@pandacss/token-dictionary 0.37.1 → 0.38.0

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
@@ -2,9 +2,7 @@ import * as _pandacss_types from '@pandacss/types';
2
2
  import { Tokens, SemanticTokens, ThemeVariantsMap, Token as Token$1 } from '@pandacss/types';
3
3
  import { CssVarOptions, CssVar } from '@pandacss/shared';
4
4
 
5
- type TokenStatus = 'deprecated' | 'experimental' | 'new';
6
5
  interface ExtensionData {
7
- status?: TokenStatus;
8
6
  category?: string;
9
7
  references?: TokenReferences;
10
8
  condition?: string;
@@ -20,12 +18,13 @@ interface TokenReferences {
20
18
  type TokenExtensions<T = {}> = ExtensionData & {
21
19
  [key: string]: any;
22
20
  } & T;
23
- interface ExtendedToken {
21
+ interface TokenInput {
24
22
  name: string;
25
23
  value: any;
26
24
  type?: string;
27
25
  path?: string[];
28
26
  description?: string;
27
+ deprecated?: boolean | string;
29
28
  extensions?: TokenExtensions;
30
29
  }
31
30
  /**
@@ -38,8 +37,9 @@ declare class Token {
38
37
  path: string[];
39
38
  type?: string;
40
39
  description?: string;
40
+ deprecated?: boolean | string;
41
41
  extensions: TokenExtensions;
42
- constructor(data: ExtendedToken);
42
+ constructor(input: TokenInput);
43
43
  /**
44
44
  * The unique identifier of the token.
45
45
  */
@@ -110,6 +110,7 @@ declare class TokenDictionary {
110
110
  private options;
111
111
  allTokens: Token[];
112
112
  byName: Map<string, Token>;
113
+ private deprecated;
113
114
  constructor(options: TokenDictionaryOptions);
114
115
  init(): this;
115
116
  get prefix(): string | undefined;
@@ -154,6 +155,7 @@ declare class TokenDictionary {
154
155
  * Resolve token references to their actual raw value (recursively resolves references)
155
156
  */
156
157
  deepResolveReference(originalValue: string): string | undefined;
158
+ isDeprecated(name: string): boolean;
157
159
  build(): this;
158
160
  get isEmpty(): boolean;
159
161
  view: ReturnType<TokenDictionaryView['getTokensView']>;
@@ -170,6 +172,7 @@ declare class TokenDictionaryView {
170
172
  values: Map<string, string>;
171
173
  nameByVar: Map<string, string>;
172
174
  json: Record<string, Record<string, string>>;
175
+ valuesByCategory: Map<keyof _pandacss_types.TokenDataTypes, Map<string, string>>;
173
176
  get: (path: string, fallback?: string | number) => string;
174
177
  getCategoryValues: (category: string) => Record<string, string> | undefined;
175
178
  };
package/dist/index.d.ts CHANGED
@@ -2,9 +2,7 @@ import * as _pandacss_types from '@pandacss/types';
2
2
  import { Tokens, SemanticTokens, ThemeVariantsMap, Token as Token$1 } from '@pandacss/types';
3
3
  import { CssVarOptions, CssVar } from '@pandacss/shared';
4
4
 
5
- type TokenStatus = 'deprecated' | 'experimental' | 'new';
6
5
  interface ExtensionData {
7
- status?: TokenStatus;
8
6
  category?: string;
9
7
  references?: TokenReferences;
10
8
  condition?: string;
@@ -20,12 +18,13 @@ interface TokenReferences {
20
18
  type TokenExtensions<T = {}> = ExtensionData & {
21
19
  [key: string]: any;
22
20
  } & T;
23
- interface ExtendedToken {
21
+ interface TokenInput {
24
22
  name: string;
25
23
  value: any;
26
24
  type?: string;
27
25
  path?: string[];
28
26
  description?: string;
27
+ deprecated?: boolean | string;
29
28
  extensions?: TokenExtensions;
30
29
  }
31
30
  /**
@@ -38,8 +37,9 @@ declare class Token {
38
37
  path: string[];
39
38
  type?: string;
40
39
  description?: string;
40
+ deprecated?: boolean | string;
41
41
  extensions: TokenExtensions;
42
- constructor(data: ExtendedToken);
42
+ constructor(input: TokenInput);
43
43
  /**
44
44
  * The unique identifier of the token.
45
45
  */
@@ -110,6 +110,7 @@ declare class TokenDictionary {
110
110
  private options;
111
111
  allTokens: Token[];
112
112
  byName: Map<string, Token>;
113
+ private deprecated;
113
114
  constructor(options: TokenDictionaryOptions);
114
115
  init(): this;
115
116
  get prefix(): string | undefined;
@@ -154,6 +155,7 @@ declare class TokenDictionary {
154
155
  * Resolve token references to their actual raw value (recursively resolves references)
155
156
  */
156
157
  deepResolveReference(originalValue: string): string | undefined;
158
+ isDeprecated(name: string): boolean;
157
159
  build(): this;
158
160
  get isEmpty(): boolean;
159
161
  view: ReturnType<TokenDictionaryView['getTokensView']>;
@@ -170,6 +172,7 @@ declare class TokenDictionaryView {
170
172
  values: Map<string, string>;
171
173
  nameByVar: Map<string, string>;
172
174
  json: Record<string, Record<string, string>>;
175
+ valuesByCategory: Map<keyof _pandacss_types.TokenDataTypes, Map<string, string>>;
173
176
  get: (path: string, fallback?: string | number) => string;
174
177
  getCategoryValues: (category: string) => Record<string, string> | undefined;
175
178
  };
package/dist/index.js CHANGED
@@ -153,20 +153,22 @@ var Token = class _Token {
153
153
  path;
154
154
  type;
155
155
  description;
156
+ deprecated;
156
157
  extensions;
157
- constructor(data) {
158
- this.name = data.name;
159
- this.value = data.value;
160
- this.originalValue = data.value;
161
- this.path = data.path ?? [];
162
- if (data.type) {
163
- this.type = data.type;
158
+ constructor(input) {
159
+ this.name = input.name;
160
+ this.value = input.value;
161
+ this.originalValue = input.value;
162
+ this.path = input.path ?? [];
163
+ if (input.type) {
164
+ this.type = input.type;
164
165
  }
165
- if (data.description) {
166
- this.description = data.description;
166
+ if (input.description) {
167
+ this.description = input.description;
167
168
  }
168
- this.extensions = data.extensions ?? {};
169
- this.extensions.condition = data.extensions?.condition ?? "base";
169
+ this.extensions = input.extensions ?? {};
170
+ this.extensions.condition = input.extensions?.condition ?? "base";
171
+ this.deprecated = input.deprecated;
170
172
  this.setType();
171
173
  }
172
174
  /**
@@ -736,6 +738,7 @@ var TokenDictionary = class {
736
738
  }
737
739
  allTokens = [];
738
740
  byName = /* @__PURE__ */ new Map();
741
+ deprecated = /* @__PURE__ */ new Set();
739
742
  init() {
740
743
  this.registerTokens();
741
744
  this.registerTransform(...transforms);
@@ -849,6 +852,9 @@ var TokenDictionary = class {
849
852
  registerToken = (token, transformPhase) => {
850
853
  this.allTokens.push(token);
851
854
  this.byName.set(token.name, token);
855
+ if (token.deprecated) {
856
+ this.deprecated.add(token.name);
857
+ }
852
858
  if (transformPhase) {
853
859
  this.transforms.forEach((transform) => {
854
860
  if (transform.enforce === transformPhase) {
@@ -1033,6 +1039,9 @@ var TokenDictionary = class {
1033
1039
  return next;
1034
1040
  }
1035
1041
  }
1042
+ isDeprecated(name) {
1043
+ return this.deprecated.has(name);
1044
+ }
1036
1045
  build() {
1037
1046
  this.applyMiddlewares("pre");
1038
1047
  this.transformTokens("pre");
@@ -1082,6 +1091,7 @@ var TokenDictionaryView = class {
1082
1091
  values: flatValues,
1083
1092
  nameByVar,
1084
1093
  json,
1094
+ valuesByCategory,
1085
1095
  get: (0, import_shared5.memo)((path, fallback) => {
1086
1096
  return flatValues.get(path) ?? fallback;
1087
1097
  }),
package/dist/index.mjs CHANGED
@@ -128,20 +128,22 @@ var Token = class _Token {
128
128
  path;
129
129
  type;
130
130
  description;
131
+ deprecated;
131
132
  extensions;
132
- constructor(data) {
133
- this.name = data.name;
134
- this.value = data.value;
135
- this.originalValue = data.value;
136
- this.path = data.path ?? [];
137
- if (data.type) {
138
- this.type = data.type;
133
+ constructor(input) {
134
+ this.name = input.name;
135
+ this.value = input.value;
136
+ this.originalValue = input.value;
137
+ this.path = input.path ?? [];
138
+ if (input.type) {
139
+ this.type = input.type;
139
140
  }
140
- if (data.description) {
141
- this.description = data.description;
141
+ if (input.description) {
142
+ this.description = input.description;
142
143
  }
143
- this.extensions = data.extensions ?? {};
144
- this.extensions.condition = data.extensions?.condition ?? "base";
144
+ this.extensions = input.extensions ?? {};
145
+ this.extensions.condition = input.extensions?.condition ?? "base";
146
+ this.deprecated = input.deprecated;
145
147
  this.setType();
146
148
  }
147
149
  /**
@@ -711,6 +713,7 @@ var TokenDictionary = class {
711
713
  }
712
714
  allTokens = [];
713
715
  byName = /* @__PURE__ */ new Map();
716
+ deprecated = /* @__PURE__ */ new Set();
714
717
  init() {
715
718
  this.registerTokens();
716
719
  this.registerTransform(...transforms);
@@ -824,6 +827,9 @@ var TokenDictionary = class {
824
827
  registerToken = (token, transformPhase) => {
825
828
  this.allTokens.push(token);
826
829
  this.byName.set(token.name, token);
830
+ if (token.deprecated) {
831
+ this.deprecated.add(token.name);
832
+ }
827
833
  if (transformPhase) {
828
834
  this.transforms.forEach((transform) => {
829
835
  if (transform.enforce === transformPhase) {
@@ -1008,6 +1014,9 @@ var TokenDictionary = class {
1008
1014
  return next;
1009
1015
  }
1010
1016
  }
1017
+ isDeprecated(name) {
1018
+ return this.deprecated.has(name);
1019
+ }
1011
1020
  build() {
1012
1021
  this.applyMiddlewares("pre");
1013
1022
  this.transformTokens("pre");
@@ -1057,6 +1066,7 @@ var TokenDictionaryView = class {
1057
1066
  values: flatValues,
1058
1067
  nameByVar,
1059
1068
  json,
1069
+ valuesByCategory,
1060
1070
  get: memo((path, fallback) => {
1061
1071
  return flatValues.get(path) ?? fallback;
1062
1072
  }),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pandacss/token-dictionary",
3
- "version": "0.37.1",
3
+ "version": "0.38.0",
4
4
  "description": "Common error messages for css panda",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -33,9 +33,9 @@
33
33
  ],
34
34
  "dependencies": {
35
35
  "ts-pattern": "5.0.8",
36
- "@pandacss/logger": "^0.37.1",
37
- "@pandacss/shared": "0.37.1",
38
- "@pandacss/types": "0.37.1"
36
+ "@pandacss/logger": "^0.38.0",
37
+ "@pandacss/shared": "0.38.0",
38
+ "@pandacss/types": "0.38.0"
39
39
  },
40
40
  "scripts": {
41
41
  "build": "tsup src/index.ts --format=esm,cjs --dts",