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/preact/index.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ import { ComponentChildren, VNode, ComponentType, JSX, Ref } from 'preact';
|
|
|
4
4
|
|
|
5
5
|
type StringMap<T = unknown> = Record<string, T>;
|
|
6
6
|
type AnyRecord = StringMap<unknown>;
|
|
7
|
+
type EmptyRecord = Record<never, never>;
|
|
7
8
|
|
|
8
9
|
type IntrinsicTag = keyof HTMLElementTagNameMap;
|
|
9
10
|
|
|
@@ -14,7 +15,6 @@ type KnownAriaRole = (typeof KNOWN_ARIA_ROLES)[number];
|
|
|
14
15
|
|
|
15
16
|
type Booleanish = boolean | 'true' | 'false';
|
|
16
17
|
type ClassName = string | string[];
|
|
17
|
-
type EmptyRecord = Record<never, never>;
|
|
18
18
|
type NonEmptyArray<T> = [T, ...T[]];
|
|
19
19
|
type Numberish = number | `${number}`;
|
|
20
20
|
type Primitive = string | number | boolean;
|
|
@@ -51,34 +51,16 @@ type ValidResult = {
|
|
|
51
51
|
valid: true;
|
|
52
52
|
};
|
|
53
53
|
|
|
54
|
-
type RequireAtLeastOneIfNotEmpty<T> = keyof T extends never ? EmptyRecord : RequireAtLeastOne<T>;
|
|
55
|
-
type CompoundVariantConditionValue<V extends VariantMap, K extends keyof V> = VariantKey<V, K> | NonEmptyArray<VariantKey<V, K>>;
|
|
56
|
-
type CompoundVariantConditions<V extends VariantMap> = Simplify<{
|
|
57
|
-
[K in keyof V]: CompoundVariantConditionValue<V, K>;
|
|
58
|
-
}>;
|
|
59
|
-
type CompoundVariantRequiredConditions<V extends VariantMap> = RequireAtLeastOneIfNotEmpty<CompoundVariantConditions<V>>;
|
|
60
|
-
type CompoundVariantBase<V extends VariantMap> = keyof V extends never ? EmptyRecord : CompoundVariantRequiredConditions<V>;
|
|
61
|
-
type CompoundVariant<V extends VariantMap> = CompoundVariantBase<V> & {
|
|
62
|
-
class: VariantValue;
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
interface CVACompounds<V extends VariantMap> {
|
|
66
|
-
compoundVariants?: readonly CompoundVariant<V>[];
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
interface CVADefaults<V extends VariantMap> {
|
|
70
|
-
defaultVariants?: DefaultVariants<V>;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
interface CVAVariants<V extends VariantMap> {
|
|
74
|
-
variants?: V;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
54
|
type StringToBoolean<T> = T extends 'true' | 'false' ? boolean : T;
|
|
55
|
+
|
|
78
56
|
type VariantValue = string | string[];
|
|
57
|
+
|
|
79
58
|
type VariantStates<K extends string = string> = Record<K, VariantValue>;
|
|
59
|
+
|
|
80
60
|
type VariantMap<V extends string = string, K extends string = string> = Record<V, VariantStates<K>>;
|
|
61
|
+
|
|
81
62
|
type VariantKey<V extends VariantMap, K extends keyof V> = StringToBoolean<keyof V[K] & string>;
|
|
63
|
+
|
|
82
64
|
/**
|
|
83
65
|
* A partial selection of variant states authored at factory definition time.
|
|
84
66
|
*
|
|
@@ -88,14 +70,17 @@ type VariantKey<V extends VariantMap, K extends keyof V> = StringToBoolean<keyof
|
|
|
88
70
|
type VariantSelection<V extends VariantMap> = {
|
|
89
71
|
[K in keyof V]?: keyof V[K];
|
|
90
72
|
};
|
|
73
|
+
|
|
91
74
|
/** The full optional prop surface exposed to callers for a given variant map. */
|
|
92
75
|
type VariantProps<V extends VariantMap> = {
|
|
93
76
|
[K in keyof V]?: VariantKey<V, K>;
|
|
94
77
|
};
|
|
78
|
+
|
|
95
79
|
type NormalizedVariantValue<K extends string> = string extends K ? Primitive : K extends 'true' | 'false' ? Booleanish : K extends `${number}` ? Numberish : K;
|
|
96
80
|
type DefaultVariants<V extends VariantMap> = {
|
|
97
81
|
[K in keyof V]?: NormalizedVariantValue<keyof V[K] & string>;
|
|
98
82
|
};
|
|
83
|
+
|
|
99
84
|
/**
|
|
100
85
|
* A static, immutable map of named presets to partial variant selections.
|
|
101
86
|
*
|
|
@@ -103,7 +88,9 @@ type DefaultVariants<V extends VariantMap> = {
|
|
|
103
88
|
* avoiding the need to repeat variant combinations at each call site.
|
|
104
89
|
*/
|
|
105
90
|
type RecipeMap<V extends VariantMap = VariantMap> = Readonly<Record<string, VariantSelection<V>>>;
|
|
91
|
+
|
|
106
92
|
type RecipeTarget<TVariants extends VariantMap = VariantMap> = VariantSelection<TVariants>;
|
|
93
|
+
|
|
107
94
|
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> {
|
|
108
95
|
default: TDefault;
|
|
109
96
|
props: Props;
|
|
@@ -116,6 +103,29 @@ type RecipeOf<T extends PolymorphicGenerics> = T['preset'];
|
|
|
116
103
|
type DefaultOf<T extends PolymorphicGenerics> = T['default'];
|
|
117
104
|
type PropsOf<T extends PolymorphicGenerics> = T['props'];
|
|
118
105
|
|
|
106
|
+
type RequireAtLeastOneIfNotEmpty<T> = keyof T extends never ? EmptyRecord : RequireAtLeastOne<T>;
|
|
107
|
+
type CompoundVariantConditionValue<V extends VariantMap, K extends keyof V> = VariantKey<V, K> | NonEmptyArray<VariantKey<V, K>>;
|
|
108
|
+
type CompoundVariantConditions<V extends VariantMap> = Simplify<{
|
|
109
|
+
[K in keyof V]: CompoundVariantConditionValue<V, K>;
|
|
110
|
+
}>;
|
|
111
|
+
type CompoundVariantRequiredConditions<V extends VariantMap> = RequireAtLeastOneIfNotEmpty<CompoundVariantConditions<V>>;
|
|
112
|
+
type CompoundVariantBase<V extends VariantMap> = keyof V extends never ? EmptyRecord : CompoundVariantRequiredConditions<V>;
|
|
113
|
+
type CompoundVariant<V extends VariantMap> = CompoundVariantBase<V> & {
|
|
114
|
+
class: VariantValue;
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
interface CVACompounds<V extends VariantMap> {
|
|
118
|
+
compoundVariants?: readonly CompoundVariant<V>[];
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
interface CVADefaults<V extends VariantMap> {
|
|
122
|
+
defaultVariants?: DefaultVariants<V>;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
interface CVAVariants<V extends VariantMap> {
|
|
126
|
+
variants?: V;
|
|
127
|
+
}
|
|
128
|
+
|
|
119
129
|
interface BaseClassOptions {
|
|
120
130
|
baseClassName?: ClassName;
|
|
121
131
|
}
|
|
@@ -147,7 +157,11 @@ type ClassPlugin<TProps extends AnyRecord = EmptyRecord> = Readonly<{
|
|
|
147
157
|
}>;
|
|
148
158
|
|
|
149
159
|
type ClassPluginFactory<TProps extends AnyRecord = EmptyRecord> = <V extends VariantMap>(options: ClassPipelineOptions<V>, diagnostics: Diagnostics) => ClassPlugin<TProps>;
|
|
150
|
-
|
|
160
|
+
/** `ClassPluginFactory` with its plugin-owned-props generic erased — the common form used
|
|
161
|
+
* wherever a factory's concrete plugin-props shape isn't tracked (factory generics,
|
|
162
|
+
* capability wiring). */
|
|
163
|
+
type AnyClassPluginFactory = ClassPluginFactory<AnyRecord> | undefined;
|
|
164
|
+
type ExtractPluginProps<TPlugin extends AnyClassPluginFactory> = TPlugin extends ClassPluginFactory<infer T> ? string extends keyof T ? EmptyRecord : T : EmptyRecord;
|
|
151
165
|
|
|
152
166
|
type AriaContext = {
|
|
153
167
|
readonly tag: IntrinsicTag;
|
|
@@ -207,7 +221,7 @@ type EnforcementOptions<TAllowed extends ElementType = ElementType> = {
|
|
|
207
221
|
readonly allowedAs?: readonly TAllowed[];
|
|
208
222
|
};
|
|
209
223
|
|
|
210
|
-
type StylingOptions<V extends Readonly<VariantMap> = Readonly<EmptyRecord>, TPreset extends RecipeMap<V> = Readonly<EmptyRecord>, TPlugin extends
|
|
224
|
+
type StylingOptions<V extends Readonly<VariantMap> = Readonly<EmptyRecord>, TPreset extends RecipeMap<V> = Readonly<EmptyRecord>, TPlugin extends AnyClassPluginFactory = AnyClassPluginFactory> = {
|
|
211
225
|
readonly base?: ClassName;
|
|
212
226
|
readonly variants?: V;
|
|
213
227
|
readonly defaults?: Partial<DefaultVariants<V>>;
|
|
@@ -221,8 +235,8 @@ type StylingOptions<V extends Readonly<VariantMap> = Readonly<EmptyRecord>, TPre
|
|
|
221
235
|
type NormalizeFn<Props extends AnyRecord = AnyRecord> = {
|
|
222
236
|
normalize(props: Readonly<Props & IntrinsicProps>): Props & IntrinsicProps;
|
|
223
237
|
}['normalize'];
|
|
224
|
-
type AnyFactoryOptions = FactoryOptions<ElementType, AnyRecord, VariantMap, RecipeMap<VariantMap>,
|
|
225
|
-
type FactoryOptions<TDefault extends ElementType = ElementType, Props extends AnyRecord = EmptyRecord, V extends Readonly<VariantMap> = Readonly<EmptyRecord>, TPreset extends RecipeMap<V> = Readonly<EmptyRecord>, TPlugin extends
|
|
238
|
+
type AnyFactoryOptions = FactoryOptions<ElementType, AnyRecord, VariantMap, RecipeMap<VariantMap>, AnyClassPluginFactory>;
|
|
239
|
+
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> = {
|
|
226
240
|
readonly tag?: TDefault;
|
|
227
241
|
readonly name?: string;
|
|
228
242
|
readonly defaults?: Partial<NoInfer<Props>>;
|
|
@@ -238,11 +252,11 @@ type SlottableProps = {
|
|
|
238
252
|
};
|
|
239
253
|
declare function Slottable({ children }: SlottableProps): AnyVNode;
|
|
240
254
|
|
|
241
|
-
type UnknownProps =
|
|
255
|
+
type UnknownProps = AnyRecord;
|
|
242
256
|
type SlotComponent = ComponentType<UnknownProps>;
|
|
243
257
|
type AnyVNode = VNode<any>;
|
|
244
258
|
|
|
245
|
-
type PreactFactoryOptions<TDefault extends ElementType, Props extends UnknownProps, Variants extends Readonly<VariantMap>, TPreset extends RecipeMap<Variants> = Readonly<EmptyRecord>, TPlugin extends
|
|
259
|
+
type PreactFactoryOptions<TDefault extends ElementType, Props extends UnknownProps, Variants extends Readonly<VariantMap>, TPreset extends RecipeMap<Variants> = Readonly<EmptyRecord>, TPlugin extends AnyClassPluginFactory = AnyClassPluginFactory> = FactoryOptions<TDefault, Props, Variants, TPreset, TPlugin> & {
|
|
246
260
|
/** Component used to render the asChild slot. Defaults to the built-in Slot. */
|
|
247
261
|
slotComponent?: SlotComponent;
|
|
248
262
|
/**
|
|
@@ -276,6 +290,6 @@ type PolymorphicComponent<G extends PolymorphicGenerics> = {
|
|
|
276
290
|
displayName?: string;
|
|
277
291
|
};
|
|
278
292
|
|
|
279
|
-
declare function createContractComponent<TDefault extends ElementType, Props extends UnknownProps = EmptyRecord, Variants extends Readonly<VariantMap> = Readonly<EmptyRecord>, TPreset extends RecipeMap<Variants> = Readonly<EmptyRecord>, TPlugin extends
|
|
293
|
+
declare function createContractComponent<TDefault extends ElementType, Props extends UnknownProps = EmptyRecord, Variants extends Readonly<VariantMap> = Readonly<EmptyRecord>, TPreset extends RecipeMap<Variants> = Readonly<EmptyRecord>, TPlugin extends AnyClassPluginFactory = AnyClassPluginFactory>(options: PreactFactoryOptions<TDefault, Props, Variants, TPreset, TPlugin>): PolymorphicComponent<PolymorphicGenerics<TDefault, Props & ExtractPluginProps<TPlugin>, Variants, TPreset>>;
|
|
280
294
|
|
|
281
295
|
export { type AnyFactoryOptions, type ElementRef, type ElementType, type EmptyRecord, type PolymorphicComponent, type PolymorphicGenerics, type PolymorphicProps, type PolymorphicWithAsChild, type PreactFactoryOptions, Slottable, createContractComponent, defineContractComponent };
|