praxis-kit 4.0.1 → 4.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_shared/diagnostics.d.ts +209 -0
- package/dist/_shared/diagnostics.js +289 -0
- package/dist/{chunk-TJRHF6MS.js → chunk-LA6WGQA6.js} +1023 -822
- package/dist/codemod/index.js +23 -15
- package/dist/contract/index.d.ts +46 -173
- package/dist/eslint/index.js +21 -17
- package/dist/lit/index.d.ts +44 -173
- package/dist/lit/index.js +705 -598
- package/dist/preact/index.d.ts +47 -174
- package/dist/preact/index.js +1077 -886
- package/dist/react/index.d.ts +25 -11
- package/dist/react/index.js +21 -143
- package/dist/react/legacy.d.ts +4 -3
- package/dist/react/legacy.js +28 -147
- package/dist/{merge-refs-CEpa0zK1.d.ts → react-options-XrRof248.d.ts} +170 -255
- package/dist/solid/index.d.ts +47 -174
- package/dist/solid/index.js +630 -538
- package/dist/svelte/index.d.ts +57 -177
- package/dist/svelte/index.js +609 -534
- package/dist/tailwind/index.d.ts +23 -157
- package/dist/tailwind/index.js +11 -119
- package/dist/vite-plugin/index.d.ts +10 -12
- package/dist/vue/index.d.ts +47 -174
- package/dist/vue/index.js +969 -897
- package/dist/web/index.d.ts +45 -174
- package/dist/web/index.js +707 -594
- package/package.json +6 -6
package/dist/vue/index.js
CHANGED
|
@@ -1,18 +1,8 @@
|
|
|
1
1
|
// ../../adapters/vue/src/create-contract-component.ts
|
|
2
|
-
import {
|
|
2
|
+
import { computed, defineComponent as defineComponent2 } from "vue";
|
|
3
3
|
|
|
4
|
-
// ../../lib/
|
|
5
|
-
|
|
6
|
-
throw new Error(message);
|
|
7
|
-
}
|
|
8
|
-
function invariant(condition, message) {
|
|
9
|
-
if (!condition) panic(message);
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
// ../../lib/adapter-utils/src/apply-display-name.ts
|
|
13
|
-
function applyDisplayName(component, name) {
|
|
14
|
-
Object.assign(component, { displayName: name ?? "PolymorphicComponent" });
|
|
15
|
-
}
|
|
4
|
+
// ../../lib/primitive/src/guards/children/component-id.ts
|
|
5
|
+
var COMPONENT_DEFAULT_TAG = /* @__PURE__ */ Symbol.for("praxis.component-default-tag");
|
|
16
6
|
|
|
17
7
|
// ../../lib/primitive/src/utils/is-object.ts
|
|
18
8
|
function isObject(value, excludeArrays = false) {
|
|
@@ -26,185 +16,66 @@ function isNumber(value) {
|
|
|
26
16
|
return typeof value === "number";
|
|
27
17
|
}
|
|
28
18
|
|
|
29
|
-
// ../../lib/primitive/src/
|
|
30
|
-
function
|
|
31
|
-
return
|
|
19
|
+
// ../../lib/primitive/src/guards/foundational/is-defined.ts
|
|
20
|
+
function isUndefined(value) {
|
|
21
|
+
return value === void 0;
|
|
32
22
|
}
|
|
33
23
|
|
|
34
|
-
// ../../lib/primitive/src/
|
|
35
|
-
function
|
|
36
|
-
|
|
24
|
+
// ../../lib/primitive/src/guards/foundational/is-null.ts
|
|
25
|
+
function isNull(value) {
|
|
26
|
+
return value === null;
|
|
37
27
|
}
|
|
38
28
|
|
|
39
|
-
// ../../lib/primitive/src/
|
|
40
|
-
function
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
}
|
|
47
|
-
return null;
|
|
48
|
-
}
|
|
49
|
-
function some(iterable, predicate) {
|
|
50
|
-
for (const value of iterable) {
|
|
51
|
-
if (predicate(value)) return true;
|
|
52
|
-
}
|
|
53
|
-
return false;
|
|
54
|
-
}
|
|
55
|
-
function every(iterable, predicate) {
|
|
56
|
-
let index = 0;
|
|
57
|
-
for (const value of iterable) {
|
|
58
|
-
if (!predicate(value, index++)) {
|
|
59
|
-
return false;
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
return true;
|
|
63
|
-
}
|
|
64
|
-
function* filter(iterable, predicate) {
|
|
65
|
-
let index = 0;
|
|
66
|
-
for (const value of iterable) {
|
|
67
|
-
if (predicate(value, index++)) {
|
|
68
|
-
yield value;
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
function* map(iterable, callback) {
|
|
73
|
-
let index = 0;
|
|
74
|
-
for (const value of iterable) {
|
|
75
|
-
yield callback(value, index++);
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
function forEach(iterable, callback) {
|
|
79
|
-
let index = 0;
|
|
80
|
-
for (const value of iterable) {
|
|
81
|
-
callback(value, index++);
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
function reduce(iterable, initial, callback) {
|
|
85
|
-
let accumulator = initial;
|
|
86
|
-
let index = 0;
|
|
87
|
-
for (const value of iterable) {
|
|
88
|
-
accumulator = callback(accumulator, value, index++);
|
|
89
|
-
}
|
|
90
|
-
return accumulator;
|
|
91
|
-
}
|
|
92
|
-
function collect(iterable, callback) {
|
|
93
|
-
const result = {};
|
|
94
|
-
let index = 0;
|
|
95
|
-
for (const value of iterable) {
|
|
96
|
-
const entry = callback(value, index++);
|
|
97
|
-
if (entry === null) {
|
|
98
|
-
return null;
|
|
99
|
-
}
|
|
100
|
-
result[entry[0]] = entry[1];
|
|
101
|
-
}
|
|
102
|
-
return result;
|
|
103
|
-
}
|
|
104
|
-
function findLast(value, callback) {
|
|
105
|
-
for (let index = value.length - 1; index >= 0; index--) {
|
|
106
|
-
const result = callback(value[index], index);
|
|
107
|
-
if (result != null) {
|
|
108
|
-
return result;
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
return null;
|
|
112
|
-
}
|
|
113
|
-
function* items(collection) {
|
|
114
|
-
for (let i = 0; i < collection.length; i++) {
|
|
115
|
-
const item = collection.item(i);
|
|
116
|
-
if (item !== null) {
|
|
117
|
-
yield item;
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
function nodeList(list) {
|
|
122
|
-
return {
|
|
123
|
-
*[Symbol.iterator]() {
|
|
124
|
-
for (let i = 0; i < list.length; i++) {
|
|
125
|
-
const node = list.item(i);
|
|
126
|
-
if (node !== null) {
|
|
127
|
-
yield node;
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
};
|
|
132
|
-
}
|
|
133
|
-
function mapEntries(m) {
|
|
134
|
-
return m.entries();
|
|
135
|
-
}
|
|
136
|
-
function set(s) {
|
|
137
|
-
return s.values();
|
|
138
|
-
}
|
|
139
|
-
function hasOwn(object, key) {
|
|
140
|
-
return Object.hasOwn(object, key);
|
|
141
|
-
}
|
|
142
|
-
function* entries(object) {
|
|
143
|
-
for (const key in object) {
|
|
144
|
-
if (!hasOwn(object, key)) continue;
|
|
145
|
-
yield [key, object[key]];
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
function* keys(object) {
|
|
149
|
-
for (const [key] of entries(object)) {
|
|
150
|
-
yield key;
|
|
151
|
-
}
|
|
29
|
+
// ../../lib/primitive/src/guards/children/is-tag.ts
|
|
30
|
+
function getAsProp(child) {
|
|
31
|
+
if (!isObject(child) || !("props" in child)) return void 0;
|
|
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;
|
|
152
36
|
}
|
|
153
|
-
function
|
|
154
|
-
|
|
155
|
-
|
|
37
|
+
function getTag(child) {
|
|
38
|
+
if (!isObject(child) || !("type" in child)) return void 0;
|
|
39
|
+
const t = child.type;
|
|
40
|
+
if (isString(t)) return t;
|
|
41
|
+
if (typeof t === "function" || isObject(t)) {
|
|
42
|
+
const defaultTag = t[COMPONENT_DEFAULT_TAG];
|
|
43
|
+
if (!isString(defaultTag)) return void 0;
|
|
44
|
+
return getAsProp(child) ?? defaultTag;
|
|
156
45
|
}
|
|
46
|
+
return void 0;
|
|
157
47
|
}
|
|
158
|
-
function
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
48
|
+
function isTag(...args) {
|
|
49
|
+
if (isString(args[0])) {
|
|
50
|
+
const set3 = new Set(args);
|
|
51
|
+
return (child2) => {
|
|
52
|
+
const tag2 = getTag(child2);
|
|
53
|
+
return tag2 !== void 0 && set3.has(tag2);
|
|
54
|
+
};
|
|
162
55
|
}
|
|
163
|
-
|
|
56
|
+
const [child, ...tags] = args;
|
|
57
|
+
const set2 = new Set(tags);
|
|
58
|
+
const tag = getTag(child);
|
|
59
|
+
return tag !== void 0 && set2.has(tag);
|
|
164
60
|
}
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
61
|
+
|
|
62
|
+
// ../../lib/adapter-utils/src/invariant.ts
|
|
63
|
+
function panic(message) {
|
|
64
|
+
throw new Error(message);
|
|
169
65
|
}
|
|
170
|
-
function
|
|
171
|
-
|
|
172
|
-
callback(key);
|
|
173
|
-
}
|
|
66
|
+
function invariant(condition, message) {
|
|
67
|
+
if (!condition) panic(message);
|
|
174
68
|
}
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
}
|
|
69
|
+
|
|
70
|
+
// ../../lib/adapter-utils/src/runtime/apply-display-name.ts
|
|
71
|
+
function applyDisplayName(component, name) {
|
|
72
|
+
Object.assign(component, { displayName: name ?? "PolymorphicComponent" });
|
|
179
73
|
}
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
74
|
+
|
|
75
|
+
// ../../lib/adapter-utils/src/runtime/define-component.ts
|
|
76
|
+
function defineContractComponent(options) {
|
|
77
|
+
return (factory) => factory(options);
|
|
184
78
|
}
|
|
185
|
-
var iterate = Object.freeze({
|
|
186
|
-
entries,
|
|
187
|
-
filter,
|
|
188
|
-
find,
|
|
189
|
-
findLast,
|
|
190
|
-
forEach,
|
|
191
|
-
forEachEntry,
|
|
192
|
-
forEachKey,
|
|
193
|
-
forEachSet,
|
|
194
|
-
forEachValue,
|
|
195
|
-
items,
|
|
196
|
-
keys,
|
|
197
|
-
map,
|
|
198
|
-
mapEntries,
|
|
199
|
-
mapValues,
|
|
200
|
-
nodeList,
|
|
201
|
-
reduce,
|
|
202
|
-
collect,
|
|
203
|
-
set,
|
|
204
|
-
some,
|
|
205
|
-
every,
|
|
206
|
-
values
|
|
207
|
-
});
|
|
208
79
|
|
|
209
80
|
// ../../lib/primitive/src/constants/aria/global-aria-attributes.ts
|
|
210
81
|
var GLOBAL_ARIA_ATTRIBUTES = /* @__PURE__ */ new Set([
|
|
@@ -228,7 +99,7 @@ var GLOBAL_ARIA_ATTRIBUTES = /* @__PURE__ */ new Set([
|
|
|
228
99
|
]);
|
|
229
100
|
|
|
230
101
|
// ../../lib/primitive/src/constants/aria/implicit-role-record.ts
|
|
231
|
-
var IMPLICIT_ROLE_RECORD = {
|
|
102
|
+
var IMPLICIT_ROLE_RECORD = Object.freeze({
|
|
232
103
|
// Landmarks
|
|
233
104
|
article: "article",
|
|
234
105
|
aside: "complementary",
|
|
@@ -264,8 +135,8 @@ var IMPLICIT_ROLE_RECORD = {
|
|
|
264
135
|
meter: "meter",
|
|
265
136
|
output: "status",
|
|
266
137
|
progress: "progressbar"
|
|
267
|
-
};
|
|
268
|
-
var INPUT_TYPE_ROLE_MAP = {
|
|
138
|
+
});
|
|
139
|
+
var INPUT_TYPE_ROLE_MAP = Object.freeze({
|
|
269
140
|
checkbox: "checkbox",
|
|
270
141
|
radio: "radio",
|
|
271
142
|
range: "slider",
|
|
@@ -279,18 +150,106 @@ var INPUT_TYPE_ROLE_MAP = {
|
|
|
279
150
|
submit: "button",
|
|
280
151
|
reset: "button",
|
|
281
152
|
image: "button"
|
|
282
|
-
};
|
|
283
|
-
var STRONG_ROLES = [
|
|
153
|
+
});
|
|
154
|
+
var STRONG_ROLES = Object.freeze([
|
|
284
155
|
"main",
|
|
285
156
|
"navigation",
|
|
286
157
|
"complementary",
|
|
287
158
|
"contentinfo",
|
|
288
159
|
"banner"
|
|
289
|
-
];
|
|
290
|
-
var STANDALONE_ROLES = [
|
|
160
|
+
]);
|
|
161
|
+
var STANDALONE_ROLES = Object.freeze([
|
|
162
|
+
"article"
|
|
163
|
+
]);
|
|
291
164
|
var STRONG_ROLES_SET = new Set(STRONG_ROLES);
|
|
292
165
|
var STANDALONE_ROLES_SET = new Set(STANDALONE_ROLES);
|
|
293
166
|
|
|
167
|
+
// ../../lib/primitive/src/constants/aria/known-aria-roles.ts
|
|
168
|
+
var KNOWN_ARIA_ROLES = Object.freeze([
|
|
169
|
+
"alert",
|
|
170
|
+
"alertdialog",
|
|
171
|
+
"application",
|
|
172
|
+
"article",
|
|
173
|
+
"banner",
|
|
174
|
+
"blockquote",
|
|
175
|
+
"button",
|
|
176
|
+
"caption",
|
|
177
|
+
"cell",
|
|
178
|
+
"checkbox",
|
|
179
|
+
"code",
|
|
180
|
+
"columnheader",
|
|
181
|
+
"combobox",
|
|
182
|
+
"complementary",
|
|
183
|
+
"contentinfo",
|
|
184
|
+
"definition",
|
|
185
|
+
"deletion",
|
|
186
|
+
"dialog",
|
|
187
|
+
"document",
|
|
188
|
+
"emphasis",
|
|
189
|
+
"feed",
|
|
190
|
+
"figure",
|
|
191
|
+
"form",
|
|
192
|
+
"generic",
|
|
193
|
+
"grid",
|
|
194
|
+
"gridcell",
|
|
195
|
+
"group",
|
|
196
|
+
"heading",
|
|
197
|
+
"img",
|
|
198
|
+
"insertion",
|
|
199
|
+
"link",
|
|
200
|
+
"list",
|
|
201
|
+
"listbox",
|
|
202
|
+
"listitem",
|
|
203
|
+
"log",
|
|
204
|
+
"main",
|
|
205
|
+
"marquee",
|
|
206
|
+
"math",
|
|
207
|
+
"menu",
|
|
208
|
+
"menubar",
|
|
209
|
+
"menuitem",
|
|
210
|
+
"menuitemcheckbox",
|
|
211
|
+
"menuitemradio",
|
|
212
|
+
"meter",
|
|
213
|
+
"navigation",
|
|
214
|
+
"none",
|
|
215
|
+
"note",
|
|
216
|
+
"option",
|
|
217
|
+
"paragraph",
|
|
218
|
+
"presentation",
|
|
219
|
+
"progressbar",
|
|
220
|
+
"radio",
|
|
221
|
+
"radiogroup",
|
|
222
|
+
"region",
|
|
223
|
+
"row",
|
|
224
|
+
"rowgroup",
|
|
225
|
+
"rowheader",
|
|
226
|
+
"scrollbar",
|
|
227
|
+
"search",
|
|
228
|
+
"searchbox",
|
|
229
|
+
"separator",
|
|
230
|
+
"slider",
|
|
231
|
+
"spinbutton",
|
|
232
|
+
"status",
|
|
233
|
+
"strong",
|
|
234
|
+
"subscript",
|
|
235
|
+
"superscript",
|
|
236
|
+
"switch",
|
|
237
|
+
"tab",
|
|
238
|
+
"table",
|
|
239
|
+
"tablist",
|
|
240
|
+
"tabpanel",
|
|
241
|
+
"term",
|
|
242
|
+
"textbox",
|
|
243
|
+
"time",
|
|
244
|
+
"timer",
|
|
245
|
+
"toolbar",
|
|
246
|
+
"tooltip",
|
|
247
|
+
"tree",
|
|
248
|
+
"treegrid",
|
|
249
|
+
"treeitem"
|
|
250
|
+
]);
|
|
251
|
+
var KNOWN_ARIA_ROLES_SET = new Set(KNOWN_ARIA_ROLES);
|
|
252
|
+
|
|
294
253
|
// ../../lib/primitive/src/constants/aria/role-restricted-attributes.ts
|
|
295
254
|
var ROLE_RESTRICTED_ATTRIBUTES = /* @__PURE__ */ new Map([
|
|
296
255
|
[
|
|
@@ -442,16 +401,6 @@ var ROLE_RESTRICTED_ATTRIBUTES = /* @__PURE__ */ new Map([
|
|
|
442
401
|
]
|
|
443
402
|
]);
|
|
444
403
|
|
|
445
|
-
// ../../lib/primitive/src/guards/foundational/is-defined.ts
|
|
446
|
-
function isUndefined(value) {
|
|
447
|
-
return value === void 0;
|
|
448
|
-
}
|
|
449
|
-
|
|
450
|
-
// ../../lib/primitive/src/guards/foundational/is-null.ts
|
|
451
|
-
function isNull(value) {
|
|
452
|
-
return value === null;
|
|
453
|
-
}
|
|
454
|
-
|
|
455
404
|
// ../../lib/primitive/src/guards/aria/is-aria-attribute.ts
|
|
456
405
|
function isGlobalAriaAttribute(attr) {
|
|
457
406
|
return GLOBAL_ARIA_ATTRIBUTES.has(attr);
|
|
@@ -473,51 +422,20 @@ function isStandaloneTag(tag) {
|
|
|
473
422
|
return STANDALONE_ROLES_SET.has(IMPLICIT_ROLE_RECORD[tag]);
|
|
474
423
|
}
|
|
475
424
|
function getInputImplicitRole(type) {
|
|
476
|
-
if (type
|
|
425
|
+
if (!isString(type) || !(type in INPUT_TYPE_ROLE_MAP)) return void 0;
|
|
477
426
|
return INPUT_TYPE_ROLE_MAP[type];
|
|
478
427
|
}
|
|
479
428
|
function getConditionalImplicitRole(tag, ariaLabel, ariaLabelledBy) {
|
|
480
|
-
const isNamed =
|
|
429
|
+
const isNamed = isString(ariaLabel) || isString(ariaLabelledBy);
|
|
481
430
|
if (!isNamed) return void 0;
|
|
482
431
|
if (tag === "section") return "region";
|
|
483
432
|
if (tag === "form") return "form";
|
|
484
433
|
return void 0;
|
|
485
434
|
}
|
|
486
435
|
|
|
487
|
-
// ../../lib/primitive/src/guards/
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
// ../../lib/primitive/src/guards/children/is-tag.ts
|
|
491
|
-
function getAsProp(child) {
|
|
492
|
-
if (!isObject(child) || !("props" in child)) return void 0;
|
|
493
|
-
const props = child.props;
|
|
494
|
-
if (!isObject(props)) return void 0;
|
|
495
|
-
const as = props.as;
|
|
496
|
-
return isString(as) && as !== "" ? as : void 0;
|
|
497
|
-
}
|
|
498
|
-
function getTag(child) {
|
|
499
|
-
if (!isObject(child) || !("type" in child)) return void 0;
|
|
500
|
-
const t = child.type;
|
|
501
|
-
if (isString(t)) return t;
|
|
502
|
-
if (typeof t === "function" || isObject(t)) {
|
|
503
|
-
const defaultTag = t[COMPONENT_DEFAULT_TAG];
|
|
504
|
-
if (!isString(defaultTag)) return void 0;
|
|
505
|
-
return getAsProp(child) ?? defaultTag;
|
|
506
|
-
}
|
|
507
|
-
return void 0;
|
|
508
|
-
}
|
|
509
|
-
function isTag(...args) {
|
|
510
|
-
if (isString(args[0])) {
|
|
511
|
-
const set3 = new Set(args);
|
|
512
|
-
return (child2) => {
|
|
513
|
-
const tag2 = getTag(child2);
|
|
514
|
-
return tag2 !== void 0 && set3.has(tag2);
|
|
515
|
-
};
|
|
516
|
-
}
|
|
517
|
-
const [child, ...tags] = args;
|
|
518
|
-
const set2 = new Set(tags);
|
|
519
|
-
const tag = getTag(child);
|
|
520
|
-
return tag !== void 0 && set2.has(tag);
|
|
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);
|
|
521
439
|
}
|
|
522
440
|
|
|
523
441
|
// ../../lib/contract/src/aria/aria-role-policy.ts
|
|
@@ -531,6 +449,202 @@ function getImplicitRole(tag, props) {
|
|
|
531
449
|
return void 0;
|
|
532
450
|
}
|
|
533
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/utils/assert-never.ts
|
|
460
|
+
function assertNever(value) {
|
|
461
|
+
throw new Error(`Unexpected value: ${String(value)}`);
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
// ../../lib/primitive/src/utils/cn.ts
|
|
465
|
+
import { clsx } from "clsx";
|
|
466
|
+
function cn(...inputs) {
|
|
467
|
+
return clsx(...inputs);
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
// ../../lib/primitive/src/utils/iterate.ts
|
|
471
|
+
function find(iterable, callback) {
|
|
472
|
+
for (const value of iterable) {
|
|
473
|
+
const result = callback(value);
|
|
474
|
+
if (result != null) {
|
|
475
|
+
return result;
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
return null;
|
|
479
|
+
}
|
|
480
|
+
function some(iterable, predicate) {
|
|
481
|
+
for (const value of iterable) {
|
|
482
|
+
if (predicate(value)) return true;
|
|
483
|
+
}
|
|
484
|
+
return false;
|
|
485
|
+
}
|
|
486
|
+
function every(iterable, predicate) {
|
|
487
|
+
let index = 0;
|
|
488
|
+
for (const value of iterable) {
|
|
489
|
+
if (!predicate(value, index++)) {
|
|
490
|
+
return false;
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
return true;
|
|
494
|
+
}
|
|
495
|
+
function* filter(iterable, predicate) {
|
|
496
|
+
let index = 0;
|
|
497
|
+
for (const value of iterable) {
|
|
498
|
+
if (predicate(value, index++)) {
|
|
499
|
+
yield value;
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
function* map(iterable, callback) {
|
|
504
|
+
let index = 0;
|
|
505
|
+
for (const value of iterable) {
|
|
506
|
+
yield callback(value, index++);
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
function forEach(iterable, callback) {
|
|
510
|
+
let index = 0;
|
|
511
|
+
for (const value of iterable) {
|
|
512
|
+
callback(value, index++);
|
|
513
|
+
}
|
|
514
|
+
}
|
|
515
|
+
function reduce(iterable, initial, callback) {
|
|
516
|
+
let accumulator = initial;
|
|
517
|
+
let index = 0;
|
|
518
|
+
for (const value of iterable) {
|
|
519
|
+
accumulator = callback(accumulator, value, index++);
|
|
520
|
+
}
|
|
521
|
+
return accumulator;
|
|
522
|
+
}
|
|
523
|
+
function collect(iterable, callback) {
|
|
524
|
+
const result = {};
|
|
525
|
+
let index = 0;
|
|
526
|
+
for (const value of iterable) {
|
|
527
|
+
const entry = callback(value, index++);
|
|
528
|
+
if (entry === null) {
|
|
529
|
+
return null;
|
|
530
|
+
}
|
|
531
|
+
result[entry[0]] = entry[1];
|
|
532
|
+
}
|
|
533
|
+
return result;
|
|
534
|
+
}
|
|
535
|
+
function findLast(value, callback) {
|
|
536
|
+
for (let index = value.length - 1; index >= 0; index--) {
|
|
537
|
+
const result = callback(value[index], index);
|
|
538
|
+
if (result != null) {
|
|
539
|
+
return result;
|
|
540
|
+
}
|
|
541
|
+
}
|
|
542
|
+
return null;
|
|
543
|
+
}
|
|
544
|
+
function* items(collection) {
|
|
545
|
+
for (let i = 0; i < collection.length; i++) {
|
|
546
|
+
const item = collection.item(i);
|
|
547
|
+
if (item !== null) {
|
|
548
|
+
yield item;
|
|
549
|
+
}
|
|
550
|
+
}
|
|
551
|
+
}
|
|
552
|
+
function nodeList(list) {
|
|
553
|
+
return {
|
|
554
|
+
*[Symbol.iterator]() {
|
|
555
|
+
for (let i = 0; i < list.length; i++) {
|
|
556
|
+
const node = list.item(i);
|
|
557
|
+
if (node !== null) {
|
|
558
|
+
yield node;
|
|
559
|
+
}
|
|
560
|
+
}
|
|
561
|
+
}
|
|
562
|
+
};
|
|
563
|
+
}
|
|
564
|
+
function mapEntries(m) {
|
|
565
|
+
return m.entries();
|
|
566
|
+
}
|
|
567
|
+
function set(s) {
|
|
568
|
+
return s.values();
|
|
569
|
+
}
|
|
570
|
+
function hasOwn(object, key) {
|
|
571
|
+
return Object.hasOwn(object, key);
|
|
572
|
+
}
|
|
573
|
+
function* entries(object) {
|
|
574
|
+
for (const key in object) {
|
|
575
|
+
if (!hasOwn(object, key)) continue;
|
|
576
|
+
yield [key, object[key]];
|
|
577
|
+
}
|
|
578
|
+
}
|
|
579
|
+
function* keys(object) {
|
|
580
|
+
for (const [key] of entries(object)) {
|
|
581
|
+
yield key;
|
|
582
|
+
}
|
|
583
|
+
}
|
|
584
|
+
function* values(object) {
|
|
585
|
+
for (const [, value] of entries(object)) {
|
|
586
|
+
yield value;
|
|
587
|
+
}
|
|
588
|
+
}
|
|
589
|
+
function mapValues(object, callback) {
|
|
590
|
+
const result = {};
|
|
591
|
+
for (const [key, value] of entries(object)) {
|
|
592
|
+
result[key] = callback(value, key);
|
|
593
|
+
}
|
|
594
|
+
return result;
|
|
595
|
+
}
|
|
596
|
+
function forEachEntry(object, callback) {
|
|
597
|
+
for (const [key, value] of entries(object)) {
|
|
598
|
+
callback(key, value);
|
|
599
|
+
}
|
|
600
|
+
}
|
|
601
|
+
function forEachKey(object, callback) {
|
|
602
|
+
for (const key of keys(object)) {
|
|
603
|
+
callback(key);
|
|
604
|
+
}
|
|
605
|
+
}
|
|
606
|
+
function forEachValue(object, callback) {
|
|
607
|
+
for (const value of values(object)) {
|
|
608
|
+
callback(value);
|
|
609
|
+
}
|
|
610
|
+
}
|
|
611
|
+
function forEachSet(s, callback) {
|
|
612
|
+
for (const value of s) {
|
|
613
|
+
callback(value);
|
|
614
|
+
}
|
|
615
|
+
}
|
|
616
|
+
var iterate = Object.freeze({
|
|
617
|
+
entries,
|
|
618
|
+
filter,
|
|
619
|
+
find,
|
|
620
|
+
findLast,
|
|
621
|
+
forEach,
|
|
622
|
+
forEachEntry,
|
|
623
|
+
forEachKey,
|
|
624
|
+
forEachSet,
|
|
625
|
+
forEachValue,
|
|
626
|
+
items,
|
|
627
|
+
keys,
|
|
628
|
+
map,
|
|
629
|
+
mapEntries,
|
|
630
|
+
mapValues,
|
|
631
|
+
nodeList,
|
|
632
|
+
reduce,
|
|
633
|
+
collect,
|
|
634
|
+
set,
|
|
635
|
+
some,
|
|
636
|
+
every,
|
|
637
|
+
values
|
|
638
|
+
});
|
|
639
|
+
|
|
640
|
+
// ../../lib/primitive/src/utils/merge-props.ts
|
|
641
|
+
function mergeProps(defaultProps, props) {
|
|
642
|
+
return {
|
|
643
|
+
...defaultProps ?? {},
|
|
644
|
+
...props
|
|
645
|
+
};
|
|
646
|
+
}
|
|
647
|
+
|
|
534
648
|
// ../../lib/contract/src/strict/invariant-base.ts
|
|
535
649
|
var InvariantBase = class {
|
|
536
650
|
diagnostics;
|
|
@@ -553,159 +667,21 @@ var InvariantBase = class {
|
|
|
553
667
|
}
|
|
554
668
|
};
|
|
555
669
|
|
|
556
|
-
// ../../lib/diagnostics/src/category.ts
|
|
557
|
-
var DiagnosticCategory = /* @__PURE__ */ ((DiagnosticCategory2) => {
|
|
558
|
-
DiagnosticCategory2[DiagnosticCategory2["Contract"] = 0] = "Contract";
|
|
559
|
-
DiagnosticCategory2[DiagnosticCategory2["HTML"] = 1] = "HTML";
|
|
560
|
-
DiagnosticCategory2[DiagnosticCategory2["ARIA"] = 2] = "ARIA";
|
|
561
|
-
DiagnosticCategory2[DiagnosticCategory2["Composition"] = 3] = "Composition";
|
|
562
|
-
DiagnosticCategory2[DiagnosticCategory2["Rendering"] = 4] = "Rendering";
|
|
563
|
-
DiagnosticCategory2[DiagnosticCategory2["Accessibility"] = 5] = "Accessibility";
|
|
564
|
-
DiagnosticCategory2[DiagnosticCategory2["Performance"] = 6] = "Performance";
|
|
565
|
-
DiagnosticCategory2[DiagnosticCategory2["Internal"] = 7] = "Internal";
|
|
566
|
-
DiagnosticCategory2[DiagnosticCategory2["Deprecation"] = 8] = "Deprecation";
|
|
567
|
-
DiagnosticCategory2[DiagnosticCategory2["Lint"] = 9] = "Lint";
|
|
568
|
-
return DiagnosticCategory2;
|
|
569
|
-
})(DiagnosticCategory || {});
|
|
570
|
-
|
|
571
|
-
// ../../lib/diagnostics/src/error.ts
|
|
572
|
-
var PraxisError = class extends Error {
|
|
573
|
-
diagnostic;
|
|
574
|
-
constructor(diagnostic) {
|
|
575
|
-
super(diagnostic.message);
|
|
576
|
-
this.name = "PraxisError";
|
|
577
|
-
this.diagnostic = diagnostic;
|
|
578
|
-
}
|
|
579
|
-
};
|
|
580
|
-
|
|
581
|
-
// ../../lib/diagnostics/src/severity.ts
|
|
582
|
-
var Severity = /* @__PURE__ */ ((Severity2) => {
|
|
583
|
-
Severity2[Severity2["Debug"] = 0] = "Debug";
|
|
584
|
-
Severity2[Severity2["Info"] = 1] = "Info";
|
|
585
|
-
Severity2[Severity2["Warning"] = 2] = "Warning";
|
|
586
|
-
Severity2[Severity2["Error"] = 3] = "Error";
|
|
587
|
-
Severity2[Severity2["Fatal"] = 4] = "Fatal";
|
|
588
|
-
return Severity2;
|
|
589
|
-
})(Severity || {});
|
|
590
|
-
|
|
591
|
-
// ../../lib/diagnostics/src/policy.ts
|
|
592
|
-
var DefaultPolicy = class {
|
|
593
|
-
reportThreshold;
|
|
594
|
-
throwThreshold;
|
|
595
|
-
constructor({
|
|
596
|
-
reportThreshold = 1 /* Info */,
|
|
597
|
-
throwThreshold = 4 /* Fatal */
|
|
598
|
-
} = {}) {
|
|
599
|
-
this.reportThreshold = reportThreshold;
|
|
600
|
-
this.throwThreshold = throwThreshold;
|
|
601
|
-
}
|
|
602
|
-
resolve(diagnostic) {
|
|
603
|
-
if (diagnostic.severity >= this.throwThreshold) return 2 /* Throw */;
|
|
604
|
-
if (diagnostic.severity >= this.reportThreshold) return 1 /* Report */;
|
|
605
|
-
return 0 /* Ignore */;
|
|
606
|
-
}
|
|
607
|
-
};
|
|
608
|
-
|
|
609
|
-
// ../../lib/diagnostics/src/diagnostics.ts
|
|
610
|
-
var Diagnostics = class {
|
|
611
|
-
reporter;
|
|
612
|
-
policy;
|
|
613
|
-
// Pre-computed at construction time: true if Warning-level diagnostics are not ignored.
|
|
614
|
-
active;
|
|
615
|
-
constructor(reporter, policy = new DefaultPolicy()) {
|
|
616
|
-
this.reporter = reporter;
|
|
617
|
-
this.policy = policy;
|
|
618
|
-
this.active = policy.resolve({ severity: 2 /* Warning */ }) !== 0 /* Ignore */;
|
|
619
|
-
}
|
|
620
|
-
report(diagnostic) {
|
|
621
|
-
const enforcement = this.policy.resolve(diagnostic);
|
|
622
|
-
if (enforcement === 0 /* Ignore */) return diagnostic;
|
|
623
|
-
if (enforcement === 2 /* Throw */) throw new PraxisError(diagnostic);
|
|
624
|
-
this.reporter.report(diagnostic);
|
|
625
|
-
return diagnostic;
|
|
626
|
-
}
|
|
627
|
-
warn(input) {
|
|
628
|
-
return this.report({ ...input, severity: 2 /* Warning */ });
|
|
629
|
-
}
|
|
630
|
-
error(input) {
|
|
631
|
-
return this.report({ ...input, severity: 3 /* Error */ });
|
|
632
|
-
}
|
|
633
|
-
info(input) {
|
|
634
|
-
return this.report({ ...input, severity: 1 /* Info */ });
|
|
635
|
-
}
|
|
636
|
-
};
|
|
637
|
-
|
|
638
|
-
// ../../lib/diagnostics/src/formatter.ts
|
|
639
|
-
function formatDiagnostic(diagnostic) {
|
|
640
|
-
const level = Severity[diagnostic.severity];
|
|
641
|
-
const category = DiagnosticCategory[diagnostic.category];
|
|
642
|
-
const prefix = category !== void 0 ? `[${category}] ` : "";
|
|
643
|
-
return `${level} ${diagnostic.code}: ${prefix}${diagnostic.message}`;
|
|
644
|
-
}
|
|
645
|
-
|
|
646
|
-
// ../../lib/diagnostics/src/console-reporter.ts
|
|
647
|
-
var ConsoleReporter = class {
|
|
648
|
-
report(diagnostic) {
|
|
649
|
-
const message = formatDiagnostic(diagnostic);
|
|
650
|
-
switch (diagnostic.severity) {
|
|
651
|
-
case 0 /* Debug */:
|
|
652
|
-
console.debug(message);
|
|
653
|
-
break;
|
|
654
|
-
case 1 /* Info */:
|
|
655
|
-
console.info(message);
|
|
656
|
-
break;
|
|
657
|
-
case 2 /* Warning */:
|
|
658
|
-
console.warn(message);
|
|
659
|
-
break;
|
|
660
|
-
case 3 /* Error */:
|
|
661
|
-
case 4 /* Fatal */:
|
|
662
|
-
console.error(message);
|
|
663
|
-
break;
|
|
664
|
-
}
|
|
665
|
-
}
|
|
666
|
-
};
|
|
667
|
-
|
|
668
|
-
// ../../lib/diagnostics/src/null-reporter.ts
|
|
669
|
-
var nullReporter = {
|
|
670
|
-
report() {
|
|
671
|
-
}
|
|
672
|
-
};
|
|
673
|
-
|
|
674
|
-
// ../../lib/diagnostics/src/presets.ts
|
|
675
|
-
var ignoreAllPolicy = {
|
|
676
|
-
resolve(_) {
|
|
677
|
-
return 0 /* Ignore */;
|
|
678
|
-
}
|
|
679
|
-
};
|
|
680
|
-
var warnOnlyReporter = {
|
|
681
|
-
report(diagnostic) {
|
|
682
|
-
console.warn(formatDiagnostic(diagnostic));
|
|
683
|
-
}
|
|
684
|
-
};
|
|
685
|
-
var silentDiagnostics = new Diagnostics(nullReporter, ignoreAllPolicy);
|
|
686
|
-
var warnDiagnostics = new Diagnostics(
|
|
687
|
-
warnOnlyReporter,
|
|
688
|
-
new DefaultPolicy({ reportThreshold: 2 /* Warning */, throwThreshold: 4 /* Fatal */ })
|
|
689
|
-
);
|
|
690
|
-
var throwDiagnostics = new Diagnostics(
|
|
691
|
-
new ConsoleReporter(),
|
|
692
|
-
new DefaultPolicy({ reportThreshold: 2 /* Warning */, throwThreshold: 3 /* Error */ })
|
|
693
|
-
);
|
|
694
|
-
|
|
695
670
|
// ../../lib/contract/src/diagnostics/aria.ts
|
|
671
|
+
import { DiagnosticCategory, DiagnosticCode } from "../_shared/diagnostics.js";
|
|
696
672
|
var AriaDiagnostics = {
|
|
697
673
|
/** Generic bridge for violations produced by external AriaRule functions. */
|
|
698
674
|
fromViolation(v) {
|
|
699
675
|
return {
|
|
700
|
-
code:
|
|
701
|
-
category:
|
|
676
|
+
code: DiagnosticCode.AriaViolation,
|
|
677
|
+
category: DiagnosticCategory.ARIA,
|
|
702
678
|
message: v.message
|
|
703
679
|
};
|
|
704
680
|
},
|
|
705
681
|
attributeInvalid(key, role) {
|
|
706
682
|
return {
|
|
707
|
-
code:
|
|
708
|
-
category:
|
|
683
|
+
code: DiagnosticCode.AriaAttributeInvalid,
|
|
684
|
+
category: DiagnosticCategory.ARIA,
|
|
709
685
|
message: `"${key}" is not valid on role="${role}". It will be removed.`,
|
|
710
686
|
rationale: "Invalid ARIA attributes are ignored by assistive technology and may trigger accessibility-tree warnings in browser devtools.",
|
|
711
687
|
suggestions: [
|
|
@@ -718,8 +694,8 @@ var AriaDiagnostics = {
|
|
|
718
694
|
},
|
|
719
695
|
missingLiveRegion(role, impliedLive) {
|
|
720
696
|
return {
|
|
721
|
-
code:
|
|
722
|
-
category:
|
|
697
|
+
code: DiagnosticCode.AriaMissingLiveRegion,
|
|
698
|
+
category: DiagnosticCategory.ARIA,
|
|
723
699
|
message: `role="${role}" implies aria-live="${impliedLive}" but it is missing. It has been injected.`,
|
|
724
700
|
rationale: "Live-region roles announce dynamic content changes to screen readers. Without aria-live the politeness level is unspecified and announcements may be silent.",
|
|
725
701
|
suggestions: [
|
|
@@ -733,8 +709,8 @@ var AriaDiagnostics = {
|
|
|
733
709
|
},
|
|
734
710
|
missingAtomic(role) {
|
|
735
711
|
return {
|
|
736
|
-
code:
|
|
737
|
-
category:
|
|
712
|
+
code: DiagnosticCode.AriaMissingAtomic,
|
|
713
|
+
category: DiagnosticCategory.ARIA,
|
|
738
714
|
message: `role="${role}" is a live region. Consider setting aria-atomic="true" if the full region should be announced as a unit, or aria-atomic="false" if only changed nodes should be read.`,
|
|
739
715
|
rationale: "aria-atomic controls whether assistive technology announces the entire live region or only the changed nodes. Omitting it leaves the behaviour browser-defined."
|
|
740
716
|
};
|
|
@@ -742,8 +718,8 @@ var AriaDiagnostics = {
|
|
|
742
718
|
relevantInvalidTokens(invalid) {
|
|
743
719
|
const quoted = invalid.map((t) => `"${t}"`).join(", ");
|
|
744
720
|
return {
|
|
745
|
-
code:
|
|
746
|
-
category:
|
|
721
|
+
code: DiagnosticCode.AriaRelevantInvalidToken,
|
|
722
|
+
category: DiagnosticCategory.ARIA,
|
|
747
723
|
message: `aria-relevant contains invalid token(s): ${quoted}. Valid tokens are: additions, removals, text, all.`,
|
|
748
724
|
rationale: "aria-relevant accepts a space-separated list of change types. Unrecognised tokens are silently ignored by assistive technology, making the attribute ineffective.",
|
|
749
725
|
suggestions: [
|
|
@@ -756,8 +732,8 @@ var AriaDiagnostics = {
|
|
|
756
732
|
},
|
|
757
733
|
relevantSuperseded() {
|
|
758
734
|
return {
|
|
759
|
-
code:
|
|
760
|
-
category:
|
|
735
|
+
code: DiagnosticCode.AriaRelevantSuperseded,
|
|
736
|
+
category: DiagnosticCategory.ARIA,
|
|
761
737
|
message: 'aria-relevant includes "all" alongside other tokens. "all" supersedes additions, removals, and text \u2014 use aria-relevant="all" alone.',
|
|
762
738
|
rationale: '"all" is equivalent to "additions removals text". Combining it with other tokens is redundant and may confuse readers of the markup.',
|
|
763
739
|
suggestions: [
|
|
@@ -770,8 +746,8 @@ var AriaDiagnostics = {
|
|
|
770
746
|
},
|
|
771
747
|
missingAccessibleName(tag) {
|
|
772
748
|
return {
|
|
773
|
-
code:
|
|
774
|
-
category:
|
|
749
|
+
code: DiagnosticCode.AriaMissingAccessibleName,
|
|
750
|
+
category: DiagnosticCategory.ARIA,
|
|
775
751
|
message: `<${tag}> has no accessible name. Add aria-label or aria-labelledby.`,
|
|
776
752
|
rationale: "Elements with a landmark or interactive role must have an accessible name so that assistive technology can identify them when presenting the page outline.",
|
|
777
753
|
suggestions: [
|
|
@@ -788,8 +764,8 @@ var AriaDiagnostics = {
|
|
|
788
764
|
},
|
|
789
765
|
attributeOnPresentational(attr, tag) {
|
|
790
766
|
return {
|
|
791
|
-
code:
|
|
792
|
-
category:
|
|
767
|
+
code: DiagnosticCode.AriaAttributeOnPresentational,
|
|
768
|
+
category: DiagnosticCategory.ARIA,
|
|
793
769
|
message: `"${attr}" is not allowed on a presentational <${tag}>. Presentational elements are invisible to assistive technology.`,
|
|
794
770
|
rationale: 'role="none" and role="presentation" (including <img alt="">) remove an element from the accessibility tree. ARIA attributes on such elements are ignored by assistive technology.',
|
|
795
771
|
suggestions: [
|
|
@@ -802,8 +778,8 @@ var AriaDiagnostics = {
|
|
|
802
778
|
},
|
|
803
779
|
ariaHiddenOnFocusable(tag) {
|
|
804
780
|
return {
|
|
805
|
-
code:
|
|
806
|
-
category:
|
|
781
|
+
code: DiagnosticCode.AriaHiddenOnFocusable,
|
|
782
|
+
category: DiagnosticCategory.ARIA,
|
|
807
783
|
message: `aria-hidden="true" must not be used on focusable <${tag}> elements. Screen reader users who navigate by keyboard will encounter the element but receive no information about it.`,
|
|
808
784
|
rationale: 'aria-hidden removes an element from the accessibility tree while leaving it keyboard-reachable. This creates a "ghost" \u2014 a focusable element assistive technology cannot describe.',
|
|
809
785
|
suggestions: [
|
|
@@ -821,8 +797,8 @@ var AriaDiagnostics = {
|
|
|
821
797
|
invalidAttributeValue(attr, value, expected) {
|
|
822
798
|
const got = value === null ? "null" : value === void 0 ? "undefined" : typeof value === "string" ? `"${value}"` : String(value);
|
|
823
799
|
return {
|
|
824
|
-
code:
|
|
825
|
-
category:
|
|
800
|
+
code: DiagnosticCode.AriaInvalidAttributeValue,
|
|
801
|
+
category: DiagnosticCategory.ARIA,
|
|
826
802
|
message: `"${attr}" has an invalid value (${got}). Expected: ${expected}.`,
|
|
827
803
|
rationale: "ARIA attributes with invalid values are silently ignored by assistive technology, making the markup semantically inert.",
|
|
828
804
|
suggestions: [
|
|
@@ -835,8 +811,8 @@ var AriaDiagnostics = {
|
|
|
835
811
|
},
|
|
836
812
|
redundantAriaLevel(tag, level) {
|
|
837
813
|
return {
|
|
838
|
-
code:
|
|
839
|
-
category:
|
|
814
|
+
code: DiagnosticCode.AriaRedundantLevelAttribute,
|
|
815
|
+
category: DiagnosticCategory.ARIA,
|
|
840
816
|
message: `aria-level="${level}" is redundant on <${tag}>: the element already has an implicit heading level of ${level}. Remove the attribute.`,
|
|
841
817
|
rationale: 'Restating the implicit aria-level adds noise without semantic value. Use aria-level only to override the native heading level (e.g. aria-level="3" on <h2>).',
|
|
842
818
|
suggestions: [
|
|
@@ -849,8 +825,8 @@ var AriaDiagnostics = {
|
|
|
849
825
|
},
|
|
850
826
|
requiredProperty(attr, role) {
|
|
851
827
|
return {
|
|
852
|
-
code:
|
|
853
|
-
category:
|
|
828
|
+
code: DiagnosticCode.AriaRequiredProperty,
|
|
829
|
+
category: DiagnosticCategory.ARIA,
|
|
854
830
|
message: `"${attr}" is required for role="${role}" but is missing.`,
|
|
855
831
|
rationale: `WAI-ARIA 1.2 specifies required states and properties for certain roles. Without "${attr}", assistive technology cannot correctly communicate the element's state to users.`,
|
|
856
832
|
suggestions: [
|
|
@@ -863,8 +839,8 @@ var AriaDiagnostics = {
|
|
|
863
839
|
},
|
|
864
840
|
invalidRole(role, tag) {
|
|
865
841
|
return {
|
|
866
|
-
code:
|
|
867
|
-
category:
|
|
842
|
+
code: DiagnosticCode.AriaInvalidRole,
|
|
843
|
+
category: DiagnosticCategory.ARIA,
|
|
868
844
|
message: `Invalid role "${role ?? ""}" on <${tag}>.`,
|
|
869
845
|
rationale: "An unrecognised or misapplied ARIA role is ignored by assistive technology and may degrade the accessibility of the element."
|
|
870
846
|
};
|
|
@@ -872,11 +848,12 @@ var AriaDiagnostics = {
|
|
|
872
848
|
};
|
|
873
849
|
|
|
874
850
|
// ../../lib/contract/src/diagnostics/contract.ts
|
|
851
|
+
import { DiagnosticCategory as DiagnosticCategory2, DiagnosticCode as DiagnosticCode2 } from "../_shared/diagnostics.js";
|
|
875
852
|
var ContractDiagnostics = {
|
|
876
853
|
unexpectedChild(typeName, index, context) {
|
|
877
854
|
return {
|
|
878
|
-
code:
|
|
879
|
-
category:
|
|
855
|
+
code: DiagnosticCode2.UnexpectedChild,
|
|
856
|
+
category: DiagnosticCategory2.Contract,
|
|
880
857
|
component: context,
|
|
881
858
|
message: `${context}: unexpected child "${typeName}" at index ${index}.`
|
|
882
859
|
};
|
|
@@ -884,69 +861,69 @@ var ContractDiagnostics = {
|
|
|
884
861
|
ambiguousChild(typeName, index, ruleNames, context) {
|
|
885
862
|
const quoted = ruleNames.map((n) => `"${n}"`).join(" and ");
|
|
886
863
|
return {
|
|
887
|
-
code:
|
|
888
|
-
category:
|
|
864
|
+
code: DiagnosticCode2.AmbiguousChild,
|
|
865
|
+
category: DiagnosticCategory2.Contract,
|
|
889
866
|
component: context,
|
|
890
867
|
message: `${context}: child "${typeName}" at index ${index} matches multiple child rules: ${quoted}.`
|
|
891
868
|
};
|
|
892
869
|
},
|
|
893
870
|
cardinalityMin(ruleName, min, context) {
|
|
894
871
|
return {
|
|
895
|
-
code:
|
|
896
|
-
category:
|
|
872
|
+
code: DiagnosticCode2.CardinalityMin,
|
|
873
|
+
category: DiagnosticCategory2.Contract,
|
|
897
874
|
component: context,
|
|
898
875
|
message: `${context}: "${ruleName}" requires at least ${min}.`
|
|
899
876
|
};
|
|
900
877
|
},
|
|
901
878
|
cardinalityMax(ruleName, max, context) {
|
|
902
879
|
return {
|
|
903
|
-
code:
|
|
904
|
-
category:
|
|
880
|
+
code: DiagnosticCode2.CardinalityMax,
|
|
881
|
+
category: DiagnosticCategory2.Contract,
|
|
905
882
|
component: context,
|
|
906
883
|
message: `${context}: "${ruleName}" allows at most ${max}.`
|
|
907
884
|
};
|
|
908
885
|
},
|
|
909
886
|
positionViolation(ruleName, position, index, context) {
|
|
910
887
|
return {
|
|
911
|
-
code:
|
|
912
|
-
category:
|
|
888
|
+
code: DiagnosticCode2.PositionViolation,
|
|
889
|
+
category: DiagnosticCategory2.Contract,
|
|
913
890
|
component: context,
|
|
914
891
|
message: `${context}: "${ruleName}" must be ${position}, got index ${index}`
|
|
915
892
|
};
|
|
916
893
|
},
|
|
917
|
-
unknownVariantDim(component,
|
|
894
|
+
unknownVariantDim(component, label2, dim) {
|
|
918
895
|
return {
|
|
919
|
-
code:
|
|
920
|
-
category:
|
|
921
|
-
message: `${component}: ${
|
|
896
|
+
code: DiagnosticCode2.ContractUnknownVariantDim,
|
|
897
|
+
category: DiagnosticCategory2.Contract,
|
|
898
|
+
message: `${component}: ${label2} references unknown variant "${dim}".`
|
|
922
899
|
};
|
|
923
900
|
},
|
|
924
|
-
unknownVariantValue(component,
|
|
901
|
+
unknownVariantValue(component, label2, dim, value, valid) {
|
|
925
902
|
return {
|
|
926
|
-
code:
|
|
927
|
-
category:
|
|
928
|
-
message: `${component}: ${
|
|
903
|
+
code: DiagnosticCode2.ContractUnknownVariantValue,
|
|
904
|
+
category: DiagnosticCategory2.Contract,
|
|
905
|
+
message: `${component}: ${label2} sets "${dim}" to unknown value "${value}" (valid: ${valid.join(", ")}).`
|
|
929
906
|
};
|
|
930
907
|
},
|
|
931
908
|
unknownRecipeKey(component, key) {
|
|
932
909
|
return {
|
|
933
|
-
code:
|
|
934
|
-
category:
|
|
910
|
+
code: DiagnosticCode2.ContractUnknownRecipeKey,
|
|
911
|
+
category: DiagnosticCategory2.Contract,
|
|
935
912
|
message: `${component} Unknown recipeKey "${key}" \u2014 no preset with that name exists.`
|
|
936
913
|
};
|
|
937
914
|
},
|
|
938
915
|
invalidVariantValue(component, key, value) {
|
|
939
916
|
return {
|
|
940
|
-
code:
|
|
941
|
-
category:
|
|
917
|
+
code: DiagnosticCode2.ContractInvalidVariantValue,
|
|
918
|
+
category: DiagnosticCategory2.Contract,
|
|
942
919
|
message: `${component} Variant "${key}=${value}" is not a defined value for the "${key}" dimension.`
|
|
943
920
|
};
|
|
944
921
|
},
|
|
945
922
|
allowedAsViolation(tag, allowedAs, component) {
|
|
946
923
|
const allowed = allowedAs.map((t) => `"${String(t)}"`).join(", ");
|
|
947
924
|
return {
|
|
948
|
-
code:
|
|
949
|
-
category:
|
|
925
|
+
code: DiagnosticCode2.AllowedAsViolation,
|
|
926
|
+
category: DiagnosticCategory2.Contract,
|
|
950
927
|
component,
|
|
951
928
|
message: `<${component}>: "as" prop received "${tag}" but only [${allowed}] are allowed.`
|
|
952
929
|
};
|
|
@@ -954,73 +931,75 @@ var ContractDiagnostics = {
|
|
|
954
931
|
};
|
|
955
932
|
|
|
956
933
|
// ../../lib/contract/src/diagnostics/html.ts
|
|
934
|
+
import { DiagnosticCategory as DiagnosticCategory3, DiagnosticCode as DiagnosticCode3 } from "../_shared/diagnostics.js";
|
|
957
935
|
var HtmlDiagnostics = {
|
|
958
936
|
emptyRole(tag) {
|
|
959
937
|
return {
|
|
960
|
-
code:
|
|
961
|
-
category:
|
|
938
|
+
code: DiagnosticCode3.HtmlEmptyRole,
|
|
939
|
+
category: DiagnosticCategory3.HTML,
|
|
962
940
|
message: `<${tag}> has an explicit empty role="". Omit the attribute instead.`
|
|
963
941
|
};
|
|
964
942
|
},
|
|
965
943
|
implicitRoleRedundant(tag, implicitRole) {
|
|
966
944
|
return {
|
|
967
|
-
code:
|
|
968
|
-
category:
|
|
945
|
+
code: DiagnosticCode3.HtmlImplicitRoleRedundant,
|
|
946
|
+
category: DiagnosticCategory3.HTML,
|
|
969
947
|
message: `<${tag}> already has implicit role="${implicitRole}". Avoid redundant role assignment.`
|
|
970
948
|
};
|
|
971
949
|
},
|
|
972
950
|
implicitRoleOverride(tag, implicitRole, role) {
|
|
973
951
|
return {
|
|
974
|
-
code:
|
|
975
|
-
category:
|
|
952
|
+
code: DiagnosticCode3.HtmlImplicitRoleOverride,
|
|
953
|
+
category: DiagnosticCategory3.HTML,
|
|
976
954
|
message: `<${tag}> should not override its implicit role="${implicitRole}" with role="${role}".`
|
|
977
955
|
};
|
|
978
956
|
},
|
|
979
957
|
standaloneRegionOverride(tag, implicitRole) {
|
|
980
958
|
return {
|
|
981
|
-
code:
|
|
982
|
-
category:
|
|
959
|
+
code: DiagnosticCode3.HtmlStandaloneRegionOverride,
|
|
960
|
+
category: DiagnosticCategory3.HTML,
|
|
983
961
|
message: `<${tag}> is a self-contained element with implicit role="${implicitRole}". Assigning role="region" has been removed.`
|
|
984
962
|
};
|
|
985
963
|
},
|
|
986
964
|
landmarkRoleOverride(tag, implicitRole, role) {
|
|
987
965
|
return {
|
|
988
|
-
code:
|
|
989
|
-
category:
|
|
966
|
+
code: DiagnosticCode3.HtmlLandmarkRoleOverride,
|
|
967
|
+
category: DiagnosticCategory3.HTML,
|
|
990
968
|
message: `<${tag}> has a fixed landmark role="${implicitRole}". role="${role}" overrides it and confuses assistive technology. The override has been removed.`
|
|
991
969
|
};
|
|
992
970
|
},
|
|
993
971
|
invalidChild(child, parent, allowed) {
|
|
994
972
|
return {
|
|
995
|
-
code:
|
|
996
|
-
category:
|
|
973
|
+
code: DiagnosticCode3.HtmlInvalidChild,
|
|
974
|
+
category: DiagnosticCategory3.HTML,
|
|
997
975
|
message: `<${child}> is not a valid direct child of <${parent}>. Allowed: ${allowed}.`
|
|
998
976
|
};
|
|
999
977
|
}
|
|
1000
978
|
};
|
|
1001
979
|
|
|
1002
980
|
// ../../lib/contract/src/diagnostics/slot.ts
|
|
981
|
+
import { DiagnosticCategory as DiagnosticCategory4, DiagnosticCode as DiagnosticCode4 } from "../_shared/diagnostics.js";
|
|
1003
982
|
var SlotDiagnostics = {
|
|
1004
983
|
exclusive(name) {
|
|
1005
984
|
return {
|
|
1006
|
-
code:
|
|
1007
|
-
category:
|
|
985
|
+
code: DiagnosticCode4.SlotExclusive,
|
|
986
|
+
category: DiagnosticCategory4.Contract,
|
|
1008
987
|
component: name,
|
|
1009
988
|
message: `${name}: "as" and "asChild" are mutually exclusive`
|
|
1010
989
|
};
|
|
1011
990
|
},
|
|
1012
991
|
singleChildRequired(name, elementTerm) {
|
|
1013
992
|
return {
|
|
1014
|
-
code:
|
|
1015
|
-
category:
|
|
993
|
+
code: DiagnosticCode4.SlotSingleChild,
|
|
994
|
+
category: DiagnosticCategory4.Contract,
|
|
1016
995
|
component: name,
|
|
1017
996
|
message: `${name}: asChild requires a ${elementTerm} child`
|
|
1018
997
|
};
|
|
1019
998
|
},
|
|
1020
999
|
singleChildExceeded(name, elementTerm, count) {
|
|
1021
1000
|
return {
|
|
1022
|
-
code:
|
|
1023
|
-
category:
|
|
1001
|
+
code: DiagnosticCode4.SlotSingleChild,
|
|
1002
|
+
category: DiagnosticCategory4.Contract,
|
|
1024
1003
|
component: name,
|
|
1025
1004
|
message: `${name}: asChild requires exactly one ${elementTerm} child, got ${count}`
|
|
1026
1005
|
};
|
|
@@ -1028,16 +1007,16 @@ var SlotDiagnostics = {
|
|
|
1028
1007
|
discardedChildren(name, elementTerm, count) {
|
|
1029
1008
|
const suffix = count === 1 ? "" : "ren";
|
|
1030
1009
|
return {
|
|
1031
|
-
code:
|
|
1032
|
-
category:
|
|
1010
|
+
code: DiagnosticCode4.SlotDiscardedChildren,
|
|
1011
|
+
category: DiagnosticCategory4.Contract,
|
|
1033
1012
|
component: name,
|
|
1034
1013
|
message: `${name}: asChild discarded ${count} non-element child${suffix} \u2014 only ${elementTerm}s are valid asChild children.`
|
|
1035
1014
|
};
|
|
1036
1015
|
},
|
|
1037
1016
|
renderFnRequired(name, received) {
|
|
1038
1017
|
return {
|
|
1039
|
-
code:
|
|
1040
|
-
category:
|
|
1018
|
+
code: DiagnosticCode4.SlotRenderFn,
|
|
1019
|
+
category: DiagnosticCategory4.Contract,
|
|
1041
1020
|
component: name,
|
|
1042
1021
|
message: `${name}: asChild requires a render function as children, got ${received}`
|
|
1043
1022
|
};
|
|
@@ -1721,7 +1700,7 @@ function getTypeName(value) {
|
|
|
1721
1700
|
return primitive;
|
|
1722
1701
|
}
|
|
1723
1702
|
const name = value.constructor?.name;
|
|
1724
|
-
return
|
|
1703
|
+
return isString(name) && name !== "Object" ? name : "object";
|
|
1725
1704
|
}
|
|
1726
1705
|
|
|
1727
1706
|
// ../../lib/contract/src/children/normalize-child-rule.ts
|
|
@@ -1972,6 +1951,9 @@ var readonlyProps = ({
|
|
|
1972
1951
|
};
|
|
1973
1952
|
};
|
|
1974
1953
|
|
|
1954
|
+
// ../core/src/html/evaluators.ts
|
|
1955
|
+
import { warnDiagnostics as warnDiagnostics2 } from "../_shared/diagnostics.js";
|
|
1956
|
+
|
|
1975
1957
|
// ../core/src/html/aria-rules.ts
|
|
1976
1958
|
var LANDMARK_TAG_SET = /* @__PURE__ */ new Set(["article", "aside", "footer", "header", "main", "nav"]);
|
|
1977
1959
|
var removeLandmarkRoleOverride = {
|
|
@@ -2012,8 +1994,10 @@ function landmarkNameAdvisory(ctx) {
|
|
|
2012
1994
|
if (!ctx.implicitRole || !NAMED_LANDMARK_TAGS.has(ctx.tag)) return [];
|
|
2013
1995
|
return requireAccessibleName(ctx);
|
|
2014
1996
|
}
|
|
1997
|
+
var HTML_ARIA_RULES = [landmarkRoleRule, landmarkNameAdvisory];
|
|
2015
1998
|
|
|
2016
1999
|
// ../core/src/html/contracts.ts
|
|
2000
|
+
import { warnDiagnostics } from "../_shared/diagnostics.js";
|
|
2017
2001
|
function isOpenContent(...blockedTags) {
|
|
2018
2002
|
const set2 = new Set(blockedTags);
|
|
2019
2003
|
return (child) => isObject(child) && "type" in child && (!isString(child.type) || !set2.has(child.type));
|
|
@@ -2158,7 +2142,7 @@ var htmlContracts = {
|
|
|
2158
2142
|
};
|
|
2159
2143
|
|
|
2160
2144
|
// ../core/src/html/evaluators.ts
|
|
2161
|
-
var htmlDiagnostics =
|
|
2145
|
+
var htmlDiagnostics = warnDiagnostics2;
|
|
2162
2146
|
function buildEvaluatorMap() {
|
|
2163
2147
|
const map2 = /* @__PURE__ */ new Map();
|
|
2164
2148
|
iterate.forEachEntry(htmlContracts, (tag, { children }) => {
|
|
@@ -2186,402 +2170,492 @@ function getHtmlPropNormalizers(tag) {
|
|
|
2186
2170
|
return typeof tag === "string" ? HTML_FORM_NORMALIZERS.get(tag) : void 0;
|
|
2187
2171
|
}
|
|
2188
2172
|
|
|
2189
|
-
// ../../
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
const active = resolved[key];
|
|
2209
|
-
if (typeof active === "string") {
|
|
2210
|
-
const cls = valueMap[active];
|
|
2211
|
-
if (cls !== void 0) classes.push(cls);
|
|
2212
|
-
}
|
|
2213
|
-
});
|
|
2214
|
-
return { context: { classes } };
|
|
2173
|
+
// ../../node_modules/.pnpm/class-variance-authority@0.7.1/node_modules/class-variance-authority/dist/index.mjs
|
|
2174
|
+
import { clsx as clsx2 } from "clsx";
|
|
2175
|
+
var falsyToString = (value) => typeof value === "boolean" ? `${value}` : value === 0 ? "0" : value;
|
|
2176
|
+
var cx = clsx2;
|
|
2177
|
+
var cva = (base, config) => (props) => {
|
|
2178
|
+
var _config_compoundVariants;
|
|
2179
|
+
if ((config === null || config === void 0 ? void 0 : config.variants) == null) return cx(base, props === null || props === void 0 ? void 0 : props.class, props === null || props === void 0 ? void 0 : props.className);
|
|
2180
|
+
const { variants, defaultVariants } = config;
|
|
2181
|
+
const getVariantClassNames = Object.keys(variants).map((variant) => {
|
|
2182
|
+
const variantProp = props === null || props === void 0 ? void 0 : props[variant];
|
|
2183
|
+
const defaultVariantProp = defaultVariants === null || defaultVariants === void 0 ? void 0 : defaultVariants[variant];
|
|
2184
|
+
if (variantProp === null) return null;
|
|
2185
|
+
const variantKey = falsyToString(variantProp) || falsyToString(defaultVariantProp);
|
|
2186
|
+
return variants[variant][variantKey];
|
|
2187
|
+
});
|
|
2188
|
+
const propsWithoutUndefined = props && Object.entries(props).reduce((acc, param) => {
|
|
2189
|
+
let [key, value] = param;
|
|
2190
|
+
if (value === void 0) {
|
|
2191
|
+
return acc;
|
|
2215
2192
|
}
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
return (
|
|
2237
|
-
}
|
|
2238
|
-
|
|
2239
|
-
// ../../lib/adapter-utils/src/build-engines.ts
|
|
2240
|
-
function buildEngines(diagnostics, childRules, context) {
|
|
2241
|
-
return childRules?.length ? { childrenEvaluator: new ChildrenEvaluator(childRules, diagnostics, context) } : {};
|
|
2242
|
-
}
|
|
2243
|
-
|
|
2244
|
-
// ../../lib/adapter-utils/src/resolve-adapter-common-options.ts
|
|
2245
|
-
function resolveAdapterCommonOptions(options, defaultName = "PolymorphicComponent", defaultDiagnostics = throwDiagnostics) {
|
|
2246
|
-
return {
|
|
2247
|
-
name: options.name ?? defaultName,
|
|
2248
|
-
diagnostics: options.enforcement?.diagnostics ?? defaultDiagnostics
|
|
2249
|
-
};
|
|
2250
|
-
}
|
|
2193
|
+
acc[key] = value;
|
|
2194
|
+
return acc;
|
|
2195
|
+
}, {});
|
|
2196
|
+
const getCompoundVariantClassNames = config === null || config === void 0 ? void 0 : (_config_compoundVariants = config.compoundVariants) === null || _config_compoundVariants === void 0 ? void 0 : _config_compoundVariants.reduce((acc, param) => {
|
|
2197
|
+
let { class: cvClass, className: cvClassName, ...compoundVariantOptions } = param;
|
|
2198
|
+
return Object.entries(compoundVariantOptions).every((param2) => {
|
|
2199
|
+
let [key, value] = param2;
|
|
2200
|
+
return Array.isArray(value) ? value.includes({
|
|
2201
|
+
...defaultVariants,
|
|
2202
|
+
...propsWithoutUndefined
|
|
2203
|
+
}[key]) : {
|
|
2204
|
+
...defaultVariants,
|
|
2205
|
+
...propsWithoutUndefined
|
|
2206
|
+
}[key] === value;
|
|
2207
|
+
}) ? [
|
|
2208
|
+
...acc,
|
|
2209
|
+
cvClass,
|
|
2210
|
+
cvClassName
|
|
2211
|
+
] : acc;
|
|
2212
|
+
}, []);
|
|
2213
|
+
return cx(base, getVariantClassNames, getCompoundVariantClassNames, props === null || props === void 0 ? void 0 : props.class, props === null || props === void 0 ? void 0 : props.className);
|
|
2214
|
+
};
|
|
2251
2215
|
|
|
2252
|
-
// ../../lib/
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2216
|
+
// ../../lib/styling/src/cva.ts
|
|
2217
|
+
function cva2(base, config) {
|
|
2218
|
+
const fn = cva(base, config);
|
|
2219
|
+
return (props) => cn(fn(props));
|
|
2220
|
+
}
|
|
2221
|
+
|
|
2222
|
+
// ../../lib/styling/src/static-class-resolver.ts
|
|
2223
|
+
var StaticClassResolver = class {
|
|
2224
|
+
#baseClass;
|
|
2225
|
+
#cache = /* @__PURE__ */ new Map();
|
|
2226
|
+
#resolveTag;
|
|
2227
|
+
constructor(baseClass, tagMap) {
|
|
2228
|
+
this.#baseClass = Array.isArray(baseClass) ? baseClass.join(" ") : baseClass;
|
|
2229
|
+
this.#resolveTag = tagMap ? (tag) => {
|
|
2230
|
+
const extra = tagMap[tag];
|
|
2231
|
+
if (!extra) return this.#baseClass;
|
|
2232
|
+
const extraStr = Array.isArray(extra) ? extra.join(" ") : extra;
|
|
2233
|
+
return `${this.#baseClass} ${extraStr}`;
|
|
2234
|
+
} : () => this.#baseClass;
|
|
2235
|
+
}
|
|
2236
|
+
resolve(tag, skipTagMap = false) {
|
|
2237
|
+
if (typeof tag !== "string" || skipTagMap) return this.#baseClass;
|
|
2238
|
+
const cached = this.#cache.get(tag);
|
|
2239
|
+
if (cached !== void 0) {
|
|
2240
|
+
this.#cache.delete(tag);
|
|
2241
|
+
this.#cache.set(tag, cached);
|
|
2242
|
+
return cached;
|
|
2243
|
+
}
|
|
2244
|
+
const result = this.#resolveTag(tag);
|
|
2245
|
+
this.#cache.set(tag, result);
|
|
2246
|
+
if (this.#cache.size > 200) {
|
|
2247
|
+
const lru = this.#cache.keys().next().value;
|
|
2248
|
+
if (lru !== void 0) this.#cache.delete(lru);
|
|
2249
|
+
}
|
|
2250
|
+
return result;
|
|
2260
2251
|
}
|
|
2261
|
-
|
|
2262
|
-
|
|
2252
|
+
};
|
|
2253
|
+
|
|
2254
|
+
// ../../lib/styling/src/variant-class-resolver.ts
|
|
2255
|
+
var VariantClassResolver = class _VariantClassResolver {
|
|
2256
|
+
#cvaFn;
|
|
2257
|
+
#recipeMap;
|
|
2258
|
+
#variantKeys;
|
|
2259
|
+
#precomputedClasses;
|
|
2260
|
+
#cache = /* @__PURE__ */ new Map();
|
|
2261
|
+
constructor(cvaFn, recipeMap, variantKeys, precomputedClasses) {
|
|
2262
|
+
this.#cvaFn = cvaFn ?? null;
|
|
2263
|
+
this.#recipeMap = Object.freeze(recipeMap ?? {});
|
|
2264
|
+
this.#variantKeys = variantKeys ?? null;
|
|
2265
|
+
this.#precomputedClasses = precomputedClasses ?? null;
|
|
2266
|
+
}
|
|
2267
|
+
resolve({ props, recipe }) {
|
|
2268
|
+
const normalizedKey = recipe ?? "__none__";
|
|
2269
|
+
const cacheKey = this.#createCacheKey(props, normalizedKey);
|
|
2270
|
+
if (this.#precomputedClasses !== null) {
|
|
2271
|
+
const precomputed = this.#precomputedClasses[cacheKey];
|
|
2272
|
+
if (precomputed !== void 0) return precomputed;
|
|
2273
|
+
}
|
|
2274
|
+
const cached = this.#cache.get(cacheKey);
|
|
2275
|
+
if (cached !== void 0) {
|
|
2276
|
+
this.#cache.delete(cacheKey);
|
|
2277
|
+
this.#cache.set(cacheKey, cached);
|
|
2278
|
+
return cached;
|
|
2279
|
+
}
|
|
2280
|
+
const result = this.#compute(props, recipe);
|
|
2281
|
+
this.#cache.set(cacheKey, result);
|
|
2282
|
+
if (this.#cache.size > 1e3) {
|
|
2283
|
+
const lru = this.#cache.keys().next().value;
|
|
2284
|
+
if (lru !== void 0) this.#cache.delete(lru);
|
|
2285
|
+
}
|
|
2286
|
+
return result;
|
|
2263
2287
|
}
|
|
2264
|
-
|
|
2265
|
-
|
|
2288
|
+
#compute(props, recipe) {
|
|
2289
|
+
if (!this.#cvaFn) return "";
|
|
2290
|
+
if (!recipe) return this.#cvaFn(props);
|
|
2291
|
+
const preset = this.#recipeMap[recipe];
|
|
2292
|
+
if (!preset) return this.#cvaFn(props);
|
|
2293
|
+
return this.#cvaFn({ ...preset, ...props });
|
|
2294
|
+
}
|
|
2295
|
+
// When variantKeys is provided, only those keys are included in the cache key — non-variant
|
|
2296
|
+
// props (className, id, etc.) produce identical CVA output and must not fragment the cache.
|
|
2297
|
+
// Iterating #variantKeys directly (fixed Set insertion order) avoids Object.keys + filter + sort.
|
|
2298
|
+
// String is built incrementally to avoid a parts[] array allocation on every render.
|
|
2299
|
+
#createCacheKey(props, recipe) {
|
|
2300
|
+
if (this.#variantKeys !== null) {
|
|
2301
|
+
let key2 = recipe;
|
|
2302
|
+
iterate.forEachSet(this.#variantKeys, (k) => {
|
|
2303
|
+
if (k in props) key2 += `|${k}:${_VariantClassResolver.#serializeValue(props[k])}`;
|
|
2304
|
+
});
|
|
2305
|
+
return key2;
|
|
2306
|
+
}
|
|
2307
|
+
let key = recipe;
|
|
2308
|
+
iterate.forEach(Object.keys(props).sort(), (k) => {
|
|
2309
|
+
key += `|${k}:${_VariantClassResolver.#serializeValue(props[k])}`;
|
|
2310
|
+
});
|
|
2311
|
+
return key;
|
|
2266
2312
|
}
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
)
|
|
2313
|
+
static #serializeValue(value) {
|
|
2314
|
+
if (value === void 0) return "u";
|
|
2315
|
+
if (value === null) return "n";
|
|
2316
|
+
if (typeof value === "boolean") return `b:${value}`;
|
|
2317
|
+
if (typeof value === "string") return `s:${value}`;
|
|
2318
|
+
return `x:${String(value)}`;
|
|
2271
2319
|
}
|
|
2272
2320
|
};
|
|
2273
2321
|
|
|
2274
|
-
// ../../lib/
|
|
2275
|
-
function
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
2322
|
+
// ../../lib/styling/src/create-class-pipeline.ts
|
|
2323
|
+
function createClassPipeline(resolved) {
|
|
2324
|
+
const baseClass = resolved.baseClassName ?? "";
|
|
2325
|
+
const cvaFn = resolved.variants ? cva2("", {
|
|
2326
|
+
variants: resolved.variants,
|
|
2327
|
+
defaultVariants: resolved.defaultVariants,
|
|
2328
|
+
compoundVariants: resolved.compoundVariants
|
|
2329
|
+
}) : null;
|
|
2330
|
+
const variantKeys = resolved.variants ? new Set(Object.keys(resolved.variants)) : void 0;
|
|
2331
|
+
const staticResolver = new StaticClassResolver(baseClass, resolved.tagMap);
|
|
2332
|
+
const variantResolver = new VariantClassResolver(
|
|
2333
|
+
cvaFn,
|
|
2334
|
+
resolved.recipeMap,
|
|
2335
|
+
variantKeys,
|
|
2336
|
+
resolved.precomputedClasses
|
|
2337
|
+
);
|
|
2338
|
+
return function resolveClasses(tag, props, className, recipe) {
|
|
2339
|
+
const staticClasses = staticResolver.resolve(tag, recipe !== void 0);
|
|
2340
|
+
const variantClasses = variantResolver.resolve({ props, recipe });
|
|
2341
|
+
if (!className)
|
|
2342
|
+
return staticClasses && variantClasses ? `${staticClasses} ${variantClasses}` : staticClasses || variantClasses;
|
|
2343
|
+
return cn(staticClasses, variantClasses, className);
|
|
2285
2344
|
};
|
|
2286
2345
|
}
|
|
2287
2346
|
|
|
2288
|
-
// ../../lib/
|
|
2289
|
-
function
|
|
2290
|
-
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
|
|
2295
|
-
|
|
2296
|
-
);
|
|
2297
|
-
}
|
|
2298
|
-
function buildVariantConfig(variants, presets, defaults, compounds) {
|
|
2299
|
-
return {
|
|
2300
|
-
variants: mapVariantRecord(variants ?? {}, flattenClassName),
|
|
2301
|
-
...presets !== void 0 && Object.keys(presets).length > 0 && { presets },
|
|
2302
|
-
...defaults !== void 0 && Object.keys(defaults).length > 0 && { defaults },
|
|
2303
|
-
...compounds !== void 0 && compounds.length > 0 && {
|
|
2304
|
-
compounds
|
|
2347
|
+
// ../../lib/pipeline-kit/src/factory/define-pipeline.ts
|
|
2348
|
+
function definePipeline(factory) {
|
|
2349
|
+
const cache = /* @__PURE__ */ new WeakMap();
|
|
2350
|
+
return (resolved) => {
|
|
2351
|
+
let pipeline = cache.get(resolved);
|
|
2352
|
+
if (!pipeline) {
|
|
2353
|
+
pipeline = factory(resolved);
|
|
2354
|
+
cache.set(resolved, pipeline);
|
|
2305
2355
|
}
|
|
2356
|
+
return pipeline;
|
|
2306
2357
|
};
|
|
2307
2358
|
}
|
|
2308
2359
|
|
|
2309
|
-
//
|
|
2310
|
-
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
|
-
if (
|
|
2314
|
-
|
|
2315
|
-
|
|
2316
|
-
|
|
2317
|
-
|
|
2318
|
-
|
|
2319
|
-
|
|
2320
|
-
|
|
2321
|
-
return { ...decoration, [nodeId]: nextDecoration };
|
|
2322
|
-
}
|
|
2323
|
-
|
|
2324
|
-
// ../../runtime/core/src/get-active-props.ts
|
|
2325
|
-
function getActiveProps(nodeId, decoration) {
|
|
2326
|
-
const dec = decoration[nodeId];
|
|
2327
|
-
return { ...dec?.attributes ?? {}, ...dec?.variants ?? {} };
|
|
2360
|
+
// ../core/src/options/resolve-factory-options.ts
|
|
2361
|
+
import { silentDiagnostics } from "../_shared/diagnostics.js";
|
|
2362
|
+
var EMPTY_VARIANT_KEYS = /* @__PURE__ */ new Set();
|
|
2363
|
+
function composeNormalizers(normalizers, fn) {
|
|
2364
|
+
if (!normalizers?.length) return fn;
|
|
2365
|
+
return ((props) => {
|
|
2366
|
+
const patched = normalizers.reduce(
|
|
2367
|
+
(acc, normalizer) => ({ ...acc, ...normalizer(acc) }),
|
|
2368
|
+
props
|
|
2369
|
+
);
|
|
2370
|
+
return fn ? fn(patched) : patched;
|
|
2371
|
+
});
|
|
2328
2372
|
}
|
|
2329
|
-
|
|
2330
|
-
|
|
2331
|
-
|
|
2332
|
-
|
|
2373
|
+
function whenDefined(key, value) {
|
|
2374
|
+
return value === void 0 ? {} : { [key]: value };
|
|
2375
|
+
}
|
|
2376
|
+
function resolveFactoryOptions(options = {}) {
|
|
2377
|
+
const { styling, enforcement } = options;
|
|
2378
|
+
const composedNormalizeFn = composeNormalizers(enforcement?.props, options.normalize);
|
|
2379
|
+
const variantKeys = styling?.variants === void 0 ? EMPTY_VARIANT_KEYS : new Set(Object.keys(styling.variants));
|
|
2380
|
+
return Object.freeze({
|
|
2381
|
+
defaultTag: options.tag ?? "div",
|
|
2382
|
+
diagnostics: enforcement?.diagnostics ?? silentDiagnostics,
|
|
2383
|
+
variantKeys,
|
|
2384
|
+
...whenDefined("displayName", options.name),
|
|
2385
|
+
...whenDefined("defaultProps", options.defaults),
|
|
2386
|
+
...whenDefined("baseClassName", styling?.base),
|
|
2387
|
+
...whenDefined("tagMap", styling?.tags),
|
|
2388
|
+
...whenDefined("recipeMap", styling?.presets),
|
|
2389
|
+
...whenDefined("variants", styling?.variants),
|
|
2390
|
+
...whenDefined("defaultVariants", styling?.defaults),
|
|
2391
|
+
...whenDefined("compoundVariants", styling?.compounds),
|
|
2392
|
+
...whenDefined("normalizeFn", composedNormalizeFn),
|
|
2393
|
+
...whenDefined("ariaRules", enforcement?.aria),
|
|
2394
|
+
...whenDefined("childRules", enforcement?.children),
|
|
2395
|
+
...whenDefined("allowedAs", enforcement?.allowedAs),
|
|
2396
|
+
...whenDefined("precomputedClasses", styling?.precomputedClasses)
|
|
2397
|
+
});
|
|
2333
2398
|
}
|
|
2334
2399
|
|
|
2335
|
-
//
|
|
2336
|
-
function
|
|
2337
|
-
if (
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
|
|
2400
|
+
// ../core/src/options/validate-factory-options.ts
|
|
2401
|
+
function validateFactoryOptions(resolved, diagnostics) {
|
|
2402
|
+
if (!diagnostics.active) return;
|
|
2403
|
+
const name = resolved.displayName ?? "Component";
|
|
2404
|
+
const { variants } = resolved;
|
|
2405
|
+
const checkSelection = (label2, selection) => {
|
|
2406
|
+
iterate.forEachEntry(selection, (dim, value) => {
|
|
2407
|
+
if (value === void 0 || value === null) return;
|
|
2408
|
+
if (!variants || !Object.hasOwn(variants, dim)) {
|
|
2409
|
+
diagnostics.error(ContractDiagnostics.unknownVariantDim(name, label2, dim));
|
|
2410
|
+
return;
|
|
2411
|
+
}
|
|
2412
|
+
const states = variants[dim];
|
|
2413
|
+
const stateKey = String(value);
|
|
2414
|
+
if (!Object.hasOwn(states, stateKey)) {
|
|
2415
|
+
diagnostics.error(
|
|
2416
|
+
ContractDiagnostics.unknownVariantValue(name, label2, dim, stateKey, Object.keys(states))
|
|
2417
|
+
);
|
|
2418
|
+
}
|
|
2419
|
+
});
|
|
2420
|
+
};
|
|
2421
|
+
const { recipeMap } = resolved;
|
|
2422
|
+
if (recipeMap) {
|
|
2423
|
+
iterate.forEachEntry(recipeMap, (recipeKey, selection) => {
|
|
2424
|
+
checkSelection(`preset "${recipeKey}"`, selection);
|
|
2342
2425
|
});
|
|
2343
|
-
} else {
|
|
2344
|
-
seenIds.add(input.id);
|
|
2345
|
-
}
|
|
2346
|
-
if (input.slot !== void 0) {
|
|
2347
|
-
slotAssignments.set(input.id, input.slot);
|
|
2348
|
-
}
|
|
2349
|
-
const children = Object.freeze(
|
|
2350
|
-
(input.children ?? []).map((child) => buildNode(child, slotAssignments, seenIds, diagnostics))
|
|
2351
|
-
);
|
|
2352
|
-
if (input.kind === "native") {
|
|
2353
|
-
return Object.freeze({ kind: "native", id: input.id, tag: input.tag, children });
|
|
2354
2426
|
}
|
|
2355
|
-
|
|
2356
|
-
}
|
|
2357
|
-
function buildTreeContext(root) {
|
|
2358
|
-
const slotAssignments = /* @__PURE__ */ new Map();
|
|
2359
|
-
const diagnostics = [];
|
|
2360
|
-
const rootNode = buildNode(root, slotAssignments, /* @__PURE__ */ new Set(), diagnostics);
|
|
2361
|
-
return Object.freeze({ root: rootNode, slotAssignments, diagnostics });
|
|
2362
|
-
}
|
|
2363
|
-
|
|
2364
|
-
// ../../runtime/core/src/build-render-context.ts
|
|
2365
|
-
function buildRenderContext(decoration = {}) {
|
|
2366
|
-
return { decoration: new Map(Object.entries(decoration)) };
|
|
2427
|
+
if (resolved.defaultVariants) checkSelection("defaults", resolved.defaultVariants);
|
|
2367
2428
|
}
|
|
2368
2429
|
|
|
2369
|
-
//
|
|
2370
|
-
function
|
|
2371
|
-
|
|
2372
|
-
return Object.entries(conditions).every(([key, expected]) => {
|
|
2373
|
-
const actual = active[key];
|
|
2374
|
-
return Array.isArray(expected) ? expected.includes(actual) : actual === expected;
|
|
2375
|
-
});
|
|
2430
|
+
// ../core/src/options/validate-render-props.ts
|
|
2431
|
+
function label(name) {
|
|
2432
|
+
return name ? `[${name}]` : "[createContractComponent]";
|
|
2376
2433
|
}
|
|
2377
|
-
function
|
|
2378
|
-
|
|
2379
|
-
const
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
|
|
2385
|
-
|
|
2434
|
+
function validateRenderProps(diagnostics, options, props, recipeKey) {
|
|
2435
|
+
const { recipeMap, variants, displayName } = options;
|
|
2436
|
+
const tag = label(displayName);
|
|
2437
|
+
if (recipeKey !== void 0 && (!recipeMap || !Object.hasOwn(recipeMap, recipeKey))) {
|
|
2438
|
+
diagnostics.error(ContractDiagnostics.unknownRecipeKey(tag, recipeKey));
|
|
2439
|
+
}
|
|
2440
|
+
if (variants) {
|
|
2441
|
+
iterate.forEachKey(variants, (key) => {
|
|
2442
|
+
if (!Object.hasOwn(props, key)) return;
|
|
2443
|
+
const value = props[key];
|
|
2444
|
+
if (value === void 0 || value === null) return;
|
|
2445
|
+
const dim = variants[key];
|
|
2446
|
+
if (dim && !Object.hasOwn(dim, String(value))) {
|
|
2447
|
+
diagnostics.error(ContractDiagnostics.invalidVariantValue(tag, key, String(value)));
|
|
2448
|
+
}
|
|
2449
|
+
});
|
|
2450
|
+
}
|
|
2386
2451
|
}
|
|
2387
2452
|
|
|
2388
|
-
//
|
|
2389
|
-
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
|
|
2396
|
-
|
|
2397
|
-
|
|
2398
|
-
|
|
2399
|
-
|
|
2400
|
-
|
|
2401
|
-
|
|
2402
|
-
|
|
2403
|
-
|
|
2404
|
-
|
|
2453
|
+
// ../core/src/factory/plugin-invariants.ts
|
|
2454
|
+
import { throwDiagnostics } from "../_shared/diagnostics.js";
|
|
2455
|
+
|
|
2456
|
+
// ../core/src/factory/plugin-diagnostics.ts
|
|
2457
|
+
import { DiagnosticCategory as DiagnosticCategory5, DiagnosticCode as DiagnosticCode5 } from "../_shared/diagnostics.js";
|
|
2458
|
+
var PluginDiagnostics = {
|
|
2459
|
+
invalidShape(received) {
|
|
2460
|
+
const got = received === null ? "null" : typeof received;
|
|
2461
|
+
return {
|
|
2462
|
+
code: DiagnosticCode5.PluginInvalidShape,
|
|
2463
|
+
category: DiagnosticCategory5.Internal,
|
|
2464
|
+
message: `[praxis-kit] Plugin factory must return an object with a 'pipeline' function. Got: ${got}.`
|
|
2465
|
+
};
|
|
2466
|
+
},
|
|
2467
|
+
pipelineReturnType(received) {
|
|
2468
|
+
const got = received === null ? "null" : Array.isArray(received) ? "array" : typeof received;
|
|
2469
|
+
return {
|
|
2470
|
+
code: DiagnosticCode5.PluginPipelineReturnType,
|
|
2471
|
+
category: DiagnosticCategory5.Internal,
|
|
2472
|
+
message: `[praxis-kit] Plugin pipeline must return a string. Got: ${got}.`
|
|
2473
|
+
};
|
|
2405
2474
|
}
|
|
2406
|
-
|
|
2407
|
-
|
|
2408
|
-
|
|
2409
|
-
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
|
|
2413
|
-
|
|
2475
|
+
};
|
|
2476
|
+
|
|
2477
|
+
// ../core/src/factory/plugin-invariants.ts
|
|
2478
|
+
function assertPluginShape(result) {
|
|
2479
|
+
if (result === null || typeof result !== "object")
|
|
2480
|
+
throwDiagnostics.error(PluginDiagnostics.invalidShape(result));
|
|
2481
|
+
const plugin = result;
|
|
2482
|
+
if (typeof plugin.pipeline !== "function")
|
|
2483
|
+
throwDiagnostics.error(PluginDiagnostics.invalidShape(result));
|
|
2484
|
+
}
|
|
2485
|
+
function guardPipeline(pipeline) {
|
|
2486
|
+
if (process.env.NODE_ENV === "production") return pipeline;
|
|
2487
|
+
return function guardedPipeline(tag, props, className, recipe) {
|
|
2488
|
+
const result = pipeline(tag, props, className, recipe);
|
|
2489
|
+
if (typeof result !== "string")
|
|
2490
|
+
throwDiagnostics.error(PluginDiagnostics.pipelineReturnType(result));
|
|
2491
|
+
return result;
|
|
2414
2492
|
};
|
|
2415
|
-
const compoundClasses = resolveCompounds(resolvedValues, compounds);
|
|
2416
|
-
return { variantClasses, compoundClasses };
|
|
2417
2493
|
}
|
|
2418
2494
|
|
|
2419
|
-
//
|
|
2420
|
-
|
|
2421
|
-
|
|
2422
|
-
|
|
2495
|
+
// ../core/src/factory/create-polymorphic2.ts
|
|
2496
|
+
var createTagPipeline = (resolved) => makeResolveTag(resolved.defaultTag);
|
|
2497
|
+
var createPropsPipeline = (resolved) => (props) => mergeProps(resolved.defaultProps, props);
|
|
2498
|
+
var createHtmlPropNormalizersPipeline = () => getHtmlPropNormalizers;
|
|
2499
|
+
var createHtmlChildrenEvaluatorPipeline = () => getHtmlChildrenEvaluator;
|
|
2500
|
+
var createStylingClassPipeline = (resolved) => createClassPipeline(resolved);
|
|
2501
|
+
function resolveAriaRules(resolved) {
|
|
2502
|
+
return [.../* @__PURE__ */ new Set([...HTML_ARIA_RULES, ...resolved.ariaRules ?? []])];
|
|
2503
|
+
}
|
|
2504
|
+
var createAriaPipeline = (resolved) => {
|
|
2505
|
+
const rules = resolveAriaRules(resolved);
|
|
2506
|
+
const engine = new AriaPolicyEngine(resolved.diagnostics, rules.length ? { rules } : void 0);
|
|
2507
|
+
return (tag, props) => engine.validate(tag, props);
|
|
2508
|
+
};
|
|
2509
|
+
var memoizedTagPipeline = definePipeline(createTagPipeline);
|
|
2510
|
+
var memoizedPropsPipeline = definePipeline(createPropsPipeline);
|
|
2511
|
+
var memoizedHtmlPropNormalizersPipeline = definePipeline(createHtmlPropNormalizersPipeline);
|
|
2512
|
+
var memoizedHtmlChildrenEvaluatorPipeline = definePipeline(createHtmlChildrenEvaluatorPipeline);
|
|
2513
|
+
var memoizedClassPipeline = definePipeline(createStylingClassPipeline);
|
|
2514
|
+
var memoizedAriaPipeline = definePipeline(createAriaPipeline);
|
|
2515
|
+
function resolveAriaPassthrough(_tag, props) {
|
|
2516
|
+
return { props };
|
|
2517
|
+
}
|
|
2518
|
+
function resolveClassPlugin(factory, resolved, diagnostics) {
|
|
2519
|
+
if (!factory) return { pluginResult: void 0, classPipeline: memoizedClassPipeline(resolved) };
|
|
2520
|
+
const pluginResult = factory(resolved, diagnostics);
|
|
2521
|
+
assertPluginShape(pluginResult);
|
|
2522
|
+
return { pluginResult, classPipeline: guardPipeline(pluginResult.pipeline) };
|
|
2523
|
+
}
|
|
2524
|
+
function createPolymorphic2(options = {}) {
|
|
2525
|
+
const baseResolved = resolveFactoryOptions(options);
|
|
2526
|
+
const anyBaseResolved = baseResolved;
|
|
2527
|
+
const resolved = Object.freeze({
|
|
2528
|
+
...baseResolved,
|
|
2529
|
+
htmlPropNormalizersFn: memoizedHtmlPropNormalizersPipeline(anyBaseResolved),
|
|
2530
|
+
htmlChildrenEvaluatorFn: memoizedHtmlChildrenEvaluatorPipeline(anyBaseResolved)
|
|
2531
|
+
});
|
|
2532
|
+
const anyResolved = resolved;
|
|
2533
|
+
if (process.env.NODE_ENV !== "production") {
|
|
2534
|
+
validateFactoryOptions(resolved, resolved.diagnostics);
|
|
2423
2535
|
}
|
|
2424
|
-
const
|
|
2425
|
-
|
|
2426
|
-
|
|
2427
|
-
|
|
2536
|
+
const { pluginResult, classPipeline } = resolveClassPlugin(
|
|
2537
|
+
options.styling?.plugin,
|
|
2538
|
+
anyResolved,
|
|
2539
|
+
resolved.diagnostics
|
|
2540
|
+
);
|
|
2541
|
+
const resolveTag2 = memoizedTagPipeline(anyResolved);
|
|
2542
|
+
const resolveProps = memoizedPropsPipeline(anyResolved);
|
|
2543
|
+
const resolveAriaFn = options.enforcement !== void 0 ? memoizedAriaPipeline(anyResolved) : resolveAriaPassthrough;
|
|
2544
|
+
const methods = {
|
|
2545
|
+
resolveTag: resolveTag2,
|
|
2546
|
+
resolveProps,
|
|
2547
|
+
resolveClasses(tag, props, className, recipe) {
|
|
2548
|
+
if (process.env.NODE_ENV !== "production") {
|
|
2549
|
+
validateRenderProps(resolved.diagnostics, resolved, props, recipe);
|
|
2550
|
+
}
|
|
2551
|
+
return classPipeline(tag, props, className, recipe);
|
|
2552
|
+
},
|
|
2553
|
+
resolveAria(tag, props) {
|
|
2554
|
+
return resolveAriaFn(tag, props);
|
|
2428
2555
|
}
|
|
2429
2556
|
};
|
|
2557
|
+
const runtimeObject = pluginResult ? { ...methods, options: resolved, hasStyling: true, classPlugin: pluginResult } : { ...methods, options: resolved };
|
|
2558
|
+
return runtimeObject;
|
|
2430
2559
|
}
|
|
2431
2560
|
|
|
2432
|
-
//
|
|
2433
|
-
|
|
2434
|
-
|
|
2561
|
+
// ../core/src/resolver/resolver.ts
|
|
2562
|
+
import { silentDiagnostics as silentDiagnostics2 } from "../_shared/diagnostics.js";
|
|
2563
|
+
function enforceAllowedAs(tag, allowedAs, diagnostics, displayName) {
|
|
2564
|
+
if (allowedAs.includes(tag)) return;
|
|
2565
|
+
if (!diagnostics) return;
|
|
2566
|
+
const component = displayName ?? String(tag);
|
|
2567
|
+
diagnostics.error(ContractDiagnostics.allowedAsViolation(String(tag), allowedAs, component));
|
|
2435
2568
|
}
|
|
2436
2569
|
|
|
2437
|
-
// ../../lib/adapter-utils/src/
|
|
2438
|
-
|
|
2439
|
-
|
|
2440
|
-
|
|
2570
|
+
// ../../lib/adapter-utils/src/runtime/build-core-runtime.ts
|
|
2571
|
+
var EMPTY_SET = /* @__PURE__ */ new Set();
|
|
2572
|
+
function buildCoreRuntime(normalized) {
|
|
2573
|
+
const runtime = createPolymorphic2(normalized);
|
|
2574
|
+
const ownedKeys = "classPlugin" in runtime ? runtime.classPlugin.ownedKeys ?? EMPTY_SET : EMPTY_SET;
|
|
2575
|
+
return { runtime, ownedKeys };
|
|
2441
2576
|
}
|
|
2442
2577
|
|
|
2443
|
-
// ../../lib/adapter-utils/src/
|
|
2444
|
-
function
|
|
2445
|
-
|
|
2446
|
-
const dec = decoration["root"];
|
|
2447
|
-
if (dec?.attributes === void 0) return decoration;
|
|
2448
|
-
const result = ariaEngine.validate(tag, dec.attributes);
|
|
2449
|
-
const cleaned = result.props;
|
|
2450
|
-
return {
|
|
2451
|
-
...decoration,
|
|
2452
|
-
root: withAttributes(dec, Object.keys(cleaned).length > 0 ? cleaned : void 0)
|
|
2453
|
-
};
|
|
2578
|
+
// ../../lib/adapter-utils/src/runtime/build-engines.ts
|
|
2579
|
+
function buildEngines(diagnostics, childRules, context) {
|
|
2580
|
+
return childRules?.length ? { childrenEvaluator: new ChildrenEvaluator(childRules, diagnostics, context) } : {};
|
|
2454
2581
|
}
|
|
2455
2582
|
|
|
2456
|
-
// ../../lib/adapter-utils/src/
|
|
2457
|
-
|
|
2458
|
-
|
|
2459
|
-
const dec = decoration["root"];
|
|
2460
|
-
if (dec?.attributes === void 0) return decoration;
|
|
2461
|
-
const kept = Object.fromEntries(
|
|
2462
|
-
Object.entries(dec.attributes).filter(([k]) => !filterFn(k, variantKeys))
|
|
2463
|
-
);
|
|
2583
|
+
// ../../lib/adapter-utils/src/runtime/resolve-adapter-common-options.ts
|
|
2584
|
+
import { throwDiagnostics as throwDiagnostics2, silentDiagnostics as silentDiagnostics3 } from "../_shared/diagnostics.js";
|
|
2585
|
+
function resolveAdapterCommonOptions(options, defaultName = "PolymorphicComponent", defaultDiagnostics = throwDiagnostics2) {
|
|
2464
2586
|
return {
|
|
2465
|
-
|
|
2466
|
-
|
|
2587
|
+
name: options.name ?? defaultName,
|
|
2588
|
+
diagnostics: options.enforcement?.diagnostics ?? defaultDiagnostics
|
|
2467
2589
|
};
|
|
2468
2590
|
}
|
|
2469
2591
|
|
|
2470
|
-
// ../../
|
|
2471
|
-
function
|
|
2472
|
-
|
|
2473
|
-
|
|
2474
|
-
|
|
2475
|
-
|
|
2476
|
-
|
|
2477
|
-
function assignIfNotEmpty(target, key, value) {
|
|
2478
|
-
if (Object.keys(value).length > 0) {
|
|
2479
|
-
target[key] = value;
|
|
2480
|
-
}
|
|
2481
|
-
}
|
|
2482
|
-
function extractStyles(value, styles) {
|
|
2483
|
-
if (!isObject(value)) return false;
|
|
2484
|
-
iterate.forEachEntry(value, (k, v) => {
|
|
2485
|
-
if (isStyleValue(v)) {
|
|
2486
|
-
styles[k] = v;
|
|
2487
|
-
}
|
|
2592
|
+
// ../../lib/adapter-utils/src/props/apply-filter.ts
|
|
2593
|
+
function applyFilter(props, filterProps, variantKeys) {
|
|
2594
|
+
const out = {};
|
|
2595
|
+
iterate.forEachEntry(props, (k) => {
|
|
2596
|
+
if (!Object.hasOwn(props, k)) return;
|
|
2597
|
+
if (filterProps(k, variantKeys)) return;
|
|
2598
|
+
out[k] = props[k];
|
|
2488
2599
|
});
|
|
2489
|
-
return
|
|
2490
|
-
}
|
|
2491
|
-
function extractListener(key, value, listeners) {
|
|
2492
|
-
if (!key.startsWith("on") || !isFunction(value)) {
|
|
2493
|
-
return false;
|
|
2494
|
-
}
|
|
2495
|
-
listeners[key] = value;
|
|
2496
|
-
return true;
|
|
2600
|
+
return out;
|
|
2497
2601
|
}
|
|
2498
|
-
|
|
2499
|
-
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
|
|
2503
|
-
|
|
2504
|
-
}
|
|
2505
|
-
function extractDecoration(props, variantKeys) {
|
|
2506
|
-
const attributes = {};
|
|
2507
|
-
const styles = {};
|
|
2508
|
-
const listeners = {};
|
|
2509
|
-
const variants = {};
|
|
2510
|
-
const dec = {};
|
|
2511
|
-
iterate.forEachEntry(props, (key, value) => {
|
|
2512
|
-
if (key === "children" || key === "slot" || key === "ref") return;
|
|
2513
|
-
if (key === "style" && extractStyles(value, styles)) return;
|
|
2514
|
-
if (extractListener(key, value, listeners)) return;
|
|
2515
|
-
if (isAttributeValue(value)) {
|
|
2516
|
-
extractAttributeOrVariant(key, value, attributes, variants, variantKeys);
|
|
2517
|
-
}
|
|
2518
|
-
});
|
|
2519
|
-
assignIfNotEmpty(dec, "attributes", attributes);
|
|
2520
|
-
assignIfNotEmpty(dec, "styles", styles);
|
|
2521
|
-
assignIfNotEmpty(dec, "listeners", listeners);
|
|
2522
|
-
assignIfNotEmpty(dec, "variants", variants);
|
|
2523
|
-
const ref = props.ref;
|
|
2524
|
-
if (ref !== void 0) {
|
|
2525
|
-
dec.ref = ref;
|
|
2602
|
+
|
|
2603
|
+
// ../../lib/adapter-utils/src/props/compose-filter.ts
|
|
2604
|
+
function composeFilter(ownedKeys, filterProps) {
|
|
2605
|
+
const defaultFilter = (key, variantKeys) => variantKeys.has(key) || ownedKeys.has(key);
|
|
2606
|
+
if (!filterProps) {
|
|
2607
|
+
return defaultFilter;
|
|
2526
2608
|
}
|
|
2527
|
-
return
|
|
2609
|
+
return (key, variantKeys) => defaultFilter(key, variantKeys) || filterProps(key, variantKeys);
|
|
2528
2610
|
}
|
|
2529
2611
|
|
|
2530
|
-
// ../../
|
|
2531
|
-
|
|
2532
|
-
|
|
2533
|
-
|
|
2534
|
-
|
|
2612
|
+
// ../../lib/adapter-utils/src/slot/slot-validator.ts
|
|
2613
|
+
var SlotValidator = class extends InvariantBase {
|
|
2614
|
+
#name;
|
|
2615
|
+
#elementTerm;
|
|
2616
|
+
constructor(name, diagnostics, elementTerm) {
|
|
2617
|
+
super(diagnostics);
|
|
2618
|
+
this.#name = name;
|
|
2619
|
+
this.#elementTerm = elementTerm;
|
|
2620
|
+
}
|
|
2621
|
+
assertExclusive() {
|
|
2622
|
+
this.violate(SlotDiagnostics.exclusive(this.#name));
|
|
2623
|
+
}
|
|
2624
|
+
warnDiscardedChildren(count) {
|
|
2625
|
+
this.warn(SlotDiagnostics.discardedChildren(this.#name, this.#elementTerm, count));
|
|
2626
|
+
}
|
|
2627
|
+
assertSingleChild(count) {
|
|
2628
|
+
this.violate(
|
|
2629
|
+
count === 0 ? SlotDiagnostics.singleChildRequired(this.#name, this.#elementTerm) : SlotDiagnostics.singleChildExceeded(this.#name, this.#elementTerm, count)
|
|
2630
|
+
);
|
|
2631
|
+
}
|
|
2632
|
+
};
|
|
2535
2633
|
|
|
2536
|
-
// ../../adapters/vue/src/
|
|
2537
|
-
function
|
|
2634
|
+
// ../../adapters/vue/src/build-runtime.ts
|
|
2635
|
+
function normalizeOptions(options) {
|
|
2538
2636
|
return {
|
|
2539
|
-
|
|
2540
|
-
...
|
|
2541
|
-
...decoration?.styles !== void 0 ? { style: decoration.styles } : {},
|
|
2542
|
-
...decoration?.listeners,
|
|
2543
|
-
...decoration?.ref !== void 0 ? { ref: decoration.ref } : {}
|
|
2637
|
+
...options,
|
|
2638
|
+
...resolveAdapterCommonOptions(options)
|
|
2544
2639
|
};
|
|
2545
2640
|
}
|
|
2546
|
-
|
|
2547
|
-
|
|
2548
|
-
|
|
2549
|
-
|
|
2550
|
-
const
|
|
2551
|
-
|
|
2552
|
-
|
|
2553
|
-
|
|
2554
|
-
|
|
2555
|
-
|
|
2556
|
-
|
|
2557
|
-
|
|
2558
|
-
if (node.kind === "component") {
|
|
2559
|
-
return h(Fragment, isRoot ? null : { key: node.id }, children);
|
|
2560
|
-
}
|
|
2561
|
-
const decoration = render.decoration.get(node.id);
|
|
2562
|
-
const base = buildPropsFromDecoration(isRoot ? "" : node.id, decoration);
|
|
2563
|
-
const { key: _key, ...rest } = base;
|
|
2564
|
-
const props = {
|
|
2565
|
-
...isRoot ? {} : { key: node.id },
|
|
2566
|
-
...rest,
|
|
2567
|
-
...decoration?.listeners !== void 0 ? normalizeListenerKeys(decoration.listeners) : {}
|
|
2641
|
+
function buildRuntime(options) {
|
|
2642
|
+
const normalized = normalizeOptions(options);
|
|
2643
|
+
const { runtime, ownedKeys } = buildCoreRuntime(normalized);
|
|
2644
|
+
const { diagnostics, enforcement, filterProps: userFilter, name } = normalized;
|
|
2645
|
+
const { childrenEvaluator } = buildEngines(diagnostics, enforcement?.children, name);
|
|
2646
|
+
const filterProps = composeFilter(ownedKeys, userFilter);
|
|
2647
|
+
const slotValidator = new SlotValidator(name, diagnostics, "VNode");
|
|
2648
|
+
const built = {
|
|
2649
|
+
runtime,
|
|
2650
|
+
filterProps,
|
|
2651
|
+
slotValidator,
|
|
2652
|
+
...childrenEvaluator !== void 0 && { childrenEvaluator }
|
|
2568
2653
|
};
|
|
2569
|
-
return
|
|
2654
|
+
return built;
|
|
2570
2655
|
}
|
|
2571
|
-
var vueBackend = {
|
|
2572
|
-
render(context) {
|
|
2573
|
-
return renderNode(context.tree.root, context.render, true);
|
|
2574
|
-
}
|
|
2575
|
-
};
|
|
2576
2656
|
|
|
2577
|
-
// ../../adapters/vue/src/
|
|
2578
|
-
|
|
2579
|
-
const treeCtx = buildTreeContext({ kind: "native", tag, id: "root", children: [] });
|
|
2580
|
-
const rendered = renderComponent(definition, treeCtx, buildRenderContext(decoration), vueBackend);
|
|
2581
|
-
if (slots?.default === void 0) return rendered;
|
|
2582
|
-
const { key: _key, ...props } = rendered.props ?? {};
|
|
2583
|
-
return h2(tag, props, { default: slots.default });
|
|
2584
|
-
}
|
|
2657
|
+
// ../../adapters/vue/src/render.ts
|
|
2658
|
+
import { cloneVNode, h as h3 } from "vue";
|
|
2585
2659
|
|
|
2586
2660
|
// ../../adapters/vue/src/normalize-children.ts
|
|
2587
2661
|
import { isVNode } from "vue";
|
|
@@ -2591,17 +2665,19 @@ function normalizeChildren(slots) {
|
|
|
2591
2665
|
return { vnodes, discarded: raw.length - vnodes.length };
|
|
2592
2666
|
}
|
|
2593
2667
|
|
|
2668
|
+
// ../../adapters/vue/src/slot/extractSlottable.ts
|
|
2669
|
+
import { h as h2, Fragment as Fragment2 } from "vue";
|
|
2670
|
+
|
|
2594
2671
|
// ../../adapters/vue/src/slot/Slottable.ts
|
|
2595
|
-
import { defineComponent, h
|
|
2672
|
+
import { defineComponent, h, Fragment } from "vue";
|
|
2596
2673
|
var Slottable = defineComponent({
|
|
2597
2674
|
name: "Slottable",
|
|
2598
2675
|
setup(_, { slots }) {
|
|
2599
|
-
return () =>
|
|
2676
|
+
return () => h(Fragment, null, slots.default?.());
|
|
2600
2677
|
}
|
|
2601
2678
|
});
|
|
2602
2679
|
|
|
2603
2680
|
// ../../adapters/vue/src/slot/extractSlottable.ts
|
|
2604
|
-
import { h as h4, Fragment as Fragment3 } from "vue";
|
|
2605
2681
|
function isSlottableVNode(vnode) {
|
|
2606
2682
|
return vnode.type === Slottable;
|
|
2607
2683
|
}
|
|
@@ -2624,127 +2700,123 @@ function extractSlottable(children) {
|
|
|
2624
2700
|
child,
|
|
2625
2701
|
rebuild(merged) {
|
|
2626
2702
|
const out = children.map((node, i) => i === index ? merged : node);
|
|
2627
|
-
return
|
|
2703
|
+
return h2(Fragment2, null, out);
|
|
2628
2704
|
}
|
|
2629
2705
|
};
|
|
2630
2706
|
}
|
|
2631
2707
|
|
|
2708
|
+
// ../../adapters/vue/src/render.ts
|
|
2709
|
+
var MULTI_WORD_EVENT_RE = /^on[A-Z][a-z]+[A-Z]/;
|
|
2710
|
+
function normalizeListenerKeys(props) {
|
|
2711
|
+
const out = {};
|
|
2712
|
+
for (const k in props) {
|
|
2713
|
+
out[MULTI_WORD_EVENT_RE.test(k) ? "on" + k.slice(2).toLowerCase() : k] = props[k];
|
|
2714
|
+
}
|
|
2715
|
+
return out;
|
|
2716
|
+
}
|
|
2717
|
+
function isAttributeValue(v) {
|
|
2718
|
+
return isString(v) || isNumber(v) || typeof v === "boolean";
|
|
2719
|
+
}
|
|
2720
|
+
function pickAttributes(props) {
|
|
2721
|
+
const out = {};
|
|
2722
|
+
for (const k in props) {
|
|
2723
|
+
if (isAttributeValue(props[k])) out[k] = props[k];
|
|
2724
|
+
}
|
|
2725
|
+
return out;
|
|
2726
|
+
}
|
|
2727
|
+
function prepareRenderState(runtime, attrs, filterProps) {
|
|
2728
|
+
const { as, asChild, class: callerClass, recipe, ...rest } = attrs;
|
|
2729
|
+
const tag = typeof as === "string" ? as : runtime.options.defaultTag;
|
|
2730
|
+
if (runtime.options.allowedAs !== void 0) {
|
|
2731
|
+
enforceAllowedAs(
|
|
2732
|
+
tag,
|
|
2733
|
+
runtime.options.allowedAs,
|
|
2734
|
+
runtime.options.diagnostics,
|
|
2735
|
+
runtime.options.displayName
|
|
2736
|
+
);
|
|
2737
|
+
}
|
|
2738
|
+
const mergedProps = runtime.resolveProps(rest);
|
|
2739
|
+
const htmlNormalizers = runtime.options.htmlPropNormalizersFn?.(tag);
|
|
2740
|
+
const htmlNormalizedProps = htmlNormalizers?.length ? htmlNormalizers.reduce((acc, fn) => ({ ...acc, ...fn(acc) }), mergedProps) : mergedProps;
|
|
2741
|
+
const normalizedProps = runtime.options.normalizeFn ? runtime.options.normalizeFn(htmlNormalizedProps) : htmlNormalizedProps;
|
|
2742
|
+
const className = runtime.resolveClasses(tag, normalizedProps, callerClass, recipe);
|
|
2743
|
+
const filteredProps = applyFilter(normalizedProps, filterProps, runtime.options.variantKeys);
|
|
2744
|
+
return {
|
|
2745
|
+
tag,
|
|
2746
|
+
directives: {
|
|
2747
|
+
...typeof as === "string" && { as },
|
|
2748
|
+
...asChild !== void 0 && { asChild }
|
|
2749
|
+
},
|
|
2750
|
+
props: filteredProps,
|
|
2751
|
+
className
|
|
2752
|
+
};
|
|
2753
|
+
}
|
|
2754
|
+
function buildElementProps(props, className) {
|
|
2755
|
+
const { role, ...rest } = props;
|
|
2756
|
+
return {
|
|
2757
|
+
...normalizeListenerKeys(rest),
|
|
2758
|
+
class: className,
|
|
2759
|
+
...isKnownAriaRole(role) && { role }
|
|
2760
|
+
};
|
|
2761
|
+
}
|
|
2762
|
+
function renderIntrinsic(state, runtime, slots) {
|
|
2763
|
+
const elementProps = buildElementProps(state.props, state.className);
|
|
2764
|
+
const domProps = runtime.resolveAria(state.tag, elementProps).props;
|
|
2765
|
+
return h3(state.tag, domProps, slots.default ? { default: slots.default } : void 0);
|
|
2766
|
+
}
|
|
2767
|
+
function validateSlotDirectives(directives, validator) {
|
|
2768
|
+
const { as, asChild } = directives;
|
|
2769
|
+
if (!asChild) return false;
|
|
2770
|
+
if (as !== void 0) {
|
|
2771
|
+
validator.assertExclusive();
|
|
2772
|
+
return false;
|
|
2773
|
+
}
|
|
2774
|
+
return true;
|
|
2775
|
+
}
|
|
2776
|
+
function tryRenderAsChild(state, children, discarded, validator) {
|
|
2777
|
+
if (!validateSlotDirectives(state.directives, validator)) return null;
|
|
2778
|
+
if (discarded > 0) validator.warnDiscardedChildren(discarded);
|
|
2779
|
+
const attrs = { ...pickAttributes(state.props), class: state.className };
|
|
2780
|
+
const slottable = extractSlottable(children);
|
|
2781
|
+
if (slottable) return slottable.rebuild(cloneVNode(slottable.child, attrs));
|
|
2782
|
+
if (children.length === 1 && children[0] !== void 0) {
|
|
2783
|
+
return cloneVNode(children[0], attrs);
|
|
2784
|
+
}
|
|
2785
|
+
validator.assertSingleChild(children.length);
|
|
2786
|
+
return null;
|
|
2787
|
+
}
|
|
2788
|
+
function render({
|
|
2789
|
+
runtime,
|
|
2790
|
+
state,
|
|
2791
|
+
slots,
|
|
2792
|
+
slotValidator,
|
|
2793
|
+
childrenEvaluator
|
|
2794
|
+
}) {
|
|
2795
|
+
const { vnodes: children, discarded } = normalizeChildren(slots);
|
|
2796
|
+
if (process.env.NODE_ENV !== "production") {
|
|
2797
|
+
childrenEvaluator?.evaluate(children);
|
|
2798
|
+
}
|
|
2799
|
+
const slotResult = tryRenderAsChild(state, children, discarded, slotValidator);
|
|
2800
|
+
return slotResult ?? renderIntrinsic(state, runtime, slots);
|
|
2801
|
+
}
|
|
2802
|
+
|
|
2632
2803
|
// ../../adapters/vue/src/create-contract-component.ts
|
|
2633
|
-
var EMPTY_SET = /* @__PURE__ */ new Set();
|
|
2634
2804
|
function createContractComponent(options) {
|
|
2635
|
-
const
|
|
2636
|
-
const displayName = resolved.name;
|
|
2637
|
-
const defaultTag = options.tag ?? "div";
|
|
2638
|
-
const definition = buildDefinition(displayName, defaultTag);
|
|
2639
|
-
const variantKeys = new Set(Object.keys(options.styling?.variants ?? {}));
|
|
2640
|
-
const domDefaults = options.defaults;
|
|
2641
|
-
const stylePipeline = buildStylePipeline(
|
|
2642
|
-
options.styling?.variants,
|
|
2643
|
-
options.styling?.presets,
|
|
2644
|
-
options.styling?.defaults ?? {},
|
|
2645
|
-
options.styling?.compounds,
|
|
2646
|
-
void 0
|
|
2647
|
-
);
|
|
2648
|
-
const base = options.styling?.base !== void 0 ? flattenClassName(options.styling.base) : void 0;
|
|
2649
|
-
const filterFn = options.filterProps;
|
|
2650
|
-
const allowedAs = options.enforcement?.allowedAs;
|
|
2651
|
-
const normalizeFn = options.normalize;
|
|
2652
|
-
const enforcementNormalizers = options.enforcement?.props;
|
|
2653
|
-
const classPlugin = options.styling?.plugin !== void 0 ? options.styling.plugin(
|
|
2654
|
-
options.styling,
|
|
2655
|
-
resolved.diagnostics
|
|
2656
|
-
) : void 0;
|
|
2657
|
-
const pluginKeys = classPlugin?.ownedKeys ?? EMPTY_SET;
|
|
2658
|
-
const { childrenEvaluator: explicitEvaluator } = buildEngines(
|
|
2659
|
-
resolved.diagnostics,
|
|
2660
|
-
options.enforcement?.children,
|
|
2661
|
-
displayName
|
|
2662
|
-
);
|
|
2663
|
-
const ariaEngine = options.enforcement !== void 0 ? new AriaPolicyEngine(resolved.diagnostics) : void 0;
|
|
2664
|
-
const slotValidator = new SlotValidator(displayName, resolved.diagnostics, "VNode");
|
|
2805
|
+
const bundle = buildRuntime(options);
|
|
2665
2806
|
const Component = defineComponent2({
|
|
2666
|
-
name
|
|
2807
|
+
// normalizeOptions always supplies `name`, so displayName is always defined here —
|
|
2808
|
+
// the fallback only satisfies the type, which allows it to be absent in general.
|
|
2809
|
+
name: bundle.runtime.options.displayName ?? "PolymorphicComponent",
|
|
2667
2810
|
inheritAttrs: false,
|
|
2668
2811
|
setup(_, { attrs, slots }) {
|
|
2669
|
-
const
|
|
2670
|
-
|
|
2671
|
-
|
|
2672
|
-
|
|
2673
|
-
class: callerClass,
|
|
2674
|
-
recipe,
|
|
2675
|
-
...ownProps
|
|
2676
|
-
} = attrs;
|
|
2677
|
-
const tag = typeof as === "string" ? as : defaultTag;
|
|
2678
|
-
if (allowedAs !== void 0)
|
|
2679
|
-
enforceAllowedAs(tag, allowedAs, resolved.diagnostics, displayName);
|
|
2680
|
-
const rawBaseProps = domDefaults !== void 0 ? { ...domDefaults, ...ownProps } : ownProps;
|
|
2681
|
-
const normalizedProps = applyPropNormalizers(tag, rawBaseProps, enforcementNormalizers);
|
|
2682
|
-
const baseProps = normalizeFn !== void 0 ? normalizeFn(normalizedProps) : normalizedProps;
|
|
2683
|
-
const pluginProps = {};
|
|
2684
|
-
const propsForExtraction = pluginKeys.size > 0 ? Object.fromEntries(
|
|
2685
|
-
Object.entries(baseProps).filter(([k]) => {
|
|
2686
|
-
if (pluginKeys.has(k)) {
|
|
2687
|
-
pluginProps[k] = baseProps[k];
|
|
2688
|
-
return false;
|
|
2689
|
-
}
|
|
2690
|
-
return true;
|
|
2691
|
-
})
|
|
2692
|
-
) : baseProps;
|
|
2693
|
-
const rootDec = extractDecoration(propsForExtraction, variantKeys);
|
|
2694
|
-
const decoration = applyAria(
|
|
2695
|
-
Object.keys(rootDec).length > 0 ? { root: rootDec } : {},
|
|
2696
|
-
tag,
|
|
2697
|
-
ariaEngine
|
|
2698
|
-
);
|
|
2699
|
-
const recipeName = typeof recipe === "string" ? recipe : void 0;
|
|
2700
|
-
const { variantClasses, compoundClasses } = stylePipeline ? stylePipeline.execute(decoration, recipeName) : { variantClasses: [], compoundClasses: [] };
|
|
2701
|
-
const rawClassName = joinClasses(
|
|
2702
|
-
base,
|
|
2703
|
-
...variantClasses,
|
|
2704
|
-
...compoundClasses,
|
|
2705
|
-
typeof callerClass === "string" ? callerClass : void 0
|
|
2706
|
-
);
|
|
2707
|
-
const className = classPlugin !== void 0 ? classPlugin.pipeline(tag, pluginProps, rawClassName, recipeName) : rawClassName;
|
|
2708
|
-
let finalDecoration = className ? applyAttributes("root", { className }, decoration, variantKeys) : decoration;
|
|
2709
|
-
finalDecoration = applyFilterProps(finalDecoration, filterFn, variantKeys);
|
|
2710
|
-
return { tag, asChild, as, finalDecoration, className };
|
|
2711
|
-
});
|
|
2712
|
-
return () => {
|
|
2713
|
-
const { tag, asChild, as, finalDecoration, className } = decorationState.value;
|
|
2714
|
-
const { vnodes: children, discarded } = normalizeChildren(slots);
|
|
2715
|
-
if (process.env.NODE_ENV !== "production") {
|
|
2716
|
-
const childEval = explicitEvaluator ?? getHtmlChildrenEvaluator(tag);
|
|
2717
|
-
childEval?.evaluate(children);
|
|
2718
|
-
}
|
|
2719
|
-
if (asChild === true) {
|
|
2720
|
-
if (typeof as === "string") {
|
|
2721
|
-
slotValidator.assertExclusive();
|
|
2722
|
-
} else {
|
|
2723
|
-
if (discarded > 0) slotValidator.warnDiscardedChildren(discarded);
|
|
2724
|
-
const extraction = extractSlottable(children);
|
|
2725
|
-
if (extraction) {
|
|
2726
|
-
return extraction.rebuild(
|
|
2727
|
-
cloneVNode(extraction.child, {
|
|
2728
|
-
...finalDecoration["root"]?.attributes,
|
|
2729
|
-
class: className
|
|
2730
|
-
})
|
|
2731
|
-
);
|
|
2732
|
-
}
|
|
2733
|
-
if (children.length === 1 && children[0] !== void 0) {
|
|
2734
|
-
return cloneVNode(children[0], {
|
|
2735
|
-
...finalDecoration["root"]?.attributes,
|
|
2736
|
-
class: className
|
|
2737
|
-
});
|
|
2738
|
-
}
|
|
2739
|
-
slotValidator.assertSingleChild(children.length);
|
|
2740
|
-
return null;
|
|
2741
|
-
}
|
|
2742
|
-
}
|
|
2743
|
-
return renderNormally(definition, tag, finalDecoration, slots);
|
|
2744
|
-
};
|
|
2812
|
+
const state = computed(
|
|
2813
|
+
() => prepareRenderState(bundle.runtime, attrs, bundle.filterProps)
|
|
2814
|
+
);
|
|
2815
|
+
return () => render({ ...bundle, state: state.value, slots });
|
|
2745
2816
|
}
|
|
2746
2817
|
});
|
|
2747
2818
|
applyDisplayName(Component, options.name);
|
|
2819
|
+
const defaultTag = bundle.runtime.options.defaultTag;
|
|
2748
2820
|
if (typeof defaultTag === "string") {
|
|
2749
2821
|
Object.assign(Component, { [COMPONENT_DEFAULT_TAG]: defaultTag });
|
|
2750
2822
|
}
|