@pandacss/token-dictionary 0.44.0 → 0.45.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/index.js +15 -12
- package/dist/index.mjs +16 -13
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -512,6 +512,9 @@ function svgToDataUri(svgString) {
|
|
|
512
512
|
var objectKeys = (obj) => Object.keys(obj);
|
|
513
513
|
|
|
514
514
|
// src/transform.ts
|
|
515
|
+
function toUnit(v) {
|
|
516
|
+
return (0, import_shared4.isCssUnit)(v) ? v : `${v}px`;
|
|
517
|
+
}
|
|
515
518
|
var transformShadow = {
|
|
516
519
|
name: "tokens/shadow",
|
|
517
520
|
match: (token) => token.extensions.category === "shadows",
|
|
@@ -581,7 +584,7 @@ var transformBorders = {
|
|
|
581
584
|
}
|
|
582
585
|
if (isCompositeBorder(token.value)) {
|
|
583
586
|
const { width, style, color } = token.value;
|
|
584
|
-
return `${width}
|
|
587
|
+
return `${toUnit(width)} ${style} ${color}`;
|
|
585
588
|
}
|
|
586
589
|
return token.value;
|
|
587
590
|
}
|
|
@@ -637,25 +640,25 @@ var addConditionalCssVariables = {
|
|
|
637
640
|
const refs = getReferences(token.value);
|
|
638
641
|
if (!refs.length)
|
|
639
642
|
return token.value;
|
|
640
|
-
refs.
|
|
641
|
-
|
|
643
|
+
const modifier = refs.some((ref) => ref.includes("/"));
|
|
644
|
+
if (!modifier) {
|
|
645
|
+
refs.forEach((ref) => {
|
|
642
646
|
const variable = dictionary.formatCssVar(ref.split("."), { prefix, hash }).ref;
|
|
643
647
|
token.value = token.value.replace(`{${ref}}`, variable);
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
const
|
|
647
|
-
const
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
648
|
+
});
|
|
649
|
+
} else {
|
|
650
|
+
const tokenFn = (name) => {
|
|
651
|
+
const token2 = dictionary.getByName(name);
|
|
652
|
+
return token2?.extensions.varRef;
|
|
653
|
+
};
|
|
654
|
+
token.value = expandReferences(token.value, (path) => {
|
|
651
655
|
const mix = dictionary.colorMix(path, tokenFn);
|
|
652
656
|
if (mix.invalid) {
|
|
653
657
|
throw new Error("Invalid color mix at " + path + ": " + mix.value);
|
|
654
658
|
}
|
|
655
659
|
return mix.value;
|
|
656
660
|
});
|
|
657
|
-
|
|
658
|
-
});
|
|
661
|
+
}
|
|
659
662
|
return token.value;
|
|
660
663
|
}
|
|
661
664
|
};
|
package/dist/index.mjs
CHANGED
|
@@ -382,7 +382,7 @@ var removeEmptyTokens = {
|
|
|
382
382
|
var middlewares = [addNegativeTokens, addVirtualPalette, removeEmptyTokens, addPixelUnit];
|
|
383
383
|
|
|
384
384
|
// src/transform.ts
|
|
385
|
-
import { isString } from "@pandacss/shared";
|
|
385
|
+
import { isCssUnit, isString } from "@pandacss/shared";
|
|
386
386
|
import { P as P2, match } from "ts-pattern";
|
|
387
387
|
|
|
388
388
|
// src/mini-svg-uri.ts
|
|
@@ -488,6 +488,9 @@ function svgToDataUri(svgString) {
|
|
|
488
488
|
var objectKeys = (obj) => Object.keys(obj);
|
|
489
489
|
|
|
490
490
|
// src/transform.ts
|
|
491
|
+
function toUnit(v) {
|
|
492
|
+
return isCssUnit(v) ? v : `${v}px`;
|
|
493
|
+
}
|
|
491
494
|
var transformShadow = {
|
|
492
495
|
name: "tokens/shadow",
|
|
493
496
|
match: (token) => token.extensions.category === "shadows",
|
|
@@ -557,7 +560,7 @@ var transformBorders = {
|
|
|
557
560
|
}
|
|
558
561
|
if (isCompositeBorder(token.value)) {
|
|
559
562
|
const { width, style, color } = token.value;
|
|
560
|
-
return `${width}
|
|
563
|
+
return `${toUnit(width)} ${style} ${color}`;
|
|
561
564
|
}
|
|
562
565
|
return token.value;
|
|
563
566
|
}
|
|
@@ -613,25 +616,25 @@ var addConditionalCssVariables = {
|
|
|
613
616
|
const refs = getReferences(token.value);
|
|
614
617
|
if (!refs.length)
|
|
615
618
|
return token.value;
|
|
616
|
-
refs.
|
|
617
|
-
|
|
619
|
+
const modifier = refs.some((ref) => ref.includes("/"));
|
|
620
|
+
if (!modifier) {
|
|
621
|
+
refs.forEach((ref) => {
|
|
618
622
|
const variable = dictionary.formatCssVar(ref.split("."), { prefix, hash }).ref;
|
|
619
623
|
token.value = token.value.replace(`{${ref}}`, variable);
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
const
|
|
623
|
-
const
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
624
|
+
});
|
|
625
|
+
} else {
|
|
626
|
+
const tokenFn = (name) => {
|
|
627
|
+
const token2 = dictionary.getByName(name);
|
|
628
|
+
return token2?.extensions.varRef;
|
|
629
|
+
};
|
|
630
|
+
token.value = expandReferences(token.value, (path) => {
|
|
627
631
|
const mix = dictionary.colorMix(path, tokenFn);
|
|
628
632
|
if (mix.invalid) {
|
|
629
633
|
throw new Error("Invalid color mix at " + path + ": " + mix.value);
|
|
630
634
|
}
|
|
631
635
|
return mix.value;
|
|
632
636
|
});
|
|
633
|
-
|
|
634
|
-
});
|
|
637
|
+
}
|
|
635
638
|
return token.value;
|
|
636
639
|
}
|
|
637
640
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pandacss/token-dictionary",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.45.1",
|
|
4
4
|
"description": "Common error messages for css panda",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -33,9 +33,9 @@
|
|
|
33
33
|
],
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"ts-pattern": "5.0.8",
|
|
36
|
-
"@pandacss/logger": "^0.
|
|
37
|
-
"@pandacss/shared": "0.
|
|
38
|
-
"@pandacss/types": "0.
|
|
36
|
+
"@pandacss/logger": "^0.45.1",
|
|
37
|
+
"@pandacss/shared": "0.45.1",
|
|
38
|
+
"@pandacss/types": "0.45.1"
|
|
39
39
|
},
|
|
40
40
|
"scripts": {
|
|
41
41
|
"build": "tsup src/index.ts --format=esm,cjs --dts",
|