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/solid/index.js
CHANGED
|
@@ -23,205 +23,47 @@ function isNull(value) {
|
|
|
23
23
|
return value === null;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
// ../../lib/
|
|
27
|
-
function
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
// ../../lib/primitive/src/utils/cn.ts
|
|
44
|
-
import { clsx } from "clsx";
|
|
45
|
-
function cn(...inputs) {
|
|
46
|
-
return clsx(...inputs);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
// ../../lib/primitive/src/utils/iterate.ts
|
|
50
|
-
function find(iterable, callback) {
|
|
51
|
-
for (const value of iterable) {
|
|
52
|
-
const result = callback(value);
|
|
53
|
-
if (result != null) {
|
|
54
|
-
return result;
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
return null;
|
|
58
|
-
}
|
|
59
|
-
function some(iterable, predicate) {
|
|
60
|
-
for (const value of iterable) {
|
|
61
|
-
if (predicate(value)) return true;
|
|
62
|
-
}
|
|
63
|
-
return false;
|
|
64
|
-
}
|
|
65
|
-
function every(iterable, predicate) {
|
|
66
|
-
let index = 0;
|
|
67
|
-
for (const value of iterable) {
|
|
68
|
-
if (!predicate(value, index++)) {
|
|
69
|
-
return false;
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
return true;
|
|
73
|
-
}
|
|
74
|
-
function* filter(iterable, predicate) {
|
|
75
|
-
let index = 0;
|
|
76
|
-
for (const value of iterable) {
|
|
77
|
-
if (predicate(value, index++)) {
|
|
78
|
-
yield value;
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
function* map(iterable, callback) {
|
|
83
|
-
let index = 0;
|
|
84
|
-
for (const value of iterable) {
|
|
85
|
-
yield callback(value, index++);
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
function forEach(iterable, callback) {
|
|
89
|
-
let index = 0;
|
|
90
|
-
for (const value of iterable) {
|
|
91
|
-
callback(value, index++);
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
function reduce(iterable, initial, callback) {
|
|
95
|
-
let accumulator = initial;
|
|
96
|
-
let index = 0;
|
|
97
|
-
for (const value of iterable) {
|
|
98
|
-
accumulator = callback(accumulator, value, index++);
|
|
99
|
-
}
|
|
100
|
-
return accumulator;
|
|
101
|
-
}
|
|
102
|
-
function collect(iterable, callback) {
|
|
103
|
-
const result = {};
|
|
104
|
-
let index = 0;
|
|
105
|
-
for (const value of iterable) {
|
|
106
|
-
const entry = callback(value, index++);
|
|
107
|
-
if (entry === null) {
|
|
108
|
-
return null;
|
|
109
|
-
}
|
|
110
|
-
result[entry[0]] = entry[1];
|
|
111
|
-
}
|
|
112
|
-
return result;
|
|
113
|
-
}
|
|
114
|
-
function findLast(value, callback) {
|
|
115
|
-
for (let index = value.length - 1; index >= 0; index--) {
|
|
116
|
-
const result = callback(value[index], index);
|
|
117
|
-
if (result != null) {
|
|
118
|
-
return result;
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
return null;
|
|
122
|
-
}
|
|
123
|
-
function* items(collection) {
|
|
124
|
-
for (let i = 0; i < collection.length; i++) {
|
|
125
|
-
const item = collection.item(i);
|
|
126
|
-
if (item !== null) {
|
|
127
|
-
yield item;
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
function nodeList(list) {
|
|
132
|
-
return {
|
|
133
|
-
*[Symbol.iterator]() {
|
|
134
|
-
for (let i = 0; i < list.length; i++) {
|
|
135
|
-
const node = list.item(i);
|
|
136
|
-
if (node !== null) {
|
|
137
|
-
yield node;
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
};
|
|
142
|
-
}
|
|
143
|
-
function mapEntries(m) {
|
|
144
|
-
return m.entries();
|
|
145
|
-
}
|
|
146
|
-
function set(s) {
|
|
147
|
-
return s.values();
|
|
148
|
-
}
|
|
149
|
-
function hasOwn(object, key) {
|
|
150
|
-
return Object.hasOwn(object, key);
|
|
151
|
-
}
|
|
152
|
-
function* entries(object) {
|
|
153
|
-
for (const key in object) {
|
|
154
|
-
if (!hasOwn(object, key)) continue;
|
|
155
|
-
yield [key, object[key]];
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
function* keys(object) {
|
|
159
|
-
for (const [key] of entries(object)) {
|
|
160
|
-
yield key;
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
function* values(object) {
|
|
164
|
-
for (const [, value] of entries(object)) {
|
|
165
|
-
yield value;
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
function mapValues(object, callback) {
|
|
169
|
-
const result = {};
|
|
170
|
-
for (const [key, value] of entries(object)) {
|
|
171
|
-
result[key] = callback(value, key);
|
|
172
|
-
}
|
|
173
|
-
return result;
|
|
174
|
-
}
|
|
175
|
-
function forEachEntry(object, callback) {
|
|
176
|
-
for (const [key, value] of entries(object)) {
|
|
177
|
-
callback(key, value);
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
function forEachKey(object, callback) {
|
|
181
|
-
for (const key of keys(object)) {
|
|
182
|
-
callback(key);
|
|
26
|
+
// ../../lib/primitive/src/guards/children/is-tag.ts
|
|
27
|
+
function getAsProp(child) {
|
|
28
|
+
if (!isObject(child) || !("props" in child)) return void 0;
|
|
29
|
+
const props = child.props;
|
|
30
|
+
if (!isObject(props)) return void 0;
|
|
31
|
+
const as = props.as;
|
|
32
|
+
return isString(as) && as !== "" ? as : void 0;
|
|
33
|
+
}
|
|
34
|
+
function getTag(child) {
|
|
35
|
+
if (!isObject(child) || !("type" in child)) return void 0;
|
|
36
|
+
const t = child.type;
|
|
37
|
+
if (isString(t)) return t;
|
|
38
|
+
if (typeof t === "function" || isObject(t)) {
|
|
39
|
+
const defaultTag = t[COMPONENT_DEFAULT_TAG];
|
|
40
|
+
if (!isString(defaultTag)) return void 0;
|
|
41
|
+
return getAsProp(child) ?? defaultTag;
|
|
183
42
|
}
|
|
43
|
+
return void 0;
|
|
184
44
|
}
|
|
185
|
-
function
|
|
186
|
-
|
|
187
|
-
|
|
45
|
+
function isTag(...args) {
|
|
46
|
+
if (isString(args[0])) {
|
|
47
|
+
const set3 = new Set(args);
|
|
48
|
+
return (child2) => {
|
|
49
|
+
const tag2 = getTag(child2);
|
|
50
|
+
return tag2 !== void 0 && set3.has(tag2);
|
|
51
|
+
};
|
|
188
52
|
}
|
|
53
|
+
const [child, ...tags] = args;
|
|
54
|
+
const set2 = new Set(tags);
|
|
55
|
+
const tag = getTag(child);
|
|
56
|
+
return tag !== void 0 && set2.has(tag);
|
|
189
57
|
}
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
}
|
|
58
|
+
|
|
59
|
+
// ../../lib/adapter-utils/src/runtime/apply-display-name.ts
|
|
60
|
+
function applyDisplayName(component, name) {
|
|
61
|
+
Object.assign(component, { displayName: name ?? "PolymorphicComponent" });
|
|
194
62
|
}
|
|
195
|
-
var iterate = Object.freeze({
|
|
196
|
-
entries,
|
|
197
|
-
filter,
|
|
198
|
-
find,
|
|
199
|
-
findLast,
|
|
200
|
-
forEach,
|
|
201
|
-
forEachEntry,
|
|
202
|
-
forEachKey,
|
|
203
|
-
forEachSet,
|
|
204
|
-
forEachValue,
|
|
205
|
-
items,
|
|
206
|
-
keys,
|
|
207
|
-
map,
|
|
208
|
-
mapEntries,
|
|
209
|
-
mapValues,
|
|
210
|
-
nodeList,
|
|
211
|
-
reduce,
|
|
212
|
-
collect,
|
|
213
|
-
set,
|
|
214
|
-
some,
|
|
215
|
-
every,
|
|
216
|
-
values
|
|
217
|
-
});
|
|
218
63
|
|
|
219
|
-
// ../../lib/
|
|
220
|
-
function
|
|
221
|
-
return
|
|
222
|
-
...defaultProps ?? {},
|
|
223
|
-
...props
|
|
224
|
-
};
|
|
64
|
+
// ../../lib/adapter-utils/src/runtime/define-component.ts
|
|
65
|
+
function defineContractComponent(options) {
|
|
66
|
+
return (factory) => factory(options);
|
|
225
67
|
}
|
|
226
68
|
|
|
227
69
|
// ../../lib/primitive/src/constants/aria/global-aria-attributes.ts
|
|
@@ -246,7 +88,7 @@ var GLOBAL_ARIA_ATTRIBUTES = /* @__PURE__ */ new Set([
|
|
|
246
88
|
]);
|
|
247
89
|
|
|
248
90
|
// ../../lib/primitive/src/constants/aria/implicit-role-record.ts
|
|
249
|
-
var IMPLICIT_ROLE_RECORD = {
|
|
91
|
+
var IMPLICIT_ROLE_RECORD = Object.freeze({
|
|
250
92
|
// Landmarks
|
|
251
93
|
article: "article",
|
|
252
94
|
aside: "complementary",
|
|
@@ -282,8 +124,8 @@ var IMPLICIT_ROLE_RECORD = {
|
|
|
282
124
|
meter: "meter",
|
|
283
125
|
output: "status",
|
|
284
126
|
progress: "progressbar"
|
|
285
|
-
};
|
|
286
|
-
var INPUT_TYPE_ROLE_MAP = {
|
|
127
|
+
});
|
|
128
|
+
var INPUT_TYPE_ROLE_MAP = Object.freeze({
|
|
287
129
|
checkbox: "checkbox",
|
|
288
130
|
radio: "radio",
|
|
289
131
|
range: "slider",
|
|
@@ -297,20 +139,22 @@ var INPUT_TYPE_ROLE_MAP = {
|
|
|
297
139
|
submit: "button",
|
|
298
140
|
reset: "button",
|
|
299
141
|
image: "button"
|
|
300
|
-
};
|
|
301
|
-
var STRONG_ROLES = [
|
|
142
|
+
});
|
|
143
|
+
var STRONG_ROLES = Object.freeze([
|
|
302
144
|
"main",
|
|
303
145
|
"navigation",
|
|
304
146
|
"complementary",
|
|
305
147
|
"contentinfo",
|
|
306
148
|
"banner"
|
|
307
|
-
];
|
|
308
|
-
var STANDALONE_ROLES = [
|
|
149
|
+
]);
|
|
150
|
+
var STANDALONE_ROLES = Object.freeze([
|
|
151
|
+
"article"
|
|
152
|
+
]);
|
|
309
153
|
var STRONG_ROLES_SET = new Set(STRONG_ROLES);
|
|
310
154
|
var STANDALONE_ROLES_SET = new Set(STANDALONE_ROLES);
|
|
311
155
|
|
|
312
156
|
// ../../lib/primitive/src/constants/aria/known-aria-roles.ts
|
|
313
|
-
var KNOWN_ARIA_ROLES = [
|
|
157
|
+
var KNOWN_ARIA_ROLES = Object.freeze([
|
|
314
158
|
"alert",
|
|
315
159
|
"alertdialog",
|
|
316
160
|
"application",
|
|
@@ -392,7 +236,7 @@ var KNOWN_ARIA_ROLES = [
|
|
|
392
236
|
"tree",
|
|
393
237
|
"treegrid",
|
|
394
238
|
"treeitem"
|
|
395
|
-
];
|
|
239
|
+
]);
|
|
396
240
|
var KNOWN_ARIA_ROLES_SET = new Set(KNOWN_ARIA_ROLES);
|
|
397
241
|
|
|
398
242
|
// ../../lib/primitive/src/constants/aria/role-restricted-attributes.ts
|
|
@@ -567,11 +411,11 @@ function isStandaloneTag(tag) {
|
|
|
567
411
|
return STANDALONE_ROLES_SET.has(IMPLICIT_ROLE_RECORD[tag]);
|
|
568
412
|
}
|
|
569
413
|
function getInputImplicitRole(type) {
|
|
570
|
-
if (type
|
|
414
|
+
if (!isString(type) || !(type in INPUT_TYPE_ROLE_MAP)) return void 0;
|
|
571
415
|
return INPUT_TYPE_ROLE_MAP[type];
|
|
572
416
|
}
|
|
573
417
|
function getConditionalImplicitRole(tag, ariaLabel, ariaLabelledBy) {
|
|
574
|
-
const isNamed =
|
|
418
|
+
const isNamed = isString(ariaLabel) || isString(ariaLabelledBy);
|
|
575
419
|
if (!isNamed) return void 0;
|
|
576
420
|
if (tag === "section") return "region";
|
|
577
421
|
if (tag === "form") return "form";
|
|
@@ -583,17 +427,6 @@ function isKnownAriaRole(value) {
|
|
|
583
427
|
return isString(value) && KNOWN_ARIA_ROLES_SET.has(value);
|
|
584
428
|
}
|
|
585
429
|
|
|
586
|
-
// ../../lib/adapter-utils/src/apply-filter.ts
|
|
587
|
-
function applyFilter(props, filterProps, variantKeys) {
|
|
588
|
-
const out = {};
|
|
589
|
-
iterate.forEachEntry(props, (k) => {
|
|
590
|
-
if (!Object.hasOwn(props, k)) return;
|
|
591
|
-
if (filterProps(k, variantKeys)) return;
|
|
592
|
-
out[k] = props[k];
|
|
593
|
-
});
|
|
594
|
-
return out;
|
|
595
|
-
}
|
|
596
|
-
|
|
597
430
|
// ../../lib/contract/src/aria/aria-role-policy.ts
|
|
598
431
|
function getImplicitRole(tag, props) {
|
|
599
432
|
if (tag in IMPLICIT_ROLE_RECORD) return IMPLICIT_ROLE_RECORD[tag];
|
|
@@ -605,6 +438,202 @@ function getImplicitRole(tag, props) {
|
|
|
605
438
|
return void 0;
|
|
606
439
|
}
|
|
607
440
|
|
|
441
|
+
// ../../lib/primitive/src/tag/resolve-tag.ts
|
|
442
|
+
function makeResolveTag(defaultTag) {
|
|
443
|
+
return function tag(as) {
|
|
444
|
+
return as ?? defaultTag;
|
|
445
|
+
};
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
// ../../lib/primitive/src/utils/assert-never.ts
|
|
449
|
+
function assertNever(value) {
|
|
450
|
+
throw new Error(`Unexpected value: ${String(value)}`);
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
// ../../lib/primitive/src/utils/cn.ts
|
|
454
|
+
import { clsx } from "clsx";
|
|
455
|
+
function cn(...inputs) {
|
|
456
|
+
return clsx(...inputs);
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
// ../../lib/primitive/src/utils/iterate.ts
|
|
460
|
+
function find(iterable, callback) {
|
|
461
|
+
for (const value of iterable) {
|
|
462
|
+
const result = callback(value);
|
|
463
|
+
if (result != null) {
|
|
464
|
+
return result;
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
return null;
|
|
468
|
+
}
|
|
469
|
+
function some(iterable, predicate) {
|
|
470
|
+
for (const value of iterable) {
|
|
471
|
+
if (predicate(value)) return true;
|
|
472
|
+
}
|
|
473
|
+
return false;
|
|
474
|
+
}
|
|
475
|
+
function every(iterable, predicate) {
|
|
476
|
+
let index = 0;
|
|
477
|
+
for (const value of iterable) {
|
|
478
|
+
if (!predicate(value, index++)) {
|
|
479
|
+
return false;
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
return true;
|
|
483
|
+
}
|
|
484
|
+
function* filter(iterable, predicate) {
|
|
485
|
+
let index = 0;
|
|
486
|
+
for (const value of iterable) {
|
|
487
|
+
if (predicate(value, index++)) {
|
|
488
|
+
yield value;
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
}
|
|
492
|
+
function* map(iterable, callback) {
|
|
493
|
+
let index = 0;
|
|
494
|
+
for (const value of iterable) {
|
|
495
|
+
yield callback(value, index++);
|
|
496
|
+
}
|
|
497
|
+
}
|
|
498
|
+
function forEach(iterable, callback) {
|
|
499
|
+
let index = 0;
|
|
500
|
+
for (const value of iterable) {
|
|
501
|
+
callback(value, index++);
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
function reduce(iterable, initial, callback) {
|
|
505
|
+
let accumulator = initial;
|
|
506
|
+
let index = 0;
|
|
507
|
+
for (const value of iterable) {
|
|
508
|
+
accumulator = callback(accumulator, value, index++);
|
|
509
|
+
}
|
|
510
|
+
return accumulator;
|
|
511
|
+
}
|
|
512
|
+
function collect(iterable, callback) {
|
|
513
|
+
const result = {};
|
|
514
|
+
let index = 0;
|
|
515
|
+
for (const value of iterable) {
|
|
516
|
+
const entry = callback(value, index++);
|
|
517
|
+
if (entry === null) {
|
|
518
|
+
return null;
|
|
519
|
+
}
|
|
520
|
+
result[entry[0]] = entry[1];
|
|
521
|
+
}
|
|
522
|
+
return result;
|
|
523
|
+
}
|
|
524
|
+
function findLast(value, callback) {
|
|
525
|
+
for (let index = value.length - 1; index >= 0; index--) {
|
|
526
|
+
const result = callback(value[index], index);
|
|
527
|
+
if (result != null) {
|
|
528
|
+
return result;
|
|
529
|
+
}
|
|
530
|
+
}
|
|
531
|
+
return null;
|
|
532
|
+
}
|
|
533
|
+
function* items(collection) {
|
|
534
|
+
for (let i = 0; i < collection.length; i++) {
|
|
535
|
+
const item = collection.item(i);
|
|
536
|
+
if (item !== null) {
|
|
537
|
+
yield item;
|
|
538
|
+
}
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
function nodeList(list) {
|
|
542
|
+
return {
|
|
543
|
+
*[Symbol.iterator]() {
|
|
544
|
+
for (let i = 0; i < list.length; i++) {
|
|
545
|
+
const node = list.item(i);
|
|
546
|
+
if (node !== null) {
|
|
547
|
+
yield node;
|
|
548
|
+
}
|
|
549
|
+
}
|
|
550
|
+
}
|
|
551
|
+
};
|
|
552
|
+
}
|
|
553
|
+
function mapEntries(m) {
|
|
554
|
+
return m.entries();
|
|
555
|
+
}
|
|
556
|
+
function set(s) {
|
|
557
|
+
return s.values();
|
|
558
|
+
}
|
|
559
|
+
function hasOwn(object, key) {
|
|
560
|
+
return Object.hasOwn(object, key);
|
|
561
|
+
}
|
|
562
|
+
function* entries(object) {
|
|
563
|
+
for (const key in object) {
|
|
564
|
+
if (!hasOwn(object, key)) continue;
|
|
565
|
+
yield [key, object[key]];
|
|
566
|
+
}
|
|
567
|
+
}
|
|
568
|
+
function* keys(object) {
|
|
569
|
+
for (const [key] of entries(object)) {
|
|
570
|
+
yield key;
|
|
571
|
+
}
|
|
572
|
+
}
|
|
573
|
+
function* values(object) {
|
|
574
|
+
for (const [, value] of entries(object)) {
|
|
575
|
+
yield value;
|
|
576
|
+
}
|
|
577
|
+
}
|
|
578
|
+
function mapValues(object, callback) {
|
|
579
|
+
const result = {};
|
|
580
|
+
for (const [key, value] of entries(object)) {
|
|
581
|
+
result[key] = callback(value, key);
|
|
582
|
+
}
|
|
583
|
+
return result;
|
|
584
|
+
}
|
|
585
|
+
function forEachEntry(object, callback) {
|
|
586
|
+
for (const [key, value] of entries(object)) {
|
|
587
|
+
callback(key, value);
|
|
588
|
+
}
|
|
589
|
+
}
|
|
590
|
+
function forEachKey(object, callback) {
|
|
591
|
+
for (const key of keys(object)) {
|
|
592
|
+
callback(key);
|
|
593
|
+
}
|
|
594
|
+
}
|
|
595
|
+
function forEachValue(object, callback) {
|
|
596
|
+
for (const value of values(object)) {
|
|
597
|
+
callback(value);
|
|
598
|
+
}
|
|
599
|
+
}
|
|
600
|
+
function forEachSet(s, callback) {
|
|
601
|
+
for (const value of s) {
|
|
602
|
+
callback(value);
|
|
603
|
+
}
|
|
604
|
+
}
|
|
605
|
+
var iterate = Object.freeze({
|
|
606
|
+
entries,
|
|
607
|
+
filter,
|
|
608
|
+
find,
|
|
609
|
+
findLast,
|
|
610
|
+
forEach,
|
|
611
|
+
forEachEntry,
|
|
612
|
+
forEachKey,
|
|
613
|
+
forEachSet,
|
|
614
|
+
forEachValue,
|
|
615
|
+
items,
|
|
616
|
+
keys,
|
|
617
|
+
map,
|
|
618
|
+
mapEntries,
|
|
619
|
+
mapValues,
|
|
620
|
+
nodeList,
|
|
621
|
+
reduce,
|
|
622
|
+
collect,
|
|
623
|
+
set,
|
|
624
|
+
some,
|
|
625
|
+
every,
|
|
626
|
+
values
|
|
627
|
+
});
|
|
628
|
+
|
|
629
|
+
// ../../lib/primitive/src/utils/merge-props.ts
|
|
630
|
+
function mergeProps(defaultProps, props) {
|
|
631
|
+
return {
|
|
632
|
+
...defaultProps ?? {},
|
|
633
|
+
...props
|
|
634
|
+
};
|
|
635
|
+
}
|
|
636
|
+
|
|
608
637
|
// ../../lib/contract/src/strict/invariant-base.ts
|
|
609
638
|
var InvariantBase = class {
|
|
610
639
|
diagnostics;
|
|
@@ -1660,7 +1689,7 @@ function getTypeName(value) {
|
|
|
1660
1689
|
return primitive;
|
|
1661
1690
|
}
|
|
1662
1691
|
const name = value.constructor?.name;
|
|
1663
|
-
return
|
|
1692
|
+
return isString(name) && name !== "Object" ? name : "object";
|
|
1664
1693
|
}
|
|
1665
1694
|
|
|
1666
1695
|
// ../../lib/contract/src/children/normalize-child-rule.ts
|
|
@@ -1911,6 +1940,9 @@ var readonlyProps = ({
|
|
|
1911
1940
|
};
|
|
1912
1941
|
};
|
|
1913
1942
|
|
|
1943
|
+
// ../core/src/html/evaluators.ts
|
|
1944
|
+
import { warnDiagnostics as warnDiagnostics2 } from "../_shared/diagnostics.js";
|
|
1945
|
+
|
|
1914
1946
|
// ../core/src/html/aria-rules.ts
|
|
1915
1947
|
var LANDMARK_TAG_SET = /* @__PURE__ */ new Set(["article", "aside", "footer", "header", "main", "nav"]);
|
|
1916
1948
|
var removeLandmarkRoleOverride = {
|
|
@@ -1953,6 +1985,171 @@ function landmarkNameAdvisory(ctx) {
|
|
|
1953
1985
|
}
|
|
1954
1986
|
var HTML_ARIA_RULES = [landmarkRoleRule, landmarkNameAdvisory];
|
|
1955
1987
|
|
|
1988
|
+
// ../core/src/html/contracts.ts
|
|
1989
|
+
import { warnDiagnostics } from "../_shared/diagnostics.js";
|
|
1990
|
+
function isOpenContent(...blockedTags) {
|
|
1991
|
+
const set2 = new Set(blockedTags);
|
|
1992
|
+
return (child) => {
|
|
1993
|
+
if (!isObject(child) || !("type" in child)) return false;
|
|
1994
|
+
const tag = getTag(child);
|
|
1995
|
+
return tag === void 0 || !set2.has(tag);
|
|
1996
|
+
};
|
|
1997
|
+
}
|
|
1998
|
+
var METADATA_TAGS = ["script", "template"];
|
|
1999
|
+
var metadataMatch = isTag(...METADATA_TAGS);
|
|
2000
|
+
function metadata(name = "metadata") {
|
|
2001
|
+
return { name, match: metadataMatch };
|
|
2002
|
+
}
|
|
2003
|
+
function firstOptional(name, tag) {
|
|
2004
|
+
return { name, match: isTag(tag), cardinality: { max: 1 }, position: "first" };
|
|
2005
|
+
}
|
|
2006
|
+
function contract(children) {
|
|
2007
|
+
return { diagnostics: warnDiagnostics, children };
|
|
2008
|
+
}
|
|
2009
|
+
function ariaContract(aria) {
|
|
2010
|
+
return { diagnostics: warnDiagnostics, aria };
|
|
2011
|
+
}
|
|
2012
|
+
function firstChildContract(name, tag) {
|
|
2013
|
+
return contract([firstOptional(name, tag), { name: "content", match: isOpenContent(tag) }]);
|
|
2014
|
+
}
|
|
2015
|
+
var VOID_TAGS = [
|
|
2016
|
+
"area",
|
|
2017
|
+
"base",
|
|
2018
|
+
"br",
|
|
2019
|
+
"col",
|
|
2020
|
+
"embed",
|
|
2021
|
+
"hr",
|
|
2022
|
+
"img",
|
|
2023
|
+
"input",
|
|
2024
|
+
"link",
|
|
2025
|
+
"meta",
|
|
2026
|
+
"param",
|
|
2027
|
+
"source",
|
|
2028
|
+
"track",
|
|
2029
|
+
"wbr"
|
|
2030
|
+
];
|
|
2031
|
+
var TEXT_ONLY_TAGS = ["option", "script", "style", "textarea", "title"];
|
|
2032
|
+
var LANDMARK_TAGS = ["article", "aside", "footer", "header", "main", "nav"];
|
|
2033
|
+
var listContract = contract([{ name: "list-item", match: isTag("li", ...METADATA_TAGS) }]);
|
|
2034
|
+
var tableContract = contract([
|
|
2035
|
+
firstOptional("caption", "caption"),
|
|
2036
|
+
{ name: "colgroup", match: isTag("colgroup") },
|
|
2037
|
+
{ name: "thead", match: isTag("thead"), cardinality: { max: 1 } },
|
|
2038
|
+
{ name: "tbody", match: isTag("tbody") },
|
|
2039
|
+
{ name: "tfoot", match: isTag("tfoot"), cardinality: { max: 1 } },
|
|
2040
|
+
{ name: "table-row", match: isTag("tr", ...METADATA_TAGS) }
|
|
2041
|
+
]);
|
|
2042
|
+
var tableBodyContract = contract([
|
|
2043
|
+
{ name: "table-row", match: isTag("tr", ...METADATA_TAGS) }
|
|
2044
|
+
]);
|
|
2045
|
+
var tableRowContract = contract([
|
|
2046
|
+
{ name: "table-cell", match: isTag("td", "th", ...METADATA_TAGS) }
|
|
2047
|
+
]);
|
|
2048
|
+
var colgroupContract = contract([{ name: "column", match: isTag("col", "template") }]);
|
|
2049
|
+
var dlContract = contract([
|
|
2050
|
+
{ name: "term", match: isTag("dt") },
|
|
2051
|
+
{ name: "description", match: isTag("dd") },
|
|
2052
|
+
{ name: "group", match: isTag("div") },
|
|
2053
|
+
metadata()
|
|
2054
|
+
]);
|
|
2055
|
+
var selectContract = contract([
|
|
2056
|
+
{ name: "option", match: isTag("option", "optgroup", "hr", ...METADATA_TAGS) }
|
|
2057
|
+
]);
|
|
2058
|
+
var optgroupContract = contract([
|
|
2059
|
+
{ name: "option", match: isTag("option", ...METADATA_TAGS) }
|
|
2060
|
+
]);
|
|
2061
|
+
var datalistContract = contract([
|
|
2062
|
+
{ name: "option", match: isTag("option", ...METADATA_TAGS) }
|
|
2063
|
+
]);
|
|
2064
|
+
var pictureContract = contract([
|
|
2065
|
+
{ name: "source", match: isTag("source", ...METADATA_TAGS) },
|
|
2066
|
+
{ name: "image", match: isTag("img"), cardinality: { min: 1, max: 1 }, position: "last" }
|
|
2067
|
+
]);
|
|
2068
|
+
var figureContract = contract([
|
|
2069
|
+
{ name: "caption", match: isTag("figcaption"), cardinality: { max: 1 } },
|
|
2070
|
+
{ name: "content", match: isOpenContent("figcaption") }
|
|
2071
|
+
]);
|
|
2072
|
+
var detailsContract = firstChildContract("summary", "summary");
|
|
2073
|
+
var fieldsetContract = firstChildContract("legend", "legend");
|
|
2074
|
+
var mediaContract = contract([
|
|
2075
|
+
{ name: "source", match: isTag("source") },
|
|
2076
|
+
{ name: "track", match: isTag("track") },
|
|
2077
|
+
metadata(),
|
|
2078
|
+
{ name: "content", match: isOpenContent("source", "track", ...METADATA_TAGS) }
|
|
2079
|
+
]);
|
|
2080
|
+
var headContract = contract([
|
|
2081
|
+
{
|
|
2082
|
+
name: "metadata",
|
|
2083
|
+
match: isTag("base", "link", "meta", "noscript", "script", "style", "template", "title")
|
|
2084
|
+
}
|
|
2085
|
+
]);
|
|
2086
|
+
var htmlContract = contract([
|
|
2087
|
+
{ name: "head", match: isTag("head"), cardinality: { min: 1, max: 1 }, position: "first" },
|
|
2088
|
+
{ name: "body", match: isTag("body"), cardinality: { min: 1, max: 1 } }
|
|
2089
|
+
]);
|
|
2090
|
+
var voidContract = contract([]);
|
|
2091
|
+
var textOnlyContract = contract([
|
|
2092
|
+
{
|
|
2093
|
+
name: "text",
|
|
2094
|
+
match: (child) => isString(child) || isNumber(child)
|
|
2095
|
+
}
|
|
2096
|
+
]);
|
|
2097
|
+
var landmarkContract = ariaContract([landmarkRoleRule, landmarkNameAdvisory]);
|
|
2098
|
+
var dialogContract = ariaContract([requireAccessibleName]);
|
|
2099
|
+
var menuContract = ariaContract([requireAccessibleName]);
|
|
2100
|
+
var menubarContract = ariaContract([requireAccessibleName]);
|
|
2101
|
+
var treeContract = ariaContract([requireAccessibleName]);
|
|
2102
|
+
var gridContract = ariaContract([requireAccessibleName]);
|
|
2103
|
+
var listboxContract = ariaContract([requireAccessibleName]);
|
|
2104
|
+
var tablistContract = ariaContract([requireAccessibleName]);
|
|
2105
|
+
var radiogroupContract = ariaContract([requireAccessibleName]);
|
|
2106
|
+
var CONTRACT_GROUPS = [
|
|
2107
|
+
[VOID_TAGS, voidContract],
|
|
2108
|
+
[TEXT_ONLY_TAGS, textOnlyContract],
|
|
2109
|
+
[LANDMARK_TAGS, landmarkContract],
|
|
2110
|
+
[["ul", "ol", "menu"], listContract],
|
|
2111
|
+
[["audio", "video"], mediaContract],
|
|
2112
|
+
[["thead", "tbody", "tfoot"], tableBodyContract]
|
|
2113
|
+
];
|
|
2114
|
+
function contractMap(groups) {
|
|
2115
|
+
return Object.fromEntries(
|
|
2116
|
+
groups.flatMap(([tags, enforcement]) => tags.map((tag) => [tag, enforcement]))
|
|
2117
|
+
);
|
|
2118
|
+
}
|
|
2119
|
+
var htmlContracts = {
|
|
2120
|
+
...contractMap(CONTRACT_GROUPS),
|
|
2121
|
+
table: tableContract,
|
|
2122
|
+
tr: tableRowContract,
|
|
2123
|
+
colgroup: colgroupContract,
|
|
2124
|
+
dl: dlContract,
|
|
2125
|
+
select: selectContract,
|
|
2126
|
+
optgroup: optgroupContract,
|
|
2127
|
+
datalist: datalistContract,
|
|
2128
|
+
picture: pictureContract,
|
|
2129
|
+
figure: figureContract,
|
|
2130
|
+
details: detailsContract,
|
|
2131
|
+
fieldset: fieldsetContract,
|
|
2132
|
+
dialog: dialogContract,
|
|
2133
|
+
head: headContract,
|
|
2134
|
+
html: htmlContract
|
|
2135
|
+
};
|
|
2136
|
+
|
|
2137
|
+
// ../core/src/html/evaluators.ts
|
|
2138
|
+
var htmlDiagnostics = warnDiagnostics2;
|
|
2139
|
+
function buildEvaluatorMap() {
|
|
2140
|
+
const map2 = /* @__PURE__ */ new Map();
|
|
2141
|
+
iterate.forEachEntry(htmlContracts, (tag, { children }) => {
|
|
2142
|
+
if (children?.length) {
|
|
2143
|
+
map2.set(tag, new ChildrenEvaluator(children, htmlDiagnostics, `<${tag}>`));
|
|
2144
|
+
}
|
|
2145
|
+
});
|
|
2146
|
+
return map2;
|
|
2147
|
+
}
|
|
2148
|
+
var HTML_EVALUATORS = buildEvaluatorMap();
|
|
2149
|
+
function getHtmlChildrenEvaluator(tag) {
|
|
2150
|
+
return typeof tag === "string" ? HTML_EVALUATORS.get(tag) : void 0;
|
|
2151
|
+
}
|
|
2152
|
+
|
|
1956
2153
|
// ../core/src/html/prop-normalizers.ts
|
|
1957
2154
|
var HTML_FORM_NORMALIZERS = /* @__PURE__ */ new Map([
|
|
1958
2155
|
["button", [disabledProps]],
|
|
@@ -2140,6 +2337,19 @@ function createClassPipeline(resolved) {
|
|
|
2140
2337
|
};
|
|
2141
2338
|
}
|
|
2142
2339
|
|
|
2340
|
+
// ../../lib/pipeline-kit/src/factory/define-pipeline.ts
|
|
2341
|
+
function definePipeline(factory) {
|
|
2342
|
+
const cache = /* @__PURE__ */ new WeakMap();
|
|
2343
|
+
return (resolved) => {
|
|
2344
|
+
let pipeline = cache.get(resolved);
|
|
2345
|
+
if (!pipeline) {
|
|
2346
|
+
pipeline = factory(resolved);
|
|
2347
|
+
cache.set(resolved, pipeline);
|
|
2348
|
+
}
|
|
2349
|
+
return pipeline;
|
|
2350
|
+
};
|
|
2351
|
+
}
|
|
2352
|
+
|
|
2143
2353
|
// ../core/src/options/resolve-factory-options.ts
|
|
2144
2354
|
import { silentDiagnostics } from "../_shared/diagnostics.js";
|
|
2145
2355
|
var EMPTY_VARIANT_KEYS = /* @__PURE__ */ new Set();
|
|
@@ -2275,89 +2485,82 @@ function guardPipeline(pipeline) {
|
|
|
2275
2485
|
};
|
|
2276
2486
|
}
|
|
2277
2487
|
|
|
2278
|
-
// ../core/src/factory/create-
|
|
2279
|
-
var
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
|
|
2488
|
+
// ../core/src/factory/create-polymorphic2.ts
|
|
2489
|
+
var createTagPipeline = (resolved) => makeResolveTag(resolved.defaultTag);
|
|
2490
|
+
var createPropsPipeline = (resolved) => (props) => mergeProps(resolved.defaultProps, props);
|
|
2491
|
+
var createHtmlPropNormalizersPipeline = () => getHtmlPropNormalizers;
|
|
2492
|
+
var createHtmlChildrenEvaluatorPipeline = () => getHtmlChildrenEvaluator;
|
|
2493
|
+
var createStylingClassPipeline = (resolved) => createClassPipeline(resolved);
|
|
2494
|
+
function resolveAriaRules(resolved) {
|
|
2495
|
+
return [.../* @__PURE__ */ new Set([...HTML_ARIA_RULES, ...resolved.ariaRules ?? []])];
|
|
2496
|
+
}
|
|
2497
|
+
var createAriaPipeline = (resolved) => {
|
|
2498
|
+
const rules = resolveAriaRules(resolved);
|
|
2499
|
+
const engine = new AriaPolicyEngine(resolved.diagnostics, rules.length ? { rules } : void 0);
|
|
2500
|
+
return (tag, props) => engine.validate(tag, props);
|
|
2501
|
+
};
|
|
2502
|
+
var memoizedTagPipeline = definePipeline(createTagPipeline);
|
|
2503
|
+
var memoizedPropsPipeline = definePipeline(createPropsPipeline);
|
|
2504
|
+
var memoizedHtmlPropNormalizersPipeline = definePipeline(createHtmlPropNormalizersPipeline);
|
|
2505
|
+
var memoizedHtmlChildrenEvaluatorPipeline = definePipeline(createHtmlChildrenEvaluatorPipeline);
|
|
2506
|
+
var memoizedClassPipeline = definePipeline(createStylingClassPipeline);
|
|
2507
|
+
var memoizedAriaPipeline = definePipeline(createAriaPipeline);
|
|
2508
|
+
function resolveAriaPassthrough(_tag, props) {
|
|
2509
|
+
return { props };
|
|
2510
|
+
}
|
|
2511
|
+
function resolveClassPlugin(factory, resolved, diagnostics) {
|
|
2512
|
+
if (!factory) return { pluginResult: void 0, classPipeline: memoizedClassPipeline(resolved) };
|
|
2287
2513
|
const pluginResult = factory(resolved, diagnostics);
|
|
2288
2514
|
assertPluginShape(pluginResult);
|
|
2289
|
-
|
|
2290
|
-
return { pluginResult, classPipeline };
|
|
2515
|
+
return { pluginResult, classPipeline: guardPipeline(pluginResult.pipeline) };
|
|
2291
2516
|
}
|
|
2292
|
-
function
|
|
2293
|
-
|
|
2294
|
-
|
|
2295
|
-
|
|
2296
|
-
|
|
2297
|
-
|
|
2517
|
+
function createPolymorphic2(options = {}) {
|
|
2518
|
+
const baseResolved = resolveFactoryOptions(options);
|
|
2519
|
+
const anyBaseResolved = baseResolved;
|
|
2520
|
+
const resolved = Object.freeze({
|
|
2521
|
+
...baseResolved,
|
|
2522
|
+
htmlPropNormalizersFn: memoizedHtmlPropNormalizersPipeline(anyBaseResolved),
|
|
2523
|
+
htmlChildrenEvaluatorFn: memoizedHtmlChildrenEvaluatorPipeline(anyBaseResolved)
|
|
2524
|
+
});
|
|
2525
|
+
const anyResolved = resolved;
|
|
2526
|
+
if (process.env.NODE_ENV !== "production") {
|
|
2527
|
+
validateFactoryOptions(resolved, resolved.diagnostics);
|
|
2528
|
+
}
|
|
2529
|
+
const { pluginResult, classPipeline } = resolveClassPlugin(
|
|
2530
|
+
options.styling?.plugin,
|
|
2531
|
+
anyResolved,
|
|
2532
|
+
resolved.diagnostics
|
|
2533
|
+
);
|
|
2534
|
+
const resolveTag3 = memoizedTagPipeline(anyResolved);
|
|
2535
|
+
const resolveProps = memoizedPropsPipeline(anyResolved);
|
|
2536
|
+
const resolveAriaFn = options.enforcement !== void 0 ? memoizedAriaPipeline(anyResolved) : resolveAriaPassthrough;
|
|
2537
|
+
const methods = {
|
|
2538
|
+
resolveTag: resolveTag3,
|
|
2539
|
+
resolveProps,
|
|
2298
2540
|
resolveClasses(tag, props, className, recipe) {
|
|
2299
2541
|
if (process.env.NODE_ENV !== "production") {
|
|
2300
|
-
validateRenderProps(
|
|
2542
|
+
validateRenderProps(resolved.diagnostics, resolved, props, recipe);
|
|
2301
2543
|
}
|
|
2302
2544
|
return classPipeline(tag, props, className, recipe);
|
|
2303
2545
|
},
|
|
2304
2546
|
resolveAria(tag, props) {
|
|
2305
|
-
|
|
2306
|
-
const result = engine.validate(tag, props);
|
|
2307
|
-
return { props: result.props };
|
|
2547
|
+
return resolveAriaFn(tag, props);
|
|
2308
2548
|
}
|
|
2309
2549
|
};
|
|
2310
|
-
}
|
|
2311
|
-
|
|
2312
|
-
return pluginResult ? { ...methods, options: resolved, hasStyling: true, classPlugin: pluginResult } : { ...methods, options: resolved };
|
|
2313
|
-
}
|
|
2314
|
-
function createPolymorphic(options = {}, capabilities) {
|
|
2315
|
-
const baseResolved = resolveFactoryOptions(options);
|
|
2316
|
-
const resolved = capabilities?.htmlPropNormalizersFn !== void 0 ? Object.freeze({
|
|
2317
|
-
...baseResolved,
|
|
2318
|
-
htmlPropNormalizersFn: capabilities.htmlPropNormalizersFn
|
|
2319
|
-
}) : baseResolved;
|
|
2320
|
-
if (process.env.NODE_ENV !== "production") {
|
|
2321
|
-
validateFactoryOptions(resolved, resolved.diagnostics);
|
|
2322
|
-
}
|
|
2323
|
-
const { pluginResult, classPipeline } = resolveClassPipeline(
|
|
2324
|
-
options,
|
|
2325
|
-
resolved,
|
|
2326
|
-
resolved.diagnostics,
|
|
2327
|
-
capabilities
|
|
2328
|
-
);
|
|
2329
|
-
const allAriaRules = [
|
|
2330
|
-
.../* @__PURE__ */ new Set([...capabilities?.htmlAriaRules ?? [], ...resolved.ariaRules ?? []])
|
|
2331
|
-
];
|
|
2332
|
-
const engine = options.enforcement !== void 0 && capabilities?.AriaEngine ? new capabilities.AriaEngine(
|
|
2333
|
-
resolved.diagnostics,
|
|
2334
|
-
allAriaRules.length ? { rules: allAriaRules } : void 0
|
|
2335
|
-
) : null;
|
|
2336
|
-
const methods = createRuntimeMethods(resolved, classPipeline, engine, resolved.diagnostics);
|
|
2337
|
-
return createRuntimeObject(
|
|
2338
|
-
methods,
|
|
2339
|
-
resolved,
|
|
2340
|
-
pluginResult
|
|
2341
|
-
);
|
|
2342
|
-
}
|
|
2343
|
-
|
|
2344
|
-
// ../core/src/factory/create-polymorphic-full.ts
|
|
2345
|
-
var FULL_CAPABILITIES = {
|
|
2346
|
-
createClassPipeline,
|
|
2347
|
-
AriaEngine: AriaPolicyEngine,
|
|
2348
|
-
htmlAriaRules: HTML_ARIA_RULES,
|
|
2349
|
-
htmlPropNormalizersFn: getHtmlPropNormalizers
|
|
2350
|
-
};
|
|
2351
|
-
function createPolymorphic2(options = {}) {
|
|
2352
|
-
return createPolymorphic(options, FULL_CAPABILITIES);
|
|
2550
|
+
const runtimeObject = pluginResult ? { ...methods, options: resolved, hasStyling: true, classPlugin: pluginResult } : { ...methods, options: resolved };
|
|
2551
|
+
return runtimeObject;
|
|
2353
2552
|
}
|
|
2354
2553
|
|
|
2355
|
-
//
|
|
2356
|
-
|
|
2357
|
-
|
|
2554
|
+
// ../core/src/resolver/resolver.ts
|
|
2555
|
+
import { silentDiagnostics as silentDiagnostics2 } from "../_shared/diagnostics.js";
|
|
2556
|
+
function enforceAllowedAs(tag, allowedAs, diagnostics, displayName) {
|
|
2557
|
+
if (allowedAs.includes(tag)) return;
|
|
2558
|
+
if (!diagnostics) return;
|
|
2559
|
+
const component = displayName ?? String(tag);
|
|
2560
|
+
diagnostics.error(ContractDiagnostics.allowedAsViolation(String(tag), allowedAs, component));
|
|
2358
2561
|
}
|
|
2359
2562
|
|
|
2360
|
-
// ../../lib/adapter-utils/src/build-core-runtime.ts
|
|
2563
|
+
// ../../lib/adapter-utils/src/runtime/build-core-runtime.ts
|
|
2361
2564
|
var EMPTY_SET = /* @__PURE__ */ new Set();
|
|
2362
2565
|
function buildCoreRuntime(normalized) {
|
|
2363
2566
|
const runtime = createPolymorphic2(normalized);
|
|
@@ -2365,12 +2568,32 @@ function buildCoreRuntime(normalized) {
|
|
|
2365
2568
|
return { runtime, ownedKeys };
|
|
2366
2569
|
}
|
|
2367
2570
|
|
|
2368
|
-
// ../../lib/adapter-utils/src/build-engines.ts
|
|
2571
|
+
// ../../lib/adapter-utils/src/runtime/build-engines.ts
|
|
2369
2572
|
function buildEngines(diagnostics, childRules, context) {
|
|
2370
2573
|
return childRules?.length ? { childrenEvaluator: new ChildrenEvaluator(childRules, diagnostics, context) } : {};
|
|
2371
2574
|
}
|
|
2372
2575
|
|
|
2373
|
-
// ../../lib/adapter-utils/src/
|
|
2576
|
+
// ../../lib/adapter-utils/src/runtime/resolve-adapter-common-options.ts
|
|
2577
|
+
import { throwDiagnostics as throwDiagnostics2, silentDiagnostics as silentDiagnostics3 } from "../_shared/diagnostics.js";
|
|
2578
|
+
function resolveAdapterCommonOptions(options, defaultName = "PolymorphicComponent", defaultDiagnostics = throwDiagnostics2) {
|
|
2579
|
+
return {
|
|
2580
|
+
name: options.name ?? defaultName,
|
|
2581
|
+
diagnostics: options.enforcement?.diagnostics ?? defaultDiagnostics
|
|
2582
|
+
};
|
|
2583
|
+
}
|
|
2584
|
+
|
|
2585
|
+
// ../../lib/adapter-utils/src/props/apply-filter.ts
|
|
2586
|
+
function applyFilter(props, filterProps, variantKeys) {
|
|
2587
|
+
const out = {};
|
|
2588
|
+
iterate.forEachEntry(props, (k) => {
|
|
2589
|
+
if (!Object.hasOwn(props, k)) return;
|
|
2590
|
+
if (filterProps(k, variantKeys)) return;
|
|
2591
|
+
out[k] = props[k];
|
|
2592
|
+
});
|
|
2593
|
+
return out;
|
|
2594
|
+
}
|
|
2595
|
+
|
|
2596
|
+
// ../../lib/adapter-utils/src/props/compose-filter.ts
|
|
2374
2597
|
function composeFilter(ownedKeys, filterProps) {
|
|
2375
2598
|
const defaultFilter = (key, variantKeys) => variantKeys.has(key) || ownedKeys.has(key);
|
|
2376
2599
|
if (!filterProps) {
|
|
@@ -2379,15 +2602,6 @@ function composeFilter(ownedKeys, filterProps) {
|
|
|
2379
2602
|
return (key, variantKeys) => defaultFilter(key, variantKeys) || filterProps(key, variantKeys);
|
|
2380
2603
|
}
|
|
2381
2604
|
|
|
2382
|
-
// ../../lib/adapter-utils/src/resolve-adapter-common-options.ts
|
|
2383
|
-
import { throwDiagnostics as throwDiagnostics2, silentDiagnostics as silentDiagnostics2 } from "../_shared/diagnostics.js";
|
|
2384
|
-
function resolveAdapterCommonOptions(options, defaultName = "PolymorphicComponent", defaultDiagnostics = throwDiagnostics2) {
|
|
2385
|
-
return {
|
|
2386
|
-
name: options.name ?? defaultName,
|
|
2387
|
-
diagnostics: options.enforcement?.diagnostics ?? defaultDiagnostics
|
|
2388
|
-
};
|
|
2389
|
-
}
|
|
2390
|
-
|
|
2391
2605
|
// ../../adapters/solid/src/slot/slot-validator.ts
|
|
2392
2606
|
var SlotValidator = class extends InvariantBase {
|
|
2393
2607
|
#name;
|
|
@@ -2464,7 +2678,7 @@ function resolveTag2(runtime, as) {
|
|
|
2464
2678
|
return runtime.resolveTag(as);
|
|
2465
2679
|
}
|
|
2466
2680
|
function resolveDomProps(tag, elementProps, runtime) {
|
|
2467
|
-
return
|
|
2681
|
+
return isString(tag) ? runtime.resolveAria(tag, elementProps).props : elementProps;
|
|
2468
2682
|
}
|
|
2469
2683
|
function tryRenderAsChild(known, filteredProps, resolvedClass, slotValidator) {
|
|
2470
2684
|
if (!known.asChild) return null;
|
|
@@ -2505,9 +2719,20 @@ function render({
|
|
|
2505
2719
|
const filteredProps = createMemo(
|
|
2506
2720
|
() => applyFilter(normalizedProps(), filterProps, runtime.options.variantKeys)
|
|
2507
2721
|
);
|
|
2722
|
+
const { allowedAs } = runtime.options;
|
|
2723
|
+
if (allowedAs !== void 0) {
|
|
2724
|
+
createEffect(
|
|
2725
|
+
() => enforceAllowedAs(tag(), allowedAs, runtime.options.diagnostics, runtime.options.displayName)
|
|
2726
|
+
);
|
|
2727
|
+
}
|
|
2508
2728
|
if (process.env.NODE_ENV !== "production" && childrenEvaluator) {
|
|
2509
2729
|
createEffect(() => childrenEvaluator.evaluate(toChildArray(known.children)));
|
|
2510
2730
|
}
|
|
2731
|
+
if (process.env.NODE_ENV !== "production") {
|
|
2732
|
+
createEffect(
|
|
2733
|
+
() => runtime.options.htmlChildrenEvaluatorFn?.(tag())?.evaluate(toChildArray(known.children))
|
|
2734
|
+
);
|
|
2735
|
+
}
|
|
2511
2736
|
const slotResult = tryRenderAsChild(known, filteredProps, resolvedClass, slotValidator);
|
|
2512
2737
|
if (slotResult !== null) return slotResult;
|
|
2513
2738
|
const domProps = createMemo(() => {
|