praxis-kit 6.1.0 → 6.2.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/{chunk-VUULGK5M.js → chunk-4YVNOMUS.js} +607 -564
- package/dist/contract/index.d.ts +11 -3
- package/dist/eslint/index.js +1 -1
- package/dist/guards/index.d.ts +36 -0
- package/dist/guards/index.js +62 -0
- package/dist/lit/index.d.ts +9 -2
- package/dist/lit/index.js +389 -340
- package/dist/preact/index.d.ts +9 -2
- package/dist/preact/index.js +496 -453
- 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-AitAOrje.d.ts → react-options-DQTX4YS_.d.ts} +9 -2
- package/dist/solid/index.d.ts +9 -2
- package/dist/solid/index.js +485 -440
- package/dist/svelte/Polymorphic.svelte +2 -2
- package/dist/svelte/index.d.ts +10 -3
- package/dist/svelte/index.js +385 -340
- package/dist/tailwind/index.d.ts +1 -1
- package/dist/tailwind/index.js +3 -3
- package/dist/vue/index.d.ts +9 -2
- package/dist/vue/index.js +472 -421
- package/dist/web/index.d.ts +9 -2
- package/dist/web/index.js +389 -340
- package/package.json +10 -3
|
@@ -3,6 +3,19 @@ function defineContractComponent(options) {
|
|
|
3
3
|
return (factory) => factory(options);
|
|
4
4
|
}
|
|
5
5
|
|
|
6
|
+
// ../../lib/primitive/src/tag/resolve-tag.ts
|
|
7
|
+
function makeResolveTag(defaultTag) {
|
|
8
|
+
return function tag(as) {
|
|
9
|
+
return as ?? defaultTag;
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
// ../../lib/primitive/src/merge/constants.ts
|
|
14
|
+
var EVENT_HANDLER_RE = /^on[A-Z]/;
|
|
15
|
+
|
|
16
|
+
// ../../lib/primitive/src/rule/rule-brand.ts
|
|
17
|
+
var RULE_BRAND = /* @__PURE__ */ Symbol("praxis-kit/dynamic-rule");
|
|
18
|
+
|
|
6
19
|
// ../../lib/primitive/src/guards/foundational/is-defined.ts
|
|
7
20
|
function isUndefined(value) {
|
|
8
21
|
return value === void 0;
|
|
@@ -12,8 +25,11 @@ function isUndefined(value) {
|
|
|
12
25
|
function isNull(value) {
|
|
13
26
|
return value === null;
|
|
14
27
|
}
|
|
28
|
+
function isNonNull(value) {
|
|
29
|
+
return value != null;
|
|
30
|
+
}
|
|
15
31
|
|
|
16
|
-
// ../../lib/primitive/src/utils/
|
|
32
|
+
// ../../lib/primitive/src/utils/type-guards.ts
|
|
17
33
|
function isObject(value, excludeArrays = false) {
|
|
18
34
|
if (value === null || typeof value !== "object") return false;
|
|
19
35
|
return excludeArrays ? !Array.isArray(value) : true;
|
|
@@ -24,419 +40,29 @@ function isString(value) {
|
|
|
24
40
|
function isNumber(value) {
|
|
25
41
|
return typeof value === "number";
|
|
26
42
|
}
|
|
27
|
-
|
|
28
|
-
// ../../lib/primitive/src/merge/constants.ts
|
|
29
|
-
var EVENT_HANDLER_RE = /^on[A-Z]/;
|
|
30
|
-
|
|
31
|
-
// ../../lib/primitive/src/merge/predicates.ts
|
|
32
43
|
function isFunction(value) {
|
|
33
44
|
return typeof value === "function";
|
|
34
45
|
}
|
|
35
46
|
function isPlainObject(value) {
|
|
36
|
-
if (!isObject(value)) return false;
|
|
47
|
+
if (!isObject(value, true)) return false;
|
|
37
48
|
const proto = Object.getPrototypeOf(value);
|
|
38
49
|
return proto === Object.prototype || proto === null;
|
|
39
50
|
}
|
|
40
51
|
|
|
41
|
-
// ../../lib/primitive/src/
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
"aria-controls",
|
|
46
|
-
"aria-current",
|
|
47
|
-
"aria-describedby",
|
|
48
|
-
"aria-details",
|
|
49
|
-
"aria-disabled",
|
|
50
|
-
"aria-errormessage",
|
|
51
|
-
"aria-flowto",
|
|
52
|
-
"aria-hidden",
|
|
53
|
-
"aria-keyshortcuts",
|
|
54
|
-
"aria-label",
|
|
55
|
-
"aria-labelledby",
|
|
56
|
-
"aria-live",
|
|
57
|
-
"aria-owns",
|
|
58
|
-
"aria-relevant",
|
|
59
|
-
"aria-roledescription"
|
|
60
|
-
]);
|
|
52
|
+
// ../../lib/primitive/src/rule/is-dynamic-rule.ts
|
|
53
|
+
function isDynamicRule(rule) {
|
|
54
|
+
return isObject(rule, true) && rule[RULE_BRAND] === true;
|
|
55
|
+
}
|
|
61
56
|
|
|
62
|
-
// ../../lib/primitive/src/
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
aside: "complementary",
|
|
67
|
-
footer: "contentinfo",
|
|
68
|
-
header: "banner",
|
|
69
|
-
main: "main",
|
|
70
|
-
nav: "navigation",
|
|
71
|
-
// Interactive
|
|
72
|
-
a: "link",
|
|
73
|
-
button: "button",
|
|
74
|
-
select: "listbox",
|
|
75
|
-
textarea: "textbox",
|
|
76
|
-
// Headings
|
|
77
|
-
h1: "heading",
|
|
78
|
-
h2: "heading",
|
|
79
|
-
h3: "heading",
|
|
80
|
-
h4: "heading",
|
|
81
|
-
h5: "heading",
|
|
82
|
-
h6: "heading",
|
|
83
|
-
// Lists
|
|
84
|
-
ul: "list",
|
|
85
|
-
ol: "list",
|
|
86
|
-
li: "listitem",
|
|
87
|
-
// Tables
|
|
88
|
-
table: "table",
|
|
89
|
-
tr: "row",
|
|
90
|
-
td: "cell",
|
|
91
|
-
th: "columnheader",
|
|
92
|
-
// Structural / semantic
|
|
93
|
-
dialog: "dialog",
|
|
94
|
-
fieldset: "group",
|
|
95
|
-
figure: "figure",
|
|
96
|
-
meter: "meter",
|
|
97
|
-
output: "status",
|
|
98
|
-
progress: "progressbar"
|
|
99
|
-
});
|
|
100
|
-
var INPUT_TYPE_ROLE_MAP = Object.freeze({
|
|
101
|
-
checkbox: "checkbox",
|
|
102
|
-
radio: "radio",
|
|
103
|
-
range: "slider",
|
|
104
|
-
number: "spinbutton",
|
|
105
|
-
search: "searchbox",
|
|
106
|
-
text: "textbox",
|
|
107
|
-
email: "textbox",
|
|
108
|
-
tel: "textbox",
|
|
109
|
-
url: "textbox",
|
|
110
|
-
button: "button",
|
|
111
|
-
submit: "button",
|
|
112
|
-
reset: "button",
|
|
113
|
-
image: "button"
|
|
114
|
-
});
|
|
115
|
-
var STRONG_ROLES = Object.freeze([
|
|
116
|
-
"main",
|
|
117
|
-
"navigation",
|
|
118
|
-
"complementary",
|
|
119
|
-
"contentinfo",
|
|
120
|
-
"banner"
|
|
121
|
-
]);
|
|
122
|
-
var STANDALONE_ROLES = Object.freeze([
|
|
123
|
-
"article"
|
|
124
|
-
]);
|
|
125
|
-
var STRONG_ROLES_SET = new Set(STRONG_ROLES);
|
|
126
|
-
var STANDALONE_ROLES_SET = new Set(STANDALONE_ROLES);
|
|
57
|
+
// ../../lib/primitive/src/rule/resolve-rule.ts
|
|
58
|
+
function resolveRule(rule, context) {
|
|
59
|
+
return isDynamicRule(rule) ? rule.resolve(context) : rule;
|
|
60
|
+
}
|
|
127
61
|
|
|
128
|
-
// ../../lib/primitive/src/
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
"application",
|
|
133
|
-
"article",
|
|
134
|
-
"banner",
|
|
135
|
-
"blockquote",
|
|
136
|
-
"button",
|
|
137
|
-
"caption",
|
|
138
|
-
"cell",
|
|
139
|
-
"checkbox",
|
|
140
|
-
"code",
|
|
141
|
-
"columnheader",
|
|
142
|
-
"combobox",
|
|
143
|
-
"complementary",
|
|
144
|
-
"contentinfo",
|
|
145
|
-
"definition",
|
|
146
|
-
"deletion",
|
|
147
|
-
"dialog",
|
|
148
|
-
"document",
|
|
149
|
-
"emphasis",
|
|
150
|
-
"feed",
|
|
151
|
-
"figure",
|
|
152
|
-
"form",
|
|
153
|
-
"generic",
|
|
154
|
-
"grid",
|
|
155
|
-
"gridcell",
|
|
156
|
-
"group",
|
|
157
|
-
"heading",
|
|
158
|
-
"img",
|
|
159
|
-
"insertion",
|
|
160
|
-
"link",
|
|
161
|
-
"list",
|
|
162
|
-
"listbox",
|
|
163
|
-
"listitem",
|
|
164
|
-
"log",
|
|
165
|
-
"main",
|
|
166
|
-
"marquee",
|
|
167
|
-
"math",
|
|
168
|
-
"menu",
|
|
169
|
-
"menubar",
|
|
170
|
-
"menuitem",
|
|
171
|
-
"menuitemcheckbox",
|
|
172
|
-
"menuitemradio",
|
|
173
|
-
"meter",
|
|
174
|
-
"navigation",
|
|
175
|
-
"none",
|
|
176
|
-
"note",
|
|
177
|
-
"option",
|
|
178
|
-
"paragraph",
|
|
179
|
-
"presentation",
|
|
180
|
-
"progressbar",
|
|
181
|
-
"radio",
|
|
182
|
-
"radiogroup",
|
|
183
|
-
"region",
|
|
184
|
-
"row",
|
|
185
|
-
"rowgroup",
|
|
186
|
-
"rowheader",
|
|
187
|
-
"scrollbar",
|
|
188
|
-
"search",
|
|
189
|
-
"searchbox",
|
|
190
|
-
"separator",
|
|
191
|
-
"slider",
|
|
192
|
-
"spinbutton",
|
|
193
|
-
"status",
|
|
194
|
-
"strong",
|
|
195
|
-
"subscript",
|
|
196
|
-
"superscript",
|
|
197
|
-
"switch",
|
|
198
|
-
"tab",
|
|
199
|
-
"table",
|
|
200
|
-
"tablist",
|
|
201
|
-
"tabpanel",
|
|
202
|
-
"term",
|
|
203
|
-
"textbox",
|
|
204
|
-
"time",
|
|
205
|
-
"timer",
|
|
206
|
-
"toolbar",
|
|
207
|
-
"tooltip",
|
|
208
|
-
"tree",
|
|
209
|
-
"treegrid",
|
|
210
|
-
"treeitem"
|
|
211
|
-
]);
|
|
212
|
-
var KNOWN_ARIA_ROLES_SET = new Set(KNOWN_ARIA_ROLES);
|
|
213
|
-
|
|
214
|
-
// ../../lib/primitive/src/constants/aria/role-restricted-attributes.ts
|
|
215
|
-
var ROLE_RESTRICTED_ATTRIBUTES = /* @__PURE__ */ new Map([
|
|
216
|
-
[
|
|
217
|
-
"aria-activedescendant",
|
|
218
|
-
/* @__PURE__ */ new Set([
|
|
219
|
-
"application",
|
|
220
|
-
"combobox",
|
|
221
|
-
"grid",
|
|
222
|
-
"group",
|
|
223
|
-
"listbox",
|
|
224
|
-
"menu",
|
|
225
|
-
"menubar",
|
|
226
|
-
"radiogroup",
|
|
227
|
-
"spinbutton",
|
|
228
|
-
"tablist",
|
|
229
|
-
"toolbar",
|
|
230
|
-
"textbox",
|
|
231
|
-
"tree",
|
|
232
|
-
"treegrid"
|
|
233
|
-
])
|
|
234
|
-
],
|
|
235
|
-
["aria-autocomplete", /* @__PURE__ */ new Set(["combobox", "searchbox", "textbox"])],
|
|
236
|
-
[
|
|
237
|
-
"aria-checked",
|
|
238
|
-
/* @__PURE__ */ new Set(["checkbox", "menuitemcheckbox", "option", "radio", "switch", "treeitem"])
|
|
239
|
-
],
|
|
240
|
-
["aria-colcount", /* @__PURE__ */ new Set(["grid", "table", "treegrid"])],
|
|
241
|
-
["aria-colindex", /* @__PURE__ */ new Set(["cell", "columnheader", "gridcell", "row", "rowheader"])],
|
|
242
|
-
["aria-colspan", /* @__PURE__ */ new Set(["cell", "columnheader", "gridcell", "rowheader"])],
|
|
243
|
-
[
|
|
244
|
-
"aria-expanded",
|
|
245
|
-
/* @__PURE__ */ new Set([
|
|
246
|
-
"button",
|
|
247
|
-
"combobox",
|
|
248
|
-
"gridcell",
|
|
249
|
-
"listbox",
|
|
250
|
-
"menuitem",
|
|
251
|
-
"menuitemcheckbox",
|
|
252
|
-
"menuitemradio",
|
|
253
|
-
"row",
|
|
254
|
-
"rowheader",
|
|
255
|
-
"tab",
|
|
256
|
-
"treeitem"
|
|
257
|
-
])
|
|
258
|
-
],
|
|
259
|
-
[
|
|
260
|
-
"aria-haspopup",
|
|
261
|
-
/* @__PURE__ */ new Set([
|
|
262
|
-
"button",
|
|
263
|
-
"combobox",
|
|
264
|
-
"gridcell",
|
|
265
|
-
"listbox",
|
|
266
|
-
"menuitem",
|
|
267
|
-
"menuitemcheckbox",
|
|
268
|
-
"menuitemradio",
|
|
269
|
-
"tab",
|
|
270
|
-
"treeitem"
|
|
271
|
-
])
|
|
272
|
-
],
|
|
273
|
-
["aria-level", /* @__PURE__ */ new Set(["heading", "listitem", "row", "treeitem"])],
|
|
274
|
-
["aria-modal", /* @__PURE__ */ new Set(["alertdialog", "dialog"])],
|
|
275
|
-
["aria-multiline", /* @__PURE__ */ new Set(["textbox"])],
|
|
276
|
-
["aria-multiselectable", /* @__PURE__ */ new Set(["grid", "listbox", "tablist", "tree", "treegrid"])],
|
|
277
|
-
[
|
|
278
|
-
"aria-orientation",
|
|
279
|
-
/* @__PURE__ */ new Set(["scrollbar", "select", "separator", "slider", "tablist", "toolbar", "tree"])
|
|
280
|
-
],
|
|
281
|
-
["aria-placeholder", /* @__PURE__ */ new Set(["searchbox", "textbox"])],
|
|
282
|
-
[
|
|
283
|
-
"aria-posinset",
|
|
284
|
-
/* @__PURE__ */ new Set([
|
|
285
|
-
"article",
|
|
286
|
-
"listitem",
|
|
287
|
-
"menuitem",
|
|
288
|
-
"menuitemcheckbox",
|
|
289
|
-
"menuitemradio",
|
|
290
|
-
"option",
|
|
291
|
-
"radio",
|
|
292
|
-
"row",
|
|
293
|
-
"tab"
|
|
294
|
-
])
|
|
295
|
-
],
|
|
296
|
-
["aria-pressed", /* @__PURE__ */ new Set(["button"])],
|
|
297
|
-
[
|
|
298
|
-
"aria-readonly",
|
|
299
|
-
/* @__PURE__ */ new Set([
|
|
300
|
-
"combobox",
|
|
301
|
-
"grid",
|
|
302
|
-
"gridcell",
|
|
303
|
-
"listbox",
|
|
304
|
-
"radiogroup",
|
|
305
|
-
"slider",
|
|
306
|
-
"spinbutton",
|
|
307
|
-
"textbox",
|
|
308
|
-
"tree",
|
|
309
|
-
"treegrid"
|
|
310
|
-
])
|
|
311
|
-
],
|
|
312
|
-
[
|
|
313
|
-
"aria-required",
|
|
314
|
-
/* @__PURE__ */ new Set([
|
|
315
|
-
"combobox",
|
|
316
|
-
"gridcell",
|
|
317
|
-
"listbox",
|
|
318
|
-
"radiogroup",
|
|
319
|
-
"spinbutton",
|
|
320
|
-
"textbox",
|
|
321
|
-
"tree",
|
|
322
|
-
"treegrid"
|
|
323
|
-
])
|
|
324
|
-
],
|
|
325
|
-
["aria-rowcount", /* @__PURE__ */ new Set(["grid", "table", "treegrid"])],
|
|
326
|
-
["aria-rowindex", /* @__PURE__ */ new Set(["cell", "columnheader", "gridcell", "row", "rowheader"])],
|
|
327
|
-
["aria-rowspan", /* @__PURE__ */ new Set(["cell", "columnheader", "gridcell", "rowheader"])],
|
|
328
|
-
[
|
|
329
|
-
"aria-selected",
|
|
330
|
-
/* @__PURE__ */ new Set(["columnheader", "gridcell", "option", "row", "rowheader", "tab", "treeitem"])
|
|
331
|
-
],
|
|
332
|
-
[
|
|
333
|
-
"aria-setsize",
|
|
334
|
-
/* @__PURE__ */ new Set([
|
|
335
|
-
"article",
|
|
336
|
-
"listitem",
|
|
337
|
-
"menuitem",
|
|
338
|
-
"menuitemcheckbox",
|
|
339
|
-
"menuitemradio",
|
|
340
|
-
"option",
|
|
341
|
-
"radio",
|
|
342
|
-
"row",
|
|
343
|
-
"tab"
|
|
344
|
-
])
|
|
345
|
-
],
|
|
346
|
-
["aria-sort", /* @__PURE__ */ new Set(["columnheader", "rowheader"])],
|
|
347
|
-
[
|
|
348
|
-
"aria-valuemax",
|
|
349
|
-
/* @__PURE__ */ new Set(["meter", "progressbar", "scrollbar", "separator", "slider", "spinbutton"])
|
|
350
|
-
],
|
|
351
|
-
[
|
|
352
|
-
"aria-valuemin",
|
|
353
|
-
/* @__PURE__ */ new Set(["meter", "progressbar", "scrollbar", "separator", "slider", "spinbutton"])
|
|
354
|
-
],
|
|
355
|
-
[
|
|
356
|
-
"aria-valuenow",
|
|
357
|
-
/* @__PURE__ */ new Set(["meter", "progressbar", "scrollbar", "separator", "slider", "spinbutton"])
|
|
358
|
-
],
|
|
359
|
-
[
|
|
360
|
-
"aria-valuetext",
|
|
361
|
-
/* @__PURE__ */ new Set(["meter", "progressbar", "scrollbar", "separator", "slider", "spinbutton"])
|
|
362
|
-
]
|
|
363
|
-
]);
|
|
364
|
-
|
|
365
|
-
// ../../lib/primitive/src/guards/aria/is-aria-attribute.ts
|
|
366
|
-
function isGlobalAriaAttribute(attr) {
|
|
367
|
-
return GLOBAL_ARIA_ATTRIBUTES.has(attr);
|
|
368
|
-
}
|
|
369
|
-
function isAriaAttributeValidForRole(attr, role) {
|
|
370
|
-
const allowedRoles = ROLE_RESTRICTED_ATTRIBUTES.get(attr);
|
|
371
|
-
if (isUndefined(allowedRoles)) return true;
|
|
372
|
-
if (isUndefined(role)) return false;
|
|
373
|
-
return allowedRoles.has(role);
|
|
374
|
-
}
|
|
375
|
-
|
|
376
|
-
// ../../lib/primitive/src/constants/primitive/slot-name.ts
|
|
377
|
-
var SLOT_NAME = "Slot";
|
|
378
|
-
|
|
379
|
-
// ../../lib/primitive/src/guards/aria/is-aria-role.ts
|
|
380
|
-
function isStrongImplicitRole(tag) {
|
|
381
|
-
if (!(tag in IMPLICIT_ROLE_RECORD)) return false;
|
|
382
|
-
return STRONG_ROLES_SET.has(IMPLICIT_ROLE_RECORD[tag]);
|
|
383
|
-
}
|
|
384
|
-
function isStandaloneTag(tag) {
|
|
385
|
-
if (!(tag in IMPLICIT_ROLE_RECORD)) return false;
|
|
386
|
-
return STANDALONE_ROLES_SET.has(IMPLICIT_ROLE_RECORD[tag]);
|
|
387
|
-
}
|
|
388
|
-
function getInputImplicitRole(type) {
|
|
389
|
-
if (!isString(type) || !(type in INPUT_TYPE_ROLE_MAP)) return void 0;
|
|
390
|
-
return INPUT_TYPE_ROLE_MAP[type];
|
|
391
|
-
}
|
|
392
|
-
function getConditionalImplicitRole(tag, ariaLabel, ariaLabelledBy) {
|
|
393
|
-
const isNamed = isString(ariaLabel) || isString(ariaLabelledBy);
|
|
394
|
-
if (!isNamed) return void 0;
|
|
395
|
-
if (tag === "section") return "region";
|
|
396
|
-
if (tag === "form") return "form";
|
|
397
|
-
return void 0;
|
|
398
|
-
}
|
|
399
|
-
|
|
400
|
-
// ../../lib/primitive/src/guards/aria/is-known-aria-role.ts
|
|
401
|
-
function isKnownAriaRole(value) {
|
|
402
|
-
return isString(value) && KNOWN_ARIA_ROLES_SET.has(value);
|
|
403
|
-
}
|
|
404
|
-
|
|
405
|
-
// ../../lib/contract/src/aria/aria-role-policy.ts
|
|
406
|
-
function getImplicitRole(tag, props) {
|
|
407
|
-
if (tag in IMPLICIT_ROLE_RECORD) return IMPLICIT_ROLE_RECORD[tag];
|
|
408
|
-
if (tag === "input") return getInputImplicitRole(props?.type);
|
|
409
|
-
if (tag === "img") return props?.alt === "" ? "none" : "img";
|
|
410
|
-
if (tag === "section" || tag === "form") {
|
|
411
|
-
return getConditionalImplicitRole(tag, props?.["aria-label"], props?.["aria-labelledby"]);
|
|
412
|
-
}
|
|
413
|
-
return void 0;
|
|
414
|
-
}
|
|
415
|
-
|
|
416
|
-
// ../../lib/primitive/src/tag/resolve-tag.ts
|
|
417
|
-
function makeResolveTag(defaultTag) {
|
|
418
|
-
return function tag(as) {
|
|
419
|
-
return as ?? defaultTag;
|
|
420
|
-
};
|
|
421
|
-
}
|
|
422
|
-
|
|
423
|
-
// ../../lib/primitive/src/rule/rule-brand.ts
|
|
424
|
-
var RULE_BRAND = /* @__PURE__ */ Symbol("praxis-kit/dynamic-rule");
|
|
425
|
-
|
|
426
|
-
// ../../lib/primitive/src/rule/is-dynamic-rule.ts
|
|
427
|
-
function isDynamicRule(rule) {
|
|
428
|
-
return isObject(rule, true) && rule[RULE_BRAND] === true;
|
|
429
|
-
}
|
|
430
|
-
|
|
431
|
-
// ../../lib/primitive/src/rule/resolve-rule.ts
|
|
432
|
-
function resolveRule(rule, context) {
|
|
433
|
-
return isDynamicRule(rule) ? rule.resolve(context) : rule;
|
|
434
|
-
}
|
|
435
|
-
|
|
436
|
-
// ../../lib/primitive/src/utils/assert-never.ts
|
|
437
|
-
function assertNever(value) {
|
|
438
|
-
throw new Error(`Unexpected value: ${String(value)}`);
|
|
439
|
-
}
|
|
62
|
+
// ../../lib/primitive/src/utils/assert-never.ts
|
|
63
|
+
function assertNever(value) {
|
|
64
|
+
throw new Error(`Unexpected value: ${String(value)}`);
|
|
65
|
+
}
|
|
440
66
|
|
|
441
67
|
// ../../lib/primitive/src/utils/cn.ts
|
|
442
68
|
import { clsx } from "clsx";
|
|
@@ -575,119 +201,483 @@ function forEachEntry(object, callback) {
|
|
|
575
201
|
callback(key, value);
|
|
576
202
|
}
|
|
577
203
|
}
|
|
578
|
-
function forEachKey(object, callback) {
|
|
579
|
-
for (const key of keys(object)) {
|
|
580
|
-
callback(key);
|
|
581
|
-
}
|
|
204
|
+
function forEachKey(object, callback) {
|
|
205
|
+
for (const key of keys(object)) {
|
|
206
|
+
callback(key);
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
function forEachValue(object, callback) {
|
|
210
|
+
for (const value of values(object)) {
|
|
211
|
+
callback(value);
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
function forEachSet(s, callback) {
|
|
215
|
+
for (const value of s) {
|
|
216
|
+
callback(value);
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
var iterate = Object.freeze({
|
|
220
|
+
entries,
|
|
221
|
+
filter,
|
|
222
|
+
find,
|
|
223
|
+
findLast,
|
|
224
|
+
forEach,
|
|
225
|
+
forEachEntry,
|
|
226
|
+
forEachKey,
|
|
227
|
+
forEachSet,
|
|
228
|
+
forEachValue,
|
|
229
|
+
items,
|
|
230
|
+
keys,
|
|
231
|
+
map,
|
|
232
|
+
mapEntries,
|
|
233
|
+
mapValues,
|
|
234
|
+
nodeList,
|
|
235
|
+
reduce,
|
|
236
|
+
collect,
|
|
237
|
+
set,
|
|
238
|
+
some,
|
|
239
|
+
every,
|
|
240
|
+
values
|
|
241
|
+
});
|
|
242
|
+
|
|
243
|
+
// ../../lib/primitive/src/utils/lazy.ts
|
|
244
|
+
function lazy(factory) {
|
|
245
|
+
let initialized = false;
|
|
246
|
+
let value;
|
|
247
|
+
return () => {
|
|
248
|
+
if (!initialized) {
|
|
249
|
+
value = factory();
|
|
250
|
+
initialized = true;
|
|
251
|
+
}
|
|
252
|
+
return value;
|
|
253
|
+
};
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
// ../../lib/primitive/src/utils/lru-cache.ts
|
|
257
|
+
var LRUCache = class {
|
|
258
|
+
#maxSize;
|
|
259
|
+
#store = /* @__PURE__ */ new Map();
|
|
260
|
+
constructor(maxSize) {
|
|
261
|
+
if (!Number.isInteger(maxSize) || maxSize < 1) {
|
|
262
|
+
throw new RangeError("LRUCache maxSize must be a positive integer.");
|
|
263
|
+
}
|
|
264
|
+
this.#maxSize = maxSize;
|
|
265
|
+
}
|
|
266
|
+
get(key) {
|
|
267
|
+
if (!this.#store.has(key)) return void 0;
|
|
268
|
+
const value = this.#store.get(key);
|
|
269
|
+
this.#store.delete(key);
|
|
270
|
+
this.#store.set(key, value);
|
|
271
|
+
return value;
|
|
272
|
+
}
|
|
273
|
+
set(key, value) {
|
|
274
|
+
this.#store.delete(key);
|
|
275
|
+
this.#store.set(key, value);
|
|
276
|
+
if (this.#store.size > this.#maxSize) {
|
|
277
|
+
const lru = this.#store.keys().next().value;
|
|
278
|
+
if (lru !== void 0) this.#store.delete(lru);
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
has(key) {
|
|
282
|
+
return this.#store.has(key);
|
|
283
|
+
}
|
|
284
|
+
delete(key) {
|
|
285
|
+
return this.#store.delete(key);
|
|
286
|
+
}
|
|
287
|
+
get size() {
|
|
288
|
+
return this.#store.size;
|
|
289
|
+
}
|
|
290
|
+
clear() {
|
|
291
|
+
this.#store.clear();
|
|
292
|
+
}
|
|
293
|
+
};
|
|
294
|
+
|
|
295
|
+
// ../../lib/primitive/src/utils/merge-refs.ts
|
|
296
|
+
function mergeRefsCore(...refs) {
|
|
297
|
+
const resolvedRefs = refs.filter((r) => r != null);
|
|
298
|
+
if (resolvedRefs.length === 0) return null;
|
|
299
|
+
if (resolvedRefs.length === 1) return resolvedRefs[0] ?? null;
|
|
300
|
+
return (value) => {
|
|
301
|
+
iterate.forEach(resolvedRefs, (ref) => {
|
|
302
|
+
if (isFunction(ref)) {
|
|
303
|
+
ref(value);
|
|
304
|
+
} else {
|
|
305
|
+
ref.current = value;
|
|
306
|
+
}
|
|
307
|
+
});
|
|
308
|
+
};
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
// ../../lib/primitive/src/utils/merge-props.ts
|
|
312
|
+
function mergeProps(defaultProps, props) {
|
|
313
|
+
return {
|
|
314
|
+
...defaultProps ?? {},
|
|
315
|
+
...props
|
|
316
|
+
};
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
// ../../lib/primitive/src/constants/aria/global-aria-attributes.ts
|
|
320
|
+
var GLOBAL_ARIA_ATTRIBUTES = /* @__PURE__ */ new Set([
|
|
321
|
+
"aria-atomic",
|
|
322
|
+
"aria-busy",
|
|
323
|
+
"aria-controls",
|
|
324
|
+
"aria-current",
|
|
325
|
+
"aria-describedby",
|
|
326
|
+
"aria-details",
|
|
327
|
+
"aria-disabled",
|
|
328
|
+
"aria-errormessage",
|
|
329
|
+
"aria-flowto",
|
|
330
|
+
"aria-hidden",
|
|
331
|
+
"aria-keyshortcuts",
|
|
332
|
+
"aria-label",
|
|
333
|
+
"aria-labelledby",
|
|
334
|
+
"aria-live",
|
|
335
|
+
"aria-owns",
|
|
336
|
+
"aria-relevant",
|
|
337
|
+
"aria-roledescription"
|
|
338
|
+
]);
|
|
339
|
+
|
|
340
|
+
// ../../lib/primitive/src/constants/aria/implicit-role-record.ts
|
|
341
|
+
var IMPLICIT_ROLE_RECORD = Object.freeze({
|
|
342
|
+
// Landmarks
|
|
343
|
+
article: "article",
|
|
344
|
+
aside: "complementary",
|
|
345
|
+
footer: "contentinfo",
|
|
346
|
+
header: "banner",
|
|
347
|
+
main: "main",
|
|
348
|
+
nav: "navigation",
|
|
349
|
+
// Interactive
|
|
350
|
+
a: "link",
|
|
351
|
+
button: "button",
|
|
352
|
+
select: "listbox",
|
|
353
|
+
textarea: "textbox",
|
|
354
|
+
// Headings
|
|
355
|
+
h1: "heading",
|
|
356
|
+
h2: "heading",
|
|
357
|
+
h3: "heading",
|
|
358
|
+
h4: "heading",
|
|
359
|
+
h5: "heading",
|
|
360
|
+
h6: "heading",
|
|
361
|
+
// Lists
|
|
362
|
+
ul: "list",
|
|
363
|
+
ol: "list",
|
|
364
|
+
li: "listitem",
|
|
365
|
+
// Tables
|
|
366
|
+
table: "table",
|
|
367
|
+
tr: "row",
|
|
368
|
+
td: "cell",
|
|
369
|
+
th: "columnheader",
|
|
370
|
+
// Structural / semantic
|
|
371
|
+
dialog: "dialog",
|
|
372
|
+
fieldset: "group",
|
|
373
|
+
figure: "figure",
|
|
374
|
+
meter: "meter",
|
|
375
|
+
output: "status",
|
|
376
|
+
progress: "progressbar"
|
|
377
|
+
});
|
|
378
|
+
var INPUT_TYPE_ROLE_MAP = Object.freeze({
|
|
379
|
+
checkbox: "checkbox",
|
|
380
|
+
radio: "radio",
|
|
381
|
+
range: "slider",
|
|
382
|
+
number: "spinbutton",
|
|
383
|
+
search: "searchbox",
|
|
384
|
+
text: "textbox",
|
|
385
|
+
email: "textbox",
|
|
386
|
+
tel: "textbox",
|
|
387
|
+
url: "textbox",
|
|
388
|
+
button: "button",
|
|
389
|
+
submit: "button",
|
|
390
|
+
reset: "button",
|
|
391
|
+
image: "button"
|
|
392
|
+
});
|
|
393
|
+
var STRONG_ROLES = Object.freeze([
|
|
394
|
+
"main",
|
|
395
|
+
"navigation",
|
|
396
|
+
"complementary",
|
|
397
|
+
"contentinfo",
|
|
398
|
+
"banner"
|
|
399
|
+
]);
|
|
400
|
+
var STANDALONE_ROLES = Object.freeze([
|
|
401
|
+
"article"
|
|
402
|
+
]);
|
|
403
|
+
var STRONG_ROLES_SET = new Set(STRONG_ROLES);
|
|
404
|
+
var STANDALONE_ROLES_SET = new Set(STANDALONE_ROLES);
|
|
405
|
+
|
|
406
|
+
// ../../lib/primitive/src/constants/aria/known-aria-roles.ts
|
|
407
|
+
var KNOWN_ARIA_ROLES = Object.freeze([
|
|
408
|
+
"alert",
|
|
409
|
+
"alertdialog",
|
|
410
|
+
"application",
|
|
411
|
+
"article",
|
|
412
|
+
"banner",
|
|
413
|
+
"blockquote",
|
|
414
|
+
"button",
|
|
415
|
+
"caption",
|
|
416
|
+
"cell",
|
|
417
|
+
"checkbox",
|
|
418
|
+
"code",
|
|
419
|
+
"columnheader",
|
|
420
|
+
"combobox",
|
|
421
|
+
"complementary",
|
|
422
|
+
"contentinfo",
|
|
423
|
+
"definition",
|
|
424
|
+
"deletion",
|
|
425
|
+
"dialog",
|
|
426
|
+
"document",
|
|
427
|
+
"emphasis",
|
|
428
|
+
"feed",
|
|
429
|
+
"figure",
|
|
430
|
+
"form",
|
|
431
|
+
"generic",
|
|
432
|
+
"grid",
|
|
433
|
+
"gridcell",
|
|
434
|
+
"group",
|
|
435
|
+
"heading",
|
|
436
|
+
"img",
|
|
437
|
+
"insertion",
|
|
438
|
+
"link",
|
|
439
|
+
"list",
|
|
440
|
+
"listbox",
|
|
441
|
+
"listitem",
|
|
442
|
+
"log",
|
|
443
|
+
"main",
|
|
444
|
+
"marquee",
|
|
445
|
+
"math",
|
|
446
|
+
"menu",
|
|
447
|
+
"menubar",
|
|
448
|
+
"menuitem",
|
|
449
|
+
"menuitemcheckbox",
|
|
450
|
+
"menuitemradio",
|
|
451
|
+
"meter",
|
|
452
|
+
"navigation",
|
|
453
|
+
"none",
|
|
454
|
+
"note",
|
|
455
|
+
"option",
|
|
456
|
+
"paragraph",
|
|
457
|
+
"presentation",
|
|
458
|
+
"progressbar",
|
|
459
|
+
"radio",
|
|
460
|
+
"radiogroup",
|
|
461
|
+
"region",
|
|
462
|
+
"row",
|
|
463
|
+
"rowgroup",
|
|
464
|
+
"rowheader",
|
|
465
|
+
"scrollbar",
|
|
466
|
+
"search",
|
|
467
|
+
"searchbox",
|
|
468
|
+
"separator",
|
|
469
|
+
"slider",
|
|
470
|
+
"spinbutton",
|
|
471
|
+
"status",
|
|
472
|
+
"strong",
|
|
473
|
+
"subscript",
|
|
474
|
+
"superscript",
|
|
475
|
+
"switch",
|
|
476
|
+
"tab",
|
|
477
|
+
"table",
|
|
478
|
+
"tablist",
|
|
479
|
+
"tabpanel",
|
|
480
|
+
"term",
|
|
481
|
+
"textbox",
|
|
482
|
+
"time",
|
|
483
|
+
"timer",
|
|
484
|
+
"toolbar",
|
|
485
|
+
"tooltip",
|
|
486
|
+
"tree",
|
|
487
|
+
"treegrid",
|
|
488
|
+
"treeitem"
|
|
489
|
+
]);
|
|
490
|
+
var KNOWN_ARIA_ROLES_SET = new Set(KNOWN_ARIA_ROLES);
|
|
491
|
+
|
|
492
|
+
// ../../lib/primitive/src/constants/aria/role-restricted-attributes.ts
|
|
493
|
+
var ROLE_RESTRICTED_ATTRIBUTES = /* @__PURE__ */ new Map([
|
|
494
|
+
[
|
|
495
|
+
"aria-activedescendant",
|
|
496
|
+
/* @__PURE__ */ new Set([
|
|
497
|
+
"application",
|
|
498
|
+
"combobox",
|
|
499
|
+
"grid",
|
|
500
|
+
"group",
|
|
501
|
+
"listbox",
|
|
502
|
+
"menu",
|
|
503
|
+
"menubar",
|
|
504
|
+
"radiogroup",
|
|
505
|
+
"spinbutton",
|
|
506
|
+
"tablist",
|
|
507
|
+
"toolbar",
|
|
508
|
+
"textbox",
|
|
509
|
+
"tree",
|
|
510
|
+
"treegrid"
|
|
511
|
+
])
|
|
512
|
+
],
|
|
513
|
+
["aria-autocomplete", /* @__PURE__ */ new Set(["combobox", "searchbox", "textbox"])],
|
|
514
|
+
[
|
|
515
|
+
"aria-checked",
|
|
516
|
+
/* @__PURE__ */ new Set(["checkbox", "menuitemcheckbox", "option", "radio", "switch", "treeitem"])
|
|
517
|
+
],
|
|
518
|
+
["aria-colcount", /* @__PURE__ */ new Set(["grid", "table", "treegrid"])],
|
|
519
|
+
["aria-colindex", /* @__PURE__ */ new Set(["cell", "columnheader", "gridcell", "row", "rowheader"])],
|
|
520
|
+
["aria-colspan", /* @__PURE__ */ new Set(["cell", "columnheader", "gridcell", "rowheader"])],
|
|
521
|
+
[
|
|
522
|
+
"aria-expanded",
|
|
523
|
+
/* @__PURE__ */ new Set([
|
|
524
|
+
"button",
|
|
525
|
+
"combobox",
|
|
526
|
+
"gridcell",
|
|
527
|
+
"listbox",
|
|
528
|
+
"menuitem",
|
|
529
|
+
"menuitemcheckbox",
|
|
530
|
+
"menuitemradio",
|
|
531
|
+
"row",
|
|
532
|
+
"rowheader",
|
|
533
|
+
"tab",
|
|
534
|
+
"treeitem"
|
|
535
|
+
])
|
|
536
|
+
],
|
|
537
|
+
[
|
|
538
|
+
"aria-haspopup",
|
|
539
|
+
/* @__PURE__ */ new Set([
|
|
540
|
+
"button",
|
|
541
|
+
"combobox",
|
|
542
|
+
"gridcell",
|
|
543
|
+
"listbox",
|
|
544
|
+
"menuitem",
|
|
545
|
+
"menuitemcheckbox",
|
|
546
|
+
"menuitemradio",
|
|
547
|
+
"tab",
|
|
548
|
+
"treeitem"
|
|
549
|
+
])
|
|
550
|
+
],
|
|
551
|
+
["aria-level", /* @__PURE__ */ new Set(["heading", "listitem", "row", "treeitem"])],
|
|
552
|
+
["aria-modal", /* @__PURE__ */ new Set(["alertdialog", "dialog"])],
|
|
553
|
+
["aria-multiline", /* @__PURE__ */ new Set(["textbox"])],
|
|
554
|
+
["aria-multiselectable", /* @__PURE__ */ new Set(["grid", "listbox", "tablist", "tree", "treegrid"])],
|
|
555
|
+
[
|
|
556
|
+
"aria-orientation",
|
|
557
|
+
/* @__PURE__ */ new Set(["scrollbar", "select", "separator", "slider", "tablist", "toolbar", "tree"])
|
|
558
|
+
],
|
|
559
|
+
["aria-placeholder", /* @__PURE__ */ new Set(["searchbox", "textbox"])],
|
|
560
|
+
[
|
|
561
|
+
"aria-posinset",
|
|
562
|
+
/* @__PURE__ */ new Set([
|
|
563
|
+
"article",
|
|
564
|
+
"listitem",
|
|
565
|
+
"menuitem",
|
|
566
|
+
"menuitemcheckbox",
|
|
567
|
+
"menuitemradio",
|
|
568
|
+
"option",
|
|
569
|
+
"radio",
|
|
570
|
+
"row",
|
|
571
|
+
"tab"
|
|
572
|
+
])
|
|
573
|
+
],
|
|
574
|
+
["aria-pressed", /* @__PURE__ */ new Set(["button"])],
|
|
575
|
+
[
|
|
576
|
+
"aria-readonly",
|
|
577
|
+
/* @__PURE__ */ new Set([
|
|
578
|
+
"combobox",
|
|
579
|
+
"grid",
|
|
580
|
+
"gridcell",
|
|
581
|
+
"listbox",
|
|
582
|
+
"radiogroup",
|
|
583
|
+
"slider",
|
|
584
|
+
"spinbutton",
|
|
585
|
+
"textbox",
|
|
586
|
+
"tree",
|
|
587
|
+
"treegrid"
|
|
588
|
+
])
|
|
589
|
+
],
|
|
590
|
+
[
|
|
591
|
+
"aria-required",
|
|
592
|
+
/* @__PURE__ */ new Set([
|
|
593
|
+
"combobox",
|
|
594
|
+
"gridcell",
|
|
595
|
+
"listbox",
|
|
596
|
+
"radiogroup",
|
|
597
|
+
"spinbutton",
|
|
598
|
+
"textbox",
|
|
599
|
+
"tree",
|
|
600
|
+
"treegrid"
|
|
601
|
+
])
|
|
602
|
+
],
|
|
603
|
+
["aria-rowcount", /* @__PURE__ */ new Set(["grid", "table", "treegrid"])],
|
|
604
|
+
["aria-rowindex", /* @__PURE__ */ new Set(["cell", "columnheader", "gridcell", "row", "rowheader"])],
|
|
605
|
+
["aria-rowspan", /* @__PURE__ */ new Set(["cell", "columnheader", "gridcell", "rowheader"])],
|
|
606
|
+
[
|
|
607
|
+
"aria-selected",
|
|
608
|
+
/* @__PURE__ */ new Set(["columnheader", "gridcell", "option", "row", "rowheader", "tab", "treeitem"])
|
|
609
|
+
],
|
|
610
|
+
[
|
|
611
|
+
"aria-setsize",
|
|
612
|
+
/* @__PURE__ */ new Set([
|
|
613
|
+
"article",
|
|
614
|
+
"listitem",
|
|
615
|
+
"menuitem",
|
|
616
|
+
"menuitemcheckbox",
|
|
617
|
+
"menuitemradio",
|
|
618
|
+
"option",
|
|
619
|
+
"radio",
|
|
620
|
+
"row",
|
|
621
|
+
"tab"
|
|
622
|
+
])
|
|
623
|
+
],
|
|
624
|
+
["aria-sort", /* @__PURE__ */ new Set(["columnheader", "rowheader"])],
|
|
625
|
+
[
|
|
626
|
+
"aria-valuemax",
|
|
627
|
+
/* @__PURE__ */ new Set(["meter", "progressbar", "scrollbar", "separator", "slider", "spinbutton"])
|
|
628
|
+
],
|
|
629
|
+
[
|
|
630
|
+
"aria-valuemin",
|
|
631
|
+
/* @__PURE__ */ new Set(["meter", "progressbar", "scrollbar", "separator", "slider", "spinbutton"])
|
|
632
|
+
],
|
|
633
|
+
[
|
|
634
|
+
"aria-valuenow",
|
|
635
|
+
/* @__PURE__ */ new Set(["meter", "progressbar", "scrollbar", "separator", "slider", "spinbutton"])
|
|
636
|
+
],
|
|
637
|
+
[
|
|
638
|
+
"aria-valuetext",
|
|
639
|
+
/* @__PURE__ */ new Set(["meter", "progressbar", "scrollbar", "separator", "slider", "spinbutton"])
|
|
640
|
+
]
|
|
641
|
+
]);
|
|
642
|
+
|
|
643
|
+
// ../../lib/primitive/src/constants/primitive/slot-name.ts
|
|
644
|
+
var SLOT_NAME = "Slot";
|
|
645
|
+
|
|
646
|
+
// ../../lib/primitive/src/guards/aria/is-aria-attribute.ts
|
|
647
|
+
function isGlobalAriaAttribute(attr) {
|
|
648
|
+
return GLOBAL_ARIA_ATTRIBUTES.has(attr);
|
|
649
|
+
}
|
|
650
|
+
function isAriaAttributeValidForRole(attr, role) {
|
|
651
|
+
const allowedRoles = ROLE_RESTRICTED_ATTRIBUTES.get(attr);
|
|
652
|
+
if (isUndefined(allowedRoles)) return true;
|
|
653
|
+
if (isUndefined(role)) return false;
|
|
654
|
+
return allowedRoles.has(role);
|
|
582
655
|
}
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
656
|
+
|
|
657
|
+
// ../../lib/primitive/src/guards/aria/is-aria-role.ts
|
|
658
|
+
function isStrongImplicitRole(tag) {
|
|
659
|
+
if (!(tag in IMPLICIT_ROLE_RECORD)) return false;
|
|
660
|
+
return STRONG_ROLES_SET.has(IMPLICIT_ROLE_RECORD[tag]);
|
|
587
661
|
}
|
|
588
|
-
function
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
}
|
|
662
|
+
function isStandaloneTag(tag) {
|
|
663
|
+
if (!(tag in IMPLICIT_ROLE_RECORD)) return false;
|
|
664
|
+
return STANDALONE_ROLES_SET.has(IMPLICIT_ROLE_RECORD[tag]);
|
|
592
665
|
}
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
find,
|
|
597
|
-
findLast,
|
|
598
|
-
forEach,
|
|
599
|
-
forEachEntry,
|
|
600
|
-
forEachKey,
|
|
601
|
-
forEachSet,
|
|
602
|
-
forEachValue,
|
|
603
|
-
items,
|
|
604
|
-
keys,
|
|
605
|
-
map,
|
|
606
|
-
mapEntries,
|
|
607
|
-
mapValues,
|
|
608
|
-
nodeList,
|
|
609
|
-
reduce,
|
|
610
|
-
collect,
|
|
611
|
-
set,
|
|
612
|
-
some,
|
|
613
|
-
every,
|
|
614
|
-
values
|
|
615
|
-
});
|
|
616
|
-
|
|
617
|
-
// ../../lib/primitive/src/utils/lazy.ts
|
|
618
|
-
function lazy(factory) {
|
|
619
|
-
let initialized = false;
|
|
620
|
-
let value;
|
|
621
|
-
return () => {
|
|
622
|
-
if (!initialized) {
|
|
623
|
-
value = factory();
|
|
624
|
-
initialized = true;
|
|
625
|
-
}
|
|
626
|
-
return value;
|
|
627
|
-
};
|
|
666
|
+
function getInputImplicitRole(type) {
|
|
667
|
+
if (!isString(type) || !(type in INPUT_TYPE_ROLE_MAP)) return void 0;
|
|
668
|
+
return INPUT_TYPE_ROLE_MAP[type];
|
|
628
669
|
}
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
if (!Number.isInteger(maxSize) || maxSize < 1) {
|
|
636
|
-
throw new RangeError("LRUCache maxSize must be a positive integer.");
|
|
637
|
-
}
|
|
638
|
-
this.#maxSize = maxSize;
|
|
639
|
-
}
|
|
640
|
-
get(key) {
|
|
641
|
-
if (!this.#store.has(key)) return void 0;
|
|
642
|
-
const value = this.#store.get(key);
|
|
643
|
-
this.#store.delete(key);
|
|
644
|
-
this.#store.set(key, value);
|
|
645
|
-
return value;
|
|
646
|
-
}
|
|
647
|
-
set(key, value) {
|
|
648
|
-
this.#store.delete(key);
|
|
649
|
-
this.#store.set(key, value);
|
|
650
|
-
if (this.#store.size > this.#maxSize) {
|
|
651
|
-
const lru = this.#store.keys().next().value;
|
|
652
|
-
if (lru !== void 0) this.#store.delete(lru);
|
|
653
|
-
}
|
|
654
|
-
}
|
|
655
|
-
has(key) {
|
|
656
|
-
return this.#store.has(key);
|
|
657
|
-
}
|
|
658
|
-
delete(key) {
|
|
659
|
-
return this.#store.delete(key);
|
|
660
|
-
}
|
|
661
|
-
get size() {
|
|
662
|
-
return this.#store.size;
|
|
663
|
-
}
|
|
664
|
-
clear() {
|
|
665
|
-
this.#store.clear();
|
|
666
|
-
}
|
|
667
|
-
};
|
|
668
|
-
|
|
669
|
-
// ../../lib/primitive/src/utils/merge-refs.ts
|
|
670
|
-
function mergeRefsCore(...refs) {
|
|
671
|
-
const active = refs.filter((r) => r != null);
|
|
672
|
-
if (active.length === 0) return null;
|
|
673
|
-
if (active.length === 1) return active[0];
|
|
674
|
-
return (value) => {
|
|
675
|
-
iterate.forEach(active, (ref) => {
|
|
676
|
-
if (typeof ref === "function") {
|
|
677
|
-
ref(value);
|
|
678
|
-
} else {
|
|
679
|
-
ref.current = value;
|
|
680
|
-
}
|
|
681
|
-
});
|
|
682
|
-
};
|
|
670
|
+
function getConditionalImplicitRole(tag, ariaLabel, ariaLabelledBy) {
|
|
671
|
+
const isNamed = isString(ariaLabel) || isString(ariaLabelledBy);
|
|
672
|
+
if (!isNamed) return void 0;
|
|
673
|
+
if (tag === "section") return "region";
|
|
674
|
+
if (tag === "form") return "form";
|
|
675
|
+
return void 0;
|
|
683
676
|
}
|
|
684
677
|
|
|
685
|
-
// ../../lib/primitive/src/
|
|
686
|
-
function
|
|
687
|
-
return
|
|
688
|
-
...defaultProps ?? {},
|
|
689
|
-
...props
|
|
690
|
-
};
|
|
678
|
+
// ../../lib/primitive/src/guards/aria/is-known-aria-role.ts
|
|
679
|
+
function isKnownAriaRole(value) {
|
|
680
|
+
return isString(value) && KNOWN_ARIA_ROLES_SET.has(value);
|
|
691
681
|
}
|
|
692
682
|
|
|
693
683
|
// ../../lib/primitive/src/guards/children/component-id.ts
|
|
@@ -727,6 +717,17 @@ function isTag(...args) {
|
|
|
727
717
|
return tag !== void 0 && set2.has(tag);
|
|
728
718
|
}
|
|
729
719
|
|
|
720
|
+
// ../../lib/contract/src/aria/aria-role-policy.ts
|
|
721
|
+
function getImplicitRole(tag, props) {
|
|
722
|
+
if (tag in IMPLICIT_ROLE_RECORD) return IMPLICIT_ROLE_RECORD[tag];
|
|
723
|
+
if (tag === "input") return getInputImplicitRole(props?.type);
|
|
724
|
+
if (tag === "img") return props?.alt === "" ? "none" : "img";
|
|
725
|
+
if (tag === "section" || tag === "form") {
|
|
726
|
+
return getConditionalImplicitRole(tag, props?.["aria-label"], props?.["aria-labelledby"]);
|
|
727
|
+
}
|
|
728
|
+
return void 0;
|
|
729
|
+
}
|
|
730
|
+
|
|
730
731
|
// ../../lib/contract/src/diagnostics/aria.ts
|
|
731
732
|
import { DiagnosticCategory, DiagnosticCode } from "./_shared/diagnostics.js";
|
|
732
733
|
var AriaDiagnostics = {
|
|
@@ -1106,7 +1107,7 @@ var InvariantBase = class {
|
|
|
1106
1107
|
};
|
|
1107
1108
|
|
|
1108
1109
|
// ../../lib/contract/src/aria/polymorphic-validator.ts
|
|
1109
|
-
var
|
|
1110
|
+
var NO_VIOLATIONS = [{ valid: true }];
|
|
1110
1111
|
function isIntrinsicTag(tag) {
|
|
1111
1112
|
return isString(tag);
|
|
1112
1113
|
}
|
|
@@ -1148,17 +1149,20 @@ var AriaPolicyEngine = class _AriaPolicyEngine extends InvariantBase {
|
|
|
1148
1149
|
static #deriveContext(tag, props) {
|
|
1149
1150
|
if (!isIntrinsicTag(tag)) return { proceed: false, result: { props, violations: [] } };
|
|
1150
1151
|
const implicitRole = getImplicitRole(tag, props);
|
|
1151
|
-
const hasRole2 = implicitRole
|
|
1152
|
+
const hasRole2 = isNonNull(implicitRole) || isString(props.role) && props.role.length > 0;
|
|
1152
1153
|
if (!hasRole2) return { proceed: false, result: { props, violations: [] } };
|
|
1153
1154
|
const normalized = _AriaPolicyEngine.#normalizeEmptyRole(tag, props);
|
|
1154
|
-
|
|
1155
|
-
const
|
|
1155
|
+
const workingProps = normalized.normalized ? normalized.result.props : props;
|
|
1156
|
+
const preExistingViolations = normalized.normalized ? normalized.result.violations : [];
|
|
1157
|
+
const effectiveRole = workingProps.role ?? implicitRole;
|
|
1156
1158
|
return {
|
|
1157
1159
|
proceed: true,
|
|
1158
1160
|
tag,
|
|
1159
1161
|
implicitRole,
|
|
1160
1162
|
effectiveRole,
|
|
1161
|
-
|
|
1163
|
+
props: workingProps,
|
|
1164
|
+
preExistingViolations,
|
|
1165
|
+
context: { tag, props: workingProps, implicitRole, effectiveRole }
|
|
1162
1166
|
};
|
|
1163
1167
|
}
|
|
1164
1168
|
static #runRules(rules, context) {
|
|
@@ -1173,7 +1177,7 @@ var AriaPolicyEngine = class _AriaPolicyEngine extends InvariantBase {
|
|
|
1173
1177
|
} = context;
|
|
1174
1178
|
const { message, attribute, severity } = result;
|
|
1175
1179
|
const resolvedMessage = message ?? result.diagnostic?.message;
|
|
1176
|
-
const fallbackDiag = resolvedMessage
|
|
1180
|
+
const fallbackDiag = isNonNull(resolvedMessage) ? void 0 : AriaDiagnostics.invalidRole(role, tag);
|
|
1177
1181
|
violations.push({
|
|
1178
1182
|
message: resolvedMessage ?? fallbackDiag.message,
|
|
1179
1183
|
tag,
|
|
@@ -1181,8 +1185,8 @@ var AriaPolicyEngine = class _AriaPolicyEngine extends InvariantBase {
|
|
|
1181
1185
|
attribute,
|
|
1182
1186
|
severity,
|
|
1183
1187
|
phase: "evaluate",
|
|
1184
|
-
...result.diagnostic
|
|
1185
|
-
...fallbackDiag
|
|
1188
|
+
...isNonNull(result.diagnostic) && { diagnostic: result.diagnostic },
|
|
1189
|
+
...isNonNull(fallbackDiag) && { diagnostic: fallbackDiag }
|
|
1186
1190
|
});
|
|
1187
1191
|
if (result.fixable) fixes.push(result.fix);
|
|
1188
1192
|
});
|
|
@@ -1190,7 +1194,7 @@ var AriaPolicyEngine = class _AriaPolicyEngine extends InvariantBase {
|
|
|
1190
1194
|
return { violations, fixes };
|
|
1191
1195
|
}
|
|
1192
1196
|
static #getRules(context) {
|
|
1193
|
-
if (_AriaPolicyEngine.#hasRole(context.props) || context.effectiveRole
|
|
1197
|
+
if (_AriaPolicyEngine.#hasRole(context.props) || isNonNull(context.effectiveRole) && _AriaPolicyEngine.#LIVE_REGION_ROLES.has(context.effectiveRole)) {
|
|
1194
1198
|
return _AriaPolicyEngine.#pipeline;
|
|
1195
1199
|
}
|
|
1196
1200
|
return _AriaPolicyEngine.#implicitOnlyRules;
|
|
@@ -1198,24 +1202,36 @@ var AriaPolicyEngine = class _AriaPolicyEngine extends InvariantBase {
|
|
|
1198
1202
|
static evaluate(tag, props) {
|
|
1199
1203
|
const derived = _AriaPolicyEngine.#deriveContext(tag, props);
|
|
1200
1204
|
if (!derived.proceed) return derived.result;
|
|
1201
|
-
const {
|
|
1205
|
+
const {
|
|
1206
|
+
tag: narrowedTag,
|
|
1207
|
+
implicitRole,
|
|
1208
|
+
context,
|
|
1209
|
+
props: workingProps,
|
|
1210
|
+
preExistingViolations
|
|
1211
|
+
} = derived;
|
|
1202
1212
|
const { violations, fixes } = _AriaPolicyEngine.#runRules(
|
|
1203
1213
|
_AriaPolicyEngine.#getRules(context),
|
|
1204
1214
|
context
|
|
1205
1215
|
);
|
|
1206
|
-
const next = _AriaPolicyEngine.#applyFixes(narrowedTag, implicitRole,
|
|
1207
|
-
return { props: next, violations };
|
|
1216
|
+
const next = _AriaPolicyEngine.#applyFixes(narrowedTag, implicitRole, workingProps, fixes);
|
|
1217
|
+
return { props: next, violations: [...preExistingViolations, ...violations] };
|
|
1208
1218
|
}
|
|
1209
1219
|
static #evaluateWithRules(tag, props, extraRules) {
|
|
1210
1220
|
const derived = _AriaPolicyEngine.#deriveContext(tag, props);
|
|
1211
1221
|
if (!derived.proceed) return derived.result;
|
|
1212
|
-
const {
|
|
1222
|
+
const {
|
|
1223
|
+
tag: narrowedTag,
|
|
1224
|
+
implicitRole,
|
|
1225
|
+
context,
|
|
1226
|
+
props: workingProps,
|
|
1227
|
+
preExistingViolations
|
|
1228
|
+
} = derived;
|
|
1213
1229
|
const { violations, fixes } = _AriaPolicyEngine.#runRules(
|
|
1214
1230
|
[..._AriaPolicyEngine.#getRules(context), ...extraRules],
|
|
1215
1231
|
context
|
|
1216
1232
|
);
|
|
1217
|
-
const next = _AriaPolicyEngine.#applyFixes(narrowedTag, implicitRole,
|
|
1218
|
-
return { props: next, violations };
|
|
1233
|
+
const next = _AriaPolicyEngine.#applyFixes(narrowedTag, implicitRole, workingProps, fixes);
|
|
1234
|
+
return { props: next, violations: [...preExistingViolations, ...violations] };
|
|
1219
1235
|
}
|
|
1220
1236
|
report(violations) {
|
|
1221
1237
|
iterate.forEach(violations, (v) => {
|
|
@@ -1224,12 +1240,12 @@ var AriaPolicyEngine = class _AriaPolicyEngine extends InvariantBase {
|
|
|
1224
1240
|
else this.warn(d);
|
|
1225
1241
|
});
|
|
1226
1242
|
}
|
|
1227
|
-
// Cache key covers only the aria-relevant subset of props (tag + role + aria-* attrs)
|
|
1228
|
-
// Non-aria props (className, onClick, etc.) do
|
|
1229
|
-
// so cache hits survive re-renders
|
|
1230
|
-
//
|
|
1231
|
-
//
|
|
1232
|
-
//
|
|
1243
|
+
// Cache key covers only the aria-relevant subset of props (tag + role + aria-* attrs) —
|
|
1244
|
+
// exactly what the built-in pipeline reads. Non-aria props (className, onClick, etc.) do
|
|
1245
|
+
// not affect built-in ARIA decisions and are excluded so cache hits survive re-renders
|
|
1246
|
+
// that only change non-aria props. This key alone is unsound for #extraRules, which may
|
|
1247
|
+
// read arbitrary props outside this set — validate() extends it with #extraRulesKeySuffix,
|
|
1248
|
+
// or bypasses the cache, to account for that.
|
|
1233
1249
|
static #createPlanKey(tag, props) {
|
|
1234
1250
|
if (!isIntrinsicTag(tag)) return null;
|
|
1235
1251
|
const parts = [tag];
|
|
@@ -1245,6 +1261,23 @@ var AriaPolicyEngine = class _AriaPolicyEngine extends InvariantBase {
|
|
|
1245
1261
|
if (ariaEntries.length > 0) parts.push(...ariaEntries.sort());
|
|
1246
1262
|
return parts.join("|");
|
|
1247
1263
|
}
|
|
1264
|
+
// Extends the base cache key with the props each extra rule declares it reads (`readsProps`).
|
|
1265
|
+
// Returns null — meaning "don't cache" — if any extra rule omits `readsProps` (it may read
|
|
1266
|
+
// arbitrary props the key can't account for) or if a declared prop's value isn't a primitive
|
|
1267
|
+
// (object/array identity isn't stably representable in a string key).
|
|
1268
|
+
static #extraRulesKeySuffix(extraRules, props) {
|
|
1269
|
+
const parts = [];
|
|
1270
|
+
for (const rule of extraRules) {
|
|
1271
|
+
const readsProps = rule.readsProps;
|
|
1272
|
+
if (!isNonNull(readsProps)) return null;
|
|
1273
|
+
for (const propKey of readsProps) {
|
|
1274
|
+
const v = props[propKey];
|
|
1275
|
+
if (v !== void 0 && !isString(v) && !isNumber(v) && typeof v !== "boolean") return null;
|
|
1276
|
+
parts.push(`x:${propKey}:${String(v)}`);
|
|
1277
|
+
}
|
|
1278
|
+
}
|
|
1279
|
+
return parts.sort().join("|");
|
|
1280
|
+
}
|
|
1248
1281
|
static #computePlan(inputProps, resultProps) {
|
|
1249
1282
|
const removals = /* @__PURE__ */ new Set();
|
|
1250
1283
|
const updates = {};
|
|
@@ -1268,7 +1301,12 @@ var AriaPolicyEngine = class _AriaPolicyEngine extends InvariantBase {
|
|
|
1268
1301
|
return next;
|
|
1269
1302
|
}
|
|
1270
1303
|
validate(tag, props) {
|
|
1271
|
-
const
|
|
1304
|
+
const baseKey = _AriaPolicyEngine.#createPlanKey(tag, props);
|
|
1305
|
+
let key = baseKey;
|
|
1306
|
+
if (this.#extraRules.length > 0) {
|
|
1307
|
+
const suffix = _AriaPolicyEngine.#extraRulesKeySuffix(this.#extraRules, props);
|
|
1308
|
+
key = isNonNull(baseKey) && isNonNull(suffix) ? `${baseKey}|${suffix}` : null;
|
|
1309
|
+
}
|
|
1272
1310
|
if (!isNull(key)) {
|
|
1273
1311
|
const cached = this.#planCache.get(key);
|
|
1274
1312
|
if (cached !== void 0) {
|
|
@@ -1358,7 +1396,7 @@ var AriaPolicyEngine = class _AriaPolicyEngine extends InvariantBase {
|
|
|
1358
1396
|
implicitRole
|
|
1359
1397
|
}) {
|
|
1360
1398
|
const role = props.role;
|
|
1361
|
-
if (!implicitRole || !role || role === implicitRole) return
|
|
1399
|
+
if (!implicitRole || !role || role === implicitRole) return NO_VIOLATIONS;
|
|
1362
1400
|
if (isStrongImplicitRole(tag) && role === "region") {
|
|
1363
1401
|
return [
|
|
1364
1402
|
{
|
|
@@ -1370,11 +1408,11 @@ var AriaPolicyEngine = class _AriaPolicyEngine extends InvariantBase {
|
|
|
1370
1408
|
}
|
|
1371
1409
|
];
|
|
1372
1410
|
}
|
|
1373
|
-
return
|
|
1411
|
+
return NO_VIOLATIONS;
|
|
1374
1412
|
}
|
|
1375
1413
|
static #checkRedundantRole({ tag, props, implicitRole }) {
|
|
1376
1414
|
const role = props.role;
|
|
1377
|
-
if (!implicitRole || !role || role !== implicitRole) return
|
|
1415
|
+
if (!implicitRole || !role || role !== implicitRole) return NO_VIOLATIONS;
|
|
1378
1416
|
return [
|
|
1379
1417
|
{
|
|
1380
1418
|
valid: false,
|
|
@@ -1387,8 +1425,8 @@ var AriaPolicyEngine = class _AriaPolicyEngine extends InvariantBase {
|
|
|
1387
1425
|
}
|
|
1388
1426
|
static #checkStandaloneRegion({ tag, props, implicitRole }) {
|
|
1389
1427
|
const role = props.role;
|
|
1390
|
-
if (role !== "region") return
|
|
1391
|
-
if (!isStandaloneTag(tag)) return
|
|
1428
|
+
if (role !== "region") return NO_VIOLATIONS;
|
|
1429
|
+
if (!isStandaloneTag(tag)) return NO_VIOLATIONS;
|
|
1392
1430
|
return [
|
|
1393
1431
|
{
|
|
1394
1432
|
valid: false,
|
|
@@ -1404,7 +1442,7 @@ var AriaPolicyEngine = class _AriaPolicyEngine extends InvariantBase {
|
|
|
1404
1442
|
props,
|
|
1405
1443
|
effectiveRole
|
|
1406
1444
|
}) {
|
|
1407
|
-
if (effectiveRole === "none" || effectiveRole === "presentation") return
|
|
1445
|
+
if (effectiveRole === "none" || effectiveRole === "presentation") return NO_VIOLATIONS;
|
|
1408
1446
|
const results = [];
|
|
1409
1447
|
iterate.forEachEntry(props, (key) => {
|
|
1410
1448
|
if (!key.startsWith("aria-")) return;
|
|
@@ -1522,12 +1560,12 @@ var AriaPolicyEngine = class _AriaPolicyEngine extends InvariantBase {
|
|
|
1522
1560
|
}
|
|
1523
1561
|
}
|
|
1524
1562
|
static #checkAriaAttributeValues({ props, effectiveRole }) {
|
|
1525
|
-
if (effectiveRole === "none" || effectiveRole === "presentation") return
|
|
1563
|
+
if (effectiveRole === "none" || effectiveRole === "presentation") return NO_VIOLATIONS;
|
|
1526
1564
|
const results = [];
|
|
1527
1565
|
iterate.forEachEntry(props, (key, value) => {
|
|
1528
1566
|
if (!key.startsWith("aria-")) return;
|
|
1529
1567
|
const type = _AriaPolicyEngine.#ARIA_VALUE_TYPES.get(key);
|
|
1530
|
-
if (type
|
|
1568
|
+
if (!isNonNull(type)) return;
|
|
1531
1569
|
if (_AriaPolicyEngine.#isValidAriaValue(value, type)) return;
|
|
1532
1570
|
results.push({
|
|
1533
1571
|
valid: false,
|
|
@@ -1558,13 +1596,13 @@ var AriaPolicyEngine = class _AriaPolicyEngine extends InvariantBase {
|
|
|
1558
1596
|
props,
|
|
1559
1597
|
effectiveRole
|
|
1560
1598
|
}) {
|
|
1561
|
-
if (effectiveRole === "none" || effectiveRole === "presentation") return
|
|
1599
|
+
if (effectiveRole === "none" || effectiveRole === "presentation") return NO_VIOLATIONS;
|
|
1562
1600
|
const implicitLevel = _AriaPolicyEngine.#HEADING_IMPLICIT_LEVELS.get(tag);
|
|
1563
|
-
if (implicitLevel
|
|
1601
|
+
if (!isNonNull(implicitLevel)) return NO_VIOLATIONS;
|
|
1564
1602
|
const raw = props["aria-level"];
|
|
1565
|
-
if (raw
|
|
1603
|
+
if (!isNonNull(raw)) return NO_VIOLATIONS;
|
|
1566
1604
|
const n = typeof raw === "number" ? raw : typeof raw === "string" ? parseInt(raw, 10) : NaN;
|
|
1567
|
-
if (!Number.isFinite(n) || n !== implicitLevel) return
|
|
1605
|
+
if (!Number.isFinite(n) || n !== implicitLevel) return NO_VIOLATIONS;
|
|
1568
1606
|
return [
|
|
1569
1607
|
{
|
|
1570
1608
|
valid: false,
|
|
@@ -1587,9 +1625,10 @@ var AriaPolicyEngine = class _AriaPolicyEngine extends InvariantBase {
|
|
|
1587
1625
|
props,
|
|
1588
1626
|
effectiveRole
|
|
1589
1627
|
}) {
|
|
1590
|
-
if (!effectiveRole || !_AriaPolicyEngine.#NAME_REQUIRED_ROLES.has(effectiveRole))
|
|
1591
|
-
|
|
1592
|
-
if (
|
|
1628
|
+
if (!effectiveRole || !_AriaPolicyEngine.#NAME_REQUIRED_ROLES.has(effectiveRole))
|
|
1629
|
+
return NO_VIOLATIONS;
|
|
1630
|
+
if ("aria-label" in props || "aria-labelledby" in props) return NO_VIOLATIONS;
|
|
1631
|
+
if (tag === "img" && typeof props.alt === "string" && props.alt.length > 0) return NO_VIOLATIONS;
|
|
1593
1632
|
return [
|
|
1594
1633
|
{
|
|
1595
1634
|
valid: false,
|
|
@@ -1612,9 +1651,9 @@ var AriaPolicyEngine = class _AriaPolicyEngine extends InvariantBase {
|
|
|
1612
1651
|
props,
|
|
1613
1652
|
effectiveRole
|
|
1614
1653
|
}) {
|
|
1615
|
-
if (!effectiveRole) return
|
|
1654
|
+
if (!effectiveRole) return NO_VIOLATIONS;
|
|
1616
1655
|
const required = _AriaPolicyEngine.#REQUIRED_PROPERTIES.get(effectiveRole);
|
|
1617
|
-
if (required
|
|
1656
|
+
if (!isNonNull(required)) return NO_VIOLATIONS;
|
|
1618
1657
|
const results = [];
|
|
1619
1658
|
iterate.forEach(required, (attr) => {
|
|
1620
1659
|
if (attr in props) return;
|
|
@@ -1638,12 +1677,12 @@ var AriaPolicyEngine = class _AriaPolicyEngine extends InvariantBase {
|
|
|
1638
1677
|
]);
|
|
1639
1678
|
// WAI-ARIA 1.2 §6.6: aria-hidden="true" must not be placed on focusable elements.
|
|
1640
1679
|
static #checkAriaHiddenOnFocusable({ tag, props }) {
|
|
1641
|
-
if (props["aria-hidden"] !== "true" && props["aria-hidden"] !== true) return
|
|
1680
|
+
if (props["aria-hidden"] !== "true" && props["aria-hidden"] !== true) return NO_VIOLATIONS;
|
|
1642
1681
|
const isInteractive = _AriaPolicyEngine.#INTERACTIVE_TAGS.has(tag);
|
|
1643
1682
|
if (!isInteractive) {
|
|
1644
1683
|
const tabindex = props.tabindex;
|
|
1645
1684
|
const n = typeof tabindex === "number" ? tabindex : typeof tabindex === "string" ? parseInt(tabindex, 10) : NaN;
|
|
1646
|
-
if (!Number.isFinite(n) || n < 0) return
|
|
1685
|
+
if (!Number.isFinite(n) || n < 0) return NO_VIOLATIONS;
|
|
1647
1686
|
}
|
|
1648
1687
|
return [
|
|
1649
1688
|
{
|
|
@@ -1662,7 +1701,7 @@ var AriaPolicyEngine = class _AriaPolicyEngine extends InvariantBase {
|
|
|
1662
1701
|
props,
|
|
1663
1702
|
effectiveRole
|
|
1664
1703
|
}) {
|
|
1665
|
-
if (effectiveRole !== "none" && effectiveRole !== "presentation") return
|
|
1704
|
+
if (effectiveRole !== "none" && effectiveRole !== "presentation") return NO_VIOLATIONS;
|
|
1666
1705
|
const results = [];
|
|
1667
1706
|
iterate.forEachEntry(props, (key) => {
|
|
1668
1707
|
if (!key.startsWith("aria-")) return;
|
|
@@ -1686,10 +1725,10 @@ var AriaPolicyEngine = class _AriaPolicyEngine extends InvariantBase {
|
|
|
1686
1725
|
["timer", "off"]
|
|
1687
1726
|
]);
|
|
1688
1727
|
static #checkMissingLiveRegion({ effectiveRole, props }) {
|
|
1689
|
-
if (!effectiveRole) return
|
|
1728
|
+
if (!effectiveRole) return NO_VIOLATIONS;
|
|
1690
1729
|
const impliedLive = _AriaPolicyEngine.#LIVE_REGION_ROLES.get(effectiveRole);
|
|
1691
|
-
if (!impliedLive) return
|
|
1692
|
-
if ("aria-live" in props) return
|
|
1730
|
+
if (!impliedLive) return NO_VIOLATIONS;
|
|
1731
|
+
if ("aria-live" in props) return NO_VIOLATIONS;
|
|
1693
1732
|
const injectLive = {
|
|
1694
1733
|
kind: `injectLive:${effectiveRole}`,
|
|
1695
1734
|
apply: (ctx) => ({
|
|
@@ -1709,8 +1748,9 @@ var AriaPolicyEngine = class _AriaPolicyEngine extends InvariantBase {
|
|
|
1709
1748
|
];
|
|
1710
1749
|
}
|
|
1711
1750
|
static #checkMissingAtomic({ effectiveRole, props }) {
|
|
1712
|
-
if (!effectiveRole || !_AriaPolicyEngine.#LIVE_REGION_ROLES.has(effectiveRole))
|
|
1713
|
-
|
|
1751
|
+
if (!effectiveRole || !_AriaPolicyEngine.#LIVE_REGION_ROLES.has(effectiveRole))
|
|
1752
|
+
return NO_VIOLATIONS;
|
|
1753
|
+
if ("aria-atomic" in props) return NO_VIOLATIONS;
|
|
1714
1754
|
return [
|
|
1715
1755
|
{
|
|
1716
1756
|
valid: false,
|
|
@@ -1734,8 +1774,8 @@ var AriaPolicyEngine = class _AriaPolicyEngine extends InvariantBase {
|
|
|
1734
1774
|
};
|
|
1735
1775
|
static #checkInvalidAriaRelevant({ props }) {
|
|
1736
1776
|
const relevant = props["aria-relevant"];
|
|
1737
|
-
if (relevant === void 0) return
|
|
1738
|
-
if (typeof relevant !== "string") return
|
|
1777
|
+
if (relevant === void 0) return NO_VIOLATIONS;
|
|
1778
|
+
if (typeof relevant !== "string") return NO_VIOLATIONS;
|
|
1739
1779
|
const tokens = relevant.trim().split(/\s+/);
|
|
1740
1780
|
const invalid = tokens.filter((t) => !_AriaPolicyEngine.#VALID_RELEVANT_TOKENS.has(t));
|
|
1741
1781
|
if (invalid.length > 0) {
|
|
@@ -1762,7 +1802,7 @@ var AriaPolicyEngine = class _AriaPolicyEngine extends InvariantBase {
|
|
|
1762
1802
|
}
|
|
1763
1803
|
];
|
|
1764
1804
|
}
|
|
1765
|
-
return
|
|
1805
|
+
return NO_VIOLATIONS;
|
|
1766
1806
|
}
|
|
1767
1807
|
};
|
|
1768
1808
|
|
|
@@ -2463,7 +2503,7 @@ function createClassPipeline(resolved) {
|
|
|
2463
2503
|
const staticClasses = staticResolver.resolve(tag, recipe !== void 0);
|
|
2464
2504
|
const variantClasses = variantResolver.resolve({ props, recipe });
|
|
2465
2505
|
if (!className)
|
|
2466
|
-
return staticClasses && variantClasses ? `${staticClasses} ${variantClasses}` : staticClasses || variantClasses;
|
|
2506
|
+
return (staticClasses && variantClasses ? `${staticClasses} ${variantClasses}` : staticClasses || variantClasses) || void 0;
|
|
2467
2507
|
return cn(staticClasses, variantClasses, className);
|
|
2468
2508
|
};
|
|
2469
2509
|
}
|
|
@@ -2503,7 +2543,10 @@ function resolveFactoryOptions(options = {}) {
|
|
|
2503
2543
|
const variantKeys = styling?.variants === void 0 ? EMPTY_VARIANT_KEYS : new Set(Object.keys(styling.variants));
|
|
2504
2544
|
return Object.freeze({
|
|
2505
2545
|
defaultTag: options.tag ?? "div",
|
|
2506
|
-
diagnostics: resolveDiagnostics(
|
|
2546
|
+
diagnostics: resolveDiagnostics(
|
|
2547
|
+
enforcement?.diagnostics,
|
|
2548
|
+
options.diagnostics ?? silentDiagnostics
|
|
2549
|
+
),
|
|
2507
2550
|
variantKeys,
|
|
2508
2551
|
...whenDefined("displayName", options.name),
|
|
2509
2552
|
...whenDefined("defaultProps", options.defaults),
|
|
@@ -2674,7 +2717,7 @@ function createPolymorphic2(options = {}) {
|
|
|
2674
2717
|
if (process.env.NODE_ENV !== "production") {
|
|
2675
2718
|
validateRenderProps(resolved.diagnostics, resolved, props, recipe);
|
|
2676
2719
|
}
|
|
2677
|
-
return classPipeline(tag, props, className, recipe);
|
|
2720
|
+
return classPipeline(tag, props, className, recipe) || void 0;
|
|
2678
2721
|
},
|
|
2679
2722
|
resolveAria(tag, props) {
|
|
2680
2723
|
return resolveAriaFn(tag, props);
|