@pandacss/generator 0.5.0 → 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 +78 -75
- package/dist/index.d.ts +78 -75
- package/dist/index.js +323 -302
- package/dist/index.mjs +324 -303
- package/package.json +8 -8
package/dist/index.mjs
CHANGED
|
@@ -42,7 +42,7 @@ var artifactsGenerated = (ctx) => {
|
|
|
42
42
|
${tick} ${quote(outdir, "/recipes")}: functions to create multi-variant styles
|
|
43
43
|
`,
|
|
44
44
|
jsx.framework && outdent`
|
|
45
|
-
${tick} ${quote(outdir, "/jsx")}:
|
|
45
|
+
${tick} ${quote(outdir, "/jsx")}: styled jsx elements for ${jsx.framework}
|
|
46
46
|
`,
|
|
47
47
|
"\n"
|
|
48
48
|
].filter(Boolean).join("\n");
|
|
@@ -97,12 +97,9 @@ var getMessages = (ctx) => ({
|
|
|
97
97
|
configWatch
|
|
98
98
|
});
|
|
99
99
|
|
|
100
|
-
// src/generator.ts
|
|
101
|
-
import { Obj as Obj2, pipe as pipe3 } from "lil-fp";
|
|
102
|
-
|
|
103
100
|
// src/artifacts/index.ts
|
|
104
101
|
import { isObject } from "@pandacss/shared";
|
|
105
|
-
import
|
|
102
|
+
import outdent42 from "outdent";
|
|
106
103
|
|
|
107
104
|
// src/artifacts/css/global-css.ts
|
|
108
105
|
var generateGlobalCss = (ctx) => {
|
|
@@ -178,199 +175,197 @@ function generateKeyframeCss(ctx) {
|
|
|
178
175
|
var css = String.raw;
|
|
179
176
|
function generateResetCss(ctx, scope = "") {
|
|
180
177
|
const selector = scope ? `${scope} ` : "";
|
|
181
|
-
const output = css
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
}
|
|
178
|
+
const output = css`@layer reset {
|
|
179
|
+
${selector}* {
|
|
180
|
+
margin: 0;
|
|
181
|
+
padding: 0;
|
|
182
|
+
font: inherit;
|
|
183
|
+
}
|
|
188
184
|
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
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
|
+
}
|
|
197
193
|
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
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
|
+
}
|
|
210
206
|
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
207
|
+
${selector}hr {
|
|
208
|
+
height: 0;
|
|
209
|
+
color: inherit;
|
|
210
|
+
border-top-width: 1px;
|
|
211
|
+
}
|
|
216
212
|
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
213
|
+
body {
|
|
214
|
+
height: 100%;
|
|
215
|
+
line-height: inherit;
|
|
216
|
+
}
|
|
221
217
|
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
218
|
+
${selector}img {
|
|
219
|
+
border-style: none;
|
|
220
|
+
}
|
|
225
221
|
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
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
|
+
}
|
|
237
233
|
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
234
|
+
${selector}img,
|
|
235
|
+
${selector}video {
|
|
236
|
+
max-width: 100%;
|
|
237
|
+
height: auto;
|
|
238
|
+
}
|
|
243
239
|
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
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
|
+
}
|
|
253
249
|
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
250
|
+
${selector}ol,
|
|
251
|
+
${selector}ul {
|
|
252
|
+
list-style: none;
|
|
253
|
+
}
|
|
258
254
|
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
255
|
+
${selector}code,
|
|
256
|
+
${selector}kbd,
|
|
257
|
+
${selector}pre,
|
|
258
|
+
${selector}samp {
|
|
259
|
+
font-size: 1em;
|
|
260
|
+
}
|
|
265
261
|
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
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
|
+
}
|
|
274
270
|
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
271
|
+
${selector}button,
|
|
272
|
+
${selector}select {
|
|
273
|
+
text-transform: none;
|
|
274
|
+
}
|
|
279
275
|
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
276
|
+
${selector}table {
|
|
277
|
+
text-indent: 0;
|
|
278
|
+
border-color: inherit;
|
|
279
|
+
border-collapse: collapse;
|
|
280
|
+
}
|
|
285
281
|
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
282
|
+
${selector}input::placeholder,
|
|
283
|
+
${selector}textarea::placeholder {
|
|
284
|
+
opacity: 1;
|
|
285
|
+
color: var(--global-color-placeholder, #9ca3af);
|
|
286
|
+
}
|
|
291
287
|
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
288
|
+
${selector}textarea {
|
|
289
|
+
resize: vertical;
|
|
290
|
+
}
|
|
295
291
|
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
292
|
+
${selector}summary {
|
|
293
|
+
display: list-item;
|
|
294
|
+
}
|
|
299
295
|
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
296
|
+
${selector}small {
|
|
297
|
+
font-size: 80%;
|
|
298
|
+
}
|
|
303
299
|
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
300
|
+
${selector}sub,
|
|
301
|
+
${selector}sup {
|
|
302
|
+
font-size: 75%;
|
|
303
|
+
line-height: 0;
|
|
304
|
+
position: relative;
|
|
305
|
+
vertical-align: baseline;
|
|
306
|
+
}
|
|
311
307
|
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
308
|
+
${selector}sub {
|
|
309
|
+
bottom: -0.25em;
|
|
310
|
+
}
|
|
315
311
|
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
312
|
+
${selector}sup {
|
|
313
|
+
top: -0.5em;
|
|
314
|
+
}
|
|
319
315
|
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
316
|
+
${selector}dialog {
|
|
317
|
+
padding: 0;
|
|
318
|
+
}
|
|
323
319
|
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
320
|
+
${selector}a {
|
|
321
|
+
color: inherit;
|
|
322
|
+
text-decoration: inherit;
|
|
323
|
+
}
|
|
328
324
|
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
325
|
+
${selector}abbr:where([title]) {
|
|
326
|
+
text-decoration: underline dotted;
|
|
327
|
+
}
|
|
332
328
|
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
329
|
+
${selector}b,
|
|
330
|
+
${selector}strong {
|
|
331
|
+
font-weight: bolder;
|
|
332
|
+
}
|
|
337
333
|
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
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
|
+
}
|
|
346
342
|
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
343
|
+
${selector}[type='search'] {
|
|
344
|
+
-webkit-appearance: textfield;
|
|
345
|
+
outline-offset: -2px;
|
|
346
|
+
}
|
|
351
347
|
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
348
|
+
${selector}::-webkit-search-decoration {
|
|
349
|
+
-webkit-appearance: none;
|
|
350
|
+
}
|
|
355
351
|
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
352
|
+
${selector}::-webkit-file-upload-button {
|
|
353
|
+
-webkit-appearance: button;
|
|
354
|
+
}
|
|
359
355
|
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
356
|
+
${selector}::-webkit-inner-spin-button,
|
|
357
|
+
${selector}::-webkit-outer-spin-button {
|
|
358
|
+
height: auto;
|
|
359
|
+
}
|
|
364
360
|
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
361
|
+
${selector}:-moz-ui-invalid {
|
|
362
|
+
box-shadow: none;
|
|
363
|
+
}
|
|
368
364
|
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
`;
|
|
365
|
+
${selector}:-moz-focusring {
|
|
366
|
+
outline: auto;
|
|
367
|
+
}
|
|
368
|
+
}`;
|
|
374
369
|
ctx.hooks.callHook("generator:css", "reset.css", output);
|
|
375
370
|
return output;
|
|
376
371
|
}
|
|
@@ -384,7 +379,15 @@ var generateStaticCss = (ctx) => {
|
|
|
384
379
|
const fn = getStaticCss(staticCss);
|
|
385
380
|
const results = fn({
|
|
386
381
|
breakpoints: Object.keys(theme.breakpoints ?? {}),
|
|
387
|
-
getPropertyKeys:
|
|
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
|
+
},
|
|
388
391
|
getRecipeKeys: (recipe) => recipes.details.find((detail) => detail.config.name === recipe)?.variantKeyMap ?? {}
|
|
389
392
|
});
|
|
390
393
|
results.css.forEach((css2) => {
|
|
@@ -719,7 +722,7 @@ function generateCvaFn(ctx) {
|
|
|
719
722
|
|
|
720
723
|
return Object.assign(cvaFn, {
|
|
721
724
|
__cva__: true,
|
|
722
|
-
|
|
725
|
+
variantMap,
|
|
723
726
|
variantKeys,
|
|
724
727
|
resolve,
|
|
725
728
|
config,
|
|
@@ -798,7 +801,7 @@ import { outdent as outdent8 } from "outdent";
|
|
|
798
801
|
|
|
799
802
|
// src/artifacts/generated/helpers.mjs.json
|
|
800
803
|
var helpers_mjs_default = {
|
|
801
|
-
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\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
|
|
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'
|
|
802
805
|
};
|
|
803
806
|
|
|
804
807
|
// src/artifacts/js/helpers.ts
|
|
@@ -824,6 +827,7 @@ var is_valid_prop_mjs_default = {
|
|
|
824
827
|
};
|
|
825
828
|
|
|
826
829
|
// src/artifacts/js/is-valid-prop.ts
|
|
830
|
+
import { outdent as outdent9 } from "outdent";
|
|
827
831
|
function generateisValidProp(ctx) {
|
|
828
832
|
if (ctx.isTemplateLiteralSyntax)
|
|
829
833
|
return;
|
|
@@ -833,14 +837,19 @@ function generateisValidProp(ctx) {
|
|
|
833
837
|
`var userGenerated = [${ctx.properties.map((key) => JSON.stringify(key)).join(",")}]`
|
|
834
838
|
);
|
|
835
839
|
return {
|
|
836
|
-
js: content
|
|
840
|
+
js: content,
|
|
841
|
+
dts: outdent9`
|
|
842
|
+
declare const isCssProperty: (value: string) => boolean;
|
|
843
|
+
|
|
844
|
+
export { isCssProperty };
|
|
845
|
+
`
|
|
837
846
|
};
|
|
838
847
|
}
|
|
839
848
|
|
|
840
849
|
// src/artifacts/js/pattern.ts
|
|
841
850
|
import { unionType } from "@pandacss/shared";
|
|
842
851
|
import { stringify as stringify2 } from "javascript-stringify";
|
|
843
|
-
import { outdent as
|
|
852
|
+
import { outdent as outdent10 } from "outdent";
|
|
844
853
|
import { match } from "ts-pattern";
|
|
845
854
|
function generatePattern(ctx) {
|
|
846
855
|
if (ctx.patterns.isEmpty())
|
|
@@ -858,7 +867,7 @@ function generatePattern(ctx) {
|
|
|
858
867
|
}
|
|
859
868
|
return {
|
|
860
869
|
name: dashName,
|
|
861
|
-
dts:
|
|
870
|
+
dts: outdent10`
|
|
862
871
|
import type { SystemStyleObject, ConditionalValue } from '../types'
|
|
863
872
|
import type { PropertyValue } from '../types/prop-type'
|
|
864
873
|
import type { Properties } from '../types/csstype'
|
|
@@ -882,7 +891,7 @@ function generatePattern(ctx) {
|
|
|
882
891
|
}).join("\n ")}
|
|
883
892
|
}
|
|
884
893
|
|
|
885
|
-
${strict ?
|
|
894
|
+
${strict ? outdent10`export declare function ${name}(options: ${upperName}Properties): string` : outdent10`
|
|
886
895
|
|
|
887
896
|
type ${upperName}Options = ${upperName}Properties & Omit<SystemStyleObject, keyof ${upperName}Properties ${blocklistType}>
|
|
888
897
|
|
|
@@ -891,7 +900,7 @@ function generatePattern(ctx) {
|
|
|
891
900
|
`}
|
|
892
901
|
|
|
893
902
|
`,
|
|
894
|
-
js:
|
|
903
|
+
js: outdent10`
|
|
895
904
|
${ctx.file.import(helperImports.join(", "), "../helpers")}
|
|
896
905
|
${ctx.file.import("css", "../css/index")}
|
|
897
906
|
|
|
@@ -908,7 +917,7 @@ transform`)}
|
|
|
908
917
|
|
|
909
918
|
// src/artifacts/js/recipe.ts
|
|
910
919
|
import { unionType as unionType2 } from "@pandacss/shared";
|
|
911
|
-
import { outdent as
|
|
920
|
+
import { outdent as outdent11 } from "outdent";
|
|
912
921
|
var stringify3 = (value) => JSON.stringify(value, null, 2);
|
|
913
922
|
var isBooleanValue = (value) => value === "true" || value === "false";
|
|
914
923
|
function generateRecipes(ctx) {
|
|
@@ -922,7 +931,7 @@ function generateRecipes(ctx) {
|
|
|
922
931
|
const createRecipeFn = {
|
|
923
932
|
name: "create-recipe",
|
|
924
933
|
dts: "",
|
|
925
|
-
js:
|
|
934
|
+
js: outdent11`
|
|
926
935
|
${ctx.file.import("css", "../css/css")}
|
|
927
936
|
${ctx.file.import("assertCompoundVariant, getCompoundVariantCss", "../css/cva")}
|
|
928
937
|
${ctx.file.import("cx", "../css/cx")}
|
|
@@ -969,7 +978,7 @@ function generateRecipes(ctx) {
|
|
|
969
978
|
const { name, description, defaultVariants, compoundVariants } = config;
|
|
970
979
|
return {
|
|
971
980
|
name: dashName,
|
|
972
|
-
js:
|
|
981
|
+
js: outdent11`
|
|
973
982
|
${ctx.file.import("splitProps", "../helpers")}
|
|
974
983
|
${ctx.file.import("createRecipe", "./create-recipe")}
|
|
975
984
|
|
|
@@ -990,7 +999,7 @@ function generateRecipes(ctx) {
|
|
|
990
999
|
splitVariantProps,
|
|
991
1000
|
})
|
|
992
1001
|
`,
|
|
993
|
-
dts:
|
|
1002
|
+
dts: outdent11`
|
|
994
1003
|
import type { ConditionalValue } from '../types'
|
|
995
1004
|
import type { Pretty } from '../types/helpers'
|
|
996
1005
|
|
|
@@ -1028,7 +1037,7 @@ function generateRecipes(ctx) {
|
|
|
1028
1037
|
}
|
|
1029
1038
|
|
|
1030
1039
|
// src/artifacts/js/token.ts
|
|
1031
|
-
import
|
|
1040
|
+
import outdent12 from "outdent";
|
|
1032
1041
|
function generateTokenJs(ctx) {
|
|
1033
1042
|
const { tokens } = ctx;
|
|
1034
1043
|
const map = /* @__PURE__ */ new Map();
|
|
@@ -1039,7 +1048,7 @@ function generateTokenJs(ctx) {
|
|
|
1039
1048
|
});
|
|
1040
1049
|
const obj = Object.fromEntries(map);
|
|
1041
1050
|
return {
|
|
1042
|
-
js:
|
|
1051
|
+
js: outdent12`
|
|
1043
1052
|
const tokens = ${JSON.stringify(obj, null, 2)}
|
|
1044
1053
|
|
|
1045
1054
|
export function token(path, fallback) {
|
|
@@ -1052,7 +1061,7 @@ function generateTokenJs(ctx) {
|
|
|
1052
1061
|
|
|
1053
1062
|
token.var = tokenVar
|
|
1054
1063
|
`,
|
|
1055
|
-
dts:
|
|
1064
|
+
dts: outdent12`
|
|
1056
1065
|
import type { Token } from './tokens'
|
|
1057
1066
|
|
|
1058
1067
|
export declare const token: {
|
|
@@ -1066,11 +1075,11 @@ function generateTokenJs(ctx) {
|
|
|
1066
1075
|
}
|
|
1067
1076
|
|
|
1068
1077
|
// src/artifacts/preact-jsx/jsx.ts
|
|
1069
|
-
import { outdent as
|
|
1078
|
+
import { outdent as outdent13 } from "outdent";
|
|
1070
1079
|
function generatePreactJsxFactory(ctx) {
|
|
1071
1080
|
const { factoryName, componentName } = ctx.jsx;
|
|
1072
1081
|
return {
|
|
1073
|
-
js:
|
|
1082
|
+
js: outdent13`
|
|
1074
1083
|
import { h } from 'preact'
|
|
1075
1084
|
import { forwardRef } from 'preact/compat'
|
|
1076
1085
|
import { useMemo } from 'preact/hooks'
|
|
@@ -1137,7 +1146,7 @@ function generatePreactJsxFactory(ctx) {
|
|
|
1137
1146
|
}
|
|
1138
1147
|
|
|
1139
1148
|
// src/artifacts/preact-jsx/pattern.ts
|
|
1140
|
-
import { outdent as
|
|
1149
|
+
import { outdent as outdent14 } from "outdent";
|
|
1141
1150
|
import { match as match2 } from "ts-pattern";
|
|
1142
1151
|
function generatePreactJsxPattern(ctx) {
|
|
1143
1152
|
const { typeName, factoryName } = ctx.jsx;
|
|
@@ -1146,7 +1155,7 @@ function generatePreactJsxPattern(ctx) {
|
|
|
1146
1155
|
const { description, jsxElement = "div" } = pattern.config;
|
|
1147
1156
|
return {
|
|
1148
1157
|
name: dashName,
|
|
1149
|
-
js:
|
|
1158
|
+
js: outdent14`
|
|
1150
1159
|
import { h } from 'preact'
|
|
1151
1160
|
import { forwardRef } from 'preact/compat'
|
|
1152
1161
|
${ctx.file.import(factoryName, "./factory")}
|
|
@@ -1155,12 +1164,12 @@ function generatePreactJsxPattern(ctx) {
|
|
|
1155
1164
|
export const ${jsxName} = forwardRef(function ${jsxName}(props, ref) {
|
|
1156
1165
|
${match2(props.length).with(
|
|
1157
1166
|
0,
|
|
1158
|
-
() =>
|
|
1167
|
+
() => outdent14`
|
|
1159
1168
|
const styleProps = ${styleFnName}()
|
|
1160
1169
|
return h(${factoryName}.${jsxElement}, { ref, ...styleProps, ...props })
|
|
1161
1170
|
`
|
|
1162
1171
|
).otherwise(
|
|
1163
|
-
() =>
|
|
1172
|
+
() => outdent14`
|
|
1164
1173
|
const { ${props.join(", ")}, ...restProps } = props
|
|
1165
1174
|
const styleProps = ${styleFnName}({${props.join(", ")}})
|
|
1166
1175
|
return h(${factoryName}.${jsxElement}, { ref, ...styleProps, ...restProps })
|
|
@@ -1168,7 +1177,7 @@ function generatePreactJsxPattern(ctx) {
|
|
|
1168
1177
|
)}
|
|
1169
1178
|
})
|
|
1170
1179
|
`,
|
|
1171
|
-
dts:
|
|
1180
|
+
dts: outdent14`
|
|
1172
1181
|
import type { FunctionComponent } from 'preact'
|
|
1173
1182
|
import type { ${upperName}Properties } from '../patterns/${dashName}'
|
|
1174
1183
|
import type { ${typeName} } from '../types/jsx'
|
|
@@ -1183,15 +1192,15 @@ function generatePreactJsxPattern(ctx) {
|
|
|
1183
1192
|
}
|
|
1184
1193
|
|
|
1185
1194
|
// src/artifacts/preact-jsx/types.ts
|
|
1186
|
-
import { outdent as
|
|
1195
|
+
import { outdent as outdent15 } from "outdent";
|
|
1187
1196
|
function generatePreactJsxTypes(ctx) {
|
|
1188
1197
|
const { factoryName, componentName, upperName, typeName } = ctx.jsx;
|
|
1189
1198
|
return {
|
|
1190
|
-
jsxFactory:
|
|
1199
|
+
jsxFactory: outdent15`
|
|
1191
1200
|
import type { ${upperName} } from '../types/jsx'
|
|
1192
1201
|
export declare const ${factoryName}: ${upperName}
|
|
1193
1202
|
`,
|
|
1194
|
-
jsxType:
|
|
1203
|
+
jsxType: outdent15`
|
|
1195
1204
|
import type { ComponentProps, JSX } from 'preact'
|
|
1196
1205
|
import type { Assign, JsxStyleProps, JsxHTMLProps } from './system-types'
|
|
1197
1206
|
import type { RecipeDefinition, RecipeSelection, RecipeVariantRecord } from './recipe'
|
|
@@ -1226,11 +1235,11 @@ export type ${typeName}<T extends ElementType> = JsxHTMLProps<ComponentProps<T>,
|
|
|
1226
1235
|
}
|
|
1227
1236
|
|
|
1228
1237
|
// src/artifacts/preact-jsx/jsx.string-literal.ts
|
|
1229
|
-
import { outdent as
|
|
1238
|
+
import { outdent as outdent16 } from "outdent";
|
|
1230
1239
|
function generatePreactJsxStringLiteralFactory(ctx) {
|
|
1231
1240
|
const { factoryName, componentName } = ctx.jsx;
|
|
1232
1241
|
return {
|
|
1233
|
-
js:
|
|
1242
|
+
js: outdent16`
|
|
1234
1243
|
import { h } from 'preact'
|
|
1235
1244
|
import { forwardRef } from 'preact/compat'
|
|
1236
1245
|
${ctx.file.import("css, cx", "../css/index")}
|
|
@@ -1276,15 +1285,15 @@ function generatePreactJsxStringLiteralFactory(ctx) {
|
|
|
1276
1285
|
}
|
|
1277
1286
|
|
|
1278
1287
|
// src/artifacts/preact-jsx/types.string-literal.ts
|
|
1279
|
-
import { outdent as
|
|
1288
|
+
import { outdent as outdent17 } from "outdent";
|
|
1280
1289
|
function generatePreactJsxStringLiteralTypes(ctx) {
|
|
1281
1290
|
const { factoryName, componentName, upperName, typeName } = ctx.jsx;
|
|
1282
1291
|
return {
|
|
1283
|
-
jsxFactory:
|
|
1292
|
+
jsxFactory: outdent17`
|
|
1284
1293
|
import type { ${upperName} } from '../types/jsx'
|
|
1285
1294
|
export declare const ${factoryName}: ${upperName}
|
|
1286
1295
|
`,
|
|
1287
|
-
jsxType:
|
|
1296
|
+
jsxType: outdent17`
|
|
1288
1297
|
import type { ComponentProps, JSX } from 'preact'
|
|
1289
1298
|
|
|
1290
1299
|
type ElementType = keyof JSX.IntrinsicElements
|
|
@@ -1310,11 +1319,11 @@ export type ${typeName}<T extends ElementType> = ComponentProps<T>
|
|
|
1310
1319
|
}
|
|
1311
1320
|
|
|
1312
1321
|
// src/artifacts/qwik-jsx/jsx.ts
|
|
1313
|
-
import { outdent as
|
|
1322
|
+
import { outdent as outdent18 } from "outdent";
|
|
1314
1323
|
function generateQwikJsxFactory(ctx) {
|
|
1315
1324
|
const { factoryName, componentName } = ctx.jsx;
|
|
1316
1325
|
return {
|
|
1317
|
-
js:
|
|
1326
|
+
js: outdent18`
|
|
1318
1327
|
import { h } from '@builder.io/qwik'
|
|
1319
1328
|
${ctx.file.import("css, cx, cva, assignCss", "../css/index")}
|
|
1320
1329
|
${ctx.file.import("splitProps, normalizeHTMLProps", "../helpers")}
|
|
@@ -1378,7 +1387,7 @@ function generateQwikJsxFactory(ctx) {
|
|
|
1378
1387
|
}
|
|
1379
1388
|
|
|
1380
1389
|
// src/artifacts/qwik-jsx/pattern.ts
|
|
1381
|
-
import { outdent as
|
|
1390
|
+
import { outdent as outdent19 } from "outdent";
|
|
1382
1391
|
import { match as match3 } from "ts-pattern";
|
|
1383
1392
|
function generateQwikJsxPattern(ctx) {
|
|
1384
1393
|
const { typeName, factoryName } = ctx.jsx;
|
|
@@ -1387,7 +1396,7 @@ function generateQwikJsxPattern(ctx) {
|
|
|
1387
1396
|
const { description, jsxElement = "div" } = pattern.config;
|
|
1388
1397
|
return {
|
|
1389
1398
|
name: dashName,
|
|
1390
|
-
js:
|
|
1399
|
+
js: outdent19`
|
|
1391
1400
|
import { h } from '@builder.io/qwik'
|
|
1392
1401
|
${ctx.file.import(factoryName, "./factory")}
|
|
1393
1402
|
${ctx.file.import(styleFnName, `../patterns/${dashName}`)}
|
|
@@ -1395,12 +1404,12 @@ function generateQwikJsxPattern(ctx) {
|
|
|
1395
1404
|
export const ${jsxName} = function ${jsxName}(props) {
|
|
1396
1405
|
${match3(props.length).with(
|
|
1397
1406
|
0,
|
|
1398
|
-
() =>
|
|
1407
|
+
() => outdent19`
|
|
1399
1408
|
const styleProps = ${styleFnName}()
|
|
1400
1409
|
return h(${factoryName}.${jsxElement}, { ...styleProps, ...props })
|
|
1401
1410
|
`
|
|
1402
1411
|
).otherwise(
|
|
1403
|
-
() =>
|
|
1412
|
+
() => outdent19`
|
|
1404
1413
|
const { ${props.join(", ")}, ...restProps } = props
|
|
1405
1414
|
const styleProps = ${styleFnName}({${props.join(", ")}})
|
|
1406
1415
|
return h(${factoryName}.${jsxElement}, { ...styleProps, ...restProps })
|
|
@@ -1408,7 +1417,7 @@ function generateQwikJsxPattern(ctx) {
|
|
|
1408
1417
|
)}
|
|
1409
1418
|
}
|
|
1410
1419
|
`,
|
|
1411
|
-
dts:
|
|
1420
|
+
dts: outdent19`
|
|
1412
1421
|
import type { FunctionComponent } from '@builder.io/qwik'
|
|
1413
1422
|
import type { ${upperName}Properties } from '../patterns/${dashName}'
|
|
1414
1423
|
import type { ${typeName} } from '../types/jsx'
|
|
@@ -1427,15 +1436,15 @@ function generateQwikJsxPattern(ctx) {
|
|
|
1427
1436
|
}
|
|
1428
1437
|
|
|
1429
1438
|
// src/artifacts/qwik-jsx/types.ts
|
|
1430
|
-
import { outdent as
|
|
1439
|
+
import { outdent as outdent20 } from "outdent";
|
|
1431
1440
|
function generateQwikJsxTypes(ctx) {
|
|
1432
1441
|
const { factoryName, componentName, upperName, typeName } = ctx.jsx;
|
|
1433
1442
|
return {
|
|
1434
|
-
jsxFactory:
|
|
1443
|
+
jsxFactory: outdent20`
|
|
1435
1444
|
import { ${upperName} } from '../types/jsx'
|
|
1436
1445
|
export declare const ${factoryName}: ${upperName}
|
|
1437
1446
|
`,
|
|
1438
|
-
jsxType:
|
|
1447
|
+
jsxType: outdent20`
|
|
1439
1448
|
import type { FunctionComponent, QwikIntrinsicElements } from '@builder.io/qwik'
|
|
1440
1449
|
import type { Assign as _Assign, JsxStyleProps, PatchedHTMLProps } from './system-types'
|
|
1441
1450
|
import type { RecipeDefinition, RecipeSelection, RecipeVariantRecord } from './recipe'
|
|
@@ -1489,11 +1498,11 @@ export type ${typeName}<T extends ElementType> = Assign<ComponentProps<T>, JsxSt
|
|
|
1489
1498
|
}
|
|
1490
1499
|
|
|
1491
1500
|
// src/artifacts/qwik-jsx/jsx.string-literal.ts
|
|
1492
|
-
import { outdent as
|
|
1501
|
+
import { outdent as outdent21 } from "outdent";
|
|
1493
1502
|
function generateQwikJsxStringLiteralFactory(ctx) {
|
|
1494
1503
|
const { factoryName, componentName } = ctx.jsx;
|
|
1495
1504
|
return {
|
|
1496
|
-
js:
|
|
1505
|
+
js: outdent21`
|
|
1497
1506
|
import { h } from '@builder.io/qwik'
|
|
1498
1507
|
${ctx.file.import("css, cx", "../css/index")}
|
|
1499
1508
|
|
|
@@ -1538,15 +1547,15 @@ function generateQwikJsxStringLiteralFactory(ctx) {
|
|
|
1538
1547
|
}
|
|
1539
1548
|
|
|
1540
1549
|
// src/artifacts/qwik-jsx/types.string-literal.ts
|
|
1541
|
-
import { outdent as
|
|
1550
|
+
import { outdent as outdent22 } from "outdent";
|
|
1542
1551
|
function generateQwikJsxStringLiteralTypes(ctx) {
|
|
1543
1552
|
const { factoryName, componentName, upperName, typeName } = ctx.jsx;
|
|
1544
1553
|
return {
|
|
1545
|
-
jsxFactory:
|
|
1554
|
+
jsxFactory: outdent22`
|
|
1546
1555
|
import { ${upperName} } from '../types/jsx'
|
|
1547
1556
|
export declare const ${factoryName}: ${upperName}
|
|
1548
1557
|
`,
|
|
1549
|
-
jsxType:
|
|
1558
|
+
jsxType: outdent22`
|
|
1550
1559
|
import type { FunctionComponent, QwikIntrinsicElements } from '@builder.io/qwik'
|
|
1551
1560
|
|
|
1552
1561
|
type ElementType = keyof QwikIntrinsicElements | FunctionComponent<any>
|
|
@@ -1577,11 +1586,11 @@ export type ${typeName}<T extends ElementType> = ComponentProps<T>
|
|
|
1577
1586
|
}
|
|
1578
1587
|
|
|
1579
1588
|
// src/artifacts/react-jsx/jsx.ts
|
|
1580
|
-
import { outdent as
|
|
1589
|
+
import { outdent as outdent23 } from "outdent";
|
|
1581
1590
|
function generateReactJsxFactory(ctx) {
|
|
1582
1591
|
const { factoryName, componentName } = ctx.jsx;
|
|
1583
1592
|
return {
|
|
1584
|
-
js:
|
|
1593
|
+
js: outdent23`
|
|
1585
1594
|
import { createElement, forwardRef, useMemo } from 'react'
|
|
1586
1595
|
${ctx.file.import("css, cx, cva, assignCss", "../css/index")}
|
|
1587
1596
|
${ctx.file.import("splitProps, normalizeHTMLProps", "../helpers")}
|
|
@@ -1647,7 +1656,7 @@ function generateReactJsxFactory(ctx) {
|
|
|
1647
1656
|
}
|
|
1648
1657
|
|
|
1649
1658
|
// src/artifacts/react-jsx/pattern.ts
|
|
1650
|
-
import { outdent as
|
|
1659
|
+
import { outdent as outdent24 } from "outdent";
|
|
1651
1660
|
import { match as match4 } from "ts-pattern";
|
|
1652
1661
|
function generateReactJsxPattern(ctx) {
|
|
1653
1662
|
const { typeName, factoryName } = ctx.jsx;
|
|
@@ -1656,7 +1665,7 @@ function generateReactJsxPattern(ctx) {
|
|
|
1656
1665
|
const { description, jsxElement = "div" } = pattern.config;
|
|
1657
1666
|
return {
|
|
1658
1667
|
name: dashName,
|
|
1659
|
-
js:
|
|
1668
|
+
js: outdent24`
|
|
1660
1669
|
import { createElement, forwardRef } from 'react'
|
|
1661
1670
|
${ctx.file.import(factoryName, "./factory")}
|
|
1662
1671
|
${ctx.file.import(styleFnName, `../patterns/${dashName}`)}
|
|
@@ -1664,12 +1673,12 @@ function generateReactJsxPattern(ctx) {
|
|
|
1664
1673
|
export const ${jsxName} = forwardRef(function ${jsxName}(props, ref) {
|
|
1665
1674
|
${match4(props.length).with(
|
|
1666
1675
|
0,
|
|
1667
|
-
() =>
|
|
1676
|
+
() => outdent24`
|
|
1668
1677
|
const styleProps = ${styleFnName}()
|
|
1669
1678
|
return createElement(${factoryName}.${jsxElement}, { ref, ...styleProps, ...props })
|
|
1670
1679
|
`
|
|
1671
1680
|
).otherwise(
|
|
1672
|
-
() =>
|
|
1681
|
+
() => outdent24`
|
|
1673
1682
|
const { ${props.join(", ")}, ...restProps } = props
|
|
1674
1683
|
const styleProps = ${styleFnName}({${props.join(", ")}})
|
|
1675
1684
|
return createElement(${factoryName}.${jsxElement}, { ref, ...styleProps, ...restProps })
|
|
@@ -1677,7 +1686,7 @@ function generateReactJsxPattern(ctx) {
|
|
|
1677
1686
|
)}
|
|
1678
1687
|
})
|
|
1679
1688
|
`,
|
|
1680
|
-
dts:
|
|
1689
|
+
dts: outdent24`
|
|
1681
1690
|
import type { FunctionComponent } from 'react'
|
|
1682
1691
|
import type { ${upperName}Properties } from '../patterns/${dashName}'
|
|
1683
1692
|
import type { ${typeName} } from '../types/jsx'
|
|
@@ -1692,15 +1701,15 @@ function generateReactJsxPattern(ctx) {
|
|
|
1692
1701
|
}
|
|
1693
1702
|
|
|
1694
1703
|
// src/artifacts/react-jsx/types.ts
|
|
1695
|
-
import { outdent as
|
|
1704
|
+
import { outdent as outdent25 } from "outdent";
|
|
1696
1705
|
function generateReactJsxTypes(ctx) {
|
|
1697
1706
|
const { factoryName, componentName, upperName, typeName } = ctx.jsx;
|
|
1698
1707
|
return {
|
|
1699
|
-
jsxFactory:
|
|
1708
|
+
jsxFactory: outdent25`
|
|
1700
1709
|
import { ${upperName} } from '../types/jsx'
|
|
1701
1710
|
export declare const ${factoryName}: ${upperName}
|
|
1702
1711
|
`,
|
|
1703
|
-
jsxType:
|
|
1712
|
+
jsxType: outdent25`
|
|
1704
1713
|
import type { ComponentProps, ElementType } from 'react'
|
|
1705
1714
|
import type { Assign, JsxStyleProps, JsxHTMLProps } from './system-types'
|
|
1706
1715
|
import type { RecipeDefinition, RecipeSelection, RecipeVariantRecord } from './recipe'
|
|
@@ -1733,11 +1742,11 @@ export type ${typeName}<T extends ElementType> = JsxHTMLProps<ComponentProps<T>,
|
|
|
1733
1742
|
}
|
|
1734
1743
|
|
|
1735
1744
|
// src/artifacts/react-jsx/jsx.string-literal.ts
|
|
1736
|
-
import { outdent as
|
|
1745
|
+
import { outdent as outdent26 } from "outdent";
|
|
1737
1746
|
function generateReactJsxStringLiteralFactory(ctx) {
|
|
1738
1747
|
const { factoryName, componentName } = ctx.jsx;
|
|
1739
1748
|
return {
|
|
1740
|
-
js:
|
|
1749
|
+
js: outdent26`
|
|
1741
1750
|
import { createElement, forwardRef } from 'react'
|
|
1742
1751
|
${ctx.file.import("css, cx", "../css/index")}
|
|
1743
1752
|
|
|
@@ -1783,15 +1792,15 @@ function generateReactJsxStringLiteralFactory(ctx) {
|
|
|
1783
1792
|
}
|
|
1784
1793
|
|
|
1785
1794
|
// src/artifacts/react-jsx/types.string-literal.ts
|
|
1786
|
-
import { outdent as
|
|
1795
|
+
import { outdent as outdent27 } from "outdent";
|
|
1787
1796
|
function generateReactJsxStringLiteralTypes(ctx) {
|
|
1788
1797
|
const { factoryName, componentName, upperName, typeName } = ctx.jsx;
|
|
1789
1798
|
return {
|
|
1790
|
-
jsxFactory:
|
|
1799
|
+
jsxFactory: outdent27`
|
|
1791
1800
|
import { ${upperName} } from '../types/jsx'
|
|
1792
1801
|
export declare const ${factoryName}: ${upperName}
|
|
1793
1802
|
`,
|
|
1794
|
-
jsxType:
|
|
1803
|
+
jsxType: outdent27`
|
|
1795
1804
|
import type { ComponentProps, ElementType } from 'react'
|
|
1796
1805
|
|
|
1797
1806
|
type Dict = Record<string, unknown>
|
|
@@ -1815,11 +1824,11 @@ export type ${typeName}<T extends ElementType> = ComponentProps<T>
|
|
|
1815
1824
|
}
|
|
1816
1825
|
|
|
1817
1826
|
// src/artifacts/solid-jsx/jsx.ts
|
|
1818
|
-
import { outdent as
|
|
1827
|
+
import { outdent as outdent28 } from "outdent";
|
|
1819
1828
|
function generateSolidJsxFactory(ctx) {
|
|
1820
1829
|
const { componentName, factoryName } = ctx.jsx;
|
|
1821
1830
|
return {
|
|
1822
|
-
js:
|
|
1831
|
+
js: outdent28`
|
|
1823
1832
|
import { Dynamic } from 'solid-js/web'
|
|
1824
1833
|
import { mergeProps, splitProps } from 'solid-js'
|
|
1825
1834
|
import { createComponent } from 'solid-js/web'
|
|
@@ -1896,7 +1905,7 @@ function generateSolidJsxFactory(ctx) {
|
|
|
1896
1905
|
}
|
|
1897
1906
|
|
|
1898
1907
|
// src/artifacts/solid-jsx/pattern.ts
|
|
1899
|
-
import { outdent as
|
|
1908
|
+
import { outdent as outdent29 } from "outdent";
|
|
1900
1909
|
import { match as match5 } from "ts-pattern";
|
|
1901
1910
|
function generateSolidJsxPattern(ctx) {
|
|
1902
1911
|
const { typeName, factoryName } = ctx.jsx;
|
|
@@ -1905,7 +1914,7 @@ function generateSolidJsxPattern(ctx) {
|
|
|
1905
1914
|
const { description, jsxElement = "div" } = pattern.config;
|
|
1906
1915
|
return {
|
|
1907
1916
|
name: dashName,
|
|
1908
|
-
js:
|
|
1917
|
+
js: outdent29`
|
|
1909
1918
|
import { splitProps, mergeProps } from 'solid-js'
|
|
1910
1919
|
import { createComponent } from 'solid-js/web'
|
|
1911
1920
|
${ctx.file.import(factoryName, "./factory")}
|
|
@@ -1914,12 +1923,12 @@ function generateSolidJsxPattern(ctx) {
|
|
|
1914
1923
|
export function ${jsxName}(props) {
|
|
1915
1924
|
${match5(props.length).with(
|
|
1916
1925
|
0,
|
|
1917
|
-
() =>
|
|
1926
|
+
() => outdent29`
|
|
1918
1927
|
const styleProps = ${styleFnName}()
|
|
1919
1928
|
return createComponent(${factoryName}.${jsxElement}, mergeProps(styleProps, props))
|
|
1920
1929
|
`
|
|
1921
1930
|
).otherwise(
|
|
1922
|
-
() =>
|
|
1931
|
+
() => outdent29`
|
|
1923
1932
|
const [patternProps, restProps] = splitProps(props, [${props.map((v) => JSON.stringify(v)).join(", ")}]);
|
|
1924
1933
|
const styleProps = ${styleFnName}(patternProps)
|
|
1925
1934
|
return createComponent(${factoryName}.${jsxElement}, mergeProps(styleProps, restProps))
|
|
@@ -1927,7 +1936,7 @@ function generateSolidJsxPattern(ctx) {
|
|
|
1927
1936
|
)}
|
|
1928
1937
|
}
|
|
1929
1938
|
`,
|
|
1930
|
-
dts:
|
|
1939
|
+
dts: outdent29`
|
|
1931
1940
|
import { Component } from 'solid-js'
|
|
1932
1941
|
import { ${upperName}Properties } from '../patterns/${dashName}'
|
|
1933
1942
|
import { ${typeName} } from '../types/jsx'
|
|
@@ -1942,15 +1951,15 @@ function generateSolidJsxPattern(ctx) {
|
|
|
1942
1951
|
}
|
|
1943
1952
|
|
|
1944
1953
|
// src/artifacts/solid-jsx/types.ts
|
|
1945
|
-
import { outdent as
|
|
1954
|
+
import { outdent as outdent30 } from "outdent";
|
|
1946
1955
|
function generateSolidJsxTypes(ctx) {
|
|
1947
1956
|
const { factoryName, componentName, upperName, typeName } = ctx.jsx;
|
|
1948
1957
|
return {
|
|
1949
|
-
jsxFactory:
|
|
1958
|
+
jsxFactory: outdent30`
|
|
1950
1959
|
import type { ${upperName} } from '../types/jsx'
|
|
1951
1960
|
export declare const ${factoryName}: ${upperName}
|
|
1952
1961
|
`,
|
|
1953
|
-
jsxType:
|
|
1962
|
+
jsxType: outdent30`
|
|
1954
1963
|
import type { ComponentProps, Component, JSX } from 'solid-js'
|
|
1955
1964
|
import type { Assign, JsxStyleProps, JsxHTMLProps } from './system-types'
|
|
1956
1965
|
import type { RecipeDefinition, RecipeSelection, RecipeVariantRecord } from './recipe'
|
|
@@ -1985,11 +1994,11 @@ export type ${typeName}<T extends ElementType> = JsxHTMLProps<ComponentProps<T>,
|
|
|
1985
1994
|
}
|
|
1986
1995
|
|
|
1987
1996
|
// src/artifacts/solid-jsx/jsx.string-literal.ts
|
|
1988
|
-
import { outdent as
|
|
1997
|
+
import { outdent as outdent31 } from "outdent";
|
|
1989
1998
|
function generateSolidJsxStringLiteralFactory(ctx) {
|
|
1990
1999
|
const { componentName, factoryName } = ctx.jsx;
|
|
1991
2000
|
return {
|
|
1992
|
-
js:
|
|
2001
|
+
js: outdent31`
|
|
1993
2002
|
import { mergeProps, splitProps } from 'solid-js'
|
|
1994
2003
|
import { Dynamic, createComponent } from 'solid-js/web'
|
|
1995
2004
|
${ctx.file.import("css, cx", "../css/index")}
|
|
@@ -2041,15 +2050,15 @@ export const ${factoryName} = createJsxFactory()
|
|
|
2041
2050
|
}
|
|
2042
2051
|
|
|
2043
2052
|
// src/artifacts/solid-jsx/types.string-literal.ts
|
|
2044
|
-
import { outdent as
|
|
2053
|
+
import { outdent as outdent32 } from "outdent";
|
|
2045
2054
|
function generateSolidJsxStringLiteralTypes(ctx) {
|
|
2046
2055
|
const { factoryName, componentName, upperName, typeName } = ctx.jsx;
|
|
2047
2056
|
return {
|
|
2048
|
-
jsxFactory:
|
|
2057
|
+
jsxFactory: outdent32`
|
|
2049
2058
|
import type { ${upperName} } from '../types/jsx'
|
|
2050
2059
|
export declare const ${factoryName}: ${upperName}
|
|
2051
2060
|
`,
|
|
2052
|
-
jsxType:
|
|
2061
|
+
jsxType: outdent32`
|
|
2053
2062
|
import type { Component, ComponentProps, JSX } from 'solid-js'
|
|
2054
2063
|
|
|
2055
2064
|
type Dict = Record<string, unknown>
|
|
@@ -2075,11 +2084,11 @@ export type ${typeName}<T extends ElementType> = ComponentProps<T>
|
|
|
2075
2084
|
}
|
|
2076
2085
|
|
|
2077
2086
|
// src/artifacts/vue-jsx/jsx.ts
|
|
2078
|
-
import { outdent as
|
|
2087
|
+
import { outdent as outdent33 } from "outdent";
|
|
2079
2088
|
function generateVueJsxFactory(ctx) {
|
|
2080
2089
|
const { factoryName } = ctx.jsx;
|
|
2081
2090
|
return {
|
|
2082
|
-
js:
|
|
2091
|
+
js: outdent33`
|
|
2083
2092
|
import { defineComponent, h, computed } from 'vue'
|
|
2084
2093
|
${ctx.file.import("css, cx, cva, assignCss", "../css/index")}
|
|
2085
2094
|
${ctx.file.import("splitProps, normalizeHTMLProps", "../helpers")}
|
|
@@ -2153,11 +2162,11 @@ function generateVueJsxFactory(ctx) {
|
|
|
2153
2162
|
}
|
|
2154
2163
|
|
|
2155
2164
|
// src/artifacts/vue-jsx/jsx.string-literal.ts
|
|
2156
|
-
import { outdent as
|
|
2165
|
+
import { outdent as outdent34 } from "outdent";
|
|
2157
2166
|
function generateVueJsxStringLiteralFactory(ctx) {
|
|
2158
2167
|
const { factoryName } = ctx.jsx;
|
|
2159
2168
|
return {
|
|
2160
|
-
js:
|
|
2169
|
+
js: outdent34`
|
|
2161
2170
|
import { defineComponent, h, computed } from 'vue'
|
|
2162
2171
|
${ctx.file.import("css, cx", "../css/index")}
|
|
2163
2172
|
|
|
@@ -2207,7 +2216,7 @@ function generateVueJsxStringLiteralFactory(ctx) {
|
|
|
2207
2216
|
}
|
|
2208
2217
|
|
|
2209
2218
|
// src/artifacts/vue-jsx/pattern.ts
|
|
2210
|
-
import { outdent as
|
|
2219
|
+
import { outdent as outdent35 } from "outdent";
|
|
2211
2220
|
function generateVueJsxPattern(ctx) {
|
|
2212
2221
|
const { typeName, factoryName } = ctx.jsx;
|
|
2213
2222
|
return ctx.patterns.details.map((pattern) => {
|
|
@@ -2216,7 +2225,7 @@ function generateVueJsxPattern(ctx) {
|
|
|
2216
2225
|
const propList = props.map((v) => JSON.stringify(v)).join(", ");
|
|
2217
2226
|
return {
|
|
2218
2227
|
name: dashName,
|
|
2219
|
-
js:
|
|
2228
|
+
js: outdent35`
|
|
2220
2229
|
import { defineComponent, h, computed } from 'vue'
|
|
2221
2230
|
${ctx.file.import(factoryName, "./factory")}
|
|
2222
2231
|
${ctx.file.import(styleFnName, `../patterns/${dashName}`)}
|
|
@@ -2234,7 +2243,7 @@ function generateVueJsxPattern(ctx) {
|
|
|
2234
2243
|
}
|
|
2235
2244
|
})
|
|
2236
2245
|
`,
|
|
2237
|
-
dts:
|
|
2246
|
+
dts: outdent35`
|
|
2238
2247
|
import { FunctionalComponent } from 'vue'
|
|
2239
2248
|
import { ${upperName}Properties } from '../patterns/${dashName}'
|
|
2240
2249
|
import { ${typeName} } from '../types/jsx'
|
|
@@ -2249,15 +2258,15 @@ function generateVueJsxPattern(ctx) {
|
|
|
2249
2258
|
}
|
|
2250
2259
|
|
|
2251
2260
|
// src/artifacts/vue-jsx/types.ts
|
|
2252
|
-
import { outdent as
|
|
2261
|
+
import { outdent as outdent36 } from "outdent";
|
|
2253
2262
|
function generateVueJsxTypes(ctx) {
|
|
2254
2263
|
const { factoryName, componentName, upperName, typeName } = ctx.jsx;
|
|
2255
2264
|
return {
|
|
2256
|
-
jsxFactory:
|
|
2265
|
+
jsxFactory: outdent36`
|
|
2257
2266
|
import { ${upperName} } from '../types/jsx'
|
|
2258
2267
|
export declare const ${factoryName}: ${upperName}
|
|
2259
2268
|
`,
|
|
2260
|
-
jsxType:
|
|
2269
|
+
jsxType: outdent36`
|
|
2261
2270
|
import type { Component, FunctionalComponent } from 'vue'
|
|
2262
2271
|
import type { Assign, JsxStyleProps, JsxHTMLProps } from './system-types'
|
|
2263
2272
|
import type { RecipeDefinition, RecipeSelection, RecipeVariantRecord } from './recipe'
|
|
@@ -2414,15 +2423,15 @@ type IntrinsicElement =
|
|
|
2414
2423
|
}
|
|
2415
2424
|
|
|
2416
2425
|
// src/artifacts/vue-jsx/types.string-literal.ts
|
|
2417
|
-
import { outdent as
|
|
2426
|
+
import { outdent as outdent37 } from "outdent";
|
|
2418
2427
|
function generateVueJsxStringLiteralTypes(ctx) {
|
|
2419
2428
|
const { factoryName, componentName, upperName, typeName } = ctx.jsx;
|
|
2420
2429
|
return {
|
|
2421
|
-
jsxFactory:
|
|
2430
|
+
jsxFactory: outdent37`
|
|
2422
2431
|
import { ${upperName} } from '../types/jsx'
|
|
2423
2432
|
export declare const ${factoryName}: ${upperName}
|
|
2424
2433
|
`,
|
|
2425
|
-
jsxType:
|
|
2434
|
+
jsxType: outdent37`
|
|
2426
2435
|
import type { Component, FunctionalComponent } from 'vue'
|
|
2427
2436
|
|
|
2428
2437
|
type IntrinsicElement =
|
|
@@ -2637,22 +2646,27 @@ function generatePackageJson(ctx) {
|
|
|
2637
2646
|
exports: {
|
|
2638
2647
|
"./css": {
|
|
2639
2648
|
types: "./css/index.d.ts",
|
|
2649
|
+
require: "./css/index.mjs",
|
|
2640
2650
|
import: "./css/index.mjs"
|
|
2641
2651
|
},
|
|
2642
2652
|
"./jsx": {
|
|
2643
2653
|
types: "./jsx/index.d.ts",
|
|
2654
|
+
require: "./jsx/index.mjs",
|
|
2644
2655
|
import: "./jsx/index.mjs"
|
|
2645
2656
|
},
|
|
2646
2657
|
"./patterns": {
|
|
2647
2658
|
types: "./patterns/index.d.ts",
|
|
2659
|
+
require: "./patterns/index.mjs",
|
|
2648
2660
|
import: "./patterns/index.mjs"
|
|
2649
2661
|
},
|
|
2650
2662
|
"./recipes": {
|
|
2651
2663
|
types: "./recipes/index.d.ts",
|
|
2664
|
+
require: "./recipes/index.mjs",
|
|
2652
2665
|
import: "./recipes/index.mjs"
|
|
2653
2666
|
},
|
|
2654
2667
|
"./tokens": {
|
|
2655
2668
|
types: "./tokens/index.d.ts",
|
|
2669
|
+
require: "./tokens/index.mjs",
|
|
2656
2670
|
import: "./tokens/index.mjs"
|
|
2657
2671
|
},
|
|
2658
2672
|
"./types": {
|
|
@@ -2686,7 +2700,7 @@ var recipe_d_ts_default = {
|
|
|
2686
2700
|
|
|
2687
2701
|
// src/artifacts/generated/pattern.d.ts.json
|
|
2688
2702
|
var pattern_d_ts_default = {
|
|
2689
|
-
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"
|
|
2690
2704
|
};
|
|
2691
2705
|
|
|
2692
2706
|
// src/artifacts/generated/parts.d.ts.json
|
|
@@ -2713,12 +2727,12 @@ function getGeneratedTypes() {
|
|
|
2713
2727
|
}
|
|
2714
2728
|
|
|
2715
2729
|
// src/artifacts/types/main.ts
|
|
2716
|
-
import { outdent as
|
|
2730
|
+
import { outdent as outdent38 } from "outdent";
|
|
2717
2731
|
var generateTypesEntry = () => ({
|
|
2718
|
-
global:
|
|
2732
|
+
global: outdent38`
|
|
2719
2733
|
import type { RecipeVariantRecord, RecipeConfig } from './recipe'
|
|
2720
2734
|
import type { Parts } from './parts'
|
|
2721
|
-
import type { PatternConfig } from './pattern'
|
|
2735
|
+
import type { PatternConfig, PatternProperties } from './pattern'
|
|
2722
2736
|
import type { GlobalStyleObject, SystemStyleObject } from './system-types'
|
|
2723
2737
|
import type { CompositionStyles } from './composition'
|
|
2724
2738
|
|
|
@@ -2728,23 +2742,23 @@ var generateTypesEntry = () => ({
|
|
|
2728
2742
|
export function defineGlobalStyles(definition: GlobalStyleObject): GlobalStyleObject
|
|
2729
2743
|
export function defineTextStyles(definition: CompositionStyles['textStyles']): CompositionStyles['textStyles']
|
|
2730
2744
|
export function defineLayerStyles(definition: CompositionStyles['layerStyles']): CompositionStyles['layerStyles']
|
|
2731
|
-
export function definePattern<T>(config: PatternConfig<T>): PatternConfig
|
|
2745
|
+
export function definePattern<T extends PatternProperties>(config: PatternConfig<T>): PatternConfig
|
|
2732
2746
|
export function defineParts<T extends Parts>(parts: T): (config: Partial<Record<keyof T, SystemStyleObject>>) => Partial<Record<keyof T, SystemStyleObject>>;
|
|
2733
2747
|
}
|
|
2734
2748
|
`,
|
|
2735
|
-
index:
|
|
2749
|
+
index: outdent38`
|
|
2736
2750
|
import './global'
|
|
2737
2751
|
export type { ConditionalValue } from './conditions'
|
|
2738
2752
|
export type { GlobalStyleObject, JsxStyleProps, SystemStyleObject } from './system-types'
|
|
2739
2753
|
|
|
2740
2754
|
`,
|
|
2741
|
-
helpers:
|
|
2755
|
+
helpers: outdent38`
|
|
2742
2756
|
export type Pretty<T> = T extends infer U ? { [K in keyof U]: U[K] } : never
|
|
2743
2757
|
`
|
|
2744
2758
|
});
|
|
2745
2759
|
|
|
2746
2760
|
// src/artifacts/types/prop-types.ts
|
|
2747
|
-
import { outdent as
|
|
2761
|
+
import { outdent as outdent39 } from "outdent";
|
|
2748
2762
|
function generatePropTypes(ctx) {
|
|
2749
2763
|
const {
|
|
2750
2764
|
config: { strictTokens },
|
|
@@ -2752,7 +2766,7 @@ function generatePropTypes(ctx) {
|
|
|
2752
2766
|
} = ctx;
|
|
2753
2767
|
const strictText = `${strictTokens ? "" : " | CssValue<T>"}`;
|
|
2754
2768
|
const result = [
|
|
2755
|
-
|
|
2769
|
+
outdent39`
|
|
2756
2770
|
import type { ConditionalValue } from './conditions';
|
|
2757
2771
|
import type { CssProperties } from './system-types'
|
|
2758
2772
|
import type { Tokens } from '../tokens'
|
|
@@ -2775,7 +2789,7 @@ function generatePropTypes(ctx) {
|
|
|
2775
2789
|
result.push(` ${key}: Shorthand<${JSON.stringify(value)}>;`);
|
|
2776
2790
|
});
|
|
2777
2791
|
result.push("}");
|
|
2778
|
-
return
|
|
2792
|
+
return outdent39`
|
|
2779
2793
|
${result.join("\n")}
|
|
2780
2794
|
|
|
2781
2795
|
export type PropertyValue<T extends string> = T extends keyof PropertyTypes
|
|
@@ -2788,10 +2802,10 @@ function generatePropTypes(ctx) {
|
|
|
2788
2802
|
|
|
2789
2803
|
// src/artifacts/types/style-props.ts
|
|
2790
2804
|
import { allCssProperties } from "@pandacss/is-valid-prop";
|
|
2791
|
-
import
|
|
2805
|
+
import outdent40 from "outdent";
|
|
2792
2806
|
function generateStyleProps(ctx) {
|
|
2793
2807
|
const props = new Set(allCssProperties.concat(ctx.utility.keys()));
|
|
2794
|
-
return
|
|
2808
|
+
return outdent40`
|
|
2795
2809
|
import type { ConditionalValue } from './conditions'
|
|
2796
2810
|
import type { PropertyValue } from './prop-type'
|
|
2797
2811
|
import type { Token } from '../tokens'
|
|
@@ -2808,7 +2822,7 @@ function generateStyleProps(ctx) {
|
|
|
2808
2822
|
|
|
2809
2823
|
// src/artifacts/types/token-types.ts
|
|
2810
2824
|
import { capitalize, unionType as unionType3 } from "@pandacss/shared";
|
|
2811
|
-
import { outdent as
|
|
2825
|
+
import { outdent as outdent41 } from "outdent";
|
|
2812
2826
|
import pluralize from "pluralize";
|
|
2813
2827
|
var categories = [
|
|
2814
2828
|
"zIndex",
|
|
@@ -2853,7 +2867,7 @@ function generateTokenTypes(ctx) {
|
|
|
2853
2867
|
result.add("} & { [token: string]: never }");
|
|
2854
2868
|
set.add(Array.from(result).join("\n"));
|
|
2855
2869
|
set.add(`export type TokenCategory = ${unionType3(categories)}`);
|
|
2856
|
-
return
|
|
2870
|
+
return outdent41.string(Array.from(set).join("\n\n"));
|
|
2857
2871
|
}
|
|
2858
2872
|
|
|
2859
2873
|
// src/artifacts/index.ts
|
|
@@ -2950,8 +2964,8 @@ function setupRecipes(ctx) {
|
|
|
2950
2964
|
return;
|
|
2951
2965
|
const indexFiles = files.filter((file) => !file.name.includes("create-recipe"));
|
|
2952
2966
|
const index = {
|
|
2953
|
-
js:
|
|
2954
|
-
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"))
|
|
2955
2969
|
};
|
|
2956
2970
|
return {
|
|
2957
2971
|
dir: ctx.paths.recipe,
|
|
@@ -2970,8 +2984,8 @@ function setupPatterns(ctx) {
|
|
|
2970
2984
|
if (!files)
|
|
2971
2985
|
return;
|
|
2972
2986
|
const index = {
|
|
2973
|
-
js:
|
|
2974
|
-
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"))
|
|
2975
2989
|
};
|
|
2976
2990
|
return {
|
|
2977
2991
|
dir: ctx.paths.pattern,
|
|
@@ -2991,13 +3005,15 @@ function setupJsx(ctx) {
|
|
|
2991
3005
|
const factory = generateJsxFactory(ctx);
|
|
2992
3006
|
const patterns = generateJsxPatterns(ctx);
|
|
2993
3007
|
const index = {
|
|
2994
|
-
js:
|
|
3008
|
+
js: outdent42`
|
|
2995
3009
|
${ctx.file.export("./factory")}
|
|
2996
|
-
${
|
|
3010
|
+
${isValidProp?.js ? ctx.file.export("./is-valid-prop") : ""}
|
|
3011
|
+
${outdent42.string(patterns.map((file) => ctx.file.export(`./${file.name}`)).join("\n"))}
|
|
2997
3012
|
`,
|
|
2998
|
-
dts:
|
|
3013
|
+
dts: outdent42`
|
|
2999
3014
|
export * from './factory'
|
|
3000
|
-
${
|
|
3015
|
+
${isValidProp?.dts ? `export * from './is-valid-prop'` : ""}
|
|
3016
|
+
${outdent42.string(patterns.map((file) => `export * from './${file.name}'`).join("\n"))}
|
|
3001
3017
|
export type { ${ctx.jsx.typeName} } from '../types/jsx'
|
|
3002
3018
|
`
|
|
3003
3019
|
};
|
|
@@ -3007,6 +3023,7 @@ function setupJsx(ctx) {
|
|
|
3007
3023
|
...patterns.map((file) => ({ file: ctx.file.ext(file.name), code: file.js })),
|
|
3008
3024
|
...patterns.map((file) => ({ file: `${file.name}.d.ts`, code: file.dts })),
|
|
3009
3025
|
{ file: ctx.file.ext("is-valid-prop"), code: isValidProp?.js },
|
|
3026
|
+
{ file: "is-valid-prop.d.ts", code: isValidProp?.dts },
|
|
3010
3027
|
{ file: "factory.d.ts", code: types.jsxFactory },
|
|
3011
3028
|
{ file: ctx.file.ext("factory"), code: factory?.js },
|
|
3012
3029
|
{ file: "index.d.ts", code: index.dts },
|
|
@@ -3016,12 +3033,12 @@ function setupJsx(ctx) {
|
|
|
3016
3033
|
}
|
|
3017
3034
|
function setupCssIndex(ctx) {
|
|
3018
3035
|
const index = {
|
|
3019
|
-
js:
|
|
3036
|
+
js: outdent42`
|
|
3020
3037
|
${ctx.file.export("./css")}
|
|
3021
3038
|
${ctx.file.export("./cx")}
|
|
3022
3039
|
${ctx.isTemplateLiteralSyntax ? "" : ctx.file.export("./cva")}
|
|
3023
3040
|
`,
|
|
3024
|
-
dts:
|
|
3041
|
+
dts: outdent42`
|
|
3025
3042
|
export * from './css'
|
|
3026
3043
|
export * from './cx'
|
|
3027
3044
|
${ctx.isTemplateLiteralSyntax ? "" : `export * from './cva'`}
|
|
@@ -3096,9 +3113,9 @@ var generateFlattenedCss = (ctx) => (options) => {
|
|
|
3096
3113
|
const { theme: { keyframes } = {}, preflight, minify, staticCss } = ctx.config;
|
|
3097
3114
|
const unresolved = [
|
|
3098
3115
|
"@layer reset, base, tokens, recipes, utilities;",
|
|
3116
|
+
preflight && "@import './reset.css';",
|
|
3099
3117
|
"@import './global.css';",
|
|
3100
3118
|
staticCss && "@import './static.css';",
|
|
3101
|
-
preflight && "@import './reset.css';",
|
|
3102
3119
|
!ctx.tokens.isEmpty && "@import './tokens/index.css';",
|
|
3103
3120
|
keyframes && "@import './tokens/keyframes.css';"
|
|
3104
3121
|
].filter(Boolean).join("\n\n");
|
|
@@ -3118,8 +3135,7 @@ var generateFlattenedCss = (ctx) => (options) => {
|
|
|
3118
3135
|
// src/artifacts/css/parser-css.ts
|
|
3119
3136
|
import { logger } from "@pandacss/logger";
|
|
3120
3137
|
import { pipe, tap, tryCatch } from "lil-fp/func";
|
|
3121
|
-
import { match as match6
|
|
3122
|
-
var flattenStyles = (data) => Object.assign({}, data, { css: void 0 }, data.css ?? {});
|
|
3138
|
+
import { P, match as match6 } from "ts-pattern";
|
|
3123
3139
|
var generateParserCss = (ctx) => (result) => pipe(
|
|
3124
3140
|
{ ...ctx, sheet: ctx.createSheet(), result },
|
|
3125
3141
|
tap(({ sheet, result: result2, patterns, recipes }) => {
|
|
@@ -3135,7 +3151,7 @@ var generateParserCss = (ctx) => (result) => pipe(
|
|
|
3135
3151
|
});
|
|
3136
3152
|
result2.jsx.forEach((jsx) => {
|
|
3137
3153
|
jsx.data.forEach((data) => {
|
|
3138
|
-
sheet.
|
|
3154
|
+
sheet.processStyleProps(data);
|
|
3139
3155
|
});
|
|
3140
3156
|
});
|
|
3141
3157
|
result2.recipe.forEach((recipeSet, name) => {
|
|
@@ -3146,8 +3162,8 @@ var generateParserCss = (ctx) => (result) => pipe(
|
|
|
3146
3162
|
continue;
|
|
3147
3163
|
match6(recipe).with({ type: "jsx-recipe", name: P.string }, ({ name: name2 }) => {
|
|
3148
3164
|
recipe.data.forEach((data) => {
|
|
3149
|
-
const [recipeProps, styleProps] = recipes.splitProps(name2,
|
|
3150
|
-
sheet.
|
|
3165
|
+
const [recipeProps, styleProps] = recipes.splitProps(name2, data);
|
|
3166
|
+
sheet.processStyleProps(styleProps);
|
|
3151
3167
|
sheet.processRecipe(recipeConfig, recipeProps);
|
|
3152
3168
|
});
|
|
3153
3169
|
}).otherwise(() => {
|
|
@@ -3166,8 +3182,8 @@ var generateParserCss = (ctx) => (result) => pipe(
|
|
|
3166
3182
|
match6(pattern).with({ type: "jsx-pattern", name: P.string }, ({ name: name2 }) => {
|
|
3167
3183
|
pattern.data.forEach((data) => {
|
|
3168
3184
|
const fnName = patterns.getFnName(name2);
|
|
3169
|
-
const styleProps = patterns.transform(fnName,
|
|
3170
|
-
sheet.
|
|
3185
|
+
const styleProps = patterns.transform(fnName, data);
|
|
3186
|
+
sheet.processStyleProps(styleProps);
|
|
3171
3187
|
});
|
|
3172
3188
|
}).otherwise(() => {
|
|
3173
3189
|
pattern.data.forEach((data) => {
|
|
@@ -3406,25 +3422,30 @@ var getImportMap = (outdir) => ({
|
|
|
3406
3422
|
pattern: `${outdir}/patterns`,
|
|
3407
3423
|
jsx: `${outdir}/jsx`
|
|
3408
3424
|
});
|
|
3409
|
-
var createGenerator = (conf) =>
|
|
3410
|
-
getEngine(defaults(conf))
|
|
3411
|
-
|
|
3425
|
+
var createGenerator = (conf) => {
|
|
3426
|
+
const ctx = getEngine(defaults(conf));
|
|
3427
|
+
const { config, jsx, isValidProperty, patterns, recipes } = ctx;
|
|
3428
|
+
const compilerOptions = conf.tsconfig?.compilerOptions ?? {};
|
|
3429
|
+
const baseUrl = compilerOptions.baseUrl ?? "";
|
|
3430
|
+
const cwd = conf.config.cwd;
|
|
3431
|
+
const relativeBaseUrl = baseUrl ? baseUrl.replace(cwd, "").slice(1) + "/" : cwd;
|
|
3432
|
+
return {
|
|
3433
|
+
...ctx,
|
|
3412
3434
|
getArtifacts: generateArtifacts(ctx),
|
|
3413
3435
|
getCss: generateFlattenedCss(ctx),
|
|
3414
3436
|
getParserCss: generateParserCss(ctx),
|
|
3415
|
-
messages: getMessages(ctx)
|
|
3416
|
-
|
|
3417
|
-
|
|
3418
|
-
|
|
3419
|
-
|
|
3420
|
-
|
|
3421
|
-
|
|
3422
|
-
|
|
3423
|
-
|
|
3424
|
-
|
|
3425
|
-
|
|
3426
|
-
|
|
3427
|
-
);
|
|
3437
|
+
messages: getMessages(ctx),
|
|
3438
|
+
parserOptions: {
|
|
3439
|
+
importMap: getImportMap(config.outdir.replace(relativeBaseUrl, "")),
|
|
3440
|
+
jsx: {
|
|
3441
|
+
factory: jsx.factoryName,
|
|
3442
|
+
isStyleProp: isValidProperty,
|
|
3443
|
+
nodes: [...patterns.nodes, ...recipes.nodes]
|
|
3444
|
+
},
|
|
3445
|
+
getRecipesByJsxName: recipes.filter
|
|
3446
|
+
}
|
|
3447
|
+
};
|
|
3448
|
+
};
|
|
3428
3449
|
export {
|
|
3429
3450
|
createGenerator,
|
|
3430
3451
|
messages_exports as messages
|