@bamboocss/token-dictionary 1.55.3 → 1.55.5
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.cjs +8 -3
- package/dist/index.mjs +8 -3
- package/package.json +4 -4
package/dist/index.cjs
CHANGED
|
@@ -638,8 +638,9 @@ const transforms = [
|
|
|
638
638
|
return token.extensions.category === "colors" && token.value.includes("/");
|
|
639
639
|
},
|
|
640
640
|
transform(token, dict) {
|
|
641
|
-
if (!token.value.includes("/")) return token;
|
|
641
|
+
if (!token.value.includes("/")) return token.value;
|
|
642
642
|
return expandReferences(token.value, (path) => {
|
|
643
|
+
if (!path.includes("/")) return referenceOf(path);
|
|
643
644
|
const tokenFn = (tokenPath) => {
|
|
644
645
|
return dict.getByName(tokenPath)?.extensions.varRef;
|
|
645
646
|
};
|
|
@@ -668,6 +669,10 @@ const transforms = [
|
|
|
668
669
|
return dictionary.getByName(name)?.extensions.varRef;
|
|
669
670
|
};
|
|
670
671
|
token.value = expandReferences(token.value, (path) => {
|
|
672
|
+
if (!path.includes("/")) return dictionary.formatCssVar(path.split("."), {
|
|
673
|
+
prefix,
|
|
674
|
+
hash
|
|
675
|
+
}).ref;
|
|
671
676
|
const mix = dictionary.colorMix(path, tokenFn);
|
|
672
677
|
if (mix.invalid) throw new _bamboocss_shared.BambooError("INVALID_TOKEN", "Invalid color mix at " + path + ": " + mix.value);
|
|
673
678
|
return mix.value;
|
|
@@ -905,11 +910,11 @@ var TokenDictionary = class {
|
|
|
905
910
|
assertTokenFormat(token);
|
|
906
911
|
const category = path[0];
|
|
907
912
|
const name = this.formatTokenName(path);
|
|
908
|
-
const { value, ...restData } = (0, _bamboocss_shared.isString)(token.value) || isCompositeTokenValue(token.value) ? { value: { base: token.value } } : token;
|
|
913
|
+
const { value, ...restData } = (0, _bamboocss_shared.isString)(token.value) || typeof token.value === "number" || isCompositeTokenValue(token.value) ? { value: { base: token.value } } : token;
|
|
909
914
|
const node = new Token({
|
|
910
915
|
...restData,
|
|
911
916
|
name,
|
|
912
|
-
value: value.base
|
|
917
|
+
value: value.base ?? "",
|
|
913
918
|
path
|
|
914
919
|
});
|
|
915
920
|
node.setExtensions({
|
package/dist/index.mjs
CHANGED
|
@@ -614,8 +614,9 @@ const transforms = [
|
|
|
614
614
|
return token.extensions.category === "colors" && token.value.includes("/");
|
|
615
615
|
},
|
|
616
616
|
transform(token, dict) {
|
|
617
|
-
if (!token.value.includes("/")) return token;
|
|
617
|
+
if (!token.value.includes("/")) return token.value;
|
|
618
618
|
return expandReferences(token.value, (path) => {
|
|
619
|
+
if (!path.includes("/")) return referenceOf(path);
|
|
619
620
|
const tokenFn = (tokenPath) => {
|
|
620
621
|
return dict.getByName(tokenPath)?.extensions.varRef;
|
|
621
622
|
};
|
|
@@ -644,6 +645,10 @@ const transforms = [
|
|
|
644
645
|
return dictionary.getByName(name)?.extensions.varRef;
|
|
645
646
|
};
|
|
646
647
|
token.value = expandReferences(token.value, (path) => {
|
|
648
|
+
if (!path.includes("/")) return dictionary.formatCssVar(path.split("."), {
|
|
649
|
+
prefix,
|
|
650
|
+
hash
|
|
651
|
+
}).ref;
|
|
647
652
|
const mix = dictionary.colorMix(path, tokenFn);
|
|
648
653
|
if (mix.invalid) throw new BambooError("INVALID_TOKEN", "Invalid color mix at " + path + ": " + mix.value);
|
|
649
654
|
return mix.value;
|
|
@@ -881,11 +886,11 @@ var TokenDictionary = class {
|
|
|
881
886
|
assertTokenFormat(token);
|
|
882
887
|
const category = path[0];
|
|
883
888
|
const name = this.formatTokenName(path);
|
|
884
|
-
const { value, ...restData } = isString(token.value) || isCompositeTokenValue(token.value) ? { value: { base: token.value } } : token;
|
|
889
|
+
const { value, ...restData } = isString(token.value) || typeof token.value === "number" || isCompositeTokenValue(token.value) ? { value: { base: token.value } } : token;
|
|
885
890
|
const node = new Token({
|
|
886
891
|
...restData,
|
|
887
892
|
name,
|
|
888
|
-
value: value.base
|
|
893
|
+
value: value.base ?? "",
|
|
889
894
|
path
|
|
890
895
|
});
|
|
891
896
|
node.setExtensions({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bamboocss/token-dictionary",
|
|
3
|
-
"version": "1.55.
|
|
3
|
+
"version": "1.55.5",
|
|
4
4
|
"description": "Common error messages for css bamboo",
|
|
5
5
|
"homepage": "https://bamboocss.com",
|
|
6
6
|
"license": "MIT",
|
|
@@ -35,9 +35,9 @@
|
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"picomatch": "4.0.5",
|
|
37
37
|
"ts-pattern": "5.9.0",
|
|
38
|
-
"@bamboocss/logger": "^1.55.
|
|
39
|
-
"@bamboocss/shared": "1.55.
|
|
40
|
-
"@bamboocss/types": "1.55.
|
|
38
|
+
"@bamboocss/logger": "^1.55.5",
|
|
39
|
+
"@bamboocss/shared": "1.55.5",
|
|
40
|
+
"@bamboocss/types": "1.55.5"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@types/picomatch": "4.0.2"
|