mirror of
https://github.com/robonen/tools.git
synced 2026-03-20 10:54:44 +00:00
feat: update package.json exports to support new module formats and types
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import type { Component, IntrinsicElementAttributes, SetupContext } from 'vue';
|
||||
import { h } from 'vue';
|
||||
import type { AllowedComponentProps, Component, IntrinsicElementAttributes, SetupContext, VNodeProps } from 'vue';
|
||||
import { h, mergeProps } from 'vue';
|
||||
import { Slot } from './Slot';
|
||||
|
||||
type FunctionalComponentContext = Omit<SetupContext, 'expose'>;
|
||||
@@ -8,10 +8,12 @@ export interface PrimitiveProps {
|
||||
as?: keyof IntrinsicElementAttributes | Component;
|
||||
}
|
||||
|
||||
export function Primitive(props: PrimitiveProps, ctx: FunctionalComponentContext) {
|
||||
return props.as === 'template'
|
||||
? h(Slot, ctx.attrs, ctx.slots)
|
||||
: h(props.as!, ctx.attrs, ctx.slots);
|
||||
export function Primitive(props: PrimitiveProps & VNodeProps & AllowedComponentProps & Record<string, unknown>, ctx: FunctionalComponentContext) {
|
||||
const { as, ...delegatedProps } = props;
|
||||
|
||||
return as === 'template'
|
||||
? h(Slot, mergeProps(ctx.attrs, delegatedProps), ctx.slots)
|
||||
: h(as!, mergeProps(ctx.attrs, delegatedProps), ctx.slots);
|
||||
}
|
||||
|
||||
Primitive.props = {
|
||||
|
||||
Reference in New Issue
Block a user