@pandacss/generator 0.3.2 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +267 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +775 -110
- package/dist/index.mjs +815 -150
- package/package.json +8 -8
package/dist/index.js
CHANGED
|
@@ -42,6 +42,7 @@ __export(messages_exports, {
|
|
|
42
42
|
buildComplete: () => buildComplete,
|
|
43
43
|
codegenComplete: () => codegenComplete,
|
|
44
44
|
configExists: () => configExists,
|
|
45
|
+
configWatch: () => configWatch,
|
|
45
46
|
getMessages: () => getMessages,
|
|
46
47
|
noExtract: () => noExtract,
|
|
47
48
|
thankYou: () => thankYou,
|
|
@@ -65,7 +66,7 @@ var artifactsGenerated = (ctx) => {
|
|
|
65
66
|
!tokens.isEmpty && import_outdent.outdent`
|
|
66
67
|
${tick} ${(0, import_logger.quote)(outdir, "/tokens")}: the css variables and js function to query your tokens
|
|
67
68
|
`,
|
|
68
|
-
!patterns.isEmpty() && import_outdent.outdent`
|
|
69
|
+
!patterns.isEmpty() && !ctx.isTemplateLiteralSyntax && import_outdent.outdent`
|
|
69
70
|
${tick} ${(0, import_logger.quote)(outdir, "/patterns")}: functions to implement apply common layout patterns
|
|
70
71
|
`,
|
|
71
72
|
!recipes.isEmpty() && import_outdent.outdent`
|
|
@@ -110,6 +111,9 @@ var noExtract = () => import_outdent.outdent`
|
|
|
110
111
|
var watch = () => import_outdent.outdent`
|
|
111
112
|
Watching for file changes...
|
|
112
113
|
`;
|
|
114
|
+
var configWatch = () => import_outdent.outdent`
|
|
115
|
+
Watching for config file changes...
|
|
116
|
+
`;
|
|
113
117
|
var buildComplete = (count) => import_outdent.outdent`
|
|
114
118
|
Successfully extracted css from ${count} file(s) ✨
|
|
115
119
|
`;
|
|
@@ -120,7 +124,8 @@ var getMessages = (ctx) => ({
|
|
|
120
124
|
codegenComplete,
|
|
121
125
|
noExtract,
|
|
122
126
|
watch,
|
|
123
|
-
buildComplete
|
|
127
|
+
buildComplete,
|
|
128
|
+
configWatch
|
|
124
129
|
});
|
|
125
130
|
|
|
126
131
|
// src/generator.ts
|
|
@@ -128,7 +133,7 @@ var import_lil_fp3 = require("lil-fp");
|
|
|
128
133
|
|
|
129
134
|
// src/artifacts/index.ts
|
|
130
135
|
var import_shared4 = require("@pandacss/shared");
|
|
131
|
-
var
|
|
136
|
+
var import_outdent41 = __toESM(require("outdent"));
|
|
132
137
|
|
|
133
138
|
// src/artifacts/css/global-css.ts
|
|
134
139
|
var generateGlobalCss = (ctx) => {
|
|
@@ -572,8 +577,39 @@ function generateConditions(ctx) {
|
|
|
572
577
|
};
|
|
573
578
|
}
|
|
574
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
|
+
|
|
575
611
|
// src/artifacts/js/css-fn.ts
|
|
576
|
-
var
|
|
612
|
+
var import_outdent4 = require("outdent");
|
|
577
613
|
var stringify = (v) => JSON.stringify(Object.fromEntries(v), null, 2);
|
|
578
614
|
function generateCssFn(ctx) {
|
|
579
615
|
const {
|
|
@@ -583,11 +619,11 @@ function generateCssFn(ctx) {
|
|
|
583
619
|
} = ctx;
|
|
584
620
|
const { separator } = utility;
|
|
585
621
|
return {
|
|
586
|
-
dts:
|
|
622
|
+
dts: import_outdent4.outdent`
|
|
587
623
|
import type { SystemStyleObject } from '../types'
|
|
588
624
|
export declare function css(styles: SystemStyleObject): string
|
|
589
625
|
`,
|
|
590
|
-
js:
|
|
626
|
+
js: import_outdent4.outdent`
|
|
591
627
|
${ctx.file.import("createCss, createMergeCss, hypenateProperty, withoutSpace", "../helpers")}
|
|
592
628
|
${ctx.file.import("sortConditions, finalizeConditions", "./conditions")}
|
|
593
629
|
|
|
@@ -630,11 +666,58 @@ function generateCssFn(ctx) {
|
|
|
630
666
|
};
|
|
631
667
|
}
|
|
632
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
|
+
|
|
633
716
|
// src/artifacts/js/cva.ts
|
|
634
|
-
var
|
|
717
|
+
var import_outdent6 = require("outdent");
|
|
635
718
|
function generateCvaFn(ctx) {
|
|
636
719
|
return {
|
|
637
|
-
js:
|
|
720
|
+
js: import_outdent6.outdent`
|
|
638
721
|
${ctx.file.import("compact, splitProps", "../helpers")}
|
|
639
722
|
${ctx.file.import("css, mergeCss", "./css")}
|
|
640
723
|
|
|
@@ -700,7 +783,7 @@ function generateCvaFn(ctx) {
|
|
|
700
783
|
}
|
|
701
784
|
|
|
702
785
|
`,
|
|
703
|
-
dts:
|
|
786
|
+
dts: import_outdent6.outdent`
|
|
704
787
|
import type { RecipeCreatorFn } from '../types/recipe'
|
|
705
788
|
|
|
706
789
|
export declare const cva: RecipeCreatorFn
|
|
@@ -712,10 +795,10 @@ function generateCvaFn(ctx) {
|
|
|
712
795
|
}
|
|
713
796
|
|
|
714
797
|
// src/artifacts/js/cx.ts
|
|
715
|
-
var
|
|
798
|
+
var import_outdent7 = __toESM(require("outdent"));
|
|
716
799
|
function generateCx() {
|
|
717
800
|
return {
|
|
718
|
-
js:
|
|
801
|
+
js: import_outdent7.default`
|
|
719
802
|
function cx() {
|
|
720
803
|
let str = '',
|
|
721
804
|
i = 0,
|
|
@@ -732,7 +815,7 @@ function generateCx() {
|
|
|
732
815
|
|
|
733
816
|
export { cx }
|
|
734
817
|
`,
|
|
735
|
-
dts:
|
|
818
|
+
dts: import_outdent7.default`
|
|
736
819
|
type Argument = string | boolean | null | undefined
|
|
737
820
|
|
|
738
821
|
/** Conditionally join classNames into a single string */
|
|
@@ -742,17 +825,17 @@ function generateCx() {
|
|
|
742
825
|
}
|
|
743
826
|
|
|
744
827
|
// src/artifacts/js/helpers.ts
|
|
745
|
-
var
|
|
828
|
+
var import_outdent8 = require("outdent");
|
|
746
829
|
|
|
747
830
|
// src/artifacts/generated/helpers.mjs.json
|
|
748
831
|
var helpers_mjs_default = {
|
|
749
|
-
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'
|
|
750
833
|
};
|
|
751
834
|
|
|
752
835
|
// src/artifacts/js/helpers.ts
|
|
753
836
|
function generateHelpers() {
|
|
754
837
|
return {
|
|
755
|
-
js:
|
|
838
|
+
js: import_outdent8.outdent`
|
|
756
839
|
${helpers_mjs_default.content}
|
|
757
840
|
|
|
758
841
|
export function __spreadValues(a, b){
|
|
@@ -768,11 +851,13 @@ function generateHelpers() {
|
|
|
768
851
|
|
|
769
852
|
// src/artifacts/generated/is-valid-prop.mjs.json
|
|
770
853
|
var is_valid_prop_mjs_default = {
|
|
771
|
-
content: '// src/index.ts\nvar userGenerated = [];\nvar allCssProperties = [\n "MsAccelerator",\n "MsBlockProgression",\n "MsContentZoomChaining",\n "MsContentZooming",\n "MsContentZoomLimit",\n "MsContentZoomLimitMax",\n "MsContentZoomLimitMin",\n "MsContentZoomSnap",\n "MsContentZoomSnapPoints",\n "MsContentZoomSnapType",\n "MsFilter",\n "MsFlowFrom",\n "MsFlowInto",\n "MsGridColumns",\n "MsGridRows",\n "MsHighContrastAdjust",\n "MsHyphenateLimitChars",\n "MsHyphenateLimitLines",\n "MsHyphenateLimitZone",\n "MsImeAlign",\n "MsOverflowStyle",\n "MsScrollbar3dlightColor",\n "MsScrollbarArrowColor",\n "MsScrollbarBaseColor",\n "MsScrollbarDarkshadowColor",\n "MsScrollbarFaceColor",\n "MsScrollbarHighlightColor",\n "MsScrollbarShadowColor",\n "MsScrollbarTrackColor",\n "MsScrollChaining",\n "MsScrollLimit",\n "MsScrollLimitXMax",\n "MsScrollLimitXMin",\n "MsScrollLimitYMax",\n "MsScrollLimitYMin",\n "MsScrollRails",\n "MsScrollSnapPointsX",\n "MsScrollSnapPointsY",\n "MsScrollSnapType",\n "MsScrollSnapX",\n "MsScrollSnapY",\n "MsScrollTranslation",\n "MsTextAutospace",\n "MsTouchSelect",\n "MsUserSelect",\n "MsWrapFlow",\n "MsWrapMargin",\n "MsWrapThrough",\n "MozAppearance",\n "MozBinding",\n "MozBorderBottomColors",\n "MozBorderLeftColors",\n "MozBorderRightColors",\n "MozBorderTopColors",\n "MozContextProperties",\n "MozFloatEdge",\n "MozForceBrokenImageIcon",\n "MozImageRegion",\n "MozOrient",\n "MozOutlineRadius",\n "MozOutlineRadiusBottomleft",\n "MozOutlineRadiusBottomright",\n "MozOutlineRadiusTopleft",\n "MozOutlineRadiusTopright",\n "MozStackSizing",\n "MozTextBlink",\n "MozUserFocus",\n "MozUserInput",\n "MozUserModify",\n "MozWindowDragging",\n "MozWindowShadow",\n "WebkitAppearance",\n "WebkitBorderBefore",\n "WebkitBorderBeforeColor",\n "WebkitBorderBeforeStyle",\n "WebkitBorderBeforeWidth",\n "WebkitBoxReflect",\n "WebkitLineClamp",\n "WebkitMask",\n "WebkitMaskAttachment",\n "WebkitMaskClip",\n "WebkitMaskComposite",\n "WebkitMaskImage",\n "WebkitMaskOrigin",\n "WebkitMaskPosition",\n "WebkitMaskPositionX",\n "WebkitMaskPositionY",\n "WebkitMaskRepeat",\n "WebkitMaskRepeatX",\n "WebkitMaskRepeatY",\n "WebkitMaskSize",\n "WebkitOverflowScrolling",\n "WebkitTapHighlightColor",\n "WebkitTextFillColor",\n "WebkitTextStroke",\n "WebkitTextStrokeColor",\n "WebkitTextStrokeWidth",\n "WebkitTouchCallout",\n "WebkitUserModify",\n "accentColor",\n "alignContent",\n "alignItems",\n "alignSelf",\n "alignTracks",\n "all",\n "animation",\n "animationComposition",\n "animationDelay",\n "animationDirection",\n "animationDuration",\n "animationFillMode",\n "animationIterationCount",\n "animationName",\n "animationPlayState",\n "animationTimingFunction",\n "animationTimeline",\n "appearance",\n "aspectRatio",\n "azimuth",\n "backdropFilter",\n "backfaceVisibility",\n "background",\n "backgroundAttachment",\n "backgroundBlendMode",\n "backgroundClip",\n "backgroundColor",\n "backgroundImage",\n "backgroundOrigin",\n "backgroundPosition",\n "backgroundPositionX",\n "backgroundPositionY",\n "backgroundRepeat",\n "backgroundSize",\n "blockOverflow",\n "blockSize",\n "border",\n "borderBlock",\n "borderBlockColor",\n "borderBlockStyle",\n "borderBlockWidth",\n "borderBlockEnd",\n "borderBlockEndColor",\n "borderBlockEndStyle",\n "borderBlockEndWidth",\n "borderBlockStart",\n "borderBlockStartColor",\n "borderBlockStartStyle",\n "borderBlockStartWidth",\n "borderBottom",\n "borderBottomColor",\n "borderBottomLeftRadius",\n "borderBottomRightRadius",\n "borderBottomStyle",\n "borderBottomWidth",\n "borderCollapse",\n "borderColor",\n "borderEndEndRadius",\n "borderEndStartRadius",\n "borderImage",\n "borderImageOutset",\n "borderImageRepeat",\n "borderImageSlice",\n "borderImageSource",\n "borderImageWidth",\n "borderInline",\n "borderInlineEnd",\n "borderInlineColor",\n "borderInlineStyle",\n "borderInlineWidth",\n "borderInlineEndColor",\n "borderInlineEndStyle",\n "borderInlineEndWidth",\n "borderInlineStart",\n "borderInlineStartColor",\n "borderInlineStartStyle",\n "borderInlineStartWidth",\n "borderLeft",\n "borderLeftColor",\n "borderLeftStyle",\n "borderLeftWidth",\n "borderRadius",\n "borderRight",\n "borderRightColor",\n "borderRightStyle",\n "borderRightWidth",\n "borderSpacing",\n "borderStartEndRadius",\n "borderStartStartRadius",\n "borderStyle",\n "borderTop",\n "borderTopColor",\n "borderTopLeftRadius",\n "borderTopRightRadius",\n "borderTopStyle",\n "borderTopWidth",\n "borderWidth",\n "bottom",\n "boxAlign",\n "boxDecorationBreak",\n "boxDirection",\n "boxFlex",\n "boxFlexGroup",\n "boxLines",\n "boxOrdinalGroup",\n "boxOrient",\n "boxPack",\n "boxShadow",\n "boxSizing",\n "breakAfter",\n "breakBefore",\n "breakInside",\n "captionSide",\n "caret",\n "caretColor",\n "caretShape",\n "clear",\n "clip",\n "clipPath",\n "color",\n "printColorAdjust",\n "colorScheme",\n "columnCount",\n "columnFill",\n "columnGap",\n "columnRule",\n "columnRuleColor",\n "columnRuleStyle",\n "columnRuleWidth",\n "columnSpan",\n "columnWidth",\n "columns",\n "contain",\n "containIntrinsicSize",\n "containIntrinsicBlockSize",\n "containIntrinsicHeight",\n "containIntrinsicInlineSize",\n "containIntrinsicWidth",\n "content",\n "contentVisibility",\n "counterIncrement",\n "counterReset",\n "counterSet",\n "cursor",\n "direction",\n "display",\n "emptyCells",\n "filter",\n "flex",\n "flexBasis",\n "flexDirection",\n "flexFlow",\n "flexGrow",\n "flexShrink",\n "flexWrap",\n "float",\n "font",\n "fontFamily",\n "fontFeatureSettings",\n "fontKerning",\n "fontLanguageOverride",\n "fontOpticalSizing",\n "fontVariationSettings",\n "fontSize",\n "fontSizeAdjust",\n "fontSmooth",\n "fontStretch",\n "fontStyle",\n "fontSynthesis",\n "fontVariant",\n "fontVariantAlternates",\n "fontVariantCaps",\n "fontVariantEastAsian",\n "fontVariantLigatures",\n "fontVariantNumeric",\n "fontVariantPosition",\n "fontWeight",\n "forcedColorAdjust",\n "gap",\n "grid",\n "gridArea",\n "gridAutoColumns",\n "gridAutoFlow",\n "gridAutoRows",\n "gridColumn",\n "gridColumnEnd",\n "gridColumnGap",\n "gridColumnStart",\n "gridGap",\n "gridRow",\n "gridRowEnd",\n "gridRowGap",\n "gridRowStart",\n "gridTemplate",\n "gridTemplateAreas",\n "gridTemplateColumns",\n "gridTemplateRows",\n "hangingPunctuation",\n "height",\n "hyphenateCharacter",\n "hyphenateLimitChars",\n "hyphens",\n "imageOrientation",\n "imageRendering",\n "imageResolution",\n "imeMode",\n "initialLetter",\n "initialLetterAlign",\n "inlineSize",\n "inputSecurity",\n "inset",\n "insetBlock",\n "insetBlockEnd",\n "insetBlockStart",\n "insetInline",\n "insetInlineEnd",\n "insetInlineStart",\n "isolation",\n "justifyContent",\n "justifyItems",\n "justifySelf",\n "justifyTracks",\n "left",\n "letterSpacing",\n "lineBreak",\n "lineClamp",\n "lineHeight",\n "lineHeightStep",\n "listStyle",\n "listStyleImage",\n "listStylePosition",\n "listStyleType",\n "margin",\n "marginBlock",\n "marginBlockEnd",\n "marginBlockStart",\n "marginBottom",\n "marginInline",\n "marginInlineEnd",\n "marginInlineStart",\n "marginLeft",\n "marginRight",\n "marginTop",\n "marginTrim",\n "mask",\n "maskBorder",\n "maskBorderMode",\n "maskBorderOutset",\n "maskBorderRepeat",\n "maskBorderSlice",\n "maskBorderSource",\n "maskBorderWidth",\n "maskClip",\n "maskComposite",\n "maskImage",\n "maskMode",\n "maskOrigin",\n "maskPosition",\n "maskRepeat",\n "maskSize",\n "maskType",\n "masonryAutoFlow",\n "mathDepth",\n "mathShift",\n "mathStyle",\n "maxBlockSize",\n "maxHeight",\n "maxInlineSize",\n "maxLines",\n "maxWidth",\n "minBlockSize",\n "minHeight",\n "minInlineSize",\n "minWidth",\n "mixBlendMode",\n "objectFit",\n "objectPosition",\n "offset",\n "offsetAnchor",\n "offsetDistance",\n "offsetPath",\n "offsetPosition",\n "offsetRotate",\n "opacity",\n "order",\n "orphans",\n "outline",\n "outlineColor",\n "outlineOffset",\n "outlineStyle",\n "outlineWidth",\n "overflow",\n "overflowAnchor",\n "overflowBlock",\n "overflowClipBox",\n "overflowClipMargin",\n "overflowInline",\n "overflowWrap",\n "overflowX",\n "overflowY",\n "overscrollBehavior",\n "overscrollBehaviorBlock",\n "overscrollBehaviorInline",\n "overscrollBehaviorX",\n "overscrollBehaviorY",\n "padding",\n "paddingBlock",\n "paddingBlockEnd",\n "paddingBlockStart",\n "paddingBottom",\n "paddingInline",\n "paddingInlineEnd",\n "paddingInlineStart",\n "paddingLeft",\n "paddingRight",\n "paddingTop",\n "pageBreakAfter",\n "pageBreakBefore",\n "pageBreakInside",\n "paintOrder",\n "perspective",\n "perspectiveOrigin",\n "placeContent",\n "placeItems",\n "placeSelf",\n "pointerEvents",\n "position",\n "quotes",\n "resize",\n "right",\n "rotate",\n "rowGap",\n "rubyAlign",\n "rubyMerge",\n "rubyPosition",\n "scale",\n "scrollbarColor",\n "scrollbarGutter",\n "scrollbarWidth",\n "scrollBehavior",\n "scrollMargin",\n "scrollMarginBlock",\n "scrollMarginBlockStart",\n "scrollMarginBlockEnd",\n "scrollMarginBottom",\n "scrollMarginInline",\n "scrollMarginInlineStart",\n "scrollMarginInlineEnd",\n "scrollMarginLeft",\n "scrollMarginRight",\n "scrollMarginTop",\n "scrollPadding",\n "scrollPaddingBlock",\n "scrollPaddingBlockStart",\n "scrollPaddingBlockEnd",\n "scrollPaddingBottom",\n "scrollPaddingInline",\n "scrollPaddingInlineStart",\n "scrollPaddingInlineEnd",\n "scrollPaddingLeft",\n "scrollPaddingRight",\n "scrollPaddingTop",\n "scrollSnapAlign",\n "scrollSnapCoordinate",\n "scrollSnapDestination",\n "scrollSnapPointsX",\n "scrollSnapPointsY",\n "scrollSnapStop",\n "scrollSnapType",\n "scrollSnapTypeX",\n "scrollSnapTypeY",\n "scrollTimeline",\n "scrollTimelineAxis",\n "scrollTimelineName",\n "shapeImageThreshold",\n "shapeMargin",\n "shapeOutside",\n "tabSize",\n "tableLayout",\n "textAlign",\n "textAlignLast",\n "textCombineUpright",\n "textDecoration",\n "textDecorationColor",\n "textDecorationLine",\n "textDecorationSkip",\n "textDecorationSkipInk",\n "textDecorationStyle",\n "textDecorationThickness",\n "textEmphasis",\n "textEmphasisColor",\n "textEmphasisPosition",\n "textEmphasisStyle",\n "textIndent",\n "textJustify",\n "textOrientation",\n "textOverflow",\n "textRendering",\n "textShadow",\n "textSizeAdjust",\n "textTransform",\n "textUnderlineOffset",\n "textUnderlinePosition",\n "top",\n "touchAction",\n "transform",\n "transformBox",\n "transformOrigin",\n "transformStyle",\n "transition",\n "transitionDelay",\n "transitionDuration",\n "transitionProperty",\n "transitionTimingFunction",\n "translate",\n "unicodeBidi",\n "userSelect",\n "verticalAlign",\n "visibility",\n "whiteSpace",\n "widows",\n "width",\n "willChange",\n "wordBreak",\n "wordSpacing",\n "wordWrap",\n "writingMode",\n "zIndex",\n "zoom",\n ...userGenerated\n];\nvar properties = new Map(allCssProperties.map((prop) => [prop, true]));\nfunction memo(fn) {\n const cache = /* @__PURE__ */ Object.create(null);\n return (arg) => {\n if (cache[arg] === void 0)\n cache[arg] = fn(arg);\n return cache[arg];\n };\n}\nvar isCssProperty = memo((prop) => {\n return properties.has(prop) || prop.startsWith("--");\n});\nexport {\n allCssProperties,\n isCssProperty\n};\n'
|
|
854
|
+
content: '// src/index.ts\nvar userGenerated = [];\nvar allCssProperties = [\n "MsAccelerator",\n "MsBlockProgression",\n "MsContentZoomChaining",\n "MsContentZooming",\n "MsContentZoomLimit",\n "MsContentZoomLimitMax",\n "MsContentZoomLimitMin",\n "MsContentZoomSnap",\n "MsContentZoomSnapPoints",\n "MsContentZoomSnapType",\n "MsFilter",\n "MsFlowFrom",\n "MsFlowInto",\n "MsGridColumns",\n "MsGridRows",\n "MsHighContrastAdjust",\n "MsHyphenateLimitChars",\n "MsHyphenateLimitLines",\n "MsHyphenateLimitZone",\n "MsImeAlign",\n "MsOverflowStyle",\n "MsScrollbar3dlightColor",\n "MsScrollbarArrowColor",\n "MsScrollbarBaseColor",\n "MsScrollbarDarkshadowColor",\n "MsScrollbarFaceColor",\n "MsScrollbarHighlightColor",\n "MsScrollbarShadowColor",\n "MsScrollbarTrackColor",\n "MsScrollChaining",\n "MsScrollLimit",\n "MsScrollLimitXMax",\n "MsScrollLimitXMin",\n "MsScrollLimitYMax",\n "MsScrollLimitYMin",\n "MsScrollRails",\n "MsScrollSnapPointsX",\n "MsScrollSnapPointsY",\n "MsScrollSnapType",\n "MsScrollSnapX",\n "MsScrollSnapY",\n "MsScrollTranslation",\n "MsTextAutospace",\n "MsTouchSelect",\n "MsUserSelect",\n "MsWrapFlow",\n "MsWrapMargin",\n "MsWrapThrough",\n "MozAppearance",\n "MozBinding",\n "MozBorderBottomColors",\n "MozBorderLeftColors",\n "MozBorderRightColors",\n "MozBorderTopColors",\n "MozContextProperties",\n "MozFloatEdge",\n "MozForceBrokenImageIcon",\n "MozImageRegion",\n "MozOrient",\n "MozOutlineRadius",\n "MozOutlineRadiusBottomleft",\n "MozOutlineRadiusBottomright",\n "MozOutlineRadiusTopleft",\n "MozOutlineRadiusTopright",\n "MozStackSizing",\n "MozTextBlink",\n "MozUserFocus",\n "MozUserInput",\n "MozUserModify",\n "MozWindowDragging",\n "MozWindowShadow",\n "WebkitAppearance",\n "WebkitBorderBefore",\n "WebkitBorderBeforeColor",\n "WebkitBorderBeforeStyle",\n "WebkitBorderBeforeWidth",\n "WebkitBoxReflect",\n "WebkitLineClamp",\n "WebkitMask",\n "WebkitMaskAttachment",\n "WebkitMaskClip",\n "WebkitMaskComposite",\n "WebkitMaskImage",\n "WebkitMaskOrigin",\n "WebkitMaskPosition",\n "WebkitMaskPositionX",\n "WebkitMaskPositionY",\n "WebkitMaskRepeat",\n "WebkitMaskRepeatX",\n "WebkitMaskRepeatY",\n "WebkitMaskSize",\n "WebkitOverflowScrolling",\n "WebkitTapHighlightColor",\n "WebkitTextFillColor",\n "WebkitTextStroke",\n "WebkitTextStrokeColor",\n "WebkitTextStrokeWidth",\n "WebkitTouchCallout",\n "WebkitUserModify",\n "accentColor",\n "alignContent",\n "alignItems",\n "alignSelf",\n "alignTracks",\n "all",\n "animation",\n "animationComposition",\n "animationDelay",\n "animationDirection",\n "animationDuration",\n "animationFillMode",\n "animationIterationCount",\n "animationName",\n "animationPlayState",\n "animationTimingFunction",\n "animationTimeline",\n "appearance",\n "aspectRatio",\n "azimuth",\n "backdropFilter",\n "backfaceVisibility",\n "background",\n "backgroundAttachment",\n "backgroundBlendMode",\n "backgroundClip",\n "backgroundColor",\n "backgroundImage",\n "backgroundOrigin",\n "backgroundPosition",\n "backgroundPositionX",\n "backgroundPositionY",\n "backgroundRepeat",\n "backgroundSize",\n "blockOverflow",\n "blockSize",\n "border",\n "borderBlock",\n "borderBlockColor",\n "borderBlockStyle",\n "borderBlockWidth",\n "borderBlockEnd",\n "borderBlockEndColor",\n "borderBlockEndStyle",\n "borderBlockEndWidth",\n "borderBlockStart",\n "borderBlockStartColor",\n "borderBlockStartStyle",\n "borderBlockStartWidth",\n "borderBottom",\n "borderBottomColor",\n "borderBottomLeftRadius",\n "borderBottomRightRadius",\n "borderBottomStyle",\n "borderBottomWidth",\n "borderCollapse",\n "borderColor",\n "borderEndEndRadius",\n "borderEndStartRadius",\n "borderImage",\n "borderImageOutset",\n "borderImageRepeat",\n "borderImageSlice",\n "borderImageSource",\n "borderImageWidth",\n "borderInline",\n "borderInlineEnd",\n "borderInlineColor",\n "borderInlineStyle",\n "borderInlineWidth",\n "borderInlineEndColor",\n "borderInlineEndStyle",\n "borderInlineEndWidth",\n "borderInlineStart",\n "borderInlineStartColor",\n "borderInlineStartStyle",\n "borderInlineStartWidth",\n "borderLeft",\n "borderLeftColor",\n "borderLeftStyle",\n "borderLeftWidth",\n "borderRadius",\n "borderRight",\n "borderRightColor",\n "borderRightStyle",\n "borderRightWidth",\n "borderSpacing",\n "borderStartEndRadius",\n "borderStartStartRadius",\n "borderStyle",\n "borderTop",\n "borderTopColor",\n "borderTopLeftRadius",\n "borderTopRightRadius",\n "borderTopStyle",\n "borderTopWidth",\n "borderWidth",\n "bottom",\n "boxAlign",\n "boxDecorationBreak",\n "boxDirection",\n "boxFlex",\n "boxFlexGroup",\n "boxLines",\n "boxOrdinalGroup",\n "boxOrient",\n "boxPack",\n "boxShadow",\n "boxSizing",\n "breakAfter",\n "breakBefore",\n "breakInside",\n "captionSide",\n "caret",\n "caretColor",\n "caretShape",\n "clear",\n "clip",\n "clipPath",\n "color",\n "colorScheme",\n "columnCount",\n "columnFill",\n "columnGap",\n "columnRule",\n "columnRuleColor",\n "columnRuleStyle",\n "columnRuleWidth",\n "columnSpan",\n "columnWidth",\n "columns",\n "contain",\n "containIntrinsicSize",\n "containIntrinsicBlockSize",\n "containIntrinsicHeight",\n "containIntrinsicInlineSize",\n "containIntrinsicWidth",\n "container",\n "containerName",\n "containerType",\n "content",\n "contentVisibility",\n "counterIncrement",\n "counterReset",\n "counterSet",\n "cursor",\n "direction",\n "display",\n "emptyCells",\n "filter",\n "flex",\n "flexBasis",\n "flexDirection",\n "flexFlow",\n "flexGrow",\n "flexShrink",\n "flexWrap",\n "float",\n "font",\n "fontFamily",\n "fontFeatureSettings",\n "fontKerning",\n "fontLanguageOverride",\n "fontOpticalSizing",\n "fontPalette",\n "fontVariationSettings",\n "fontSize",\n "fontSizeAdjust",\n "fontSmooth",\n "fontStretch",\n "fontStyle",\n "fontSynthesis",\n "fontVariant",\n "fontVariantAlternates",\n "fontVariantCaps",\n "fontVariantEastAsian",\n "fontVariantEmoji",\n "fontVariantLigatures",\n "fontVariantNumeric",\n "fontVariantPosition",\n "fontWeight",\n "forcedColorAdjust",\n "gap",\n "grid",\n "gridArea",\n "gridAutoColumns",\n "gridAutoFlow",\n "gridAutoRows",\n "gridColumn",\n "gridColumnEnd",\n "gridColumnGap",\n "gridColumnStart",\n "gridGap",\n "gridRow",\n "gridRowEnd",\n "gridRowGap",\n "gridRowStart",\n "gridTemplate",\n "gridTemplateAreas",\n "gridTemplateColumns",\n "gridTemplateRows",\n "hangingPunctuation",\n "height",\n "hyphenateCharacter",\n "hyphenateLimitChars",\n "hyphens",\n "imageOrientation",\n "imageRendering",\n "imageResolution",\n "imeMode",\n "initialLetter",\n "initialLetterAlign",\n "inlineSize",\n "inputSecurity",\n "inset",\n "insetBlock",\n "insetBlockEnd",\n "insetBlockStart",\n "insetInline",\n "insetInlineEnd",\n "insetInlineStart",\n "isolation",\n "justifyContent",\n "justifyItems",\n "justifySelf",\n "justifyTracks",\n "left",\n "letterSpacing",\n "lineBreak",\n "lineClamp",\n "lineHeight",\n "lineHeightStep",\n "listStyle",\n "listStyleImage",\n "listStylePosition",\n "listStyleType",\n "margin",\n "marginBlock",\n "marginBlockEnd",\n "marginBlockStart",\n "marginBottom",\n "marginInline",\n "marginInlineEnd",\n "marginInlineStart",\n "marginLeft",\n "marginRight",\n "marginTop",\n "marginTrim",\n "mask",\n "maskBorder",\n "maskBorderMode",\n "maskBorderOutset",\n "maskBorderRepeat",\n "maskBorderSlice",\n "maskBorderSource",\n "maskBorderWidth",\n "maskClip",\n "maskComposite",\n "maskImage",\n "maskMode",\n "maskOrigin",\n "maskPosition",\n "maskRepeat",\n "maskSize",\n "maskType",\n "masonryAutoFlow",\n "mathDepth",\n "mathShift",\n "mathStyle",\n "maxBlockSize",\n "maxHeight",\n "maxInlineSize",\n "maxLines",\n "maxWidth",\n "minBlockSize",\n "minHeight",\n "minInlineSize",\n "minWidth",\n "mixBlendMode",\n "objectFit",\n "objectPosition",\n "offset",\n "offsetAnchor",\n "offsetDistance",\n "offsetPath",\n "offsetPosition",\n "offsetRotate",\n "opacity",\n "order",\n "orphans",\n "outline",\n "outlineColor",\n "outlineOffset",\n "outlineStyle",\n "outlineWidth",\n "overflow",\n "overflowAnchor",\n "overflowBlock",\n "overflowClipBox",\n "overflowClipMargin",\n "overflowInline",\n "overflowWrap",\n "overflowX",\n "overflowY",\n "overscrollBehavior",\n "overscrollBehaviorBlock",\n "overscrollBehaviorInline",\n "overscrollBehaviorX",\n "overscrollBehaviorY",\n "padding",\n "paddingBlock",\n "paddingBlockEnd",\n "paddingBlockStart",\n "paddingBottom",\n "paddingInline",\n "paddingInlineEnd",\n "paddingInlineStart",\n "paddingLeft",\n "paddingRight",\n "paddingTop",\n "page",\n "pageBreakAfter",\n "pageBreakBefore",\n "pageBreakInside",\n "paintOrder",\n "perspective",\n "perspectiveOrigin",\n "placeContent",\n "placeItems",\n "placeSelf",\n "pointerEvents",\n "position",\n "printColorAdjust",\n "quotes",\n "resize",\n "right",\n "rotate",\n "rowGap",\n "rubyAlign",\n "rubyMerge",\n "rubyPosition",\n "scale",\n "scrollbarColor",\n "scrollbarGutter",\n "scrollbarWidth",\n "scrollBehavior",\n "scrollMargin",\n "scrollMarginBlock",\n "scrollMarginBlockStart",\n "scrollMarginBlockEnd",\n "scrollMarginBottom",\n "scrollMarginInline",\n "scrollMarginInlineStart",\n "scrollMarginInlineEnd",\n "scrollMarginLeft",\n "scrollMarginRight",\n "scrollMarginTop",\n "scrollPadding",\n "scrollPaddingBlock",\n "scrollPaddingBlockStart",\n "scrollPaddingBlockEnd",\n "scrollPaddingBottom",\n "scrollPaddingInline",\n "scrollPaddingInlineStart",\n "scrollPaddingInlineEnd",\n "scrollPaddingLeft",\n "scrollPaddingRight",\n "scrollPaddingTop",\n "scrollSnapAlign",\n "scrollSnapCoordinate",\n "scrollSnapDestination",\n "scrollSnapPointsX",\n "scrollSnapPointsY",\n "scrollSnapStop",\n "scrollSnapType",\n "scrollSnapTypeX",\n "scrollSnapTypeY",\n "scrollTimeline",\n "scrollTimelineAxis",\n "scrollTimelineName",\n "shapeImageThreshold",\n "shapeMargin",\n "shapeOutside",\n "tabSize",\n "tableLayout",\n "textAlign",\n "textAlignLast",\n "textCombineUpright",\n "textDecoration",\n "textDecorationColor",\n "textDecorationLine",\n "textDecorationSkip",\n "textDecorationSkipInk",\n "textDecorationStyle",\n "textDecorationThickness",\n "textEmphasis",\n "textEmphasisColor",\n "textEmphasisPosition",\n "textEmphasisStyle",\n "textIndent",\n "textJustify",\n "textOrientation",\n "textOverflow",\n "textRendering",\n "textShadow",\n "textSizeAdjust",\n "textTransform",\n "textUnderlineOffset",\n "textUnderlinePosition",\n "top",\n "touchAction",\n "transform",\n "transformBox",\n "transformOrigin",\n "transformStyle",\n "transition",\n "transitionDelay",\n "transitionDuration",\n "transitionProperty",\n "transitionTimingFunction",\n "translate",\n "unicodeBidi",\n "userSelect",\n "verticalAlign",\n "viewTransitionName",\n "visibility",\n "whiteSpace",\n "widows",\n "width",\n "willChange",\n "wordBreak",\n "wordSpacing",\n "wordWrap",\n "writingMode",\n "zIndex",\n "zoom",\n ...userGenerated\n];\nvar properties = new Map(allCssProperties.map((prop) => [prop, true]));\nfunction memo(fn) {\n const cache = /* @__PURE__ */ Object.create(null);\n return (arg) => {\n if (cache[arg] === void 0)\n cache[arg] = fn(arg);\n return cache[arg];\n };\n}\nvar selectorRegex = /&|@/;\nvar isCssProperty = memo((prop) => {\n return properties.has(prop) || prop.startsWith("--") || selectorRegex.test(prop);\n});\nexport {\n allCssProperties,\n isCssProperty\n};\n'
|
|
772
855
|
};
|
|
773
856
|
|
|
774
857
|
// src/artifacts/js/is-valid-prop.ts
|
|
775
858
|
function generateisValidProp(ctx) {
|
|
859
|
+
if (ctx.isTemplateLiteralSyntax)
|
|
860
|
+
return;
|
|
776
861
|
let content = is_valid_prop_mjs_default.content;
|
|
777
862
|
content = content.replace(
|
|
778
863
|
"var userGenerated = []",
|
|
@@ -786,7 +871,7 @@ function generateisValidProp(ctx) {
|
|
|
786
871
|
// src/artifacts/js/pattern.ts
|
|
787
872
|
var import_shared = require("@pandacss/shared");
|
|
788
873
|
var import_javascript_stringify = require("javascript-stringify");
|
|
789
|
-
var
|
|
874
|
+
var import_outdent9 = require("outdent");
|
|
790
875
|
var import_ts_pattern = require("ts-pattern");
|
|
791
876
|
function generatePattern(ctx) {
|
|
792
877
|
if (ctx.patterns.isEmpty())
|
|
@@ -804,7 +889,7 @@ function generatePattern(ctx) {
|
|
|
804
889
|
}
|
|
805
890
|
return {
|
|
806
891
|
name: dashName,
|
|
807
|
-
dts:
|
|
892
|
+
dts: import_outdent9.outdent`
|
|
808
893
|
import type { SystemStyleObject, ConditionalValue } from '../types'
|
|
809
894
|
import type { PropertyValue } from '../types/prop-type'
|
|
810
895
|
import type { Properties } from '../types/csstype'
|
|
@@ -828,7 +913,7 @@ function generatePattern(ctx) {
|
|
|
828
913
|
}).join("\n ")}
|
|
829
914
|
}
|
|
830
915
|
|
|
831
|
-
${strict ?
|
|
916
|
+
${strict ? import_outdent9.outdent`export declare function ${name}(options: ${upperName}Properties): string` : import_outdent9.outdent`
|
|
832
917
|
|
|
833
918
|
type ${upperName}Options = ${upperName}Properties & Omit<SystemStyleObject, keyof ${upperName}Properties ${blocklistType}>
|
|
834
919
|
|
|
@@ -837,7 +922,7 @@ function generatePattern(ctx) {
|
|
|
837
922
|
`}
|
|
838
923
|
|
|
839
924
|
`,
|
|
840
|
-
js:
|
|
925
|
+
js: import_outdent9.outdent`
|
|
841
926
|
${ctx.file.import(helperImports.join(", "), "../helpers")}
|
|
842
927
|
${ctx.file.import("css", "../css/index")}
|
|
843
928
|
|
|
@@ -854,7 +939,7 @@ transform`)}
|
|
|
854
939
|
|
|
855
940
|
// src/artifacts/js/recipe.ts
|
|
856
941
|
var import_shared2 = require("@pandacss/shared");
|
|
857
|
-
var
|
|
942
|
+
var import_outdent10 = require("outdent");
|
|
858
943
|
var stringify3 = (value) => JSON.stringify(value, null, 2);
|
|
859
944
|
var isBooleanValue = (value) => value === "true" || value === "false";
|
|
860
945
|
function generateRecipes(ctx) {
|
|
@@ -868,7 +953,7 @@ function generateRecipes(ctx) {
|
|
|
868
953
|
const createRecipeFn = {
|
|
869
954
|
name: "create-recipe",
|
|
870
955
|
dts: "",
|
|
871
|
-
js:
|
|
956
|
+
js: import_outdent10.outdent`
|
|
872
957
|
${ctx.file.import("css", "../css/css")}
|
|
873
958
|
${ctx.file.import("assertCompoundVariant, getCompoundVariantCss", "../css/cva")}
|
|
874
959
|
${ctx.file.import("cx", "../css/cx")}
|
|
@@ -915,7 +1000,7 @@ function generateRecipes(ctx) {
|
|
|
915
1000
|
const { name, description, defaultVariants, compoundVariants } = config;
|
|
916
1001
|
return {
|
|
917
1002
|
name: dashName,
|
|
918
|
-
js:
|
|
1003
|
+
js: import_outdent10.outdent`
|
|
919
1004
|
${ctx.file.import("splitProps", "../helpers")}
|
|
920
1005
|
${ctx.file.import("createRecipe", "./create-recipe")}
|
|
921
1006
|
|
|
@@ -936,7 +1021,7 @@ function generateRecipes(ctx) {
|
|
|
936
1021
|
splitVariantProps,
|
|
937
1022
|
})
|
|
938
1023
|
`,
|
|
939
|
-
dts:
|
|
1024
|
+
dts: import_outdent10.outdent`
|
|
940
1025
|
import type { ConditionalValue } from '../types'
|
|
941
1026
|
import type { Pretty } from '../types/helpers'
|
|
942
1027
|
|
|
@@ -974,7 +1059,7 @@ function generateRecipes(ctx) {
|
|
|
974
1059
|
}
|
|
975
1060
|
|
|
976
1061
|
// src/artifacts/js/token.ts
|
|
977
|
-
var
|
|
1062
|
+
var import_outdent11 = __toESM(require("outdent"));
|
|
978
1063
|
function generateTokenJs(ctx) {
|
|
979
1064
|
const { tokens } = ctx;
|
|
980
1065
|
const map = /* @__PURE__ */ new Map();
|
|
@@ -985,7 +1070,7 @@ function generateTokenJs(ctx) {
|
|
|
985
1070
|
});
|
|
986
1071
|
const obj = Object.fromEntries(map);
|
|
987
1072
|
return {
|
|
988
|
-
js:
|
|
1073
|
+
js: import_outdent11.default`
|
|
989
1074
|
const tokens = ${JSON.stringify(obj, null, 2)}
|
|
990
1075
|
|
|
991
1076
|
export function token(path, fallback) {
|
|
@@ -998,7 +1083,7 @@ function generateTokenJs(ctx) {
|
|
|
998
1083
|
|
|
999
1084
|
token.var = tokenVar
|
|
1000
1085
|
`,
|
|
1001
|
-
dts:
|
|
1086
|
+
dts: import_outdent11.default`
|
|
1002
1087
|
import type { Token } from './tokens'
|
|
1003
1088
|
|
|
1004
1089
|
export declare const token: {
|
|
@@ -1012,11 +1097,11 @@ function generateTokenJs(ctx) {
|
|
|
1012
1097
|
}
|
|
1013
1098
|
|
|
1014
1099
|
// src/artifacts/preact-jsx/jsx.ts
|
|
1015
|
-
var
|
|
1100
|
+
var import_outdent12 = require("outdent");
|
|
1016
1101
|
function generatePreactJsxFactory(ctx) {
|
|
1017
1102
|
const { factoryName, componentName } = ctx.jsx;
|
|
1018
1103
|
return {
|
|
1019
|
-
js:
|
|
1104
|
+
js: import_outdent12.outdent`
|
|
1020
1105
|
import { h } from 'preact'
|
|
1021
1106
|
import { forwardRef } from 'preact/compat'
|
|
1022
1107
|
import { useMemo } from 'preact/hooks'
|
|
@@ -1083,7 +1168,7 @@ function generatePreactJsxFactory(ctx) {
|
|
|
1083
1168
|
}
|
|
1084
1169
|
|
|
1085
1170
|
// src/artifacts/preact-jsx/pattern.ts
|
|
1086
|
-
var
|
|
1171
|
+
var import_outdent13 = require("outdent");
|
|
1087
1172
|
var import_ts_pattern2 = require("ts-pattern");
|
|
1088
1173
|
function generatePreactJsxPattern(ctx) {
|
|
1089
1174
|
const { typeName, factoryName } = ctx.jsx;
|
|
@@ -1092,7 +1177,7 @@ function generatePreactJsxPattern(ctx) {
|
|
|
1092
1177
|
const { description, jsxElement = "div" } = pattern.config;
|
|
1093
1178
|
return {
|
|
1094
1179
|
name: dashName,
|
|
1095
|
-
js:
|
|
1180
|
+
js: import_outdent13.outdent`
|
|
1096
1181
|
import { h } from 'preact'
|
|
1097
1182
|
import { forwardRef } from 'preact/compat'
|
|
1098
1183
|
${ctx.file.import(factoryName, "./factory")}
|
|
@@ -1101,12 +1186,12 @@ function generatePreactJsxPattern(ctx) {
|
|
|
1101
1186
|
export const ${jsxName} = forwardRef(function ${jsxName}(props, ref) {
|
|
1102
1187
|
${(0, import_ts_pattern2.match)(props.length).with(
|
|
1103
1188
|
0,
|
|
1104
|
-
() =>
|
|
1189
|
+
() => import_outdent13.outdent`
|
|
1105
1190
|
const styleProps = ${styleFnName}()
|
|
1106
1191
|
return h(${factoryName}.${jsxElement}, { ref, ...styleProps, ...props })
|
|
1107
1192
|
`
|
|
1108
1193
|
).otherwise(
|
|
1109
|
-
() =>
|
|
1194
|
+
() => import_outdent13.outdent`
|
|
1110
1195
|
const { ${props.join(", ")}, ...restProps } = props
|
|
1111
1196
|
const styleProps = ${styleFnName}({${props.join(", ")}})
|
|
1112
1197
|
return h(${factoryName}.${jsxElement}, { ref, ...styleProps, ...restProps })
|
|
@@ -1114,7 +1199,7 @@ function generatePreactJsxPattern(ctx) {
|
|
|
1114
1199
|
)}
|
|
1115
1200
|
})
|
|
1116
1201
|
`,
|
|
1117
|
-
dts:
|
|
1202
|
+
dts: import_outdent13.outdent`
|
|
1118
1203
|
import type { FunctionComponent } from 'preact'
|
|
1119
1204
|
import type { ${upperName}Properties } from '../patterns/${dashName}'
|
|
1120
1205
|
import type { ${typeName} } from '../types/jsx'
|
|
@@ -1129,15 +1214,15 @@ function generatePreactJsxPattern(ctx) {
|
|
|
1129
1214
|
}
|
|
1130
1215
|
|
|
1131
1216
|
// src/artifacts/preact-jsx/types.ts
|
|
1132
|
-
var
|
|
1217
|
+
var import_outdent14 = require("outdent");
|
|
1133
1218
|
function generatePreactJsxTypes(ctx) {
|
|
1134
1219
|
const { factoryName, componentName, upperName, typeName } = ctx.jsx;
|
|
1135
1220
|
return {
|
|
1136
|
-
jsxFactory:
|
|
1221
|
+
jsxFactory: import_outdent14.outdent`
|
|
1137
1222
|
import type { ${upperName} } from '../types/jsx'
|
|
1138
1223
|
export declare const ${factoryName}: ${upperName}
|
|
1139
1224
|
`,
|
|
1140
|
-
jsxType:
|
|
1225
|
+
jsxType: import_outdent14.outdent`
|
|
1141
1226
|
import type { ComponentProps, JSX } from 'preact'
|
|
1142
1227
|
import type { Assign, JsxStyleProps, JsxHTMLProps } from './system-types'
|
|
1143
1228
|
import type { RecipeDefinition, RecipeSelection, RecipeVariantRecord } from './recipe'
|
|
@@ -1171,12 +1256,96 @@ export type ${typeName}<T extends ElementType> = JsxHTMLProps<ComponentProps<T>,
|
|
|
1171
1256
|
};
|
|
1172
1257
|
}
|
|
1173
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
|
+
|
|
1174
1343
|
// src/artifacts/qwik-jsx/jsx.ts
|
|
1175
|
-
var
|
|
1344
|
+
var import_outdent17 = require("outdent");
|
|
1176
1345
|
function generateQwikJsxFactory(ctx) {
|
|
1177
1346
|
const { factoryName, componentName } = ctx.jsx;
|
|
1178
1347
|
return {
|
|
1179
|
-
js:
|
|
1348
|
+
js: import_outdent17.outdent`
|
|
1180
1349
|
import { h } from '@builder.io/qwik'
|
|
1181
1350
|
${ctx.file.import("css, cx, cva, assignCss", "../css/index")}
|
|
1182
1351
|
${ctx.file.import("splitProps, normalizeHTMLProps", "../helpers")}
|
|
@@ -1240,7 +1409,7 @@ function generateQwikJsxFactory(ctx) {
|
|
|
1240
1409
|
}
|
|
1241
1410
|
|
|
1242
1411
|
// src/artifacts/qwik-jsx/pattern.ts
|
|
1243
|
-
var
|
|
1412
|
+
var import_outdent18 = require("outdent");
|
|
1244
1413
|
var import_ts_pattern3 = require("ts-pattern");
|
|
1245
1414
|
function generateQwikJsxPattern(ctx) {
|
|
1246
1415
|
const { typeName, factoryName } = ctx.jsx;
|
|
@@ -1249,7 +1418,7 @@ function generateQwikJsxPattern(ctx) {
|
|
|
1249
1418
|
const { description, jsxElement = "div" } = pattern.config;
|
|
1250
1419
|
return {
|
|
1251
1420
|
name: dashName,
|
|
1252
|
-
js:
|
|
1421
|
+
js: import_outdent18.outdent`
|
|
1253
1422
|
import { h } from '@builder.io/qwik'
|
|
1254
1423
|
${ctx.file.import(factoryName, "./factory")}
|
|
1255
1424
|
${ctx.file.import(styleFnName, `../patterns/${dashName}`)}
|
|
@@ -1257,12 +1426,12 @@ function generateQwikJsxPattern(ctx) {
|
|
|
1257
1426
|
export const ${jsxName} = function ${jsxName}(props) {
|
|
1258
1427
|
${(0, import_ts_pattern3.match)(props.length).with(
|
|
1259
1428
|
0,
|
|
1260
|
-
() =>
|
|
1429
|
+
() => import_outdent18.outdent`
|
|
1261
1430
|
const styleProps = ${styleFnName}()
|
|
1262
1431
|
return h(${factoryName}.${jsxElement}, { ...styleProps, ...props })
|
|
1263
1432
|
`
|
|
1264
1433
|
).otherwise(
|
|
1265
|
-
() =>
|
|
1434
|
+
() => import_outdent18.outdent`
|
|
1266
1435
|
const { ${props.join(", ")}, ...restProps } = props
|
|
1267
1436
|
const styleProps = ${styleFnName}({${props.join(", ")}})
|
|
1268
1437
|
return h(${factoryName}.${jsxElement}, { ...styleProps, ...restProps })
|
|
@@ -1270,7 +1439,7 @@ function generateQwikJsxPattern(ctx) {
|
|
|
1270
1439
|
)}
|
|
1271
1440
|
}
|
|
1272
1441
|
`,
|
|
1273
|
-
dts:
|
|
1442
|
+
dts: import_outdent18.outdent`
|
|
1274
1443
|
import type { FunctionComponent } from '@builder.io/qwik'
|
|
1275
1444
|
import type { ${upperName}Properties } from '../patterns/${dashName}'
|
|
1276
1445
|
import type { ${typeName} } from '../types/jsx'
|
|
@@ -1289,15 +1458,15 @@ function generateQwikJsxPattern(ctx) {
|
|
|
1289
1458
|
}
|
|
1290
1459
|
|
|
1291
1460
|
// src/artifacts/qwik-jsx/types.ts
|
|
1292
|
-
var
|
|
1461
|
+
var import_outdent19 = require("outdent");
|
|
1293
1462
|
function generateQwikJsxTypes(ctx) {
|
|
1294
1463
|
const { factoryName, componentName, upperName, typeName } = ctx.jsx;
|
|
1295
1464
|
return {
|
|
1296
|
-
jsxFactory:
|
|
1465
|
+
jsxFactory: import_outdent19.outdent`
|
|
1297
1466
|
import { ${upperName} } from '../types/jsx'
|
|
1298
1467
|
export declare const ${factoryName}: ${upperName}
|
|
1299
1468
|
`,
|
|
1300
|
-
jsxType:
|
|
1469
|
+
jsxType: import_outdent19.outdent`
|
|
1301
1470
|
import type { FunctionComponent, QwikIntrinsicElements } from '@builder.io/qwik'
|
|
1302
1471
|
import type { Assign as _Assign, JsxStyleProps, PatchedHTMLProps } from './system-types'
|
|
1303
1472
|
import type { RecipeDefinition, RecipeSelection, RecipeVariantRecord } from './recipe'
|
|
@@ -1350,12 +1519,100 @@ export type ${typeName}<T extends ElementType> = Assign<ComponentProps<T>, JsxSt
|
|
|
1350
1519
|
};
|
|
1351
1520
|
}
|
|
1352
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
|
+
|
|
1353
1610
|
// src/artifacts/react-jsx/jsx.ts
|
|
1354
|
-
var
|
|
1611
|
+
var import_outdent22 = require("outdent");
|
|
1355
1612
|
function generateReactJsxFactory(ctx) {
|
|
1356
1613
|
const { factoryName, componentName } = ctx.jsx;
|
|
1357
1614
|
return {
|
|
1358
|
-
js:
|
|
1615
|
+
js: import_outdent22.outdent`
|
|
1359
1616
|
import { createElement, forwardRef, useMemo } from 'react'
|
|
1360
1617
|
${ctx.file.import("css, cx, cva, assignCss", "../css/index")}
|
|
1361
1618
|
${ctx.file.import("splitProps, normalizeHTMLProps", "../helpers")}
|
|
@@ -1421,7 +1678,7 @@ function generateReactJsxFactory(ctx) {
|
|
|
1421
1678
|
}
|
|
1422
1679
|
|
|
1423
1680
|
// src/artifacts/react-jsx/pattern.ts
|
|
1424
|
-
var
|
|
1681
|
+
var import_outdent23 = require("outdent");
|
|
1425
1682
|
var import_ts_pattern4 = require("ts-pattern");
|
|
1426
1683
|
function generateReactJsxPattern(ctx) {
|
|
1427
1684
|
const { typeName, factoryName } = ctx.jsx;
|
|
@@ -1430,7 +1687,7 @@ function generateReactJsxPattern(ctx) {
|
|
|
1430
1687
|
const { description, jsxElement = "div" } = pattern.config;
|
|
1431
1688
|
return {
|
|
1432
1689
|
name: dashName,
|
|
1433
|
-
js:
|
|
1690
|
+
js: import_outdent23.outdent`
|
|
1434
1691
|
import { createElement, forwardRef } from 'react'
|
|
1435
1692
|
${ctx.file.import(factoryName, "./factory")}
|
|
1436
1693
|
${ctx.file.import(styleFnName, `../patterns/${dashName}`)}
|
|
@@ -1438,12 +1695,12 @@ function generateReactJsxPattern(ctx) {
|
|
|
1438
1695
|
export const ${jsxName} = forwardRef(function ${jsxName}(props, ref) {
|
|
1439
1696
|
${(0, import_ts_pattern4.match)(props.length).with(
|
|
1440
1697
|
0,
|
|
1441
|
-
() =>
|
|
1698
|
+
() => import_outdent23.outdent`
|
|
1442
1699
|
const styleProps = ${styleFnName}()
|
|
1443
1700
|
return createElement(${factoryName}.${jsxElement}, { ref, ...styleProps, ...props })
|
|
1444
1701
|
`
|
|
1445
1702
|
).otherwise(
|
|
1446
|
-
() =>
|
|
1703
|
+
() => import_outdent23.outdent`
|
|
1447
1704
|
const { ${props.join(", ")}, ...restProps } = props
|
|
1448
1705
|
const styleProps = ${styleFnName}({${props.join(", ")}})
|
|
1449
1706
|
return createElement(${factoryName}.${jsxElement}, { ref, ...styleProps, ...restProps })
|
|
@@ -1451,7 +1708,7 @@ function generateReactJsxPattern(ctx) {
|
|
|
1451
1708
|
)}
|
|
1452
1709
|
})
|
|
1453
1710
|
`,
|
|
1454
|
-
dts:
|
|
1711
|
+
dts: import_outdent23.outdent`
|
|
1455
1712
|
import type { FunctionComponent } from 'react'
|
|
1456
1713
|
import type { ${upperName}Properties } from '../patterns/${dashName}'
|
|
1457
1714
|
import type { ${typeName} } from '../types/jsx'
|
|
@@ -1466,15 +1723,15 @@ function generateReactJsxPattern(ctx) {
|
|
|
1466
1723
|
}
|
|
1467
1724
|
|
|
1468
1725
|
// src/artifacts/react-jsx/types.ts
|
|
1469
|
-
var
|
|
1726
|
+
var import_outdent24 = require("outdent");
|
|
1470
1727
|
function generateReactJsxTypes(ctx) {
|
|
1471
1728
|
const { factoryName, componentName, upperName, typeName } = ctx.jsx;
|
|
1472
1729
|
return {
|
|
1473
|
-
jsxFactory:
|
|
1730
|
+
jsxFactory: import_outdent24.outdent`
|
|
1474
1731
|
import { ${upperName} } from '../types/jsx'
|
|
1475
1732
|
export declare const ${factoryName}: ${upperName}
|
|
1476
1733
|
`,
|
|
1477
|
-
jsxType:
|
|
1734
|
+
jsxType: import_outdent24.outdent`
|
|
1478
1735
|
import type { ComponentProps, ElementType } from 'react'
|
|
1479
1736
|
import type { Assign, JsxStyleProps, JsxHTMLProps } from './system-types'
|
|
1480
1737
|
import type { RecipeDefinition, RecipeSelection, RecipeVariantRecord } from './recipe'
|
|
@@ -1506,12 +1763,94 @@ export type ${typeName}<T extends ElementType> = JsxHTMLProps<ComponentProps<T>,
|
|
|
1506
1763
|
};
|
|
1507
1764
|
}
|
|
1508
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
|
+
|
|
1509
1848
|
// src/artifacts/solid-jsx/jsx.ts
|
|
1510
|
-
var
|
|
1849
|
+
var import_outdent27 = require("outdent");
|
|
1511
1850
|
function generateSolidJsxFactory(ctx) {
|
|
1512
1851
|
const { componentName, factoryName } = ctx.jsx;
|
|
1513
1852
|
return {
|
|
1514
|
-
js:
|
|
1853
|
+
js: import_outdent27.outdent`
|
|
1515
1854
|
import { Dynamic } from 'solid-js/web'
|
|
1516
1855
|
import { mergeProps, splitProps } from 'solid-js'
|
|
1517
1856
|
import { createComponent } from 'solid-js/web'
|
|
@@ -1588,7 +1927,7 @@ function generateSolidJsxFactory(ctx) {
|
|
|
1588
1927
|
}
|
|
1589
1928
|
|
|
1590
1929
|
// src/artifacts/solid-jsx/pattern.ts
|
|
1591
|
-
var
|
|
1930
|
+
var import_outdent28 = require("outdent");
|
|
1592
1931
|
var import_ts_pattern5 = require("ts-pattern");
|
|
1593
1932
|
function generateSolidJsxPattern(ctx) {
|
|
1594
1933
|
const { typeName, factoryName } = ctx.jsx;
|
|
@@ -1597,7 +1936,7 @@ function generateSolidJsxPattern(ctx) {
|
|
|
1597
1936
|
const { description, jsxElement = "div" } = pattern.config;
|
|
1598
1937
|
return {
|
|
1599
1938
|
name: dashName,
|
|
1600
|
-
js:
|
|
1939
|
+
js: import_outdent28.outdent`
|
|
1601
1940
|
import { splitProps, mergeProps } from 'solid-js'
|
|
1602
1941
|
import { createComponent } from 'solid-js/web'
|
|
1603
1942
|
${ctx.file.import(factoryName, "./factory")}
|
|
@@ -1606,12 +1945,12 @@ function generateSolidJsxPattern(ctx) {
|
|
|
1606
1945
|
export function ${jsxName}(props) {
|
|
1607
1946
|
${(0, import_ts_pattern5.match)(props.length).with(
|
|
1608
1947
|
0,
|
|
1609
|
-
() =>
|
|
1948
|
+
() => import_outdent28.outdent`
|
|
1610
1949
|
const styleProps = ${styleFnName}()
|
|
1611
1950
|
return createComponent(${factoryName}.${jsxElement}, mergeProps(styleProps, props))
|
|
1612
1951
|
`
|
|
1613
1952
|
).otherwise(
|
|
1614
|
-
() =>
|
|
1953
|
+
() => import_outdent28.outdent`
|
|
1615
1954
|
const [patternProps, restProps] = splitProps(props, [${props.map((v) => JSON.stringify(v)).join(", ")}]);
|
|
1616
1955
|
const styleProps = ${styleFnName}(patternProps)
|
|
1617
1956
|
return createComponent(${factoryName}.${jsxElement}, mergeProps(styleProps, restProps))
|
|
@@ -1619,7 +1958,7 @@ function generateSolidJsxPattern(ctx) {
|
|
|
1619
1958
|
)}
|
|
1620
1959
|
}
|
|
1621
1960
|
`,
|
|
1622
|
-
dts:
|
|
1961
|
+
dts: import_outdent28.outdent`
|
|
1623
1962
|
import { Component } from 'solid-js'
|
|
1624
1963
|
import { ${upperName}Properties } from '../patterns/${dashName}'
|
|
1625
1964
|
import { ${typeName} } from '../types/jsx'
|
|
@@ -1634,15 +1973,15 @@ function generateSolidJsxPattern(ctx) {
|
|
|
1634
1973
|
}
|
|
1635
1974
|
|
|
1636
1975
|
// src/artifacts/solid-jsx/types.ts
|
|
1637
|
-
var
|
|
1976
|
+
var import_outdent29 = require("outdent");
|
|
1638
1977
|
function generateSolidJsxTypes(ctx) {
|
|
1639
1978
|
const { factoryName, componentName, upperName, typeName } = ctx.jsx;
|
|
1640
1979
|
return {
|
|
1641
|
-
jsxFactory:
|
|
1980
|
+
jsxFactory: import_outdent29.outdent`
|
|
1642
1981
|
import type { ${upperName} } from '../types/jsx'
|
|
1643
1982
|
export declare const ${factoryName}: ${upperName}
|
|
1644
1983
|
`,
|
|
1645
|
-
jsxType:
|
|
1984
|
+
jsxType: import_outdent29.outdent`
|
|
1646
1985
|
import type { ComponentProps, Component, JSX } from 'solid-js'
|
|
1647
1986
|
import type { Assign, JsxStyleProps, JsxHTMLProps } from './system-types'
|
|
1648
1987
|
import type { RecipeDefinition, RecipeSelection, RecipeVariantRecord } from './recipe'
|
|
@@ -1676,12 +2015,102 @@ export type ${typeName}<T extends ElementType> = JsxHTMLProps<ComponentProps<T>,
|
|
|
1676
2015
|
};
|
|
1677
2016
|
}
|
|
1678
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
|
+
|
|
1679
2108
|
// src/artifacts/vue-jsx/jsx.ts
|
|
1680
|
-
var
|
|
2109
|
+
var import_outdent32 = require("outdent");
|
|
1681
2110
|
function generateVueJsxFactory(ctx) {
|
|
1682
2111
|
const { factoryName } = ctx.jsx;
|
|
1683
2112
|
return {
|
|
1684
|
-
js:
|
|
2113
|
+
js: import_outdent32.outdent`
|
|
1685
2114
|
import { defineComponent, h, computed } from 'vue'
|
|
1686
2115
|
${ctx.file.import("css, cx, cva, assignCss", "../css/index")}
|
|
1687
2116
|
${ctx.file.import("splitProps, normalizeHTMLProps", "../helpers")}
|
|
@@ -1754,8 +2183,62 @@ function generateVueJsxFactory(ctx) {
|
|
|
1754
2183
|
};
|
|
1755
2184
|
}
|
|
1756
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
|
+
|
|
1757
2240
|
// src/artifacts/vue-jsx/pattern.ts
|
|
1758
|
-
var
|
|
2241
|
+
var import_outdent34 = require("outdent");
|
|
1759
2242
|
function generateVueJsxPattern(ctx) {
|
|
1760
2243
|
const { typeName, factoryName } = ctx.jsx;
|
|
1761
2244
|
return ctx.patterns.details.map((pattern) => {
|
|
@@ -1764,7 +2247,7 @@ function generateVueJsxPattern(ctx) {
|
|
|
1764
2247
|
const propList = props.map((v) => JSON.stringify(v)).join(", ");
|
|
1765
2248
|
return {
|
|
1766
2249
|
name: dashName,
|
|
1767
|
-
js:
|
|
2250
|
+
js: import_outdent34.outdent`
|
|
1768
2251
|
import { defineComponent, h, computed } from 'vue'
|
|
1769
2252
|
${ctx.file.import(factoryName, "./factory")}
|
|
1770
2253
|
${ctx.file.import(styleFnName, `../patterns/${dashName}`)}
|
|
@@ -1782,7 +2265,7 @@ function generateVueJsxPattern(ctx) {
|
|
|
1782
2265
|
}
|
|
1783
2266
|
})
|
|
1784
2267
|
`,
|
|
1785
|
-
dts:
|
|
2268
|
+
dts: import_outdent34.outdent`
|
|
1786
2269
|
import { FunctionalComponent } from 'vue'
|
|
1787
2270
|
import { ${upperName}Properties } from '../patterns/${dashName}'
|
|
1788
2271
|
import { ${typeName} } from '../types/jsx'
|
|
@@ -1797,15 +2280,15 @@ function generateVueJsxPattern(ctx) {
|
|
|
1797
2280
|
}
|
|
1798
2281
|
|
|
1799
2282
|
// src/artifacts/vue-jsx/types.ts
|
|
1800
|
-
var
|
|
2283
|
+
var import_outdent35 = require("outdent");
|
|
1801
2284
|
function generateVueJsxTypes(ctx) {
|
|
1802
2285
|
const { factoryName, componentName, upperName, typeName } = ctx.jsx;
|
|
1803
2286
|
return {
|
|
1804
|
-
jsxFactory:
|
|
2287
|
+
jsxFactory: import_outdent35.outdent`
|
|
1805
2288
|
import { ${upperName} } from '../types/jsx'
|
|
1806
2289
|
export declare const ${factoryName}: ${upperName}
|
|
1807
2290
|
`,
|
|
1808
|
-
jsxType:
|
|
2291
|
+
jsxType: import_outdent35.outdent`
|
|
1809
2292
|
import type { Component, FunctionalComponent } from 'vue'
|
|
1810
2293
|
import type { Assign, JsxStyleProps, JsxHTMLProps } from './system-types'
|
|
1811
2294
|
import type { RecipeDefinition, RecipeSelection, RecipeVariantRecord } from './recipe'
|
|
@@ -1961,6 +2444,161 @@ type IntrinsicElement =
|
|
|
1961
2444
|
};
|
|
1962
2445
|
}
|
|
1963
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
|
+
|
|
1964
2602
|
// src/artifacts/jsx.ts
|
|
1965
2603
|
var typesMap = {
|
|
1966
2604
|
react: generateReactJsxTypes,
|
|
@@ -1969,10 +2607,18 @@ var typesMap = {
|
|
|
1969
2607
|
vue: generateVueJsxTypes,
|
|
1970
2608
|
qwik: generateQwikJsxTypes
|
|
1971
2609
|
};
|
|
2610
|
+
var typesStringLiteralMap = {
|
|
2611
|
+
react: generateSolidJsxStringLiteralTypes,
|
|
2612
|
+
solid: generateReactJsxStringLiteralTypes,
|
|
2613
|
+
qwik: generateQwikJsxStringLiteralTypes,
|
|
2614
|
+
preact: generatePreactJsxStringLiteralTypes,
|
|
2615
|
+
vue: generateVueJsxStringLiteralTypes
|
|
2616
|
+
};
|
|
1972
2617
|
function generateJsxTypes(ctx) {
|
|
1973
2618
|
if (!ctx.jsx.framework)
|
|
1974
2619
|
return;
|
|
1975
|
-
|
|
2620
|
+
const type = ctx.isTemplateLiteralSyntax ? typesStringLiteralMap[ctx.jsx.framework] : typesMap[ctx.jsx.framework];
|
|
2621
|
+
return type?.(ctx);
|
|
1976
2622
|
}
|
|
1977
2623
|
var factoryMap = {
|
|
1978
2624
|
react: generateReactJsxFactory,
|
|
@@ -1981,10 +2627,18 @@ var factoryMap = {
|
|
|
1981
2627
|
vue: generateVueJsxFactory,
|
|
1982
2628
|
qwik: generateQwikJsxFactory
|
|
1983
2629
|
};
|
|
2630
|
+
var factoryStringLiteralMap = {
|
|
2631
|
+
react: generateReactJsxStringLiteralFactory,
|
|
2632
|
+
solid: generateSolidJsxStringLiteralFactory,
|
|
2633
|
+
qwik: generateQwikJsxStringLiteralFactory,
|
|
2634
|
+
preact: generatePreactJsxStringLiteralFactory,
|
|
2635
|
+
vue: generateVueJsxStringLiteralFactory
|
|
2636
|
+
};
|
|
1984
2637
|
function generateJsxFactory(ctx) {
|
|
1985
2638
|
if (!ctx.jsx.framework)
|
|
1986
2639
|
return;
|
|
1987
|
-
|
|
2640
|
+
const factory = ctx.isTemplateLiteralSyntax ? factoryStringLiteralMap[ctx.jsx.framework] : factoryMap[ctx.jsx.framework];
|
|
2641
|
+
return factory?.(ctx);
|
|
1988
2642
|
}
|
|
1989
2643
|
var patternMap = {
|
|
1990
2644
|
react: generateReactJsxPattern,
|
|
@@ -1994,6 +2648,8 @@ var patternMap = {
|
|
|
1994
2648
|
qwik: generateQwikJsxPattern
|
|
1995
2649
|
};
|
|
1996
2650
|
function generateJsxPatterns(ctx) {
|
|
2651
|
+
if (ctx.isTemplateLiteralSyntax)
|
|
2652
|
+
return [];
|
|
1997
2653
|
if (ctx.patterns.isEmpty() && !ctx.jsx.framework)
|
|
1998
2654
|
return [];
|
|
1999
2655
|
return patternMap[ctx.jsx.framework](ctx);
|
|
@@ -2046,7 +2702,7 @@ var csstype_d_ts_default = {
|
|
|
2046
2702
|
|
|
2047
2703
|
// src/artifacts/generated/system-types.d.ts.json
|
|
2048
2704
|
var system_types_d_ts_default = {
|
|
2049
|
-
content: "import type { ConditionalValue, Conditions, Nested } from './conditions'\nimport type { PropertiesFallback } from './csstype'\nimport type { SystemProperties, CssVarProperties } from './style-props'\n\ntype String = string & {}\ntype Number = number & {}\n\n/* -----------------------------------------------------------------------------\n * Native css properties\n * -----------------------------------------------------------------------------*/\n\nexport type CssProperty = keyof PropertiesFallback\n\nexport type CssProperties = PropertiesFallback<String | Number> & CssVarProperties\n\nexport type CssKeyframes = {\n [name: string]: {\n [time: string]: CssProperties\n }\n}\n\n/* -----------------------------------------------------------------------------\n * Conditional css properties\n * -----------------------------------------------------------------------------*/\n\ntype MinimalNested<P> = {\n [K in keyof Conditions]?: Nested<P>\n}\n\ntype GenericProperties = {\n [key: string]: ConditionalValue<String | Number | boolean>\n}\n\n/* -----------------------------------------------------------------------------\n * Native css props\n * -----------------------------------------------------------------------------*/\n\nexport type NestedCssProperties = Nested<CssProperties>\n\nexport type SystemStyleObject = Nested<SystemProperties & CssVarProperties>\n\nexport type GlobalStyleObject = {\n [selector: string]: SystemStyleObject\n}\n\nexport type CompositionStyleObject<Property extends string> = Nested<{\n [K in Property]?: K extends keyof SystemStyleObject ? SystemStyleObject[K] : unknown\n}>\n\n/* -----------------------------------------------------------------------------\n * Jsx style props\n * -----------------------------------------------------------------------------*/\n\nexport type JsxStyleProps = SystemProperties &\n MinimalNested<SystemStyleObject> & {\n css?: SystemStyleObject\n }\n\
|
|
2705
|
+
content: "import type { ConditionalValue, Conditions, Nested } from './conditions'\nimport type { PropertiesFallback } from './csstype'\nimport type { SystemProperties, CssVarProperties } from './style-props'\n\ntype String = string & {}\ntype Number = number & {}\n\n/* -----------------------------------------------------------------------------\n * Native css properties\n * -----------------------------------------------------------------------------*/\n\nexport type CssProperty = keyof PropertiesFallback\n\nexport type CssProperties = PropertiesFallback<String | Number> & CssVarProperties\n\nexport type CssKeyframes = {\n [name: string]: {\n [time: string]: CssProperties\n }\n}\n\n/* -----------------------------------------------------------------------------\n * Conditional css properties\n * -----------------------------------------------------------------------------*/\n\ntype MinimalNested<P> = {\n [K in keyof Conditions]?: Nested<P>\n}\n\ntype GenericProperties = {\n [key: string]: ConditionalValue<String | Number | boolean>\n}\n\n/* -----------------------------------------------------------------------------\n * Native css props\n * -----------------------------------------------------------------------------*/\n\nexport type NestedCssProperties = Nested<CssProperties>\n\nexport type SystemStyleObject = Nested<SystemProperties & CssVarProperties>\n\nexport type GlobalStyleObject = {\n [selector: string]: SystemStyleObject\n}\n\nexport type CompositionStyleObject<Property extends string> = Nested<{\n [K in Property]?: K extends keyof SystemStyleObject ? SystemStyleObject[K] : unknown\n}>\n\n/* -----------------------------------------------------------------------------\n * Jsx style props\n * -----------------------------------------------------------------------------*/\n\nexport type JsxStyleProps = SystemProperties &\n MinimalNested<SystemStyleObject> & {\n css?: SystemStyleObject\n }\n\nexport type Assign<T, U> = Omit<T, keyof U> & U\n\nexport type PatchedHTMLProps = {\n htmlSize?: string | number\n htmlWidth?: string | number\n htmlHeight?: string | number\n htmlTranslate?: 'yes' | 'no' | undefined\n htmlContent?: string\n}\n\nexport type OmittedHTMLProps = 'color' | 'translate' | 'transition' | 'width' | 'height' | 'size' | 'content'\n\ntype WithHTMLProps<T> = Omit<T, OmittedHTMLProps> & PatchedHTMLProps\n\nexport type JsxHTMLProps<T extends Record<string, any>, P extends Record<string, any> = {}> = Assign<\n WithHTMLProps<T>,\n P\n>\n"
|
|
2050
2706
|
};
|
|
2051
2707
|
|
|
2052
2708
|
// src/artifacts/generated/composition.d.ts.json
|
|
@@ -2061,7 +2717,7 @@ var recipe_d_ts_default = {
|
|
|
2061
2717
|
|
|
2062
2718
|
// src/artifacts/generated/pattern.d.ts.json
|
|
2063
2719
|
var pattern_d_ts_default = {
|
|
2064
|
-
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"
|
|
2065
2721
|
};
|
|
2066
2722
|
|
|
2067
2723
|
// src/artifacts/generated/parts.d.ts.json
|
|
@@ -2071,7 +2727,7 @@ var parts_d_ts_default = {
|
|
|
2071
2727
|
|
|
2072
2728
|
// src/artifacts/generated/selectors.d.ts.json
|
|
2073
2729
|
var selectors_d_ts_default = {
|
|
2074
|
-
content: "import type { Pseudos } from './csstype'\n\ntype AriaAttributes =\n | '[aria-disabled]'\n | '[aria-hidden]'\n | '[aria-invalid]'\n | '[aria-readonly]'\n | '[aria-required]'\n | '[aria-selected]'\n | '[aria-checked]'\n | '[aria-expanded]'\n | '[aria-pressed]'\n | `[aria-current=${'page' | 'step' | 'location' | 'date' | 'time'}]`\n | '[aria-invalid]'\n | `[aria-sort=${'ascending' | 'descending'}]`\n\ntype DataAttributes =\n | '[data-selected]'\n | '[data-highlighted]'\n | '[data-hover]'\n | '[data-active]'\n | '[data-checked]'\n | '[data-disabled]'\n | '[data-readonly]'\n | '[data-focus]'\n | '[data-focus-visible]'\n | '[data-focus-visible-added]'\n | '[data-invalid]'\n | '[data-pressed]'\n | '[data-expanded]'\n | '[data-grabbed]'\n | '[data-dragged]'\n | '[data-orientation=horizontal]'\n | '[data-orientation=vertical]'\n | '[data-in-range]'\n | '[data-out-of-range]'\n | '[data-placeholder-shown]'\n | `[data-part=${string}]`\n | `[data-attr=${string}]`\n | `[data-placement=${string}]`\n | `[data-theme=${string}]`\n | `[data-size=${string}]`\n | `[data-state=${string}]`\n | '[data-empty]'\n | '[data-loading]'\n | '[data-loaded]'\n | '[data-enter]'\n | '[data-entering]'\n | '[data-exited]'\n | '[data-exiting]'\n\ntype AttributeSelector = `&${Pseudos | DataAttributes | AriaAttributes}`\ntype ParentSelector = `${DataAttributes | AriaAttributes} &`\n\nexport type AnySelector = `${string}&` | `&${string}`\nexport type Selectors = AttributeSelector | ParentSelector\n"
|
|
2730
|
+
content: "import type { Pseudos } from './csstype'\n\ntype AriaAttributes =\n | '[aria-disabled]'\n | '[aria-hidden]'\n | '[aria-invalid]'\n | '[aria-readonly]'\n | '[aria-required]'\n | '[aria-selected]'\n | '[aria-checked]'\n | '[aria-expanded]'\n | '[aria-pressed]'\n | `[aria-current=${'page' | 'step' | 'location' | 'date' | 'time'}]`\n | '[aria-invalid]'\n | `[aria-sort=${'ascending' | 'descending'}]`\n\ntype DataAttributes =\n | '[data-selected]'\n | '[data-highlighted]'\n | '[data-hover]'\n | '[data-active]'\n | '[data-checked]'\n | '[data-disabled]'\n | '[data-readonly]'\n | '[data-focus]'\n | '[data-focus-visible]'\n | '[data-focus-visible-added]'\n | '[data-invalid]'\n | '[data-pressed]'\n | '[data-expanded]'\n | '[data-grabbed]'\n | '[data-dragged]'\n | '[data-orientation=horizontal]'\n | '[data-orientation=vertical]'\n | '[data-in-range]'\n | '[data-out-of-range]'\n | '[data-placeholder-shown]'\n | `[data-part=${string}]`\n | `[data-attr=${string}]`\n | `[data-placement=${string}]`\n | `[data-theme=${string}]`\n | `[data-size=${string}]`\n | `[data-state=${string}]`\n | '[data-empty]'\n | '[data-loading]'\n | '[data-loaded]'\n | '[data-enter]'\n | '[data-entering]'\n | '[data-exited]'\n | '[data-exiting]'\n\ntype AttributeSelector = `&${Pseudos | DataAttributes | AriaAttributes}`\ntype ParentSelector = `${DataAttributes | AriaAttributes} &`\n\ntype AtRuleType = 'media' | 'layer' | 'container' | 'supports' | 'page'\n\nexport type AnySelector = `${string}&` | `&${string}` | `@${AtRuleType}${string}`\nexport type Selectors = AttributeSelector | ParentSelector\n"
|
|
2075
2731
|
};
|
|
2076
2732
|
|
|
2077
2733
|
// src/artifacts/types/generated.ts
|
|
@@ -2088,9 +2744,9 @@ function getGeneratedTypes() {
|
|
|
2088
2744
|
}
|
|
2089
2745
|
|
|
2090
2746
|
// src/artifacts/types/main.ts
|
|
2091
|
-
var
|
|
2747
|
+
var import_outdent37 = require("outdent");
|
|
2092
2748
|
var generateTypesEntry = () => ({
|
|
2093
|
-
global:
|
|
2749
|
+
global: import_outdent37.outdent`
|
|
2094
2750
|
import type { RecipeVariantRecord, RecipeConfig } from './recipe'
|
|
2095
2751
|
import type { Parts } from './parts'
|
|
2096
2752
|
import type { PatternConfig } from './pattern'
|
|
@@ -2107,19 +2763,19 @@ var generateTypesEntry = () => ({
|
|
|
2107
2763
|
export function defineParts<T extends Parts>(parts: T): (config: Partial<Record<keyof T, SystemStyleObject>>) => Partial<Record<keyof T, SystemStyleObject>>;
|
|
2108
2764
|
}
|
|
2109
2765
|
`,
|
|
2110
|
-
index:
|
|
2766
|
+
index: import_outdent37.outdent`
|
|
2111
2767
|
import './global'
|
|
2112
2768
|
export type { ConditionalValue } from './conditions'
|
|
2113
2769
|
export type { GlobalStyleObject, JsxStyleProps, SystemStyleObject } from './system-types'
|
|
2114
2770
|
|
|
2115
2771
|
`,
|
|
2116
|
-
helpers:
|
|
2772
|
+
helpers: import_outdent37.outdent`
|
|
2117
2773
|
export type Pretty<T> = T extends infer U ? { [K in keyof U]: U[K] } : never
|
|
2118
2774
|
`
|
|
2119
2775
|
});
|
|
2120
2776
|
|
|
2121
2777
|
// src/artifacts/types/prop-types.ts
|
|
2122
|
-
var
|
|
2778
|
+
var import_outdent38 = require("outdent");
|
|
2123
2779
|
function generatePropTypes(ctx) {
|
|
2124
2780
|
const {
|
|
2125
2781
|
config: { strictTokens },
|
|
@@ -2127,7 +2783,7 @@ function generatePropTypes(ctx) {
|
|
|
2127
2783
|
} = ctx;
|
|
2128
2784
|
const strictText = `${strictTokens ? "" : " | CssValue<T>"}`;
|
|
2129
2785
|
const result = [
|
|
2130
|
-
|
|
2786
|
+
import_outdent38.outdent`
|
|
2131
2787
|
import type { ConditionalValue } from './conditions';
|
|
2132
2788
|
import type { CssProperties } from './system-types'
|
|
2133
2789
|
import type { Tokens } from '../tokens'
|
|
@@ -2150,7 +2806,7 @@ function generatePropTypes(ctx) {
|
|
|
2150
2806
|
result.push(` ${key}: Shorthand<${JSON.stringify(value)}>;`);
|
|
2151
2807
|
});
|
|
2152
2808
|
result.push("}");
|
|
2153
|
-
return
|
|
2809
|
+
return import_outdent38.outdent`
|
|
2154
2810
|
${result.join("\n")}
|
|
2155
2811
|
|
|
2156
2812
|
export type PropertyValue<T extends string> = T extends keyof PropertyTypes
|
|
@@ -2163,10 +2819,10 @@ function generatePropTypes(ctx) {
|
|
|
2163
2819
|
|
|
2164
2820
|
// src/artifacts/types/style-props.ts
|
|
2165
2821
|
var import_is_valid_prop = require("@pandacss/is-valid-prop");
|
|
2166
|
-
var
|
|
2822
|
+
var import_outdent39 = __toESM(require("outdent"));
|
|
2167
2823
|
function generateStyleProps(ctx) {
|
|
2168
2824
|
const props = new Set(import_is_valid_prop.allCssProperties.concat(ctx.utility.keys()));
|
|
2169
|
-
return
|
|
2825
|
+
return import_outdent39.default`
|
|
2170
2826
|
import type { ConditionalValue } from './conditions'
|
|
2171
2827
|
import type { PropertyValue } from './prop-type'
|
|
2172
2828
|
import type { Token } from '../tokens'
|
|
@@ -2183,7 +2839,7 @@ function generateStyleProps(ctx) {
|
|
|
2183
2839
|
|
|
2184
2840
|
// src/artifacts/types/token-types.ts
|
|
2185
2841
|
var import_shared3 = require("@pandacss/shared");
|
|
2186
|
-
var
|
|
2842
|
+
var import_outdent40 = require("outdent");
|
|
2187
2843
|
var import_pluralize = __toESM(require("pluralize"));
|
|
2188
2844
|
var categories = [
|
|
2189
2845
|
"zIndex",
|
|
@@ -2228,7 +2884,7 @@ function generateTokenTypes(ctx) {
|
|
|
2228
2884
|
result.add("} & { [token: string]: never }");
|
|
2229
2885
|
set.add(Array.from(result).join("\n"));
|
|
2230
2886
|
set.add(`export type TokenCategory = ${(0, import_shared3.unionType)(categories)}`);
|
|
2231
|
-
return
|
|
2887
|
+
return import_outdent40.outdent.string(Array.from(set).join("\n\n"));
|
|
2232
2888
|
}
|
|
2233
2889
|
|
|
2234
2890
|
// src/artifacts/index.ts
|
|
@@ -2286,8 +2942,8 @@ function setupTypes(ctx) {
|
|
|
2286
2942
|
};
|
|
2287
2943
|
}
|
|
2288
2944
|
function setupCss(ctx) {
|
|
2289
|
-
const code = generateCssFn(ctx);
|
|
2290
|
-
const conditions = generateConditions(ctx);
|
|
2945
|
+
const code = ctx.isTemplateLiteralSyntax ? generateStringLiteralCssFn(ctx) : generateCssFn(ctx);
|
|
2946
|
+
const conditions = ctx.isTemplateLiteralSyntax ? generateStringLiteralConditions(ctx) : generateConditions(ctx);
|
|
2291
2947
|
return {
|
|
2292
2948
|
dir: ctx.paths.css,
|
|
2293
2949
|
files: [
|
|
@@ -2298,6 +2954,8 @@ function setupCss(ctx) {
|
|
|
2298
2954
|
};
|
|
2299
2955
|
}
|
|
2300
2956
|
function setupCva(ctx) {
|
|
2957
|
+
if (ctx.isTemplateLiteralSyntax)
|
|
2958
|
+
return;
|
|
2301
2959
|
const code = generateCvaFn(ctx);
|
|
2302
2960
|
return {
|
|
2303
2961
|
dir: ctx.paths.css,
|
|
@@ -2323,8 +2981,8 @@ function setupRecipes(ctx) {
|
|
|
2323
2981
|
return;
|
|
2324
2982
|
const indexFiles = files.filter((file) => !file.name.includes("create-recipe"));
|
|
2325
2983
|
const index = {
|
|
2326
|
-
js:
|
|
2327
|
-
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"))
|
|
2328
2986
|
};
|
|
2329
2987
|
return {
|
|
2330
2988
|
dir: ctx.paths.recipe,
|
|
@@ -2337,12 +2995,14 @@ function setupRecipes(ctx) {
|
|
|
2337
2995
|
};
|
|
2338
2996
|
}
|
|
2339
2997
|
function setupPatterns(ctx) {
|
|
2998
|
+
if (ctx.isTemplateLiteralSyntax)
|
|
2999
|
+
return;
|
|
2340
3000
|
const files = generatePattern(ctx);
|
|
2341
3001
|
if (!files)
|
|
2342
3002
|
return;
|
|
2343
3003
|
const index = {
|
|
2344
|
-
js:
|
|
2345
|
-
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"))
|
|
2346
3006
|
};
|
|
2347
3007
|
return {
|
|
2348
3008
|
dir: ctx.paths.pattern,
|
|
@@ -2362,13 +3022,13 @@ function setupJsx(ctx) {
|
|
|
2362
3022
|
const factory = generateJsxFactory(ctx);
|
|
2363
3023
|
const patterns = generateJsxPatterns(ctx);
|
|
2364
3024
|
const index = {
|
|
2365
|
-
js:
|
|
3025
|
+
js: import_outdent41.default`
|
|
2366
3026
|
${ctx.file.export("./factory")}
|
|
2367
|
-
${
|
|
3027
|
+
${import_outdent41.default.string(patterns.map((file) => ctx.file.export(`./${file.name}`)).join("\n"))}
|
|
2368
3028
|
`,
|
|
2369
|
-
dts:
|
|
3029
|
+
dts: import_outdent41.default`
|
|
2370
3030
|
export * from './factory'
|
|
2371
|
-
${
|
|
3031
|
+
${import_outdent41.default.string(patterns.map((file) => `export * from './${file.name}'`).join("\n"))}
|
|
2372
3032
|
export type { ${ctx.jsx.typeName} } from '../types/jsx'
|
|
2373
3033
|
`
|
|
2374
3034
|
};
|
|
@@ -2377,7 +3037,7 @@ function setupJsx(ctx) {
|
|
|
2377
3037
|
files: [
|
|
2378
3038
|
...patterns.map((file) => ({ file: ctx.file.ext(file.name), code: file.js })),
|
|
2379
3039
|
...patterns.map((file) => ({ file: `${file.name}.d.ts`, code: file.dts })),
|
|
2380
|
-
{ file: ctx.file.ext("is-valid-prop"), code: isValidProp
|
|
3040
|
+
{ file: ctx.file.ext("is-valid-prop"), code: isValidProp?.js },
|
|
2381
3041
|
{ file: "factory.d.ts", code: types.jsxFactory },
|
|
2382
3042
|
{ file: ctx.file.ext("factory"), code: factory?.js },
|
|
2383
3043
|
{ file: "index.d.ts", code: index.dts },
|
|
@@ -2387,15 +3047,15 @@ function setupJsx(ctx) {
|
|
|
2387
3047
|
}
|
|
2388
3048
|
function setupCssIndex(ctx) {
|
|
2389
3049
|
const index = {
|
|
2390
|
-
js:
|
|
3050
|
+
js: import_outdent41.default`
|
|
2391
3051
|
${ctx.file.export("./css")}
|
|
2392
3052
|
${ctx.file.export("./cx")}
|
|
2393
|
-
${ctx.file.export("./cva")}
|
|
3053
|
+
${ctx.isTemplateLiteralSyntax ? "" : ctx.file.export("./cva")}
|
|
2394
3054
|
`,
|
|
2395
|
-
dts:
|
|
3055
|
+
dts: import_outdent41.default`
|
|
2396
3056
|
export * from './css'
|
|
2397
3057
|
export * from './cx'
|
|
2398
|
-
export * from './cva'
|
|
3058
|
+
${ctx.isTemplateLiteralSyntax ? "" : `export * from './cva'`}
|
|
2399
3059
|
`
|
|
2400
3060
|
};
|
|
2401
3061
|
return {
|
|
@@ -2577,6 +3237,7 @@ var helpers = {
|
|
|
2577
3237
|
var getBaseEngine = (conf) => {
|
|
2578
3238
|
const { config } = conf;
|
|
2579
3239
|
const theme = config.theme ?? {};
|
|
3240
|
+
const isTemplateLiteralSyntax = config.syntax === "template-literal";
|
|
2580
3241
|
const hash = {
|
|
2581
3242
|
tokens: (0, import_lil_fp.isBool)(config.hash) ? config.hash : config.hash?.cssVar,
|
|
2582
3243
|
className: (0, import_lil_fp.isBool)(config.hash) ? config.hash : config.hash?.className
|
|
@@ -2595,11 +3256,12 @@ var getBaseEngine = (conf) => {
|
|
|
2595
3256
|
const utility = new import_core4.Utility({
|
|
2596
3257
|
prefix: prefix.className,
|
|
2597
3258
|
tokens,
|
|
2598
|
-
config: config.utilities,
|
|
2599
|
-
separator: config.separator
|
|
3259
|
+
config: isTemplateLiteralSyntax ? {} : config.utilities,
|
|
3260
|
+
separator: config.separator,
|
|
3261
|
+
shorthands: config.shorthands
|
|
2600
3262
|
});
|
|
2601
3263
|
const conditions = new import_core4.Conditions({
|
|
2602
|
-
conditions: config.conditions,
|
|
3264
|
+
conditions: isTemplateLiteralSyntax ? {} : config.conditions,
|
|
2603
3265
|
breakpoints: config.theme?.breakpoints
|
|
2604
3266
|
});
|
|
2605
3267
|
const { textStyles, layerStyles } = theme;
|
|
@@ -2637,6 +3299,7 @@ var getBaseEngine = (conf) => {
|
|
|
2637
3299
|
};
|
|
2638
3300
|
return {
|
|
2639
3301
|
...conf,
|
|
3302
|
+
isTemplateLiteralSyntax,
|
|
2640
3303
|
studio,
|
|
2641
3304
|
hash,
|
|
2642
3305
|
prefix,
|
|
@@ -2718,7 +3381,7 @@ var getPatternEngine = (config) => {
|
|
|
2718
3381
|
return Object.entries(patterns).map(([name, pattern]) => ({
|
|
2719
3382
|
type: "pattern",
|
|
2720
3383
|
name: pattern.jsx ?? (0, import_shared7.capitalize)(name),
|
|
2721
|
-
props: Object.keys(pattern
|
|
3384
|
+
props: Object.keys(pattern?.properties ?? {}),
|
|
2722
3385
|
baseName: name
|
|
2723
3386
|
}));
|
|
2724
3387
|
}),
|
|
@@ -2757,6 +3420,8 @@ var defaults = (conf) => ({
|
|
|
2757
3420
|
cssVarRoot: ":where(:root, :host)",
|
|
2758
3421
|
jsxFactory: "styled",
|
|
2759
3422
|
outExtension: "mjs",
|
|
3423
|
+
shorthands: true,
|
|
3424
|
+
syntax: "object-literal",
|
|
2760
3425
|
...conf.config
|
|
2761
3426
|
}
|
|
2762
3427
|
});
|