@pandacss/token-dictionary 0.0.0-dev-20230122144203 → 0.0.0-dev-20230124104736

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 CHANGED
@@ -1,6 +1,8 @@
1
- type TokenStatus$1 = 'deprecated' | 'experimental' | 'new';
1
+ import { Tokens, SemanticTokens } from '@pandacss/types';
2
+
3
+ type TokenStatus = 'deprecated' | 'experimental' | 'new';
2
4
  type ExtensionData = {
3
- status?: TokenStatus$1;
5
+ status?: TokenStatus;
4
6
  category?: string;
5
7
  references?: TokenReferences;
6
8
  condition?: string;
@@ -73,78 +75,6 @@ declare class Token {
73
75
  setType(): void;
74
76
  }
75
77
 
76
- type TokenStatus = 'deprecated' | 'experimental' | 'new';
77
- type TokenEntry<V = any> = {
78
- value: V;
79
- description?: string;
80
- type?: string;
81
- extensions?: {
82
- status?: TokenStatus;
83
- [key: string]: any;
84
- };
85
- };
86
- type Conditional<C extends string, V> = V | {
87
- [K in C]?: Conditional<C, V>;
88
- };
89
- type SemanticTokenEntry<V = string, C extends string = string> = {
90
- description?: string;
91
- type?: string;
92
- value: Conditional<C, V>;
93
- extensions?: {
94
- [key: string]: any;
95
- };
96
- };
97
- type Border = {
98
- color: string;
99
- width: string | number;
100
- style: string;
101
- };
102
- type Shadow = {
103
- offsetX: number;
104
- offsetY: number;
105
- blur: number;
106
- spread: number;
107
- color: string;
108
- inset?: boolean;
109
- };
110
- type Gradient = {
111
- type: 'linear' | 'radial';
112
- placement: string | number;
113
- stops: Array<{
114
- color: string;
115
- position: number;
116
- }>;
117
- };
118
- type Nested<T> = {
119
- [key: string]: T | Nested<T>;
120
- };
121
- type TokenValues = {
122
- zIndex: number;
123
- opacity: number;
124
- colors: string;
125
- fonts: string | string[];
126
- fontSizes: string;
127
- fontWeights: string | number;
128
- lineHeights: string | number;
129
- letterSpacings: string;
130
- sizes: string;
131
- shadows: Shadow | Shadow[] | string | string[];
132
- spacing: string | number;
133
- radii: string;
134
- borders: string | Border;
135
- durations: string;
136
- easings: string | number[];
137
- animations: string;
138
- blurs: string;
139
- gradients: string | Gradient;
140
- };
141
- type Tokens = {
142
- [key in keyof TokenValues]?: Nested<TokenEntry<TokenValues[key]>>;
143
- };
144
- type SemanticTokens<C extends string = string> = {
145
- [key in keyof TokenValues]?: Nested<SemanticTokenEntry<TokenValues[key], C>>;
146
- };
147
-
148
78
  type EnforcePhase = 'pre' | 'post';
149
79
  type Options = {
150
80
  prefix?: string;
@@ -159,6 +89,7 @@ type TokenTransformer = {
159
89
  type TokenDictionaryOptions = {
160
90
  tokens?: Tokens;
161
91
  semanticTokens?: SemanticTokens;
92
+ breakpoints?: Record<string, string>;
162
93
  prefix?: string;
163
94
  };
164
95
  type TokenMiddleware = {
package/dist/index.js CHANGED
@@ -199,10 +199,14 @@ var TokenDictionary = class {
199
199
  return Array.from(new Set(this.allTokens.map((token) => token.name)));
200
200
  }
201
201
  constructor(options) {
202
- const { tokens = {}, semanticTokens = {}, prefix } = options;
202
+ const { tokens = {}, semanticTokens = {}, breakpoints, prefix } = options;
203
+ const computedTokens = (0, import_shared3.compact)({
204
+ ...tokens,
205
+ screens: breakpoints ? (0, import_shared3.mapObject)(breakpoints, (value) => ({ value })) : void 0
206
+ });
203
207
  this.prefix = prefix;
204
208
  (0, import_shared3.walkObject)(
205
- tokens,
209
+ computedTokens,
206
210
  (token, path) => {
207
211
  assertTokenFormat(token);
208
212
  const category = path[0];
package/dist/index.mjs CHANGED
@@ -2,7 +2,7 @@
2
2
  import { getDotPath as getDotPath2, mapToJson as mapToJson2 } from "@pandacss/shared";
3
3
 
4
4
  // src/dictionary.ts
5
- import { isString, memo, walkObject as walkObject2 } from "@pandacss/shared";
5
+ import { compact, isString, mapObject, memo, walkObject as walkObject2 } from "@pandacss/shared";
6
6
  import { isMatching, match } from "ts-pattern";
7
7
 
8
8
  // src/token.ts
@@ -173,10 +173,14 @@ var TokenDictionary = class {
173
173
  return Array.from(new Set(this.allTokens.map((token) => token.name)));
174
174
  }
175
175
  constructor(options) {
176
- const { tokens = {}, semanticTokens = {}, prefix } = options;
176
+ const { tokens = {}, semanticTokens = {}, breakpoints, prefix } = options;
177
+ const computedTokens = compact({
178
+ ...tokens,
179
+ screens: breakpoints ? mapObject(breakpoints, (value) => ({ value })) : void 0
180
+ });
177
181
  this.prefix = prefix;
178
182
  walkObject2(
179
- tokens,
183
+ computedTokens,
180
184
  (token, path) => {
181
185
  assertTokenFormat(token);
182
186
  const category = path[0];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pandacss/token-dictionary",
3
- "version": "0.0.0-dev-20230122144203",
3
+ "version": "0.0.0-dev-20230124104736",
4
4
  "description": "Common error messages for css panda",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -15,10 +15,11 @@
15
15
  ],
16
16
  "dependencies": {
17
17
  "ts-pattern": "4.1.3",
18
- "@pandacss/shared": "0.0.0-dev-20230122144203"
18
+ "@pandacss/types": "0.0.0-dev-20230124104736",
19
+ "@pandacss/shared": "0.0.0-dev-20230124104736"
19
20
  },
20
21
  "devDependencies": {
21
- "@pandacss/fixture": "0.0.0-dev-20230122144203"
22
+ "@pandacss/fixture": "0.0.0-dev-20230124104736"
22
23
  },
23
24
  "scripts": {
24
25
  "build": "tsup src/index.ts --format=esm,cjs --dts",