praxis-kit 3.1.1 → 4.0.1
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/README.md +141 -126
- package/dist/chunk-TJRHF6MS.js +2777 -0
- package/dist/codemod/index.js +20 -20
- package/dist/contract/index.d.ts +164 -37
- package/dist/contract/index.js +158 -1190
- package/dist/eslint/index.js +403 -178
- package/dist/lit/index.d.ts +164 -37
- package/dist/lit/index.js +1384 -747
- package/dist/{merge-refs-BKyE8h8M.d.ts → merge-refs-CEpa0zK1.d.ts} +208 -49
- package/dist/preact/index.d.ts +177 -52
- package/dist/preact/index.js +1686 -1025
- package/dist/react/index.d.ts +19 -11
- package/dist/react/index.js +115 -116
- package/dist/react/legacy.d.ts +3 -11
- package/dist/react/legacy.js +116 -136
- package/dist/solid/index.d.ts +171 -46
- package/dist/solid/index.js +1476 -706
- package/dist/svelte/index.d.ts +177 -50
- package/dist/svelte/index.js +1407 -725
- package/dist/tailwind/index.d.ts +231 -5
- package/dist/tailwind/index.js +366 -90
- package/dist/ts-plugin/index.cjs +5 -5
- package/dist/vite-plugin/index.d.ts +228 -121
- package/dist/vite-plugin/index.js +568 -347
- package/dist/vue/index.d.ts +181 -56
- package/dist/vue/index.js +1701 -926
- package/dist/web/index.d.ts +167 -40
- package/dist/web/index.js +1369 -732
- package/package.json +5 -4
- package/dist/chunk-6RJN5B6L.js +0 -2221
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { RequireAtLeastOne, Simplify, ReadonlyDeep, NonEmptyTuple } from 'type-fest';
|
|
2
1
|
import { ComponentType, PropsWithChildren, ReactElement, JSX, Ref, ReactNode } from 'react';
|
|
2
|
+
import { Except, RequireAtLeastOne, Simplify, ReadonlyDeep, NonEmptyTuple } from 'type-fest';
|
|
3
3
|
|
|
4
|
-
type
|
|
4
|
+
type StringMap<T = unknown> = Record<string, T>;
|
|
5
|
+
type AnyRecord = StringMap<unknown>;
|
|
5
6
|
|
|
6
7
|
type IntrinsicTag = keyof HTMLElementTagNameMap;
|
|
7
8
|
|
|
@@ -10,32 +11,176 @@ type ElementType = IntrinsicTag | (string & {});
|
|
|
10
11
|
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
12
|
type KnownAriaRole = (typeof KNOWN_ARIA_ROLES)[number];
|
|
12
13
|
|
|
13
|
-
type AriaRole = KnownAriaRole | (string & {});
|
|
14
|
-
|
|
15
14
|
type Booleanish = boolean | 'true' | 'false';
|
|
16
|
-
|
|
17
15
|
type ClassName = string | string[];
|
|
18
|
-
|
|
19
16
|
type EmptyRecord = Record<never, never>;
|
|
20
|
-
|
|
17
|
+
type NonEmptyArray<T> = [T, ...T[]];
|
|
18
|
+
type Numberish = number | `${number}`;
|
|
19
|
+
type Primitive = string | number | boolean;
|
|
20
|
+
type AriaRole = KnownAriaRole | (string & {});
|
|
21
21
|
type IntrinsicProps = AnyRecord & {
|
|
22
22
|
role?: AriaRole;
|
|
23
23
|
};
|
|
24
|
+
type TagMap = Partial<Record<IntrinsicTag | (string & {}), ClassName>>;
|
|
24
25
|
|
|
25
|
-
|
|
26
|
+
declare enum DiagnosticCategory {
|
|
27
|
+
Contract = 0,
|
|
28
|
+
HTML = 1,
|
|
29
|
+
ARIA = 2,
|
|
30
|
+
Composition = 3,
|
|
31
|
+
Rendering = 4,
|
|
32
|
+
Accessibility = 5,
|
|
33
|
+
Performance = 6,
|
|
34
|
+
Internal = 7,
|
|
35
|
+
Deprecation = 8,
|
|
36
|
+
Lint = 9
|
|
37
|
+
}
|
|
26
38
|
|
|
27
|
-
|
|
39
|
+
declare enum DiagnosticCode {
|
|
40
|
+
MissingRequiredChild = "COMP1001",
|
|
41
|
+
InvalidParent = "COMP1002",
|
|
42
|
+
InvalidChild = "COMP1003",
|
|
43
|
+
UnexpectedChild = "COMP1004",
|
|
44
|
+
AmbiguousChild = "COMP1005",
|
|
45
|
+
CardinalityMin = "COMP1006",
|
|
46
|
+
CardinalityMax = "COMP1007",
|
|
47
|
+
PositionViolation = "COMP1008",
|
|
48
|
+
AllowedAsViolation = "COMP1009",
|
|
49
|
+
SlotExclusive = "SLOT1001",
|
|
50
|
+
SlotSingleChild = "SLOT1002",
|
|
51
|
+
SlotDiscardedChildren = "SLOT1003",
|
|
52
|
+
SlotRenderFn = "SLOT1004",
|
|
53
|
+
MissingAriaRelationship = "ARIA2001",
|
|
54
|
+
AriaViolation = "ARIA2002",
|
|
55
|
+
AriaAttributeInvalid = "ARIA2003",
|
|
56
|
+
AriaMissingLiveRegion = "ARIA2004",
|
|
57
|
+
AriaMissingAtomic = "ARIA2005",
|
|
58
|
+
AriaRelevantInvalidToken = "ARIA2006",
|
|
59
|
+
AriaRelevantSuperseded = "ARIA2007",
|
|
60
|
+
AriaInvalidRole = "ARIA2008",
|
|
61
|
+
AriaMissingAccessibleName = "ARIA2009",
|
|
62
|
+
AriaAttributeOnPresentational = "ARIA2010",
|
|
63
|
+
AriaHiddenOnFocusable = "ARIA2011",
|
|
64
|
+
AriaRequiredProperty = "ARIA2012",
|
|
65
|
+
AriaInvalidAttributeValue = "ARIA2013",
|
|
66
|
+
AriaRedundantLevelAttribute = "ARIA2014",
|
|
67
|
+
InvalidHeadingHierarchy = "HTML3001",
|
|
68
|
+
HtmlEmptyRole = "HTML3002",
|
|
69
|
+
HtmlImplicitRoleRedundant = "HTML3003",
|
|
70
|
+
HtmlImplicitRoleOverride = "HTML3004",
|
|
71
|
+
HtmlStandaloneRegionOverride = "HTML3005",
|
|
72
|
+
HtmlLandmarkRoleOverride = "HTML3006",
|
|
73
|
+
HtmlInvalidChild = "HTML3007",
|
|
74
|
+
InvalidRenderingTarget = "RENDER4001",
|
|
75
|
+
LintDeadCompoundKey = "LINT5001",
|
|
76
|
+
LintDeadCompoundValue = "LINT5002",
|
|
77
|
+
LintDeadCompoundNonLiteral = "LINT5003",
|
|
78
|
+
LintMissingStrict = "LINT5004",
|
|
79
|
+
LintInvalidDefaultKey = "LINT5005",
|
|
80
|
+
LintInvalidDefaultValue = "LINT5006",
|
|
81
|
+
LintInvalidDefaultNonLiteral = "LINT5007",
|
|
82
|
+
LintNegativeMin = "LINT5008",
|
|
83
|
+
LintNegativeMax = "LINT5009",
|
|
84
|
+
LintMaxLessThanMin = "LINT5010",
|
|
85
|
+
LintZeroMax = "LINT5011",
|
|
86
|
+
LintMultipleFirst = "LINT5012",
|
|
87
|
+
LintMultipleLast = "LINT5013",
|
|
88
|
+
LintMinSumExceedsCapacity = "LINT5014",
|
|
89
|
+
LintCardinalityViolation = "LINT5015",
|
|
90
|
+
LintAriaTagOverride = "LINT5016",
|
|
91
|
+
ContractUnknownVariantDim = "COMP1010",
|
|
92
|
+
ContractUnknownVariantValue = "COMP1011",
|
|
93
|
+
ContractUnknownRecipeKey = "COMP1012",
|
|
94
|
+
ContractInvalidVariantValue = "COMP1013",
|
|
95
|
+
TailwindMultipleDisplayProps = "CSS6001",
|
|
96
|
+
TailwindReservedLayoutLiteral = "CSS6002",
|
|
97
|
+
TailwindDeadVariantClass = "CSS6003",
|
|
98
|
+
PluginInvalidShape = "PLUGIN7001",
|
|
99
|
+
PluginPipelineReturnType = "PLUGIN7002",
|
|
100
|
+
InternalError = "INTERNAL9000"
|
|
101
|
+
}
|
|
28
102
|
|
|
29
|
-
type
|
|
103
|
+
type MetadataMap = AnyRecord;
|
|
104
|
+
type NodeId = string;
|
|
30
105
|
|
|
31
|
-
|
|
106
|
+
interface Diagnostic$1 {
|
|
107
|
+
code: string;
|
|
108
|
+
message: string;
|
|
109
|
+
severity: 'error' | 'warning' | 'info';
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
type CapabilityMap = StringMap<boolean>;
|
|
113
|
+
|
|
114
|
+
interface SourcePosition {
|
|
115
|
+
line: number;
|
|
116
|
+
col: number;
|
|
117
|
+
}
|
|
118
|
+
interface SourceLocation {
|
|
119
|
+
file: string;
|
|
120
|
+
start: SourcePosition;
|
|
121
|
+
end?: SourcePosition;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
declare enum Severity$1 {
|
|
125
|
+
Debug = 0,
|
|
126
|
+
Info = 1,
|
|
127
|
+
Warning = 2,
|
|
128
|
+
Error = 3,
|
|
129
|
+
Fatal = 4
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
interface DiagnosticSuggestion {
|
|
133
|
+
title: string;
|
|
134
|
+
description?: string;
|
|
135
|
+
fix?: string;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
type Context = AnyRecord;
|
|
139
|
+
type Metadata = AnyRecord;
|
|
140
|
+
interface Diagnostic {
|
|
141
|
+
code: DiagnosticCode;
|
|
142
|
+
severity: Severity$1;
|
|
143
|
+
category: DiagnosticCategory;
|
|
144
|
+
message: string;
|
|
145
|
+
rationale?: string;
|
|
146
|
+
component?: string;
|
|
147
|
+
contract?: string;
|
|
148
|
+
location?: SourceLocation;
|
|
149
|
+
suggestions?: DiagnosticSuggestion[];
|
|
150
|
+
context?: Context;
|
|
151
|
+
metadata?: Metadata;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
declare enum Enforcement {
|
|
155
|
+
Ignore = 0,
|
|
156
|
+
Report = 1,
|
|
157
|
+
Throw = 2
|
|
158
|
+
}
|
|
159
|
+
interface DiagnosticPolicy {
|
|
160
|
+
resolve(diagnostic: Diagnostic): Enforcement;
|
|
161
|
+
}
|
|
32
162
|
|
|
33
|
-
|
|
163
|
+
interface DiagnosticReporter {
|
|
164
|
+
report(diagnostic: Diagnostic): void;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
type DiagnosticInput = Except<Diagnostic, 'severity'>;
|
|
168
|
+
declare class Diagnostics {
|
|
169
|
+
private readonly reporter;
|
|
170
|
+
private readonly policy;
|
|
171
|
+
readonly active: boolean;
|
|
172
|
+
constructor(reporter: DiagnosticReporter, policy?: DiagnosticPolicy);
|
|
173
|
+
report(diagnostic: Diagnostic): Diagnostic;
|
|
174
|
+
warn(input: DiagnosticInput): Diagnostic;
|
|
175
|
+
error(input: DiagnosticInput): Diagnostic;
|
|
176
|
+
info(input: DiagnosticInput): Diagnostic;
|
|
177
|
+
}
|
|
34
178
|
|
|
35
|
-
type
|
|
36
|
-
min
|
|
37
|
-
max
|
|
179
|
+
type MinMax = {
|
|
180
|
+
min: number;
|
|
181
|
+
max: number;
|
|
38
182
|
};
|
|
183
|
+
type CardinalityInput = Partial<MinMax>;
|
|
39
184
|
|
|
40
185
|
type ChildRuleMatch<T, U extends T = T> = (child: T) => child is U;
|
|
41
186
|
|
|
@@ -58,16 +203,6 @@ type ValidResult = {
|
|
|
58
203
|
valid: true;
|
|
59
204
|
};
|
|
60
205
|
|
|
61
|
-
type StringToBoolean<T> = T extends 'true' | 'false' ? boolean : T;
|
|
62
|
-
|
|
63
|
-
type VariantValue$1 = string | string[];
|
|
64
|
-
|
|
65
|
-
type VariantStates<K extends string = string> = Record<K, VariantValue$1>;
|
|
66
|
-
|
|
67
|
-
type VariantMap<V extends string = string, K extends string = string> = Record<V, VariantStates<K>>;
|
|
68
|
-
|
|
69
|
-
type VariantKey<V extends VariantMap, K extends keyof V> = StringToBoolean<keyof V[K] & string>;
|
|
70
|
-
|
|
71
206
|
type RequireAtLeastOneIfNotEmpty<T> = keyof T extends never ? EmptyRecord : RequireAtLeastOne<T>;
|
|
72
207
|
type CompoundVariantConditionValue<V extends VariantMap, K extends keyof V> = VariantKey<V, K> | NonEmptyArray<VariantKey<V, K>>;
|
|
73
208
|
type CompoundVariantConditions<V extends VariantMap> = Simplify<{
|
|
@@ -76,22 +211,13 @@ type CompoundVariantConditions<V extends VariantMap> = Simplify<{
|
|
|
76
211
|
type CompoundVariantRequiredConditions<V extends VariantMap> = RequireAtLeastOneIfNotEmpty<CompoundVariantConditions<V>>;
|
|
77
212
|
type CompoundVariantBase<V extends VariantMap> = keyof V extends never ? EmptyRecord : CompoundVariantRequiredConditions<V>;
|
|
78
213
|
type CompoundVariant<V extends VariantMap> = CompoundVariantBase<V> & {
|
|
79
|
-
class: VariantValue
|
|
214
|
+
class: VariantValue;
|
|
80
215
|
};
|
|
81
216
|
|
|
82
217
|
interface CVACompounds<V extends VariantMap> {
|
|
83
218
|
compoundVariants?: readonly CompoundVariant<V>[];
|
|
84
219
|
}
|
|
85
220
|
|
|
86
|
-
/** The full optional prop surface exposed to callers for a given variant map. */
|
|
87
|
-
type VariantProps<V extends VariantMap> = {
|
|
88
|
-
[K in keyof V]?: VariantKey<V, K>;
|
|
89
|
-
};
|
|
90
|
-
type VariantValue<K extends string> = string extends K ? Primitive : K extends 'true' | 'false' ? Booleanish : K extends `${number}` ? Numberish : K;
|
|
91
|
-
type DefaultVariants<V extends VariantMap> = {
|
|
92
|
-
[K in keyof V]?: VariantValue<keyof V[K] & string>;
|
|
93
|
-
};
|
|
94
|
-
|
|
95
221
|
interface CVADefaults<V extends VariantMap> {
|
|
96
222
|
defaultVariants?: DefaultVariants<V>;
|
|
97
223
|
}
|
|
@@ -100,6 +226,11 @@ interface CVAVariants<V extends VariantMap> {
|
|
|
100
226
|
variants?: V;
|
|
101
227
|
}
|
|
102
228
|
|
|
229
|
+
type StringToBoolean<T> = T extends 'true' | 'false' ? boolean : T;
|
|
230
|
+
type VariantValue = string | string[];
|
|
231
|
+
type VariantStates<K extends string = string> = Record<K, VariantValue>;
|
|
232
|
+
type VariantMap<V extends string = string, K extends string = string> = Record<V, VariantStates<K>>;
|
|
233
|
+
type VariantKey<V extends VariantMap, K extends keyof V> = StringToBoolean<keyof V[K] & string>;
|
|
103
234
|
/**
|
|
104
235
|
* A partial selection of variant states authored at factory definition time.
|
|
105
236
|
*
|
|
@@ -109,7 +240,14 @@ interface CVAVariants<V extends VariantMap> {
|
|
|
109
240
|
type VariantSelection<V extends VariantMap> = {
|
|
110
241
|
[K in keyof V]?: keyof V[K];
|
|
111
242
|
};
|
|
112
|
-
|
|
243
|
+
/** The full optional prop surface exposed to callers for a given variant map. */
|
|
244
|
+
type VariantProps<V extends VariantMap> = {
|
|
245
|
+
[K in keyof V]?: VariantKey<V, K>;
|
|
246
|
+
};
|
|
247
|
+
type NormalizedVariantValue<K extends string> = string extends K ? Primitive : K extends 'true' | 'false' ? Booleanish : K extends `${number}` ? Numberish : K;
|
|
248
|
+
type DefaultVariants<V extends VariantMap> = {
|
|
249
|
+
[K in keyof V]?: NormalizedVariantValue<keyof V[K] & string>;
|
|
250
|
+
};
|
|
113
251
|
/**
|
|
114
252
|
* A static, immutable map of named presets to partial variant selections.
|
|
115
253
|
*
|
|
@@ -117,7 +255,7 @@ type VariantSelection<V extends VariantMap> = {
|
|
|
117
255
|
* avoiding the need to repeat variant combinations at each call site.
|
|
118
256
|
*/
|
|
119
257
|
type RecipeMap<V extends VariantMap = VariantMap> = Readonly<Record<string, VariantSelection<V>>>;
|
|
120
|
-
|
|
258
|
+
type RecipeTarget<TVariants extends VariantMap = VariantMap> = VariantSelection<TVariants>;
|
|
121
259
|
interface PolymorphicGenerics<TDefault extends ElementType = ElementType, Props extends AnyRecord = AnyRecord, Variants extends Readonly<VariantMap> = Readonly<VariantMap>, TPreset extends RecipeMap<Variants> = Readonly<EmptyRecord>, TAllowed extends ElementType = ElementType> {
|
|
122
260
|
default: TDefault;
|
|
123
261
|
props: Props;
|
|
@@ -128,8 +266,8 @@ interface PolymorphicGenerics<TDefault extends ElementType = ElementType, Props
|
|
|
128
266
|
type VariantsOf<T extends PolymorphicGenerics> = T['variants'];
|
|
129
267
|
type RecipeOf<T extends PolymorphicGenerics> = T['preset'];
|
|
130
268
|
type AllowedOf<T extends PolymorphicGenerics> = T['allowed'];
|
|
131
|
-
|
|
132
|
-
type
|
|
269
|
+
type DefaultOf<T extends PolymorphicGenerics> = T['default'];
|
|
270
|
+
type PropsOf<T extends PolymorphicGenerics> = T['props'];
|
|
133
271
|
|
|
134
272
|
interface BaseClassOptions {
|
|
135
273
|
baseClassName?: ClassName;
|
|
@@ -161,7 +299,7 @@ type ClassPlugin<TProps extends AnyRecord = EmptyRecord> = Readonly<{
|
|
|
161
299
|
readonly _pluginProps?: TProps;
|
|
162
300
|
}>;
|
|
163
301
|
|
|
164
|
-
type ClassPluginFactory<TProps extends AnyRecord = EmptyRecord> = <V extends VariantMap>(options: ClassPipelineOptions<V>,
|
|
302
|
+
type ClassPluginFactory<TProps extends AnyRecord = EmptyRecord> = <V extends VariantMap>(options: ClassPipelineOptions<V>, diagnostics: Diagnostics) => ClassPlugin<TProps>;
|
|
165
303
|
type ExtractPluginProps<TPlugin extends ClassPluginFactory<AnyRecord> | undefined> = TPlugin extends ClassPluginFactory<infer T> ? string extends keyof T ? EmptyRecord : T : EmptyRecord;
|
|
166
304
|
|
|
167
305
|
type AriaContext = {
|
|
@@ -195,8 +333,9 @@ type Severity = 'error' | 'warning' | (string & {});
|
|
|
195
333
|
type AriaInvalidBase<M extends string = string> = {
|
|
196
334
|
valid: false;
|
|
197
335
|
severity: Severity;
|
|
198
|
-
message
|
|
336
|
+
message?: M;
|
|
199
337
|
attribute?: string;
|
|
338
|
+
diagnostic?: DiagnosticInput;
|
|
200
339
|
};
|
|
201
340
|
type AriaInvalidWithFix<M extends string = string> = AriaInvalidBase<M> & {
|
|
202
341
|
fixable: true;
|
|
@@ -213,11 +352,11 @@ type AriaRule<C extends AriaContext = AriaContext> = (context: C) => readonly Ar
|
|
|
213
352
|
type PropNormalizer = (props: Readonly<AnyRecord & IntrinsicProps>) => Partial<AnyRecord & IntrinsicProps>;
|
|
214
353
|
|
|
215
354
|
type EnforcementOptions<TAllowed extends ElementType = ElementType> = {
|
|
216
|
-
readonly
|
|
355
|
+
readonly diagnostics?: Diagnostics;
|
|
217
356
|
readonly aria?: readonly AriaRule[];
|
|
218
357
|
readonly children?: readonly ChildRuleInput[];
|
|
219
358
|
readonly props?: readonly PropNormalizer[];
|
|
220
|
-
/** Restricts the `as` prop to this set of tags. Violations route through
|
|
359
|
+
/** Restricts the `as` prop to this set of tags. Violations route through diagnostics. */
|
|
221
360
|
readonly allowedAs?: readonly TAllowed[];
|
|
222
361
|
};
|
|
223
362
|
|
|
@@ -245,11 +384,21 @@ type FactoryOptions<TDefault extends ElementType = ElementType, Props extends An
|
|
|
245
384
|
readonly enforcement?: EnforcementOptions<TAllowed>;
|
|
246
385
|
};
|
|
247
386
|
|
|
248
|
-
type DefaultOf<T extends PolymorphicGenerics> = T['default'];
|
|
249
|
-
type PropsOf<T extends PolymorphicGenerics> = T['props'];
|
|
250
|
-
|
|
251
387
|
declare function defineContractComponent<O extends FactoryOptions>(options: O): <R>(factory: (options: O) => R) => R;
|
|
252
388
|
|
|
389
|
+
interface ComponentIdentity {
|
|
390
|
+
id: NodeId;
|
|
391
|
+
name: string;
|
|
392
|
+
tag: string;
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
interface ComponentDefinition {
|
|
396
|
+
identity: ComponentIdentity;
|
|
397
|
+
capabilities: CapabilityMap;
|
|
398
|
+
metadata: MetadataMap;
|
|
399
|
+
diagnostics: Diagnostic$1[];
|
|
400
|
+
}
|
|
401
|
+
|
|
253
402
|
type UnknownProps = Record<string, unknown>;
|
|
254
403
|
type SlotComponent = ComponentType<UnknownProps>;
|
|
255
404
|
|
|
@@ -261,6 +410,16 @@ type SlotComponent = ComponentType<UnknownProps>;
|
|
|
261
410
|
*/
|
|
262
411
|
type RenderCallbackProps = Readonly<Record<string, unknown>>;
|
|
263
412
|
|
|
413
|
+
type SlottableProps = PropsWithChildren;
|
|
414
|
+
declare function Slottable({ children }: SlottableProps): ReactElement;
|
|
415
|
+
|
|
416
|
+
/** Structural subset of `CompiledComponentArtifact` consumed by the React adapter. */
|
|
417
|
+
interface CompiledArtifact {
|
|
418
|
+
readonly definition: ComponentDefinition;
|
|
419
|
+
readonly precomputed?: {
|
|
420
|
+
readonly variantLookup?: Record<string, string>;
|
|
421
|
+
};
|
|
422
|
+
}
|
|
264
423
|
/**
|
|
265
424
|
* Extends FactoryOptions with React-specific configuration.
|
|
266
425
|
* slotComponent is intentionally not in core — it is a React rendering concern.
|
|
@@ -274,11 +433,11 @@ type ReactFactoryOptions<TDefault extends ElementType, Props extends UnknownProp
|
|
|
274
433
|
* Receives `runtime.options.variantKeys` as a convenience if needed.
|
|
275
434
|
*/
|
|
276
435
|
filterProps?: (key: string, variantKeys: ReadonlySet<string>) => boolean;
|
|
436
|
+
/** Pre-compiled artifact from `@praxis-kit/runtime`'s compiler. When provided, replaces the stub
|
|
437
|
+
* definition and enables the precomputed variant lookup fast path. */
|
|
438
|
+
artifact?: CompiledArtifact;
|
|
277
439
|
};
|
|
278
440
|
|
|
279
|
-
type SlottableProps = PropsWithChildren;
|
|
280
|
-
declare function Slottable({ children }: SlottableProps): ReactElement;
|
|
281
|
-
|
|
282
441
|
/** Maps a core ElementType to its DOM instance type for ref inference. */
|
|
283
442
|
type ElementRef<T extends ElementType> = T extends IntrinsicTag ? HTMLElementTagNameMap[T] : unknown;
|
|
284
443
|
/** @internal React JSX intrinsic props for a given element type. */
|