@pandacss/studio 0.13.0 → 0.13.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 +8 -8
- package/styled-system/css/conditions.mjs +16 -18
- package/styled-system/css/css.d.ts +1 -1
- package/styled-system/css/css.mjs +12 -11
- package/styled-system/css/cva.d.ts +2 -2
- package/styled-system/css/cva.mjs +2 -2
- package/styled-system/css/cx.mjs +1 -1
- package/styled-system/css/index.d.ts +4 -4
- package/styled-system/css/index.mjs +4 -4
- package/styled-system/css/sva.d.ts +1 -1
- package/styled-system/css/sva.mjs +10 -8
- package/styled-system/global.css +30 -33
- package/styled-system/helpers.mjs +165 -154
- package/styled-system/jsx/aspect-ratio.d.ts +3 -3
- package/styled-system/jsx/aspect-ratio.mjs +5 -5
- package/styled-system/jsx/bleed.d.ts +3 -3
- package/styled-system/jsx/bleed.mjs +5 -5
- package/styled-system/jsx/box.d.ts +3 -3
- package/styled-system/jsx/box.mjs +4 -4
- package/styled-system/jsx/center.d.ts +3 -3
- package/styled-system/jsx/center.mjs +5 -5
- package/styled-system/jsx/circle.d.ts +3 -3
- package/styled-system/jsx/circle.mjs +5 -5
- package/styled-system/jsx/container.d.ts +3 -3
- package/styled-system/jsx/container.mjs +4 -4
- package/styled-system/jsx/divider.d.ts +3 -3
- package/styled-system/jsx/divider.mjs +5 -5
- package/styled-system/jsx/factory.d.ts +1 -1
- package/styled-system/jsx/factory.mjs +19 -18
- package/styled-system/jsx/flex.d.ts +3 -3
- package/styled-system/jsx/flex.mjs +5 -5
- package/styled-system/jsx/float.d.ts +3 -3
- package/styled-system/jsx/float.mjs +5 -5
- package/styled-system/jsx/grid-item.d.ts +3 -3
- package/styled-system/jsx/grid-item.mjs +5 -5
- package/styled-system/jsx/grid.d.ts +3 -3
- package/styled-system/jsx/grid.mjs +5 -5
- package/styled-system/jsx/hstack.d.ts +3 -3
- package/styled-system/jsx/hstack.mjs +5 -5
- package/styled-system/jsx/index.d.ts +27 -24
- package/styled-system/jsx/index.mjs +23 -23
- package/styled-system/jsx/is-valid-prop.mjs +13 -12
- package/styled-system/jsx/link-box.d.ts +3 -3
- package/styled-system/jsx/link-box.mjs +4 -4
- package/styled-system/jsx/link-overlay.d.ts +3 -3
- package/styled-system/jsx/link-overlay.mjs +4 -4
- package/styled-system/jsx/spacer.d.ts +3 -3
- package/styled-system/jsx/spacer.mjs +5 -5
- package/styled-system/jsx/square.d.ts +3 -3
- package/styled-system/jsx/square.mjs +5 -5
- package/styled-system/jsx/stack.d.ts +3 -3
- package/styled-system/jsx/stack.mjs +5 -5
- package/styled-system/jsx/styled-link.d.ts +3 -3
- package/styled-system/jsx/styled-link.mjs +4 -4
- package/styled-system/jsx/visually-hidden.d.ts +3 -3
- package/styled-system/jsx/visually-hidden.mjs +4 -4
- package/styled-system/jsx/vstack.d.ts +3 -3
- package/styled-system/jsx/vstack.mjs +5 -5
- package/styled-system/jsx/wrap.d.ts +3 -3
- package/styled-system/jsx/wrap.mjs +5 -5
- package/styled-system/patterns/aspect-ratio.d.ts +5 -5
- package/styled-system/patterns/aspect-ratio.mjs +29 -30
- package/styled-system/patterns/bleed.d.ts +5 -5
- package/styled-system/patterns/bleed.mjs +13 -14
- package/styled-system/patterns/box.d.ts +5 -5
- package/styled-system/patterns/box.mjs +6 -7
- package/styled-system/patterns/center.d.ts +5 -5
- package/styled-system/patterns/center.mjs +12 -13
- package/styled-system/patterns/circle.d.ts +5 -5
- package/styled-system/patterns/circle.mjs +16 -17
- package/styled-system/patterns/container.d.ts +5 -5
- package/styled-system/patterns/container.mjs +12 -13
- package/styled-system/patterns/divider.d.ts +5 -5
- package/styled-system/patterns/divider.mjs +15 -16
- package/styled-system/patterns/flex.d.ts +5 -5
- package/styled-system/patterns/flex.mjs +17 -18
- package/styled-system/patterns/float.d.ts +5 -5
- package/styled-system/patterns/float.mjs +39 -40
- package/styled-system/patterns/grid-item.d.ts +5 -5
- package/styled-system/patterns/grid-item.mjs +16 -17
- package/styled-system/patterns/grid.d.ts +5 -5
- package/styled-system/patterns/grid.mjs +14 -20
- package/styled-system/patterns/hstack.d.ts +5 -5
- package/styled-system/patterns/hstack.mjs +14 -15
- package/styled-system/patterns/index.d.ts +21 -21
- package/styled-system/patterns/index.mjs +21 -21
- package/styled-system/patterns/link-box.d.ts +5 -5
- package/styled-system/patterns/link-box.mjs +13 -14
- package/styled-system/patterns/link-overlay.d.ts +5 -5
- package/styled-system/patterns/link-overlay.mjs +18 -19
- package/styled-system/patterns/spacer.d.ts +5 -5
- package/styled-system/patterns/spacer.mjs +12 -13
- package/styled-system/patterns/square.d.ts +5 -5
- package/styled-system/patterns/square.mjs +15 -16
- package/styled-system/patterns/stack.d.ts +5 -5
- package/styled-system/patterns/stack.mjs +14 -15
- package/styled-system/patterns/styled-link.d.ts +5 -5
- package/styled-system/patterns/styled-link.mjs +12 -13
- package/styled-system/patterns/visually-hidden.d.ts +5 -5
- package/styled-system/patterns/visually-hidden.mjs +9 -10
- package/styled-system/patterns/vstack.d.ts +5 -5
- package/styled-system/patterns/vstack.mjs +14 -15
- package/styled-system/patterns/wrap.d.ts +5 -5
- package/styled-system/patterns/wrap.mjs +16 -17
- package/styled-system/reset.css +4 -3
- package/styled-system/static.css +3 -3
- package/styled-system/styles.css +50 -50
- package/styled-system/tokens/index.css +434 -434
- package/styled-system/tokens/index.d.ts +2 -2
- package/styled-system/tokens/index.mjs +1419 -1421
- package/styled-system/tokens/keyframes.css +23 -25
- package/styled-system/types/composition.d.ts +1 -1
- package/styled-system/types/conditions.d.ts +1 -1
- package/styled-system/types/global.d.ts +6 -5
- package/styled-system/types/index.d.ts +3 -3
- package/styled-system/types/jsx.d.ts +2 -2
- package/styled-system/types/pattern.d.ts +2 -2
- package/styled-system/types/prop-type.d.ts +2 -2
- package/styled-system/types/recipe.d.ts +1 -1
- package/styled-system/types/selectors.d.ts +1 -1
- package/styled-system/types/style-props.d.ts +3 -3
- package/styled-system/types/system-types.d.ts +3 -3
|
@@ -1,272 +1,278 @@
|
|
|
1
1
|
// src/assert.ts
|
|
2
2
|
function isObject(value) {
|
|
3
|
-
return typeof value ===
|
|
3
|
+
return typeof value === "object" && value != null && !Array.isArray(value);
|
|
4
4
|
}
|
|
5
5
|
|
|
6
6
|
// src/compact.ts
|
|
7
7
|
function compact(value) {
|
|
8
|
-
return Object.fromEntries(Object.entries(value ?? {}).filter(([_, value2]) => value2 !== void 0))
|
|
8
|
+
return Object.fromEntries(Object.entries(value ?? {}).filter(([_, value2]) => value2 !== void 0));
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
// src/condition.ts
|
|
12
|
-
var isBaseCondition = (v) => v ===
|
|
12
|
+
var isBaseCondition = (v) => v === "base";
|
|
13
13
|
function filterBaseConditions(c) {
|
|
14
|
-
return c.slice().filter((v) => !isBaseCondition(v))
|
|
14
|
+
return c.slice().filter((v) => !isBaseCondition(v));
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
// src/css-important.ts
|
|
18
|
-
var importantRegex = /!(important)
|
|
18
|
+
var importantRegex = /!(important)?$/;
|
|
19
19
|
function isImportant(value) {
|
|
20
|
-
return typeof value ===
|
|
20
|
+
return typeof value === "string" ? importantRegex.test(value) : false;
|
|
21
21
|
}
|
|
22
22
|
function withoutImportant(value) {
|
|
23
|
-
return typeof value ===
|
|
23
|
+
return typeof value === "string" ? value.replace(importantRegex, "").trim() : value;
|
|
24
24
|
}
|
|
25
25
|
function withoutSpace(str) {
|
|
26
|
-
return typeof str ===
|
|
26
|
+
return typeof str === "string" ? str.replaceAll(" ", "_") : str;
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
// src/hash.ts
|
|
30
30
|
function toChar(code) {
|
|
31
|
-
return String.fromCharCode(code + (code > 25 ? 39 : 97))
|
|
31
|
+
return String.fromCharCode(code + (code > 25 ? 39 : 97));
|
|
32
32
|
}
|
|
33
33
|
function toName(code) {
|
|
34
|
-
let name =
|
|
35
|
-
let x
|
|
36
|
-
for (x = Math.abs(code); x > 52; x =
|
|
37
|
-
|
|
34
|
+
let name = "";
|
|
35
|
+
let x;
|
|
36
|
+
for (x = Math.abs(code); x > 52; x = x / 52 | 0)
|
|
37
|
+
name = toChar(x % 52) + name;
|
|
38
|
+
return toChar(x % 52) + name;
|
|
38
39
|
}
|
|
39
40
|
function toPhash(h, x) {
|
|
40
|
-
let i = x.length
|
|
41
|
-
while (i)
|
|
42
|
-
|
|
41
|
+
let i = x.length;
|
|
42
|
+
while (i)
|
|
43
|
+
h = h * 33 ^ x.charCodeAt(--i);
|
|
44
|
+
return h;
|
|
43
45
|
}
|
|
44
46
|
function toHash(value) {
|
|
45
|
-
return toName(toPhash(5381, value) >>> 0)
|
|
47
|
+
return toName(toPhash(5381, value) >>> 0);
|
|
46
48
|
}
|
|
47
49
|
|
|
48
50
|
// src/merge-props.ts
|
|
49
51
|
function mergeProps(...sources) {
|
|
50
|
-
const result = {}
|
|
52
|
+
const result = {};
|
|
51
53
|
for (const source of sources) {
|
|
52
54
|
for (const [key, value] of Object.entries(source)) {
|
|
53
55
|
if (isObject(value)) {
|
|
54
|
-
result[key] = mergeProps(result[key] || {}, value)
|
|
56
|
+
result[key] = mergeProps(result[key] || {}, value);
|
|
55
57
|
} else {
|
|
56
|
-
result[key] = value
|
|
58
|
+
result[key] = value;
|
|
57
59
|
}
|
|
58
60
|
}
|
|
59
61
|
}
|
|
60
|
-
return result
|
|
62
|
+
return result;
|
|
61
63
|
}
|
|
62
64
|
|
|
63
65
|
// src/walk-object.ts
|
|
64
|
-
var isNotNullish = (element) => element != null
|
|
66
|
+
var isNotNullish = (element) => element != null;
|
|
65
67
|
function walkObject(target, predicate, options = {}) {
|
|
66
|
-
const { stop, getKey } = options
|
|
68
|
+
const { stop, getKey } = options;
|
|
67
69
|
function inner(value, path = []) {
|
|
68
70
|
if (isObject(value) || Array.isArray(value)) {
|
|
69
|
-
const result = {}
|
|
71
|
+
const result = {};
|
|
70
72
|
for (const [prop, child] of Object.entries(value)) {
|
|
71
|
-
const key = getKey?.(prop) ?? prop
|
|
72
|
-
const childPath = [...path, key]
|
|
73
|
+
const key = getKey?.(prop) ?? prop;
|
|
74
|
+
const childPath = [...path, key];
|
|
73
75
|
if (stop?.(value, childPath)) {
|
|
74
|
-
return predicate(value, path)
|
|
76
|
+
return predicate(value, path);
|
|
75
77
|
}
|
|
76
|
-
const next = inner(child, childPath)
|
|
78
|
+
const next = inner(child, childPath);
|
|
77
79
|
if (isNotNullish(next)) {
|
|
78
|
-
result[key] = next
|
|
80
|
+
result[key] = next;
|
|
79
81
|
}
|
|
80
82
|
}
|
|
81
|
-
return result
|
|
83
|
+
return result;
|
|
82
84
|
}
|
|
83
|
-
return predicate(value, path)
|
|
85
|
+
return predicate(value, path);
|
|
84
86
|
}
|
|
85
|
-
return inner(target)
|
|
87
|
+
return inner(target);
|
|
86
88
|
}
|
|
87
89
|
function mapObject(obj, fn) {
|
|
88
|
-
if (!isObject(obj))
|
|
89
|
-
|
|
90
|
+
if (!isObject(obj))
|
|
91
|
+
return fn(obj);
|
|
92
|
+
return walkObject(obj, (value) => fn(value));
|
|
90
93
|
}
|
|
91
94
|
|
|
92
95
|
// src/normalize-style-object.ts
|
|
93
96
|
function toResponsiveObject(values, breakpoints) {
|
|
94
97
|
return values.reduce((acc, current, index) => {
|
|
95
|
-
const key = breakpoints[index]
|
|
98
|
+
const key = breakpoints[index];
|
|
96
99
|
if (current != null) {
|
|
97
|
-
acc[key] = current
|
|
100
|
+
acc[key] = current;
|
|
98
101
|
}
|
|
99
|
-
return acc
|
|
100
|
-
}, {})
|
|
102
|
+
return acc;
|
|
103
|
+
}, {});
|
|
101
104
|
}
|
|
102
105
|
function normalizeShorthand(styles, context) {
|
|
103
|
-
const { hasShorthand, resolveShorthand } = context.utility
|
|
106
|
+
const { hasShorthand, resolveShorthand } = context.utility;
|
|
104
107
|
return walkObject(styles, (v) => v, {
|
|
105
108
|
getKey: (prop) => {
|
|
106
|
-
return hasShorthand ? resolveShorthand(prop) : prop
|
|
107
|
-
}
|
|
108
|
-
})
|
|
109
|
+
return hasShorthand ? resolveShorthand(prop) : prop;
|
|
110
|
+
}
|
|
111
|
+
});
|
|
109
112
|
}
|
|
110
113
|
function normalizeStyleObject(styles, context) {
|
|
111
|
-
const { utility, conditions } = context
|
|
112
|
-
const { hasShorthand, resolveShorthand } = utility
|
|
114
|
+
const { utility, conditions } = context;
|
|
115
|
+
const { hasShorthand, resolveShorthand } = utility;
|
|
113
116
|
return walkObject(
|
|
114
117
|
styles,
|
|
115
118
|
(value) => {
|
|
116
|
-
return Array.isArray(value) ? toResponsiveObject(value, conditions.breakpoints.keys) : value
|
|
119
|
+
return Array.isArray(value) ? toResponsiveObject(value, conditions.breakpoints.keys) : value;
|
|
117
120
|
},
|
|
118
121
|
{
|
|
119
122
|
stop: (value) => Array.isArray(value),
|
|
120
123
|
getKey: (prop) => {
|
|
121
|
-
return hasShorthand ? resolveShorthand(prop) : prop
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
)
|
|
124
|
+
return hasShorthand ? resolveShorthand(prop) : prop;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
);
|
|
125
128
|
}
|
|
126
129
|
|
|
127
130
|
// src/classname.ts
|
|
128
131
|
var fallbackCondition = {
|
|
129
132
|
shift: (v) => v,
|
|
130
133
|
finalize: (v) => v,
|
|
131
|
-
breakpoints: { keys: [] }
|
|
132
|
-
}
|
|
133
|
-
var sanitize = (value) =>
|
|
134
|
+
breakpoints: { keys: [] }
|
|
135
|
+
};
|
|
136
|
+
var sanitize = (value) => typeof value === "string" ? value.replaceAll(/[\n\s]+/g, " ") : value;
|
|
134
137
|
function createCss(context) {
|
|
135
|
-
const { utility, hash, conditions: conds = fallbackCondition } = context
|
|
136
|
-
const formatClassName = (str) => [utility.prefix, str].filter(Boolean).join(
|
|
138
|
+
const { utility, hash, conditions: conds = fallbackCondition } = context;
|
|
139
|
+
const formatClassName = (str) => [utility.prefix, str].filter(Boolean).join("-");
|
|
137
140
|
const hashFn = (conditions, className) => {
|
|
138
|
-
let result
|
|
141
|
+
let result;
|
|
139
142
|
if (hash) {
|
|
140
|
-
const baseArray = [...conds.finalize(conditions), className]
|
|
141
|
-
result = formatClassName(toHash(baseArray.join(
|
|
143
|
+
const baseArray = [...conds.finalize(conditions), className];
|
|
144
|
+
result = formatClassName(toHash(baseArray.join(":")));
|
|
142
145
|
} else {
|
|
143
|
-
const baseArray = [...conds.finalize(conditions), formatClassName(className)]
|
|
144
|
-
result = baseArray.join(
|
|
146
|
+
const baseArray = [...conds.finalize(conditions), formatClassName(className)];
|
|
147
|
+
result = baseArray.join(":");
|
|
145
148
|
}
|
|
146
|
-
return result
|
|
147
|
-
}
|
|
149
|
+
return result;
|
|
150
|
+
};
|
|
148
151
|
return (styleObject = {}) => {
|
|
149
|
-
const normalizedObject = normalizeStyleObject(styleObject, context)
|
|
150
|
-
const classNames = /* @__PURE__ */ new Set()
|
|
152
|
+
const normalizedObject = normalizeStyleObject(styleObject, context);
|
|
153
|
+
const classNames = /* @__PURE__ */ new Set();
|
|
151
154
|
walkObject(normalizedObject, (value, paths) => {
|
|
152
|
-
const important = isImportant(value)
|
|
153
|
-
if (value == null)
|
|
154
|
-
|
|
155
|
-
const
|
|
156
|
-
const
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
155
|
+
const important = isImportant(value);
|
|
156
|
+
if (value == null)
|
|
157
|
+
return;
|
|
158
|
+
const [prop, ...allConditions] = conds.shift(paths);
|
|
159
|
+
const conditions = filterBaseConditions(allConditions);
|
|
160
|
+
const transformed = utility.transform(prop, withoutImportant(sanitize(value)));
|
|
161
|
+
let className = hashFn(conditions, transformed.className);
|
|
162
|
+
if (important)
|
|
163
|
+
className = `${className}!`;
|
|
164
|
+
classNames.add(className);
|
|
165
|
+
});
|
|
166
|
+
return Array.from(classNames).join(" ");
|
|
167
|
+
};
|
|
163
168
|
}
|
|
164
169
|
function compactStyles(...styles) {
|
|
165
|
-
return styles.filter((style) => isObject(style) && Object.keys(compact(style)).length > 0)
|
|
170
|
+
return styles.filter((style) => isObject(style) && Object.keys(compact(style)).length > 0);
|
|
166
171
|
}
|
|
167
172
|
function createMergeCss(context) {
|
|
168
173
|
function resolve(styles) {
|
|
169
|
-
const allStyles = compactStyles(...styles)
|
|
170
|
-
if (allStyles.length === 1)
|
|
171
|
-
|
|
174
|
+
const allStyles = compactStyles(...styles);
|
|
175
|
+
if (allStyles.length === 1)
|
|
176
|
+
return allStyles;
|
|
177
|
+
return allStyles.map((style) => normalizeShorthand(style, context));
|
|
172
178
|
}
|
|
173
179
|
function mergeCss(...styles) {
|
|
174
|
-
return mergeProps(...resolve(styles))
|
|
180
|
+
return mergeProps(...resolve(styles));
|
|
175
181
|
}
|
|
176
182
|
function assignCss(...styles) {
|
|
177
|
-
return Object.assign({}, ...resolve(styles))
|
|
183
|
+
return Object.assign({}, ...resolve(styles));
|
|
178
184
|
}
|
|
179
|
-
return { mergeCss, assignCss }
|
|
185
|
+
return { mergeCss, assignCss };
|
|
180
186
|
}
|
|
181
187
|
|
|
182
188
|
// src/memo.ts
|
|
183
189
|
var memo = (fn) => {
|
|
184
|
-
const cache = /* @__PURE__ */ new Map()
|
|
190
|
+
const cache = /* @__PURE__ */ new Map();
|
|
185
191
|
const get = (...args) => {
|
|
186
|
-
const key = JSON.stringify(args)
|
|
192
|
+
const key = JSON.stringify(args);
|
|
187
193
|
if (cache.has(key)) {
|
|
188
|
-
return cache.get(key)
|
|
194
|
+
return cache.get(key);
|
|
189
195
|
}
|
|
190
|
-
const result = fn(...args)
|
|
191
|
-
cache.set(key, result)
|
|
192
|
-
return result
|
|
193
|
-
}
|
|
194
|
-
return get
|
|
195
|
-
}
|
|
196
|
+
const result = fn(...args);
|
|
197
|
+
cache.set(key, result);
|
|
198
|
+
return result;
|
|
199
|
+
};
|
|
200
|
+
return get;
|
|
201
|
+
};
|
|
196
202
|
|
|
197
203
|
// src/hypenate-property.ts
|
|
198
|
-
var wordRegex = /([A-Z])/g
|
|
199
|
-
var msRegex = /^ms
|
|
204
|
+
var wordRegex = /([A-Z])/g;
|
|
205
|
+
var msRegex = /^ms-/;
|
|
200
206
|
var hypenateProperty = memo((property) => {
|
|
201
|
-
if (property.startsWith(
|
|
202
|
-
|
|
203
|
-
|
|
207
|
+
if (property.startsWith("--"))
|
|
208
|
+
return property;
|
|
209
|
+
return property.replace(wordRegex, "-$1").replace(msRegex, "-ms-").toLowerCase();
|
|
210
|
+
});
|
|
204
211
|
|
|
205
212
|
// src/slot.ts
|
|
206
213
|
var assign = (obj, path, value) => {
|
|
207
|
-
const last = path.pop()
|
|
214
|
+
const last = path.pop();
|
|
208
215
|
const target = path.reduce((acc, key) => {
|
|
209
|
-
if (acc[key] == null)
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
216
|
+
if (acc[key] == null)
|
|
217
|
+
acc[key] = {};
|
|
218
|
+
return acc[key];
|
|
219
|
+
}, obj);
|
|
220
|
+
if (last != null)
|
|
221
|
+
target[last] = value;
|
|
222
|
+
};
|
|
214
223
|
var getSlotRecipes = (recipe) => {
|
|
215
|
-
const parts = recipe.slots
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
224
|
+
const parts = recipe.slots.map((slot) => [
|
|
225
|
+
slot,
|
|
226
|
+
// setup base recipe
|
|
227
|
+
{
|
|
228
|
+
// create class-base on BEM
|
|
229
|
+
className: [recipe.className ?? "", slot].join("__"),
|
|
230
|
+
base: {},
|
|
231
|
+
variants: {},
|
|
232
|
+
defaultVariants: recipe.defaultVariants ?? {},
|
|
233
|
+
compoundVariants: []
|
|
234
|
+
}
|
|
235
|
+
]).map(([slot, cva]) => {
|
|
236
|
+
const base = recipe.base[slot];
|
|
237
|
+
if (base)
|
|
238
|
+
cva.base = base;
|
|
239
|
+
walkObject(
|
|
240
|
+
recipe.variants ?? {},
|
|
241
|
+
(variant, path) => {
|
|
242
|
+
if (!variant[slot])
|
|
243
|
+
return;
|
|
244
|
+
assign(cva, ["variants", ...path], variant[slot]);
|
|
226
245
|
},
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
const base = recipe.base[slot]
|
|
230
|
-
if (base) cva.base = base
|
|
231
|
-
walkObject(
|
|
232
|
-
recipe.variants ?? {},
|
|
233
|
-
(variant, path) => {
|
|
234
|
-
if (!variant[slot]) return
|
|
235
|
-
assign(cva, ['variants', ...path], variant[slot])
|
|
236
|
-
},
|
|
237
|
-
{
|
|
238
|
-
stop: (_value, path) => path.includes(slot),
|
|
239
|
-
},
|
|
240
|
-
)
|
|
241
|
-
if (recipe.compoundVariants) {
|
|
242
|
-
cva.compoundVariants = getSlotCompoundVariant(recipe.compoundVariants, slot)
|
|
246
|
+
{
|
|
247
|
+
stop: (_value, path) => path.includes(slot)
|
|
243
248
|
}
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
249
|
+
);
|
|
250
|
+
if (recipe.compoundVariants) {
|
|
251
|
+
cva.compoundVariants = getSlotCompoundVariant(recipe.compoundVariants, slot);
|
|
252
|
+
}
|
|
253
|
+
return [slot, cva];
|
|
254
|
+
});
|
|
255
|
+
return Object.fromEntries(parts);
|
|
256
|
+
};
|
|
257
|
+
var getSlotCompoundVariant = (compoundVariants, slotName) => compoundVariants.filter((compoundVariant) => compoundVariant.css[slotName]).map((compoundVariant) => ({ ...compoundVariant, css: compoundVariant.css[slotName] }));
|
|
252
258
|
|
|
253
259
|
// src/split-props.ts
|
|
254
260
|
function splitProps(props, ...keys) {
|
|
255
|
-
const descriptors = Object.getOwnPropertyDescriptors(props)
|
|
256
|
-
const dKeys = Object.keys(descriptors)
|
|
261
|
+
const descriptors = Object.getOwnPropertyDescriptors(props);
|
|
262
|
+
const dKeys = Object.keys(descriptors);
|
|
257
263
|
const split = (k) => {
|
|
258
|
-
const clone = {}
|
|
264
|
+
const clone = {};
|
|
259
265
|
for (let i = 0; i < k.length; i++) {
|
|
260
|
-
const key = k[i]
|
|
266
|
+
const key = k[i];
|
|
261
267
|
if (descriptors[key]) {
|
|
262
|
-
Object.defineProperty(clone, key, descriptors[key])
|
|
263
|
-
delete descriptors[key]
|
|
268
|
+
Object.defineProperty(clone, key, descriptors[key]);
|
|
269
|
+
delete descriptors[key];
|
|
264
270
|
}
|
|
265
271
|
}
|
|
266
|
-
return clone
|
|
267
|
-
}
|
|
268
|
-
const fn = (key) => split(Array.isArray(key) ? key : dKeys.filter(key))
|
|
269
|
-
return keys.map(fn).concat(split(dKeys))
|
|
272
|
+
return clone;
|
|
273
|
+
};
|
|
274
|
+
const fn = (key) => split(Array.isArray(key) ? key : dKeys.filter(key));
|
|
275
|
+
return keys.map(fn).concat(split(dKeys));
|
|
270
276
|
}
|
|
271
277
|
export {
|
|
272
278
|
compact,
|
|
@@ -284,19 +290,24 @@ export {
|
|
|
284
290
|
splitProps,
|
|
285
291
|
toHash,
|
|
286
292
|
walkObject,
|
|
287
|
-
withoutSpace
|
|
288
|
-
}
|
|
293
|
+
withoutSpace
|
|
294
|
+
};
|
|
295
|
+
|
|
296
|
+
|
|
289
297
|
|
|
290
298
|
// src/normalize-html.ts
|
|
291
|
-
var htmlProps = [
|
|
299
|
+
var htmlProps = ["htmlSize", "htmlTranslate", "htmlWidth", "htmlHeight"];
|
|
292
300
|
function convert(key) {
|
|
293
|
-
return htmlProps.includes(key) ? key.replace(
|
|
301
|
+
return htmlProps.includes(key) ? key.replace("html", "").toLowerCase() : key;
|
|
294
302
|
}
|
|
295
303
|
function normalizeHTMLProps(props) {
|
|
296
|
-
return Object.fromEntries(Object.entries(props).map(([key, value]) => [convert(key), value]))
|
|
304
|
+
return Object.fromEntries(Object.entries(props).map(([key, value]) => [convert(key), value]));
|
|
297
305
|
}
|
|
298
|
-
normalizeHTMLProps.keys = htmlProps
|
|
299
|
-
export {
|
|
306
|
+
normalizeHTMLProps.keys = htmlProps;
|
|
307
|
+
export {
|
|
308
|
+
normalizeHTMLProps
|
|
309
|
+
};
|
|
310
|
+
|
|
300
311
|
|
|
301
312
|
export function __spreadValues(a, b) {
|
|
302
313
|
return { ...a, ...b }
|
|
@@ -304,4 +315,4 @@ export function __spreadValues(a, b) {
|
|
|
304
315
|
|
|
305
316
|
export function __objRest(source, exclude) {
|
|
306
317
|
return Object.fromEntries(Object.entries(source).filter(([key]) => !exclude.includes(key)))
|
|
307
|
-
}
|
|
318
|
+
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/* eslint-disable */
|
|
2
2
|
import type { FunctionComponent } from 'react'
|
|
3
|
-
import type { AspectRatioProperties } from '../patterns/aspect-ratio'
|
|
4
|
-
import type { HTMLPandaProps } from '../types/jsx'
|
|
5
|
-
import type { DistributiveOmit } from '../types/system-types'
|
|
3
|
+
import type { AspectRatioProperties } from '../patterns/aspect-ratio';
|
|
4
|
+
import type { HTMLPandaProps } from '../types/jsx';
|
|
5
|
+
import type { DistributiveOmit } from '../types/system-types';
|
|
6
6
|
|
|
7
7
|
export type AspectRatioProps = AspectRatioProperties & DistributiveOmit<HTMLPandaProps<'div'>, keyof AspectRatioProperties | 'aspectRatio'>
|
|
8
8
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { createElement, forwardRef } from 'react'
|
|
2
|
-
import { panda } from './factory.mjs'
|
|
3
|
-
import { getAspectRatioStyle } from '../patterns/aspect-ratio.mjs'
|
|
2
|
+
import { panda } from './factory.mjs';
|
|
3
|
+
import { getAspectRatioStyle } from '../patterns/aspect-ratio.mjs';
|
|
4
4
|
|
|
5
5
|
export const AspectRatio = /* @__PURE__ */ forwardRef(function AspectRatio(props, ref) {
|
|
6
6
|
const { ratio, ...restProps } = props
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
})
|
|
7
|
+
const styleProps = getAspectRatioStyle({ratio})
|
|
8
|
+
return createElement(panda.div, { ref, ...styleProps, ...restProps })
|
|
9
|
+
})
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/* eslint-disable */
|
|
2
2
|
import type { FunctionComponent } from 'react'
|
|
3
|
-
import type { BleedProperties } from '../patterns/bleed'
|
|
4
|
-
import type { HTMLPandaProps } from '../types/jsx'
|
|
5
|
-
import type { DistributiveOmit } from '../types/system-types'
|
|
3
|
+
import type { BleedProperties } from '../patterns/bleed';
|
|
4
|
+
import type { HTMLPandaProps } from '../types/jsx';
|
|
5
|
+
import type { DistributiveOmit } from '../types/system-types';
|
|
6
6
|
|
|
7
7
|
export type BleedProps = BleedProperties & DistributiveOmit<HTMLPandaProps<'div'>, keyof BleedProperties >
|
|
8
8
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { createElement, forwardRef } from 'react'
|
|
2
|
-
import { panda } from './factory.mjs'
|
|
3
|
-
import { getBleedStyle } from '../patterns/bleed.mjs'
|
|
2
|
+
import { panda } from './factory.mjs';
|
|
3
|
+
import { getBleedStyle } from '../patterns/bleed.mjs';
|
|
4
4
|
|
|
5
5
|
export const Bleed = /* @__PURE__ */ forwardRef(function Bleed(props, ref) {
|
|
6
6
|
const { inline, block, ...restProps } = props
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
})
|
|
7
|
+
const styleProps = getBleedStyle({inline, block})
|
|
8
|
+
return createElement(panda.div, { ref, ...styleProps, ...restProps })
|
|
9
|
+
})
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/* eslint-disable */
|
|
2
2
|
import type { FunctionComponent } from 'react'
|
|
3
|
-
import type { BoxProperties } from '../patterns/box'
|
|
4
|
-
import type { HTMLPandaProps } from '../types/jsx'
|
|
5
|
-
import type { DistributiveOmit } from '../types/system-types'
|
|
3
|
+
import type { BoxProperties } from '../patterns/box';
|
|
4
|
+
import type { HTMLPandaProps } from '../types/jsx';
|
|
5
|
+
import type { DistributiveOmit } from '../types/system-types';
|
|
6
6
|
|
|
7
7
|
export type BoxProps = BoxProperties & DistributiveOmit<HTMLPandaProps<'div'>, keyof BoxProperties >
|
|
8
8
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { createElement, forwardRef } from 'react'
|
|
2
|
-
import { panda } from './factory.mjs'
|
|
3
|
-
import { getBoxStyle } from '../patterns/box.mjs'
|
|
2
|
+
import { panda } from './factory.mjs';
|
|
3
|
+
import { getBoxStyle } from '../patterns/box.mjs';
|
|
4
4
|
|
|
5
5
|
export const Box = /* @__PURE__ */ forwardRef(function Box(props, ref) {
|
|
6
6
|
const styleProps = getBoxStyle()
|
|
7
|
-
|
|
8
|
-
})
|
|
7
|
+
return createElement(panda.div, { ref, ...styleProps, ...props })
|
|
8
|
+
})
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/* eslint-disable */
|
|
2
2
|
import type { FunctionComponent } from 'react'
|
|
3
|
-
import type { CenterProperties } from '../patterns/center'
|
|
4
|
-
import type { HTMLPandaProps } from '../types/jsx'
|
|
5
|
-
import type { DistributiveOmit } from '../types/system-types'
|
|
3
|
+
import type { CenterProperties } from '../patterns/center';
|
|
4
|
+
import type { HTMLPandaProps } from '../types/jsx';
|
|
5
|
+
import type { DistributiveOmit } from '../types/system-types';
|
|
6
6
|
|
|
7
7
|
export type CenterProps = CenterProperties & DistributiveOmit<HTMLPandaProps<'div'>, keyof CenterProperties >
|
|
8
8
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { createElement, forwardRef } from 'react'
|
|
2
|
-
import { panda } from './factory.mjs'
|
|
3
|
-
import { getCenterStyle } from '../patterns/center.mjs'
|
|
2
|
+
import { panda } from './factory.mjs';
|
|
3
|
+
import { getCenterStyle } from '../patterns/center.mjs';
|
|
4
4
|
|
|
5
5
|
export const Center = /* @__PURE__ */ forwardRef(function Center(props, ref) {
|
|
6
6
|
const { inline, ...restProps } = props
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
})
|
|
7
|
+
const styleProps = getCenterStyle({inline})
|
|
8
|
+
return createElement(panda.div, { ref, ...styleProps, ...restProps })
|
|
9
|
+
})
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/* eslint-disable */
|
|
2
2
|
import type { FunctionComponent } from 'react'
|
|
3
|
-
import type { CircleProperties } from '../patterns/circle'
|
|
4
|
-
import type { HTMLPandaProps } from '../types/jsx'
|
|
5
|
-
import type { DistributiveOmit } from '../types/system-types'
|
|
3
|
+
import type { CircleProperties } from '../patterns/circle';
|
|
4
|
+
import type { HTMLPandaProps } from '../types/jsx';
|
|
5
|
+
import type { DistributiveOmit } from '../types/system-types';
|
|
6
6
|
|
|
7
7
|
export type CircleProps = CircleProperties & DistributiveOmit<HTMLPandaProps<'div'>, keyof CircleProperties >
|
|
8
8
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { createElement, forwardRef } from 'react'
|
|
2
|
-
import { panda } from './factory.mjs'
|
|
3
|
-
import { getCircleStyle } from '../patterns/circle.mjs'
|
|
2
|
+
import { panda } from './factory.mjs';
|
|
3
|
+
import { getCircleStyle } from '../patterns/circle.mjs';
|
|
4
4
|
|
|
5
5
|
export const Circle = /* @__PURE__ */ forwardRef(function Circle(props, ref) {
|
|
6
6
|
const { size, ...restProps } = props
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
})
|
|
7
|
+
const styleProps = getCircleStyle({size})
|
|
8
|
+
return createElement(panda.div, { ref, ...styleProps, ...restProps })
|
|
9
|
+
})
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/* eslint-disable */
|
|
2
2
|
import type { FunctionComponent } from 'react'
|
|
3
|
-
import type { ContainerProperties } from '../patterns/container'
|
|
4
|
-
import type { HTMLPandaProps } from '../types/jsx'
|
|
5
|
-
import type { DistributiveOmit } from '../types/system-types'
|
|
3
|
+
import type { ContainerProperties } from '../patterns/container';
|
|
4
|
+
import type { HTMLPandaProps } from '../types/jsx';
|
|
5
|
+
import type { DistributiveOmit } from '../types/system-types';
|
|
6
6
|
|
|
7
7
|
export type ContainerProps = ContainerProperties & DistributiveOmit<HTMLPandaProps<'div'>, keyof ContainerProperties >
|
|
8
8
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { createElement, forwardRef } from 'react'
|
|
2
|
-
import { panda } from './factory.mjs'
|
|
3
|
-
import { getContainerStyle } from '../patterns/container.mjs'
|
|
2
|
+
import { panda } from './factory.mjs';
|
|
3
|
+
import { getContainerStyle } from '../patterns/container.mjs';
|
|
4
4
|
|
|
5
5
|
export const Container = /* @__PURE__ */ forwardRef(function Container(props, ref) {
|
|
6
6
|
const styleProps = getContainerStyle()
|
|
7
|
-
|
|
8
|
-
})
|
|
7
|
+
return createElement(panda.div, { ref, ...styleProps, ...props })
|
|
8
|
+
})
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/* eslint-disable */
|
|
2
2
|
import type { FunctionComponent } from 'react'
|
|
3
|
-
import type { DividerProperties } from '../patterns/divider'
|
|
4
|
-
import type { HTMLPandaProps } from '../types/jsx'
|
|
5
|
-
import type { DistributiveOmit } from '../types/system-types'
|
|
3
|
+
import type { DividerProperties } from '../patterns/divider';
|
|
4
|
+
import type { HTMLPandaProps } from '../types/jsx';
|
|
5
|
+
import type { DistributiveOmit } from '../types/system-types';
|
|
6
6
|
|
|
7
7
|
export type DividerProps = DividerProperties & DistributiveOmit<HTMLPandaProps<'div'>, keyof DividerProperties >
|
|
8
8
|
|