praxis-kit 7.5.0 → 7.8.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/dist/_shared/diagnostics.d.ts +3 -0
- package/dist/_shared/diagnostics.js +3 -0
- package/dist/{chunk-SMHJEFNE.js → chunk-QYP7KLRE.js} +316 -154
- package/dist/contract/index.d.ts +3 -3
- package/dist/eslint/index.js +227 -187
- package/dist/html/index.d.ts +6 -1
- package/dist/html/index.js +234 -68
- package/dist/lit/index.d.ts +3 -3
- package/dist/lit/index.js +305 -141
- package/dist/preact/index.d.ts +90 -5
- package/dist/preact/index.js +316 -152
- package/dist/react/index.d.ts +3 -2
- package/dist/react/index.js +1 -1
- package/dist/react/legacy.d.ts +8 -5
- package/dist/react/legacy.js +8 -8
- package/dist/{react-options-5GbZ8Tbv.d.ts → react-options-DU3EdFOv.d.ts} +102 -6
- package/dist/solid/index.d.ts +103 -7
- package/dist/solid/index.js +316 -152
- package/dist/svelte/Polymorphic.svelte +8 -0
- package/dist/svelte/index.d.ts +196 -10
- package/dist/svelte/index.js +319 -152
- package/dist/tailwind/index.d.ts +1 -1
- package/dist/vite-plugin/index.d.ts +6 -3
- package/dist/vue/index.d.ts +70 -5
- package/dist/vue/index.js +316 -152
- package/dist/web/index.d.ts +3 -3
- package/dist/web/index.js +305 -141
- package/package.json +9 -9
package/dist/tailwind/index.d.ts
CHANGED
|
@@ -99,7 +99,7 @@ interface BaseClassOptions {
|
|
|
99
99
|
type ClassPipelineFn = (tag: unknown, props: AnyRecord, className?: ClassName, recipe?: string) => string | undefined;
|
|
100
100
|
|
|
101
101
|
interface RecipeOptions<TVariants extends VariantMap = VariantMap> {
|
|
102
|
-
recipeMap?:
|
|
102
|
+
recipeMap?: StringMap<RecipeTarget<TVariants>>;
|
|
103
103
|
}
|
|
104
104
|
|
|
105
105
|
interface TagMapOptions {
|
|
@@ -75,10 +75,13 @@ declare enum DiagnosticCode {
|
|
|
75
75
|
HtmlInputAltIgnoredForType = "HTML3113",
|
|
76
76
|
HtmlInputHeightIgnoredForType = "HTML3114",
|
|
77
77
|
HtmlInputWidthIgnoredForType = "HTML3115",
|
|
78
|
+
HtmlAnchorDangerousHref = "HTML3201",
|
|
78
79
|
A11yInputMissingAccessibleName = "A11Y8100",
|
|
79
80
|
A11yInputPlaceholderNotLabel = "A11Y8101",
|
|
80
81
|
A11yInputPasswordAutocomplete = "A11Y8102",
|
|
81
82
|
A11yInputRequiredReadOnlyConflict = "A11Y8103",
|
|
83
|
+
A11yAnchorRoleButtonWithHref = "A11Y8200",
|
|
84
|
+
A11yAnchorAriaDisabledInert = "A11Y8201",
|
|
82
85
|
InvalidRenderingTarget = "RENDER4001",
|
|
83
86
|
LintDeadCompoundKey = "LINT5001",
|
|
84
87
|
LintDeadCompoundValue = "LINT5002",
|
|
@@ -294,7 +297,7 @@ declare function analyze(code: string, filename: string, options?: PluginOptions
|
|
|
294
297
|
* Returns null when static extraction is not possible (non-literal values,
|
|
295
298
|
* no variants, or combination count exceeds MAX_COMBINATIONS).
|
|
296
299
|
*/
|
|
297
|
-
declare function buildPrecomputedClasses(stylingObj: ts.ObjectLiteralExpression):
|
|
300
|
+
declare function buildPrecomputedClasses(stylingObj: ts.ObjectLiteralExpression): StringMap<string> | null;
|
|
298
301
|
/**
|
|
299
302
|
* Injects precomputed variant class maps into all factory calls in the given
|
|
300
303
|
* source file that have fully-static `styling.variants` configurations.
|
|
@@ -334,7 +337,7 @@ type ComponentTokens = {
|
|
|
334
337
|
tagClasses: string[];
|
|
335
338
|
};
|
|
336
339
|
type DesignTokenManifest = {
|
|
337
|
-
components:
|
|
340
|
+
components: StringMap<ComponentTokens>;
|
|
338
341
|
allClasses: string[];
|
|
339
342
|
};
|
|
340
343
|
/**
|
|
@@ -440,7 +443,7 @@ declare function transformAsChild(source: ts.SourceFile): string | null;
|
|
|
440
443
|
type StaticComponent = {
|
|
441
444
|
readonly defaultTag: string;
|
|
442
445
|
readonly variantKeys: ReadonlySet<string>;
|
|
443
|
-
readonly precomputedClasses: Readonly<
|
|
446
|
+
readonly precomputedClasses: Readonly<StringMap<string>>;
|
|
444
447
|
};
|
|
445
448
|
/**
|
|
446
449
|
* Walks the source file and extracts metadata for each same-file factory call
|
package/dist/vue/index.d.ts
CHANGED
|
@@ -190,20 +190,75 @@ type DefaultVariants<V extends VariantMap> = {
|
|
|
190
190
|
* Presets are named bundles of variant props that callers activate by key,
|
|
191
191
|
* avoiding the need to repeat variant combinations at each call site.
|
|
192
192
|
*/
|
|
193
|
-
type RecipeMap<V extends VariantMap = VariantMap> = Readonly<
|
|
193
|
+
type RecipeMap<V extends VariantMap = VariantMap> = Readonly<StringMap<VariantSelection<V>>>;
|
|
194
194
|
|
|
195
195
|
type RecipeTarget<TVariants extends VariantMap = VariantMap> = VariantSelection<TVariants>;
|
|
196
196
|
|
|
197
|
-
|
|
197
|
+
/**
|
|
198
|
+
* The framework-neutral descriptor for a single praxis-kit component's contract — every render
|
|
199
|
+
* mechanism (tag resolution, prop merging, classes, ARIA) and every framework adapter's
|
|
200
|
+
* component type is built from this one shape. Deliberately just data: five type parameters and
|
|
201
|
+
* their corresponding properties, with no notion of JSX, call signatures, refs, or any
|
|
202
|
+
* framework-specific rendering concern. Each adapter (React, Vue, Svelte, Solid, Lit, Web) builds
|
|
203
|
+
* its own idiomatic component type on top of a `PolymorphicGenerics<...>` instantiation — see
|
|
204
|
+
* `PolymorphicComponent<G>` (`adapters/react/src/shared/types/polymorphic-props.ts`) for the
|
|
205
|
+
* React example — rather than this interface knowing anything about any of them.
|
|
206
|
+
*
|
|
207
|
+
* Use the `*Of<T>` accessor aliases below (`DefaultOf<G>`, `PropsOf<G>`, etc.) to read a single
|
|
208
|
+
* field back out of an already-resolved `G`, instead of indexing `G['default']` etc. directly at
|
|
209
|
+
* call sites — same rationale as any accessor: the property name stays an implementation detail,
|
|
210
|
+
* and every reader benefits together if it ever needs to change.
|
|
211
|
+
*/
|
|
212
|
+
interface PolymorphicGenerics<
|
|
213
|
+
/**
|
|
214
|
+
* The element/tag this component renders as when the consumer doesn't override it via `as`
|
|
215
|
+
* (`AllowedOf<G>` permitting) — e.g. `'button'`, `'div'`. Defaults to the widest `ElementType`
|
|
216
|
+
* so a generic `PolymorphicGenerics` reference (with nothing else specified) still compiles.
|
|
217
|
+
*/
|
|
218
|
+
TDefault extends ElementType = ElementType,
|
|
219
|
+
/**
|
|
220
|
+
* The props this specific component declares — its own contract, before variants are mixed
|
|
221
|
+
* in. Defaults to `AnyRecord` for the same "still compiles unspecified" reason as `TDefault`.
|
|
222
|
+
*/
|
|
223
|
+
Props extends AnyRecord = AnyRecord,
|
|
224
|
+
/**
|
|
225
|
+
* This component's variant definitions (e.g. `{ intent: { primary: ..., ghost: ... } }`).
|
|
226
|
+
* Constrained to `Readonly<VariantMap>` — not the wider `AnyRecord` — specifically so `TPreset`
|
|
227
|
+
* below can be expressed as `RecipeMap<Variants>` and get real per-variant-key checking,
|
|
228
|
+
* instead of falling back to an unconstrained `RecipeMap<VariantMap>`.
|
|
229
|
+
*/
|
|
230
|
+
Variants extends Readonly<VariantMap> = Readonly<VariantMap>,
|
|
231
|
+
/**
|
|
232
|
+
* Named presets (`RecipeMap<Variants>`) — bundles of variant selections a consumer activates
|
|
233
|
+
* by key instead of repeating the same variant combination at every call site. Tied to
|
|
234
|
+
* `Variants`, not `AnyRecord`, precisely so a preset can only ever select keys/values that
|
|
235
|
+
* `Variants` actually defines — an invalid preset is a type error, not a silent no-op.
|
|
236
|
+
* Defaults to `Readonly<EmptyRecord>` (no presets), which is the common case: a component can
|
|
237
|
+
* have variants without necessarily defining any named presets over them, and most don't.
|
|
238
|
+
*/
|
|
239
|
+
TPreset extends RecipeMap<Variants> = Readonly<EmptyRecord>,
|
|
240
|
+
/**
|
|
241
|
+
* The set of elements/tags a consumer is allowed to switch to via `as`. Defaults to the widest
|
|
242
|
+
* `ElementType`, under which `AllowedOf<G>` imposes no restriction at all (see
|
|
243
|
+
* `PolymorphicControlProps.as`'s own comment in the React adapter for the concrete effect this
|
|
244
|
+
* has at a component's actual call site).
|
|
245
|
+
*/
|
|
246
|
+
TAllowed extends ElementType = ElementType> {
|
|
198
247
|
default: TDefault;
|
|
199
248
|
props: Props;
|
|
200
249
|
variants: Variants;
|
|
201
250
|
preset: TPreset;
|
|
202
251
|
allowed: TAllowed;
|
|
203
252
|
}
|
|
253
|
+
/** This component's variant definitions. See `PolymorphicGenerics`'s `Variants` parameter. */
|
|
204
254
|
type VariantsOf<T extends PolymorphicGenerics> = T['variants'];
|
|
255
|
+
/** This component's named presets. See `PolymorphicGenerics`'s `TPreset` parameter. */
|
|
205
256
|
type RecipeOf<T extends PolymorphicGenerics> = T['preset'];
|
|
257
|
+
/** The element/tag this component renders as by default. See `PolymorphicGenerics`'s `TDefault`
|
|
258
|
+
* parameter. */
|
|
206
259
|
type DefaultOf<T extends PolymorphicGenerics> = T['default'];
|
|
260
|
+
/** This component's own declared props, before variants are mixed in. See `PolymorphicGenerics`'s
|
|
261
|
+
* `Props` parameter. */
|
|
207
262
|
type PropsOf<T extends PolymorphicGenerics> = T['props'];
|
|
208
263
|
|
|
209
264
|
type RequireAtLeastOneIfNotEmpty<T> = keyof T extends never ? EmptyRecord : RequireAtLeastOne<T>;
|
|
@@ -236,7 +291,7 @@ interface BaseClassOptions {
|
|
|
236
291
|
type ClassPipelineFn = (tag: unknown, props: AnyRecord, className?: ClassName, recipe?: string) => string | undefined;
|
|
237
292
|
|
|
238
293
|
interface RecipeOptions<TVariants extends VariantMap = VariantMap> {
|
|
239
|
-
recipeMap?:
|
|
294
|
+
recipeMap?: StringMap<RecipeTarget<TVariants>>;
|
|
240
295
|
}
|
|
241
296
|
|
|
242
297
|
interface TagMapOptions {
|
|
@@ -405,7 +460,7 @@ type StylingOptions<V extends Readonly<VariantMap> = Readonly<EmptyRecord>, TPre
|
|
|
405
460
|
* combination, skipping runtime class computation entirely when a match is found. Normally
|
|
406
461
|
* generated by a build-time class-extraction plugin rather than hand-authored.
|
|
407
462
|
*/
|
|
408
|
-
readonly precomputedClasses?: Readonly<
|
|
463
|
+
readonly precomputedClasses?: Readonly<StringMap<string>>;
|
|
409
464
|
};
|
|
410
465
|
|
|
411
466
|
type NormalizeFn<Props extends AnyRecord = AnyRecord> = {
|
|
@@ -530,6 +585,16 @@ type PolymorphicComponent<G extends PolymorphicGenerics> = {
|
|
|
530
585
|
};
|
|
531
586
|
displayName?: string;
|
|
532
587
|
};
|
|
588
|
+
/**
|
|
589
|
+
* A component's full prop contract, both render modes at once — naming symmetry with React's/
|
|
590
|
+
* Preact's `ContractProps<T, Mode>` (`@praxis-kit/contract-props`), not a fix for a gap: Vue has
|
|
591
|
+
* no version of the overload-resolution ceiling those two adapters need a marker to work around.
|
|
592
|
+
* `PolymorphicComponent<G>`'s single `new()` construct signature already exposes both modes
|
|
593
|
+
* unioned together (`$props: PolymorphicProps<G> | PolymorphicWithAsChild<G>`), so this alias is
|
|
594
|
+
* just that same union under a familiar name — no phantom marker involved, `G` is already an
|
|
595
|
+
* ordinary, ambient type parameter.
|
|
596
|
+
*/
|
|
597
|
+
type ContractProps<G extends PolymorphicGenerics> = PolymorphicProps<G> | PolymorphicWithAsChild<G>;
|
|
533
598
|
|
|
534
599
|
/**
|
|
535
600
|
* Creates a polymorphic Vue component with praxis-kit contracts applied.
|
|
@@ -558,4 +623,4 @@ declare function createContractComponent<TDefault extends ElementType, Props ext
|
|
|
558
623
|
readonly subComponents?: TSubComponents;
|
|
559
624
|
}): MergeRecords<PolymorphicComponent<PolymorphicGenerics<TDefault, MergeRecords<Props, ExtractPluginProps<TPlugin>>, Variants, TPreset>>, TSubComponents>;
|
|
560
625
|
|
|
561
|
-
export { type AnyFactoryOptions, type ElementType, type EmptyRecord, type PolymorphicComponent, type PolymorphicGenerics, type PolymorphicProps, type PolymorphicWithAsChild, Slottable, type SlottableProps, type VueFactoryOptions, createContractComponent, defineContractComponent };
|
|
626
|
+
export { type AnyFactoryOptions, type ContractProps, type ElementType, type EmptyRecord, type PolymorphicComponent, type PolymorphicGenerics, type PolymorphicProps, type PolymorphicWithAsChild, Slottable, type SlottableProps, type VueFactoryOptions, createContractComponent, defineContractComponent };
|