@pandacss/token-dictionary 1.7.0 → 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
@@ -1219,6 +1219,7 @@ var TokenDictionaryView = class {
1219
1219
  const conditionMap = /* @__PURE__ */ new Map();
1220
1220
  const categoryMap = /* @__PURE__ */ new Map();
1221
1221
  const colorPalettes = /* @__PURE__ */ new Map();
1222
+ const colorPaletteTokens = /* @__PURE__ */ new Map();
1222
1223
  const valuesByCategory = /* @__PURE__ */ new Map();
1223
1224
  const flatValues = /* @__PURE__ */ new Map();
1224
1225
  const rawValues = /* @__PURE__ */ new Map();
@@ -1226,7 +1227,7 @@ var TokenDictionaryView = class {
1226
1227
  const vars = /* @__PURE__ */ new Map();
1227
1228
  this.dictionary.allTokens.forEach((token) => {
1228
1229
  this.processCondition(token, conditionMap);
1229
- this.processColorPalette(token, colorPalettes, this.dictionary.byName);
1230
+ this.processColorPalette(token, colorPalettes, colorPaletteTokens, this.dictionary.byName);
1230
1231
  this.processCategory(token, categoryMap);
1231
1232
  this.processValue(token, valuesByCategory, flatValues, rawValues, nameByVar);
1232
1233
  this.processVars(token, vars);
@@ -1252,6 +1253,11 @@ var TokenDictionaryView = class {
1252
1253
  if (result != null) {
1253
1254
  return result;
1254
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();
1255
1261
  })
1256
1262
  };
1257
1263
  }
@@ -1261,7 +1267,7 @@ var TokenDictionaryView = class {
1261
1267
  if (!group.has(condition)) group.set(condition, /* @__PURE__ */ new Set());
1262
1268
  group.get(condition).add(token);
1263
1269
  }
1264
- processColorPalette(token, group, byName) {
1270
+ processColorPalette(token, group, tokenPaths, byName) {
1265
1271
  const extensions = token.extensions;
1266
1272
  const { colorPalette, colorPaletteRoots, isVirtual } = extensions;
1267
1273
  if (!colorPalette || isVirtual) return;
@@ -1270,12 +1276,17 @@ var TokenDictionaryView = class {
1270
1276
  if (!group.has(formated)) {
1271
1277
  group.set(formated, /* @__PURE__ */ new Map());
1272
1278
  }
1279
+ if (!tokenPaths.has(formated)) {
1280
+ tokenPaths.set(formated, /* @__PURE__ */ new Set());
1281
+ }
1273
1282
  const virtualPath = replaceRootWithColorPalette([...token.path], [...colorPaletteRoot]);
1274
1283
  const virtualName = this.dictionary.formatTokenName(virtualPath);
1275
1284
  const virtualToken = byName.get(virtualName);
1276
1285
  if (!virtualToken) return;
1277
1286
  const virtualVar = virtualToken.extensions.var;
1278
1287
  group.get(formated).set(virtualVar, token.extensions.varRef);
1288
+ const tokenPath = this.dictionary.formatTokenName(virtualPath.slice(1));
1289
+ tokenPaths.get(formated).add(tokenPath);
1279
1290
  if (extensions.isDefault && colorPaletteRoot.length === 1) {
1280
1291
  const colorPaletteName = this.dictionary.formatTokenName(["colors", "colorPalette"]);
1281
1292
  const colorPaletteToken = byName.get(colorPaletteName);
package/dist/index.mjs CHANGED
@@ -1186,6 +1186,7 @@ var TokenDictionaryView = class {
1186
1186
  const conditionMap = /* @__PURE__ */ new Map();
1187
1187
  const categoryMap = /* @__PURE__ */ new Map();
1188
1188
  const colorPalettes = /* @__PURE__ */ new Map();
1189
+ const colorPaletteTokens = /* @__PURE__ */ new Map();
1189
1190
  const valuesByCategory = /* @__PURE__ */ new Map();
1190
1191
  const flatValues = /* @__PURE__ */ new Map();
1191
1192
  const rawValues = /* @__PURE__ */ new Map();
@@ -1193,7 +1194,7 @@ var TokenDictionaryView = class {
1193
1194
  const vars = /* @__PURE__ */ new Map();
1194
1195
  this.dictionary.allTokens.forEach((token) => {
1195
1196
  this.processCondition(token, conditionMap);
1196
- this.processColorPalette(token, colorPalettes, this.dictionary.byName);
1197
+ this.processColorPalette(token, colorPalettes, colorPaletteTokens, this.dictionary.byName);
1197
1198
  this.processCategory(token, categoryMap);
1198
1199
  this.processValue(token, valuesByCategory, flatValues, rawValues, nameByVar);
1199
1200
  this.processVars(token, vars);
@@ -1219,6 +1220,11 @@ var TokenDictionaryView = class {
1219
1220
  if (result != null) {
1220
1221
  return result;
1221
1222
  }
1223
+ }),
1224
+ getColorPaletteValues: memo((palette) => {
1225
+ const tokens = colorPaletteTokens.get(palette);
1226
+ if (!tokens) return [];
1227
+ return Array.from(tokens).sort();
1222
1228
  })
1223
1229
  };
1224
1230
  }
@@ -1228,7 +1234,7 @@ var TokenDictionaryView = class {
1228
1234
  if (!group.has(condition)) group.set(condition, /* @__PURE__ */ new Set());
1229
1235
  group.get(condition).add(token);
1230
1236
  }
1231
- processColorPalette(token, group, byName) {
1237
+ processColorPalette(token, group, tokenPaths, byName) {
1232
1238
  const extensions = token.extensions;
1233
1239
  const { colorPalette, colorPaletteRoots, isVirtual } = extensions;
1234
1240
  if (!colorPalette || isVirtual) return;
@@ -1237,12 +1243,17 @@ var TokenDictionaryView = class {
1237
1243
  if (!group.has(formated)) {
1238
1244
  group.set(formated, /* @__PURE__ */ new Map());
1239
1245
  }
1246
+ if (!tokenPaths.has(formated)) {
1247
+ tokenPaths.set(formated, /* @__PURE__ */ new Set());
1248
+ }
1240
1249
  const virtualPath = replaceRootWithColorPalette([...token.path], [...colorPaletteRoot]);
1241
1250
  const virtualName = this.dictionary.formatTokenName(virtualPath);
1242
1251
  const virtualToken = byName.get(virtualName);
1243
1252
  if (!virtualToken) return;
1244
1253
  const virtualVar = virtualToken.extensions.var;
1245
1254
  group.get(formated).set(virtualVar, token.extensions.varRef);
1255
+ const tokenPath = this.dictionary.formatTokenName(virtualPath.slice(1));
1256
+ tokenPaths.get(formated).add(tokenPath);
1246
1257
  if (extensions.isDefault && colorPaletteRoot.length === 1) {
1247
1258
  const colorPaletteName = this.dictionary.formatTokenName(["colors", "colorPalette"]);
1248
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.7.0",
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.7.0",
39
- "@pandacss/shared": "1.7.0",
40
- "@pandacss/types": "1.7.0"
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"