@pandacss/token-dictionary 0.0.0-dev-20230515185817 → 0.0.0-dev-20230516103848
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 +3 -0
- package/dist/index.js +13 -8
- package/dist/index.mjs +13 -8
- package/package.json +4 -4
package/dist/index.d.ts
CHANGED
|
@@ -78,6 +78,7 @@ declare class Token {
|
|
|
78
78
|
type EnforcePhase = 'pre' | 'post';
|
|
79
79
|
type Options = {
|
|
80
80
|
prefix?: string;
|
|
81
|
+
hash?: boolean;
|
|
81
82
|
};
|
|
82
83
|
type TokenTransformer = {
|
|
83
84
|
name: string;
|
|
@@ -91,6 +92,7 @@ type TokenDictionaryOptions = {
|
|
|
91
92
|
semanticTokens?: SemanticTokens;
|
|
92
93
|
breakpoints?: Record<string, string>;
|
|
93
94
|
prefix?: string;
|
|
95
|
+
hash?: boolean;
|
|
94
96
|
};
|
|
95
97
|
type TokenMiddleware = {
|
|
96
98
|
enforce?: EnforcePhase;
|
|
@@ -99,6 +101,7 @@ type TokenMiddleware = {
|
|
|
99
101
|
declare class TokenDictionary$1 {
|
|
100
102
|
allTokens: Token[];
|
|
101
103
|
prefix: string | undefined;
|
|
104
|
+
hash: boolean | undefined;
|
|
102
105
|
get allNames(): string[];
|
|
103
106
|
constructor(options: TokenDictionaryOptions);
|
|
104
107
|
getByName: (name: string) => Token | undefined;
|
package/dist/index.js
CHANGED
|
@@ -235,11 +235,12 @@ function expandBreakpoints(breakpoints) {
|
|
|
235
235
|
var TokenDictionary = class {
|
|
236
236
|
allTokens = [];
|
|
237
237
|
prefix;
|
|
238
|
+
hash;
|
|
238
239
|
get allNames() {
|
|
239
240
|
return Array.from(new Set(this.allTokens.map((token) => token.name)));
|
|
240
241
|
}
|
|
241
242
|
constructor(options) {
|
|
242
|
-
const { tokens = {}, semanticTokens = {}, breakpoints, prefix } = options;
|
|
243
|
+
const { tokens = {}, semanticTokens = {}, breakpoints, prefix, hash } = options;
|
|
243
244
|
const breakpointTokens = expandBreakpoints(breakpoints);
|
|
244
245
|
const computedTokens = (0, import_shared3.compact)({
|
|
245
246
|
...tokens,
|
|
@@ -250,6 +251,7 @@ var TokenDictionary = class {
|
|
|
250
251
|
}
|
|
251
252
|
});
|
|
252
253
|
this.prefix = prefix;
|
|
254
|
+
this.hash = hash;
|
|
253
255
|
(0, import_shared3.walkObject)(
|
|
254
256
|
computedTokens,
|
|
255
257
|
(token, path) => {
|
|
@@ -313,7 +315,10 @@ var TokenDictionary = class {
|
|
|
313
315
|
return;
|
|
314
316
|
if (typeof transform.match === "function" && !transform.match(token))
|
|
315
317
|
return;
|
|
316
|
-
const transformed = transform.transform(token, {
|
|
318
|
+
const transformed = transform.transform(token, {
|
|
319
|
+
prefix: this.prefix,
|
|
320
|
+
hash: this.hash
|
|
321
|
+
});
|
|
317
322
|
(0, import_ts_pattern.match)(transform).with({ type: "extensions" }, () => {
|
|
318
323
|
token.setExtensions(transformed);
|
|
319
324
|
}).with({ type: "value" }, () => {
|
|
@@ -497,13 +502,13 @@ var formats = {
|
|
|
497
502
|
var import_shared5 = require("@pandacss/shared");
|
|
498
503
|
var addNegativeTokens = {
|
|
499
504
|
enforce: "pre",
|
|
500
|
-
transform(dictionary, { prefix }) {
|
|
505
|
+
transform(dictionary, { prefix, hash }) {
|
|
501
506
|
const tokens = dictionary.filter({
|
|
502
507
|
extensions: { category: "spacing" }
|
|
503
508
|
});
|
|
504
509
|
tokens.forEach((token) => {
|
|
505
510
|
const originalPath = [...token.path];
|
|
506
|
-
const originalVar = (0, import_shared5.cssVar)(originalPath.join("-"), { prefix });
|
|
511
|
+
const originalVar = (0, import_shared5.cssVar)(originalPath.join("-"), { prefix, hash });
|
|
507
512
|
const node = token.clone();
|
|
508
513
|
node.setExtensions({
|
|
509
514
|
isNegative: true,
|
|
@@ -768,10 +773,10 @@ var transformAssets = {
|
|
|
768
773
|
var addCssVariables = {
|
|
769
774
|
type: "extensions",
|
|
770
775
|
name: "tokens/css-var",
|
|
771
|
-
transform(token, { prefix }) {
|
|
776
|
+
transform(token, { prefix, hash }) {
|
|
772
777
|
const { isNegative, originalPath } = token.extensions;
|
|
773
778
|
const pathValue = isNegative ? originalPath : token.path;
|
|
774
|
-
const variable = (0, import_shared6.cssVar)(pathValue.join("-"), { prefix });
|
|
779
|
+
const variable = (0, import_shared6.cssVar)(pathValue.join("-"), { prefix, hash });
|
|
775
780
|
return {
|
|
776
781
|
var: variable.var,
|
|
777
782
|
varRef: variable.ref
|
|
@@ -781,12 +786,12 @@ var addCssVariables = {
|
|
|
781
786
|
var addConditionalCssVariables = {
|
|
782
787
|
enforce: "post",
|
|
783
788
|
name: "tokens/conditionals",
|
|
784
|
-
transform(token, { prefix }) {
|
|
789
|
+
transform(token, { prefix, hash }) {
|
|
785
790
|
const refs = getReferences(token.value);
|
|
786
791
|
if (!refs.length)
|
|
787
792
|
return token.value;
|
|
788
793
|
refs.forEach((ref) => {
|
|
789
|
-
const variable = (0, import_shared6.cssVar)(ref.split(".").join("-"), { prefix }).ref;
|
|
794
|
+
const variable = (0, import_shared6.cssVar)(ref.split(".").join("-"), { prefix, hash }).ref;
|
|
790
795
|
token.value = token.value.replace(`{${ref}}`, variable);
|
|
791
796
|
});
|
|
792
797
|
return token.value;
|
package/dist/index.mjs
CHANGED
|
@@ -209,11 +209,12 @@ function expandBreakpoints(breakpoints) {
|
|
|
209
209
|
var TokenDictionary = class {
|
|
210
210
|
allTokens = [];
|
|
211
211
|
prefix;
|
|
212
|
+
hash;
|
|
212
213
|
get allNames() {
|
|
213
214
|
return Array.from(new Set(this.allTokens.map((token) => token.name)));
|
|
214
215
|
}
|
|
215
216
|
constructor(options) {
|
|
216
|
-
const { tokens = {}, semanticTokens = {}, breakpoints, prefix } = options;
|
|
217
|
+
const { tokens = {}, semanticTokens = {}, breakpoints, prefix, hash } = options;
|
|
217
218
|
const breakpointTokens = expandBreakpoints(breakpoints);
|
|
218
219
|
const computedTokens = compact({
|
|
219
220
|
...tokens,
|
|
@@ -224,6 +225,7 @@ var TokenDictionary = class {
|
|
|
224
225
|
}
|
|
225
226
|
});
|
|
226
227
|
this.prefix = prefix;
|
|
228
|
+
this.hash = hash;
|
|
227
229
|
walkObject2(
|
|
228
230
|
computedTokens,
|
|
229
231
|
(token, path) => {
|
|
@@ -287,7 +289,10 @@ var TokenDictionary = class {
|
|
|
287
289
|
return;
|
|
288
290
|
if (typeof transform.match === "function" && !transform.match(token))
|
|
289
291
|
return;
|
|
290
|
-
const transformed = transform.transform(token, {
|
|
292
|
+
const transformed = transform.transform(token, {
|
|
293
|
+
prefix: this.prefix,
|
|
294
|
+
hash: this.hash
|
|
295
|
+
});
|
|
291
296
|
match(transform).with({ type: "extensions" }, () => {
|
|
292
297
|
token.setExtensions(transformed);
|
|
293
298
|
}).with({ type: "value" }, () => {
|
|
@@ -471,13 +476,13 @@ var formats = {
|
|
|
471
476
|
import { calc, cssVar } from "@pandacss/shared";
|
|
472
477
|
var addNegativeTokens = {
|
|
473
478
|
enforce: "pre",
|
|
474
|
-
transform(dictionary, { prefix }) {
|
|
479
|
+
transform(dictionary, { prefix, hash }) {
|
|
475
480
|
const tokens = dictionary.filter({
|
|
476
481
|
extensions: { category: "spacing" }
|
|
477
482
|
});
|
|
478
483
|
tokens.forEach((token) => {
|
|
479
484
|
const originalPath = [...token.path];
|
|
480
|
-
const originalVar = cssVar(originalPath.join("-"), { prefix });
|
|
485
|
+
const originalVar = cssVar(originalPath.join("-"), { prefix, hash });
|
|
481
486
|
const node = token.clone();
|
|
482
487
|
node.setExtensions({
|
|
483
488
|
isNegative: true,
|
|
@@ -742,10 +747,10 @@ var transformAssets = {
|
|
|
742
747
|
var addCssVariables = {
|
|
743
748
|
type: "extensions",
|
|
744
749
|
name: "tokens/css-var",
|
|
745
|
-
transform(token, { prefix }) {
|
|
750
|
+
transform(token, { prefix, hash }) {
|
|
746
751
|
const { isNegative, originalPath } = token.extensions;
|
|
747
752
|
const pathValue = isNegative ? originalPath : token.path;
|
|
748
|
-
const variable = cssVar2(pathValue.join("-"), { prefix });
|
|
753
|
+
const variable = cssVar2(pathValue.join("-"), { prefix, hash });
|
|
749
754
|
return {
|
|
750
755
|
var: variable.var,
|
|
751
756
|
varRef: variable.ref
|
|
@@ -755,12 +760,12 @@ var addCssVariables = {
|
|
|
755
760
|
var addConditionalCssVariables = {
|
|
756
761
|
enforce: "post",
|
|
757
762
|
name: "tokens/conditionals",
|
|
758
|
-
transform(token, { prefix }) {
|
|
763
|
+
transform(token, { prefix, hash }) {
|
|
759
764
|
const refs = getReferences(token.value);
|
|
760
765
|
if (!refs.length)
|
|
761
766
|
return token.value;
|
|
762
767
|
refs.forEach((ref) => {
|
|
763
|
-
const variable = cssVar2(ref.split(".").join("-"), { prefix }).ref;
|
|
768
|
+
const variable = cssVar2(ref.split(".").join("-"), { prefix, hash }).ref;
|
|
764
769
|
token.value = token.value.replace(`{${ref}}`, variable);
|
|
765
770
|
});
|
|
766
771
|
return token.value;
|
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-20230516103848",
|
|
4
4
|
"description": "Common error messages for css panda",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -15,11 +15,11 @@
|
|
|
15
15
|
],
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"ts-pattern": "4.3.0",
|
|
18
|
-
"@pandacss/types": "0.0.0-dev-
|
|
19
|
-
"@pandacss/shared": "0.0.0-dev-
|
|
18
|
+
"@pandacss/types": "0.0.0-dev-20230516103848",
|
|
19
|
+
"@pandacss/shared": "0.0.0-dev-20230516103848"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
|
-
"@pandacss/fixture": "0.0.0-dev-
|
|
22
|
+
"@pandacss/fixture": "0.0.0-dev-20230516103848"
|
|
23
23
|
},
|
|
24
24
|
"scripts": {
|
|
25
25
|
"build": "tsup src/index.ts --format=esm,cjs --dts",
|