@pandacss/generator 0.3.2 → 0.5.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 +267 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +775 -110
- package/dist/index.mjs +815 -150
- package/package.json +8 -8
package/dist/index.mjs
CHANGED
|
@@ -11,6 +11,7 @@ __export(messages_exports, {
|
|
|
11
11
|
buildComplete: () => buildComplete,
|
|
12
12
|
codegenComplete: () => codegenComplete,
|
|
13
13
|
configExists: () => configExists,
|
|
14
|
+
configWatch: () => configWatch,
|
|
14
15
|
getMessages: () => getMessages,
|
|
15
16
|
noExtract: () => noExtract,
|
|
16
17
|
thankYou: () => thankYou,
|
|
@@ -34,7 +35,7 @@ var artifactsGenerated = (ctx) => {
|
|
|
34
35
|
!tokens.isEmpty && outdent`
|
|
35
36
|
${tick} ${quote(outdir, "/tokens")}: the css variables and js function to query your tokens
|
|
36
37
|
`,
|
|
37
|
-
!patterns.isEmpty() && outdent`
|
|
38
|
+
!patterns.isEmpty() && !ctx.isTemplateLiteralSyntax && outdent`
|
|
38
39
|
${tick} ${quote(outdir, "/patterns")}: functions to implement apply common layout patterns
|
|
39
40
|
`,
|
|
40
41
|
!recipes.isEmpty() && outdent`
|
|
@@ -79,6 +80,9 @@ var noExtract = () => outdent`
|
|
|
79
80
|
var watch = () => outdent`
|
|
80
81
|
Watching for file changes...
|
|
81
82
|
`;
|
|
83
|
+
var configWatch = () => outdent`
|
|
84
|
+
Watching for config file changes...
|
|
85
|
+
`;
|
|
82
86
|
var buildComplete = (count) => outdent`
|
|
83
87
|
Successfully extracted css from ${count} file(s) ✨
|
|
84
88
|
`;
|
|
@@ -89,7 +93,8 @@ var getMessages = (ctx) => ({
|
|
|
89
93
|
codegenComplete,
|
|
90
94
|
noExtract,
|
|
91
95
|
watch,
|
|
92
|
-
buildComplete
|
|
96
|
+
buildComplete,
|
|
97
|
+
configWatch
|
|
93
98
|
});
|
|
94
99
|
|
|
95
100
|
// src/generator.ts
|
|
@@ -97,7 +102,7 @@ import { Obj as Obj2, pipe as pipe3 } from "lil-fp";
|
|
|
97
102
|
|
|
98
103
|
// src/artifacts/index.ts
|
|
99
104
|
import { isObject } from "@pandacss/shared";
|
|
100
|
-
import
|
|
105
|
+
import outdent41 from "outdent";
|
|
101
106
|
|
|
102
107
|
// src/artifacts/css/global-css.ts
|
|
103
108
|
var generateGlobalCss = (ctx) => {
|
|
@@ -541,8 +546,39 @@ function generateConditions(ctx) {
|
|
|
541
546
|
};
|
|
542
547
|
}
|
|
543
548
|
|
|
549
|
+
// src/artifacts/js/conditions.string-literal.ts
|
|
550
|
+
import outdent3 from "outdent";
|
|
551
|
+
function generateStringLiteralConditions(ctx) {
|
|
552
|
+
return {
|
|
553
|
+
js: outdent3`
|
|
554
|
+
${ctx.file.import("withoutSpace", "../helpers")}
|
|
555
|
+
|
|
556
|
+
export const isCondition = (val) => condRegex.test(val)
|
|
557
|
+
|
|
558
|
+
const condRegex = /^@|&|&$/
|
|
559
|
+
const selectorRegex = /&|@/
|
|
560
|
+
|
|
561
|
+
export const finalizeConditions = (paths) => {
|
|
562
|
+
return paths.map((path) => (selectorRegex.test(path) ? \`[\${withoutSpace(path.trim())}]\` : path))
|
|
563
|
+
}
|
|
564
|
+
|
|
565
|
+
export function sortConditions(paths){
|
|
566
|
+
return paths.sort((a, b) => {
|
|
567
|
+
const aa = isCondition(a)
|
|
568
|
+
const bb = isCondition(b)
|
|
569
|
+
if (aa && !bb) return 1
|
|
570
|
+
if (!aa && bb) return -1
|
|
571
|
+
return 0
|
|
572
|
+
})
|
|
573
|
+
}
|
|
574
|
+
`,
|
|
575
|
+
dts: outdent3`
|
|
576
|
+
`
|
|
577
|
+
};
|
|
578
|
+
}
|
|
579
|
+
|
|
544
580
|
// src/artifacts/js/css-fn.ts
|
|
545
|
-
import { outdent as
|
|
581
|
+
import { outdent as outdent4 } from "outdent";
|
|
546
582
|
var stringify = (v) => JSON.stringify(Object.fromEntries(v), null, 2);
|
|
547
583
|
function generateCssFn(ctx) {
|
|
548
584
|
const {
|
|
@@ -552,11 +588,11 @@ function generateCssFn(ctx) {
|
|
|
552
588
|
} = ctx;
|
|
553
589
|
const { separator } = utility;
|
|
554
590
|
return {
|
|
555
|
-
dts:
|
|
591
|
+
dts: outdent4`
|
|
556
592
|
import type { SystemStyleObject } from '../types'
|
|
557
593
|
export declare function css(styles: SystemStyleObject): string
|
|
558
594
|
`,
|
|
559
|
-
js:
|
|
595
|
+
js: outdent4`
|
|
560
596
|
${ctx.file.import("createCss, createMergeCss, hypenateProperty, withoutSpace", "../helpers")}
|
|
561
597
|
${ctx.file.import("sortConditions, finalizeConditions", "./conditions")}
|
|
562
598
|
|
|
@@ -599,11 +635,58 @@ function generateCssFn(ctx) {
|
|
|
599
635
|
};
|
|
600
636
|
}
|
|
601
637
|
|
|
638
|
+
// src/artifacts/js/css-fn.string-literal.ts
|
|
639
|
+
import { outdent as outdent5 } from "outdent";
|
|
640
|
+
function generateStringLiteralCssFn(ctx) {
|
|
641
|
+
const {
|
|
642
|
+
utility,
|
|
643
|
+
config: { hash, prefix }
|
|
644
|
+
} = ctx;
|
|
645
|
+
const { separator } = utility;
|
|
646
|
+
return {
|
|
647
|
+
dts: outdent5`
|
|
648
|
+
export declare function css(template: { raw: readonly string[] | ArrayLike<string> }): string
|
|
649
|
+
`,
|
|
650
|
+
js: outdent5`
|
|
651
|
+
${ctx.file.import("astish, createCss, withoutSpace", "../helpers")}
|
|
652
|
+
${ctx.file.import("sortConditions, finalizeConditions", "./conditions")}
|
|
653
|
+
|
|
654
|
+
function transform(prop, value) {
|
|
655
|
+
const className = \`$\{prop}${separator}$\{withoutSpace(value)}\`
|
|
656
|
+
return { className }
|
|
657
|
+
}
|
|
658
|
+
|
|
659
|
+
const context = {
|
|
660
|
+
hash: ${hash ? "true" : "false"},
|
|
661
|
+
conditions: {
|
|
662
|
+
shift: sortConditions,
|
|
663
|
+
finalize: finalizeConditions,
|
|
664
|
+
breakpoints: { keys: [] },
|
|
665
|
+
},
|
|
666
|
+
utility: {
|
|
667
|
+
prefix: ${prefix ? JSON.stringify(prefix) : void 0},
|
|
668
|
+
transform,
|
|
669
|
+
hasShorthand: false,
|
|
670
|
+
resolveShorthand(prop) {
|
|
671
|
+
return prop
|
|
672
|
+
},
|
|
673
|
+
}
|
|
674
|
+
}
|
|
675
|
+
|
|
676
|
+
const cssFn = createCss(context)
|
|
677
|
+
|
|
678
|
+
export const css = (str) => {
|
|
679
|
+
return cssFn(astish(str[0]))
|
|
680
|
+
}
|
|
681
|
+
`
|
|
682
|
+
};
|
|
683
|
+
}
|
|
684
|
+
|
|
602
685
|
// src/artifacts/js/cva.ts
|
|
603
|
-
import { outdent as
|
|
686
|
+
import { outdent as outdent6 } from "outdent";
|
|
604
687
|
function generateCvaFn(ctx) {
|
|
605
688
|
return {
|
|
606
|
-
js:
|
|
689
|
+
js: outdent6`
|
|
607
690
|
${ctx.file.import("compact, splitProps", "../helpers")}
|
|
608
691
|
${ctx.file.import("css, mergeCss", "./css")}
|
|
609
692
|
|
|
@@ -669,7 +752,7 @@ function generateCvaFn(ctx) {
|
|
|
669
752
|
}
|
|
670
753
|
|
|
671
754
|
`,
|
|
672
|
-
dts:
|
|
755
|
+
dts: outdent6`
|
|
673
756
|
import type { RecipeCreatorFn } from '../types/recipe'
|
|
674
757
|
|
|
675
758
|
export declare const cva: RecipeCreatorFn
|
|
@@ -681,10 +764,10 @@ function generateCvaFn(ctx) {
|
|
|
681
764
|
}
|
|
682
765
|
|
|
683
766
|
// src/artifacts/js/cx.ts
|
|
684
|
-
import
|
|
767
|
+
import outdent7 from "outdent";
|
|
685
768
|
function generateCx() {
|
|
686
769
|
return {
|
|
687
|
-
js:
|
|
770
|
+
js: outdent7`
|
|
688
771
|
function cx() {
|
|
689
772
|
let str = '',
|
|
690
773
|
i = 0,
|
|
@@ -701,7 +784,7 @@ function generateCx() {
|
|
|
701
784
|
|
|
702
785
|
export { cx }
|
|
703
786
|
`,
|
|
704
|
-
dts:
|
|
787
|
+
dts: outdent7`
|
|
705
788
|
type Argument = string | boolean | null | undefined
|
|
706
789
|
|
|
707
790
|
/** Conditionally join classNames into a single string */
|
|
@@ -711,17 +794,17 @@ function generateCx() {
|
|
|
711
794
|
}
|
|
712
795
|
|
|
713
796
|
// src/artifacts/js/helpers.ts
|
|
714
|
-
import { outdent as
|
|
797
|
+
import { outdent as outdent8 } from "outdent";
|
|
715
798
|
|
|
716
799
|
// src/artifacts/generated/helpers.mjs.json
|
|
717
800
|
var helpers_mjs_default = {
|
|
718
|
-
content: '// src/assert.ts\nfunction isObject(value) {\n return typeof value === "object" && value != null && !Array.isArray(value);\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 result[key] = inner(child, childPath);\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/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}\
|
|
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 result[key] = inner(child, childPath);\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 dashCaseRegex = /[A-Z]/g;\nvar hypenateProperty = memo((property) => {\n if (property.startsWith("--"))\n return property;\n return property.replace(dashCaseRegex, (match) => `-${match.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'
|
|
719
802
|
};
|
|
720
803
|
|
|
721
804
|
// src/artifacts/js/helpers.ts
|
|
722
805
|
function generateHelpers() {
|
|
723
806
|
return {
|
|
724
|
-
js:
|
|
807
|
+
js: outdent8`
|
|
725
808
|
${helpers_mjs_default.content}
|
|
726
809
|
|
|
727
810
|
export function __spreadValues(a, b){
|
|
@@ -737,11 +820,13 @@ function generateHelpers() {
|
|
|
737
820
|
|
|
738
821
|
// src/artifacts/generated/is-valid-prop.mjs.json
|
|
739
822
|
var is_valid_prop_mjs_default = {
|
|
740
|
-
content: '// src/index.ts\nvar userGenerated = [];\nvar allCssProperties = [\n "MsAccelerator",\n "MsBlockProgression",\n "MsContentZoomChaining",\n "MsContentZooming",\n "MsContentZoomLimit",\n "MsContentZoomLimitMax",\n "MsContentZoomLimitMin",\n "MsContentZoomSnap",\n "MsContentZoomSnapPoints",\n "MsContentZoomSnapType",\n "MsFilter",\n "MsFlowFrom",\n "MsFlowInto",\n "MsGridColumns",\n "MsGridRows",\n "MsHighContrastAdjust",\n "MsHyphenateLimitChars",\n "MsHyphenateLimitLines",\n "MsHyphenateLimitZone",\n "MsImeAlign",\n "MsOverflowStyle",\n "MsScrollbar3dlightColor",\n "MsScrollbarArrowColor",\n "MsScrollbarBaseColor",\n "MsScrollbarDarkshadowColor",\n "MsScrollbarFaceColor",\n "MsScrollbarHighlightColor",\n "MsScrollbarShadowColor",\n "MsScrollbarTrackColor",\n "MsScrollChaining",\n "MsScrollLimit",\n "MsScrollLimitXMax",\n "MsScrollLimitXMin",\n "MsScrollLimitYMax",\n "MsScrollLimitYMin",\n "MsScrollRails",\n "MsScrollSnapPointsX",\n "MsScrollSnapPointsY",\n "MsScrollSnapType",\n "MsScrollSnapX",\n "MsScrollSnapY",\n "MsScrollTranslation",\n "MsTextAutospace",\n "MsTouchSelect",\n "MsUserSelect",\n "MsWrapFlow",\n "MsWrapMargin",\n "MsWrapThrough",\n "MozAppearance",\n "MozBinding",\n "MozBorderBottomColors",\n "MozBorderLeftColors",\n "MozBorderRightColors",\n "MozBorderTopColors",\n "MozContextProperties",\n "MozFloatEdge",\n "MozForceBrokenImageIcon",\n "MozImageRegion",\n "MozOrient",\n "MozOutlineRadius",\n "MozOutlineRadiusBottomleft",\n "MozOutlineRadiusBottomright",\n "MozOutlineRadiusTopleft",\n "MozOutlineRadiusTopright",\n "MozStackSizing",\n "MozTextBlink",\n "MozUserFocus",\n "MozUserInput",\n "MozUserModify",\n "MozWindowDragging",\n "MozWindowShadow",\n "WebkitAppearance",\n "WebkitBorderBefore",\n "WebkitBorderBeforeColor",\n "WebkitBorderBeforeStyle",\n "WebkitBorderBeforeWidth",\n "WebkitBoxReflect",\n "WebkitLineClamp",\n "WebkitMask",\n "WebkitMaskAttachment",\n "WebkitMaskClip",\n "WebkitMaskComposite",\n "WebkitMaskImage",\n "WebkitMaskOrigin",\n "WebkitMaskPosition",\n "WebkitMaskPositionX",\n "WebkitMaskPositionY",\n "WebkitMaskRepeat",\n "WebkitMaskRepeatX",\n "WebkitMaskRepeatY",\n "WebkitMaskSize",\n "WebkitOverflowScrolling",\n "WebkitTapHighlightColor",\n "WebkitTextFillColor",\n "WebkitTextStroke",\n "WebkitTextStrokeColor",\n "WebkitTextStrokeWidth",\n "WebkitTouchCallout",\n "WebkitUserModify",\n "accentColor",\n "alignContent",\n "alignItems",\n "alignSelf",\n "alignTracks",\n "all",\n "animation",\n "animationComposition",\n "animationDelay",\n "animationDirection",\n "animationDuration",\n "animationFillMode",\n "animationIterationCount",\n "animationName",\n "animationPlayState",\n "animationTimingFunction",\n "animationTimeline",\n "appearance",\n "aspectRatio",\n "azimuth",\n "backdropFilter",\n "backfaceVisibility",\n "background",\n "backgroundAttachment",\n "backgroundBlendMode",\n "backgroundClip",\n "backgroundColor",\n "backgroundImage",\n "backgroundOrigin",\n "backgroundPosition",\n "backgroundPositionX",\n "backgroundPositionY",\n "backgroundRepeat",\n "backgroundSize",\n "blockOverflow",\n "blockSize",\n "border",\n "borderBlock",\n "borderBlockColor",\n "borderBlockStyle",\n "borderBlockWidth",\n "borderBlockEnd",\n "borderBlockEndColor",\n "borderBlockEndStyle",\n "borderBlockEndWidth",\n "borderBlockStart",\n "borderBlockStartColor",\n "borderBlockStartStyle",\n "borderBlockStartWidth",\n "borderBottom",\n "borderBottomColor",\n "borderBottomLeftRadius",\n "borderBottomRightRadius",\n "borderBottomStyle",\n "borderBottomWidth",\n "borderCollapse",\n "borderColor",\n "borderEndEndRadius",\n "borderEndStartRadius",\n "borderImage",\n "borderImageOutset",\n "borderImageRepeat",\n "borderImageSlice",\n "borderImageSource",\n "borderImageWidth",\n "borderInline",\n "borderInlineEnd",\n "borderInlineColor",\n "borderInlineStyle",\n "borderInlineWidth",\n "borderInlineEndColor",\n "borderInlineEndStyle",\n "borderInlineEndWidth",\n "borderInlineStart",\n "borderInlineStartColor",\n "borderInlineStartStyle",\n "borderInlineStartWidth",\n "borderLeft",\n "borderLeftColor",\n "borderLeftStyle",\n "borderLeftWidth",\n "borderRadius",\n "borderRight",\n "borderRightColor",\n "borderRightStyle",\n "borderRightWidth",\n "borderSpacing",\n "borderStartEndRadius",\n "borderStartStartRadius",\n "borderStyle",\n "borderTop",\n "borderTopColor",\n "borderTopLeftRadius",\n "borderTopRightRadius",\n "borderTopStyle",\n "borderTopWidth",\n "borderWidth",\n "bottom",\n "boxAlign",\n "boxDecorationBreak",\n "boxDirection",\n "boxFlex",\n "boxFlexGroup",\n "boxLines",\n "boxOrdinalGroup",\n "boxOrient",\n "boxPack",\n "boxShadow",\n "boxSizing",\n "breakAfter",\n "breakBefore",\n "breakInside",\n "captionSide",\n "caret",\n "caretColor",\n "caretShape",\n "clear",\n "clip",\n "clipPath",\n "color",\n "printColorAdjust",\n "colorScheme",\n "columnCount",\n "columnFill",\n "columnGap",\n "columnRule",\n "columnRuleColor",\n "columnRuleStyle",\n "columnRuleWidth",\n "columnSpan",\n "columnWidth",\n "columns",\n "contain",\n "containIntrinsicSize",\n "containIntrinsicBlockSize",\n "containIntrinsicHeight",\n "containIntrinsicInlineSize",\n "containIntrinsicWidth",\n "content",\n "contentVisibility",\n "counterIncrement",\n "counterReset",\n "counterSet",\n "cursor",\n "direction",\n "display",\n "emptyCells",\n "filter",\n "flex",\n "flexBasis",\n "flexDirection",\n "flexFlow",\n "flexGrow",\n "flexShrink",\n "flexWrap",\n "float",\n "font",\n "fontFamily",\n "fontFeatureSettings",\n "fontKerning",\n "fontLanguageOverride",\n "fontOpticalSizing",\n "fontVariationSettings",\n "fontSize",\n "fontSizeAdjust",\n "fontSmooth",\n "fontStretch",\n "fontStyle",\n "fontSynthesis",\n "fontVariant",\n "fontVariantAlternates",\n "fontVariantCaps",\n "fontVariantEastAsian",\n "fontVariantLigatures",\n "fontVariantNumeric",\n "fontVariantPosition",\n "fontWeight",\n "forcedColorAdjust",\n "gap",\n "grid",\n "gridArea",\n "gridAutoColumns",\n "gridAutoFlow",\n "gridAutoRows",\n "gridColumn",\n "gridColumnEnd",\n "gridColumnGap",\n "gridColumnStart",\n "gridGap",\n "gridRow",\n "gridRowEnd",\n "gridRowGap",\n "gridRowStart",\n "gridTemplate",\n "gridTemplateAreas",\n "gridTemplateColumns",\n "gridTemplateRows",\n "hangingPunctuation",\n "height",\n "hyphenateCharacter",\n "hyphenateLimitChars",\n "hyphens",\n "imageOrientation",\n "imageRendering",\n "imageResolution",\n "imeMode",\n "initialLetter",\n "initialLetterAlign",\n "inlineSize",\n "inputSecurity",\n "inset",\n "insetBlock",\n "insetBlockEnd",\n "insetBlockStart",\n "insetInline",\n "insetInlineEnd",\n "insetInlineStart",\n "isolation",\n "justifyContent",\n "justifyItems",\n "justifySelf",\n "justifyTracks",\n "left",\n "letterSpacing",\n "lineBreak",\n "lineClamp",\n "lineHeight",\n "lineHeightStep",\n "listStyle",\n "listStyleImage",\n "listStylePosition",\n "listStyleType",\n "margin",\n "marginBlock",\n "marginBlockEnd",\n "marginBlockStart",\n "marginBottom",\n "marginInline",\n "marginInlineEnd",\n "marginInlineStart",\n "marginLeft",\n "marginRight",\n "marginTop",\n "marginTrim",\n "mask",\n "maskBorder",\n "maskBorderMode",\n "maskBorderOutset",\n "maskBorderRepeat",\n "maskBorderSlice",\n "maskBorderSource",\n "maskBorderWidth",\n "maskClip",\n "maskComposite",\n "maskImage",\n "maskMode",\n "maskOrigin",\n "maskPosition",\n "maskRepeat",\n "maskSize",\n "maskType",\n "masonryAutoFlow",\n "mathDepth",\n "mathShift",\n "mathStyle",\n "maxBlockSize",\n "maxHeight",\n "maxInlineSize",\n "maxLines",\n "maxWidth",\n "minBlockSize",\n "minHeight",\n "minInlineSize",\n "minWidth",\n "mixBlendMode",\n "objectFit",\n "objectPosition",\n "offset",\n "offsetAnchor",\n "offsetDistance",\n "offsetPath",\n "offsetPosition",\n "offsetRotate",\n "opacity",\n "order",\n "orphans",\n "outline",\n "outlineColor",\n "outlineOffset",\n "outlineStyle",\n "outlineWidth",\n "overflow",\n "overflowAnchor",\n "overflowBlock",\n "overflowClipBox",\n "overflowClipMargin",\n "overflowInline",\n "overflowWrap",\n "overflowX",\n "overflowY",\n "overscrollBehavior",\n "overscrollBehaviorBlock",\n "overscrollBehaviorInline",\n "overscrollBehaviorX",\n "overscrollBehaviorY",\n "padding",\n "paddingBlock",\n "paddingBlockEnd",\n "paddingBlockStart",\n "paddingBottom",\n "paddingInline",\n "paddingInlineEnd",\n "paddingInlineStart",\n "paddingLeft",\n "paddingRight",\n "paddingTop",\n "pageBreakAfter",\n "pageBreakBefore",\n "pageBreakInside",\n "paintOrder",\n "perspective",\n "perspectiveOrigin",\n "placeContent",\n "placeItems",\n "placeSelf",\n "pointerEvents",\n "position",\n "quotes",\n "resize",\n "right",\n "rotate",\n "rowGap",\n "rubyAlign",\n "rubyMerge",\n "rubyPosition",\n "scale",\n "scrollbarColor",\n "scrollbarGutter",\n "scrollbarWidth",\n "scrollBehavior",\n "scrollMargin",\n "scrollMarginBlock",\n "scrollMarginBlockStart",\n "scrollMarginBlockEnd",\n "scrollMarginBottom",\n "scrollMarginInline",\n "scrollMarginInlineStart",\n "scrollMarginInlineEnd",\n "scrollMarginLeft",\n "scrollMarginRight",\n "scrollMarginTop",\n "scrollPadding",\n "scrollPaddingBlock",\n "scrollPaddingBlockStart",\n "scrollPaddingBlockEnd",\n "scrollPaddingBottom",\n "scrollPaddingInline",\n "scrollPaddingInlineStart",\n "scrollPaddingInlineEnd",\n "scrollPaddingLeft",\n "scrollPaddingRight",\n "scrollPaddingTop",\n "scrollSnapAlign",\n "scrollSnapCoordinate",\n "scrollSnapDestination",\n "scrollSnapPointsX",\n "scrollSnapPointsY",\n "scrollSnapStop",\n "scrollSnapType",\n "scrollSnapTypeX",\n "scrollSnapTypeY",\n "scrollTimeline",\n "scrollTimelineAxis",\n "scrollTimelineName",\n "shapeImageThreshold",\n "shapeMargin",\n "shapeOutside",\n "tabSize",\n "tableLayout",\n "textAlign",\n "textAlignLast",\n "textCombineUpright",\n "textDecoration",\n "textDecorationColor",\n "textDecorationLine",\n "textDecorationSkip",\n "textDecorationSkipInk",\n "textDecorationStyle",\n "textDecorationThickness",\n "textEmphasis",\n "textEmphasisColor",\n "textEmphasisPosition",\n "textEmphasisStyle",\n "textIndent",\n "textJustify",\n "textOrientation",\n "textOverflow",\n "textRendering",\n "textShadow",\n "textSizeAdjust",\n "textTransform",\n "textUnderlineOffset",\n "textUnderlinePosition",\n "top",\n "touchAction",\n "transform",\n "transformBox",\n "transformOrigin",\n "transformStyle",\n "transition",\n "transitionDelay",\n "transitionDuration",\n "transitionProperty",\n "transitionTimingFunction",\n "translate",\n "unicodeBidi",\n "userSelect",\n "verticalAlign",\n "visibility",\n "whiteSpace",\n "widows",\n "width",\n "willChange",\n "wordBreak",\n "wordSpacing",\n "wordWrap",\n "writingMode",\n "zIndex",\n "zoom",\n ...userGenerated\n];\nvar properties = new Map(allCssProperties.map((prop) => [prop, true]));\nfunction memo(fn) {\n const cache = /* @__PURE__ */ Object.create(null);\n return (arg) => {\n if (cache[arg] === void 0)\n cache[arg] = fn(arg);\n return cache[arg];\n };\n}\nvar isCssProperty = memo((prop) => {\n return properties.has(prop) || prop.startsWith("--");\n});\nexport {\n allCssProperties,\n isCssProperty\n};\n'
|
|
823
|
+
content: '// src/index.ts\nvar userGenerated = [];\nvar allCssProperties = [\n "MsAccelerator",\n "MsBlockProgression",\n "MsContentZoomChaining",\n "MsContentZooming",\n "MsContentZoomLimit",\n "MsContentZoomLimitMax",\n "MsContentZoomLimitMin",\n "MsContentZoomSnap",\n "MsContentZoomSnapPoints",\n "MsContentZoomSnapType",\n "MsFilter",\n "MsFlowFrom",\n "MsFlowInto",\n "MsGridColumns",\n "MsGridRows",\n "MsHighContrastAdjust",\n "MsHyphenateLimitChars",\n "MsHyphenateLimitLines",\n "MsHyphenateLimitZone",\n "MsImeAlign",\n "MsOverflowStyle",\n "MsScrollbar3dlightColor",\n "MsScrollbarArrowColor",\n "MsScrollbarBaseColor",\n "MsScrollbarDarkshadowColor",\n "MsScrollbarFaceColor",\n "MsScrollbarHighlightColor",\n "MsScrollbarShadowColor",\n "MsScrollbarTrackColor",\n "MsScrollChaining",\n "MsScrollLimit",\n "MsScrollLimitXMax",\n "MsScrollLimitXMin",\n "MsScrollLimitYMax",\n "MsScrollLimitYMin",\n "MsScrollRails",\n "MsScrollSnapPointsX",\n "MsScrollSnapPointsY",\n "MsScrollSnapType",\n "MsScrollSnapX",\n "MsScrollSnapY",\n "MsScrollTranslation",\n "MsTextAutospace",\n "MsTouchSelect",\n "MsUserSelect",\n "MsWrapFlow",\n "MsWrapMargin",\n "MsWrapThrough",\n "MozAppearance",\n "MozBinding",\n "MozBorderBottomColors",\n "MozBorderLeftColors",\n "MozBorderRightColors",\n "MozBorderTopColors",\n "MozContextProperties",\n "MozFloatEdge",\n "MozForceBrokenImageIcon",\n "MozImageRegion",\n "MozOrient",\n "MozOutlineRadius",\n "MozOutlineRadiusBottomleft",\n "MozOutlineRadiusBottomright",\n "MozOutlineRadiusTopleft",\n "MozOutlineRadiusTopright",\n "MozStackSizing",\n "MozTextBlink",\n "MozUserFocus",\n "MozUserInput",\n "MozUserModify",\n "MozWindowDragging",\n "MozWindowShadow",\n "WebkitAppearance",\n "WebkitBorderBefore",\n "WebkitBorderBeforeColor",\n "WebkitBorderBeforeStyle",\n "WebkitBorderBeforeWidth",\n "WebkitBoxReflect",\n "WebkitLineClamp",\n "WebkitMask",\n "WebkitMaskAttachment",\n "WebkitMaskClip",\n "WebkitMaskComposite",\n "WebkitMaskImage",\n "WebkitMaskOrigin",\n "WebkitMaskPosition",\n "WebkitMaskPositionX",\n "WebkitMaskPositionY",\n "WebkitMaskRepeat",\n "WebkitMaskRepeatX",\n "WebkitMaskRepeatY",\n "WebkitMaskSize",\n "WebkitOverflowScrolling",\n "WebkitTapHighlightColor",\n "WebkitTextFillColor",\n "WebkitTextStroke",\n "WebkitTextStrokeColor",\n "WebkitTextStrokeWidth",\n "WebkitTouchCallout",\n "WebkitUserModify",\n "accentColor",\n "alignContent",\n "alignItems",\n "alignSelf",\n "alignTracks",\n "all",\n "animation",\n "animationComposition",\n "animationDelay",\n "animationDirection",\n "animationDuration",\n "animationFillMode",\n "animationIterationCount",\n "animationName",\n "animationPlayState",\n "animationTimingFunction",\n "animationTimeline",\n "appearance",\n "aspectRatio",\n "azimuth",\n "backdropFilter",\n "backfaceVisibility",\n "background",\n "backgroundAttachment",\n "backgroundBlendMode",\n "backgroundClip",\n "backgroundColor",\n "backgroundImage",\n "backgroundOrigin",\n "backgroundPosition",\n "backgroundPositionX",\n "backgroundPositionY",\n "backgroundRepeat",\n "backgroundSize",\n "blockOverflow",\n "blockSize",\n "border",\n "borderBlock",\n "borderBlockColor",\n "borderBlockStyle",\n "borderBlockWidth",\n "borderBlockEnd",\n "borderBlockEndColor",\n "borderBlockEndStyle",\n "borderBlockEndWidth",\n "borderBlockStart",\n "borderBlockStartColor",\n "borderBlockStartStyle",\n "borderBlockStartWidth",\n "borderBottom",\n "borderBottomColor",\n "borderBottomLeftRadius",\n "borderBottomRightRadius",\n "borderBottomStyle",\n "borderBottomWidth",\n "borderCollapse",\n "borderColor",\n "borderEndEndRadius",\n "borderEndStartRadius",\n "borderImage",\n "borderImageOutset",\n "borderImageRepeat",\n "borderImageSlice",\n "borderImageSource",\n "borderImageWidth",\n "borderInline",\n "borderInlineEnd",\n "borderInlineColor",\n "borderInlineStyle",\n "borderInlineWidth",\n "borderInlineEndColor",\n "borderInlineEndStyle",\n "borderInlineEndWidth",\n "borderInlineStart",\n "borderInlineStartColor",\n "borderInlineStartStyle",\n "borderInlineStartWidth",\n "borderLeft",\n "borderLeftColor",\n "borderLeftStyle",\n "borderLeftWidth",\n "borderRadius",\n "borderRight",\n "borderRightColor",\n "borderRightStyle",\n "borderRightWidth",\n "borderSpacing",\n "borderStartEndRadius",\n "borderStartStartRadius",\n "borderStyle",\n "borderTop",\n "borderTopColor",\n "borderTopLeftRadius",\n "borderTopRightRadius",\n "borderTopStyle",\n "borderTopWidth",\n "borderWidth",\n "bottom",\n "boxAlign",\n "boxDecorationBreak",\n "boxDirection",\n "boxFlex",\n "boxFlexGroup",\n "boxLines",\n "boxOrdinalGroup",\n "boxOrient",\n "boxPack",\n "boxShadow",\n "boxSizing",\n "breakAfter",\n "breakBefore",\n "breakInside",\n "captionSide",\n "caret",\n "caretColor",\n "caretShape",\n "clear",\n "clip",\n "clipPath",\n "color",\n "colorScheme",\n "columnCount",\n "columnFill",\n "columnGap",\n "columnRule",\n "columnRuleColor",\n "columnRuleStyle",\n "columnRuleWidth",\n "columnSpan",\n "columnWidth",\n "columns",\n "contain",\n "containIntrinsicSize",\n "containIntrinsicBlockSize",\n "containIntrinsicHeight",\n "containIntrinsicInlineSize",\n "containIntrinsicWidth",\n "container",\n "containerName",\n "containerType",\n "content",\n "contentVisibility",\n "counterIncrement",\n "counterReset",\n "counterSet",\n "cursor",\n "direction",\n "display",\n "emptyCells",\n "filter",\n "flex",\n "flexBasis",\n "flexDirection",\n "flexFlow",\n "flexGrow",\n "flexShrink",\n "flexWrap",\n "float",\n "font",\n "fontFamily",\n "fontFeatureSettings",\n "fontKerning",\n "fontLanguageOverride",\n "fontOpticalSizing",\n "fontPalette",\n "fontVariationSettings",\n "fontSize",\n "fontSizeAdjust",\n "fontSmooth",\n "fontStretch",\n "fontStyle",\n "fontSynthesis",\n "fontVariant",\n "fontVariantAlternates",\n "fontVariantCaps",\n "fontVariantEastAsian",\n "fontVariantEmoji",\n "fontVariantLigatures",\n "fontVariantNumeric",\n "fontVariantPosition",\n "fontWeight",\n "forcedColorAdjust",\n "gap",\n "grid",\n "gridArea",\n "gridAutoColumns",\n "gridAutoFlow",\n "gridAutoRows",\n "gridColumn",\n "gridColumnEnd",\n "gridColumnGap",\n "gridColumnStart",\n "gridGap",\n "gridRow",\n "gridRowEnd",\n "gridRowGap",\n "gridRowStart",\n "gridTemplate",\n "gridTemplateAreas",\n "gridTemplateColumns",\n "gridTemplateRows",\n "hangingPunctuation",\n "height",\n "hyphenateCharacter",\n "hyphenateLimitChars",\n "hyphens",\n "imageOrientation",\n "imageRendering",\n "imageResolution",\n "imeMode",\n "initialLetter",\n "initialLetterAlign",\n "inlineSize",\n "inputSecurity",\n "inset",\n "insetBlock",\n "insetBlockEnd",\n "insetBlockStart",\n "insetInline",\n "insetInlineEnd",\n "insetInlineStart",\n "isolation",\n "justifyContent",\n "justifyItems",\n "justifySelf",\n "justifyTracks",\n "left",\n "letterSpacing",\n "lineBreak",\n "lineClamp",\n "lineHeight",\n "lineHeightStep",\n "listStyle",\n "listStyleImage",\n "listStylePosition",\n "listStyleType",\n "margin",\n "marginBlock",\n "marginBlockEnd",\n "marginBlockStart",\n "marginBottom",\n "marginInline",\n "marginInlineEnd",\n "marginInlineStart",\n "marginLeft",\n "marginRight",\n "marginTop",\n "marginTrim",\n "mask",\n "maskBorder",\n "maskBorderMode",\n "maskBorderOutset",\n "maskBorderRepeat",\n "maskBorderSlice",\n "maskBorderSource",\n "maskBorderWidth",\n "maskClip",\n "maskComposite",\n "maskImage",\n "maskMode",\n "maskOrigin",\n "maskPosition",\n "maskRepeat",\n "maskSize",\n "maskType",\n "masonryAutoFlow",\n "mathDepth",\n "mathShift",\n "mathStyle",\n "maxBlockSize",\n "maxHeight",\n "maxInlineSize",\n "maxLines",\n "maxWidth",\n "minBlockSize",\n "minHeight",\n "minInlineSize",\n "minWidth",\n "mixBlendMode",\n "objectFit",\n "objectPosition",\n "offset",\n "offsetAnchor",\n "offsetDistance",\n "offsetPath",\n "offsetPosition",\n "offsetRotate",\n "opacity",\n "order",\n "orphans",\n "outline",\n "outlineColor",\n "outlineOffset",\n "outlineStyle",\n "outlineWidth",\n "overflow",\n "overflowAnchor",\n "overflowBlock",\n "overflowClipBox",\n "overflowClipMargin",\n "overflowInline",\n "overflowWrap",\n "overflowX",\n "overflowY",\n "overscrollBehavior",\n "overscrollBehaviorBlock",\n "overscrollBehaviorInline",\n "overscrollBehaviorX",\n "overscrollBehaviorY",\n "padding",\n "paddingBlock",\n "paddingBlockEnd",\n "paddingBlockStart",\n "paddingBottom",\n "paddingInline",\n "paddingInlineEnd",\n "paddingInlineStart",\n "paddingLeft",\n "paddingRight",\n "paddingTop",\n "page",\n "pageBreakAfter",\n "pageBreakBefore",\n "pageBreakInside",\n "paintOrder",\n "perspective",\n "perspectiveOrigin",\n "placeContent",\n "placeItems",\n "placeSelf",\n "pointerEvents",\n "position",\n "printColorAdjust",\n "quotes",\n "resize",\n "right",\n "rotate",\n "rowGap",\n "rubyAlign",\n "rubyMerge",\n "rubyPosition",\n "scale",\n "scrollbarColor",\n "scrollbarGutter",\n "scrollbarWidth",\n "scrollBehavior",\n "scrollMargin",\n "scrollMarginBlock",\n "scrollMarginBlockStart",\n "scrollMarginBlockEnd",\n "scrollMarginBottom",\n "scrollMarginInline",\n "scrollMarginInlineStart",\n "scrollMarginInlineEnd",\n "scrollMarginLeft",\n "scrollMarginRight",\n "scrollMarginTop",\n "scrollPadding",\n "scrollPaddingBlock",\n "scrollPaddingBlockStart",\n "scrollPaddingBlockEnd",\n "scrollPaddingBottom",\n "scrollPaddingInline",\n "scrollPaddingInlineStart",\n "scrollPaddingInlineEnd",\n "scrollPaddingLeft",\n "scrollPaddingRight",\n "scrollPaddingTop",\n "scrollSnapAlign",\n "scrollSnapCoordinate",\n "scrollSnapDestination",\n "scrollSnapPointsX",\n "scrollSnapPointsY",\n "scrollSnapStop",\n "scrollSnapType",\n "scrollSnapTypeX",\n "scrollSnapTypeY",\n "scrollTimeline",\n "scrollTimelineAxis",\n "scrollTimelineName",\n "shapeImageThreshold",\n "shapeMargin",\n "shapeOutside",\n "tabSize",\n "tableLayout",\n "textAlign",\n "textAlignLast",\n "textCombineUpright",\n "textDecoration",\n "textDecorationColor",\n "textDecorationLine",\n "textDecorationSkip",\n "textDecorationSkipInk",\n "textDecorationStyle",\n "textDecorationThickness",\n "textEmphasis",\n "textEmphasisColor",\n "textEmphasisPosition",\n "textEmphasisStyle",\n "textIndent",\n "textJustify",\n "textOrientation",\n "textOverflow",\n "textRendering",\n "textShadow",\n "textSizeAdjust",\n "textTransform",\n "textUnderlineOffset",\n "textUnderlinePosition",\n "top",\n "touchAction",\n "transform",\n "transformBox",\n "transformOrigin",\n "transformStyle",\n "transition",\n "transitionDelay",\n "transitionDuration",\n "transitionProperty",\n "transitionTimingFunction",\n "translate",\n "unicodeBidi",\n "userSelect",\n "verticalAlign",\n "viewTransitionName",\n "visibility",\n "whiteSpace",\n "widows",\n "width",\n "willChange",\n "wordBreak",\n "wordSpacing",\n "wordWrap",\n "writingMode",\n "zIndex",\n "zoom",\n ...userGenerated\n];\nvar properties = new Map(allCssProperties.map((prop) => [prop, true]));\nfunction memo(fn) {\n const cache = /* @__PURE__ */ Object.create(null);\n return (arg) => {\n if (cache[arg] === void 0)\n cache[arg] = fn(arg);\n return cache[arg];\n };\n}\nvar selectorRegex = /&|@/;\nvar isCssProperty = memo((prop) => {\n return properties.has(prop) || prop.startsWith("--") || selectorRegex.test(prop);\n});\nexport {\n allCssProperties,\n isCssProperty\n};\n'
|
|
741
824
|
};
|
|
742
825
|
|
|
743
826
|
// src/artifacts/js/is-valid-prop.ts
|
|
744
827
|
function generateisValidProp(ctx) {
|
|
828
|
+
if (ctx.isTemplateLiteralSyntax)
|
|
829
|
+
return;
|
|
745
830
|
let content = is_valid_prop_mjs_default.content;
|
|
746
831
|
content = content.replace(
|
|
747
832
|
"var userGenerated = []",
|
|
@@ -755,7 +840,7 @@ function generateisValidProp(ctx) {
|
|
|
755
840
|
// src/artifacts/js/pattern.ts
|
|
756
841
|
import { unionType } from "@pandacss/shared";
|
|
757
842
|
import { stringify as stringify2 } from "javascript-stringify";
|
|
758
|
-
import { outdent as
|
|
843
|
+
import { outdent as outdent9 } from "outdent";
|
|
759
844
|
import { match } from "ts-pattern";
|
|
760
845
|
function generatePattern(ctx) {
|
|
761
846
|
if (ctx.patterns.isEmpty())
|
|
@@ -773,7 +858,7 @@ function generatePattern(ctx) {
|
|
|
773
858
|
}
|
|
774
859
|
return {
|
|
775
860
|
name: dashName,
|
|
776
|
-
dts:
|
|
861
|
+
dts: outdent9`
|
|
777
862
|
import type { SystemStyleObject, ConditionalValue } from '../types'
|
|
778
863
|
import type { PropertyValue } from '../types/prop-type'
|
|
779
864
|
import type { Properties } from '../types/csstype'
|
|
@@ -797,7 +882,7 @@ function generatePattern(ctx) {
|
|
|
797
882
|
}).join("\n ")}
|
|
798
883
|
}
|
|
799
884
|
|
|
800
|
-
${strict ?
|
|
885
|
+
${strict ? outdent9`export declare function ${name}(options: ${upperName}Properties): string` : outdent9`
|
|
801
886
|
|
|
802
887
|
type ${upperName}Options = ${upperName}Properties & Omit<SystemStyleObject, keyof ${upperName}Properties ${blocklistType}>
|
|
803
888
|
|
|
@@ -806,7 +891,7 @@ function generatePattern(ctx) {
|
|
|
806
891
|
`}
|
|
807
892
|
|
|
808
893
|
`,
|
|
809
|
-
js:
|
|
894
|
+
js: outdent9`
|
|
810
895
|
${ctx.file.import(helperImports.join(", "), "../helpers")}
|
|
811
896
|
${ctx.file.import("css", "../css/index")}
|
|
812
897
|
|
|
@@ -823,7 +908,7 @@ transform`)}
|
|
|
823
908
|
|
|
824
909
|
// src/artifacts/js/recipe.ts
|
|
825
910
|
import { unionType as unionType2 } from "@pandacss/shared";
|
|
826
|
-
import { outdent as
|
|
911
|
+
import { outdent as outdent10 } from "outdent";
|
|
827
912
|
var stringify3 = (value) => JSON.stringify(value, null, 2);
|
|
828
913
|
var isBooleanValue = (value) => value === "true" || value === "false";
|
|
829
914
|
function generateRecipes(ctx) {
|
|
@@ -837,7 +922,7 @@ function generateRecipes(ctx) {
|
|
|
837
922
|
const createRecipeFn = {
|
|
838
923
|
name: "create-recipe",
|
|
839
924
|
dts: "",
|
|
840
|
-
js:
|
|
925
|
+
js: outdent10`
|
|
841
926
|
${ctx.file.import("css", "../css/css")}
|
|
842
927
|
${ctx.file.import("assertCompoundVariant, getCompoundVariantCss", "../css/cva")}
|
|
843
928
|
${ctx.file.import("cx", "../css/cx")}
|
|
@@ -884,7 +969,7 @@ function generateRecipes(ctx) {
|
|
|
884
969
|
const { name, description, defaultVariants, compoundVariants } = config;
|
|
885
970
|
return {
|
|
886
971
|
name: dashName,
|
|
887
|
-
js:
|
|
972
|
+
js: outdent10`
|
|
888
973
|
${ctx.file.import("splitProps", "../helpers")}
|
|
889
974
|
${ctx.file.import("createRecipe", "./create-recipe")}
|
|
890
975
|
|
|
@@ -905,7 +990,7 @@ function generateRecipes(ctx) {
|
|
|
905
990
|
splitVariantProps,
|
|
906
991
|
})
|
|
907
992
|
`,
|
|
908
|
-
dts:
|
|
993
|
+
dts: outdent10`
|
|
909
994
|
import type { ConditionalValue } from '../types'
|
|
910
995
|
import type { Pretty } from '../types/helpers'
|
|
911
996
|
|
|
@@ -943,7 +1028,7 @@ function generateRecipes(ctx) {
|
|
|
943
1028
|
}
|
|
944
1029
|
|
|
945
1030
|
// src/artifacts/js/token.ts
|
|
946
|
-
import
|
|
1031
|
+
import outdent11 from "outdent";
|
|
947
1032
|
function generateTokenJs(ctx) {
|
|
948
1033
|
const { tokens } = ctx;
|
|
949
1034
|
const map = /* @__PURE__ */ new Map();
|
|
@@ -954,7 +1039,7 @@ function generateTokenJs(ctx) {
|
|
|
954
1039
|
});
|
|
955
1040
|
const obj = Object.fromEntries(map);
|
|
956
1041
|
return {
|
|
957
|
-
js:
|
|
1042
|
+
js: outdent11`
|
|
958
1043
|
const tokens = ${JSON.stringify(obj, null, 2)}
|
|
959
1044
|
|
|
960
1045
|
export function token(path, fallback) {
|
|
@@ -967,7 +1052,7 @@ function generateTokenJs(ctx) {
|
|
|
967
1052
|
|
|
968
1053
|
token.var = tokenVar
|
|
969
1054
|
`,
|
|
970
|
-
dts:
|
|
1055
|
+
dts: outdent11`
|
|
971
1056
|
import type { Token } from './tokens'
|
|
972
1057
|
|
|
973
1058
|
export declare const token: {
|
|
@@ -981,11 +1066,11 @@ function generateTokenJs(ctx) {
|
|
|
981
1066
|
}
|
|
982
1067
|
|
|
983
1068
|
// src/artifacts/preact-jsx/jsx.ts
|
|
984
|
-
import { outdent as
|
|
1069
|
+
import { outdent as outdent12 } from "outdent";
|
|
985
1070
|
function generatePreactJsxFactory(ctx) {
|
|
986
1071
|
const { factoryName, componentName } = ctx.jsx;
|
|
987
1072
|
return {
|
|
988
|
-
js:
|
|
1073
|
+
js: outdent12`
|
|
989
1074
|
import { h } from 'preact'
|
|
990
1075
|
import { forwardRef } from 'preact/compat'
|
|
991
1076
|
import { useMemo } from 'preact/hooks'
|
|
@@ -1052,7 +1137,7 @@ function generatePreactJsxFactory(ctx) {
|
|
|
1052
1137
|
}
|
|
1053
1138
|
|
|
1054
1139
|
// src/artifacts/preact-jsx/pattern.ts
|
|
1055
|
-
import { outdent as
|
|
1140
|
+
import { outdent as outdent13 } from "outdent";
|
|
1056
1141
|
import { match as match2 } from "ts-pattern";
|
|
1057
1142
|
function generatePreactJsxPattern(ctx) {
|
|
1058
1143
|
const { typeName, factoryName } = ctx.jsx;
|
|
@@ -1061,7 +1146,7 @@ function generatePreactJsxPattern(ctx) {
|
|
|
1061
1146
|
const { description, jsxElement = "div" } = pattern.config;
|
|
1062
1147
|
return {
|
|
1063
1148
|
name: dashName,
|
|
1064
|
-
js:
|
|
1149
|
+
js: outdent13`
|
|
1065
1150
|
import { h } from 'preact'
|
|
1066
1151
|
import { forwardRef } from 'preact/compat'
|
|
1067
1152
|
${ctx.file.import(factoryName, "./factory")}
|
|
@@ -1070,12 +1155,12 @@ function generatePreactJsxPattern(ctx) {
|
|
|
1070
1155
|
export const ${jsxName} = forwardRef(function ${jsxName}(props, ref) {
|
|
1071
1156
|
${match2(props.length).with(
|
|
1072
1157
|
0,
|
|
1073
|
-
() =>
|
|
1158
|
+
() => outdent13`
|
|
1074
1159
|
const styleProps = ${styleFnName}()
|
|
1075
1160
|
return h(${factoryName}.${jsxElement}, { ref, ...styleProps, ...props })
|
|
1076
1161
|
`
|
|
1077
1162
|
).otherwise(
|
|
1078
|
-
() =>
|
|
1163
|
+
() => outdent13`
|
|
1079
1164
|
const { ${props.join(", ")}, ...restProps } = props
|
|
1080
1165
|
const styleProps = ${styleFnName}({${props.join(", ")}})
|
|
1081
1166
|
return h(${factoryName}.${jsxElement}, { ref, ...styleProps, ...restProps })
|
|
@@ -1083,7 +1168,7 @@ function generatePreactJsxPattern(ctx) {
|
|
|
1083
1168
|
)}
|
|
1084
1169
|
})
|
|
1085
1170
|
`,
|
|
1086
|
-
dts:
|
|
1171
|
+
dts: outdent13`
|
|
1087
1172
|
import type { FunctionComponent } from 'preact'
|
|
1088
1173
|
import type { ${upperName}Properties } from '../patterns/${dashName}'
|
|
1089
1174
|
import type { ${typeName} } from '../types/jsx'
|
|
@@ -1098,15 +1183,15 @@ function generatePreactJsxPattern(ctx) {
|
|
|
1098
1183
|
}
|
|
1099
1184
|
|
|
1100
1185
|
// src/artifacts/preact-jsx/types.ts
|
|
1101
|
-
import { outdent as
|
|
1186
|
+
import { outdent as outdent14 } from "outdent";
|
|
1102
1187
|
function generatePreactJsxTypes(ctx) {
|
|
1103
1188
|
const { factoryName, componentName, upperName, typeName } = ctx.jsx;
|
|
1104
1189
|
return {
|
|
1105
|
-
jsxFactory:
|
|
1190
|
+
jsxFactory: outdent14`
|
|
1106
1191
|
import type { ${upperName} } from '../types/jsx'
|
|
1107
1192
|
export declare const ${factoryName}: ${upperName}
|
|
1108
1193
|
`,
|
|
1109
|
-
jsxType:
|
|
1194
|
+
jsxType: outdent14`
|
|
1110
1195
|
import type { ComponentProps, JSX } from 'preact'
|
|
1111
1196
|
import type { Assign, JsxStyleProps, JsxHTMLProps } from './system-types'
|
|
1112
1197
|
import type { RecipeDefinition, RecipeSelection, RecipeVariantRecord } from './recipe'
|
|
@@ -1140,12 +1225,96 @@ export type ${typeName}<T extends ElementType> = JsxHTMLProps<ComponentProps<T>,
|
|
|
1140
1225
|
};
|
|
1141
1226
|
}
|
|
1142
1227
|
|
|
1228
|
+
// src/artifacts/preact-jsx/jsx.string-literal.ts
|
|
1229
|
+
import { outdent as outdent15 } from "outdent";
|
|
1230
|
+
function generatePreactJsxStringLiteralFactory(ctx) {
|
|
1231
|
+
const { factoryName, componentName } = ctx.jsx;
|
|
1232
|
+
return {
|
|
1233
|
+
js: outdent15`
|
|
1234
|
+
import { h } from 'preact'
|
|
1235
|
+
import { forwardRef } from 'preact/compat'
|
|
1236
|
+
${ctx.file.import("css, cx", "../css/index")}
|
|
1237
|
+
|
|
1238
|
+
function createStyledFn(Dynamic) {
|
|
1239
|
+
return function styledFn(template) {
|
|
1240
|
+
const baseClassName = css(template)
|
|
1241
|
+
const ${componentName} = forwardRef(function ${componentName}(props, ref) {
|
|
1242
|
+
const { as: Element = Dynamic, ...elementProps } = props
|
|
1243
|
+
const classes = () => cx(baseClassName, elementProps.className)
|
|
1244
|
+
|
|
1245
|
+
return h(Element, {
|
|
1246
|
+
ref,
|
|
1247
|
+
...elementProps,
|
|
1248
|
+
className: classes(),
|
|
1249
|
+
})
|
|
1250
|
+
})
|
|
1251
|
+
|
|
1252
|
+
${componentName}.displayName = \`${factoryName}.\${Dynamic}\`
|
|
1253
|
+
return ${componentName}
|
|
1254
|
+
}
|
|
1255
|
+
}
|
|
1256
|
+
|
|
1257
|
+
function createJsxFactory() {
|
|
1258
|
+
const cache = new Map()
|
|
1259
|
+
|
|
1260
|
+
return new Proxy(createStyledFn, {
|
|
1261
|
+
apply(_, __, args) {
|
|
1262
|
+
return createStyledFn(...args)
|
|
1263
|
+
},
|
|
1264
|
+
get(_, el) {
|
|
1265
|
+
if (!cache.has(el)) {
|
|
1266
|
+
cache.set(el, createStyledFn(el))
|
|
1267
|
+
}
|
|
1268
|
+
return cache.get(el)
|
|
1269
|
+
},
|
|
1270
|
+
})
|
|
1271
|
+
}
|
|
1272
|
+
|
|
1273
|
+
export const ${factoryName} = createJsxFactory()
|
|
1274
|
+
`
|
|
1275
|
+
};
|
|
1276
|
+
}
|
|
1277
|
+
|
|
1278
|
+
// src/artifacts/preact-jsx/types.string-literal.ts
|
|
1279
|
+
import { outdent as outdent16 } from "outdent";
|
|
1280
|
+
function generatePreactJsxStringLiteralTypes(ctx) {
|
|
1281
|
+
const { factoryName, componentName, upperName, typeName } = ctx.jsx;
|
|
1282
|
+
return {
|
|
1283
|
+
jsxFactory: outdent16`
|
|
1284
|
+
import type { ${upperName} } from '../types/jsx'
|
|
1285
|
+
export declare const ${factoryName}: ${upperName}
|
|
1286
|
+
`,
|
|
1287
|
+
jsxType: outdent16`
|
|
1288
|
+
import type { ComponentProps, JSX } from 'preact'
|
|
1289
|
+
|
|
1290
|
+
type ElementType = keyof JSX.IntrinsicElements
|
|
1291
|
+
|
|
1292
|
+
type Dict = Record<string, unknown>
|
|
1293
|
+
|
|
1294
|
+
export type ${componentName}<T extends ElementType> = {
|
|
1295
|
+
(args: { raw: readonly string[] | ArrayLike<string> }): (props: ComponentProps<T>) => JSX.Element
|
|
1296
|
+
displayName?: string
|
|
1297
|
+
}
|
|
1298
|
+
|
|
1299
|
+
interface JsxFactory {
|
|
1300
|
+
<T extends ElementType>(component: T): ${componentName}<T>
|
|
1301
|
+
}
|
|
1302
|
+
|
|
1303
|
+
type JsxElements = { [K in keyof JSX.IntrinsicElements]: ${componentName}<K> }
|
|
1304
|
+
|
|
1305
|
+
export type ${upperName} = JsxFactory & JsxElements
|
|
1306
|
+
|
|
1307
|
+
export type ${typeName}<T extends ElementType> = ComponentProps<T>
|
|
1308
|
+
`
|
|
1309
|
+
};
|
|
1310
|
+
}
|
|
1311
|
+
|
|
1143
1312
|
// src/artifacts/qwik-jsx/jsx.ts
|
|
1144
|
-
import { outdent as
|
|
1313
|
+
import { outdent as outdent17 } from "outdent";
|
|
1145
1314
|
function generateQwikJsxFactory(ctx) {
|
|
1146
1315
|
const { factoryName, componentName } = ctx.jsx;
|
|
1147
1316
|
return {
|
|
1148
|
-
js:
|
|
1317
|
+
js: outdent17`
|
|
1149
1318
|
import { h } from '@builder.io/qwik'
|
|
1150
1319
|
${ctx.file.import("css, cx, cva, assignCss", "../css/index")}
|
|
1151
1320
|
${ctx.file.import("splitProps, normalizeHTMLProps", "../helpers")}
|
|
@@ -1209,7 +1378,7 @@ function generateQwikJsxFactory(ctx) {
|
|
|
1209
1378
|
}
|
|
1210
1379
|
|
|
1211
1380
|
// src/artifacts/qwik-jsx/pattern.ts
|
|
1212
|
-
import { outdent as
|
|
1381
|
+
import { outdent as outdent18 } from "outdent";
|
|
1213
1382
|
import { match as match3 } from "ts-pattern";
|
|
1214
1383
|
function generateQwikJsxPattern(ctx) {
|
|
1215
1384
|
const { typeName, factoryName } = ctx.jsx;
|
|
@@ -1218,7 +1387,7 @@ function generateQwikJsxPattern(ctx) {
|
|
|
1218
1387
|
const { description, jsxElement = "div" } = pattern.config;
|
|
1219
1388
|
return {
|
|
1220
1389
|
name: dashName,
|
|
1221
|
-
js:
|
|
1390
|
+
js: outdent18`
|
|
1222
1391
|
import { h } from '@builder.io/qwik'
|
|
1223
1392
|
${ctx.file.import(factoryName, "./factory")}
|
|
1224
1393
|
${ctx.file.import(styleFnName, `../patterns/${dashName}`)}
|
|
@@ -1226,12 +1395,12 @@ function generateQwikJsxPattern(ctx) {
|
|
|
1226
1395
|
export const ${jsxName} = function ${jsxName}(props) {
|
|
1227
1396
|
${match3(props.length).with(
|
|
1228
1397
|
0,
|
|
1229
|
-
() =>
|
|
1398
|
+
() => outdent18`
|
|
1230
1399
|
const styleProps = ${styleFnName}()
|
|
1231
1400
|
return h(${factoryName}.${jsxElement}, { ...styleProps, ...props })
|
|
1232
1401
|
`
|
|
1233
1402
|
).otherwise(
|
|
1234
|
-
() =>
|
|
1403
|
+
() => outdent18`
|
|
1235
1404
|
const { ${props.join(", ")}, ...restProps } = props
|
|
1236
1405
|
const styleProps = ${styleFnName}({${props.join(", ")}})
|
|
1237
1406
|
return h(${factoryName}.${jsxElement}, { ...styleProps, ...restProps })
|
|
@@ -1239,7 +1408,7 @@ function generateQwikJsxPattern(ctx) {
|
|
|
1239
1408
|
)}
|
|
1240
1409
|
}
|
|
1241
1410
|
`,
|
|
1242
|
-
dts:
|
|
1411
|
+
dts: outdent18`
|
|
1243
1412
|
import type { FunctionComponent } from '@builder.io/qwik'
|
|
1244
1413
|
import type { ${upperName}Properties } from '../patterns/${dashName}'
|
|
1245
1414
|
import type { ${typeName} } from '../types/jsx'
|
|
@@ -1258,15 +1427,15 @@ function generateQwikJsxPattern(ctx) {
|
|
|
1258
1427
|
}
|
|
1259
1428
|
|
|
1260
1429
|
// src/artifacts/qwik-jsx/types.ts
|
|
1261
|
-
import { outdent as
|
|
1430
|
+
import { outdent as outdent19 } from "outdent";
|
|
1262
1431
|
function generateQwikJsxTypes(ctx) {
|
|
1263
1432
|
const { factoryName, componentName, upperName, typeName } = ctx.jsx;
|
|
1264
1433
|
return {
|
|
1265
|
-
jsxFactory:
|
|
1434
|
+
jsxFactory: outdent19`
|
|
1266
1435
|
import { ${upperName} } from '../types/jsx'
|
|
1267
1436
|
export declare const ${factoryName}: ${upperName}
|
|
1268
1437
|
`,
|
|
1269
|
-
jsxType:
|
|
1438
|
+
jsxType: outdent19`
|
|
1270
1439
|
import type { FunctionComponent, QwikIntrinsicElements } from '@builder.io/qwik'
|
|
1271
1440
|
import type { Assign as _Assign, JsxStyleProps, PatchedHTMLProps } from './system-types'
|
|
1272
1441
|
import type { RecipeDefinition, RecipeSelection, RecipeVariantRecord } from './recipe'
|
|
@@ -1319,12 +1488,100 @@ export type ${typeName}<T extends ElementType> = Assign<ComponentProps<T>, JsxSt
|
|
|
1319
1488
|
};
|
|
1320
1489
|
}
|
|
1321
1490
|
|
|
1491
|
+
// src/artifacts/qwik-jsx/jsx.string-literal.ts
|
|
1492
|
+
import { outdent as outdent20 } from "outdent";
|
|
1493
|
+
function generateQwikJsxStringLiteralFactory(ctx) {
|
|
1494
|
+
const { factoryName, componentName } = ctx.jsx;
|
|
1495
|
+
return {
|
|
1496
|
+
js: outdent20`
|
|
1497
|
+
import { h } from '@builder.io/qwik'
|
|
1498
|
+
${ctx.file.import("css, cx", "../css/index")}
|
|
1499
|
+
|
|
1500
|
+
function createStyledFn(Dynamic) {
|
|
1501
|
+
return function styledFn(template) {
|
|
1502
|
+
const baseClassName = css(template)
|
|
1503
|
+
const ${componentName} = function ${componentName}(props) {
|
|
1504
|
+
const { as: Element = Dynamic, ...elementProps } = props
|
|
1505
|
+
const classes = () => cx(baseClassName, elementProps.className)
|
|
1506
|
+
|
|
1507
|
+
return h(Element, {
|
|
1508
|
+
...elementProps,
|
|
1509
|
+
className: classes(),
|
|
1510
|
+
})
|
|
1511
|
+
}
|
|
1512
|
+
|
|
1513
|
+
${componentName}.displayName = \`${factoryName}.\${Dynamic}\`
|
|
1514
|
+
return ${componentName}
|
|
1515
|
+
}
|
|
1516
|
+
}
|
|
1517
|
+
|
|
1518
|
+
function createJsxFactory() {
|
|
1519
|
+
const cache = new Map()
|
|
1520
|
+
|
|
1521
|
+
return new Proxy(createStyledFn, {
|
|
1522
|
+
apply(_, __, args) {
|
|
1523
|
+
return createStyledFn(...args)
|
|
1524
|
+
},
|
|
1525
|
+
get(_, el) {
|
|
1526
|
+
if (!cache.has(el)) {
|
|
1527
|
+
cache.set(el, createStyledFn(el))
|
|
1528
|
+
}
|
|
1529
|
+
return cache.get(el)
|
|
1530
|
+
},
|
|
1531
|
+
})
|
|
1532
|
+
}
|
|
1533
|
+
|
|
1534
|
+
export const ${factoryName} = createJsxFactory()
|
|
1535
|
+
|
|
1536
|
+
`
|
|
1537
|
+
};
|
|
1538
|
+
}
|
|
1539
|
+
|
|
1540
|
+
// src/artifacts/qwik-jsx/types.string-literal.ts
|
|
1541
|
+
import { outdent as outdent21 } from "outdent";
|
|
1542
|
+
function generateQwikJsxStringLiteralTypes(ctx) {
|
|
1543
|
+
const { factoryName, componentName, upperName, typeName } = ctx.jsx;
|
|
1544
|
+
return {
|
|
1545
|
+
jsxFactory: outdent21`
|
|
1546
|
+
import { ${upperName} } from '../types/jsx'
|
|
1547
|
+
export declare const ${factoryName}: ${upperName}
|
|
1548
|
+
`,
|
|
1549
|
+
jsxType: outdent21`
|
|
1550
|
+
import type { FunctionComponent, QwikIntrinsicElements } from '@builder.io/qwik'
|
|
1551
|
+
|
|
1552
|
+
type ElementType = keyof QwikIntrinsicElements | FunctionComponent<any>
|
|
1553
|
+
|
|
1554
|
+
type ComponentProps<T extends ElementType> = T extends keyof QwikIntrinsicElements
|
|
1555
|
+
? QwikIntrinsicElements[T]
|
|
1556
|
+
: T extends FunctionComponent<infer P>
|
|
1557
|
+
? P
|
|
1558
|
+
: never
|
|
1559
|
+
|
|
1560
|
+
type Dict = Record<string, unknown>
|
|
1561
|
+
|
|
1562
|
+
export type ${componentName}<T extends ElementType> = {
|
|
1563
|
+
(args: { raw: readonly string[] | ArrayLike<string> }): (props: ComponentProps<T>) => JSX.Element
|
|
1564
|
+
}
|
|
1565
|
+
|
|
1566
|
+
interface JsxFactory {
|
|
1567
|
+
<T extends ElementType>(component: T): ${componentName}<T>
|
|
1568
|
+
}
|
|
1569
|
+
|
|
1570
|
+
type JsxElements = { [K in keyof QwikIntrinsicElements]: ${componentName}<K> }
|
|
1571
|
+
|
|
1572
|
+
export type ${upperName} = JsxFactory & JsxElements
|
|
1573
|
+
|
|
1574
|
+
export type ${typeName}<T extends ElementType> = ComponentProps<T>
|
|
1575
|
+
`
|
|
1576
|
+
};
|
|
1577
|
+
}
|
|
1578
|
+
|
|
1322
1579
|
// src/artifacts/react-jsx/jsx.ts
|
|
1323
|
-
import { outdent as
|
|
1580
|
+
import { outdent as outdent22 } from "outdent";
|
|
1324
1581
|
function generateReactJsxFactory(ctx) {
|
|
1325
1582
|
const { factoryName, componentName } = ctx.jsx;
|
|
1326
1583
|
return {
|
|
1327
|
-
js:
|
|
1584
|
+
js: outdent22`
|
|
1328
1585
|
import { createElement, forwardRef, useMemo } from 'react'
|
|
1329
1586
|
${ctx.file.import("css, cx, cva, assignCss", "../css/index")}
|
|
1330
1587
|
${ctx.file.import("splitProps, normalizeHTMLProps", "../helpers")}
|
|
@@ -1390,7 +1647,7 @@ function generateReactJsxFactory(ctx) {
|
|
|
1390
1647
|
}
|
|
1391
1648
|
|
|
1392
1649
|
// src/artifacts/react-jsx/pattern.ts
|
|
1393
|
-
import { outdent as
|
|
1650
|
+
import { outdent as outdent23 } from "outdent";
|
|
1394
1651
|
import { match as match4 } from "ts-pattern";
|
|
1395
1652
|
function generateReactJsxPattern(ctx) {
|
|
1396
1653
|
const { typeName, factoryName } = ctx.jsx;
|
|
@@ -1399,7 +1656,7 @@ function generateReactJsxPattern(ctx) {
|
|
|
1399
1656
|
const { description, jsxElement = "div" } = pattern.config;
|
|
1400
1657
|
return {
|
|
1401
1658
|
name: dashName,
|
|
1402
|
-
js:
|
|
1659
|
+
js: outdent23`
|
|
1403
1660
|
import { createElement, forwardRef } from 'react'
|
|
1404
1661
|
${ctx.file.import(factoryName, "./factory")}
|
|
1405
1662
|
${ctx.file.import(styleFnName, `../patterns/${dashName}`)}
|
|
@@ -1407,12 +1664,12 @@ function generateReactJsxPattern(ctx) {
|
|
|
1407
1664
|
export const ${jsxName} = forwardRef(function ${jsxName}(props, ref) {
|
|
1408
1665
|
${match4(props.length).with(
|
|
1409
1666
|
0,
|
|
1410
|
-
() =>
|
|
1667
|
+
() => outdent23`
|
|
1411
1668
|
const styleProps = ${styleFnName}()
|
|
1412
1669
|
return createElement(${factoryName}.${jsxElement}, { ref, ...styleProps, ...props })
|
|
1413
1670
|
`
|
|
1414
1671
|
).otherwise(
|
|
1415
|
-
() =>
|
|
1672
|
+
() => outdent23`
|
|
1416
1673
|
const { ${props.join(", ")}, ...restProps } = props
|
|
1417
1674
|
const styleProps = ${styleFnName}({${props.join(", ")}})
|
|
1418
1675
|
return createElement(${factoryName}.${jsxElement}, { ref, ...styleProps, ...restProps })
|
|
@@ -1420,7 +1677,7 @@ function generateReactJsxPattern(ctx) {
|
|
|
1420
1677
|
)}
|
|
1421
1678
|
})
|
|
1422
1679
|
`,
|
|
1423
|
-
dts:
|
|
1680
|
+
dts: outdent23`
|
|
1424
1681
|
import type { FunctionComponent } from 'react'
|
|
1425
1682
|
import type { ${upperName}Properties } from '../patterns/${dashName}'
|
|
1426
1683
|
import type { ${typeName} } from '../types/jsx'
|
|
@@ -1435,15 +1692,15 @@ function generateReactJsxPattern(ctx) {
|
|
|
1435
1692
|
}
|
|
1436
1693
|
|
|
1437
1694
|
// src/artifacts/react-jsx/types.ts
|
|
1438
|
-
import { outdent as
|
|
1695
|
+
import { outdent as outdent24 } from "outdent";
|
|
1439
1696
|
function generateReactJsxTypes(ctx) {
|
|
1440
1697
|
const { factoryName, componentName, upperName, typeName } = ctx.jsx;
|
|
1441
1698
|
return {
|
|
1442
|
-
jsxFactory:
|
|
1699
|
+
jsxFactory: outdent24`
|
|
1443
1700
|
import { ${upperName} } from '../types/jsx'
|
|
1444
1701
|
export declare const ${factoryName}: ${upperName}
|
|
1445
1702
|
`,
|
|
1446
|
-
jsxType:
|
|
1703
|
+
jsxType: outdent24`
|
|
1447
1704
|
import type { ComponentProps, ElementType } from 'react'
|
|
1448
1705
|
import type { Assign, JsxStyleProps, JsxHTMLProps } from './system-types'
|
|
1449
1706
|
import type { RecipeDefinition, RecipeSelection, RecipeVariantRecord } from './recipe'
|
|
@@ -1475,52 +1732,134 @@ export type ${typeName}<T extends ElementType> = JsxHTMLProps<ComponentProps<T>,
|
|
|
1475
1732
|
};
|
|
1476
1733
|
}
|
|
1477
1734
|
|
|
1478
|
-
// src/artifacts/
|
|
1479
|
-
import { outdent as
|
|
1480
|
-
function
|
|
1481
|
-
const {
|
|
1735
|
+
// src/artifacts/react-jsx/jsx.string-literal.ts
|
|
1736
|
+
import { outdent as outdent25 } from "outdent";
|
|
1737
|
+
function generateReactJsxStringLiteralFactory(ctx) {
|
|
1738
|
+
const { factoryName, componentName } = ctx.jsx;
|
|
1482
1739
|
return {
|
|
1483
|
-
js:
|
|
1484
|
-
import {
|
|
1485
|
-
import
|
|
1486
|
-
import { createComponent } from 'solid-js/web'
|
|
1487
|
-
${ctx.file.import("css, cx, cva, assignCss", "../css/index")}
|
|
1488
|
-
${ctx.file.import("normalizeHTMLProps", "../helpers")}
|
|
1489
|
-
${ctx.file.import("allCssProperties", "./is-valid-prop")}
|
|
1490
|
-
|
|
1491
|
-
function styledFn(element, configOrCva = {}) {
|
|
1492
|
-
const cvaFn = configOrCva.__cva__ ? configOrCva : cva(configOrCva)
|
|
1493
|
-
|
|
1494
|
-
return function ${componentName}(props) {
|
|
1495
|
-
const mergedProps = mergeProps({ as: element }, props)
|
|
1740
|
+
js: outdent25`
|
|
1741
|
+
import { createElement, forwardRef } from 'react'
|
|
1742
|
+
${ctx.file.import("css, cx", "../css/index")}
|
|
1496
1743
|
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
)
|
|
1504
|
-
|
|
1505
|
-
function recipeClass() {
|
|
1506
|
-
const { css: cssStyles, ...propStyles } = styleProps
|
|
1507
|
-
const styles = assignCss(propStyles, cssStyles)
|
|
1508
|
-
return cx(cvaFn(variantProps), css(styles), localProps.class)
|
|
1509
|
-
}
|
|
1744
|
+
function createStyledFn(Dynamic) {
|
|
1745
|
+
return function styledFn(template) {
|
|
1746
|
+
const baseClassName = css(template)
|
|
1747
|
+
const ${componentName} = forwardRef(function ${componentName}(props, ref) {
|
|
1748
|
+
const { as: Element = Dynamic, ...elementProps } = props
|
|
1749
|
+
const classes = () => cx(baseClassName, elementProps.className)
|
|
1510
1750
|
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
}
|
|
1517
|
-
|
|
1518
|
-
const classes = configOrCva.__recipe__ ? recipeClass : cvaClass
|
|
1751
|
+
return createElement(Element, {
|
|
1752
|
+
ref,
|
|
1753
|
+
...elementProps,
|
|
1754
|
+
className: classes(),
|
|
1755
|
+
})
|
|
1756
|
+
})
|
|
1519
1757
|
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1758
|
+
${componentName}.displayName = \`${factoryName}.\${Dynamic}\`
|
|
1759
|
+
return ${componentName}
|
|
1760
|
+
}
|
|
1761
|
+
}
|
|
1762
|
+
|
|
1763
|
+
function createJsxFactory() {
|
|
1764
|
+
const cache = new Map()
|
|
1765
|
+
|
|
1766
|
+
return new Proxy(createStyledFn, {
|
|
1767
|
+
apply(_, __, args) {
|
|
1768
|
+
return createStyledFn(...args)
|
|
1769
|
+
},
|
|
1770
|
+
get(_, el) {
|
|
1771
|
+
if (!cache.has(el)) {
|
|
1772
|
+
cache.set(el, createStyledFn(el))
|
|
1773
|
+
}
|
|
1774
|
+
return cache.get(el)
|
|
1775
|
+
},
|
|
1776
|
+
})
|
|
1777
|
+
}
|
|
1778
|
+
|
|
1779
|
+
export const ${factoryName} = createJsxFactory()
|
|
1780
|
+
|
|
1781
|
+
`
|
|
1782
|
+
};
|
|
1783
|
+
}
|
|
1784
|
+
|
|
1785
|
+
// src/artifacts/react-jsx/types.string-literal.ts
|
|
1786
|
+
import { outdent as outdent26 } from "outdent";
|
|
1787
|
+
function generateReactJsxStringLiteralTypes(ctx) {
|
|
1788
|
+
const { factoryName, componentName, upperName, typeName } = ctx.jsx;
|
|
1789
|
+
return {
|
|
1790
|
+
jsxFactory: outdent26`
|
|
1791
|
+
import { ${upperName} } from '../types/jsx'
|
|
1792
|
+
export declare const ${factoryName}: ${upperName}
|
|
1793
|
+
`,
|
|
1794
|
+
jsxType: outdent26`
|
|
1795
|
+
import type { ComponentProps, ElementType } from 'react'
|
|
1796
|
+
|
|
1797
|
+
type Dict = Record<string, unknown>
|
|
1798
|
+
|
|
1799
|
+
export type ${componentName}<T extends ElementType> = {
|
|
1800
|
+
(args: { raw: readonly string[] | ArrayLike<string> }): (props: ComponentProps<T>) => JSX.Element
|
|
1801
|
+
displayName?: string
|
|
1802
|
+
}
|
|
1803
|
+
|
|
1804
|
+
interface JsxFactory {
|
|
1805
|
+
<T extends ElementType>(component: T): ${componentName}<T>
|
|
1806
|
+
}
|
|
1807
|
+
|
|
1808
|
+
type JsxElements = { [K in keyof JSX.IntrinsicElements]: ${componentName}<K> }
|
|
1809
|
+
|
|
1810
|
+
export type ${upperName} = JsxFactory & JsxElements
|
|
1811
|
+
|
|
1812
|
+
export type ${typeName}<T extends ElementType> = ComponentProps<T>
|
|
1813
|
+
`
|
|
1814
|
+
};
|
|
1815
|
+
}
|
|
1816
|
+
|
|
1817
|
+
// src/artifacts/solid-jsx/jsx.ts
|
|
1818
|
+
import { outdent as outdent27 } from "outdent";
|
|
1819
|
+
function generateSolidJsxFactory(ctx) {
|
|
1820
|
+
const { componentName, factoryName } = ctx.jsx;
|
|
1821
|
+
return {
|
|
1822
|
+
js: outdent27`
|
|
1823
|
+
import { Dynamic } from 'solid-js/web'
|
|
1824
|
+
import { mergeProps, splitProps } from 'solid-js'
|
|
1825
|
+
import { createComponent } from 'solid-js/web'
|
|
1826
|
+
${ctx.file.import("css, cx, cva, assignCss", "../css/index")}
|
|
1827
|
+
${ctx.file.import("normalizeHTMLProps", "../helpers")}
|
|
1828
|
+
${ctx.file.import("allCssProperties", "./is-valid-prop")}
|
|
1829
|
+
|
|
1830
|
+
function styledFn(element, configOrCva = {}) {
|
|
1831
|
+
const cvaFn = configOrCva.__cva__ ? configOrCva : cva(configOrCva)
|
|
1832
|
+
|
|
1833
|
+
return function ${componentName}(props) {
|
|
1834
|
+
const mergedProps = mergeProps({ as: element }, props)
|
|
1835
|
+
|
|
1836
|
+
const [localProps, variantProps, styleProps, htmlProps, elementProps] = splitProps(
|
|
1837
|
+
mergedProps,
|
|
1838
|
+
['as', 'class'],
|
|
1839
|
+
cvaFn.variantKeys,
|
|
1840
|
+
allCssProperties,
|
|
1841
|
+
normalizeHTMLProps.keys
|
|
1842
|
+
)
|
|
1843
|
+
|
|
1844
|
+
function recipeClass() {
|
|
1845
|
+
const { css: cssStyles, ...propStyles } = styleProps
|
|
1846
|
+
const styles = assignCss(propStyles, cssStyles)
|
|
1847
|
+
return cx(cvaFn(variantProps), css(styles), localProps.class)
|
|
1848
|
+
}
|
|
1849
|
+
|
|
1850
|
+
function cvaClass() {
|
|
1851
|
+
const { css: cssStyles, ...propStyles } = styleProps
|
|
1852
|
+
const cvaStyles = cvaFn.resolve(variantProps)
|
|
1853
|
+
const styles = assignCss(cvaStyles, propStyles, cssStyles)
|
|
1854
|
+
return cx(css(styles), localProps.class)
|
|
1855
|
+
}
|
|
1856
|
+
|
|
1857
|
+
const classes = configOrCva.__recipe__ ? recipeClass : cvaClass
|
|
1858
|
+
|
|
1859
|
+
return createComponent(
|
|
1860
|
+
Dynamic,
|
|
1861
|
+
mergeProps(
|
|
1862
|
+
{
|
|
1524
1863
|
get component() {
|
|
1525
1864
|
return localProps.as
|
|
1526
1865
|
},
|
|
@@ -1557,7 +1896,7 @@ function generateSolidJsxFactory(ctx) {
|
|
|
1557
1896
|
}
|
|
1558
1897
|
|
|
1559
1898
|
// src/artifacts/solid-jsx/pattern.ts
|
|
1560
|
-
import { outdent as
|
|
1899
|
+
import { outdent as outdent28 } from "outdent";
|
|
1561
1900
|
import { match as match5 } from "ts-pattern";
|
|
1562
1901
|
function generateSolidJsxPattern(ctx) {
|
|
1563
1902
|
const { typeName, factoryName } = ctx.jsx;
|
|
@@ -1566,7 +1905,7 @@ function generateSolidJsxPattern(ctx) {
|
|
|
1566
1905
|
const { description, jsxElement = "div" } = pattern.config;
|
|
1567
1906
|
return {
|
|
1568
1907
|
name: dashName,
|
|
1569
|
-
js:
|
|
1908
|
+
js: outdent28`
|
|
1570
1909
|
import { splitProps, mergeProps } from 'solid-js'
|
|
1571
1910
|
import { createComponent } from 'solid-js/web'
|
|
1572
1911
|
${ctx.file.import(factoryName, "./factory")}
|
|
@@ -1575,12 +1914,12 @@ function generateSolidJsxPattern(ctx) {
|
|
|
1575
1914
|
export function ${jsxName}(props) {
|
|
1576
1915
|
${match5(props.length).with(
|
|
1577
1916
|
0,
|
|
1578
|
-
() =>
|
|
1917
|
+
() => outdent28`
|
|
1579
1918
|
const styleProps = ${styleFnName}()
|
|
1580
1919
|
return createComponent(${factoryName}.${jsxElement}, mergeProps(styleProps, props))
|
|
1581
1920
|
`
|
|
1582
1921
|
).otherwise(
|
|
1583
|
-
() =>
|
|
1922
|
+
() => outdent28`
|
|
1584
1923
|
const [patternProps, restProps] = splitProps(props, [${props.map((v) => JSON.stringify(v)).join(", ")}]);
|
|
1585
1924
|
const styleProps = ${styleFnName}(patternProps)
|
|
1586
1925
|
return createComponent(${factoryName}.${jsxElement}, mergeProps(styleProps, restProps))
|
|
@@ -1588,7 +1927,7 @@ function generateSolidJsxPattern(ctx) {
|
|
|
1588
1927
|
)}
|
|
1589
1928
|
}
|
|
1590
1929
|
`,
|
|
1591
|
-
dts:
|
|
1930
|
+
dts: outdent28`
|
|
1592
1931
|
import { Component } from 'solid-js'
|
|
1593
1932
|
import { ${upperName}Properties } from '../patterns/${dashName}'
|
|
1594
1933
|
import { ${typeName} } from '../types/jsx'
|
|
@@ -1603,15 +1942,15 @@ function generateSolidJsxPattern(ctx) {
|
|
|
1603
1942
|
}
|
|
1604
1943
|
|
|
1605
1944
|
// src/artifacts/solid-jsx/types.ts
|
|
1606
|
-
import { outdent as
|
|
1945
|
+
import { outdent as outdent29 } from "outdent";
|
|
1607
1946
|
function generateSolidJsxTypes(ctx) {
|
|
1608
1947
|
const { factoryName, componentName, upperName, typeName } = ctx.jsx;
|
|
1609
1948
|
return {
|
|
1610
|
-
jsxFactory:
|
|
1949
|
+
jsxFactory: outdent29`
|
|
1611
1950
|
import type { ${upperName} } from '../types/jsx'
|
|
1612
1951
|
export declare const ${factoryName}: ${upperName}
|
|
1613
1952
|
`,
|
|
1614
|
-
jsxType:
|
|
1953
|
+
jsxType: outdent29`
|
|
1615
1954
|
import type { ComponentProps, Component, JSX } from 'solid-js'
|
|
1616
1955
|
import type { Assign, JsxStyleProps, JsxHTMLProps } from './system-types'
|
|
1617
1956
|
import type { RecipeDefinition, RecipeSelection, RecipeVariantRecord } from './recipe'
|
|
@@ -1645,12 +1984,102 @@ export type ${typeName}<T extends ElementType> = JsxHTMLProps<ComponentProps<T>,
|
|
|
1645
1984
|
};
|
|
1646
1985
|
}
|
|
1647
1986
|
|
|
1987
|
+
// src/artifacts/solid-jsx/jsx.string-literal.ts
|
|
1988
|
+
import { outdent as outdent30 } from "outdent";
|
|
1989
|
+
function generateSolidJsxStringLiteralFactory(ctx) {
|
|
1990
|
+
const { componentName, factoryName } = ctx.jsx;
|
|
1991
|
+
return {
|
|
1992
|
+
js: outdent30`
|
|
1993
|
+
import { mergeProps, splitProps } from 'solid-js'
|
|
1994
|
+
import { Dynamic, createComponent } from 'solid-js/web'
|
|
1995
|
+
${ctx.file.import("css, cx", "../css/index")}
|
|
1996
|
+
|
|
1997
|
+
function createStyled(element) {
|
|
1998
|
+
return function styledFn(template) {
|
|
1999
|
+
const baseClassName = css(template)
|
|
2000
|
+
return function ${componentName}(props) {
|
|
2001
|
+
const mergedProps = mergeProps({ as: element }, props)
|
|
2002
|
+
const [localProps, elementProps] = splitProps(mergedProps, ['as', 'class'])
|
|
2003
|
+
|
|
2004
|
+
return createComponent(
|
|
2005
|
+
Dynamic,
|
|
2006
|
+
mergeProps(
|
|
2007
|
+
{
|
|
2008
|
+
get component() {
|
|
2009
|
+
return localProps.as
|
|
2010
|
+
},
|
|
2011
|
+
get class() {
|
|
2012
|
+
return cx(baseClassName, localProps.class)
|
|
2013
|
+
},
|
|
2014
|
+
},
|
|
2015
|
+
elementProps,
|
|
2016
|
+
),
|
|
2017
|
+
)
|
|
2018
|
+
}
|
|
2019
|
+
}
|
|
2020
|
+
}
|
|
2021
|
+
|
|
2022
|
+
function createJsxFactory() {
|
|
2023
|
+
const cache = new Map()
|
|
2024
|
+
|
|
2025
|
+
return new Proxy(createStyled, {
|
|
2026
|
+
apply(_, __, args) {
|
|
2027
|
+
return createStyled(...args)
|
|
2028
|
+
},
|
|
2029
|
+
get(_, el) {
|
|
2030
|
+
if (!cache.has(el)) {
|
|
2031
|
+
cache.set(el, createStyled(el))
|
|
2032
|
+
}
|
|
2033
|
+
return cache.get(el)
|
|
2034
|
+
},
|
|
2035
|
+
})
|
|
2036
|
+
}
|
|
2037
|
+
|
|
2038
|
+
export const ${factoryName} = createJsxFactory()
|
|
2039
|
+
`
|
|
2040
|
+
};
|
|
2041
|
+
}
|
|
2042
|
+
|
|
2043
|
+
// src/artifacts/solid-jsx/types.string-literal.ts
|
|
2044
|
+
import { outdent as outdent31 } from "outdent";
|
|
2045
|
+
function generateSolidJsxStringLiteralTypes(ctx) {
|
|
2046
|
+
const { factoryName, componentName, upperName, typeName } = ctx.jsx;
|
|
2047
|
+
return {
|
|
2048
|
+
jsxFactory: outdent31`
|
|
2049
|
+
import type { ${upperName} } from '../types/jsx'
|
|
2050
|
+
export declare const ${factoryName}: ${upperName}
|
|
2051
|
+
`,
|
|
2052
|
+
jsxType: outdent31`
|
|
2053
|
+
import type { Component, ComponentProps, JSX } from 'solid-js'
|
|
2054
|
+
|
|
2055
|
+
type Dict = Record<string, unknown>
|
|
2056
|
+
|
|
2057
|
+
type ElementType<P = any> = keyof JSX.IntrinsicElements | Component<P>
|
|
2058
|
+
|
|
2059
|
+
export type ${componentName}<T extends ElementType> = {
|
|
2060
|
+
(args: { raw: readonly string[] | ArrayLike<string> }): (props: ComponentProps<T>) => JSX.Element
|
|
2061
|
+
displayName?: string
|
|
2062
|
+
}
|
|
2063
|
+
|
|
2064
|
+
interface JsxFactory {
|
|
2065
|
+
<T extends ElementType>(component: T): ${componentName}<T>
|
|
2066
|
+
}
|
|
2067
|
+
|
|
2068
|
+
type JsxElements = { [K in keyof JSX.IntrinsicElements]: ${componentName}<K> }
|
|
2069
|
+
|
|
2070
|
+
export type Styled = JsxFactory & JsxElements
|
|
2071
|
+
|
|
2072
|
+
export type ${typeName}<T extends ElementType> = ComponentProps<T>
|
|
2073
|
+
`
|
|
2074
|
+
};
|
|
2075
|
+
}
|
|
2076
|
+
|
|
1648
2077
|
// src/artifacts/vue-jsx/jsx.ts
|
|
1649
|
-
import { outdent as
|
|
2078
|
+
import { outdent as outdent32 } from "outdent";
|
|
1650
2079
|
function generateVueJsxFactory(ctx) {
|
|
1651
2080
|
const { factoryName } = ctx.jsx;
|
|
1652
2081
|
return {
|
|
1653
|
-
js:
|
|
2082
|
+
js: outdent32`
|
|
1654
2083
|
import { defineComponent, h, computed } from 'vue'
|
|
1655
2084
|
${ctx.file.import("css, cx, cva, assignCss", "../css/index")}
|
|
1656
2085
|
${ctx.file.import("splitProps, normalizeHTMLProps", "../helpers")}
|
|
@@ -1723,8 +2152,62 @@ function generateVueJsxFactory(ctx) {
|
|
|
1723
2152
|
};
|
|
1724
2153
|
}
|
|
1725
2154
|
|
|
2155
|
+
// src/artifacts/vue-jsx/jsx.string-literal.ts
|
|
2156
|
+
import { outdent as outdent33 } from "outdent";
|
|
2157
|
+
function generateVueJsxStringLiteralFactory(ctx) {
|
|
2158
|
+
const { factoryName } = ctx.jsx;
|
|
2159
|
+
return {
|
|
2160
|
+
js: outdent33`
|
|
2161
|
+
import { defineComponent, h, computed } from 'vue'
|
|
2162
|
+
${ctx.file.import("css, cx", "../css/index")}
|
|
2163
|
+
|
|
2164
|
+
function createStyled(Dynamic) {
|
|
2165
|
+
function styledFn(template) {
|
|
2166
|
+
const baseClassName = css(template)
|
|
2167
|
+
return defineComponent({
|
|
2168
|
+
name: \`${factoryName}.\${Dynamic}\`,
|
|
2169
|
+
inheritAttrs: false,
|
|
2170
|
+
props: { as: { type: [String, Object], default: Dynamic } },
|
|
2171
|
+
setup(props, { slots, attrs }) {
|
|
2172
|
+
const classes = computed(() => cx(baseClassName, elementProps.className))
|
|
2173
|
+
return () => {
|
|
2174
|
+
return h(
|
|
2175
|
+
props.as,
|
|
2176
|
+
{
|
|
2177
|
+
class: classes.value,
|
|
2178
|
+
...elementProps,
|
|
2179
|
+
},
|
|
2180
|
+
slots.default && slots.default(),
|
|
2181
|
+
)
|
|
2182
|
+
}
|
|
2183
|
+
},
|
|
2184
|
+
})
|
|
2185
|
+
}
|
|
2186
|
+
}
|
|
2187
|
+
|
|
2188
|
+
function createJsxFactory() {
|
|
2189
|
+
const cache = new Map()
|
|
2190
|
+
|
|
2191
|
+
return new Proxy(createStyled, {
|
|
2192
|
+
apply(_, __, args) {
|
|
2193
|
+
return createStyled(...args)
|
|
2194
|
+
},
|
|
2195
|
+
get(_, el) {
|
|
2196
|
+
if (!cache.has(el)) {
|
|
2197
|
+
cache.set(el, createStyled(el))
|
|
2198
|
+
}
|
|
2199
|
+
return cache.get(el)
|
|
2200
|
+
},
|
|
2201
|
+
})
|
|
2202
|
+
}
|
|
2203
|
+
|
|
2204
|
+
export const ${factoryName} = createJsxFactory()
|
|
2205
|
+
`
|
|
2206
|
+
};
|
|
2207
|
+
}
|
|
2208
|
+
|
|
1726
2209
|
// src/artifacts/vue-jsx/pattern.ts
|
|
1727
|
-
import { outdent as
|
|
2210
|
+
import { outdent as outdent34 } from "outdent";
|
|
1728
2211
|
function generateVueJsxPattern(ctx) {
|
|
1729
2212
|
const { typeName, factoryName } = ctx.jsx;
|
|
1730
2213
|
return ctx.patterns.details.map((pattern) => {
|
|
@@ -1733,7 +2216,7 @@ function generateVueJsxPattern(ctx) {
|
|
|
1733
2216
|
const propList = props.map((v) => JSON.stringify(v)).join(", ");
|
|
1734
2217
|
return {
|
|
1735
2218
|
name: dashName,
|
|
1736
|
-
js:
|
|
2219
|
+
js: outdent34`
|
|
1737
2220
|
import { defineComponent, h, computed } from 'vue'
|
|
1738
2221
|
${ctx.file.import(factoryName, "./factory")}
|
|
1739
2222
|
${ctx.file.import(styleFnName, `../patterns/${dashName}`)}
|
|
@@ -1751,7 +2234,7 @@ function generateVueJsxPattern(ctx) {
|
|
|
1751
2234
|
}
|
|
1752
2235
|
})
|
|
1753
2236
|
`,
|
|
1754
|
-
dts:
|
|
2237
|
+
dts: outdent34`
|
|
1755
2238
|
import { FunctionalComponent } from 'vue'
|
|
1756
2239
|
import { ${upperName}Properties } from '../patterns/${dashName}'
|
|
1757
2240
|
import { ${typeName} } from '../types/jsx'
|
|
@@ -1766,15 +2249,15 @@ function generateVueJsxPattern(ctx) {
|
|
|
1766
2249
|
}
|
|
1767
2250
|
|
|
1768
2251
|
// src/artifacts/vue-jsx/types.ts
|
|
1769
|
-
import { outdent as
|
|
2252
|
+
import { outdent as outdent35 } from "outdent";
|
|
1770
2253
|
function generateVueJsxTypes(ctx) {
|
|
1771
2254
|
const { factoryName, componentName, upperName, typeName } = ctx.jsx;
|
|
1772
2255
|
return {
|
|
1773
|
-
jsxFactory:
|
|
2256
|
+
jsxFactory: outdent35`
|
|
1774
2257
|
import { ${upperName} } from '../types/jsx'
|
|
1775
2258
|
export declare const ${factoryName}: ${upperName}
|
|
1776
2259
|
`,
|
|
1777
|
-
jsxType:
|
|
2260
|
+
jsxType: outdent35`
|
|
1778
2261
|
import type { Component, FunctionalComponent } from 'vue'
|
|
1779
2262
|
import type { Assign, JsxStyleProps, JsxHTMLProps } from './system-types'
|
|
1780
2263
|
import type { RecipeDefinition, RecipeSelection, RecipeVariantRecord } from './recipe'
|
|
@@ -1930,6 +2413,161 @@ type IntrinsicElement =
|
|
|
1930
2413
|
};
|
|
1931
2414
|
}
|
|
1932
2415
|
|
|
2416
|
+
// src/artifacts/vue-jsx/types.string-literal.ts
|
|
2417
|
+
import { outdent as outdent36 } from "outdent";
|
|
2418
|
+
function generateVueJsxStringLiteralTypes(ctx) {
|
|
2419
|
+
const { factoryName, componentName, upperName, typeName } = ctx.jsx;
|
|
2420
|
+
return {
|
|
2421
|
+
jsxFactory: outdent36`
|
|
2422
|
+
import { ${upperName} } from '../types/jsx'
|
|
2423
|
+
export declare const ${factoryName}: ${upperName}
|
|
2424
|
+
`,
|
|
2425
|
+
jsxType: outdent36`
|
|
2426
|
+
import type { Component, FunctionalComponent } from 'vue'
|
|
2427
|
+
|
|
2428
|
+
type IntrinsicElement =
|
|
2429
|
+
| 'a'
|
|
2430
|
+
| 'abbr'
|
|
2431
|
+
| 'address'
|
|
2432
|
+
| 'area'
|
|
2433
|
+
| 'article'
|
|
2434
|
+
| 'aside'
|
|
2435
|
+
| 'audio'
|
|
2436
|
+
| 'b'
|
|
2437
|
+
| 'base'
|
|
2438
|
+
| 'bdi'
|
|
2439
|
+
| 'bdo'
|
|
2440
|
+
| 'blockquote'
|
|
2441
|
+
| 'body'
|
|
2442
|
+
| 'br'
|
|
2443
|
+
| 'button'
|
|
2444
|
+
| 'canvas'
|
|
2445
|
+
| 'caption'
|
|
2446
|
+
| 'cite'
|
|
2447
|
+
| 'code'
|
|
2448
|
+
| 'col'
|
|
2449
|
+
| 'colgroup'
|
|
2450
|
+
| 'data'
|
|
2451
|
+
| 'datalist'
|
|
2452
|
+
| 'dd'
|
|
2453
|
+
| 'del'
|
|
2454
|
+
| 'details'
|
|
2455
|
+
| 'dfn'
|
|
2456
|
+
| 'dialog'
|
|
2457
|
+
| 'div'
|
|
2458
|
+
| 'dl'
|
|
2459
|
+
| 'dt'
|
|
2460
|
+
| 'em'
|
|
2461
|
+
| 'embed'
|
|
2462
|
+
| 'fieldset'
|
|
2463
|
+
| 'figcaption'
|
|
2464
|
+
| 'figure'
|
|
2465
|
+
| 'footer'
|
|
2466
|
+
| 'form'
|
|
2467
|
+
| 'h1'
|
|
2468
|
+
| 'h2'
|
|
2469
|
+
| 'h3'
|
|
2470
|
+
| 'h4'
|
|
2471
|
+
| 'h5'
|
|
2472
|
+
| 'h6'
|
|
2473
|
+
| 'head'
|
|
2474
|
+
| 'header'
|
|
2475
|
+
| 'hgroup'
|
|
2476
|
+
| 'hr'
|
|
2477
|
+
| 'html'
|
|
2478
|
+
| 'i'
|
|
2479
|
+
| 'iframe'
|
|
2480
|
+
| 'img'
|
|
2481
|
+
| 'input'
|
|
2482
|
+
| 'ins'
|
|
2483
|
+
| 'kbd'
|
|
2484
|
+
| 'label'
|
|
2485
|
+
| 'legend'
|
|
2486
|
+
| 'li'
|
|
2487
|
+
| 'link'
|
|
2488
|
+
| 'main'
|
|
2489
|
+
| 'map'
|
|
2490
|
+
| 'mark'
|
|
2491
|
+
| 'math'
|
|
2492
|
+
| 'menu'
|
|
2493
|
+
| 'menuitem'
|
|
2494
|
+
| 'meta'
|
|
2495
|
+
| 'meter'
|
|
2496
|
+
| 'nav'
|
|
2497
|
+
| 'noscript'
|
|
2498
|
+
| 'object'
|
|
2499
|
+
| 'ol'
|
|
2500
|
+
| 'optgroup'
|
|
2501
|
+
| 'option'
|
|
2502
|
+
| 'output'
|
|
2503
|
+
| 'p'
|
|
2504
|
+
| 'param'
|
|
2505
|
+
| 'picture'
|
|
2506
|
+
| 'pre'
|
|
2507
|
+
| 'progress'
|
|
2508
|
+
| 'q'
|
|
2509
|
+
| 'rb'
|
|
2510
|
+
| 'rp'
|
|
2511
|
+
| 'rt'
|
|
2512
|
+
| 'rtc'
|
|
2513
|
+
| 'ruby'
|
|
2514
|
+
| 's'
|
|
2515
|
+
| 'samp'
|
|
2516
|
+
| 'script'
|
|
2517
|
+
| 'section'
|
|
2518
|
+
| 'select'
|
|
2519
|
+
| 'slot'
|
|
2520
|
+
| 'small'
|
|
2521
|
+
| 'source'
|
|
2522
|
+
| 'span'
|
|
2523
|
+
| 'strong'
|
|
2524
|
+
| 'style'
|
|
2525
|
+
| 'sub'
|
|
2526
|
+
| 'summary'
|
|
2527
|
+
| 'sup'
|
|
2528
|
+
| 'svg'
|
|
2529
|
+
| 'table'
|
|
2530
|
+
| 'tbody'
|
|
2531
|
+
| 'td'
|
|
2532
|
+
| 'template'
|
|
2533
|
+
| 'textarea'
|
|
2534
|
+
| 'tfoot'
|
|
2535
|
+
| 'th'
|
|
2536
|
+
| 'thead'
|
|
2537
|
+
| 'time'
|
|
2538
|
+
| 'title'
|
|
2539
|
+
| 'tr'
|
|
2540
|
+
| 'track'
|
|
2541
|
+
| 'u'
|
|
2542
|
+
| 'ul'
|
|
2543
|
+
| 'var'
|
|
2544
|
+
| 'video'
|
|
2545
|
+
| 'wbr'
|
|
2546
|
+
|
|
2547
|
+
type ElementType = IntrinsicElement | Component
|
|
2548
|
+
|
|
2549
|
+
type ComponentProps<T extends ElementType> = T extends keyof JSX.IntrinsicElements
|
|
2550
|
+
? JSX.IntrinsicElements[T]
|
|
2551
|
+
: T extends Component<infer Props>
|
|
2552
|
+
? Props
|
|
2553
|
+
: never
|
|
2554
|
+
|
|
2555
|
+
type ${componentName}<T extends ElementType> = FunctionalComponent<ComponentProps<T>>
|
|
2556
|
+
>
|
|
2557
|
+
|
|
2558
|
+
interface JsxFactory {
|
|
2559
|
+
<T extends ElementType>(component: T): ${componentName}<T>
|
|
2560
|
+
}
|
|
2561
|
+
|
|
2562
|
+
type JsxElements = { [K in keyof JSX.IntrinsicElements]: ${componentName}<K> }
|
|
2563
|
+
|
|
2564
|
+
export type ${upperName} = JsxFactory & JsxElements
|
|
2565
|
+
|
|
2566
|
+
export type ${typeName}<T extends ElementType> = ComponentProps<T>
|
|
2567
|
+
`
|
|
2568
|
+
};
|
|
2569
|
+
}
|
|
2570
|
+
|
|
1933
2571
|
// src/artifacts/jsx.ts
|
|
1934
2572
|
var typesMap = {
|
|
1935
2573
|
react: generateReactJsxTypes,
|
|
@@ -1938,10 +2576,18 @@ var typesMap = {
|
|
|
1938
2576
|
vue: generateVueJsxTypes,
|
|
1939
2577
|
qwik: generateQwikJsxTypes
|
|
1940
2578
|
};
|
|
2579
|
+
var typesStringLiteralMap = {
|
|
2580
|
+
react: generateSolidJsxStringLiteralTypes,
|
|
2581
|
+
solid: generateReactJsxStringLiteralTypes,
|
|
2582
|
+
qwik: generateQwikJsxStringLiteralTypes,
|
|
2583
|
+
preact: generatePreactJsxStringLiteralTypes,
|
|
2584
|
+
vue: generateVueJsxStringLiteralTypes
|
|
2585
|
+
};
|
|
1941
2586
|
function generateJsxTypes(ctx) {
|
|
1942
2587
|
if (!ctx.jsx.framework)
|
|
1943
2588
|
return;
|
|
1944
|
-
|
|
2589
|
+
const type = ctx.isTemplateLiteralSyntax ? typesStringLiteralMap[ctx.jsx.framework] : typesMap[ctx.jsx.framework];
|
|
2590
|
+
return type?.(ctx);
|
|
1945
2591
|
}
|
|
1946
2592
|
var factoryMap = {
|
|
1947
2593
|
react: generateReactJsxFactory,
|
|
@@ -1950,10 +2596,18 @@ var factoryMap = {
|
|
|
1950
2596
|
vue: generateVueJsxFactory,
|
|
1951
2597
|
qwik: generateQwikJsxFactory
|
|
1952
2598
|
};
|
|
2599
|
+
var factoryStringLiteralMap = {
|
|
2600
|
+
react: generateReactJsxStringLiteralFactory,
|
|
2601
|
+
solid: generateSolidJsxStringLiteralFactory,
|
|
2602
|
+
qwik: generateQwikJsxStringLiteralFactory,
|
|
2603
|
+
preact: generatePreactJsxStringLiteralFactory,
|
|
2604
|
+
vue: generateVueJsxStringLiteralFactory
|
|
2605
|
+
};
|
|
1953
2606
|
function generateJsxFactory(ctx) {
|
|
1954
2607
|
if (!ctx.jsx.framework)
|
|
1955
2608
|
return;
|
|
1956
|
-
|
|
2609
|
+
const factory = ctx.isTemplateLiteralSyntax ? factoryStringLiteralMap[ctx.jsx.framework] : factoryMap[ctx.jsx.framework];
|
|
2610
|
+
return factory?.(ctx);
|
|
1957
2611
|
}
|
|
1958
2612
|
var patternMap = {
|
|
1959
2613
|
react: generateReactJsxPattern,
|
|
@@ -1963,6 +2617,8 @@ var patternMap = {
|
|
|
1963
2617
|
qwik: generateQwikJsxPattern
|
|
1964
2618
|
};
|
|
1965
2619
|
function generateJsxPatterns(ctx) {
|
|
2620
|
+
if (ctx.isTemplateLiteralSyntax)
|
|
2621
|
+
return [];
|
|
1966
2622
|
if (ctx.patterns.isEmpty() && !ctx.jsx.framework)
|
|
1967
2623
|
return [];
|
|
1968
2624
|
return patternMap[ctx.jsx.framework](ctx);
|
|
@@ -2015,7 +2671,7 @@ var csstype_d_ts_default = {
|
|
|
2015
2671
|
|
|
2016
2672
|
// src/artifacts/generated/system-types.d.ts.json
|
|
2017
2673
|
var system_types_d_ts_default = {
|
|
2018
|
-
content: "import type { ConditionalValue, Conditions, Nested } from './conditions'\nimport type { PropertiesFallback } from './csstype'\nimport type { SystemProperties, CssVarProperties } from './style-props'\n\ntype String = string & {}\ntype Number = number & {}\n\n/* -----------------------------------------------------------------------------\n * Native css properties\n * -----------------------------------------------------------------------------*/\n\nexport type CssProperty = keyof PropertiesFallback\n\nexport type CssProperties = PropertiesFallback<String | Number> & CssVarProperties\n\nexport type CssKeyframes = {\n [name: string]: {\n [time: string]: CssProperties\n }\n}\n\n/* -----------------------------------------------------------------------------\n * Conditional css properties\n * -----------------------------------------------------------------------------*/\n\ntype MinimalNested<P> = {\n [K in keyof Conditions]?: Nested<P>\n}\n\ntype GenericProperties = {\n [key: string]: ConditionalValue<String | Number | boolean>\n}\n\n/* -----------------------------------------------------------------------------\n * Native css props\n * -----------------------------------------------------------------------------*/\n\nexport type NestedCssProperties = Nested<CssProperties>\n\nexport type SystemStyleObject = Nested<SystemProperties & CssVarProperties>\n\nexport type GlobalStyleObject = {\n [selector: string]: SystemStyleObject\n}\n\nexport type CompositionStyleObject<Property extends string> = Nested<{\n [K in Property]?: K extends keyof SystemStyleObject ? SystemStyleObject[K] : unknown\n}>\n\n/* -----------------------------------------------------------------------------\n * Jsx style props\n * -----------------------------------------------------------------------------*/\n\nexport type JsxStyleProps = SystemProperties &\n MinimalNested<SystemStyleObject> & {\n css?: SystemStyleObject\n }\n\
|
|
2674
|
+
content: "import type { ConditionalValue, Conditions, Nested } from './conditions'\nimport type { PropertiesFallback } from './csstype'\nimport type { SystemProperties, CssVarProperties } from './style-props'\n\ntype String = string & {}\ntype Number = number & {}\n\n/* -----------------------------------------------------------------------------\n * Native css properties\n * -----------------------------------------------------------------------------*/\n\nexport type CssProperty = keyof PropertiesFallback\n\nexport type CssProperties = PropertiesFallback<String | Number> & CssVarProperties\n\nexport type CssKeyframes = {\n [name: string]: {\n [time: string]: CssProperties\n }\n}\n\n/* -----------------------------------------------------------------------------\n * Conditional css properties\n * -----------------------------------------------------------------------------*/\n\ntype MinimalNested<P> = {\n [K in keyof Conditions]?: Nested<P>\n}\n\ntype GenericProperties = {\n [key: string]: ConditionalValue<String | Number | boolean>\n}\n\n/* -----------------------------------------------------------------------------\n * Native css props\n * -----------------------------------------------------------------------------*/\n\nexport type NestedCssProperties = Nested<CssProperties>\n\nexport type SystemStyleObject = Nested<SystemProperties & CssVarProperties>\n\nexport type GlobalStyleObject = {\n [selector: string]: SystemStyleObject\n}\n\nexport type CompositionStyleObject<Property extends string> = Nested<{\n [K in Property]?: K extends keyof SystemStyleObject ? SystemStyleObject[K] : unknown\n}>\n\n/* -----------------------------------------------------------------------------\n * Jsx style props\n * -----------------------------------------------------------------------------*/\n\nexport type JsxStyleProps = SystemProperties &\n MinimalNested<SystemStyleObject> & {\n css?: SystemStyleObject\n }\n\nexport type Assign<T, U> = Omit<T, keyof U> & U\n\nexport type PatchedHTMLProps = {\n htmlSize?: string | number\n htmlWidth?: string | number\n htmlHeight?: string | number\n htmlTranslate?: 'yes' | 'no' | undefined\n htmlContent?: string\n}\n\nexport type OmittedHTMLProps = 'color' | 'translate' | 'transition' | 'width' | 'height' | 'size' | 'content'\n\ntype WithHTMLProps<T> = Omit<T, OmittedHTMLProps> & PatchedHTMLProps\n\nexport type JsxHTMLProps<T extends Record<string, any>, P extends Record<string, any> = {}> = Assign<\n WithHTMLProps<T>,\n P\n>\n"
|
|
2019
2675
|
};
|
|
2020
2676
|
|
|
2021
2677
|
// src/artifacts/generated/composition.d.ts.json
|
|
@@ -2030,7 +2686,7 @@ var recipe_d_ts_default = {
|
|
|
2030
2686
|
|
|
2031
2687
|
// src/artifacts/generated/pattern.d.ts.json
|
|
2032
2688
|
var pattern_d_ts_default = {
|
|
2033
|
-
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\ntype 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
|
|
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\ntype 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"
|
|
2034
2690
|
};
|
|
2035
2691
|
|
|
2036
2692
|
// src/artifacts/generated/parts.d.ts.json
|
|
@@ -2040,7 +2696,7 @@ var parts_d_ts_default = {
|
|
|
2040
2696
|
|
|
2041
2697
|
// src/artifacts/generated/selectors.d.ts.json
|
|
2042
2698
|
var selectors_d_ts_default = {
|
|
2043
|
-
content: "import type { Pseudos } from './csstype'\n\ntype AriaAttributes =\n | '[aria-disabled]'\n | '[aria-hidden]'\n | '[aria-invalid]'\n | '[aria-readonly]'\n | '[aria-required]'\n | '[aria-selected]'\n | '[aria-checked]'\n | '[aria-expanded]'\n | '[aria-pressed]'\n | `[aria-current=${'page' | 'step' | 'location' | 'date' | 'time'}]`\n | '[aria-invalid]'\n | `[aria-sort=${'ascending' | 'descending'}]`\n\ntype DataAttributes =\n | '[data-selected]'\n | '[data-highlighted]'\n | '[data-hover]'\n | '[data-active]'\n | '[data-checked]'\n | '[data-disabled]'\n | '[data-readonly]'\n | '[data-focus]'\n | '[data-focus-visible]'\n | '[data-focus-visible-added]'\n | '[data-invalid]'\n | '[data-pressed]'\n | '[data-expanded]'\n | '[data-grabbed]'\n | '[data-dragged]'\n | '[data-orientation=horizontal]'\n | '[data-orientation=vertical]'\n | '[data-in-range]'\n | '[data-out-of-range]'\n | '[data-placeholder-shown]'\n | `[data-part=${string}]`\n | `[data-attr=${string}]`\n | `[data-placement=${string}]`\n | `[data-theme=${string}]`\n | `[data-size=${string}]`\n | `[data-state=${string}]`\n | '[data-empty]'\n | '[data-loading]'\n | '[data-loaded]'\n | '[data-enter]'\n | '[data-entering]'\n | '[data-exited]'\n | '[data-exiting]'\n\ntype AttributeSelector = `&${Pseudos | DataAttributes | AriaAttributes}`\ntype ParentSelector = `${DataAttributes | AriaAttributes} &`\n\nexport type AnySelector = `${string}&` | `&${string}`\nexport type Selectors = AttributeSelector | ParentSelector\n"
|
|
2699
|
+
content: "import type { Pseudos } from './csstype'\n\ntype AriaAttributes =\n | '[aria-disabled]'\n | '[aria-hidden]'\n | '[aria-invalid]'\n | '[aria-readonly]'\n | '[aria-required]'\n | '[aria-selected]'\n | '[aria-checked]'\n | '[aria-expanded]'\n | '[aria-pressed]'\n | `[aria-current=${'page' | 'step' | 'location' | 'date' | 'time'}]`\n | '[aria-invalid]'\n | `[aria-sort=${'ascending' | 'descending'}]`\n\ntype DataAttributes =\n | '[data-selected]'\n | '[data-highlighted]'\n | '[data-hover]'\n | '[data-active]'\n | '[data-checked]'\n | '[data-disabled]'\n | '[data-readonly]'\n | '[data-focus]'\n | '[data-focus-visible]'\n | '[data-focus-visible-added]'\n | '[data-invalid]'\n | '[data-pressed]'\n | '[data-expanded]'\n | '[data-grabbed]'\n | '[data-dragged]'\n | '[data-orientation=horizontal]'\n | '[data-orientation=vertical]'\n | '[data-in-range]'\n | '[data-out-of-range]'\n | '[data-placeholder-shown]'\n | `[data-part=${string}]`\n | `[data-attr=${string}]`\n | `[data-placement=${string}]`\n | `[data-theme=${string}]`\n | `[data-size=${string}]`\n | `[data-state=${string}]`\n | '[data-empty]'\n | '[data-loading]'\n | '[data-loaded]'\n | '[data-enter]'\n | '[data-entering]'\n | '[data-exited]'\n | '[data-exiting]'\n\ntype AttributeSelector = `&${Pseudos | DataAttributes | AriaAttributes}`\ntype ParentSelector = `${DataAttributes | AriaAttributes} &`\n\ntype AtRuleType = 'media' | 'layer' | 'container' | 'supports' | 'page'\n\nexport type AnySelector = `${string}&` | `&${string}` | `@${AtRuleType}${string}`\nexport type Selectors = AttributeSelector | ParentSelector\n"
|
|
2044
2700
|
};
|
|
2045
2701
|
|
|
2046
2702
|
// src/artifacts/types/generated.ts
|
|
@@ -2057,9 +2713,9 @@ function getGeneratedTypes() {
|
|
|
2057
2713
|
}
|
|
2058
2714
|
|
|
2059
2715
|
// src/artifacts/types/main.ts
|
|
2060
|
-
import { outdent as
|
|
2716
|
+
import { outdent as outdent37 } from "outdent";
|
|
2061
2717
|
var generateTypesEntry = () => ({
|
|
2062
|
-
global:
|
|
2718
|
+
global: outdent37`
|
|
2063
2719
|
import type { RecipeVariantRecord, RecipeConfig } from './recipe'
|
|
2064
2720
|
import type { Parts } from './parts'
|
|
2065
2721
|
import type { PatternConfig } from './pattern'
|
|
@@ -2076,19 +2732,19 @@ var generateTypesEntry = () => ({
|
|
|
2076
2732
|
export function defineParts<T extends Parts>(parts: T): (config: Partial<Record<keyof T, SystemStyleObject>>) => Partial<Record<keyof T, SystemStyleObject>>;
|
|
2077
2733
|
}
|
|
2078
2734
|
`,
|
|
2079
|
-
index:
|
|
2735
|
+
index: outdent37`
|
|
2080
2736
|
import './global'
|
|
2081
2737
|
export type { ConditionalValue } from './conditions'
|
|
2082
2738
|
export type { GlobalStyleObject, JsxStyleProps, SystemStyleObject } from './system-types'
|
|
2083
2739
|
|
|
2084
2740
|
`,
|
|
2085
|
-
helpers:
|
|
2741
|
+
helpers: outdent37`
|
|
2086
2742
|
export type Pretty<T> = T extends infer U ? { [K in keyof U]: U[K] } : never
|
|
2087
2743
|
`
|
|
2088
2744
|
});
|
|
2089
2745
|
|
|
2090
2746
|
// src/artifacts/types/prop-types.ts
|
|
2091
|
-
import { outdent as
|
|
2747
|
+
import { outdent as outdent38 } from "outdent";
|
|
2092
2748
|
function generatePropTypes(ctx) {
|
|
2093
2749
|
const {
|
|
2094
2750
|
config: { strictTokens },
|
|
@@ -2096,7 +2752,7 @@ function generatePropTypes(ctx) {
|
|
|
2096
2752
|
} = ctx;
|
|
2097
2753
|
const strictText = `${strictTokens ? "" : " | CssValue<T>"}`;
|
|
2098
2754
|
const result = [
|
|
2099
|
-
|
|
2755
|
+
outdent38`
|
|
2100
2756
|
import type { ConditionalValue } from './conditions';
|
|
2101
2757
|
import type { CssProperties } from './system-types'
|
|
2102
2758
|
import type { Tokens } from '../tokens'
|
|
@@ -2119,7 +2775,7 @@ function generatePropTypes(ctx) {
|
|
|
2119
2775
|
result.push(` ${key}: Shorthand<${JSON.stringify(value)}>;`);
|
|
2120
2776
|
});
|
|
2121
2777
|
result.push("}");
|
|
2122
|
-
return
|
|
2778
|
+
return outdent38`
|
|
2123
2779
|
${result.join("\n")}
|
|
2124
2780
|
|
|
2125
2781
|
export type PropertyValue<T extends string> = T extends keyof PropertyTypes
|
|
@@ -2132,10 +2788,10 @@ function generatePropTypes(ctx) {
|
|
|
2132
2788
|
|
|
2133
2789
|
// src/artifacts/types/style-props.ts
|
|
2134
2790
|
import { allCssProperties } from "@pandacss/is-valid-prop";
|
|
2135
|
-
import
|
|
2791
|
+
import outdent39 from "outdent";
|
|
2136
2792
|
function generateStyleProps(ctx) {
|
|
2137
2793
|
const props = new Set(allCssProperties.concat(ctx.utility.keys()));
|
|
2138
|
-
return
|
|
2794
|
+
return outdent39`
|
|
2139
2795
|
import type { ConditionalValue } from './conditions'
|
|
2140
2796
|
import type { PropertyValue } from './prop-type'
|
|
2141
2797
|
import type { Token } from '../tokens'
|
|
@@ -2152,7 +2808,7 @@ function generateStyleProps(ctx) {
|
|
|
2152
2808
|
|
|
2153
2809
|
// src/artifacts/types/token-types.ts
|
|
2154
2810
|
import { capitalize, unionType as unionType3 } from "@pandacss/shared";
|
|
2155
|
-
import { outdent as
|
|
2811
|
+
import { outdent as outdent40 } from "outdent";
|
|
2156
2812
|
import pluralize from "pluralize";
|
|
2157
2813
|
var categories = [
|
|
2158
2814
|
"zIndex",
|
|
@@ -2197,7 +2853,7 @@ function generateTokenTypes(ctx) {
|
|
|
2197
2853
|
result.add("} & { [token: string]: never }");
|
|
2198
2854
|
set.add(Array.from(result).join("\n"));
|
|
2199
2855
|
set.add(`export type TokenCategory = ${unionType3(categories)}`);
|
|
2200
|
-
return
|
|
2856
|
+
return outdent40.string(Array.from(set).join("\n\n"));
|
|
2201
2857
|
}
|
|
2202
2858
|
|
|
2203
2859
|
// src/artifacts/index.ts
|
|
@@ -2255,8 +2911,8 @@ function setupTypes(ctx) {
|
|
|
2255
2911
|
};
|
|
2256
2912
|
}
|
|
2257
2913
|
function setupCss(ctx) {
|
|
2258
|
-
const code = generateCssFn(ctx);
|
|
2259
|
-
const conditions = generateConditions(ctx);
|
|
2914
|
+
const code = ctx.isTemplateLiteralSyntax ? generateStringLiteralCssFn(ctx) : generateCssFn(ctx);
|
|
2915
|
+
const conditions = ctx.isTemplateLiteralSyntax ? generateStringLiteralConditions(ctx) : generateConditions(ctx);
|
|
2260
2916
|
return {
|
|
2261
2917
|
dir: ctx.paths.css,
|
|
2262
2918
|
files: [
|
|
@@ -2267,6 +2923,8 @@ function setupCss(ctx) {
|
|
|
2267
2923
|
};
|
|
2268
2924
|
}
|
|
2269
2925
|
function setupCva(ctx) {
|
|
2926
|
+
if (ctx.isTemplateLiteralSyntax)
|
|
2927
|
+
return;
|
|
2270
2928
|
const code = generateCvaFn(ctx);
|
|
2271
2929
|
return {
|
|
2272
2930
|
dir: ctx.paths.css,
|
|
@@ -2292,8 +2950,8 @@ function setupRecipes(ctx) {
|
|
|
2292
2950
|
return;
|
|
2293
2951
|
const indexFiles = files.filter((file) => !file.name.includes("create-recipe"));
|
|
2294
2952
|
const index = {
|
|
2295
|
-
js:
|
|
2296
|
-
dts:
|
|
2953
|
+
js: outdent41.string(indexFiles.map((file) => ctx.file.export(`./${file.name}`)).join("\n")),
|
|
2954
|
+
dts: outdent41.string(indexFiles.map((file) => `export * from './${file.name}'`).join("\n"))
|
|
2297
2955
|
};
|
|
2298
2956
|
return {
|
|
2299
2957
|
dir: ctx.paths.recipe,
|
|
@@ -2306,12 +2964,14 @@ function setupRecipes(ctx) {
|
|
|
2306
2964
|
};
|
|
2307
2965
|
}
|
|
2308
2966
|
function setupPatterns(ctx) {
|
|
2967
|
+
if (ctx.isTemplateLiteralSyntax)
|
|
2968
|
+
return;
|
|
2309
2969
|
const files = generatePattern(ctx);
|
|
2310
2970
|
if (!files)
|
|
2311
2971
|
return;
|
|
2312
2972
|
const index = {
|
|
2313
|
-
js:
|
|
2314
|
-
dts:
|
|
2973
|
+
js: outdent41.string(files.map((file) => ctx.file.export(`./${file.name}`)).join("\n")),
|
|
2974
|
+
dts: outdent41.string(files.map((file) => `export * from './${file.name}'`).join("\n"))
|
|
2315
2975
|
};
|
|
2316
2976
|
return {
|
|
2317
2977
|
dir: ctx.paths.pattern,
|
|
@@ -2331,13 +2991,13 @@ function setupJsx(ctx) {
|
|
|
2331
2991
|
const factory = generateJsxFactory(ctx);
|
|
2332
2992
|
const patterns = generateJsxPatterns(ctx);
|
|
2333
2993
|
const index = {
|
|
2334
|
-
js:
|
|
2994
|
+
js: outdent41`
|
|
2335
2995
|
${ctx.file.export("./factory")}
|
|
2336
|
-
${
|
|
2996
|
+
${outdent41.string(patterns.map((file) => ctx.file.export(`./${file.name}`)).join("\n"))}
|
|
2337
2997
|
`,
|
|
2338
|
-
dts:
|
|
2998
|
+
dts: outdent41`
|
|
2339
2999
|
export * from './factory'
|
|
2340
|
-
${
|
|
3000
|
+
${outdent41.string(patterns.map((file) => `export * from './${file.name}'`).join("\n"))}
|
|
2341
3001
|
export type { ${ctx.jsx.typeName} } from '../types/jsx'
|
|
2342
3002
|
`
|
|
2343
3003
|
};
|
|
@@ -2346,7 +3006,7 @@ function setupJsx(ctx) {
|
|
|
2346
3006
|
files: [
|
|
2347
3007
|
...patterns.map((file) => ({ file: ctx.file.ext(file.name), code: file.js })),
|
|
2348
3008
|
...patterns.map((file) => ({ file: `${file.name}.d.ts`, code: file.dts })),
|
|
2349
|
-
{ file: ctx.file.ext("is-valid-prop"), code: isValidProp
|
|
3009
|
+
{ file: ctx.file.ext("is-valid-prop"), code: isValidProp?.js },
|
|
2350
3010
|
{ file: "factory.d.ts", code: types.jsxFactory },
|
|
2351
3011
|
{ file: ctx.file.ext("factory"), code: factory?.js },
|
|
2352
3012
|
{ file: "index.d.ts", code: index.dts },
|
|
@@ -2356,15 +3016,15 @@ function setupJsx(ctx) {
|
|
|
2356
3016
|
}
|
|
2357
3017
|
function setupCssIndex(ctx) {
|
|
2358
3018
|
const index = {
|
|
2359
|
-
js:
|
|
3019
|
+
js: outdent41`
|
|
2360
3020
|
${ctx.file.export("./css")}
|
|
2361
3021
|
${ctx.file.export("./cx")}
|
|
2362
|
-
${ctx.file.export("./cva")}
|
|
3022
|
+
${ctx.isTemplateLiteralSyntax ? "" : ctx.file.export("./cva")}
|
|
2363
3023
|
`,
|
|
2364
|
-
dts:
|
|
3024
|
+
dts: outdent41`
|
|
2365
3025
|
export * from './css'
|
|
2366
3026
|
export * from './cx'
|
|
2367
|
-
export * from './cva'
|
|
3027
|
+
${ctx.isTemplateLiteralSyntax ? "" : `export * from './cva'`}
|
|
2368
3028
|
`
|
|
2369
3029
|
};
|
|
2370
3030
|
return {
|
|
@@ -2552,6 +3212,7 @@ var helpers = {
|
|
|
2552
3212
|
var getBaseEngine = (conf) => {
|
|
2553
3213
|
const { config } = conf;
|
|
2554
3214
|
const theme = config.theme ?? {};
|
|
3215
|
+
const isTemplateLiteralSyntax = config.syntax === "template-literal";
|
|
2555
3216
|
const hash = {
|
|
2556
3217
|
tokens: isBool(config.hash) ? config.hash : config.hash?.cssVar,
|
|
2557
3218
|
className: isBool(config.hash) ? config.hash : config.hash?.className
|
|
@@ -2570,11 +3231,12 @@ var getBaseEngine = (conf) => {
|
|
|
2570
3231
|
const utility = new Utility({
|
|
2571
3232
|
prefix: prefix.className,
|
|
2572
3233
|
tokens,
|
|
2573
|
-
config: config.utilities,
|
|
2574
|
-
separator: config.separator
|
|
3234
|
+
config: isTemplateLiteralSyntax ? {} : config.utilities,
|
|
3235
|
+
separator: config.separator,
|
|
3236
|
+
shorthands: config.shorthands
|
|
2575
3237
|
});
|
|
2576
3238
|
const conditions = new Conditions({
|
|
2577
|
-
conditions: config.conditions,
|
|
3239
|
+
conditions: isTemplateLiteralSyntax ? {} : config.conditions,
|
|
2578
3240
|
breakpoints: config.theme?.breakpoints
|
|
2579
3241
|
});
|
|
2580
3242
|
const { textStyles, layerStyles } = theme;
|
|
@@ -2612,6 +3274,7 @@ var getBaseEngine = (conf) => {
|
|
|
2612
3274
|
};
|
|
2613
3275
|
return {
|
|
2614
3276
|
...conf,
|
|
3277
|
+
isTemplateLiteralSyntax,
|
|
2615
3278
|
studio,
|
|
2616
3279
|
hash,
|
|
2617
3280
|
prefix,
|
|
@@ -2693,7 +3356,7 @@ var getPatternEngine = (config) => {
|
|
|
2693
3356
|
return Object.entries(patterns).map(([name, pattern]) => ({
|
|
2694
3357
|
type: "pattern",
|
|
2695
3358
|
name: pattern.jsx ?? capitalize3(name),
|
|
2696
|
-
props: Object.keys(pattern
|
|
3359
|
+
props: Object.keys(pattern?.properties ?? {}),
|
|
2697
3360
|
baseName: name
|
|
2698
3361
|
}));
|
|
2699
3362
|
}),
|
|
@@ -2732,6 +3395,8 @@ var defaults = (conf) => ({
|
|
|
2732
3395
|
cssVarRoot: ":where(:root, :host)",
|
|
2733
3396
|
jsxFactory: "styled",
|
|
2734
3397
|
outExtension: "mjs",
|
|
3398
|
+
shorthands: true,
|
|
3399
|
+
syntax: "object-literal",
|
|
2735
3400
|
...conf.config
|
|
2736
3401
|
}
|
|
2737
3402
|
});
|