praxis-kit 4.0.0 → 4.0.3

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.
@@ -1,2 +1,246 @@
1
- export { AnyFactoryOptions, PropNormalizer, activeProps, disabledProps, expandedProps, invalidProps, loadingProps, pressedProps, readonlyProps, selectedProps } from '@praxis-kit/core';
2
- export { activeContract, disabledContract, expandedContract, invalidContract, loadingContract, mergeContracts, pressedContract, readonlyContract, selectedContract } from '@praxis-kit/core/contract';
1
+ import { Diagnostics as Diagnostics$1, DiagnosticInput } from '../_shared/diagnostics.js';
2
+ import { RequireAtLeastOne, Simplify, ReadonlyDeep } from 'type-fest';
3
+
4
+ type StringMap<T = unknown> = Record<string, T>;
5
+ type AnyRecord = StringMap<unknown>;
6
+
7
+ type IntrinsicTag = keyof HTMLElementTagNameMap;
8
+
9
+ 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"];
12
+ type KnownAriaRole = (typeof KNOWN_ARIA_ROLES)[number];
13
+
14
+ type Booleanish = boolean | 'true' | 'false';
15
+ type ClassName = string | string[];
16
+ type EmptyRecord = Record<never, never>;
17
+ type NonEmptyArray<T> = [T, ...T[]];
18
+ type Numberish = number | `${number}`;
19
+ type Primitive = string | number | boolean;
20
+ type AriaRole = KnownAriaRole | (string & {});
21
+ type IntrinsicProps = AnyRecord & {
22
+ role?: AriaRole;
23
+ };
24
+ type TagMap = Partial<Record<IntrinsicTag | (string & {}), ClassName>>;
25
+
26
+ type MinMax = {
27
+ min: number;
28
+ max: number;
29
+ };
30
+ type CardinalityInput = Partial<MinMax>;
31
+
32
+ type ChildRuleMatch<T, U extends T = T> = (child: T) => child is U;
33
+
34
+ type ChildRulePosition = 'first' | 'last' | 'any';
35
+
36
+ type ChildRuleInput<T = unknown, U extends T = T> = {
37
+ name: string;
38
+ match: ChildRuleMatch<T, U>;
39
+ cardinality?: CardinalityInput;
40
+ position?: ChildRulePosition;
41
+ /**
42
+ * Optional component-type reference for O(1) dispatch index.
43
+ * When provided for every rule, the matcher reads child.type instead of
44
+ * calling every match function on every child (O(n×m) → O(n+m)).
45
+ */
46
+ type?: unknown;
47
+ };
48
+
49
+ type ValidResult = {
50
+ valid: true;
51
+ };
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
+ type StringToBoolean<T> = T extends 'true' | 'false' ? boolean : T;
77
+ type VariantValue = string | string[];
78
+ type VariantStates<K extends string = string> = Record<K, VariantValue>;
79
+ type VariantMap<V extends string = string, K extends string = string> = Record<V, VariantStates<K>>;
80
+ type VariantKey<V extends VariantMap, K extends keyof V> = StringToBoolean<keyof V[K] & string>;
81
+ /**
82
+ * A partial selection of variant states authored at factory definition time.
83
+ *
84
+ * Uses `keyof V[K]` directly (not `VariantKey`) so TypeScript can eagerly
85
+ * resolve the union at constraint-check time without deferred conditional types.
86
+ */
87
+ type VariantSelection<V extends VariantMap> = {
88
+ [K in keyof V]?: keyof V[K];
89
+ };
90
+ type NormalizedVariantValue<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]?: NormalizedVariantValue<keyof V[K] & string>;
93
+ };
94
+ /**
95
+ * A static, immutable map of named presets to partial variant selections.
96
+ *
97
+ * Presets are named bundles of variant props that callers activate by key,
98
+ * avoiding the need to repeat variant combinations at each call site.
99
+ */
100
+ type RecipeMap<V extends VariantMap = VariantMap> = Readonly<Record<string, VariantSelection<V>>>;
101
+ type RecipeTarget<TVariants extends VariantMap = VariantMap> = VariantSelection<TVariants>;
102
+
103
+ interface BaseClassOptions {
104
+ baseClassName?: ClassName;
105
+ }
106
+
107
+ type ClassPipelineFn = (tag: unknown, props: AnyRecord, className?: ClassName, recipe?: string) => string;
108
+
109
+ interface RecipeOptions<TVariants extends VariantMap = VariantMap> {
110
+ recipeMap?: Record<string, RecipeTarget<TVariants>>;
111
+ }
112
+
113
+ interface TagMapOptions {
114
+ tagMap?: TagMap;
115
+ }
116
+
117
+ type CompositionOptions<TVariants extends VariantMap = VariantMap> = Simplify<TagMapOptions & RecipeOptions<TVariants>>;
118
+
119
+ type CVASystemOptions<TVariants extends VariantMap = VariantMap> = Simplify<CVAVariants<TVariants> & CVADefaults<TVariants> & CVACompounds<TVariants>>;
120
+
121
+ type StyleOptions<TVariants extends VariantMap = VariantMap> = Simplify<BaseClassOptions & CVASystemOptions<TVariants>>;
122
+
123
+ type ClassPipelineOptions<TVariants extends VariantMap = VariantMap> = Simplify<StyleOptions<TVariants> & CompositionOptions<TVariants>>;
124
+
125
+ type OwnedPropKeys = ReadonlySet<string>;
126
+
127
+ type ClassPlugin<TProps extends AnyRecord = EmptyRecord> = Readonly<{
128
+ pipeline: ClassPipelineFn;
129
+ ownedKeys?: OwnedPropKeys;
130
+ readonly _pluginProps?: TProps;
131
+ }>;
132
+
133
+ type ClassPluginFactory<TProps extends AnyRecord = EmptyRecord> = <V extends VariantMap>(options: ClassPipelineOptions<V>, diagnostics: Diagnostics$1) => ClassPlugin<TProps>;
134
+
135
+ type AriaContext = {
136
+ readonly tag: IntrinsicTag;
137
+ readonly implicitRole: AriaRole | undefined;
138
+ readonly effectiveRole: string | undefined;
139
+ readonly props: ReadonlyDeep<IntrinsicProps>;
140
+ };
141
+
142
+ type RemoveAttributeFixKind = `removeAttribute:${string}`;
143
+ type InjectLiveFixKind = `injectLive:${string}`;
144
+ type FixKind = 'removeRole' | 'setRole' | 'normalizeRelevantAll' | RemoveAttributeFixKind | InjectLiveFixKind;
145
+
146
+ type AriaFixResult = {
147
+ applied: false;
148
+ next: ReadonlyDeep<IntrinsicProps>;
149
+ } | {
150
+ applied: true;
151
+ next: ReadonlyDeep<IntrinsicProps>;
152
+ previous: ReadonlyDeep<IntrinsicProps>;
153
+ };
154
+ type AriaFix = {
155
+ readonly kind: FixKind;
156
+ readonly priority?: number;
157
+ readonly source?: string;
158
+ readonly apply: (context: AriaContext) => AriaFixResult;
159
+ };
160
+
161
+ type Severity = 'error' | 'warning' | (string & {});
162
+
163
+ type AriaInvalidBase<M extends string = string> = {
164
+ valid: false;
165
+ severity: Severity;
166
+ message?: M;
167
+ attribute?: string;
168
+ diagnostic?: DiagnosticInput;
169
+ };
170
+ type AriaInvalidWithFix<M extends string = string> = AriaInvalidBase<M> & {
171
+ fixable: true;
172
+ fix: AriaFix;
173
+ };
174
+ type AriaInvalidWithoutFix<M extends string = string> = AriaInvalidBase<M> & {
175
+ fixable: false;
176
+ };
177
+ type AriaInvalidResult<M extends string = string> = AriaInvalidWithFix<M> | AriaInvalidWithoutFix<M>;
178
+ type AriaResult = ValidResult | AriaInvalidResult;
179
+
180
+ type AriaRule<C extends AriaContext = AriaContext> = (context: C) => readonly AriaResult[];
181
+
182
+ type PropNormalizer = (props: Readonly<AnyRecord & IntrinsicProps>) => Partial<AnyRecord & IntrinsicProps>;
183
+
184
+ type EnforcementOptions<TAllowed extends ElementType = ElementType> = {
185
+ readonly diagnostics?: Diagnostics$1;
186
+ readonly aria?: readonly AriaRule[];
187
+ readonly children?: readonly ChildRuleInput[];
188
+ readonly props?: readonly PropNormalizer[];
189
+ /** Restricts the `as` prop to this set of tags. Violations route through diagnostics. */
190
+ readonly allowedAs?: readonly TAllowed[];
191
+ };
192
+
193
+ type StylingOptions<V extends Readonly<VariantMap> = Readonly<EmptyRecord>, TPreset extends RecipeMap<V> = Readonly<EmptyRecord>, TPlugin extends ClassPluginFactory<AnyRecord> | undefined = ClassPluginFactory<AnyRecord> | undefined> = {
194
+ readonly base?: ClassName;
195
+ readonly variants?: V;
196
+ readonly defaults?: Partial<DefaultVariants<V>>;
197
+ readonly compounds?: readonly CompoundVariant<V>[];
198
+ readonly presets?: TPreset;
199
+ readonly tags?: Readonly<TagMap>;
200
+ readonly plugin?: TPlugin;
201
+ readonly precomputedClasses?: Readonly<Record<string, string>>;
202
+ };
203
+
204
+ type NormalizeFn<Props extends AnyRecord = AnyRecord> = {
205
+ normalize(props: Readonly<Props & IntrinsicProps>): Props & IntrinsicProps;
206
+ }['normalize'];
207
+ type AnyFactoryOptions = FactoryOptions<ElementType, AnyRecord, VariantMap, RecipeMap<VariantMap>, ClassPluginFactory<AnyRecord> | undefined>;
208
+ type FactoryOptions<TDefault extends ElementType = ElementType, Props extends AnyRecord = EmptyRecord, V extends Readonly<VariantMap> = Readonly<EmptyRecord>, TPreset extends RecipeMap<V> = Readonly<EmptyRecord>, TPlugin extends ClassPluginFactory<AnyRecord> | undefined = ClassPluginFactory<AnyRecord> | undefined, TAllowed extends ElementType = ElementType> = {
209
+ readonly tag?: TDefault;
210
+ readonly name?: string;
211
+ readonly defaults?: Partial<NoInfer<Props>>;
212
+ readonly normalize?: NormalizeFn<NoInfer<Props>>;
213
+ readonly styling?: StylingOptions<V, TPreset, TPlugin>;
214
+ readonly enforcement?: EnforcementOptions<TAllowed>;
215
+ };
216
+
217
+ declare const activeProps: PropNormalizer;
218
+
219
+ declare const disabledProps: PropNormalizer;
220
+
221
+ declare const expandedProps: PropNormalizer;
222
+
223
+ declare const invalidProps: PropNormalizer;
224
+
225
+ declare const loadingProps: PropNormalizer;
226
+
227
+ declare const pressedProps: PropNormalizer;
228
+
229
+ declare const readonlyProps: PropNormalizer;
230
+
231
+ declare const selectedProps: PropNormalizer;
232
+
233
+ declare const activeContract: EnforcementOptions;
234
+ declare const disabledContract: EnforcementOptions;
235
+ declare const expandedContract: EnforcementOptions;
236
+ declare const invalidContract: EnforcementOptions;
237
+ declare const loadingContract: EnforcementOptions;
238
+ declare const pressedContract: EnforcementOptions;
239
+ declare const readonlyContract: EnforcementOptions;
240
+ declare const selectedContract: EnforcementOptions;
241
+
242
+ declare function mergeContracts(...contracts: readonly EnforcementOptions[]): EnforcementOptions;
243
+
244
+ type Diagnostics = Diagnostics$1;
245
+
246
+ export { type AnyFactoryOptions, type Diagnostics, type PropNormalizer, activeContract, activeProps, disabledContract, disabledProps, expandedContract, expandedProps, invalidContract, invalidProps, loadingContract, loadingProps, mergeContracts, pressedContract, pressedProps, readonlyContract, readonlyProps, selectedContract, selectedProps };
@@ -5,7 +5,11 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
5
5
  var __getProtoOf = Object.getPrototypeOf;
6
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
7
  var __commonJS = (cb, mod) => function __require() {
8
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
8
+ try {
9
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
10
+ } catch (e) {
11
+ throw mod = 0, e;
12
+ }
9
13
  };
10
14
  var __copyProps = (to, from, except, desc) => {
11
15
  if (from && typeof from === "object" || typeof from === "function") {
@@ -24,9 +28,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
24
28
  mod
25
29
  ));
26
30
 
27
- // ../../node_modules/.pnpm/@typescript-eslint+utils@8.60.0_eslint@10.5.0_jiti@2.7.0__typescript@6.0.3/node_modules/@typescript-eslint/utils/dist/eslint-utils/deepMerge.js
31
+ // ../../node_modules/.pnpm/@typescript-eslint+utils@8.60.0_eslint@10.6.0_jiti@2.7.0__typescript@6.0.3/node_modules/@typescript-eslint/utils/dist/eslint-utils/deepMerge.js
28
32
  var require_deepMerge = __commonJS({
29
- "../../node_modules/.pnpm/@typescript-eslint+utils@8.60.0_eslint@10.5.0_jiti@2.7.0__typescript@6.0.3/node_modules/@typescript-eslint/utils/dist/eslint-utils/deepMerge.js"(exports) {
33
+ "../../node_modules/.pnpm/@typescript-eslint+utils@8.60.0_eslint@10.6.0_jiti@2.7.0__typescript@6.0.3/node_modules/@typescript-eslint/utils/dist/eslint-utils/deepMerge.js"(exports) {
30
34
  "use strict";
31
35
  Object.defineProperty(exports, "__esModule", { value: true });
32
36
  exports.isObjectNotArray = isObjectNotArray;
@@ -59,9 +63,9 @@ var require_deepMerge = __commonJS({
59
63
  }
60
64
  });
61
65
 
62
- // ../../node_modules/.pnpm/@typescript-eslint+utils@8.60.0_eslint@10.5.0_jiti@2.7.0__typescript@6.0.3/node_modules/@typescript-eslint/utils/dist/eslint-utils/applyDefault.js
66
+ // ../../node_modules/.pnpm/@typescript-eslint+utils@8.60.0_eslint@10.6.0_jiti@2.7.0__typescript@6.0.3/node_modules/@typescript-eslint/utils/dist/eslint-utils/applyDefault.js
63
67
  var require_applyDefault = __commonJS({
64
- "../../node_modules/.pnpm/@typescript-eslint+utils@8.60.0_eslint@10.5.0_jiti@2.7.0__typescript@6.0.3/node_modules/@typescript-eslint/utils/dist/eslint-utils/applyDefault.js"(exports) {
68
+ "../../node_modules/.pnpm/@typescript-eslint+utils@8.60.0_eslint@10.6.0_jiti@2.7.0__typescript@6.0.3/node_modules/@typescript-eslint/utils/dist/eslint-utils/applyDefault.js"(exports) {
65
69
  "use strict";
66
70
  Object.defineProperty(exports, "__esModule", { value: true });
67
71
  exports.applyDefault = applyDefault;
@@ -86,9 +90,9 @@ var require_applyDefault = __commonJS({
86
90
  }
87
91
  });
88
92
 
89
- // ../../node_modules/.pnpm/@typescript-eslint+utils@8.60.0_eslint@10.5.0_jiti@2.7.0__typescript@6.0.3/node_modules/@typescript-eslint/utils/dist/eslint-utils/parserSeemsToBeTSESLint.js
93
+ // ../../node_modules/.pnpm/@typescript-eslint+utils@8.60.0_eslint@10.6.0_jiti@2.7.0__typescript@6.0.3/node_modules/@typescript-eslint/utils/dist/eslint-utils/parserSeemsToBeTSESLint.js
90
94
  var require_parserSeemsToBeTSESLint = __commonJS({
91
- "../../node_modules/.pnpm/@typescript-eslint+utils@8.60.0_eslint@10.5.0_jiti@2.7.0__typescript@6.0.3/node_modules/@typescript-eslint/utils/dist/eslint-utils/parserSeemsToBeTSESLint.js"(exports) {
95
+ "../../node_modules/.pnpm/@typescript-eslint+utils@8.60.0_eslint@10.6.0_jiti@2.7.0__typescript@6.0.3/node_modules/@typescript-eslint/utils/dist/eslint-utils/parserSeemsToBeTSESLint.js"(exports) {
92
96
  "use strict";
93
97
  Object.defineProperty(exports, "__esModule", { value: true });
94
98
  exports.parserSeemsToBeTSESLint = parserSeemsToBeTSESLint;
@@ -98,9 +102,9 @@ var require_parserSeemsToBeTSESLint = __commonJS({
98
102
  }
99
103
  });
100
104
 
101
- // ../../node_modules/.pnpm/@typescript-eslint+utils@8.60.0_eslint@10.5.0_jiti@2.7.0__typescript@6.0.3/node_modules/@typescript-eslint/utils/dist/eslint-utils/getParserServices.js
105
+ // ../../node_modules/.pnpm/@typescript-eslint+utils@8.60.0_eslint@10.6.0_jiti@2.7.0__typescript@6.0.3/node_modules/@typescript-eslint/utils/dist/eslint-utils/getParserServices.js
102
106
  var require_getParserServices = __commonJS({
103
- "../../node_modules/.pnpm/@typescript-eslint+utils@8.60.0_eslint@10.5.0_jiti@2.7.0__typescript@6.0.3/node_modules/@typescript-eslint/utils/dist/eslint-utils/getParserServices.js"(exports) {
107
+ "../../node_modules/.pnpm/@typescript-eslint+utils@8.60.0_eslint@10.6.0_jiti@2.7.0__typescript@6.0.3/node_modules/@typescript-eslint/utils/dist/eslint-utils/getParserServices.js"(exports) {
104
108
  "use strict";
105
109
  Object.defineProperty(exports, "__esModule", { value: true });
106
110
  exports.getParserServices = getParserServices;
@@ -131,17 +135,17 @@ var require_getParserServices = __commonJS({
131
135
  }
132
136
  });
133
137
 
134
- // ../../node_modules/.pnpm/@typescript-eslint+utils@8.60.0_eslint@10.5.0_jiti@2.7.0__typescript@6.0.3/node_modules/@typescript-eslint/utils/dist/eslint-utils/InferTypesFromRule.js
138
+ // ../../node_modules/.pnpm/@typescript-eslint+utils@8.60.0_eslint@10.6.0_jiti@2.7.0__typescript@6.0.3/node_modules/@typescript-eslint/utils/dist/eslint-utils/InferTypesFromRule.js
135
139
  var require_InferTypesFromRule = __commonJS({
136
- "../../node_modules/.pnpm/@typescript-eslint+utils@8.60.0_eslint@10.5.0_jiti@2.7.0__typescript@6.0.3/node_modules/@typescript-eslint/utils/dist/eslint-utils/InferTypesFromRule.js"(exports) {
140
+ "../../node_modules/.pnpm/@typescript-eslint+utils@8.60.0_eslint@10.6.0_jiti@2.7.0__typescript@6.0.3/node_modules/@typescript-eslint/utils/dist/eslint-utils/InferTypesFromRule.js"(exports) {
137
141
  "use strict";
138
142
  Object.defineProperty(exports, "__esModule", { value: true });
139
143
  }
140
144
  });
141
145
 
142
- // ../../node_modules/.pnpm/@typescript-eslint+utils@8.60.0_eslint@10.5.0_jiti@2.7.0__typescript@6.0.3/node_modules/@typescript-eslint/utils/dist/eslint-utils/nullThrows.js
146
+ // ../../node_modules/.pnpm/@typescript-eslint+utils@8.60.0_eslint@10.6.0_jiti@2.7.0__typescript@6.0.3/node_modules/@typescript-eslint/utils/dist/eslint-utils/nullThrows.js
143
147
  var require_nullThrows = __commonJS({
144
- "../../node_modules/.pnpm/@typescript-eslint+utils@8.60.0_eslint@10.5.0_jiti@2.7.0__typescript@6.0.3/node_modules/@typescript-eslint/utils/dist/eslint-utils/nullThrows.js"(exports) {
148
+ "../../node_modules/.pnpm/@typescript-eslint+utils@8.60.0_eslint@10.6.0_jiti@2.7.0__typescript@6.0.3/node_modules/@typescript-eslint/utils/dist/eslint-utils/nullThrows.js"(exports) {
145
149
  "use strict";
146
150
  Object.defineProperty(exports, "__esModule", { value: true });
147
151
  exports.NullThrowsReasons = void 0;
@@ -159,9 +163,9 @@ var require_nullThrows = __commonJS({
159
163
  }
160
164
  });
161
165
 
162
- // ../../node_modules/.pnpm/@typescript-eslint+utils@8.60.0_eslint@10.5.0_jiti@2.7.0__typescript@6.0.3/node_modules/@typescript-eslint/utils/dist/eslint-utils/RuleCreator.js
166
+ // ../../node_modules/.pnpm/@typescript-eslint+utils@8.60.0_eslint@10.6.0_jiti@2.7.0__typescript@6.0.3/node_modules/@typescript-eslint/utils/dist/eslint-utils/RuleCreator.js
163
167
  var require_RuleCreator = __commonJS({
164
- "../../node_modules/.pnpm/@typescript-eslint+utils@8.60.0_eslint@10.5.0_jiti@2.7.0__typescript@6.0.3/node_modules/@typescript-eslint/utils/dist/eslint-utils/RuleCreator.js"(exports) {
168
+ "../../node_modules/.pnpm/@typescript-eslint+utils@8.60.0_eslint@10.6.0_jiti@2.7.0__typescript@6.0.3/node_modules/@typescript-eslint/utils/dist/eslint-utils/RuleCreator.js"(exports) {
165
169
  "use strict";
166
170
  Object.defineProperty(exports, "__esModule", { value: true });
167
171
  exports.RuleCreator = RuleCreator8;
@@ -207,9 +211,9 @@ var require_RuleCreator = __commonJS({
207
211
  }
208
212
  });
209
213
 
210
- // ../../node_modules/.pnpm/@typescript-eslint+utils@8.60.0_eslint@10.5.0_jiti@2.7.0__typescript@6.0.3/node_modules/@typescript-eslint/utils/dist/eslint-utils/index.js
214
+ // ../../node_modules/.pnpm/@typescript-eslint+utils@8.60.0_eslint@10.6.0_jiti@2.7.0__typescript@6.0.3/node_modules/@typescript-eslint/utils/dist/eslint-utils/index.js
211
215
  var require_eslint_utils = __commonJS({
212
- "../../node_modules/.pnpm/@typescript-eslint+utils@8.60.0_eslint@10.5.0_jiti@2.7.0__typescript@6.0.3/node_modules/@typescript-eslint/utils/dist/eslint-utils/index.js"(exports) {
216
+ "../../node_modules/.pnpm/@typescript-eslint+utils@8.60.0_eslint@10.6.0_jiti@2.7.0__typescript@6.0.3/node_modules/@typescript-eslint/utils/dist/eslint-utils/index.js"(exports) {
213
217
  "use strict";
214
218
  var __createBinding = exports && exports.__createBinding || (Object.create ? (function(o, m, k, k2) {
215
219
  if (k2 === void 0) k2 = k;
@@ -1,9 +1,225 @@
1
- import { ElementType, AnyRecord, EmptyRecord, VariantMap, RecipeMap, ClassPluginFactory, FactoryOptions, ExtractPluginProps } from '@praxis-kit/core';
2
- export { AnyFactoryOptions } from '@praxis-kit/core';
3
- import { FilterPredicate } from '@praxis-kit/adapter-utils';
4
- export { defineContractComponent } from '@praxis-kit/adapter-utils';
1
+ import { RequireAtLeastOne, Simplify, ReadonlyDeep } from 'type-fest';
2
+ import { Diagnostics, DiagnosticInput } from '../_shared/diagnostics.js';
5
3
  import { LitElement } from 'lit';
6
4
 
5
+ type StringMap<T = unknown> = Record<string, T>;
6
+ type AnyRecord = StringMap<unknown>;
7
+
8
+ type IntrinsicTag = keyof HTMLElementTagNameMap;
9
+
10
+ type ElementType = IntrinsicTag | (string & {});
11
+
12
+ 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"];
13
+ type KnownAriaRole = (typeof KNOWN_ARIA_ROLES)[number];
14
+
15
+ type Booleanish = boolean | 'true' | 'false';
16
+ type ClassName = string | string[];
17
+ type EmptyRecord = Record<never, never>;
18
+ type NonEmptyArray<T> = [T, ...T[]];
19
+ type Numberish = number | `${number}`;
20
+ type Primitive = string | number | boolean;
21
+ type AriaRole = KnownAriaRole | (string & {});
22
+ type IntrinsicProps = AnyRecord & {
23
+ role?: AriaRole;
24
+ };
25
+ type TagMap = Partial<Record<IntrinsicTag | (string & {}), ClassName>>;
26
+
27
+ type MinMax = {
28
+ min: number;
29
+ max: number;
30
+ };
31
+ type CardinalityInput = Partial<MinMax>;
32
+
33
+ type ChildRuleMatch<T, U extends T = T> = (child: T) => child is U;
34
+
35
+ type ChildRulePosition = 'first' | 'last' | 'any';
36
+
37
+ type ChildRuleInput<T = unknown, U extends T = T> = {
38
+ name: string;
39
+ match: ChildRuleMatch<T, U>;
40
+ cardinality?: CardinalityInput;
41
+ position?: ChildRulePosition;
42
+ /**
43
+ * Optional component-type reference for O(1) dispatch index.
44
+ * When provided for every rule, the matcher reads child.type instead of
45
+ * calling every match function on every child (O(n×m) → O(n+m)).
46
+ */
47
+ type?: unknown;
48
+ };
49
+
50
+ type ValidResult = {
51
+ valid: true;
52
+ };
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
+ type StringToBoolean<T> = T extends 'true' | 'false' ? boolean : T;
78
+ type VariantValue = string | string[];
79
+ type VariantStates<K extends string = string> = Record<K, VariantValue>;
80
+ type VariantMap<V extends string = string, K extends string = string> = Record<V, VariantStates<K>>;
81
+ type VariantKey<V extends VariantMap, K extends keyof V> = StringToBoolean<keyof V[K] & string>;
82
+ /**
83
+ * A partial selection of variant states authored at factory definition time.
84
+ *
85
+ * Uses `keyof V[K]` directly (not `VariantKey`) so TypeScript can eagerly
86
+ * resolve the union at constraint-check time without deferred conditional types.
87
+ */
88
+ type VariantSelection<V extends VariantMap> = {
89
+ [K in keyof V]?: keyof V[K];
90
+ };
91
+ type NormalizedVariantValue<K extends string> = string extends K ? Primitive : K extends 'true' | 'false' ? Booleanish : K extends `${number}` ? Numberish : K;
92
+ type DefaultVariants<V extends VariantMap> = {
93
+ [K in keyof V]?: NormalizedVariantValue<keyof V[K] & string>;
94
+ };
95
+ /**
96
+ * A static, immutable map of named presets to partial variant selections.
97
+ *
98
+ * Presets are named bundles of variant props that callers activate by key,
99
+ * avoiding the need to repeat variant combinations at each call site.
100
+ */
101
+ type RecipeMap<V extends VariantMap = VariantMap> = Readonly<Record<string, VariantSelection<V>>>;
102
+ type RecipeTarget<TVariants extends VariantMap = VariantMap> = VariantSelection<TVariants>;
103
+
104
+ interface BaseClassOptions {
105
+ baseClassName?: ClassName;
106
+ }
107
+
108
+ type ClassPipelineFn = (tag: unknown, props: AnyRecord, className?: ClassName, recipe?: string) => string;
109
+
110
+ interface RecipeOptions<TVariants extends VariantMap = VariantMap> {
111
+ recipeMap?: Record<string, RecipeTarget<TVariants>>;
112
+ }
113
+
114
+ interface TagMapOptions {
115
+ tagMap?: TagMap;
116
+ }
117
+
118
+ type CompositionOptions<TVariants extends VariantMap = VariantMap> = Simplify<TagMapOptions & RecipeOptions<TVariants>>;
119
+
120
+ type CVASystemOptions<TVariants extends VariantMap = VariantMap> = Simplify<CVAVariants<TVariants> & CVADefaults<TVariants> & CVACompounds<TVariants>>;
121
+
122
+ type StyleOptions<TVariants extends VariantMap = VariantMap> = Simplify<BaseClassOptions & CVASystemOptions<TVariants>>;
123
+
124
+ type ClassPipelineOptions<TVariants extends VariantMap = VariantMap> = Simplify<StyleOptions<TVariants> & CompositionOptions<TVariants>>;
125
+
126
+ type OwnedPropKeys = ReadonlySet<string>;
127
+
128
+ type ClassPlugin<TProps extends AnyRecord = EmptyRecord> = Readonly<{
129
+ pipeline: ClassPipelineFn;
130
+ ownedKeys?: OwnedPropKeys;
131
+ readonly _pluginProps?: TProps;
132
+ }>;
133
+
134
+ type ClassPluginFactory<TProps extends AnyRecord = EmptyRecord> = <V extends VariantMap>(options: ClassPipelineOptions<V>, diagnostics: Diagnostics) => ClassPlugin<TProps>;
135
+ type ExtractPluginProps<TPlugin extends ClassPluginFactory<AnyRecord> | undefined> = TPlugin extends ClassPluginFactory<infer T> ? string extends keyof T ? EmptyRecord : T : EmptyRecord;
136
+
137
+ type AriaContext = {
138
+ readonly tag: IntrinsicTag;
139
+ readonly implicitRole: AriaRole | undefined;
140
+ readonly effectiveRole: string | undefined;
141
+ readonly props: ReadonlyDeep<IntrinsicProps>;
142
+ };
143
+
144
+ type RemoveAttributeFixKind = `removeAttribute:${string}`;
145
+ type InjectLiveFixKind = `injectLive:${string}`;
146
+ type FixKind = 'removeRole' | 'setRole' | 'normalizeRelevantAll' | RemoveAttributeFixKind | InjectLiveFixKind;
147
+
148
+ type AriaFixResult = {
149
+ applied: false;
150
+ next: ReadonlyDeep<IntrinsicProps>;
151
+ } | {
152
+ applied: true;
153
+ next: ReadonlyDeep<IntrinsicProps>;
154
+ previous: ReadonlyDeep<IntrinsicProps>;
155
+ };
156
+ type AriaFix = {
157
+ readonly kind: FixKind;
158
+ readonly priority?: number;
159
+ readonly source?: string;
160
+ readonly apply: (context: AriaContext) => AriaFixResult;
161
+ };
162
+
163
+ type Severity = 'error' | 'warning' | (string & {});
164
+
165
+ type AriaInvalidBase<M extends string = string> = {
166
+ valid: false;
167
+ severity: Severity;
168
+ message?: M;
169
+ attribute?: string;
170
+ diagnostic?: DiagnosticInput;
171
+ };
172
+ type AriaInvalidWithFix<M extends string = string> = AriaInvalidBase<M> & {
173
+ fixable: true;
174
+ fix: AriaFix;
175
+ };
176
+ type AriaInvalidWithoutFix<M extends string = string> = AriaInvalidBase<M> & {
177
+ fixable: false;
178
+ };
179
+ type AriaInvalidResult<M extends string = string> = AriaInvalidWithFix<M> | AriaInvalidWithoutFix<M>;
180
+ type AriaResult = ValidResult | AriaInvalidResult;
181
+
182
+ type AriaRule<C extends AriaContext = AriaContext> = (context: C) => readonly AriaResult[];
183
+
184
+ type PropNormalizer = (props: Readonly<AnyRecord & IntrinsicProps>) => Partial<AnyRecord & IntrinsicProps>;
185
+
186
+ type EnforcementOptions<TAllowed extends ElementType = ElementType> = {
187
+ readonly diagnostics?: Diagnostics;
188
+ readonly aria?: readonly AriaRule[];
189
+ readonly children?: readonly ChildRuleInput[];
190
+ readonly props?: readonly PropNormalizer[];
191
+ /** Restricts the `as` prop to this set of tags. Violations route through diagnostics. */
192
+ readonly allowedAs?: readonly TAllowed[];
193
+ };
194
+
195
+ type StylingOptions<V extends Readonly<VariantMap> = Readonly<EmptyRecord>, TPreset extends RecipeMap<V> = Readonly<EmptyRecord>, TPlugin extends ClassPluginFactory<AnyRecord> | undefined = ClassPluginFactory<AnyRecord> | undefined> = {
196
+ readonly base?: ClassName;
197
+ readonly variants?: V;
198
+ readonly defaults?: Partial<DefaultVariants<V>>;
199
+ readonly compounds?: readonly CompoundVariant<V>[];
200
+ readonly presets?: TPreset;
201
+ readonly tags?: Readonly<TagMap>;
202
+ readonly plugin?: TPlugin;
203
+ readonly precomputedClasses?: Readonly<Record<string, string>>;
204
+ };
205
+
206
+ type NormalizeFn<Props extends AnyRecord = AnyRecord> = {
207
+ normalize(props: Readonly<Props & IntrinsicProps>): Props & IntrinsicProps;
208
+ }['normalize'];
209
+ type AnyFactoryOptions = FactoryOptions<ElementType, AnyRecord, VariantMap, RecipeMap<VariantMap>, ClassPluginFactory<AnyRecord> | undefined>;
210
+ type FactoryOptions<TDefault extends ElementType = ElementType, Props extends AnyRecord = EmptyRecord, V extends Readonly<VariantMap> = Readonly<EmptyRecord>, TPreset extends RecipeMap<V> = Readonly<EmptyRecord>, TPlugin extends ClassPluginFactory<AnyRecord> | undefined = ClassPluginFactory<AnyRecord> | undefined, TAllowed extends ElementType = ElementType> = {
211
+ readonly tag?: TDefault;
212
+ readonly name?: string;
213
+ readonly defaults?: Partial<NoInfer<Props>>;
214
+ readonly normalize?: NormalizeFn<NoInfer<Props>>;
215
+ readonly styling?: StylingOptions<V, TPreset, TPlugin>;
216
+ readonly enforcement?: EnforcementOptions<TAllowed>;
217
+ };
218
+
219
+ type FilterPredicate = (key: string, variantKeys: ReadonlySet<string>) => boolean;
220
+
221
+ declare function defineContractComponent<O extends FactoryOptions>(options: O): <R>(factory: (options: O) => R) => R;
222
+
7
223
  /**
8
224
  * Options accepted by createContractComponent in the Lit adapter.
9
225
  *
@@ -76,4 +292,4 @@ declare function createContractComponent<TDefault extends ElementType, TProps ex
76
292
  */
77
293
  declare function renderToString(component: LitContractComponent, props?: UnknownProps, innerHTML?: string): string;
78
294
 
79
- export { type LitContractComponent, type LitFactoryOptions, createContractComponent, renderToString };
295
+ export { type AnyFactoryOptions, type LitContractComponent, type LitFactoryOptions, createContractComponent, defineContractComponent, renderToString };