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/web/index.js CHANGED
@@ -3,6 +3,16 @@ function defineContractComponent(options) {
3
3
  return (factory) => factory(options);
4
4
  }
5
5
 
6
+ // ../../lib/primitive/src/tag/resolve-tag.ts
7
+ function makeResolveTag(defaultTag) {
8
+ return function tag(as) {
9
+ return as ?? defaultTag;
10
+ };
11
+ }
12
+
13
+ // ../../lib/primitive/src/rule/rule-brand.ts
14
+ var RULE_BRAND = /* @__PURE__ */ Symbol("praxis-kit/dynamic-rule");
15
+
6
16
  // ../../lib/primitive/src/guards/foundational/is-defined.ts
7
17
  function isUndefined(value) {
8
18
  return value === void 0;
@@ -28,6 +38,244 @@ function isNumber(value) {
28
38
  return typeof value === "number";
29
39
  }
30
40
 
41
+ // ../../lib/primitive/src/rule/is-dynamic-rule.ts
42
+ function isDynamicRule(rule) {
43
+ return isObject(rule, true) && rule[RULE_BRAND] === true;
44
+ }
45
+
46
+ // ../../lib/primitive/src/rule/resolve-rule.ts
47
+ function resolveRule(rule, context) {
48
+ return isDynamicRule(rule) ? rule.resolve(context) : rule;
49
+ }
50
+
51
+ // ../../lib/primitive/src/utils/assert-never.ts
52
+ function assertNever(value) {
53
+ throw new Error(`Unexpected value: ${String(value)}`);
54
+ }
55
+
56
+ // ../../lib/primitive/src/utils/cn.ts
57
+ import { clsx } from "clsx";
58
+ function cn(...inputs) {
59
+ return clsx(...inputs);
60
+ }
61
+
62
+ // ../../lib/primitive/src/utils/iterate.ts
63
+ function find(iterable, callback) {
64
+ for (const value of iterable) {
65
+ const result = callback(value);
66
+ if (result != null) {
67
+ return result;
68
+ }
69
+ }
70
+ return null;
71
+ }
72
+ function some(iterable, predicate) {
73
+ for (const value of iterable) {
74
+ if (predicate(value)) return true;
75
+ }
76
+ return false;
77
+ }
78
+ function every(iterable, predicate) {
79
+ let index = 0;
80
+ for (const value of iterable) {
81
+ if (!predicate(value, index++)) {
82
+ return false;
83
+ }
84
+ }
85
+ return true;
86
+ }
87
+ function* filter(iterable, predicate) {
88
+ let index = 0;
89
+ for (const value of iterable) {
90
+ if (predicate(value, index++)) {
91
+ yield value;
92
+ }
93
+ }
94
+ }
95
+ function* map(iterable, callback) {
96
+ let index = 0;
97
+ for (const value of iterable) {
98
+ yield callback(value, index++);
99
+ }
100
+ }
101
+ function forEach(iterable, callback) {
102
+ let index = 0;
103
+ for (const value of iterable) {
104
+ callback(value, index++);
105
+ }
106
+ }
107
+ function reduce(iterable, initial, callback) {
108
+ let accumulator = initial;
109
+ let index = 0;
110
+ for (const value of iterable) {
111
+ accumulator = callback(accumulator, value, index++);
112
+ }
113
+ return accumulator;
114
+ }
115
+ function collect(iterable, callback) {
116
+ const result = {};
117
+ let index = 0;
118
+ for (const value of iterable) {
119
+ const entry = callback(value, index++);
120
+ if (entry === null) {
121
+ return null;
122
+ }
123
+ result[entry[0]] = entry[1];
124
+ }
125
+ return result;
126
+ }
127
+ function findLast(value, callback) {
128
+ for (let index = value.length - 1; index >= 0; index--) {
129
+ const result = callback(value[index], index);
130
+ if (result != null) {
131
+ return result;
132
+ }
133
+ }
134
+ return null;
135
+ }
136
+ function* items(collection) {
137
+ for (let i = 0; i < collection.length; i++) {
138
+ const item = collection.item(i);
139
+ if (item !== null) {
140
+ yield item;
141
+ }
142
+ }
143
+ }
144
+ function nodeList(list) {
145
+ return {
146
+ *[Symbol.iterator]() {
147
+ for (let i = 0; i < list.length; i++) {
148
+ const node = list.item(i);
149
+ if (node !== null) {
150
+ yield node;
151
+ }
152
+ }
153
+ }
154
+ };
155
+ }
156
+ function mapEntries(m) {
157
+ return m.entries();
158
+ }
159
+ function set(s) {
160
+ return s.values();
161
+ }
162
+ function hasOwn(object, key) {
163
+ return Object.hasOwn(object, key);
164
+ }
165
+ function* entries(object) {
166
+ for (const key in object) {
167
+ if (!hasOwn(object, key)) continue;
168
+ yield [key, object[key]];
169
+ }
170
+ }
171
+ function* keys(object) {
172
+ for (const [key] of entries(object)) {
173
+ yield key;
174
+ }
175
+ }
176
+ function* values(object) {
177
+ for (const [, value] of entries(object)) {
178
+ yield value;
179
+ }
180
+ }
181
+ function mapValues(object, callback) {
182
+ const result = {};
183
+ for (const [key, value] of entries(object)) {
184
+ result[key] = callback(value, key);
185
+ }
186
+ return result;
187
+ }
188
+ function forEachEntry(object, callback) {
189
+ for (const [key, value] of entries(object)) {
190
+ callback(key, value);
191
+ }
192
+ }
193
+ function forEachKey(object, callback) {
194
+ for (const key of keys(object)) {
195
+ callback(key);
196
+ }
197
+ }
198
+ function forEachValue(object, callback) {
199
+ for (const value of values(object)) {
200
+ callback(value);
201
+ }
202
+ }
203
+ function forEachSet(s, callback) {
204
+ for (const value of s) {
205
+ callback(value);
206
+ }
207
+ }
208
+ var iterate = Object.freeze({
209
+ entries,
210
+ filter,
211
+ find,
212
+ findLast,
213
+ forEach,
214
+ forEachEntry,
215
+ forEachKey,
216
+ forEachSet,
217
+ forEachValue,
218
+ items,
219
+ keys,
220
+ map,
221
+ mapEntries,
222
+ mapValues,
223
+ nodeList,
224
+ reduce,
225
+ collect,
226
+ set,
227
+ some,
228
+ every,
229
+ values
230
+ });
231
+
232
+ // ../../lib/primitive/src/utils/lru-cache.ts
233
+ var LRUCache = class {
234
+ #maxSize;
235
+ #store = /* @__PURE__ */ new Map();
236
+ constructor(maxSize) {
237
+ if (!Number.isInteger(maxSize) || maxSize < 1) {
238
+ throw new RangeError("LRUCache maxSize must be a positive integer.");
239
+ }
240
+ this.#maxSize = maxSize;
241
+ }
242
+ get(key) {
243
+ if (!this.#store.has(key)) return void 0;
244
+ const value = this.#store.get(key);
245
+ this.#store.delete(key);
246
+ this.#store.set(key, value);
247
+ return value;
248
+ }
249
+ set(key, value) {
250
+ this.#store.delete(key);
251
+ this.#store.set(key, value);
252
+ if (this.#store.size > this.#maxSize) {
253
+ const lru = this.#store.keys().next().value;
254
+ if (lru !== void 0) this.#store.delete(lru);
255
+ }
256
+ }
257
+ has(key) {
258
+ return this.#store.has(key);
259
+ }
260
+ delete(key) {
261
+ return this.#store.delete(key);
262
+ }
263
+ get size() {
264
+ return this.#store.size;
265
+ }
266
+ clear() {
267
+ this.#store.clear();
268
+ }
269
+ };
270
+
271
+ // ../../lib/primitive/src/utils/merge-props.ts
272
+ function mergeProps(defaultProps, props) {
273
+ return {
274
+ ...defaultProps ?? {},
275
+ ...props
276
+ };
277
+ }
278
+
31
279
  // ../../lib/primitive/src/constants/aria/global-aria-attributes.ts
32
280
  var GLOBAL_ARIA_ATTRIBUTES = /* @__PURE__ */ new Set([
33
281
  "aria-atomic",
@@ -298,265 +546,6 @@ function getConditionalImplicitRole(tag, ariaLabel, ariaLabelledBy) {
298
546
  return void 0;
299
547
  }
300
548
 
301
- // ../../lib/contract/src/aria/aria-role-policy.ts
302
- function getImplicitRole(tag, props) {
303
- if (tag in IMPLICIT_ROLE_RECORD) return IMPLICIT_ROLE_RECORD[tag];
304
- if (tag === "input") return getInputImplicitRole(props?.type);
305
- if (tag === "img") return props?.alt === "" ? "none" : "img";
306
- if (tag === "section" || tag === "form") {
307
- return getConditionalImplicitRole(tag, props?.["aria-label"], props?.["aria-labelledby"]);
308
- }
309
- return void 0;
310
- }
311
-
312
- // ../../lib/primitive/src/tag/resolve-tag.ts
313
- function makeResolveTag(defaultTag) {
314
- return function tag(as) {
315
- return as ?? defaultTag;
316
- };
317
- }
318
-
319
- // ../../lib/primitive/src/rule/rule-brand.ts
320
- var RULE_BRAND = /* @__PURE__ */ Symbol("praxis-kit/dynamic-rule");
321
-
322
- // ../../lib/primitive/src/rule/is-dynamic-rule.ts
323
- function isDynamicRule(rule) {
324
- return isObject(rule, true) && rule[RULE_BRAND] === true;
325
- }
326
-
327
- // ../../lib/primitive/src/rule/resolve-rule.ts
328
- function resolveRule(rule, context) {
329
- return isDynamicRule(rule) ? rule.resolve(context) : rule;
330
- }
331
-
332
- // ../../lib/primitive/src/utils/assert-never.ts
333
- function assertNever(value) {
334
- throw new Error(`Unexpected value: ${String(value)}`);
335
- }
336
-
337
- // ../../lib/primitive/src/utils/cn.ts
338
- import { clsx } from "clsx";
339
- function cn(...inputs) {
340
- return clsx(...inputs);
341
- }
342
-
343
- // ../../lib/primitive/src/utils/iterate.ts
344
- function find(iterable, callback) {
345
- for (const value of iterable) {
346
- const result = callback(value);
347
- if (result != null) {
348
- return result;
349
- }
350
- }
351
- return null;
352
- }
353
- function some(iterable, predicate) {
354
- for (const value of iterable) {
355
- if (predicate(value)) return true;
356
- }
357
- return false;
358
- }
359
- function every(iterable, predicate) {
360
- let index = 0;
361
- for (const value of iterable) {
362
- if (!predicate(value, index++)) {
363
- return false;
364
- }
365
- }
366
- return true;
367
- }
368
- function* filter(iterable, predicate) {
369
- let index = 0;
370
- for (const value of iterable) {
371
- if (predicate(value, index++)) {
372
- yield value;
373
- }
374
- }
375
- }
376
- function* map(iterable, callback) {
377
- let index = 0;
378
- for (const value of iterable) {
379
- yield callback(value, index++);
380
- }
381
- }
382
- function forEach(iterable, callback) {
383
- let index = 0;
384
- for (const value of iterable) {
385
- callback(value, index++);
386
- }
387
- }
388
- function reduce(iterable, initial, callback) {
389
- let accumulator = initial;
390
- let index = 0;
391
- for (const value of iterable) {
392
- accumulator = callback(accumulator, value, index++);
393
- }
394
- return accumulator;
395
- }
396
- function collect(iterable, callback) {
397
- const result = {};
398
- let index = 0;
399
- for (const value of iterable) {
400
- const entry = callback(value, index++);
401
- if (entry === null) {
402
- return null;
403
- }
404
- result[entry[0]] = entry[1];
405
- }
406
- return result;
407
- }
408
- function findLast(value, callback) {
409
- for (let index = value.length - 1; index >= 0; index--) {
410
- const result = callback(value[index], index);
411
- if (result != null) {
412
- return result;
413
- }
414
- }
415
- return null;
416
- }
417
- function* items(collection) {
418
- for (let i = 0; i < collection.length; i++) {
419
- const item = collection.item(i);
420
- if (item !== null) {
421
- yield item;
422
- }
423
- }
424
- }
425
- function nodeList(list) {
426
- return {
427
- *[Symbol.iterator]() {
428
- for (let i = 0; i < list.length; i++) {
429
- const node = list.item(i);
430
- if (node !== null) {
431
- yield node;
432
- }
433
- }
434
- }
435
- };
436
- }
437
- function mapEntries(m) {
438
- return m.entries();
439
- }
440
- function set(s) {
441
- return s.values();
442
- }
443
- function hasOwn(object, key) {
444
- return Object.hasOwn(object, key);
445
- }
446
- function* entries(object) {
447
- for (const key in object) {
448
- if (!hasOwn(object, key)) continue;
449
- yield [key, object[key]];
450
- }
451
- }
452
- function* keys(object) {
453
- for (const [key] of entries(object)) {
454
- yield key;
455
- }
456
- }
457
- function* values(object) {
458
- for (const [, value] of entries(object)) {
459
- yield value;
460
- }
461
- }
462
- function mapValues(object, callback) {
463
- const result = {};
464
- for (const [key, value] of entries(object)) {
465
- result[key] = callback(value, key);
466
- }
467
- return result;
468
- }
469
- function forEachEntry(object, callback) {
470
- for (const [key, value] of entries(object)) {
471
- callback(key, value);
472
- }
473
- }
474
- function forEachKey(object, callback) {
475
- for (const key of keys(object)) {
476
- callback(key);
477
- }
478
- }
479
- function forEachValue(object, callback) {
480
- for (const value of values(object)) {
481
- callback(value);
482
- }
483
- }
484
- function forEachSet(s, callback) {
485
- for (const value of s) {
486
- callback(value);
487
- }
488
- }
489
- var iterate = Object.freeze({
490
- entries,
491
- filter,
492
- find,
493
- findLast,
494
- forEach,
495
- forEachEntry,
496
- forEachKey,
497
- forEachSet,
498
- forEachValue,
499
- items,
500
- keys,
501
- map,
502
- mapEntries,
503
- mapValues,
504
- nodeList,
505
- reduce,
506
- collect,
507
- set,
508
- some,
509
- every,
510
- values
511
- });
512
-
513
- // ../../lib/primitive/src/utils/lru-cache.ts
514
- var LRUCache = class {
515
- #maxSize;
516
- #store = /* @__PURE__ */ new Map();
517
- constructor(maxSize) {
518
- if (!Number.isInteger(maxSize) || maxSize < 1) {
519
- throw new RangeError("LRUCache maxSize must be a positive integer.");
520
- }
521
- this.#maxSize = maxSize;
522
- }
523
- get(key) {
524
- if (!this.#store.has(key)) return void 0;
525
- const value = this.#store.get(key);
526
- this.#store.delete(key);
527
- this.#store.set(key, value);
528
- return value;
529
- }
530
- set(key, value) {
531
- this.#store.delete(key);
532
- this.#store.set(key, value);
533
- if (this.#store.size > this.#maxSize) {
534
- const lru = this.#store.keys().next().value;
535
- if (lru !== void 0) this.#store.delete(lru);
536
- }
537
- }
538
- has(key) {
539
- return this.#store.has(key);
540
- }
541
- delete(key) {
542
- return this.#store.delete(key);
543
- }
544
- get size() {
545
- return this.#store.size;
546
- }
547
- clear() {
548
- this.#store.clear();
549
- }
550
- };
551
-
552
- // ../../lib/primitive/src/utils/merge-props.ts
553
- function mergeProps(defaultProps, props) {
554
- return {
555
- ...defaultProps ?? {},
556
- ...props
557
- };
558
- }
559
-
560
549
  // ../../lib/primitive/src/guards/children/component-id.ts
561
550
  var COMPONENT_DEFAULT_TAG = /* @__PURE__ */ Symbol.for("praxis.component-default-tag");
562
551
 
@@ -593,6 +582,17 @@ function isTag(...args) {
593
582
  return tag !== void 0 && set2.has(tag);
594
583
  }
595
584
 
585
+ // ../../lib/contract/src/aria/aria-role-policy.ts
586
+ function getImplicitRole(tag, props) {
587
+ if (tag in IMPLICIT_ROLE_RECORD) return IMPLICIT_ROLE_RECORD[tag];
588
+ if (tag === "input") return getInputImplicitRole(props?.type);
589
+ if (tag === "img") return props?.alt === "" ? "none" : "img";
590
+ if (tag === "section" || tag === "form") {
591
+ return getConditionalImplicitRole(tag, props?.["aria-label"], props?.["aria-labelledby"]);
592
+ }
593
+ return void 0;
594
+ }
595
+
596
596
  // ../../lib/contract/src/diagnostics/aria.ts
597
597
  import { DiagnosticCategory, DiagnosticCode } from "../_shared/diagnostics.js";
598
598
  var AriaDiagnostics = {
@@ -2362,7 +2362,10 @@ function resolveFactoryOptions(options = {}) {
2362
2362
  const variantKeys = styling?.variants === void 0 ? EMPTY_VARIANT_KEYS : new Set(Object.keys(styling.variants));
2363
2363
  return Object.freeze({
2364
2364
  defaultTag: options.tag ?? "div",
2365
- diagnostics: resolveDiagnostics(enforcement?.diagnostics, silentDiagnostics),
2365
+ diagnostics: resolveDiagnostics(
2366
+ enforcement?.diagnostics,
2367
+ options.diagnostics ?? silentDiagnostics
2368
+ ),
2366
2369
  variantKeys,
2367
2370
  ...whenDefined("displayName", options.name),
2368
2371
  ...whenDefined("defaultProps", options.defaults),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "praxis-kit",
3
- "version": "6.1.1",
3
+ "version": "6.2.0",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  "./react": {
@@ -191,9 +191,9 @@
191
191
  "vue": "^3.5.38",
192
192
  "@praxis-kit/adapter-utils": "0.0.0",
193
193
  "@praxis-kit/core": "0.0.0",
194
+ "@praxis-kit/diagnostics": "0.0.0",
194
195
  "@praxis-kit/pipeline": "0.0.0",
195
196
  "@praxis-kit/primitive": "0.0.0",
196
- "@praxis-kit/diagnostics": "0.0.0",
197
197
  "@praxis-kit/vite-plugin": "0.0.0"
198
198
  },
199
199
  "publishConfig": {