@pandacss/token-dictionary 0.26.2 → 0.27.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
@@ -1,3 +1,4 @@
1
+ import { mapToJson } from '@pandacss/shared';
1
2
  import { Tokens, SemanticTokens } from '@pandacss/types';
2
3
 
3
4
  type TokenStatus = 'deprecated' | 'experimental' | 'new';
@@ -130,31 +131,29 @@ declare class TokenDictionary$1 {
130
131
  get isEmpty(): boolean;
131
132
  }
132
133
 
134
+ declare const formats: {
135
+ groupByCondition(dictionary: TokenDictionary$1): Map<string, Set<Token>>;
136
+ groupByColorPalette(dictionary: TokenDictionary$1): Map<string, Map<string, string>>;
137
+ groupByCategory(dictionary: TokenDictionary$1): Map<string, Map<string, Token>>;
138
+ getFlattenedValues(dictionary: TokenDictionary$1): Map<string, Map<string, string>>;
139
+ getVars(dictionary: TokenDictionary$1): Map<string, Map<string, string>>;
140
+ createVarGetter(dictionary: TokenDictionary$1): (path: string, fallback?: string | number) => string;
141
+ getColorPaletteValues(dictionary: TokenDictionary$1): Set<string>;
142
+ };
143
+
133
144
  declare class TokenDictionary extends TokenDictionary$1 {
145
+ get: ReturnType<typeof formats.createVarGetter>;
146
+ conditionMap: ReturnType<typeof formats.groupByCondition>;
147
+ categoryMap: ReturnType<typeof formats.groupByCategory>;
148
+ values: ReturnType<typeof formats.getFlattenedValues>;
149
+ colorPalettes: ReturnType<typeof formats.groupByColorPalette>;
150
+ vars: ReturnType<typeof formats.getVars>;
151
+ json: ReturnType<typeof mapToJson>;
134
152
  constructor(options: TokenDictionaryOptions);
135
- get get(): (path: string, fallback?: string | number | undefined) => string;
136
- get conditionMap(): Map<string, Set<Token>>;
137
- get categoryMap(): Map<string, Map<string, Token>>;
138
- get values(): Map<string, Map<string, string>>;
139
- get colorPalettes(): {
140
- clear: never;
141
- delete: never;
142
- forEach: never;
143
- get: never;
144
- has: never;
145
- set: never;
146
- readonly size: never;
147
- entries: never;
148
- keys: never;
149
- values: never;
150
- [Symbol.iterator]: never;
151
- readonly [Symbol.toStringTag]: never;
152
- };
153
- get vars(): Map<string, Map<string, string>>;
154
- getValue(path: string): {
153
+ getValue: (path: string) => {
155
154
  [k: string]: string;
156
155
  } | undefined;
157
- getTokenVar(path: string): any;
156
+ getTokenVar: (path: string) => any;
158
157
  expandReference(value: string): string;
159
158
  }
160
159
 
package/dist/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import { mapToJson } from '@pandacss/shared';
1
2
  import { Tokens, SemanticTokens } from '@pandacss/types';
2
3
 
3
4
  type TokenStatus = 'deprecated' | 'experimental' | 'new';
@@ -130,31 +131,29 @@ declare class TokenDictionary$1 {
130
131
  get isEmpty(): boolean;
131
132
  }
132
133
 
134
+ declare const formats: {
135
+ groupByCondition(dictionary: TokenDictionary$1): Map<string, Set<Token>>;
136
+ groupByColorPalette(dictionary: TokenDictionary$1): Map<string, Map<string, string>>;
137
+ groupByCategory(dictionary: TokenDictionary$1): Map<string, Map<string, Token>>;
138
+ getFlattenedValues(dictionary: TokenDictionary$1): Map<string, Map<string, string>>;
139
+ getVars(dictionary: TokenDictionary$1): Map<string, Map<string, string>>;
140
+ createVarGetter(dictionary: TokenDictionary$1): (path: string, fallback?: string | number) => string;
141
+ getColorPaletteValues(dictionary: TokenDictionary$1): Set<string>;
142
+ };
143
+
133
144
  declare class TokenDictionary extends TokenDictionary$1 {
145
+ get: ReturnType<typeof formats.createVarGetter>;
146
+ conditionMap: ReturnType<typeof formats.groupByCondition>;
147
+ categoryMap: ReturnType<typeof formats.groupByCategory>;
148
+ values: ReturnType<typeof formats.getFlattenedValues>;
149
+ colorPalettes: ReturnType<typeof formats.groupByColorPalette>;
150
+ vars: ReturnType<typeof formats.getVars>;
151
+ json: ReturnType<typeof mapToJson>;
134
152
  constructor(options: TokenDictionaryOptions);
135
- get get(): (path: string, fallback?: string | number | undefined) => string;
136
- get conditionMap(): Map<string, Set<Token>>;
137
- get categoryMap(): Map<string, Map<string, Token>>;
138
- get values(): Map<string, Map<string, string>>;
139
- get colorPalettes(): {
140
- clear: never;
141
- delete: never;
142
- forEach: never;
143
- get: never;
144
- has: never;
145
- set: never;
146
- readonly size: never;
147
- entries: never;
148
- keys: never;
149
- values: never;
150
- [Symbol.iterator]: never;
151
- readonly [Symbol.toStringTag]: never;
152
- };
153
- get vars(): Map<string, Map<string, string>>;
154
- getValue(path: string): {
153
+ getValue: (path: string) => {
155
154
  [k: string]: string;
156
155
  } | undefined;
157
- getTokenVar(path: string): any;
156
+ getTokenVar: (path: string) => any;
158
157
  expandReference(value: string): string;
159
158
  }
160
159
 
package/dist/index.js CHANGED
@@ -270,7 +270,8 @@ var TOKEN_TYPES = {
270
270
  easings: "cubicBezier",
271
271
  borders: "border",
272
272
  components: "cti",
273
- assets: "asset"
273
+ assets: "asset",
274
+ aspectRatios: "aspectRatio"
274
275
  };
275
276
 
276
277
  // src/dictionary.ts
@@ -922,40 +923,35 @@ var transforms = [
922
923
 
923
924
  // src/create-dictionary.ts
924
925
  var TokenDictionary2 = class extends TokenDictionary {
926
+ get;
927
+ conditionMap;
928
+ categoryMap;
929
+ values;
930
+ colorPalettes;
931
+ vars;
932
+ json;
925
933
  constructor(options) {
926
934
  super(options);
927
935
  this.registerTransform(...transforms);
928
936
  this.registerMiddleware(...middlewares);
929
937
  this.build();
930
- }
931
- get get() {
932
- return formats.createVarGetter(this);
933
- }
934
- get conditionMap() {
935
- return formats.groupByCondition(this);
936
- }
937
- get categoryMap() {
938
- return formats.groupByCategory(this);
939
- }
940
- get values() {
941
- return formats.getFlattenedValues(this);
942
- }
943
- get colorPalettes() {
944
- return (0, import_shared7.mapToJson)(formats.groupByColorPalette(this));
945
- }
946
- get vars() {
947
- return formats.getVars(this);
948
- }
949
- getValue(path) {
938
+ this.get = formats.createVarGetter(this);
939
+ this.conditionMap = formats.groupByCondition(this);
940
+ this.categoryMap = formats.groupByCategory(this);
941
+ this.values = formats.getFlattenedValues(this);
942
+ this.colorPalettes = (0, import_shared7.mapToJson)(formats.groupByColorPalette(this));
943
+ this.vars = formats.getVars(this);
944
+ this.json = (0, import_shared7.mapToJson)(this.values);
945
+ }
946
+ getValue = (0, import_shared7.memo)((path) => {
950
947
  const result = this.values.get(path);
951
948
  if (result != null) {
952
949
  return Object.fromEntries(result);
953
950
  }
954
- }
955
- getTokenVar(path) {
956
- const json = (0, import_shared7.mapToJson)(this.values);
957
- return (0, import_shared7.getDotPath)(json, path);
958
- }
951
+ });
952
+ getTokenVar = (0, import_shared7.memo)((path) => {
953
+ return (0, import_shared7.getDotPath)(this.json, path);
954
+ });
959
955
  expandReference(value) {
960
956
  return expandReferences(value, (key) => this.get(key));
961
957
  }
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  // src/create-dictionary.ts
2
- import { getDotPath as getDotPath2, mapToJson as mapToJson2 } from "@pandacss/shared";
2
+ import { getDotPath as getDotPath2, mapToJson as mapToJson2, memo as memo2 } from "@pandacss/shared";
3
3
 
4
4
  // src/dictionary.ts
5
5
  import { compact, isString, mapObject, memo, walkObject as walkObject2 } from "@pandacss/shared";
@@ -243,7 +243,8 @@ var TOKEN_TYPES = {
243
243
  easings: "cubicBezier",
244
244
  borders: "border",
245
245
  components: "cti",
246
- assets: "asset"
246
+ assets: "asset",
247
+ aspectRatios: "aspectRatio"
247
248
  };
248
249
 
249
250
  // src/dictionary.ts
@@ -895,40 +896,35 @@ var transforms = [
895
896
 
896
897
  // src/create-dictionary.ts
897
898
  var TokenDictionary2 = class extends TokenDictionary {
899
+ get;
900
+ conditionMap;
901
+ categoryMap;
902
+ values;
903
+ colorPalettes;
904
+ vars;
905
+ json;
898
906
  constructor(options) {
899
907
  super(options);
900
908
  this.registerTransform(...transforms);
901
909
  this.registerMiddleware(...middlewares);
902
910
  this.build();
903
- }
904
- get get() {
905
- return formats.createVarGetter(this);
906
- }
907
- get conditionMap() {
908
- return formats.groupByCondition(this);
909
- }
910
- get categoryMap() {
911
- return formats.groupByCategory(this);
912
- }
913
- get values() {
914
- return formats.getFlattenedValues(this);
915
- }
916
- get colorPalettes() {
917
- return mapToJson2(formats.groupByColorPalette(this));
918
- }
919
- get vars() {
920
- return formats.getVars(this);
921
- }
922
- getValue(path) {
911
+ this.get = formats.createVarGetter(this);
912
+ this.conditionMap = formats.groupByCondition(this);
913
+ this.categoryMap = formats.groupByCategory(this);
914
+ this.values = formats.getFlattenedValues(this);
915
+ this.colorPalettes = mapToJson2(formats.groupByColorPalette(this));
916
+ this.vars = formats.getVars(this);
917
+ this.json = mapToJson2(this.values);
918
+ }
919
+ getValue = memo2((path) => {
923
920
  const result = this.values.get(path);
924
921
  if (result != null) {
925
922
  return Object.fromEntries(result);
926
923
  }
927
- }
928
- getTokenVar(path) {
929
- const json = mapToJson2(this.values);
930
- return getDotPath2(json, path);
931
- }
924
+ });
925
+ getTokenVar = memo2((path) => {
926
+ return getDotPath2(this.json, path);
927
+ });
932
928
  expandReference(value) {
933
929
  return expandReferences(value, (key) => this.get(key));
934
930
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pandacss/token-dictionary",
3
- "version": "0.26.2",
3
+ "version": "0.27.1",
4
4
  "description": "Common error messages for css panda",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -33,8 +33,8 @@
33
33
  ],
34
34
  "dependencies": {
35
35
  "ts-pattern": "5.0.5",
36
- "@pandacss/shared": "0.26.2",
37
- "@pandacss/types": "0.26.2"
36
+ "@pandacss/shared": "0.27.1",
37
+ "@pandacss/types": "0.27.1"
38
38
  },
39
39
  "scripts": {
40
40
  "build": "tsup src/index.ts --format=esm,cjs --dts",