@pandacss/generator 0.5.1 → 0.6.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 +300 -282
- package/dist/index.mjs +301 -283
- package/package.json +8 -8
package/dist/index.mjs
CHANGED
|
@@ -99,7 +99,7 @@ var getMessages = (ctx) => ({
|
|
|
99
99
|
|
|
100
100
|
// src/artifacts/index.ts
|
|
101
101
|
import { isObject } from "@pandacss/shared";
|
|
102
|
-
import
|
|
102
|
+
import outdent42 from "outdent";
|
|
103
103
|
|
|
104
104
|
// src/artifacts/css/global-css.ts
|
|
105
105
|
var generateGlobalCss = (ctx) => {
|
|
@@ -175,199 +175,197 @@ function generateKeyframeCss(ctx) {
|
|
|
175
175
|
var css = String.raw;
|
|
176
176
|
function generateResetCss(ctx, scope = "") {
|
|
177
177
|
const selector = scope ? `${scope} ` : "";
|
|
178
|
-
const output = css
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
}
|
|
178
|
+
const output = css`@layer reset {
|
|
179
|
+
${selector}* {
|
|
180
|
+
margin: 0;
|
|
181
|
+
padding: 0;
|
|
182
|
+
font: inherit;
|
|
183
|
+
}
|
|
185
184
|
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
185
|
+
${selector}*,
|
|
186
|
+
${selector}*::before,
|
|
187
|
+
${selector}*::after {
|
|
188
|
+
box-sizing: border-box;
|
|
189
|
+
border-width: 0;
|
|
190
|
+
border-style: solid;
|
|
191
|
+
border-color: var(--global-color-border, currentColor);
|
|
192
|
+
}
|
|
194
193
|
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
194
|
+
${scope || "html"} {
|
|
195
|
+
line-height: 1.5;
|
|
196
|
+
--font-fallback: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
|
|
197
|
+
'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol',
|
|
198
|
+
'Noto Color Emoji';
|
|
199
|
+
-webkit-text-size-adjust: 100%;
|
|
200
|
+
-webkit-text-size-adjust: 100%;
|
|
201
|
+
-webkit-font-smoothing: antialiased;
|
|
202
|
+
-moz-tab-size: 4;
|
|
203
|
+
tab-size: 4;
|
|
204
|
+
font-family: var(--global-font-body, var(--font-fallback));
|
|
205
|
+
}
|
|
207
206
|
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
207
|
+
${selector}hr {
|
|
208
|
+
height: 0;
|
|
209
|
+
color: inherit;
|
|
210
|
+
border-top-width: 1px;
|
|
211
|
+
}
|
|
213
212
|
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
213
|
+
body {
|
|
214
|
+
height: 100%;
|
|
215
|
+
line-height: inherit;
|
|
216
|
+
}
|
|
218
217
|
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
218
|
+
${selector}img {
|
|
219
|
+
border-style: none;
|
|
220
|
+
}
|
|
222
221
|
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
222
|
+
${selector}img,
|
|
223
|
+
${selector}svg,
|
|
224
|
+
${selector}video,
|
|
225
|
+
${selector}canvas,
|
|
226
|
+
${selector}audio,
|
|
227
|
+
${selector}iframe,
|
|
228
|
+
${selector}embed,
|
|
229
|
+
${selector}object {
|
|
230
|
+
display: block;
|
|
231
|
+
vertical-align: middle;
|
|
232
|
+
}
|
|
234
233
|
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
234
|
+
${selector}img,
|
|
235
|
+
${selector}video {
|
|
236
|
+
max-width: 100%;
|
|
237
|
+
height: auto;
|
|
238
|
+
}
|
|
240
239
|
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
240
|
+
${selector}p,
|
|
241
|
+
${selector}h1,
|
|
242
|
+
${selector}h2,
|
|
243
|
+
${selector}h3,
|
|
244
|
+
${selector}h4,
|
|
245
|
+
${selector}h5,
|
|
246
|
+
${selector}h6 {
|
|
247
|
+
overflow-wrap: break-word;
|
|
248
|
+
}
|
|
250
249
|
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
250
|
+
${selector}ol,
|
|
251
|
+
${selector}ul {
|
|
252
|
+
list-style: none;
|
|
253
|
+
}
|
|
255
254
|
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
255
|
+
${selector}code,
|
|
256
|
+
${selector}kbd,
|
|
257
|
+
${selector}pre,
|
|
258
|
+
${selector}samp {
|
|
259
|
+
font-size: 1em;
|
|
260
|
+
}
|
|
262
261
|
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
262
|
+
${selector}button,
|
|
263
|
+
${selector}[type='button'],
|
|
264
|
+
${selector}[type='reset'],
|
|
265
|
+
${selector}[type='submit'] {
|
|
266
|
+
-webkit-appearance: button;
|
|
267
|
+
background-color: transparent;
|
|
268
|
+
background-image: none;
|
|
269
|
+
}
|
|
271
270
|
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
271
|
+
${selector}button,
|
|
272
|
+
${selector}select {
|
|
273
|
+
text-transform: none;
|
|
274
|
+
}
|
|
276
275
|
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
276
|
+
${selector}table {
|
|
277
|
+
text-indent: 0;
|
|
278
|
+
border-color: inherit;
|
|
279
|
+
border-collapse: collapse;
|
|
280
|
+
}
|
|
282
281
|
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
282
|
+
${selector}input::placeholder,
|
|
283
|
+
${selector}textarea::placeholder {
|
|
284
|
+
opacity: 1;
|
|
285
|
+
color: var(--global-color-placeholder, #9ca3af);
|
|
286
|
+
}
|
|
288
287
|
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
288
|
+
${selector}textarea {
|
|
289
|
+
resize: vertical;
|
|
290
|
+
}
|
|
292
291
|
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
292
|
+
${selector}summary {
|
|
293
|
+
display: list-item;
|
|
294
|
+
}
|
|
296
295
|
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
296
|
+
${selector}small {
|
|
297
|
+
font-size: 80%;
|
|
298
|
+
}
|
|
300
299
|
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
300
|
+
${selector}sub,
|
|
301
|
+
${selector}sup {
|
|
302
|
+
font-size: 75%;
|
|
303
|
+
line-height: 0;
|
|
304
|
+
position: relative;
|
|
305
|
+
vertical-align: baseline;
|
|
306
|
+
}
|
|
308
307
|
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
308
|
+
${selector}sub {
|
|
309
|
+
bottom: -0.25em;
|
|
310
|
+
}
|
|
312
311
|
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
312
|
+
${selector}sup {
|
|
313
|
+
top: -0.5em;
|
|
314
|
+
}
|
|
316
315
|
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
316
|
+
${selector}dialog {
|
|
317
|
+
padding: 0;
|
|
318
|
+
}
|
|
320
319
|
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
320
|
+
${selector}a {
|
|
321
|
+
color: inherit;
|
|
322
|
+
text-decoration: inherit;
|
|
323
|
+
}
|
|
325
324
|
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
325
|
+
${selector}abbr:where([title]) {
|
|
326
|
+
text-decoration: underline dotted;
|
|
327
|
+
}
|
|
329
328
|
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
329
|
+
${selector}b,
|
|
330
|
+
${selector}strong {
|
|
331
|
+
font-weight: bolder;
|
|
332
|
+
}
|
|
334
333
|
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
334
|
+
${selector}code,
|
|
335
|
+
${selector}kbd,
|
|
336
|
+
${selector}samp,
|
|
337
|
+
${selector}pre {
|
|
338
|
+
font-size: 1em;
|
|
339
|
+
--font-mono-fallback: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New';
|
|
340
|
+
font-family: var(--global-font-mono, var(--font-fallback));
|
|
341
|
+
}
|
|
343
342
|
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
343
|
+
${selector}[type='search'] {
|
|
344
|
+
-webkit-appearance: textfield;
|
|
345
|
+
outline-offset: -2px;
|
|
346
|
+
}
|
|
348
347
|
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
348
|
+
${selector}::-webkit-search-decoration {
|
|
349
|
+
-webkit-appearance: none;
|
|
350
|
+
}
|
|
352
351
|
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
352
|
+
${selector}::-webkit-file-upload-button {
|
|
353
|
+
-webkit-appearance: button;
|
|
354
|
+
}
|
|
356
355
|
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
356
|
+
${selector}::-webkit-inner-spin-button,
|
|
357
|
+
${selector}::-webkit-outer-spin-button {
|
|
358
|
+
height: auto;
|
|
359
|
+
}
|
|
361
360
|
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
361
|
+
${selector}:-moz-ui-invalid {
|
|
362
|
+
box-shadow: none;
|
|
363
|
+
}
|
|
365
364
|
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
`;
|
|
365
|
+
${selector}:-moz-focusring {
|
|
366
|
+
outline: auto;
|
|
367
|
+
}
|
|
368
|
+
}`;
|
|
371
369
|
ctx.hooks.callHook("generator:css", "reset.css", output);
|
|
372
370
|
return output;
|
|
373
371
|
}
|
|
@@ -381,7 +379,15 @@ var generateStaticCss = (ctx) => {
|
|
|
381
379
|
const fn = getStaticCss(staticCss);
|
|
382
380
|
const results = fn({
|
|
383
381
|
breakpoints: Object.keys(theme.breakpoints ?? {}),
|
|
384
|
-
getPropertyKeys: (prop) =>
|
|
382
|
+
getPropertyKeys: (prop) => {
|
|
383
|
+
const propConfig = utility.config[prop];
|
|
384
|
+
if (!propConfig)
|
|
385
|
+
return [];
|
|
386
|
+
const values = utility.getPropertyValues(propConfig);
|
|
387
|
+
if (!values)
|
|
388
|
+
return [];
|
|
389
|
+
return Object.keys(values);
|
|
390
|
+
},
|
|
385
391
|
getRecipeKeys: (recipe) => recipes.details.find((detail) => detail.config.name === recipe)?.variantKeyMap ?? {}
|
|
386
392
|
});
|
|
387
393
|
results.css.forEach((css2) => {
|
|
@@ -795,7 +801,7 @@ import { outdent as outdent8 } from "outdent";
|
|
|
795
801
|
|
|
796
802
|
// src/artifacts/generated/helpers.mjs.json
|
|
797
803
|
var helpers_mjs_default = {
|
|
798
|
-
content: '// src/assert.ts\nfunction isObject(value) {\n return typeof value === "object" && value != null && !Array.isArray(value);\n}\n\n// src/astish.ts\nvar newRule = /(?:([\\u0080-\\uFFFF\\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\\s*)/g;\nvar ruleClean = /\\/\\*[^]*?\\*\\/|\\s\\s+|\\n/g;\nvar astish = (val, tree = [{}]) => {\n const block = newRule.exec((val ?? "").replace(ruleClean, ""));\n if (!block)\n return tree[0];\n if (block[4])\n tree.shift();\n else if (block[3])\n tree.unshift(tree[0][block[3]] = tree[0][block[3]] || {});\n else\n tree[0][block[1]] = block[2];\n return astish(val, tree);\n};\n\n// src/compact.ts\nfunction compact(value) {\n return Object.fromEntries(Object.entries(value ?? {}).filter(([_, value2]) => value2 !== void 0));\n}\n\n// src/condition.ts\nvar isBaseCondition = (v) => v === "base";\nfunction filterBaseConditions(c) {\n return c.slice().filter((v) => !isBaseCondition(v));\n}\n\n// src/css-important.ts\nvar importantRegex = /!(important)?$/;\nfunction isImportant(value) {\n return typeof value === "string" ? importantRegex.test(value) : false;\n}\nfunction withoutImportant(value) {\n return typeof value === "string" ? value.replace(importantRegex, "").trim() : value;\n}\nfunction withoutSpace(str) {\n return typeof str === "string" ? str.replaceAll(" ", "_") : str;\n}\n\n// src/hash.ts\nfunction toChar(code) {\n return String.fromCharCode(code + (code > 25 ? 39 : 97));\n}\nfunction toName(code) {\n let name = "";\n let x;\n for (x = Math.abs(code); x > 52; x = x / 52 | 0)\n name = toChar(x % 52) + name;\n return toChar(x % 52) + name;\n}\nfunction toPhash(h, x) {\n let i = x.length;\n while (i)\n h = h * 33 ^ x.charCodeAt(--i);\n return h;\n}\nfunction toHash(value) {\n return toName(toPhash(5381, value) >>> 0);\n}\n\n// src/merge-props.ts\nfunction mergeProps(...sources) {\n const result = {};\n for (const source of sources) {\n for (const [key, value] of Object.entries(source)) {\n if (isObject(value)) {\n result[key] = mergeProps(result[key] || {}, value);\n } else {\n result[key] = value;\n }\n }\n }\n return result;\n}\n\n// src/walk-object.ts\nvar isNotNullish = (element) => element != null;\nfunction walkObject(target, predicate, options = {}) {\n const { stop, getKey } = options;\n function inner(value, path = []) {\n if (isObject(value) || Array.isArray(value)) {\n const result = {};\n for (const [prop, child] of Object.entries(value)) {\n const key = getKey?.(prop) ?? prop;\n const childPath = [...path, key];\n if (stop?.(value, childPath)) {\n return predicate(value, path);\n }\n const next = inner(child, childPath);\n if (isNotNullish(next)) {\n result[key] = next;\n }\n }\n return result;\n }\n return predicate(value, path);\n }\n return inner(target);\n}\nfunction mapObject(obj, fn) {\n if (!isObject(obj))\n return fn(obj);\n return walkObject(obj, (value) => fn(value));\n}\n\n// src/normalize-style-object.ts\nfunction toResponsiveObject(values, breakpoints) {\n return values.reduce((acc, current, index) => {\n const key = breakpoints[index];\n if (current != null) {\n acc[key] = current;\n }\n return acc;\n }, {});\n}\nfunction normalizeShorthand(styles, context) {\n const { hasShorthand, resolveShorthand } = context.utility;\n return walkObject(styles, (v) => v, {\n getKey: (prop) => {\n return hasShorthand ? resolveShorthand(prop) : prop;\n }\n });\n}\nfunction normalizeStyleObject(styles, context) {\n const { utility, conditions } = context;\n const { hasShorthand, resolveShorthand } = utility;\n return walkObject(\n styles,\n (value) => {\n return Array.isArray(value) ? toResponsiveObject(value, conditions.breakpoints.keys) : value;\n },\n {\n stop: (value) => Array.isArray(value),\n getKey: (prop) => {\n return hasShorthand ? resolveShorthand(prop) : prop;\n }\n }\n );\n}\n\n// src/classname.ts\nvar fallbackCondition = {\n shift: (v) => v,\n finalize: (v) => v,\n breakpoints: { keys: [] }\n};\nvar sanitize = (value) => typeof value === "string" ? value.replaceAll(/[\\n\\s]+/g, " ") : value;\nfunction createCss(context) {\n const { utility, hash, conditions: conds = fallbackCondition } = context;\n const formatClassName = (str) => [utility.prefix, str].filter(Boolean).join("-");\n const hashFn = (conditions, className) => {\n let result;\n if (hash) {\n const baseArray = [...conds.finalize(conditions), className];\n result = formatClassName(toHash(baseArray.join(":")));\n } else {\n const baseArray = [...conds.finalize(conditions), formatClassName(className)];\n result = baseArray.join(":");\n }\n return result;\n };\n return (styleObject = {}) => {\n const normalizedObject = normalizeStyleObject(styleObject, context);\n const classNames = /* @__PURE__ */ new Set();\n walkObject(normalizedObject, (value, paths) => {\n const important = isImportant(value);\n if (value == null)\n return;\n const [prop, ...allConditions] = conds.shift(paths);\n const conditions = filterBaseConditions(allConditions);\n const transformed = utility.transform(prop, withoutImportant(sanitize(value)));\n let className = hashFn(conditions, transformed.className);\n if (important)\n className = `${className}!`;\n classNames.add(className);\n });\n return Array.from(classNames).join(" ");\n };\n}\nfunction compactStyles(...styles) {\n return styles.filter((style) => isObject(style) && Object.keys(compact(style)).length > 0);\n}\nfunction createMergeCss(context) {\n function resolve(styles) {\n const allStyles = compactStyles(...styles);\n if (allStyles.length === 1)\n return allStyles;\n return allStyles.map((style) => normalizeShorthand(style, context));\n }\n function mergeCss(...styles) {\n return mergeProps(...resolve(styles));\n }\n function assignCss(...styles) {\n return Object.assign({}, ...resolve(styles));\n }\n return { mergeCss, assignCss };\n}\n\n// src/memo.ts\nvar memo = (fn) => {\n const cache = /* @__PURE__ */ new Map();\n const get = (...args) => {\n const key = JSON.stringify(args);\n if (cache.has(key)) {\n return cache.get(key);\n }\n const result = fn(...args);\n cache.set(key, result);\n return result;\n };\n return get;\n};\n\n// src/hypenate.ts\nvar
|
|
804
|
+
content: '// src/assert.ts\nfunction isObject(value) {\n return typeof value === "object" && value != null && !Array.isArray(value);\n}\n\n// src/astish.ts\nvar newRule = /(?:([\\u0080-\\uFFFF\\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\\s*)/g;\nvar ruleClean = /\\/\\*[^]*?\\*\\/|\\s\\s+|\\n/g;\nvar astish = (val, tree = [{}]) => {\n const block = newRule.exec((val ?? "").replace(ruleClean, ""));\n if (!block)\n return tree[0];\n if (block[4])\n tree.shift();\n else if (block[3])\n tree.unshift(tree[0][block[3]] = tree[0][block[3]] || {});\n else\n tree[0][block[1]] = block[2];\n return astish(val, tree);\n};\n\n// src/compact.ts\nfunction compact(value) {\n return Object.fromEntries(Object.entries(value ?? {}).filter(([_, value2]) => value2 !== void 0));\n}\n\n// src/condition.ts\nvar isBaseCondition = (v) => v === "base";\nfunction filterBaseConditions(c) {\n return c.slice().filter((v) => !isBaseCondition(v));\n}\n\n// src/css-important.ts\nvar importantRegex = /!(important)?$/;\nfunction isImportant(value) {\n return typeof value === "string" ? importantRegex.test(value) : false;\n}\nfunction withoutImportant(value) {\n return typeof value === "string" ? value.replace(importantRegex, "").trim() : value;\n}\nfunction withoutSpace(str) {\n return typeof str === "string" ? str.replaceAll(" ", "_") : str;\n}\n\n// src/hash.ts\nfunction toChar(code) {\n return String.fromCharCode(code + (code > 25 ? 39 : 97));\n}\nfunction toName(code) {\n let name = "";\n let x;\n for (x = Math.abs(code); x > 52; x = x / 52 | 0)\n name = toChar(x % 52) + name;\n return toChar(x % 52) + name;\n}\nfunction toPhash(h, x) {\n let i = x.length;\n while (i)\n h = h * 33 ^ x.charCodeAt(--i);\n return h;\n}\nfunction toHash(value) {\n return toName(toPhash(5381, value) >>> 0);\n}\n\n// src/merge-props.ts\nfunction mergeProps(...sources) {\n const result = {};\n for (const source of sources) {\n for (const [key, value] of Object.entries(source)) {\n if (isObject(value)) {\n result[key] = mergeProps(result[key] || {}, value);\n } else {\n result[key] = value;\n }\n }\n }\n return result;\n}\n\n// src/walk-object.ts\nvar isNotNullish = (element) => element != null;\nfunction walkObject(target, predicate, options = {}) {\n const { stop, getKey } = options;\n function inner(value, path = []) {\n if (isObject(value) || Array.isArray(value)) {\n const result = {};\n for (const [prop, child] of Object.entries(value)) {\n const key = getKey?.(prop) ?? prop;\n const childPath = [...path, key];\n if (stop?.(value, childPath)) {\n return predicate(value, path);\n }\n const next = inner(child, childPath);\n if (isNotNullish(next)) {\n result[key] = next;\n }\n }\n return result;\n }\n return predicate(value, path);\n }\n return inner(target);\n}\nfunction mapObject(obj, fn) {\n if (!isObject(obj))\n return fn(obj);\n return walkObject(obj, (value) => fn(value));\n}\n\n// src/normalize-style-object.ts\nfunction toResponsiveObject(values, breakpoints) {\n return values.reduce((acc, current, index) => {\n const key = breakpoints[index];\n if (current != null) {\n acc[key] = current;\n }\n return acc;\n }, {});\n}\nfunction normalizeShorthand(styles, context) {\n const { hasShorthand, resolveShorthand } = context.utility;\n return walkObject(styles, (v) => v, {\n getKey: (prop) => {\n return hasShorthand ? resolveShorthand(prop) : prop;\n }\n });\n}\nfunction normalizeStyleObject(styles, context) {\n const { utility, conditions } = context;\n const { hasShorthand, resolveShorthand } = utility;\n return walkObject(\n styles,\n (value) => {\n return Array.isArray(value) ? toResponsiveObject(value, conditions.breakpoints.keys) : value;\n },\n {\n stop: (value) => Array.isArray(value),\n getKey: (prop) => {\n return hasShorthand ? resolveShorthand(prop) : prop;\n }\n }\n );\n}\n\n// src/classname.ts\nvar fallbackCondition = {\n shift: (v) => v,\n finalize: (v) => v,\n breakpoints: { keys: [] }\n};\nvar sanitize = (value) => typeof value === "string" ? value.replaceAll(/[\\n\\s]+/g, " ") : value;\nfunction createCss(context) {\n const { utility, hash, conditions: conds = fallbackCondition } = context;\n const formatClassName = (str) => [utility.prefix, str].filter(Boolean).join("-");\n const hashFn = (conditions, className) => {\n let result;\n if (hash) {\n const baseArray = [...conds.finalize(conditions), className];\n result = formatClassName(toHash(baseArray.join(":")));\n } else {\n const baseArray = [...conds.finalize(conditions), formatClassName(className)];\n result = baseArray.join(":");\n }\n return result;\n };\n return (styleObject = {}) => {\n const normalizedObject = normalizeStyleObject(styleObject, context);\n const classNames = /* @__PURE__ */ new Set();\n walkObject(normalizedObject, (value, paths) => {\n const important = isImportant(value);\n if (value == null)\n return;\n const [prop, ...allConditions] = conds.shift(paths);\n const conditions = filterBaseConditions(allConditions);\n const transformed = utility.transform(prop, withoutImportant(sanitize(value)));\n let className = hashFn(conditions, transformed.className);\n if (important)\n className = `${className}!`;\n classNames.add(className);\n });\n return Array.from(classNames).join(" ");\n };\n}\nfunction compactStyles(...styles) {\n return styles.filter((style) => isObject(style) && Object.keys(compact(style)).length > 0);\n}\nfunction createMergeCss(context) {\n function resolve(styles) {\n const allStyles = compactStyles(...styles);\n if (allStyles.length === 1)\n return allStyles;\n return allStyles.map((style) => normalizeShorthand(style, context));\n }\n function mergeCss(...styles) {\n return mergeProps(...resolve(styles));\n }\n function assignCss(...styles) {\n return Object.assign({}, ...resolve(styles));\n }\n return { mergeCss, assignCss };\n}\n\n// src/memo.ts\nvar memo = (fn) => {\n const cache = /* @__PURE__ */ new Map();\n const get = (...args) => {\n const key = JSON.stringify(args);\n if (cache.has(key)) {\n return cache.get(key);\n }\n const result = fn(...args);\n cache.set(key, result);\n return result;\n };\n return get;\n};\n\n// src/hypenate-property.ts\nvar wordRegex = /([A-Z])/g;\nvar msRegex = /^ms-/;\nvar hypenateProperty = memo((property) => {\n if (property.startsWith("--"))\n return property;\n return property.replace(wordRegex, "-$1").replace(msRegex, "-ms-").toLowerCase();\n});\n\n// src/normalize-html.ts\nvar htmlProps = ["htmlSize", "htmlTranslate", "htmlWidth", "htmlHeight"];\nfunction convert(key) {\n return htmlProps.includes(key) ? key.replace("html", "").toLowerCase() : key;\n}\nfunction normalizeHTMLProps(props) {\n return Object.fromEntries(Object.entries(props).map(([key, value]) => [convert(key), value]));\n}\nnormalizeHTMLProps.keys = htmlProps;\n\n// src/split-props.ts\nfunction splitProps(props, ...keys) {\n const descriptors = Object.getOwnPropertyDescriptors(props);\n const dKeys = Object.keys(descriptors);\n const split = (k) => {\n const clone = {};\n for (let i = 0; i < k.length; i++) {\n const key = k[i];\n if (descriptors[key]) {\n Object.defineProperty(clone, key, descriptors[key]);\n delete descriptors[key];\n }\n }\n return clone;\n };\n const fn = (key) => split(Array.isArray(key) ? key : dKeys.filter(key));\n return keys.map(fn).concat(split(dKeys));\n}\nexport {\n astish,\n compact,\n createCss,\n createMergeCss,\n filterBaseConditions,\n hypenateProperty,\n isBaseCondition,\n isObject,\n mapObject,\n mergeProps,\n normalizeHTMLProps,\n splitProps,\n toHash,\n walkObject,\n withoutSpace\n};\n'
|
|
799
805
|
};
|
|
800
806
|
|
|
801
807
|
// src/artifacts/js/helpers.ts
|
|
@@ -821,6 +827,7 @@ var is_valid_prop_mjs_default = {
|
|
|
821
827
|
};
|
|
822
828
|
|
|
823
829
|
// src/artifacts/js/is-valid-prop.ts
|
|
830
|
+
import { outdent as outdent9 } from "outdent";
|
|
824
831
|
function generateisValidProp(ctx) {
|
|
825
832
|
if (ctx.isTemplateLiteralSyntax)
|
|
826
833
|
return;
|
|
@@ -830,14 +837,19 @@ function generateisValidProp(ctx) {
|
|
|
830
837
|
`var userGenerated = [${ctx.properties.map((key) => JSON.stringify(key)).join(",")}]`
|
|
831
838
|
);
|
|
832
839
|
return {
|
|
833
|
-
js: content
|
|
840
|
+
js: content,
|
|
841
|
+
dts: outdent9`
|
|
842
|
+
declare const isCssProperty: (value: string) => boolean;
|
|
843
|
+
|
|
844
|
+
export { isCssProperty };
|
|
845
|
+
`
|
|
834
846
|
};
|
|
835
847
|
}
|
|
836
848
|
|
|
837
849
|
// src/artifacts/js/pattern.ts
|
|
838
850
|
import { unionType } from "@pandacss/shared";
|
|
839
851
|
import { stringify as stringify2 } from "javascript-stringify";
|
|
840
|
-
import { outdent as
|
|
852
|
+
import { outdent as outdent10 } from "outdent";
|
|
841
853
|
import { match } from "ts-pattern";
|
|
842
854
|
function generatePattern(ctx) {
|
|
843
855
|
if (ctx.patterns.isEmpty())
|
|
@@ -855,7 +867,7 @@ function generatePattern(ctx) {
|
|
|
855
867
|
}
|
|
856
868
|
return {
|
|
857
869
|
name: dashName,
|
|
858
|
-
dts:
|
|
870
|
+
dts: outdent10`
|
|
859
871
|
import type { SystemStyleObject, ConditionalValue } from '../types'
|
|
860
872
|
import type { PropertyValue } from '../types/prop-type'
|
|
861
873
|
import type { Properties } from '../types/csstype'
|
|
@@ -879,7 +891,7 @@ function generatePattern(ctx) {
|
|
|
879
891
|
}).join("\n ")}
|
|
880
892
|
}
|
|
881
893
|
|
|
882
|
-
${strict ?
|
|
894
|
+
${strict ? outdent10`export declare function ${name}(options: ${upperName}Properties): string` : outdent10`
|
|
883
895
|
|
|
884
896
|
type ${upperName}Options = ${upperName}Properties & Omit<SystemStyleObject, keyof ${upperName}Properties ${blocklistType}>
|
|
885
897
|
|
|
@@ -888,7 +900,7 @@ function generatePattern(ctx) {
|
|
|
888
900
|
`}
|
|
889
901
|
|
|
890
902
|
`,
|
|
891
|
-
js:
|
|
903
|
+
js: outdent10`
|
|
892
904
|
${ctx.file.import(helperImports.join(", "), "../helpers")}
|
|
893
905
|
${ctx.file.import("css", "../css/index")}
|
|
894
906
|
|
|
@@ -905,7 +917,7 @@ transform`)}
|
|
|
905
917
|
|
|
906
918
|
// src/artifacts/js/recipe.ts
|
|
907
919
|
import { unionType as unionType2 } from "@pandacss/shared";
|
|
908
|
-
import { outdent as
|
|
920
|
+
import { outdent as outdent11 } from "outdent";
|
|
909
921
|
var stringify3 = (value) => JSON.stringify(value, null, 2);
|
|
910
922
|
var isBooleanValue = (value) => value === "true" || value === "false";
|
|
911
923
|
function generateRecipes(ctx) {
|
|
@@ -919,7 +931,7 @@ function generateRecipes(ctx) {
|
|
|
919
931
|
const createRecipeFn = {
|
|
920
932
|
name: "create-recipe",
|
|
921
933
|
dts: "",
|
|
922
|
-
js:
|
|
934
|
+
js: outdent11`
|
|
923
935
|
${ctx.file.import("css", "../css/css")}
|
|
924
936
|
${ctx.file.import("assertCompoundVariant, getCompoundVariantCss", "../css/cva")}
|
|
925
937
|
${ctx.file.import("cx", "../css/cx")}
|
|
@@ -966,7 +978,7 @@ function generateRecipes(ctx) {
|
|
|
966
978
|
const { name, description, defaultVariants, compoundVariants } = config;
|
|
967
979
|
return {
|
|
968
980
|
name: dashName,
|
|
969
|
-
js:
|
|
981
|
+
js: outdent11`
|
|
970
982
|
${ctx.file.import("splitProps", "../helpers")}
|
|
971
983
|
${ctx.file.import("createRecipe", "./create-recipe")}
|
|
972
984
|
|
|
@@ -987,7 +999,7 @@ function generateRecipes(ctx) {
|
|
|
987
999
|
splitVariantProps,
|
|
988
1000
|
})
|
|
989
1001
|
`,
|
|
990
|
-
dts:
|
|
1002
|
+
dts: outdent11`
|
|
991
1003
|
import type { ConditionalValue } from '../types'
|
|
992
1004
|
import type { Pretty } from '../types/helpers'
|
|
993
1005
|
|
|
@@ -1025,7 +1037,7 @@ function generateRecipes(ctx) {
|
|
|
1025
1037
|
}
|
|
1026
1038
|
|
|
1027
1039
|
// src/artifacts/js/token.ts
|
|
1028
|
-
import
|
|
1040
|
+
import outdent12 from "outdent";
|
|
1029
1041
|
function generateTokenJs(ctx) {
|
|
1030
1042
|
const { tokens } = ctx;
|
|
1031
1043
|
const map = /* @__PURE__ */ new Map();
|
|
@@ -1036,7 +1048,7 @@ function generateTokenJs(ctx) {
|
|
|
1036
1048
|
});
|
|
1037
1049
|
const obj = Object.fromEntries(map);
|
|
1038
1050
|
return {
|
|
1039
|
-
js:
|
|
1051
|
+
js: outdent12`
|
|
1040
1052
|
const tokens = ${JSON.stringify(obj, null, 2)}
|
|
1041
1053
|
|
|
1042
1054
|
export function token(path, fallback) {
|
|
@@ -1049,7 +1061,7 @@ function generateTokenJs(ctx) {
|
|
|
1049
1061
|
|
|
1050
1062
|
token.var = tokenVar
|
|
1051
1063
|
`,
|
|
1052
|
-
dts:
|
|
1064
|
+
dts: outdent12`
|
|
1053
1065
|
import type { Token } from './tokens'
|
|
1054
1066
|
|
|
1055
1067
|
export declare const token: {
|
|
@@ -1063,11 +1075,11 @@ function generateTokenJs(ctx) {
|
|
|
1063
1075
|
}
|
|
1064
1076
|
|
|
1065
1077
|
// src/artifacts/preact-jsx/jsx.ts
|
|
1066
|
-
import { outdent as
|
|
1078
|
+
import { outdent as outdent13 } from "outdent";
|
|
1067
1079
|
function generatePreactJsxFactory(ctx) {
|
|
1068
1080
|
const { factoryName, componentName } = ctx.jsx;
|
|
1069
1081
|
return {
|
|
1070
|
-
js:
|
|
1082
|
+
js: outdent13`
|
|
1071
1083
|
import { h } from 'preact'
|
|
1072
1084
|
import { forwardRef } from 'preact/compat'
|
|
1073
1085
|
import { useMemo } from 'preact/hooks'
|
|
@@ -1134,7 +1146,7 @@ function generatePreactJsxFactory(ctx) {
|
|
|
1134
1146
|
}
|
|
1135
1147
|
|
|
1136
1148
|
// src/artifacts/preact-jsx/pattern.ts
|
|
1137
|
-
import { outdent as
|
|
1149
|
+
import { outdent as outdent14 } from "outdent";
|
|
1138
1150
|
import { match as match2 } from "ts-pattern";
|
|
1139
1151
|
function generatePreactJsxPattern(ctx) {
|
|
1140
1152
|
const { typeName, factoryName } = ctx.jsx;
|
|
@@ -1143,7 +1155,7 @@ function generatePreactJsxPattern(ctx) {
|
|
|
1143
1155
|
const { description, jsxElement = "div" } = pattern.config;
|
|
1144
1156
|
return {
|
|
1145
1157
|
name: dashName,
|
|
1146
|
-
js:
|
|
1158
|
+
js: outdent14`
|
|
1147
1159
|
import { h } from 'preact'
|
|
1148
1160
|
import { forwardRef } from 'preact/compat'
|
|
1149
1161
|
${ctx.file.import(factoryName, "./factory")}
|
|
@@ -1152,12 +1164,12 @@ function generatePreactJsxPattern(ctx) {
|
|
|
1152
1164
|
export const ${jsxName} = forwardRef(function ${jsxName}(props, ref) {
|
|
1153
1165
|
${match2(props.length).with(
|
|
1154
1166
|
0,
|
|
1155
|
-
() =>
|
|
1167
|
+
() => outdent14`
|
|
1156
1168
|
const styleProps = ${styleFnName}()
|
|
1157
1169
|
return h(${factoryName}.${jsxElement}, { ref, ...styleProps, ...props })
|
|
1158
1170
|
`
|
|
1159
1171
|
).otherwise(
|
|
1160
|
-
() =>
|
|
1172
|
+
() => outdent14`
|
|
1161
1173
|
const { ${props.join(", ")}, ...restProps } = props
|
|
1162
1174
|
const styleProps = ${styleFnName}({${props.join(", ")}})
|
|
1163
1175
|
return h(${factoryName}.${jsxElement}, { ref, ...styleProps, ...restProps })
|
|
@@ -1165,7 +1177,7 @@ function generatePreactJsxPattern(ctx) {
|
|
|
1165
1177
|
)}
|
|
1166
1178
|
})
|
|
1167
1179
|
`,
|
|
1168
|
-
dts:
|
|
1180
|
+
dts: outdent14`
|
|
1169
1181
|
import type { FunctionComponent } from 'preact'
|
|
1170
1182
|
import type { ${upperName}Properties } from '../patterns/${dashName}'
|
|
1171
1183
|
import type { ${typeName} } from '../types/jsx'
|
|
@@ -1180,15 +1192,15 @@ function generatePreactJsxPattern(ctx) {
|
|
|
1180
1192
|
}
|
|
1181
1193
|
|
|
1182
1194
|
// src/artifacts/preact-jsx/types.ts
|
|
1183
|
-
import { outdent as
|
|
1195
|
+
import { outdent as outdent15 } from "outdent";
|
|
1184
1196
|
function generatePreactJsxTypes(ctx) {
|
|
1185
1197
|
const { factoryName, componentName, upperName, typeName } = ctx.jsx;
|
|
1186
1198
|
return {
|
|
1187
|
-
jsxFactory:
|
|
1199
|
+
jsxFactory: outdent15`
|
|
1188
1200
|
import type { ${upperName} } from '../types/jsx'
|
|
1189
1201
|
export declare const ${factoryName}: ${upperName}
|
|
1190
1202
|
`,
|
|
1191
|
-
jsxType:
|
|
1203
|
+
jsxType: outdent15`
|
|
1192
1204
|
import type { ComponentProps, JSX } from 'preact'
|
|
1193
1205
|
import type { Assign, JsxStyleProps, JsxHTMLProps } from './system-types'
|
|
1194
1206
|
import type { RecipeDefinition, RecipeSelection, RecipeVariantRecord } from './recipe'
|
|
@@ -1223,11 +1235,11 @@ export type ${typeName}<T extends ElementType> = JsxHTMLProps<ComponentProps<T>,
|
|
|
1223
1235
|
}
|
|
1224
1236
|
|
|
1225
1237
|
// src/artifacts/preact-jsx/jsx.string-literal.ts
|
|
1226
|
-
import { outdent as
|
|
1238
|
+
import { outdent as outdent16 } from "outdent";
|
|
1227
1239
|
function generatePreactJsxStringLiteralFactory(ctx) {
|
|
1228
1240
|
const { factoryName, componentName } = ctx.jsx;
|
|
1229
1241
|
return {
|
|
1230
|
-
js:
|
|
1242
|
+
js: outdent16`
|
|
1231
1243
|
import { h } from 'preact'
|
|
1232
1244
|
import { forwardRef } from 'preact/compat'
|
|
1233
1245
|
${ctx.file.import("css, cx", "../css/index")}
|
|
@@ -1273,15 +1285,15 @@ function generatePreactJsxStringLiteralFactory(ctx) {
|
|
|
1273
1285
|
}
|
|
1274
1286
|
|
|
1275
1287
|
// src/artifacts/preact-jsx/types.string-literal.ts
|
|
1276
|
-
import { outdent as
|
|
1288
|
+
import { outdent as outdent17 } from "outdent";
|
|
1277
1289
|
function generatePreactJsxStringLiteralTypes(ctx) {
|
|
1278
1290
|
const { factoryName, componentName, upperName, typeName } = ctx.jsx;
|
|
1279
1291
|
return {
|
|
1280
|
-
jsxFactory:
|
|
1292
|
+
jsxFactory: outdent17`
|
|
1281
1293
|
import type { ${upperName} } from '../types/jsx'
|
|
1282
1294
|
export declare const ${factoryName}: ${upperName}
|
|
1283
1295
|
`,
|
|
1284
|
-
jsxType:
|
|
1296
|
+
jsxType: outdent17`
|
|
1285
1297
|
import type { ComponentProps, JSX } from 'preact'
|
|
1286
1298
|
|
|
1287
1299
|
type ElementType = keyof JSX.IntrinsicElements
|
|
@@ -1307,11 +1319,11 @@ export type ${typeName}<T extends ElementType> = ComponentProps<T>
|
|
|
1307
1319
|
}
|
|
1308
1320
|
|
|
1309
1321
|
// src/artifacts/qwik-jsx/jsx.ts
|
|
1310
|
-
import { outdent as
|
|
1322
|
+
import { outdent as outdent18 } from "outdent";
|
|
1311
1323
|
function generateQwikJsxFactory(ctx) {
|
|
1312
1324
|
const { factoryName, componentName } = ctx.jsx;
|
|
1313
1325
|
return {
|
|
1314
|
-
js:
|
|
1326
|
+
js: outdent18`
|
|
1315
1327
|
import { h } from '@builder.io/qwik'
|
|
1316
1328
|
${ctx.file.import("css, cx, cva, assignCss", "../css/index")}
|
|
1317
1329
|
${ctx.file.import("splitProps, normalizeHTMLProps", "../helpers")}
|
|
@@ -1375,7 +1387,7 @@ function generateQwikJsxFactory(ctx) {
|
|
|
1375
1387
|
}
|
|
1376
1388
|
|
|
1377
1389
|
// src/artifacts/qwik-jsx/pattern.ts
|
|
1378
|
-
import { outdent as
|
|
1390
|
+
import { outdent as outdent19 } from "outdent";
|
|
1379
1391
|
import { match as match3 } from "ts-pattern";
|
|
1380
1392
|
function generateQwikJsxPattern(ctx) {
|
|
1381
1393
|
const { typeName, factoryName } = ctx.jsx;
|
|
@@ -1384,7 +1396,7 @@ function generateQwikJsxPattern(ctx) {
|
|
|
1384
1396
|
const { description, jsxElement = "div" } = pattern.config;
|
|
1385
1397
|
return {
|
|
1386
1398
|
name: dashName,
|
|
1387
|
-
js:
|
|
1399
|
+
js: outdent19`
|
|
1388
1400
|
import { h } from '@builder.io/qwik'
|
|
1389
1401
|
${ctx.file.import(factoryName, "./factory")}
|
|
1390
1402
|
${ctx.file.import(styleFnName, `../patterns/${dashName}`)}
|
|
@@ -1392,12 +1404,12 @@ function generateQwikJsxPattern(ctx) {
|
|
|
1392
1404
|
export const ${jsxName} = function ${jsxName}(props) {
|
|
1393
1405
|
${match3(props.length).with(
|
|
1394
1406
|
0,
|
|
1395
|
-
() =>
|
|
1407
|
+
() => outdent19`
|
|
1396
1408
|
const styleProps = ${styleFnName}()
|
|
1397
1409
|
return h(${factoryName}.${jsxElement}, { ...styleProps, ...props })
|
|
1398
1410
|
`
|
|
1399
1411
|
).otherwise(
|
|
1400
|
-
() =>
|
|
1412
|
+
() => outdent19`
|
|
1401
1413
|
const { ${props.join(", ")}, ...restProps } = props
|
|
1402
1414
|
const styleProps = ${styleFnName}({${props.join(", ")}})
|
|
1403
1415
|
return h(${factoryName}.${jsxElement}, { ...styleProps, ...restProps })
|
|
@@ -1405,7 +1417,7 @@ function generateQwikJsxPattern(ctx) {
|
|
|
1405
1417
|
)}
|
|
1406
1418
|
}
|
|
1407
1419
|
`,
|
|
1408
|
-
dts:
|
|
1420
|
+
dts: outdent19`
|
|
1409
1421
|
import type { FunctionComponent } from '@builder.io/qwik'
|
|
1410
1422
|
import type { ${upperName}Properties } from '../patterns/${dashName}'
|
|
1411
1423
|
import type { ${typeName} } from '../types/jsx'
|
|
@@ -1424,15 +1436,15 @@ function generateQwikJsxPattern(ctx) {
|
|
|
1424
1436
|
}
|
|
1425
1437
|
|
|
1426
1438
|
// src/artifacts/qwik-jsx/types.ts
|
|
1427
|
-
import { outdent as
|
|
1439
|
+
import { outdent as outdent20 } from "outdent";
|
|
1428
1440
|
function generateQwikJsxTypes(ctx) {
|
|
1429
1441
|
const { factoryName, componentName, upperName, typeName } = ctx.jsx;
|
|
1430
1442
|
return {
|
|
1431
|
-
jsxFactory:
|
|
1443
|
+
jsxFactory: outdent20`
|
|
1432
1444
|
import { ${upperName} } from '../types/jsx'
|
|
1433
1445
|
export declare const ${factoryName}: ${upperName}
|
|
1434
1446
|
`,
|
|
1435
|
-
jsxType:
|
|
1447
|
+
jsxType: outdent20`
|
|
1436
1448
|
import type { FunctionComponent, QwikIntrinsicElements } from '@builder.io/qwik'
|
|
1437
1449
|
import type { Assign as _Assign, JsxStyleProps, PatchedHTMLProps } from './system-types'
|
|
1438
1450
|
import type { RecipeDefinition, RecipeSelection, RecipeVariantRecord } from './recipe'
|
|
@@ -1486,11 +1498,11 @@ export type ${typeName}<T extends ElementType> = Assign<ComponentProps<T>, JsxSt
|
|
|
1486
1498
|
}
|
|
1487
1499
|
|
|
1488
1500
|
// src/artifacts/qwik-jsx/jsx.string-literal.ts
|
|
1489
|
-
import { outdent as
|
|
1501
|
+
import { outdent as outdent21 } from "outdent";
|
|
1490
1502
|
function generateQwikJsxStringLiteralFactory(ctx) {
|
|
1491
1503
|
const { factoryName, componentName } = ctx.jsx;
|
|
1492
1504
|
return {
|
|
1493
|
-
js:
|
|
1505
|
+
js: outdent21`
|
|
1494
1506
|
import { h } from '@builder.io/qwik'
|
|
1495
1507
|
${ctx.file.import("css, cx", "../css/index")}
|
|
1496
1508
|
|
|
@@ -1535,15 +1547,15 @@ function generateQwikJsxStringLiteralFactory(ctx) {
|
|
|
1535
1547
|
}
|
|
1536
1548
|
|
|
1537
1549
|
// src/artifacts/qwik-jsx/types.string-literal.ts
|
|
1538
|
-
import { outdent as
|
|
1550
|
+
import { outdent as outdent22 } from "outdent";
|
|
1539
1551
|
function generateQwikJsxStringLiteralTypes(ctx) {
|
|
1540
1552
|
const { factoryName, componentName, upperName, typeName } = ctx.jsx;
|
|
1541
1553
|
return {
|
|
1542
|
-
jsxFactory:
|
|
1554
|
+
jsxFactory: outdent22`
|
|
1543
1555
|
import { ${upperName} } from '../types/jsx'
|
|
1544
1556
|
export declare const ${factoryName}: ${upperName}
|
|
1545
1557
|
`,
|
|
1546
|
-
jsxType:
|
|
1558
|
+
jsxType: outdent22`
|
|
1547
1559
|
import type { FunctionComponent, QwikIntrinsicElements } from '@builder.io/qwik'
|
|
1548
1560
|
|
|
1549
1561
|
type ElementType = keyof QwikIntrinsicElements | FunctionComponent<any>
|
|
@@ -1574,11 +1586,11 @@ export type ${typeName}<T extends ElementType> = ComponentProps<T>
|
|
|
1574
1586
|
}
|
|
1575
1587
|
|
|
1576
1588
|
// src/artifacts/react-jsx/jsx.ts
|
|
1577
|
-
import { outdent as
|
|
1589
|
+
import { outdent as outdent23 } from "outdent";
|
|
1578
1590
|
function generateReactJsxFactory(ctx) {
|
|
1579
1591
|
const { factoryName, componentName } = ctx.jsx;
|
|
1580
1592
|
return {
|
|
1581
|
-
js:
|
|
1593
|
+
js: outdent23`
|
|
1582
1594
|
import { createElement, forwardRef, useMemo } from 'react'
|
|
1583
1595
|
${ctx.file.import("css, cx, cva, assignCss", "../css/index")}
|
|
1584
1596
|
${ctx.file.import("splitProps, normalizeHTMLProps", "../helpers")}
|
|
@@ -1644,7 +1656,7 @@ function generateReactJsxFactory(ctx) {
|
|
|
1644
1656
|
}
|
|
1645
1657
|
|
|
1646
1658
|
// src/artifacts/react-jsx/pattern.ts
|
|
1647
|
-
import { outdent as
|
|
1659
|
+
import { outdent as outdent24 } from "outdent";
|
|
1648
1660
|
import { match as match4 } from "ts-pattern";
|
|
1649
1661
|
function generateReactJsxPattern(ctx) {
|
|
1650
1662
|
const { typeName, factoryName } = ctx.jsx;
|
|
@@ -1653,7 +1665,7 @@ function generateReactJsxPattern(ctx) {
|
|
|
1653
1665
|
const { description, jsxElement = "div" } = pattern.config;
|
|
1654
1666
|
return {
|
|
1655
1667
|
name: dashName,
|
|
1656
|
-
js:
|
|
1668
|
+
js: outdent24`
|
|
1657
1669
|
import { createElement, forwardRef } from 'react'
|
|
1658
1670
|
${ctx.file.import(factoryName, "./factory")}
|
|
1659
1671
|
${ctx.file.import(styleFnName, `../patterns/${dashName}`)}
|
|
@@ -1661,12 +1673,12 @@ function generateReactJsxPattern(ctx) {
|
|
|
1661
1673
|
export const ${jsxName} = forwardRef(function ${jsxName}(props, ref) {
|
|
1662
1674
|
${match4(props.length).with(
|
|
1663
1675
|
0,
|
|
1664
|
-
() =>
|
|
1676
|
+
() => outdent24`
|
|
1665
1677
|
const styleProps = ${styleFnName}()
|
|
1666
1678
|
return createElement(${factoryName}.${jsxElement}, { ref, ...styleProps, ...props })
|
|
1667
1679
|
`
|
|
1668
1680
|
).otherwise(
|
|
1669
|
-
() =>
|
|
1681
|
+
() => outdent24`
|
|
1670
1682
|
const { ${props.join(", ")}, ...restProps } = props
|
|
1671
1683
|
const styleProps = ${styleFnName}({${props.join(", ")}})
|
|
1672
1684
|
return createElement(${factoryName}.${jsxElement}, { ref, ...styleProps, ...restProps })
|
|
@@ -1674,7 +1686,7 @@ function generateReactJsxPattern(ctx) {
|
|
|
1674
1686
|
)}
|
|
1675
1687
|
})
|
|
1676
1688
|
`,
|
|
1677
|
-
dts:
|
|
1689
|
+
dts: outdent24`
|
|
1678
1690
|
import type { FunctionComponent } from 'react'
|
|
1679
1691
|
import type { ${upperName}Properties } from '../patterns/${dashName}'
|
|
1680
1692
|
import type { ${typeName} } from '../types/jsx'
|
|
@@ -1689,15 +1701,15 @@ function generateReactJsxPattern(ctx) {
|
|
|
1689
1701
|
}
|
|
1690
1702
|
|
|
1691
1703
|
// src/artifacts/react-jsx/types.ts
|
|
1692
|
-
import { outdent as
|
|
1704
|
+
import { outdent as outdent25 } from "outdent";
|
|
1693
1705
|
function generateReactJsxTypes(ctx) {
|
|
1694
1706
|
const { factoryName, componentName, upperName, typeName } = ctx.jsx;
|
|
1695
1707
|
return {
|
|
1696
|
-
jsxFactory:
|
|
1708
|
+
jsxFactory: outdent25`
|
|
1697
1709
|
import { ${upperName} } from '../types/jsx'
|
|
1698
1710
|
export declare const ${factoryName}: ${upperName}
|
|
1699
1711
|
`,
|
|
1700
|
-
jsxType:
|
|
1712
|
+
jsxType: outdent25`
|
|
1701
1713
|
import type { ComponentProps, ElementType } from 'react'
|
|
1702
1714
|
import type { Assign, JsxStyleProps, JsxHTMLProps } from './system-types'
|
|
1703
1715
|
import type { RecipeDefinition, RecipeSelection, RecipeVariantRecord } from './recipe'
|
|
@@ -1730,11 +1742,11 @@ export type ${typeName}<T extends ElementType> = JsxHTMLProps<ComponentProps<T>,
|
|
|
1730
1742
|
}
|
|
1731
1743
|
|
|
1732
1744
|
// src/artifacts/react-jsx/jsx.string-literal.ts
|
|
1733
|
-
import { outdent as
|
|
1745
|
+
import { outdent as outdent26 } from "outdent";
|
|
1734
1746
|
function generateReactJsxStringLiteralFactory(ctx) {
|
|
1735
1747
|
const { factoryName, componentName } = ctx.jsx;
|
|
1736
1748
|
return {
|
|
1737
|
-
js:
|
|
1749
|
+
js: outdent26`
|
|
1738
1750
|
import { createElement, forwardRef } from 'react'
|
|
1739
1751
|
${ctx.file.import("css, cx", "../css/index")}
|
|
1740
1752
|
|
|
@@ -1780,15 +1792,15 @@ function generateReactJsxStringLiteralFactory(ctx) {
|
|
|
1780
1792
|
}
|
|
1781
1793
|
|
|
1782
1794
|
// src/artifacts/react-jsx/types.string-literal.ts
|
|
1783
|
-
import { outdent as
|
|
1795
|
+
import { outdent as outdent27 } from "outdent";
|
|
1784
1796
|
function generateReactJsxStringLiteralTypes(ctx) {
|
|
1785
1797
|
const { factoryName, componentName, upperName, typeName } = ctx.jsx;
|
|
1786
1798
|
return {
|
|
1787
|
-
jsxFactory:
|
|
1799
|
+
jsxFactory: outdent27`
|
|
1788
1800
|
import { ${upperName} } from '../types/jsx'
|
|
1789
1801
|
export declare const ${factoryName}: ${upperName}
|
|
1790
1802
|
`,
|
|
1791
|
-
jsxType:
|
|
1803
|
+
jsxType: outdent27`
|
|
1792
1804
|
import type { ComponentProps, ElementType } from 'react'
|
|
1793
1805
|
|
|
1794
1806
|
type Dict = Record<string, unknown>
|
|
@@ -1812,11 +1824,11 @@ export type ${typeName}<T extends ElementType> = ComponentProps<T>
|
|
|
1812
1824
|
}
|
|
1813
1825
|
|
|
1814
1826
|
// src/artifacts/solid-jsx/jsx.ts
|
|
1815
|
-
import { outdent as
|
|
1827
|
+
import { outdent as outdent28 } from "outdent";
|
|
1816
1828
|
function generateSolidJsxFactory(ctx) {
|
|
1817
1829
|
const { componentName, factoryName } = ctx.jsx;
|
|
1818
1830
|
return {
|
|
1819
|
-
js:
|
|
1831
|
+
js: outdent28`
|
|
1820
1832
|
import { Dynamic } from 'solid-js/web'
|
|
1821
1833
|
import { mergeProps, splitProps } from 'solid-js'
|
|
1822
1834
|
import { createComponent } from 'solid-js/web'
|
|
@@ -1893,7 +1905,7 @@ function generateSolidJsxFactory(ctx) {
|
|
|
1893
1905
|
}
|
|
1894
1906
|
|
|
1895
1907
|
// src/artifacts/solid-jsx/pattern.ts
|
|
1896
|
-
import { outdent as
|
|
1908
|
+
import { outdent as outdent29 } from "outdent";
|
|
1897
1909
|
import { match as match5 } from "ts-pattern";
|
|
1898
1910
|
function generateSolidJsxPattern(ctx) {
|
|
1899
1911
|
const { typeName, factoryName } = ctx.jsx;
|
|
@@ -1902,7 +1914,7 @@ function generateSolidJsxPattern(ctx) {
|
|
|
1902
1914
|
const { description, jsxElement = "div" } = pattern.config;
|
|
1903
1915
|
return {
|
|
1904
1916
|
name: dashName,
|
|
1905
|
-
js:
|
|
1917
|
+
js: outdent29`
|
|
1906
1918
|
import { splitProps, mergeProps } from 'solid-js'
|
|
1907
1919
|
import { createComponent } from 'solid-js/web'
|
|
1908
1920
|
${ctx.file.import(factoryName, "./factory")}
|
|
@@ -1911,12 +1923,12 @@ function generateSolidJsxPattern(ctx) {
|
|
|
1911
1923
|
export function ${jsxName}(props) {
|
|
1912
1924
|
${match5(props.length).with(
|
|
1913
1925
|
0,
|
|
1914
|
-
() =>
|
|
1926
|
+
() => outdent29`
|
|
1915
1927
|
const styleProps = ${styleFnName}()
|
|
1916
1928
|
return createComponent(${factoryName}.${jsxElement}, mergeProps(styleProps, props))
|
|
1917
1929
|
`
|
|
1918
1930
|
).otherwise(
|
|
1919
|
-
() =>
|
|
1931
|
+
() => outdent29`
|
|
1920
1932
|
const [patternProps, restProps] = splitProps(props, [${props.map((v) => JSON.stringify(v)).join(", ")}]);
|
|
1921
1933
|
const styleProps = ${styleFnName}(patternProps)
|
|
1922
1934
|
return createComponent(${factoryName}.${jsxElement}, mergeProps(styleProps, restProps))
|
|
@@ -1924,7 +1936,7 @@ function generateSolidJsxPattern(ctx) {
|
|
|
1924
1936
|
)}
|
|
1925
1937
|
}
|
|
1926
1938
|
`,
|
|
1927
|
-
dts:
|
|
1939
|
+
dts: outdent29`
|
|
1928
1940
|
import { Component } from 'solid-js'
|
|
1929
1941
|
import { ${upperName}Properties } from '../patterns/${dashName}'
|
|
1930
1942
|
import { ${typeName} } from '../types/jsx'
|
|
@@ -1939,15 +1951,15 @@ function generateSolidJsxPattern(ctx) {
|
|
|
1939
1951
|
}
|
|
1940
1952
|
|
|
1941
1953
|
// src/artifacts/solid-jsx/types.ts
|
|
1942
|
-
import { outdent as
|
|
1954
|
+
import { outdent as outdent30 } from "outdent";
|
|
1943
1955
|
function generateSolidJsxTypes(ctx) {
|
|
1944
1956
|
const { factoryName, componentName, upperName, typeName } = ctx.jsx;
|
|
1945
1957
|
return {
|
|
1946
|
-
jsxFactory:
|
|
1958
|
+
jsxFactory: outdent30`
|
|
1947
1959
|
import type { ${upperName} } from '../types/jsx'
|
|
1948
1960
|
export declare const ${factoryName}: ${upperName}
|
|
1949
1961
|
`,
|
|
1950
|
-
jsxType:
|
|
1962
|
+
jsxType: outdent30`
|
|
1951
1963
|
import type { ComponentProps, Component, JSX } from 'solid-js'
|
|
1952
1964
|
import type { Assign, JsxStyleProps, JsxHTMLProps } from './system-types'
|
|
1953
1965
|
import type { RecipeDefinition, RecipeSelection, RecipeVariantRecord } from './recipe'
|
|
@@ -1982,11 +1994,11 @@ export type ${typeName}<T extends ElementType> = JsxHTMLProps<ComponentProps<T>,
|
|
|
1982
1994
|
}
|
|
1983
1995
|
|
|
1984
1996
|
// src/artifacts/solid-jsx/jsx.string-literal.ts
|
|
1985
|
-
import { outdent as
|
|
1997
|
+
import { outdent as outdent31 } from "outdent";
|
|
1986
1998
|
function generateSolidJsxStringLiteralFactory(ctx) {
|
|
1987
1999
|
const { componentName, factoryName } = ctx.jsx;
|
|
1988
2000
|
return {
|
|
1989
|
-
js:
|
|
2001
|
+
js: outdent31`
|
|
1990
2002
|
import { mergeProps, splitProps } from 'solid-js'
|
|
1991
2003
|
import { Dynamic, createComponent } from 'solid-js/web'
|
|
1992
2004
|
${ctx.file.import("css, cx", "../css/index")}
|
|
@@ -2038,15 +2050,15 @@ export const ${factoryName} = createJsxFactory()
|
|
|
2038
2050
|
}
|
|
2039
2051
|
|
|
2040
2052
|
// src/artifacts/solid-jsx/types.string-literal.ts
|
|
2041
|
-
import { outdent as
|
|
2053
|
+
import { outdent as outdent32 } from "outdent";
|
|
2042
2054
|
function generateSolidJsxStringLiteralTypes(ctx) {
|
|
2043
2055
|
const { factoryName, componentName, upperName, typeName } = ctx.jsx;
|
|
2044
2056
|
return {
|
|
2045
|
-
jsxFactory:
|
|
2057
|
+
jsxFactory: outdent32`
|
|
2046
2058
|
import type { ${upperName} } from '../types/jsx'
|
|
2047
2059
|
export declare const ${factoryName}: ${upperName}
|
|
2048
2060
|
`,
|
|
2049
|
-
jsxType:
|
|
2061
|
+
jsxType: outdent32`
|
|
2050
2062
|
import type { Component, ComponentProps, JSX } from 'solid-js'
|
|
2051
2063
|
|
|
2052
2064
|
type Dict = Record<string, unknown>
|
|
@@ -2072,11 +2084,11 @@ export type ${typeName}<T extends ElementType> = ComponentProps<T>
|
|
|
2072
2084
|
}
|
|
2073
2085
|
|
|
2074
2086
|
// src/artifacts/vue-jsx/jsx.ts
|
|
2075
|
-
import { outdent as
|
|
2087
|
+
import { outdent as outdent33 } from "outdent";
|
|
2076
2088
|
function generateVueJsxFactory(ctx) {
|
|
2077
2089
|
const { factoryName } = ctx.jsx;
|
|
2078
2090
|
return {
|
|
2079
|
-
js:
|
|
2091
|
+
js: outdent33`
|
|
2080
2092
|
import { defineComponent, h, computed } from 'vue'
|
|
2081
2093
|
${ctx.file.import("css, cx, cva, assignCss", "../css/index")}
|
|
2082
2094
|
${ctx.file.import("splitProps, normalizeHTMLProps", "../helpers")}
|
|
@@ -2150,11 +2162,11 @@ function generateVueJsxFactory(ctx) {
|
|
|
2150
2162
|
}
|
|
2151
2163
|
|
|
2152
2164
|
// src/artifacts/vue-jsx/jsx.string-literal.ts
|
|
2153
|
-
import { outdent as
|
|
2165
|
+
import { outdent as outdent34 } from "outdent";
|
|
2154
2166
|
function generateVueJsxStringLiteralFactory(ctx) {
|
|
2155
2167
|
const { factoryName } = ctx.jsx;
|
|
2156
2168
|
return {
|
|
2157
|
-
js:
|
|
2169
|
+
js: outdent34`
|
|
2158
2170
|
import { defineComponent, h, computed } from 'vue'
|
|
2159
2171
|
${ctx.file.import("css, cx", "../css/index")}
|
|
2160
2172
|
|
|
@@ -2204,7 +2216,7 @@ function generateVueJsxStringLiteralFactory(ctx) {
|
|
|
2204
2216
|
}
|
|
2205
2217
|
|
|
2206
2218
|
// src/artifacts/vue-jsx/pattern.ts
|
|
2207
|
-
import { outdent as
|
|
2219
|
+
import { outdent as outdent35 } from "outdent";
|
|
2208
2220
|
function generateVueJsxPattern(ctx) {
|
|
2209
2221
|
const { typeName, factoryName } = ctx.jsx;
|
|
2210
2222
|
return ctx.patterns.details.map((pattern) => {
|
|
@@ -2213,7 +2225,7 @@ function generateVueJsxPattern(ctx) {
|
|
|
2213
2225
|
const propList = props.map((v) => JSON.stringify(v)).join(", ");
|
|
2214
2226
|
return {
|
|
2215
2227
|
name: dashName,
|
|
2216
|
-
js:
|
|
2228
|
+
js: outdent35`
|
|
2217
2229
|
import { defineComponent, h, computed } from 'vue'
|
|
2218
2230
|
${ctx.file.import(factoryName, "./factory")}
|
|
2219
2231
|
${ctx.file.import(styleFnName, `../patterns/${dashName}`)}
|
|
@@ -2231,7 +2243,7 @@ function generateVueJsxPattern(ctx) {
|
|
|
2231
2243
|
}
|
|
2232
2244
|
})
|
|
2233
2245
|
`,
|
|
2234
|
-
dts:
|
|
2246
|
+
dts: outdent35`
|
|
2235
2247
|
import { FunctionalComponent } from 'vue'
|
|
2236
2248
|
import { ${upperName}Properties } from '../patterns/${dashName}'
|
|
2237
2249
|
import { ${typeName} } from '../types/jsx'
|
|
@@ -2246,15 +2258,15 @@ function generateVueJsxPattern(ctx) {
|
|
|
2246
2258
|
}
|
|
2247
2259
|
|
|
2248
2260
|
// src/artifacts/vue-jsx/types.ts
|
|
2249
|
-
import { outdent as
|
|
2261
|
+
import { outdent as outdent36 } from "outdent";
|
|
2250
2262
|
function generateVueJsxTypes(ctx) {
|
|
2251
2263
|
const { factoryName, componentName, upperName, typeName } = ctx.jsx;
|
|
2252
2264
|
return {
|
|
2253
|
-
jsxFactory:
|
|
2265
|
+
jsxFactory: outdent36`
|
|
2254
2266
|
import { ${upperName} } from '../types/jsx'
|
|
2255
2267
|
export declare const ${factoryName}: ${upperName}
|
|
2256
2268
|
`,
|
|
2257
|
-
jsxType:
|
|
2269
|
+
jsxType: outdent36`
|
|
2258
2270
|
import type { Component, FunctionalComponent } from 'vue'
|
|
2259
2271
|
import type { Assign, JsxStyleProps, JsxHTMLProps } from './system-types'
|
|
2260
2272
|
import type { RecipeDefinition, RecipeSelection, RecipeVariantRecord } from './recipe'
|
|
@@ -2411,15 +2423,15 @@ type IntrinsicElement =
|
|
|
2411
2423
|
}
|
|
2412
2424
|
|
|
2413
2425
|
// src/artifacts/vue-jsx/types.string-literal.ts
|
|
2414
|
-
import { outdent as
|
|
2426
|
+
import { outdent as outdent37 } from "outdent";
|
|
2415
2427
|
function generateVueJsxStringLiteralTypes(ctx) {
|
|
2416
2428
|
const { factoryName, componentName, upperName, typeName } = ctx.jsx;
|
|
2417
2429
|
return {
|
|
2418
|
-
jsxFactory:
|
|
2430
|
+
jsxFactory: outdent37`
|
|
2419
2431
|
import { ${upperName} } from '../types/jsx'
|
|
2420
2432
|
export declare const ${factoryName}: ${upperName}
|
|
2421
2433
|
`,
|
|
2422
|
-
jsxType:
|
|
2434
|
+
jsxType: outdent37`
|
|
2423
2435
|
import type { Component, FunctionalComponent } from 'vue'
|
|
2424
2436
|
|
|
2425
2437
|
type IntrinsicElement =
|
|
@@ -2634,22 +2646,27 @@ function generatePackageJson(ctx) {
|
|
|
2634
2646
|
exports: {
|
|
2635
2647
|
"./css": {
|
|
2636
2648
|
types: "./css/index.d.ts",
|
|
2649
|
+
require: "./css/index.mjs",
|
|
2637
2650
|
import: "./css/index.mjs"
|
|
2638
2651
|
},
|
|
2639
2652
|
"./jsx": {
|
|
2640
2653
|
types: "./jsx/index.d.ts",
|
|
2654
|
+
require: "./jsx/index.mjs",
|
|
2641
2655
|
import: "./jsx/index.mjs"
|
|
2642
2656
|
},
|
|
2643
2657
|
"./patterns": {
|
|
2644
2658
|
types: "./patterns/index.d.ts",
|
|
2659
|
+
require: "./patterns/index.mjs",
|
|
2645
2660
|
import: "./patterns/index.mjs"
|
|
2646
2661
|
},
|
|
2647
2662
|
"./recipes": {
|
|
2648
2663
|
types: "./recipes/index.d.ts",
|
|
2664
|
+
require: "./recipes/index.mjs",
|
|
2649
2665
|
import: "./recipes/index.mjs"
|
|
2650
2666
|
},
|
|
2651
2667
|
"./tokens": {
|
|
2652
2668
|
types: "./tokens/index.d.ts",
|
|
2669
|
+
require: "./tokens/index.mjs",
|
|
2653
2670
|
import: "./tokens/index.mjs"
|
|
2654
2671
|
},
|
|
2655
2672
|
"./types": {
|
|
@@ -2683,7 +2700,7 @@ var recipe_d_ts_default = {
|
|
|
2683
2700
|
|
|
2684
2701
|
// src/artifacts/generated/pattern.d.ts.json
|
|
2685
2702
|
var pattern_d_ts_default = {
|
|
2686
|
-
content: "import type { CssProperty, SystemStyleObject } from './system-types'\nimport type { TokenCategory } from '../tokens'\n\ntype Primitive = string | number | boolean | null | undefined\ntype LiteralUnion<T, K extends Primitive = string> = T | (K & Record<never, never>)\n\nexport type PatternProperty =\n | { type: 'property'; value: CssProperty }\n | { type: 'enum'; value: string[] }\n | { type: 'token'; value: TokenCategory; property?: CssProperty }\n | { type: 'string' | 'boolean' | 'number' }\n\nexport type PatternHelpers = {\n map: (value: any, fn: (value: string) => string | undefined) => any\n}\n\
|
|
2703
|
+
content: "import type { CssProperty, SystemStyleObject } from './system-types'\nimport type { TokenCategory } from '../tokens'\n\ntype Primitive = string | number | boolean | null | undefined\ntype LiteralUnion<T, K extends Primitive = string> = T | (K & Record<never, never>)\n\nexport type PatternProperty =\n | { type: 'property'; value: CssProperty }\n | { type: 'enum'; value: string[] }\n | { type: 'token'; value: TokenCategory; property?: CssProperty }\n | { type: 'string' | 'boolean' | 'number' }\n\nexport type PatternHelpers = {\n map: (value: any, fn: (value: string) => string | undefined) => any\n}\n\nexport type PatternProperties = Record<string, PatternProperty>\n\ntype Props<T> = Record<LiteralUnion<keyof T>, any>\n\nexport type PatternConfig<T extends PatternProperties = PatternProperties> = {\n /**\n * The description of the pattern. This will be used in the JSDoc comment.\n */\n description?: string\n /**\n * The JSX element rendered by the pattern\n * @default 'div'\n */\n jsxElement?: string\n /**\n * The properties of the pattern.\n */\n properties?: T\n /**\n * The css object this pattern will generate.\n */\n transform?: (props: Props<T>, helpers: PatternHelpers) => SystemStyleObject\n /**\n * The jsx element name this pattern will generate.\n */\n jsx?: string\n /**\n * Whether to only generate types for the specified properties.\n * This will disallow css properties\n */\n strict?: boolean\n /**\n * @experimental\n * Disallow certain css properties for this pattern\n */\n blocklist?: LiteralUnion<CssProperty>[]\n}\n"
|
|
2687
2704
|
};
|
|
2688
2705
|
|
|
2689
2706
|
// src/artifacts/generated/parts.d.ts.json
|
|
@@ -2710,12 +2727,12 @@ function getGeneratedTypes() {
|
|
|
2710
2727
|
}
|
|
2711
2728
|
|
|
2712
2729
|
// src/artifacts/types/main.ts
|
|
2713
|
-
import { outdent as
|
|
2730
|
+
import { outdent as outdent38 } from "outdent";
|
|
2714
2731
|
var generateTypesEntry = () => ({
|
|
2715
|
-
global:
|
|
2732
|
+
global: outdent38`
|
|
2716
2733
|
import type { RecipeVariantRecord, RecipeConfig } from './recipe'
|
|
2717
2734
|
import type { Parts } from './parts'
|
|
2718
|
-
import type { PatternConfig } from './pattern'
|
|
2735
|
+
import type { PatternConfig, PatternProperties } from './pattern'
|
|
2719
2736
|
import type { GlobalStyleObject, SystemStyleObject } from './system-types'
|
|
2720
2737
|
import type { CompositionStyles } from './composition'
|
|
2721
2738
|
|
|
@@ -2725,23 +2742,23 @@ var generateTypesEntry = () => ({
|
|
|
2725
2742
|
export function defineGlobalStyles(definition: GlobalStyleObject): GlobalStyleObject
|
|
2726
2743
|
export function defineTextStyles(definition: CompositionStyles['textStyles']): CompositionStyles['textStyles']
|
|
2727
2744
|
export function defineLayerStyles(definition: CompositionStyles['layerStyles']): CompositionStyles['layerStyles']
|
|
2728
|
-
export function definePattern<T>(config: PatternConfig<T>): PatternConfig
|
|
2745
|
+
export function definePattern<T extends PatternProperties>(config: PatternConfig<T>): PatternConfig
|
|
2729
2746
|
export function defineParts<T extends Parts>(parts: T): (config: Partial<Record<keyof T, SystemStyleObject>>) => Partial<Record<keyof T, SystemStyleObject>>;
|
|
2730
2747
|
}
|
|
2731
2748
|
`,
|
|
2732
|
-
index:
|
|
2749
|
+
index: outdent38`
|
|
2733
2750
|
import './global'
|
|
2734
2751
|
export type { ConditionalValue } from './conditions'
|
|
2735
2752
|
export type { GlobalStyleObject, JsxStyleProps, SystemStyleObject } from './system-types'
|
|
2736
2753
|
|
|
2737
2754
|
`,
|
|
2738
|
-
helpers:
|
|
2755
|
+
helpers: outdent38`
|
|
2739
2756
|
export type Pretty<T> = T extends infer U ? { [K in keyof U]: U[K] } : never
|
|
2740
2757
|
`
|
|
2741
2758
|
});
|
|
2742
2759
|
|
|
2743
2760
|
// src/artifacts/types/prop-types.ts
|
|
2744
|
-
import { outdent as
|
|
2761
|
+
import { outdent as outdent39 } from "outdent";
|
|
2745
2762
|
function generatePropTypes(ctx) {
|
|
2746
2763
|
const {
|
|
2747
2764
|
config: { strictTokens },
|
|
@@ -2749,7 +2766,7 @@ function generatePropTypes(ctx) {
|
|
|
2749
2766
|
} = ctx;
|
|
2750
2767
|
const strictText = `${strictTokens ? "" : " | CssValue<T>"}`;
|
|
2751
2768
|
const result = [
|
|
2752
|
-
|
|
2769
|
+
outdent39`
|
|
2753
2770
|
import type { ConditionalValue } from './conditions';
|
|
2754
2771
|
import type { CssProperties } from './system-types'
|
|
2755
2772
|
import type { Tokens } from '../tokens'
|
|
@@ -2772,7 +2789,7 @@ function generatePropTypes(ctx) {
|
|
|
2772
2789
|
result.push(` ${key}: Shorthand<${JSON.stringify(value)}>;`);
|
|
2773
2790
|
});
|
|
2774
2791
|
result.push("}");
|
|
2775
|
-
return
|
|
2792
|
+
return outdent39`
|
|
2776
2793
|
${result.join("\n")}
|
|
2777
2794
|
|
|
2778
2795
|
export type PropertyValue<T extends string> = T extends keyof PropertyTypes
|
|
@@ -2785,10 +2802,10 @@ function generatePropTypes(ctx) {
|
|
|
2785
2802
|
|
|
2786
2803
|
// src/artifacts/types/style-props.ts
|
|
2787
2804
|
import { allCssProperties } from "@pandacss/is-valid-prop";
|
|
2788
|
-
import
|
|
2805
|
+
import outdent40 from "outdent";
|
|
2789
2806
|
function generateStyleProps(ctx) {
|
|
2790
2807
|
const props = new Set(allCssProperties.concat(ctx.utility.keys()));
|
|
2791
|
-
return
|
|
2808
|
+
return outdent40`
|
|
2792
2809
|
import type { ConditionalValue } from './conditions'
|
|
2793
2810
|
import type { PropertyValue } from './prop-type'
|
|
2794
2811
|
import type { Token } from '../tokens'
|
|
@@ -2805,7 +2822,7 @@ function generateStyleProps(ctx) {
|
|
|
2805
2822
|
|
|
2806
2823
|
// src/artifacts/types/token-types.ts
|
|
2807
2824
|
import { capitalize, unionType as unionType3 } from "@pandacss/shared";
|
|
2808
|
-
import { outdent as
|
|
2825
|
+
import { outdent as outdent41 } from "outdent";
|
|
2809
2826
|
import pluralize from "pluralize";
|
|
2810
2827
|
var categories = [
|
|
2811
2828
|
"zIndex",
|
|
@@ -2850,7 +2867,7 @@ function generateTokenTypes(ctx) {
|
|
|
2850
2867
|
result.add("} & { [token: string]: never }");
|
|
2851
2868
|
set.add(Array.from(result).join("\n"));
|
|
2852
2869
|
set.add(`export type TokenCategory = ${unionType3(categories)}`);
|
|
2853
|
-
return
|
|
2870
|
+
return outdent41.string(Array.from(set).join("\n\n"));
|
|
2854
2871
|
}
|
|
2855
2872
|
|
|
2856
2873
|
// src/artifacts/index.ts
|
|
@@ -2947,8 +2964,8 @@ function setupRecipes(ctx) {
|
|
|
2947
2964
|
return;
|
|
2948
2965
|
const indexFiles = files.filter((file) => !file.name.includes("create-recipe"));
|
|
2949
2966
|
const index = {
|
|
2950
|
-
js:
|
|
2951
|
-
dts:
|
|
2967
|
+
js: outdent42.string(indexFiles.map((file) => ctx.file.export(`./${file.name}`)).join("\n")),
|
|
2968
|
+
dts: outdent42.string(indexFiles.map((file) => `export * from './${file.name}'`).join("\n"))
|
|
2952
2969
|
};
|
|
2953
2970
|
return {
|
|
2954
2971
|
dir: ctx.paths.recipe,
|
|
@@ -2967,8 +2984,8 @@ function setupPatterns(ctx) {
|
|
|
2967
2984
|
if (!files)
|
|
2968
2985
|
return;
|
|
2969
2986
|
const index = {
|
|
2970
|
-
js:
|
|
2971
|
-
dts:
|
|
2987
|
+
js: outdent42.string(files.map((file) => ctx.file.export(`./${file.name}`)).join("\n")),
|
|
2988
|
+
dts: outdent42.string(files.map((file) => `export * from './${file.name}'`).join("\n"))
|
|
2972
2989
|
};
|
|
2973
2990
|
return {
|
|
2974
2991
|
dir: ctx.paths.pattern,
|
|
@@ -2988,13 +3005,15 @@ function setupJsx(ctx) {
|
|
|
2988
3005
|
const factory = generateJsxFactory(ctx);
|
|
2989
3006
|
const patterns = generateJsxPatterns(ctx);
|
|
2990
3007
|
const index = {
|
|
2991
|
-
js:
|
|
3008
|
+
js: outdent42`
|
|
2992
3009
|
${ctx.file.export("./factory")}
|
|
2993
|
-
${
|
|
3010
|
+
${isValidProp?.js ? ctx.file.export("./is-valid-prop") : ""}
|
|
3011
|
+
${outdent42.string(patterns.map((file) => ctx.file.export(`./${file.name}`)).join("\n"))}
|
|
2994
3012
|
`,
|
|
2995
|
-
dts:
|
|
3013
|
+
dts: outdent42`
|
|
2996
3014
|
export * from './factory'
|
|
2997
|
-
${
|
|
3015
|
+
${isValidProp?.dts ? `export * from './is-valid-prop'` : ""}
|
|
3016
|
+
${outdent42.string(patterns.map((file) => `export * from './${file.name}'`).join("\n"))}
|
|
2998
3017
|
export type { ${ctx.jsx.typeName} } from '../types/jsx'
|
|
2999
3018
|
`
|
|
3000
3019
|
};
|
|
@@ -3004,6 +3023,7 @@ function setupJsx(ctx) {
|
|
|
3004
3023
|
...patterns.map((file) => ({ file: ctx.file.ext(file.name), code: file.js })),
|
|
3005
3024
|
...patterns.map((file) => ({ file: `${file.name}.d.ts`, code: file.dts })),
|
|
3006
3025
|
{ file: ctx.file.ext("is-valid-prop"), code: isValidProp?.js },
|
|
3026
|
+
{ file: "is-valid-prop.d.ts", code: isValidProp?.dts },
|
|
3007
3027
|
{ file: "factory.d.ts", code: types.jsxFactory },
|
|
3008
3028
|
{ file: ctx.file.ext("factory"), code: factory?.js },
|
|
3009
3029
|
{ file: "index.d.ts", code: index.dts },
|
|
@@ -3013,12 +3033,12 @@ function setupJsx(ctx) {
|
|
|
3013
3033
|
}
|
|
3014
3034
|
function setupCssIndex(ctx) {
|
|
3015
3035
|
const index = {
|
|
3016
|
-
js:
|
|
3036
|
+
js: outdent42`
|
|
3017
3037
|
${ctx.file.export("./css")}
|
|
3018
3038
|
${ctx.file.export("./cx")}
|
|
3019
3039
|
${ctx.isTemplateLiteralSyntax ? "" : ctx.file.export("./cva")}
|
|
3020
3040
|
`,
|
|
3021
|
-
dts:
|
|
3041
|
+
dts: outdent42`
|
|
3022
3042
|
export * from './css'
|
|
3023
3043
|
export * from './cx'
|
|
3024
3044
|
${ctx.isTemplateLiteralSyntax ? "" : `export * from './cva'`}
|
|
@@ -3115,8 +3135,7 @@ var generateFlattenedCss = (ctx) => (options) => {
|
|
|
3115
3135
|
// src/artifacts/css/parser-css.ts
|
|
3116
3136
|
import { logger } from "@pandacss/logger";
|
|
3117
3137
|
import { pipe, tap, tryCatch } from "lil-fp/func";
|
|
3118
|
-
import { match as match6
|
|
3119
|
-
var flattenStyles = (data) => Object.assign({}, data, { css: void 0 }, data.css ?? {});
|
|
3138
|
+
import { P, match as match6 } from "ts-pattern";
|
|
3120
3139
|
var generateParserCss = (ctx) => (result) => pipe(
|
|
3121
3140
|
{ ...ctx, sheet: ctx.createSheet(), result },
|
|
3122
3141
|
tap(({ sheet, result: result2, patterns, recipes }) => {
|
|
@@ -3132,7 +3151,7 @@ var generateParserCss = (ctx) => (result) => pipe(
|
|
|
3132
3151
|
});
|
|
3133
3152
|
result2.jsx.forEach((jsx) => {
|
|
3134
3153
|
jsx.data.forEach((data) => {
|
|
3135
|
-
sheet.
|
|
3154
|
+
sheet.processStyleProps(data);
|
|
3136
3155
|
});
|
|
3137
3156
|
});
|
|
3138
3157
|
result2.recipe.forEach((recipeSet, name) => {
|
|
@@ -3143,8 +3162,8 @@ var generateParserCss = (ctx) => (result) => pipe(
|
|
|
3143
3162
|
continue;
|
|
3144
3163
|
match6(recipe).with({ type: "jsx-recipe", name: P.string }, ({ name: name2 }) => {
|
|
3145
3164
|
recipe.data.forEach((data) => {
|
|
3146
|
-
const [recipeProps, styleProps] = recipes.splitProps(name2,
|
|
3147
|
-
sheet.
|
|
3165
|
+
const [recipeProps, styleProps] = recipes.splitProps(name2, data);
|
|
3166
|
+
sheet.processStyleProps(styleProps);
|
|
3148
3167
|
sheet.processRecipe(recipeConfig, recipeProps);
|
|
3149
3168
|
});
|
|
3150
3169
|
}).otherwise(() => {
|
|
@@ -3163,8 +3182,8 @@ var generateParserCss = (ctx) => (result) => pipe(
|
|
|
3163
3182
|
match6(pattern).with({ type: "jsx-pattern", name: P.string }, ({ name: name2 }) => {
|
|
3164
3183
|
pattern.data.forEach((data) => {
|
|
3165
3184
|
const fnName = patterns.getFnName(name2);
|
|
3166
|
-
const styleProps = patterns.transform(fnName,
|
|
3167
|
-
sheet.
|
|
3185
|
+
const styleProps = patterns.transform(fnName, data);
|
|
3186
|
+
sheet.processStyleProps(styleProps);
|
|
3168
3187
|
});
|
|
3169
3188
|
}).otherwise(() => {
|
|
3170
3189
|
pattern.data.forEach((data) => {
|
|
@@ -3423,8 +3442,7 @@ var createGenerator = (conf) => {
|
|
|
3423
3442
|
isStyleProp: isValidProperty,
|
|
3424
3443
|
nodes: [...patterns.nodes, ...recipes.nodes]
|
|
3425
3444
|
},
|
|
3426
|
-
|
|
3427
|
-
getRecipeByName: recipes.getConfig
|
|
3445
|
+
getRecipesByJsxName: recipes.filter
|
|
3428
3446
|
}
|
|
3429
3447
|
};
|
|
3430
3448
|
};
|