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
package/dist/web/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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "praxis-kit",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.1.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
"./react": {
|
|
@@ -182,12 +182,12 @@
|
|
|
182
182
|
"typescript": "^6.0.3",
|
|
183
183
|
"vite": "^8.1.4",
|
|
184
184
|
"vue": "^3.5.38",
|
|
185
|
-
"@praxis-kit/core": "0.0.0",
|
|
186
185
|
"@praxis-kit/adapter-utils": "0.0.0",
|
|
187
186
|
"@praxis-kit/diagnostics": "0.0.0",
|
|
187
|
+
"@praxis-kit/core": "0.0.0",
|
|
188
|
+
"@praxis-kit/primitive": "0.0.0",
|
|
188
189
|
"@praxis-kit/pipeline": "0.0.0",
|
|
189
|
-
"@praxis-kit/vite-plugin": "0.0.0"
|
|
190
|
-
"@praxis-kit/primitive": "0.0.0"
|
|
190
|
+
"@praxis-kit/vite-plugin": "0.0.0"
|
|
191
191
|
},
|
|
192
192
|
"publishConfig": {
|
|
193
193
|
"access": "public"
|