praxis-kit 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/dist/chunk-KDUNVQK2.js +2059 -0
- package/dist/codemod/index.d.ts +21 -0
- package/dist/codemod/index.js +241955 -0
- package/dist/eslint/index.d.ts +84 -0
- package/dist/eslint/index.js +1068 -0
- package/dist/lit/index.d.ts +304 -0
- package/dist/lit/index.js +1887 -0
- package/dist/merge-refs-CfBqh1UO.d.ts +374 -0
- package/dist/preact/index.d.ts +292 -0
- package/dist/preact/index.js +2062 -0
- package/dist/react/index.d.ts +27 -0
- package/dist/react/index.js +197 -0
- package/dist/react/legacy.d.ts +21 -0
- package/dist/react/legacy.js +209 -0
- package/dist/solid/index.d.ts +287 -0
- package/dist/solid/index.js +1837 -0
- package/dist/svelte/index.d.ts +343 -0
- package/dist/svelte/index.js +1723 -0
- package/dist/tailwind/index.d.ts +138 -0
- package/dist/tailwind/index.js +508 -0
- package/dist/ts-plugin/index.cjs +191 -0
- package/dist/ts-plugin/index.d.cts +10 -0
- package/dist/vite-plugin/index.d.ts +395 -0
- package/dist/vite-plugin/index.js +1329 -0
- package/dist/vue/index.d.ts +309 -0
- package/dist/vue/index.js +1922 -0
- package/dist/web/index.d.ts +302 -0
- package/dist/web/index.js +1858 -0
- package/package.json +176 -0
|
@@ -0,0 +1,374 @@
|
|
|
1
|
+
import { RequireAtLeastOne, Simplify, ReadonlyDeep, NonEmptyTuple } from 'type-fest';
|
|
2
|
+
import { ComponentType, PropsWithChildren, ReactElement, JSX, Ref, ReactNode } from 'react';
|
|
3
|
+
|
|
4
|
+
type AnyRecord = Record<string, unknown>;
|
|
5
|
+
|
|
6
|
+
type IntrinsicTag = keyof HTMLElementTagNameMap;
|
|
7
|
+
|
|
8
|
+
type ElementType = IntrinsicTag | (string & {});
|
|
9
|
+
|
|
10
|
+
declare const KNOWN_ARIA_ROLES: readonly ["alert", "alertdialog", "application", "article", "banner", "blockquote", "button", "caption", "cell", "checkbox", "code", "columnheader", "combobox", "complementary", "contentinfo", "definition", "deletion", "dialog", "document", "emphasis", "feed", "figure", "form", "generic", "grid", "gridcell", "group", "heading", "img", "insertion", "link", "list", "listbox", "listitem", "log", "main", "marquee", "math", "menu", "menubar", "menuitem", "menuitemcheckbox", "menuitemradio", "meter", "navigation", "none", "note", "option", "paragraph", "presentation", "progressbar", "radio", "radiogroup", "region", "row", "rowgroup", "rowheader", "scrollbar", "search", "searchbox", "separator", "slider", "spinbutton", "status", "strong", "subscript", "superscript", "switch", "tab", "table", "tablist", "tabpanel", "term", "textbox", "time", "timer", "toolbar", "tooltip", "tree", "treegrid", "treeitem"];
|
|
11
|
+
type KnownAriaRole = (typeof KNOWN_ARIA_ROLES)[number];
|
|
12
|
+
|
|
13
|
+
type AriaRole = KnownAriaRole | (string & {});
|
|
14
|
+
|
|
15
|
+
type ClassName = string | string[];
|
|
16
|
+
|
|
17
|
+
type EmptyRecord = Record<never, never>;
|
|
18
|
+
|
|
19
|
+
type IntrinsicProps = AnyRecord & {
|
|
20
|
+
role?: AriaRole;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
type NonEmptyArray<T> = [T, ...T[]];
|
|
24
|
+
|
|
25
|
+
type TagMap = Partial<Record<IntrinsicTag | (string & {}), ClassName>>;
|
|
26
|
+
|
|
27
|
+
type StrictMode = boolean | 'warn' | 'async-warn' | 'throw';
|
|
28
|
+
|
|
29
|
+
type CardinalityInput = {
|
|
30
|
+
min?: number;
|
|
31
|
+
max?: number;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
type ChildRuleMatch<T, U extends T = T> = (child: T) => child is U;
|
|
35
|
+
|
|
36
|
+
type ChildRulePosition = 'first' | 'last' | 'any';
|
|
37
|
+
|
|
38
|
+
type ChildRuleInput<T = unknown, U extends T = T> = {
|
|
39
|
+
name: string;
|
|
40
|
+
match: ChildRuleMatch<T, U>;
|
|
41
|
+
cardinality?: CardinalityInput;
|
|
42
|
+
position?: ChildRulePosition;
|
|
43
|
+
/**
|
|
44
|
+
* Optional component-type reference for O(1) dispatch index.
|
|
45
|
+
* When provided for every rule, the matcher reads child.type instead of
|
|
46
|
+
* calling every match function on every child (O(n×m) → O(n+m)).
|
|
47
|
+
*/
|
|
48
|
+
type?: unknown;
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
type ValidResult = {
|
|
52
|
+
valid: true;
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
type StringToBoolean<T> = T extends 'true' | 'false' ? boolean : T;
|
|
56
|
+
|
|
57
|
+
type VariantValue = string | string[];
|
|
58
|
+
|
|
59
|
+
type VariantStates<K extends string = string> = Record<K, VariantValue>;
|
|
60
|
+
|
|
61
|
+
type VariantMap<V extends string = string, K extends string = string> = Record<V, VariantStates<K>>;
|
|
62
|
+
|
|
63
|
+
type VariantKey<V extends VariantMap, K extends keyof V> = StringToBoolean<keyof V[K] & string>;
|
|
64
|
+
|
|
65
|
+
type RequireAtLeastOneIfNotEmpty<T> = keyof T extends never ? EmptyRecord : RequireAtLeastOne<T>;
|
|
66
|
+
type CompoundVariantConditionValue<V extends VariantMap, K extends keyof V> = VariantKey<V, K> | NonEmptyArray<VariantKey<V, K>>;
|
|
67
|
+
type CompoundVariantConditions<V extends VariantMap> = Simplify<{
|
|
68
|
+
[K in keyof V]: CompoundVariantConditionValue<V, K>;
|
|
69
|
+
}>;
|
|
70
|
+
type CompoundVariantRequiredConditions<V extends VariantMap> = RequireAtLeastOneIfNotEmpty<CompoundVariantConditions<V>>;
|
|
71
|
+
type CompoundVariantBase<V extends VariantMap> = keyof V extends never ? EmptyRecord : CompoundVariantRequiredConditions<V>;
|
|
72
|
+
type CompoundVariant<V extends VariantMap> = CompoundVariantBase<V> & {
|
|
73
|
+
class: VariantValue;
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
interface CVACompounds<V extends VariantMap> {
|
|
77
|
+
compoundVariants?: readonly CompoundVariant<V>[];
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/** The full optional prop surface exposed to callers for a given variant map. */
|
|
81
|
+
type VariantProps<V extends VariantMap> = {
|
|
82
|
+
[K in keyof V]?: VariantKey<V, K>;
|
|
83
|
+
};
|
|
84
|
+
type DefaultVariants<V extends VariantMap> = {
|
|
85
|
+
[K in keyof V]?: VariantKey<V, K>;
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
interface CVADefaults<V extends VariantMap> {
|
|
89
|
+
defaultVariants?: DefaultVariants<V>;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
interface CVAVariants<V extends VariantMap> {
|
|
93
|
+
variants?: V;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* A partial selection of variant states authored at factory definition time.
|
|
98
|
+
*
|
|
99
|
+
* Uses `keyof V[K]` directly (not `VariantKey`) so TypeScript can eagerly
|
|
100
|
+
* resolve the union at constraint-check time without deferred conditional types.
|
|
101
|
+
*/
|
|
102
|
+
type VariantSelection<V extends VariantMap> = {
|
|
103
|
+
[K in keyof V]?: keyof V[K];
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* A static, immutable map of named presets to partial variant selections.
|
|
108
|
+
*
|
|
109
|
+
* Presets are named bundles of variant props that callers activate by key,
|
|
110
|
+
* avoiding the need to repeat variant combinations at each call site.
|
|
111
|
+
*/
|
|
112
|
+
type PresetMap<V extends VariantMap = VariantMap> = Readonly<Record<string, VariantSelection<V>>>;
|
|
113
|
+
|
|
114
|
+
interface PolymorphicGenerics<TDefault extends ElementType = ElementType, Props extends AnyRecord = AnyRecord, Variants extends Readonly<VariantMap> = Readonly<VariantMap>, TPreset extends PresetMap<Variants> = Readonly<EmptyRecord>, TAllowed extends ElementType = ElementType> {
|
|
115
|
+
default: TDefault;
|
|
116
|
+
props: Props;
|
|
117
|
+
variants: Variants;
|
|
118
|
+
preset: TPreset;
|
|
119
|
+
allowed: TAllowed;
|
|
120
|
+
}
|
|
121
|
+
type VariantsOf<T extends PolymorphicGenerics> = T['variants'];
|
|
122
|
+
type PresetOf<T extends PolymorphicGenerics> = T['preset'];
|
|
123
|
+
type AllowedOf<T extends PolymorphicGenerics> = T['allowed'];
|
|
124
|
+
|
|
125
|
+
type PresetTarget<TVariants extends VariantMap = VariantMap> = VariantSelection<TVariants>;
|
|
126
|
+
|
|
127
|
+
interface BaseClassOptions {
|
|
128
|
+
baseClassName?: ClassName;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
type ClassPipelineFn = (tag: unknown, props: AnyRecord, className?: ClassName, variantKey?: string) => string;
|
|
132
|
+
|
|
133
|
+
interface PresetOptions<TVariants extends VariantMap = VariantMap> {
|
|
134
|
+
presetMap?: Record<string, PresetTarget<TVariants>>;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
interface TagMapOptions {
|
|
138
|
+
tagMap?: TagMap;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
type CompositionOptions<TVariants extends VariantMap = VariantMap> = Simplify<TagMapOptions & PresetOptions<TVariants>>;
|
|
142
|
+
|
|
143
|
+
type CVASystemOptions<TVariants extends VariantMap = VariantMap> = Simplify<CVAVariants<TVariants> & CVADefaults<TVariants> & CVACompounds<TVariants>>;
|
|
144
|
+
|
|
145
|
+
type StyleOptions<TVariants extends VariantMap = VariantMap> = Simplify<BaseClassOptions & CVASystemOptions<TVariants>>;
|
|
146
|
+
|
|
147
|
+
type ClassPipelineOptions<TVariants extends VariantMap = VariantMap> = Simplify<StyleOptions<TVariants> & CompositionOptions<TVariants>>;
|
|
148
|
+
|
|
149
|
+
type OwnedPropKeys = ReadonlySet<string>;
|
|
150
|
+
|
|
151
|
+
type ClassPlugin<TProps extends AnyRecord = EmptyRecord> = Readonly<{
|
|
152
|
+
pipeline: ClassPipelineFn;
|
|
153
|
+
ownedKeys?: OwnedPropKeys;
|
|
154
|
+
readonly _pluginProps?: TProps;
|
|
155
|
+
}>;
|
|
156
|
+
|
|
157
|
+
type ClassPluginFactory<TProps extends AnyRecord = EmptyRecord> = <V extends VariantMap>(options: ClassPipelineOptions<V>, strict: StrictMode) => ClassPlugin<TProps>;
|
|
158
|
+
|
|
159
|
+
type AriaContext = {
|
|
160
|
+
readonly tag: IntrinsicTag;
|
|
161
|
+
readonly implicitRole: AriaRole | undefined;
|
|
162
|
+
readonly effectiveRole: string | undefined;
|
|
163
|
+
readonly props: ReadonlyDeep<IntrinsicProps>;
|
|
164
|
+
};
|
|
165
|
+
|
|
166
|
+
type RemoveAttributeFixKind = `removeAttribute:${string}`;
|
|
167
|
+
type InjectLiveFixKind = `injectLive:${string}`;
|
|
168
|
+
type FixKind = 'removeRole' | 'setRole' | 'normalizeRelevantAll' | RemoveAttributeFixKind | InjectLiveFixKind;
|
|
169
|
+
|
|
170
|
+
type AriaFixResult = {
|
|
171
|
+
applied: false;
|
|
172
|
+
next: ReadonlyDeep<IntrinsicProps>;
|
|
173
|
+
} | {
|
|
174
|
+
applied: true;
|
|
175
|
+
next: ReadonlyDeep<IntrinsicProps>;
|
|
176
|
+
previous: ReadonlyDeep<IntrinsicProps>;
|
|
177
|
+
};
|
|
178
|
+
type AriaFix = {
|
|
179
|
+
readonly kind: FixKind;
|
|
180
|
+
readonly priority?: number;
|
|
181
|
+
readonly source?: string;
|
|
182
|
+
readonly apply: (context: AriaContext) => AriaFixResult;
|
|
183
|
+
};
|
|
184
|
+
|
|
185
|
+
type Severity = 'error' | 'warning' | (string & {});
|
|
186
|
+
|
|
187
|
+
type AriaInvalidBase<M extends string = string> = {
|
|
188
|
+
valid: false;
|
|
189
|
+
severity: Severity;
|
|
190
|
+
message: M;
|
|
191
|
+
attribute?: string;
|
|
192
|
+
};
|
|
193
|
+
type AriaInvalidWithFix<M extends string = string> = AriaInvalidBase<M> & {
|
|
194
|
+
fixable: true;
|
|
195
|
+
fix: AriaFix;
|
|
196
|
+
};
|
|
197
|
+
type AriaInvalidWithoutFix<M extends string = string> = AriaInvalidBase<M> & {
|
|
198
|
+
fixable: false;
|
|
199
|
+
};
|
|
200
|
+
type AriaInvalidResult<M extends string = string> = AriaInvalidWithFix<M> | AriaInvalidWithoutFix<M>;
|
|
201
|
+
type AriaResult = ValidResult | AriaInvalidResult;
|
|
202
|
+
|
|
203
|
+
type AriaRule<C extends AriaContext = AriaContext> = (context: C) => readonly AriaResult[];
|
|
204
|
+
|
|
205
|
+
type PropNormalizer = (props: Readonly<AnyRecord & IntrinsicProps>) => Partial<AnyRecord & IntrinsicProps>;
|
|
206
|
+
|
|
207
|
+
type EnforcementOptions<TAllowed extends ElementType = ElementType> = {
|
|
208
|
+
readonly strict?: StrictMode;
|
|
209
|
+
readonly aria?: readonly AriaRule[];
|
|
210
|
+
readonly children?: readonly ChildRuleInput[];
|
|
211
|
+
readonly props?: readonly PropNormalizer[];
|
|
212
|
+
/** Restricts the `as` prop to this set of tags. Violations route through strict mode. */
|
|
213
|
+
readonly allowedAs?: readonly TAllowed[];
|
|
214
|
+
};
|
|
215
|
+
|
|
216
|
+
type StylingOptions<V extends Readonly<VariantMap> = Readonly<EmptyRecord>, TPreset extends PresetMap<V> = Readonly<EmptyRecord>, TPluginProps extends AnyRecord = EmptyRecord> = {
|
|
217
|
+
readonly base?: ClassName;
|
|
218
|
+
readonly variants?: V;
|
|
219
|
+
readonly defaults?: Partial<VariantProps<V>>;
|
|
220
|
+
readonly compounds?: readonly CompoundVariant<V>[];
|
|
221
|
+
readonly presets?: TPreset;
|
|
222
|
+
readonly tags?: Readonly<TagMap>;
|
|
223
|
+
readonly plugin?: ClassPluginFactory<TPluginProps>;
|
|
224
|
+
readonly precomputedClasses?: Readonly<Record<string, string>>;
|
|
225
|
+
};
|
|
226
|
+
|
|
227
|
+
type NormalizeFn<Props extends AnyRecord = AnyRecord> = {
|
|
228
|
+
normalize(props: Readonly<Props & IntrinsicProps>): Props & IntrinsicProps;
|
|
229
|
+
}['normalize'];
|
|
230
|
+
type FactoryOptions<TDefault extends ElementType = ElementType, Props extends AnyRecord = EmptyRecord, V extends Readonly<VariantMap> = Readonly<EmptyRecord>, TPreset extends PresetMap<V> = Readonly<EmptyRecord>, TPluginProps extends AnyRecord = EmptyRecord, TAllowed extends ElementType = ElementType> = {
|
|
231
|
+
readonly tag?: TDefault;
|
|
232
|
+
readonly name?: string;
|
|
233
|
+
readonly defaults?: Partial<NoInfer<Props>>;
|
|
234
|
+
readonly normalize?: NormalizeFn<NoInfer<Props>>;
|
|
235
|
+
readonly styling?: StylingOptions<V, TPreset, TPluginProps>;
|
|
236
|
+
readonly enforcement?: EnforcementOptions<TAllowed>;
|
|
237
|
+
};
|
|
238
|
+
|
|
239
|
+
declare const disabledProps: PropNormalizer;
|
|
240
|
+
|
|
241
|
+
declare const invalidProps: PropNormalizer;
|
|
242
|
+
|
|
243
|
+
type DefaultOf<T extends PolymorphicGenerics> = T['default'];
|
|
244
|
+
type PropsOf<T extends PolymorphicGenerics> = T['props'];
|
|
245
|
+
|
|
246
|
+
type UnknownProps = Record<string, unknown>;
|
|
247
|
+
type SlotComponent = ComponentType<UnknownProps>;
|
|
248
|
+
|
|
249
|
+
/**
|
|
250
|
+
* Props passed to the `render` callback — the component's resolved className,
|
|
251
|
+
* filtered own props, and ref. Spread these onto the target element.
|
|
252
|
+
*
|
|
253
|
+
* Typed loosely to accommodate any element tag the user chooses.
|
|
254
|
+
*/
|
|
255
|
+
type RenderCallbackProps = Readonly<Record<string, unknown>>;
|
|
256
|
+
|
|
257
|
+
/**
|
|
258
|
+
* Extends FactoryOptions with React-specific configuration.
|
|
259
|
+
* slotComponent is intentionally not in core — it is a React rendering concern.
|
|
260
|
+
*/
|
|
261
|
+
type ReactFactoryOptions<TDefault extends ElementType, Props extends UnknownProps, Variants extends Readonly<VariantMap>, TPreset extends PresetMap<Variants> = Readonly<EmptyRecord>, TPluginProps extends AnyRecord = EmptyRecord, TAllowed extends ElementType = ElementType> = FactoryOptions<TDefault, Props, Variants, TPreset, TPluginProps, TAllowed> & {
|
|
262
|
+
/** Component used to render the asChild slot. Defaults to the built-in Slot. */
|
|
263
|
+
slotComponent?: SlotComponent;
|
|
264
|
+
/**
|
|
265
|
+
* Return true for any prop key that should be consumed but not forwarded to the DOM.
|
|
266
|
+
* The adapter strips nothing by default — implementations decide what is safe to drop.
|
|
267
|
+
* Receives `runtime.options.variantKeys` as a convenience if needed.
|
|
268
|
+
*/
|
|
269
|
+
filterProps?: (key: string, variantKeys: ReadonlySet<string>) => boolean;
|
|
270
|
+
};
|
|
271
|
+
|
|
272
|
+
type SlottableProps = PropsWithChildren;
|
|
273
|
+
declare function Slottable({ children }: SlottableProps): ReactElement;
|
|
274
|
+
|
|
275
|
+
/** Maps a core ElementType to its DOM instance type for ref inference. */
|
|
276
|
+
type ElementRef<T extends ElementType> = T extends IntrinsicTag ? HTMLElementTagNameMap[T] : unknown;
|
|
277
|
+
/** @internal React JSX intrinsic props for a given element type. */
|
|
278
|
+
type IntrinsicJSXProps<T extends ElementType> = T extends IntrinsicTag ? JSX.IntrinsicElements[T] : UnknownProps;
|
|
279
|
+
/**
|
|
280
|
+
* @internal
|
|
281
|
+
* Removes index signatures (e.g. `[key: string]: T`) from a type, keeping only
|
|
282
|
+
* explicitly named properties. Used to prevent fallback-to-constraint generics
|
|
283
|
+
* like `Record<string, unknown>` or `Readonly<VariantMap>` from producing a
|
|
284
|
+
* `[key: string]: T` member that makes `keyof` resolve to `string` — which
|
|
285
|
+
* would cause `Omit<IntrinsicJSXProps<TAs>, string>` to remove all HTML props.
|
|
286
|
+
*/
|
|
287
|
+
type StripIndexSignature<T> = {
|
|
288
|
+
[K in keyof T as string extends K ? never : K]: T[K];
|
|
289
|
+
};
|
|
290
|
+
type ComponentProps<G extends PolymorphicGenerics> = StripIndexSignature<PropsOf<G>>;
|
|
291
|
+
type ComponentVariants<G extends PolymorphicGenerics> = StripIndexSignature<VariantProps<VariantsOf<G>>>;
|
|
292
|
+
type OwnedProps<G extends PolymorphicGenerics> = ComponentProps<G> & ComponentVariants<G>;
|
|
293
|
+
/**
|
|
294
|
+
* @internal
|
|
295
|
+
* Polymorphic machinery props. Separated from `OwnedProps` so the two concerns
|
|
296
|
+
* are distinct: user-defined props vs. the tag/ref/class system.
|
|
297
|
+
*
|
|
298
|
+
* `asChild` and `children` are excluded — typed separately in the discriminated
|
|
299
|
+
* union below so each render mode can enforce different child constraints.
|
|
300
|
+
*/
|
|
301
|
+
type PolymorphicControlProps<G extends PolymorphicGenerics, TAs extends ElementType> = {
|
|
302
|
+
as?: TAs & AllowedOf<G>;
|
|
303
|
+
className?: ClassName | undefined;
|
|
304
|
+
variantKey?: keyof PresetOf<G>;
|
|
305
|
+
ref?: Ref<ElementRef<TAs>>;
|
|
306
|
+
};
|
|
307
|
+
/** @internal Full set of props owned by the component — used as the Omit key in IntrinsicPropsWithoutOwned. */
|
|
308
|
+
type ControlProps<G extends PolymorphicGenerics, TAs extends ElementType> = OwnedProps<G> & PolymorphicControlProps<G, TAs>;
|
|
309
|
+
type IntrinsicPropsWithoutOwned<G extends PolymorphicGenerics, TAs extends ElementType> = Omit<IntrinsicJSXProps<TAs>, keyof ControlProps<G, TAs> | 'children'>;
|
|
310
|
+
type SharedProps<G extends PolymorphicGenerics, TAs extends ElementType> = IntrinsicPropsWithoutOwned<G, TAs> & ControlProps<G, TAs>;
|
|
311
|
+
/** Discriminant for the normal render path: `asChild` absent or false, any children. */
|
|
312
|
+
type NormalRenderMode = {
|
|
313
|
+
asChild?: false;
|
|
314
|
+
children?: ReactNode | undefined;
|
|
315
|
+
};
|
|
316
|
+
/**
|
|
317
|
+
* Discriminant for the slot render path. One or more `ReactElement` children required.
|
|
318
|
+
* `as` is forbidden — combining `as` with `asChild` is a runtime invariant violation.
|
|
319
|
+
*/
|
|
320
|
+
type SlotRenderMode = {
|
|
321
|
+
asChild: true;
|
|
322
|
+
as?: never;
|
|
323
|
+
children: ReactElement | NonEmptyTuple<ReactElement>;
|
|
324
|
+
};
|
|
325
|
+
/**
|
|
326
|
+
* Discriminant for the render-prop path. The callback receives all resolved props
|
|
327
|
+
* (className, ref, filtered component props) and returns the target element.
|
|
328
|
+
*
|
|
329
|
+
* This is the output form for the compile-time `asChild` transform: keeps the same
|
|
330
|
+
* rendering flexibility as `asChild` without the `cloneElement` cost at runtime.
|
|
331
|
+
* Unlike `asChild`, the render callback does not auto-merge conflicting event
|
|
332
|
+
* handlers — spread position determines precedence.
|
|
333
|
+
*
|
|
334
|
+
* ```tsx
|
|
335
|
+
* <Button render={(p) => <a href="/home" {...p} />} size="lg" />
|
|
336
|
+
* ```
|
|
337
|
+
*/
|
|
338
|
+
type CallbackRenderMode = {
|
|
339
|
+
render: (props: RenderCallbackProps) => ReactElement;
|
|
340
|
+
asChild?: never;
|
|
341
|
+
children?: never;
|
|
342
|
+
};
|
|
343
|
+
/**
|
|
344
|
+
* Props for the normal render path. HTML attributes are inferred from `TAs`.
|
|
345
|
+
*
|
|
346
|
+
* `Omit + intersection` (not `Merge`) is used so TypeScript can infer `TAs` from
|
|
347
|
+
* the `as` prop value; control props win on key conflicts.
|
|
348
|
+
*/
|
|
349
|
+
type PolymorphicProps<G extends PolymorphicGenerics, TAs extends ElementType = DefaultOf<G>> = Simplify<SharedProps<G, TAs> & NormalRenderMode>;
|
|
350
|
+
/**
|
|
351
|
+
* Props for the slot render path (`asChild: true`). One or more `ReactElement`
|
|
352
|
+
* children are required. Multiple children are permitted for the Slottable
|
|
353
|
+
* sibling pattern where one child is a `<Slottable>` wrapper.
|
|
354
|
+
*/
|
|
355
|
+
type PolymorphicWithAsChild<G extends PolymorphicGenerics, TAs extends ElementType = DefaultOf<G>> = Simplify<SharedProps<G, TAs> & SlotRenderMode>;
|
|
356
|
+
type PolymorphicWithRender<G extends PolymorphicGenerics, TAs extends ElementType = DefaultOf<G>> = Simplify<SharedProps<G, TAs> & CallbackRenderMode>;
|
|
357
|
+
/**
|
|
358
|
+
* A polymorphic component that infers HTML attributes and ref type from the `as` prop.
|
|
359
|
+
*
|
|
360
|
+
* Three call signatures form a discriminated union:
|
|
361
|
+
* - `render` present → render-prop path; no Slot or cloneElement at runtime
|
|
362
|
+
* - `asChild: true` → slot path; exactly one `ReactElement` child required
|
|
363
|
+
* - `asChild?: false` → normal path; any `ReactNode` children accepted
|
|
364
|
+
*/
|
|
365
|
+
type PolymorphicComponent<G extends PolymorphicGenerics> = {
|
|
366
|
+
<TAs extends ElementType = DefaultOf<G>>(props: PolymorphicWithRender<G, TAs>): ReactElement;
|
|
367
|
+
<TAs extends ElementType = DefaultOf<G>>(props: PolymorphicWithAsChild<G, TAs>): ReactElement;
|
|
368
|
+
<TAs extends ElementType = DefaultOf<G>>(props: PolymorphicProps<G, TAs>): ReactElement;
|
|
369
|
+
displayName?: string;
|
|
370
|
+
};
|
|
371
|
+
|
|
372
|
+
declare function mergeRefs<T>(...refs: (Ref<T> | null | undefined)[]): Ref<T> | null;
|
|
373
|
+
|
|
374
|
+
export { type AnyRecord as A, type ElementType as E, type FactoryOptions as F, type PresetMap as P, type ReactFactoryOptions as R, Slottable as S, type UnknownProps as U, type VariantMap as V, type EmptyRecord as a, type PolymorphicComponent as b, type PolymorphicGenerics as c, type ElementRef as d, type PolymorphicProps as e, type PolymorphicWithAsChild as f, type PolymorphicWithRender as g, type RenderCallbackProps as h, type SlottableProps as i, disabledProps as j, invalidProps as k, mergeRefs as m };
|
|
@@ -0,0 +1,292 @@
|
|
|
1
|
+
import { RequireAtLeastOne, Simplify, ReadonlyDeep, OmitIndexSignature } from 'type-fest';
|
|
2
|
+
import { VNode, ComponentType, JSX, Ref, ComponentChildren } from 'preact';
|
|
3
|
+
|
|
4
|
+
type AnyRecord = Record<string, unknown>;
|
|
5
|
+
|
|
6
|
+
type IntrinsicTag = keyof HTMLElementTagNameMap;
|
|
7
|
+
|
|
8
|
+
type ElementType = IntrinsicTag | (string & {});
|
|
9
|
+
|
|
10
|
+
declare const KNOWN_ARIA_ROLES: readonly ["alert", "alertdialog", "application", "article", "banner", "blockquote", "button", "caption", "cell", "checkbox", "code", "columnheader", "combobox", "complementary", "contentinfo", "definition", "deletion", "dialog", "document", "emphasis", "feed", "figure", "form", "generic", "grid", "gridcell", "group", "heading", "img", "insertion", "link", "list", "listbox", "listitem", "log", "main", "marquee", "math", "menu", "menubar", "menuitem", "menuitemcheckbox", "menuitemradio", "meter", "navigation", "none", "note", "option", "paragraph", "presentation", "progressbar", "radio", "radiogroup", "region", "row", "rowgroup", "rowheader", "scrollbar", "search", "searchbox", "separator", "slider", "spinbutton", "status", "strong", "subscript", "superscript", "switch", "tab", "table", "tablist", "tabpanel", "term", "textbox", "time", "timer", "toolbar", "tooltip", "tree", "treegrid", "treeitem"];
|
|
11
|
+
type KnownAriaRole = (typeof KNOWN_ARIA_ROLES)[number];
|
|
12
|
+
|
|
13
|
+
type AriaRole = KnownAriaRole | (string & {});
|
|
14
|
+
|
|
15
|
+
type ClassName = string | string[];
|
|
16
|
+
|
|
17
|
+
type EmptyRecord = Record<never, never>;
|
|
18
|
+
|
|
19
|
+
type IntrinsicProps = AnyRecord & {
|
|
20
|
+
role?: AriaRole;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
type NonEmptyArray<T> = [T, ...T[]];
|
|
24
|
+
|
|
25
|
+
type TagMap = Partial<Record<IntrinsicTag | (string & {}), ClassName>>;
|
|
26
|
+
|
|
27
|
+
type StrictMode = boolean | 'warn' | 'async-warn' | 'throw';
|
|
28
|
+
|
|
29
|
+
type CardinalityInput = {
|
|
30
|
+
min?: number;
|
|
31
|
+
max?: number;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
type ChildRuleMatch<T, U extends T = T> = (child: T) => child is U;
|
|
35
|
+
|
|
36
|
+
type ChildRulePosition = 'first' | 'last' | 'any';
|
|
37
|
+
|
|
38
|
+
type ChildRuleInput<T = unknown, U extends T = T> = {
|
|
39
|
+
name: string;
|
|
40
|
+
match: ChildRuleMatch<T, U>;
|
|
41
|
+
cardinality?: CardinalityInput;
|
|
42
|
+
position?: ChildRulePosition;
|
|
43
|
+
/**
|
|
44
|
+
* Optional component-type reference for O(1) dispatch index.
|
|
45
|
+
* When provided for every rule, the matcher reads child.type instead of
|
|
46
|
+
* calling every match function on every child (O(n×m) → O(n+m)).
|
|
47
|
+
*/
|
|
48
|
+
type?: unknown;
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
type ValidResult = {
|
|
52
|
+
valid: true;
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
type StringToBoolean<T> = T extends 'true' | 'false' ? boolean : T;
|
|
56
|
+
|
|
57
|
+
type VariantValue = string | string[];
|
|
58
|
+
|
|
59
|
+
type VariantStates<K extends string = string> = Record<K, VariantValue>;
|
|
60
|
+
|
|
61
|
+
type VariantMap<V extends string = string, K extends string = string> = Record<V, VariantStates<K>>;
|
|
62
|
+
|
|
63
|
+
type VariantKey<V extends VariantMap, K extends keyof V> = StringToBoolean<keyof V[K] & string>;
|
|
64
|
+
|
|
65
|
+
type RequireAtLeastOneIfNotEmpty<T> = keyof T extends never ? EmptyRecord : RequireAtLeastOne<T>;
|
|
66
|
+
type CompoundVariantConditionValue<V extends VariantMap, K extends keyof V> = VariantKey<V, K> | NonEmptyArray<VariantKey<V, K>>;
|
|
67
|
+
type CompoundVariantConditions<V extends VariantMap> = Simplify<{
|
|
68
|
+
[K in keyof V]: CompoundVariantConditionValue<V, K>;
|
|
69
|
+
}>;
|
|
70
|
+
type CompoundVariantRequiredConditions<V extends VariantMap> = RequireAtLeastOneIfNotEmpty<CompoundVariantConditions<V>>;
|
|
71
|
+
type CompoundVariantBase<V extends VariantMap> = keyof V extends never ? EmptyRecord : CompoundVariantRequiredConditions<V>;
|
|
72
|
+
type CompoundVariant<V extends VariantMap> = CompoundVariantBase<V> & {
|
|
73
|
+
class: VariantValue;
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
interface CVACompounds<V extends VariantMap> {
|
|
77
|
+
compoundVariants?: readonly CompoundVariant<V>[];
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/** The full optional prop surface exposed to callers for a given variant map. */
|
|
81
|
+
type VariantProps<V extends VariantMap> = {
|
|
82
|
+
[K in keyof V]?: VariantKey<V, K>;
|
|
83
|
+
};
|
|
84
|
+
type DefaultVariants<V extends VariantMap> = {
|
|
85
|
+
[K in keyof V]?: VariantKey<V, K>;
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
interface CVADefaults<V extends VariantMap> {
|
|
89
|
+
defaultVariants?: DefaultVariants<V>;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
interface CVAVariants<V extends VariantMap> {
|
|
93
|
+
variants?: V;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* A partial selection of variant states authored at factory definition time.
|
|
98
|
+
*
|
|
99
|
+
* Uses `keyof V[K]` directly (not `VariantKey`) so TypeScript can eagerly
|
|
100
|
+
* resolve the union at constraint-check time without deferred conditional types.
|
|
101
|
+
*/
|
|
102
|
+
type VariantSelection<V extends VariantMap> = {
|
|
103
|
+
[K in keyof V]?: keyof V[K];
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* A static, immutable map of named presets to partial variant selections.
|
|
108
|
+
*
|
|
109
|
+
* Presets are named bundles of variant props that callers activate by key,
|
|
110
|
+
* avoiding the need to repeat variant combinations at each call site.
|
|
111
|
+
*/
|
|
112
|
+
type PresetMap<V extends VariantMap = VariantMap> = Readonly<Record<string, VariantSelection<V>>>;
|
|
113
|
+
|
|
114
|
+
interface PolymorphicGenerics<TDefault extends ElementType = ElementType, Props extends AnyRecord = AnyRecord, Variants extends Readonly<VariantMap> = Readonly<VariantMap>, TPreset extends PresetMap<Variants> = Readonly<EmptyRecord>, TAllowed extends ElementType = ElementType> {
|
|
115
|
+
default: TDefault;
|
|
116
|
+
props: Props;
|
|
117
|
+
variants: Variants;
|
|
118
|
+
preset: TPreset;
|
|
119
|
+
allowed: TAllowed;
|
|
120
|
+
}
|
|
121
|
+
type VariantsOf<T extends PolymorphicGenerics> = T['variants'];
|
|
122
|
+
type PresetOf<T extends PolymorphicGenerics> = T['preset'];
|
|
123
|
+
|
|
124
|
+
type PresetTarget<TVariants extends VariantMap = VariantMap> = VariantSelection<TVariants>;
|
|
125
|
+
|
|
126
|
+
interface BaseClassOptions {
|
|
127
|
+
baseClassName?: ClassName;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
type ClassPipelineFn = (tag: unknown, props: AnyRecord, className?: ClassName, variantKey?: string) => string;
|
|
131
|
+
|
|
132
|
+
interface PresetOptions<TVariants extends VariantMap = VariantMap> {
|
|
133
|
+
presetMap?: Record<string, PresetTarget<TVariants>>;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
interface TagMapOptions {
|
|
137
|
+
tagMap?: TagMap;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
type CompositionOptions<TVariants extends VariantMap = VariantMap> = Simplify<TagMapOptions & PresetOptions<TVariants>>;
|
|
141
|
+
|
|
142
|
+
type CVASystemOptions<TVariants extends VariantMap = VariantMap> = Simplify<CVAVariants<TVariants> & CVADefaults<TVariants> & CVACompounds<TVariants>>;
|
|
143
|
+
|
|
144
|
+
type StyleOptions<TVariants extends VariantMap = VariantMap> = Simplify<BaseClassOptions & CVASystemOptions<TVariants>>;
|
|
145
|
+
|
|
146
|
+
type ClassPipelineOptions<TVariants extends VariantMap = VariantMap> = Simplify<StyleOptions<TVariants> & CompositionOptions<TVariants>>;
|
|
147
|
+
|
|
148
|
+
type OwnedPropKeys = ReadonlySet<string>;
|
|
149
|
+
|
|
150
|
+
type ClassPlugin<TProps extends AnyRecord = EmptyRecord> = Readonly<{
|
|
151
|
+
pipeline: ClassPipelineFn;
|
|
152
|
+
ownedKeys?: OwnedPropKeys;
|
|
153
|
+
readonly _pluginProps?: TProps;
|
|
154
|
+
}>;
|
|
155
|
+
|
|
156
|
+
type ClassPluginFactory<TProps extends AnyRecord = EmptyRecord> = <V extends VariantMap>(options: ClassPipelineOptions<V>, strict: StrictMode) => ClassPlugin<TProps>;
|
|
157
|
+
|
|
158
|
+
type AriaContext = {
|
|
159
|
+
readonly tag: IntrinsicTag;
|
|
160
|
+
readonly implicitRole: AriaRole | undefined;
|
|
161
|
+
readonly effectiveRole: string | undefined;
|
|
162
|
+
readonly props: ReadonlyDeep<IntrinsicProps>;
|
|
163
|
+
};
|
|
164
|
+
|
|
165
|
+
type RemoveAttributeFixKind = `removeAttribute:${string}`;
|
|
166
|
+
type InjectLiveFixKind = `injectLive:${string}`;
|
|
167
|
+
type FixKind = 'removeRole' | 'setRole' | 'normalizeRelevantAll' | RemoveAttributeFixKind | InjectLiveFixKind;
|
|
168
|
+
|
|
169
|
+
type AriaFixResult = {
|
|
170
|
+
applied: false;
|
|
171
|
+
next: ReadonlyDeep<IntrinsicProps>;
|
|
172
|
+
} | {
|
|
173
|
+
applied: true;
|
|
174
|
+
next: ReadonlyDeep<IntrinsicProps>;
|
|
175
|
+
previous: ReadonlyDeep<IntrinsicProps>;
|
|
176
|
+
};
|
|
177
|
+
type AriaFix = {
|
|
178
|
+
readonly kind: FixKind;
|
|
179
|
+
readonly priority?: number;
|
|
180
|
+
readonly source?: string;
|
|
181
|
+
readonly apply: (context: AriaContext) => AriaFixResult;
|
|
182
|
+
};
|
|
183
|
+
|
|
184
|
+
type Severity = 'error' | 'warning' | (string & {});
|
|
185
|
+
|
|
186
|
+
type AriaInvalidBase<M extends string = string> = {
|
|
187
|
+
valid: false;
|
|
188
|
+
severity: Severity;
|
|
189
|
+
message: M;
|
|
190
|
+
attribute?: string;
|
|
191
|
+
};
|
|
192
|
+
type AriaInvalidWithFix<M extends string = string> = AriaInvalidBase<M> & {
|
|
193
|
+
fixable: true;
|
|
194
|
+
fix: AriaFix;
|
|
195
|
+
};
|
|
196
|
+
type AriaInvalidWithoutFix<M extends string = string> = AriaInvalidBase<M> & {
|
|
197
|
+
fixable: false;
|
|
198
|
+
};
|
|
199
|
+
type AriaInvalidResult<M extends string = string> = AriaInvalidWithFix<M> | AriaInvalidWithoutFix<M>;
|
|
200
|
+
type AriaResult = ValidResult | AriaInvalidResult;
|
|
201
|
+
|
|
202
|
+
type AriaRule<C extends AriaContext = AriaContext> = (context: C) => readonly AriaResult[];
|
|
203
|
+
|
|
204
|
+
type PropNormalizer = (props: Readonly<AnyRecord & IntrinsicProps>) => Partial<AnyRecord & IntrinsicProps>;
|
|
205
|
+
|
|
206
|
+
type EnforcementOptions<TAllowed extends ElementType = ElementType> = {
|
|
207
|
+
readonly strict?: StrictMode;
|
|
208
|
+
readonly aria?: readonly AriaRule[];
|
|
209
|
+
readonly children?: readonly ChildRuleInput[];
|
|
210
|
+
readonly props?: readonly PropNormalizer[];
|
|
211
|
+
/** Restricts the `as` prop to this set of tags. Violations route through strict mode. */
|
|
212
|
+
readonly allowedAs?: readonly TAllowed[];
|
|
213
|
+
};
|
|
214
|
+
|
|
215
|
+
type StylingOptions<V extends Readonly<VariantMap> = Readonly<EmptyRecord>, TPreset extends PresetMap<V> = Readonly<EmptyRecord>, TPluginProps extends AnyRecord = EmptyRecord> = {
|
|
216
|
+
readonly base?: ClassName;
|
|
217
|
+
readonly variants?: V;
|
|
218
|
+
readonly defaults?: Partial<VariantProps<V>>;
|
|
219
|
+
readonly compounds?: readonly CompoundVariant<V>[];
|
|
220
|
+
readonly presets?: TPreset;
|
|
221
|
+
readonly tags?: Readonly<TagMap>;
|
|
222
|
+
readonly plugin?: ClassPluginFactory<TPluginProps>;
|
|
223
|
+
readonly precomputedClasses?: Readonly<Record<string, string>>;
|
|
224
|
+
};
|
|
225
|
+
|
|
226
|
+
type NormalizeFn<Props extends AnyRecord = AnyRecord> = {
|
|
227
|
+
normalize(props: Readonly<Props & IntrinsicProps>): Props & IntrinsicProps;
|
|
228
|
+
}['normalize'];
|
|
229
|
+
type FactoryOptions<TDefault extends ElementType = ElementType, Props extends AnyRecord = EmptyRecord, V extends Readonly<VariantMap> = Readonly<EmptyRecord>, TPreset extends PresetMap<V> = Readonly<EmptyRecord>, TPluginProps extends AnyRecord = EmptyRecord, TAllowed extends ElementType = ElementType> = {
|
|
230
|
+
readonly tag?: TDefault;
|
|
231
|
+
readonly name?: string;
|
|
232
|
+
readonly defaults?: Partial<NoInfer<Props>>;
|
|
233
|
+
readonly normalize?: NormalizeFn<NoInfer<Props>>;
|
|
234
|
+
readonly styling?: StylingOptions<V, TPreset, TPluginProps>;
|
|
235
|
+
readonly enforcement?: EnforcementOptions<TAllowed>;
|
|
236
|
+
};
|
|
237
|
+
|
|
238
|
+
declare const disabledProps: PropNormalizer;
|
|
239
|
+
|
|
240
|
+
declare const invalidProps: PropNormalizer;
|
|
241
|
+
|
|
242
|
+
type DefaultOf<T extends PolymorphicGenerics> = T['default'];
|
|
243
|
+
type PropsOf<T extends PolymorphicGenerics> = T['props'];
|
|
244
|
+
|
|
245
|
+
type UnknownProps = Record<string, unknown>;
|
|
246
|
+
type SlotComponent = ComponentType<UnknownProps>;
|
|
247
|
+
type AnyVNode = VNode<any>;
|
|
248
|
+
|
|
249
|
+
type PreactFactoryOptions<TDefault extends ElementType, Props extends UnknownProps, Variants extends Readonly<VariantMap>, TPreset extends PresetMap<Variants> = Readonly<EmptyRecord>, TPluginProps extends AnyRecord = EmptyRecord> = FactoryOptions<TDefault, Props, Variants, TPreset, TPluginProps> & {
|
|
250
|
+
/** Component used to render the asChild slot. Defaults to the built-in Slot. */
|
|
251
|
+
slotComponent?: SlotComponent;
|
|
252
|
+
/**
|
|
253
|
+
* Return true for any prop key that should be consumed but not forwarded to the DOM.
|
|
254
|
+
* Receives `runtime.options.variantKeys` as a convenience if needed.
|
|
255
|
+
*/
|
|
256
|
+
filterProps?: (key: string, variantKeys: ReadonlySet<string>) => boolean;
|
|
257
|
+
};
|
|
258
|
+
|
|
259
|
+
type ElementRef<T extends ElementType> = T extends IntrinsicTag ? HTMLElementTagNameMap[T] : unknown;
|
|
260
|
+
type IntrinsicJSXProps<T extends ElementType> = T extends IntrinsicTag ? JSX.IntrinsicElements[T] : UnknownProps;
|
|
261
|
+
type ControlProps<G extends PolymorphicGenerics, TAs extends ElementType> = OmitIndexSignature<PropsOf<G>> & OmitIndexSignature<VariantProps<VariantsOf<G>>> & {
|
|
262
|
+
as?: TAs;
|
|
263
|
+
className?: ClassName | undefined;
|
|
264
|
+
variantKey?: keyof PresetOf<G>;
|
|
265
|
+
ref?: Ref<ElementRef<TAs>>;
|
|
266
|
+
};
|
|
267
|
+
type SharedProps<G extends PolymorphicGenerics, TAs extends ElementType> = Omit<IntrinsicJSXProps<TAs>, keyof ControlProps<G, TAs> | 'children'> & ControlProps<G, TAs>;
|
|
268
|
+
type PolymorphicProps<G extends PolymorphicGenerics, TAs extends ElementType = DefaultOf<G>> = Simplify<SharedProps<G, TAs> & {
|
|
269
|
+
asChild?: false;
|
|
270
|
+
children?: unknown;
|
|
271
|
+
}>;
|
|
272
|
+
type PolymorphicWithAsChild<G extends PolymorphicGenerics, TAs extends ElementType = DefaultOf<G>> = Simplify<SharedProps<G, TAs> & {
|
|
273
|
+
asChild: true;
|
|
274
|
+
as?: never;
|
|
275
|
+
children: AnyVNode | AnyVNode[];
|
|
276
|
+
}>;
|
|
277
|
+
type PolymorphicComponent<G extends PolymorphicGenerics> = {
|
|
278
|
+
<TAs extends ElementType = DefaultOf<G>>(props: PolymorphicWithAsChild<G, TAs>): AnyVNode;
|
|
279
|
+
<TAs extends ElementType = DefaultOf<G>>(props: PolymorphicProps<G, TAs>): AnyVNode;
|
|
280
|
+
displayName?: string;
|
|
281
|
+
};
|
|
282
|
+
|
|
283
|
+
declare function createContractComponent<TDefault extends ElementType, Props extends UnknownProps = EmptyRecord, Variants extends Readonly<VariantMap> = Readonly<EmptyRecord>, TPreset extends PresetMap<Variants> = Readonly<EmptyRecord>, TPluginProps extends AnyRecord = EmptyRecord>(options: PreactFactoryOptions<TDefault, Props, Variants, TPreset, TPluginProps>): PolymorphicComponent<PolymorphicGenerics<TDefault, Props & TPluginProps, Variants, TPreset>>;
|
|
284
|
+
|
|
285
|
+
declare function defineContractComponent<O extends FactoryOptions>(options: O): <R>(factory: (options: O) => R) => R;
|
|
286
|
+
|
|
287
|
+
type SlottableProps = {
|
|
288
|
+
children?: ComponentChildren;
|
|
289
|
+
};
|
|
290
|
+
declare function Slottable({ children }: SlottableProps): AnyVNode;
|
|
291
|
+
|
|
292
|
+
export { type ElementRef, type PolymorphicComponent, type PolymorphicProps, type PolymorphicWithAsChild, type PreactFactoryOptions, Slottable, createContractComponent, defineContractComponent, disabledProps, invalidProps };
|