praxis-kit 6.6.0 → 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.
- package/dist/_shared/diagnostics.d.ts +1 -0
- package/dist/_shared/diagnostics.js +1 -0
- package/dist/{chunk-OCG5VM4H.js → chunk-35CJAOJW.js} +267 -155
- package/dist/contract/index.d.ts +56 -3
- package/dist/contract/index.js +75 -0
- package/dist/eslint/index.js +16 -16
- package/dist/guards/index.d.ts +21 -1
- package/dist/guards/index.js +29 -1
- package/dist/html/index.d.ts +7 -4
- package/dist/html/index.js +48 -27
- package/dist/lit/index.d.ts +5 -2
- package/dist/lit/index.js +264 -155
- package/dist/preact/index.d.ts +5 -2
- package/dist/preact/index.js +267 -155
- package/dist/react/index.d.ts +2 -2
- package/dist/react/index.js +1 -1
- package/dist/react/legacy.d.ts +2 -2
- package/dist/react/legacy.js +1 -1
- package/dist/{react-options-BUBVohU6.d.ts → react-options-Cm99IE5J.d.ts} +5 -2
- package/dist/solid/index.d.ts +5 -2
- package/dist/solid/index.js +267 -155
- package/dist/svelte/Polymorphic.svelte +3 -1
- package/dist/svelte/index.d.ts +12 -9
- package/dist/svelte/index.js +263 -154
- package/dist/tailwind/index.js +31 -0
- package/dist/vite-plugin/index.d.ts +1 -0
- package/dist/vue/index.d.ts +5 -2
- package/dist/vue/index.js +264 -155
- package/dist/web/index.d.ts +5 -2
- package/dist/web/index.js +264 -155
- package/package.json +7 -7
package/dist/vue/index.js
CHANGED
|
@@ -11,6 +11,11 @@ function makeResolveTag(defaultTag) {
|
|
|
11
11
|
// ../../lib/primitive/src/rule/rule-brand.ts
|
|
12
12
|
var RULE_BRAND = /* @__PURE__ */ Symbol("praxis-kit/dynamic-rule");
|
|
13
13
|
|
|
14
|
+
// ../../lib/primitive/src/rule/dynamic.ts
|
|
15
|
+
function dynamic(resolve) {
|
|
16
|
+
return { [RULE_BRAND]: true, resolve };
|
|
17
|
+
}
|
|
18
|
+
|
|
14
19
|
// ../../lib/primitive/src/guards/foundational/is-defined.ts
|
|
15
20
|
function isUndefined(value) {
|
|
16
21
|
return value === void 0;
|
|
@@ -24,7 +29,7 @@ function isNonNull(value) {
|
|
|
24
29
|
return value != null;
|
|
25
30
|
}
|
|
26
31
|
function isNullish(value) {
|
|
27
|
-
return isNull(value) || value
|
|
32
|
+
return isNull(value) || isUndefined(value);
|
|
28
33
|
}
|
|
29
34
|
|
|
30
35
|
// ../../lib/primitive/src/utils/type-guards.ts
|
|
@@ -601,6 +606,24 @@ var ROLE_RESTRICTED_ATTRIBUTES = /* @__PURE__ */ new Map([
|
|
|
601
606
|
]
|
|
602
607
|
]);
|
|
603
608
|
|
|
609
|
+
// ../../lib/primitive/src/constants/html/void-tags.ts
|
|
610
|
+
var VOID_TAGS = [
|
|
611
|
+
"area",
|
|
612
|
+
"base",
|
|
613
|
+
"br",
|
|
614
|
+
"col",
|
|
615
|
+
"embed",
|
|
616
|
+
"hr",
|
|
617
|
+
"img",
|
|
618
|
+
"input",
|
|
619
|
+
"link",
|
|
620
|
+
"meta",
|
|
621
|
+
"param",
|
|
622
|
+
"source",
|
|
623
|
+
"track",
|
|
624
|
+
"wbr"
|
|
625
|
+
];
|
|
626
|
+
|
|
604
627
|
// ../../lib/primitive/src/guards/aria/is-aria-attribute.ts
|
|
605
628
|
function isGlobalAriaAttribute(attr) {
|
|
606
629
|
return GLOBAL_ARIA_ATTRIBUTES.has(attr);
|
|
@@ -1599,7 +1622,8 @@ var AriaPolicyEngine = class _AriaPolicyEngine extends InvariantBase {
|
|
|
1599
1622
|
const cached = _AriaPolicyEngine.#removeAttributeFixCache.get(attr);
|
|
1600
1623
|
if (cached) return cached;
|
|
1601
1624
|
const fix = {
|
|
1602
|
-
kind:
|
|
1625
|
+
kind: "removeAttribute",
|
|
1626
|
+
attribute: attr,
|
|
1603
1627
|
apply: ({ props }) => {
|
|
1604
1628
|
if (!(attr in props)) return { applied: false, next: props };
|
|
1605
1629
|
return { applied: true, next: omitProp(props, attr), previous: props };
|
|
@@ -1870,7 +1894,8 @@ var AriaPolicyEngine = class _AriaPolicyEngine extends InvariantBase {
|
|
|
1870
1894
|
if (!impliedLive) return NO_VIOLATIONS2;
|
|
1871
1895
|
if ("aria-live" in props) return NO_VIOLATIONS2;
|
|
1872
1896
|
const injectLive = {
|
|
1873
|
-
kind:
|
|
1897
|
+
kind: "injectLive",
|
|
1898
|
+
attribute: "aria-live",
|
|
1874
1899
|
apply: (ctx) => ({
|
|
1875
1900
|
applied: true,
|
|
1876
1901
|
next: { ...ctx.props, "aria-live": impliedLive },
|
|
@@ -1939,6 +1964,23 @@ var AriaPolicyEngine = class _AriaPolicyEngine extends InvariantBase {
|
|
|
1939
1964
|
}
|
|
1940
1965
|
};
|
|
1941
1966
|
|
|
1967
|
+
// ../../lib/contract/src/aria/factories.ts
|
|
1968
|
+
function removeProp(props, key) {
|
|
1969
|
+
const next = { ...props };
|
|
1970
|
+
delete next[key];
|
|
1971
|
+
return next;
|
|
1972
|
+
}
|
|
1973
|
+
function removeAttributeFix(attribute) {
|
|
1974
|
+
return Object.freeze({
|
|
1975
|
+
kind: "removeAttribute",
|
|
1976
|
+
attribute,
|
|
1977
|
+
apply: ({ props }) => {
|
|
1978
|
+
if (!(attribute in props)) return { applied: false, next: props };
|
|
1979
|
+
return { applied: true, next: removeProp(props, attribute), previous: props };
|
|
1980
|
+
}
|
|
1981
|
+
});
|
|
1982
|
+
}
|
|
1983
|
+
|
|
1942
1984
|
// ../../lib/contract/src/children/get-type-name.ts
|
|
1943
1985
|
function getTypeName(value) {
|
|
1944
1986
|
if (value === null) return "null";
|
|
@@ -2255,6 +2297,77 @@ var readonlyProps = ({
|
|
|
2255
2297
|
// ../core/src/html/evaluators.ts
|
|
2256
2298
|
import { warnDiagnostics as warnDiagnostics2 } from "../_shared/diagnostics.js";
|
|
2257
2299
|
|
|
2300
|
+
// ../core/src/html/contracts/categories.ts
|
|
2301
|
+
var METADATA_TAGS = ["script", "template"];
|
|
2302
|
+
var TEXT_ONLY_TAGS = [
|
|
2303
|
+
"option",
|
|
2304
|
+
"script",
|
|
2305
|
+
"style",
|
|
2306
|
+
"textarea",
|
|
2307
|
+
"title"
|
|
2308
|
+
];
|
|
2309
|
+
var LANDMARK_TAGS = [
|
|
2310
|
+
"article",
|
|
2311
|
+
"aside",
|
|
2312
|
+
"footer",
|
|
2313
|
+
"header",
|
|
2314
|
+
"main",
|
|
2315
|
+
"nav"
|
|
2316
|
+
];
|
|
2317
|
+
var INTERACTIVE_CONTENT_TAGS = [
|
|
2318
|
+
"a",
|
|
2319
|
+
"button",
|
|
2320
|
+
"input",
|
|
2321
|
+
"select",
|
|
2322
|
+
"textarea",
|
|
2323
|
+
"label"
|
|
2324
|
+
];
|
|
2325
|
+
var LABELABLE_TAGS = [
|
|
2326
|
+
"button",
|
|
2327
|
+
"input",
|
|
2328
|
+
"meter",
|
|
2329
|
+
"output",
|
|
2330
|
+
"progress",
|
|
2331
|
+
"select",
|
|
2332
|
+
"textarea"
|
|
2333
|
+
];
|
|
2334
|
+
var OTHER_INTERACTIVE_TAGS = [
|
|
2335
|
+
"a",
|
|
2336
|
+
"details",
|
|
2337
|
+
"embed",
|
|
2338
|
+
"iframe"
|
|
2339
|
+
];
|
|
2340
|
+
var P_BLOCKED_TAGS = [
|
|
2341
|
+
"address",
|
|
2342
|
+
"article",
|
|
2343
|
+
"aside",
|
|
2344
|
+
"blockquote",
|
|
2345
|
+
"details",
|
|
2346
|
+
"dialog",
|
|
2347
|
+
"div",
|
|
2348
|
+
"dl",
|
|
2349
|
+
"fieldset",
|
|
2350
|
+
"figure",
|
|
2351
|
+
"footer",
|
|
2352
|
+
"form",
|
|
2353
|
+
"h1",
|
|
2354
|
+
"h2",
|
|
2355
|
+
"h3",
|
|
2356
|
+
"h4",
|
|
2357
|
+
"h5",
|
|
2358
|
+
"h6",
|
|
2359
|
+
"header",
|
|
2360
|
+
"hr",
|
|
2361
|
+
"main",
|
|
2362
|
+
"nav",
|
|
2363
|
+
"ol",
|
|
2364
|
+
"p",
|
|
2365
|
+
"pre",
|
|
2366
|
+
"section",
|
|
2367
|
+
"table",
|
|
2368
|
+
"ul"
|
|
2369
|
+
];
|
|
2370
|
+
|
|
2258
2371
|
// ../core/src/html/spec/vocabulary/input.ts
|
|
2259
2372
|
var TEXT_INPUT_TYPES = ["text", "search", "url", "tel", "email", "password"];
|
|
2260
2373
|
var NUMERIC_INPUT_TYPES = [
|
|
@@ -2309,20 +2422,6 @@ var INPUT_MUTUALLY_EXCLUSIVE_POLICIES = [
|
|
|
2309
2422
|
|
|
2310
2423
|
// ../core/src/html/spec/validators/attribute-type-validator.ts
|
|
2311
2424
|
var DEFAULT_INPUT_TYPE = "text";
|
|
2312
|
-
function omit(props, key) {
|
|
2313
|
-
const next = { ...props };
|
|
2314
|
-
delete next[key];
|
|
2315
|
-
return next;
|
|
2316
|
-
}
|
|
2317
|
-
function removeAttributeFix(attribute) {
|
|
2318
|
-
return {
|
|
2319
|
-
kind: `removeAttribute:${attribute}`,
|
|
2320
|
-
apply: ({ props }) => {
|
|
2321
|
-
if (!(attribute in props)) return { applied: false, next: props };
|
|
2322
|
-
return { applied: true, next: omit(props, attribute), previous: props };
|
|
2323
|
-
}
|
|
2324
|
-
};
|
|
2325
|
-
}
|
|
2326
2425
|
function createInputAttributeTypeRule({
|
|
2327
2426
|
attribute,
|
|
2328
2427
|
allowedTypes
|
|
@@ -2634,7 +2733,11 @@ var ALLOWED_ROLES = {
|
|
|
2634
2733
|
"treeitem"
|
|
2635
2734
|
],
|
|
2636
2735
|
dialog: ["alertdialog"],
|
|
2637
|
-
fieldset: ["none", "presentation", "radiogroup"]
|
|
2736
|
+
fieldset: ["none", "presentation", "radiogroup"],
|
|
2737
|
+
// `<label>` has no implicit role and no documented alternates — its native labeling
|
|
2738
|
+
// semantics (control association, accessible-name contribution) aren't reproducible via
|
|
2739
|
+
// ARIA, so any explicit `role` should be avoided rather than substituted.
|
|
2740
|
+
label: []
|
|
2638
2741
|
};
|
|
2639
2742
|
var ELEMENT_SPECS = {
|
|
2640
2743
|
input: inputElementSpec,
|
|
@@ -2675,7 +2778,10 @@ var roleNotPermittedRule = Object.assign(
|
|
|
2675
2778
|
);
|
|
2676
2779
|
|
|
2677
2780
|
// ../core/src/html/aria-rules.ts
|
|
2678
|
-
|
|
2781
|
+
function defineAriaRule(tags, rule) {
|
|
2782
|
+
return Object.assign(rule, { tags });
|
|
2783
|
+
}
|
|
2784
|
+
var LANDMARK_TAG_SET = new Set(LANDMARK_TAGS);
|
|
2679
2785
|
var removeLandmarkRoleOverride = {
|
|
2680
2786
|
kind: "removeRole",
|
|
2681
2787
|
apply: ({ props }) => {
|
|
@@ -2684,10 +2790,11 @@ var removeLandmarkRoleOverride = {
|
|
|
2684
2790
|
return { applied: true, next: rest, previous: props };
|
|
2685
2791
|
}
|
|
2686
2792
|
};
|
|
2687
|
-
var landmarkRoleRule =
|
|
2793
|
+
var landmarkRoleRule = defineAriaRule(
|
|
2794
|
+
LANDMARK_TAGS,
|
|
2688
2795
|
({ tag, props, implicitRole }) => {
|
|
2689
2796
|
if (!LANDMARK_TAG_SET.has(tag) || !implicitRole) return [];
|
|
2690
|
-
const role = props
|
|
2797
|
+
const { role } = props;
|
|
2691
2798
|
if (!role || role === implicitRole) return [];
|
|
2692
2799
|
const diagnostic = HtmlDiagnostics.landmarkRoleOverride(tag, implicitRole, role);
|
|
2693
2800
|
return [
|
|
@@ -2699,8 +2806,7 @@ var landmarkRoleRule = Object.assign(
|
|
|
2699
2806
|
diagnostic
|
|
2700
2807
|
}
|
|
2701
2808
|
];
|
|
2702
|
-
}
|
|
2703
|
-
{ tags: [...LANDMARK_TAG_SET] }
|
|
2809
|
+
}
|
|
2704
2810
|
);
|
|
2705
2811
|
function requireAccessibleName({ tag, props }) {
|
|
2706
2812
|
if ("aria-label" in props || "aria-labelledby" in props) return [];
|
|
@@ -2713,38 +2819,44 @@ function requireAccessibleName({ tag, props }) {
|
|
|
2713
2819
|
}
|
|
2714
2820
|
];
|
|
2715
2821
|
}
|
|
2716
|
-
var NAMED_LANDMARK_TAGS =
|
|
2717
|
-
var
|
|
2822
|
+
var NAMED_LANDMARK_TAGS = ["nav", "aside"];
|
|
2823
|
+
var NAMED_LANDMARK_TAG_SET = new Set(NAMED_LANDMARK_TAGS);
|
|
2824
|
+
var landmarkAccessibleNameRule = defineAriaRule(
|
|
2825
|
+
NAMED_LANDMARK_TAGS,
|
|
2718
2826
|
(ctx) => {
|
|
2719
|
-
if (!ctx.implicitRole || !
|
|
2827
|
+
if (!ctx.implicitRole || !NAMED_LANDMARK_TAG_SET.has(ctx.tag)) return [];
|
|
2720
2828
|
return requireAccessibleName(ctx);
|
|
2721
|
-
}
|
|
2722
|
-
{ tags: [...NAMED_LANDMARK_TAGS] }
|
|
2829
|
+
}
|
|
2723
2830
|
);
|
|
2724
2831
|
var HTML_ARIA_RULES = [
|
|
2725
2832
|
landmarkRoleRule,
|
|
2726
|
-
|
|
2833
|
+
landmarkAccessibleNameRule,
|
|
2727
2834
|
roleNotPermittedRule,
|
|
2728
2835
|
...INPUT_RULES
|
|
2729
2836
|
];
|
|
2730
2837
|
|
|
2731
|
-
// ../core/src/html/contracts.ts
|
|
2838
|
+
// ../core/src/html/contracts/helpers.ts
|
|
2732
2839
|
import { warnDiagnostics } from "../_shared/diagnostics.js";
|
|
2840
|
+
function isVNodeLike(child) {
|
|
2841
|
+
return isObject(child) && "type" in child;
|
|
2842
|
+
}
|
|
2733
2843
|
function isOpenContent(...blockedTags) {
|
|
2734
2844
|
const set2 = new Set(blockedTags);
|
|
2735
2845
|
return (child) => {
|
|
2736
|
-
if (!
|
|
2846
|
+
if (!isVNodeLike(child)) return false;
|
|
2737
2847
|
const tag = getTag(child);
|
|
2738
2848
|
return tag === void 0 || !set2.has(tag);
|
|
2739
2849
|
};
|
|
2740
2850
|
}
|
|
2741
|
-
var METADATA_TAGS = ["script", "template"];
|
|
2742
2851
|
var metadataMatch = isTag(...METADATA_TAGS);
|
|
2743
2852
|
function metadata(name = "metadata") {
|
|
2744
2853
|
return { name, match: metadataMatch };
|
|
2745
2854
|
}
|
|
2855
|
+
function optional(name, tag) {
|
|
2856
|
+
return { name, match: isTag(tag), cardinality: { max: 1 } };
|
|
2857
|
+
}
|
|
2746
2858
|
function firstOptional(name, tag) {
|
|
2747
|
-
return { name,
|
|
2859
|
+
return { ...optional(name, tag), position: "first" };
|
|
2748
2860
|
}
|
|
2749
2861
|
function contract(children, options) {
|
|
2750
2862
|
return { diagnostics: warnDiagnostics, children, ...options };
|
|
@@ -2758,50 +2870,41 @@ function ariaContract(aria) {
|
|
|
2758
2870
|
function firstChildContract(name, tag) {
|
|
2759
2871
|
return contract([firstOptional(name, tag), { name: "content", match: isOpenContent(tag) }]);
|
|
2760
2872
|
}
|
|
2761
|
-
|
|
2762
|
-
|
|
2763
|
-
|
|
2764
|
-
|
|
2765
|
-
|
|
2766
|
-
|
|
2767
|
-
|
|
2768
|
-
|
|
2769
|
-
|
|
2770
|
-
|
|
2771
|
-
|
|
2772
|
-
|
|
2773
|
-
|
|
2774
|
-
|
|
2775
|
-
|
|
2776
|
-
];
|
|
2777
|
-
var
|
|
2778
|
-
var
|
|
2779
|
-
var
|
|
2780
|
-
|
|
2781
|
-
|
|
2782
|
-
var
|
|
2783
|
-
|
|
2784
|
-
|
|
2785
|
-
|
|
2786
|
-
|
|
2787
|
-
{ name: "tfoot", match: isTag("tfoot"), cardinality: { max: 1 } },
|
|
2788
|
-
{ name: "table-row", match: isTag("tr", ...METADATA_TAGS) }
|
|
2789
|
-
]);
|
|
2790
|
-
var tableBodyContract = closedContract([
|
|
2791
|
-
{ name: "table-row", match: isTag("tr", ...METADATA_TAGS) }
|
|
2792
|
-
]);
|
|
2793
|
-
var tableRowContract = closedContract([
|
|
2794
|
-
{ name: "table-cell", match: isTag("td", "th", ...METADATA_TAGS) }
|
|
2795
|
-
]);
|
|
2796
|
-
var colgroupContract = closedContract([
|
|
2797
|
-
{ name: "column", match: isTag("col", "template") }
|
|
2873
|
+
function getChildProp(child, key) {
|
|
2874
|
+
if (!isVNodeLike(child)) return void 0;
|
|
2875
|
+
const { props } = child;
|
|
2876
|
+
if (!isObject(props)) return void 0;
|
|
2877
|
+
return props[key];
|
|
2878
|
+
}
|
|
2879
|
+
|
|
2880
|
+
// ../core/src/html/contracts/aria/landmarks.ts
|
|
2881
|
+
var landmarkContract = ariaContract([landmarkRoleRule, landmarkAccessibleNameRule]);
|
|
2882
|
+
|
|
2883
|
+
// ../core/src/html/contracts/aria/widgets.ts
|
|
2884
|
+
var dialogContract = ariaContract([requireAccessibleName]);
|
|
2885
|
+
var menuContract = ariaContract([requireAccessibleName]);
|
|
2886
|
+
var menubarContract = ariaContract([requireAccessibleName]);
|
|
2887
|
+
var treeContract = ariaContract([requireAccessibleName]);
|
|
2888
|
+
var gridContract = ariaContract([requireAccessibleName]);
|
|
2889
|
+
var listboxContract = ariaContract([requireAccessibleName]);
|
|
2890
|
+
var tablistContract = ariaContract([requireAccessibleName]);
|
|
2891
|
+
var radiogroupContract = ariaContract([requireAccessibleName]);
|
|
2892
|
+
|
|
2893
|
+
// ../core/src/html/contracts/html/document.ts
|
|
2894
|
+
var headContract = closedContract([
|
|
2895
|
+
{
|
|
2896
|
+
name: "metadata",
|
|
2897
|
+
match: isTag("base", "link", "meta", "noscript", "script", "style", "template", "title")
|
|
2898
|
+
}
|
|
2798
2899
|
]);
|
|
2799
|
-
var
|
|
2800
|
-
{ name: "
|
|
2801
|
-
{ name: "
|
|
2802
|
-
{ name: "group", match: isTag("div") },
|
|
2803
|
-
metadata()
|
|
2900
|
+
var htmlContract = closedContract([
|
|
2901
|
+
{ name: "head", match: isTag("head"), cardinality: { min: 1, max: 1 }, position: "first" },
|
|
2902
|
+
{ name: "body", match: isTag("body"), cardinality: { min: 1, max: 1 } }
|
|
2804
2903
|
]);
|
|
2904
|
+
var voidContract = contract([], { exclusiveChildren: true, allowText: false });
|
|
2905
|
+
var textOnlyContract = contract([], { exclusiveChildren: true });
|
|
2906
|
+
|
|
2907
|
+
// ../core/src/html/contracts/html/forms.ts
|
|
2805
2908
|
var selectContract = closedContract([
|
|
2806
2909
|
{ name: "option", match: isTag("option", "optgroup", "hr", ...METADATA_TAGS) }
|
|
2807
2910
|
]);
|
|
@@ -2811,6 +2914,59 @@ var optgroupContract = closedContract([
|
|
|
2811
2914
|
var datalistContract = closedContract([
|
|
2812
2915
|
{ name: "option", match: isTag("option", ...METADATA_TAGS) }
|
|
2813
2916
|
]);
|
|
2917
|
+
var buttonContract = closedContract([
|
|
2918
|
+
{ name: "content", match: isOpenContent(...INTERACTIVE_CONTENT_TAGS) }
|
|
2919
|
+
]);
|
|
2920
|
+
var anchorContract = closedContract([
|
|
2921
|
+
{ name: "content", match: isOpenContent(...INTERACTIVE_CONTENT_TAGS) }
|
|
2922
|
+
]);
|
|
2923
|
+
var labelableTagMatch = isTag(...LABELABLE_TAGS);
|
|
2924
|
+
function isLabelableControl(child) {
|
|
2925
|
+
if (!labelableTagMatch(child)) return false;
|
|
2926
|
+
if (getTag(child) !== "input") return true;
|
|
2927
|
+
const type = getChildProp(child, "type");
|
|
2928
|
+
return !isString(type) || type !== "hidden";
|
|
2929
|
+
}
|
|
2930
|
+
function hasAccessibleNameProp(props) {
|
|
2931
|
+
return "aria-label" in props || "aria-labelledby" in props;
|
|
2932
|
+
}
|
|
2933
|
+
function isNonEmptyTextChild(child) {
|
|
2934
|
+
if (isNumber(child)) return true;
|
|
2935
|
+
return isString(child) && child.trim().length > 0;
|
|
2936
|
+
}
|
|
2937
|
+
var labelContract = contract([
|
|
2938
|
+
{ name: "control", match: isLabelableControl, cardinality: { max: 1 } },
|
|
2939
|
+
{ name: "nested-label", match: isTag("label"), cardinality: { max: 0 } },
|
|
2940
|
+
{
|
|
2941
|
+
name: "other-interactive-content",
|
|
2942
|
+
match: isTag(...OTHER_INTERACTIVE_TAGS),
|
|
2943
|
+
cardinality: { max: 0 }
|
|
2944
|
+
},
|
|
2945
|
+
{
|
|
2946
|
+
name: "accessible-name",
|
|
2947
|
+
match: isNonEmptyTextChild,
|
|
2948
|
+
cardinality: dynamic(
|
|
2949
|
+
(ctx) => hasAccessibleNameProp(ctx.props) ? { min: 0 } : { min: 1 }
|
|
2950
|
+
)
|
|
2951
|
+
}
|
|
2952
|
+
]);
|
|
2953
|
+
|
|
2954
|
+
// ../core/src/html/contracts/html/grouping.ts
|
|
2955
|
+
var detailsContract = firstChildContract("summary", "summary");
|
|
2956
|
+
var fieldsetContract = firstChildContract("legend", "legend");
|
|
2957
|
+
|
|
2958
|
+
// ../core/src/html/contracts/html/lists.ts
|
|
2959
|
+
var listContract = closedContract([
|
|
2960
|
+
{ name: "list-item", match: isTag("li", ...METADATA_TAGS) }
|
|
2961
|
+
]);
|
|
2962
|
+
var dlContract = closedContract([
|
|
2963
|
+
{ name: "term", match: isTag("dt") },
|
|
2964
|
+
{ name: "description", match: isTag("dd") },
|
|
2965
|
+
{ name: "group", match: isTag("div") },
|
|
2966
|
+
metadata()
|
|
2967
|
+
]);
|
|
2968
|
+
|
|
2969
|
+
// ../core/src/html/contracts/html/media.ts
|
|
2814
2970
|
var pictureContract = closedContract([
|
|
2815
2971
|
{ name: "source", match: isTag("source", ...METADATA_TAGS) },
|
|
2816
2972
|
{ name: "image", match: isTag("img"), cardinality: { min: 1, max: 1 }, position: "last" }
|
|
@@ -2819,91 +2975,49 @@ var figureContract = contract([
|
|
|
2819
2975
|
{ name: "caption", match: isTag("figcaption"), cardinality: { max: 1 } },
|
|
2820
2976
|
{ name: "content", match: isOpenContent("figcaption") }
|
|
2821
2977
|
]);
|
|
2822
|
-
var detailsContract = firstChildContract("summary", "summary");
|
|
2823
|
-
var fieldsetContract = firstChildContract("legend", "legend");
|
|
2824
2978
|
var objectContract = contract([
|
|
2825
2979
|
{ name: "param", match: isTag("param") },
|
|
2826
2980
|
{ name: "content", match: isOpenContent("param") }
|
|
2827
2981
|
]);
|
|
2828
|
-
var INTERACTIVE_CONTENT_TAGS = ["a", "button", "input", "select", "textarea", "label"];
|
|
2829
|
-
var buttonContract = closedContract([
|
|
2830
|
-
{ name: "content", match: isOpenContent(...INTERACTIVE_CONTENT_TAGS) }
|
|
2831
|
-
]);
|
|
2832
|
-
var anchorContract = closedContract([
|
|
2833
|
-
{ name: "content", match: isOpenContent(...INTERACTIVE_CONTENT_TAGS) }
|
|
2834
|
-
]);
|
|
2835
|
-
var LABELABLE_TAGS = [
|
|
2836
|
-
"button",
|
|
2837
|
-
"input",
|
|
2838
|
-
"meter",
|
|
2839
|
-
"output",
|
|
2840
|
-
"progress",
|
|
2841
|
-
"select",
|
|
2842
|
-
"textarea"
|
|
2843
|
-
];
|
|
2844
|
-
var labelContract = contract([
|
|
2845
|
-
{ name: "control", match: isTag(...LABELABLE_TAGS), cardinality: { max: 1 } }
|
|
2846
|
-
]);
|
|
2847
|
-
var P_BLOCKED_TAGS = [
|
|
2848
|
-
"address",
|
|
2849
|
-
"article",
|
|
2850
|
-
"aside",
|
|
2851
|
-
"blockquote",
|
|
2852
|
-
"details",
|
|
2853
|
-
"dialog",
|
|
2854
|
-
"div",
|
|
2855
|
-
"dl",
|
|
2856
|
-
"fieldset",
|
|
2857
|
-
"figure",
|
|
2858
|
-
"footer",
|
|
2859
|
-
"form",
|
|
2860
|
-
"h1",
|
|
2861
|
-
"h2",
|
|
2862
|
-
"h3",
|
|
2863
|
-
"h4",
|
|
2864
|
-
"h5",
|
|
2865
|
-
"h6",
|
|
2866
|
-
"header",
|
|
2867
|
-
"hr",
|
|
2868
|
-
"main",
|
|
2869
|
-
"nav",
|
|
2870
|
-
"ol",
|
|
2871
|
-
"p",
|
|
2872
|
-
"pre",
|
|
2873
|
-
"section",
|
|
2874
|
-
"table",
|
|
2875
|
-
"ul"
|
|
2876
|
-
];
|
|
2877
|
-
var pContract = closedContract([
|
|
2878
|
-
{ name: "content", match: isOpenContent(...P_BLOCKED_TAGS) }
|
|
2879
|
-
]);
|
|
2880
2982
|
var mediaContract = contract([
|
|
2881
2983
|
{ name: "source", match: isTag("source") },
|
|
2882
2984
|
{ name: "track", match: isTag("track") },
|
|
2883
2985
|
metadata(),
|
|
2884
2986
|
{ name: "content", match: isOpenContent("source", "track", ...METADATA_TAGS) }
|
|
2885
2987
|
]);
|
|
2886
|
-
|
|
2887
|
-
|
|
2888
|
-
|
|
2889
|
-
|
|
2890
|
-
}
|
|
2988
|
+
|
|
2989
|
+
// ../core/src/html/contracts/html/tables.ts
|
|
2990
|
+
var tableContract = closedContract([
|
|
2991
|
+
firstOptional("caption", "caption"),
|
|
2992
|
+
{ name: "colgroup", match: isTag("colgroup") },
|
|
2993
|
+
{ name: "thead", match: isTag("thead"), cardinality: { max: 1 } },
|
|
2994
|
+
{ name: "tbody", match: isTag("tbody") },
|
|
2995
|
+
{ name: "tfoot", match: isTag("tfoot"), cardinality: { max: 1 } },
|
|
2996
|
+
{ name: "table-row", match: isTag("tr", ...METADATA_TAGS) }
|
|
2891
2997
|
]);
|
|
2892
|
-
var
|
|
2893
|
-
{ name: "
|
|
2894
|
-
{ name: "body", match: isTag("body"), cardinality: { min: 1, max: 1 } }
|
|
2998
|
+
var tableBodyContract = closedContract([
|
|
2999
|
+
{ name: "table-row", match: isTag("tr", ...METADATA_TAGS) }
|
|
2895
3000
|
]);
|
|
2896
|
-
var
|
|
2897
|
-
|
|
2898
|
-
|
|
2899
|
-
var
|
|
2900
|
-
|
|
2901
|
-
|
|
2902
|
-
|
|
2903
|
-
|
|
2904
|
-
var
|
|
2905
|
-
|
|
2906
|
-
|
|
3001
|
+
var tableRowContract = closedContract([
|
|
3002
|
+
{ name: "table-cell", match: isTag("td", "th", ...METADATA_TAGS) }
|
|
3003
|
+
]);
|
|
3004
|
+
var colgroupContract = closedContract([
|
|
3005
|
+
{ name: "column", match: isTag("col", "template") }
|
|
3006
|
+
]);
|
|
3007
|
+
|
|
3008
|
+
// ../core/src/html/contracts/html/text.ts
|
|
3009
|
+
var pContract = closedContract([
|
|
3010
|
+
{ name: "content", match: isOpenContent(...P_BLOCKED_TAGS) }
|
|
3011
|
+
]);
|
|
3012
|
+
|
|
3013
|
+
// ../core/src/html/contracts/build-map.ts
|
|
3014
|
+
function buildMap(groups) {
|
|
3015
|
+
return Object.fromEntries(
|
|
3016
|
+
groups.flatMap(([keys2, value]) => keys2.map((key) => [key, value]))
|
|
3017
|
+
);
|
|
3018
|
+
}
|
|
3019
|
+
|
|
3020
|
+
// ../core/src/html/contracts/maps.ts
|
|
2907
3021
|
var CONTRACT_GROUPS = [
|
|
2908
3022
|
[VOID_TAGS, voidContract],
|
|
2909
3023
|
[TEXT_ONLY_TAGS, textOnlyContract],
|
|
@@ -2912,13 +3026,8 @@ var CONTRACT_GROUPS = [
|
|
|
2912
3026
|
[["audio", "video"], mediaContract],
|
|
2913
3027
|
[["thead", "tbody", "tfoot"], tableBodyContract]
|
|
2914
3028
|
];
|
|
2915
|
-
function contractMap(groups) {
|
|
2916
|
-
return Object.fromEntries(
|
|
2917
|
-
groups.flatMap(([tags, enforcement]) => tags.map((tag) => [tag, enforcement]))
|
|
2918
|
-
);
|
|
2919
|
-
}
|
|
2920
3029
|
var htmlContracts = {
|
|
2921
|
-
...
|
|
3030
|
+
...buildMap(CONTRACT_GROUPS),
|
|
2922
3031
|
table: tableContract,
|
|
2923
3032
|
tr: tableRowContract,
|
|
2924
3033
|
colgroup: colgroupContract,
|
|
@@ -3610,7 +3719,7 @@ function render({
|
|
|
3610
3719
|
const { vnodes: children, discarded } = normalizeChildren(slots);
|
|
3611
3720
|
if (process.env.NODE_ENV !== "production") {
|
|
3612
3721
|
childrenEvaluator?.evaluate(children, { tag: state.tag, props: state.normalizedProps });
|
|
3613
|
-
runtime.options.htmlChildrenEvaluatorFn?.(state.tag)?.evaluate(children);
|
|
3722
|
+
runtime.options.htmlChildrenEvaluatorFn?.(state.tag)?.evaluate(children, { tag: state.tag, props: state.normalizedProps });
|
|
3614
3723
|
}
|
|
3615
3724
|
const slotResult = tryRenderAsChild(state, children, discarded, slotValidator);
|
|
3616
3725
|
return slotResult ?? renderIntrinsic(state, runtime, slots);
|
package/dist/web/index.d.ts
CHANGED
|
@@ -178,8 +178,8 @@ type AriaContext = {
|
|
|
178
178
|
readonly props: ReadonlyDeep<IntrinsicProps>;
|
|
179
179
|
};
|
|
180
180
|
|
|
181
|
-
type RemoveAttributeFixKind =
|
|
182
|
-
type InjectLiveFixKind =
|
|
181
|
+
type RemoveAttributeFixKind = 'removeAttribute';
|
|
182
|
+
type InjectLiveFixKind = 'injectLive';
|
|
183
183
|
type FixKind = 'removeRole' | 'setRole' | 'normalizeRelevantAll' | RemoveAttributeFixKind | InjectLiveFixKind;
|
|
184
184
|
|
|
185
185
|
type AriaFixResult = {
|
|
@@ -192,6 +192,9 @@ type AriaFixResult = {
|
|
|
192
192
|
};
|
|
193
193
|
type AriaFix = {
|
|
194
194
|
readonly kind: FixKind;
|
|
195
|
+
/** The attribute a `'removeAttribute'`/`'injectLive'` fix targets — always set for those
|
|
196
|
+
* kinds, absent for kinds with no single-attribute target (`'removeRole'`, etc.). */
|
|
197
|
+
readonly attribute?: string;
|
|
195
198
|
readonly priority?: number;
|
|
196
199
|
readonly source?: string;
|
|
197
200
|
readonly apply: (context: AriaContext) => AriaFixResult;
|