@pandacss/token-dictionary 0.31.0 → 0.32.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 CHANGED
@@ -365,6 +365,13 @@ var addVirtualPalette = {
365
365
  const colorPaletteList = colorPalettes.get(formated) || [];
366
366
  colorPaletteList.push(token);
367
367
  colorPalettes.set(formated, colorPaletteList);
368
+ if (token.extensions.isDefault && colorPaletteRoot.length === 1) {
369
+ const keyPath = colorPaletteTokenKeys[0]?.filter(Boolean);
370
+ if (!keyPath.length)
371
+ return;
372
+ const path = colorPaletteRoot.concat(keyPath);
373
+ keys.set(dictionary.formatTokenName(path), []);
374
+ }
368
375
  });
369
376
  });
370
377
  keys.forEach((segments) => {
@@ -576,7 +583,7 @@ var transformAssets = {
576
583
  match: (token) => token.extensions.category === "assets",
577
584
  transform(token) {
578
585
  const raw = token.value;
579
- return (0, import_ts_pattern2.match)(raw).with(import_ts_pattern2.P.string, (value) => value).with({ type: "url" }, ({ value }) => `url('${value}')`).with({ type: "svg" }, ({ value }) => `url('${svgToDataUri(value)})'`).exhaustive();
586
+ return (0, import_ts_pattern2.match)(raw).with(import_ts_pattern2.P.string, (value) => value).with({ type: "url" }, ({ value }) => `url('${value}')`).with({ type: "svg" }, ({ value }) => `url('${svgToDataUri(value)}')`).exhaustive();
580
587
  }
581
588
  };
582
589
  var addCssVariables = {
@@ -711,6 +718,7 @@ var TokenDictionary = class {
711
718
  (0, import_shared5.walkObject)(
712
719
  computedTokens,
713
720
  (token, path) => {
721
+ const isDefault = path.includes("DEFAULT");
714
722
  path = filterDefault(path);
715
723
  assertTokenFormat(token);
716
724
  const category = path[0];
@@ -720,6 +728,9 @@ var TokenDictionary = class {
720
728
  category,
721
729
  prop: this.formatTokenName(path.slice(1))
722
730
  });
731
+ if (isDefault) {
732
+ node.setExtensions({ isDefault });
733
+ }
723
734
  this.registerToken(node);
724
735
  },
725
736
  { stop: isToken }
@@ -727,6 +738,7 @@ var TokenDictionary = class {
727
738
  (0, import_shared5.walkObject)(
728
739
  semanticTokens,
729
740
  (token, path) => {
741
+ const isDefault = path.includes("DEFAULT");
730
742
  path = filterDefault(path);
731
743
  assertTokenFormat(token);
732
744
  const category = path[0];
@@ -744,6 +756,9 @@ var TokenDictionary = class {
744
756
  conditions: value,
745
757
  prop: this.formatTokenName(path.slice(1))
746
758
  });
759
+ if (isDefault) {
760
+ node.setExtensions({ isDefault });
761
+ }
747
762
  this.registerToken(node);
748
763
  },
749
764
  { stop: isToken }
@@ -951,7 +966,8 @@ var TokenDictionaryView = class {
951
966
  group.get(condition).add(token);
952
967
  }
953
968
  processColorPalette(token, group, byName) {
954
- const { colorPalette, colorPaletteRoots, isVirtual } = token.extensions;
969
+ const extensions = token.extensions;
970
+ const { colorPalette, colorPaletteRoots, isVirtual } = extensions;
955
971
  if (!colorPalette || isVirtual)
956
972
  return;
957
973
  colorPaletteRoots.forEach((colorPaletteRoot) => {
@@ -966,6 +982,24 @@ var TokenDictionaryView = class {
966
982
  return;
967
983
  const virtualVar = virtualToken.extensions.var;
968
984
  group.get(formated).set(virtualVar, token.extensions.varRef);
985
+ if (extensions.isDefault && colorPaletteRoot.length === 1) {
986
+ const colorPaletteName = this.dictionary.formatTokenName(["colors", "colorPalette"]);
987
+ const colorPaletteToken = byName.get(colorPaletteName);
988
+ if (!colorPaletteToken)
989
+ return;
990
+ const name = this.dictionary.formatTokenName(token.path);
991
+ const virtualToken2 = byName.get(name);
992
+ if (!virtualToken2)
993
+ return;
994
+ const keyPath = extensions.colorPaletteTokenKeys[0]?.filter(Boolean);
995
+ if (!keyPath.length)
996
+ return;
997
+ const formated2 = this.dictionary.formatTokenName(colorPaletteRoot.concat(keyPath));
998
+ if (!group.has(formated2)) {
999
+ group.set(formated2, /* @__PURE__ */ new Map());
1000
+ }
1001
+ group.get(formated2).set(colorPaletteToken.extensions.var, virtualToken2.extensions.varRef);
1002
+ }
969
1003
  });
970
1004
  }
971
1005
  processCategory(token, group) {
package/dist/index.mjs CHANGED
@@ -345,6 +345,13 @@ var addVirtualPalette = {
345
345
  const colorPaletteList = colorPalettes.get(formated) || [];
346
346
  colorPaletteList.push(token);
347
347
  colorPalettes.set(formated, colorPaletteList);
348
+ if (token.extensions.isDefault && colorPaletteRoot.length === 1) {
349
+ const keyPath = colorPaletteTokenKeys[0]?.filter(Boolean);
350
+ if (!keyPath.length)
351
+ return;
352
+ const path = colorPaletteRoot.concat(keyPath);
353
+ keys.set(dictionary.formatTokenName(path), []);
354
+ }
348
355
  });
349
356
  });
350
357
  keys.forEach((segments) => {
@@ -556,7 +563,7 @@ var transformAssets = {
556
563
  match: (token) => token.extensions.category === "assets",
557
564
  transform(token) {
558
565
  const raw = token.value;
559
- return match(raw).with(P2.string, (value) => value).with({ type: "url" }, ({ value }) => `url('${value}')`).with({ type: "svg" }, ({ value }) => `url('${svgToDataUri(value)})'`).exhaustive();
566
+ return match(raw).with(P2.string, (value) => value).with({ type: "url" }, ({ value }) => `url('${value}')`).with({ type: "svg" }, ({ value }) => `url('${svgToDataUri(value)}')`).exhaustive();
560
567
  }
561
568
  };
562
569
  var addCssVariables = {
@@ -691,6 +698,7 @@ var TokenDictionary = class {
691
698
  walkObject2(
692
699
  computedTokens,
693
700
  (token, path) => {
701
+ const isDefault = path.includes("DEFAULT");
694
702
  path = filterDefault(path);
695
703
  assertTokenFormat(token);
696
704
  const category = path[0];
@@ -700,6 +708,9 @@ var TokenDictionary = class {
700
708
  category,
701
709
  prop: this.formatTokenName(path.slice(1))
702
710
  });
711
+ if (isDefault) {
712
+ node.setExtensions({ isDefault });
713
+ }
703
714
  this.registerToken(node);
704
715
  },
705
716
  { stop: isToken }
@@ -707,6 +718,7 @@ var TokenDictionary = class {
707
718
  walkObject2(
708
719
  semanticTokens,
709
720
  (token, path) => {
721
+ const isDefault = path.includes("DEFAULT");
710
722
  path = filterDefault(path);
711
723
  assertTokenFormat(token);
712
724
  const category = path[0];
@@ -724,6 +736,9 @@ var TokenDictionary = class {
724
736
  conditions: value,
725
737
  prop: this.formatTokenName(path.slice(1))
726
738
  });
739
+ if (isDefault) {
740
+ node.setExtensions({ isDefault });
741
+ }
727
742
  this.registerToken(node);
728
743
  },
729
744
  { stop: isToken }
@@ -931,7 +946,8 @@ var TokenDictionaryView = class {
931
946
  group.get(condition).add(token);
932
947
  }
933
948
  processColorPalette(token, group, byName) {
934
- const { colorPalette, colorPaletteRoots, isVirtual } = token.extensions;
949
+ const extensions = token.extensions;
950
+ const { colorPalette, colorPaletteRoots, isVirtual } = extensions;
935
951
  if (!colorPalette || isVirtual)
936
952
  return;
937
953
  colorPaletteRoots.forEach((colorPaletteRoot) => {
@@ -946,6 +962,24 @@ var TokenDictionaryView = class {
946
962
  return;
947
963
  const virtualVar = virtualToken.extensions.var;
948
964
  group.get(formated).set(virtualVar, token.extensions.varRef);
965
+ if (extensions.isDefault && colorPaletteRoot.length === 1) {
966
+ const colorPaletteName = this.dictionary.formatTokenName(["colors", "colorPalette"]);
967
+ const colorPaletteToken = byName.get(colorPaletteName);
968
+ if (!colorPaletteToken)
969
+ return;
970
+ const name = this.dictionary.formatTokenName(token.path);
971
+ const virtualToken2 = byName.get(name);
972
+ if (!virtualToken2)
973
+ return;
974
+ const keyPath = extensions.colorPaletteTokenKeys[0]?.filter(Boolean);
975
+ if (!keyPath.length)
976
+ return;
977
+ const formated2 = this.dictionary.formatTokenName(colorPaletteRoot.concat(keyPath));
978
+ if (!group.has(formated2)) {
979
+ group.set(formated2, /* @__PURE__ */ new Map());
980
+ }
981
+ group.get(formated2).set(colorPaletteToken.extensions.var, virtualToken2.extensions.varRef);
982
+ }
949
983
  });
950
984
  }
951
985
  processCategory(token, group) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pandacss/token-dictionary",
3
- "version": "0.31.0",
3
+ "version": "0.32.1",
4
4
  "description": "Common error messages for css panda",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -32,10 +32,10 @@
32
32
  "dist"
33
33
  ],
34
34
  "dependencies": {
35
- "ts-pattern": "5.0.5",
36
- "@pandacss/logger": "^0.31.0",
37
- "@pandacss/shared": "0.31.0",
38
- "@pandacss/types": "0.31.0"
35
+ "ts-pattern": "5.0.8",
36
+ "@pandacss/logger": "^0.32.1",
37
+ "@pandacss/types": "0.32.1",
38
+ "@pandacss/shared": "0.32.1"
39
39
  },
40
40
  "scripts": {
41
41
  "build": "tsup src/index.ts --format=esm,cjs --dts",