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
package/dist/vue/index.js
CHANGED
|
@@ -1,10 +1,30 @@
|
|
|
1
1
|
// ../../adapters/vue/src/create-contract-component.ts
|
|
2
2
|
import { computed, defineComponent as defineComponent2 } from "vue";
|
|
3
3
|
|
|
4
|
-
// ../../lib/primitive/src/
|
|
5
|
-
|
|
4
|
+
// ../../lib/primitive/src/tag/resolve-tag.ts
|
|
5
|
+
function makeResolveTag(defaultTag) {
|
|
6
|
+
return function tag(as) {
|
|
7
|
+
return as ?? defaultTag;
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
// ../../lib/primitive/src/rule/rule-brand.ts
|
|
12
|
+
var RULE_BRAND = /* @__PURE__ */ Symbol("praxis-kit/dynamic-rule");
|
|
13
|
+
|
|
14
|
+
// ../../lib/primitive/src/guards/foundational/is-defined.ts
|
|
15
|
+
function isUndefined(value) {
|
|
16
|
+
return value === void 0;
|
|
17
|
+
}
|
|
6
18
|
|
|
7
|
-
// ../../lib/primitive/src/
|
|
19
|
+
// ../../lib/primitive/src/guards/foundational/is-null.ts
|
|
20
|
+
function isNull(value) {
|
|
21
|
+
return value === null;
|
|
22
|
+
}
|
|
23
|
+
function isNonNull(value) {
|
|
24
|
+
return value != null;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// ../../lib/primitive/src/utils/type-guards.ts
|
|
8
28
|
function isObject(value, excludeArrays = false) {
|
|
9
29
|
if (value === null || typeof value !== "object") return false;
|
|
10
30
|
return excludeArrays ? !Array.isArray(value) : true;
|
|
@@ -16,65 +36,242 @@ function isNumber(value) {
|
|
|
16
36
|
return typeof value === "number";
|
|
17
37
|
}
|
|
18
38
|
|
|
19
|
-
// ../../lib/primitive/src/
|
|
20
|
-
function
|
|
21
|
-
return
|
|
39
|
+
// ../../lib/primitive/src/rule/is-dynamic-rule.ts
|
|
40
|
+
function isDynamicRule(rule) {
|
|
41
|
+
return isObject(rule, true) && rule[RULE_BRAND] === true;
|
|
22
42
|
}
|
|
23
43
|
|
|
24
|
-
// ../../lib/primitive/src/
|
|
25
|
-
function
|
|
26
|
-
return
|
|
44
|
+
// ../../lib/primitive/src/rule/resolve-rule.ts
|
|
45
|
+
function resolveRule(rule, context) {
|
|
46
|
+
return isDynamicRule(rule) ? rule.resolve(context) : rule;
|
|
27
47
|
}
|
|
28
48
|
|
|
29
|
-
// ../../lib/primitive/src/
|
|
30
|
-
function
|
|
31
|
-
|
|
32
|
-
const props = child.props;
|
|
33
|
-
if (!isObject(props)) return void 0;
|
|
34
|
-
const as = props.as;
|
|
35
|
-
return isString(as) && as !== "" ? as : void 0;
|
|
49
|
+
// ../../lib/primitive/src/utils/assert-never.ts
|
|
50
|
+
function assertNever(value) {
|
|
51
|
+
throw new Error(`Unexpected value: ${String(value)}`);
|
|
36
52
|
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
53
|
+
|
|
54
|
+
// ../../lib/primitive/src/utils/cn.ts
|
|
55
|
+
import { clsx } from "clsx";
|
|
56
|
+
function cn(...inputs) {
|
|
57
|
+
return clsx(...inputs);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// ../../lib/primitive/src/utils/iterate.ts
|
|
61
|
+
function find(iterable, callback) {
|
|
62
|
+
for (const value of iterable) {
|
|
63
|
+
const result = callback(value);
|
|
64
|
+
if (result != null) {
|
|
65
|
+
return result;
|
|
66
|
+
}
|
|
45
67
|
}
|
|
46
|
-
return
|
|
68
|
+
return null;
|
|
47
69
|
}
|
|
48
|
-
function
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
return (child2) => {
|
|
52
|
-
const tag2 = getTag(child2);
|
|
53
|
-
return tag2 !== void 0 && set3.has(tag2);
|
|
54
|
-
};
|
|
70
|
+
function some(iterable, predicate) {
|
|
71
|
+
for (const value of iterable) {
|
|
72
|
+
if (predicate(value)) return true;
|
|
55
73
|
}
|
|
56
|
-
|
|
57
|
-
const set2 = new Set(tags);
|
|
58
|
-
const tag = getTag(child);
|
|
59
|
-
return tag !== void 0 && set2.has(tag);
|
|
74
|
+
return false;
|
|
60
75
|
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
76
|
+
function every(iterable, predicate) {
|
|
77
|
+
let index = 0;
|
|
78
|
+
for (const value of iterable) {
|
|
79
|
+
if (!predicate(value, index++)) {
|
|
80
|
+
return false;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
return true;
|
|
65
84
|
}
|
|
66
|
-
function
|
|
67
|
-
|
|
85
|
+
function* filter(iterable, predicate) {
|
|
86
|
+
let index = 0;
|
|
87
|
+
for (const value of iterable) {
|
|
88
|
+
if (predicate(value, index++)) {
|
|
89
|
+
yield value;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
68
92
|
}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
93
|
+
function* map(iterable, callback) {
|
|
94
|
+
let index = 0;
|
|
95
|
+
for (const value of iterable) {
|
|
96
|
+
yield callback(value, index++);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
function forEach(iterable, callback) {
|
|
100
|
+
let index = 0;
|
|
101
|
+
for (const value of iterable) {
|
|
102
|
+
callback(value, index++);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
function reduce(iterable, initial, callback) {
|
|
106
|
+
let accumulator = initial;
|
|
107
|
+
let index = 0;
|
|
108
|
+
for (const value of iterable) {
|
|
109
|
+
accumulator = callback(accumulator, value, index++);
|
|
110
|
+
}
|
|
111
|
+
return accumulator;
|
|
73
112
|
}
|
|
113
|
+
function collect(iterable, callback) {
|
|
114
|
+
const result = {};
|
|
115
|
+
let index = 0;
|
|
116
|
+
for (const value of iterable) {
|
|
117
|
+
const entry = callback(value, index++);
|
|
118
|
+
if (entry === null) {
|
|
119
|
+
return null;
|
|
120
|
+
}
|
|
121
|
+
result[entry[0]] = entry[1];
|
|
122
|
+
}
|
|
123
|
+
return result;
|
|
124
|
+
}
|
|
125
|
+
function findLast(value, callback) {
|
|
126
|
+
for (let index = value.length - 1; index >= 0; index--) {
|
|
127
|
+
const result = callback(value[index], index);
|
|
128
|
+
if (result != null) {
|
|
129
|
+
return result;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
return null;
|
|
133
|
+
}
|
|
134
|
+
function* items(collection) {
|
|
135
|
+
for (let i = 0; i < collection.length; i++) {
|
|
136
|
+
const item = collection.item(i);
|
|
137
|
+
if (item !== null) {
|
|
138
|
+
yield item;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
function nodeList(list) {
|
|
143
|
+
return {
|
|
144
|
+
*[Symbol.iterator]() {
|
|
145
|
+
for (let i = 0; i < list.length; i++) {
|
|
146
|
+
const node = list.item(i);
|
|
147
|
+
if (node !== null) {
|
|
148
|
+
yield node;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
function mapEntries(m) {
|
|
155
|
+
return m.entries();
|
|
156
|
+
}
|
|
157
|
+
function set(s) {
|
|
158
|
+
return s.values();
|
|
159
|
+
}
|
|
160
|
+
function hasOwn(object, key) {
|
|
161
|
+
return Object.hasOwn(object, key);
|
|
162
|
+
}
|
|
163
|
+
function* entries(object) {
|
|
164
|
+
for (const key in object) {
|
|
165
|
+
if (!hasOwn(object, key)) continue;
|
|
166
|
+
yield [key, object[key]];
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
function* keys(object) {
|
|
170
|
+
for (const [key] of entries(object)) {
|
|
171
|
+
yield key;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
function* values(object) {
|
|
175
|
+
for (const [, value] of entries(object)) {
|
|
176
|
+
yield value;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
function mapValues(object, callback) {
|
|
180
|
+
const result = {};
|
|
181
|
+
for (const [key, value] of entries(object)) {
|
|
182
|
+
result[key] = callback(value, key);
|
|
183
|
+
}
|
|
184
|
+
return result;
|
|
185
|
+
}
|
|
186
|
+
function forEachEntry(object, callback) {
|
|
187
|
+
for (const [key, value] of entries(object)) {
|
|
188
|
+
callback(key, value);
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
function forEachKey(object, callback) {
|
|
192
|
+
for (const key of keys(object)) {
|
|
193
|
+
callback(key);
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
function forEachValue(object, callback) {
|
|
197
|
+
for (const value of values(object)) {
|
|
198
|
+
callback(value);
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
function forEachSet(s, callback) {
|
|
202
|
+
for (const value of s) {
|
|
203
|
+
callback(value);
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
var iterate = Object.freeze({
|
|
207
|
+
entries,
|
|
208
|
+
filter,
|
|
209
|
+
find,
|
|
210
|
+
findLast,
|
|
211
|
+
forEach,
|
|
212
|
+
forEachEntry,
|
|
213
|
+
forEachKey,
|
|
214
|
+
forEachSet,
|
|
215
|
+
forEachValue,
|
|
216
|
+
items,
|
|
217
|
+
keys,
|
|
218
|
+
map,
|
|
219
|
+
mapEntries,
|
|
220
|
+
mapValues,
|
|
221
|
+
nodeList,
|
|
222
|
+
reduce,
|
|
223
|
+
collect,
|
|
224
|
+
set,
|
|
225
|
+
some,
|
|
226
|
+
every,
|
|
227
|
+
values
|
|
228
|
+
});
|
|
74
229
|
|
|
75
|
-
// ../../lib/
|
|
76
|
-
|
|
77
|
-
|
|
230
|
+
// ../../lib/primitive/src/utils/lru-cache.ts
|
|
231
|
+
var LRUCache = class {
|
|
232
|
+
#maxSize;
|
|
233
|
+
#store = /* @__PURE__ */ new Map();
|
|
234
|
+
constructor(maxSize) {
|
|
235
|
+
if (!Number.isInteger(maxSize) || maxSize < 1) {
|
|
236
|
+
throw new RangeError("LRUCache maxSize must be a positive integer.");
|
|
237
|
+
}
|
|
238
|
+
this.#maxSize = maxSize;
|
|
239
|
+
}
|
|
240
|
+
get(key) {
|
|
241
|
+
if (!this.#store.has(key)) return void 0;
|
|
242
|
+
const value = this.#store.get(key);
|
|
243
|
+
this.#store.delete(key);
|
|
244
|
+
this.#store.set(key, value);
|
|
245
|
+
return value;
|
|
246
|
+
}
|
|
247
|
+
set(key, value) {
|
|
248
|
+
this.#store.delete(key);
|
|
249
|
+
this.#store.set(key, value);
|
|
250
|
+
if (this.#store.size > this.#maxSize) {
|
|
251
|
+
const lru = this.#store.keys().next().value;
|
|
252
|
+
if (lru !== void 0) this.#store.delete(lru);
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
has(key) {
|
|
256
|
+
return this.#store.has(key);
|
|
257
|
+
}
|
|
258
|
+
delete(key) {
|
|
259
|
+
return this.#store.delete(key);
|
|
260
|
+
}
|
|
261
|
+
get size() {
|
|
262
|
+
return this.#store.size;
|
|
263
|
+
}
|
|
264
|
+
clear() {
|
|
265
|
+
this.#store.clear();
|
|
266
|
+
}
|
|
267
|
+
};
|
|
268
|
+
|
|
269
|
+
// ../../lib/primitive/src/utils/merge-props.ts
|
|
270
|
+
function mergeProps(defaultProps, props) {
|
|
271
|
+
return {
|
|
272
|
+
...defaultProps ?? {},
|
|
273
|
+
...props
|
|
274
|
+
};
|
|
78
275
|
}
|
|
79
276
|
|
|
80
277
|
// ../../lib/primitive/src/constants/aria/global-aria-attributes.ts
|
|
@@ -360,341 +557,147 @@ var ROLE_RESTRICTED_ATTRIBUTES = /* @__PURE__ */ new Map([
|
|
|
360
557
|
"tree",
|
|
361
558
|
"treegrid"
|
|
362
559
|
])
|
|
363
|
-
],
|
|
364
|
-
["aria-rowcount", /* @__PURE__ */ new Set(["grid", "table", "treegrid"])],
|
|
365
|
-
["aria-rowindex", /* @__PURE__ */ new Set(["cell", "columnheader", "gridcell", "row", "rowheader"])],
|
|
366
|
-
["aria-rowspan", /* @__PURE__ */ new Set(["cell", "columnheader", "gridcell", "rowheader"])],
|
|
367
|
-
[
|
|
368
|
-
"aria-selected",
|
|
369
|
-
/* @__PURE__ */ new Set(["columnheader", "gridcell", "option", "row", "rowheader", "tab", "treeitem"])
|
|
370
|
-
],
|
|
371
|
-
[
|
|
372
|
-
"aria-setsize",
|
|
373
|
-
/* @__PURE__ */ new Set([
|
|
374
|
-
"article",
|
|
375
|
-
"listitem",
|
|
376
|
-
"menuitem",
|
|
377
|
-
"menuitemcheckbox",
|
|
378
|
-
"menuitemradio",
|
|
379
|
-
"option",
|
|
380
|
-
"radio",
|
|
381
|
-
"row",
|
|
382
|
-
"tab"
|
|
383
|
-
])
|
|
384
|
-
],
|
|
385
|
-
["aria-sort", /* @__PURE__ */ new Set(["columnheader", "rowheader"])],
|
|
386
|
-
[
|
|
387
|
-
"aria-valuemax",
|
|
388
|
-
/* @__PURE__ */ new Set(["meter", "progressbar", "scrollbar", "separator", "slider", "spinbutton"])
|
|
389
|
-
],
|
|
390
|
-
[
|
|
391
|
-
"aria-valuemin",
|
|
392
|
-
/* @__PURE__ */ new Set(["meter", "progressbar", "scrollbar", "separator", "slider", "spinbutton"])
|
|
393
|
-
],
|
|
394
|
-
[
|
|
395
|
-
"aria-valuenow",
|
|
396
|
-
/* @__PURE__ */ new Set(["meter", "progressbar", "scrollbar", "separator", "slider", "spinbutton"])
|
|
397
|
-
],
|
|
398
|
-
[
|
|
399
|
-
"aria-valuetext",
|
|
400
|
-
/* @__PURE__ */ new Set(["meter", "progressbar", "scrollbar", "separator", "slider", "spinbutton"])
|
|
401
|
-
]
|
|
402
|
-
]);
|
|
403
|
-
|
|
404
|
-
// ../../lib/primitive/src/guards/aria/is-aria-attribute.ts
|
|
405
|
-
function isGlobalAriaAttribute(attr) {
|
|
406
|
-
return GLOBAL_ARIA_ATTRIBUTES.has(attr);
|
|
407
|
-
}
|
|
408
|
-
function isAriaAttributeValidForRole(attr, role) {
|
|
409
|
-
const allowedRoles = ROLE_RESTRICTED_ATTRIBUTES.get(attr);
|
|
410
|
-
if (isUndefined(allowedRoles)) return true;
|
|
411
|
-
if (isUndefined(role)) return false;
|
|
412
|
-
return allowedRoles.has(role);
|
|
413
|
-
}
|
|
414
|
-
|
|
415
|
-
// ../../lib/primitive/src/guards/aria/is-aria-role.ts
|
|
416
|
-
function isStrongImplicitRole(tag) {
|
|
417
|
-
if (!(tag in IMPLICIT_ROLE_RECORD)) return false;
|
|
418
|
-
return STRONG_ROLES_SET.has(IMPLICIT_ROLE_RECORD[tag]);
|
|
419
|
-
}
|
|
420
|
-
function isStandaloneTag(tag) {
|
|
421
|
-
if (!(tag in IMPLICIT_ROLE_RECORD)) return false;
|
|
422
|
-
return STANDALONE_ROLES_SET.has(IMPLICIT_ROLE_RECORD[tag]);
|
|
423
|
-
}
|
|
424
|
-
function getInputImplicitRole(type) {
|
|
425
|
-
if (!isString(type) || !(type in INPUT_TYPE_ROLE_MAP)) return void 0;
|
|
426
|
-
return INPUT_TYPE_ROLE_MAP[type];
|
|
427
|
-
}
|
|
428
|
-
function getConditionalImplicitRole(tag, ariaLabel, ariaLabelledBy) {
|
|
429
|
-
const isNamed = isString(ariaLabel) || isString(ariaLabelledBy);
|
|
430
|
-
if (!isNamed) return void 0;
|
|
431
|
-
if (tag === "section") return "region";
|
|
432
|
-
if (tag === "form") return "form";
|
|
433
|
-
return void 0;
|
|
434
|
-
}
|
|
435
|
-
|
|
436
|
-
// ../../lib/primitive/src/guards/aria/is-known-aria-role.ts
|
|
437
|
-
function isKnownAriaRole(value) {
|
|
438
|
-
return isString(value) && KNOWN_ARIA_ROLES_SET.has(value);
|
|
439
|
-
}
|
|
440
|
-
|
|
441
|
-
// ../../lib/contract/src/aria/aria-role-policy.ts
|
|
442
|
-
function getImplicitRole(tag, props) {
|
|
443
|
-
if (tag in IMPLICIT_ROLE_RECORD) return IMPLICIT_ROLE_RECORD[tag];
|
|
444
|
-
if (tag === "input") return getInputImplicitRole(props?.type);
|
|
445
|
-
if (tag === "img") return props?.alt === "" ? "none" : "img";
|
|
446
|
-
if (tag === "section" || tag === "form") {
|
|
447
|
-
return getConditionalImplicitRole(tag, props?.["aria-label"], props?.["aria-labelledby"]);
|
|
448
|
-
}
|
|
449
|
-
return void 0;
|
|
450
|
-
}
|
|
451
|
-
|
|
452
|
-
// ../../lib/primitive/src/tag/resolve-tag.ts
|
|
453
|
-
function makeResolveTag(defaultTag) {
|
|
454
|
-
return function tag(as) {
|
|
455
|
-
return as ?? defaultTag;
|
|
456
|
-
};
|
|
457
|
-
}
|
|
458
|
-
|
|
459
|
-
// ../../lib/primitive/src/rule/rule-brand.ts
|
|
460
|
-
var RULE_BRAND = /* @__PURE__ */ Symbol("praxis-kit/dynamic-rule");
|
|
461
|
-
|
|
462
|
-
// ../../lib/primitive/src/rule/is-dynamic-rule.ts
|
|
463
|
-
function isDynamicRule(rule) {
|
|
464
|
-
return isObject(rule, true) && rule[RULE_BRAND] === true;
|
|
465
|
-
}
|
|
466
|
-
|
|
467
|
-
// ../../lib/primitive/src/rule/resolve-rule.ts
|
|
468
|
-
function resolveRule(rule, context) {
|
|
469
|
-
return isDynamicRule(rule) ? rule.resolve(context) : rule;
|
|
470
|
-
}
|
|
471
|
-
|
|
472
|
-
// ../../lib/primitive/src/utils/assert-never.ts
|
|
473
|
-
function assertNever(value) {
|
|
474
|
-
throw new Error(`Unexpected value: ${String(value)}`);
|
|
475
|
-
}
|
|
476
|
-
|
|
477
|
-
// ../../lib/primitive/src/utils/cn.ts
|
|
478
|
-
import { clsx } from "clsx";
|
|
479
|
-
function cn(...inputs) {
|
|
480
|
-
return clsx(...inputs);
|
|
481
|
-
}
|
|
482
|
-
|
|
483
|
-
// ../../lib/primitive/src/utils/iterate.ts
|
|
484
|
-
function find(iterable, callback) {
|
|
485
|
-
for (const value of iterable) {
|
|
486
|
-
const result = callback(value);
|
|
487
|
-
if (result != null) {
|
|
488
|
-
return result;
|
|
489
|
-
}
|
|
490
|
-
}
|
|
491
|
-
return null;
|
|
492
|
-
}
|
|
493
|
-
function some(iterable, predicate) {
|
|
494
|
-
for (const value of iterable) {
|
|
495
|
-
if (predicate(value)) return true;
|
|
496
|
-
}
|
|
497
|
-
return false;
|
|
498
|
-
}
|
|
499
|
-
function every(iterable, predicate) {
|
|
500
|
-
let index = 0;
|
|
501
|
-
for (const value of iterable) {
|
|
502
|
-
if (!predicate(value, index++)) {
|
|
503
|
-
return false;
|
|
504
|
-
}
|
|
505
|
-
}
|
|
506
|
-
return true;
|
|
507
|
-
}
|
|
508
|
-
function* filter(iterable, predicate) {
|
|
509
|
-
let index = 0;
|
|
510
|
-
for (const value of iterable) {
|
|
511
|
-
if (predicate(value, index++)) {
|
|
512
|
-
yield value;
|
|
513
|
-
}
|
|
514
|
-
}
|
|
515
|
-
}
|
|
516
|
-
function* map(iterable, callback) {
|
|
517
|
-
let index = 0;
|
|
518
|
-
for (const value of iterable) {
|
|
519
|
-
yield callback(value, index++);
|
|
520
|
-
}
|
|
521
|
-
}
|
|
522
|
-
function forEach(iterable, callback) {
|
|
523
|
-
let index = 0;
|
|
524
|
-
for (const value of iterable) {
|
|
525
|
-
callback(value, index++);
|
|
526
|
-
}
|
|
527
|
-
}
|
|
528
|
-
function reduce(iterable, initial, callback) {
|
|
529
|
-
let accumulator = initial;
|
|
530
|
-
let index = 0;
|
|
531
|
-
for (const value of iterable) {
|
|
532
|
-
accumulator = callback(accumulator, value, index++);
|
|
533
|
-
}
|
|
534
|
-
return accumulator;
|
|
535
|
-
}
|
|
536
|
-
function collect(iterable, callback) {
|
|
537
|
-
const result = {};
|
|
538
|
-
let index = 0;
|
|
539
|
-
for (const value of iterable) {
|
|
540
|
-
const entry = callback(value, index++);
|
|
541
|
-
if (entry === null) {
|
|
542
|
-
return null;
|
|
543
|
-
}
|
|
544
|
-
result[entry[0]] = entry[1];
|
|
545
|
-
}
|
|
546
|
-
return result;
|
|
547
|
-
}
|
|
548
|
-
function findLast(value, callback) {
|
|
549
|
-
for (let index = value.length - 1; index >= 0; index--) {
|
|
550
|
-
const result = callback(value[index], index);
|
|
551
|
-
if (result != null) {
|
|
552
|
-
return result;
|
|
553
|
-
}
|
|
554
|
-
}
|
|
555
|
-
return null;
|
|
560
|
+
],
|
|
561
|
+
["aria-rowcount", /* @__PURE__ */ new Set(["grid", "table", "treegrid"])],
|
|
562
|
+
["aria-rowindex", /* @__PURE__ */ new Set(["cell", "columnheader", "gridcell", "row", "rowheader"])],
|
|
563
|
+
["aria-rowspan", /* @__PURE__ */ new Set(["cell", "columnheader", "gridcell", "rowheader"])],
|
|
564
|
+
[
|
|
565
|
+
"aria-selected",
|
|
566
|
+
/* @__PURE__ */ new Set(["columnheader", "gridcell", "option", "row", "rowheader", "tab", "treeitem"])
|
|
567
|
+
],
|
|
568
|
+
[
|
|
569
|
+
"aria-setsize",
|
|
570
|
+
/* @__PURE__ */ new Set([
|
|
571
|
+
"article",
|
|
572
|
+
"listitem",
|
|
573
|
+
"menuitem",
|
|
574
|
+
"menuitemcheckbox",
|
|
575
|
+
"menuitemradio",
|
|
576
|
+
"option",
|
|
577
|
+
"radio",
|
|
578
|
+
"row",
|
|
579
|
+
"tab"
|
|
580
|
+
])
|
|
581
|
+
],
|
|
582
|
+
["aria-sort", /* @__PURE__ */ new Set(["columnheader", "rowheader"])],
|
|
583
|
+
[
|
|
584
|
+
"aria-valuemax",
|
|
585
|
+
/* @__PURE__ */ new Set(["meter", "progressbar", "scrollbar", "separator", "slider", "spinbutton"])
|
|
586
|
+
],
|
|
587
|
+
[
|
|
588
|
+
"aria-valuemin",
|
|
589
|
+
/* @__PURE__ */ new Set(["meter", "progressbar", "scrollbar", "separator", "slider", "spinbutton"])
|
|
590
|
+
],
|
|
591
|
+
[
|
|
592
|
+
"aria-valuenow",
|
|
593
|
+
/* @__PURE__ */ new Set(["meter", "progressbar", "scrollbar", "separator", "slider", "spinbutton"])
|
|
594
|
+
],
|
|
595
|
+
[
|
|
596
|
+
"aria-valuetext",
|
|
597
|
+
/* @__PURE__ */ new Set(["meter", "progressbar", "scrollbar", "separator", "slider", "spinbutton"])
|
|
598
|
+
]
|
|
599
|
+
]);
|
|
600
|
+
|
|
601
|
+
// ../../lib/primitive/src/guards/aria/is-aria-attribute.ts
|
|
602
|
+
function isGlobalAriaAttribute(attr) {
|
|
603
|
+
return GLOBAL_ARIA_ATTRIBUTES.has(attr);
|
|
556
604
|
}
|
|
557
|
-
function
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
}
|
|
563
|
-
}
|
|
605
|
+
function isAriaAttributeValidForRole(attr, role) {
|
|
606
|
+
const allowedRoles = ROLE_RESTRICTED_ATTRIBUTES.get(attr);
|
|
607
|
+
if (isUndefined(allowedRoles)) return true;
|
|
608
|
+
if (isUndefined(role)) return false;
|
|
609
|
+
return allowedRoles.has(role);
|
|
564
610
|
}
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
if (node !== null) {
|
|
571
|
-
yield node;
|
|
572
|
-
}
|
|
573
|
-
}
|
|
574
|
-
}
|
|
575
|
-
};
|
|
611
|
+
|
|
612
|
+
// ../../lib/primitive/src/guards/aria/is-aria-role.ts
|
|
613
|
+
function isStrongImplicitRole(tag) {
|
|
614
|
+
if (!(tag in IMPLICIT_ROLE_RECORD)) return false;
|
|
615
|
+
return STRONG_ROLES_SET.has(IMPLICIT_ROLE_RECORD[tag]);
|
|
576
616
|
}
|
|
577
|
-
function
|
|
578
|
-
|
|
617
|
+
function isStandaloneTag(tag) {
|
|
618
|
+
if (!(tag in IMPLICIT_ROLE_RECORD)) return false;
|
|
619
|
+
return STANDALONE_ROLES_SET.has(IMPLICIT_ROLE_RECORD[tag]);
|
|
579
620
|
}
|
|
580
|
-
function
|
|
581
|
-
|
|
621
|
+
function getInputImplicitRole(type) {
|
|
622
|
+
if (!isString(type) || !(type in INPUT_TYPE_ROLE_MAP)) return void 0;
|
|
623
|
+
return INPUT_TYPE_ROLE_MAP[type];
|
|
582
624
|
}
|
|
583
|
-
function
|
|
584
|
-
|
|
625
|
+
function getConditionalImplicitRole(tag, ariaLabel, ariaLabelledBy) {
|
|
626
|
+
const isNamed = isString(ariaLabel) || isString(ariaLabelledBy);
|
|
627
|
+
if (!isNamed) return void 0;
|
|
628
|
+
if (tag === "section") return "region";
|
|
629
|
+
if (tag === "form") return "form";
|
|
630
|
+
return void 0;
|
|
585
631
|
}
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
}
|
|
632
|
+
|
|
633
|
+
// ../../lib/primitive/src/guards/aria/is-known-aria-role.ts
|
|
634
|
+
function isKnownAriaRole(value) {
|
|
635
|
+
return isString(value) && KNOWN_ARIA_ROLES_SET.has(value);
|
|
591
636
|
}
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
637
|
+
|
|
638
|
+
// ../../lib/primitive/src/guards/children/component-id.ts
|
|
639
|
+
var COMPONENT_DEFAULT_TAG = /* @__PURE__ */ Symbol.for("praxis.component-default-tag");
|
|
640
|
+
|
|
641
|
+
// ../../lib/primitive/src/guards/children/is-tag.ts
|
|
642
|
+
function getAsProp(child) {
|
|
643
|
+
if (!isObject(child) || !("props" in child)) return void 0;
|
|
644
|
+
const props = child.props;
|
|
645
|
+
if (!isObject(props)) return void 0;
|
|
646
|
+
const as = props.as;
|
|
647
|
+
return isString(as) && as !== "" ? as : void 0;
|
|
596
648
|
}
|
|
597
|
-
function
|
|
598
|
-
|
|
599
|
-
|
|
649
|
+
function getTag(child) {
|
|
650
|
+
if (!isObject(child) || !("type" in child)) return void 0;
|
|
651
|
+
const t = child.type;
|
|
652
|
+
if (isString(t)) return t;
|
|
653
|
+
if (typeof t === "function" || isObject(t)) {
|
|
654
|
+
const defaultTag = t[COMPONENT_DEFAULT_TAG];
|
|
655
|
+
if (!isString(defaultTag)) return void 0;
|
|
656
|
+
return getAsProp(child) ?? defaultTag;
|
|
600
657
|
}
|
|
658
|
+
return void 0;
|
|
601
659
|
}
|
|
602
|
-
function
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
660
|
+
function isTag(...args) {
|
|
661
|
+
if (isString(args[0])) {
|
|
662
|
+
const set3 = new Set(args);
|
|
663
|
+
return (child2) => {
|
|
664
|
+
const tag2 = getTag(child2);
|
|
665
|
+
return tag2 !== void 0 && set3.has(tag2);
|
|
666
|
+
};
|
|
606
667
|
}
|
|
607
|
-
|
|
668
|
+
const [child, ...tags] = args;
|
|
669
|
+
const set2 = new Set(tags);
|
|
670
|
+
const tag = getTag(child);
|
|
671
|
+
return tag !== void 0 && set2.has(tag);
|
|
608
672
|
}
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
673
|
+
|
|
674
|
+
// ../../lib/adapter-utils/src/invariant.ts
|
|
675
|
+
function panic(message) {
|
|
676
|
+
throw new Error(message);
|
|
613
677
|
}
|
|
614
|
-
function
|
|
615
|
-
|
|
616
|
-
callback(key);
|
|
617
|
-
}
|
|
678
|
+
function invariant(condition, message) {
|
|
679
|
+
if (!condition) panic(message);
|
|
618
680
|
}
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
}
|
|
681
|
+
|
|
682
|
+
// ../../lib/adapter-utils/src/runtime/apply-display-name.ts
|
|
683
|
+
function applyDisplayName(component, name) {
|
|
684
|
+
Object.assign(component, { displayName: name ?? "PolymorphicComponent" });
|
|
623
685
|
}
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
686
|
+
|
|
687
|
+
// ../../lib/adapter-utils/src/runtime/define-component.ts
|
|
688
|
+
function defineContractComponent(options) {
|
|
689
|
+
return (factory) => factory(options);
|
|
628
690
|
}
|
|
629
|
-
var iterate = Object.freeze({
|
|
630
|
-
entries,
|
|
631
|
-
filter,
|
|
632
|
-
find,
|
|
633
|
-
findLast,
|
|
634
|
-
forEach,
|
|
635
|
-
forEachEntry,
|
|
636
|
-
forEachKey,
|
|
637
|
-
forEachSet,
|
|
638
|
-
forEachValue,
|
|
639
|
-
items,
|
|
640
|
-
keys,
|
|
641
|
-
map,
|
|
642
|
-
mapEntries,
|
|
643
|
-
mapValues,
|
|
644
|
-
nodeList,
|
|
645
|
-
reduce,
|
|
646
|
-
collect,
|
|
647
|
-
set,
|
|
648
|
-
some,
|
|
649
|
-
every,
|
|
650
|
-
values
|
|
651
|
-
});
|
|
652
691
|
|
|
653
|
-
// ../../lib/
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
}
|
|
661
|
-
this.#maxSize = maxSize;
|
|
662
|
-
}
|
|
663
|
-
get(key) {
|
|
664
|
-
if (!this.#store.has(key)) return void 0;
|
|
665
|
-
const value = this.#store.get(key);
|
|
666
|
-
this.#store.delete(key);
|
|
667
|
-
this.#store.set(key, value);
|
|
668
|
-
return value;
|
|
669
|
-
}
|
|
670
|
-
set(key, value) {
|
|
671
|
-
this.#store.delete(key);
|
|
672
|
-
this.#store.set(key, value);
|
|
673
|
-
if (this.#store.size > this.#maxSize) {
|
|
674
|
-
const lru = this.#store.keys().next().value;
|
|
675
|
-
if (lru !== void 0) this.#store.delete(lru);
|
|
676
|
-
}
|
|
677
|
-
}
|
|
678
|
-
has(key) {
|
|
679
|
-
return this.#store.has(key);
|
|
680
|
-
}
|
|
681
|
-
delete(key) {
|
|
682
|
-
return this.#store.delete(key);
|
|
683
|
-
}
|
|
684
|
-
get size() {
|
|
685
|
-
return this.#store.size;
|
|
686
|
-
}
|
|
687
|
-
clear() {
|
|
688
|
-
this.#store.clear();
|
|
692
|
+
// ../../lib/contract/src/aria/aria-role-policy.ts
|
|
693
|
+
function getImplicitRole(tag, props) {
|
|
694
|
+
if (tag in IMPLICIT_ROLE_RECORD) return IMPLICIT_ROLE_RECORD[tag];
|
|
695
|
+
if (tag === "input") return getInputImplicitRole(props?.type);
|
|
696
|
+
if (tag === "img") return props?.alt === "" ? "none" : "img";
|
|
697
|
+
if (tag === "section" || tag === "form") {
|
|
698
|
+
return getConditionalImplicitRole(tag, props?.["aria-label"], props?.["aria-labelledby"]);
|
|
689
699
|
}
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
// ../../lib/primitive/src/utils/merge-props.ts
|
|
693
|
-
function mergeProps(defaultProps, props) {
|
|
694
|
-
return {
|
|
695
|
-
...defaultProps ?? {},
|
|
696
|
-
...props
|
|
697
|
-
};
|
|
700
|
+
return void 0;
|
|
698
701
|
}
|
|
699
702
|
|
|
700
703
|
// ../../lib/contract/src/diagnostics/aria.ts
|
|
@@ -1076,7 +1079,7 @@ var InvariantBase = class {
|
|
|
1076
1079
|
};
|
|
1077
1080
|
|
|
1078
1081
|
// ../../lib/contract/src/aria/polymorphic-validator.ts
|
|
1079
|
-
var
|
|
1082
|
+
var NO_VIOLATIONS = [{ valid: true }];
|
|
1080
1083
|
function isIntrinsicTag(tag) {
|
|
1081
1084
|
return isString(tag);
|
|
1082
1085
|
}
|
|
@@ -1118,17 +1121,20 @@ var AriaPolicyEngine = class _AriaPolicyEngine extends InvariantBase {
|
|
|
1118
1121
|
static #deriveContext(tag, props) {
|
|
1119
1122
|
if (!isIntrinsicTag(tag)) return { proceed: false, result: { props, violations: [] } };
|
|
1120
1123
|
const implicitRole = getImplicitRole(tag, props);
|
|
1121
|
-
const hasRole2 = implicitRole
|
|
1124
|
+
const hasRole2 = isNonNull(implicitRole) || isString(props.role) && props.role.length > 0;
|
|
1122
1125
|
if (!hasRole2) return { proceed: false, result: { props, violations: [] } };
|
|
1123
1126
|
const normalized = _AriaPolicyEngine.#normalizeEmptyRole(tag, props);
|
|
1124
|
-
|
|
1125
|
-
const
|
|
1127
|
+
const workingProps = normalized.normalized ? normalized.result.props : props;
|
|
1128
|
+
const preExistingViolations = normalized.normalized ? normalized.result.violations : [];
|
|
1129
|
+
const effectiveRole = workingProps.role ?? implicitRole;
|
|
1126
1130
|
return {
|
|
1127
1131
|
proceed: true,
|
|
1128
1132
|
tag,
|
|
1129
1133
|
implicitRole,
|
|
1130
1134
|
effectiveRole,
|
|
1131
|
-
|
|
1135
|
+
props: workingProps,
|
|
1136
|
+
preExistingViolations,
|
|
1137
|
+
context: { tag, props: workingProps, implicitRole, effectiveRole }
|
|
1132
1138
|
};
|
|
1133
1139
|
}
|
|
1134
1140
|
static #runRules(rules, context) {
|
|
@@ -1143,7 +1149,7 @@ var AriaPolicyEngine = class _AriaPolicyEngine extends InvariantBase {
|
|
|
1143
1149
|
} = context;
|
|
1144
1150
|
const { message, attribute, severity } = result;
|
|
1145
1151
|
const resolvedMessage = message ?? result.diagnostic?.message;
|
|
1146
|
-
const fallbackDiag = resolvedMessage
|
|
1152
|
+
const fallbackDiag = isNonNull(resolvedMessage) ? void 0 : AriaDiagnostics.invalidRole(role, tag);
|
|
1147
1153
|
violations.push({
|
|
1148
1154
|
message: resolvedMessage ?? fallbackDiag.message,
|
|
1149
1155
|
tag,
|
|
@@ -1151,8 +1157,8 @@ var AriaPolicyEngine = class _AriaPolicyEngine extends InvariantBase {
|
|
|
1151
1157
|
attribute,
|
|
1152
1158
|
severity,
|
|
1153
1159
|
phase: "evaluate",
|
|
1154
|
-
...result.diagnostic
|
|
1155
|
-
...fallbackDiag
|
|
1160
|
+
...isNonNull(result.diagnostic) && { diagnostic: result.diagnostic },
|
|
1161
|
+
...isNonNull(fallbackDiag) && { diagnostic: fallbackDiag }
|
|
1156
1162
|
});
|
|
1157
1163
|
if (result.fixable) fixes.push(result.fix);
|
|
1158
1164
|
});
|
|
@@ -1160,7 +1166,7 @@ var AriaPolicyEngine = class _AriaPolicyEngine extends InvariantBase {
|
|
|
1160
1166
|
return { violations, fixes };
|
|
1161
1167
|
}
|
|
1162
1168
|
static #getRules(context) {
|
|
1163
|
-
if (_AriaPolicyEngine.#hasRole(context.props) || context.effectiveRole
|
|
1169
|
+
if (_AriaPolicyEngine.#hasRole(context.props) || isNonNull(context.effectiveRole) && _AriaPolicyEngine.#LIVE_REGION_ROLES.has(context.effectiveRole)) {
|
|
1164
1170
|
return _AriaPolicyEngine.#pipeline;
|
|
1165
1171
|
}
|
|
1166
1172
|
return _AriaPolicyEngine.#implicitOnlyRules;
|
|
@@ -1168,24 +1174,36 @@ var AriaPolicyEngine = class _AriaPolicyEngine extends InvariantBase {
|
|
|
1168
1174
|
static evaluate(tag, props) {
|
|
1169
1175
|
const derived = _AriaPolicyEngine.#deriveContext(tag, props);
|
|
1170
1176
|
if (!derived.proceed) return derived.result;
|
|
1171
|
-
const {
|
|
1177
|
+
const {
|
|
1178
|
+
tag: narrowedTag,
|
|
1179
|
+
implicitRole,
|
|
1180
|
+
context,
|
|
1181
|
+
props: workingProps,
|
|
1182
|
+
preExistingViolations
|
|
1183
|
+
} = derived;
|
|
1172
1184
|
const { violations, fixes } = _AriaPolicyEngine.#runRules(
|
|
1173
1185
|
_AriaPolicyEngine.#getRules(context),
|
|
1174
1186
|
context
|
|
1175
1187
|
);
|
|
1176
|
-
const next = _AriaPolicyEngine.#applyFixes(narrowedTag, implicitRole,
|
|
1177
|
-
return { props: next, violations };
|
|
1188
|
+
const next = _AriaPolicyEngine.#applyFixes(narrowedTag, implicitRole, workingProps, fixes);
|
|
1189
|
+
return { props: next, violations: [...preExistingViolations, ...violations] };
|
|
1178
1190
|
}
|
|
1179
1191
|
static #evaluateWithRules(tag, props, extraRules) {
|
|
1180
1192
|
const derived = _AriaPolicyEngine.#deriveContext(tag, props);
|
|
1181
1193
|
if (!derived.proceed) return derived.result;
|
|
1182
|
-
const {
|
|
1194
|
+
const {
|
|
1195
|
+
tag: narrowedTag,
|
|
1196
|
+
implicitRole,
|
|
1197
|
+
context,
|
|
1198
|
+
props: workingProps,
|
|
1199
|
+
preExistingViolations
|
|
1200
|
+
} = derived;
|
|
1183
1201
|
const { violations, fixes } = _AriaPolicyEngine.#runRules(
|
|
1184
1202
|
[..._AriaPolicyEngine.#getRules(context), ...extraRules],
|
|
1185
1203
|
context
|
|
1186
1204
|
);
|
|
1187
|
-
const next = _AriaPolicyEngine.#applyFixes(narrowedTag, implicitRole,
|
|
1188
|
-
return { props: next, violations };
|
|
1205
|
+
const next = _AriaPolicyEngine.#applyFixes(narrowedTag, implicitRole, workingProps, fixes);
|
|
1206
|
+
return { props: next, violations: [...preExistingViolations, ...violations] };
|
|
1189
1207
|
}
|
|
1190
1208
|
report(violations) {
|
|
1191
1209
|
iterate.forEach(violations, (v) => {
|
|
@@ -1194,12 +1212,12 @@ var AriaPolicyEngine = class _AriaPolicyEngine extends InvariantBase {
|
|
|
1194
1212
|
else this.warn(d);
|
|
1195
1213
|
});
|
|
1196
1214
|
}
|
|
1197
|
-
// Cache key covers only the aria-relevant subset of props (tag + role + aria-* attrs)
|
|
1198
|
-
// Non-aria props (className, onClick, etc.) do
|
|
1199
|
-
// so cache hits survive re-renders
|
|
1200
|
-
//
|
|
1201
|
-
//
|
|
1202
|
-
//
|
|
1215
|
+
// Cache key covers only the aria-relevant subset of props (tag + role + aria-* attrs) —
|
|
1216
|
+
// exactly what the built-in pipeline reads. Non-aria props (className, onClick, etc.) do
|
|
1217
|
+
// not affect built-in ARIA decisions and are excluded so cache hits survive re-renders
|
|
1218
|
+
// that only change non-aria props. This key alone is unsound for #extraRules, which may
|
|
1219
|
+
// read arbitrary props outside this set — validate() extends it with #extraRulesKeySuffix,
|
|
1220
|
+
// or bypasses the cache, to account for that.
|
|
1203
1221
|
static #createPlanKey(tag, props) {
|
|
1204
1222
|
if (!isIntrinsicTag(tag)) return null;
|
|
1205
1223
|
const parts = [tag];
|
|
@@ -1215,6 +1233,23 @@ var AriaPolicyEngine = class _AriaPolicyEngine extends InvariantBase {
|
|
|
1215
1233
|
if (ariaEntries.length > 0) parts.push(...ariaEntries.sort());
|
|
1216
1234
|
return parts.join("|");
|
|
1217
1235
|
}
|
|
1236
|
+
// Extends the base cache key with the props each extra rule declares it reads (`readsProps`).
|
|
1237
|
+
// Returns null — meaning "don't cache" — if any extra rule omits `readsProps` (it may read
|
|
1238
|
+
// arbitrary props the key can't account for) or if a declared prop's value isn't a primitive
|
|
1239
|
+
// (object/array identity isn't stably representable in a string key).
|
|
1240
|
+
static #extraRulesKeySuffix(extraRules, props) {
|
|
1241
|
+
const parts = [];
|
|
1242
|
+
for (const rule of extraRules) {
|
|
1243
|
+
const readsProps = rule.readsProps;
|
|
1244
|
+
if (!isNonNull(readsProps)) return null;
|
|
1245
|
+
for (const propKey of readsProps) {
|
|
1246
|
+
const v = props[propKey];
|
|
1247
|
+
if (v !== void 0 && !isString(v) && !isNumber(v) && typeof v !== "boolean") return null;
|
|
1248
|
+
parts.push(`x:${propKey}:${String(v)}`);
|
|
1249
|
+
}
|
|
1250
|
+
}
|
|
1251
|
+
return parts.sort().join("|");
|
|
1252
|
+
}
|
|
1218
1253
|
static #computePlan(inputProps, resultProps) {
|
|
1219
1254
|
const removals = /* @__PURE__ */ new Set();
|
|
1220
1255
|
const updates = {};
|
|
@@ -1238,7 +1273,12 @@ var AriaPolicyEngine = class _AriaPolicyEngine extends InvariantBase {
|
|
|
1238
1273
|
return next;
|
|
1239
1274
|
}
|
|
1240
1275
|
validate(tag, props) {
|
|
1241
|
-
const
|
|
1276
|
+
const baseKey = _AriaPolicyEngine.#createPlanKey(tag, props);
|
|
1277
|
+
let key = baseKey;
|
|
1278
|
+
if (this.#extraRules.length > 0) {
|
|
1279
|
+
const suffix = _AriaPolicyEngine.#extraRulesKeySuffix(this.#extraRules, props);
|
|
1280
|
+
key = isNonNull(baseKey) && isNonNull(suffix) ? `${baseKey}|${suffix}` : null;
|
|
1281
|
+
}
|
|
1242
1282
|
if (!isNull(key)) {
|
|
1243
1283
|
const cached = this.#planCache.get(key);
|
|
1244
1284
|
if (cached !== void 0) {
|
|
@@ -1328,7 +1368,7 @@ var AriaPolicyEngine = class _AriaPolicyEngine extends InvariantBase {
|
|
|
1328
1368
|
implicitRole
|
|
1329
1369
|
}) {
|
|
1330
1370
|
const role = props.role;
|
|
1331
|
-
if (!implicitRole || !role || role === implicitRole) return
|
|
1371
|
+
if (!implicitRole || !role || role === implicitRole) return NO_VIOLATIONS;
|
|
1332
1372
|
if (isStrongImplicitRole(tag) && role === "region") {
|
|
1333
1373
|
return [
|
|
1334
1374
|
{
|
|
@@ -1340,11 +1380,11 @@ var AriaPolicyEngine = class _AriaPolicyEngine extends InvariantBase {
|
|
|
1340
1380
|
}
|
|
1341
1381
|
];
|
|
1342
1382
|
}
|
|
1343
|
-
return
|
|
1383
|
+
return NO_VIOLATIONS;
|
|
1344
1384
|
}
|
|
1345
1385
|
static #checkRedundantRole({ tag, props, implicitRole }) {
|
|
1346
1386
|
const role = props.role;
|
|
1347
|
-
if (!implicitRole || !role || role !== implicitRole) return
|
|
1387
|
+
if (!implicitRole || !role || role !== implicitRole) return NO_VIOLATIONS;
|
|
1348
1388
|
return [
|
|
1349
1389
|
{
|
|
1350
1390
|
valid: false,
|
|
@@ -1357,8 +1397,8 @@ var AriaPolicyEngine = class _AriaPolicyEngine extends InvariantBase {
|
|
|
1357
1397
|
}
|
|
1358
1398
|
static #checkStandaloneRegion({ tag, props, implicitRole }) {
|
|
1359
1399
|
const role = props.role;
|
|
1360
|
-
if (role !== "region") return
|
|
1361
|
-
if (!isStandaloneTag(tag)) return
|
|
1400
|
+
if (role !== "region") return NO_VIOLATIONS;
|
|
1401
|
+
if (!isStandaloneTag(tag)) return NO_VIOLATIONS;
|
|
1362
1402
|
return [
|
|
1363
1403
|
{
|
|
1364
1404
|
valid: false,
|
|
@@ -1374,7 +1414,7 @@ var AriaPolicyEngine = class _AriaPolicyEngine extends InvariantBase {
|
|
|
1374
1414
|
props,
|
|
1375
1415
|
effectiveRole
|
|
1376
1416
|
}) {
|
|
1377
|
-
if (effectiveRole === "none" || effectiveRole === "presentation") return
|
|
1417
|
+
if (effectiveRole === "none" || effectiveRole === "presentation") return NO_VIOLATIONS;
|
|
1378
1418
|
const results = [];
|
|
1379
1419
|
iterate.forEachEntry(props, (key) => {
|
|
1380
1420
|
if (!key.startsWith("aria-")) return;
|
|
@@ -1492,12 +1532,12 @@ var AriaPolicyEngine = class _AriaPolicyEngine extends InvariantBase {
|
|
|
1492
1532
|
}
|
|
1493
1533
|
}
|
|
1494
1534
|
static #checkAriaAttributeValues({ props, effectiveRole }) {
|
|
1495
|
-
if (effectiveRole === "none" || effectiveRole === "presentation") return
|
|
1535
|
+
if (effectiveRole === "none" || effectiveRole === "presentation") return NO_VIOLATIONS;
|
|
1496
1536
|
const results = [];
|
|
1497
1537
|
iterate.forEachEntry(props, (key, value) => {
|
|
1498
1538
|
if (!key.startsWith("aria-")) return;
|
|
1499
1539
|
const type = _AriaPolicyEngine.#ARIA_VALUE_TYPES.get(key);
|
|
1500
|
-
if (type
|
|
1540
|
+
if (!isNonNull(type)) return;
|
|
1501
1541
|
if (_AriaPolicyEngine.#isValidAriaValue(value, type)) return;
|
|
1502
1542
|
results.push({
|
|
1503
1543
|
valid: false,
|
|
@@ -1528,13 +1568,13 @@ var AriaPolicyEngine = class _AriaPolicyEngine extends InvariantBase {
|
|
|
1528
1568
|
props,
|
|
1529
1569
|
effectiveRole
|
|
1530
1570
|
}) {
|
|
1531
|
-
if (effectiveRole === "none" || effectiveRole === "presentation") return
|
|
1571
|
+
if (effectiveRole === "none" || effectiveRole === "presentation") return NO_VIOLATIONS;
|
|
1532
1572
|
const implicitLevel = _AriaPolicyEngine.#HEADING_IMPLICIT_LEVELS.get(tag);
|
|
1533
|
-
if (implicitLevel
|
|
1573
|
+
if (!isNonNull(implicitLevel)) return NO_VIOLATIONS;
|
|
1534
1574
|
const raw = props["aria-level"];
|
|
1535
|
-
if (raw
|
|
1575
|
+
if (!isNonNull(raw)) return NO_VIOLATIONS;
|
|
1536
1576
|
const n = typeof raw === "number" ? raw : typeof raw === "string" ? parseInt(raw, 10) : NaN;
|
|
1537
|
-
if (!Number.isFinite(n) || n !== implicitLevel) return
|
|
1577
|
+
if (!Number.isFinite(n) || n !== implicitLevel) return NO_VIOLATIONS;
|
|
1538
1578
|
return [
|
|
1539
1579
|
{
|
|
1540
1580
|
valid: false,
|
|
@@ -1557,9 +1597,10 @@ var AriaPolicyEngine = class _AriaPolicyEngine extends InvariantBase {
|
|
|
1557
1597
|
props,
|
|
1558
1598
|
effectiveRole
|
|
1559
1599
|
}) {
|
|
1560
|
-
if (!effectiveRole || !_AriaPolicyEngine.#NAME_REQUIRED_ROLES.has(effectiveRole))
|
|
1561
|
-
|
|
1562
|
-
if (
|
|
1600
|
+
if (!effectiveRole || !_AriaPolicyEngine.#NAME_REQUIRED_ROLES.has(effectiveRole))
|
|
1601
|
+
return NO_VIOLATIONS;
|
|
1602
|
+
if ("aria-label" in props || "aria-labelledby" in props) return NO_VIOLATIONS;
|
|
1603
|
+
if (tag === "img" && typeof props.alt === "string" && props.alt.length > 0) return NO_VIOLATIONS;
|
|
1563
1604
|
return [
|
|
1564
1605
|
{
|
|
1565
1606
|
valid: false,
|
|
@@ -1582,9 +1623,9 @@ var AriaPolicyEngine = class _AriaPolicyEngine extends InvariantBase {
|
|
|
1582
1623
|
props,
|
|
1583
1624
|
effectiveRole
|
|
1584
1625
|
}) {
|
|
1585
|
-
if (!effectiveRole) return
|
|
1626
|
+
if (!effectiveRole) return NO_VIOLATIONS;
|
|
1586
1627
|
const required = _AriaPolicyEngine.#REQUIRED_PROPERTIES.get(effectiveRole);
|
|
1587
|
-
if (required
|
|
1628
|
+
if (!isNonNull(required)) return NO_VIOLATIONS;
|
|
1588
1629
|
const results = [];
|
|
1589
1630
|
iterate.forEach(required, (attr) => {
|
|
1590
1631
|
if (attr in props) return;
|
|
@@ -1608,12 +1649,12 @@ var AriaPolicyEngine = class _AriaPolicyEngine extends InvariantBase {
|
|
|
1608
1649
|
]);
|
|
1609
1650
|
// WAI-ARIA 1.2 §6.6: aria-hidden="true" must not be placed on focusable elements.
|
|
1610
1651
|
static #checkAriaHiddenOnFocusable({ tag, props }) {
|
|
1611
|
-
if (props["aria-hidden"] !== "true" && props["aria-hidden"] !== true) return
|
|
1652
|
+
if (props["aria-hidden"] !== "true" && props["aria-hidden"] !== true) return NO_VIOLATIONS;
|
|
1612
1653
|
const isInteractive = _AriaPolicyEngine.#INTERACTIVE_TAGS.has(tag);
|
|
1613
1654
|
if (!isInteractive) {
|
|
1614
1655
|
const tabindex = props.tabindex;
|
|
1615
1656
|
const n = typeof tabindex === "number" ? tabindex : typeof tabindex === "string" ? parseInt(tabindex, 10) : NaN;
|
|
1616
|
-
if (!Number.isFinite(n) || n < 0) return
|
|
1657
|
+
if (!Number.isFinite(n) || n < 0) return NO_VIOLATIONS;
|
|
1617
1658
|
}
|
|
1618
1659
|
return [
|
|
1619
1660
|
{
|
|
@@ -1632,7 +1673,7 @@ var AriaPolicyEngine = class _AriaPolicyEngine extends InvariantBase {
|
|
|
1632
1673
|
props,
|
|
1633
1674
|
effectiveRole
|
|
1634
1675
|
}) {
|
|
1635
|
-
if (effectiveRole !== "none" && effectiveRole !== "presentation") return
|
|
1676
|
+
if (effectiveRole !== "none" && effectiveRole !== "presentation") return NO_VIOLATIONS;
|
|
1636
1677
|
const results = [];
|
|
1637
1678
|
iterate.forEachEntry(props, (key) => {
|
|
1638
1679
|
if (!key.startsWith("aria-")) return;
|
|
@@ -1656,10 +1697,10 @@ var AriaPolicyEngine = class _AriaPolicyEngine extends InvariantBase {
|
|
|
1656
1697
|
["timer", "off"]
|
|
1657
1698
|
]);
|
|
1658
1699
|
static #checkMissingLiveRegion({ effectiveRole, props }) {
|
|
1659
|
-
if (!effectiveRole) return
|
|
1700
|
+
if (!effectiveRole) return NO_VIOLATIONS;
|
|
1660
1701
|
const impliedLive = _AriaPolicyEngine.#LIVE_REGION_ROLES.get(effectiveRole);
|
|
1661
|
-
if (!impliedLive) return
|
|
1662
|
-
if ("aria-live" in props) return
|
|
1702
|
+
if (!impliedLive) return NO_VIOLATIONS;
|
|
1703
|
+
if ("aria-live" in props) return NO_VIOLATIONS;
|
|
1663
1704
|
const injectLive = {
|
|
1664
1705
|
kind: `injectLive:${effectiveRole}`,
|
|
1665
1706
|
apply: (ctx) => ({
|
|
@@ -1679,8 +1720,9 @@ var AriaPolicyEngine = class _AriaPolicyEngine extends InvariantBase {
|
|
|
1679
1720
|
];
|
|
1680
1721
|
}
|
|
1681
1722
|
static #checkMissingAtomic({ effectiveRole, props }) {
|
|
1682
|
-
if (!effectiveRole || !_AriaPolicyEngine.#LIVE_REGION_ROLES.has(effectiveRole))
|
|
1683
|
-
|
|
1723
|
+
if (!effectiveRole || !_AriaPolicyEngine.#LIVE_REGION_ROLES.has(effectiveRole))
|
|
1724
|
+
return NO_VIOLATIONS;
|
|
1725
|
+
if ("aria-atomic" in props) return NO_VIOLATIONS;
|
|
1684
1726
|
return [
|
|
1685
1727
|
{
|
|
1686
1728
|
valid: false,
|
|
@@ -1704,8 +1746,8 @@ var AriaPolicyEngine = class _AriaPolicyEngine extends InvariantBase {
|
|
|
1704
1746
|
};
|
|
1705
1747
|
static #checkInvalidAriaRelevant({ props }) {
|
|
1706
1748
|
const relevant = props["aria-relevant"];
|
|
1707
|
-
if (relevant === void 0) return
|
|
1708
|
-
if (typeof relevant !== "string") return
|
|
1749
|
+
if (relevant === void 0) return NO_VIOLATIONS;
|
|
1750
|
+
if (typeof relevant !== "string") return NO_VIOLATIONS;
|
|
1709
1751
|
const tokens = relevant.trim().split(/\s+/);
|
|
1710
1752
|
const invalid = tokens.filter((t) => !_AriaPolicyEngine.#VALID_RELEVANT_TOKENS.has(t));
|
|
1711
1753
|
if (invalid.length > 0) {
|
|
@@ -1732,7 +1774,7 @@ var AriaPolicyEngine = class _AriaPolicyEngine extends InvariantBase {
|
|
|
1732
1774
|
}
|
|
1733
1775
|
];
|
|
1734
1776
|
}
|
|
1735
|
-
return
|
|
1777
|
+
return NO_VIOLATIONS;
|
|
1736
1778
|
}
|
|
1737
1779
|
};
|
|
1738
1780
|
|
|
@@ -2433,7 +2475,7 @@ function createClassPipeline(resolved) {
|
|
|
2433
2475
|
const staticClasses = staticResolver.resolve(tag, recipe !== void 0);
|
|
2434
2476
|
const variantClasses = variantResolver.resolve({ props, recipe });
|
|
2435
2477
|
if (!className)
|
|
2436
|
-
return staticClasses && variantClasses ? `${staticClasses} ${variantClasses}` : staticClasses || variantClasses;
|
|
2478
|
+
return (staticClasses && variantClasses ? `${staticClasses} ${variantClasses}` : staticClasses || variantClasses) || void 0;
|
|
2437
2479
|
return cn(staticClasses, variantClasses, className);
|
|
2438
2480
|
};
|
|
2439
2481
|
}
|
|
@@ -2473,7 +2515,10 @@ function resolveFactoryOptions(options = {}) {
|
|
|
2473
2515
|
const variantKeys = styling?.variants === void 0 ? EMPTY_VARIANT_KEYS : new Set(Object.keys(styling.variants));
|
|
2474
2516
|
return Object.freeze({
|
|
2475
2517
|
defaultTag: options.tag ?? "div",
|
|
2476
|
-
diagnostics: resolveDiagnostics(
|
|
2518
|
+
diagnostics: resolveDiagnostics(
|
|
2519
|
+
enforcement?.diagnostics,
|
|
2520
|
+
options.diagnostics ?? silentDiagnostics
|
|
2521
|
+
),
|
|
2477
2522
|
variantKeys,
|
|
2478
2523
|
...whenDefined("displayName", options.name),
|
|
2479
2524
|
...whenDefined("defaultProps", options.defaults),
|
|
@@ -2644,7 +2689,7 @@ function createPolymorphic2(options = {}) {
|
|
|
2644
2689
|
if (process.env.NODE_ENV !== "production") {
|
|
2645
2690
|
validateRenderProps(resolved.diagnostics, resolved, props, recipe);
|
|
2646
2691
|
}
|
|
2647
|
-
return classPipeline(tag, props, className, recipe);
|
|
2692
|
+
return classPipeline(tag, props, className, recipe) || void 0;
|
|
2648
2693
|
},
|
|
2649
2694
|
resolveAria(tag, props) {
|
|
2650
2695
|
return resolveAriaFn(tag, props);
|
|
@@ -2861,7 +2906,10 @@ function buildElementProps(props, className) {
|
|
|
2861
2906
|
const { role, ...rest } = props;
|
|
2862
2907
|
return {
|
|
2863
2908
|
...normalizeListenerKeys(rest),
|
|
2864
|
-
class:
|
|
2909
|
+
// Vue's SSR renderer and its client-side patcher disagree on `class: undefined` — SSR's
|
|
2910
|
+
// normalizeClass turns it into '' and still emits class="", while the client patcher
|
|
2911
|
+
// removes the attribute outright. Omitting the key entirely keeps both paths consistent.
|
|
2912
|
+
...className !== void 0 && { class: className },
|
|
2865
2913
|
...isKnownAriaRole(role) && { role }
|
|
2866
2914
|
};
|
|
2867
2915
|
}
|
|
@@ -2882,7 +2930,10 @@ function validateSlotDirectives(directives, validator) {
|
|
|
2882
2930
|
function tryRenderAsChild(state, children, discarded, validator) {
|
|
2883
2931
|
if (!validateSlotDirectives(state.directives, validator)) return null;
|
|
2884
2932
|
if (discarded > 0) validator.warnDiscardedChildren(discarded);
|
|
2885
|
-
const attrs = {
|
|
2933
|
+
const attrs = {
|
|
2934
|
+
...pickAttributes(state.props),
|
|
2935
|
+
...state.className !== void 0 && { class: state.className }
|
|
2936
|
+
};
|
|
2886
2937
|
const slottable = extractSlottable(children);
|
|
2887
2938
|
if (slottable) return slottable.rebuild(cloneVNode(slottable.child, attrs));
|
|
2888
2939
|
if (children.length === 1 && children[0] !== void 0) {
|