praxis-kit 6.0.0 → 6.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-P5ZJBPAR.js → chunk-VUULGK5M.js} +80 -52
- package/dist/lit/index.js +66 -50
- package/dist/preact/index.js +66 -50
- package/dist/react/index.js +1 -1
- package/dist/react/legacy.js +1 -1
- package/dist/solid/index.js +66 -50
- package/dist/svelte/index.js +66 -50
- package/dist/tailwind/index.js +43 -20
- package/dist/vite-plugin/index.js +14 -2
- package/dist/vue/index.js +66 -50
- package/dist/web/index.js +66 -50
- package/package.json +4 -4
|
@@ -614,6 +614,58 @@ var iterate = Object.freeze({
|
|
|
614
614
|
values
|
|
615
615
|
});
|
|
616
616
|
|
|
617
|
+
// ../../lib/primitive/src/utils/lazy.ts
|
|
618
|
+
function lazy(factory) {
|
|
619
|
+
let initialized = false;
|
|
620
|
+
let value;
|
|
621
|
+
return () => {
|
|
622
|
+
if (!initialized) {
|
|
623
|
+
value = factory();
|
|
624
|
+
initialized = true;
|
|
625
|
+
}
|
|
626
|
+
return value;
|
|
627
|
+
};
|
|
628
|
+
}
|
|
629
|
+
|
|
630
|
+
// ../../lib/primitive/src/utils/lru-cache.ts
|
|
631
|
+
var LRUCache = class {
|
|
632
|
+
#maxSize;
|
|
633
|
+
#store = /* @__PURE__ */ new Map();
|
|
634
|
+
constructor(maxSize) {
|
|
635
|
+
if (!Number.isInteger(maxSize) || maxSize < 1) {
|
|
636
|
+
throw new RangeError("LRUCache maxSize must be a positive integer.");
|
|
637
|
+
}
|
|
638
|
+
this.#maxSize = maxSize;
|
|
639
|
+
}
|
|
640
|
+
get(key) {
|
|
641
|
+
if (!this.#store.has(key)) return void 0;
|
|
642
|
+
const value = this.#store.get(key);
|
|
643
|
+
this.#store.delete(key);
|
|
644
|
+
this.#store.set(key, value);
|
|
645
|
+
return value;
|
|
646
|
+
}
|
|
647
|
+
set(key, value) {
|
|
648
|
+
this.#store.delete(key);
|
|
649
|
+
this.#store.set(key, value);
|
|
650
|
+
if (this.#store.size > this.#maxSize) {
|
|
651
|
+
const lru = this.#store.keys().next().value;
|
|
652
|
+
if (lru !== void 0) this.#store.delete(lru);
|
|
653
|
+
}
|
|
654
|
+
}
|
|
655
|
+
has(key) {
|
|
656
|
+
return this.#store.has(key);
|
|
657
|
+
}
|
|
658
|
+
delete(key) {
|
|
659
|
+
return this.#store.delete(key);
|
|
660
|
+
}
|
|
661
|
+
get size() {
|
|
662
|
+
return this.#store.size;
|
|
663
|
+
}
|
|
664
|
+
clear() {
|
|
665
|
+
this.#store.clear();
|
|
666
|
+
}
|
|
667
|
+
};
|
|
668
|
+
|
|
617
669
|
// ../../lib/primitive/src/utils/merge-refs.ts
|
|
618
670
|
function mergeRefsCore(...refs) {
|
|
619
671
|
const active = refs.filter((r) => r != null);
|
|
@@ -675,28 +727,6 @@ function isTag(...args) {
|
|
|
675
727
|
return tag !== void 0 && set2.has(tag);
|
|
676
728
|
}
|
|
677
729
|
|
|
678
|
-
// ../../lib/contract/src/strict/invariant-base.ts
|
|
679
|
-
var InvariantBase = class {
|
|
680
|
-
diagnostics;
|
|
681
|
-
constructor(diagnostics) {
|
|
682
|
-
this.diagnostics = diagnostics;
|
|
683
|
-
}
|
|
684
|
-
get active() {
|
|
685
|
-
return this.diagnostics.active;
|
|
686
|
-
}
|
|
687
|
-
violate(input) {
|
|
688
|
-
this.diagnostics.error(input);
|
|
689
|
-
}
|
|
690
|
-
// Always caps at warn — never throws. ARIA 'warning' violations route here
|
|
691
|
-
// so they surface even in strict='throw' mode without aborting a render.
|
|
692
|
-
warn(input) {
|
|
693
|
-
this.diagnostics.warn(input);
|
|
694
|
-
}
|
|
695
|
-
invariant(condition, input) {
|
|
696
|
-
if (!condition) this.violate(input);
|
|
697
|
-
}
|
|
698
|
-
};
|
|
699
|
-
|
|
700
730
|
// ../../lib/contract/src/diagnostics/aria.ts
|
|
701
731
|
import { DiagnosticCategory, DiagnosticCode } from "./_shared/diagnostics.js";
|
|
702
732
|
var AriaDiagnostics = {
|
|
@@ -1053,6 +1083,28 @@ var SlotDiagnostics = {
|
|
|
1053
1083
|
}
|
|
1054
1084
|
};
|
|
1055
1085
|
|
|
1086
|
+
// ../../lib/contract/src/strict/invariant-base.ts
|
|
1087
|
+
var InvariantBase = class {
|
|
1088
|
+
diagnostics;
|
|
1089
|
+
constructor(diagnostics) {
|
|
1090
|
+
this.diagnostics = diagnostics;
|
|
1091
|
+
}
|
|
1092
|
+
get active() {
|
|
1093
|
+
return this.diagnostics.active;
|
|
1094
|
+
}
|
|
1095
|
+
violate(input) {
|
|
1096
|
+
this.diagnostics.error(input);
|
|
1097
|
+
}
|
|
1098
|
+
// Always caps at warn — never throws. ARIA 'warning' violations route here
|
|
1099
|
+
// so they surface even in strict='throw' mode without aborting a render.
|
|
1100
|
+
warn(input) {
|
|
1101
|
+
this.diagnostics.warn(input);
|
|
1102
|
+
}
|
|
1103
|
+
invariant(condition, input) {
|
|
1104
|
+
if (!condition) this.violate(input);
|
|
1105
|
+
}
|
|
1106
|
+
};
|
|
1107
|
+
|
|
1056
1108
|
// ../../lib/contract/src/aria/polymorphic-validator.ts
|
|
1057
1109
|
var VALID = [{ valid: true }];
|
|
1058
1110
|
function isIntrinsicTag(tag) {
|
|
@@ -1064,8 +1116,7 @@ function omitProp(obj, key) {
|
|
|
1064
1116
|
}
|
|
1065
1117
|
var AriaPolicyEngine = class _AriaPolicyEngine extends InvariantBase {
|
|
1066
1118
|
#extraRules;
|
|
1067
|
-
#planCache =
|
|
1068
|
-
static #MAX_CACHE = 100;
|
|
1119
|
+
#planCache = new LRUCache(100);
|
|
1069
1120
|
// Memoized AriaFix objects keyed by attribute name — the ARIA attribute set is
|
|
1070
1121
|
// finite so this Map is bounded and avoids recreating closures on every cache miss.
|
|
1071
1122
|
static #removeAttributeFixCache = /* @__PURE__ */ new Map();
|
|
@@ -1221,8 +1272,6 @@ var AriaPolicyEngine = class _AriaPolicyEngine extends InvariantBase {
|
|
|
1221
1272
|
if (!isNull(key)) {
|
|
1222
1273
|
const cached = this.#planCache.get(key);
|
|
1223
1274
|
if (cached !== void 0) {
|
|
1224
|
-
this.#planCache.delete(key);
|
|
1225
|
-
this.#planCache.set(key, cached);
|
|
1226
1275
|
if (cached.violations.length > 0) this.report(cached.violations);
|
|
1227
1276
|
return {
|
|
1228
1277
|
props: _AriaPolicyEngine.#applyPlan(props, cached.removals, cached.updates),
|
|
@@ -1239,10 +1288,6 @@ var AriaPolicyEngine = class _AriaPolicyEngine extends InvariantBase {
|
|
|
1239
1288
|
);
|
|
1240
1289
|
const plan = { removals, updates, violations: result.violations };
|
|
1241
1290
|
this.#planCache.set(key, plan);
|
|
1242
|
-
if (this.#planCache.size > _AriaPolicyEngine.#MAX_CACHE) {
|
|
1243
|
-
const lru = this.#planCache.keys().next().value;
|
|
1244
|
-
if (lru !== void 0) this.#planCache.delete(lru);
|
|
1245
|
-
}
|
|
1246
1291
|
}
|
|
1247
1292
|
return result;
|
|
1248
1293
|
}
|
|
@@ -2317,7 +2362,7 @@ function cva2(base, config) {
|
|
|
2317
2362
|
// ../../lib/styling/src/static-class-resolver.ts
|
|
2318
2363
|
var StaticClassResolver = class {
|
|
2319
2364
|
#baseClass;
|
|
2320
|
-
#cache =
|
|
2365
|
+
#cache = new LRUCache(200);
|
|
2321
2366
|
#resolveTag;
|
|
2322
2367
|
constructor(baseClass, tagMap) {
|
|
2323
2368
|
this.#baseClass = Array.isArray(baseClass) ? baseClass.join(" ") : baseClass;
|
|
@@ -2331,17 +2376,9 @@ var StaticClassResolver = class {
|
|
|
2331
2376
|
resolve(tag, skipTagMap = false) {
|
|
2332
2377
|
if (typeof tag !== "string" || skipTagMap) return this.#baseClass;
|
|
2333
2378
|
const cached = this.#cache.get(tag);
|
|
2334
|
-
if (cached !== void 0)
|
|
2335
|
-
this.#cache.delete(tag);
|
|
2336
|
-
this.#cache.set(tag, cached);
|
|
2337
|
-
return cached;
|
|
2338
|
-
}
|
|
2379
|
+
if (cached !== void 0) return cached;
|
|
2339
2380
|
const result = this.#resolveTag(tag);
|
|
2340
2381
|
this.#cache.set(tag, result);
|
|
2341
|
-
if (this.#cache.size > 200) {
|
|
2342
|
-
const lru = this.#cache.keys().next().value;
|
|
2343
|
-
if (lru !== void 0) this.#cache.delete(lru);
|
|
2344
|
-
}
|
|
2345
2382
|
return result;
|
|
2346
2383
|
}
|
|
2347
2384
|
};
|
|
@@ -2352,7 +2389,7 @@ var VariantClassResolver = class _VariantClassResolver {
|
|
|
2352
2389
|
#recipeMap;
|
|
2353
2390
|
#variantKeys;
|
|
2354
2391
|
#precomputedClasses;
|
|
2355
|
-
#cache =
|
|
2392
|
+
#cache = new LRUCache(1e3);
|
|
2356
2393
|
constructor(cvaFn, recipeMap, variantKeys, precomputedClasses) {
|
|
2357
2394
|
this.#cvaFn = cvaFn ?? null;
|
|
2358
2395
|
this.#recipeMap = Object.freeze(recipeMap ?? {});
|
|
@@ -2367,17 +2404,9 @@ var VariantClassResolver = class _VariantClassResolver {
|
|
|
2367
2404
|
if (precomputed !== void 0) return precomputed;
|
|
2368
2405
|
}
|
|
2369
2406
|
const cached = this.#cache.get(cacheKey);
|
|
2370
|
-
if (cached !== void 0)
|
|
2371
|
-
this.#cache.delete(cacheKey);
|
|
2372
|
-
this.#cache.set(cacheKey, cached);
|
|
2373
|
-
return cached;
|
|
2374
|
-
}
|
|
2407
|
+
if (cached !== void 0) return cached;
|
|
2375
2408
|
const result = this.#compute(props, recipe);
|
|
2376
2409
|
this.#cache.set(cacheKey, result);
|
|
2377
|
-
if (this.#cache.size > 1e3) {
|
|
2378
|
-
const lru = this.#cache.keys().next().value;
|
|
2379
|
-
if (lru !== void 0) this.#cache.delete(lru);
|
|
2380
|
-
}
|
|
2381
2410
|
return result;
|
|
2382
2411
|
}
|
|
2383
2412
|
#compute(props, recipe) {
|
|
@@ -3005,8 +3034,7 @@ function render({
|
|
|
3005
3034
|
childrenEvaluator
|
|
3006
3035
|
}) {
|
|
3007
3036
|
const state = prepareRenderState(runtime, props, filterProps);
|
|
3008
|
-
|
|
3009
|
-
const getNormalizedChildren = () => cached ??= normalizeChildren(state.children);
|
|
3037
|
+
const getNormalizedChildren = lazy(() => normalizeChildren(state.children));
|
|
3010
3038
|
if (process.env.NODE_ENV !== "production") {
|
|
3011
3039
|
childrenEvaluator?.evaluate(getNormalizedChildren(), {
|
|
3012
3040
|
tag: state.tag,
|
package/dist/lit/index.js
CHANGED
|
@@ -507,6 +507,45 @@ var iterate = Object.freeze({
|
|
|
507
507
|
values
|
|
508
508
|
});
|
|
509
509
|
|
|
510
|
+
// ../../lib/primitive/src/utils/lru-cache.ts
|
|
511
|
+
var LRUCache = class {
|
|
512
|
+
#maxSize;
|
|
513
|
+
#store = /* @__PURE__ */ new Map();
|
|
514
|
+
constructor(maxSize) {
|
|
515
|
+
if (!Number.isInteger(maxSize) || maxSize < 1) {
|
|
516
|
+
throw new RangeError("LRUCache maxSize must be a positive integer.");
|
|
517
|
+
}
|
|
518
|
+
this.#maxSize = maxSize;
|
|
519
|
+
}
|
|
520
|
+
get(key) {
|
|
521
|
+
if (!this.#store.has(key)) return void 0;
|
|
522
|
+
const value = this.#store.get(key);
|
|
523
|
+
this.#store.delete(key);
|
|
524
|
+
this.#store.set(key, value);
|
|
525
|
+
return value;
|
|
526
|
+
}
|
|
527
|
+
set(key, value) {
|
|
528
|
+
this.#store.delete(key);
|
|
529
|
+
this.#store.set(key, value);
|
|
530
|
+
if (this.#store.size > this.#maxSize) {
|
|
531
|
+
const lru = this.#store.keys().next().value;
|
|
532
|
+
if (lru !== void 0) this.#store.delete(lru);
|
|
533
|
+
}
|
|
534
|
+
}
|
|
535
|
+
has(key) {
|
|
536
|
+
return this.#store.has(key);
|
|
537
|
+
}
|
|
538
|
+
delete(key) {
|
|
539
|
+
return this.#store.delete(key);
|
|
540
|
+
}
|
|
541
|
+
get size() {
|
|
542
|
+
return this.#store.size;
|
|
543
|
+
}
|
|
544
|
+
clear() {
|
|
545
|
+
this.#store.clear();
|
|
546
|
+
}
|
|
547
|
+
};
|
|
548
|
+
|
|
510
549
|
// ../../lib/primitive/src/utils/merge-props.ts
|
|
511
550
|
function mergeProps(defaultProps, props) {
|
|
512
551
|
return {
|
|
@@ -551,28 +590,6 @@ function isTag(...args) {
|
|
|
551
590
|
return tag !== void 0 && set2.has(tag);
|
|
552
591
|
}
|
|
553
592
|
|
|
554
|
-
// ../../lib/contract/src/strict/invariant-base.ts
|
|
555
|
-
var InvariantBase = class {
|
|
556
|
-
diagnostics;
|
|
557
|
-
constructor(diagnostics) {
|
|
558
|
-
this.diagnostics = diagnostics;
|
|
559
|
-
}
|
|
560
|
-
get active() {
|
|
561
|
-
return this.diagnostics.active;
|
|
562
|
-
}
|
|
563
|
-
violate(input) {
|
|
564
|
-
this.diagnostics.error(input);
|
|
565
|
-
}
|
|
566
|
-
// Always caps at warn — never throws. ARIA 'warning' violations route here
|
|
567
|
-
// so they surface even in strict='throw' mode without aborting a render.
|
|
568
|
-
warn(input) {
|
|
569
|
-
this.diagnostics.warn(input);
|
|
570
|
-
}
|
|
571
|
-
invariant(condition, input) {
|
|
572
|
-
if (!condition) this.violate(input);
|
|
573
|
-
}
|
|
574
|
-
};
|
|
575
|
-
|
|
576
593
|
// ../../lib/contract/src/diagnostics/aria.ts
|
|
577
594
|
import { DiagnosticCategory, DiagnosticCode } from "../_shared/diagnostics.js";
|
|
578
595
|
var AriaDiagnostics = {
|
|
@@ -883,6 +900,28 @@ var HtmlDiagnostics = {
|
|
|
883
900
|
}
|
|
884
901
|
};
|
|
885
902
|
|
|
903
|
+
// ../../lib/contract/src/strict/invariant-base.ts
|
|
904
|
+
var InvariantBase = class {
|
|
905
|
+
diagnostics;
|
|
906
|
+
constructor(diagnostics) {
|
|
907
|
+
this.diagnostics = diagnostics;
|
|
908
|
+
}
|
|
909
|
+
get active() {
|
|
910
|
+
return this.diagnostics.active;
|
|
911
|
+
}
|
|
912
|
+
violate(input) {
|
|
913
|
+
this.diagnostics.error(input);
|
|
914
|
+
}
|
|
915
|
+
// Always caps at warn — never throws. ARIA 'warning' violations route here
|
|
916
|
+
// so they surface even in strict='throw' mode without aborting a render.
|
|
917
|
+
warn(input) {
|
|
918
|
+
this.diagnostics.warn(input);
|
|
919
|
+
}
|
|
920
|
+
invariant(condition, input) {
|
|
921
|
+
if (!condition) this.violate(input);
|
|
922
|
+
}
|
|
923
|
+
};
|
|
924
|
+
|
|
886
925
|
// ../../lib/contract/src/aria/polymorphic-validator.ts
|
|
887
926
|
var VALID = [{ valid: true }];
|
|
888
927
|
function isIntrinsicTag(tag) {
|
|
@@ -894,8 +933,7 @@ function omitProp(obj, key) {
|
|
|
894
933
|
}
|
|
895
934
|
var AriaPolicyEngine = class _AriaPolicyEngine extends InvariantBase {
|
|
896
935
|
#extraRules;
|
|
897
|
-
#planCache =
|
|
898
|
-
static #MAX_CACHE = 100;
|
|
936
|
+
#planCache = new LRUCache(100);
|
|
899
937
|
// Memoized AriaFix objects keyed by attribute name — the ARIA attribute set is
|
|
900
938
|
// finite so this Map is bounded and avoids recreating closures on every cache miss.
|
|
901
939
|
static #removeAttributeFixCache = /* @__PURE__ */ new Map();
|
|
@@ -1051,8 +1089,6 @@ var AriaPolicyEngine = class _AriaPolicyEngine extends InvariantBase {
|
|
|
1051
1089
|
if (!isNull(key)) {
|
|
1052
1090
|
const cached = this.#planCache.get(key);
|
|
1053
1091
|
if (cached !== void 0) {
|
|
1054
|
-
this.#planCache.delete(key);
|
|
1055
|
-
this.#planCache.set(key, cached);
|
|
1056
1092
|
if (cached.violations.length > 0) this.report(cached.violations);
|
|
1057
1093
|
return {
|
|
1058
1094
|
props: _AriaPolicyEngine.#applyPlan(props, cached.removals, cached.updates),
|
|
@@ -1069,10 +1105,6 @@ var AriaPolicyEngine = class _AriaPolicyEngine extends InvariantBase {
|
|
|
1069
1105
|
);
|
|
1070
1106
|
const plan = { removals, updates, violations: result.violations };
|
|
1071
1107
|
this.#planCache.set(key, plan);
|
|
1072
|
-
if (this.#planCache.size > _AriaPolicyEngine.#MAX_CACHE) {
|
|
1073
|
-
const lru = this.#planCache.keys().next().value;
|
|
1074
|
-
if (lru !== void 0) this.#planCache.delete(lru);
|
|
1075
|
-
}
|
|
1076
1108
|
}
|
|
1077
1109
|
return result;
|
|
1078
1110
|
}
|
|
@@ -2147,7 +2179,7 @@ function cva2(base, config) {
|
|
|
2147
2179
|
// ../../lib/styling/src/static-class-resolver.ts
|
|
2148
2180
|
var StaticClassResolver = class {
|
|
2149
2181
|
#baseClass;
|
|
2150
|
-
#cache =
|
|
2182
|
+
#cache = new LRUCache(200);
|
|
2151
2183
|
#resolveTag;
|
|
2152
2184
|
constructor(baseClass, tagMap) {
|
|
2153
2185
|
this.#baseClass = Array.isArray(baseClass) ? baseClass.join(" ") : baseClass;
|
|
@@ -2161,17 +2193,9 @@ var StaticClassResolver = class {
|
|
|
2161
2193
|
resolve(tag, skipTagMap = false) {
|
|
2162
2194
|
if (typeof tag !== "string" || skipTagMap) return this.#baseClass;
|
|
2163
2195
|
const cached = this.#cache.get(tag);
|
|
2164
|
-
if (cached !== void 0)
|
|
2165
|
-
this.#cache.delete(tag);
|
|
2166
|
-
this.#cache.set(tag, cached);
|
|
2167
|
-
return cached;
|
|
2168
|
-
}
|
|
2196
|
+
if (cached !== void 0) return cached;
|
|
2169
2197
|
const result = this.#resolveTag(tag);
|
|
2170
2198
|
this.#cache.set(tag, result);
|
|
2171
|
-
if (this.#cache.size > 200) {
|
|
2172
|
-
const lru = this.#cache.keys().next().value;
|
|
2173
|
-
if (lru !== void 0) this.#cache.delete(lru);
|
|
2174
|
-
}
|
|
2175
2199
|
return result;
|
|
2176
2200
|
}
|
|
2177
2201
|
};
|
|
@@ -2182,7 +2206,7 @@ var VariantClassResolver = class _VariantClassResolver {
|
|
|
2182
2206
|
#recipeMap;
|
|
2183
2207
|
#variantKeys;
|
|
2184
2208
|
#precomputedClasses;
|
|
2185
|
-
#cache =
|
|
2209
|
+
#cache = new LRUCache(1e3);
|
|
2186
2210
|
constructor(cvaFn, recipeMap, variantKeys, precomputedClasses) {
|
|
2187
2211
|
this.#cvaFn = cvaFn ?? null;
|
|
2188
2212
|
this.#recipeMap = Object.freeze(recipeMap ?? {});
|
|
@@ -2197,17 +2221,9 @@ var VariantClassResolver = class _VariantClassResolver {
|
|
|
2197
2221
|
if (precomputed !== void 0) return precomputed;
|
|
2198
2222
|
}
|
|
2199
2223
|
const cached = this.#cache.get(cacheKey);
|
|
2200
|
-
if (cached !== void 0)
|
|
2201
|
-
this.#cache.delete(cacheKey);
|
|
2202
|
-
this.#cache.set(cacheKey, cached);
|
|
2203
|
-
return cached;
|
|
2204
|
-
}
|
|
2224
|
+
if (cached !== void 0) return cached;
|
|
2205
2225
|
const result = this.#compute(props, recipe);
|
|
2206
2226
|
this.#cache.set(cacheKey, result);
|
|
2207
|
-
if (this.#cache.size > 1e3) {
|
|
2208
|
-
const lru = this.#cache.keys().next().value;
|
|
2209
|
-
if (lru !== void 0) this.#cache.delete(lru);
|
|
2210
|
-
}
|
|
2211
2227
|
return result;
|
|
2212
2228
|
}
|
|
2213
2229
|
#compute(props, recipe) {
|
package/dist/preact/index.js
CHANGED
|
@@ -666,6 +666,45 @@ var iterate = Object.freeze({
|
|
|
666
666
|
values
|
|
667
667
|
});
|
|
668
668
|
|
|
669
|
+
// ../../lib/primitive/src/utils/lru-cache.ts
|
|
670
|
+
var LRUCache = class {
|
|
671
|
+
#maxSize;
|
|
672
|
+
#store = /* @__PURE__ */ new Map();
|
|
673
|
+
constructor(maxSize) {
|
|
674
|
+
if (!Number.isInteger(maxSize) || maxSize < 1) {
|
|
675
|
+
throw new RangeError("LRUCache maxSize must be a positive integer.");
|
|
676
|
+
}
|
|
677
|
+
this.#maxSize = maxSize;
|
|
678
|
+
}
|
|
679
|
+
get(key) {
|
|
680
|
+
if (!this.#store.has(key)) return void 0;
|
|
681
|
+
const value = this.#store.get(key);
|
|
682
|
+
this.#store.delete(key);
|
|
683
|
+
this.#store.set(key, value);
|
|
684
|
+
return value;
|
|
685
|
+
}
|
|
686
|
+
set(key, value) {
|
|
687
|
+
this.#store.delete(key);
|
|
688
|
+
this.#store.set(key, value);
|
|
689
|
+
if (this.#store.size > this.#maxSize) {
|
|
690
|
+
const lru = this.#store.keys().next().value;
|
|
691
|
+
if (lru !== void 0) this.#store.delete(lru);
|
|
692
|
+
}
|
|
693
|
+
}
|
|
694
|
+
has(key) {
|
|
695
|
+
return this.#store.has(key);
|
|
696
|
+
}
|
|
697
|
+
delete(key) {
|
|
698
|
+
return this.#store.delete(key);
|
|
699
|
+
}
|
|
700
|
+
get size() {
|
|
701
|
+
return this.#store.size;
|
|
702
|
+
}
|
|
703
|
+
clear() {
|
|
704
|
+
this.#store.clear();
|
|
705
|
+
}
|
|
706
|
+
};
|
|
707
|
+
|
|
669
708
|
// ../../lib/primitive/src/utils/merge-refs.ts
|
|
670
709
|
function mergeRefsCore(...refs) {
|
|
671
710
|
const active = refs.filter((r) => r != null);
|
|
@@ -690,28 +729,6 @@ function mergeProps(defaultProps, props) {
|
|
|
690
729
|
};
|
|
691
730
|
}
|
|
692
731
|
|
|
693
|
-
// ../../lib/contract/src/strict/invariant-base.ts
|
|
694
|
-
var InvariantBase = class {
|
|
695
|
-
diagnostics;
|
|
696
|
-
constructor(diagnostics) {
|
|
697
|
-
this.diagnostics = diagnostics;
|
|
698
|
-
}
|
|
699
|
-
get active() {
|
|
700
|
-
return this.diagnostics.active;
|
|
701
|
-
}
|
|
702
|
-
violate(input) {
|
|
703
|
-
this.diagnostics.error(input);
|
|
704
|
-
}
|
|
705
|
-
// Always caps at warn — never throws. ARIA 'warning' violations route here
|
|
706
|
-
// so they surface even in strict='throw' mode without aborting a render.
|
|
707
|
-
warn(input) {
|
|
708
|
-
this.diagnostics.warn(input);
|
|
709
|
-
}
|
|
710
|
-
invariant(condition, input) {
|
|
711
|
-
if (!condition) this.violate(input);
|
|
712
|
-
}
|
|
713
|
-
};
|
|
714
|
-
|
|
715
732
|
// ../../lib/contract/src/diagnostics/aria.ts
|
|
716
733
|
import { DiagnosticCategory, DiagnosticCode } from "../_shared/diagnostics.js";
|
|
717
734
|
var AriaDiagnostics = {
|
|
@@ -1068,6 +1085,28 @@ var SlotDiagnostics = {
|
|
|
1068
1085
|
}
|
|
1069
1086
|
};
|
|
1070
1087
|
|
|
1088
|
+
// ../../lib/contract/src/strict/invariant-base.ts
|
|
1089
|
+
var InvariantBase = class {
|
|
1090
|
+
diagnostics;
|
|
1091
|
+
constructor(diagnostics) {
|
|
1092
|
+
this.diagnostics = diagnostics;
|
|
1093
|
+
}
|
|
1094
|
+
get active() {
|
|
1095
|
+
return this.diagnostics.active;
|
|
1096
|
+
}
|
|
1097
|
+
violate(input) {
|
|
1098
|
+
this.diagnostics.error(input);
|
|
1099
|
+
}
|
|
1100
|
+
// Always caps at warn — never throws. ARIA 'warning' violations route here
|
|
1101
|
+
// so they surface even in strict='throw' mode without aborting a render.
|
|
1102
|
+
warn(input) {
|
|
1103
|
+
this.diagnostics.warn(input);
|
|
1104
|
+
}
|
|
1105
|
+
invariant(condition, input) {
|
|
1106
|
+
if (!condition) this.violate(input);
|
|
1107
|
+
}
|
|
1108
|
+
};
|
|
1109
|
+
|
|
1071
1110
|
// ../../lib/contract/src/aria/polymorphic-validator.ts
|
|
1072
1111
|
var VALID = [{ valid: true }];
|
|
1073
1112
|
function isIntrinsicTag(tag) {
|
|
@@ -1079,8 +1118,7 @@ function omitProp(obj, key) {
|
|
|
1079
1118
|
}
|
|
1080
1119
|
var AriaPolicyEngine = class _AriaPolicyEngine extends InvariantBase {
|
|
1081
1120
|
#extraRules;
|
|
1082
|
-
#planCache =
|
|
1083
|
-
static #MAX_CACHE = 100;
|
|
1121
|
+
#planCache = new LRUCache(100);
|
|
1084
1122
|
// Memoized AriaFix objects keyed by attribute name — the ARIA attribute set is
|
|
1085
1123
|
// finite so this Map is bounded and avoids recreating closures on every cache miss.
|
|
1086
1124
|
static #removeAttributeFixCache = /* @__PURE__ */ new Map();
|
|
@@ -1236,8 +1274,6 @@ var AriaPolicyEngine = class _AriaPolicyEngine extends InvariantBase {
|
|
|
1236
1274
|
if (!isNull(key)) {
|
|
1237
1275
|
const cached = this.#planCache.get(key);
|
|
1238
1276
|
if (cached !== void 0) {
|
|
1239
|
-
this.#planCache.delete(key);
|
|
1240
|
-
this.#planCache.set(key, cached);
|
|
1241
1277
|
if (cached.violations.length > 0) this.report(cached.violations);
|
|
1242
1278
|
return {
|
|
1243
1279
|
props: _AriaPolicyEngine.#applyPlan(props, cached.removals, cached.updates),
|
|
@@ -1254,10 +1290,6 @@ var AriaPolicyEngine = class _AriaPolicyEngine extends InvariantBase {
|
|
|
1254
1290
|
);
|
|
1255
1291
|
const plan = { removals, updates, violations: result.violations };
|
|
1256
1292
|
this.#planCache.set(key, plan);
|
|
1257
|
-
if (this.#planCache.size > _AriaPolicyEngine.#MAX_CACHE) {
|
|
1258
|
-
const lru = this.#planCache.keys().next().value;
|
|
1259
|
-
if (lru !== void 0) this.#planCache.delete(lru);
|
|
1260
|
-
}
|
|
1261
1293
|
}
|
|
1262
1294
|
return result;
|
|
1263
1295
|
}
|
|
@@ -2332,7 +2364,7 @@ function cva2(base, config) {
|
|
|
2332
2364
|
// ../../lib/styling/src/static-class-resolver.ts
|
|
2333
2365
|
var StaticClassResolver = class {
|
|
2334
2366
|
#baseClass;
|
|
2335
|
-
#cache =
|
|
2367
|
+
#cache = new LRUCache(200);
|
|
2336
2368
|
#resolveTag;
|
|
2337
2369
|
constructor(baseClass, tagMap) {
|
|
2338
2370
|
this.#baseClass = Array.isArray(baseClass) ? baseClass.join(" ") : baseClass;
|
|
@@ -2346,17 +2378,9 @@ var StaticClassResolver = class {
|
|
|
2346
2378
|
resolve(tag, skipTagMap = false) {
|
|
2347
2379
|
if (typeof tag !== "string" || skipTagMap) return this.#baseClass;
|
|
2348
2380
|
const cached = this.#cache.get(tag);
|
|
2349
|
-
if (cached !== void 0)
|
|
2350
|
-
this.#cache.delete(tag);
|
|
2351
|
-
this.#cache.set(tag, cached);
|
|
2352
|
-
return cached;
|
|
2353
|
-
}
|
|
2381
|
+
if (cached !== void 0) return cached;
|
|
2354
2382
|
const result = this.#resolveTag(tag);
|
|
2355
2383
|
this.#cache.set(tag, result);
|
|
2356
|
-
if (this.#cache.size > 200) {
|
|
2357
|
-
const lru = this.#cache.keys().next().value;
|
|
2358
|
-
if (lru !== void 0) this.#cache.delete(lru);
|
|
2359
|
-
}
|
|
2360
2384
|
return result;
|
|
2361
2385
|
}
|
|
2362
2386
|
};
|
|
@@ -2367,7 +2391,7 @@ var VariantClassResolver = class _VariantClassResolver {
|
|
|
2367
2391
|
#recipeMap;
|
|
2368
2392
|
#variantKeys;
|
|
2369
2393
|
#precomputedClasses;
|
|
2370
|
-
#cache =
|
|
2394
|
+
#cache = new LRUCache(1e3);
|
|
2371
2395
|
constructor(cvaFn, recipeMap, variantKeys, precomputedClasses) {
|
|
2372
2396
|
this.#cvaFn = cvaFn ?? null;
|
|
2373
2397
|
this.#recipeMap = Object.freeze(recipeMap ?? {});
|
|
@@ -2382,17 +2406,9 @@ var VariantClassResolver = class _VariantClassResolver {
|
|
|
2382
2406
|
if (precomputed !== void 0) return precomputed;
|
|
2383
2407
|
}
|
|
2384
2408
|
const cached = this.#cache.get(cacheKey);
|
|
2385
|
-
if (cached !== void 0)
|
|
2386
|
-
this.#cache.delete(cacheKey);
|
|
2387
|
-
this.#cache.set(cacheKey, cached);
|
|
2388
|
-
return cached;
|
|
2389
|
-
}
|
|
2409
|
+
if (cached !== void 0) return cached;
|
|
2390
2410
|
const result = this.#compute(props, recipe);
|
|
2391
2411
|
this.#cache.set(cacheKey, result);
|
|
2392
|
-
if (this.#cache.size > 1e3) {
|
|
2393
|
-
const lru = this.#cache.keys().next().value;
|
|
2394
|
-
if (lru !== void 0) this.#cache.delete(lru);
|
|
2395
|
-
}
|
|
2396
2412
|
return result;
|
|
2397
2413
|
}
|
|
2398
2414
|
#compute(props, recipe) {
|
package/dist/react/index.js
CHANGED
package/dist/react/legacy.js
CHANGED