praxis-kit 6.6.1 → 7.0.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.
@@ -92,6 +92,7 @@ declare enum DiagnosticCode {
92
92
  TailwindMultipleDisplayProps = "CSS6001",
93
93
  TailwindReservedLayoutLiteral = "CSS6002",
94
94
  TailwindDeadVariantClass = "CSS6003",
95
+ TailwindLayoutOnVoidTag = "CSS6004",
95
96
  PluginInvalidShape = "PLUGIN7001",
96
97
  PluginPipelineReturnType = "PLUGIN7002",
97
98
  InternalError = "INTERNAL9000"
@@ -93,6 +93,7 @@ var DiagnosticCode = /* @__PURE__ */ ((DiagnosticCode2) => {
93
93
  DiagnosticCode2["TailwindMultipleDisplayProps"] = "CSS6001";
94
94
  DiagnosticCode2["TailwindReservedLayoutLiteral"] = "CSS6002";
95
95
  DiagnosticCode2["TailwindDeadVariantClass"] = "CSS6003";
96
+ DiagnosticCode2["TailwindLayoutOnVoidTag"] = "CSS6004";
96
97
  DiagnosticCode2["PluginInvalidShape"] = "PLUGIN7001";
97
98
  DiagnosticCode2["PluginPipelineReturnType"] = "PLUGIN7002";
98
99
  DiagnosticCode2["InternalError"] = "INTERNAL9000";
@@ -16,6 +16,11 @@ var EVENT_HANDLER_RE = /^on[A-Z]/;
16
16
  // ../../lib/primitive/src/rule/rule-brand.ts
17
17
  var RULE_BRAND = /* @__PURE__ */ Symbol("praxis-kit/dynamic-rule");
18
18
 
19
+ // ../../lib/primitive/src/rule/dynamic.ts
20
+ function dynamic(resolve) {
21
+ return { [RULE_BRAND]: true, resolve };
22
+ }
23
+
19
24
  // ../../lib/primitive/src/guards/foundational/is-defined.ts
20
25
  function isUndefined(value) {
21
26
  return value === void 0;
@@ -29,7 +34,7 @@ function isNonNull(value) {
29
34
  return value != null;
30
35
  }
31
36
  function isNullish(value) {
32
- return isNull(value) || value === void 0;
37
+ return isNull(value) || isUndefined(value);
33
38
  }
34
39
 
35
40
  // ../../lib/primitive/src/utils/type-guards.ts
@@ -643,6 +648,24 @@ var ROLE_RESTRICTED_ATTRIBUTES = /* @__PURE__ */ new Map([
643
648
  ]
644
649
  ]);
645
650
 
651
+ // ../../lib/primitive/src/constants/html/void-tags.ts
652
+ var VOID_TAGS = [
653
+ "area",
654
+ "base",
655
+ "br",
656
+ "col",
657
+ "embed",
658
+ "hr",
659
+ "img",
660
+ "input",
661
+ "link",
662
+ "meta",
663
+ "param",
664
+ "source",
665
+ "track",
666
+ "wbr"
667
+ ];
668
+
646
669
  // ../../lib/primitive/src/constants/primitive/slot-name.ts
647
670
  var SLOT_NAME = "Slot";
648
671
 
@@ -1627,7 +1650,8 @@ var AriaPolicyEngine = class _AriaPolicyEngine extends InvariantBase {
1627
1650
  const cached = _AriaPolicyEngine.#removeAttributeFixCache.get(attr);
1628
1651
  if (cached) return cached;
1629
1652
  const fix = {
1630
- kind: `removeAttribute:${attr}`,
1653
+ kind: "removeAttribute",
1654
+ attribute: attr,
1631
1655
  apply: ({ props }) => {
1632
1656
  if (!(attr in props)) return { applied: false, next: props };
1633
1657
  return { applied: true, next: omitProp(props, attr), previous: props };
@@ -1898,7 +1922,8 @@ var AriaPolicyEngine = class _AriaPolicyEngine extends InvariantBase {
1898
1922
  if (!impliedLive) return NO_VIOLATIONS2;
1899
1923
  if ("aria-live" in props) return NO_VIOLATIONS2;
1900
1924
  const injectLive = {
1901
- kind: `injectLive:${effectiveRole}`,
1925
+ kind: "injectLive",
1926
+ attribute: "aria-live",
1902
1927
  apply: (ctx) => ({
1903
1928
  applied: true,
1904
1929
  next: { ...ctx.props, "aria-live": impliedLive },
@@ -1967,6 +1992,23 @@ var AriaPolicyEngine = class _AriaPolicyEngine extends InvariantBase {
1967
1992
  }
1968
1993
  };
1969
1994
 
1995
+ // ../../lib/contract/src/aria/factories.ts
1996
+ function removeProp(props, key) {
1997
+ const next = { ...props };
1998
+ delete next[key];
1999
+ return next;
2000
+ }
2001
+ function removeAttributeFix(attribute) {
2002
+ return Object.freeze({
2003
+ kind: "removeAttribute",
2004
+ attribute,
2005
+ apply: ({ props }) => {
2006
+ if (!(attribute in props)) return { applied: false, next: props };
2007
+ return { applied: true, next: removeProp(props, attribute), previous: props };
2008
+ }
2009
+ });
2010
+ }
2011
+
1970
2012
  // ../../lib/contract/src/children/get-type-name.ts
1971
2013
  function getTypeName(value) {
1972
2014
  if (value === null) return "null";
@@ -2285,22 +2327,6 @@ import { warnDiagnostics as warnDiagnostics2 } from "./_shared/diagnostics.js";
2285
2327
 
2286
2328
  // ../core/src/html/contracts/categories.ts
2287
2329
  var METADATA_TAGS = ["script", "template"];
2288
- var VOID_TAGS = [
2289
- "area",
2290
- "base",
2291
- "br",
2292
- "col",
2293
- "embed",
2294
- "hr",
2295
- "img",
2296
- "input",
2297
- "link",
2298
- "meta",
2299
- "param",
2300
- "source",
2301
- "track",
2302
- "wbr"
2303
- ];
2304
2330
  var TEXT_ONLY_TAGS = [
2305
2331
  "option",
2306
2332
  "script",
@@ -2424,20 +2450,6 @@ var INPUT_MUTUALLY_EXCLUSIVE_POLICIES = [
2424
2450
 
2425
2451
  // ../core/src/html/spec/validators/attribute-type-validator.ts
2426
2452
  var DEFAULT_INPUT_TYPE = "text";
2427
- function omit(props, key) {
2428
- const next = { ...props };
2429
- delete next[key];
2430
- return next;
2431
- }
2432
- function removeAttributeFix(attribute) {
2433
- return {
2434
- kind: `removeAttribute:${attribute}`,
2435
- apply: ({ props }) => {
2436
- if (!(attribute in props)) return { applied: false, next: props };
2437
- return { applied: true, next: omit(props, attribute), previous: props };
2438
- }
2439
- };
2440
- }
2441
2453
  function createInputAttributeTypeRule({
2442
2454
  attribute,
2443
2455
  allowedTypes
@@ -2943,6 +2955,13 @@ function isLabelableControl(child) {
2943
2955
  const type = getChildProp(child, "type");
2944
2956
  return !isString(type) || type !== "hidden";
2945
2957
  }
2958
+ function hasAccessibleNameProp(props) {
2959
+ return "aria-label" in props || "aria-labelledby" in props;
2960
+ }
2961
+ function isNonEmptyTextChild(child) {
2962
+ if (isNumber(child)) return true;
2963
+ return isString(child) && child.trim().length > 0;
2964
+ }
2946
2965
  var labelContract = contract([
2947
2966
  { name: "control", match: isLabelableControl, cardinality: { max: 1 } },
2948
2967
  { name: "nested-label", match: isTag("label"), cardinality: { max: 0 } },
@@ -2950,6 +2969,13 @@ var labelContract = contract([
2950
2969
  name: "other-interactive-content",
2951
2970
  match: isTag(...OTHER_INTERACTIVE_TAGS),
2952
2971
  cardinality: { max: 0 }
2972
+ },
2973
+ {
2974
+ name: "accessible-name",
2975
+ match: isNonEmptyTextChild,
2976
+ cardinality: dynamic(
2977
+ (ctx) => hasAccessibleNameProp(ctx.props) ? { min: 0 } : { min: 1 }
2978
+ )
2953
2979
  }
2954
2980
  ]);
2955
2981
 
@@ -3824,7 +3850,10 @@ function render({
3824
3850
  tag: state.tag,
3825
3851
  props: state.normalizedProps
3826
3852
  });
3827
- runtime.options.htmlChildrenEvaluatorFn?.(state.tag)?.evaluate(getNormalizedChildren());
3853
+ runtime.options.htmlChildrenEvaluatorFn?.(state.tag)?.evaluate(getNormalizedChildren(), {
3854
+ tag: state.tag,
3855
+ props: state.normalizedProps
3856
+ });
3828
3857
  }
3829
3858
  if (typeof props.render === "function") {
3830
3859
  return props.render({ ...state.props, className: state.className, ref });
@@ -177,8 +177,8 @@ type AriaContext = {
177
177
  readonly props: ReadonlyDeep<IntrinsicProps>;
178
178
  };
179
179
 
180
- type RemoveAttributeFixKind = `removeAttribute:${string}`;
181
- type InjectLiveFixKind = `injectLive:${string}`;
180
+ type RemoveAttributeFixKind = 'removeAttribute';
181
+ type InjectLiveFixKind = 'injectLive';
182
182
  type FixKind = 'removeRole' | 'setRole' | 'normalizeRelevantAll' | RemoveAttributeFixKind | InjectLiveFixKind;
183
183
 
184
184
  type AriaFixResult = {
@@ -191,6 +191,9 @@ type AriaFixResult = {
191
191
  };
192
192
  type AriaFix = {
193
193
  readonly kind: FixKind;
194
+ /** The attribute a `'removeAttribute'`/`'injectLive'` fix targets — always set for those
195
+ * kinds, absent for kinds with no single-attribute target (`'removeRole'`, etc.). */
196
+ readonly attribute?: string;
194
197
  readonly priority?: number;
195
198
  readonly source?: string;
196
199
  readonly apply: (context: AriaContext) => AriaFixResult;
@@ -287,6 +290,56 @@ type FactoryOptions<TDefault extends ElementType = ElementType, Props extends An
287
290
  readonly diagnostics?: Diagnostics$1;
288
291
  };
289
292
 
293
+ /** Shared input shape for `invalidWithFix`/`invalidWithoutFix`. */
294
+ type InvalidResultInput = {
295
+ readonly severity: Severity;
296
+ readonly attribute?: string;
297
+ readonly message?: string;
298
+ readonly diagnostic?: DiagnosticInput;
299
+ };
300
+
301
+ /** Options for `createRemoveAttributeRule`. */
302
+ type RemoveAttributeRuleOptions = {
303
+ /** Returns true when `attribute` should be stripped for the given render. */
304
+ readonly when: (context: AriaContext) => boolean;
305
+ readonly severity?: Severity;
306
+ readonly message?: string;
307
+ /** Receives the same context `when` did, so the diagnostic can reference the offending value. */
308
+ readonly diagnostic?: (context: AriaContext) => DiagnosticInput;
309
+ readonly readsProps?: readonly string[];
310
+ readonly tags?: readonly string[];
311
+ };
312
+
313
+ /**
314
+ * Builds a correctly-literal-typed `fixable: false` `AriaResult`. Exists so a rule author can
315
+ * extract shared branch logic (severity/attribute/message computed once, reused across multiple
316
+ * `return`s) without TypeScript silently widening `valid: false`/`fixable: false` to `boolean`
317
+ * the moment those values leave an object-literal-in-return-position — the widening only happens
318
+ * on plain object literals; a function's declared return type narrows unconditionally.
319
+ */
320
+ declare function invalidWithoutFix(input: InvalidResultInput): AriaInvalidWithoutFix;
321
+ /** Same as {@link invalidWithoutFix}, for the `fixable: true` branch — requires a `fix`. */
322
+ declare function invalidWithFix(input: InvalidResultInput & {
323
+ readonly fix: AriaFix;
324
+ }): AriaInvalidWithFix;
325
+ /**
326
+ * Builds an `AriaFix` that strips a single attribute — the shape `dangerousHrefRule`-style
327
+ * "strip this attribute when it's dangerous/redundant" rules need. A no-op (`applied: false`) when
328
+ * the attribute isn't present, so applying the fix twice (or applying it when nothing triggered it)
329
+ * is always safe. Frozen — a fix is a value object; nothing should mutate `kind`/`attribute`/`apply`
330
+ * after construction.
331
+ */
332
+ declare function removeAttributeFix(attribute: string): AriaFix;
333
+ /**
334
+ * Convenience factory for the single most common `enforcement.aria`/`enforcement.rules` shape:
335
+ * "strip this attribute when some condition on the element's own props holds" — covers
336
+ * security-style guards (a dangerous URL scheme on `href`) and redundant-attribute rules alike,
337
+ * without hand-writing the rule function, the `AriaFix`, and the `invalidWithFix` call each time.
338
+ * A rule with no fix (a warn-only advisory) still needs the raw `AriaRule` shape directly — this
339
+ * factory is deliberately scoped to the strip-on-match case, not a general rule builder.
340
+ */
341
+ declare function createRemoveAttributeRule(attribute: string, options: RemoveAttributeRuleOptions): AriaRule;
342
+
290
343
  declare const activeProps: PropNormalizer;
291
344
 
292
345
  declare const disabledProps: PropNormalizer;
@@ -316,4 +369,4 @@ declare function mergeContracts(...contracts: readonly EnforcementOptions[]): En
316
369
 
317
370
  type Diagnostics = Diagnostics$1;
318
371
 
319
- export { type AnyFactoryOptions, type AriaContext, type AriaFix, type AriaFixResult, type AriaPhase, type AriaResult, type AriaRule, type Diagnostics, type FixKind, type IntrinsicProps, type AriaInvalidResult as InvalidResult, type AriaInvalidWithFix as InvalidWithFix, type AriaInvalidWithoutFix as InvalidWithoutFix, type NormalizeFn, type PropNormalizer, type RemoveAttributeFixKind, type Severity, type ValidResult, activeContract, activeProps, disabledContract, disabledProps, expandedContract, expandedProps, invalidContract, invalidProps, loadingContract, loadingProps, mergeContracts, pressedContract, pressedProps, readonlyContract, readonlyProps, selectedContract, selectedProps };
372
+ export { type AnyFactoryOptions, type AriaContext, type AriaFix, type AriaFixResult, type AriaPhase, type AriaResult, type AriaRule, type Diagnostics, type FixKind, type IntrinsicProps, type AriaInvalidResult as InvalidResult, type AriaInvalidWithFix as InvalidWithFix, type AriaInvalidWithoutFix as InvalidWithoutFix, type NormalizeFn, type PropNormalizer, type RemoveAttributeFixKind, type Severity, type ValidResult, activeContract, activeProps, createRemoveAttributeRule, disabledContract, disabledProps, expandedContract, expandedProps, invalidContract, invalidProps, invalidWithFix, invalidWithoutFix, loadingContract, loadingProps, mergeContracts, pressedContract, pressedProps, readonlyContract, readonlyProps, removeAttributeFix, selectedContract, selectedProps };
@@ -1,3 +1,8 @@
1
+ // ../../lib/primitive/src/guards/foundational/is-defined.ts
2
+ function isDefined(value) {
3
+ return value !== void 0;
4
+ }
5
+
1
6
  // ../../lib/primitive/src/utils/iterate.ts
2
7
  function find(iterable, callback) {
3
8
  for (const value of iterable) {
@@ -168,6 +173,72 @@ var iterate = Object.freeze({
168
173
  values
169
174
  });
170
175
 
176
+ // ../../lib/contract/src/aria/factories.ts
177
+ function invalidWithoutFix(input) {
178
+ return {
179
+ valid: false,
180
+ fixable: false,
181
+ severity: input.severity,
182
+ ...isDefined(input.attribute) && { attribute: input.attribute },
183
+ ...isDefined(input.message) && { message: input.message },
184
+ ...isDefined(input.diagnostic) && { diagnostic: input.diagnostic }
185
+ };
186
+ }
187
+ function invalidWithFix(input) {
188
+ return {
189
+ valid: false,
190
+ fixable: true,
191
+ severity: input.severity,
192
+ ...isDefined(input.attribute) && { attribute: input.attribute },
193
+ ...isDefined(input.message) && { message: input.message },
194
+ ...isDefined(input.diagnostic) && { diagnostic: input.diagnostic },
195
+ fix: input.fix
196
+ };
197
+ }
198
+ function removeProp(props, key) {
199
+ const next = { ...props };
200
+ delete next[key];
201
+ return next;
202
+ }
203
+ function removeAttributeFix(attribute) {
204
+ return Object.freeze({
205
+ kind: "removeAttribute",
206
+ attribute,
207
+ apply: ({ props }) => {
208
+ if (!(attribute in props)) return { applied: false, next: props };
209
+ return { applied: true, next: removeProp(props, attribute), previous: props };
210
+ }
211
+ });
212
+ }
213
+ function defineRuleMetadata(rule, metadata) {
214
+ const descriptors = {};
215
+ for (const key of Object.keys(metadata)) {
216
+ descriptors[key] = { value: metadata[key], enumerable: false };
217
+ }
218
+ Object.defineProperties(rule, descriptors);
219
+ return rule;
220
+ }
221
+ function createRemoveAttributeRule(attribute, options) {
222
+ const { when, severity = "warning", message, diagnostic, readsProps, tags } = options;
223
+ const fix = removeAttributeFix(attribute);
224
+ const rule = (context) => {
225
+ if (!when(context)) return [];
226
+ return [
227
+ invalidWithFix({
228
+ severity,
229
+ attribute,
230
+ ...isDefined(message) && { message },
231
+ ...isDefined(diagnostic) && { diagnostic: diagnostic(context) },
232
+ fix
233
+ })
234
+ ];
235
+ };
236
+ return defineRuleMetadata(rule, {
237
+ ...isDefined(readsProps) && { readsProps },
238
+ ...isDefined(tags) && { tags }
239
+ });
240
+ }
241
+
171
242
  // ../../lib/contract/src/props/get-active-props.ts
172
243
  var activeProps = ({
173
244
  active,
@@ -333,12 +404,15 @@ function mergeContracts(...contracts) {
333
404
  export {
334
405
  activeContract,
335
406
  activeProps,
407
+ createRemoveAttributeRule,
336
408
  disabledContract,
337
409
  disabledProps,
338
410
  expandedContract,
339
411
  expandedProps,
340
412
  invalidContract,
341
413
  invalidProps,
414
+ invalidWithFix,
415
+ invalidWithoutFix,
342
416
  loadingContract,
343
417
  loadingProps,
344
418
  mergeContracts,
@@ -346,6 +420,7 @@ export {
346
420
  pressedProps,
347
421
  readonlyContract,
348
422
  readonlyProps,
423
+ removeAttributeFix,
349
424
  selectedContract,
350
425
  selectedProps
351
426
  };
@@ -28,9 +28,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
28
28
  mod
29
29
  ));
30
30
 
31
- // ../../node_modules/.pnpm/@typescript-eslint+utils@8.63.0_eslint@10.7.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.65.0_eslint@10.7.0_jiti@2.7.0__typescript@6.0.3/node_modules/@typescript-eslint/utils/dist/eslint-utils/deepMerge.js
32
32
  var require_deepMerge = __commonJS({
33
- "../../node_modules/.pnpm/@typescript-eslint+utils@8.63.0_eslint@10.7.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.65.0_eslint@10.7.0_jiti@2.7.0__typescript@6.0.3/node_modules/@typescript-eslint/utils/dist/eslint-utils/deepMerge.js"(exports) {
34
34
  "use strict";
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
36
  exports.isObjectNotArray = isObjectNotArray;
@@ -63,9 +63,9 @@ var require_deepMerge = __commonJS({
63
63
  }
64
64
  });
65
65
 
66
- // ../../node_modules/.pnpm/@typescript-eslint+utils@8.63.0_eslint@10.7.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.65.0_eslint@10.7.0_jiti@2.7.0__typescript@6.0.3/node_modules/@typescript-eslint/utils/dist/eslint-utils/applyDefault.js
67
67
  var require_applyDefault = __commonJS({
68
- "../../node_modules/.pnpm/@typescript-eslint+utils@8.63.0_eslint@10.7.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.65.0_eslint@10.7.0_jiti@2.7.0__typescript@6.0.3/node_modules/@typescript-eslint/utils/dist/eslint-utils/applyDefault.js"(exports) {
69
69
  "use strict";
70
70
  Object.defineProperty(exports, "__esModule", { value: true });
71
71
  exports.applyDefault = applyDefault;
@@ -90,9 +90,9 @@ var require_applyDefault = __commonJS({
90
90
  }
91
91
  });
92
92
 
93
- // ../../node_modules/.pnpm/@typescript-eslint+utils@8.63.0_eslint@10.7.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.65.0_eslint@10.7.0_jiti@2.7.0__typescript@6.0.3/node_modules/@typescript-eslint/utils/dist/eslint-utils/parserSeemsToBeTSESLint.js
94
94
  var require_parserSeemsToBeTSESLint = __commonJS({
95
- "../../node_modules/.pnpm/@typescript-eslint+utils@8.63.0_eslint@10.7.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.65.0_eslint@10.7.0_jiti@2.7.0__typescript@6.0.3/node_modules/@typescript-eslint/utils/dist/eslint-utils/parserSeemsToBeTSESLint.js"(exports) {
96
96
  "use strict";
97
97
  Object.defineProperty(exports, "__esModule", { value: true });
98
98
  exports.parserSeemsToBeTSESLint = parserSeemsToBeTSESLint;
@@ -102,9 +102,9 @@ var require_parserSeemsToBeTSESLint = __commonJS({
102
102
  }
103
103
  });
104
104
 
105
- // ../../node_modules/.pnpm/@typescript-eslint+utils@8.63.0_eslint@10.7.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.65.0_eslint@10.7.0_jiti@2.7.0__typescript@6.0.3/node_modules/@typescript-eslint/utils/dist/eslint-utils/getParserServices.js
106
106
  var require_getParserServices = __commonJS({
107
- "../../node_modules/.pnpm/@typescript-eslint+utils@8.63.0_eslint@10.7.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.65.0_eslint@10.7.0_jiti@2.7.0__typescript@6.0.3/node_modules/@typescript-eslint/utils/dist/eslint-utils/getParserServices.js"(exports) {
108
108
  "use strict";
109
109
  Object.defineProperty(exports, "__esModule", { value: true });
110
110
  exports.getParserServices = getParserServices;
@@ -135,17 +135,17 @@ var require_getParserServices = __commonJS({
135
135
  }
136
136
  });
137
137
 
138
- // ../../node_modules/.pnpm/@typescript-eslint+utils@8.63.0_eslint@10.7.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.65.0_eslint@10.7.0_jiti@2.7.0__typescript@6.0.3/node_modules/@typescript-eslint/utils/dist/eslint-utils/InferTypesFromRule.js
139
139
  var require_InferTypesFromRule = __commonJS({
140
- "../../node_modules/.pnpm/@typescript-eslint+utils@8.63.0_eslint@10.7.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.65.0_eslint@10.7.0_jiti@2.7.0__typescript@6.0.3/node_modules/@typescript-eslint/utils/dist/eslint-utils/InferTypesFromRule.js"(exports) {
141
141
  "use strict";
142
142
  Object.defineProperty(exports, "__esModule", { value: true });
143
143
  }
144
144
  });
145
145
 
146
- // ../../node_modules/.pnpm/@typescript-eslint+utils@8.63.0_eslint@10.7.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.65.0_eslint@10.7.0_jiti@2.7.0__typescript@6.0.3/node_modules/@typescript-eslint/utils/dist/eslint-utils/nullThrows.js
147
147
  var require_nullThrows = __commonJS({
148
- "../../node_modules/.pnpm/@typescript-eslint+utils@8.63.0_eslint@10.7.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.65.0_eslint@10.7.0_jiti@2.7.0__typescript@6.0.3/node_modules/@typescript-eslint/utils/dist/eslint-utils/nullThrows.js"(exports) {
149
149
  "use strict";
150
150
  Object.defineProperty(exports, "__esModule", { value: true });
151
151
  exports.NullThrowsReasons = void 0;
@@ -163,9 +163,9 @@ var require_nullThrows = __commonJS({
163
163
  }
164
164
  });
165
165
 
166
- // ../../node_modules/.pnpm/@typescript-eslint+utils@8.63.0_eslint@10.7.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.65.0_eslint@10.7.0_jiti@2.7.0__typescript@6.0.3/node_modules/@typescript-eslint/utils/dist/eslint-utils/RuleCreator.js
167
167
  var require_RuleCreator = __commonJS({
168
- "../../node_modules/.pnpm/@typescript-eslint+utils@8.63.0_eslint@10.7.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.65.0_eslint@10.7.0_jiti@2.7.0__typescript@6.0.3/node_modules/@typescript-eslint/utils/dist/eslint-utils/RuleCreator.js"(exports) {
169
169
  "use strict";
170
170
  Object.defineProperty(exports, "__esModule", { value: true });
171
171
  exports.RuleCreator = RuleCreator8;
@@ -211,9 +211,9 @@ var require_RuleCreator = __commonJS({
211
211
  }
212
212
  });
213
213
 
214
- // ../../node_modules/.pnpm/@typescript-eslint+utils@8.63.0_eslint@10.7.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.65.0_eslint@10.7.0_jiti@2.7.0__typescript@6.0.3/node_modules/@typescript-eslint/utils/dist/eslint-utils/index.js
215
215
  var require_eslint_utils = __commonJS({
216
- "../../node_modules/.pnpm/@typescript-eslint+utils@8.63.0_eslint@10.7.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.65.0_eslint@10.7.0_jiti@2.7.0__typescript@6.0.3/node_modules/@typescript-eslint/utils/dist/eslint-utils/index.js"(exports) {
217
217
  "use strict";
218
218
  var __createBinding = exports && exports.__createBinding || (Object.create ? (function(o, m, k, k2) {
219
219
  if (k2 === void 0) k2 = k;
@@ -1,6 +1,26 @@
1
1
  type StringMap<T = unknown> = Record<string, T>;
2
2
  type AnyRecord = StringMap<unknown>;
3
3
 
4
+ /**
5
+ * Well-known Symbol stamped onto every component created by praxis-kit factories.
6
+ * Stores the factory's defaultTag — the tag that renders when no `as` prop is given.
7
+ * HOC wrappers must propagate it: `Wrapped[COMPONENT_DEFAULT_TAG] = Original[COMPONENT_DEFAULT_TAG]`.
8
+ */
9
+ declare const COMPONENT_DEFAULT_TAG: unique symbol;
10
+ /**
11
+ * Stamps `COMPONENT_DEFAULT_TAG` onto a component function/object, so `isTag()`
12
+ * (and every built-in/custom `enforcement.children` rule built on it) resolves it
13
+ * to `tag` — the same recognition a component created via `createContractComponent`
14
+ * gets automatically. A transparent wrapper around a praxis-kit component (added
15
+ * purely to narrow prop types, for example) is a *different* function object with
16
+ * no `COMPONENT_DEFAULT_TAG` of its own, so without this it silently stops being
17
+ * recognized as a valid child by every parent contract. Returns `component` for
18
+ * call-site chaining, e.g. `export const Wrapped = markComponentTag(WrapperFn, 'source')`.
19
+ */
20
+ declare function markComponentTag<T extends object>(component: T, tag: string): T;
21
+ /** Reads `COMPONENT_DEFAULT_TAG` off a component function/object, if present. */
22
+ declare function getComponentDefaultTag(component: unknown): string | undefined;
23
+
4
24
  /**
5
25
  * Resolves the effective HTML tag for a vnode:
6
26
  * - native element: returns its type string directly
@@ -42,4 +62,4 @@ declare function isObject(value: unknown, excludeArrays: true): value is AnyReco
42
62
  declare function isObject(value: unknown, excludeArrays?: false): value is object;
43
63
  declare function isString(value: unknown): value is string;
44
64
 
45
- export { type FlowContentChild, type TagChild, getTag, isFlowContent, isObject, isString, isTag };
65
+ export { COMPONENT_DEFAULT_TAG, type FlowContentChild, type TagChild, getComponentDefaultTag, getTag, isFlowContent, isObject, isString, isTag, markComponentTag };
@@ -9,9 +9,34 @@ function isString(value) {
9
9
  function isNumber(value) {
10
10
  return typeof value === "number";
11
11
  }
12
+ function isFunction(value) {
13
+ return typeof value === "function";
14
+ }
12
15
 
13
16
  // ../../lib/primitive/src/guards/children/component-id.ts
14
17
  var COMPONENT_DEFAULT_TAG = /* @__PURE__ */ Symbol.for("praxis.component-default-tag");
18
+ function isMarkable(value) {
19
+ return isFunction(value) || isObject(value);
20
+ }
21
+ function defineComponentMetadata(component, metadata) {
22
+ for (const key of Object.getOwnPropertySymbols(metadata)) {
23
+ Object.defineProperty(component, key, {
24
+ value: metadata[key],
25
+ writable: false,
26
+ configurable: true,
27
+ enumerable: false
28
+ });
29
+ }
30
+ return component;
31
+ }
32
+ function markComponentTag(component, tag) {
33
+ return defineComponentMetadata(component, { [COMPONENT_DEFAULT_TAG]: tag });
34
+ }
35
+ function getComponentDefaultTag(component) {
36
+ if (!isMarkable(component)) return void 0;
37
+ const tag = component[COMPONENT_DEFAULT_TAG];
38
+ return typeof tag === "string" ? tag : void 0;
39
+ }
15
40
 
16
41
  // ../../lib/primitive/src/guards/children/is-tag.ts
17
42
  function getAsProp(child) {
@@ -54,9 +79,12 @@ function isFlowContent(...blockedTags) {
54
79
  };
55
80
  }
56
81
  export {
82
+ COMPONENT_DEFAULT_TAG,
83
+ getComponentDefaultTag,
57
84
  getTag,
58
85
  isFlowContent,
59
86
  isObject,
60
87
  isString,
61
- isTag
88
+ isTag,
89
+ markComponentTag
62
90
  };
@@ -25,8 +25,8 @@ type AriaContext = {
25
25
  readonly props: ReadonlyDeep<IntrinsicProps>;
26
26
  };
27
27
 
28
- type RemoveAttributeFixKind = `removeAttribute:${string}`;
29
- type InjectLiveFixKind = `injectLive:${string}`;
28
+ type RemoveAttributeFixKind = 'removeAttribute';
29
+ type InjectLiveFixKind = 'injectLive';
30
30
  type FixKind = 'removeRole' | 'setRole' | 'normalizeRelevantAll' | RemoveAttributeFixKind | InjectLiveFixKind;
31
31
 
32
32
  type AriaFixResult = {
@@ -39,6 +39,9 @@ type AriaFixResult = {
39
39
  };
40
40
  type AriaFix = {
41
41
  readonly kind: FixKind;
42
+ /** The attribute a `'removeAttribute'`/`'injectLive'` fix targets — always set for those
43
+ * kinds, absent for kinds with no single-attribute target (`'removeRole'`, etc.). */
44
+ readonly attribute?: string;
42
45
  readonly priority?: number;
43
46
  readonly source?: string;
44
47
  readonly apply: (context: AriaContext) => AriaFixResult;
@@ -360,6 +360,23 @@ var InputAccessibilityDiagnostics = {
360
360
  }
361
361
  };
362
362
 
363
+ // ../../lib/contract/src/aria/factories.ts
364
+ function removeProp(props, key) {
365
+ const next = { ...props };
366
+ delete next[key];
367
+ return next;
368
+ }
369
+ function removeAttributeFix(attribute) {
370
+ return Object.freeze({
371
+ kind: "removeAttribute",
372
+ attribute,
373
+ apply: ({ props }) => {
374
+ if (!(attribute in props)) return { applied: false, next: props };
375
+ return { applied: true, next: removeProp(props, attribute), previous: props };
376
+ }
377
+ });
378
+ }
379
+
363
380
  // ../core/src/html/contracts/categories.ts
364
381
  var LANDMARK_TAGS = [
365
382
  "article",
@@ -424,20 +441,6 @@ var INPUT_MUTUALLY_EXCLUSIVE_POLICIES = [
424
441
 
425
442
  // ../core/src/html/spec/validators/attribute-type-validator.ts
426
443
  var DEFAULT_INPUT_TYPE = "text";
427
- function omit(props, key) {
428
- const next = { ...props };
429
- delete next[key];
430
- return next;
431
- }
432
- function removeAttributeFix(attribute) {
433
- return {
434
- kind: `removeAttribute:${attribute}`,
435
- apply: ({ props }) => {
436
- if (!(attribute in props)) return { applied: false, next: props };
437
- return { applied: true, next: omit(props, attribute), previous: props };
438
- }
439
- };
440
- }
441
444
  function createInputAttributeTypeRule({
442
445
  attribute,
443
446
  allowedTypes
@@ -179,8 +179,8 @@ type AriaContext = {
179
179
  readonly props: ReadonlyDeep<IntrinsicProps>;
180
180
  };
181
181
 
182
- type RemoveAttributeFixKind = `removeAttribute:${string}`;
183
- type InjectLiveFixKind = `injectLive:${string}`;
182
+ type RemoveAttributeFixKind = 'removeAttribute';
183
+ type InjectLiveFixKind = 'injectLive';
184
184
  type FixKind = 'removeRole' | 'setRole' | 'normalizeRelevantAll' | RemoveAttributeFixKind | InjectLiveFixKind;
185
185
 
186
186
  type AriaFixResult = {
@@ -193,6 +193,9 @@ type AriaFixResult = {
193
193
  };
194
194
  type AriaFix = {
195
195
  readonly kind: FixKind;
196
+ /** The attribute a `'removeAttribute'`/`'injectLive'` fix targets — always set for those
197
+ * kinds, absent for kinds with no single-attribute target (`'removeRole'`, etc.). */
198
+ readonly attribute?: string;
196
199
  readonly priority?: number;
197
200
  readonly source?: string;
198
201
  readonly apply: (context: AriaContext) => AriaFixResult;