eefd7abf83
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.
27 lines
745 B
TypeScript
27 lines
745 B
TypeScript
import type { AllowedComponentProps, Component, IntrinsicElementAttributes, SetupContext, VNodeProps } from 'vue';
|
|
import { h } from 'vue';
|
|
import { renderSlotChild } from './Slot';
|
|
|
|
type FunctionalComponentContext = Omit<SetupContext, 'expose'>;
|
|
|
|
export interface PrimitiveProps {
|
|
as?: keyof IntrinsicElementAttributes | Component;
|
|
}
|
|
|
|
export function Primitive(props: PrimitiveProps & VNodeProps & AllowedComponentProps & Record<string, unknown>, ctx: FunctionalComponentContext) {
|
|
const as = props.as;
|
|
|
|
return as === 'template'
|
|
? renderSlotChild(ctx.slots, ctx.attrs)
|
|
: h(as!, ctx.attrs, ctx.slots);
|
|
}
|
|
|
|
Primitive.inheritAttrs = false;
|
|
|
|
Primitive.props = {
|
|
as: {
|
|
type: [String, Object],
|
|
default: 'div' as const,
|
|
},
|
|
};
|