praxis-kit 6.6.0 → 6.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2283,6 +2283,93 @@ var readonlyProps = ({
2283
2283
  // ../core/src/html/evaluators.ts
2284
2284
  import { warnDiagnostics as warnDiagnostics2 } from "./_shared/diagnostics.js";
2285
2285
 
2286
+ // ../core/src/html/contracts/categories.ts
2287
+ 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
+ var TEXT_ONLY_TAGS = [
2305
+ "option",
2306
+ "script",
2307
+ "style",
2308
+ "textarea",
2309
+ "title"
2310
+ ];
2311
+ var LANDMARK_TAGS = [
2312
+ "article",
2313
+ "aside",
2314
+ "footer",
2315
+ "header",
2316
+ "main",
2317
+ "nav"
2318
+ ];
2319
+ var INTERACTIVE_CONTENT_TAGS = [
2320
+ "a",
2321
+ "button",
2322
+ "input",
2323
+ "select",
2324
+ "textarea",
2325
+ "label"
2326
+ ];
2327
+ var LABELABLE_TAGS = [
2328
+ "button",
2329
+ "input",
2330
+ "meter",
2331
+ "output",
2332
+ "progress",
2333
+ "select",
2334
+ "textarea"
2335
+ ];
2336
+ var OTHER_INTERACTIVE_TAGS = [
2337
+ "a",
2338
+ "details",
2339
+ "embed",
2340
+ "iframe"
2341
+ ];
2342
+ var P_BLOCKED_TAGS = [
2343
+ "address",
2344
+ "article",
2345
+ "aside",
2346
+ "blockquote",
2347
+ "details",
2348
+ "dialog",
2349
+ "div",
2350
+ "dl",
2351
+ "fieldset",
2352
+ "figure",
2353
+ "footer",
2354
+ "form",
2355
+ "h1",
2356
+ "h2",
2357
+ "h3",
2358
+ "h4",
2359
+ "h5",
2360
+ "h6",
2361
+ "header",
2362
+ "hr",
2363
+ "main",
2364
+ "nav",
2365
+ "ol",
2366
+ "p",
2367
+ "pre",
2368
+ "section",
2369
+ "table",
2370
+ "ul"
2371
+ ];
2372
+
2286
2373
  // ../core/src/html/spec/vocabulary/input.ts
2287
2374
  var TEXT_INPUT_TYPES = ["text", "search", "url", "tel", "email", "password"];
2288
2375
  var NUMERIC_INPUT_TYPES = [
@@ -2662,7 +2749,11 @@ var ALLOWED_ROLES = {
2662
2749
  "treeitem"
2663
2750
  ],
2664
2751
  dialog: ["alertdialog"],
2665
- fieldset: ["none", "presentation", "radiogroup"]
2752
+ fieldset: ["none", "presentation", "radiogroup"],
2753
+ // `<label>` has no implicit role and no documented alternates — its native labeling
2754
+ // semantics (control association, accessible-name contribution) aren't reproducible via
2755
+ // ARIA, so any explicit `role` should be avoided rather than substituted.
2756
+ label: []
2666
2757
  };
2667
2758
  var ELEMENT_SPECS = {
2668
2759
  input: inputElementSpec,
@@ -2703,7 +2794,10 @@ var roleNotPermittedRule = Object.assign(
2703
2794
  );
2704
2795
 
2705
2796
  // ../core/src/html/aria-rules.ts
2706
- var LANDMARK_TAG_SET = /* @__PURE__ */ new Set(["article", "aside", "footer", "header", "main", "nav"]);
2797
+ function defineAriaRule(tags, rule) {
2798
+ return Object.assign(rule, { tags });
2799
+ }
2800
+ var LANDMARK_TAG_SET = new Set(LANDMARK_TAGS);
2707
2801
  var removeLandmarkRoleOverride = {
2708
2802
  kind: "removeRole",
2709
2803
  apply: ({ props }) => {
@@ -2712,10 +2806,11 @@ var removeLandmarkRoleOverride = {
2712
2806
  return { applied: true, next: rest, previous: props };
2713
2807
  }
2714
2808
  };
2715
- var landmarkRoleRule = Object.assign(
2809
+ var landmarkRoleRule = defineAriaRule(
2810
+ LANDMARK_TAGS,
2716
2811
  ({ tag, props, implicitRole }) => {
2717
2812
  if (!LANDMARK_TAG_SET.has(tag) || !implicitRole) return [];
2718
- const role = props.role;
2813
+ const { role } = props;
2719
2814
  if (!role || role === implicitRole) return [];
2720
2815
  const diagnostic = HtmlDiagnostics.landmarkRoleOverride(tag, implicitRole, role);
2721
2816
  return [
@@ -2727,8 +2822,7 @@ var landmarkRoleRule = Object.assign(
2727
2822
  diagnostic
2728
2823
  }
2729
2824
  ];
2730
- },
2731
- { tags: [...LANDMARK_TAG_SET] }
2825
+ }
2732
2826
  );
2733
2827
  function requireAccessibleName({ tag, props }) {
2734
2828
  if ("aria-label" in props || "aria-labelledby" in props) return [];
@@ -2741,38 +2835,44 @@ function requireAccessibleName({ tag, props }) {
2741
2835
  }
2742
2836
  ];
2743
2837
  }
2744
- var NAMED_LANDMARK_TAGS = /* @__PURE__ */ new Set(["nav", "aside"]);
2745
- var landmarkNameAdvisory = Object.assign(
2838
+ var NAMED_LANDMARK_TAGS = ["nav", "aside"];
2839
+ var NAMED_LANDMARK_TAG_SET = new Set(NAMED_LANDMARK_TAGS);
2840
+ var landmarkAccessibleNameRule = defineAriaRule(
2841
+ NAMED_LANDMARK_TAGS,
2746
2842
  (ctx) => {
2747
- if (!ctx.implicitRole || !NAMED_LANDMARK_TAGS.has(ctx.tag)) return [];
2843
+ if (!ctx.implicitRole || !NAMED_LANDMARK_TAG_SET.has(ctx.tag)) return [];
2748
2844
  return requireAccessibleName(ctx);
2749
- },
2750
- { tags: [...NAMED_LANDMARK_TAGS] }
2845
+ }
2751
2846
  );
2752
2847
  var HTML_ARIA_RULES = [
2753
2848
  landmarkRoleRule,
2754
- landmarkNameAdvisory,
2849
+ landmarkAccessibleNameRule,
2755
2850
  roleNotPermittedRule,
2756
2851
  ...INPUT_RULES
2757
2852
  ];
2758
2853
 
2759
- // ../core/src/html/contracts.ts
2854
+ // ../core/src/html/contracts/helpers.ts
2760
2855
  import { warnDiagnostics } from "./_shared/diagnostics.js";
2856
+ function isVNodeLike(child) {
2857
+ return isObject(child) && "type" in child;
2858
+ }
2761
2859
  function isOpenContent(...blockedTags) {
2762
2860
  const set2 = new Set(blockedTags);
2763
2861
  return (child) => {
2764
- if (!isObject(child) || !("type" in child)) return false;
2862
+ if (!isVNodeLike(child)) return false;
2765
2863
  const tag = getTag(child);
2766
2864
  return tag === void 0 || !set2.has(tag);
2767
2865
  };
2768
2866
  }
2769
- var METADATA_TAGS = ["script", "template"];
2770
2867
  var metadataMatch = isTag(...METADATA_TAGS);
2771
2868
  function metadata(name = "metadata") {
2772
2869
  return { name, match: metadataMatch };
2773
2870
  }
2871
+ function optional(name, tag) {
2872
+ return { name, match: isTag(tag), cardinality: { max: 1 } };
2873
+ }
2774
2874
  function firstOptional(name, tag) {
2775
- return { name, match: isTag(tag), cardinality: { max: 1 }, position: "first" };
2875
+ return { ...optional(name, tag), position: "first" };
2776
2876
  }
2777
2877
  function contract(children, options) {
2778
2878
  return { diagnostics: warnDiagnostics, children, ...options };
@@ -2786,50 +2886,41 @@ function ariaContract(aria) {
2786
2886
  function firstChildContract(name, tag) {
2787
2887
  return contract([firstOptional(name, tag), { name: "content", match: isOpenContent(tag) }]);
2788
2888
  }
2789
- var VOID_TAGS = [
2790
- "area",
2791
- "base",
2792
- "br",
2793
- "col",
2794
- "embed",
2795
- "hr",
2796
- "img",
2797
- "input",
2798
- "link",
2799
- "meta",
2800
- "param",
2801
- "source",
2802
- "track",
2803
- "wbr"
2804
- ];
2805
- var TEXT_ONLY_TAGS = ["option", "script", "style", "textarea", "title"];
2806
- var LANDMARK_TAGS = ["article", "aside", "footer", "header", "main", "nav"];
2807
- var listContract = closedContract([
2808
- { name: "list-item", match: isTag("li", ...METADATA_TAGS) }
2809
- ]);
2810
- var tableContract = closedContract([
2811
- firstOptional("caption", "caption"),
2812
- { name: "colgroup", match: isTag("colgroup") },
2813
- { name: "thead", match: isTag("thead"), cardinality: { max: 1 } },
2814
- { name: "tbody", match: isTag("tbody") },
2815
- { name: "tfoot", match: isTag("tfoot"), cardinality: { max: 1 } },
2816
- { name: "table-row", match: isTag("tr", ...METADATA_TAGS) }
2817
- ]);
2818
- var tableBodyContract = closedContract([
2819
- { name: "table-row", match: isTag("tr", ...METADATA_TAGS) }
2820
- ]);
2821
- var tableRowContract = closedContract([
2822
- { name: "table-cell", match: isTag("td", "th", ...METADATA_TAGS) }
2823
- ]);
2824
- var colgroupContract = closedContract([
2825
- { name: "column", match: isTag("col", "template") }
2889
+ function getChildProp(child, key) {
2890
+ if (!isVNodeLike(child)) return void 0;
2891
+ const { props } = child;
2892
+ if (!isObject(props)) return void 0;
2893
+ return props[key];
2894
+ }
2895
+
2896
+ // ../core/src/html/contracts/aria/landmarks.ts
2897
+ var landmarkContract = ariaContract([landmarkRoleRule, landmarkAccessibleNameRule]);
2898
+
2899
+ // ../core/src/html/contracts/aria/widgets.ts
2900
+ var dialogContract = ariaContract([requireAccessibleName]);
2901
+ var menuContract = ariaContract([requireAccessibleName]);
2902
+ var menubarContract = ariaContract([requireAccessibleName]);
2903
+ var treeContract = ariaContract([requireAccessibleName]);
2904
+ var gridContract = ariaContract([requireAccessibleName]);
2905
+ var listboxContract = ariaContract([requireAccessibleName]);
2906
+ var tablistContract = ariaContract([requireAccessibleName]);
2907
+ var radiogroupContract = ariaContract([requireAccessibleName]);
2908
+
2909
+ // ../core/src/html/contracts/html/document.ts
2910
+ var headContract = closedContract([
2911
+ {
2912
+ name: "metadata",
2913
+ match: isTag("base", "link", "meta", "noscript", "script", "style", "template", "title")
2914
+ }
2826
2915
  ]);
2827
- var dlContract = closedContract([
2828
- { name: "term", match: isTag("dt") },
2829
- { name: "description", match: isTag("dd") },
2830
- { name: "group", match: isTag("div") },
2831
- metadata()
2916
+ var htmlContract = closedContract([
2917
+ { name: "head", match: isTag("head"), cardinality: { min: 1, max: 1 }, position: "first" },
2918
+ { name: "body", match: isTag("body"), cardinality: { min: 1, max: 1 } }
2832
2919
  ]);
2920
+ var voidContract = contract([], { exclusiveChildren: true, allowText: false });
2921
+ var textOnlyContract = contract([], { exclusiveChildren: true });
2922
+
2923
+ // ../core/src/html/contracts/html/forms.ts
2833
2924
  var selectContract = closedContract([
2834
2925
  { name: "option", match: isTag("option", "optgroup", "hr", ...METADATA_TAGS) }
2835
2926
  ]);
@@ -2839,6 +2930,45 @@ var optgroupContract = closedContract([
2839
2930
  var datalistContract = closedContract([
2840
2931
  { name: "option", match: isTag("option", ...METADATA_TAGS) }
2841
2932
  ]);
2933
+ var buttonContract = closedContract([
2934
+ { name: "content", match: isOpenContent(...INTERACTIVE_CONTENT_TAGS) }
2935
+ ]);
2936
+ var anchorContract = closedContract([
2937
+ { name: "content", match: isOpenContent(...INTERACTIVE_CONTENT_TAGS) }
2938
+ ]);
2939
+ var labelableTagMatch = isTag(...LABELABLE_TAGS);
2940
+ function isLabelableControl(child) {
2941
+ if (!labelableTagMatch(child)) return false;
2942
+ if (getTag(child) !== "input") return true;
2943
+ const type = getChildProp(child, "type");
2944
+ return !isString(type) || type !== "hidden";
2945
+ }
2946
+ var labelContract = contract([
2947
+ { name: "control", match: isLabelableControl, cardinality: { max: 1 } },
2948
+ { name: "nested-label", match: isTag("label"), cardinality: { max: 0 } },
2949
+ {
2950
+ name: "other-interactive-content",
2951
+ match: isTag(...OTHER_INTERACTIVE_TAGS),
2952
+ cardinality: { max: 0 }
2953
+ }
2954
+ ]);
2955
+
2956
+ // ../core/src/html/contracts/html/grouping.ts
2957
+ var detailsContract = firstChildContract("summary", "summary");
2958
+ var fieldsetContract = firstChildContract("legend", "legend");
2959
+
2960
+ // ../core/src/html/contracts/html/lists.ts
2961
+ var listContract = closedContract([
2962
+ { name: "list-item", match: isTag("li", ...METADATA_TAGS) }
2963
+ ]);
2964
+ var dlContract = closedContract([
2965
+ { name: "term", match: isTag("dt") },
2966
+ { name: "description", match: isTag("dd") },
2967
+ { name: "group", match: isTag("div") },
2968
+ metadata()
2969
+ ]);
2970
+
2971
+ // ../core/src/html/contracts/html/media.ts
2842
2972
  var pictureContract = closedContract([
2843
2973
  { name: "source", match: isTag("source", ...METADATA_TAGS) },
2844
2974
  { name: "image", match: isTag("img"), cardinality: { min: 1, max: 1 }, position: "last" }
@@ -2847,91 +2977,49 @@ var figureContract = contract([
2847
2977
  { name: "caption", match: isTag("figcaption"), cardinality: { max: 1 } },
2848
2978
  { name: "content", match: isOpenContent("figcaption") }
2849
2979
  ]);
2850
- var detailsContract = firstChildContract("summary", "summary");
2851
- var fieldsetContract = firstChildContract("legend", "legend");
2852
2980
  var objectContract = contract([
2853
2981
  { name: "param", match: isTag("param") },
2854
2982
  { name: "content", match: isOpenContent("param") }
2855
2983
  ]);
2856
- var INTERACTIVE_CONTENT_TAGS = ["a", "button", "input", "select", "textarea", "label"];
2857
- var buttonContract = closedContract([
2858
- { name: "content", match: isOpenContent(...INTERACTIVE_CONTENT_TAGS) }
2859
- ]);
2860
- var anchorContract = closedContract([
2861
- { name: "content", match: isOpenContent(...INTERACTIVE_CONTENT_TAGS) }
2862
- ]);
2863
- var LABELABLE_TAGS = [
2864
- "button",
2865
- "input",
2866
- "meter",
2867
- "output",
2868
- "progress",
2869
- "select",
2870
- "textarea"
2871
- ];
2872
- var labelContract = contract([
2873
- { name: "control", match: isTag(...LABELABLE_TAGS), cardinality: { max: 1 } }
2874
- ]);
2875
- var P_BLOCKED_TAGS = [
2876
- "address",
2877
- "article",
2878
- "aside",
2879
- "blockquote",
2880
- "details",
2881
- "dialog",
2882
- "div",
2883
- "dl",
2884
- "fieldset",
2885
- "figure",
2886
- "footer",
2887
- "form",
2888
- "h1",
2889
- "h2",
2890
- "h3",
2891
- "h4",
2892
- "h5",
2893
- "h6",
2894
- "header",
2895
- "hr",
2896
- "main",
2897
- "nav",
2898
- "ol",
2899
- "p",
2900
- "pre",
2901
- "section",
2902
- "table",
2903
- "ul"
2904
- ];
2905
- var pContract = closedContract([
2906
- { name: "content", match: isOpenContent(...P_BLOCKED_TAGS) }
2907
- ]);
2908
2984
  var mediaContract = contract([
2909
2985
  { name: "source", match: isTag("source") },
2910
2986
  { name: "track", match: isTag("track") },
2911
2987
  metadata(),
2912
2988
  { name: "content", match: isOpenContent("source", "track", ...METADATA_TAGS) }
2913
2989
  ]);
2914
- var headContract = closedContract([
2915
- {
2916
- name: "metadata",
2917
- match: isTag("base", "link", "meta", "noscript", "script", "style", "template", "title")
2918
- }
2990
+
2991
+ // ../core/src/html/contracts/html/tables.ts
2992
+ var tableContract = closedContract([
2993
+ firstOptional("caption", "caption"),
2994
+ { name: "colgroup", match: isTag("colgroup") },
2995
+ { name: "thead", match: isTag("thead"), cardinality: { max: 1 } },
2996
+ { name: "tbody", match: isTag("tbody") },
2997
+ { name: "tfoot", match: isTag("tfoot"), cardinality: { max: 1 } },
2998
+ { name: "table-row", match: isTag("tr", ...METADATA_TAGS) }
2919
2999
  ]);
2920
- var htmlContract = closedContract([
2921
- { name: "head", match: isTag("head"), cardinality: { min: 1, max: 1 }, position: "first" },
2922
- { name: "body", match: isTag("body"), cardinality: { min: 1, max: 1 } }
3000
+ var tableBodyContract = closedContract([
3001
+ { name: "table-row", match: isTag("tr", ...METADATA_TAGS) }
2923
3002
  ]);
2924
- var voidContract = contract([], { exclusiveChildren: true, allowText: false });
2925
- var textOnlyContract = contract([], { exclusiveChildren: true });
2926
- var landmarkContract = ariaContract([landmarkRoleRule, landmarkNameAdvisory]);
2927
- var dialogContract = ariaContract([requireAccessibleName]);
2928
- var menuContract = ariaContract([requireAccessibleName]);
2929
- var menubarContract = ariaContract([requireAccessibleName]);
2930
- var treeContract = ariaContract([requireAccessibleName]);
2931
- var gridContract = ariaContract([requireAccessibleName]);
2932
- var listboxContract = ariaContract([requireAccessibleName]);
2933
- var tablistContract = ariaContract([requireAccessibleName]);
2934
- var radiogroupContract = ariaContract([requireAccessibleName]);
3003
+ var tableRowContract = closedContract([
3004
+ { name: "table-cell", match: isTag("td", "th", ...METADATA_TAGS) }
3005
+ ]);
3006
+ var colgroupContract = closedContract([
3007
+ { name: "column", match: isTag("col", "template") }
3008
+ ]);
3009
+
3010
+ // ../core/src/html/contracts/html/text.ts
3011
+ var pContract = closedContract([
3012
+ { name: "content", match: isOpenContent(...P_BLOCKED_TAGS) }
3013
+ ]);
3014
+
3015
+ // ../core/src/html/contracts/build-map.ts
3016
+ function buildMap(groups) {
3017
+ return Object.fromEntries(
3018
+ groups.flatMap(([keys2, value]) => keys2.map((key) => [key, value]))
3019
+ );
3020
+ }
3021
+
3022
+ // ../core/src/html/contracts/maps.ts
2935
3023
  var CONTRACT_GROUPS = [
2936
3024
  [VOID_TAGS, voidContract],
2937
3025
  [TEXT_ONLY_TAGS, textOnlyContract],
@@ -2940,13 +3028,8 @@ var CONTRACT_GROUPS = [
2940
3028
  [["audio", "video"], mediaContract],
2941
3029
  [["thead", "tbody", "tfoot"], tableBodyContract]
2942
3030
  ];
2943
- function contractMap(groups) {
2944
- return Object.fromEntries(
2945
- groups.flatMap(([tags, enforcement]) => tags.map((tag) => [tag, enforcement]))
2946
- );
2947
- }
2948
3031
  var htmlContracts = {
2949
- ...contractMap(CONTRACT_GROUPS),
3032
+ ...buildMap(CONTRACT_GROUPS),
2950
3033
  table: tableContract,
2951
3034
  tr: tableRowContract,
2952
3035
  colgroup: colgroupContract,
@@ -316,4 +316,4 @@ declare function mergeContracts(...contracts: readonly EnforcementOptions[]): En
316
316
 
317
317
  type Diagnostics = Diagnostics$1;
318
318
 
319
- export { type AnyFactoryOptions, type AriaContext, type AriaFix, type AriaFixResult, type AriaPhase, type AriaResult, type AriaRule, type Diagnostics, type FixKind, type AriaInvalidResult as InvalidResult, type AriaInvalidWithFix as InvalidWithFix, type AriaInvalidWithoutFix as InvalidWithoutFix, 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 };
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 };
@@ -70,7 +70,7 @@ type AriaRule<C extends AriaContext = AriaContext> = ((context: C) => readonly A
70
70
 
71
71
  declare const landmarkRoleRule: AriaRule;
72
72
  declare function requireAccessibleName({ tag, props }: AriaContext): readonly AriaResult[];
73
- declare const landmarkNameAdvisory: AriaRule;
73
+ declare const landmarkAccessibleNameRule: AriaRule;
74
74
  declare const HTML_ARIA_RULES: readonly AriaRule[];
75
75
 
76
76
  declare const roleNotPermittedRule: AriaRule;
@@ -95,4 +95,4 @@ declare const passwordAutocompleteRule: AriaRule;
95
95
  declare const requiredReadOnlyConflictRule: AriaRule;
96
96
  declare const INPUT_RULES: readonly AriaRule[];
97
97
 
98
- export { HTML_ARIA_RULES, INPUT_RULES, acceptRequiresFileTypeRule, altRequiresImageTypeRule, captureRequiresFileTypeRule, checkedRequiresCheckableTypeRule, heightRequiresImageTypeRule, inputAccessibleNameRule, landmarkNameAdvisory, landmarkRoleRule, maxLengthRequiresTextTypeRule, maxRequiresNumericTypeRule, minLengthRequiresTextTypeRule, minRequiresNumericTypeRule, multipleRequiresSupportedTypeRule, passwordAutocompleteRule, patternRequiresTextTypeRule, requireAccessibleName, requiredReadOnlyConflictRule, roleNotPermittedRule, sizeRequiresTextTypeRule, stepRequiresNumericTypeRule, supportedInputTypeRule, widthRequiresImageTypeRule };
98
+ 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 };
@@ -360,6 +360,16 @@ var InputAccessibilityDiagnostics = {
360
360
  }
361
361
  };
362
362
 
363
+ // ../core/src/html/contracts/categories.ts
364
+ var LANDMARK_TAGS = [
365
+ "article",
366
+ "aside",
367
+ "footer",
368
+ "header",
369
+ "main",
370
+ "nav"
371
+ ];
372
+
363
373
  // ../core/src/html/spec/vocabulary/input.ts
364
374
  var TEXT_INPUT_TYPES = ["text", "search", "url", "tel", "email", "password"];
365
375
  var NUMERIC_INPUT_TYPES = [
@@ -739,7 +749,11 @@ var ALLOWED_ROLES = {
739
749
  "treeitem"
740
750
  ],
741
751
  dialog: ["alertdialog"],
742
- fieldset: ["none", "presentation", "radiogroup"]
752
+ fieldset: ["none", "presentation", "radiogroup"],
753
+ // `<label>` has no implicit role and no documented alternates — its native labeling
754
+ // semantics (control association, accessible-name contribution) aren't reproducible via
755
+ // ARIA, so any explicit `role` should be avoided rather than substituted.
756
+ label: []
743
757
  };
744
758
  var ELEMENT_SPECS = {
745
759
  input: inputElementSpec,
@@ -780,7 +794,10 @@ var roleNotPermittedRule = Object.assign(
780
794
  );
781
795
 
782
796
  // ../core/src/html/aria-rules.ts
783
- var LANDMARK_TAG_SET = /* @__PURE__ */ new Set(["article", "aside", "footer", "header", "main", "nav"]);
797
+ function defineAriaRule(tags, rule) {
798
+ return Object.assign(rule, { tags });
799
+ }
800
+ var LANDMARK_TAG_SET = new Set(LANDMARK_TAGS);
784
801
  var removeLandmarkRoleOverride = {
785
802
  kind: "removeRole",
786
803
  apply: ({ props }) => {
@@ -789,10 +806,11 @@ var removeLandmarkRoleOverride = {
789
806
  return { applied: true, next: rest, previous: props };
790
807
  }
791
808
  };
792
- var landmarkRoleRule = Object.assign(
809
+ var landmarkRoleRule = defineAriaRule(
810
+ LANDMARK_TAGS,
793
811
  ({ tag, props, implicitRole }) => {
794
812
  if (!LANDMARK_TAG_SET.has(tag) || !implicitRole) return [];
795
- const role = props.role;
813
+ const { role } = props;
796
814
  if (!role || role === implicitRole) return [];
797
815
  const diagnostic = HtmlDiagnostics.landmarkRoleOverride(tag, implicitRole, role);
798
816
  return [
@@ -804,8 +822,7 @@ var landmarkRoleRule = Object.assign(
804
822
  diagnostic
805
823
  }
806
824
  ];
807
- },
808
- { tags: [...LANDMARK_TAG_SET] }
825
+ }
809
826
  );
810
827
  function requireAccessibleName({ tag, props }) {
811
828
  if ("aria-label" in props || "aria-labelledby" in props) return [];
@@ -818,17 +835,18 @@ function requireAccessibleName({ tag, props }) {
818
835
  }
819
836
  ];
820
837
  }
821
- var NAMED_LANDMARK_TAGS = /* @__PURE__ */ new Set(["nav", "aside"]);
822
- var landmarkNameAdvisory = Object.assign(
838
+ var NAMED_LANDMARK_TAGS = ["nav", "aside"];
839
+ var NAMED_LANDMARK_TAG_SET = new Set(NAMED_LANDMARK_TAGS);
840
+ var landmarkAccessibleNameRule = defineAriaRule(
841
+ NAMED_LANDMARK_TAGS,
823
842
  (ctx) => {
824
- if (!ctx.implicitRole || !NAMED_LANDMARK_TAGS.has(ctx.tag)) return [];
843
+ if (!ctx.implicitRole || !NAMED_LANDMARK_TAG_SET.has(ctx.tag)) return [];
825
844
  return requireAccessibleName(ctx);
826
- },
827
- { tags: [...NAMED_LANDMARK_TAGS] }
845
+ }
828
846
  );
829
847
  var HTML_ARIA_RULES = [
830
848
  landmarkRoleRule,
831
- landmarkNameAdvisory,
849
+ landmarkAccessibleNameRule,
832
850
  roleNotPermittedRule,
833
851
  ...INPUT_RULES
834
852
  ];
@@ -841,7 +859,7 @@ export {
841
859
  checkedRequiresCheckableTypeRule,
842
860
  heightRequiresImageTypeRule,
843
861
  inputAccessibleNameRule,
844
- landmarkNameAdvisory,
862
+ landmarkAccessibleNameRule,
845
863
  landmarkRoleRule,
846
864
  maxLengthRequiresTextTypeRule,
847
865
  maxRequiresNumericTypeRule,