@pandacss/generator 0.4.0 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -66,14 +66,14 @@ 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`
73
73
  ${tick} ${(0, import_logger.quote)(outdir, "/recipes")}: functions to create multi-variant styles
74
74
  `,
75
75
  jsx.framework && import_outdent.outdent`
76
- ${tick} ${(0, import_logger.quote)(outdir, "/jsx")}: style prop powered elements for ${jsx.framework}
76
+ ${tick} ${(0, import_logger.quote)(outdir, "/jsx")}: styled jsx elements for ${jsx.framework}
77
77
  `,
78
78
  "\n"
79
79
  ].filter(Boolean).join("\n");
@@ -128,12 +128,9 @@ var getMessages = (ctx) => ({
128
128
  configWatch
129
129
  });
130
130
 
131
- // src/generator.ts
132
- var import_lil_fp3 = require("lil-fp");
133
-
134
131
  // src/artifacts/index.ts
135
132
  var import_shared4 = require("@pandacss/shared");
136
- var import_outdent29 = __toESM(require("outdent"));
133
+ var import_outdent41 = __toESM(require("outdent"));
137
134
 
138
135
  // src/artifacts/css/global-css.ts
139
136
  var generateGlobalCss = (ctx) => {
@@ -415,7 +412,7 @@ var generateStaticCss = (ctx) => {
415
412
  const fn = (0, import_core2.getStaticCss)(staticCss);
416
413
  const results = fn({
417
414
  breakpoints: Object.keys(theme.breakpoints ?? {}),
418
- getPropertyKeys: utility.getPropertyKeys,
415
+ getPropertyKeys: (prop) => utility.getPropertyKeys(prop).filter((key) => !key.startsWith("type:") && !key.startsWith("CssProperties:")),
419
416
  getRecipeKeys: (recipe) => recipes.details.find((detail) => detail.config.name === recipe)?.variantKeyMap ?? {}
420
417
  });
421
418
  results.css.forEach((css2) => {
@@ -577,8 +574,39 @@ function generateConditions(ctx) {
577
574
  };
578
575
  }
579
576
 
577
+ // src/artifacts/js/conditions.string-literal.ts
578
+ var import_outdent3 = __toESM(require("outdent"));
579
+ function generateStringLiteralConditions(ctx) {
580
+ return {
581
+ js: import_outdent3.default`
582
+ ${ctx.file.import("withoutSpace", "../helpers")}
583
+
584
+ export const isCondition = (val) => condRegex.test(val)
585
+
586
+ const condRegex = /^@|&|&$/
587
+ const selectorRegex = /&|@/
588
+
589
+ export const finalizeConditions = (paths) => {
590
+ return paths.map((path) => (selectorRegex.test(path) ? \`[\${withoutSpace(path.trim())}]\` : path))
591
+ }
592
+
593
+ export function sortConditions(paths){
594
+ return paths.sort((a, b) => {
595
+ const aa = isCondition(a)
596
+ const bb = isCondition(b)
597
+ if (aa && !bb) return 1
598
+ if (!aa && bb) return -1
599
+ return 0
600
+ })
601
+ }
602
+ `,
603
+ dts: import_outdent3.default`
604
+ `
605
+ };
606
+ }
607
+
580
608
  // src/artifacts/js/css-fn.ts
581
- var import_outdent3 = require("outdent");
609
+ var import_outdent4 = require("outdent");
582
610
  var stringify = (v) => JSON.stringify(Object.fromEntries(v), null, 2);
583
611
  function generateCssFn(ctx) {
584
612
  const {
@@ -588,11 +616,11 @@ function generateCssFn(ctx) {
588
616
  } = ctx;
589
617
  const { separator } = utility;
590
618
  return {
591
- dts: import_outdent3.outdent`
619
+ dts: import_outdent4.outdent`
592
620
  import type { SystemStyleObject } from '../types'
593
621
  export declare function css(styles: SystemStyleObject): string
594
622
  `,
595
- js: import_outdent3.outdent`
623
+ js: import_outdent4.outdent`
596
624
  ${ctx.file.import("createCss, createMergeCss, hypenateProperty, withoutSpace", "../helpers")}
597
625
  ${ctx.file.import("sortConditions, finalizeConditions", "./conditions")}
598
626
 
@@ -635,11 +663,58 @@ function generateCssFn(ctx) {
635
663
  };
636
664
  }
637
665
 
666
+ // src/artifacts/js/css-fn.string-literal.ts
667
+ var import_outdent5 = require("outdent");
668
+ function generateStringLiteralCssFn(ctx) {
669
+ const {
670
+ utility,
671
+ config: { hash, prefix }
672
+ } = ctx;
673
+ const { separator } = utility;
674
+ return {
675
+ dts: import_outdent5.outdent`
676
+ export declare function css(template: { raw: readonly string[] | ArrayLike<string> }): string
677
+ `,
678
+ js: import_outdent5.outdent`
679
+ ${ctx.file.import("astish, createCss, withoutSpace", "../helpers")}
680
+ ${ctx.file.import("sortConditions, finalizeConditions", "./conditions")}
681
+
682
+ function transform(prop, value) {
683
+ const className = \`$\{prop}${separator}$\{withoutSpace(value)}\`
684
+ return { className }
685
+ }
686
+
687
+ const context = {
688
+ hash: ${hash ? "true" : "false"},
689
+ conditions: {
690
+ shift: sortConditions,
691
+ finalize: finalizeConditions,
692
+ breakpoints: { keys: [] },
693
+ },
694
+ utility: {
695
+ prefix: ${prefix ? JSON.stringify(prefix) : void 0},
696
+ transform,
697
+ hasShorthand: false,
698
+ resolveShorthand(prop) {
699
+ return prop
700
+ },
701
+ }
702
+ }
703
+
704
+ const cssFn = createCss(context)
705
+
706
+ export const css = (str) => {
707
+ return cssFn(astish(str[0]))
708
+ }
709
+ `
710
+ };
711
+ }
712
+
638
713
  // src/artifacts/js/cva.ts
639
- var import_outdent4 = require("outdent");
714
+ var import_outdent6 = require("outdent");
640
715
  function generateCvaFn(ctx) {
641
716
  return {
642
- js: import_outdent4.outdent`
717
+ js: import_outdent6.outdent`
643
718
  ${ctx.file.import("compact, splitProps", "../helpers")}
644
719
  ${ctx.file.import("css, mergeCss", "./css")}
645
720
 
@@ -672,7 +747,7 @@ function generateCvaFn(ctx) {
672
747
 
673
748
  return Object.assign(cvaFn, {
674
749
  __cva__: true,
675
- variants: variantMap,
750
+ variantMap,
676
751
  variantKeys,
677
752
  resolve,
678
753
  config,
@@ -705,7 +780,7 @@ function generateCvaFn(ctx) {
705
780
  }
706
781
 
707
782
  `,
708
- dts: import_outdent4.outdent`
783
+ dts: import_outdent6.outdent`
709
784
  import type { RecipeCreatorFn } from '../types/recipe'
710
785
 
711
786
  export declare const cva: RecipeCreatorFn
@@ -717,10 +792,10 @@ function generateCvaFn(ctx) {
717
792
  }
718
793
 
719
794
  // src/artifacts/js/cx.ts
720
- var import_outdent5 = __toESM(require("outdent"));
795
+ var import_outdent7 = __toESM(require("outdent"));
721
796
  function generateCx() {
722
797
  return {
723
- js: import_outdent5.default`
798
+ js: import_outdent7.default`
724
799
  function cx() {
725
800
  let str = '',
726
801
  i = 0,
@@ -737,7 +812,7 @@ function generateCx() {
737
812
 
738
813
  export { cx }
739
814
  `,
740
- dts: import_outdent5.default`
815
+ dts: import_outdent7.default`
741
816
  type Argument = string | boolean | null | undefined
742
817
 
743
818
  /** Conditionally join classNames into a single string */
@@ -747,17 +822,17 @@ function generateCx() {
747
822
  }
748
823
 
749
824
  // src/artifacts/js/helpers.ts
750
- var import_outdent6 = require("outdent");
825
+ var import_outdent8 = require("outdent");
751
826
 
752
827
  // src/artifacts/generated/helpers.mjs.json
753
828
  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}\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});\nexport {\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'
829
+ content: '// src/assert.ts\nfunction isObject(value) {\n return typeof value === "object" && value != null && !Array.isArray(value);\n}\n\n// src/astish.ts\nvar newRule = /(?:([\\u0080-\\uFFFF\\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\\s*)/g;\nvar ruleClean = /\\/\\*[^]*?\\*\\/|\\s\\s+|\\n/g;\nvar astish = (val, tree = [{}]) => {\n const block = newRule.exec((val ?? "").replace(ruleClean, ""));\n if (!block)\n return tree[0];\n if (block[4])\n tree.shift();\n else if (block[3])\n tree.unshift(tree[0][block[3]] = tree[0][block[3]] || {});\n else\n tree[0][block[1]] = block[2];\n return astish(val, tree);\n};\n\n// src/compact.ts\nfunction compact(value) {\n return Object.fromEntries(Object.entries(value ?? {}).filter(([_, value2]) => value2 !== void 0));\n}\n\n// src/condition.ts\nvar isBaseCondition = (v) => v === "base";\nfunction filterBaseConditions(c) {\n return c.slice().filter((v) => !isBaseCondition(v));\n}\n\n// src/css-important.ts\nvar importantRegex = /!(important)?$/;\nfunction isImportant(value) {\n return typeof value === "string" ? importantRegex.test(value) : false;\n}\nfunction withoutImportant(value) {\n return typeof value === "string" ? value.replace(importantRegex, "").trim() : value;\n}\nfunction withoutSpace(str) {\n return typeof str === "string" ? str.replaceAll(" ", "_") : str;\n}\n\n// src/hash.ts\nfunction toChar(code) {\n return String.fromCharCode(code + (code > 25 ? 39 : 97));\n}\nfunction toName(code) {\n let name = "";\n let x;\n for (x = Math.abs(code); x > 52; x = x / 52 | 0)\n name = toChar(x % 52) + name;\n return toChar(x % 52) + name;\n}\nfunction toPhash(h, x) {\n let i = x.length;\n while (i)\n h = h * 33 ^ x.charCodeAt(--i);\n return h;\n}\nfunction toHash(value) {\n return toName(toPhash(5381, value) >>> 0);\n}\n\n// src/merge-props.ts\nfunction mergeProps(...sources) {\n const result = {};\n for (const source of sources) {\n for (const [key, value] of Object.entries(source)) {\n if (isObject(value)) {\n result[key] = mergeProps(result[key] || {}, value);\n } else {\n result[key] = value;\n }\n }\n }\n return result;\n}\n\n// src/walk-object.ts\nvar isNotNullish = (element) => element != null;\nfunction walkObject(target, predicate, options = {}) {\n const { stop, getKey } = options;\n function inner(value, path = []) {\n if (isObject(value) || Array.isArray(value)) {\n const result = {};\n for (const [prop, child] of Object.entries(value)) {\n const key = getKey?.(prop) ?? prop;\n const childPath = [...path, key];\n if (stop?.(value, childPath)) {\n return predicate(value, path);\n }\n const next = inner(child, childPath);\n if (isNotNullish(next)) {\n result[key] = next;\n }\n }\n return result;\n }\n return predicate(value, path);\n }\n return inner(target);\n}\nfunction mapObject(obj, fn) {\n if (!isObject(obj))\n return fn(obj);\n return walkObject(obj, (value) => fn(value));\n}\n\n// src/normalize-style-object.ts\nfunction toResponsiveObject(values, breakpoints) {\n return values.reduce((acc, current, index) => {\n const key = breakpoints[index];\n if (current != null) {\n acc[key] = current;\n }\n return acc;\n }, {});\n}\nfunction normalizeShorthand(styles, context) {\n const { hasShorthand, resolveShorthand } = context.utility;\n return walkObject(styles, (v) => v, {\n getKey: (prop) => {\n return hasShorthand ? resolveShorthand(prop) : prop;\n }\n });\n}\nfunction normalizeStyleObject(styles, context) {\n const { utility, conditions } = context;\n const { hasShorthand, resolveShorthand } = utility;\n return walkObject(\n styles,\n (value) => {\n return Array.isArray(value) ? toResponsiveObject(value, conditions.breakpoints.keys) : value;\n },\n {\n stop: (value) => Array.isArray(value),\n getKey: (prop) => {\n return hasShorthand ? resolveShorthand(prop) : prop;\n }\n }\n );\n}\n\n// src/classname.ts\nvar fallbackCondition = {\n shift: (v) => v,\n finalize: (v) => v,\n breakpoints: { keys: [] }\n};\nvar sanitize = (value) => typeof value === "string" ? value.replaceAll(/[\\n\\s]+/g, " ") : value;\nfunction createCss(context) {\n const { utility, hash, conditions: conds = fallbackCondition } = context;\n const formatClassName = (str) => [utility.prefix, str].filter(Boolean).join("-");\n const hashFn = (conditions, className) => {\n let result;\n if (hash) {\n const baseArray = [...conds.finalize(conditions), className];\n result = formatClassName(toHash(baseArray.join(":")));\n } else {\n const baseArray = [...conds.finalize(conditions), formatClassName(className)];\n result = baseArray.join(":");\n }\n return result;\n };\n return (styleObject = {}) => {\n const normalizedObject = normalizeStyleObject(styleObject, context);\n const classNames = /* @__PURE__ */ new Set();\n walkObject(normalizedObject, (value, paths) => {\n const important = isImportant(value);\n if (value == null)\n return;\n const [prop, ...allConditions] = conds.shift(paths);\n const conditions = filterBaseConditions(allConditions);\n const transformed = utility.transform(prop, withoutImportant(sanitize(value)));\n let className = hashFn(conditions, transformed.className);\n if (important)\n className = `${className}!`;\n classNames.add(className);\n });\n return Array.from(classNames).join(" ");\n };\n}\nfunction compactStyles(...styles) {\n return styles.filter((style) => isObject(style) && Object.keys(compact(style)).length > 0);\n}\nfunction createMergeCss(context) {\n function resolve(styles) {\n const allStyles = compactStyles(...styles);\n if (allStyles.length === 1)\n return allStyles;\n return allStyles.map((style) => normalizeShorthand(style, context));\n }\n function mergeCss(...styles) {\n return mergeProps(...resolve(styles));\n }\n function assignCss(...styles) {\n return Object.assign({}, ...resolve(styles));\n }\n return { mergeCss, assignCss };\n}\n\n// src/memo.ts\nvar memo = (fn) => {\n const cache = /* @__PURE__ */ new Map();\n const get = (...args) => {\n const key = JSON.stringify(args);\n if (cache.has(key)) {\n return cache.get(key);\n }\n const result = fn(...args);\n cache.set(key, result);\n return result;\n };\n return get;\n};\n\n// src/hypenate.ts\nvar 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
830
  };
756
831
 
757
832
  // src/artifacts/js/helpers.ts
758
833
  function generateHelpers() {
759
834
  return {
760
- js: import_outdent6.outdent`
835
+ js: import_outdent8.outdent`
761
836
  ${helpers_mjs_default.content}
762
837
 
763
838
  export function __spreadValues(a, b){
@@ -778,6 +853,8 @@ var is_valid_prop_mjs_default = {
778
853
 
779
854
  // src/artifacts/js/is-valid-prop.ts
780
855
  function generateisValidProp(ctx) {
856
+ if (ctx.isTemplateLiteralSyntax)
857
+ return;
781
858
  let content = is_valid_prop_mjs_default.content;
782
859
  content = content.replace(
783
860
  "var userGenerated = []",
@@ -791,7 +868,7 @@ function generateisValidProp(ctx) {
791
868
  // src/artifacts/js/pattern.ts
792
869
  var import_shared = require("@pandacss/shared");
793
870
  var import_javascript_stringify = require("javascript-stringify");
794
- var import_outdent7 = require("outdent");
871
+ var import_outdent9 = require("outdent");
795
872
  var import_ts_pattern = require("ts-pattern");
796
873
  function generatePattern(ctx) {
797
874
  if (ctx.patterns.isEmpty())
@@ -809,7 +886,7 @@ function generatePattern(ctx) {
809
886
  }
810
887
  return {
811
888
  name: dashName,
812
- dts: import_outdent7.outdent`
889
+ dts: import_outdent9.outdent`
813
890
  import type { SystemStyleObject, ConditionalValue } from '../types'
814
891
  import type { PropertyValue } from '../types/prop-type'
815
892
  import type { Properties } from '../types/csstype'
@@ -833,7 +910,7 @@ function generatePattern(ctx) {
833
910
  }).join("\n ")}
834
911
  }
835
912
 
836
- ${strict ? import_outdent7.outdent`export declare function ${name}(options: ${upperName}Properties): string` : import_outdent7.outdent`
913
+ ${strict ? import_outdent9.outdent`export declare function ${name}(options: ${upperName}Properties): string` : import_outdent9.outdent`
837
914
 
838
915
  type ${upperName}Options = ${upperName}Properties & Omit<SystemStyleObject, keyof ${upperName}Properties ${blocklistType}>
839
916
 
@@ -842,7 +919,7 @@ function generatePattern(ctx) {
842
919
  `}
843
920
 
844
921
  `,
845
- js: import_outdent7.outdent`
922
+ js: import_outdent9.outdent`
846
923
  ${ctx.file.import(helperImports.join(", "), "../helpers")}
847
924
  ${ctx.file.import("css", "../css/index")}
848
925
 
@@ -859,7 +936,7 @@ transform`)}
859
936
 
860
937
  // src/artifacts/js/recipe.ts
861
938
  var import_shared2 = require("@pandacss/shared");
862
- var import_outdent8 = require("outdent");
939
+ var import_outdent10 = require("outdent");
863
940
  var stringify3 = (value) => JSON.stringify(value, null, 2);
864
941
  var isBooleanValue = (value) => value === "true" || value === "false";
865
942
  function generateRecipes(ctx) {
@@ -873,7 +950,7 @@ function generateRecipes(ctx) {
873
950
  const createRecipeFn = {
874
951
  name: "create-recipe",
875
952
  dts: "",
876
- js: import_outdent8.outdent`
953
+ js: import_outdent10.outdent`
877
954
  ${ctx.file.import("css", "../css/css")}
878
955
  ${ctx.file.import("assertCompoundVariant, getCompoundVariantCss", "../css/cva")}
879
956
  ${ctx.file.import("cx", "../css/cx")}
@@ -920,7 +997,7 @@ function generateRecipes(ctx) {
920
997
  const { name, description, defaultVariants, compoundVariants } = config;
921
998
  return {
922
999
  name: dashName,
923
- js: import_outdent8.outdent`
1000
+ js: import_outdent10.outdent`
924
1001
  ${ctx.file.import("splitProps", "../helpers")}
925
1002
  ${ctx.file.import("createRecipe", "./create-recipe")}
926
1003
 
@@ -941,7 +1018,7 @@ function generateRecipes(ctx) {
941
1018
  splitVariantProps,
942
1019
  })
943
1020
  `,
944
- dts: import_outdent8.outdent`
1021
+ dts: import_outdent10.outdent`
945
1022
  import type { ConditionalValue } from '../types'
946
1023
  import type { Pretty } from '../types/helpers'
947
1024
 
@@ -979,7 +1056,7 @@ function generateRecipes(ctx) {
979
1056
  }
980
1057
 
981
1058
  // src/artifacts/js/token.ts
982
- var import_outdent9 = __toESM(require("outdent"));
1059
+ var import_outdent11 = __toESM(require("outdent"));
983
1060
  function generateTokenJs(ctx) {
984
1061
  const { tokens } = ctx;
985
1062
  const map = /* @__PURE__ */ new Map();
@@ -990,7 +1067,7 @@ function generateTokenJs(ctx) {
990
1067
  });
991
1068
  const obj = Object.fromEntries(map);
992
1069
  return {
993
- js: import_outdent9.default`
1070
+ js: import_outdent11.default`
994
1071
  const tokens = ${JSON.stringify(obj, null, 2)}
995
1072
 
996
1073
  export function token(path, fallback) {
@@ -1003,7 +1080,7 @@ function generateTokenJs(ctx) {
1003
1080
 
1004
1081
  token.var = tokenVar
1005
1082
  `,
1006
- dts: import_outdent9.default`
1083
+ dts: import_outdent11.default`
1007
1084
  import type { Token } from './tokens'
1008
1085
 
1009
1086
  export declare const token: {
@@ -1017,11 +1094,11 @@ function generateTokenJs(ctx) {
1017
1094
  }
1018
1095
 
1019
1096
  // src/artifacts/preact-jsx/jsx.ts
1020
- var import_outdent10 = require("outdent");
1097
+ var import_outdent12 = require("outdent");
1021
1098
  function generatePreactJsxFactory(ctx) {
1022
1099
  const { factoryName, componentName } = ctx.jsx;
1023
1100
  return {
1024
- js: import_outdent10.outdent`
1101
+ js: import_outdent12.outdent`
1025
1102
  import { h } from 'preact'
1026
1103
  import { forwardRef } from 'preact/compat'
1027
1104
  import { useMemo } from 'preact/hooks'
@@ -1088,7 +1165,7 @@ function generatePreactJsxFactory(ctx) {
1088
1165
  }
1089
1166
 
1090
1167
  // src/artifacts/preact-jsx/pattern.ts
1091
- var import_outdent11 = require("outdent");
1168
+ var import_outdent13 = require("outdent");
1092
1169
  var import_ts_pattern2 = require("ts-pattern");
1093
1170
  function generatePreactJsxPattern(ctx) {
1094
1171
  const { typeName, factoryName } = ctx.jsx;
@@ -1097,7 +1174,7 @@ function generatePreactJsxPattern(ctx) {
1097
1174
  const { description, jsxElement = "div" } = pattern.config;
1098
1175
  return {
1099
1176
  name: dashName,
1100
- js: import_outdent11.outdent`
1177
+ js: import_outdent13.outdent`
1101
1178
  import { h } from 'preact'
1102
1179
  import { forwardRef } from 'preact/compat'
1103
1180
  ${ctx.file.import(factoryName, "./factory")}
@@ -1106,12 +1183,12 @@ function generatePreactJsxPattern(ctx) {
1106
1183
  export const ${jsxName} = forwardRef(function ${jsxName}(props, ref) {
1107
1184
  ${(0, import_ts_pattern2.match)(props.length).with(
1108
1185
  0,
1109
- () => import_outdent11.outdent`
1186
+ () => import_outdent13.outdent`
1110
1187
  const styleProps = ${styleFnName}()
1111
1188
  return h(${factoryName}.${jsxElement}, { ref, ...styleProps, ...props })
1112
1189
  `
1113
1190
  ).otherwise(
1114
- () => import_outdent11.outdent`
1191
+ () => import_outdent13.outdent`
1115
1192
  const { ${props.join(", ")}, ...restProps } = props
1116
1193
  const styleProps = ${styleFnName}({${props.join(", ")}})
1117
1194
  return h(${factoryName}.${jsxElement}, { ref, ...styleProps, ...restProps })
@@ -1119,7 +1196,7 @@ function generatePreactJsxPattern(ctx) {
1119
1196
  )}
1120
1197
  })
1121
1198
  `,
1122
- dts: import_outdent11.outdent`
1199
+ dts: import_outdent13.outdent`
1123
1200
  import type { FunctionComponent } from 'preact'
1124
1201
  import type { ${upperName}Properties } from '../patterns/${dashName}'
1125
1202
  import type { ${typeName} } from '../types/jsx'
@@ -1134,15 +1211,15 @@ function generatePreactJsxPattern(ctx) {
1134
1211
  }
1135
1212
 
1136
1213
  // src/artifacts/preact-jsx/types.ts
1137
- var import_outdent12 = require("outdent");
1214
+ var import_outdent14 = require("outdent");
1138
1215
  function generatePreactJsxTypes(ctx) {
1139
1216
  const { factoryName, componentName, upperName, typeName } = ctx.jsx;
1140
1217
  return {
1141
- jsxFactory: import_outdent12.outdent`
1218
+ jsxFactory: import_outdent14.outdent`
1142
1219
  import type { ${upperName} } from '../types/jsx'
1143
1220
  export declare const ${factoryName}: ${upperName}
1144
1221
  `,
1145
- jsxType: import_outdent12.outdent`
1222
+ jsxType: import_outdent14.outdent`
1146
1223
  import type { ComponentProps, JSX } from 'preact'
1147
1224
  import type { Assign, JsxStyleProps, JsxHTMLProps } from './system-types'
1148
1225
  import type { RecipeDefinition, RecipeSelection, RecipeVariantRecord } from './recipe'
@@ -1176,12 +1253,96 @@ export type ${typeName}<T extends ElementType> = JsxHTMLProps<ComponentProps<T>,
1176
1253
  };
1177
1254
  }
1178
1255
 
1256
+ // src/artifacts/preact-jsx/jsx.string-literal.ts
1257
+ var import_outdent15 = require("outdent");
1258
+ function generatePreactJsxStringLiteralFactory(ctx) {
1259
+ const { factoryName, componentName } = ctx.jsx;
1260
+ return {
1261
+ js: import_outdent15.outdent`
1262
+ import { h } from 'preact'
1263
+ import { forwardRef } from 'preact/compat'
1264
+ ${ctx.file.import("css, cx", "../css/index")}
1265
+
1266
+ function createStyledFn(Dynamic) {
1267
+ return function styledFn(template) {
1268
+ const baseClassName = css(template)
1269
+ const ${componentName} = forwardRef(function ${componentName}(props, ref) {
1270
+ const { as: Element = Dynamic, ...elementProps } = props
1271
+ const classes = () => cx(baseClassName, elementProps.className)
1272
+
1273
+ return h(Element, {
1274
+ ref,
1275
+ ...elementProps,
1276
+ className: classes(),
1277
+ })
1278
+ })
1279
+
1280
+ ${componentName}.displayName = \`${factoryName}.\${Dynamic}\`
1281
+ return ${componentName}
1282
+ }
1283
+ }
1284
+
1285
+ function createJsxFactory() {
1286
+ const cache = new Map()
1287
+
1288
+ return new Proxy(createStyledFn, {
1289
+ apply(_, __, args) {
1290
+ return createStyledFn(...args)
1291
+ },
1292
+ get(_, el) {
1293
+ if (!cache.has(el)) {
1294
+ cache.set(el, createStyledFn(el))
1295
+ }
1296
+ return cache.get(el)
1297
+ },
1298
+ })
1299
+ }
1300
+
1301
+ export const ${factoryName} = createJsxFactory()
1302
+ `
1303
+ };
1304
+ }
1305
+
1306
+ // src/artifacts/preact-jsx/types.string-literal.ts
1307
+ var import_outdent16 = require("outdent");
1308
+ function generatePreactJsxStringLiteralTypes(ctx) {
1309
+ const { factoryName, componentName, upperName, typeName } = ctx.jsx;
1310
+ return {
1311
+ jsxFactory: import_outdent16.outdent`
1312
+ import type { ${upperName} } from '../types/jsx'
1313
+ export declare const ${factoryName}: ${upperName}
1314
+ `,
1315
+ jsxType: import_outdent16.outdent`
1316
+ import type { ComponentProps, JSX } from 'preact'
1317
+
1318
+ type ElementType = keyof JSX.IntrinsicElements
1319
+
1320
+ type Dict = Record<string, unknown>
1321
+
1322
+ export type ${componentName}<T extends ElementType> = {
1323
+ (args: { raw: readonly string[] | ArrayLike<string> }): (props: ComponentProps<T>) => JSX.Element
1324
+ displayName?: string
1325
+ }
1326
+
1327
+ interface JsxFactory {
1328
+ <T extends ElementType>(component: T): ${componentName}<T>
1329
+ }
1330
+
1331
+ type JsxElements = { [K in keyof JSX.IntrinsicElements]: ${componentName}<K> }
1332
+
1333
+ export type ${upperName} = JsxFactory & JsxElements
1334
+
1335
+ export type ${typeName}<T extends ElementType> = ComponentProps<T>
1336
+ `
1337
+ };
1338
+ }
1339
+
1179
1340
  // src/artifacts/qwik-jsx/jsx.ts
1180
- var import_outdent13 = require("outdent");
1341
+ var import_outdent17 = require("outdent");
1181
1342
  function generateQwikJsxFactory(ctx) {
1182
1343
  const { factoryName, componentName } = ctx.jsx;
1183
1344
  return {
1184
- js: import_outdent13.outdent`
1345
+ js: import_outdent17.outdent`
1185
1346
  import { h } from '@builder.io/qwik'
1186
1347
  ${ctx.file.import("css, cx, cva, assignCss", "../css/index")}
1187
1348
  ${ctx.file.import("splitProps, normalizeHTMLProps", "../helpers")}
@@ -1245,7 +1406,7 @@ function generateQwikJsxFactory(ctx) {
1245
1406
  }
1246
1407
 
1247
1408
  // src/artifacts/qwik-jsx/pattern.ts
1248
- var import_outdent14 = require("outdent");
1409
+ var import_outdent18 = require("outdent");
1249
1410
  var import_ts_pattern3 = require("ts-pattern");
1250
1411
  function generateQwikJsxPattern(ctx) {
1251
1412
  const { typeName, factoryName } = ctx.jsx;
@@ -1254,7 +1415,7 @@ function generateQwikJsxPattern(ctx) {
1254
1415
  const { description, jsxElement = "div" } = pattern.config;
1255
1416
  return {
1256
1417
  name: dashName,
1257
- js: import_outdent14.outdent`
1418
+ js: import_outdent18.outdent`
1258
1419
  import { h } from '@builder.io/qwik'
1259
1420
  ${ctx.file.import(factoryName, "./factory")}
1260
1421
  ${ctx.file.import(styleFnName, `../patterns/${dashName}`)}
@@ -1262,12 +1423,12 @@ function generateQwikJsxPattern(ctx) {
1262
1423
  export const ${jsxName} = function ${jsxName}(props) {
1263
1424
  ${(0, import_ts_pattern3.match)(props.length).with(
1264
1425
  0,
1265
- () => import_outdent14.outdent`
1426
+ () => import_outdent18.outdent`
1266
1427
  const styleProps = ${styleFnName}()
1267
1428
  return h(${factoryName}.${jsxElement}, { ...styleProps, ...props })
1268
1429
  `
1269
1430
  ).otherwise(
1270
- () => import_outdent14.outdent`
1431
+ () => import_outdent18.outdent`
1271
1432
  const { ${props.join(", ")}, ...restProps } = props
1272
1433
  const styleProps = ${styleFnName}({${props.join(", ")}})
1273
1434
  return h(${factoryName}.${jsxElement}, { ...styleProps, ...restProps })
@@ -1275,7 +1436,7 @@ function generateQwikJsxPattern(ctx) {
1275
1436
  )}
1276
1437
  }
1277
1438
  `,
1278
- dts: import_outdent14.outdent`
1439
+ dts: import_outdent18.outdent`
1279
1440
  import type { FunctionComponent } from '@builder.io/qwik'
1280
1441
  import type { ${upperName}Properties } from '../patterns/${dashName}'
1281
1442
  import type { ${typeName} } from '../types/jsx'
@@ -1294,15 +1455,15 @@ function generateQwikJsxPattern(ctx) {
1294
1455
  }
1295
1456
 
1296
1457
  // src/artifacts/qwik-jsx/types.ts
1297
- var import_outdent15 = require("outdent");
1458
+ var import_outdent19 = require("outdent");
1298
1459
  function generateQwikJsxTypes(ctx) {
1299
1460
  const { factoryName, componentName, upperName, typeName } = ctx.jsx;
1300
1461
  return {
1301
- jsxFactory: import_outdent15.outdent`
1462
+ jsxFactory: import_outdent19.outdent`
1302
1463
  import { ${upperName} } from '../types/jsx'
1303
1464
  export declare const ${factoryName}: ${upperName}
1304
1465
  `,
1305
- jsxType: import_outdent15.outdent`
1466
+ jsxType: import_outdent19.outdent`
1306
1467
  import type { FunctionComponent, QwikIntrinsicElements } from '@builder.io/qwik'
1307
1468
  import type { Assign as _Assign, JsxStyleProps, PatchedHTMLProps } from './system-types'
1308
1469
  import type { RecipeDefinition, RecipeSelection, RecipeVariantRecord } from './recipe'
@@ -1355,12 +1516,100 @@ export type ${typeName}<T extends ElementType> = Assign<ComponentProps<T>, JsxSt
1355
1516
  };
1356
1517
  }
1357
1518
 
1519
+ // src/artifacts/qwik-jsx/jsx.string-literal.ts
1520
+ var import_outdent20 = require("outdent");
1521
+ function generateQwikJsxStringLiteralFactory(ctx) {
1522
+ const { factoryName, componentName } = ctx.jsx;
1523
+ return {
1524
+ js: import_outdent20.outdent`
1525
+ import { h } from '@builder.io/qwik'
1526
+ ${ctx.file.import("css, cx", "../css/index")}
1527
+
1528
+ function createStyledFn(Dynamic) {
1529
+ return function styledFn(template) {
1530
+ const baseClassName = css(template)
1531
+ const ${componentName} = function ${componentName}(props) {
1532
+ const { as: Element = Dynamic, ...elementProps } = props
1533
+ const classes = () => cx(baseClassName, elementProps.className)
1534
+
1535
+ return h(Element, {
1536
+ ...elementProps,
1537
+ className: classes(),
1538
+ })
1539
+ }
1540
+
1541
+ ${componentName}.displayName = \`${factoryName}.\${Dynamic}\`
1542
+ return ${componentName}
1543
+ }
1544
+ }
1545
+
1546
+ function createJsxFactory() {
1547
+ const cache = new Map()
1548
+
1549
+ return new Proxy(createStyledFn, {
1550
+ apply(_, __, args) {
1551
+ return createStyledFn(...args)
1552
+ },
1553
+ get(_, el) {
1554
+ if (!cache.has(el)) {
1555
+ cache.set(el, createStyledFn(el))
1556
+ }
1557
+ return cache.get(el)
1558
+ },
1559
+ })
1560
+ }
1561
+
1562
+ export const ${factoryName} = createJsxFactory()
1563
+
1564
+ `
1565
+ };
1566
+ }
1567
+
1568
+ // src/artifacts/qwik-jsx/types.string-literal.ts
1569
+ var import_outdent21 = require("outdent");
1570
+ function generateQwikJsxStringLiteralTypes(ctx) {
1571
+ const { factoryName, componentName, upperName, typeName } = ctx.jsx;
1572
+ return {
1573
+ jsxFactory: import_outdent21.outdent`
1574
+ import { ${upperName} } from '../types/jsx'
1575
+ export declare const ${factoryName}: ${upperName}
1576
+ `,
1577
+ jsxType: import_outdent21.outdent`
1578
+ import type { FunctionComponent, QwikIntrinsicElements } from '@builder.io/qwik'
1579
+
1580
+ type ElementType = keyof QwikIntrinsicElements | FunctionComponent<any>
1581
+
1582
+ type ComponentProps<T extends ElementType> = T extends keyof QwikIntrinsicElements
1583
+ ? QwikIntrinsicElements[T]
1584
+ : T extends FunctionComponent<infer P>
1585
+ ? P
1586
+ : never
1587
+
1588
+ type Dict = Record<string, unknown>
1589
+
1590
+ export type ${componentName}<T extends ElementType> = {
1591
+ (args: { raw: readonly string[] | ArrayLike<string> }): (props: ComponentProps<T>) => JSX.Element
1592
+ }
1593
+
1594
+ interface JsxFactory {
1595
+ <T extends ElementType>(component: T): ${componentName}<T>
1596
+ }
1597
+
1598
+ type JsxElements = { [K in keyof QwikIntrinsicElements]: ${componentName}<K> }
1599
+
1600
+ export type ${upperName} = JsxFactory & JsxElements
1601
+
1602
+ export type ${typeName}<T extends ElementType> = ComponentProps<T>
1603
+ `
1604
+ };
1605
+ }
1606
+
1358
1607
  // src/artifacts/react-jsx/jsx.ts
1359
- var import_outdent16 = require("outdent");
1608
+ var import_outdent22 = require("outdent");
1360
1609
  function generateReactJsxFactory(ctx) {
1361
1610
  const { factoryName, componentName } = ctx.jsx;
1362
1611
  return {
1363
- js: import_outdent16.outdent`
1612
+ js: import_outdent22.outdent`
1364
1613
  import { createElement, forwardRef, useMemo } from 'react'
1365
1614
  ${ctx.file.import("css, cx, cva, assignCss", "../css/index")}
1366
1615
  ${ctx.file.import("splitProps, normalizeHTMLProps", "../helpers")}
@@ -1426,7 +1675,7 @@ function generateReactJsxFactory(ctx) {
1426
1675
  }
1427
1676
 
1428
1677
  // src/artifacts/react-jsx/pattern.ts
1429
- var import_outdent17 = require("outdent");
1678
+ var import_outdent23 = require("outdent");
1430
1679
  var import_ts_pattern4 = require("ts-pattern");
1431
1680
  function generateReactJsxPattern(ctx) {
1432
1681
  const { typeName, factoryName } = ctx.jsx;
@@ -1435,7 +1684,7 @@ function generateReactJsxPattern(ctx) {
1435
1684
  const { description, jsxElement = "div" } = pattern.config;
1436
1685
  return {
1437
1686
  name: dashName,
1438
- js: import_outdent17.outdent`
1687
+ js: import_outdent23.outdent`
1439
1688
  import { createElement, forwardRef } from 'react'
1440
1689
  ${ctx.file.import(factoryName, "./factory")}
1441
1690
  ${ctx.file.import(styleFnName, `../patterns/${dashName}`)}
@@ -1443,12 +1692,12 @@ function generateReactJsxPattern(ctx) {
1443
1692
  export const ${jsxName} = forwardRef(function ${jsxName}(props, ref) {
1444
1693
  ${(0, import_ts_pattern4.match)(props.length).with(
1445
1694
  0,
1446
- () => import_outdent17.outdent`
1695
+ () => import_outdent23.outdent`
1447
1696
  const styleProps = ${styleFnName}()
1448
1697
  return createElement(${factoryName}.${jsxElement}, { ref, ...styleProps, ...props })
1449
1698
  `
1450
1699
  ).otherwise(
1451
- () => import_outdent17.outdent`
1700
+ () => import_outdent23.outdent`
1452
1701
  const { ${props.join(", ")}, ...restProps } = props
1453
1702
  const styleProps = ${styleFnName}({${props.join(", ")}})
1454
1703
  return createElement(${factoryName}.${jsxElement}, { ref, ...styleProps, ...restProps })
@@ -1456,7 +1705,7 @@ function generateReactJsxPattern(ctx) {
1456
1705
  )}
1457
1706
  })
1458
1707
  `,
1459
- dts: import_outdent17.outdent`
1708
+ dts: import_outdent23.outdent`
1460
1709
  import type { FunctionComponent } from 'react'
1461
1710
  import type { ${upperName}Properties } from '../patterns/${dashName}'
1462
1711
  import type { ${typeName} } from '../types/jsx'
@@ -1471,15 +1720,15 @@ function generateReactJsxPattern(ctx) {
1471
1720
  }
1472
1721
 
1473
1722
  // src/artifacts/react-jsx/types.ts
1474
- var import_outdent18 = require("outdent");
1723
+ var import_outdent24 = require("outdent");
1475
1724
  function generateReactJsxTypes(ctx) {
1476
1725
  const { factoryName, componentName, upperName, typeName } = ctx.jsx;
1477
1726
  return {
1478
- jsxFactory: import_outdent18.outdent`
1727
+ jsxFactory: import_outdent24.outdent`
1479
1728
  import { ${upperName} } from '../types/jsx'
1480
1729
  export declare const ${factoryName}: ${upperName}
1481
1730
  `,
1482
- jsxType: import_outdent18.outdent`
1731
+ jsxType: import_outdent24.outdent`
1483
1732
  import type { ComponentProps, ElementType } from 'react'
1484
1733
  import type { Assign, JsxStyleProps, JsxHTMLProps } from './system-types'
1485
1734
  import type { RecipeDefinition, RecipeSelection, RecipeVariantRecord } from './recipe'
@@ -1511,59 +1760,141 @@ export type ${typeName}<T extends ElementType> = JsxHTMLProps<ComponentProps<T>,
1511
1760
  };
1512
1761
  }
1513
1762
 
1514
- // src/artifacts/solid-jsx/jsx.ts
1515
- var import_outdent19 = require("outdent");
1516
- function generateSolidJsxFactory(ctx) {
1517
- const { componentName, factoryName } = ctx.jsx;
1763
+ // src/artifacts/react-jsx/jsx.string-literal.ts
1764
+ var import_outdent25 = require("outdent");
1765
+ function generateReactJsxStringLiteralFactory(ctx) {
1766
+ const { factoryName, componentName } = ctx.jsx;
1518
1767
  return {
1519
- js: import_outdent19.outdent`
1520
- import { Dynamic } from 'solid-js/web'
1521
- import { mergeProps, splitProps } from 'solid-js'
1522
- import { createComponent } from 'solid-js/web'
1523
- ${ctx.file.import("css, cx, cva, assignCss", "../css/index")}
1524
- ${ctx.file.import("normalizeHTMLProps", "../helpers")}
1525
- ${ctx.file.import("allCssProperties", "./is-valid-prop")}
1768
+ js: import_outdent25.outdent`
1769
+ import { createElement, forwardRef } from 'react'
1770
+ ${ctx.file.import("css, cx", "../css/index")}
1526
1771
 
1527
- function styledFn(element, configOrCva = {}) {
1528
- const cvaFn = configOrCva.__cva__ ? configOrCva : cva(configOrCva)
1529
-
1530
- return function ${componentName}(props) {
1531
- const mergedProps = mergeProps({ as: element }, props)
1532
-
1533
- const [localProps, variantProps, styleProps, htmlProps, elementProps] = splitProps(
1534
- mergedProps,
1535
- ['as', 'class'],
1536
- cvaFn.variantKeys,
1537
- allCssProperties,
1538
- normalizeHTMLProps.keys
1539
- )
1540
-
1541
- function recipeClass() {
1542
- const { css: cssStyles, ...propStyles } = styleProps
1543
- const styles = assignCss(propStyles, cssStyles)
1544
- return cx(cvaFn(variantProps), css(styles), localProps.class)
1545
- }
1772
+ function createStyledFn(Dynamic) {
1773
+ return function styledFn(template) {
1774
+ const baseClassName = css(template)
1775
+ const ${componentName} = forwardRef(function ${componentName}(props, ref) {
1776
+ const { as: Element = Dynamic, ...elementProps } = props
1777
+ const classes = () => cx(baseClassName, elementProps.className)
1546
1778
 
1547
- function cvaClass() {
1548
- const { css: cssStyles, ...propStyles } = styleProps
1549
- const cvaStyles = cvaFn.resolve(variantProps)
1550
- const styles = assignCss(cvaStyles, propStyles, cssStyles)
1551
- return cx(css(styles), localProps.class)
1552
- }
1553
-
1554
- const classes = configOrCva.__recipe__ ? recipeClass : cvaClass
1779
+ return createElement(Element, {
1780
+ ref,
1781
+ ...elementProps,
1782
+ className: classes(),
1783
+ })
1784
+ })
1555
1785
 
1556
- return createComponent(
1557
- Dynamic,
1558
- mergeProps(
1559
- {
1560
- get component() {
1561
- return localProps.as
1562
- },
1563
- get class() {
1564
- return classes()
1565
- }
1566
- },
1786
+ ${componentName}.displayName = \`${factoryName}.\${Dynamic}\`
1787
+ return ${componentName}
1788
+ }
1789
+ }
1790
+
1791
+ function createJsxFactory() {
1792
+ const cache = new Map()
1793
+
1794
+ return new Proxy(createStyledFn, {
1795
+ apply(_, __, args) {
1796
+ return createStyledFn(...args)
1797
+ },
1798
+ get(_, el) {
1799
+ if (!cache.has(el)) {
1800
+ cache.set(el, createStyledFn(el))
1801
+ }
1802
+ return cache.get(el)
1803
+ },
1804
+ })
1805
+ }
1806
+
1807
+ export const ${factoryName} = createJsxFactory()
1808
+
1809
+ `
1810
+ };
1811
+ }
1812
+
1813
+ // src/artifacts/react-jsx/types.string-literal.ts
1814
+ var import_outdent26 = require("outdent");
1815
+ function generateReactJsxStringLiteralTypes(ctx) {
1816
+ const { factoryName, componentName, upperName, typeName } = ctx.jsx;
1817
+ return {
1818
+ jsxFactory: import_outdent26.outdent`
1819
+ import { ${upperName} } from '../types/jsx'
1820
+ export declare const ${factoryName}: ${upperName}
1821
+ `,
1822
+ jsxType: import_outdent26.outdent`
1823
+ import type { ComponentProps, ElementType } from 'react'
1824
+
1825
+ type Dict = Record<string, unknown>
1826
+
1827
+ export type ${componentName}<T extends ElementType> = {
1828
+ (args: { raw: readonly string[] | ArrayLike<string> }): (props: ComponentProps<T>) => JSX.Element
1829
+ displayName?: string
1830
+ }
1831
+
1832
+ interface JsxFactory {
1833
+ <T extends ElementType>(component: T): ${componentName}<T>
1834
+ }
1835
+
1836
+ type JsxElements = { [K in keyof JSX.IntrinsicElements]: ${componentName}<K> }
1837
+
1838
+ export type ${upperName} = JsxFactory & JsxElements
1839
+
1840
+ export type ${typeName}<T extends ElementType> = ComponentProps<T>
1841
+ `
1842
+ };
1843
+ }
1844
+
1845
+ // src/artifacts/solid-jsx/jsx.ts
1846
+ var import_outdent27 = require("outdent");
1847
+ function generateSolidJsxFactory(ctx) {
1848
+ const { componentName, factoryName } = ctx.jsx;
1849
+ return {
1850
+ js: import_outdent27.outdent`
1851
+ import { Dynamic } from 'solid-js/web'
1852
+ import { mergeProps, splitProps } from 'solid-js'
1853
+ import { createComponent } from 'solid-js/web'
1854
+ ${ctx.file.import("css, cx, cva, assignCss", "../css/index")}
1855
+ ${ctx.file.import("normalizeHTMLProps", "../helpers")}
1856
+ ${ctx.file.import("allCssProperties", "./is-valid-prop")}
1857
+
1858
+ function styledFn(element, configOrCva = {}) {
1859
+ const cvaFn = configOrCva.__cva__ ? configOrCva : cva(configOrCva)
1860
+
1861
+ return function ${componentName}(props) {
1862
+ const mergedProps = mergeProps({ as: element }, props)
1863
+
1864
+ const [localProps, variantProps, styleProps, htmlProps, elementProps] = splitProps(
1865
+ mergedProps,
1866
+ ['as', 'class'],
1867
+ cvaFn.variantKeys,
1868
+ allCssProperties,
1869
+ normalizeHTMLProps.keys
1870
+ )
1871
+
1872
+ function recipeClass() {
1873
+ const { css: cssStyles, ...propStyles } = styleProps
1874
+ const styles = assignCss(propStyles, cssStyles)
1875
+ return cx(cvaFn(variantProps), css(styles), localProps.class)
1876
+ }
1877
+
1878
+ function cvaClass() {
1879
+ const { css: cssStyles, ...propStyles } = styleProps
1880
+ const cvaStyles = cvaFn.resolve(variantProps)
1881
+ const styles = assignCss(cvaStyles, propStyles, cssStyles)
1882
+ return cx(css(styles), localProps.class)
1883
+ }
1884
+
1885
+ const classes = configOrCva.__recipe__ ? recipeClass : cvaClass
1886
+
1887
+ return createComponent(
1888
+ Dynamic,
1889
+ mergeProps(
1890
+ {
1891
+ get component() {
1892
+ return localProps.as
1893
+ },
1894
+ get class() {
1895
+ return classes()
1896
+ }
1897
+ },
1567
1898
  elementProps,
1568
1899
  normalizeHTMLProps(htmlProps)
1569
1900
  )
@@ -1593,7 +1924,7 @@ function generateSolidJsxFactory(ctx) {
1593
1924
  }
1594
1925
 
1595
1926
  // src/artifacts/solid-jsx/pattern.ts
1596
- var import_outdent20 = require("outdent");
1927
+ var import_outdent28 = require("outdent");
1597
1928
  var import_ts_pattern5 = require("ts-pattern");
1598
1929
  function generateSolidJsxPattern(ctx) {
1599
1930
  const { typeName, factoryName } = ctx.jsx;
@@ -1602,7 +1933,7 @@ function generateSolidJsxPattern(ctx) {
1602
1933
  const { description, jsxElement = "div" } = pattern.config;
1603
1934
  return {
1604
1935
  name: dashName,
1605
- js: import_outdent20.outdent`
1936
+ js: import_outdent28.outdent`
1606
1937
  import { splitProps, mergeProps } from 'solid-js'
1607
1938
  import { createComponent } from 'solid-js/web'
1608
1939
  ${ctx.file.import(factoryName, "./factory")}
@@ -1611,12 +1942,12 @@ function generateSolidJsxPattern(ctx) {
1611
1942
  export function ${jsxName}(props) {
1612
1943
  ${(0, import_ts_pattern5.match)(props.length).with(
1613
1944
  0,
1614
- () => import_outdent20.outdent`
1945
+ () => import_outdent28.outdent`
1615
1946
  const styleProps = ${styleFnName}()
1616
1947
  return createComponent(${factoryName}.${jsxElement}, mergeProps(styleProps, props))
1617
1948
  `
1618
1949
  ).otherwise(
1619
- () => import_outdent20.outdent`
1950
+ () => import_outdent28.outdent`
1620
1951
  const [patternProps, restProps] = splitProps(props, [${props.map((v) => JSON.stringify(v)).join(", ")}]);
1621
1952
  const styleProps = ${styleFnName}(patternProps)
1622
1953
  return createComponent(${factoryName}.${jsxElement}, mergeProps(styleProps, restProps))
@@ -1624,7 +1955,7 @@ function generateSolidJsxPattern(ctx) {
1624
1955
  )}
1625
1956
  }
1626
1957
  `,
1627
- dts: import_outdent20.outdent`
1958
+ dts: import_outdent28.outdent`
1628
1959
  import { Component } from 'solid-js'
1629
1960
  import { ${upperName}Properties } from '../patterns/${dashName}'
1630
1961
  import { ${typeName} } from '../types/jsx'
@@ -1639,15 +1970,15 @@ function generateSolidJsxPattern(ctx) {
1639
1970
  }
1640
1971
 
1641
1972
  // src/artifacts/solid-jsx/types.ts
1642
- var import_outdent21 = require("outdent");
1973
+ var import_outdent29 = require("outdent");
1643
1974
  function generateSolidJsxTypes(ctx) {
1644
1975
  const { factoryName, componentName, upperName, typeName } = ctx.jsx;
1645
1976
  return {
1646
- jsxFactory: import_outdent21.outdent`
1977
+ jsxFactory: import_outdent29.outdent`
1647
1978
  import type { ${upperName} } from '../types/jsx'
1648
1979
  export declare const ${factoryName}: ${upperName}
1649
1980
  `,
1650
- jsxType: import_outdent21.outdent`
1981
+ jsxType: import_outdent29.outdent`
1651
1982
  import type { ComponentProps, Component, JSX } from 'solid-js'
1652
1983
  import type { Assign, JsxStyleProps, JsxHTMLProps } from './system-types'
1653
1984
  import type { RecipeDefinition, RecipeSelection, RecipeVariantRecord } from './recipe'
@@ -1681,12 +2012,102 @@ export type ${typeName}<T extends ElementType> = JsxHTMLProps<ComponentProps<T>,
1681
2012
  };
1682
2013
  }
1683
2014
 
2015
+ // src/artifacts/solid-jsx/jsx.string-literal.ts
2016
+ var import_outdent30 = require("outdent");
2017
+ function generateSolidJsxStringLiteralFactory(ctx) {
2018
+ const { componentName, factoryName } = ctx.jsx;
2019
+ return {
2020
+ js: import_outdent30.outdent`
2021
+ import { mergeProps, splitProps } from 'solid-js'
2022
+ import { Dynamic, createComponent } from 'solid-js/web'
2023
+ ${ctx.file.import("css, cx", "../css/index")}
2024
+
2025
+ function createStyled(element) {
2026
+ return function styledFn(template) {
2027
+ const baseClassName = css(template)
2028
+ return function ${componentName}(props) {
2029
+ const mergedProps = mergeProps({ as: element }, props)
2030
+ const [localProps, elementProps] = splitProps(mergedProps, ['as', 'class'])
2031
+
2032
+ return createComponent(
2033
+ Dynamic,
2034
+ mergeProps(
2035
+ {
2036
+ get component() {
2037
+ return localProps.as
2038
+ },
2039
+ get class() {
2040
+ return cx(baseClassName, localProps.class)
2041
+ },
2042
+ },
2043
+ elementProps,
2044
+ ),
2045
+ )
2046
+ }
2047
+ }
2048
+ }
2049
+
2050
+ function createJsxFactory() {
2051
+ const cache = new Map()
2052
+
2053
+ return new Proxy(createStyled, {
2054
+ apply(_, __, args) {
2055
+ return createStyled(...args)
2056
+ },
2057
+ get(_, el) {
2058
+ if (!cache.has(el)) {
2059
+ cache.set(el, createStyled(el))
2060
+ }
2061
+ return cache.get(el)
2062
+ },
2063
+ })
2064
+ }
2065
+
2066
+ export const ${factoryName} = createJsxFactory()
2067
+ `
2068
+ };
2069
+ }
2070
+
2071
+ // src/artifacts/solid-jsx/types.string-literal.ts
2072
+ var import_outdent31 = require("outdent");
2073
+ function generateSolidJsxStringLiteralTypes(ctx) {
2074
+ const { factoryName, componentName, upperName, typeName } = ctx.jsx;
2075
+ return {
2076
+ jsxFactory: import_outdent31.outdent`
2077
+ import type { ${upperName} } from '../types/jsx'
2078
+ export declare const ${factoryName}: ${upperName}
2079
+ `,
2080
+ jsxType: import_outdent31.outdent`
2081
+ import type { Component, ComponentProps, JSX } from 'solid-js'
2082
+
2083
+ type Dict = Record<string, unknown>
2084
+
2085
+ type ElementType<P = any> = keyof JSX.IntrinsicElements | Component<P>
2086
+
2087
+ export type ${componentName}<T extends ElementType> = {
2088
+ (args: { raw: readonly string[] | ArrayLike<string> }): (props: ComponentProps<T>) => JSX.Element
2089
+ displayName?: string
2090
+ }
2091
+
2092
+ interface JsxFactory {
2093
+ <T extends ElementType>(component: T): ${componentName}<T>
2094
+ }
2095
+
2096
+ type JsxElements = { [K in keyof JSX.IntrinsicElements]: ${componentName}<K> }
2097
+
2098
+ export type Styled = JsxFactory & JsxElements
2099
+
2100
+ export type ${typeName}<T extends ElementType> = ComponentProps<T>
2101
+ `
2102
+ };
2103
+ }
2104
+
1684
2105
  // src/artifacts/vue-jsx/jsx.ts
1685
- var import_outdent22 = require("outdent");
2106
+ var import_outdent32 = require("outdent");
1686
2107
  function generateVueJsxFactory(ctx) {
1687
2108
  const { factoryName } = ctx.jsx;
1688
2109
  return {
1689
- js: import_outdent22.outdent`
2110
+ js: import_outdent32.outdent`
1690
2111
  import { defineComponent, h, computed } from 'vue'
1691
2112
  ${ctx.file.import("css, cx, cva, assignCss", "../css/index")}
1692
2113
  ${ctx.file.import("splitProps, normalizeHTMLProps", "../helpers")}
@@ -1759,8 +2180,62 @@ function generateVueJsxFactory(ctx) {
1759
2180
  };
1760
2181
  }
1761
2182
 
2183
+ // src/artifacts/vue-jsx/jsx.string-literal.ts
2184
+ var import_outdent33 = require("outdent");
2185
+ function generateVueJsxStringLiteralFactory(ctx) {
2186
+ const { factoryName } = ctx.jsx;
2187
+ return {
2188
+ js: import_outdent33.outdent`
2189
+ import { defineComponent, h, computed } from 'vue'
2190
+ ${ctx.file.import("css, cx", "../css/index")}
2191
+
2192
+ function createStyled(Dynamic) {
2193
+ function styledFn(template) {
2194
+ const baseClassName = css(template)
2195
+ return defineComponent({
2196
+ name: \`${factoryName}.\${Dynamic}\`,
2197
+ inheritAttrs: false,
2198
+ props: { as: { type: [String, Object], default: Dynamic } },
2199
+ setup(props, { slots, attrs }) {
2200
+ const classes = computed(() => cx(baseClassName, elementProps.className))
2201
+ return () => {
2202
+ return h(
2203
+ props.as,
2204
+ {
2205
+ class: classes.value,
2206
+ ...elementProps,
2207
+ },
2208
+ slots.default && slots.default(),
2209
+ )
2210
+ }
2211
+ },
2212
+ })
2213
+ }
2214
+ }
2215
+
2216
+ function createJsxFactory() {
2217
+ const cache = new Map()
2218
+
2219
+ return new Proxy(createStyled, {
2220
+ apply(_, __, args) {
2221
+ return createStyled(...args)
2222
+ },
2223
+ get(_, el) {
2224
+ if (!cache.has(el)) {
2225
+ cache.set(el, createStyled(el))
2226
+ }
2227
+ return cache.get(el)
2228
+ },
2229
+ })
2230
+ }
2231
+
2232
+ export const ${factoryName} = createJsxFactory()
2233
+ `
2234
+ };
2235
+ }
2236
+
1762
2237
  // src/artifacts/vue-jsx/pattern.ts
1763
- var import_outdent23 = require("outdent");
2238
+ var import_outdent34 = require("outdent");
1764
2239
  function generateVueJsxPattern(ctx) {
1765
2240
  const { typeName, factoryName } = ctx.jsx;
1766
2241
  return ctx.patterns.details.map((pattern) => {
@@ -1769,7 +2244,7 @@ function generateVueJsxPattern(ctx) {
1769
2244
  const propList = props.map((v) => JSON.stringify(v)).join(", ");
1770
2245
  return {
1771
2246
  name: dashName,
1772
- js: import_outdent23.outdent`
2247
+ js: import_outdent34.outdent`
1773
2248
  import { defineComponent, h, computed } from 'vue'
1774
2249
  ${ctx.file.import(factoryName, "./factory")}
1775
2250
  ${ctx.file.import(styleFnName, `../patterns/${dashName}`)}
@@ -1787,7 +2262,7 @@ function generateVueJsxPattern(ctx) {
1787
2262
  }
1788
2263
  })
1789
2264
  `,
1790
- dts: import_outdent23.outdent`
2265
+ dts: import_outdent34.outdent`
1791
2266
  import { FunctionalComponent } from 'vue'
1792
2267
  import { ${upperName}Properties } from '../patterns/${dashName}'
1793
2268
  import { ${typeName} } from '../types/jsx'
@@ -1802,15 +2277,15 @@ function generateVueJsxPattern(ctx) {
1802
2277
  }
1803
2278
 
1804
2279
  // src/artifacts/vue-jsx/types.ts
1805
- var import_outdent24 = require("outdent");
2280
+ var import_outdent35 = require("outdent");
1806
2281
  function generateVueJsxTypes(ctx) {
1807
2282
  const { factoryName, componentName, upperName, typeName } = ctx.jsx;
1808
2283
  return {
1809
- jsxFactory: import_outdent24.outdent`
2284
+ jsxFactory: import_outdent35.outdent`
1810
2285
  import { ${upperName} } from '../types/jsx'
1811
2286
  export declare const ${factoryName}: ${upperName}
1812
2287
  `,
1813
- jsxType: import_outdent24.outdent`
2288
+ jsxType: import_outdent35.outdent`
1814
2289
  import type { Component, FunctionalComponent } from 'vue'
1815
2290
  import type { Assign, JsxStyleProps, JsxHTMLProps } from './system-types'
1816
2291
  import type { RecipeDefinition, RecipeSelection, RecipeVariantRecord } from './recipe'
@@ -1966,6 +2441,161 @@ type IntrinsicElement =
1966
2441
  };
1967
2442
  }
1968
2443
 
2444
+ // src/artifacts/vue-jsx/types.string-literal.ts
2445
+ var import_outdent36 = require("outdent");
2446
+ function generateVueJsxStringLiteralTypes(ctx) {
2447
+ const { factoryName, componentName, upperName, typeName } = ctx.jsx;
2448
+ return {
2449
+ jsxFactory: import_outdent36.outdent`
2450
+ import { ${upperName} } from '../types/jsx'
2451
+ export declare const ${factoryName}: ${upperName}
2452
+ `,
2453
+ jsxType: import_outdent36.outdent`
2454
+ import type { Component, FunctionalComponent } from 'vue'
2455
+
2456
+ type IntrinsicElement =
2457
+ | 'a'
2458
+ | 'abbr'
2459
+ | 'address'
2460
+ | 'area'
2461
+ | 'article'
2462
+ | 'aside'
2463
+ | 'audio'
2464
+ | 'b'
2465
+ | 'base'
2466
+ | 'bdi'
2467
+ | 'bdo'
2468
+ | 'blockquote'
2469
+ | 'body'
2470
+ | 'br'
2471
+ | 'button'
2472
+ | 'canvas'
2473
+ | 'caption'
2474
+ | 'cite'
2475
+ | 'code'
2476
+ | 'col'
2477
+ | 'colgroup'
2478
+ | 'data'
2479
+ | 'datalist'
2480
+ | 'dd'
2481
+ | 'del'
2482
+ | 'details'
2483
+ | 'dfn'
2484
+ | 'dialog'
2485
+ | 'div'
2486
+ | 'dl'
2487
+ | 'dt'
2488
+ | 'em'
2489
+ | 'embed'
2490
+ | 'fieldset'
2491
+ | 'figcaption'
2492
+ | 'figure'
2493
+ | 'footer'
2494
+ | 'form'
2495
+ | 'h1'
2496
+ | 'h2'
2497
+ | 'h3'
2498
+ | 'h4'
2499
+ | 'h5'
2500
+ | 'h6'
2501
+ | 'head'
2502
+ | 'header'
2503
+ | 'hgroup'
2504
+ | 'hr'
2505
+ | 'html'
2506
+ | 'i'
2507
+ | 'iframe'
2508
+ | 'img'
2509
+ | 'input'
2510
+ | 'ins'
2511
+ | 'kbd'
2512
+ | 'label'
2513
+ | 'legend'
2514
+ | 'li'
2515
+ | 'link'
2516
+ | 'main'
2517
+ | 'map'
2518
+ | 'mark'
2519
+ | 'math'
2520
+ | 'menu'
2521
+ | 'menuitem'
2522
+ | 'meta'
2523
+ | 'meter'
2524
+ | 'nav'
2525
+ | 'noscript'
2526
+ | 'object'
2527
+ | 'ol'
2528
+ | 'optgroup'
2529
+ | 'option'
2530
+ | 'output'
2531
+ | 'p'
2532
+ | 'param'
2533
+ | 'picture'
2534
+ | 'pre'
2535
+ | 'progress'
2536
+ | 'q'
2537
+ | 'rb'
2538
+ | 'rp'
2539
+ | 'rt'
2540
+ | 'rtc'
2541
+ | 'ruby'
2542
+ | 's'
2543
+ | 'samp'
2544
+ | 'script'
2545
+ | 'section'
2546
+ | 'select'
2547
+ | 'slot'
2548
+ | 'small'
2549
+ | 'source'
2550
+ | 'span'
2551
+ | 'strong'
2552
+ | 'style'
2553
+ | 'sub'
2554
+ | 'summary'
2555
+ | 'sup'
2556
+ | 'svg'
2557
+ | 'table'
2558
+ | 'tbody'
2559
+ | 'td'
2560
+ | 'template'
2561
+ | 'textarea'
2562
+ | 'tfoot'
2563
+ | 'th'
2564
+ | 'thead'
2565
+ | 'time'
2566
+ | 'title'
2567
+ | 'tr'
2568
+ | 'track'
2569
+ | 'u'
2570
+ | 'ul'
2571
+ | 'var'
2572
+ | 'video'
2573
+ | 'wbr'
2574
+
2575
+ type ElementType = IntrinsicElement | Component
2576
+
2577
+ type ComponentProps<T extends ElementType> = T extends keyof JSX.IntrinsicElements
2578
+ ? JSX.IntrinsicElements[T]
2579
+ : T extends Component<infer Props>
2580
+ ? Props
2581
+ : never
2582
+
2583
+ type ${componentName}<T extends ElementType> = FunctionalComponent<ComponentProps<T>>
2584
+ >
2585
+
2586
+ interface JsxFactory {
2587
+ <T extends ElementType>(component: T): ${componentName}<T>
2588
+ }
2589
+
2590
+ type JsxElements = { [K in keyof JSX.IntrinsicElements]: ${componentName}<K> }
2591
+
2592
+ export type ${upperName} = JsxFactory & JsxElements
2593
+
2594
+ export type ${typeName}<T extends ElementType> = ComponentProps<T>
2595
+ `
2596
+ };
2597
+ }
2598
+
1969
2599
  // src/artifacts/jsx.ts
1970
2600
  var typesMap = {
1971
2601
  react: generateReactJsxTypes,
@@ -1974,10 +2604,18 @@ var typesMap = {
1974
2604
  vue: generateVueJsxTypes,
1975
2605
  qwik: generateQwikJsxTypes
1976
2606
  };
2607
+ var typesStringLiteralMap = {
2608
+ react: generateSolidJsxStringLiteralTypes,
2609
+ solid: generateReactJsxStringLiteralTypes,
2610
+ qwik: generateQwikJsxStringLiteralTypes,
2611
+ preact: generatePreactJsxStringLiteralTypes,
2612
+ vue: generateVueJsxStringLiteralTypes
2613
+ };
1977
2614
  function generateJsxTypes(ctx) {
1978
2615
  if (!ctx.jsx.framework)
1979
2616
  return;
1980
- return typesMap[ctx.jsx.framework](ctx);
2617
+ const type = ctx.isTemplateLiteralSyntax ? typesStringLiteralMap[ctx.jsx.framework] : typesMap[ctx.jsx.framework];
2618
+ return type?.(ctx);
1981
2619
  }
1982
2620
  var factoryMap = {
1983
2621
  react: generateReactJsxFactory,
@@ -1986,10 +2624,18 @@ var factoryMap = {
1986
2624
  vue: generateVueJsxFactory,
1987
2625
  qwik: generateQwikJsxFactory
1988
2626
  };
2627
+ var factoryStringLiteralMap = {
2628
+ react: generateReactJsxStringLiteralFactory,
2629
+ solid: generateSolidJsxStringLiteralFactory,
2630
+ qwik: generateQwikJsxStringLiteralFactory,
2631
+ preact: generatePreactJsxStringLiteralFactory,
2632
+ vue: generateVueJsxStringLiteralFactory
2633
+ };
1989
2634
  function generateJsxFactory(ctx) {
1990
2635
  if (!ctx.jsx.framework)
1991
2636
  return;
1992
- return factoryMap[ctx.jsx.framework](ctx);
2637
+ const factory = ctx.isTemplateLiteralSyntax ? factoryStringLiteralMap[ctx.jsx.framework] : factoryMap[ctx.jsx.framework];
2638
+ return factory?.(ctx);
1993
2639
  }
1994
2640
  var patternMap = {
1995
2641
  react: generateReactJsxPattern,
@@ -1999,6 +2645,8 @@ var patternMap = {
1999
2645
  qwik: generateQwikJsxPattern
2000
2646
  };
2001
2647
  function generateJsxPatterns(ctx) {
2648
+ if (ctx.isTemplateLiteralSyntax)
2649
+ return [];
2002
2650
  if (ctx.patterns.isEmpty() && !ctx.jsx.framework)
2003
2651
  return [];
2004
2652
  return patternMap[ctx.jsx.framework](ctx);
@@ -2066,7 +2714,7 @@ var recipe_d_ts_default = {
2066
2714
 
2067
2715
  // src/artifacts/generated/pattern.d.ts.json
2068
2716
  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: 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"
2717
+ 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
2718
  };
2071
2719
 
2072
2720
  // src/artifacts/generated/parts.d.ts.json
@@ -2093,9 +2741,9 @@ function getGeneratedTypes() {
2093
2741
  }
2094
2742
 
2095
2743
  // src/artifacts/types/main.ts
2096
- var import_outdent25 = require("outdent");
2744
+ var import_outdent37 = require("outdent");
2097
2745
  var generateTypesEntry = () => ({
2098
- global: import_outdent25.outdent`
2746
+ global: import_outdent37.outdent`
2099
2747
  import type { RecipeVariantRecord, RecipeConfig } from './recipe'
2100
2748
  import type { Parts } from './parts'
2101
2749
  import type { PatternConfig } from './pattern'
@@ -2112,19 +2760,19 @@ var generateTypesEntry = () => ({
2112
2760
  export function defineParts<T extends Parts>(parts: T): (config: Partial<Record<keyof T, SystemStyleObject>>) => Partial<Record<keyof T, SystemStyleObject>>;
2113
2761
  }
2114
2762
  `,
2115
- index: import_outdent25.outdent`
2763
+ index: import_outdent37.outdent`
2116
2764
  import './global'
2117
2765
  export type { ConditionalValue } from './conditions'
2118
2766
  export type { GlobalStyleObject, JsxStyleProps, SystemStyleObject } from './system-types'
2119
2767
 
2120
2768
  `,
2121
- helpers: import_outdent25.outdent`
2769
+ helpers: import_outdent37.outdent`
2122
2770
  export type Pretty<T> = T extends infer U ? { [K in keyof U]: U[K] } : never
2123
2771
  `
2124
2772
  });
2125
2773
 
2126
2774
  // src/artifacts/types/prop-types.ts
2127
- var import_outdent26 = require("outdent");
2775
+ var import_outdent38 = require("outdent");
2128
2776
  function generatePropTypes(ctx) {
2129
2777
  const {
2130
2778
  config: { strictTokens },
@@ -2132,7 +2780,7 @@ function generatePropTypes(ctx) {
2132
2780
  } = ctx;
2133
2781
  const strictText = `${strictTokens ? "" : " | CssValue<T>"}`;
2134
2782
  const result = [
2135
- import_outdent26.outdent`
2783
+ import_outdent38.outdent`
2136
2784
  import type { ConditionalValue } from './conditions';
2137
2785
  import type { CssProperties } from './system-types'
2138
2786
  import type { Tokens } from '../tokens'
@@ -2155,7 +2803,7 @@ function generatePropTypes(ctx) {
2155
2803
  result.push(` ${key}: Shorthand<${JSON.stringify(value)}>;`);
2156
2804
  });
2157
2805
  result.push("}");
2158
- return import_outdent26.outdent`
2806
+ return import_outdent38.outdent`
2159
2807
  ${result.join("\n")}
2160
2808
 
2161
2809
  export type PropertyValue<T extends string> = T extends keyof PropertyTypes
@@ -2168,10 +2816,10 @@ function generatePropTypes(ctx) {
2168
2816
 
2169
2817
  // src/artifacts/types/style-props.ts
2170
2818
  var import_is_valid_prop = require("@pandacss/is-valid-prop");
2171
- var import_outdent27 = __toESM(require("outdent"));
2819
+ var import_outdent39 = __toESM(require("outdent"));
2172
2820
  function generateStyleProps(ctx) {
2173
2821
  const props = new Set(import_is_valid_prop.allCssProperties.concat(ctx.utility.keys()));
2174
- return import_outdent27.default`
2822
+ return import_outdent39.default`
2175
2823
  import type { ConditionalValue } from './conditions'
2176
2824
  import type { PropertyValue } from './prop-type'
2177
2825
  import type { Token } from '../tokens'
@@ -2188,7 +2836,7 @@ function generateStyleProps(ctx) {
2188
2836
 
2189
2837
  // src/artifacts/types/token-types.ts
2190
2838
  var import_shared3 = require("@pandacss/shared");
2191
- var import_outdent28 = require("outdent");
2839
+ var import_outdent40 = require("outdent");
2192
2840
  var import_pluralize = __toESM(require("pluralize"));
2193
2841
  var categories = [
2194
2842
  "zIndex",
@@ -2233,7 +2881,7 @@ function generateTokenTypes(ctx) {
2233
2881
  result.add("} & { [token: string]: never }");
2234
2882
  set.add(Array.from(result).join("\n"));
2235
2883
  set.add(`export type TokenCategory = ${(0, import_shared3.unionType)(categories)}`);
2236
- return import_outdent28.outdent.string(Array.from(set).join("\n\n"));
2884
+ return import_outdent40.outdent.string(Array.from(set).join("\n\n"));
2237
2885
  }
2238
2886
 
2239
2887
  // src/artifacts/index.ts
@@ -2291,8 +2939,8 @@ function setupTypes(ctx) {
2291
2939
  };
2292
2940
  }
2293
2941
  function setupCss(ctx) {
2294
- const code = generateCssFn(ctx);
2295
- const conditions = generateConditions(ctx);
2942
+ const code = ctx.isTemplateLiteralSyntax ? generateStringLiteralCssFn(ctx) : generateCssFn(ctx);
2943
+ const conditions = ctx.isTemplateLiteralSyntax ? generateStringLiteralConditions(ctx) : generateConditions(ctx);
2296
2944
  return {
2297
2945
  dir: ctx.paths.css,
2298
2946
  files: [
@@ -2303,6 +2951,8 @@ function setupCss(ctx) {
2303
2951
  };
2304
2952
  }
2305
2953
  function setupCva(ctx) {
2954
+ if (ctx.isTemplateLiteralSyntax)
2955
+ return;
2306
2956
  const code = generateCvaFn(ctx);
2307
2957
  return {
2308
2958
  dir: ctx.paths.css,
@@ -2328,8 +2978,8 @@ function setupRecipes(ctx) {
2328
2978
  return;
2329
2979
  const indexFiles = files.filter((file) => !file.name.includes("create-recipe"));
2330
2980
  const index = {
2331
- js: import_outdent29.default.string(indexFiles.map((file) => ctx.file.export(`./${file.name}`)).join("\n")),
2332
- dts: import_outdent29.default.string(indexFiles.map((file) => `export * from './${file.name}'`).join("\n"))
2981
+ js: import_outdent41.default.string(indexFiles.map((file) => ctx.file.export(`./${file.name}`)).join("\n")),
2982
+ dts: import_outdent41.default.string(indexFiles.map((file) => `export * from './${file.name}'`).join("\n"))
2333
2983
  };
2334
2984
  return {
2335
2985
  dir: ctx.paths.recipe,
@@ -2342,12 +2992,14 @@ function setupRecipes(ctx) {
2342
2992
  };
2343
2993
  }
2344
2994
  function setupPatterns(ctx) {
2995
+ if (ctx.isTemplateLiteralSyntax)
2996
+ return;
2345
2997
  const files = generatePattern(ctx);
2346
2998
  if (!files)
2347
2999
  return;
2348
3000
  const index = {
2349
- js: import_outdent29.default.string(files.map((file) => ctx.file.export(`./${file.name}`)).join("\n")),
2350
- dts: import_outdent29.default.string(files.map((file) => `export * from './${file.name}'`).join("\n"))
3001
+ js: import_outdent41.default.string(files.map((file) => ctx.file.export(`./${file.name}`)).join("\n")),
3002
+ dts: import_outdent41.default.string(files.map((file) => `export * from './${file.name}'`).join("\n"))
2351
3003
  };
2352
3004
  return {
2353
3005
  dir: ctx.paths.pattern,
@@ -2367,13 +3019,13 @@ function setupJsx(ctx) {
2367
3019
  const factory = generateJsxFactory(ctx);
2368
3020
  const patterns = generateJsxPatterns(ctx);
2369
3021
  const index = {
2370
- js: import_outdent29.default`
3022
+ js: import_outdent41.default`
2371
3023
  ${ctx.file.export("./factory")}
2372
- ${import_outdent29.default.string(patterns.map((file) => ctx.file.export(`./${file.name}`)).join("\n"))}
3024
+ ${import_outdent41.default.string(patterns.map((file) => ctx.file.export(`./${file.name}`)).join("\n"))}
2373
3025
  `,
2374
- dts: import_outdent29.default`
3026
+ dts: import_outdent41.default`
2375
3027
  export * from './factory'
2376
- ${import_outdent29.default.string(patterns.map((file) => `export * from './${file.name}'`).join("\n"))}
3028
+ ${import_outdent41.default.string(patterns.map((file) => `export * from './${file.name}'`).join("\n"))}
2377
3029
  export type { ${ctx.jsx.typeName} } from '../types/jsx'
2378
3030
  `
2379
3031
  };
@@ -2382,7 +3034,7 @@ function setupJsx(ctx) {
2382
3034
  files: [
2383
3035
  ...patterns.map((file) => ({ file: ctx.file.ext(file.name), code: file.js })),
2384
3036
  ...patterns.map((file) => ({ file: `${file.name}.d.ts`, code: file.dts })),
2385
- { file: ctx.file.ext("is-valid-prop"), code: isValidProp.js },
3037
+ { file: ctx.file.ext("is-valid-prop"), code: isValidProp?.js },
2386
3038
  { file: "factory.d.ts", code: types.jsxFactory },
2387
3039
  { file: ctx.file.ext("factory"), code: factory?.js },
2388
3040
  { file: "index.d.ts", code: index.dts },
@@ -2392,15 +3044,15 @@ function setupJsx(ctx) {
2392
3044
  }
2393
3045
  function setupCssIndex(ctx) {
2394
3046
  const index = {
2395
- js: import_outdent29.default`
3047
+ js: import_outdent41.default`
2396
3048
  ${ctx.file.export("./css")}
2397
3049
  ${ctx.file.export("./cx")}
2398
- ${ctx.file.export("./cva")}
3050
+ ${ctx.isTemplateLiteralSyntax ? "" : ctx.file.export("./cva")}
2399
3051
  `,
2400
- dts: import_outdent29.default`
3052
+ dts: import_outdent41.default`
2401
3053
  export * from './css'
2402
3054
  export * from './cx'
2403
- export * from './cva'
3055
+ ${ctx.isTemplateLiteralSyntax ? "" : `export * from './cva'`}
2404
3056
  `
2405
3057
  };
2406
3058
  return {
@@ -2472,9 +3124,9 @@ var generateFlattenedCss = (ctx) => (options) => {
2472
3124
  const { theme: { keyframes } = {}, preflight, minify, staticCss } = ctx.config;
2473
3125
  const unresolved = [
2474
3126
  "@layer reset, base, tokens, recipes, utilities;",
3127
+ preflight && "@import './reset.css';",
2475
3128
  "@import './global.css';",
2476
3129
  staticCss && "@import './static.css';",
2477
- preflight && "@import './reset.css';",
2478
3130
  !ctx.tokens.isEmpty && "@import './tokens/index.css';",
2479
3131
  keyframes && "@import './tokens/keyframes.css';"
2480
3132
  ].filter(Boolean).join("\n\n");
@@ -2582,6 +3234,7 @@ var helpers = {
2582
3234
  var getBaseEngine = (conf) => {
2583
3235
  const { config } = conf;
2584
3236
  const theme = config.theme ?? {};
3237
+ const isTemplateLiteralSyntax = config.syntax === "template-literal";
2585
3238
  const hash = {
2586
3239
  tokens: (0, import_lil_fp.isBool)(config.hash) ? config.hash : config.hash?.cssVar,
2587
3240
  className: (0, import_lil_fp.isBool)(config.hash) ? config.hash : config.hash?.className
@@ -2600,12 +3253,12 @@ var getBaseEngine = (conf) => {
2600
3253
  const utility = new import_core4.Utility({
2601
3254
  prefix: prefix.className,
2602
3255
  tokens,
2603
- config: config.utilities,
3256
+ config: isTemplateLiteralSyntax ? {} : config.utilities,
2604
3257
  separator: config.separator,
2605
3258
  shorthands: config.shorthands
2606
3259
  });
2607
3260
  const conditions = new import_core4.Conditions({
2608
- conditions: config.conditions,
3261
+ conditions: isTemplateLiteralSyntax ? {} : config.conditions,
2609
3262
  breakpoints: config.theme?.breakpoints
2610
3263
  });
2611
3264
  const { textStyles, layerStyles } = theme;
@@ -2643,6 +3296,7 @@ var getBaseEngine = (conf) => {
2643
3296
  };
2644
3297
  return {
2645
3298
  ...conf,
3299
+ isTemplateLiteralSyntax,
2646
3300
  studio,
2647
3301
  hash,
2648
3302
  prefix,
@@ -2724,7 +3378,7 @@ var getPatternEngine = (config) => {
2724
3378
  return Object.entries(patterns).map(([name, pattern]) => ({
2725
3379
  type: "pattern",
2726
3380
  name: pattern.jsx ?? (0, import_shared7.capitalize)(name),
2727
- props: Object.keys(pattern.properties),
3381
+ props: Object.keys(pattern?.properties ?? {}),
2728
3382
  baseName: name
2729
3383
  }));
2730
3384
  }),
@@ -2764,6 +3418,7 @@ var defaults = (conf) => ({
2764
3418
  jsxFactory: "styled",
2765
3419
  outExtension: "mjs",
2766
3420
  shorthands: true,
3421
+ syntax: "object-literal",
2767
3422
  ...conf.config
2768
3423
  }
2769
3424
  });
@@ -2773,25 +3428,31 @@ var getImportMap = (outdir) => ({
2773
3428
  pattern: `${outdir}/patterns`,
2774
3429
  jsx: `${outdir}/jsx`
2775
3430
  });
2776
- var createGenerator = (conf) => (0, import_lil_fp3.pipe)(
2777
- getEngine(defaults(conf)),
2778
- import_lil_fp3.Obj.assign((ctx) => ({
3431
+ var createGenerator = (conf) => {
3432
+ const ctx = getEngine(defaults(conf));
3433
+ const { config, jsx, isValidProperty, patterns, recipes } = ctx;
3434
+ const compilerOptions = conf.tsconfig?.compilerOptions ?? {};
3435
+ const baseUrl = compilerOptions.baseUrl ?? "";
3436
+ const cwd = conf.config.cwd;
3437
+ const relativeBaseUrl = baseUrl ? baseUrl.replace(cwd, "").slice(1) + "/" : cwd;
3438
+ return {
3439
+ ...ctx,
2779
3440
  getArtifacts: generateArtifacts(ctx),
2780
3441
  getCss: generateFlattenedCss(ctx),
2781
3442
  getParserCss: generateParserCss(ctx),
2782
- messages: getMessages(ctx)
2783
- })),
2784
- import_lil_fp3.Obj.bind("parserOptions", ({ config: { outdir }, jsx, isValidProperty, patterns, recipes }) => ({
2785
- importMap: getImportMap(outdir),
2786
- jsx: {
2787
- factory: jsx.factoryName,
2788
- isStyleProp: isValidProperty,
2789
- nodes: [...patterns.nodes, ...recipes.nodes]
2790
- },
2791
- getRecipeName: recipes.getFnName,
2792
- getRecipeByName: recipes.getConfig
2793
- }))
2794
- );
3443
+ messages: getMessages(ctx),
3444
+ parserOptions: {
3445
+ importMap: getImportMap(config.outdir.replace(relativeBaseUrl, "")),
3446
+ jsx: {
3447
+ factory: jsx.factoryName,
3448
+ isStyleProp: isValidProperty,
3449
+ nodes: [...patterns.nodes, ...recipes.nodes]
3450
+ },
3451
+ getRecipeName: recipes.getFnName,
3452
+ getRecipeByName: recipes.getConfig
3453
+ }
3454
+ };
3455
+ };
2795
3456
  // Annotate the CommonJS export names for ESM import in node:
2796
3457
  0 && (module.exports = {
2797
3458
  createGenerator,