@pandacss/token-dictionary 1.6.1 → 1.7.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.d.mts CHANGED
@@ -178,6 +178,7 @@ declare class TokenDictionaryView {
178
178
  get: (path: string, fallback?: string | number) => string;
179
179
  getVar: (path: string, fallback?: string | number) => string;
180
180
  getCategoryValues: (category: string) => Record<string, string> | undefined;
181
+ getColorPaletteValues: (palette: string) => string[];
181
182
  };
182
183
  private processCondition;
183
184
  private processColorPalette;
package/dist/index.d.ts CHANGED
@@ -178,6 +178,7 @@ declare class TokenDictionaryView {
178
178
  get: (path: string, fallback?: string | number) => string;
179
179
  getVar: (path: string, fallback?: string | number) => string;
180
180
  getCategoryValues: (category: string) => Record<string, string> | undefined;
181
+ getColorPaletteValues: (palette: string) => string[];
181
182
  };
182
183
  private processCondition;
183
184
  private processColorPalette;
package/dist/index.js CHANGED
@@ -951,6 +951,7 @@ var TokenDictionary = class {
951
951
  node.setExtensions({
952
952
  category,
953
953
  conditions: value,
954
+ rawValue: value,
954
955
  prop: this.formatTokenName(path.slice(1))
955
956
  });
956
957
  if (isDefault) {
@@ -1218,6 +1219,7 @@ var TokenDictionaryView = class {
1218
1219
  const conditionMap = /* @__PURE__ */ new Map();
1219
1220
  const categoryMap = /* @__PURE__ */ new Map();
1220
1221
  const colorPalettes = /* @__PURE__ */ new Map();
1222
+ const colorPaletteTokens = /* @__PURE__ */ new Map();
1221
1223
  const valuesByCategory = /* @__PURE__ */ new Map();
1222
1224
  const flatValues = /* @__PURE__ */ new Map();
1223
1225
  const rawValues = /* @__PURE__ */ new Map();
@@ -1225,7 +1227,7 @@ var TokenDictionaryView = class {
1225
1227
  const vars = /* @__PURE__ */ new Map();
1226
1228
  this.dictionary.allTokens.forEach((token) => {
1227
1229
  this.processCondition(token, conditionMap);
1228
- this.processColorPalette(token, colorPalettes, this.dictionary.byName);
1230
+ this.processColorPalette(token, colorPalettes, colorPaletteTokens, this.dictionary.byName);
1229
1231
  this.processCategory(token, categoryMap);
1230
1232
  this.processValue(token, valuesByCategory, flatValues, rawValues, nameByVar);
1231
1233
  this.processVars(token, vars);
@@ -1251,6 +1253,11 @@ var TokenDictionaryView = class {
1251
1253
  if (result != null) {
1252
1254
  return result;
1253
1255
  }
1256
+ }),
1257
+ getColorPaletteValues: (0, import_shared6.memo)((palette) => {
1258
+ const tokens = colorPaletteTokens.get(palette);
1259
+ if (!tokens) return [];
1260
+ return Array.from(tokens).sort();
1254
1261
  })
1255
1262
  };
1256
1263
  }
@@ -1260,7 +1267,7 @@ var TokenDictionaryView = class {
1260
1267
  if (!group.has(condition)) group.set(condition, /* @__PURE__ */ new Set());
1261
1268
  group.get(condition).add(token);
1262
1269
  }
1263
- processColorPalette(token, group, byName) {
1270
+ processColorPalette(token, group, tokenPaths, byName) {
1264
1271
  const extensions = token.extensions;
1265
1272
  const { colorPalette, colorPaletteRoots, isVirtual } = extensions;
1266
1273
  if (!colorPalette || isVirtual) return;
@@ -1269,12 +1276,17 @@ var TokenDictionaryView = class {
1269
1276
  if (!group.has(formated)) {
1270
1277
  group.set(formated, /* @__PURE__ */ new Map());
1271
1278
  }
1279
+ if (!tokenPaths.has(formated)) {
1280
+ tokenPaths.set(formated, /* @__PURE__ */ new Set());
1281
+ }
1272
1282
  const virtualPath = replaceRootWithColorPalette([...token.path], [...colorPaletteRoot]);
1273
1283
  const virtualName = this.dictionary.formatTokenName(virtualPath);
1274
1284
  const virtualToken = byName.get(virtualName);
1275
1285
  if (!virtualToken) return;
1276
1286
  const virtualVar = virtualToken.extensions.var;
1277
1287
  group.get(formated).set(virtualVar, token.extensions.varRef);
1288
+ const tokenPath = this.dictionary.formatTokenName(virtualPath.slice(1));
1289
+ tokenPaths.get(formated).add(tokenPath);
1278
1290
  if (extensions.isDefault && colorPaletteRoot.length === 1) {
1279
1291
  const colorPaletteName = this.dictionary.formatTokenName(["colors", "colorPalette"]);
1280
1292
  const colorPaletteToken = byName.get(colorPaletteName);
package/dist/index.mjs CHANGED
@@ -918,6 +918,7 @@ var TokenDictionary = class {
918
918
  node.setExtensions({
919
919
  category,
920
920
  conditions: value,
921
+ rawValue: value,
921
922
  prop: this.formatTokenName(path.slice(1))
922
923
  });
923
924
  if (isDefault) {
@@ -1185,6 +1186,7 @@ var TokenDictionaryView = class {
1185
1186
  const conditionMap = /* @__PURE__ */ new Map();
1186
1187
  const categoryMap = /* @__PURE__ */ new Map();
1187
1188
  const colorPalettes = /* @__PURE__ */ new Map();
1189
+ const colorPaletteTokens = /* @__PURE__ */ new Map();
1188
1190
  const valuesByCategory = /* @__PURE__ */ new Map();
1189
1191
  const flatValues = /* @__PURE__ */ new Map();
1190
1192
  const rawValues = /* @__PURE__ */ new Map();
@@ -1192,7 +1194,7 @@ var TokenDictionaryView = class {
1192
1194
  const vars = /* @__PURE__ */ new Map();
1193
1195
  this.dictionary.allTokens.forEach((token) => {
1194
1196
  this.processCondition(token, conditionMap);
1195
- this.processColorPalette(token, colorPalettes, this.dictionary.byName);
1197
+ this.processColorPalette(token, colorPalettes, colorPaletteTokens, this.dictionary.byName);
1196
1198
  this.processCategory(token, categoryMap);
1197
1199
  this.processValue(token, valuesByCategory, flatValues, rawValues, nameByVar);
1198
1200
  this.processVars(token, vars);
@@ -1218,6 +1220,11 @@ var TokenDictionaryView = class {
1218
1220
  if (result != null) {
1219
1221
  return result;
1220
1222
  }
1223
+ }),
1224
+ getColorPaletteValues: memo((palette) => {
1225
+ const tokens = colorPaletteTokens.get(palette);
1226
+ if (!tokens) return [];
1227
+ return Array.from(tokens).sort();
1221
1228
  })
1222
1229
  };
1223
1230
  }
@@ -1227,7 +1234,7 @@ var TokenDictionaryView = class {
1227
1234
  if (!group.has(condition)) group.set(condition, /* @__PURE__ */ new Set());
1228
1235
  group.get(condition).add(token);
1229
1236
  }
1230
- processColorPalette(token, group, byName) {
1237
+ processColorPalette(token, group, tokenPaths, byName) {
1231
1238
  const extensions = token.extensions;
1232
1239
  const { colorPalette, colorPaletteRoots, isVirtual } = extensions;
1233
1240
  if (!colorPalette || isVirtual) return;
@@ -1236,12 +1243,17 @@ var TokenDictionaryView = class {
1236
1243
  if (!group.has(formated)) {
1237
1244
  group.set(formated, /* @__PURE__ */ new Map());
1238
1245
  }
1246
+ if (!tokenPaths.has(formated)) {
1247
+ tokenPaths.set(formated, /* @__PURE__ */ new Set());
1248
+ }
1239
1249
  const virtualPath = replaceRootWithColorPalette([...token.path], [...colorPaletteRoot]);
1240
1250
  const virtualName = this.dictionary.formatTokenName(virtualPath);
1241
1251
  const virtualToken = byName.get(virtualName);
1242
1252
  if (!virtualToken) return;
1243
1253
  const virtualVar = virtualToken.extensions.var;
1244
1254
  group.get(formated).set(virtualVar, token.extensions.varRef);
1255
+ const tokenPath = this.dictionary.formatTokenName(virtualPath.slice(1));
1256
+ tokenPaths.get(formated).add(tokenPath);
1245
1257
  if (extensions.isDefault && colorPaletteRoot.length === 1) {
1246
1258
  const colorPaletteName = this.dictionary.formatTokenName(["colors", "colorPalette"]);
1247
1259
  const colorPaletteToken = byName.get(colorPaletteName);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pandacss/token-dictionary",
3
- "version": "1.6.1",
3
+ "version": "1.7.1",
4
4
  "description": "Common error messages for css panda",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -35,9 +35,9 @@
35
35
  "dependencies": {
36
36
  "picomatch": "^4.0.0",
37
37
  "ts-pattern": "5.9.0",
38
- "@pandacss/logger": "^1.6.1",
39
- "@pandacss/shared": "1.6.1",
40
- "@pandacss/types": "1.6.1"
38
+ "@pandacss/logger": "^1.7.1",
39
+ "@pandacss/shared": "1.7.1",
40
+ "@pandacss/types": "1.7.1"
41
41
  },
42
42
  "devDependencies": {
43
43
  "@types/picomatch": "4.0.2"