praxis-kit 4.0.3 → 4.1.1
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 +14 -17
- package/dist/{chunk-DRGZ4ZI2.js → chunk-R2RKHZNX.js} +968 -634
- package/dist/contract/index.d.ts +39 -27
- package/dist/lit/index.d.ts +42 -30
- package/dist/lit/index.js +653 -413
- package/dist/preact/index.d.ts +45 -31
- package/dist/preact/index.js +1009 -685
- package/dist/react/index.d.ts +24 -11
- package/dist/react/index.js +21 -143
- package/dist/react/legacy.d.ts +3 -3
- package/dist/react/legacy.js +28 -147
- package/dist/{merge-refs-B0YcfdtP.d.ts → react-options-XrRof248.d.ts} +156 -100
- package/dist/solid/index.d.ts +45 -31
- package/dist/solid/index.js +521 -296
- package/dist/svelte/index.d.ts +55 -34
- package/dist/svelte/index.js +504 -296
- package/dist/tailwind/index.d.ts +29 -22
- package/dist/vite-plugin/index.d.ts +10 -12
- package/dist/vue/index.d.ts +45 -31
- package/dist/vue/index.js +898 -693
- package/dist/web/index.d.ts +43 -31
- package/dist/web/index.js +652 -406
- package/package.json +3 -3
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
|
|
@@ -528,7 +446,203 @@ function getImplicitRole(tag, props) {
|
|
|
528
446
|
if (tag === "section" || tag === "form") {
|
|
529
447
|
return getConditionalImplicitRole(tag, props?.["aria-label"], props?.["aria-labelledby"]);
|
|
530
448
|
}
|
|
531
|
-
return void 0;
|
|
449
|
+
return void 0;
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
// ../../lib/primitive/src/tag/resolve-tag.ts
|
|
453
|
+
function makeResolveTag(defaultTag) {
|
|
454
|
+
return function tag(as) {
|
|
455
|
+
return as ?? defaultTag;
|
|
456
|
+
};
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
// ../../lib/primitive/src/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
|
+
};
|
|
532
646
|
}
|
|
533
647
|
|
|
534
648
|
// ../../lib/contract/src/strict/invariant-base.ts
|
|
@@ -777,18 +891,18 @@ var ContractDiagnostics = {
|
|
|
777
891
|
message: `${context}: "${ruleName}" must be ${position}, got index ${index}`
|
|
778
892
|
};
|
|
779
893
|
},
|
|
780
|
-
unknownVariantDim(component,
|
|
894
|
+
unknownVariantDim(component, label2, dim) {
|
|
781
895
|
return {
|
|
782
896
|
code: DiagnosticCode2.ContractUnknownVariantDim,
|
|
783
897
|
category: DiagnosticCategory2.Contract,
|
|
784
|
-
message: `${component}: ${
|
|
898
|
+
message: `${component}: ${label2} references unknown variant "${dim}".`
|
|
785
899
|
};
|
|
786
900
|
},
|
|
787
|
-
unknownVariantValue(component,
|
|
901
|
+
unknownVariantValue(component, label2, dim, value, valid) {
|
|
788
902
|
return {
|
|
789
903
|
code: DiagnosticCode2.ContractUnknownVariantValue,
|
|
790
904
|
category: DiagnosticCategory2.Contract,
|
|
791
|
-
message: `${component}: ${
|
|
905
|
+
message: `${component}: ${label2} sets "${dim}" to unknown value "${value}" (valid: ${valid.join(", ")}).`
|
|
792
906
|
};
|
|
793
907
|
},
|
|
794
908
|
unknownRecipeKey(component, key) {
|
|
@@ -1586,7 +1700,7 @@ function getTypeName(value) {
|
|
|
1586
1700
|
return primitive;
|
|
1587
1701
|
}
|
|
1588
1702
|
const name = value.constructor?.name;
|
|
1589
|
-
return
|
|
1703
|
+
return isString(name) && name !== "Object" ? name : "object";
|
|
1590
1704
|
}
|
|
1591
1705
|
|
|
1592
1706
|
// ../../lib/contract/src/children/normalize-child-rule.ts
|
|
@@ -1880,12 +1994,17 @@ function landmarkNameAdvisory(ctx) {
|
|
|
1880
1994
|
if (!ctx.implicitRole || !NAMED_LANDMARK_TAGS.has(ctx.tag)) return [];
|
|
1881
1995
|
return requireAccessibleName(ctx);
|
|
1882
1996
|
}
|
|
1997
|
+
var HTML_ARIA_RULES = [landmarkRoleRule, landmarkNameAdvisory];
|
|
1883
1998
|
|
|
1884
1999
|
// ../core/src/html/contracts.ts
|
|
1885
2000
|
import { warnDiagnostics } from "../_shared/diagnostics.js";
|
|
1886
2001
|
function isOpenContent(...blockedTags) {
|
|
1887
2002
|
const set2 = new Set(blockedTags);
|
|
1888
|
-
return (child) =>
|
|
2003
|
+
return (child) => {
|
|
2004
|
+
if (!isObject(child) || !("type" in child)) return false;
|
|
2005
|
+
const tag = getTag(child);
|
|
2006
|
+
return tag === void 0 || !set2.has(tag);
|
|
2007
|
+
};
|
|
1889
2008
|
}
|
|
1890
2009
|
var METADATA_TAGS = ["script", "template"];
|
|
1891
2010
|
var metadataMatch = isTag(...METADATA_TAGS);
|
|
@@ -2055,404 +2174,492 @@ function getHtmlPropNormalizers(tag) {
|
|
|
2055
2174
|
return typeof tag === "string" ? HTML_FORM_NORMALIZERS.get(tag) : void 0;
|
|
2056
2175
|
}
|
|
2057
2176
|
|
|
2058
|
-
// ../../
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
const active = resolved[key];
|
|
2078
|
-
if (typeof active === "string") {
|
|
2079
|
-
const cls = valueMap[active];
|
|
2080
|
-
if (cls !== void 0) classes.push(cls);
|
|
2081
|
-
}
|
|
2082
|
-
});
|
|
2083
|
-
return { context: { classes } };
|
|
2177
|
+
// ../../node_modules/.pnpm/class-variance-authority@0.7.1/node_modules/class-variance-authority/dist/index.mjs
|
|
2178
|
+
import { clsx as clsx2 } from "clsx";
|
|
2179
|
+
var falsyToString = (value) => typeof value === "boolean" ? `${value}` : value === 0 ? "0" : value;
|
|
2180
|
+
var cx = clsx2;
|
|
2181
|
+
var cva = (base, config) => (props) => {
|
|
2182
|
+
var _config_compoundVariants;
|
|
2183
|
+
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);
|
|
2184
|
+
const { variants, defaultVariants } = config;
|
|
2185
|
+
const getVariantClassNames = Object.keys(variants).map((variant) => {
|
|
2186
|
+
const variantProp = props === null || props === void 0 ? void 0 : props[variant];
|
|
2187
|
+
const defaultVariantProp = defaultVariants === null || defaultVariants === void 0 ? void 0 : defaultVariants[variant];
|
|
2188
|
+
if (variantProp === null) return null;
|
|
2189
|
+
const variantKey = falsyToString(variantProp) || falsyToString(defaultVariantProp);
|
|
2190
|
+
return variants[variant][variantKey];
|
|
2191
|
+
});
|
|
2192
|
+
const propsWithoutUndefined = props && Object.entries(props).reduce((acc, param) => {
|
|
2193
|
+
let [key, value] = param;
|
|
2194
|
+
if (value === void 0) {
|
|
2195
|
+
return acc;
|
|
2084
2196
|
}
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
}
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
}
|
|
2108
|
-
|
|
2109
|
-
// ../../lib/adapter-utils/src/build-engines.ts
|
|
2110
|
-
function buildEngines(diagnostics, childRules, context) {
|
|
2111
|
-
return childRules?.length ? { childrenEvaluator: new ChildrenEvaluator(childRules, diagnostics, context) } : {};
|
|
2112
|
-
}
|
|
2113
|
-
|
|
2114
|
-
// ../../lib/adapter-utils/src/resolve-adapter-common-options.ts
|
|
2115
|
-
import { throwDiagnostics, silentDiagnostics as silentDiagnostics2 } from "../_shared/diagnostics.js";
|
|
2116
|
-
function resolveAdapterCommonOptions(options, defaultName = "PolymorphicComponent", defaultDiagnostics = throwDiagnostics) {
|
|
2117
|
-
return {
|
|
2118
|
-
name: options.name ?? defaultName,
|
|
2119
|
-
diagnostics: options.enforcement?.diagnostics ?? defaultDiagnostics
|
|
2120
|
-
};
|
|
2121
|
-
}
|
|
2197
|
+
acc[key] = value;
|
|
2198
|
+
return acc;
|
|
2199
|
+
}, {});
|
|
2200
|
+
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) => {
|
|
2201
|
+
let { class: cvClass, className: cvClassName, ...compoundVariantOptions } = param;
|
|
2202
|
+
return Object.entries(compoundVariantOptions).every((param2) => {
|
|
2203
|
+
let [key, value] = param2;
|
|
2204
|
+
return Array.isArray(value) ? value.includes({
|
|
2205
|
+
...defaultVariants,
|
|
2206
|
+
...propsWithoutUndefined
|
|
2207
|
+
}[key]) : {
|
|
2208
|
+
...defaultVariants,
|
|
2209
|
+
...propsWithoutUndefined
|
|
2210
|
+
}[key] === value;
|
|
2211
|
+
}) ? [
|
|
2212
|
+
...acc,
|
|
2213
|
+
cvClass,
|
|
2214
|
+
cvClassName
|
|
2215
|
+
] : acc;
|
|
2216
|
+
}, []);
|
|
2217
|
+
return cx(base, getVariantClassNames, getCompoundVariantClassNames, props === null || props === void 0 ? void 0 : props.class, props === null || props === void 0 ? void 0 : props.className);
|
|
2218
|
+
};
|
|
2122
2219
|
|
|
2123
|
-
// ../../lib/
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2220
|
+
// ../../lib/styling/src/cva.ts
|
|
2221
|
+
function cva2(base, config) {
|
|
2222
|
+
const fn = cva(base, config);
|
|
2223
|
+
return (props) => cn(fn(props));
|
|
2224
|
+
}
|
|
2225
|
+
|
|
2226
|
+
// ../../lib/styling/src/static-class-resolver.ts
|
|
2227
|
+
var StaticClassResolver = class {
|
|
2228
|
+
#baseClass;
|
|
2229
|
+
#cache = /* @__PURE__ */ new Map();
|
|
2230
|
+
#resolveTag;
|
|
2231
|
+
constructor(baseClass, tagMap) {
|
|
2232
|
+
this.#baseClass = Array.isArray(baseClass) ? baseClass.join(" ") : baseClass;
|
|
2233
|
+
this.#resolveTag = tagMap ? (tag) => {
|
|
2234
|
+
const extra = tagMap[tag];
|
|
2235
|
+
if (!extra) return this.#baseClass;
|
|
2236
|
+
const extraStr = Array.isArray(extra) ? extra.join(" ") : extra;
|
|
2237
|
+
return `${this.#baseClass} ${extraStr}`;
|
|
2238
|
+
} : () => this.#baseClass;
|
|
2239
|
+
}
|
|
2240
|
+
resolve(tag, skipTagMap = false) {
|
|
2241
|
+
if (typeof tag !== "string" || skipTagMap) return this.#baseClass;
|
|
2242
|
+
const cached = this.#cache.get(tag);
|
|
2243
|
+
if (cached !== void 0) {
|
|
2244
|
+
this.#cache.delete(tag);
|
|
2245
|
+
this.#cache.set(tag, cached);
|
|
2246
|
+
return cached;
|
|
2247
|
+
}
|
|
2248
|
+
const result = this.#resolveTag(tag);
|
|
2249
|
+
this.#cache.set(tag, result);
|
|
2250
|
+
if (this.#cache.size > 200) {
|
|
2251
|
+
const lru = this.#cache.keys().next().value;
|
|
2252
|
+
if (lru !== void 0) this.#cache.delete(lru);
|
|
2253
|
+
}
|
|
2254
|
+
return result;
|
|
2131
2255
|
}
|
|
2132
|
-
|
|
2133
|
-
|
|
2256
|
+
};
|
|
2257
|
+
|
|
2258
|
+
// ../../lib/styling/src/variant-class-resolver.ts
|
|
2259
|
+
var VariantClassResolver = class _VariantClassResolver {
|
|
2260
|
+
#cvaFn;
|
|
2261
|
+
#recipeMap;
|
|
2262
|
+
#variantKeys;
|
|
2263
|
+
#precomputedClasses;
|
|
2264
|
+
#cache = /* @__PURE__ */ new Map();
|
|
2265
|
+
constructor(cvaFn, recipeMap, variantKeys, precomputedClasses) {
|
|
2266
|
+
this.#cvaFn = cvaFn ?? null;
|
|
2267
|
+
this.#recipeMap = Object.freeze(recipeMap ?? {});
|
|
2268
|
+
this.#variantKeys = variantKeys ?? null;
|
|
2269
|
+
this.#precomputedClasses = precomputedClasses ?? null;
|
|
2270
|
+
}
|
|
2271
|
+
resolve({ props, recipe }) {
|
|
2272
|
+
const normalizedKey = recipe ?? "__none__";
|
|
2273
|
+
const cacheKey = this.#createCacheKey(props, normalizedKey);
|
|
2274
|
+
if (this.#precomputedClasses !== null) {
|
|
2275
|
+
const precomputed = this.#precomputedClasses[cacheKey];
|
|
2276
|
+
if (precomputed !== void 0) return precomputed;
|
|
2277
|
+
}
|
|
2278
|
+
const cached = this.#cache.get(cacheKey);
|
|
2279
|
+
if (cached !== void 0) {
|
|
2280
|
+
this.#cache.delete(cacheKey);
|
|
2281
|
+
this.#cache.set(cacheKey, cached);
|
|
2282
|
+
return cached;
|
|
2283
|
+
}
|
|
2284
|
+
const result = this.#compute(props, recipe);
|
|
2285
|
+
this.#cache.set(cacheKey, result);
|
|
2286
|
+
if (this.#cache.size > 1e3) {
|
|
2287
|
+
const lru = this.#cache.keys().next().value;
|
|
2288
|
+
if (lru !== void 0) this.#cache.delete(lru);
|
|
2289
|
+
}
|
|
2290
|
+
return result;
|
|
2134
2291
|
}
|
|
2135
|
-
|
|
2136
|
-
|
|
2292
|
+
#compute(props, recipe) {
|
|
2293
|
+
if (!this.#cvaFn) return "";
|
|
2294
|
+
if (!recipe) return this.#cvaFn(props);
|
|
2295
|
+
const preset = this.#recipeMap[recipe];
|
|
2296
|
+
if (!preset) return this.#cvaFn(props);
|
|
2297
|
+
return this.#cvaFn({ ...preset, ...props });
|
|
2298
|
+
}
|
|
2299
|
+
// When variantKeys is provided, only those keys are included in the cache key — non-variant
|
|
2300
|
+
// props (className, id, etc.) produce identical CVA output and must not fragment the cache.
|
|
2301
|
+
// Iterating #variantKeys directly (fixed Set insertion order) avoids Object.keys + filter + sort.
|
|
2302
|
+
// String is built incrementally to avoid a parts[] array allocation on every render.
|
|
2303
|
+
#createCacheKey(props, recipe) {
|
|
2304
|
+
if (this.#variantKeys !== null) {
|
|
2305
|
+
let key2 = recipe;
|
|
2306
|
+
iterate.forEachSet(this.#variantKeys, (k) => {
|
|
2307
|
+
if (k in props) key2 += `|${k}:${_VariantClassResolver.#serializeValue(props[k])}`;
|
|
2308
|
+
});
|
|
2309
|
+
return key2;
|
|
2310
|
+
}
|
|
2311
|
+
let key = recipe;
|
|
2312
|
+
iterate.forEach(Object.keys(props).sort(), (k) => {
|
|
2313
|
+
key += `|${k}:${_VariantClassResolver.#serializeValue(props[k])}`;
|
|
2314
|
+
});
|
|
2315
|
+
return key;
|
|
2137
2316
|
}
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
)
|
|
2317
|
+
static #serializeValue(value) {
|
|
2318
|
+
if (value === void 0) return "u";
|
|
2319
|
+
if (value === null) return "n";
|
|
2320
|
+
if (typeof value === "boolean") return `b:${value}`;
|
|
2321
|
+
if (typeof value === "string") return `s:${value}`;
|
|
2322
|
+
return `x:${String(value)}`;
|
|
2142
2323
|
}
|
|
2143
2324
|
};
|
|
2144
2325
|
|
|
2145
|
-
// ../../lib/
|
|
2146
|
-
function
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
|
|
2326
|
+
// ../../lib/styling/src/create-class-pipeline.ts
|
|
2327
|
+
function createClassPipeline(resolved) {
|
|
2328
|
+
const baseClass = resolved.baseClassName ?? "";
|
|
2329
|
+
const cvaFn = resolved.variants ? cva2("", {
|
|
2330
|
+
variants: resolved.variants,
|
|
2331
|
+
defaultVariants: resolved.defaultVariants,
|
|
2332
|
+
compoundVariants: resolved.compoundVariants
|
|
2333
|
+
}) : null;
|
|
2334
|
+
const variantKeys = resolved.variants ? new Set(Object.keys(resolved.variants)) : void 0;
|
|
2335
|
+
const staticResolver = new StaticClassResolver(baseClass, resolved.tagMap);
|
|
2336
|
+
const variantResolver = new VariantClassResolver(
|
|
2337
|
+
cvaFn,
|
|
2338
|
+
resolved.recipeMap,
|
|
2339
|
+
variantKeys,
|
|
2340
|
+
resolved.precomputedClasses
|
|
2341
|
+
);
|
|
2342
|
+
return function resolveClasses(tag, props, className, recipe) {
|
|
2343
|
+
const staticClasses = staticResolver.resolve(tag, recipe !== void 0);
|
|
2344
|
+
const variantClasses = variantResolver.resolve({ props, recipe });
|
|
2345
|
+
if (!className)
|
|
2346
|
+
return staticClasses && variantClasses ? `${staticClasses} ${variantClasses}` : staticClasses || variantClasses;
|
|
2347
|
+
return cn(staticClasses, variantClasses, className);
|
|
2156
2348
|
};
|
|
2157
2349
|
}
|
|
2158
2350
|
|
|
2159
|
-
// ../../lib/
|
|
2160
|
-
function
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
);
|
|
2168
|
-
}
|
|
2169
|
-
function buildVariantConfig(variants, presets, defaults, compounds) {
|
|
2170
|
-
return {
|
|
2171
|
-
variants: mapVariantRecord(variants ?? {}, flattenClassName),
|
|
2172
|
-
...presets !== void 0 && Object.keys(presets).length > 0 && { presets },
|
|
2173
|
-
...defaults !== void 0 && Object.keys(defaults).length > 0 && { defaults },
|
|
2174
|
-
...compounds !== void 0 && compounds.length > 0 && {
|
|
2175
|
-
compounds
|
|
2351
|
+
// ../../lib/pipeline-kit/src/factory/define-pipeline.ts
|
|
2352
|
+
function definePipeline(factory) {
|
|
2353
|
+
const cache = /* @__PURE__ */ new WeakMap();
|
|
2354
|
+
return (resolved) => {
|
|
2355
|
+
let pipeline = cache.get(resolved);
|
|
2356
|
+
if (!pipeline) {
|
|
2357
|
+
pipeline = factory(resolved);
|
|
2358
|
+
cache.set(resolved, pipeline);
|
|
2176
2359
|
}
|
|
2360
|
+
return pipeline;
|
|
2177
2361
|
};
|
|
2178
2362
|
}
|
|
2179
2363
|
|
|
2180
|
-
//
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
if (
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
return { ...decoration, [nodeId]: nextDecoration };
|
|
2193
|
-
}
|
|
2194
|
-
|
|
2195
|
-
// ../../runtime/core/src/get-active-props.ts
|
|
2196
|
-
function getActiveProps(nodeId, decoration) {
|
|
2197
|
-
const dec = decoration[nodeId];
|
|
2198
|
-
return { ...dec?.attributes ?? {}, ...dec?.variants ?? {} };
|
|
2364
|
+
// ../core/src/options/resolve-factory-options.ts
|
|
2365
|
+
import { silentDiagnostics } from "../_shared/diagnostics.js";
|
|
2366
|
+
var EMPTY_VARIANT_KEYS = /* @__PURE__ */ new Set();
|
|
2367
|
+
function composeNormalizers(normalizers, fn) {
|
|
2368
|
+
if (!normalizers?.length) return fn;
|
|
2369
|
+
return ((props) => {
|
|
2370
|
+
const patched = normalizers.reduce(
|
|
2371
|
+
(acc, normalizer) => ({ ...acc, ...normalizer(acc) }),
|
|
2372
|
+
props
|
|
2373
|
+
);
|
|
2374
|
+
return fn ? fn(patched) : patched;
|
|
2375
|
+
});
|
|
2199
2376
|
}
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
|
|
2377
|
+
function whenDefined(key, value) {
|
|
2378
|
+
return value === void 0 ? {} : { [key]: value };
|
|
2379
|
+
}
|
|
2380
|
+
function resolveFactoryOptions(options = {}) {
|
|
2381
|
+
const { styling, enforcement } = options;
|
|
2382
|
+
const composedNormalizeFn = composeNormalizers(enforcement?.props, options.normalize);
|
|
2383
|
+
const variantKeys = styling?.variants === void 0 ? EMPTY_VARIANT_KEYS : new Set(Object.keys(styling.variants));
|
|
2384
|
+
return Object.freeze({
|
|
2385
|
+
defaultTag: options.tag ?? "div",
|
|
2386
|
+
diagnostics: enforcement?.diagnostics ?? silentDiagnostics,
|
|
2387
|
+
variantKeys,
|
|
2388
|
+
...whenDefined("displayName", options.name),
|
|
2389
|
+
...whenDefined("defaultProps", options.defaults),
|
|
2390
|
+
...whenDefined("baseClassName", styling?.base),
|
|
2391
|
+
...whenDefined("tagMap", styling?.tags),
|
|
2392
|
+
...whenDefined("recipeMap", styling?.presets),
|
|
2393
|
+
...whenDefined("variants", styling?.variants),
|
|
2394
|
+
...whenDefined("defaultVariants", styling?.defaults),
|
|
2395
|
+
...whenDefined("compoundVariants", styling?.compounds),
|
|
2396
|
+
...whenDefined("normalizeFn", composedNormalizeFn),
|
|
2397
|
+
...whenDefined("ariaRules", enforcement?.aria),
|
|
2398
|
+
...whenDefined("childRules", enforcement?.children),
|
|
2399
|
+
...whenDefined("allowedAs", enforcement?.allowedAs),
|
|
2400
|
+
...whenDefined("precomputedClasses", styling?.precomputedClasses)
|
|
2401
|
+
});
|
|
2204
2402
|
}
|
|
2205
2403
|
|
|
2206
|
-
//
|
|
2207
|
-
function
|
|
2208
|
-
if (
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2404
|
+
// ../core/src/options/validate-factory-options.ts
|
|
2405
|
+
function validateFactoryOptions(resolved, diagnostics) {
|
|
2406
|
+
if (!diagnostics.active) return;
|
|
2407
|
+
const name = resolved.displayName ?? "Component";
|
|
2408
|
+
const { variants } = resolved;
|
|
2409
|
+
const checkSelection = (label2, selection) => {
|
|
2410
|
+
iterate.forEachEntry(selection, (dim, value) => {
|
|
2411
|
+
if (value === void 0 || value === null) return;
|
|
2412
|
+
if (!variants || !Object.hasOwn(variants, dim)) {
|
|
2413
|
+
diagnostics.error(ContractDiagnostics.unknownVariantDim(name, label2, dim));
|
|
2414
|
+
return;
|
|
2415
|
+
}
|
|
2416
|
+
const states = variants[dim];
|
|
2417
|
+
const stateKey = String(value);
|
|
2418
|
+
if (!Object.hasOwn(states, stateKey)) {
|
|
2419
|
+
diagnostics.error(
|
|
2420
|
+
ContractDiagnostics.unknownVariantValue(name, label2, dim, stateKey, Object.keys(states))
|
|
2421
|
+
);
|
|
2422
|
+
}
|
|
2423
|
+
});
|
|
2424
|
+
};
|
|
2425
|
+
const { recipeMap } = resolved;
|
|
2426
|
+
if (recipeMap) {
|
|
2427
|
+
iterate.forEachEntry(recipeMap, (recipeKey, selection) => {
|
|
2428
|
+
checkSelection(`preset "${recipeKey}"`, selection);
|
|
2213
2429
|
});
|
|
2214
|
-
} else {
|
|
2215
|
-
seenIds.add(input.id);
|
|
2216
|
-
}
|
|
2217
|
-
if (input.slot !== void 0) {
|
|
2218
|
-
slotAssignments.set(input.id, input.slot);
|
|
2219
|
-
}
|
|
2220
|
-
const children = Object.freeze(
|
|
2221
|
-
(input.children ?? []).map((child) => buildNode(child, slotAssignments, seenIds, diagnostics))
|
|
2222
|
-
);
|
|
2223
|
-
if (input.kind === "native") {
|
|
2224
|
-
return Object.freeze({ kind: "native", id: input.id, tag: input.tag, children });
|
|
2225
2430
|
}
|
|
2226
|
-
|
|
2227
|
-
}
|
|
2228
|
-
function buildTreeContext(root) {
|
|
2229
|
-
const slotAssignments = /* @__PURE__ */ new Map();
|
|
2230
|
-
const diagnostics = [];
|
|
2231
|
-
const rootNode = buildNode(root, slotAssignments, /* @__PURE__ */ new Set(), diagnostics);
|
|
2232
|
-
return Object.freeze({ root: rootNode, slotAssignments, diagnostics });
|
|
2233
|
-
}
|
|
2234
|
-
|
|
2235
|
-
// ../../runtime/core/src/build-render-context.ts
|
|
2236
|
-
function buildRenderContext(decoration = {}) {
|
|
2237
|
-
return { decoration: new Map(Object.entries(decoration)) };
|
|
2431
|
+
if (resolved.defaultVariants) checkSelection("defaults", resolved.defaultVariants);
|
|
2238
2432
|
}
|
|
2239
2433
|
|
|
2240
|
-
//
|
|
2241
|
-
function
|
|
2242
|
-
|
|
2243
|
-
return Object.entries(conditions).every(([key, expected]) => {
|
|
2244
|
-
const actual = active[key];
|
|
2245
|
-
return Array.isArray(expected) ? expected.includes(actual) : actual === expected;
|
|
2246
|
-
});
|
|
2434
|
+
// ../core/src/options/validate-render-props.ts
|
|
2435
|
+
function label(name) {
|
|
2436
|
+
return name ? `[${name}]` : "[createContractComponent]";
|
|
2247
2437
|
}
|
|
2248
|
-
function
|
|
2249
|
-
|
|
2250
|
-
const
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2438
|
+
function validateRenderProps(diagnostics, options, props, recipeKey) {
|
|
2439
|
+
const { recipeMap, variants, displayName } = options;
|
|
2440
|
+
const tag = label(displayName);
|
|
2441
|
+
if (recipeKey !== void 0 && (!recipeMap || !Object.hasOwn(recipeMap, recipeKey))) {
|
|
2442
|
+
diagnostics.error(ContractDiagnostics.unknownRecipeKey(tag, recipeKey));
|
|
2443
|
+
}
|
|
2444
|
+
if (variants) {
|
|
2445
|
+
iterate.forEachKey(variants, (key) => {
|
|
2446
|
+
if (!Object.hasOwn(props, key)) return;
|
|
2447
|
+
const value = props[key];
|
|
2448
|
+
if (value === void 0 || value === null) return;
|
|
2449
|
+
const dim = variants[key];
|
|
2450
|
+
if (dim && !Object.hasOwn(dim, String(value))) {
|
|
2451
|
+
diagnostics.error(ContractDiagnostics.invalidVariantValue(tag, key, String(value)));
|
|
2452
|
+
}
|
|
2453
|
+
});
|
|
2454
|
+
}
|
|
2257
2455
|
}
|
|
2258
2456
|
|
|
2259
|
-
//
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
|
|
2275
|
-
|
|
2457
|
+
// ../core/src/factory/plugin-invariants.ts
|
|
2458
|
+
import { throwDiagnostics } from "../_shared/diagnostics.js";
|
|
2459
|
+
|
|
2460
|
+
// ../core/src/factory/plugin-diagnostics.ts
|
|
2461
|
+
import { DiagnosticCategory as DiagnosticCategory5, DiagnosticCode as DiagnosticCode5 } from "../_shared/diagnostics.js";
|
|
2462
|
+
var PluginDiagnostics = {
|
|
2463
|
+
invalidShape(received) {
|
|
2464
|
+
const got = received === null ? "null" : typeof received;
|
|
2465
|
+
return {
|
|
2466
|
+
code: DiagnosticCode5.PluginInvalidShape,
|
|
2467
|
+
category: DiagnosticCategory5.Internal,
|
|
2468
|
+
message: `[praxis-kit] Plugin factory must return an object with a 'pipeline' function. Got: ${got}.`
|
|
2469
|
+
};
|
|
2470
|
+
},
|
|
2471
|
+
pipelineReturnType(received) {
|
|
2472
|
+
const got = received === null ? "null" : Array.isArray(received) ? "array" : typeof received;
|
|
2473
|
+
return {
|
|
2474
|
+
code: DiagnosticCode5.PluginPipelineReturnType,
|
|
2475
|
+
category: DiagnosticCategory5.Internal,
|
|
2476
|
+
message: `[praxis-kit] Plugin pipeline must return a string. Got: ${got}.`
|
|
2477
|
+
};
|
|
2276
2478
|
}
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
2479
|
+
};
|
|
2480
|
+
|
|
2481
|
+
// ../core/src/factory/plugin-invariants.ts
|
|
2482
|
+
function assertPluginShape(result) {
|
|
2483
|
+
if (result === null || typeof result !== "object")
|
|
2484
|
+
throwDiagnostics.error(PluginDiagnostics.invalidShape(result));
|
|
2485
|
+
const plugin = result;
|
|
2486
|
+
if (typeof plugin.pipeline !== "function")
|
|
2487
|
+
throwDiagnostics.error(PluginDiagnostics.invalidShape(result));
|
|
2488
|
+
}
|
|
2489
|
+
function guardPipeline(pipeline) {
|
|
2490
|
+
if (process.env.NODE_ENV === "production") return pipeline;
|
|
2491
|
+
return function guardedPipeline(tag, props, className, recipe) {
|
|
2492
|
+
const result = pipeline(tag, props, className, recipe);
|
|
2493
|
+
if (typeof result !== "string")
|
|
2494
|
+
throwDiagnostics.error(PluginDiagnostics.pipelineReturnType(result));
|
|
2495
|
+
return result;
|
|
2285
2496
|
};
|
|
2286
|
-
const compoundClasses = resolveCompounds(resolvedValues, compounds);
|
|
2287
|
-
return { variantClasses, compoundClasses };
|
|
2288
2497
|
}
|
|
2289
2498
|
|
|
2290
|
-
//
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
|
|
2499
|
+
// ../core/src/factory/create-polymorphic2.ts
|
|
2500
|
+
var createTagPipeline = (resolved) => makeResolveTag(resolved.defaultTag);
|
|
2501
|
+
var createPropsPipeline = (resolved) => (props) => mergeProps(resolved.defaultProps, props);
|
|
2502
|
+
var createHtmlPropNormalizersPipeline = () => getHtmlPropNormalizers;
|
|
2503
|
+
var createHtmlChildrenEvaluatorPipeline = () => getHtmlChildrenEvaluator;
|
|
2504
|
+
var createStylingClassPipeline = (resolved) => createClassPipeline(resolved);
|
|
2505
|
+
function resolveAriaRules(resolved) {
|
|
2506
|
+
return [.../* @__PURE__ */ new Set([...HTML_ARIA_RULES, ...resolved.ariaRules ?? []])];
|
|
2507
|
+
}
|
|
2508
|
+
var createAriaPipeline = (resolved) => {
|
|
2509
|
+
const rules = resolveAriaRules(resolved);
|
|
2510
|
+
const engine = new AriaPolicyEngine(resolved.diagnostics, rules.length ? { rules } : void 0);
|
|
2511
|
+
return (tag, props) => engine.validate(tag, props);
|
|
2512
|
+
};
|
|
2513
|
+
var memoizedTagPipeline = definePipeline(createTagPipeline);
|
|
2514
|
+
var memoizedPropsPipeline = definePipeline(createPropsPipeline);
|
|
2515
|
+
var memoizedHtmlPropNormalizersPipeline = definePipeline(createHtmlPropNormalizersPipeline);
|
|
2516
|
+
var memoizedHtmlChildrenEvaluatorPipeline = definePipeline(createHtmlChildrenEvaluatorPipeline);
|
|
2517
|
+
var memoizedClassPipeline = definePipeline(createStylingClassPipeline);
|
|
2518
|
+
var memoizedAriaPipeline = definePipeline(createAriaPipeline);
|
|
2519
|
+
function resolveAriaPassthrough(_tag, props) {
|
|
2520
|
+
return { props };
|
|
2521
|
+
}
|
|
2522
|
+
function resolveClassPlugin(factory, resolved, diagnostics) {
|
|
2523
|
+
if (!factory) return { pluginResult: void 0, classPipeline: memoizedClassPipeline(resolved) };
|
|
2524
|
+
const pluginResult = factory(resolved, diagnostics);
|
|
2525
|
+
assertPluginShape(pluginResult);
|
|
2526
|
+
return { pluginResult, classPipeline: guardPipeline(pluginResult.pipeline) };
|
|
2527
|
+
}
|
|
2528
|
+
function createPolymorphic2(options = {}) {
|
|
2529
|
+
const baseResolved = resolveFactoryOptions(options);
|
|
2530
|
+
const anyBaseResolved = baseResolved;
|
|
2531
|
+
const resolved = Object.freeze({
|
|
2532
|
+
...baseResolved,
|
|
2533
|
+
htmlPropNormalizersFn: memoizedHtmlPropNormalizersPipeline(anyBaseResolved),
|
|
2534
|
+
htmlChildrenEvaluatorFn: memoizedHtmlChildrenEvaluatorPipeline(anyBaseResolved)
|
|
2535
|
+
});
|
|
2536
|
+
const anyResolved = resolved;
|
|
2537
|
+
if (process.env.NODE_ENV !== "production") {
|
|
2538
|
+
validateFactoryOptions(resolved, resolved.diagnostics);
|
|
2294
2539
|
}
|
|
2295
|
-
const
|
|
2296
|
-
|
|
2297
|
-
|
|
2298
|
-
|
|
2540
|
+
const { pluginResult, classPipeline } = resolveClassPlugin(
|
|
2541
|
+
options.styling?.plugin,
|
|
2542
|
+
anyResolved,
|
|
2543
|
+
resolved.diagnostics
|
|
2544
|
+
);
|
|
2545
|
+
const resolveTag2 = memoizedTagPipeline(anyResolved);
|
|
2546
|
+
const resolveProps = memoizedPropsPipeline(anyResolved);
|
|
2547
|
+
const resolveAriaFn = options.enforcement !== void 0 ? memoizedAriaPipeline(anyResolved) : resolveAriaPassthrough;
|
|
2548
|
+
const methods = {
|
|
2549
|
+
resolveTag: resolveTag2,
|
|
2550
|
+
resolveProps,
|
|
2551
|
+
resolveClasses(tag, props, className, recipe) {
|
|
2552
|
+
if (process.env.NODE_ENV !== "production") {
|
|
2553
|
+
validateRenderProps(resolved.diagnostics, resolved, props, recipe);
|
|
2554
|
+
}
|
|
2555
|
+
return classPipeline(tag, props, className, recipe);
|
|
2556
|
+
},
|
|
2557
|
+
resolveAria(tag, props) {
|
|
2558
|
+
return resolveAriaFn(tag, props);
|
|
2299
2559
|
}
|
|
2300
2560
|
};
|
|
2561
|
+
const runtimeObject = pluginResult ? { ...methods, options: resolved, hasStyling: true, classPlugin: pluginResult } : { ...methods, options: resolved };
|
|
2562
|
+
return runtimeObject;
|
|
2301
2563
|
}
|
|
2302
2564
|
|
|
2303
|
-
//
|
|
2304
|
-
|
|
2305
|
-
|
|
2565
|
+
// ../core/src/resolver/resolver.ts
|
|
2566
|
+
import { silentDiagnostics as silentDiagnostics2 } from "../_shared/diagnostics.js";
|
|
2567
|
+
function enforceAllowedAs(tag, allowedAs, diagnostics, displayName) {
|
|
2568
|
+
if (allowedAs.includes(tag)) return;
|
|
2569
|
+
if (!diagnostics) return;
|
|
2570
|
+
const component = displayName ?? String(tag);
|
|
2571
|
+
diagnostics.error(ContractDiagnostics.allowedAsViolation(String(tag), allowedAs, component));
|
|
2306
2572
|
}
|
|
2307
2573
|
|
|
2308
|
-
// ../../lib/adapter-utils/src/
|
|
2309
|
-
|
|
2310
|
-
|
|
2311
|
-
|
|
2574
|
+
// ../../lib/adapter-utils/src/runtime/build-core-runtime.ts
|
|
2575
|
+
var EMPTY_SET = /* @__PURE__ */ new Set();
|
|
2576
|
+
function buildCoreRuntime(normalized) {
|
|
2577
|
+
const runtime = createPolymorphic2(normalized);
|
|
2578
|
+
const ownedKeys = "classPlugin" in runtime ? runtime.classPlugin.ownedKeys ?? EMPTY_SET : EMPTY_SET;
|
|
2579
|
+
return { runtime, ownedKeys };
|
|
2312
2580
|
}
|
|
2313
2581
|
|
|
2314
|
-
// ../../lib/adapter-utils/src/
|
|
2315
|
-
function
|
|
2316
|
-
|
|
2317
|
-
const dec = decoration["root"];
|
|
2318
|
-
if (dec?.attributes === void 0) return decoration;
|
|
2319
|
-
const result = ariaEngine.validate(tag, dec.attributes);
|
|
2320
|
-
const cleaned = result.props;
|
|
2321
|
-
return {
|
|
2322
|
-
...decoration,
|
|
2323
|
-
root: withAttributes(dec, Object.keys(cleaned).length > 0 ? cleaned : void 0)
|
|
2324
|
-
};
|
|
2582
|
+
// ../../lib/adapter-utils/src/runtime/build-engines.ts
|
|
2583
|
+
function buildEngines(diagnostics, childRules, context) {
|
|
2584
|
+
return childRules?.length ? { childrenEvaluator: new ChildrenEvaluator(childRules, diagnostics, context) } : {};
|
|
2325
2585
|
}
|
|
2326
2586
|
|
|
2327
|
-
// ../../lib/adapter-utils/src/
|
|
2328
|
-
|
|
2329
|
-
|
|
2330
|
-
const dec = decoration["root"];
|
|
2331
|
-
if (dec?.attributes === void 0) return decoration;
|
|
2332
|
-
const kept = Object.fromEntries(
|
|
2333
|
-
Object.entries(dec.attributes).filter(([k]) => !filterFn(k, variantKeys))
|
|
2334
|
-
);
|
|
2587
|
+
// ../../lib/adapter-utils/src/runtime/resolve-adapter-common-options.ts
|
|
2588
|
+
import { throwDiagnostics as throwDiagnostics2, silentDiagnostics as silentDiagnostics3 } from "../_shared/diagnostics.js";
|
|
2589
|
+
function resolveAdapterCommonOptions(options, defaultName = "PolymorphicComponent", defaultDiagnostics = throwDiagnostics2) {
|
|
2335
2590
|
return {
|
|
2336
|
-
|
|
2337
|
-
|
|
2591
|
+
name: options.name ?? defaultName,
|
|
2592
|
+
diagnostics: options.enforcement?.diagnostics ?? defaultDiagnostics
|
|
2338
2593
|
};
|
|
2339
2594
|
}
|
|
2340
2595
|
|
|
2341
|
-
// ../../
|
|
2342
|
-
function
|
|
2343
|
-
|
|
2344
|
-
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
function assignIfNotEmpty(target, key, value) {
|
|
2349
|
-
if (Object.keys(value).length > 0) {
|
|
2350
|
-
target[key] = value;
|
|
2351
|
-
}
|
|
2352
|
-
}
|
|
2353
|
-
function extractStyles(value, styles) {
|
|
2354
|
-
if (!isObject(value)) return false;
|
|
2355
|
-
iterate.forEachEntry(value, (k, v) => {
|
|
2356
|
-
if (isStyleValue(v)) {
|
|
2357
|
-
styles[k] = v;
|
|
2358
|
-
}
|
|
2596
|
+
// ../../lib/adapter-utils/src/props/apply-filter.ts
|
|
2597
|
+
function applyFilter(props, filterProps, variantKeys) {
|
|
2598
|
+
const out = {};
|
|
2599
|
+
iterate.forEachEntry(props, (k) => {
|
|
2600
|
+
if (!Object.hasOwn(props, k)) return;
|
|
2601
|
+
if (filterProps(k, variantKeys)) return;
|
|
2602
|
+
out[k] = props[k];
|
|
2359
2603
|
});
|
|
2360
|
-
return
|
|
2361
|
-
}
|
|
2362
|
-
function extractListener(key, value, listeners) {
|
|
2363
|
-
if (!key.startsWith("on") || !isFunction(value)) {
|
|
2364
|
-
return false;
|
|
2365
|
-
}
|
|
2366
|
-
listeners[key] = value;
|
|
2367
|
-
return true;
|
|
2604
|
+
return out;
|
|
2368
2605
|
}
|
|
2369
|
-
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
}
|
|
2376
|
-
function extractDecoration(props, variantKeys) {
|
|
2377
|
-
const attributes = {};
|
|
2378
|
-
const styles = {};
|
|
2379
|
-
const listeners = {};
|
|
2380
|
-
const variants = {};
|
|
2381
|
-
const dec = {};
|
|
2382
|
-
iterate.forEachEntry(props, (key, value) => {
|
|
2383
|
-
if (key === "children" || key === "slot" || key === "ref") return;
|
|
2384
|
-
if (key === "style" && extractStyles(value, styles)) return;
|
|
2385
|
-
if (extractListener(key, value, listeners)) return;
|
|
2386
|
-
if (isAttributeValue(value)) {
|
|
2387
|
-
extractAttributeOrVariant(key, value, attributes, variants, variantKeys);
|
|
2388
|
-
}
|
|
2389
|
-
});
|
|
2390
|
-
assignIfNotEmpty(dec, "attributes", attributes);
|
|
2391
|
-
assignIfNotEmpty(dec, "styles", styles);
|
|
2392
|
-
assignIfNotEmpty(dec, "listeners", listeners);
|
|
2393
|
-
assignIfNotEmpty(dec, "variants", variants);
|
|
2394
|
-
const ref = props.ref;
|
|
2395
|
-
if (ref !== void 0) {
|
|
2396
|
-
dec.ref = ref;
|
|
2606
|
+
|
|
2607
|
+
// ../../lib/adapter-utils/src/props/compose-filter.ts
|
|
2608
|
+
function composeFilter(ownedKeys, filterProps) {
|
|
2609
|
+
const defaultFilter = (key, variantKeys) => variantKeys.has(key) || ownedKeys.has(key);
|
|
2610
|
+
if (!filterProps) {
|
|
2611
|
+
return defaultFilter;
|
|
2397
2612
|
}
|
|
2398
|
-
return
|
|
2613
|
+
return (key, variantKeys) => defaultFilter(key, variantKeys) || filterProps(key, variantKeys);
|
|
2399
2614
|
}
|
|
2400
2615
|
|
|
2401
|
-
// ../../
|
|
2402
|
-
|
|
2403
|
-
|
|
2404
|
-
|
|
2405
|
-
|
|
2616
|
+
// ../../lib/adapter-utils/src/slot/slot-validator.ts
|
|
2617
|
+
var SlotValidator = class extends InvariantBase {
|
|
2618
|
+
#name;
|
|
2619
|
+
#elementTerm;
|
|
2620
|
+
constructor(name, diagnostics, elementTerm) {
|
|
2621
|
+
super(diagnostics);
|
|
2622
|
+
this.#name = name;
|
|
2623
|
+
this.#elementTerm = elementTerm;
|
|
2624
|
+
}
|
|
2625
|
+
assertExclusive() {
|
|
2626
|
+
this.violate(SlotDiagnostics.exclusive(this.#name));
|
|
2627
|
+
}
|
|
2628
|
+
warnDiscardedChildren(count) {
|
|
2629
|
+
this.warn(SlotDiagnostics.discardedChildren(this.#name, this.#elementTerm, count));
|
|
2630
|
+
}
|
|
2631
|
+
assertSingleChild(count) {
|
|
2632
|
+
this.violate(
|
|
2633
|
+
count === 0 ? SlotDiagnostics.singleChildRequired(this.#name, this.#elementTerm) : SlotDiagnostics.singleChildExceeded(this.#name, this.#elementTerm, count)
|
|
2634
|
+
);
|
|
2635
|
+
}
|
|
2636
|
+
};
|
|
2406
2637
|
|
|
2407
|
-
// ../../adapters/vue/src/
|
|
2408
|
-
function
|
|
2638
|
+
// ../../adapters/vue/src/build-runtime.ts
|
|
2639
|
+
function normalizeOptions(options) {
|
|
2409
2640
|
return {
|
|
2410
|
-
|
|
2411
|
-
...
|
|
2412
|
-
...decoration?.styles !== void 0 ? { style: decoration.styles } : {},
|
|
2413
|
-
...decoration?.listeners,
|
|
2414
|
-
...decoration?.ref !== void 0 ? { ref: decoration.ref } : {}
|
|
2641
|
+
...options,
|
|
2642
|
+
...resolveAdapterCommonOptions(options)
|
|
2415
2643
|
};
|
|
2416
2644
|
}
|
|
2417
|
-
|
|
2418
|
-
|
|
2419
|
-
|
|
2420
|
-
|
|
2421
|
-
const
|
|
2422
|
-
|
|
2423
|
-
|
|
2424
|
-
|
|
2425
|
-
|
|
2426
|
-
|
|
2427
|
-
|
|
2428
|
-
|
|
2429
|
-
if (node.kind === "component") {
|
|
2430
|
-
return h(Fragment, isRoot ? null : { key: node.id }, children);
|
|
2431
|
-
}
|
|
2432
|
-
const decoration = render.decoration.get(node.id);
|
|
2433
|
-
const base = buildPropsFromDecoration(isRoot ? "" : node.id, decoration);
|
|
2434
|
-
const { key: _key, ...rest } = base;
|
|
2435
|
-
const props = {
|
|
2436
|
-
...isRoot ? {} : { key: node.id },
|
|
2437
|
-
...rest,
|
|
2438
|
-
...decoration?.listeners !== void 0 ? normalizeListenerKeys(decoration.listeners) : {}
|
|
2645
|
+
function buildRuntime(options) {
|
|
2646
|
+
const normalized = normalizeOptions(options);
|
|
2647
|
+
const { runtime, ownedKeys } = buildCoreRuntime(normalized);
|
|
2648
|
+
const { diagnostics, enforcement, filterProps: userFilter, name } = normalized;
|
|
2649
|
+
const { childrenEvaluator } = buildEngines(diagnostics, enforcement?.children, name);
|
|
2650
|
+
const filterProps = composeFilter(ownedKeys, userFilter);
|
|
2651
|
+
const slotValidator = new SlotValidator(name, diagnostics, "VNode");
|
|
2652
|
+
const built = {
|
|
2653
|
+
runtime,
|
|
2654
|
+
filterProps,
|
|
2655
|
+
slotValidator,
|
|
2656
|
+
...childrenEvaluator !== void 0 && { childrenEvaluator }
|
|
2439
2657
|
};
|
|
2440
|
-
return
|
|
2658
|
+
return built;
|
|
2441
2659
|
}
|
|
2442
|
-
var vueBackend = {
|
|
2443
|
-
render(context) {
|
|
2444
|
-
return renderNode(context.tree.root, context.render, true);
|
|
2445
|
-
}
|
|
2446
|
-
};
|
|
2447
2660
|
|
|
2448
|
-
// ../../adapters/vue/src/
|
|
2449
|
-
|
|
2450
|
-
const treeCtx = buildTreeContext({ kind: "native", tag, id: "root", children: [] });
|
|
2451
|
-
const rendered = renderComponent(definition, treeCtx, buildRenderContext(decoration), vueBackend);
|
|
2452
|
-
if (slots?.default === void 0) return rendered;
|
|
2453
|
-
const { key: _key, ...props } = rendered.props ?? {};
|
|
2454
|
-
return h2(tag, props, { default: slots.default });
|
|
2455
|
-
}
|
|
2661
|
+
// ../../adapters/vue/src/render.ts
|
|
2662
|
+
import { cloneVNode, h as h3 } from "vue";
|
|
2456
2663
|
|
|
2457
2664
|
// ../../adapters/vue/src/normalize-children.ts
|
|
2458
2665
|
import { isVNode } from "vue";
|
|
@@ -2462,17 +2669,19 @@ function normalizeChildren(slots) {
|
|
|
2462
2669
|
return { vnodes, discarded: raw.length - vnodes.length };
|
|
2463
2670
|
}
|
|
2464
2671
|
|
|
2672
|
+
// ../../adapters/vue/src/slot/extractSlottable.ts
|
|
2673
|
+
import { h as h2, Fragment as Fragment2 } from "vue";
|
|
2674
|
+
|
|
2465
2675
|
// ../../adapters/vue/src/slot/Slottable.ts
|
|
2466
|
-
import { defineComponent, h
|
|
2676
|
+
import { defineComponent, h, Fragment } from "vue";
|
|
2467
2677
|
var Slottable = defineComponent({
|
|
2468
2678
|
name: "Slottable",
|
|
2469
2679
|
setup(_, { slots }) {
|
|
2470
|
-
return () =>
|
|
2680
|
+
return () => h(Fragment, null, slots.default?.());
|
|
2471
2681
|
}
|
|
2472
2682
|
});
|
|
2473
2683
|
|
|
2474
2684
|
// ../../adapters/vue/src/slot/extractSlottable.ts
|
|
2475
|
-
import { h as h4, Fragment as Fragment3 } from "vue";
|
|
2476
2685
|
function isSlottableVNode(vnode) {
|
|
2477
2686
|
return vnode.type === Slottable;
|
|
2478
2687
|
}
|
|
@@ -2495,127 +2704,123 @@ function extractSlottable(children) {
|
|
|
2495
2704
|
child,
|
|
2496
2705
|
rebuild(merged) {
|
|
2497
2706
|
const out = children.map((node, i) => i === index ? merged : node);
|
|
2498
|
-
return
|
|
2707
|
+
return h2(Fragment2, null, out);
|
|
2499
2708
|
}
|
|
2500
2709
|
};
|
|
2501
2710
|
}
|
|
2502
2711
|
|
|
2712
|
+
// ../../adapters/vue/src/render.ts
|
|
2713
|
+
var MULTI_WORD_EVENT_RE = /^on[A-Z][a-z]+[A-Z]/;
|
|
2714
|
+
function normalizeListenerKeys(props) {
|
|
2715
|
+
const out = {};
|
|
2716
|
+
for (const k in props) {
|
|
2717
|
+
out[MULTI_WORD_EVENT_RE.test(k) ? "on" + k.slice(2).toLowerCase() : k] = props[k];
|
|
2718
|
+
}
|
|
2719
|
+
return out;
|
|
2720
|
+
}
|
|
2721
|
+
function isAttributeValue(v) {
|
|
2722
|
+
return isString(v) || isNumber(v) || typeof v === "boolean";
|
|
2723
|
+
}
|
|
2724
|
+
function pickAttributes(props) {
|
|
2725
|
+
const out = {};
|
|
2726
|
+
for (const k in props) {
|
|
2727
|
+
if (isAttributeValue(props[k])) out[k] = props[k];
|
|
2728
|
+
}
|
|
2729
|
+
return out;
|
|
2730
|
+
}
|
|
2731
|
+
function prepareRenderState(runtime, attrs, filterProps) {
|
|
2732
|
+
const { as, asChild, class: callerClass, recipe, ...rest } = attrs;
|
|
2733
|
+
const tag = typeof as === "string" ? as : runtime.options.defaultTag;
|
|
2734
|
+
if (runtime.options.allowedAs !== void 0) {
|
|
2735
|
+
enforceAllowedAs(
|
|
2736
|
+
tag,
|
|
2737
|
+
runtime.options.allowedAs,
|
|
2738
|
+
runtime.options.diagnostics,
|
|
2739
|
+
runtime.options.displayName
|
|
2740
|
+
);
|
|
2741
|
+
}
|
|
2742
|
+
const mergedProps = runtime.resolveProps(rest);
|
|
2743
|
+
const htmlNormalizers = runtime.options.htmlPropNormalizersFn?.(tag);
|
|
2744
|
+
const htmlNormalizedProps = htmlNormalizers?.length ? htmlNormalizers.reduce((acc, fn) => ({ ...acc, ...fn(acc) }), mergedProps) : mergedProps;
|
|
2745
|
+
const normalizedProps = runtime.options.normalizeFn ? runtime.options.normalizeFn(htmlNormalizedProps) : htmlNormalizedProps;
|
|
2746
|
+
const className = runtime.resolveClasses(tag, normalizedProps, callerClass, recipe);
|
|
2747
|
+
const filteredProps = applyFilter(normalizedProps, filterProps, runtime.options.variantKeys);
|
|
2748
|
+
return {
|
|
2749
|
+
tag,
|
|
2750
|
+
directives: {
|
|
2751
|
+
...typeof as === "string" && { as },
|
|
2752
|
+
...asChild !== void 0 && { asChild }
|
|
2753
|
+
},
|
|
2754
|
+
props: filteredProps,
|
|
2755
|
+
className
|
|
2756
|
+
};
|
|
2757
|
+
}
|
|
2758
|
+
function buildElementProps(props, className) {
|
|
2759
|
+
const { role, ...rest } = props;
|
|
2760
|
+
return {
|
|
2761
|
+
...normalizeListenerKeys(rest),
|
|
2762
|
+
class: className,
|
|
2763
|
+
...isKnownAriaRole(role) && { role }
|
|
2764
|
+
};
|
|
2765
|
+
}
|
|
2766
|
+
function renderIntrinsic(state, runtime, slots) {
|
|
2767
|
+
const elementProps = buildElementProps(state.props, state.className);
|
|
2768
|
+
const domProps = runtime.resolveAria(state.tag, elementProps).props;
|
|
2769
|
+
return h3(state.tag, domProps, slots.default ? { default: slots.default } : void 0);
|
|
2770
|
+
}
|
|
2771
|
+
function validateSlotDirectives(directives, validator) {
|
|
2772
|
+
const { as, asChild } = directives;
|
|
2773
|
+
if (!asChild) return false;
|
|
2774
|
+
if (as !== void 0) {
|
|
2775
|
+
validator.assertExclusive();
|
|
2776
|
+
return false;
|
|
2777
|
+
}
|
|
2778
|
+
return true;
|
|
2779
|
+
}
|
|
2780
|
+
function tryRenderAsChild(state, children, discarded, validator) {
|
|
2781
|
+
if (!validateSlotDirectives(state.directives, validator)) return null;
|
|
2782
|
+
if (discarded > 0) validator.warnDiscardedChildren(discarded);
|
|
2783
|
+
const attrs = { ...pickAttributes(state.props), class: state.className };
|
|
2784
|
+
const slottable = extractSlottable(children);
|
|
2785
|
+
if (slottable) return slottable.rebuild(cloneVNode(slottable.child, attrs));
|
|
2786
|
+
if (children.length === 1 && children[0] !== void 0) {
|
|
2787
|
+
return cloneVNode(children[0], attrs);
|
|
2788
|
+
}
|
|
2789
|
+
validator.assertSingleChild(children.length);
|
|
2790
|
+
return null;
|
|
2791
|
+
}
|
|
2792
|
+
function render({
|
|
2793
|
+
runtime,
|
|
2794
|
+
state,
|
|
2795
|
+
slots,
|
|
2796
|
+
slotValidator,
|
|
2797
|
+
childrenEvaluator
|
|
2798
|
+
}) {
|
|
2799
|
+
const { vnodes: children, discarded } = normalizeChildren(slots);
|
|
2800
|
+
if (process.env.NODE_ENV !== "production") {
|
|
2801
|
+
childrenEvaluator?.evaluate(children);
|
|
2802
|
+
}
|
|
2803
|
+
const slotResult = tryRenderAsChild(state, children, discarded, slotValidator);
|
|
2804
|
+
return slotResult ?? renderIntrinsic(state, runtime, slots);
|
|
2805
|
+
}
|
|
2806
|
+
|
|
2503
2807
|
// ../../adapters/vue/src/create-contract-component.ts
|
|
2504
|
-
var EMPTY_SET = /* @__PURE__ */ new Set();
|
|
2505
2808
|
function createContractComponent(options) {
|
|
2506
|
-
const
|
|
2507
|
-
const displayName = resolved.name;
|
|
2508
|
-
const defaultTag = options.tag ?? "div";
|
|
2509
|
-
const definition = buildDefinition(displayName, defaultTag);
|
|
2510
|
-
const variantKeys = new Set(Object.keys(options.styling?.variants ?? {}));
|
|
2511
|
-
const domDefaults = options.defaults;
|
|
2512
|
-
const stylePipeline = buildStylePipeline(
|
|
2513
|
-
options.styling?.variants,
|
|
2514
|
-
options.styling?.presets,
|
|
2515
|
-
options.styling?.defaults ?? {},
|
|
2516
|
-
options.styling?.compounds,
|
|
2517
|
-
void 0
|
|
2518
|
-
);
|
|
2519
|
-
const base = options.styling?.base !== void 0 ? flattenClassName(options.styling.base) : void 0;
|
|
2520
|
-
const filterFn = options.filterProps;
|
|
2521
|
-
const allowedAs = options.enforcement?.allowedAs;
|
|
2522
|
-
const normalizeFn = options.normalize;
|
|
2523
|
-
const enforcementNormalizers = options.enforcement?.props;
|
|
2524
|
-
const classPlugin = options.styling?.plugin !== void 0 ? options.styling.plugin(
|
|
2525
|
-
options.styling,
|
|
2526
|
-
resolved.diagnostics
|
|
2527
|
-
) : void 0;
|
|
2528
|
-
const pluginKeys = classPlugin?.ownedKeys ?? EMPTY_SET;
|
|
2529
|
-
const { childrenEvaluator: explicitEvaluator } = buildEngines(
|
|
2530
|
-
resolved.diagnostics,
|
|
2531
|
-
options.enforcement?.children,
|
|
2532
|
-
displayName
|
|
2533
|
-
);
|
|
2534
|
-
const ariaEngine = options.enforcement !== void 0 ? new AriaPolicyEngine(resolved.diagnostics) : void 0;
|
|
2535
|
-
const slotValidator = new SlotValidator(displayName, resolved.diagnostics, "VNode");
|
|
2809
|
+
const bundle = buildRuntime(options);
|
|
2536
2810
|
const Component = defineComponent2({
|
|
2537
|
-
name
|
|
2811
|
+
// normalizeOptions always supplies `name`, so displayName is always defined here —
|
|
2812
|
+
// the fallback only satisfies the type, which allows it to be absent in general.
|
|
2813
|
+
name: bundle.runtime.options.displayName ?? "PolymorphicComponent",
|
|
2538
2814
|
inheritAttrs: false,
|
|
2539
2815
|
setup(_, { attrs, slots }) {
|
|
2540
|
-
const
|
|
2541
|
-
|
|
2542
|
-
|
|
2543
|
-
|
|
2544
|
-
class: callerClass,
|
|
2545
|
-
recipe,
|
|
2546
|
-
...ownProps
|
|
2547
|
-
} = attrs;
|
|
2548
|
-
const tag = typeof as === "string" ? as : defaultTag;
|
|
2549
|
-
if (allowedAs !== void 0)
|
|
2550
|
-
enforceAllowedAs(tag, allowedAs, resolved.diagnostics, displayName);
|
|
2551
|
-
const rawBaseProps = domDefaults !== void 0 ? { ...domDefaults, ...ownProps } : ownProps;
|
|
2552
|
-
const normalizedProps = applyPropNormalizers(tag, rawBaseProps, enforcementNormalizers);
|
|
2553
|
-
const baseProps = normalizeFn !== void 0 ? normalizeFn(normalizedProps) : normalizedProps;
|
|
2554
|
-
const pluginProps = {};
|
|
2555
|
-
const propsForExtraction = pluginKeys.size > 0 ? Object.fromEntries(
|
|
2556
|
-
Object.entries(baseProps).filter(([k]) => {
|
|
2557
|
-
if (pluginKeys.has(k)) {
|
|
2558
|
-
pluginProps[k] = baseProps[k];
|
|
2559
|
-
return false;
|
|
2560
|
-
}
|
|
2561
|
-
return true;
|
|
2562
|
-
})
|
|
2563
|
-
) : baseProps;
|
|
2564
|
-
const rootDec = extractDecoration(propsForExtraction, variantKeys);
|
|
2565
|
-
const decoration = applyAria(
|
|
2566
|
-
Object.keys(rootDec).length > 0 ? { root: rootDec } : {},
|
|
2567
|
-
tag,
|
|
2568
|
-
ariaEngine
|
|
2569
|
-
);
|
|
2570
|
-
const recipeName = typeof recipe === "string" ? recipe : void 0;
|
|
2571
|
-
const { variantClasses, compoundClasses } = stylePipeline ? stylePipeline.execute(decoration, recipeName) : { variantClasses: [], compoundClasses: [] };
|
|
2572
|
-
const rawClassName = joinClasses(
|
|
2573
|
-
base,
|
|
2574
|
-
...variantClasses,
|
|
2575
|
-
...compoundClasses,
|
|
2576
|
-
typeof callerClass === "string" ? callerClass : void 0
|
|
2577
|
-
);
|
|
2578
|
-
const className = classPlugin !== void 0 ? classPlugin.pipeline(tag, pluginProps, rawClassName, recipeName) : rawClassName;
|
|
2579
|
-
let finalDecoration = className ? applyAttributes("root", { className }, decoration, variantKeys) : decoration;
|
|
2580
|
-
finalDecoration = applyFilterProps(finalDecoration, filterFn, variantKeys);
|
|
2581
|
-
return { tag, asChild, as, finalDecoration, className };
|
|
2582
|
-
});
|
|
2583
|
-
return () => {
|
|
2584
|
-
const { tag, asChild, as, finalDecoration, className } = decorationState.value;
|
|
2585
|
-
const { vnodes: children, discarded } = normalizeChildren(slots);
|
|
2586
|
-
if (process.env.NODE_ENV !== "production") {
|
|
2587
|
-
const childEval = explicitEvaluator ?? getHtmlChildrenEvaluator(tag);
|
|
2588
|
-
childEval?.evaluate(children);
|
|
2589
|
-
}
|
|
2590
|
-
if (asChild === true) {
|
|
2591
|
-
if (typeof as === "string") {
|
|
2592
|
-
slotValidator.assertExclusive();
|
|
2593
|
-
} else {
|
|
2594
|
-
if (discarded > 0) slotValidator.warnDiscardedChildren(discarded);
|
|
2595
|
-
const extraction = extractSlottable(children);
|
|
2596
|
-
if (extraction) {
|
|
2597
|
-
return extraction.rebuild(
|
|
2598
|
-
cloneVNode(extraction.child, {
|
|
2599
|
-
...finalDecoration["root"]?.attributes,
|
|
2600
|
-
class: className
|
|
2601
|
-
})
|
|
2602
|
-
);
|
|
2603
|
-
}
|
|
2604
|
-
if (children.length === 1 && children[0] !== void 0) {
|
|
2605
|
-
return cloneVNode(children[0], {
|
|
2606
|
-
...finalDecoration["root"]?.attributes,
|
|
2607
|
-
class: className
|
|
2608
|
-
});
|
|
2609
|
-
}
|
|
2610
|
-
slotValidator.assertSingleChild(children.length);
|
|
2611
|
-
return null;
|
|
2612
|
-
}
|
|
2613
|
-
}
|
|
2614
|
-
return renderNormally(definition, tag, finalDecoration, slots);
|
|
2615
|
-
};
|
|
2816
|
+
const state = computed(
|
|
2817
|
+
() => prepareRenderState(bundle.runtime, attrs, bundle.filterProps)
|
|
2818
|
+
);
|
|
2819
|
+
return () => render({ ...bundle, state: state.value, slots });
|
|
2616
2820
|
}
|
|
2617
2821
|
});
|
|
2618
2822
|
applyDisplayName(Component, options.name);
|
|
2823
|
+
const defaultTag = bundle.runtime.options.defaultTag;
|
|
2619
2824
|
if (typeof defaultTag === "string") {
|
|
2620
2825
|
Object.assign(Component, { [COMPONENT_DEFAULT_TAG]: defaultTag });
|
|
2621
2826
|
}
|