feat(primitives): media-editor components, category reorg, perf + type cleanup
Reorganize components into category folders (forms/canvas/overlays/etc.); add the media-editor headless family (timeline, curve-editor, waveform, crop, color picker, etc.); apply perf fixes (O(1) collection lookups, plain-object drag state, gesture-leak teardown, shallowRef color state, rect caching) and replace source `any` with proper types.
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
<script lang="ts">
|
||||
import type { PrimitiveProps } from '../../internal/primitive';
|
||||
|
||||
/**
|
||||
* The visible label of a `SelectItem`. Its text is what the root captures to
|
||||
* show in `SelectValue` once the item is chosen, so each item should contain
|
||||
* exactly one; use inside a `SelectItem`.
|
||||
*/
|
||||
export interface SelectItemTextProps extends PrimitiveProps {}
|
||||
</script>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { watchPostEffect } from 'vue';
|
||||
|
||||
import { useForwardExpose } from '@robonen/vue';
|
||||
import { Primitive } from '../../internal/primitive';
|
||||
import { useSelectItemContext } from './context';
|
||||
|
||||
const { as = 'span' } = defineProps<SelectItemTextProps>();
|
||||
|
||||
const { forwardRef, currentElement } = useForwardExpose();
|
||||
const itemCtx = useSelectItemContext();
|
||||
|
||||
watchPostEffect(() => {
|
||||
itemCtx.onItemTextChange(currentElement.value);
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Primitive
|
||||
:ref="forwardRef"
|
||||
:as="as"
|
||||
:id="itemCtx.textId.value"
|
||||
>
|
||||
<slot />
|
||||
</Primitive>
|
||||
</template>
|
||||
Reference in New Issue
Block a user