@pandacss/studio 0.29.1 → 0.30.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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pandacss/studio",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.30.1",
|
|
4
4
|
"description": "The automated token documentation for Panda CSS",
|
|
5
5
|
"main": "dist/studio.js",
|
|
6
6
|
"module": "dist/studio.mjs",
|
|
@@ -48,12 +48,12 @@
|
|
|
48
48
|
"react": "18.2.0",
|
|
49
49
|
"react-dom": "18.2.0",
|
|
50
50
|
"vite": "5.0.12",
|
|
51
|
-
"@pandacss/config": "0.
|
|
52
|
-
"@pandacss/logger": "0.
|
|
53
|
-
"@pandacss/shared": "0.
|
|
54
|
-
"@pandacss/token-dictionary": "0.
|
|
55
|
-
"@pandacss/types": "0.
|
|
56
|
-
"@pandacss/astro-plugin-studio": "0.
|
|
51
|
+
"@pandacss/config": "0.30.1",
|
|
52
|
+
"@pandacss/logger": "0.30.1",
|
|
53
|
+
"@pandacss/shared": "0.30.1",
|
|
54
|
+
"@pandacss/token-dictionary": "0.30.1",
|
|
55
|
+
"@pandacss/types": "0.30.1",
|
|
56
|
+
"@pandacss/astro-plugin-studio": "0.30.1"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
59
|
"@types/react": "18.2.42",
|
|
@@ -7,7 +7,7 @@ import { Select } from './input'
|
|
|
7
7
|
import { TokenContent } from './token-content'
|
|
8
8
|
import { TokenGroup } from './token-group'
|
|
9
9
|
|
|
10
|
-
const tokens = Object.fromEntries<Map<string, Token> | undefined>(context.tokens.categoryMap)
|
|
10
|
+
const tokens = Object.fromEntries<Map<string, Token> | undefined>(context.tokens.view.categoryMap)
|
|
11
11
|
|
|
12
12
|
const defaultConfig = {
|
|
13
13
|
fontSize: '',
|
|
@@ -39,7 +39,7 @@ export default function TypographyPlayground() {
|
|
|
39
39
|
updateConfig(key, event.currentTarget.value)
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
const renderTokenSwitch = (token:
|
|
42
|
+
const renderTokenSwitch = (token: keyof typeof defaultConfig) => {
|
|
43
43
|
const currentTokens = tokens[`${token}s`]
|
|
44
44
|
if (!currentTokens) return
|
|
45
45
|
const values = Array.from(currentTokens.values())
|
package/src/lib/panda-context.ts
CHANGED
|
@@ -5,10 +5,10 @@ import { config } from 'virtual:panda'
|
|
|
5
5
|
|
|
6
6
|
export const theme = config.theme ?? {}
|
|
7
7
|
|
|
8
|
-
export const tokens = new TokenDictionary(theme)
|
|
8
|
+
export const tokens = new TokenDictionary(theme).init()
|
|
9
9
|
|
|
10
10
|
export const getTokens = (category: keyof TokenDataTypes): Token[] => {
|
|
11
|
-
const map = tokens.categoryMap.get(category) ?? new Map()
|
|
11
|
+
const map = tokens.view.categoryMap.get(category) ?? new Map()
|
|
12
12
|
return Array.from(map.values())
|
|
13
13
|
}
|
|
14
14
|
|
|
@@ -14,18 +14,6 @@ function filterBaseConditions(c) {
|
|
|
14
14
|
return c.slice().filter((v) => !isBaseCondition(v));
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
// src/important.ts
|
|
18
|
-
var importantRegex = /\s*!(important)?/i;
|
|
19
|
-
function isImportant(value) {
|
|
20
|
-
return typeof value === "string" ? importantRegex.test(value) : false;
|
|
21
|
-
}
|
|
22
|
-
function withoutImportant(value) {
|
|
23
|
-
return typeof value === "string" ? value.replace(importantRegex, "").trim() : value;
|
|
24
|
-
}
|
|
25
|
-
function withoutSpace(str) {
|
|
26
|
-
return typeof str === "string" ? str.replaceAll(" ", "_") : str;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
17
|
// src/hash.ts
|
|
30
18
|
function toChar(code) {
|
|
31
19
|
return String.fromCharCode(code + (code > 25 ? 39 : 97));
|
|
@@ -47,21 +35,16 @@ function toHash(value) {
|
|
|
47
35
|
return toName(toPhash(5381, value) >>> 0);
|
|
48
36
|
}
|
|
49
37
|
|
|
50
|
-
// src/
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
return
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
prev[key] = value;
|
|
61
|
-
}
|
|
62
|
-
});
|
|
63
|
-
return prev;
|
|
64
|
-
}, {});
|
|
38
|
+
// src/important.ts
|
|
39
|
+
var importantRegex = /\s*!(important)?/i;
|
|
40
|
+
function isImportant(value) {
|
|
41
|
+
return typeof value === "string" ? importantRegex.test(value) : false;
|
|
42
|
+
}
|
|
43
|
+
function withoutImportant(value) {
|
|
44
|
+
return typeof value === "string" ? value.replace(importantRegex, "").trim() : value;
|
|
45
|
+
}
|
|
46
|
+
function withoutSpace(str) {
|
|
47
|
+
return typeof str === "string" ? str.replaceAll(" ", "_") : str;
|
|
65
48
|
}
|
|
66
49
|
|
|
67
50
|
// src/memo.ts
|
|
@@ -79,6 +62,23 @@ var memo = (fn) => {
|
|
|
79
62
|
return get;
|
|
80
63
|
};
|
|
81
64
|
|
|
65
|
+
// src/merge-props.ts
|
|
66
|
+
function mergeProps(...sources) {
|
|
67
|
+
const objects = sources.filter(Boolean);
|
|
68
|
+
return objects.reduce((prev, obj) => {
|
|
69
|
+
Object.keys(obj).forEach((key) => {
|
|
70
|
+
const prevValue = prev[key];
|
|
71
|
+
const value = obj[key];
|
|
72
|
+
if (isObject(prevValue) && isObject(value)) {
|
|
73
|
+
prev[key] = mergeProps(prevValue, value);
|
|
74
|
+
} else {
|
|
75
|
+
prev[key] = value;
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
return prev;
|
|
79
|
+
}, {});
|
|
80
|
+
}
|
|
81
|
+
|
|
82
82
|
// src/walk-object.ts
|
|
83
83
|
var isNotNullish = (element) => element != null;
|
|
84
84
|
function walkObject(target, predicate, options = {}) {
|
|
@@ -87,7 +87,7 @@ function walkObject(target, predicate, options = {}) {
|
|
|
87
87
|
if (isObject(value) || Array.isArray(value)) {
|
|
88
88
|
const result = {};
|
|
89
89
|
for (const [prop, child] of Object.entries(value)) {
|
|
90
|
-
const key = getKey?.(prop) ?? prop;
|
|
90
|
+
const key = getKey?.(prop, child) ?? prop;
|
|
91
91
|
const childPath = [...path, key];
|
|
92
92
|
if (stop?.(value, childPath)) {
|
|
93
93
|
return predicate(value, path);
|
|
@@ -121,14 +121,6 @@ function toResponsiveObject(values, breakpoints) {
|
|
|
121
121
|
return acc;
|
|
122
122
|
}, {});
|
|
123
123
|
}
|
|
124
|
-
function normalizeShorthand(styles, context) {
|
|
125
|
-
const { hasShorthand, resolveShorthand } = context.utility;
|
|
126
|
-
return walkObject(styles, (v) => v, {
|
|
127
|
-
getKey: (prop) => {
|
|
128
|
-
return hasShorthand ? resolveShorthand(prop) : prop;
|
|
129
|
-
}
|
|
130
|
-
});
|
|
131
|
-
}
|
|
132
124
|
function normalizeStyleObject(styles, context, shorthand = true) {
|
|
133
125
|
const { utility, conditions } = context;
|
|
134
126
|
const { hasShorthand, resolveShorthand } = utility;
|
|
@@ -158,7 +150,7 @@ function createCss(context) {
|
|
|
158
150
|
let result;
|
|
159
151
|
if (hash) {
|
|
160
152
|
const baseArray = [...conds.finalize(conditions), className];
|
|
161
|
-
result = formatClassName(toHash(baseArray
|
|
153
|
+
result = formatClassName(utility.toHash(baseArray, toHash));
|
|
162
154
|
} else {
|
|
163
155
|
const baseArray = [...conds.finalize(conditions), formatClassName(className)];
|
|
164
156
|
result = baseArray.join(":");
|
|
@@ -191,7 +183,7 @@ function createMergeCss(context) {
|
|
|
191
183
|
const allStyles = compactStyles(...styles);
|
|
192
184
|
if (allStyles.length === 1)
|
|
193
185
|
return allStyles;
|
|
194
|
-
return allStyles.map((style) =>
|
|
186
|
+
return allStyles.map((style) => normalizeStyleObject(style, context));
|
|
195
187
|
}
|
|
196
188
|
function mergeCss(...styles) {
|
|
197
189
|
return mergeProps(...resolve(styles));
|