@pandacss/token-dictionary 0.0.0-dev-20240111225338 → 0.0.0-dev-20240112100832

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
@@ -923,40 +923,35 @@ var transforms = [
923
923
 
924
924
  // src/create-dictionary.ts
925
925
  var TokenDictionary2 = class extends TokenDictionary {
926
+ get;
927
+ conditionMap;
928
+ categoryMap;
929
+ values;
930
+ colorPalettes;
931
+ vars;
932
+ json;
926
933
  constructor(options) {
927
934
  super(options);
928
935
  this.registerTransform(...transforms);
929
936
  this.registerMiddleware(...middlewares);
930
937
  this.build();
931
- }
932
- get get() {
933
- return formats.createVarGetter(this);
934
- }
935
- get conditionMap() {
936
- return formats.groupByCondition(this);
937
- }
938
- get categoryMap() {
939
- return formats.groupByCategory(this);
940
- }
941
- get values() {
942
- return formats.getFlattenedValues(this);
943
- }
944
- get colorPalettes() {
945
- return (0, import_shared7.mapToJson)(formats.groupByColorPalette(this));
946
- }
947
- get vars() {
948
- return formats.getVars(this);
949
- }
950
- 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) => {
951
947
  const result = this.values.get(path);
952
948
  if (result != null) {
953
949
  return Object.fromEntries(result);
954
950
  }
955
- }
956
- getTokenVar(path) {
957
- const json = (0, import_shared7.mapToJson)(this.values);
958
- return (0, import_shared7.getDotPath)(json, path);
959
- }
951
+ });
952
+ getTokenVar = (0, import_shared7.memo)((path) => {
953
+ return (0, import_shared7.getDotPath)(this.json, path);
954
+ });
960
955
  expandReference(value) {
961
956
  return expandReferences(value, (key) => this.get(key));
962
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";
@@ -896,40 +896,35 @@ var transforms = [
896
896
 
897
897
  // src/create-dictionary.ts
898
898
  var TokenDictionary2 = class extends TokenDictionary {
899
+ get;
900
+ conditionMap;
901
+ categoryMap;
902
+ values;
903
+ colorPalettes;
904
+ vars;
905
+ json;
899
906
  constructor(options) {
900
907
  super(options);
901
908
  this.registerTransform(...transforms);
902
909
  this.registerMiddleware(...middlewares);
903
910
  this.build();
904
- }
905
- get get() {
906
- return formats.createVarGetter(this);
907
- }
908
- get conditionMap() {
909
- return formats.groupByCondition(this);
910
- }
911
- get categoryMap() {
912
- return formats.groupByCategory(this);
913
- }
914
- get values() {
915
- return formats.getFlattenedValues(this);
916
- }
917
- get colorPalettes() {
918
- return mapToJson2(formats.groupByColorPalette(this));
919
- }
920
- get vars() {
921
- return formats.getVars(this);
922
- }
923
- 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) => {
924
920
  const result = this.values.get(path);
925
921
  if (result != null) {
926
922
  return Object.fromEntries(result);
927
923
  }
928
- }
929
- getTokenVar(path) {
930
- const json = mapToJson2(this.values);
931
- return getDotPath2(json, path);
932
- }
924
+ });
925
+ getTokenVar = memo2((path) => {
926
+ return getDotPath2(this.json, path);
927
+ });
933
928
  expandReference(value) {
934
929
  return expandReferences(value, (key) => this.get(key));
935
930
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pandacss/token-dictionary",
3
- "version": "0.0.0-dev-20240111225338",
3
+ "version": "0.0.0-dev-20240112100832",
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.0.0-dev-20240111225338",
37
- "@pandacss/types": "0.0.0-dev-20240111225338"
36
+ "@pandacss/shared": "0.0.0-dev-20240112100832",
37
+ "@pandacss/types": "0.0.0-dev-20240112100832"
38
38
  },
39
39
  "scripts": {
40
40
  "build": "tsup src/index.ts --format=esm,cjs --dts",