@pandacss/token-dictionary 0.0.0-dev-20221128134624 → 0.0.0-dev-20221128152909
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.ts +1 -1
- package/dist/index.js +26 -26
- package/dist/index.mjs +26 -26
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -195,7 +195,7 @@ declare class TokenDictionary extends TokenDictionary$1 {
|
|
|
195
195
|
get conditionMap(): Map<string, Set<Token>>;
|
|
196
196
|
get categoryMap(): Map<string, Map<string, Token>>;
|
|
197
197
|
get values(): Map<string, Map<string, string>>;
|
|
198
|
-
get
|
|
198
|
+
get colorPalettes(): {
|
|
199
199
|
clear: never;
|
|
200
200
|
delete: never;
|
|
201
201
|
forEach: never;
|
package/dist/index.js
CHANGED
|
@@ -373,19 +373,19 @@ var formats = {
|
|
|
373
373
|
});
|
|
374
374
|
return grouped;
|
|
375
375
|
},
|
|
376
|
-
|
|
376
|
+
groupByColorPalette(dictionary) {
|
|
377
377
|
const grouped = /* @__PURE__ */ new Map();
|
|
378
378
|
dictionary.allTokens.forEach((token) => {
|
|
379
|
-
const {
|
|
380
|
-
if (!
|
|
379
|
+
const { colorPalette } = token.extensions;
|
|
380
|
+
if (!colorPalette || token.extensions.isVirtual)
|
|
381
381
|
return;
|
|
382
|
-
grouped.get(
|
|
383
|
-
const virtualName = token.name.replace(
|
|
382
|
+
grouped.get(colorPalette) || grouped.set(colorPalette, /* @__PURE__ */ new Map());
|
|
383
|
+
const virtualName = token.name.replace(colorPalette, "colorPalette");
|
|
384
384
|
const virtualToken = dictionary.getByName(virtualName);
|
|
385
385
|
if (!virtualToken)
|
|
386
386
|
return;
|
|
387
387
|
const virtualVar = virtualToken.extensions.var;
|
|
388
|
-
grouped.get(
|
|
388
|
+
grouped.get(colorPalette).set(virtualVar, token.extensions.varRef);
|
|
389
389
|
});
|
|
390
390
|
return grouped;
|
|
391
391
|
},
|
|
@@ -432,13 +432,13 @@ var formats = {
|
|
|
432
432
|
return (0, import_shared4.getDotPath)(flatValues, path, fallback);
|
|
433
433
|
};
|
|
434
434
|
},
|
|
435
|
-
|
|
435
|
+
getColorPaletteValues(dictionary) {
|
|
436
436
|
const values = /* @__PURE__ */ new Set();
|
|
437
437
|
dictionary.allTokens.forEach((token) => {
|
|
438
|
-
const {
|
|
439
|
-
if (!
|
|
438
|
+
const { colorPalette } = token.extensions;
|
|
439
|
+
if (!colorPalette || token.extensions.isVirtual)
|
|
440
440
|
return;
|
|
441
|
-
values.add(
|
|
441
|
+
values.add(colorPalette);
|
|
442
442
|
});
|
|
443
443
|
return values;
|
|
444
444
|
}
|
|
@@ -480,25 +480,25 @@ var addVirtualPalette = {
|
|
|
480
480
|
extensions: { category: "colors" }
|
|
481
481
|
});
|
|
482
482
|
const keys = /* @__PURE__ */ new Set();
|
|
483
|
-
const
|
|
483
|
+
const colorPalettes = /* @__PURE__ */ new Map();
|
|
484
484
|
tokens.forEach((token) => {
|
|
485
|
-
const
|
|
486
|
-
if (!
|
|
485
|
+
const { colorPalette } = token.extensions;
|
|
486
|
+
if (!colorPalette)
|
|
487
487
|
return;
|
|
488
|
-
const list =
|
|
488
|
+
const list = colorPalettes.get(colorPalette) || [];
|
|
489
489
|
keys.add(token.path.at(-1));
|
|
490
490
|
list.push(token);
|
|
491
|
-
|
|
491
|
+
colorPalettes.set(colorPalette, list);
|
|
492
492
|
});
|
|
493
493
|
keys.forEach((key) => {
|
|
494
494
|
const node = new Token({
|
|
495
|
-
name: `colors.
|
|
496
|
-
value: `{colors.
|
|
497
|
-
path: ["colors", "
|
|
495
|
+
name: `colors.colorPalette.${key}`,
|
|
496
|
+
value: `{colors.colorPalette.${key}}`,
|
|
497
|
+
path: ["colors", "colorPalette", key]
|
|
498
498
|
});
|
|
499
499
|
node.setExtensions({
|
|
500
500
|
category: "colors",
|
|
501
|
-
prop: `
|
|
501
|
+
prop: `colorPalette.${key}`,
|
|
502
502
|
isVirtual: true
|
|
503
503
|
});
|
|
504
504
|
dictionary.allTokens.push(node);
|
|
@@ -626,7 +626,7 @@ var addConditionalCssVariables = {
|
|
|
626
626
|
return token.value;
|
|
627
627
|
}
|
|
628
628
|
};
|
|
629
|
-
function
|
|
629
|
+
function getColorPaletteName(path) {
|
|
630
630
|
if (path.includes("colorPalette"))
|
|
631
631
|
return "";
|
|
632
632
|
const clone = [...path];
|
|
@@ -634,14 +634,14 @@ function getPaletteName(path) {
|
|
|
634
634
|
clone.shift();
|
|
635
635
|
return clone.join(".");
|
|
636
636
|
}
|
|
637
|
-
var
|
|
637
|
+
var addColorPalette = {
|
|
638
638
|
type: "extensions",
|
|
639
|
-
name: "tokens/colors/
|
|
639
|
+
name: "tokens/colors/colorPalette",
|
|
640
640
|
match(token) {
|
|
641
641
|
return token.extensions.category === "colors";
|
|
642
642
|
},
|
|
643
643
|
transform(token) {
|
|
644
|
-
return {
|
|
644
|
+
return { colorPalette: getColorPaletteName(token.path) };
|
|
645
645
|
}
|
|
646
646
|
};
|
|
647
647
|
var transforms = [
|
|
@@ -652,7 +652,7 @@ var transforms = [
|
|
|
652
652
|
transformBorders,
|
|
653
653
|
addCssVariables,
|
|
654
654
|
addConditionalCssVariables,
|
|
655
|
-
|
|
655
|
+
addColorPalette
|
|
656
656
|
];
|
|
657
657
|
|
|
658
658
|
// src/create-dictionary.ts
|
|
@@ -675,8 +675,8 @@ var TokenDictionary2 = class extends TokenDictionary {
|
|
|
675
675
|
get values() {
|
|
676
676
|
return formats.getFlattenedValues(this);
|
|
677
677
|
}
|
|
678
|
-
get
|
|
679
|
-
return (0, import_shared7.mapToJson)(formats.
|
|
678
|
+
get colorPalettes() {
|
|
679
|
+
return (0, import_shared7.mapToJson)(formats.groupByColorPalette(this));
|
|
680
680
|
}
|
|
681
681
|
get vars() {
|
|
682
682
|
return formats.getVars(this);
|
package/dist/index.mjs
CHANGED
|
@@ -347,19 +347,19 @@ var formats = {
|
|
|
347
347
|
});
|
|
348
348
|
return grouped;
|
|
349
349
|
},
|
|
350
|
-
|
|
350
|
+
groupByColorPalette(dictionary) {
|
|
351
351
|
const grouped = /* @__PURE__ */ new Map();
|
|
352
352
|
dictionary.allTokens.forEach((token) => {
|
|
353
|
-
const {
|
|
354
|
-
if (!
|
|
353
|
+
const { colorPalette } = token.extensions;
|
|
354
|
+
if (!colorPalette || token.extensions.isVirtual)
|
|
355
355
|
return;
|
|
356
|
-
grouped.get(
|
|
357
|
-
const virtualName = token.name.replace(
|
|
356
|
+
grouped.get(colorPalette) || grouped.set(colorPalette, /* @__PURE__ */ new Map());
|
|
357
|
+
const virtualName = token.name.replace(colorPalette, "colorPalette");
|
|
358
358
|
const virtualToken = dictionary.getByName(virtualName);
|
|
359
359
|
if (!virtualToken)
|
|
360
360
|
return;
|
|
361
361
|
const virtualVar = virtualToken.extensions.var;
|
|
362
|
-
grouped.get(
|
|
362
|
+
grouped.get(colorPalette).set(virtualVar, token.extensions.varRef);
|
|
363
363
|
});
|
|
364
364
|
return grouped;
|
|
365
365
|
},
|
|
@@ -406,13 +406,13 @@ var formats = {
|
|
|
406
406
|
return getDotPath(flatValues, path, fallback);
|
|
407
407
|
};
|
|
408
408
|
},
|
|
409
|
-
|
|
409
|
+
getColorPaletteValues(dictionary) {
|
|
410
410
|
const values = /* @__PURE__ */ new Set();
|
|
411
411
|
dictionary.allTokens.forEach((token) => {
|
|
412
|
-
const {
|
|
413
|
-
if (!
|
|
412
|
+
const { colorPalette } = token.extensions;
|
|
413
|
+
if (!colorPalette || token.extensions.isVirtual)
|
|
414
414
|
return;
|
|
415
|
-
values.add(
|
|
415
|
+
values.add(colorPalette);
|
|
416
416
|
});
|
|
417
417
|
return values;
|
|
418
418
|
}
|
|
@@ -454,25 +454,25 @@ var addVirtualPalette = {
|
|
|
454
454
|
extensions: { category: "colors" }
|
|
455
455
|
});
|
|
456
456
|
const keys = /* @__PURE__ */ new Set();
|
|
457
|
-
const
|
|
457
|
+
const colorPalettes = /* @__PURE__ */ new Map();
|
|
458
458
|
tokens.forEach((token) => {
|
|
459
|
-
const
|
|
460
|
-
if (!
|
|
459
|
+
const { colorPalette } = token.extensions;
|
|
460
|
+
if (!colorPalette)
|
|
461
461
|
return;
|
|
462
|
-
const list =
|
|
462
|
+
const list = colorPalettes.get(colorPalette) || [];
|
|
463
463
|
keys.add(token.path.at(-1));
|
|
464
464
|
list.push(token);
|
|
465
|
-
|
|
465
|
+
colorPalettes.set(colorPalette, list);
|
|
466
466
|
});
|
|
467
467
|
keys.forEach((key) => {
|
|
468
468
|
const node = new Token({
|
|
469
|
-
name: `colors.
|
|
470
|
-
value: `{colors.
|
|
471
|
-
path: ["colors", "
|
|
469
|
+
name: `colors.colorPalette.${key}`,
|
|
470
|
+
value: `{colors.colorPalette.${key}}`,
|
|
471
|
+
path: ["colors", "colorPalette", key]
|
|
472
472
|
});
|
|
473
473
|
node.setExtensions({
|
|
474
474
|
category: "colors",
|
|
475
|
-
prop: `
|
|
475
|
+
prop: `colorPalette.${key}`,
|
|
476
476
|
isVirtual: true
|
|
477
477
|
});
|
|
478
478
|
dictionary.allTokens.push(node);
|
|
@@ -600,7 +600,7 @@ var addConditionalCssVariables = {
|
|
|
600
600
|
return token.value;
|
|
601
601
|
}
|
|
602
602
|
};
|
|
603
|
-
function
|
|
603
|
+
function getColorPaletteName(path) {
|
|
604
604
|
if (path.includes("colorPalette"))
|
|
605
605
|
return "";
|
|
606
606
|
const clone = [...path];
|
|
@@ -608,14 +608,14 @@ function getPaletteName(path) {
|
|
|
608
608
|
clone.shift();
|
|
609
609
|
return clone.join(".");
|
|
610
610
|
}
|
|
611
|
-
var
|
|
611
|
+
var addColorPalette = {
|
|
612
612
|
type: "extensions",
|
|
613
|
-
name: "tokens/colors/
|
|
613
|
+
name: "tokens/colors/colorPalette",
|
|
614
614
|
match(token) {
|
|
615
615
|
return token.extensions.category === "colors";
|
|
616
616
|
},
|
|
617
617
|
transform(token) {
|
|
618
|
-
return {
|
|
618
|
+
return { colorPalette: getColorPaletteName(token.path) };
|
|
619
619
|
}
|
|
620
620
|
};
|
|
621
621
|
var transforms = [
|
|
@@ -626,7 +626,7 @@ var transforms = [
|
|
|
626
626
|
transformBorders,
|
|
627
627
|
addCssVariables,
|
|
628
628
|
addConditionalCssVariables,
|
|
629
|
-
|
|
629
|
+
addColorPalette
|
|
630
630
|
];
|
|
631
631
|
|
|
632
632
|
// src/create-dictionary.ts
|
|
@@ -649,8 +649,8 @@ var TokenDictionary2 = class extends TokenDictionary {
|
|
|
649
649
|
get values() {
|
|
650
650
|
return formats.getFlattenedValues(this);
|
|
651
651
|
}
|
|
652
|
-
get
|
|
653
|
-
return mapToJson2(formats.
|
|
652
|
+
get colorPalettes() {
|
|
653
|
+
return mapToJson2(formats.groupByColorPalette(this));
|
|
654
654
|
}
|
|
655
655
|
get vars() {
|
|
656
656
|
return formats.getVars(this);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pandacss/token-dictionary",
|
|
3
|
-
"version": "0.0.0-dev-
|
|
3
|
+
"version": "0.0.0-dev-20221128152909",
|
|
4
4
|
"description": "Common error messages for css panda",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -15,10 +15,10 @@
|
|
|
15
15
|
],
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"ts-pattern": "4.0.6",
|
|
18
|
-
"@pandacss/shared": "0.0.0-dev-
|
|
18
|
+
"@pandacss/shared": "0.0.0-dev-20221128152909"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
|
-
"@pandacss/fixture": "0.0.0-dev-
|
|
21
|
+
"@pandacss/fixture": "0.0.0-dev-20221128152909"
|
|
22
22
|
},
|
|
23
23
|
"scripts": {
|
|
24
24
|
"build": "tsup src/index.ts --format=esm,cjs --dts",
|