praxis-kit 7.4.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.
@@ -25,6 +25,19 @@ type SubComponentMap = Readonly<AnyRecord>;
25
25
  type IntrinsicTag = keyof HTMLElementTagNameMap;
26
26
 
27
27
  type ElementType = IntrinsicTag | (string & {});
28
+ /**
29
+ * Resolves a component's default tag to its real DOM interface — `HTMLDialogElement` for
30
+ * `'dialog'`, `HTMLDetailsElement` for `'details'`, and so on — falling back to `HTMLElement`
31
+ * for custom-element tags or anything not in `HTMLElementTagNameMap`. Used to type
32
+ * `FactoryOptions.onElement`'s `element` param so component authors get direct, correctly-typed
33
+ * access to tag-specific native members (`dialogEl.showModal()`) without an unsafe cast.
34
+ *
35
+ * The fallback is `HTMLElement`, not the more generic `Element` — every tag reachable through
36
+ * `IntrinsicTag` extends it, and so does every custom element per spec, so members `HTMLElement`
37
+ * itself declares (`showPopover()`/`hidePopover()`/`togglePopover()`, the `popover` attribute)
38
+ * stay directly accessible even for tags with no dedicated entry in `HTMLElementTagNameMap`.
39
+ */
40
+ type ElementForTag<TDefault extends ElementType> = TDefault extends keyof HTMLElementTagNameMap ? HTMLElementTagNameMap[TDefault] : HTMLElement;
28
41
 
29
42
  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"];
30
43
  type KnownAriaRole = (typeof KNOWN_ARIA_ROLES)[number];
@@ -124,7 +137,7 @@ type DefaultVariants<V extends VariantMap> = {
124
137
  * Presets are named bundles of variant props that callers activate by key,
125
138
  * avoiding the need to repeat variant combinations at each call site.
126
139
  */
127
- type RecipeMap<V extends VariantMap = VariantMap> = Readonly<Record<string, VariantSelection<V>>>;
140
+ type RecipeMap<V extends VariantMap = VariantMap> = Readonly<StringMap<VariantSelection<V>>>;
128
141
 
129
142
  type RecipeTarget<TVariants extends VariantMap = VariantMap> = VariantSelection<TVariants>;
130
143
 
@@ -158,7 +171,7 @@ interface BaseClassOptions {
158
171
  type ClassPipelineFn = (tag: unknown, props: AnyRecord, className?: ClassName, recipe?: string) => string | undefined;
159
172
 
160
173
  interface RecipeOptions<TVariants extends VariantMap = VariantMap> {
161
- recipeMap?: Record<string, RecipeTarget<TVariants>>;
174
+ recipeMap?: StringMap<RecipeTarget<TVariants>>;
162
175
  }
163
176
 
164
177
  interface TagMapOptions {
@@ -327,7 +340,7 @@ type StylingOptions<V extends Readonly<VariantMap> = Readonly<EmptyRecord>, TPre
327
340
  * combination, skipping runtime class computation entirely when a match is found. Normally
328
341
  * generated by a build-time class-extraction plugin rather than hand-authored.
329
342
  */
330
- readonly precomputedClasses?: Readonly<Record<string, string>>;
343
+ readonly precomputedClasses?: Readonly<StringMap<string>>;
331
344
  };
332
345
 
333
346
  type NormalizeFn<Props extends AnyRecord = AnyRecord> = {
@@ -373,13 +386,23 @@ type FactoryOptions<TDefault extends ElementType = ElementType, Props extends An
373
386
  * no prop-based equivalent), not for anything expressible as a plain
374
387
  * prop.
375
388
  *
389
+ * `element` is typed to the real DOM interface of every tag the rendered
390
+ * element could actually be — `TDefault` plus whatever `enforcement.allowed`
391
+ * permits via `as` (`HTMLDialogElement` for `tag: 'dialog'`,
392
+ * `HTMLDetailsElement` for `tag: 'details'`, and so on) — no cast needed to
393
+ * reach tag-specific members. A component that leaves `allowed`
394
+ * unconstrained (any tag reachable via `as`) falls back to `HTMLElement`,
395
+ * which still covers members every element shares (`showPopover()` and
396
+ * friends); restrict `enforcement.allowed` to the tags `onElement`
397
+ * actually knows how to handle to get real narrowing.
398
+ *
376
399
  * `getProps` returns the instance's *current* resolved props at call
377
400
  * time — read it from inside a listener registered once at mount, rather
378
401
  * than re-subscribing on every prop change.
379
402
  *
380
403
  * Return a cleanup function to run when the instance unmounts.
381
404
  */
382
- readonly onElement?: (element: Element, getProps: () => Readonly<Props>) => void | (() => void);
405
+ readonly onElement?: (element: ElementForTag<TDefault | TAllowed>, getProps: () => Readonly<Props>) => void | (() => void);
383
406
  };
384
407
 
385
408
  /** Shared input shape for `invalidWithFix`/`invalidWithoutFix`. */
@@ -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.65.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.66.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.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) {
33
+ "../../node_modules/.pnpm/@typescript-eslint+utils@8.66.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.65.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.66.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.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) {
68
+ "../../node_modules/.pnpm/@typescript-eslint+utils@8.66.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.65.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.66.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.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) {
95
+ "../../node_modules/.pnpm/@typescript-eslint+utils@8.66.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.65.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.66.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.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) {
107
+ "../../node_modules/.pnpm/@typescript-eslint+utils@8.66.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.65.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.66.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.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) {
140
+ "../../node_modules/.pnpm/@typescript-eslint+utils@8.66.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.65.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.66.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.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) {
148
+ "../../node_modules/.pnpm/@typescript-eslint+utils@8.66.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.65.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.66.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.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) {
168
+ "../../node_modules/.pnpm/@typescript-eslint+utils@8.66.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.65.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.66.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.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) {
216
+ "../../node_modules/.pnpm/@typescript-eslint+utils@8.66.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;
@@ -245,6 +245,10 @@ var require_eslint_utils = __commonJS({
245
245
  var import_eslint_utils = __toESM(require_eslint_utils(), 1);
246
246
 
247
247
  // ../../lib/primitive/src/utils/type-guards.ts
248
+ function isObject(value, excludeArrays = false) {
249
+ if (value === null || typeof value !== "object") return false;
250
+ return excludeArrays ? !Array.isArray(value) : true;
251
+ }
248
252
  function isString(value) {
249
253
  return typeof value === "string";
250
254
  }
@@ -420,6 +424,9 @@ var iterate = Object.freeze({
420
424
  });
421
425
 
422
426
  // ../../plugins/eslint/src/utils/ast.ts
427
+ function hasStringValue(node) {
428
+ return isObject(node, true) && isString(node.value);
429
+ }
423
430
  function asObjectExpression(node) {
424
431
  return node?.type === "ObjectExpression" ? node : void 0;
425
432
  }
@@ -442,23 +449,20 @@ function asNumericLiteral(node) {
442
449
  return void 0;
443
450
  }
444
451
  function asStringLiteral(node) {
445
- if (node?.type === "Literal" && typeof node.value === "string") return node.value;
452
+ if (node?.type === "Literal" && hasStringValue(node)) return node.value;
446
453
  return void 0;
447
454
  }
448
455
  function getPropertyKey(prop) {
449
456
  const { key } = prop;
450
457
  if (prop.computed) return void 0;
451
458
  if (key.type === "Identifier") return key.name;
452
- if (key.type === "Literal" && typeof key.value === "string") return key.value;
459
+ if (key.type === "Literal" && hasStringValue(key)) return key.value;
453
460
  return void 0;
454
461
  }
455
462
  function getObjectProperty(obj, key) {
456
463
  return obj.properties.find((prop) => {
457
- if (prop.type !== "Property" || prop.kind !== "init" || prop.computed) {
458
- return false;
459
- }
460
- const { key: propKey } = prop;
461
- return propKey.type === "Identifier" && propKey.name === key || propKey.type === "Literal" && propKey.value === key;
464
+ if (prop.type !== "Property" || prop.kind !== "init") return false;
465
+ return getPropertyKey(prop) === key;
462
466
  });
463
467
  }
464
468
  function getFirstObjectArg(node) {
@@ -763,182 +767,218 @@ var noInvalidDefault = createRule3({
763
767
  // ../../plugins/eslint/src/rules/no-invalid-html-nesting.ts
764
768
  var import_eslint_utils4 = __toESM(require_eslint_utils(), 1);
765
769
 
770
+ // ../../plugins/eslint/src/utils/content-model-builders.ts
771
+ function categories(...values2) {
772
+ return new Set(values2);
773
+ }
774
+ function tags(...values2) {
775
+ return new Set(values2);
776
+ }
777
+ function category(...allowed) {
778
+ return { model: { kind: "category", allowed: categories(...allowed) } };
779
+ }
780
+ function specific(...allowed) {
781
+ return { model: { kind: "specific", allowed: tags(...allowed) } };
782
+ }
783
+ function phrasing() {
784
+ return category("phrasing");
785
+ }
786
+ function phrasingOrHeading() {
787
+ return category("phrasing", "heading");
788
+ }
789
+ function categoriesFor(categoryList, tagNames) {
790
+ return Object.fromEntries(tagNames.map((tagName) => [tagName, categories(...categoryList)]));
791
+ }
792
+ function defineContentModels(definitions) {
793
+ return definitions;
794
+ }
795
+
766
796
  // ../../plugins/eslint/src/utils/html-nesting.ts
797
+ var FLOW_PHRASING_TAGS = [
798
+ "abbr",
799
+ "b",
800
+ "bdi",
801
+ "bdo",
802
+ "br",
803
+ "cite",
804
+ "code",
805
+ "data",
806
+ "dfn",
807
+ "em",
808
+ "i",
809
+ "kbd",
810
+ "mark",
811
+ "output",
812
+ "q",
813
+ "ruby",
814
+ "s",
815
+ "samp",
816
+ "small",
817
+ "span",
818
+ "strong",
819
+ "sub",
820
+ "sup",
821
+ "time",
822
+ "u",
823
+ "var",
824
+ "wbr"
825
+ ];
826
+ var FLOW_PHRASING_EMBEDDED_TAGS = [
827
+ "audio",
828
+ "canvas",
829
+ "img",
830
+ "math",
831
+ "object",
832
+ "picture",
833
+ "svg",
834
+ "video"
835
+ ];
836
+ var FLOW_PHRASING_INTERACTIVE_TAGS = ["button", "input", "label", "select", "textarea"];
837
+ var FLOW_PHRASING_EMBEDDED_INTERACTIVE_TAGS = ["embed", "iframe"];
838
+ var FLOW_PHRASING_METADATA_TAGS = ["meta", "noscript", "script", "template", "link"];
839
+ var FLOW_ONLY_TAGS = [
840
+ "address",
841
+ "blockquote",
842
+ "dialog",
843
+ "div",
844
+ "dl",
845
+ "fieldset",
846
+ "figure",
847
+ "footer",
848
+ "form",
849
+ "header",
850
+ "hr",
851
+ "li",
852
+ "main",
853
+ "menu",
854
+ "ol",
855
+ "p",
856
+ "pre",
857
+ "summary",
858
+ "table",
859
+ "ul"
860
+ ];
861
+ var FLOW_SECTIONING_TAGS = ["article", "aside", "nav", "section"];
862
+ var FLOW_INTERACTIVE_TAGS = ["details"];
863
+ var FLOW_METADATA_TAGS = ["style"];
864
+ var FLOW_HEADING_TAGS = ["h1", "h2", "h3", "h4", "h5", "h6", "hgroup"];
865
+ var METADATA_ONLY_TAGS = ["base", "title"];
767
866
  var TAG_CATEGORIES = {
768
- // Phrasing + flow
769
- abbr: /* @__PURE__ */ new Set(["flow", "phrasing"]),
770
- audio: /* @__PURE__ */ new Set(["flow", "phrasing", "embedded"]),
771
- b: /* @__PURE__ */ new Set(["flow", "phrasing"]),
772
- bdi: /* @__PURE__ */ new Set(["flow", "phrasing"]),
773
- bdo: /* @__PURE__ */ new Set(["flow", "phrasing"]),
774
- br: /* @__PURE__ */ new Set(["flow", "phrasing"]),
775
- button: /* @__PURE__ */ new Set(["flow", "phrasing", "interactive"]),
776
- canvas: /* @__PURE__ */ new Set(["flow", "phrasing", "embedded"]),
777
- cite: /* @__PURE__ */ new Set(["flow", "phrasing"]),
778
- code: /* @__PURE__ */ new Set(["flow", "phrasing"]),
779
- data: /* @__PURE__ */ new Set(["flow", "phrasing"]),
780
- dfn: /* @__PURE__ */ new Set(["flow", "phrasing"]),
781
- em: /* @__PURE__ */ new Set(["flow", "phrasing"]),
782
- embed: /* @__PURE__ */ new Set(["flow", "phrasing", "embedded", "interactive"]),
783
- i: /* @__PURE__ */ new Set(["flow", "phrasing"]),
784
- iframe: /* @__PURE__ */ new Set(["flow", "phrasing", "embedded", "interactive"]),
785
- img: /* @__PURE__ */ new Set(["flow", "phrasing", "embedded"]),
786
- input: /* @__PURE__ */ new Set(["flow", "phrasing", "interactive"]),
787
- kbd: /* @__PURE__ */ new Set(["flow", "phrasing"]),
788
- label: /* @__PURE__ */ new Set(["flow", "phrasing", "interactive"]),
789
- mark: /* @__PURE__ */ new Set(["flow", "phrasing"]),
790
- math: /* @__PURE__ */ new Set(["flow", "phrasing", "embedded"]),
791
- meta: /* @__PURE__ */ new Set(["metadata", "flow", "phrasing"]),
792
- noscript: /* @__PURE__ */ new Set(["metadata", "flow", "phrasing"]),
793
- object: /* @__PURE__ */ new Set(["flow", "phrasing", "embedded"]),
794
- output: /* @__PURE__ */ new Set(["flow", "phrasing"]),
795
- picture: /* @__PURE__ */ new Set(["flow", "phrasing", "embedded"]),
796
- q: /* @__PURE__ */ new Set(["flow", "phrasing"]),
797
- ruby: /* @__PURE__ */ new Set(["flow", "phrasing"]),
798
- s: /* @__PURE__ */ new Set(["flow", "phrasing"]),
799
- samp: /* @__PURE__ */ new Set(["flow", "phrasing"]),
800
- script: /* @__PURE__ */ new Set(["metadata", "flow", "phrasing"]),
801
- select: /* @__PURE__ */ new Set(["flow", "phrasing", "interactive"]),
802
- small: /* @__PURE__ */ new Set(["flow", "phrasing"]),
803
- span: /* @__PURE__ */ new Set(["flow", "phrasing"]),
804
- strong: /* @__PURE__ */ new Set(["flow", "phrasing"]),
805
- sub: /* @__PURE__ */ new Set(["flow", "phrasing"]),
806
- sup: /* @__PURE__ */ new Set(["flow", "phrasing"]),
807
- svg: /* @__PURE__ */ new Set(["flow", "phrasing", "embedded"]),
808
- template: /* @__PURE__ */ new Set(["metadata", "flow", "phrasing"]),
809
- textarea: /* @__PURE__ */ new Set(["flow", "phrasing", "interactive"]),
810
- time: /* @__PURE__ */ new Set(["flow", "phrasing"]),
811
- u: /* @__PURE__ */ new Set(["flow", "phrasing"]),
812
- var: /* @__PURE__ */ new Set(["flow", "phrasing"]),
813
- video: /* @__PURE__ */ new Set(["flow", "phrasing", "embedded"]),
814
- wbr: /* @__PURE__ */ new Set(["flow", "phrasing"]),
815
- // Flow only (block-level)
816
- address: /* @__PURE__ */ new Set(["flow"]),
817
- article: /* @__PURE__ */ new Set(["flow", "sectioning"]),
818
- aside: /* @__PURE__ */ new Set(["flow", "sectioning"]),
819
- blockquote: /* @__PURE__ */ new Set(["flow"]),
820
- details: /* @__PURE__ */ new Set(["flow", "interactive"]),
821
- dialog: /* @__PURE__ */ new Set(["flow"]),
822
- div: /* @__PURE__ */ new Set(["flow"]),
823
- dl: /* @__PURE__ */ new Set(["flow"]),
824
- fieldset: /* @__PURE__ */ new Set(["flow"]),
825
- figure: /* @__PURE__ */ new Set(["flow"]),
826
- footer: /* @__PURE__ */ new Set(["flow"]),
827
- form: /* @__PURE__ */ new Set(["flow"]),
828
- header: /* @__PURE__ */ new Set(["flow"]),
829
- hr: /* @__PURE__ */ new Set(["flow"]),
830
- li: /* @__PURE__ */ new Set(["flow"]),
831
- link: /* @__PURE__ */ new Set(["metadata", "flow", "phrasing"]),
832
- main: /* @__PURE__ */ new Set(["flow"]),
833
- menu: /* @__PURE__ */ new Set(["flow"]),
834
- nav: /* @__PURE__ */ new Set(["flow", "sectioning"]),
835
- ol: /* @__PURE__ */ new Set(["flow"]),
836
- p: /* @__PURE__ */ new Set(["flow"]),
837
- pre: /* @__PURE__ */ new Set(["flow"]),
838
- section: /* @__PURE__ */ new Set(["flow", "sectioning"]),
839
- style: /* @__PURE__ */ new Set(["metadata", "flow"]),
840
- summary: /* @__PURE__ */ new Set(["flow"]),
841
- table: /* @__PURE__ */ new Set(["flow"]),
842
- ul: /* @__PURE__ */ new Set(["flow"]),
843
- // Heading
844
- h1: /* @__PURE__ */ new Set(["flow", "heading"]),
845
- h2: /* @__PURE__ */ new Set(["flow", "heading"]),
846
- h3: /* @__PURE__ */ new Set(["flow", "heading"]),
847
- h4: /* @__PURE__ */ new Set(["flow", "heading"]),
848
- h5: /* @__PURE__ */ new Set(["flow", "heading"]),
849
- h6: /* @__PURE__ */ new Set(["flow", "heading"]),
850
- hgroup: /* @__PURE__ */ new Set(["flow", "heading"]),
851
- // Metadata only
852
- base: /* @__PURE__ */ new Set(["metadata"]),
853
- title: /* @__PURE__ */ new Set(["metadata"])
867
+ ...categoriesFor(["flow", "phrasing"], FLOW_PHRASING_TAGS),
868
+ ...categoriesFor(["flow", "phrasing", "embedded"], FLOW_PHRASING_EMBEDDED_TAGS),
869
+ ...categoriesFor(["flow", "phrasing", "interactive"], FLOW_PHRASING_INTERACTIVE_TAGS),
870
+ ...categoriesFor(
871
+ ["flow", "phrasing", "embedded", "interactive"],
872
+ FLOW_PHRASING_EMBEDDED_INTERACTIVE_TAGS
873
+ ),
874
+ ...categoriesFor(["metadata", "flow", "phrasing"], FLOW_PHRASING_METADATA_TAGS),
875
+ ...categoriesFor(["flow"], FLOW_ONLY_TAGS),
876
+ ...categoriesFor(["flow", "sectioning"], FLOW_SECTIONING_TAGS),
877
+ ...categoriesFor(["flow", "interactive"], FLOW_INTERACTIVE_TAGS),
878
+ ...categoriesFor(["flow", "metadata"], FLOW_METADATA_TAGS),
879
+ ...categoriesFor(["flow", "heading"], FLOW_HEADING_TAGS),
880
+ ...categoriesFor(["metadata"], METADATA_ONLY_TAGS)
854
881
  };
855
- var HTML_CONTENT_MODELS = {
882
+ var HTML_CONTENT_MODELS = defineContentModels({
856
883
  // Specific-tag constraints (structural elements whose content is enumerated, not categorical)
857
- colgroup: { kind: "specific", allowed: /* @__PURE__ */ new Set(["col", "template"]) },
858
- dl: { kind: "specific", allowed: /* @__PURE__ */ new Set(["dt", "dd", "div", "script", "template"]) },
859
- menu: { kind: "specific", allowed: /* @__PURE__ */ new Set(["li", "script", "template"]) },
860
- ol: { kind: "specific", allowed: /* @__PURE__ */ new Set(["li", "script", "template"]) },
861
- optgroup: { kind: "specific", allowed: /* @__PURE__ */ new Set(["option", "script", "template"]) },
862
- picture: { kind: "specific", allowed: /* @__PURE__ */ new Set(["source", "img", "script", "template"]) },
863
- select: {
864
- kind: "specific",
865
- allowed: /* @__PURE__ */ new Set(["option", "optgroup", "hr", "script", "template"])
866
- },
867
- table: {
868
- kind: "specific",
869
- allowed: /* @__PURE__ */ new Set([
870
- "caption",
871
- "colgroup",
872
- "thead",
873
- "tbody",
874
- "tfoot",
875
- "tr",
876
- "script",
877
- "template"
878
- ])
879
- },
880
- tbody: { kind: "specific", allowed: /* @__PURE__ */ new Set(["tr", "script", "template"]) },
881
- tfoot: { kind: "specific", allowed: /* @__PURE__ */ new Set(["tr", "script", "template"]) },
882
- thead: { kind: "specific", allowed: /* @__PURE__ */ new Set(["tr", "script", "template"]) },
883
- tr: { kind: "specific", allowed: /* @__PURE__ */ new Set(["td", "th", "script", "template"]) },
884
- ul: { kind: "specific", allowed: /* @__PURE__ */ new Set(["li", "script", "template"]) },
884
+ colgroup: specific("col", "template"),
885
+ dl: specific("dt", "dd", "div", "script", "template"),
886
+ menu: specific("li", "script", "template"),
887
+ ol: specific("li", "script", "template"),
888
+ optgroup: specific("option", "script", "template"),
889
+ picture: specific("source", "img", "script", "template"),
890
+ select: specific("option", "optgroup", "hr", "script", "template"),
891
+ table: specific("caption", "colgroup", "thead", "tbody", "tfoot", "tr", "script", "template"),
892
+ tbody: specific("tr", "script", "template"),
893
+ tfoot: specific("tr", "script", "template"),
894
+ thead: specific("tr", "script", "template"),
895
+ tr: specific("td", "th", "script", "template"),
896
+ ul: specific("li", "script", "template"),
885
897
  // Phrasing-content parents (any element whose content model is phrasing content)
886
- abbr: { kind: "category", allowed: /* @__PURE__ */ new Set(["phrasing"]) },
887
- b: { kind: "category", allowed: /* @__PURE__ */ new Set(["phrasing"]) },
888
- bdi: { kind: "category", allowed: /* @__PURE__ */ new Set(["phrasing"]) },
889
- bdo: { kind: "category", allowed: /* @__PURE__ */ new Set(["phrasing"]) },
890
- cite: { kind: "category", allowed: /* @__PURE__ */ new Set(["phrasing"]) },
891
- code: { kind: "category", allowed: /* @__PURE__ */ new Set(["phrasing"]) },
892
- data: { kind: "category", allowed: /* @__PURE__ */ new Set(["phrasing"]) },
893
- dfn: { kind: "category", allowed: /* @__PURE__ */ new Set(["phrasing"]) },
894
- dt: { kind: "category", allowed: /* @__PURE__ */ new Set(["phrasing"]) },
895
- em: { kind: "category", allowed: /* @__PURE__ */ new Set(["phrasing"]) },
896
- h1: { kind: "category", allowed: /* @__PURE__ */ new Set(["phrasing"]) },
897
- h2: { kind: "category", allowed: /* @__PURE__ */ new Set(["phrasing"]) },
898
- h3: { kind: "category", allowed: /* @__PURE__ */ new Set(["phrasing"]) },
899
- h4: { kind: "category", allowed: /* @__PURE__ */ new Set(["phrasing"]) },
900
- h5: { kind: "category", allowed: /* @__PURE__ */ new Set(["phrasing"]) },
901
- h6: { kind: "category", allowed: /* @__PURE__ */ new Set(["phrasing"]) },
902
- i: { kind: "category", allowed: /* @__PURE__ */ new Set(["phrasing"]) },
903
- kbd: { kind: "category", allowed: /* @__PURE__ */ new Set(["phrasing"]) },
904
- label: { kind: "category", allowed: /* @__PURE__ */ new Set(["phrasing"]) },
905
- mark: { kind: "category", allowed: /* @__PURE__ */ new Set(["phrasing"]) },
906
- output: { kind: "category", allowed: /* @__PURE__ */ new Set(["phrasing"]) },
907
- p: { kind: "category", allowed: /* @__PURE__ */ new Set(["phrasing"]) },
908
- q: { kind: "category", allowed: /* @__PURE__ */ new Set(["phrasing"]) },
909
- ruby: { kind: "category", allowed: /* @__PURE__ */ new Set(["phrasing"]) },
910
- s: { kind: "category", allowed: /* @__PURE__ */ new Set(["phrasing"]) },
911
- samp: { kind: "category", allowed: /* @__PURE__ */ new Set(["phrasing"]) },
912
- small: { kind: "category", allowed: /* @__PURE__ */ new Set(["phrasing"]) },
913
- span: { kind: "category", allowed: /* @__PURE__ */ new Set(["phrasing"]) },
914
- strong: { kind: "category", allowed: /* @__PURE__ */ new Set(["phrasing"]) },
915
- sub: { kind: "category", allowed: /* @__PURE__ */ new Set(["phrasing"]) },
916
- sup: { kind: "category", allowed: /* @__PURE__ */ new Set(["phrasing"]) },
917
- time: { kind: "category", allowed: /* @__PURE__ */ new Set(["phrasing"]) },
918
- u: { kind: "category", allowed: /* @__PURE__ */ new Set(["phrasing"]) },
919
- var: { kind: "category", allowed: /* @__PURE__ */ new Set(["phrasing"]) },
898
+ abbr: phrasing(),
899
+ b: phrasing(),
900
+ bdi: phrasing(),
901
+ bdo: phrasing(),
902
+ cite: phrasing(),
903
+ code: phrasing(),
904
+ data: phrasing(),
905
+ dfn: phrasing(),
906
+ dt: phrasing(),
907
+ em: phrasing(),
908
+ h1: phrasing(),
909
+ h2: phrasing(),
910
+ h3: phrasing(),
911
+ h4: phrasing(),
912
+ h5: phrasing(),
913
+ h6: phrasing(),
914
+ i: phrasing(),
915
+ kbd: phrasing(),
916
+ label: phrasing(),
917
+ mark: phrasing(),
918
+ output: phrasing(),
919
+ p: phrasing(),
920
+ q: phrasing(),
921
+ ruby: phrasing(),
922
+ s: phrasing(),
923
+ samp: phrasing(),
924
+ small: phrasing(),
925
+ span: phrasing(),
926
+ strong: phrasing(),
927
+ sub: phrasing(),
928
+ sup: phrasing(),
929
+ time: phrasing(),
930
+ u: phrasing(),
931
+ var: phrasing(),
920
932
  // Phrasing or heading (spec allows either as first child)
921
- legend: { kind: "category", allowed: /* @__PURE__ */ new Set(["phrasing", "heading"]) },
922
- summary: { kind: "category", allowed: /* @__PURE__ */ new Set(["phrasing", "heading"]) }
923
- };
933
+ legend: phrasingOrHeading(),
934
+ summary: phrasingOrHeading()
935
+ });
936
+ function getTagCategorySet(tagCategories, tagName) {
937
+ return tagCategories[tagName];
938
+ }
939
+ function getContentModelDefinition(contentModels, tagName) {
940
+ return contentModels[tagName];
941
+ }
924
942
 
925
943
  // ../../plugins/eslint/src/rules/no-invalid-html-nesting.ts
926
944
  var createRule4 = (0, import_eslint_utils4.RuleCreator)((name) => `https://praxis-kit.dev/eslint-rules/${name}`);
945
+ function describeAllowed(definition) {
946
+ const { model } = definition;
947
+ switch (model.kind) {
948
+ case "specific":
949
+ return [...model.allowed].join(", ");
950
+ case "category":
951
+ return [...model.allowed].map((c) => `${c} content`).join(", ");
952
+ // `transparent`/`nothing`/`structured` aren't evaluated yet (see `isAllowed` below) — no
953
+ // entry in HTML_CONTENT_MODELS currently uses them, so this stays unreachable in practice.
954
+ case "transparent":
955
+ case "nothing":
956
+ case "structured":
957
+ return "";
958
+ }
959
+ }
927
960
  var ALLOWED_TEXT = Object.fromEntries(
928
- Object.entries(HTML_CONTENT_MODELS).map(([tag, model]) => [
929
- tag,
930
- model.kind === "specific" ? [...model.allowed].join(", ") : [...model.allowed].map((c) => `${c} content`).join(", ")
931
- ])
961
+ Object.entries(HTML_CONTENT_MODELS).filter((entry) => entry[1] !== void 0).map(([tag, definition]) => [tag, describeAllowed(definition)])
932
962
  );
933
963
  function getIntrinsicTag(name) {
934
964
  if (name.type !== "JSXIdentifier") return void 0;
935
965
  return /^[a-z]/.test(name.name) ? name.name : void 0;
936
966
  }
937
- function isAllowed(childTag, model) {
938
- if (model.kind === "specific") return model.allowed.has(childTag);
939
- const cats = TAG_CATEGORIES[childTag];
940
- if (!cats) return true;
941
- return [...model.allowed].some((c) => cats.has(c));
967
+ function isAllowed(childTag, definition) {
968
+ const { model } = definition;
969
+ switch (model.kind) {
970
+ case "specific":
971
+ return model.allowed.has(childTag);
972
+ case "category": {
973
+ const cats = getTagCategorySet(TAG_CATEGORIES, childTag);
974
+ if (!cats) return true;
975
+ return [...model.allowed].some((c) => cats.has(c));
976
+ }
977
+ case "transparent":
978
+ case "nothing":
979
+ case "structured":
980
+ return true;
981
+ }
942
982
  }
943
983
  var noInvalidHtmlNesting = createRule4({
944
984
  name: "no-invalid-html-nesting",
@@ -958,13 +998,13 @@ var noInvalidHtmlNesting = createRule4({
958
998
  JSXElement(node) {
959
999
  const parentTag = getIntrinsicTag(node.openingElement.name);
960
1000
  if (!parentTag) return;
961
- const model = HTML_CONTENT_MODELS[parentTag];
962
- if (!model) return;
1001
+ const definition = getContentModelDefinition(HTML_CONTENT_MODELS, parentTag);
1002
+ if (!definition) return;
963
1003
  iterate.forEach(node.children, (child) => {
964
1004
  if (child.type !== "JSXElement") return;
965
1005
  const childTag = getIntrinsicTag(child.openingElement.name);
966
1006
  if (childTag === void 0) return;
967
- if (isAllowed(childTag, model)) return;
1007
+ if (isAllowed(childTag, definition)) return;
968
1008
  context.report({
969
1009
  node: child,
970
1010
  messageId: "invalidChild",
@@ -84,6 +84,11 @@ declare const HTML_ARIA_RULES: readonly AriaRule[];
84
84
 
85
85
  declare const roleNotPermittedRule: AriaRule;
86
86
 
87
+ declare const dangerousHrefRule: AriaRule;
88
+ declare const roleButtonWithHrefRule: AriaRule;
89
+ declare const ariaDisabledInertRule: AriaRule;
90
+ declare const ANCHOR_RULES: readonly AriaRule[];
91
+
87
92
  declare const supportedInputTypeRule: AriaRule;
88
93
  declare const checkedRequiresCheckableTypeRule: AriaRule;
89
94
  declare const multipleRequiresSupportedTypeRule: AriaRule;
@@ -104,4 +109,4 @@ declare const passwordAutocompleteRule: AriaRule;
104
109
  declare const requiredReadOnlyConflictRule: AriaRule;
105
110
  declare const INPUT_RULES: readonly AriaRule[];
106
111
 
107
- export { HTML_ARIA_RULES, INPUT_RULES, acceptRequiresFileTypeRule, altRequiresImageTypeRule, captureRequiresFileTypeRule, checkedRequiresCheckableTypeRule, heightRequiresImageTypeRule, inputAccessibleNameRule, landmarkAccessibleNameRule, landmarkRoleRule, maxLengthRequiresTextTypeRule, maxRequiresNumericTypeRule, minLengthRequiresTextTypeRule, minRequiresNumericTypeRule, multipleRequiresSupportedTypeRule, passwordAutocompleteRule, patternRequiresTextTypeRule, requireAccessibleName, requiredReadOnlyConflictRule, roleNotPermittedRule, sizeRequiresTextTypeRule, stepRequiresNumericTypeRule, supportedInputTypeRule, widthRequiresImageTypeRule };
112
+ export { ANCHOR_RULES, HTML_ARIA_RULES, INPUT_RULES, acceptRequiresFileTypeRule, altRequiresImageTypeRule, ariaDisabledInertRule, captureRequiresFileTypeRule, checkedRequiresCheckableTypeRule, dangerousHrefRule, heightRequiresImageTypeRule, inputAccessibleNameRule, landmarkAccessibleNameRule, landmarkRoleRule, maxLengthRequiresTextTypeRule, maxRequiresNumericTypeRule, minLengthRequiresTextTypeRule, minRequiresNumericTypeRule, multipleRequiresSupportedTypeRule, passwordAutocompleteRule, patternRequiresTextTypeRule, requireAccessibleName, requiredReadOnlyConflictRule, roleButtonWithHrefRule, roleNotPermittedRule, sizeRequiresTextTypeRule, stepRequiresNumericTypeRule, supportedInputTypeRule, widthRequiresImageTypeRule };