praxis-kit 6.1.1 → 6.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-OGQ7QKKP.js → chunk-4YVNOMUS.js} +511 -508
- package/dist/contract/index.d.ts +7 -1
- package/dist/lit/index.d.ts +5 -0
- package/dist/lit/index.js +263 -260
- package/dist/preact/index.d.ts +5 -0
- package/dist/preact/index.js +332 -329
- package/dist/react/index.d.ts +2 -2
- package/dist/react/index.js +1 -1
- package/dist/react/legacy.d.ts +2 -2
- package/dist/react/legacy.js +1 -1
- package/dist/{react-options-CjiWrT4q.d.ts → react-options-DQTX4YS_.d.ts} +5 -0
- package/dist/solid/index.d.ts +5 -0
- package/dist/solid/index.js +315 -312
- package/dist/svelte/index.d.ts +5 -0
- package/dist/svelte/index.js +263 -260
- package/dist/vue/index.d.ts +5 -0
- package/dist/vue/index.js +314 -311
- package/dist/web/index.d.ts +5 -0
- package/dist/web/index.js +263 -260
- package/package.json +2 -2
package/dist/vue/index.js
CHANGED
|
@@ -1,8 +1,15 @@
|
|
|
1
1
|
// ../../adapters/vue/src/create-contract-component.ts
|
|
2
2
|
import { computed, defineComponent as defineComponent2 } from "vue";
|
|
3
3
|
|
|
4
|
-
// ../../lib/primitive/src/
|
|
5
|
-
|
|
4
|
+
// ../../lib/primitive/src/tag/resolve-tag.ts
|
|
5
|
+
function makeResolveTag(defaultTag) {
|
|
6
|
+
return function tag(as) {
|
|
7
|
+
return as ?? defaultTag;
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
// ../../lib/primitive/src/rule/rule-brand.ts
|
|
12
|
+
var RULE_BRAND = /* @__PURE__ */ Symbol("praxis-kit/dynamic-rule");
|
|
6
13
|
|
|
7
14
|
// ../../lib/primitive/src/guards/foundational/is-defined.ts
|
|
8
15
|
function isUndefined(value) {
|
|
@@ -29,80 +36,267 @@ function isNumber(value) {
|
|
|
29
36
|
return typeof value === "number";
|
|
30
37
|
}
|
|
31
38
|
|
|
32
|
-
// ../../lib/primitive/src/
|
|
33
|
-
function
|
|
34
|
-
|
|
35
|
-
const props = child.props;
|
|
36
|
-
if (!isObject(props)) return void 0;
|
|
37
|
-
const as = props.as;
|
|
38
|
-
return isString(as) && as !== "" ? as : void 0;
|
|
39
|
+
// ../../lib/primitive/src/rule/is-dynamic-rule.ts
|
|
40
|
+
function isDynamicRule(rule) {
|
|
41
|
+
return isObject(rule, true) && rule[RULE_BRAND] === true;
|
|
39
42
|
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
43
|
+
|
|
44
|
+
// ../../lib/primitive/src/rule/resolve-rule.ts
|
|
45
|
+
function resolveRule(rule, context) {
|
|
46
|
+
return isDynamicRule(rule) ? rule.resolve(context) : rule;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// ../../lib/primitive/src/utils/assert-never.ts
|
|
50
|
+
function assertNever(value) {
|
|
51
|
+
throw new Error(`Unexpected value: ${String(value)}`);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// ../../lib/primitive/src/utils/cn.ts
|
|
55
|
+
import { clsx } from "clsx";
|
|
56
|
+
function cn(...inputs) {
|
|
57
|
+
return clsx(...inputs);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// ../../lib/primitive/src/utils/iterate.ts
|
|
61
|
+
function find(iterable, callback) {
|
|
62
|
+
for (const value of iterable) {
|
|
63
|
+
const result = callback(value);
|
|
64
|
+
if (result != null) {
|
|
65
|
+
return result;
|
|
66
|
+
}
|
|
48
67
|
}
|
|
49
|
-
return
|
|
68
|
+
return null;
|
|
50
69
|
}
|
|
51
|
-
function
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
return (child2) => {
|
|
55
|
-
const tag2 = getTag(child2);
|
|
56
|
-
return tag2 !== void 0 && set3.has(tag2);
|
|
57
|
-
};
|
|
70
|
+
function some(iterable, predicate) {
|
|
71
|
+
for (const value of iterable) {
|
|
72
|
+
if (predicate(value)) return true;
|
|
58
73
|
}
|
|
59
|
-
|
|
60
|
-
const set2 = new Set(tags);
|
|
61
|
-
const tag = getTag(child);
|
|
62
|
-
return tag !== void 0 && set2.has(tag);
|
|
74
|
+
return false;
|
|
63
75
|
}
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
76
|
+
function every(iterable, predicate) {
|
|
77
|
+
let index = 0;
|
|
78
|
+
for (const value of iterable) {
|
|
79
|
+
if (!predicate(value, index++)) {
|
|
80
|
+
return false;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
return true;
|
|
68
84
|
}
|
|
69
|
-
function
|
|
70
|
-
|
|
85
|
+
function* filter(iterable, predicate) {
|
|
86
|
+
let index = 0;
|
|
87
|
+
for (const value of iterable) {
|
|
88
|
+
if (predicate(value, index++)) {
|
|
89
|
+
yield value;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
71
92
|
}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
93
|
+
function* map(iterable, callback) {
|
|
94
|
+
let index = 0;
|
|
95
|
+
for (const value of iterable) {
|
|
96
|
+
yield callback(value, index++);
|
|
97
|
+
}
|
|
76
98
|
}
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
99
|
+
function forEach(iterable, callback) {
|
|
100
|
+
let index = 0;
|
|
101
|
+
for (const value of iterable) {
|
|
102
|
+
callback(value, index++);
|
|
103
|
+
}
|
|
81
104
|
}
|
|
105
|
+
function reduce(iterable, initial, callback) {
|
|
106
|
+
let accumulator = initial;
|
|
107
|
+
let index = 0;
|
|
108
|
+
for (const value of iterable) {
|
|
109
|
+
accumulator = callback(accumulator, value, index++);
|
|
110
|
+
}
|
|
111
|
+
return accumulator;
|
|
112
|
+
}
|
|
113
|
+
function collect(iterable, callback) {
|
|
114
|
+
const result = {};
|
|
115
|
+
let index = 0;
|
|
116
|
+
for (const value of iterable) {
|
|
117
|
+
const entry = callback(value, index++);
|
|
118
|
+
if (entry === null) {
|
|
119
|
+
return null;
|
|
120
|
+
}
|
|
121
|
+
result[entry[0]] = entry[1];
|
|
122
|
+
}
|
|
123
|
+
return result;
|
|
124
|
+
}
|
|
125
|
+
function findLast(value, callback) {
|
|
126
|
+
for (let index = value.length - 1; index >= 0; index--) {
|
|
127
|
+
const result = callback(value[index], index);
|
|
128
|
+
if (result != null) {
|
|
129
|
+
return result;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
return null;
|
|
133
|
+
}
|
|
134
|
+
function* items(collection) {
|
|
135
|
+
for (let i = 0; i < collection.length; i++) {
|
|
136
|
+
const item = collection.item(i);
|
|
137
|
+
if (item !== null) {
|
|
138
|
+
yield item;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
function nodeList(list) {
|
|
143
|
+
return {
|
|
144
|
+
*[Symbol.iterator]() {
|
|
145
|
+
for (let i = 0; i < list.length; i++) {
|
|
146
|
+
const node = list.item(i);
|
|
147
|
+
if (node !== null) {
|
|
148
|
+
yield node;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
function mapEntries(m) {
|
|
155
|
+
return m.entries();
|
|
156
|
+
}
|
|
157
|
+
function set(s) {
|
|
158
|
+
return s.values();
|
|
159
|
+
}
|
|
160
|
+
function hasOwn(object, key) {
|
|
161
|
+
return Object.hasOwn(object, key);
|
|
162
|
+
}
|
|
163
|
+
function* entries(object) {
|
|
164
|
+
for (const key in object) {
|
|
165
|
+
if (!hasOwn(object, key)) continue;
|
|
166
|
+
yield [key, object[key]];
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
function* keys(object) {
|
|
170
|
+
for (const [key] of entries(object)) {
|
|
171
|
+
yield key;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
function* values(object) {
|
|
175
|
+
for (const [, value] of entries(object)) {
|
|
176
|
+
yield value;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
function mapValues(object, callback) {
|
|
180
|
+
const result = {};
|
|
181
|
+
for (const [key, value] of entries(object)) {
|
|
182
|
+
result[key] = callback(value, key);
|
|
183
|
+
}
|
|
184
|
+
return result;
|
|
185
|
+
}
|
|
186
|
+
function forEachEntry(object, callback) {
|
|
187
|
+
for (const [key, value] of entries(object)) {
|
|
188
|
+
callback(key, value);
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
function forEachKey(object, callback) {
|
|
192
|
+
for (const key of keys(object)) {
|
|
193
|
+
callback(key);
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
function forEachValue(object, callback) {
|
|
197
|
+
for (const value of values(object)) {
|
|
198
|
+
callback(value);
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
function forEachSet(s, callback) {
|
|
202
|
+
for (const value of s) {
|
|
203
|
+
callback(value);
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
var iterate = Object.freeze({
|
|
207
|
+
entries,
|
|
208
|
+
filter,
|
|
209
|
+
find,
|
|
210
|
+
findLast,
|
|
211
|
+
forEach,
|
|
212
|
+
forEachEntry,
|
|
213
|
+
forEachKey,
|
|
214
|
+
forEachSet,
|
|
215
|
+
forEachValue,
|
|
216
|
+
items,
|
|
217
|
+
keys,
|
|
218
|
+
map,
|
|
219
|
+
mapEntries,
|
|
220
|
+
mapValues,
|
|
221
|
+
nodeList,
|
|
222
|
+
reduce,
|
|
223
|
+
collect,
|
|
224
|
+
set,
|
|
225
|
+
some,
|
|
226
|
+
every,
|
|
227
|
+
values
|
|
228
|
+
});
|
|
82
229
|
|
|
83
|
-
// ../../lib/primitive/src/
|
|
84
|
-
var
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
230
|
+
// ../../lib/primitive/src/utils/lru-cache.ts
|
|
231
|
+
var LRUCache = class {
|
|
232
|
+
#maxSize;
|
|
233
|
+
#store = /* @__PURE__ */ new Map();
|
|
234
|
+
constructor(maxSize) {
|
|
235
|
+
if (!Number.isInteger(maxSize) || maxSize < 1) {
|
|
236
|
+
throw new RangeError("LRUCache maxSize must be a positive integer.");
|
|
237
|
+
}
|
|
238
|
+
this.#maxSize = maxSize;
|
|
239
|
+
}
|
|
240
|
+
get(key) {
|
|
241
|
+
if (!this.#store.has(key)) return void 0;
|
|
242
|
+
const value = this.#store.get(key);
|
|
243
|
+
this.#store.delete(key);
|
|
244
|
+
this.#store.set(key, value);
|
|
245
|
+
return value;
|
|
246
|
+
}
|
|
247
|
+
set(key, value) {
|
|
248
|
+
this.#store.delete(key);
|
|
249
|
+
this.#store.set(key, value);
|
|
250
|
+
if (this.#store.size > this.#maxSize) {
|
|
251
|
+
const lru = this.#store.keys().next().value;
|
|
252
|
+
if (lru !== void 0) this.#store.delete(lru);
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
has(key) {
|
|
256
|
+
return this.#store.has(key);
|
|
257
|
+
}
|
|
258
|
+
delete(key) {
|
|
259
|
+
return this.#store.delete(key);
|
|
260
|
+
}
|
|
261
|
+
get size() {
|
|
262
|
+
return this.#store.size;
|
|
263
|
+
}
|
|
264
|
+
clear() {
|
|
265
|
+
this.#store.clear();
|
|
266
|
+
}
|
|
267
|
+
};
|
|
268
|
+
|
|
269
|
+
// ../../lib/primitive/src/utils/merge-props.ts
|
|
270
|
+
function mergeProps(defaultProps, props) {
|
|
271
|
+
return {
|
|
272
|
+
...defaultProps ?? {},
|
|
273
|
+
...props
|
|
274
|
+
};
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
// ../../lib/primitive/src/constants/aria/global-aria-attributes.ts
|
|
278
|
+
var GLOBAL_ARIA_ATTRIBUTES = /* @__PURE__ */ new Set([
|
|
279
|
+
"aria-atomic",
|
|
280
|
+
"aria-busy",
|
|
281
|
+
"aria-controls",
|
|
282
|
+
"aria-current",
|
|
283
|
+
"aria-describedby",
|
|
284
|
+
"aria-details",
|
|
285
|
+
"aria-disabled",
|
|
286
|
+
"aria-errormessage",
|
|
287
|
+
"aria-flowto",
|
|
288
|
+
"aria-hidden",
|
|
289
|
+
"aria-keyshortcuts",
|
|
290
|
+
"aria-label",
|
|
291
|
+
"aria-labelledby",
|
|
292
|
+
"aria-live",
|
|
293
|
+
"aria-owns",
|
|
294
|
+
"aria-relevant",
|
|
295
|
+
"aria-roledescription"
|
|
296
|
+
]);
|
|
297
|
+
|
|
298
|
+
// ../../lib/primitive/src/constants/aria/implicit-role-record.ts
|
|
299
|
+
var IMPLICIT_ROLE_RECORD = Object.freeze({
|
|
106
300
|
// Landmarks
|
|
107
301
|
article: "article",
|
|
108
302
|
aside: "complementary",
|
|
@@ -441,263 +635,69 @@ function isKnownAriaRole(value) {
|
|
|
441
635
|
return isString(value) && KNOWN_ARIA_ROLES_SET.has(value);
|
|
442
636
|
}
|
|
443
637
|
|
|
444
|
-
// ../../lib/
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
if (
|
|
450
|
-
|
|
638
|
+
// ../../lib/primitive/src/guards/children/component-id.ts
|
|
639
|
+
var COMPONENT_DEFAULT_TAG = /* @__PURE__ */ Symbol.for("praxis.component-default-tag");
|
|
640
|
+
|
|
641
|
+
// ../../lib/primitive/src/guards/children/is-tag.ts
|
|
642
|
+
function getAsProp(child) {
|
|
643
|
+
if (!isObject(child) || !("props" in child)) return void 0;
|
|
644
|
+
const props = child.props;
|
|
645
|
+
if (!isObject(props)) return void 0;
|
|
646
|
+
const as = props.as;
|
|
647
|
+
return isString(as) && as !== "" ? as : void 0;
|
|
648
|
+
}
|
|
649
|
+
function getTag(child) {
|
|
650
|
+
if (!isObject(child) || !("type" in child)) return void 0;
|
|
651
|
+
const t = child.type;
|
|
652
|
+
if (isString(t)) return t;
|
|
653
|
+
if (typeof t === "function" || isObject(t)) {
|
|
654
|
+
const defaultTag = t[COMPONENT_DEFAULT_TAG];
|
|
655
|
+
if (!isString(defaultTag)) return void 0;
|
|
656
|
+
return getAsProp(child) ?? defaultTag;
|
|
451
657
|
}
|
|
452
658
|
return void 0;
|
|
453
659
|
}
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
}
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
function isDynamicRule(rule) {
|
|
467
|
-
return isObject(rule, true) && rule[RULE_BRAND] === true;
|
|
660
|
+
function isTag(...args) {
|
|
661
|
+
if (isString(args[0])) {
|
|
662
|
+
const set3 = new Set(args);
|
|
663
|
+
return (child2) => {
|
|
664
|
+
const tag2 = getTag(child2);
|
|
665
|
+
return tag2 !== void 0 && set3.has(tag2);
|
|
666
|
+
};
|
|
667
|
+
}
|
|
668
|
+
const [child, ...tags] = args;
|
|
669
|
+
const set2 = new Set(tags);
|
|
670
|
+
const tag = getTag(child);
|
|
671
|
+
return tag !== void 0 && set2.has(tag);
|
|
468
672
|
}
|
|
469
673
|
|
|
470
|
-
// ../../lib/
|
|
471
|
-
function
|
|
472
|
-
|
|
674
|
+
// ../../lib/adapter-utils/src/invariant.ts
|
|
675
|
+
function panic(message) {
|
|
676
|
+
throw new Error(message);
|
|
473
677
|
}
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
function assertNever(value) {
|
|
477
|
-
throw new Error(`Unexpected value: ${String(value)}`);
|
|
678
|
+
function invariant(condition, message) {
|
|
679
|
+
if (!condition) panic(message);
|
|
478
680
|
}
|
|
479
681
|
|
|
480
|
-
// ../../lib/
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
return clsx(...inputs);
|
|
682
|
+
// ../../lib/adapter-utils/src/runtime/apply-display-name.ts
|
|
683
|
+
function applyDisplayName(component, name) {
|
|
684
|
+
Object.assign(component, { displayName: name ?? "PolymorphicComponent" });
|
|
484
685
|
}
|
|
485
686
|
|
|
486
|
-
// ../../lib/
|
|
487
|
-
function
|
|
488
|
-
|
|
489
|
-
const result = callback(value);
|
|
490
|
-
if (result != null) {
|
|
491
|
-
return result;
|
|
492
|
-
}
|
|
493
|
-
}
|
|
494
|
-
return null;
|
|
495
|
-
}
|
|
496
|
-
function some(iterable, predicate) {
|
|
497
|
-
for (const value of iterable) {
|
|
498
|
-
if (predicate(value)) return true;
|
|
499
|
-
}
|
|
500
|
-
return false;
|
|
501
|
-
}
|
|
502
|
-
function every(iterable, predicate) {
|
|
503
|
-
let index = 0;
|
|
504
|
-
for (const value of iterable) {
|
|
505
|
-
if (!predicate(value, index++)) {
|
|
506
|
-
return false;
|
|
507
|
-
}
|
|
508
|
-
}
|
|
509
|
-
return true;
|
|
510
|
-
}
|
|
511
|
-
function* filter(iterable, predicate) {
|
|
512
|
-
let index = 0;
|
|
513
|
-
for (const value of iterable) {
|
|
514
|
-
if (predicate(value, index++)) {
|
|
515
|
-
yield value;
|
|
516
|
-
}
|
|
517
|
-
}
|
|
518
|
-
}
|
|
519
|
-
function* map(iterable, callback) {
|
|
520
|
-
let index = 0;
|
|
521
|
-
for (const value of iterable) {
|
|
522
|
-
yield callback(value, index++);
|
|
523
|
-
}
|
|
524
|
-
}
|
|
525
|
-
function forEach(iterable, callback) {
|
|
526
|
-
let index = 0;
|
|
527
|
-
for (const value of iterable) {
|
|
528
|
-
callback(value, index++);
|
|
529
|
-
}
|
|
530
|
-
}
|
|
531
|
-
function reduce(iterable, initial, callback) {
|
|
532
|
-
let accumulator = initial;
|
|
533
|
-
let index = 0;
|
|
534
|
-
for (const value of iterable) {
|
|
535
|
-
accumulator = callback(accumulator, value, index++);
|
|
536
|
-
}
|
|
537
|
-
return accumulator;
|
|
538
|
-
}
|
|
539
|
-
function collect(iterable, callback) {
|
|
540
|
-
const result = {};
|
|
541
|
-
let index = 0;
|
|
542
|
-
for (const value of iterable) {
|
|
543
|
-
const entry = callback(value, index++);
|
|
544
|
-
if (entry === null) {
|
|
545
|
-
return null;
|
|
546
|
-
}
|
|
547
|
-
result[entry[0]] = entry[1];
|
|
548
|
-
}
|
|
549
|
-
return result;
|
|
550
|
-
}
|
|
551
|
-
function findLast(value, callback) {
|
|
552
|
-
for (let index = value.length - 1; index >= 0; index--) {
|
|
553
|
-
const result = callback(value[index], index);
|
|
554
|
-
if (result != null) {
|
|
555
|
-
return result;
|
|
556
|
-
}
|
|
557
|
-
}
|
|
558
|
-
return null;
|
|
559
|
-
}
|
|
560
|
-
function* items(collection) {
|
|
561
|
-
for (let i = 0; i < collection.length; i++) {
|
|
562
|
-
const item = collection.item(i);
|
|
563
|
-
if (item !== null) {
|
|
564
|
-
yield item;
|
|
565
|
-
}
|
|
566
|
-
}
|
|
567
|
-
}
|
|
568
|
-
function nodeList(list) {
|
|
569
|
-
return {
|
|
570
|
-
*[Symbol.iterator]() {
|
|
571
|
-
for (let i = 0; i < list.length; i++) {
|
|
572
|
-
const node = list.item(i);
|
|
573
|
-
if (node !== null) {
|
|
574
|
-
yield node;
|
|
575
|
-
}
|
|
576
|
-
}
|
|
577
|
-
}
|
|
578
|
-
};
|
|
579
|
-
}
|
|
580
|
-
function mapEntries(m) {
|
|
581
|
-
return m.entries();
|
|
582
|
-
}
|
|
583
|
-
function set(s) {
|
|
584
|
-
return s.values();
|
|
585
|
-
}
|
|
586
|
-
function hasOwn(object, key) {
|
|
587
|
-
return Object.hasOwn(object, key);
|
|
588
|
-
}
|
|
589
|
-
function* entries(object) {
|
|
590
|
-
for (const key in object) {
|
|
591
|
-
if (!hasOwn(object, key)) continue;
|
|
592
|
-
yield [key, object[key]];
|
|
593
|
-
}
|
|
594
|
-
}
|
|
595
|
-
function* keys(object) {
|
|
596
|
-
for (const [key] of entries(object)) {
|
|
597
|
-
yield key;
|
|
598
|
-
}
|
|
599
|
-
}
|
|
600
|
-
function* values(object) {
|
|
601
|
-
for (const [, value] of entries(object)) {
|
|
602
|
-
yield value;
|
|
603
|
-
}
|
|
604
|
-
}
|
|
605
|
-
function mapValues(object, callback) {
|
|
606
|
-
const result = {};
|
|
607
|
-
for (const [key, value] of entries(object)) {
|
|
608
|
-
result[key] = callback(value, key);
|
|
609
|
-
}
|
|
610
|
-
return result;
|
|
611
|
-
}
|
|
612
|
-
function forEachEntry(object, callback) {
|
|
613
|
-
for (const [key, value] of entries(object)) {
|
|
614
|
-
callback(key, value);
|
|
615
|
-
}
|
|
616
|
-
}
|
|
617
|
-
function forEachKey(object, callback) {
|
|
618
|
-
for (const key of keys(object)) {
|
|
619
|
-
callback(key);
|
|
620
|
-
}
|
|
621
|
-
}
|
|
622
|
-
function forEachValue(object, callback) {
|
|
623
|
-
for (const value of values(object)) {
|
|
624
|
-
callback(value);
|
|
625
|
-
}
|
|
626
|
-
}
|
|
627
|
-
function forEachSet(s, callback) {
|
|
628
|
-
for (const value of s) {
|
|
629
|
-
callback(value);
|
|
630
|
-
}
|
|
687
|
+
// ../../lib/adapter-utils/src/runtime/define-component.ts
|
|
688
|
+
function defineContractComponent(options) {
|
|
689
|
+
return (factory) => factory(options);
|
|
631
690
|
}
|
|
632
|
-
var iterate = Object.freeze({
|
|
633
|
-
entries,
|
|
634
|
-
filter,
|
|
635
|
-
find,
|
|
636
|
-
findLast,
|
|
637
|
-
forEach,
|
|
638
|
-
forEachEntry,
|
|
639
|
-
forEachKey,
|
|
640
|
-
forEachSet,
|
|
641
|
-
forEachValue,
|
|
642
|
-
items,
|
|
643
|
-
keys,
|
|
644
|
-
map,
|
|
645
|
-
mapEntries,
|
|
646
|
-
mapValues,
|
|
647
|
-
nodeList,
|
|
648
|
-
reduce,
|
|
649
|
-
collect,
|
|
650
|
-
set,
|
|
651
|
-
some,
|
|
652
|
-
every,
|
|
653
|
-
values
|
|
654
|
-
});
|
|
655
691
|
|
|
656
|
-
// ../../lib/
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
}
|
|
664
|
-
this.#maxSize = maxSize;
|
|
665
|
-
}
|
|
666
|
-
get(key) {
|
|
667
|
-
if (!this.#store.has(key)) return void 0;
|
|
668
|
-
const value = this.#store.get(key);
|
|
669
|
-
this.#store.delete(key);
|
|
670
|
-
this.#store.set(key, value);
|
|
671
|
-
return value;
|
|
672
|
-
}
|
|
673
|
-
set(key, value) {
|
|
674
|
-
this.#store.delete(key);
|
|
675
|
-
this.#store.set(key, value);
|
|
676
|
-
if (this.#store.size > this.#maxSize) {
|
|
677
|
-
const lru = this.#store.keys().next().value;
|
|
678
|
-
if (lru !== void 0) this.#store.delete(lru);
|
|
679
|
-
}
|
|
680
|
-
}
|
|
681
|
-
has(key) {
|
|
682
|
-
return this.#store.has(key);
|
|
683
|
-
}
|
|
684
|
-
delete(key) {
|
|
685
|
-
return this.#store.delete(key);
|
|
686
|
-
}
|
|
687
|
-
get size() {
|
|
688
|
-
return this.#store.size;
|
|
689
|
-
}
|
|
690
|
-
clear() {
|
|
691
|
-
this.#store.clear();
|
|
692
|
+
// ../../lib/contract/src/aria/aria-role-policy.ts
|
|
693
|
+
function getImplicitRole(tag, props) {
|
|
694
|
+
if (tag in IMPLICIT_ROLE_RECORD) return IMPLICIT_ROLE_RECORD[tag];
|
|
695
|
+
if (tag === "input") return getInputImplicitRole(props?.type);
|
|
696
|
+
if (tag === "img") return props?.alt === "" ? "none" : "img";
|
|
697
|
+
if (tag === "section" || tag === "form") {
|
|
698
|
+
return getConditionalImplicitRole(tag, props?.["aria-label"], props?.["aria-labelledby"]);
|
|
692
699
|
}
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
// ../../lib/primitive/src/utils/merge-props.ts
|
|
696
|
-
function mergeProps(defaultProps, props) {
|
|
697
|
-
return {
|
|
698
|
-
...defaultProps ?? {},
|
|
699
|
-
...props
|
|
700
|
-
};
|
|
700
|
+
return void 0;
|
|
701
701
|
}
|
|
702
702
|
|
|
703
703
|
// ../../lib/contract/src/diagnostics/aria.ts
|
|
@@ -2515,7 +2515,10 @@ function resolveFactoryOptions(options = {}) {
|
|
|
2515
2515
|
const variantKeys = styling?.variants === void 0 ? EMPTY_VARIANT_KEYS : new Set(Object.keys(styling.variants));
|
|
2516
2516
|
return Object.freeze({
|
|
2517
2517
|
defaultTag: options.tag ?? "div",
|
|
2518
|
-
diagnostics: resolveDiagnostics(
|
|
2518
|
+
diagnostics: resolveDiagnostics(
|
|
2519
|
+
enforcement?.diagnostics,
|
|
2520
|
+
options.diagnostics ?? silentDiagnostics
|
|
2521
|
+
),
|
|
2519
2522
|
variantKeys,
|
|
2520
2523
|
...whenDefined("displayName", options.name),
|
|
2521
2524
|
...whenDefined("defaultProps", options.defaults),
|
package/dist/web/index.d.ts
CHANGED
|
@@ -269,6 +269,11 @@ type FactoryOptions<TDefault extends ElementType = ElementType, Props extends An
|
|
|
269
269
|
readonly normalize?: NormalizeFn<NoInfer<Props>>;
|
|
270
270
|
readonly styling?: StylingOptions<V, TPreset, TPlugin>;
|
|
271
271
|
readonly enforcement?: EnforcementOptions<TAllowed>;
|
|
272
|
+
/**
|
|
273
|
+
* Adapter-resolved diagnostics default, spread in by `resolveAdapterCommonOptions`. Not meant to
|
|
274
|
+
* be set directly by component authors — use `enforcement.diagnostics` to override per component.
|
|
275
|
+
*/
|
|
276
|
+
readonly diagnostics?: Diagnostics;
|
|
272
277
|
};
|
|
273
278
|
|
|
274
279
|
type FilterPredicate = (key: string, variantKeys: ReadonlySet<string>) => boolean;
|