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/preact/index.js
CHANGED
|
@@ -11,6 +11,11 @@ var EVENT_HANDLER_RE = /^on[A-Z]/;
|
|
|
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
|
|
@@ -625,6 +630,24 @@ var ROLE_RESTRICTED_ATTRIBUTES = /* @__PURE__ */ new Map([
|
|
|
625
630
|
]
|
|
626
631
|
]);
|
|
627
632
|
|
|
633
|
+
// ../../lib/primitive/src/constants/html/void-tags.ts
|
|
634
|
+
var VOID_TAGS = [
|
|
635
|
+
"area",
|
|
636
|
+
"base",
|
|
637
|
+
"br",
|
|
638
|
+
"col",
|
|
639
|
+
"embed",
|
|
640
|
+
"hr",
|
|
641
|
+
"img",
|
|
642
|
+
"input",
|
|
643
|
+
"link",
|
|
644
|
+
"meta",
|
|
645
|
+
"param",
|
|
646
|
+
"source",
|
|
647
|
+
"track",
|
|
648
|
+
"wbr"
|
|
649
|
+
];
|
|
650
|
+
|
|
628
651
|
// ../../lib/primitive/src/constants/primitive/slot-name.ts
|
|
629
652
|
var SLOT_NAME = "Slot";
|
|
630
653
|
|
|
@@ -1629,7 +1652,8 @@ var AriaPolicyEngine = class _AriaPolicyEngine extends InvariantBase {
|
|
|
1629
1652
|
const cached = _AriaPolicyEngine.#removeAttributeFixCache.get(attr);
|
|
1630
1653
|
if (cached) return cached;
|
|
1631
1654
|
const fix = {
|
|
1632
|
-
kind:
|
|
1655
|
+
kind: "removeAttribute",
|
|
1656
|
+
attribute: attr,
|
|
1633
1657
|
apply: ({ props }) => {
|
|
1634
1658
|
if (!(attr in props)) return { applied: false, next: props };
|
|
1635
1659
|
return { applied: true, next: omitProp(props, attr), previous: props };
|
|
@@ -1900,7 +1924,8 @@ var AriaPolicyEngine = class _AriaPolicyEngine extends InvariantBase {
|
|
|
1900
1924
|
if (!impliedLive) return NO_VIOLATIONS2;
|
|
1901
1925
|
if ("aria-live" in props) return NO_VIOLATIONS2;
|
|
1902
1926
|
const injectLive = {
|
|
1903
|
-
kind:
|
|
1927
|
+
kind: "injectLive",
|
|
1928
|
+
attribute: "aria-live",
|
|
1904
1929
|
apply: (ctx) => ({
|
|
1905
1930
|
applied: true,
|
|
1906
1931
|
next: { ...ctx.props, "aria-live": impliedLive },
|
|
@@ -1969,6 +1994,23 @@ var AriaPolicyEngine = class _AriaPolicyEngine extends InvariantBase {
|
|
|
1969
1994
|
}
|
|
1970
1995
|
};
|
|
1971
1996
|
|
|
1997
|
+
// ../../lib/contract/src/aria/factories.ts
|
|
1998
|
+
function removeProp(props, key) {
|
|
1999
|
+
const next = { ...props };
|
|
2000
|
+
delete next[key];
|
|
2001
|
+
return next;
|
|
2002
|
+
}
|
|
2003
|
+
function removeAttributeFix(attribute) {
|
|
2004
|
+
return Object.freeze({
|
|
2005
|
+
kind: "removeAttribute",
|
|
2006
|
+
attribute,
|
|
2007
|
+
apply: ({ props }) => {
|
|
2008
|
+
if (!(attribute in props)) return { applied: false, next: props };
|
|
2009
|
+
return { applied: true, next: removeProp(props, attribute), previous: props };
|
|
2010
|
+
}
|
|
2011
|
+
});
|
|
2012
|
+
}
|
|
2013
|
+
|
|
1972
2014
|
// ../../lib/contract/src/children/get-type-name.ts
|
|
1973
2015
|
function getTypeName(value) {
|
|
1974
2016
|
if (value === null) return "null";
|
|
@@ -2285,6 +2327,77 @@ var readonlyProps = ({
|
|
|
2285
2327
|
// ../core/src/html/evaluators.ts
|
|
2286
2328
|
import { warnDiagnostics as warnDiagnostics2 } from "../_shared/diagnostics.js";
|
|
2287
2329
|
|
|
2330
|
+
// ../core/src/html/contracts/categories.ts
|
|
2331
|
+
var METADATA_TAGS = ["script", "template"];
|
|
2332
|
+
var TEXT_ONLY_TAGS = [
|
|
2333
|
+
"option",
|
|
2334
|
+
"script",
|
|
2335
|
+
"style",
|
|
2336
|
+
"textarea",
|
|
2337
|
+
"title"
|
|
2338
|
+
];
|
|
2339
|
+
var LANDMARK_TAGS = [
|
|
2340
|
+
"article",
|
|
2341
|
+
"aside",
|
|
2342
|
+
"footer",
|
|
2343
|
+
"header",
|
|
2344
|
+
"main",
|
|
2345
|
+
"nav"
|
|
2346
|
+
];
|
|
2347
|
+
var INTERACTIVE_CONTENT_TAGS = [
|
|
2348
|
+
"a",
|
|
2349
|
+
"button",
|
|
2350
|
+
"input",
|
|
2351
|
+
"select",
|
|
2352
|
+
"textarea",
|
|
2353
|
+
"label"
|
|
2354
|
+
];
|
|
2355
|
+
var LABELABLE_TAGS = [
|
|
2356
|
+
"button",
|
|
2357
|
+
"input",
|
|
2358
|
+
"meter",
|
|
2359
|
+
"output",
|
|
2360
|
+
"progress",
|
|
2361
|
+
"select",
|
|
2362
|
+
"textarea"
|
|
2363
|
+
];
|
|
2364
|
+
var OTHER_INTERACTIVE_TAGS = [
|
|
2365
|
+
"a",
|
|
2366
|
+
"details",
|
|
2367
|
+
"embed",
|
|
2368
|
+
"iframe"
|
|
2369
|
+
];
|
|
2370
|
+
var P_BLOCKED_TAGS = [
|
|
2371
|
+
"address",
|
|
2372
|
+
"article",
|
|
2373
|
+
"aside",
|
|
2374
|
+
"blockquote",
|
|
2375
|
+
"details",
|
|
2376
|
+
"dialog",
|
|
2377
|
+
"div",
|
|
2378
|
+
"dl",
|
|
2379
|
+
"fieldset",
|
|
2380
|
+
"figure",
|
|
2381
|
+
"footer",
|
|
2382
|
+
"form",
|
|
2383
|
+
"h1",
|
|
2384
|
+
"h2",
|
|
2385
|
+
"h3",
|
|
2386
|
+
"h4",
|
|
2387
|
+
"h5",
|
|
2388
|
+
"h6",
|
|
2389
|
+
"header",
|
|
2390
|
+
"hr",
|
|
2391
|
+
"main",
|
|
2392
|
+
"nav",
|
|
2393
|
+
"ol",
|
|
2394
|
+
"p",
|
|
2395
|
+
"pre",
|
|
2396
|
+
"section",
|
|
2397
|
+
"table",
|
|
2398
|
+
"ul"
|
|
2399
|
+
];
|
|
2400
|
+
|
|
2288
2401
|
// ../core/src/html/spec/vocabulary/input.ts
|
|
2289
2402
|
var TEXT_INPUT_TYPES = ["text", "search", "url", "tel", "email", "password"];
|
|
2290
2403
|
var NUMERIC_INPUT_TYPES = [
|
|
@@ -2339,20 +2452,6 @@ var INPUT_MUTUALLY_EXCLUSIVE_POLICIES = [
|
|
|
2339
2452
|
|
|
2340
2453
|
// ../core/src/html/spec/validators/attribute-type-validator.ts
|
|
2341
2454
|
var DEFAULT_INPUT_TYPE = "text";
|
|
2342
|
-
function omit(props, key) {
|
|
2343
|
-
const next = { ...props };
|
|
2344
|
-
delete next[key];
|
|
2345
|
-
return next;
|
|
2346
|
-
}
|
|
2347
|
-
function removeAttributeFix(attribute) {
|
|
2348
|
-
return {
|
|
2349
|
-
kind: `removeAttribute:${attribute}`,
|
|
2350
|
-
apply: ({ props }) => {
|
|
2351
|
-
if (!(attribute in props)) return { applied: false, next: props };
|
|
2352
|
-
return { applied: true, next: omit(props, attribute), previous: props };
|
|
2353
|
-
}
|
|
2354
|
-
};
|
|
2355
|
-
}
|
|
2356
2455
|
function createInputAttributeTypeRule({
|
|
2357
2456
|
attribute,
|
|
2358
2457
|
allowedTypes
|
|
@@ -2664,7 +2763,11 @@ var ALLOWED_ROLES = {
|
|
|
2664
2763
|
"treeitem"
|
|
2665
2764
|
],
|
|
2666
2765
|
dialog: ["alertdialog"],
|
|
2667
|
-
fieldset: ["none", "presentation", "radiogroup"]
|
|
2766
|
+
fieldset: ["none", "presentation", "radiogroup"],
|
|
2767
|
+
// `<label>` has no implicit role and no documented alternates — its native labeling
|
|
2768
|
+
// semantics (control association, accessible-name contribution) aren't reproducible via
|
|
2769
|
+
// ARIA, so any explicit `role` should be avoided rather than substituted.
|
|
2770
|
+
label: []
|
|
2668
2771
|
};
|
|
2669
2772
|
var ELEMENT_SPECS = {
|
|
2670
2773
|
input: inputElementSpec,
|
|
@@ -2705,7 +2808,10 @@ var roleNotPermittedRule = Object.assign(
|
|
|
2705
2808
|
);
|
|
2706
2809
|
|
|
2707
2810
|
// ../core/src/html/aria-rules.ts
|
|
2708
|
-
|
|
2811
|
+
function defineAriaRule(tags, rule) {
|
|
2812
|
+
return Object.assign(rule, { tags });
|
|
2813
|
+
}
|
|
2814
|
+
var LANDMARK_TAG_SET = new Set(LANDMARK_TAGS);
|
|
2709
2815
|
var removeLandmarkRoleOverride = {
|
|
2710
2816
|
kind: "removeRole",
|
|
2711
2817
|
apply: ({ props }) => {
|
|
@@ -2714,10 +2820,11 @@ var removeLandmarkRoleOverride = {
|
|
|
2714
2820
|
return { applied: true, next: rest, previous: props };
|
|
2715
2821
|
}
|
|
2716
2822
|
};
|
|
2717
|
-
var landmarkRoleRule =
|
|
2823
|
+
var landmarkRoleRule = defineAriaRule(
|
|
2824
|
+
LANDMARK_TAGS,
|
|
2718
2825
|
({ tag, props, implicitRole }) => {
|
|
2719
2826
|
if (!LANDMARK_TAG_SET.has(tag) || !implicitRole) return [];
|
|
2720
|
-
const role = props
|
|
2827
|
+
const { role } = props;
|
|
2721
2828
|
if (!role || role === implicitRole) return [];
|
|
2722
2829
|
const diagnostic = HtmlDiagnostics.landmarkRoleOverride(tag, implicitRole, role);
|
|
2723
2830
|
return [
|
|
@@ -2729,8 +2836,7 @@ var landmarkRoleRule = Object.assign(
|
|
|
2729
2836
|
diagnostic
|
|
2730
2837
|
}
|
|
2731
2838
|
];
|
|
2732
|
-
}
|
|
2733
|
-
{ tags: [...LANDMARK_TAG_SET] }
|
|
2839
|
+
}
|
|
2734
2840
|
);
|
|
2735
2841
|
function requireAccessibleName({ tag, props }) {
|
|
2736
2842
|
if ("aria-label" in props || "aria-labelledby" in props) return [];
|
|
@@ -2743,38 +2849,44 @@ function requireAccessibleName({ tag, props }) {
|
|
|
2743
2849
|
}
|
|
2744
2850
|
];
|
|
2745
2851
|
}
|
|
2746
|
-
var NAMED_LANDMARK_TAGS =
|
|
2747
|
-
var
|
|
2852
|
+
var NAMED_LANDMARK_TAGS = ["nav", "aside"];
|
|
2853
|
+
var NAMED_LANDMARK_TAG_SET = new Set(NAMED_LANDMARK_TAGS);
|
|
2854
|
+
var landmarkAccessibleNameRule = defineAriaRule(
|
|
2855
|
+
NAMED_LANDMARK_TAGS,
|
|
2748
2856
|
(ctx) => {
|
|
2749
|
-
if (!ctx.implicitRole || !
|
|
2857
|
+
if (!ctx.implicitRole || !NAMED_LANDMARK_TAG_SET.has(ctx.tag)) return [];
|
|
2750
2858
|
return requireAccessibleName(ctx);
|
|
2751
|
-
}
|
|
2752
|
-
{ tags: [...NAMED_LANDMARK_TAGS] }
|
|
2859
|
+
}
|
|
2753
2860
|
);
|
|
2754
2861
|
var HTML_ARIA_RULES = [
|
|
2755
2862
|
landmarkRoleRule,
|
|
2756
|
-
|
|
2863
|
+
landmarkAccessibleNameRule,
|
|
2757
2864
|
roleNotPermittedRule,
|
|
2758
2865
|
...INPUT_RULES
|
|
2759
2866
|
];
|
|
2760
2867
|
|
|
2761
|
-
// ../core/src/html/contracts.ts
|
|
2868
|
+
// ../core/src/html/contracts/helpers.ts
|
|
2762
2869
|
import { warnDiagnostics } from "../_shared/diagnostics.js";
|
|
2870
|
+
function isVNodeLike(child) {
|
|
2871
|
+
return isObject(child) && "type" in child;
|
|
2872
|
+
}
|
|
2763
2873
|
function isOpenContent(...blockedTags) {
|
|
2764
2874
|
const set2 = new Set(blockedTags);
|
|
2765
2875
|
return (child) => {
|
|
2766
|
-
if (!
|
|
2876
|
+
if (!isVNodeLike(child)) return false;
|
|
2767
2877
|
const tag = getTag(child);
|
|
2768
2878
|
return tag === void 0 || !set2.has(tag);
|
|
2769
2879
|
};
|
|
2770
2880
|
}
|
|
2771
|
-
var METADATA_TAGS = ["script", "template"];
|
|
2772
2881
|
var metadataMatch = isTag(...METADATA_TAGS);
|
|
2773
2882
|
function metadata(name = "metadata") {
|
|
2774
2883
|
return { name, match: metadataMatch };
|
|
2775
2884
|
}
|
|
2885
|
+
function optional(name, tag) {
|
|
2886
|
+
return { name, match: isTag(tag), cardinality: { max: 1 } };
|
|
2887
|
+
}
|
|
2776
2888
|
function firstOptional(name, tag) {
|
|
2777
|
-
return { name,
|
|
2889
|
+
return { ...optional(name, tag), position: "first" };
|
|
2778
2890
|
}
|
|
2779
2891
|
function contract(children, options) {
|
|
2780
2892
|
return { diagnostics: warnDiagnostics, children, ...options };
|
|
@@ -2788,50 +2900,41 @@ function ariaContract(aria) {
|
|
|
2788
2900
|
function firstChildContract(name, tag) {
|
|
2789
2901
|
return contract([firstOptional(name, tag), { name: "content", match: isOpenContent(tag) }]);
|
|
2790
2902
|
}
|
|
2791
|
-
|
|
2792
|
-
|
|
2793
|
-
|
|
2794
|
-
|
|
2795
|
-
|
|
2796
|
-
|
|
2797
|
-
|
|
2798
|
-
|
|
2799
|
-
|
|
2800
|
-
|
|
2801
|
-
|
|
2802
|
-
|
|
2803
|
-
|
|
2804
|
-
|
|
2805
|
-
|
|
2806
|
-
];
|
|
2807
|
-
var
|
|
2808
|
-
var
|
|
2809
|
-
var
|
|
2810
|
-
|
|
2811
|
-
|
|
2812
|
-
var
|
|
2813
|
-
|
|
2814
|
-
|
|
2815
|
-
|
|
2816
|
-
|
|
2817
|
-
{ name: "tfoot", match: isTag("tfoot"), cardinality: { max: 1 } },
|
|
2818
|
-
{ name: "table-row", match: isTag("tr", ...METADATA_TAGS) }
|
|
2819
|
-
]);
|
|
2820
|
-
var tableBodyContract = closedContract([
|
|
2821
|
-
{ name: "table-row", match: isTag("tr", ...METADATA_TAGS) }
|
|
2822
|
-
]);
|
|
2823
|
-
var tableRowContract = closedContract([
|
|
2824
|
-
{ name: "table-cell", match: isTag("td", "th", ...METADATA_TAGS) }
|
|
2825
|
-
]);
|
|
2826
|
-
var colgroupContract = closedContract([
|
|
2827
|
-
{ name: "column", match: isTag("col", "template") }
|
|
2903
|
+
function getChildProp(child, key) {
|
|
2904
|
+
if (!isVNodeLike(child)) return void 0;
|
|
2905
|
+
const { props } = child;
|
|
2906
|
+
if (!isObject(props)) return void 0;
|
|
2907
|
+
return props[key];
|
|
2908
|
+
}
|
|
2909
|
+
|
|
2910
|
+
// ../core/src/html/contracts/aria/landmarks.ts
|
|
2911
|
+
var landmarkContract = ariaContract([landmarkRoleRule, landmarkAccessibleNameRule]);
|
|
2912
|
+
|
|
2913
|
+
// ../core/src/html/contracts/aria/widgets.ts
|
|
2914
|
+
var dialogContract = ariaContract([requireAccessibleName]);
|
|
2915
|
+
var menuContract = ariaContract([requireAccessibleName]);
|
|
2916
|
+
var menubarContract = ariaContract([requireAccessibleName]);
|
|
2917
|
+
var treeContract = ariaContract([requireAccessibleName]);
|
|
2918
|
+
var gridContract = ariaContract([requireAccessibleName]);
|
|
2919
|
+
var listboxContract = ariaContract([requireAccessibleName]);
|
|
2920
|
+
var tablistContract = ariaContract([requireAccessibleName]);
|
|
2921
|
+
var radiogroupContract = ariaContract([requireAccessibleName]);
|
|
2922
|
+
|
|
2923
|
+
// ../core/src/html/contracts/html/document.ts
|
|
2924
|
+
var headContract = closedContract([
|
|
2925
|
+
{
|
|
2926
|
+
name: "metadata",
|
|
2927
|
+
match: isTag("base", "link", "meta", "noscript", "script", "style", "template", "title")
|
|
2928
|
+
}
|
|
2828
2929
|
]);
|
|
2829
|
-
var
|
|
2830
|
-
{ name: "
|
|
2831
|
-
{ name: "
|
|
2832
|
-
{ name: "group", match: isTag("div") },
|
|
2833
|
-
metadata()
|
|
2930
|
+
var htmlContract = closedContract([
|
|
2931
|
+
{ name: "head", match: isTag("head"), cardinality: { min: 1, max: 1 }, position: "first" },
|
|
2932
|
+
{ name: "body", match: isTag("body"), cardinality: { min: 1, max: 1 } }
|
|
2834
2933
|
]);
|
|
2934
|
+
var voidContract = contract([], { exclusiveChildren: true, allowText: false });
|
|
2935
|
+
var textOnlyContract = contract([], { exclusiveChildren: true });
|
|
2936
|
+
|
|
2937
|
+
// ../core/src/html/contracts/html/forms.ts
|
|
2835
2938
|
var selectContract = closedContract([
|
|
2836
2939
|
{ name: "option", match: isTag("option", "optgroup", "hr", ...METADATA_TAGS) }
|
|
2837
2940
|
]);
|
|
@@ -2841,6 +2944,59 @@ var optgroupContract = closedContract([
|
|
|
2841
2944
|
var datalistContract = closedContract([
|
|
2842
2945
|
{ name: "option", match: isTag("option", ...METADATA_TAGS) }
|
|
2843
2946
|
]);
|
|
2947
|
+
var buttonContract = closedContract([
|
|
2948
|
+
{ name: "content", match: isOpenContent(...INTERACTIVE_CONTENT_TAGS) }
|
|
2949
|
+
]);
|
|
2950
|
+
var anchorContract = closedContract([
|
|
2951
|
+
{ name: "content", match: isOpenContent(...INTERACTIVE_CONTENT_TAGS) }
|
|
2952
|
+
]);
|
|
2953
|
+
var labelableTagMatch = isTag(...LABELABLE_TAGS);
|
|
2954
|
+
function isLabelableControl(child) {
|
|
2955
|
+
if (!labelableTagMatch(child)) return false;
|
|
2956
|
+
if (getTag(child) !== "input") return true;
|
|
2957
|
+
const type = getChildProp(child, "type");
|
|
2958
|
+
return !isString(type) || type !== "hidden";
|
|
2959
|
+
}
|
|
2960
|
+
function hasAccessibleNameProp(props) {
|
|
2961
|
+
return "aria-label" in props || "aria-labelledby" in props;
|
|
2962
|
+
}
|
|
2963
|
+
function isNonEmptyTextChild(child) {
|
|
2964
|
+
if (isNumber(child)) return true;
|
|
2965
|
+
return isString(child) && child.trim().length > 0;
|
|
2966
|
+
}
|
|
2967
|
+
var labelContract = contract([
|
|
2968
|
+
{ name: "control", match: isLabelableControl, cardinality: { max: 1 } },
|
|
2969
|
+
{ name: "nested-label", match: isTag("label"), cardinality: { max: 0 } },
|
|
2970
|
+
{
|
|
2971
|
+
name: "other-interactive-content",
|
|
2972
|
+
match: isTag(...OTHER_INTERACTIVE_TAGS),
|
|
2973
|
+
cardinality: { max: 0 }
|
|
2974
|
+
},
|
|
2975
|
+
{
|
|
2976
|
+
name: "accessible-name",
|
|
2977
|
+
match: isNonEmptyTextChild,
|
|
2978
|
+
cardinality: dynamic(
|
|
2979
|
+
(ctx) => hasAccessibleNameProp(ctx.props) ? { min: 0 } : { min: 1 }
|
|
2980
|
+
)
|
|
2981
|
+
}
|
|
2982
|
+
]);
|
|
2983
|
+
|
|
2984
|
+
// ../core/src/html/contracts/html/grouping.ts
|
|
2985
|
+
var detailsContract = firstChildContract("summary", "summary");
|
|
2986
|
+
var fieldsetContract = firstChildContract("legend", "legend");
|
|
2987
|
+
|
|
2988
|
+
// ../core/src/html/contracts/html/lists.ts
|
|
2989
|
+
var listContract = closedContract([
|
|
2990
|
+
{ name: "list-item", match: isTag("li", ...METADATA_TAGS) }
|
|
2991
|
+
]);
|
|
2992
|
+
var dlContract = closedContract([
|
|
2993
|
+
{ name: "term", match: isTag("dt") },
|
|
2994
|
+
{ name: "description", match: isTag("dd") },
|
|
2995
|
+
{ name: "group", match: isTag("div") },
|
|
2996
|
+
metadata()
|
|
2997
|
+
]);
|
|
2998
|
+
|
|
2999
|
+
// ../core/src/html/contracts/html/media.ts
|
|
2844
3000
|
var pictureContract = closedContract([
|
|
2845
3001
|
{ name: "source", match: isTag("source", ...METADATA_TAGS) },
|
|
2846
3002
|
{ name: "image", match: isTag("img"), cardinality: { min: 1, max: 1 }, position: "last" }
|
|
@@ -2849,91 +3005,49 @@ var figureContract = contract([
|
|
|
2849
3005
|
{ name: "caption", match: isTag("figcaption"), cardinality: { max: 1 } },
|
|
2850
3006
|
{ name: "content", match: isOpenContent("figcaption") }
|
|
2851
3007
|
]);
|
|
2852
|
-
var detailsContract = firstChildContract("summary", "summary");
|
|
2853
|
-
var fieldsetContract = firstChildContract("legend", "legend");
|
|
2854
3008
|
var objectContract = contract([
|
|
2855
3009
|
{ name: "param", match: isTag("param") },
|
|
2856
3010
|
{ name: "content", match: isOpenContent("param") }
|
|
2857
3011
|
]);
|
|
2858
|
-
var INTERACTIVE_CONTENT_TAGS = ["a", "button", "input", "select", "textarea", "label"];
|
|
2859
|
-
var buttonContract = closedContract([
|
|
2860
|
-
{ name: "content", match: isOpenContent(...INTERACTIVE_CONTENT_TAGS) }
|
|
2861
|
-
]);
|
|
2862
|
-
var anchorContract = closedContract([
|
|
2863
|
-
{ name: "content", match: isOpenContent(...INTERACTIVE_CONTENT_TAGS) }
|
|
2864
|
-
]);
|
|
2865
|
-
var LABELABLE_TAGS = [
|
|
2866
|
-
"button",
|
|
2867
|
-
"input",
|
|
2868
|
-
"meter",
|
|
2869
|
-
"output",
|
|
2870
|
-
"progress",
|
|
2871
|
-
"select",
|
|
2872
|
-
"textarea"
|
|
2873
|
-
];
|
|
2874
|
-
var labelContract = contract([
|
|
2875
|
-
{ name: "control", match: isTag(...LABELABLE_TAGS), cardinality: { max: 1 } }
|
|
2876
|
-
]);
|
|
2877
|
-
var P_BLOCKED_TAGS = [
|
|
2878
|
-
"address",
|
|
2879
|
-
"article",
|
|
2880
|
-
"aside",
|
|
2881
|
-
"blockquote",
|
|
2882
|
-
"details",
|
|
2883
|
-
"dialog",
|
|
2884
|
-
"div",
|
|
2885
|
-
"dl",
|
|
2886
|
-
"fieldset",
|
|
2887
|
-
"figure",
|
|
2888
|
-
"footer",
|
|
2889
|
-
"form",
|
|
2890
|
-
"h1",
|
|
2891
|
-
"h2",
|
|
2892
|
-
"h3",
|
|
2893
|
-
"h4",
|
|
2894
|
-
"h5",
|
|
2895
|
-
"h6",
|
|
2896
|
-
"header",
|
|
2897
|
-
"hr",
|
|
2898
|
-
"main",
|
|
2899
|
-
"nav",
|
|
2900
|
-
"ol",
|
|
2901
|
-
"p",
|
|
2902
|
-
"pre",
|
|
2903
|
-
"section",
|
|
2904
|
-
"table",
|
|
2905
|
-
"ul"
|
|
2906
|
-
];
|
|
2907
|
-
var pContract = closedContract([
|
|
2908
|
-
{ name: "content", match: isOpenContent(...P_BLOCKED_TAGS) }
|
|
2909
|
-
]);
|
|
2910
3012
|
var mediaContract = contract([
|
|
2911
3013
|
{ name: "source", match: isTag("source") },
|
|
2912
3014
|
{ name: "track", match: isTag("track") },
|
|
2913
3015
|
metadata(),
|
|
2914
3016
|
{ name: "content", match: isOpenContent("source", "track", ...METADATA_TAGS) }
|
|
2915
3017
|
]);
|
|
2916
|
-
|
|
2917
|
-
|
|
2918
|
-
|
|
2919
|
-
|
|
2920
|
-
}
|
|
3018
|
+
|
|
3019
|
+
// ../core/src/html/contracts/html/tables.ts
|
|
3020
|
+
var tableContract = closedContract([
|
|
3021
|
+
firstOptional("caption", "caption"),
|
|
3022
|
+
{ name: "colgroup", match: isTag("colgroup") },
|
|
3023
|
+
{ name: "thead", match: isTag("thead"), cardinality: { max: 1 } },
|
|
3024
|
+
{ name: "tbody", match: isTag("tbody") },
|
|
3025
|
+
{ name: "tfoot", match: isTag("tfoot"), cardinality: { max: 1 } },
|
|
3026
|
+
{ name: "table-row", match: isTag("tr", ...METADATA_TAGS) }
|
|
2921
3027
|
]);
|
|
2922
|
-
var
|
|
2923
|
-
{ name: "
|
|
2924
|
-
{ name: "body", match: isTag("body"), cardinality: { min: 1, max: 1 } }
|
|
3028
|
+
var tableBodyContract = closedContract([
|
|
3029
|
+
{ name: "table-row", match: isTag("tr", ...METADATA_TAGS) }
|
|
2925
3030
|
]);
|
|
2926
|
-
var
|
|
2927
|
-
|
|
2928
|
-
|
|
2929
|
-
var
|
|
2930
|
-
|
|
2931
|
-
|
|
2932
|
-
|
|
2933
|
-
|
|
2934
|
-
var
|
|
2935
|
-
|
|
2936
|
-
|
|
3031
|
+
var tableRowContract = closedContract([
|
|
3032
|
+
{ name: "table-cell", match: isTag("td", "th", ...METADATA_TAGS) }
|
|
3033
|
+
]);
|
|
3034
|
+
var colgroupContract = closedContract([
|
|
3035
|
+
{ name: "column", match: isTag("col", "template") }
|
|
3036
|
+
]);
|
|
3037
|
+
|
|
3038
|
+
// ../core/src/html/contracts/html/text.ts
|
|
3039
|
+
var pContract = closedContract([
|
|
3040
|
+
{ name: "content", match: isOpenContent(...P_BLOCKED_TAGS) }
|
|
3041
|
+
]);
|
|
3042
|
+
|
|
3043
|
+
// ../core/src/html/contracts/build-map.ts
|
|
3044
|
+
function buildMap(groups) {
|
|
3045
|
+
return Object.fromEntries(
|
|
3046
|
+
groups.flatMap(([keys2, value]) => keys2.map((key) => [key, value]))
|
|
3047
|
+
);
|
|
3048
|
+
}
|
|
3049
|
+
|
|
3050
|
+
// ../core/src/html/contracts/maps.ts
|
|
2937
3051
|
var CONTRACT_GROUPS = [
|
|
2938
3052
|
[VOID_TAGS, voidContract],
|
|
2939
3053
|
[TEXT_ONLY_TAGS, textOnlyContract],
|
|
@@ -2942,13 +3056,8 @@ var CONTRACT_GROUPS = [
|
|
|
2942
3056
|
[["audio", "video"], mediaContract],
|
|
2943
3057
|
[["thead", "tbody", "tfoot"], tableBodyContract]
|
|
2944
3058
|
];
|
|
2945
|
-
function contractMap(groups) {
|
|
2946
|
-
return Object.fromEntries(
|
|
2947
|
-
groups.flatMap(([tags, enforcement]) => tags.map((tag) => [tag, enforcement]))
|
|
2948
|
-
);
|
|
2949
|
-
}
|
|
2950
3059
|
var htmlContracts = {
|
|
2951
|
-
...
|
|
3060
|
+
...buildMap(CONTRACT_GROUPS),
|
|
2952
3061
|
table: tableContract,
|
|
2953
3062
|
tr: tableRowContract,
|
|
2954
3063
|
colgroup: colgroupContract,
|
|
@@ -3720,7 +3829,10 @@ function render({
|
|
|
3720
3829
|
tag: state.tag,
|
|
3721
3830
|
props: state.normalizedProps
|
|
3722
3831
|
});
|
|
3723
|
-
runtime.options.htmlChildrenEvaluatorFn?.(state.tag)?.evaluate(getNormalizedChildren()
|
|
3832
|
+
runtime.options.htmlChildrenEvaluatorFn?.(state.tag)?.evaluate(getNormalizedChildren(), {
|
|
3833
|
+
tag: state.tag,
|
|
3834
|
+
props: state.normalizedProps
|
|
3835
|
+
});
|
|
3724
3836
|
}
|
|
3725
3837
|
const slotResult = tryRenderAsChild(
|
|
3726
3838
|
state,
|
package/dist/react/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { U as UnknownProps, E as ElementType, a as EmptyRecord, V as VariantMap, R as RecipeMap, A as AnyClassPluginFactory, b as ReactFactoryOptions, P as PolymorphicComponent, c as PolymorphicGenerics, d as ExtractPluginProps } from '../react-options-
|
|
2
|
-
export { e as AnyFactoryOptions, f as ElementRef, F as FactoryOptions, g as PolymorphicProps, h as PolymorphicWithAsChild, i as PolymorphicWithRender, j as RenderCallbackProps, S as Slottable, k as SlottableProps, m as composeRefs, l as defineContractComponent, m as mergeRefs } from '../react-options-
|
|
1
|
+
import { U as UnknownProps, E as ElementType, a as EmptyRecord, V as VariantMap, R as RecipeMap, A as AnyClassPluginFactory, b as ReactFactoryOptions, P as PolymorphicComponent, c as PolymorphicGenerics, d as ExtractPluginProps } from '../react-options-Cm99IE5J.js';
|
|
2
|
+
export { e as AnyFactoryOptions, f as ElementRef, F as FactoryOptions, g as PolymorphicProps, h as PolymorphicWithAsChild, i as PolymorphicWithRender, j as RenderCallbackProps, S as Slottable, k as SlottableProps, m as composeRefs, l as defineContractComponent, m as mergeRefs } from '../react-options-Cm99IE5J.js';
|
|
3
3
|
import * as react from 'react';
|
|
4
4
|
import { ReactElement, Ref } from 'react';
|
|
5
5
|
import 'type-fest';
|
package/dist/react/index.js
CHANGED
package/dist/react/legacy.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { E as ElementType, U as UnknownProps, a as EmptyRecord, V as VariantMap, R as RecipeMap, A as AnyClassPluginFactory, b as ReactFactoryOptions, P as PolymorphicComponent, c as PolymorphicGenerics, d as ExtractPluginProps } from '../react-options-
|
|
2
|
-
export { e as AnyFactoryOptions, f as ElementRef, F as FactoryOptions, g as PolymorphicProps, h as PolymorphicWithAsChild, i as PolymorphicWithRender, j as RenderCallbackProps, S as Slottable, k as SlottableProps, l as defineContractComponent, m as mergeRefs } from '../react-options-
|
|
1
|
+
import { E as ElementType, U as UnknownProps, a as EmptyRecord, V as VariantMap, R as RecipeMap, A as AnyClassPluginFactory, b as ReactFactoryOptions, P as PolymorphicComponent, c as PolymorphicGenerics, d as ExtractPluginProps } from '../react-options-Cm99IE5J.js';
|
|
2
|
+
export { e as AnyFactoryOptions, f as ElementRef, F as FactoryOptions, g as PolymorphicProps, h as PolymorphicWithAsChild, i as PolymorphicWithRender, j as RenderCallbackProps, S as Slottable, k as SlottableProps, l as defineContractComponent, m as mergeRefs } from '../react-options-Cm99IE5J.js';
|
|
3
3
|
import * as react from 'react';
|
|
4
4
|
import 'type-fest';
|
|
5
5
|
import '../_shared/diagnostics.js';
|
package/dist/react/legacy.js
CHANGED
|
@@ -197,8 +197,8 @@ type AriaContext = {
|
|
|
197
197
|
readonly props: ReadonlyDeep<IntrinsicProps>;
|
|
198
198
|
};
|
|
199
199
|
|
|
200
|
-
type RemoveAttributeFixKind =
|
|
201
|
-
type InjectLiveFixKind =
|
|
200
|
+
type RemoveAttributeFixKind = 'removeAttribute';
|
|
201
|
+
type InjectLiveFixKind = 'injectLive';
|
|
202
202
|
type FixKind = 'removeRole' | 'setRole' | 'normalizeRelevantAll' | RemoveAttributeFixKind | InjectLiveFixKind;
|
|
203
203
|
|
|
204
204
|
type AriaFixResult = {
|
|
@@ -211,6 +211,9 @@ type AriaFixResult = {
|
|
|
211
211
|
};
|
|
212
212
|
type AriaFix = {
|
|
213
213
|
readonly kind: FixKind;
|
|
214
|
+
/** The attribute a `'removeAttribute'`/`'injectLive'` fix targets — always set for those
|
|
215
|
+
* kinds, absent for kinds with no single-attribute target (`'removeRole'`, etc.). */
|
|
216
|
+
readonly attribute?: string;
|
|
214
217
|
readonly priority?: number;
|
|
215
218
|
readonly source?: string;
|
|
216
219
|
readonly apply: (context: AriaContext) => AriaFixResult;
|
package/dist/solid/index.d.ts
CHANGED
|
@@ -196,8 +196,8 @@ type AriaContext = {
|
|
|
196
196
|
readonly props: ReadonlyDeep<IntrinsicProps>;
|
|
197
197
|
};
|
|
198
198
|
|
|
199
|
-
type RemoveAttributeFixKind =
|
|
200
|
-
type InjectLiveFixKind =
|
|
199
|
+
type RemoveAttributeFixKind = 'removeAttribute';
|
|
200
|
+
type InjectLiveFixKind = 'injectLive';
|
|
201
201
|
type FixKind = 'removeRole' | 'setRole' | 'normalizeRelevantAll' | RemoveAttributeFixKind | InjectLiveFixKind;
|
|
202
202
|
|
|
203
203
|
type AriaFixResult = {
|
|
@@ -210,6 +210,9 @@ type AriaFixResult = {
|
|
|
210
210
|
};
|
|
211
211
|
type AriaFix = {
|
|
212
212
|
readonly kind: FixKind;
|
|
213
|
+
/** The attribute a `'removeAttribute'`/`'injectLive'` fix targets — always set for those
|
|
214
|
+
* kinds, absent for kinds with no single-attribute target (`'removeRole'`, etc.). */
|
|
215
|
+
readonly attribute?: string;
|
|
213
216
|
readonly priority?: number;
|
|
214
217
|
readonly source?: string;
|
|
215
218
|
readonly apply: (context: AriaContext) => AriaFixResult;
|