@pandacss/token-dictionary 0.49.0 → 0.51.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 +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +8 -5
- package/dist/index.mjs +8 -5
- package/package.json +4 -4
package/dist/index.d.mts
CHANGED
|
@@ -119,7 +119,7 @@ declare class TokenDictionary {
|
|
|
119
119
|
formatTokenName: (path: string[]) => string;
|
|
120
120
|
formatCssVar: (path: string[], options: CssVarOptions) => CssVar;
|
|
121
121
|
registerTokens(): this;
|
|
122
|
-
registerToken: (token: Token, transformPhase?:
|
|
122
|
+
registerToken: (token: Token, transformPhase?: "pre" | "post") => void;
|
|
123
123
|
private transforms;
|
|
124
124
|
registerTransform(...transforms: TokenTransformer[]): this;
|
|
125
125
|
private execTransform;
|
|
@@ -197,7 +197,7 @@ declare function expandReferences(value: string, fn: (key: string) => string): s
|
|
|
197
197
|
* Converts a JS Map to an object
|
|
198
198
|
*/
|
|
199
199
|
declare function mapToJson(map: Map<string, any>): Record<string, unknown>;
|
|
200
|
-
declare const isToken: (value: any) => value is Token$1
|
|
200
|
+
declare const isToken: (value: any) => value is Token$1;
|
|
201
201
|
declare function assertTokenFormat(token: any): asserts token is Token$1;
|
|
202
202
|
|
|
203
203
|
export { Token, TokenDictionary, type TokenExtensions, assertTokenFormat, expandReferences, getReferences, hasReference, isToken, mapToJson };
|
package/dist/index.d.ts
CHANGED
|
@@ -119,7 +119,7 @@ declare class TokenDictionary {
|
|
|
119
119
|
formatTokenName: (path: string[]) => string;
|
|
120
120
|
formatCssVar: (path: string[], options: CssVarOptions) => CssVar;
|
|
121
121
|
registerTokens(): this;
|
|
122
|
-
registerToken: (token: Token, transformPhase?:
|
|
122
|
+
registerToken: (token: Token, transformPhase?: "pre" | "post") => void;
|
|
123
123
|
private transforms;
|
|
124
124
|
registerTransform(...transforms: TokenTransformer[]): this;
|
|
125
125
|
private execTransform;
|
|
@@ -197,7 +197,7 @@ declare function expandReferences(value: string, fn: (key: string) => string): s
|
|
|
197
197
|
* Converts a JS Map to an object
|
|
198
198
|
*/
|
|
199
199
|
declare function mapToJson(map: Map<string, any>): Record<string, unknown>;
|
|
200
|
-
declare const isToken: (value: any) => value is Token$1
|
|
200
|
+
declare const isToken: (value: any) => value is Token$1;
|
|
201
201
|
declare function assertTokenFormat(token: any): asserts token is Token$1;
|
|
202
202
|
|
|
203
203
|
export { Token, TokenDictionary, type TokenExtensions, assertTokenFormat, expandReferences, getReferences, hasReference, isToken, mapToJson };
|
package/dist/index.js
CHANGED
|
@@ -39,10 +39,10 @@ var import_ts_pattern3 = require("ts-pattern");
|
|
|
39
39
|
var import_ts_pattern = require("ts-pattern");
|
|
40
40
|
var isCompositeShadow = (0, import_ts_pattern.isMatching)({
|
|
41
41
|
inset: import_ts_pattern.P.optional(import_ts_pattern.P.boolean),
|
|
42
|
-
offsetX: import_ts_pattern.P.number,
|
|
43
|
-
offsetY: import_ts_pattern.P.number,
|
|
44
|
-
blur: import_ts_pattern.P.number,
|
|
45
|
-
spread: import_ts_pattern.P.number,
|
|
42
|
+
offsetX: import_ts_pattern.P.union(import_ts_pattern.P.number, import_ts_pattern.P.string),
|
|
43
|
+
offsetY: import_ts_pattern.P.union(import_ts_pattern.P.number, import_ts_pattern.P.string),
|
|
44
|
+
blur: import_ts_pattern.P.union(import_ts_pattern.P.number, import_ts_pattern.P.string),
|
|
45
|
+
spread: import_ts_pattern.P.union(import_ts_pattern.P.number, import_ts_pattern.P.string),
|
|
46
46
|
color: import_ts_pattern.P.string
|
|
47
47
|
});
|
|
48
48
|
var isCompositeGradient = (0, import_ts_pattern.isMatching)({
|
|
@@ -516,6 +516,9 @@ var objectKeys = (obj) => Object.keys(obj);
|
|
|
516
516
|
function toUnit(v) {
|
|
517
517
|
return (0, import_shared4.isCssUnit)(v) || hasReference(v.toString()) ? v : `${v}px`;
|
|
518
518
|
}
|
|
519
|
+
function px(v) {
|
|
520
|
+
return (0, import_shared4.isString)(v) ? v : `${v}px`;
|
|
521
|
+
}
|
|
519
522
|
var transformShadow = {
|
|
520
523
|
name: "tokens/shadow",
|
|
521
524
|
match: (token) => token.extensions.category === "shadows",
|
|
@@ -528,7 +531,7 @@ var transformShadow = {
|
|
|
528
531
|
}
|
|
529
532
|
if (isCompositeShadow(token.value)) {
|
|
530
533
|
const { offsetX, offsetY, blur, spread, color, inset } = token.value;
|
|
531
|
-
return
|
|
534
|
+
return [inset ? "inset " : "", px(offsetX), px(offsetY), px(blur), px(spread), color].filter(Boolean).join(" ");
|
|
532
535
|
}
|
|
533
536
|
return token.value;
|
|
534
537
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -15,10 +15,10 @@ import { isMatching as isMatching2, match as match2 } from "ts-pattern";
|
|
|
15
15
|
import { P, isMatching } from "ts-pattern";
|
|
16
16
|
var isCompositeShadow = isMatching({
|
|
17
17
|
inset: P.optional(P.boolean),
|
|
18
|
-
offsetX: P.number,
|
|
19
|
-
offsetY: P.number,
|
|
20
|
-
blur: P.number,
|
|
21
|
-
spread: P.number,
|
|
18
|
+
offsetX: P.union(P.number, P.string),
|
|
19
|
+
offsetY: P.union(P.number, P.string),
|
|
20
|
+
blur: P.union(P.number, P.string),
|
|
21
|
+
spread: P.union(P.number, P.string),
|
|
22
22
|
color: P.string
|
|
23
23
|
});
|
|
24
24
|
var isCompositeGradient = isMatching({
|
|
@@ -492,6 +492,9 @@ var objectKeys = (obj) => Object.keys(obj);
|
|
|
492
492
|
function toUnit(v) {
|
|
493
493
|
return isCssUnit(v) || hasReference(v.toString()) ? v : `${v}px`;
|
|
494
494
|
}
|
|
495
|
+
function px(v) {
|
|
496
|
+
return isString(v) ? v : `${v}px`;
|
|
497
|
+
}
|
|
495
498
|
var transformShadow = {
|
|
496
499
|
name: "tokens/shadow",
|
|
497
500
|
match: (token) => token.extensions.category === "shadows",
|
|
@@ -504,7 +507,7 @@ var transformShadow = {
|
|
|
504
507
|
}
|
|
505
508
|
if (isCompositeShadow(token.value)) {
|
|
506
509
|
const { offsetX, offsetY, blur, spread, color, inset } = token.value;
|
|
507
|
-
return
|
|
510
|
+
return [inset ? "inset " : "", px(offsetX), px(offsetY), px(blur), px(spread), color].filter(Boolean).join(" ");
|
|
508
511
|
}
|
|
509
512
|
return token.value;
|
|
510
513
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pandacss/token-dictionary",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.51.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
|
-
"@pandacss/shared": "0.
|
|
38
|
-
"@pandacss/types": "0.
|
|
36
|
+
"@pandacss/logger": "^0.51.0",
|
|
37
|
+
"@pandacss/shared": "0.51.0",
|
|
38
|
+
"@pandacss/types": "0.51.0"
|
|
39
39
|
},
|
|
40
40
|
"scripts": {
|
|
41
41
|
"build": "tsup src/index.ts --format=esm,cjs --dts",
|