@pandacss/generator 0.4.0 → 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 +2 -0
- package/dist/index.js +763 -105
- package/dist/index.mjs +765 -107
- package/package.json +8 -8
package/dist/index.js
CHANGED
|
@@ -66,7 +66,7 @@ var artifactsGenerated = (ctx) => {
|
|
|
66
66
|
!tokens.isEmpty && import_outdent.outdent`
|
|
67
67
|
${tick} ${(0, import_logger.quote)(outdir, "/tokens")}: the css variables and js function to query your tokens
|
|
68
68
|
`,
|
|
69
|
-
!patterns.isEmpty() && import_outdent.outdent`
|
|
69
|
+
!patterns.isEmpty() && !ctx.isTemplateLiteralSyntax && import_outdent.outdent`
|
|
70
70
|
${tick} ${(0, import_logger.quote)(outdir, "/patterns")}: functions to implement apply common layout patterns
|
|
71
71
|
`,
|
|
72
72
|
!recipes.isEmpty() && import_outdent.outdent`
|
|
@@ -133,7 +133,7 @@ var import_lil_fp3 = require("lil-fp");
|
|
|
133
133
|
|
|
134
134
|
// src/artifacts/index.ts
|
|
135
135
|
var import_shared4 = require("@pandacss/shared");
|
|
136
|
-
var
|
|
136
|
+
var import_outdent41 = __toESM(require("outdent"));
|
|
137
137
|
|
|
138
138
|
// src/artifacts/css/global-css.ts
|
|
139
139
|
var generateGlobalCss = (ctx) => {
|
|
@@ -577,8 +577,39 @@ function generateConditions(ctx) {
|
|
|
577
577
|
};
|
|
578
578
|
}
|
|
579
579
|
|
|
580
|
+
// src/artifacts/js/conditions.string-literal.ts
|
|
581
|
+
var import_outdent3 = __toESM(require("outdent"));
|
|
582
|
+
function generateStringLiteralConditions(ctx) {
|
|
583
|
+
return {
|
|
584
|
+
js: import_outdent3.default`
|
|
585
|
+
${ctx.file.import("withoutSpace", "../helpers")}
|
|
586
|
+
|
|
587
|
+
export const isCondition = (val) => condRegex.test(val)
|
|
588
|
+
|
|
589
|
+
const condRegex = /^@|&|&$/
|
|
590
|
+
const selectorRegex = /&|@/
|
|
591
|
+
|
|
592
|
+
export const finalizeConditions = (paths) => {
|
|
593
|
+
return paths.map((path) => (selectorRegex.test(path) ? \`[\${withoutSpace(path.trim())}]\` : path))
|
|
594
|
+
}
|
|
595
|
+
|
|
596
|
+
export function sortConditions(paths){
|
|
597
|
+
return paths.sort((a, b) => {
|
|
598
|
+
const aa = isCondition(a)
|
|
599
|
+
const bb = isCondition(b)
|
|
600
|
+
if (aa && !bb) return 1
|
|
601
|
+
if (!aa && bb) return -1
|
|
602
|
+
return 0
|
|
603
|
+
})
|
|
604
|
+
}
|
|
605
|
+
`,
|
|
606
|
+
dts: import_outdent3.default`
|
|
607
|
+
`
|
|
608
|
+
};
|
|
609
|
+
}
|
|
610
|
+
|
|
580
611
|
// src/artifacts/js/css-fn.ts
|
|
581
|
-
var
|
|
612
|
+
var import_outdent4 = require("outdent");
|
|
582
613
|
var stringify = (v) => JSON.stringify(Object.fromEntries(v), null, 2);
|
|
583
614
|
function generateCssFn(ctx) {
|
|
584
615
|
const {
|
|
@@ -588,11 +619,11 @@ function generateCssFn(ctx) {
|
|
|
588
619
|
} = ctx;
|
|
589
620
|
const { separator } = utility;
|
|
590
621
|
return {
|
|
591
|
-
dts:
|
|
622
|
+
dts: import_outdent4.outdent`
|
|
592
623
|
import type { SystemStyleObject } from '../types'
|
|
593
624
|
export declare function css(styles: SystemStyleObject): string
|
|
594
625
|
`,
|
|
595
|
-
js:
|
|
626
|
+
js: import_outdent4.outdent`
|
|
596
627
|
${ctx.file.import("createCss, createMergeCss, hypenateProperty, withoutSpace", "../helpers")}
|
|
597
628
|
${ctx.file.import("sortConditions, finalizeConditions", "./conditions")}
|
|
598
629
|
|
|
@@ -635,11 +666,58 @@ function generateCssFn(ctx) {
|
|
|
635
666
|
};
|
|
636
667
|
}
|
|
637
668
|
|
|
669
|
+
// src/artifacts/js/css-fn.string-literal.ts
|
|
670
|
+
var import_outdent5 = require("outdent");
|
|
671
|
+
function generateStringLiteralCssFn(ctx) {
|
|
672
|
+
const {
|
|
673
|
+
utility,
|
|
674
|
+
config: { hash, prefix }
|
|
675
|
+
} = ctx;
|
|
676
|
+
const { separator } = utility;
|
|
677
|
+
return {
|
|
678
|
+
dts: import_outdent5.outdent`
|
|
679
|
+
export declare function css(template: { raw: readonly string[] | ArrayLike<string> }): string
|
|
680
|
+
`,
|
|
681
|
+
js: import_outdent5.outdent`
|
|
682
|
+
${ctx.file.import("astish, createCss, withoutSpace", "../helpers")}
|
|
683
|
+
${ctx.file.import("sortConditions, finalizeConditions", "./conditions")}
|
|
684
|
+
|
|
685
|
+
function transform(prop, value) {
|
|
686
|
+
const className = \`$\{prop}${separator}$\{withoutSpace(value)}\`
|
|
687
|
+
return { className }
|
|
688
|
+
}
|
|
689
|
+
|
|
690
|
+
const context = {
|
|
691
|
+
hash: ${hash ? "true" : "false"},
|
|
692
|
+
conditions: {
|
|
693
|
+
shift: sortConditions,
|
|
694
|
+
finalize: finalizeConditions,
|
|
695
|
+
breakpoints: { keys: [] },
|
|
696
|
+
},
|
|
697
|
+
utility: {
|
|
698
|
+
prefix: ${prefix ? JSON.stringify(prefix) : void 0},
|
|
699
|
+
transform,
|
|
700
|
+
hasShorthand: false,
|
|
701
|
+
resolveShorthand(prop) {
|
|
702
|
+
return prop
|
|
703
|
+
},
|
|
704
|
+
}
|
|
705
|
+
}
|
|
706
|
+
|
|
707
|
+
const cssFn = createCss(context)
|
|
708
|
+
|
|
709
|
+
export const css = (str) => {
|
|
710
|
+
return cssFn(astish(str[0]))
|
|
711
|
+
}
|
|
712
|
+
`
|
|
713
|
+
};
|
|
714
|
+
}
|
|
715
|
+
|
|
638
716
|
// src/artifacts/js/cva.ts
|
|
639
|
-
var
|
|
717
|
+
var import_outdent6 = require("outdent");
|
|
640
718
|
function generateCvaFn(ctx) {
|
|
641
719
|
return {
|
|
642
|
-
js:
|
|
720
|
+
js: import_outdent6.outdent`
|
|
643
721
|
${ctx.file.import("compact, splitProps", "../helpers")}
|
|
644
722
|
${ctx.file.import("css, mergeCss", "./css")}
|
|
645
723
|
|
|
@@ -705,7 +783,7 @@ function generateCvaFn(ctx) {
|
|
|
705
783
|
}
|
|
706
784
|
|
|
707
785
|
`,
|
|
708
|
-
dts:
|
|
786
|
+
dts: import_outdent6.outdent`
|
|
709
787
|
import type { RecipeCreatorFn } from '../types/recipe'
|
|
710
788
|
|
|
711
789
|
export declare const cva: RecipeCreatorFn
|
|
@@ -717,10 +795,10 @@ function generateCvaFn(ctx) {
|
|
|
717
795
|
}
|
|
718
796
|
|
|
719
797
|
// src/artifacts/js/cx.ts
|
|
720
|
-
var
|
|
798
|
+
var import_outdent7 = __toESM(require("outdent"));
|
|
721
799
|
function generateCx() {
|
|
722
800
|
return {
|
|
723
|
-
js:
|
|
801
|
+
js: import_outdent7.default`
|
|
724
802
|
function cx() {
|
|
725
803
|
let str = '',
|
|
726
804
|
i = 0,
|
|
@@ -737,7 +815,7 @@ function generateCx() {
|
|
|
737
815
|
|
|
738
816
|
export { cx }
|
|
739
817
|
`,
|
|
740
|
-
dts:
|
|
818
|
+
dts: import_outdent7.default`
|
|
741
819
|
type Argument = string | boolean | null | undefined
|
|
742
820
|
|
|
743
821
|
/** Conditionally join classNames into a single string */
|
|
@@ -747,17 +825,17 @@ function generateCx() {
|
|
|
747
825
|
}
|
|
748
826
|
|
|
749
827
|
// src/artifacts/js/helpers.ts
|
|
750
|
-
var
|
|
828
|
+
var import_outdent8 = require("outdent");
|
|
751
829
|
|
|
752
830
|
// src/artifacts/generated/helpers.mjs.json
|
|
753
831
|
var helpers_mjs_default = {
|
|
754
|
-
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}\
|
|
832
|
+
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'
|
|
755
833
|
};
|
|
756
834
|
|
|
757
835
|
// src/artifacts/js/helpers.ts
|
|
758
836
|
function generateHelpers() {
|
|
759
837
|
return {
|
|
760
|
-
js:
|
|
838
|
+
js: import_outdent8.outdent`
|
|
761
839
|
${helpers_mjs_default.content}
|
|
762
840
|
|
|
763
841
|
export function __spreadValues(a, b){
|
|
@@ -778,6 +856,8 @@ var is_valid_prop_mjs_default = {
|
|
|
778
856
|
|
|
779
857
|
// src/artifacts/js/is-valid-prop.ts
|
|
780
858
|
function generateisValidProp(ctx) {
|
|
859
|
+
if (ctx.isTemplateLiteralSyntax)
|
|
860
|
+
return;
|
|
781
861
|
let content = is_valid_prop_mjs_default.content;
|
|
782
862
|
content = content.replace(
|
|
783
863
|
"var userGenerated = []",
|
|
@@ -791,7 +871,7 @@ function generateisValidProp(ctx) {
|
|
|
791
871
|
// src/artifacts/js/pattern.ts
|
|
792
872
|
var import_shared = require("@pandacss/shared");
|
|
793
873
|
var import_javascript_stringify = require("javascript-stringify");
|
|
794
|
-
var
|
|
874
|
+
var import_outdent9 = require("outdent");
|
|
795
875
|
var import_ts_pattern = require("ts-pattern");
|
|
796
876
|
function generatePattern(ctx) {
|
|
797
877
|
if (ctx.patterns.isEmpty())
|
|
@@ -809,7 +889,7 @@ function generatePattern(ctx) {
|
|
|
809
889
|
}
|
|
810
890
|
return {
|
|
811
891
|
name: dashName,
|
|
812
|
-
dts:
|
|
892
|
+
dts: import_outdent9.outdent`
|
|
813
893
|
import type { SystemStyleObject, ConditionalValue } from '../types'
|
|
814
894
|
import type { PropertyValue } from '../types/prop-type'
|
|
815
895
|
import type { Properties } from '../types/csstype'
|
|
@@ -833,7 +913,7 @@ function generatePattern(ctx) {
|
|
|
833
913
|
}).join("\n ")}
|
|
834
914
|
}
|
|
835
915
|
|
|
836
|
-
${strict ?
|
|
916
|
+
${strict ? import_outdent9.outdent`export declare function ${name}(options: ${upperName}Properties): string` : import_outdent9.outdent`
|
|
837
917
|
|
|
838
918
|
type ${upperName}Options = ${upperName}Properties & Omit<SystemStyleObject, keyof ${upperName}Properties ${blocklistType}>
|
|
839
919
|
|
|
@@ -842,7 +922,7 @@ function generatePattern(ctx) {
|
|
|
842
922
|
`}
|
|
843
923
|
|
|
844
924
|
`,
|
|
845
|
-
js:
|
|
925
|
+
js: import_outdent9.outdent`
|
|
846
926
|
${ctx.file.import(helperImports.join(", "), "../helpers")}
|
|
847
927
|
${ctx.file.import("css", "../css/index")}
|
|
848
928
|
|
|
@@ -859,7 +939,7 @@ transform`)}
|
|
|
859
939
|
|
|
860
940
|
// src/artifacts/js/recipe.ts
|
|
861
941
|
var import_shared2 = require("@pandacss/shared");
|
|
862
|
-
var
|
|
942
|
+
var import_outdent10 = require("outdent");
|
|
863
943
|
var stringify3 = (value) => JSON.stringify(value, null, 2);
|
|
864
944
|
var isBooleanValue = (value) => value === "true" || value === "false";
|
|
865
945
|
function generateRecipes(ctx) {
|
|
@@ -873,7 +953,7 @@ function generateRecipes(ctx) {
|
|
|
873
953
|
const createRecipeFn = {
|
|
874
954
|
name: "create-recipe",
|
|
875
955
|
dts: "",
|
|
876
|
-
js:
|
|
956
|
+
js: import_outdent10.outdent`
|
|
877
957
|
${ctx.file.import("css", "../css/css")}
|
|
878
958
|
${ctx.file.import("assertCompoundVariant, getCompoundVariantCss", "../css/cva")}
|
|
879
959
|
${ctx.file.import("cx", "../css/cx")}
|
|
@@ -920,7 +1000,7 @@ function generateRecipes(ctx) {
|
|
|
920
1000
|
const { name, description, defaultVariants, compoundVariants } = config;
|
|
921
1001
|
return {
|
|
922
1002
|
name: dashName,
|
|
923
|
-
js:
|
|
1003
|
+
js: import_outdent10.outdent`
|
|
924
1004
|
${ctx.file.import("splitProps", "../helpers")}
|
|
925
1005
|
${ctx.file.import("createRecipe", "./create-recipe")}
|
|
926
1006
|
|
|
@@ -941,7 +1021,7 @@ function generateRecipes(ctx) {
|
|
|
941
1021
|
splitVariantProps,
|
|
942
1022
|
})
|
|
943
1023
|
`,
|
|
944
|
-
dts:
|
|
1024
|
+
dts: import_outdent10.outdent`
|
|
945
1025
|
import type { ConditionalValue } from '../types'
|
|
946
1026
|
import type { Pretty } from '../types/helpers'
|
|
947
1027
|
|
|
@@ -979,7 +1059,7 @@ function generateRecipes(ctx) {
|
|
|
979
1059
|
}
|
|
980
1060
|
|
|
981
1061
|
// src/artifacts/js/token.ts
|
|
982
|
-
var
|
|
1062
|
+
var import_outdent11 = __toESM(require("outdent"));
|
|
983
1063
|
function generateTokenJs(ctx) {
|
|
984
1064
|
const { tokens } = ctx;
|
|
985
1065
|
const map = /* @__PURE__ */ new Map();
|
|
@@ -990,7 +1070,7 @@ function generateTokenJs(ctx) {
|
|
|
990
1070
|
});
|
|
991
1071
|
const obj = Object.fromEntries(map);
|
|
992
1072
|
return {
|
|
993
|
-
js:
|
|
1073
|
+
js: import_outdent11.default`
|
|
994
1074
|
const tokens = ${JSON.stringify(obj, null, 2)}
|
|
995
1075
|
|
|
996
1076
|
export function token(path, fallback) {
|
|
@@ -1003,7 +1083,7 @@ function generateTokenJs(ctx) {
|
|
|
1003
1083
|
|
|
1004
1084
|
token.var = tokenVar
|
|
1005
1085
|
`,
|
|
1006
|
-
dts:
|
|
1086
|
+
dts: import_outdent11.default`
|
|
1007
1087
|
import type { Token } from './tokens'
|
|
1008
1088
|
|
|
1009
1089
|
export declare const token: {
|
|
@@ -1017,11 +1097,11 @@ function generateTokenJs(ctx) {
|
|
|
1017
1097
|
}
|
|
1018
1098
|
|
|
1019
1099
|
// src/artifacts/preact-jsx/jsx.ts
|
|
1020
|
-
var
|
|
1100
|
+
var import_outdent12 = require("outdent");
|
|
1021
1101
|
function generatePreactJsxFactory(ctx) {
|
|
1022
1102
|
const { factoryName, componentName } = ctx.jsx;
|
|
1023
1103
|
return {
|
|
1024
|
-
js:
|
|
1104
|
+
js: import_outdent12.outdent`
|
|
1025
1105
|
import { h } from 'preact'
|
|
1026
1106
|
import { forwardRef } from 'preact/compat'
|
|
1027
1107
|
import { useMemo } from 'preact/hooks'
|
|
@@ -1088,7 +1168,7 @@ function generatePreactJsxFactory(ctx) {
|
|
|
1088
1168
|
}
|
|
1089
1169
|
|
|
1090
1170
|
// src/artifacts/preact-jsx/pattern.ts
|
|
1091
|
-
var
|
|
1171
|
+
var import_outdent13 = require("outdent");
|
|
1092
1172
|
var import_ts_pattern2 = require("ts-pattern");
|
|
1093
1173
|
function generatePreactJsxPattern(ctx) {
|
|
1094
1174
|
const { typeName, factoryName } = ctx.jsx;
|
|
@@ -1097,7 +1177,7 @@ function generatePreactJsxPattern(ctx) {
|
|
|
1097
1177
|
const { description, jsxElement = "div" } = pattern.config;
|
|
1098
1178
|
return {
|
|
1099
1179
|
name: dashName,
|
|
1100
|
-
js:
|
|
1180
|
+
js: import_outdent13.outdent`
|
|
1101
1181
|
import { h } from 'preact'
|
|
1102
1182
|
import { forwardRef } from 'preact/compat'
|
|
1103
1183
|
${ctx.file.import(factoryName, "./factory")}
|
|
@@ -1106,12 +1186,12 @@ function generatePreactJsxPattern(ctx) {
|
|
|
1106
1186
|
export const ${jsxName} = forwardRef(function ${jsxName}(props, ref) {
|
|
1107
1187
|
${(0, import_ts_pattern2.match)(props.length).with(
|
|
1108
1188
|
0,
|
|
1109
|
-
() =>
|
|
1189
|
+
() => import_outdent13.outdent`
|
|
1110
1190
|
const styleProps = ${styleFnName}()
|
|
1111
1191
|
return h(${factoryName}.${jsxElement}, { ref, ...styleProps, ...props })
|
|
1112
1192
|
`
|
|
1113
1193
|
).otherwise(
|
|
1114
|
-
() =>
|
|
1194
|
+
() => import_outdent13.outdent`
|
|
1115
1195
|
const { ${props.join(", ")}, ...restProps } = props
|
|
1116
1196
|
const styleProps = ${styleFnName}({${props.join(", ")}})
|
|
1117
1197
|
return h(${factoryName}.${jsxElement}, { ref, ...styleProps, ...restProps })
|
|
@@ -1119,7 +1199,7 @@ function generatePreactJsxPattern(ctx) {
|
|
|
1119
1199
|
)}
|
|
1120
1200
|
})
|
|
1121
1201
|
`,
|
|
1122
|
-
dts:
|
|
1202
|
+
dts: import_outdent13.outdent`
|
|
1123
1203
|
import type { FunctionComponent } from 'preact'
|
|
1124
1204
|
import type { ${upperName}Properties } from '../patterns/${dashName}'
|
|
1125
1205
|
import type { ${typeName} } from '../types/jsx'
|
|
@@ -1134,15 +1214,15 @@ function generatePreactJsxPattern(ctx) {
|
|
|
1134
1214
|
}
|
|
1135
1215
|
|
|
1136
1216
|
// src/artifacts/preact-jsx/types.ts
|
|
1137
|
-
var
|
|
1217
|
+
var import_outdent14 = require("outdent");
|
|
1138
1218
|
function generatePreactJsxTypes(ctx) {
|
|
1139
1219
|
const { factoryName, componentName, upperName, typeName } = ctx.jsx;
|
|
1140
1220
|
return {
|
|
1141
|
-
jsxFactory:
|
|
1221
|
+
jsxFactory: import_outdent14.outdent`
|
|
1142
1222
|
import type { ${upperName} } from '../types/jsx'
|
|
1143
1223
|
export declare const ${factoryName}: ${upperName}
|
|
1144
1224
|
`,
|
|
1145
|
-
jsxType:
|
|
1225
|
+
jsxType: import_outdent14.outdent`
|
|
1146
1226
|
import type { ComponentProps, JSX } from 'preact'
|
|
1147
1227
|
import type { Assign, JsxStyleProps, JsxHTMLProps } from './system-types'
|
|
1148
1228
|
import type { RecipeDefinition, RecipeSelection, RecipeVariantRecord } from './recipe'
|
|
@@ -1176,12 +1256,96 @@ export type ${typeName}<T extends ElementType> = JsxHTMLProps<ComponentProps<T>,
|
|
|
1176
1256
|
};
|
|
1177
1257
|
}
|
|
1178
1258
|
|
|
1259
|
+
// src/artifacts/preact-jsx/jsx.string-literal.ts
|
|
1260
|
+
var import_outdent15 = require("outdent");
|
|
1261
|
+
function generatePreactJsxStringLiteralFactory(ctx) {
|
|
1262
|
+
const { factoryName, componentName } = ctx.jsx;
|
|
1263
|
+
return {
|
|
1264
|
+
js: import_outdent15.outdent`
|
|
1265
|
+
import { h } from 'preact'
|
|
1266
|
+
import { forwardRef } from 'preact/compat'
|
|
1267
|
+
${ctx.file.import("css, cx", "../css/index")}
|
|
1268
|
+
|
|
1269
|
+
function createStyledFn(Dynamic) {
|
|
1270
|
+
return function styledFn(template) {
|
|
1271
|
+
const baseClassName = css(template)
|
|
1272
|
+
const ${componentName} = forwardRef(function ${componentName}(props, ref) {
|
|
1273
|
+
const { as: Element = Dynamic, ...elementProps } = props
|
|
1274
|
+
const classes = () => cx(baseClassName, elementProps.className)
|
|
1275
|
+
|
|
1276
|
+
return h(Element, {
|
|
1277
|
+
ref,
|
|
1278
|
+
...elementProps,
|
|
1279
|
+
className: classes(),
|
|
1280
|
+
})
|
|
1281
|
+
})
|
|
1282
|
+
|
|
1283
|
+
${componentName}.displayName = \`${factoryName}.\${Dynamic}\`
|
|
1284
|
+
return ${componentName}
|
|
1285
|
+
}
|
|
1286
|
+
}
|
|
1287
|
+
|
|
1288
|
+
function createJsxFactory() {
|
|
1289
|
+
const cache = new Map()
|
|
1290
|
+
|
|
1291
|
+
return new Proxy(createStyledFn, {
|
|
1292
|
+
apply(_, __, args) {
|
|
1293
|
+
return createStyledFn(...args)
|
|
1294
|
+
},
|
|
1295
|
+
get(_, el) {
|
|
1296
|
+
if (!cache.has(el)) {
|
|
1297
|
+
cache.set(el, createStyledFn(el))
|
|
1298
|
+
}
|
|
1299
|
+
return cache.get(el)
|
|
1300
|
+
},
|
|
1301
|
+
})
|
|
1302
|
+
}
|
|
1303
|
+
|
|
1304
|
+
export const ${factoryName} = createJsxFactory()
|
|
1305
|
+
`
|
|
1306
|
+
};
|
|
1307
|
+
}
|
|
1308
|
+
|
|
1309
|
+
// src/artifacts/preact-jsx/types.string-literal.ts
|
|
1310
|
+
var import_outdent16 = require("outdent");
|
|
1311
|
+
function generatePreactJsxStringLiteralTypes(ctx) {
|
|
1312
|
+
const { factoryName, componentName, upperName, typeName } = ctx.jsx;
|
|
1313
|
+
return {
|
|
1314
|
+
jsxFactory: import_outdent16.outdent`
|
|
1315
|
+
import type { ${upperName} } from '../types/jsx'
|
|
1316
|
+
export declare const ${factoryName}: ${upperName}
|
|
1317
|
+
`,
|
|
1318
|
+
jsxType: import_outdent16.outdent`
|
|
1319
|
+
import type { ComponentProps, JSX } from 'preact'
|
|
1320
|
+
|
|
1321
|
+
type ElementType = keyof JSX.IntrinsicElements
|
|
1322
|
+
|
|
1323
|
+
type Dict = Record<string, unknown>
|
|
1324
|
+
|
|
1325
|
+
export type ${componentName}<T extends ElementType> = {
|
|
1326
|
+
(args: { raw: readonly string[] | ArrayLike<string> }): (props: ComponentProps<T>) => JSX.Element
|
|
1327
|
+
displayName?: string
|
|
1328
|
+
}
|
|
1329
|
+
|
|
1330
|
+
interface JsxFactory {
|
|
1331
|
+
<T extends ElementType>(component: T): ${componentName}<T>
|
|
1332
|
+
}
|
|
1333
|
+
|
|
1334
|
+
type JsxElements = { [K in keyof JSX.IntrinsicElements]: ${componentName}<K> }
|
|
1335
|
+
|
|
1336
|
+
export type ${upperName} = JsxFactory & JsxElements
|
|
1337
|
+
|
|
1338
|
+
export type ${typeName}<T extends ElementType> = ComponentProps<T>
|
|
1339
|
+
`
|
|
1340
|
+
};
|
|
1341
|
+
}
|
|
1342
|
+
|
|
1179
1343
|
// src/artifacts/qwik-jsx/jsx.ts
|
|
1180
|
-
var
|
|
1344
|
+
var import_outdent17 = require("outdent");
|
|
1181
1345
|
function generateQwikJsxFactory(ctx) {
|
|
1182
1346
|
const { factoryName, componentName } = ctx.jsx;
|
|
1183
1347
|
return {
|
|
1184
|
-
js:
|
|
1348
|
+
js: import_outdent17.outdent`
|
|
1185
1349
|
import { h } from '@builder.io/qwik'
|
|
1186
1350
|
${ctx.file.import("css, cx, cva, assignCss", "../css/index")}
|
|
1187
1351
|
${ctx.file.import("splitProps, normalizeHTMLProps", "../helpers")}
|
|
@@ -1245,7 +1409,7 @@ function generateQwikJsxFactory(ctx) {
|
|
|
1245
1409
|
}
|
|
1246
1410
|
|
|
1247
1411
|
// src/artifacts/qwik-jsx/pattern.ts
|
|
1248
|
-
var
|
|
1412
|
+
var import_outdent18 = require("outdent");
|
|
1249
1413
|
var import_ts_pattern3 = require("ts-pattern");
|
|
1250
1414
|
function generateQwikJsxPattern(ctx) {
|
|
1251
1415
|
const { typeName, factoryName } = ctx.jsx;
|
|
@@ -1254,7 +1418,7 @@ function generateQwikJsxPattern(ctx) {
|
|
|
1254
1418
|
const { description, jsxElement = "div" } = pattern.config;
|
|
1255
1419
|
return {
|
|
1256
1420
|
name: dashName,
|
|
1257
|
-
js:
|
|
1421
|
+
js: import_outdent18.outdent`
|
|
1258
1422
|
import { h } from '@builder.io/qwik'
|
|
1259
1423
|
${ctx.file.import(factoryName, "./factory")}
|
|
1260
1424
|
${ctx.file.import(styleFnName, `../patterns/${dashName}`)}
|
|
@@ -1262,12 +1426,12 @@ function generateQwikJsxPattern(ctx) {
|
|
|
1262
1426
|
export const ${jsxName} = function ${jsxName}(props) {
|
|
1263
1427
|
${(0, import_ts_pattern3.match)(props.length).with(
|
|
1264
1428
|
0,
|
|
1265
|
-
() =>
|
|
1429
|
+
() => import_outdent18.outdent`
|
|
1266
1430
|
const styleProps = ${styleFnName}()
|
|
1267
1431
|
return h(${factoryName}.${jsxElement}, { ...styleProps, ...props })
|
|
1268
1432
|
`
|
|
1269
1433
|
).otherwise(
|
|
1270
|
-
() =>
|
|
1434
|
+
() => import_outdent18.outdent`
|
|
1271
1435
|
const { ${props.join(", ")}, ...restProps } = props
|
|
1272
1436
|
const styleProps = ${styleFnName}({${props.join(", ")}})
|
|
1273
1437
|
return h(${factoryName}.${jsxElement}, { ...styleProps, ...restProps })
|
|
@@ -1275,7 +1439,7 @@ function generateQwikJsxPattern(ctx) {
|
|
|
1275
1439
|
)}
|
|
1276
1440
|
}
|
|
1277
1441
|
`,
|
|
1278
|
-
dts:
|
|
1442
|
+
dts: import_outdent18.outdent`
|
|
1279
1443
|
import type { FunctionComponent } from '@builder.io/qwik'
|
|
1280
1444
|
import type { ${upperName}Properties } from '../patterns/${dashName}'
|
|
1281
1445
|
import type { ${typeName} } from '../types/jsx'
|
|
@@ -1294,15 +1458,15 @@ function generateQwikJsxPattern(ctx) {
|
|
|
1294
1458
|
}
|
|
1295
1459
|
|
|
1296
1460
|
// src/artifacts/qwik-jsx/types.ts
|
|
1297
|
-
var
|
|
1461
|
+
var import_outdent19 = require("outdent");
|
|
1298
1462
|
function generateQwikJsxTypes(ctx) {
|
|
1299
1463
|
const { factoryName, componentName, upperName, typeName } = ctx.jsx;
|
|
1300
1464
|
return {
|
|
1301
|
-
jsxFactory:
|
|
1465
|
+
jsxFactory: import_outdent19.outdent`
|
|
1302
1466
|
import { ${upperName} } from '../types/jsx'
|
|
1303
1467
|
export declare const ${factoryName}: ${upperName}
|
|
1304
1468
|
`,
|
|
1305
|
-
jsxType:
|
|
1469
|
+
jsxType: import_outdent19.outdent`
|
|
1306
1470
|
import type { FunctionComponent, QwikIntrinsicElements } from '@builder.io/qwik'
|
|
1307
1471
|
import type { Assign as _Assign, JsxStyleProps, PatchedHTMLProps } from './system-types'
|
|
1308
1472
|
import type { RecipeDefinition, RecipeSelection, RecipeVariantRecord } from './recipe'
|
|
@@ -1355,12 +1519,100 @@ export type ${typeName}<T extends ElementType> = Assign<ComponentProps<T>, JsxSt
|
|
|
1355
1519
|
};
|
|
1356
1520
|
}
|
|
1357
1521
|
|
|
1522
|
+
// src/artifacts/qwik-jsx/jsx.string-literal.ts
|
|
1523
|
+
var import_outdent20 = require("outdent");
|
|
1524
|
+
function generateQwikJsxStringLiteralFactory(ctx) {
|
|
1525
|
+
const { factoryName, componentName } = ctx.jsx;
|
|
1526
|
+
return {
|
|
1527
|
+
js: import_outdent20.outdent`
|
|
1528
|
+
import { h } from '@builder.io/qwik'
|
|
1529
|
+
${ctx.file.import("css, cx", "../css/index")}
|
|
1530
|
+
|
|
1531
|
+
function createStyledFn(Dynamic) {
|
|
1532
|
+
return function styledFn(template) {
|
|
1533
|
+
const baseClassName = css(template)
|
|
1534
|
+
const ${componentName} = function ${componentName}(props) {
|
|
1535
|
+
const { as: Element = Dynamic, ...elementProps } = props
|
|
1536
|
+
const classes = () => cx(baseClassName, elementProps.className)
|
|
1537
|
+
|
|
1538
|
+
return h(Element, {
|
|
1539
|
+
...elementProps,
|
|
1540
|
+
className: classes(),
|
|
1541
|
+
})
|
|
1542
|
+
}
|
|
1543
|
+
|
|
1544
|
+
${componentName}.displayName = \`${factoryName}.\${Dynamic}\`
|
|
1545
|
+
return ${componentName}
|
|
1546
|
+
}
|
|
1547
|
+
}
|
|
1548
|
+
|
|
1549
|
+
function createJsxFactory() {
|
|
1550
|
+
const cache = new Map()
|
|
1551
|
+
|
|
1552
|
+
return new Proxy(createStyledFn, {
|
|
1553
|
+
apply(_, __, args) {
|
|
1554
|
+
return createStyledFn(...args)
|
|
1555
|
+
},
|
|
1556
|
+
get(_, el) {
|
|
1557
|
+
if (!cache.has(el)) {
|
|
1558
|
+
cache.set(el, createStyledFn(el))
|
|
1559
|
+
}
|
|
1560
|
+
return cache.get(el)
|
|
1561
|
+
},
|
|
1562
|
+
})
|
|
1563
|
+
}
|
|
1564
|
+
|
|
1565
|
+
export const ${factoryName} = createJsxFactory()
|
|
1566
|
+
|
|
1567
|
+
`
|
|
1568
|
+
};
|
|
1569
|
+
}
|
|
1570
|
+
|
|
1571
|
+
// src/artifacts/qwik-jsx/types.string-literal.ts
|
|
1572
|
+
var import_outdent21 = require("outdent");
|
|
1573
|
+
function generateQwikJsxStringLiteralTypes(ctx) {
|
|
1574
|
+
const { factoryName, componentName, upperName, typeName } = ctx.jsx;
|
|
1575
|
+
return {
|
|
1576
|
+
jsxFactory: import_outdent21.outdent`
|
|
1577
|
+
import { ${upperName} } from '../types/jsx'
|
|
1578
|
+
export declare const ${factoryName}: ${upperName}
|
|
1579
|
+
`,
|
|
1580
|
+
jsxType: import_outdent21.outdent`
|
|
1581
|
+
import type { FunctionComponent, QwikIntrinsicElements } from '@builder.io/qwik'
|
|
1582
|
+
|
|
1583
|
+
type ElementType = keyof QwikIntrinsicElements | FunctionComponent<any>
|
|
1584
|
+
|
|
1585
|
+
type ComponentProps<T extends ElementType> = T extends keyof QwikIntrinsicElements
|
|
1586
|
+
? QwikIntrinsicElements[T]
|
|
1587
|
+
: T extends FunctionComponent<infer P>
|
|
1588
|
+
? P
|
|
1589
|
+
: never
|
|
1590
|
+
|
|
1591
|
+
type Dict = Record<string, unknown>
|
|
1592
|
+
|
|
1593
|
+
export type ${componentName}<T extends ElementType> = {
|
|
1594
|
+
(args: { raw: readonly string[] | ArrayLike<string> }): (props: ComponentProps<T>) => JSX.Element
|
|
1595
|
+
}
|
|
1596
|
+
|
|
1597
|
+
interface JsxFactory {
|
|
1598
|
+
<T extends ElementType>(component: T): ${componentName}<T>
|
|
1599
|
+
}
|
|
1600
|
+
|
|
1601
|
+
type JsxElements = { [K in keyof QwikIntrinsicElements]: ${componentName}<K> }
|
|
1602
|
+
|
|
1603
|
+
export type ${upperName} = JsxFactory & JsxElements
|
|
1604
|
+
|
|
1605
|
+
export type ${typeName}<T extends ElementType> = ComponentProps<T>
|
|
1606
|
+
`
|
|
1607
|
+
};
|
|
1608
|
+
}
|
|
1609
|
+
|
|
1358
1610
|
// src/artifacts/react-jsx/jsx.ts
|
|
1359
|
-
var
|
|
1611
|
+
var import_outdent22 = require("outdent");
|
|
1360
1612
|
function generateReactJsxFactory(ctx) {
|
|
1361
1613
|
const { factoryName, componentName } = ctx.jsx;
|
|
1362
1614
|
return {
|
|
1363
|
-
js:
|
|
1615
|
+
js: import_outdent22.outdent`
|
|
1364
1616
|
import { createElement, forwardRef, useMemo } from 'react'
|
|
1365
1617
|
${ctx.file.import("css, cx, cva, assignCss", "../css/index")}
|
|
1366
1618
|
${ctx.file.import("splitProps, normalizeHTMLProps", "../helpers")}
|
|
@@ -1426,7 +1678,7 @@ function generateReactJsxFactory(ctx) {
|
|
|
1426
1678
|
}
|
|
1427
1679
|
|
|
1428
1680
|
// src/artifacts/react-jsx/pattern.ts
|
|
1429
|
-
var
|
|
1681
|
+
var import_outdent23 = require("outdent");
|
|
1430
1682
|
var import_ts_pattern4 = require("ts-pattern");
|
|
1431
1683
|
function generateReactJsxPattern(ctx) {
|
|
1432
1684
|
const { typeName, factoryName } = ctx.jsx;
|
|
@@ -1435,7 +1687,7 @@ function generateReactJsxPattern(ctx) {
|
|
|
1435
1687
|
const { description, jsxElement = "div" } = pattern.config;
|
|
1436
1688
|
return {
|
|
1437
1689
|
name: dashName,
|
|
1438
|
-
js:
|
|
1690
|
+
js: import_outdent23.outdent`
|
|
1439
1691
|
import { createElement, forwardRef } from 'react'
|
|
1440
1692
|
${ctx.file.import(factoryName, "./factory")}
|
|
1441
1693
|
${ctx.file.import(styleFnName, `../patterns/${dashName}`)}
|
|
@@ -1443,12 +1695,12 @@ function generateReactJsxPattern(ctx) {
|
|
|
1443
1695
|
export const ${jsxName} = forwardRef(function ${jsxName}(props, ref) {
|
|
1444
1696
|
${(0, import_ts_pattern4.match)(props.length).with(
|
|
1445
1697
|
0,
|
|
1446
|
-
() =>
|
|
1698
|
+
() => import_outdent23.outdent`
|
|
1447
1699
|
const styleProps = ${styleFnName}()
|
|
1448
1700
|
return createElement(${factoryName}.${jsxElement}, { ref, ...styleProps, ...props })
|
|
1449
1701
|
`
|
|
1450
1702
|
).otherwise(
|
|
1451
|
-
() =>
|
|
1703
|
+
() => import_outdent23.outdent`
|
|
1452
1704
|
const { ${props.join(", ")}, ...restProps } = props
|
|
1453
1705
|
const styleProps = ${styleFnName}({${props.join(", ")}})
|
|
1454
1706
|
return createElement(${factoryName}.${jsxElement}, { ref, ...styleProps, ...restProps })
|
|
@@ -1456,7 +1708,7 @@ function generateReactJsxPattern(ctx) {
|
|
|
1456
1708
|
)}
|
|
1457
1709
|
})
|
|
1458
1710
|
`,
|
|
1459
|
-
dts:
|
|
1711
|
+
dts: import_outdent23.outdent`
|
|
1460
1712
|
import type { FunctionComponent } from 'react'
|
|
1461
1713
|
import type { ${upperName}Properties } from '../patterns/${dashName}'
|
|
1462
1714
|
import type { ${typeName} } from '../types/jsx'
|
|
@@ -1471,15 +1723,15 @@ function generateReactJsxPattern(ctx) {
|
|
|
1471
1723
|
}
|
|
1472
1724
|
|
|
1473
1725
|
// src/artifacts/react-jsx/types.ts
|
|
1474
|
-
var
|
|
1726
|
+
var import_outdent24 = require("outdent");
|
|
1475
1727
|
function generateReactJsxTypes(ctx) {
|
|
1476
1728
|
const { factoryName, componentName, upperName, typeName } = ctx.jsx;
|
|
1477
1729
|
return {
|
|
1478
|
-
jsxFactory:
|
|
1730
|
+
jsxFactory: import_outdent24.outdent`
|
|
1479
1731
|
import { ${upperName} } from '../types/jsx'
|
|
1480
1732
|
export declare const ${factoryName}: ${upperName}
|
|
1481
1733
|
`,
|
|
1482
|
-
jsxType:
|
|
1734
|
+
jsxType: import_outdent24.outdent`
|
|
1483
1735
|
import type { ComponentProps, ElementType } from 'react'
|
|
1484
1736
|
import type { Assign, JsxStyleProps, JsxHTMLProps } from './system-types'
|
|
1485
1737
|
import type { RecipeDefinition, RecipeSelection, RecipeVariantRecord } from './recipe'
|
|
@@ -1511,12 +1763,94 @@ export type ${typeName}<T extends ElementType> = JsxHTMLProps<ComponentProps<T>,
|
|
|
1511
1763
|
};
|
|
1512
1764
|
}
|
|
1513
1765
|
|
|
1766
|
+
// src/artifacts/react-jsx/jsx.string-literal.ts
|
|
1767
|
+
var import_outdent25 = require("outdent");
|
|
1768
|
+
function generateReactJsxStringLiteralFactory(ctx) {
|
|
1769
|
+
const { factoryName, componentName } = ctx.jsx;
|
|
1770
|
+
return {
|
|
1771
|
+
js: import_outdent25.outdent`
|
|
1772
|
+
import { createElement, forwardRef } from 'react'
|
|
1773
|
+
${ctx.file.import("css, cx", "../css/index")}
|
|
1774
|
+
|
|
1775
|
+
function createStyledFn(Dynamic) {
|
|
1776
|
+
return function styledFn(template) {
|
|
1777
|
+
const baseClassName = css(template)
|
|
1778
|
+
const ${componentName} = forwardRef(function ${componentName}(props, ref) {
|
|
1779
|
+
const { as: Element = Dynamic, ...elementProps } = props
|
|
1780
|
+
const classes = () => cx(baseClassName, elementProps.className)
|
|
1781
|
+
|
|
1782
|
+
return createElement(Element, {
|
|
1783
|
+
ref,
|
|
1784
|
+
...elementProps,
|
|
1785
|
+
className: classes(),
|
|
1786
|
+
})
|
|
1787
|
+
})
|
|
1788
|
+
|
|
1789
|
+
${componentName}.displayName = \`${factoryName}.\${Dynamic}\`
|
|
1790
|
+
return ${componentName}
|
|
1791
|
+
}
|
|
1792
|
+
}
|
|
1793
|
+
|
|
1794
|
+
function createJsxFactory() {
|
|
1795
|
+
const cache = new Map()
|
|
1796
|
+
|
|
1797
|
+
return new Proxy(createStyledFn, {
|
|
1798
|
+
apply(_, __, args) {
|
|
1799
|
+
return createStyledFn(...args)
|
|
1800
|
+
},
|
|
1801
|
+
get(_, el) {
|
|
1802
|
+
if (!cache.has(el)) {
|
|
1803
|
+
cache.set(el, createStyledFn(el))
|
|
1804
|
+
}
|
|
1805
|
+
return cache.get(el)
|
|
1806
|
+
},
|
|
1807
|
+
})
|
|
1808
|
+
}
|
|
1809
|
+
|
|
1810
|
+
export const ${factoryName} = createJsxFactory()
|
|
1811
|
+
|
|
1812
|
+
`
|
|
1813
|
+
};
|
|
1814
|
+
}
|
|
1815
|
+
|
|
1816
|
+
// src/artifacts/react-jsx/types.string-literal.ts
|
|
1817
|
+
var import_outdent26 = require("outdent");
|
|
1818
|
+
function generateReactJsxStringLiteralTypes(ctx) {
|
|
1819
|
+
const { factoryName, componentName, upperName, typeName } = ctx.jsx;
|
|
1820
|
+
return {
|
|
1821
|
+
jsxFactory: import_outdent26.outdent`
|
|
1822
|
+
import { ${upperName} } from '../types/jsx'
|
|
1823
|
+
export declare const ${factoryName}: ${upperName}
|
|
1824
|
+
`,
|
|
1825
|
+
jsxType: import_outdent26.outdent`
|
|
1826
|
+
import type { ComponentProps, ElementType } from 'react'
|
|
1827
|
+
|
|
1828
|
+
type Dict = Record<string, unknown>
|
|
1829
|
+
|
|
1830
|
+
export type ${componentName}<T extends ElementType> = {
|
|
1831
|
+
(args: { raw: readonly string[] | ArrayLike<string> }): (props: ComponentProps<T>) => JSX.Element
|
|
1832
|
+
displayName?: string
|
|
1833
|
+
}
|
|
1834
|
+
|
|
1835
|
+
interface JsxFactory {
|
|
1836
|
+
<T extends ElementType>(component: T): ${componentName}<T>
|
|
1837
|
+
}
|
|
1838
|
+
|
|
1839
|
+
type JsxElements = { [K in keyof JSX.IntrinsicElements]: ${componentName}<K> }
|
|
1840
|
+
|
|
1841
|
+
export type ${upperName} = JsxFactory & JsxElements
|
|
1842
|
+
|
|
1843
|
+
export type ${typeName}<T extends ElementType> = ComponentProps<T>
|
|
1844
|
+
`
|
|
1845
|
+
};
|
|
1846
|
+
}
|
|
1847
|
+
|
|
1514
1848
|
// src/artifacts/solid-jsx/jsx.ts
|
|
1515
|
-
var
|
|
1849
|
+
var import_outdent27 = require("outdent");
|
|
1516
1850
|
function generateSolidJsxFactory(ctx) {
|
|
1517
1851
|
const { componentName, factoryName } = ctx.jsx;
|
|
1518
1852
|
return {
|
|
1519
|
-
js:
|
|
1853
|
+
js: import_outdent27.outdent`
|
|
1520
1854
|
import { Dynamic } from 'solid-js/web'
|
|
1521
1855
|
import { mergeProps, splitProps } from 'solid-js'
|
|
1522
1856
|
import { createComponent } from 'solid-js/web'
|
|
@@ -1593,7 +1927,7 @@ function generateSolidJsxFactory(ctx) {
|
|
|
1593
1927
|
}
|
|
1594
1928
|
|
|
1595
1929
|
// src/artifacts/solid-jsx/pattern.ts
|
|
1596
|
-
var
|
|
1930
|
+
var import_outdent28 = require("outdent");
|
|
1597
1931
|
var import_ts_pattern5 = require("ts-pattern");
|
|
1598
1932
|
function generateSolidJsxPattern(ctx) {
|
|
1599
1933
|
const { typeName, factoryName } = ctx.jsx;
|
|
@@ -1602,7 +1936,7 @@ function generateSolidJsxPattern(ctx) {
|
|
|
1602
1936
|
const { description, jsxElement = "div" } = pattern.config;
|
|
1603
1937
|
return {
|
|
1604
1938
|
name: dashName,
|
|
1605
|
-
js:
|
|
1939
|
+
js: import_outdent28.outdent`
|
|
1606
1940
|
import { splitProps, mergeProps } from 'solid-js'
|
|
1607
1941
|
import { createComponent } from 'solid-js/web'
|
|
1608
1942
|
${ctx.file.import(factoryName, "./factory")}
|
|
@@ -1611,12 +1945,12 @@ function generateSolidJsxPattern(ctx) {
|
|
|
1611
1945
|
export function ${jsxName}(props) {
|
|
1612
1946
|
${(0, import_ts_pattern5.match)(props.length).with(
|
|
1613
1947
|
0,
|
|
1614
|
-
() =>
|
|
1948
|
+
() => import_outdent28.outdent`
|
|
1615
1949
|
const styleProps = ${styleFnName}()
|
|
1616
1950
|
return createComponent(${factoryName}.${jsxElement}, mergeProps(styleProps, props))
|
|
1617
1951
|
`
|
|
1618
1952
|
).otherwise(
|
|
1619
|
-
() =>
|
|
1953
|
+
() => import_outdent28.outdent`
|
|
1620
1954
|
const [patternProps, restProps] = splitProps(props, [${props.map((v) => JSON.stringify(v)).join(", ")}]);
|
|
1621
1955
|
const styleProps = ${styleFnName}(patternProps)
|
|
1622
1956
|
return createComponent(${factoryName}.${jsxElement}, mergeProps(styleProps, restProps))
|
|
@@ -1624,7 +1958,7 @@ function generateSolidJsxPattern(ctx) {
|
|
|
1624
1958
|
)}
|
|
1625
1959
|
}
|
|
1626
1960
|
`,
|
|
1627
|
-
dts:
|
|
1961
|
+
dts: import_outdent28.outdent`
|
|
1628
1962
|
import { Component } from 'solid-js'
|
|
1629
1963
|
import { ${upperName}Properties } from '../patterns/${dashName}'
|
|
1630
1964
|
import { ${typeName} } from '../types/jsx'
|
|
@@ -1639,15 +1973,15 @@ function generateSolidJsxPattern(ctx) {
|
|
|
1639
1973
|
}
|
|
1640
1974
|
|
|
1641
1975
|
// src/artifacts/solid-jsx/types.ts
|
|
1642
|
-
var
|
|
1976
|
+
var import_outdent29 = require("outdent");
|
|
1643
1977
|
function generateSolidJsxTypes(ctx) {
|
|
1644
1978
|
const { factoryName, componentName, upperName, typeName } = ctx.jsx;
|
|
1645
1979
|
return {
|
|
1646
|
-
jsxFactory:
|
|
1980
|
+
jsxFactory: import_outdent29.outdent`
|
|
1647
1981
|
import type { ${upperName} } from '../types/jsx'
|
|
1648
1982
|
export declare const ${factoryName}: ${upperName}
|
|
1649
1983
|
`,
|
|
1650
|
-
jsxType:
|
|
1984
|
+
jsxType: import_outdent29.outdent`
|
|
1651
1985
|
import type { ComponentProps, Component, JSX } from 'solid-js'
|
|
1652
1986
|
import type { Assign, JsxStyleProps, JsxHTMLProps } from './system-types'
|
|
1653
1987
|
import type { RecipeDefinition, RecipeSelection, RecipeVariantRecord } from './recipe'
|
|
@@ -1681,12 +2015,102 @@ export type ${typeName}<T extends ElementType> = JsxHTMLProps<ComponentProps<T>,
|
|
|
1681
2015
|
};
|
|
1682
2016
|
}
|
|
1683
2017
|
|
|
2018
|
+
// src/artifacts/solid-jsx/jsx.string-literal.ts
|
|
2019
|
+
var import_outdent30 = require("outdent");
|
|
2020
|
+
function generateSolidJsxStringLiteralFactory(ctx) {
|
|
2021
|
+
const { componentName, factoryName } = ctx.jsx;
|
|
2022
|
+
return {
|
|
2023
|
+
js: import_outdent30.outdent`
|
|
2024
|
+
import { mergeProps, splitProps } from 'solid-js'
|
|
2025
|
+
import { Dynamic, createComponent } from 'solid-js/web'
|
|
2026
|
+
${ctx.file.import("css, cx", "../css/index")}
|
|
2027
|
+
|
|
2028
|
+
function createStyled(element) {
|
|
2029
|
+
return function styledFn(template) {
|
|
2030
|
+
const baseClassName = css(template)
|
|
2031
|
+
return function ${componentName}(props) {
|
|
2032
|
+
const mergedProps = mergeProps({ as: element }, props)
|
|
2033
|
+
const [localProps, elementProps] = splitProps(mergedProps, ['as', 'class'])
|
|
2034
|
+
|
|
2035
|
+
return createComponent(
|
|
2036
|
+
Dynamic,
|
|
2037
|
+
mergeProps(
|
|
2038
|
+
{
|
|
2039
|
+
get component() {
|
|
2040
|
+
return localProps.as
|
|
2041
|
+
},
|
|
2042
|
+
get class() {
|
|
2043
|
+
return cx(baseClassName, localProps.class)
|
|
2044
|
+
},
|
|
2045
|
+
},
|
|
2046
|
+
elementProps,
|
|
2047
|
+
),
|
|
2048
|
+
)
|
|
2049
|
+
}
|
|
2050
|
+
}
|
|
2051
|
+
}
|
|
2052
|
+
|
|
2053
|
+
function createJsxFactory() {
|
|
2054
|
+
const cache = new Map()
|
|
2055
|
+
|
|
2056
|
+
return new Proxy(createStyled, {
|
|
2057
|
+
apply(_, __, args) {
|
|
2058
|
+
return createStyled(...args)
|
|
2059
|
+
},
|
|
2060
|
+
get(_, el) {
|
|
2061
|
+
if (!cache.has(el)) {
|
|
2062
|
+
cache.set(el, createStyled(el))
|
|
2063
|
+
}
|
|
2064
|
+
return cache.get(el)
|
|
2065
|
+
},
|
|
2066
|
+
})
|
|
2067
|
+
}
|
|
2068
|
+
|
|
2069
|
+
export const ${factoryName} = createJsxFactory()
|
|
2070
|
+
`
|
|
2071
|
+
};
|
|
2072
|
+
}
|
|
2073
|
+
|
|
2074
|
+
// src/artifacts/solid-jsx/types.string-literal.ts
|
|
2075
|
+
var import_outdent31 = require("outdent");
|
|
2076
|
+
function generateSolidJsxStringLiteralTypes(ctx) {
|
|
2077
|
+
const { factoryName, componentName, upperName, typeName } = ctx.jsx;
|
|
2078
|
+
return {
|
|
2079
|
+
jsxFactory: import_outdent31.outdent`
|
|
2080
|
+
import type { ${upperName} } from '../types/jsx'
|
|
2081
|
+
export declare const ${factoryName}: ${upperName}
|
|
2082
|
+
`,
|
|
2083
|
+
jsxType: import_outdent31.outdent`
|
|
2084
|
+
import type { Component, ComponentProps, JSX } from 'solid-js'
|
|
2085
|
+
|
|
2086
|
+
type Dict = Record<string, unknown>
|
|
2087
|
+
|
|
2088
|
+
type ElementType<P = any> = keyof JSX.IntrinsicElements | Component<P>
|
|
2089
|
+
|
|
2090
|
+
export type ${componentName}<T extends ElementType> = {
|
|
2091
|
+
(args: { raw: readonly string[] | ArrayLike<string> }): (props: ComponentProps<T>) => JSX.Element
|
|
2092
|
+
displayName?: string
|
|
2093
|
+
}
|
|
2094
|
+
|
|
2095
|
+
interface JsxFactory {
|
|
2096
|
+
<T extends ElementType>(component: T): ${componentName}<T>
|
|
2097
|
+
}
|
|
2098
|
+
|
|
2099
|
+
type JsxElements = { [K in keyof JSX.IntrinsicElements]: ${componentName}<K> }
|
|
2100
|
+
|
|
2101
|
+
export type Styled = JsxFactory & JsxElements
|
|
2102
|
+
|
|
2103
|
+
export type ${typeName}<T extends ElementType> = ComponentProps<T>
|
|
2104
|
+
`
|
|
2105
|
+
};
|
|
2106
|
+
}
|
|
2107
|
+
|
|
1684
2108
|
// src/artifacts/vue-jsx/jsx.ts
|
|
1685
|
-
var
|
|
2109
|
+
var import_outdent32 = require("outdent");
|
|
1686
2110
|
function generateVueJsxFactory(ctx) {
|
|
1687
2111
|
const { factoryName } = ctx.jsx;
|
|
1688
2112
|
return {
|
|
1689
|
-
js:
|
|
2113
|
+
js: import_outdent32.outdent`
|
|
1690
2114
|
import { defineComponent, h, computed } from 'vue'
|
|
1691
2115
|
${ctx.file.import("css, cx, cva, assignCss", "../css/index")}
|
|
1692
2116
|
${ctx.file.import("splitProps, normalizeHTMLProps", "../helpers")}
|
|
@@ -1759,8 +2183,62 @@ function generateVueJsxFactory(ctx) {
|
|
|
1759
2183
|
};
|
|
1760
2184
|
}
|
|
1761
2185
|
|
|
2186
|
+
// src/artifacts/vue-jsx/jsx.string-literal.ts
|
|
2187
|
+
var import_outdent33 = require("outdent");
|
|
2188
|
+
function generateVueJsxStringLiteralFactory(ctx) {
|
|
2189
|
+
const { factoryName } = ctx.jsx;
|
|
2190
|
+
return {
|
|
2191
|
+
js: import_outdent33.outdent`
|
|
2192
|
+
import { defineComponent, h, computed } from 'vue'
|
|
2193
|
+
${ctx.file.import("css, cx", "../css/index")}
|
|
2194
|
+
|
|
2195
|
+
function createStyled(Dynamic) {
|
|
2196
|
+
function styledFn(template) {
|
|
2197
|
+
const baseClassName = css(template)
|
|
2198
|
+
return defineComponent({
|
|
2199
|
+
name: \`${factoryName}.\${Dynamic}\`,
|
|
2200
|
+
inheritAttrs: false,
|
|
2201
|
+
props: { as: { type: [String, Object], default: Dynamic } },
|
|
2202
|
+
setup(props, { slots, attrs }) {
|
|
2203
|
+
const classes = computed(() => cx(baseClassName, elementProps.className))
|
|
2204
|
+
return () => {
|
|
2205
|
+
return h(
|
|
2206
|
+
props.as,
|
|
2207
|
+
{
|
|
2208
|
+
class: classes.value,
|
|
2209
|
+
...elementProps,
|
|
2210
|
+
},
|
|
2211
|
+
slots.default && slots.default(),
|
|
2212
|
+
)
|
|
2213
|
+
}
|
|
2214
|
+
},
|
|
2215
|
+
})
|
|
2216
|
+
}
|
|
2217
|
+
}
|
|
2218
|
+
|
|
2219
|
+
function createJsxFactory() {
|
|
2220
|
+
const cache = new Map()
|
|
2221
|
+
|
|
2222
|
+
return new Proxy(createStyled, {
|
|
2223
|
+
apply(_, __, args) {
|
|
2224
|
+
return createStyled(...args)
|
|
2225
|
+
},
|
|
2226
|
+
get(_, el) {
|
|
2227
|
+
if (!cache.has(el)) {
|
|
2228
|
+
cache.set(el, createStyled(el))
|
|
2229
|
+
}
|
|
2230
|
+
return cache.get(el)
|
|
2231
|
+
},
|
|
2232
|
+
})
|
|
2233
|
+
}
|
|
2234
|
+
|
|
2235
|
+
export const ${factoryName} = createJsxFactory()
|
|
2236
|
+
`
|
|
2237
|
+
};
|
|
2238
|
+
}
|
|
2239
|
+
|
|
1762
2240
|
// src/artifacts/vue-jsx/pattern.ts
|
|
1763
|
-
var
|
|
2241
|
+
var import_outdent34 = require("outdent");
|
|
1764
2242
|
function generateVueJsxPattern(ctx) {
|
|
1765
2243
|
const { typeName, factoryName } = ctx.jsx;
|
|
1766
2244
|
return ctx.patterns.details.map((pattern) => {
|
|
@@ -1769,7 +2247,7 @@ function generateVueJsxPattern(ctx) {
|
|
|
1769
2247
|
const propList = props.map((v) => JSON.stringify(v)).join(", ");
|
|
1770
2248
|
return {
|
|
1771
2249
|
name: dashName,
|
|
1772
|
-
js:
|
|
2250
|
+
js: import_outdent34.outdent`
|
|
1773
2251
|
import { defineComponent, h, computed } from 'vue'
|
|
1774
2252
|
${ctx.file.import(factoryName, "./factory")}
|
|
1775
2253
|
${ctx.file.import(styleFnName, `../patterns/${dashName}`)}
|
|
@@ -1787,7 +2265,7 @@ function generateVueJsxPattern(ctx) {
|
|
|
1787
2265
|
}
|
|
1788
2266
|
})
|
|
1789
2267
|
`,
|
|
1790
|
-
dts:
|
|
2268
|
+
dts: import_outdent34.outdent`
|
|
1791
2269
|
import { FunctionalComponent } from 'vue'
|
|
1792
2270
|
import { ${upperName}Properties } from '../patterns/${dashName}'
|
|
1793
2271
|
import { ${typeName} } from '../types/jsx'
|
|
@@ -1802,15 +2280,15 @@ function generateVueJsxPattern(ctx) {
|
|
|
1802
2280
|
}
|
|
1803
2281
|
|
|
1804
2282
|
// src/artifacts/vue-jsx/types.ts
|
|
1805
|
-
var
|
|
2283
|
+
var import_outdent35 = require("outdent");
|
|
1806
2284
|
function generateVueJsxTypes(ctx) {
|
|
1807
2285
|
const { factoryName, componentName, upperName, typeName } = ctx.jsx;
|
|
1808
2286
|
return {
|
|
1809
|
-
jsxFactory:
|
|
2287
|
+
jsxFactory: import_outdent35.outdent`
|
|
1810
2288
|
import { ${upperName} } from '../types/jsx'
|
|
1811
2289
|
export declare const ${factoryName}: ${upperName}
|
|
1812
2290
|
`,
|
|
1813
|
-
jsxType:
|
|
2291
|
+
jsxType: import_outdent35.outdent`
|
|
1814
2292
|
import type { Component, FunctionalComponent } from 'vue'
|
|
1815
2293
|
import type { Assign, JsxStyleProps, JsxHTMLProps } from './system-types'
|
|
1816
2294
|
import type { RecipeDefinition, RecipeSelection, RecipeVariantRecord } from './recipe'
|
|
@@ -1966,6 +2444,161 @@ type IntrinsicElement =
|
|
|
1966
2444
|
};
|
|
1967
2445
|
}
|
|
1968
2446
|
|
|
2447
|
+
// src/artifacts/vue-jsx/types.string-literal.ts
|
|
2448
|
+
var import_outdent36 = require("outdent");
|
|
2449
|
+
function generateVueJsxStringLiteralTypes(ctx) {
|
|
2450
|
+
const { factoryName, componentName, upperName, typeName } = ctx.jsx;
|
|
2451
|
+
return {
|
|
2452
|
+
jsxFactory: import_outdent36.outdent`
|
|
2453
|
+
import { ${upperName} } from '../types/jsx'
|
|
2454
|
+
export declare const ${factoryName}: ${upperName}
|
|
2455
|
+
`,
|
|
2456
|
+
jsxType: import_outdent36.outdent`
|
|
2457
|
+
import type { Component, FunctionalComponent } from 'vue'
|
|
2458
|
+
|
|
2459
|
+
type IntrinsicElement =
|
|
2460
|
+
| 'a'
|
|
2461
|
+
| 'abbr'
|
|
2462
|
+
| 'address'
|
|
2463
|
+
| 'area'
|
|
2464
|
+
| 'article'
|
|
2465
|
+
| 'aside'
|
|
2466
|
+
| 'audio'
|
|
2467
|
+
| 'b'
|
|
2468
|
+
| 'base'
|
|
2469
|
+
| 'bdi'
|
|
2470
|
+
| 'bdo'
|
|
2471
|
+
| 'blockquote'
|
|
2472
|
+
| 'body'
|
|
2473
|
+
| 'br'
|
|
2474
|
+
| 'button'
|
|
2475
|
+
| 'canvas'
|
|
2476
|
+
| 'caption'
|
|
2477
|
+
| 'cite'
|
|
2478
|
+
| 'code'
|
|
2479
|
+
| 'col'
|
|
2480
|
+
| 'colgroup'
|
|
2481
|
+
| 'data'
|
|
2482
|
+
| 'datalist'
|
|
2483
|
+
| 'dd'
|
|
2484
|
+
| 'del'
|
|
2485
|
+
| 'details'
|
|
2486
|
+
| 'dfn'
|
|
2487
|
+
| 'dialog'
|
|
2488
|
+
| 'div'
|
|
2489
|
+
| 'dl'
|
|
2490
|
+
| 'dt'
|
|
2491
|
+
| 'em'
|
|
2492
|
+
| 'embed'
|
|
2493
|
+
| 'fieldset'
|
|
2494
|
+
| 'figcaption'
|
|
2495
|
+
| 'figure'
|
|
2496
|
+
| 'footer'
|
|
2497
|
+
| 'form'
|
|
2498
|
+
| 'h1'
|
|
2499
|
+
| 'h2'
|
|
2500
|
+
| 'h3'
|
|
2501
|
+
| 'h4'
|
|
2502
|
+
| 'h5'
|
|
2503
|
+
| 'h6'
|
|
2504
|
+
| 'head'
|
|
2505
|
+
| 'header'
|
|
2506
|
+
| 'hgroup'
|
|
2507
|
+
| 'hr'
|
|
2508
|
+
| 'html'
|
|
2509
|
+
| 'i'
|
|
2510
|
+
| 'iframe'
|
|
2511
|
+
| 'img'
|
|
2512
|
+
| 'input'
|
|
2513
|
+
| 'ins'
|
|
2514
|
+
| 'kbd'
|
|
2515
|
+
| 'label'
|
|
2516
|
+
| 'legend'
|
|
2517
|
+
| 'li'
|
|
2518
|
+
| 'link'
|
|
2519
|
+
| 'main'
|
|
2520
|
+
| 'map'
|
|
2521
|
+
| 'mark'
|
|
2522
|
+
| 'math'
|
|
2523
|
+
| 'menu'
|
|
2524
|
+
| 'menuitem'
|
|
2525
|
+
| 'meta'
|
|
2526
|
+
| 'meter'
|
|
2527
|
+
| 'nav'
|
|
2528
|
+
| 'noscript'
|
|
2529
|
+
| 'object'
|
|
2530
|
+
| 'ol'
|
|
2531
|
+
| 'optgroup'
|
|
2532
|
+
| 'option'
|
|
2533
|
+
| 'output'
|
|
2534
|
+
| 'p'
|
|
2535
|
+
| 'param'
|
|
2536
|
+
| 'picture'
|
|
2537
|
+
| 'pre'
|
|
2538
|
+
| 'progress'
|
|
2539
|
+
| 'q'
|
|
2540
|
+
| 'rb'
|
|
2541
|
+
| 'rp'
|
|
2542
|
+
| 'rt'
|
|
2543
|
+
| 'rtc'
|
|
2544
|
+
| 'ruby'
|
|
2545
|
+
| 's'
|
|
2546
|
+
| 'samp'
|
|
2547
|
+
| 'script'
|
|
2548
|
+
| 'section'
|
|
2549
|
+
| 'select'
|
|
2550
|
+
| 'slot'
|
|
2551
|
+
| 'small'
|
|
2552
|
+
| 'source'
|
|
2553
|
+
| 'span'
|
|
2554
|
+
| 'strong'
|
|
2555
|
+
| 'style'
|
|
2556
|
+
| 'sub'
|
|
2557
|
+
| 'summary'
|
|
2558
|
+
| 'sup'
|
|
2559
|
+
| 'svg'
|
|
2560
|
+
| 'table'
|
|
2561
|
+
| 'tbody'
|
|
2562
|
+
| 'td'
|
|
2563
|
+
| 'template'
|
|
2564
|
+
| 'textarea'
|
|
2565
|
+
| 'tfoot'
|
|
2566
|
+
| 'th'
|
|
2567
|
+
| 'thead'
|
|
2568
|
+
| 'time'
|
|
2569
|
+
| 'title'
|
|
2570
|
+
| 'tr'
|
|
2571
|
+
| 'track'
|
|
2572
|
+
| 'u'
|
|
2573
|
+
| 'ul'
|
|
2574
|
+
| 'var'
|
|
2575
|
+
| 'video'
|
|
2576
|
+
| 'wbr'
|
|
2577
|
+
|
|
2578
|
+
type ElementType = IntrinsicElement | Component
|
|
2579
|
+
|
|
2580
|
+
type ComponentProps<T extends ElementType> = T extends keyof JSX.IntrinsicElements
|
|
2581
|
+
? JSX.IntrinsicElements[T]
|
|
2582
|
+
: T extends Component<infer Props>
|
|
2583
|
+
? Props
|
|
2584
|
+
: never
|
|
2585
|
+
|
|
2586
|
+
type ${componentName}<T extends ElementType> = FunctionalComponent<ComponentProps<T>>
|
|
2587
|
+
>
|
|
2588
|
+
|
|
2589
|
+
interface JsxFactory {
|
|
2590
|
+
<T extends ElementType>(component: T): ${componentName}<T>
|
|
2591
|
+
}
|
|
2592
|
+
|
|
2593
|
+
type JsxElements = { [K in keyof JSX.IntrinsicElements]: ${componentName}<K> }
|
|
2594
|
+
|
|
2595
|
+
export type ${upperName} = JsxFactory & JsxElements
|
|
2596
|
+
|
|
2597
|
+
export type ${typeName}<T extends ElementType> = ComponentProps<T>
|
|
2598
|
+
`
|
|
2599
|
+
};
|
|
2600
|
+
}
|
|
2601
|
+
|
|
1969
2602
|
// src/artifacts/jsx.ts
|
|
1970
2603
|
var typesMap = {
|
|
1971
2604
|
react: generateReactJsxTypes,
|
|
@@ -1974,10 +2607,18 @@ var typesMap = {
|
|
|
1974
2607
|
vue: generateVueJsxTypes,
|
|
1975
2608
|
qwik: generateQwikJsxTypes
|
|
1976
2609
|
};
|
|
2610
|
+
var typesStringLiteralMap = {
|
|
2611
|
+
react: generateSolidJsxStringLiteralTypes,
|
|
2612
|
+
solid: generateReactJsxStringLiteralTypes,
|
|
2613
|
+
qwik: generateQwikJsxStringLiteralTypes,
|
|
2614
|
+
preact: generatePreactJsxStringLiteralTypes,
|
|
2615
|
+
vue: generateVueJsxStringLiteralTypes
|
|
2616
|
+
};
|
|
1977
2617
|
function generateJsxTypes(ctx) {
|
|
1978
2618
|
if (!ctx.jsx.framework)
|
|
1979
2619
|
return;
|
|
1980
|
-
|
|
2620
|
+
const type = ctx.isTemplateLiteralSyntax ? typesStringLiteralMap[ctx.jsx.framework] : typesMap[ctx.jsx.framework];
|
|
2621
|
+
return type?.(ctx);
|
|
1981
2622
|
}
|
|
1982
2623
|
var factoryMap = {
|
|
1983
2624
|
react: generateReactJsxFactory,
|
|
@@ -1986,10 +2627,18 @@ var factoryMap = {
|
|
|
1986
2627
|
vue: generateVueJsxFactory,
|
|
1987
2628
|
qwik: generateQwikJsxFactory
|
|
1988
2629
|
};
|
|
2630
|
+
var factoryStringLiteralMap = {
|
|
2631
|
+
react: generateReactJsxStringLiteralFactory,
|
|
2632
|
+
solid: generateSolidJsxStringLiteralFactory,
|
|
2633
|
+
qwik: generateQwikJsxStringLiteralFactory,
|
|
2634
|
+
preact: generatePreactJsxStringLiteralFactory,
|
|
2635
|
+
vue: generateVueJsxStringLiteralFactory
|
|
2636
|
+
};
|
|
1989
2637
|
function generateJsxFactory(ctx) {
|
|
1990
2638
|
if (!ctx.jsx.framework)
|
|
1991
2639
|
return;
|
|
1992
|
-
|
|
2640
|
+
const factory = ctx.isTemplateLiteralSyntax ? factoryStringLiteralMap[ctx.jsx.framework] : factoryMap[ctx.jsx.framework];
|
|
2641
|
+
return factory?.(ctx);
|
|
1993
2642
|
}
|
|
1994
2643
|
var patternMap = {
|
|
1995
2644
|
react: generateReactJsxPattern,
|
|
@@ -1999,6 +2648,8 @@ var patternMap = {
|
|
|
1999
2648
|
qwik: generateQwikJsxPattern
|
|
2000
2649
|
};
|
|
2001
2650
|
function generateJsxPatterns(ctx) {
|
|
2651
|
+
if (ctx.isTemplateLiteralSyntax)
|
|
2652
|
+
return [];
|
|
2002
2653
|
if (ctx.patterns.isEmpty() && !ctx.jsx.framework)
|
|
2003
2654
|
return [];
|
|
2004
2655
|
return patternMap[ctx.jsx.framework](ctx);
|
|
@@ -2066,7 +2717,7 @@ var recipe_d_ts_default = {
|
|
|
2066
2717
|
|
|
2067
2718
|
// src/artifacts/generated/pattern.d.ts.json
|
|
2068
2719
|
var pattern_d_ts_default = {
|
|
2069
|
-
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
|
|
2720
|
+
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"
|
|
2070
2721
|
};
|
|
2071
2722
|
|
|
2072
2723
|
// src/artifacts/generated/parts.d.ts.json
|
|
@@ -2093,9 +2744,9 @@ function getGeneratedTypes() {
|
|
|
2093
2744
|
}
|
|
2094
2745
|
|
|
2095
2746
|
// src/artifacts/types/main.ts
|
|
2096
|
-
var
|
|
2747
|
+
var import_outdent37 = require("outdent");
|
|
2097
2748
|
var generateTypesEntry = () => ({
|
|
2098
|
-
global:
|
|
2749
|
+
global: import_outdent37.outdent`
|
|
2099
2750
|
import type { RecipeVariantRecord, RecipeConfig } from './recipe'
|
|
2100
2751
|
import type { Parts } from './parts'
|
|
2101
2752
|
import type { PatternConfig } from './pattern'
|
|
@@ -2112,19 +2763,19 @@ var generateTypesEntry = () => ({
|
|
|
2112
2763
|
export function defineParts<T extends Parts>(parts: T): (config: Partial<Record<keyof T, SystemStyleObject>>) => Partial<Record<keyof T, SystemStyleObject>>;
|
|
2113
2764
|
}
|
|
2114
2765
|
`,
|
|
2115
|
-
index:
|
|
2766
|
+
index: import_outdent37.outdent`
|
|
2116
2767
|
import './global'
|
|
2117
2768
|
export type { ConditionalValue } from './conditions'
|
|
2118
2769
|
export type { GlobalStyleObject, JsxStyleProps, SystemStyleObject } from './system-types'
|
|
2119
2770
|
|
|
2120
2771
|
`,
|
|
2121
|
-
helpers:
|
|
2772
|
+
helpers: import_outdent37.outdent`
|
|
2122
2773
|
export type Pretty<T> = T extends infer U ? { [K in keyof U]: U[K] } : never
|
|
2123
2774
|
`
|
|
2124
2775
|
});
|
|
2125
2776
|
|
|
2126
2777
|
// src/artifacts/types/prop-types.ts
|
|
2127
|
-
var
|
|
2778
|
+
var import_outdent38 = require("outdent");
|
|
2128
2779
|
function generatePropTypes(ctx) {
|
|
2129
2780
|
const {
|
|
2130
2781
|
config: { strictTokens },
|
|
@@ -2132,7 +2783,7 @@ function generatePropTypes(ctx) {
|
|
|
2132
2783
|
} = ctx;
|
|
2133
2784
|
const strictText = `${strictTokens ? "" : " | CssValue<T>"}`;
|
|
2134
2785
|
const result = [
|
|
2135
|
-
|
|
2786
|
+
import_outdent38.outdent`
|
|
2136
2787
|
import type { ConditionalValue } from './conditions';
|
|
2137
2788
|
import type { CssProperties } from './system-types'
|
|
2138
2789
|
import type { Tokens } from '../tokens'
|
|
@@ -2155,7 +2806,7 @@ function generatePropTypes(ctx) {
|
|
|
2155
2806
|
result.push(` ${key}: Shorthand<${JSON.stringify(value)}>;`);
|
|
2156
2807
|
});
|
|
2157
2808
|
result.push("}");
|
|
2158
|
-
return
|
|
2809
|
+
return import_outdent38.outdent`
|
|
2159
2810
|
${result.join("\n")}
|
|
2160
2811
|
|
|
2161
2812
|
export type PropertyValue<T extends string> = T extends keyof PropertyTypes
|
|
@@ -2168,10 +2819,10 @@ function generatePropTypes(ctx) {
|
|
|
2168
2819
|
|
|
2169
2820
|
// src/artifacts/types/style-props.ts
|
|
2170
2821
|
var import_is_valid_prop = require("@pandacss/is-valid-prop");
|
|
2171
|
-
var
|
|
2822
|
+
var import_outdent39 = __toESM(require("outdent"));
|
|
2172
2823
|
function generateStyleProps(ctx) {
|
|
2173
2824
|
const props = new Set(import_is_valid_prop.allCssProperties.concat(ctx.utility.keys()));
|
|
2174
|
-
return
|
|
2825
|
+
return import_outdent39.default`
|
|
2175
2826
|
import type { ConditionalValue } from './conditions'
|
|
2176
2827
|
import type { PropertyValue } from './prop-type'
|
|
2177
2828
|
import type { Token } from '../tokens'
|
|
@@ -2188,7 +2839,7 @@ function generateStyleProps(ctx) {
|
|
|
2188
2839
|
|
|
2189
2840
|
// src/artifacts/types/token-types.ts
|
|
2190
2841
|
var import_shared3 = require("@pandacss/shared");
|
|
2191
|
-
var
|
|
2842
|
+
var import_outdent40 = require("outdent");
|
|
2192
2843
|
var import_pluralize = __toESM(require("pluralize"));
|
|
2193
2844
|
var categories = [
|
|
2194
2845
|
"zIndex",
|
|
@@ -2233,7 +2884,7 @@ function generateTokenTypes(ctx) {
|
|
|
2233
2884
|
result.add("} & { [token: string]: never }");
|
|
2234
2885
|
set.add(Array.from(result).join("\n"));
|
|
2235
2886
|
set.add(`export type TokenCategory = ${(0, import_shared3.unionType)(categories)}`);
|
|
2236
|
-
return
|
|
2887
|
+
return import_outdent40.outdent.string(Array.from(set).join("\n\n"));
|
|
2237
2888
|
}
|
|
2238
2889
|
|
|
2239
2890
|
// src/artifacts/index.ts
|
|
@@ -2291,8 +2942,8 @@ function setupTypes(ctx) {
|
|
|
2291
2942
|
};
|
|
2292
2943
|
}
|
|
2293
2944
|
function setupCss(ctx) {
|
|
2294
|
-
const code = generateCssFn(ctx);
|
|
2295
|
-
const conditions = generateConditions(ctx);
|
|
2945
|
+
const code = ctx.isTemplateLiteralSyntax ? generateStringLiteralCssFn(ctx) : generateCssFn(ctx);
|
|
2946
|
+
const conditions = ctx.isTemplateLiteralSyntax ? generateStringLiteralConditions(ctx) : generateConditions(ctx);
|
|
2296
2947
|
return {
|
|
2297
2948
|
dir: ctx.paths.css,
|
|
2298
2949
|
files: [
|
|
@@ -2303,6 +2954,8 @@ function setupCss(ctx) {
|
|
|
2303
2954
|
};
|
|
2304
2955
|
}
|
|
2305
2956
|
function setupCva(ctx) {
|
|
2957
|
+
if (ctx.isTemplateLiteralSyntax)
|
|
2958
|
+
return;
|
|
2306
2959
|
const code = generateCvaFn(ctx);
|
|
2307
2960
|
return {
|
|
2308
2961
|
dir: ctx.paths.css,
|
|
@@ -2328,8 +2981,8 @@ function setupRecipes(ctx) {
|
|
|
2328
2981
|
return;
|
|
2329
2982
|
const indexFiles = files.filter((file) => !file.name.includes("create-recipe"));
|
|
2330
2983
|
const index = {
|
|
2331
|
-
js:
|
|
2332
|
-
dts:
|
|
2984
|
+
js: import_outdent41.default.string(indexFiles.map((file) => ctx.file.export(`./${file.name}`)).join("\n")),
|
|
2985
|
+
dts: import_outdent41.default.string(indexFiles.map((file) => `export * from './${file.name}'`).join("\n"))
|
|
2333
2986
|
};
|
|
2334
2987
|
return {
|
|
2335
2988
|
dir: ctx.paths.recipe,
|
|
@@ -2342,12 +2995,14 @@ function setupRecipes(ctx) {
|
|
|
2342
2995
|
};
|
|
2343
2996
|
}
|
|
2344
2997
|
function setupPatterns(ctx) {
|
|
2998
|
+
if (ctx.isTemplateLiteralSyntax)
|
|
2999
|
+
return;
|
|
2345
3000
|
const files = generatePattern(ctx);
|
|
2346
3001
|
if (!files)
|
|
2347
3002
|
return;
|
|
2348
3003
|
const index = {
|
|
2349
|
-
js:
|
|
2350
|
-
dts:
|
|
3004
|
+
js: import_outdent41.default.string(files.map((file) => ctx.file.export(`./${file.name}`)).join("\n")),
|
|
3005
|
+
dts: import_outdent41.default.string(files.map((file) => `export * from './${file.name}'`).join("\n"))
|
|
2351
3006
|
};
|
|
2352
3007
|
return {
|
|
2353
3008
|
dir: ctx.paths.pattern,
|
|
@@ -2367,13 +3022,13 @@ function setupJsx(ctx) {
|
|
|
2367
3022
|
const factory = generateJsxFactory(ctx);
|
|
2368
3023
|
const patterns = generateJsxPatterns(ctx);
|
|
2369
3024
|
const index = {
|
|
2370
|
-
js:
|
|
3025
|
+
js: import_outdent41.default`
|
|
2371
3026
|
${ctx.file.export("./factory")}
|
|
2372
|
-
${
|
|
3027
|
+
${import_outdent41.default.string(patterns.map((file) => ctx.file.export(`./${file.name}`)).join("\n"))}
|
|
2373
3028
|
`,
|
|
2374
|
-
dts:
|
|
3029
|
+
dts: import_outdent41.default`
|
|
2375
3030
|
export * from './factory'
|
|
2376
|
-
${
|
|
3031
|
+
${import_outdent41.default.string(patterns.map((file) => `export * from './${file.name}'`).join("\n"))}
|
|
2377
3032
|
export type { ${ctx.jsx.typeName} } from '../types/jsx'
|
|
2378
3033
|
`
|
|
2379
3034
|
};
|
|
@@ -2382,7 +3037,7 @@ function setupJsx(ctx) {
|
|
|
2382
3037
|
files: [
|
|
2383
3038
|
...patterns.map((file) => ({ file: ctx.file.ext(file.name), code: file.js })),
|
|
2384
3039
|
...patterns.map((file) => ({ file: `${file.name}.d.ts`, code: file.dts })),
|
|
2385
|
-
{ file: ctx.file.ext("is-valid-prop"), code: isValidProp
|
|
3040
|
+
{ file: ctx.file.ext("is-valid-prop"), code: isValidProp?.js },
|
|
2386
3041
|
{ file: "factory.d.ts", code: types.jsxFactory },
|
|
2387
3042
|
{ file: ctx.file.ext("factory"), code: factory?.js },
|
|
2388
3043
|
{ file: "index.d.ts", code: index.dts },
|
|
@@ -2392,15 +3047,15 @@ function setupJsx(ctx) {
|
|
|
2392
3047
|
}
|
|
2393
3048
|
function setupCssIndex(ctx) {
|
|
2394
3049
|
const index = {
|
|
2395
|
-
js:
|
|
3050
|
+
js: import_outdent41.default`
|
|
2396
3051
|
${ctx.file.export("./css")}
|
|
2397
3052
|
${ctx.file.export("./cx")}
|
|
2398
|
-
${ctx.file.export("./cva")}
|
|
3053
|
+
${ctx.isTemplateLiteralSyntax ? "" : ctx.file.export("./cva")}
|
|
2399
3054
|
`,
|
|
2400
|
-
dts:
|
|
3055
|
+
dts: import_outdent41.default`
|
|
2401
3056
|
export * from './css'
|
|
2402
3057
|
export * from './cx'
|
|
2403
|
-
export * from './cva'
|
|
3058
|
+
${ctx.isTemplateLiteralSyntax ? "" : `export * from './cva'`}
|
|
2404
3059
|
`
|
|
2405
3060
|
};
|
|
2406
3061
|
return {
|
|
@@ -2582,6 +3237,7 @@ var helpers = {
|
|
|
2582
3237
|
var getBaseEngine = (conf) => {
|
|
2583
3238
|
const { config } = conf;
|
|
2584
3239
|
const theme = config.theme ?? {};
|
|
3240
|
+
const isTemplateLiteralSyntax = config.syntax === "template-literal";
|
|
2585
3241
|
const hash = {
|
|
2586
3242
|
tokens: (0, import_lil_fp.isBool)(config.hash) ? config.hash : config.hash?.cssVar,
|
|
2587
3243
|
className: (0, import_lil_fp.isBool)(config.hash) ? config.hash : config.hash?.className
|
|
@@ -2600,12 +3256,12 @@ var getBaseEngine = (conf) => {
|
|
|
2600
3256
|
const utility = new import_core4.Utility({
|
|
2601
3257
|
prefix: prefix.className,
|
|
2602
3258
|
tokens,
|
|
2603
|
-
config: config.utilities,
|
|
3259
|
+
config: isTemplateLiteralSyntax ? {} : config.utilities,
|
|
2604
3260
|
separator: config.separator,
|
|
2605
3261
|
shorthands: config.shorthands
|
|
2606
3262
|
});
|
|
2607
3263
|
const conditions = new import_core4.Conditions({
|
|
2608
|
-
conditions: config.conditions,
|
|
3264
|
+
conditions: isTemplateLiteralSyntax ? {} : config.conditions,
|
|
2609
3265
|
breakpoints: config.theme?.breakpoints
|
|
2610
3266
|
});
|
|
2611
3267
|
const { textStyles, layerStyles } = theme;
|
|
@@ -2643,6 +3299,7 @@ var getBaseEngine = (conf) => {
|
|
|
2643
3299
|
};
|
|
2644
3300
|
return {
|
|
2645
3301
|
...conf,
|
|
3302
|
+
isTemplateLiteralSyntax,
|
|
2646
3303
|
studio,
|
|
2647
3304
|
hash,
|
|
2648
3305
|
prefix,
|
|
@@ -2724,7 +3381,7 @@ var getPatternEngine = (config) => {
|
|
|
2724
3381
|
return Object.entries(patterns).map(([name, pattern]) => ({
|
|
2725
3382
|
type: "pattern",
|
|
2726
3383
|
name: pattern.jsx ?? (0, import_shared7.capitalize)(name),
|
|
2727
|
-
props: Object.keys(pattern
|
|
3384
|
+
props: Object.keys(pattern?.properties ?? {}),
|
|
2728
3385
|
baseName: name
|
|
2729
3386
|
}));
|
|
2730
3387
|
}),
|
|
@@ -2764,6 +3421,7 @@ var defaults = (conf) => ({
|
|
|
2764
3421
|
jsxFactory: "styled",
|
|
2765
3422
|
outExtension: "mjs",
|
|
2766
3423
|
shorthands: true,
|
|
3424
|
+
syntax: "object-literal",
|
|
2767
3425
|
...conf.config
|
|
2768
3426
|
}
|
|
2769
3427
|
});
|