praxis-kit 4.0.3 → 4.1.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/dist/_shared/diagnostics.d.ts +14 -17
- package/dist/{chunk-DRGZ4ZI2.js → chunk-R2RKHZNX.js} +968 -634
- package/dist/contract/index.d.ts +39 -27
- package/dist/lit/index.d.ts +42 -30
- package/dist/lit/index.js +653 -413
- package/dist/preact/index.d.ts +45 -31
- package/dist/preact/index.js +1009 -685
- package/dist/react/index.d.ts +24 -11
- package/dist/react/index.js +21 -143
- package/dist/react/legacy.d.ts +3 -3
- package/dist/react/legacy.js +28 -147
- package/dist/{merge-refs-B0YcfdtP.d.ts → react-options-XrRof248.d.ts} +156 -100
- package/dist/solid/index.d.ts +45 -31
- package/dist/solid/index.js +521 -296
- package/dist/svelte/index.d.ts +55 -34
- package/dist/svelte/index.js +504 -296
- package/dist/tailwind/index.d.ts +29 -22
- package/dist/vite-plugin/index.d.ts +10 -12
- package/dist/vue/index.d.ts +45 -31
- package/dist/vue/index.js +898 -693
- package/dist/web/index.d.ts +43 -31
- package/dist/web/index.js +652 -406
- package/package.json +3 -3
package/dist/web/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { Diagnostics, DiagnosticInput } from '../_shared/diagnostics.js';
|
|
|
3
3
|
|
|
4
4
|
type StringMap<T = unknown> = Record<string, T>;
|
|
5
5
|
type AnyRecord = StringMap<unknown>;
|
|
6
|
+
type EmptyRecord = Record<never, never>;
|
|
6
7
|
|
|
7
8
|
type IntrinsicTag = keyof HTMLElementTagNameMap;
|
|
8
9
|
|
|
@@ -13,7 +14,6 @@ type KnownAriaRole = (typeof KNOWN_ARIA_ROLES)[number];
|
|
|
13
14
|
|
|
14
15
|
type Booleanish = boolean | 'true' | 'false';
|
|
15
16
|
type ClassName = string | string[];
|
|
16
|
-
type EmptyRecord = Record<never, never>;
|
|
17
17
|
type NonEmptyArray<T> = [T, ...T[]];
|
|
18
18
|
type Numberish = number | `${number}`;
|
|
19
19
|
type Primitive = string | number | boolean;
|
|
@@ -50,34 +50,16 @@ type ValidResult = {
|
|
|
50
50
|
valid: true;
|
|
51
51
|
};
|
|
52
52
|
|
|
53
|
-
type RequireAtLeastOneIfNotEmpty<T> = keyof T extends never ? EmptyRecord : RequireAtLeastOne<T>;
|
|
54
|
-
type CompoundVariantConditionValue<V extends VariantMap, K extends keyof V> = VariantKey<V, K> | NonEmptyArray<VariantKey<V, K>>;
|
|
55
|
-
type CompoundVariantConditions<V extends VariantMap> = Simplify<{
|
|
56
|
-
[K in keyof V]: CompoundVariantConditionValue<V, K>;
|
|
57
|
-
}>;
|
|
58
|
-
type CompoundVariantRequiredConditions<V extends VariantMap> = RequireAtLeastOneIfNotEmpty<CompoundVariantConditions<V>>;
|
|
59
|
-
type CompoundVariantBase<V extends VariantMap> = keyof V extends never ? EmptyRecord : CompoundVariantRequiredConditions<V>;
|
|
60
|
-
type CompoundVariant<V extends VariantMap> = CompoundVariantBase<V> & {
|
|
61
|
-
class: VariantValue;
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
interface CVACompounds<V extends VariantMap> {
|
|
65
|
-
compoundVariants?: readonly CompoundVariant<V>[];
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
interface CVADefaults<V extends VariantMap> {
|
|
69
|
-
defaultVariants?: DefaultVariants<V>;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
interface CVAVariants<V extends VariantMap> {
|
|
73
|
-
variants?: V;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
53
|
type StringToBoolean<T> = T extends 'true' | 'false' ? boolean : T;
|
|
54
|
+
|
|
77
55
|
type VariantValue = string | string[];
|
|
56
|
+
|
|
78
57
|
type VariantStates<K extends string = string> = Record<K, VariantValue>;
|
|
58
|
+
|
|
79
59
|
type VariantMap<V extends string = string, K extends string = string> = Record<V, VariantStates<K>>;
|
|
60
|
+
|
|
80
61
|
type VariantKey<V extends VariantMap, K extends keyof V> = StringToBoolean<keyof V[K] & string>;
|
|
62
|
+
|
|
81
63
|
/**
|
|
82
64
|
* A partial selection of variant states authored at factory definition time.
|
|
83
65
|
*
|
|
@@ -87,10 +69,12 @@ type VariantKey<V extends VariantMap, K extends keyof V> = StringToBoolean<keyof
|
|
|
87
69
|
type VariantSelection<V extends VariantMap> = {
|
|
88
70
|
[K in keyof V]?: keyof V[K];
|
|
89
71
|
};
|
|
72
|
+
|
|
90
73
|
type NormalizedVariantValue<K extends string> = string extends K ? Primitive : K extends 'true' | 'false' ? Booleanish : K extends `${number}` ? Numberish : K;
|
|
91
74
|
type DefaultVariants<V extends VariantMap> = {
|
|
92
75
|
[K in keyof V]?: NormalizedVariantValue<keyof V[K] & string>;
|
|
93
76
|
};
|
|
77
|
+
|
|
94
78
|
/**
|
|
95
79
|
* A static, immutable map of named presets to partial variant selections.
|
|
96
80
|
*
|
|
@@ -98,8 +82,32 @@ type DefaultVariants<V extends VariantMap> = {
|
|
|
98
82
|
* avoiding the need to repeat variant combinations at each call site.
|
|
99
83
|
*/
|
|
100
84
|
type RecipeMap<V extends VariantMap = VariantMap> = Readonly<Record<string, VariantSelection<V>>>;
|
|
85
|
+
|
|
101
86
|
type RecipeTarget<TVariants extends VariantMap = VariantMap> = VariantSelection<TVariants>;
|
|
102
87
|
|
|
88
|
+
type RequireAtLeastOneIfNotEmpty<T> = keyof T extends never ? EmptyRecord : RequireAtLeastOne<T>;
|
|
89
|
+
type CompoundVariantConditionValue<V extends VariantMap, K extends keyof V> = VariantKey<V, K> | NonEmptyArray<VariantKey<V, K>>;
|
|
90
|
+
type CompoundVariantConditions<V extends VariantMap> = Simplify<{
|
|
91
|
+
[K in keyof V]: CompoundVariantConditionValue<V, K>;
|
|
92
|
+
}>;
|
|
93
|
+
type CompoundVariantRequiredConditions<V extends VariantMap> = RequireAtLeastOneIfNotEmpty<CompoundVariantConditions<V>>;
|
|
94
|
+
type CompoundVariantBase<V extends VariantMap> = keyof V extends never ? EmptyRecord : CompoundVariantRequiredConditions<V>;
|
|
95
|
+
type CompoundVariant<V extends VariantMap> = CompoundVariantBase<V> & {
|
|
96
|
+
class: VariantValue;
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
interface CVACompounds<V extends VariantMap> {
|
|
100
|
+
compoundVariants?: readonly CompoundVariant<V>[];
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
interface CVADefaults<V extends VariantMap> {
|
|
104
|
+
defaultVariants?: DefaultVariants<V>;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
interface CVAVariants<V extends VariantMap> {
|
|
108
|
+
variants?: V;
|
|
109
|
+
}
|
|
110
|
+
|
|
103
111
|
interface BaseClassOptions {
|
|
104
112
|
baseClassName?: ClassName;
|
|
105
113
|
}
|
|
@@ -131,7 +139,11 @@ type ClassPlugin<TProps extends AnyRecord = EmptyRecord> = Readonly<{
|
|
|
131
139
|
}>;
|
|
132
140
|
|
|
133
141
|
type ClassPluginFactory<TProps extends AnyRecord = EmptyRecord> = <V extends VariantMap>(options: ClassPipelineOptions<V>, diagnostics: Diagnostics) => ClassPlugin<TProps>;
|
|
134
|
-
|
|
142
|
+
/** `ClassPluginFactory` with its plugin-owned-props generic erased — the common form used
|
|
143
|
+
* wherever a factory's concrete plugin-props shape isn't tracked (factory generics,
|
|
144
|
+
* capability wiring). */
|
|
145
|
+
type AnyClassPluginFactory = ClassPluginFactory<AnyRecord> | undefined;
|
|
146
|
+
type ExtractPluginProps<TPlugin extends AnyClassPluginFactory> = TPlugin extends ClassPluginFactory<infer T> ? string extends keyof T ? EmptyRecord : T : EmptyRecord;
|
|
135
147
|
|
|
136
148
|
type AriaContext = {
|
|
137
149
|
readonly tag: IntrinsicTag;
|
|
@@ -191,7 +203,7 @@ type EnforcementOptions<TAllowed extends ElementType = ElementType> = {
|
|
|
191
203
|
readonly allowedAs?: readonly TAllowed[];
|
|
192
204
|
};
|
|
193
205
|
|
|
194
|
-
type StylingOptions<V extends Readonly<VariantMap> = Readonly<EmptyRecord>, TPreset extends RecipeMap<V> = Readonly<EmptyRecord>, TPlugin extends
|
|
206
|
+
type StylingOptions<V extends Readonly<VariantMap> = Readonly<EmptyRecord>, TPreset extends RecipeMap<V> = Readonly<EmptyRecord>, TPlugin extends AnyClassPluginFactory = AnyClassPluginFactory> = {
|
|
195
207
|
readonly base?: ClassName;
|
|
196
208
|
readonly variants?: V;
|
|
197
209
|
readonly defaults?: Partial<DefaultVariants<V>>;
|
|
@@ -205,8 +217,8 @@ type StylingOptions<V extends Readonly<VariantMap> = Readonly<EmptyRecord>, TPre
|
|
|
205
217
|
type NormalizeFn<Props extends AnyRecord = AnyRecord> = {
|
|
206
218
|
normalize(props: Readonly<Props & IntrinsicProps>): Props & IntrinsicProps;
|
|
207
219
|
}['normalize'];
|
|
208
|
-
type AnyFactoryOptions = FactoryOptions<ElementType, AnyRecord, VariantMap, RecipeMap<VariantMap>,
|
|
209
|
-
type FactoryOptions<TDefault extends ElementType = ElementType, Props extends AnyRecord = EmptyRecord, V extends Readonly<VariantMap> = Readonly<EmptyRecord>, TPreset extends RecipeMap<V> = Readonly<EmptyRecord>, TPlugin extends
|
|
220
|
+
type AnyFactoryOptions = FactoryOptions<ElementType, AnyRecord, VariantMap, RecipeMap<VariantMap>, AnyClassPluginFactory>;
|
|
221
|
+
type FactoryOptions<TDefault extends ElementType = ElementType, Props extends AnyRecord = EmptyRecord, V extends Readonly<VariantMap> = Readonly<EmptyRecord>, TPreset extends RecipeMap<V> = Readonly<EmptyRecord>, TPlugin extends AnyClassPluginFactory = AnyClassPluginFactory, TAllowed extends ElementType = ElementType> = {
|
|
210
222
|
readonly tag?: TDefault;
|
|
211
223
|
readonly name?: string;
|
|
212
224
|
readonly defaults?: Partial<NoInfer<Props>>;
|
|
@@ -225,11 +237,11 @@ declare function defineContractComponent<O extends FactoryOptions>(options: O):
|
|
|
225
237
|
* Identical shape to LitFactoryOptions — a plain HTMLElement subclass with
|
|
226
238
|
* no framework dependency. Light DOM only; Shadow DOM is out of scope.
|
|
227
239
|
*/
|
|
228
|
-
type WebFactoryOptions<TDefault extends ElementType = ElementType, TProps extends AnyRecord = EmptyRecord, TVariants extends Readonly<VariantMap> = Readonly<EmptyRecord>, TPreset extends RecipeMap<TVariants> = Readonly<EmptyRecord>, TPlugin extends
|
|
240
|
+
type WebFactoryOptions<TDefault extends ElementType = ElementType, TProps extends AnyRecord = EmptyRecord, TVariants extends Readonly<VariantMap> = Readonly<EmptyRecord>, TPreset extends RecipeMap<TVariants> = Readonly<EmptyRecord>, TPlugin extends AnyClassPluginFactory = AnyClassPluginFactory> = FactoryOptions<TDefault, TProps, TVariants, TPreset, TPlugin> & {
|
|
229
241
|
readonly filterProps?: FilterPredicate;
|
|
230
242
|
};
|
|
231
243
|
|
|
232
|
-
type UnknownProps =
|
|
244
|
+
type UnknownProps = AnyRecord;
|
|
233
245
|
/**
|
|
234
246
|
* Constructor type returned by createContractComponent.
|
|
235
247
|
*
|
|
@@ -277,7 +289,7 @@ type WebContractComponent<TVariants extends Readonly<VariantMap> = Readonly<Empt
|
|
|
277
289
|
* For non-reactive attributes (`aria-*`, `role`, `data-*`) call `element.update()`
|
|
278
290
|
* after setting them to trigger an explicit pipeline re-run.
|
|
279
291
|
*/
|
|
280
|
-
declare function createContractComponent<TDefault extends ElementType, TProps extends UnknownProps = EmptyRecord, TVariants extends Readonly<VariantMap> = Readonly<EmptyRecord>, TPreset extends RecipeMap<TVariants> = Readonly<EmptyRecord>, TPlugin extends
|
|
292
|
+
declare function createContractComponent<TDefault extends ElementType, TProps extends UnknownProps = EmptyRecord, TVariants extends Readonly<VariantMap> = Readonly<EmptyRecord>, TPreset extends RecipeMap<TVariants> = Readonly<EmptyRecord>, TPlugin extends AnyClassPluginFactory = AnyClassPluginFactory>(options: WebFactoryOptions<TDefault, TProps, TVariants, TPreset, TPlugin>): WebContractComponent<TVariants, ExtractPluginProps<TPlugin>>;
|
|
281
293
|
|
|
282
294
|
/**
|
|
283
295
|
* Renders a praxis-kit web component to an HTML string without requiring a DOM.
|