@pandacss/generator 0.0.0-dev-20230801082734 → 0.0.0-dev-20230801084843
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 +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +215 -131
- package/dist/index.mjs +210 -126
- package/package.json +8 -8
package/dist/index.js
CHANGED
|
@@ -130,7 +130,7 @@ var getMessages = (ctx) => ({
|
|
|
130
130
|
|
|
131
131
|
// src/artifacts/index.ts
|
|
132
132
|
var import_shared4 = require("@pandacss/shared");
|
|
133
|
-
var
|
|
133
|
+
var import_outdent43 = __toESM(require("outdent"));
|
|
134
134
|
|
|
135
135
|
// src/artifacts/css/global-css.ts
|
|
136
136
|
var generateGlobalCss = (ctx) => {
|
|
@@ -839,7 +839,7 @@ var import_outdent8 = require("outdent");
|
|
|
839
839
|
|
|
840
840
|
// src/artifacts/generated/helpers.mjs.json
|
|
841
841
|
var helpers_mjs_default = {
|
|
842
|
-
content: '// src/assert.ts\nfunction isObject(value) {\n return typeof value === "object" && value != null && !Array.isArray(value);\n}\n\n// src/astish.ts\nvar newRule = /(?:([\\u0080-\\uFFFF\\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\\s*)/g;\nvar ruleClean = /\\/\\*[^]*?\\*\\/|\\s\\s+|\\n/g;\nvar astish = (val, tree = [{}]) => {\n const block = newRule.exec((val ?? "").replace(ruleClean, ""));\n if (!block)\n return tree[0];\n if (block[4])\n tree.shift();\n else if (block[3])\n tree.unshift(tree[0][block[3]] = tree[0][block[3]] || {});\n else\n tree[0][block[1]] = block[2];\n return astish(val, tree);\n};\n\n// src/compact.ts\nfunction compact(value) {\n return Object.fromEntries(Object.entries(value ?? {}).filter(([_, value2]) => value2 !== void 0));\n}\n\n// src/condition.ts\nvar isBaseCondition = (v) => v === "base";\nfunction filterBaseConditions(c) {\n return c.slice().filter((v) => !isBaseCondition(v));\n}\n\n// src/css-important.ts\nvar importantRegex = /!(important)?$/;\nfunction isImportant(value) {\n return typeof value === "string" ? importantRegex.test(value) : false;\n}\nfunction withoutImportant(value) {\n return typeof value === "string" ? value.replace(importantRegex, "").trim() : value;\n}\nfunction withoutSpace(str) {\n return typeof str === "string" ? str.replaceAll(" ", "_") : str;\n}\n\n// src/hash.ts\nfunction toChar(code) {\n return String.fromCharCode(code + (code > 25 ? 39 : 97));\n}\nfunction toName(code) {\n let name = "";\n let x;\n for (x = Math.abs(code); x > 52; x = x / 52 | 0)\n name = toChar(x % 52) + name;\n return toChar(x % 52) + name;\n}\nfunction toPhash(h, x) {\n let i = x.length;\n while (i)\n h = h * 33 ^ x.charCodeAt(--i);\n return h;\n}\nfunction toHash(value) {\n return toName(toPhash(5381, value) >>> 0);\n}\n\n// src/merge-props.ts\nfunction mergeProps(...sources) {\n const result = {};\n for (const source of sources) {\n for (const [key, value] of Object.entries(source)) {\n if (isObject(value)) {\n result[key] = mergeProps(result[key] || {}, value);\n } else {\n result[key] = value;\n }\n }\n }\n return result;\n}\n\n// src/walk-object.ts\nvar isNotNullish = (element) => element != null;\nfunction walkObject(target, predicate, options = {}) {\n const { stop, getKey } = options;\n function inner(value, path = []) {\n if (isObject(value) || Array.isArray(value)) {\n const result = {};\n for (const [prop, child] of Object.entries(value)) {\n const key = getKey?.(prop) ?? prop;\n const childPath = [...path, key];\n if (stop?.(value, childPath)) {\n return predicate(value, path);\n }\n const next = inner(child, childPath);\n if (isNotNullish(next)) {\n result[key] = next;\n }\n }\n return result;\n }\n return predicate(value, path);\n }\n return inner(target);\n}\nfunction mapObject(obj, fn) {\n if (!isObject(obj))\n return fn(obj);\n return walkObject(obj, (value) => fn(value));\n}\n\n// src/normalize-style-object.ts\nfunction toResponsiveObject(values, breakpoints) {\n return values.reduce((acc, current, index) => {\n const key = breakpoints[index];\n if (current != null) {\n acc[key] = current;\n }\n return acc;\n }, {});\n}\nfunction normalizeShorthand(styles, context) {\n const { hasShorthand, resolveShorthand } = context.utility;\n return walkObject(styles, (v) => v, {\n getKey: (prop) => {\n return hasShorthand ? resolveShorthand(prop) : prop;\n }\n });\n}\nfunction normalizeStyleObject(styles, context) {\n const { utility, conditions } = context;\n const { hasShorthand, resolveShorthand } = utility;\n return walkObject(\n styles,\n (value) => {\n return Array.isArray(value) ? toResponsiveObject(value, conditions.breakpoints.keys) : value;\n },\n {\n stop: (value) => Array.isArray(value),\n getKey: (prop) => {\n return hasShorthand ? resolveShorthand(prop) : prop;\n }\n }\n );\n}\n\n// src/classname.ts\nvar fallbackCondition = {\n shift: (v) => v,\n finalize: (v) => v,\n breakpoints: { keys: [] }\n};\nvar sanitize = (value) => typeof value === "string" ? value.replaceAll(/[\\n\\s]+/g, " ") : value;\nfunction createCss(context) {\n const { utility, hash, conditions: conds = fallbackCondition } = context;\n const formatClassName = (str) => [utility.prefix, str].filter(Boolean).join("-");\n const hashFn = (conditions, className) => {\n let result;\n if (hash) {\n const baseArray = [...conds.finalize(conditions), className];\n result = formatClassName(toHash(baseArray.join(":")));\n } else {\n const baseArray = [...conds.finalize(conditions), formatClassName(className)];\n result = baseArray.join(":");\n }\n return result;\n };\n return (styleObject = {}) => {\n const normalizedObject = normalizeStyleObject(styleObject, context);\n const classNames = /* @__PURE__ */ new Set();\n walkObject(normalizedObject, (value, paths) => {\n const important = isImportant(value);\n if (value == null)\n return;\n const [prop, ...allConditions] = conds.shift(paths);\n const conditions = filterBaseConditions(allConditions);\n const transformed = utility.transform(prop, withoutImportant(sanitize(value)));\n let className = hashFn(conditions, transformed.className);\n if (important)\n className = `${className}!`;\n classNames.add(className);\n });\n return Array.from(classNames).join(" ");\n };\n}\nfunction compactStyles(...styles) {\n return styles.filter((style) => isObject(style) && Object.keys(compact(style)).length > 0);\n}\nfunction createMergeCss(context) {\n function resolve(styles) {\n const allStyles = compactStyles(...styles);\n if (allStyles.length === 1)\n return allStyles;\n return allStyles.map((style) => normalizeShorthand(style, context));\n }\n function mergeCss(...styles) {\n return mergeProps(...resolve(styles));\n }\n function assignCss(...styles) {\n return Object.assign({}, ...resolve(styles));\n }\n return { mergeCss, assignCss };\n}\n\n// src/memo.ts\nvar memo = (fn) => {\n const cache = /* @__PURE__ */ new Map();\n const get = (...args) => {\n const key = JSON.stringify(args);\n if (cache.has(key)) {\n return cache.get(key);\n }\n const result = fn(...args);\n cache.set(key, result);\n return result;\n };\n return get;\n};\n\n// src/hypenate-property.ts\nvar wordRegex = /([A-Z])/g;\nvar msRegex = /^ms-/;\nvar hypenateProperty = memo((property) => {\n if (property.startsWith("--"))\n return property;\n return property.replace(wordRegex, "-$1").replace(msRegex, "-ms-").toLowerCase();\n});\n\n// src/normalize-html.ts\nvar htmlProps = ["htmlSize", "htmlTranslate", "htmlWidth", "htmlHeight"];\nfunction convert(key) {\n return htmlProps.includes(key) ? key.replace("html", "").toLowerCase() : key;\n}\nfunction normalizeHTMLProps(props) {\n return Object.fromEntries(Object.entries(props).map(([key, value]) => [convert(key), value]));\n}\nnormalizeHTMLProps.keys = htmlProps;\n\n// src/split-props.ts\nfunction splitProps(props, ...keys) {\n const descriptors = Object.getOwnPropertyDescriptors(props);\n const dKeys = Object.keys(descriptors);\n const split = (k) => {\n const clone = {};\n for (let i = 0; i < k.length; i++) {\n const key = k[i];\n if (descriptors[key]) {\n Object.defineProperty(clone, key, descriptors[key]);\n delete descriptors[key];\n }\n }\n return clone;\n };\n const fn = (key) => split(Array.isArray(key) ? key : dKeys.filter(key));\n return keys.map(fn).concat(split(dKeys));\n}\nexport {\n astish,\n compact,\n createCss,\n createMergeCss,\n filterBaseConditions,\n hypenateProperty,\n isBaseCondition,\n isObject,\n mapObject,\n mergeProps,\n normalizeHTMLProps,\n splitProps,\n toHash,\n walkObject,\n withoutSpace\n};\n'
|
|
842
|
+
content: '// src/assert.ts\nfunction isObject(value) {\n return typeof value === "object" && value != null && !Array.isArray(value);\n}\n\n// src/astish.ts\nvar newRule = /(?:([\\u0080-\\uFFFF\\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\\s*)/g;\nvar ruleClean = /\\/\\*[^]*?\\*\\/|\\s\\s+|\\n/g;\nvar astish = (val, tree = [{}]) => {\n const block = newRule.exec((val ?? "").replace(ruleClean, ""));\n if (!block)\n return tree[0];\n if (block[4])\n tree.shift();\n else if (block[3])\n tree.unshift(tree[0][block[3]] = tree[0][block[3]] || {});\n else\n tree[0][block[1]] = block[2];\n return astish(val, tree);\n};\n\n// src/compact.ts\nfunction compact(value) {\n return Object.fromEntries(Object.entries(value ?? {}).filter(([_, value2]) => value2 !== void 0));\n}\n\n// src/condition.ts\nvar isBaseCondition = (v) => v === "base";\nfunction filterBaseConditions(c) {\n return c.slice().filter((v) => !isBaseCondition(v));\n}\n\n// src/css-important.ts\nvar importantRegex = /!(important)?$/;\nfunction isImportant(value) {\n return typeof value === "string" ? importantRegex.test(value) : false;\n}\nfunction withoutImportant(value) {\n return typeof value === "string" ? value.replace(importantRegex, "").trim() : value;\n}\nfunction withoutSpace(str) {\n return typeof str === "string" ? str.replaceAll(" ", "_") : str;\n}\n\n// src/hash.ts\nfunction toChar(code) {\n return String.fromCharCode(code + (code > 25 ? 39 : 97));\n}\nfunction toName(code) {\n let name = "";\n let x;\n for (x = Math.abs(code); x > 52; x = x / 52 | 0)\n name = toChar(x % 52) + name;\n return toChar(x % 52) + name;\n}\nfunction toPhash(h, x) {\n let i = x.length;\n while (i)\n h = h * 33 ^ x.charCodeAt(--i);\n return h;\n}\nfunction toHash(value) {\n return toName(toPhash(5381, value) >>> 0);\n}\n\n// src/merge-props.ts\nfunction mergeProps(...sources) {\n const result = {};\n for (const source of sources) {\n for (const [key, value] of Object.entries(source)) {\n if (isObject(value)) {\n result[key] = mergeProps(result[key] || {}, value);\n } else {\n result[key] = value;\n }\n }\n }\n return result;\n}\n\n// src/walk-object.ts\nvar isNotNullish = (element) => element != null;\nfunction walkObject(target, predicate, options = {}) {\n const { stop, getKey } = options;\n function inner(value, path = []) {\n if (isObject(value) || Array.isArray(value)) {\n const result = {};\n for (const [prop, child] of Object.entries(value)) {\n const key = getKey?.(prop) ?? prop;\n const childPath = [...path, key];\n if (stop?.(value, childPath)) {\n return predicate(value, path);\n }\n const next = inner(child, childPath);\n if (isNotNullish(next)) {\n result[key] = next;\n }\n }\n return result;\n }\n return predicate(value, path);\n }\n return inner(target);\n}\nfunction mapObject(obj, fn) {\n if (!isObject(obj))\n return fn(obj);\n return walkObject(obj, (value) => fn(value));\n}\n\n// src/normalize-style-object.ts\nfunction toResponsiveObject(values, breakpoints) {\n return values.reduce((acc, current, index) => {\n const key = breakpoints[index];\n if (current != null) {\n acc[key] = current;\n }\n return acc;\n }, {});\n}\nfunction normalizeShorthand(styles, context) {\n const { hasShorthand, resolveShorthand } = context.utility;\n return walkObject(styles, (v) => v, {\n getKey: (prop) => {\n return hasShorthand ? resolveShorthand(prop) : prop;\n }\n });\n}\nfunction normalizeStyleObject(styles, context) {\n const { utility, conditions } = context;\n const { hasShorthand, resolveShorthand } = utility;\n return walkObject(\n styles,\n (value) => {\n return Array.isArray(value) ? toResponsiveObject(value, conditions.breakpoints.keys) : value;\n },\n {\n stop: (value) => Array.isArray(value),\n getKey: (prop) => {\n return hasShorthand ? resolveShorthand(prop) : prop;\n }\n }\n );\n}\n\n// src/classname.ts\nvar fallbackCondition = {\n shift: (v) => v,\n finalize: (v) => v,\n breakpoints: { keys: [] }\n};\nvar sanitize = (value) => typeof value === "string" ? value.replaceAll(/[\\n\\s]+/g, " ") : value;\nfunction createCss(context) {\n const { utility, hash, conditions: conds = fallbackCondition } = context;\n const formatClassName = (str) => [utility.prefix, str].filter(Boolean).join("-");\n const hashFn = (conditions, className) => {\n let result;\n if (hash) {\n const baseArray = [...conds.finalize(conditions), className];\n result = formatClassName(toHash(baseArray.join(":")));\n } else {\n const baseArray = [...conds.finalize(conditions), formatClassName(className)];\n result = baseArray.join(":");\n }\n return result;\n };\n return (styleObject = {}) => {\n const normalizedObject = normalizeStyleObject(styleObject, context);\n const classNames = /* @__PURE__ */ new Set();\n walkObject(normalizedObject, (value, paths) => {\n const important = isImportant(value);\n if (value == null)\n return;\n const [prop, ...allConditions] = conds.shift(paths);\n const conditions = filterBaseConditions(allConditions);\n const transformed = utility.transform(prop, withoutImportant(sanitize(value)));\n let className = hashFn(conditions, transformed.className);\n if (important)\n className = `${className}!`;\n classNames.add(className);\n });\n return Array.from(classNames).join(" ");\n };\n}\nfunction compactStyles(...styles) {\n return styles.filter((style) => isObject(style) && Object.keys(compact(style)).length > 0);\n}\nfunction createMergeCss(context) {\n function resolve(styles) {\n const allStyles = compactStyles(...styles);\n if (allStyles.length === 1)\n return allStyles;\n return allStyles.map((style) => normalizeShorthand(style, context));\n }\n function mergeCss(...styles) {\n return mergeProps(...resolve(styles));\n }\n function assignCss(...styles) {\n return Object.assign({}, ...resolve(styles));\n }\n return { mergeCss, assignCss };\n}\n\n// src/memo.ts\nvar memo = (fn) => {\n const cache = /* @__PURE__ */ new Map();\n const get = (...args) => {\n const key = JSON.stringify(args);\n if (cache.has(key)) {\n return cache.get(key);\n }\n const result = fn(...args);\n cache.set(key, result);\n return result;\n };\n return get;\n};\n\n// src/hypenate-property.ts\nvar wordRegex = /([A-Z])/g;\nvar msRegex = /^ms-/;\nvar hypenateProperty = memo((property) => {\n if (property.startsWith("--"))\n return property;\n return property.replace(wordRegex, "-$1").replace(msRegex, "-ms-").toLowerCase();\n});\n\n// src/normalize-html.ts\nvar htmlProps = ["htmlSize", "htmlTranslate", "htmlWidth", "htmlHeight"];\nfunction convert(key) {\n return htmlProps.includes(key) ? key.replace("html", "").toLowerCase() : key;\n}\nfunction normalizeHTMLProps(props) {\n return Object.fromEntries(Object.entries(props).map(([key, value]) => [convert(key), value]));\n}\nnormalizeHTMLProps.keys = htmlProps;\n\n// src/slot.ts\nvar assign = (obj, path, value) => {\n const last = path.pop();\n const target = path.reduce((acc, key) => {\n if (acc[key] == null)\n acc[key] = {};\n return acc[key];\n }, obj);\n if (last != null)\n target[last] = value;\n};\nvar getSlotRecipes = (recipe) => {\n const parts = recipe.slots.map((slot) => [\n slot,\n // setup base recipe\n {\n // create class-base on BEM\n className: [recipe.className ?? "", slot].join("__"),\n base: {},\n variants: {},\n defaultVariants: recipe.defaultVariants ?? {},\n compoundVariants: []\n }\n ]).map(([slot, cva]) => {\n const base = recipe.base[slot];\n if (base)\n cva.base = base;\n walkObject(\n recipe.variants ?? {},\n (variant, path) => {\n if (!variant[slot])\n return;\n assign(cva, ["variants", ...path], variant[slot]);\n },\n {\n stop: (_value, path) => path.includes(slot)\n }\n );\n if (recipe.compoundVariants) {\n cva.compoundVariants = getSlotCompoundVariant(recipe.compoundVariants, slot);\n }\n return [slot, cva];\n });\n return Object.fromEntries(parts);\n};\nvar getSlotCompoundVariant = (compoundVariants, slotName) => compoundVariants.filter((compoundVariant) => compoundVariant.css[slotName]).map((compoundVariant) => ({ ...compoundVariant, css: compoundVariant.css[slotName] }));\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 getSlotCompoundVariant,\n getSlotRecipes,\n hypenateProperty,\n isBaseCondition,\n isObject,\n mapObject,\n mergeProps,\n normalizeHTMLProps,\n splitProps,\n toHash,\n walkObject,\n withoutSpace\n};\n'
|
|
843
843
|
};
|
|
844
844
|
|
|
845
845
|
// src/artifacts/js/helpers.ts
|
|
@@ -960,8 +960,10 @@ transform`)}
|
|
|
960
960
|
}
|
|
961
961
|
|
|
962
962
|
// src/artifacts/js/recipe.ts
|
|
963
|
+
var import_core4 = require("@pandacss/core");
|
|
963
964
|
var import_shared2 = require("@pandacss/shared");
|
|
964
965
|
var import_outdent11 = require("outdent");
|
|
966
|
+
var import_ts_pattern2 = require("ts-pattern");
|
|
965
967
|
var stringify3 = (value) => JSON.stringify(value, null, 2);
|
|
966
968
|
var isBooleanValue = (value) => value === "true" || value === "false";
|
|
967
969
|
function generateRecipes(ctx) {
|
|
@@ -1020,13 +1022,38 @@ function generateRecipes(ctx) {
|
|
|
1020
1022
|
...ctx.recipes.details.map((recipe) => {
|
|
1021
1023
|
const { baseName, config, upperName, variantKeyMap, dashName } = recipe;
|
|
1022
1024
|
const { description, defaultVariants, compoundVariants } = config;
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1025
|
+
const jsCode = (0, import_ts_pattern2.match)(config).when(
|
|
1026
|
+
import_core4.isSlotRecipe,
|
|
1027
|
+
(config2) => import_outdent11.outdent`
|
|
1028
|
+
${ctx.file.import("splitProps, getSlotCompoundVariant", "../helpers")}
|
|
1029
|
+
${ctx.file.import("createRecipe", "./create-recipe")}
|
|
1030
|
+
|
|
1031
|
+
const defaultVariants = ${stringify3(defaultVariants ?? {})}
|
|
1032
|
+
const compoundVariants = ${stringify3(compoundVariants ?? [])}
|
|
1033
|
+
|
|
1034
|
+
const slotNames = ${stringify3(config2.slots.map((slot) => [slot, `${config2.className}__${slot}`]))}
|
|
1035
|
+
const slotFns = slotNames.map(([slotName, slotKey]) => [slotName, createRecipe(slotKey, defaultVariants, getSlotCompoundVariant(compoundVariants, slotName))])
|
|
1036
|
+
|
|
1037
|
+
const ${baseName}Fn = (props = {}) => {
|
|
1038
|
+
return Object.fromEntries(slotFns.map(([slotName, slotFn]) => [slotName, slotFn(props)]))
|
|
1039
|
+
}
|
|
1040
|
+
|
|
1041
|
+
export const ${baseName} = Object.assign(${baseName}Fn, {
|
|
1042
|
+
__recipe__: false,
|
|
1043
|
+
raw: (props) => props,
|
|
1044
|
+
variantKeys: ${stringify3(Object.keys(variantKeyMap))},
|
|
1045
|
+
variantMap: ${stringify3(variantKeyMap)},
|
|
1046
|
+
splitVariantProps(props) {
|
|
1047
|
+
return splitProps(props, ${stringify3(Object.keys(variantKeyMap))})
|
|
1048
|
+
},
|
|
1049
|
+
})
|
|
1050
|
+
`
|
|
1051
|
+
).otherwise(
|
|
1052
|
+
(config2) => import_outdent11.outdent`
|
|
1026
1053
|
${ctx.file.import("splitProps", "../helpers")}
|
|
1027
1054
|
${ctx.file.import("createRecipe", "./create-recipe")}
|
|
1028
1055
|
|
|
1029
|
-
const ${baseName}Fn = createRecipe('${
|
|
1056
|
+
const ${baseName}Fn = createRecipe('${config2.className}', ${stringify3(defaultVariants ?? {})}, ${stringify3(
|
|
1030
1057
|
compoundVariants ?? []
|
|
1031
1058
|
)})
|
|
1032
1059
|
|
|
@@ -1039,7 +1066,11 @@ function generateRecipes(ctx) {
|
|
|
1039
1066
|
return splitProps(props, ${stringify3(Object.keys(variantKeyMap))})
|
|
1040
1067
|
},
|
|
1041
1068
|
})
|
|
1042
|
-
|
|
1069
|
+
`
|
|
1070
|
+
);
|
|
1071
|
+
return {
|
|
1072
|
+
name: dashName,
|
|
1073
|
+
js: jsCode,
|
|
1043
1074
|
dts: import_outdent11.outdent`
|
|
1044
1075
|
import type { ConditionalValue } from '../types'
|
|
1045
1076
|
import type { Pretty } from '../types/helpers'
|
|
@@ -1063,7 +1094,7 @@ function generateRecipes(ctx) {
|
|
|
1063
1094
|
|
|
1064
1095
|
interface ${upperName}Recipe {
|
|
1065
1096
|
__type: ${upperName}VariantProps
|
|
1066
|
-
(props?: ${upperName}VariantProps): string
|
|
1097
|
+
(props?: ${upperName}VariantProps): ${(0, import_core4.isSlotRecipe)(config) ? `Pretty<Record<${(0, import_shared2.unionType)(config.slots)}, string>>` : "string"}
|
|
1067
1098
|
raw: (props?: ${upperName}VariantProps) => ${upperName}VariantProps
|
|
1068
1099
|
variantMap: ${upperName}VariantMap
|
|
1069
1100
|
variantKeys: Array<keyof ${upperName}Variant>
|
|
@@ -1078,8 +1109,42 @@ function generateRecipes(ctx) {
|
|
|
1078
1109
|
];
|
|
1079
1110
|
}
|
|
1080
1111
|
|
|
1112
|
+
// src/artifacts/js/sva.ts
|
|
1113
|
+
var import_outdent12 = require("outdent");
|
|
1114
|
+
function generateSvaFn(ctx) {
|
|
1115
|
+
return {
|
|
1116
|
+
js: import_outdent12.outdent`
|
|
1117
|
+
${ctx.file.import("getSlotRecipes", "../helpers")}
|
|
1118
|
+
${ctx.file.import("cva", "./cva")}
|
|
1119
|
+
|
|
1120
|
+
export function sva(config) {
|
|
1121
|
+
const slots = Object.entries(getSlotRecipes(config)).map(([slot, slotCva]) => [slot, cva(slotCva)])
|
|
1122
|
+
|
|
1123
|
+
function svaFn(props) {
|
|
1124
|
+
const result = slots.map(([slot, cvaFn]) => [slot, cvaFn(props)])
|
|
1125
|
+
return Object.fromEntries(result)
|
|
1126
|
+
}
|
|
1127
|
+
|
|
1128
|
+
const [, firstCva] = slots[0]
|
|
1129
|
+
|
|
1130
|
+
return Object.assign(svaFn, {
|
|
1131
|
+
__cva__: false,
|
|
1132
|
+
variantMap: firstCva.variantMap,
|
|
1133
|
+
variantKeys: firstCva.variantKeys,
|
|
1134
|
+
splitVariantProps: firstCva.splitVariantProps,
|
|
1135
|
+
})
|
|
1136
|
+
}
|
|
1137
|
+
`,
|
|
1138
|
+
dts: import_outdent12.outdent`
|
|
1139
|
+
import type { SlotRecipeCreatorFn } from '../types/recipe'
|
|
1140
|
+
|
|
1141
|
+
export declare const sva: SlotRecipeCreatorFn
|
|
1142
|
+
`
|
|
1143
|
+
};
|
|
1144
|
+
}
|
|
1145
|
+
|
|
1081
1146
|
// src/artifacts/js/token.ts
|
|
1082
|
-
var
|
|
1147
|
+
var import_outdent13 = __toESM(require("outdent"));
|
|
1083
1148
|
function generateTokenJs(ctx) {
|
|
1084
1149
|
const { tokens } = ctx;
|
|
1085
1150
|
const map = /* @__PURE__ */ new Map();
|
|
@@ -1090,7 +1155,7 @@ function generateTokenJs(ctx) {
|
|
|
1090
1155
|
});
|
|
1091
1156
|
const obj = Object.fromEntries(map);
|
|
1092
1157
|
return {
|
|
1093
|
-
js:
|
|
1158
|
+
js: import_outdent13.default`
|
|
1094
1159
|
const tokens = ${JSON.stringify(obj, null, 2)}
|
|
1095
1160
|
|
|
1096
1161
|
export function token(path, fallback) {
|
|
@@ -1103,7 +1168,7 @@ function generateTokenJs(ctx) {
|
|
|
1103
1168
|
|
|
1104
1169
|
token.var = tokenVar
|
|
1105
1170
|
`,
|
|
1106
|
-
dts:
|
|
1171
|
+
dts: import_outdent13.default`
|
|
1107
1172
|
import type { Token } from './tokens'
|
|
1108
1173
|
|
|
1109
1174
|
export declare const token: {
|
|
@@ -1117,11 +1182,11 @@ function generateTokenJs(ctx) {
|
|
|
1117
1182
|
}
|
|
1118
1183
|
|
|
1119
1184
|
// src/artifacts/preact-jsx/jsx.ts
|
|
1120
|
-
var
|
|
1185
|
+
var import_outdent14 = require("outdent");
|
|
1121
1186
|
function generatePreactJsxFactory(ctx) {
|
|
1122
1187
|
const { factoryName, componentName } = ctx.jsx;
|
|
1123
1188
|
return {
|
|
1124
|
-
js:
|
|
1189
|
+
js: import_outdent14.outdent`
|
|
1125
1190
|
import { h } from 'preact'
|
|
1126
1191
|
import { forwardRef } from 'preact/compat'
|
|
1127
1192
|
import { useMemo } from 'preact/hooks'
|
|
@@ -1188,8 +1253,8 @@ function generatePreactJsxFactory(ctx) {
|
|
|
1188
1253
|
}
|
|
1189
1254
|
|
|
1190
1255
|
// src/artifacts/preact-jsx/pattern.ts
|
|
1191
|
-
var
|
|
1192
|
-
var
|
|
1256
|
+
var import_outdent15 = require("outdent");
|
|
1257
|
+
var import_ts_pattern3 = require("ts-pattern");
|
|
1193
1258
|
function generatePreactJsxPattern(ctx) {
|
|
1194
1259
|
const { typeName, factoryName } = ctx.jsx;
|
|
1195
1260
|
return ctx.patterns.details.map((pattern) => {
|
|
@@ -1197,21 +1262,21 @@ function generatePreactJsxPattern(ctx) {
|
|
|
1197
1262
|
const { description, jsxElement = "div" } = pattern.config;
|
|
1198
1263
|
return {
|
|
1199
1264
|
name: dashName,
|
|
1200
|
-
js:
|
|
1265
|
+
js: import_outdent15.outdent`
|
|
1201
1266
|
import { h } from 'preact'
|
|
1202
1267
|
import { forwardRef } from 'preact/compat'
|
|
1203
1268
|
${ctx.file.import(factoryName, "./factory")}
|
|
1204
1269
|
${ctx.file.import(styleFnName, `../patterns/${dashName}`)}
|
|
1205
1270
|
|
|
1206
1271
|
export const ${jsxName} = forwardRef(function ${jsxName}(props, ref) {
|
|
1207
|
-
${(0,
|
|
1272
|
+
${(0, import_ts_pattern3.match)(props.length).with(
|
|
1208
1273
|
0,
|
|
1209
|
-
() =>
|
|
1274
|
+
() => import_outdent15.outdent`
|
|
1210
1275
|
const styleProps = ${styleFnName}()
|
|
1211
1276
|
return h(${factoryName}.${jsxElement}, { ref, ...styleProps, ...props })
|
|
1212
1277
|
`
|
|
1213
1278
|
).otherwise(
|
|
1214
|
-
() =>
|
|
1279
|
+
() => import_outdent15.outdent`
|
|
1215
1280
|
const { ${props.join(", ")}, ...restProps } = props
|
|
1216
1281
|
const styleProps = ${styleFnName}({${props.join(", ")}})
|
|
1217
1282
|
return h(${factoryName}.${jsxElement}, { ref, ...styleProps, ...restProps })
|
|
@@ -1219,7 +1284,7 @@ function generatePreactJsxPattern(ctx) {
|
|
|
1219
1284
|
)}
|
|
1220
1285
|
})
|
|
1221
1286
|
`,
|
|
1222
|
-
dts:
|
|
1287
|
+
dts: import_outdent15.outdent`
|
|
1223
1288
|
import type { FunctionComponent } from 'preact'
|
|
1224
1289
|
import type { ${upperName}Properties } from '../patterns/${dashName}'
|
|
1225
1290
|
import type { ${typeName} } from '../types/jsx'
|
|
@@ -1234,15 +1299,15 @@ function generatePreactJsxPattern(ctx) {
|
|
|
1234
1299
|
}
|
|
1235
1300
|
|
|
1236
1301
|
// src/artifacts/preact-jsx/types.ts
|
|
1237
|
-
var
|
|
1302
|
+
var import_outdent16 = require("outdent");
|
|
1238
1303
|
function generatePreactJsxTypes(ctx) {
|
|
1239
1304
|
const { factoryName, componentName, upperName, typeName } = ctx.jsx;
|
|
1240
1305
|
return {
|
|
1241
|
-
jsxFactory:
|
|
1306
|
+
jsxFactory: import_outdent16.outdent`
|
|
1242
1307
|
import type { ${upperName} } from '../types/jsx'
|
|
1243
1308
|
export declare const ${factoryName}: ${upperName}
|
|
1244
1309
|
`,
|
|
1245
|
-
jsxType:
|
|
1310
|
+
jsxType: import_outdent16.outdent`
|
|
1246
1311
|
import type { ComponentProps, JSX } from 'preact'
|
|
1247
1312
|
import type { Assign, JsxStyleProps, JsxHTMLProps } from './system-types'
|
|
1248
1313
|
import type { RecipeDefinition, RecipeSelection, RecipeVariantRecord } from './recipe'
|
|
@@ -1277,11 +1342,11 @@ export type ${typeName}<T extends ElementType> = JsxHTMLProps<ComponentProps<T>,
|
|
|
1277
1342
|
}
|
|
1278
1343
|
|
|
1279
1344
|
// src/artifacts/preact-jsx/jsx.string-literal.ts
|
|
1280
|
-
var
|
|
1345
|
+
var import_outdent17 = require("outdent");
|
|
1281
1346
|
function generatePreactJsxStringLiteralFactory(ctx) {
|
|
1282
1347
|
const { factoryName, componentName } = ctx.jsx;
|
|
1283
1348
|
return {
|
|
1284
|
-
js:
|
|
1349
|
+
js: import_outdent17.outdent`
|
|
1285
1350
|
import { h } from 'preact'
|
|
1286
1351
|
import { forwardRef } from 'preact/compat'
|
|
1287
1352
|
${ctx.file.import("css, cx", "../css/index")}
|
|
@@ -1327,15 +1392,15 @@ function generatePreactJsxStringLiteralFactory(ctx) {
|
|
|
1327
1392
|
}
|
|
1328
1393
|
|
|
1329
1394
|
// src/artifacts/preact-jsx/types.string-literal.ts
|
|
1330
|
-
var
|
|
1395
|
+
var import_outdent18 = require("outdent");
|
|
1331
1396
|
function generatePreactJsxStringLiteralTypes(ctx) {
|
|
1332
1397
|
const { factoryName, componentName, upperName, typeName } = ctx.jsx;
|
|
1333
1398
|
return {
|
|
1334
|
-
jsxFactory:
|
|
1399
|
+
jsxFactory: import_outdent18.outdent`
|
|
1335
1400
|
import type { ${upperName} } from '../types/jsx'
|
|
1336
1401
|
export declare const ${factoryName}: ${upperName}
|
|
1337
1402
|
`,
|
|
1338
|
-
jsxType:
|
|
1403
|
+
jsxType: import_outdent18.outdent`
|
|
1339
1404
|
import type { ComponentProps, JSX } from 'preact'
|
|
1340
1405
|
|
|
1341
1406
|
type ElementType = keyof JSX.IntrinsicElements
|
|
@@ -1361,11 +1426,11 @@ export type ${typeName}<T extends ElementType> = ComponentProps<T>
|
|
|
1361
1426
|
}
|
|
1362
1427
|
|
|
1363
1428
|
// src/artifacts/qwik-jsx/jsx.ts
|
|
1364
|
-
var
|
|
1429
|
+
var import_outdent19 = require("outdent");
|
|
1365
1430
|
function generateQwikJsxFactory(ctx) {
|
|
1366
1431
|
const { factoryName, componentName } = ctx.jsx;
|
|
1367
1432
|
return {
|
|
1368
|
-
js:
|
|
1433
|
+
js: import_outdent19.outdent`
|
|
1369
1434
|
import { h } from '@builder.io/qwik'
|
|
1370
1435
|
${ctx.file.import("css, cx, cva, assignCss", "../css/index")}
|
|
1371
1436
|
${ctx.file.import("splitProps, normalizeHTMLProps", "../helpers")}
|
|
@@ -1429,8 +1494,8 @@ function generateQwikJsxFactory(ctx) {
|
|
|
1429
1494
|
}
|
|
1430
1495
|
|
|
1431
1496
|
// src/artifacts/qwik-jsx/pattern.ts
|
|
1432
|
-
var
|
|
1433
|
-
var
|
|
1497
|
+
var import_outdent20 = require("outdent");
|
|
1498
|
+
var import_ts_pattern4 = require("ts-pattern");
|
|
1434
1499
|
function generateQwikJsxPattern(ctx) {
|
|
1435
1500
|
const { typeName, factoryName } = ctx.jsx;
|
|
1436
1501
|
return ctx.patterns.details.map((pattern) => {
|
|
@@ -1438,20 +1503,20 @@ function generateQwikJsxPattern(ctx) {
|
|
|
1438
1503
|
const { description, jsxElement = "div" } = pattern.config;
|
|
1439
1504
|
return {
|
|
1440
1505
|
name: dashName,
|
|
1441
|
-
js:
|
|
1506
|
+
js: import_outdent20.outdent`
|
|
1442
1507
|
import { h } from '@builder.io/qwik'
|
|
1443
1508
|
${ctx.file.import(factoryName, "./factory")}
|
|
1444
1509
|
${ctx.file.import(styleFnName, `../patterns/${dashName}`)}
|
|
1445
1510
|
|
|
1446
1511
|
export const ${jsxName} = function ${jsxName}(props) {
|
|
1447
|
-
${(0,
|
|
1512
|
+
${(0, import_ts_pattern4.match)(props.length).with(
|
|
1448
1513
|
0,
|
|
1449
|
-
() =>
|
|
1514
|
+
() => import_outdent20.outdent`
|
|
1450
1515
|
const styleProps = ${styleFnName}()
|
|
1451
1516
|
return h(${factoryName}.${jsxElement}, { ...styleProps, ...props })
|
|
1452
1517
|
`
|
|
1453
1518
|
).otherwise(
|
|
1454
|
-
() =>
|
|
1519
|
+
() => import_outdent20.outdent`
|
|
1455
1520
|
const { ${props.join(", ")}, ...restProps } = props
|
|
1456
1521
|
const styleProps = ${styleFnName}({${props.join(", ")}})
|
|
1457
1522
|
return h(${factoryName}.${jsxElement}, { ...styleProps, ...restProps })
|
|
@@ -1459,7 +1524,7 @@ function generateQwikJsxPattern(ctx) {
|
|
|
1459
1524
|
)}
|
|
1460
1525
|
}
|
|
1461
1526
|
`,
|
|
1462
|
-
dts:
|
|
1527
|
+
dts: import_outdent20.outdent`
|
|
1463
1528
|
import type { FunctionComponent } from '@builder.io/qwik'
|
|
1464
1529
|
import type { ${upperName}Properties } from '../patterns/${dashName}'
|
|
1465
1530
|
import type { ${typeName} } from '../types/jsx'
|
|
@@ -1478,15 +1543,15 @@ function generateQwikJsxPattern(ctx) {
|
|
|
1478
1543
|
}
|
|
1479
1544
|
|
|
1480
1545
|
// src/artifacts/qwik-jsx/types.ts
|
|
1481
|
-
var
|
|
1546
|
+
var import_outdent21 = require("outdent");
|
|
1482
1547
|
function generateQwikJsxTypes(ctx) {
|
|
1483
1548
|
const { factoryName, componentName, upperName, typeName } = ctx.jsx;
|
|
1484
1549
|
return {
|
|
1485
|
-
jsxFactory:
|
|
1550
|
+
jsxFactory: import_outdent21.outdent`
|
|
1486
1551
|
import { ${upperName} } from '../types/jsx'
|
|
1487
1552
|
export declare const ${factoryName}: ${upperName}
|
|
1488
1553
|
`,
|
|
1489
|
-
jsxType:
|
|
1554
|
+
jsxType: import_outdent21.outdent`
|
|
1490
1555
|
import type { FunctionComponent, QwikIntrinsicElements } from '@builder.io/qwik'
|
|
1491
1556
|
import type { Assign as _Assign, JsxStyleProps, PatchedHTMLProps } from './system-types'
|
|
1492
1557
|
import type { RecipeDefinition, RecipeSelection, RecipeVariantRecord } from './recipe'
|
|
@@ -1540,11 +1605,11 @@ export type ${typeName}<T extends ElementType> = Assign<ComponentProps<T>, JsxSt
|
|
|
1540
1605
|
}
|
|
1541
1606
|
|
|
1542
1607
|
// src/artifacts/qwik-jsx/jsx.string-literal.ts
|
|
1543
|
-
var
|
|
1608
|
+
var import_outdent22 = require("outdent");
|
|
1544
1609
|
function generateQwikJsxStringLiteralFactory(ctx) {
|
|
1545
1610
|
const { factoryName, componentName } = ctx.jsx;
|
|
1546
1611
|
return {
|
|
1547
|
-
js:
|
|
1612
|
+
js: import_outdent22.outdent`
|
|
1548
1613
|
import { h } from '@builder.io/qwik'
|
|
1549
1614
|
${ctx.file.import("css, cx", "../css/index")}
|
|
1550
1615
|
|
|
@@ -1589,15 +1654,15 @@ function generateQwikJsxStringLiteralFactory(ctx) {
|
|
|
1589
1654
|
}
|
|
1590
1655
|
|
|
1591
1656
|
// src/artifacts/qwik-jsx/types.string-literal.ts
|
|
1592
|
-
var
|
|
1657
|
+
var import_outdent23 = require("outdent");
|
|
1593
1658
|
function generateQwikJsxStringLiteralTypes(ctx) {
|
|
1594
1659
|
const { factoryName, componentName, upperName, typeName } = ctx.jsx;
|
|
1595
1660
|
return {
|
|
1596
|
-
jsxFactory:
|
|
1661
|
+
jsxFactory: import_outdent23.outdent`
|
|
1597
1662
|
import { ${upperName} } from '../types/jsx'
|
|
1598
1663
|
export declare const ${factoryName}: ${upperName}
|
|
1599
1664
|
`,
|
|
1600
|
-
jsxType:
|
|
1665
|
+
jsxType: import_outdent23.outdent`
|
|
1601
1666
|
import type { FunctionComponent, QwikIntrinsicElements } from '@builder.io/qwik'
|
|
1602
1667
|
|
|
1603
1668
|
type ElementType = keyof QwikIntrinsicElements | FunctionComponent<any>
|
|
@@ -1628,11 +1693,11 @@ export type ${typeName}<T extends ElementType> = ComponentProps<T>
|
|
|
1628
1693
|
}
|
|
1629
1694
|
|
|
1630
1695
|
// src/artifacts/react-jsx/jsx.ts
|
|
1631
|
-
var
|
|
1696
|
+
var import_outdent24 = require("outdent");
|
|
1632
1697
|
function generateReactJsxFactory(ctx) {
|
|
1633
1698
|
const { factoryName, componentName } = ctx.jsx;
|
|
1634
1699
|
return {
|
|
1635
|
-
js:
|
|
1700
|
+
js: import_outdent24.outdent`
|
|
1636
1701
|
import { createElement, forwardRef, useMemo } from 'react'
|
|
1637
1702
|
${ctx.file.import("css, cx, cva, assignCss", "../css/index")}
|
|
1638
1703
|
${ctx.file.import("splitProps, normalizeHTMLProps", "../helpers")}
|
|
@@ -1698,8 +1763,8 @@ function generateReactJsxFactory(ctx) {
|
|
|
1698
1763
|
}
|
|
1699
1764
|
|
|
1700
1765
|
// src/artifacts/react-jsx/pattern.ts
|
|
1701
|
-
var
|
|
1702
|
-
var
|
|
1766
|
+
var import_outdent25 = require("outdent");
|
|
1767
|
+
var import_ts_pattern5 = require("ts-pattern");
|
|
1703
1768
|
function generateReactJsxPattern(ctx) {
|
|
1704
1769
|
const { typeName, factoryName } = ctx.jsx;
|
|
1705
1770
|
return ctx.patterns.details.map((pattern) => {
|
|
@@ -1707,20 +1772,20 @@ function generateReactJsxPattern(ctx) {
|
|
|
1707
1772
|
const { description, jsxElement = "div" } = pattern.config;
|
|
1708
1773
|
return {
|
|
1709
1774
|
name: dashName,
|
|
1710
|
-
js:
|
|
1775
|
+
js: import_outdent25.outdent`
|
|
1711
1776
|
import { createElement, forwardRef } from 'react'
|
|
1712
1777
|
${ctx.file.import(factoryName, "./factory")}
|
|
1713
1778
|
${ctx.file.import(styleFnName, `../patterns/${dashName}`)}
|
|
1714
1779
|
|
|
1715
1780
|
export const ${jsxName} = forwardRef(function ${jsxName}(props, ref) {
|
|
1716
|
-
${(0,
|
|
1781
|
+
${(0, import_ts_pattern5.match)(props.length).with(
|
|
1717
1782
|
0,
|
|
1718
|
-
() =>
|
|
1783
|
+
() => import_outdent25.outdent`
|
|
1719
1784
|
const styleProps = ${styleFnName}()
|
|
1720
1785
|
return createElement(${factoryName}.${jsxElement}, { ref, ...styleProps, ...props })
|
|
1721
1786
|
`
|
|
1722
1787
|
).otherwise(
|
|
1723
|
-
() =>
|
|
1788
|
+
() => import_outdent25.outdent`
|
|
1724
1789
|
const { ${props.join(", ")}, ...restProps } = props
|
|
1725
1790
|
const styleProps = ${styleFnName}({${props.join(", ")}})
|
|
1726
1791
|
return createElement(${factoryName}.${jsxElement}, { ref, ...styleProps, ...restProps })
|
|
@@ -1728,7 +1793,7 @@ function generateReactJsxPattern(ctx) {
|
|
|
1728
1793
|
)}
|
|
1729
1794
|
})
|
|
1730
1795
|
`,
|
|
1731
|
-
dts:
|
|
1796
|
+
dts: import_outdent25.outdent`
|
|
1732
1797
|
import type { FunctionComponent } from 'react'
|
|
1733
1798
|
import type { ${upperName}Properties } from '../patterns/${dashName}'
|
|
1734
1799
|
import type { ${typeName} } from '../types/jsx'
|
|
@@ -1743,15 +1808,15 @@ function generateReactJsxPattern(ctx) {
|
|
|
1743
1808
|
}
|
|
1744
1809
|
|
|
1745
1810
|
// src/artifacts/react-jsx/types.ts
|
|
1746
|
-
var
|
|
1811
|
+
var import_outdent26 = require("outdent");
|
|
1747
1812
|
function generateReactJsxTypes(ctx) {
|
|
1748
1813
|
const { factoryName, componentName, upperName, typeName } = ctx.jsx;
|
|
1749
1814
|
return {
|
|
1750
|
-
jsxFactory:
|
|
1815
|
+
jsxFactory: import_outdent26.outdent`
|
|
1751
1816
|
import { ${upperName} } from '../types/jsx'
|
|
1752
1817
|
export declare const ${factoryName}: ${upperName}
|
|
1753
1818
|
`,
|
|
1754
|
-
jsxType:
|
|
1819
|
+
jsxType: import_outdent26.outdent`
|
|
1755
1820
|
import type { ComponentPropsWithoutRef, ElementType, ElementRef, Ref } from 'react'
|
|
1756
1821
|
import type { Assign, JsxStyleProps, JsxHTMLProps } from './system-types'
|
|
1757
1822
|
import type { RecipeDefinition, RecipeSelection, RecipeVariantRecord } from './recipe'
|
|
@@ -1788,11 +1853,11 @@ export type ${typeName}<T extends ElementType> = JsxHTMLProps<ComponentProps<T>,
|
|
|
1788
1853
|
}
|
|
1789
1854
|
|
|
1790
1855
|
// src/artifacts/react-jsx/jsx.string-literal.ts
|
|
1791
|
-
var
|
|
1856
|
+
var import_outdent27 = require("outdent");
|
|
1792
1857
|
function generateReactJsxStringLiteralFactory(ctx) {
|
|
1793
1858
|
const { factoryName, componentName } = ctx.jsx;
|
|
1794
1859
|
return {
|
|
1795
|
-
js:
|
|
1860
|
+
js: import_outdent27.outdent`
|
|
1796
1861
|
import { createElement, forwardRef } from 'react'
|
|
1797
1862
|
${ctx.file.import("css, cx", "../css/index")}
|
|
1798
1863
|
|
|
@@ -1838,15 +1903,15 @@ function generateReactJsxStringLiteralFactory(ctx) {
|
|
|
1838
1903
|
}
|
|
1839
1904
|
|
|
1840
1905
|
// src/artifacts/react-jsx/types.string-literal.ts
|
|
1841
|
-
var
|
|
1906
|
+
var import_outdent28 = require("outdent");
|
|
1842
1907
|
function generateReactJsxStringLiteralTypes(ctx) {
|
|
1843
1908
|
const { factoryName, componentName, upperName, typeName } = ctx.jsx;
|
|
1844
1909
|
return {
|
|
1845
|
-
jsxFactory:
|
|
1910
|
+
jsxFactory: import_outdent28.outdent`
|
|
1846
1911
|
import { ${upperName} } from '../types/jsx'
|
|
1847
1912
|
export declare const ${factoryName}: ${upperName}
|
|
1848
1913
|
`,
|
|
1849
|
-
jsxType:
|
|
1914
|
+
jsxType: import_outdent28.outdent`
|
|
1850
1915
|
import type { ComponentPropsWithoutRef, ElementType, ElementRef, Ref } from 'react'
|
|
1851
1916
|
|
|
1852
1917
|
type Dict = Record<string, unknown>
|
|
@@ -1874,11 +1939,11 @@ export type ${typeName}<T extends ElementType> = ComponentProps<T>
|
|
|
1874
1939
|
}
|
|
1875
1940
|
|
|
1876
1941
|
// src/artifacts/solid-jsx/jsx.ts
|
|
1877
|
-
var
|
|
1942
|
+
var import_outdent29 = require("outdent");
|
|
1878
1943
|
function generateSolidJsxFactory(ctx) {
|
|
1879
1944
|
const { componentName, factoryName } = ctx.jsx;
|
|
1880
1945
|
return {
|
|
1881
|
-
js:
|
|
1946
|
+
js: import_outdent29.outdent`
|
|
1882
1947
|
import { Dynamic } from 'solid-js/web'
|
|
1883
1948
|
import { mergeProps, splitProps } from 'solid-js'
|
|
1884
1949
|
import { createComponent } from 'solid-js/web'
|
|
@@ -1955,8 +2020,8 @@ function generateSolidJsxFactory(ctx) {
|
|
|
1955
2020
|
}
|
|
1956
2021
|
|
|
1957
2022
|
// src/artifacts/solid-jsx/pattern.ts
|
|
1958
|
-
var
|
|
1959
|
-
var
|
|
2023
|
+
var import_outdent30 = require("outdent");
|
|
2024
|
+
var import_ts_pattern6 = require("ts-pattern");
|
|
1960
2025
|
function generateSolidJsxPattern(ctx) {
|
|
1961
2026
|
const { typeName, factoryName } = ctx.jsx;
|
|
1962
2027
|
return ctx.patterns.details.map((pattern) => {
|
|
@@ -1964,21 +2029,21 @@ function generateSolidJsxPattern(ctx) {
|
|
|
1964
2029
|
const { description, jsxElement = "div" } = pattern.config;
|
|
1965
2030
|
return {
|
|
1966
2031
|
name: dashName,
|
|
1967
|
-
js:
|
|
2032
|
+
js: import_outdent30.outdent`
|
|
1968
2033
|
import { splitProps, mergeProps } from 'solid-js'
|
|
1969
2034
|
import { createComponent } from 'solid-js/web'
|
|
1970
2035
|
${ctx.file.import(factoryName, "./factory")}
|
|
1971
2036
|
${ctx.file.import(styleFnName, `../patterns/${dashName}`)}
|
|
1972
2037
|
|
|
1973
2038
|
export function ${jsxName}(props) {
|
|
1974
|
-
${(0,
|
|
2039
|
+
${(0, import_ts_pattern6.match)(props.length).with(
|
|
1975
2040
|
0,
|
|
1976
|
-
() =>
|
|
2041
|
+
() => import_outdent30.outdent`
|
|
1977
2042
|
const styleProps = ${styleFnName}()
|
|
1978
2043
|
return createComponent(${factoryName}.${jsxElement}, mergeProps(styleProps, props))
|
|
1979
2044
|
`
|
|
1980
2045
|
).otherwise(
|
|
1981
|
-
() =>
|
|
2046
|
+
() => import_outdent30.outdent`
|
|
1982
2047
|
const [patternProps, restProps] = splitProps(props, [${props.map((v) => JSON.stringify(v)).join(", ")}]);
|
|
1983
2048
|
const styleProps = ${styleFnName}(patternProps)
|
|
1984
2049
|
return createComponent(${factoryName}.${jsxElement}, mergeProps(styleProps, restProps))
|
|
@@ -1986,7 +2051,7 @@ function generateSolidJsxPattern(ctx) {
|
|
|
1986
2051
|
)}
|
|
1987
2052
|
}
|
|
1988
2053
|
`,
|
|
1989
|
-
dts:
|
|
2054
|
+
dts: import_outdent30.outdent`
|
|
1990
2055
|
import { Component } from 'solid-js'
|
|
1991
2056
|
import { ${upperName}Properties } from '../patterns/${dashName}'
|
|
1992
2057
|
import { ${typeName} } from '../types/jsx'
|
|
@@ -2001,15 +2066,15 @@ function generateSolidJsxPattern(ctx) {
|
|
|
2001
2066
|
}
|
|
2002
2067
|
|
|
2003
2068
|
// src/artifacts/solid-jsx/types.ts
|
|
2004
|
-
var
|
|
2069
|
+
var import_outdent31 = require("outdent");
|
|
2005
2070
|
function generateSolidJsxTypes(ctx) {
|
|
2006
2071
|
const { factoryName, componentName, upperName, typeName } = ctx.jsx;
|
|
2007
2072
|
return {
|
|
2008
|
-
jsxFactory:
|
|
2073
|
+
jsxFactory: import_outdent31.outdent`
|
|
2009
2074
|
import type { ${upperName} } from '../types/jsx'
|
|
2010
2075
|
export declare const ${factoryName}: ${upperName}
|
|
2011
2076
|
`,
|
|
2012
|
-
jsxType:
|
|
2077
|
+
jsxType: import_outdent31.outdent`
|
|
2013
2078
|
import type { ComponentProps, Component, JSX } from 'solid-js'
|
|
2014
2079
|
import type { Assign, JsxStyleProps, JsxHTMLProps } from './system-types'
|
|
2015
2080
|
import type { RecipeDefinition, RecipeSelection, RecipeVariantRecord } from './recipe'
|
|
@@ -2044,11 +2109,11 @@ export type ${typeName}<T extends ElementType> = JsxHTMLProps<ComponentProps<T>,
|
|
|
2044
2109
|
}
|
|
2045
2110
|
|
|
2046
2111
|
// src/artifacts/solid-jsx/jsx.string-literal.ts
|
|
2047
|
-
var
|
|
2112
|
+
var import_outdent32 = require("outdent");
|
|
2048
2113
|
function generateSolidJsxStringLiteralFactory(ctx) {
|
|
2049
2114
|
const { componentName, factoryName } = ctx.jsx;
|
|
2050
2115
|
return {
|
|
2051
|
-
js:
|
|
2116
|
+
js: import_outdent32.outdent`
|
|
2052
2117
|
import { mergeProps, splitProps } from 'solid-js'
|
|
2053
2118
|
import { Dynamic, createComponent } from 'solid-js/web'
|
|
2054
2119
|
${ctx.file.import("css, cx", "../css/index")}
|
|
@@ -2100,15 +2165,15 @@ export const ${factoryName} = createJsxFactory()
|
|
|
2100
2165
|
}
|
|
2101
2166
|
|
|
2102
2167
|
// src/artifacts/solid-jsx/types.string-literal.ts
|
|
2103
|
-
var
|
|
2168
|
+
var import_outdent33 = require("outdent");
|
|
2104
2169
|
function generateSolidJsxStringLiteralTypes(ctx) {
|
|
2105
2170
|
const { factoryName, componentName, upperName, typeName } = ctx.jsx;
|
|
2106
2171
|
return {
|
|
2107
|
-
jsxFactory:
|
|
2172
|
+
jsxFactory: import_outdent33.outdent`
|
|
2108
2173
|
import type { ${upperName} } from '../types/jsx'
|
|
2109
2174
|
export declare const ${factoryName}: ${upperName}
|
|
2110
2175
|
`,
|
|
2111
|
-
jsxType:
|
|
2176
|
+
jsxType: import_outdent33.outdent`
|
|
2112
2177
|
import type { Component, ComponentProps, JSX } from 'solid-js'
|
|
2113
2178
|
|
|
2114
2179
|
type Dict = Record<string, unknown>
|
|
@@ -2134,11 +2199,11 @@ export type ${typeName}<T extends ElementType> = ComponentProps<T>
|
|
|
2134
2199
|
}
|
|
2135
2200
|
|
|
2136
2201
|
// src/artifacts/vue-jsx/jsx.ts
|
|
2137
|
-
var
|
|
2202
|
+
var import_outdent34 = require("outdent");
|
|
2138
2203
|
function generateVueJsxFactory(ctx) {
|
|
2139
2204
|
const { factoryName } = ctx.jsx;
|
|
2140
2205
|
return {
|
|
2141
|
-
js:
|
|
2206
|
+
js: import_outdent34.outdent`
|
|
2142
2207
|
import { defineComponent, h, computed } from 'vue'
|
|
2143
2208
|
${ctx.file.import("css, cx, cva, assignCss", "../css/index")}
|
|
2144
2209
|
${ctx.file.import("splitProps, normalizeHTMLProps", "../helpers")}
|
|
@@ -2212,11 +2277,11 @@ function generateVueJsxFactory(ctx) {
|
|
|
2212
2277
|
}
|
|
2213
2278
|
|
|
2214
2279
|
// src/artifacts/vue-jsx/jsx.string-literal.ts
|
|
2215
|
-
var
|
|
2280
|
+
var import_outdent35 = require("outdent");
|
|
2216
2281
|
function generateVueJsxStringLiteralFactory(ctx) {
|
|
2217
2282
|
const { factoryName } = ctx.jsx;
|
|
2218
2283
|
return {
|
|
2219
|
-
js:
|
|
2284
|
+
js: import_outdent35.outdent`
|
|
2220
2285
|
import { defineComponent, h, computed } from 'vue'
|
|
2221
2286
|
${ctx.file.import("css, cx", "../css/index")}
|
|
2222
2287
|
|
|
@@ -2266,7 +2331,7 @@ function generateVueJsxStringLiteralFactory(ctx) {
|
|
|
2266
2331
|
}
|
|
2267
2332
|
|
|
2268
2333
|
// src/artifacts/vue-jsx/pattern.ts
|
|
2269
|
-
var
|
|
2334
|
+
var import_outdent36 = require("outdent");
|
|
2270
2335
|
function generateVueJsxPattern(ctx) {
|
|
2271
2336
|
const { typeName, factoryName } = ctx.jsx;
|
|
2272
2337
|
return ctx.patterns.details.map((pattern) => {
|
|
@@ -2275,7 +2340,7 @@ function generateVueJsxPattern(ctx) {
|
|
|
2275
2340
|
const propList = props.map((v) => JSON.stringify(v)).join(", ");
|
|
2276
2341
|
return {
|
|
2277
2342
|
name: dashName,
|
|
2278
|
-
js:
|
|
2343
|
+
js: import_outdent36.outdent`
|
|
2279
2344
|
import { defineComponent, h, computed } from 'vue'
|
|
2280
2345
|
${ctx.file.import(factoryName, "./factory")}
|
|
2281
2346
|
${ctx.file.import(styleFnName, `../patterns/${dashName}`)}
|
|
@@ -2293,7 +2358,7 @@ function generateVueJsxPattern(ctx) {
|
|
|
2293
2358
|
}
|
|
2294
2359
|
})
|
|
2295
2360
|
`,
|
|
2296
|
-
dts:
|
|
2361
|
+
dts: import_outdent36.outdent`
|
|
2297
2362
|
import { FunctionalComponent } from 'vue'
|
|
2298
2363
|
import { ${upperName}Properties } from '../patterns/${dashName}'
|
|
2299
2364
|
import { ${typeName} } from '../types/jsx'
|
|
@@ -2308,15 +2373,15 @@ function generateVueJsxPattern(ctx) {
|
|
|
2308
2373
|
}
|
|
2309
2374
|
|
|
2310
2375
|
// src/artifacts/vue-jsx/types.ts
|
|
2311
|
-
var
|
|
2376
|
+
var import_outdent37 = require("outdent");
|
|
2312
2377
|
function generateVueJsxTypes(ctx) {
|
|
2313
2378
|
const { factoryName, componentName, upperName, typeName } = ctx.jsx;
|
|
2314
2379
|
return {
|
|
2315
|
-
jsxFactory:
|
|
2380
|
+
jsxFactory: import_outdent37.outdent`
|
|
2316
2381
|
import { ${upperName} } from '../types/jsx'
|
|
2317
2382
|
export declare const ${factoryName}: ${upperName}
|
|
2318
2383
|
`,
|
|
2319
|
-
jsxType:
|
|
2384
|
+
jsxType: import_outdent37.outdent`
|
|
2320
2385
|
import type { Component, FunctionalComponent } from 'vue'
|
|
2321
2386
|
import type { Assign, JsxStyleProps, JsxHTMLProps } from './system-types'
|
|
2322
2387
|
import type { RecipeDefinition, RecipeSelection, RecipeVariantRecord } from './recipe'
|
|
@@ -2473,15 +2538,15 @@ type IntrinsicElement =
|
|
|
2473
2538
|
}
|
|
2474
2539
|
|
|
2475
2540
|
// src/artifacts/vue-jsx/types.string-literal.ts
|
|
2476
|
-
var
|
|
2541
|
+
var import_outdent38 = require("outdent");
|
|
2477
2542
|
function generateVueJsxStringLiteralTypes(ctx) {
|
|
2478
2543
|
const { factoryName, componentName, upperName, typeName } = ctx.jsx;
|
|
2479
2544
|
return {
|
|
2480
|
-
jsxFactory:
|
|
2545
|
+
jsxFactory: import_outdent38.outdent`
|
|
2481
2546
|
import { ${upperName} } from '../types/jsx'
|
|
2482
2547
|
export declare const ${factoryName}: ${upperName}
|
|
2483
2548
|
`,
|
|
2484
|
-
jsxType:
|
|
2549
|
+
jsxType: import_outdent38.outdent`
|
|
2485
2550
|
import type { Component, FunctionalComponent } from 'vue'
|
|
2486
2551
|
|
|
2487
2552
|
type IntrinsicElement =
|
|
@@ -2745,7 +2810,7 @@ var composition_d_ts_default = {
|
|
|
2745
2810
|
|
|
2746
2811
|
// src/artifacts/generated/recipe.d.ts.json
|
|
2747
2812
|
var recipe_d_ts_default = {
|
|
2748
|
-
content: "import type { SystemStyleObject } from './system-types'\n\ntype Pretty<T> =
|
|
2813
|
+
content: "import type { SystemStyleObject } from './system-types'\n\ntype Pretty<T> = { [K in keyof T]: T[K] } & {}\n\ntype StringToBoolean<T> = T extends 'true' | 'false' ? boolean : T\n\nexport type RecipeVariantRecord = Record<any, Record<any, SystemStyleObject>>\n\nexport type RecipeSelection<T extends RecipeVariantRecord> = keyof any extends keyof T\n ? {}\n : {\n [K in keyof T]?: StringToBoolean<keyof T[K]>\n }\n\nexport type RecipeVariantFn<T extends RecipeVariantRecord> = (props?: RecipeSelection<T>) => string\n\nexport type RecipeVariantProps<T extends RecipeVariantFn<RecipeVariantRecord>> = Pretty<Parameters<T>[0]>\n\ntype RecipeVariantMap<T extends RecipeVariantRecord> = {\n [K in keyof T]: Array<keyof T[K]>\n}\n\n/* -----------------------------------------------------------------------------\n * Recipe / Standard\n * -----------------------------------------------------------------------------*/\n\nexport type RecipeRuntimeFn<T extends RecipeVariantRecord> = RecipeVariantFn<T> & {\n __type: RecipeSelection<T>\n variantKeys: (keyof T)[]\n variantMap: RecipeVariantMap<T>\n resolve: (props: RecipeSelection<T>) => SystemStyleObject\n config: RecipeConfig<T>\n splitVariantProps<Props extends RecipeSelection<T>>(props: Props): [RecipeSelection<T>, Pretty<Omit<Props, keyof T>>]\n}\n\nexport type RecipeCompoundSelection<T extends RecipeVariantRecord> = {\n [K in keyof T]?: StringToBoolean<keyof T[K]> | Array<StringToBoolean<keyof T[K]>>\n}\n\nexport type RecipeCompoundVariant<T extends RecipeVariantRecord> = RecipeCompoundSelection<T> & {\n css: SystemStyleObject\n}\n\nexport type RecipeDefinition<T extends RecipeVariantRecord> = {\n /**\n * The base styles of the recipe.\n */\n base?: SystemStyleObject\n /**\n * The multi-variant styles of the recipe.\n */\n variants?: T | RecipeVariantRecord\n /**\n * The default variants of the recipe.\n */\n defaultVariants?: RecipeSelection<T>\n /**\n * The styles to apply when a combination of variants is selected.\n */\n compoundVariants?: Array<RecipeCompoundVariant<T>>\n}\n\nexport type RecipeCreatorFn = <T extends RecipeVariantRecord>(config: RecipeDefinition<T>) => RecipeRuntimeFn<T>\n\ntype RecipeConfigMeta = {\n /**\n * The name of the recipe.\n */\n className: string\n /**\n * The description of the recipe. This will be used in the JSDoc comment.\n */\n description?: string\n /**\n * The jsx elements to track for this recipe. Can be string or Regexp.\n *\n * @default capitalize(recipe.name)\n * @example ['Button', 'Link', /Button$/]\n */\n jsx?: Array<string | RegExp>\n}\n\nexport type RecipeConfig<T extends RecipeVariantRecord = RecipeVariantRecord> = RecipeDefinition<T> & RecipeConfigMeta\n\n/* -----------------------------------------------------------------------------\n * Recipe / Slot\n * -----------------------------------------------------------------------------*/\n\ntype SlotRecord<S extends string, T> = Partial<Record<S, T>>\n\nexport type SlotRecipeVariantRecord<S extends string> = Record<any, Record<any, SlotRecord<S, SystemStyleObject>>>\n\nexport type SlotRecipeVariantFn<S extends string, T extends RecipeVariantRecord> = (\n props?: RecipeSelection<T>,\n) => SlotRecord<S, string>\n\nexport type SlotRecipeRuntimeFn<S extends string, T extends SlotRecipeVariantRecord<S>> = SlotRecipeVariantFn<S, T> & {\n variantKeys: (keyof T)[]\n variantMap: RecipeVariantMap<T>\n splitVariantProps<Props extends RecipeSelection<T>>(props: Props): [RecipeSelection<T>, Pretty<Omit<Props, keyof T>>]\n}\n\nexport type SlotRecipeCompoundVariant<S extends string, T extends RecipeVariantRecord> = RecipeCompoundSelection<T> & {\n css: SlotRecord<S, SystemStyleObject>\n}\n\nexport type SlotRecipeDefinition<S extends string, T extends SlotRecipeVariantRecord<S>> = {\n /**\n * The parts/slots of the recipe.\n */\n slots: S[] | Readonly<S[]>\n /**\n * The base styles of the recipe.\n */\n base?: SlotRecord<S, SystemStyleObject>\n /**\n * The multi-variant styles of the recipe.\n */\n variants?: T | SlotRecipeVariantRecord<S>\n /**\n * The default variants of the recipe.\n */\n defaultVariants?: RecipeSelection<T>\n /**\n * The styles to apply when a combination of variants is selected.\n */\n compoundVariants?: Array<SlotRecipeCompoundVariant<S, T>>\n}\n\nexport type SlotRecipeCreatorFn = <S extends string, T extends SlotRecipeVariantRecord<S>>(\n config: SlotRecipeDefinition<S, T>,\n) => SlotRecipeRuntimeFn<S, T>\n\nexport type SlotRecipeConfig<\n S extends string = string,\n T extends SlotRecipeVariantRecord<S> = SlotRecipeVariantRecord<S>,\n> = SlotRecipeDefinition<S, T> & RecipeConfigMeta\n"
|
|
2749
2814
|
};
|
|
2750
2815
|
|
|
2751
2816
|
// src/artifacts/generated/pattern.d.ts.json
|
|
@@ -2777,10 +2842,10 @@ function getGeneratedTypes() {
|
|
|
2777
2842
|
}
|
|
2778
2843
|
|
|
2779
2844
|
// src/artifacts/types/main.ts
|
|
2780
|
-
var
|
|
2845
|
+
var import_outdent39 = require("outdent");
|
|
2781
2846
|
var generateTypesEntry = () => ({
|
|
2782
|
-
global:
|
|
2783
|
-
import type { RecipeVariantRecord, RecipeConfig } from './recipe'
|
|
2847
|
+
global: import_outdent39.outdent`
|
|
2848
|
+
import type { RecipeVariantRecord, RecipeConfig, SlotRecipeVariantRecord, SlotRecipeConfig } from './recipe'
|
|
2784
2849
|
import type { Parts } from './parts'
|
|
2785
2850
|
import type { PatternConfig, PatternProperties } from './pattern'
|
|
2786
2851
|
import type { GlobalStyleObject, SystemStyleObject } from './system-types'
|
|
@@ -2788,27 +2853,28 @@ var generateTypesEntry = () => ({
|
|
|
2788
2853
|
|
|
2789
2854
|
declare module '@pandacss/dev' {
|
|
2790
2855
|
export function defineRecipe<V extends RecipeVariantRecord>(config: RecipeConfig<V>): RecipeConfig
|
|
2856
|
+
export function defineSlotRecipe<S extends string, V extends SlotRecipeVariantRecord<S>>(config: SlotRecipeConfig<S, V>): SlotRecipeConfig
|
|
2791
2857
|
export function defineStyles(definition: SystemStyleObject): SystemStyleObject
|
|
2792
2858
|
export function defineGlobalStyles(definition: GlobalStyleObject): GlobalStyleObject
|
|
2793
2859
|
export function defineTextStyles(definition: CompositionStyles['textStyles']): CompositionStyles['textStyles']
|
|
2794
2860
|
export function defineLayerStyles(definition: CompositionStyles['layerStyles']): CompositionStyles['layerStyles']
|
|
2795
2861
|
export function definePattern<T extends PatternProperties>(config: PatternConfig<T>): PatternConfig
|
|
2796
|
-
export function defineParts<T extends Parts>(parts: T): (config: Partial<Record<keyof T, SystemStyleObject>>) => Partial<Record<keyof T, SystemStyleObject
|
|
2862
|
+
export function defineParts<T extends Parts>(parts: T): (config: Partial<Record<keyof T, SystemStyleObject>>) => Partial<Record<keyof T, SystemStyleObject>>
|
|
2797
2863
|
}
|
|
2798
2864
|
`,
|
|
2799
|
-
index:
|
|
2865
|
+
index: import_outdent39.outdent`
|
|
2800
2866
|
import './global'
|
|
2801
2867
|
export type { ConditionalValue } from './conditions'
|
|
2802
2868
|
export type { GlobalStyleObject, JsxStyleProps, SystemStyleObject } from './system-types'
|
|
2803
2869
|
|
|
2804
2870
|
`,
|
|
2805
|
-
helpers:
|
|
2871
|
+
helpers: import_outdent39.outdent`
|
|
2806
2872
|
export type Pretty<T> = T extends infer U ? { [K in keyof U]: U[K] } : never
|
|
2807
2873
|
`
|
|
2808
2874
|
});
|
|
2809
2875
|
|
|
2810
2876
|
// src/artifacts/types/prop-types.ts
|
|
2811
|
-
var
|
|
2877
|
+
var import_outdent40 = require("outdent");
|
|
2812
2878
|
function generatePropTypes(ctx) {
|
|
2813
2879
|
const {
|
|
2814
2880
|
config: { strictTokens },
|
|
@@ -2816,7 +2882,7 @@ function generatePropTypes(ctx) {
|
|
|
2816
2882
|
} = ctx;
|
|
2817
2883
|
const strictText = `${strictTokens ? "" : " | CssValue<T>"}`;
|
|
2818
2884
|
const result = [
|
|
2819
|
-
|
|
2885
|
+
import_outdent40.outdent`
|
|
2820
2886
|
import type { ConditionalValue } from './conditions';
|
|
2821
2887
|
import type { CssProperties } from './system-types'
|
|
2822
2888
|
import type { Tokens } from '../tokens'
|
|
@@ -2839,7 +2905,7 @@ function generatePropTypes(ctx) {
|
|
|
2839
2905
|
result.push(` ${key}: Shorthand<${JSON.stringify(value)}>;`);
|
|
2840
2906
|
});
|
|
2841
2907
|
result.push("}");
|
|
2842
|
-
return
|
|
2908
|
+
return import_outdent40.outdent`
|
|
2843
2909
|
${result.join("\n")}
|
|
2844
2910
|
|
|
2845
2911
|
export type PropertyValue<T extends string> = T extends keyof PropertyTypes
|
|
@@ -2852,10 +2918,10 @@ function generatePropTypes(ctx) {
|
|
|
2852
2918
|
|
|
2853
2919
|
// src/artifacts/types/style-props.ts
|
|
2854
2920
|
var import_is_valid_prop = require("@pandacss/is-valid-prop");
|
|
2855
|
-
var
|
|
2921
|
+
var import_outdent41 = __toESM(require("outdent"));
|
|
2856
2922
|
function generateStyleProps(ctx) {
|
|
2857
2923
|
const props = new Set(import_is_valid_prop.allCssProperties.concat(ctx.utility.keys()));
|
|
2858
|
-
return
|
|
2924
|
+
return import_outdent41.default`
|
|
2859
2925
|
import type { ConditionalValue } from './conditions'
|
|
2860
2926
|
import type { PropertyValue } from './prop-type'
|
|
2861
2927
|
import type { Token } from '../tokens'
|
|
@@ -2872,7 +2938,7 @@ function generateStyleProps(ctx) {
|
|
|
2872
2938
|
|
|
2873
2939
|
// src/artifacts/types/token-types.ts
|
|
2874
2940
|
var import_shared3 = require("@pandacss/shared");
|
|
2875
|
-
var
|
|
2941
|
+
var import_outdent42 = require("outdent");
|
|
2876
2942
|
var import_pluralize = __toESM(require("pluralize"));
|
|
2877
2943
|
var categories = [
|
|
2878
2944
|
"zIndex",
|
|
@@ -2917,7 +2983,7 @@ function generateTokenTypes(ctx) {
|
|
|
2917
2983
|
result.add("} & { [token: string]: never }");
|
|
2918
2984
|
set.add(Array.from(result).join("\n"));
|
|
2919
2985
|
set.add(`export type TokenCategory = ${(0, import_shared3.unionType)(categories)}`);
|
|
2920
|
-
return
|
|
2986
|
+
return import_outdent42.outdent.string(Array.from(set).join("\n\n"));
|
|
2921
2987
|
}
|
|
2922
2988
|
|
|
2923
2989
|
// src/artifacts/index.ts
|
|
@@ -2998,6 +3064,18 @@ function setupCva(ctx) {
|
|
|
2998
3064
|
]
|
|
2999
3065
|
};
|
|
3000
3066
|
}
|
|
3067
|
+
function setupSva(ctx) {
|
|
3068
|
+
if (ctx.isTemplateLiteralSyntax)
|
|
3069
|
+
return;
|
|
3070
|
+
const code = generateSvaFn(ctx);
|
|
3071
|
+
return {
|
|
3072
|
+
dir: ctx.paths.css,
|
|
3073
|
+
files: [
|
|
3074
|
+
{ file: ctx.file.ext("sva"), code: code.js },
|
|
3075
|
+
{ file: "sva.d.ts", code: code.dts }
|
|
3076
|
+
]
|
|
3077
|
+
};
|
|
3078
|
+
}
|
|
3001
3079
|
function setupCx(ctx) {
|
|
3002
3080
|
const code = generateCx();
|
|
3003
3081
|
return {
|
|
@@ -3014,8 +3092,8 @@ function setupRecipes(ctx) {
|
|
|
3014
3092
|
return;
|
|
3015
3093
|
const indexFiles = files.filter((file) => !file.name.includes("create-recipe"));
|
|
3016
3094
|
const index = {
|
|
3017
|
-
js:
|
|
3018
|
-
dts:
|
|
3095
|
+
js: import_outdent43.default.string(indexFiles.map((file) => ctx.file.export(`./${file.name}`)).join("\n")),
|
|
3096
|
+
dts: import_outdent43.default.string(indexFiles.map((file) => `export * from './${file.name}'`).join("\n"))
|
|
3019
3097
|
};
|
|
3020
3098
|
return {
|
|
3021
3099
|
dir: ctx.paths.recipe,
|
|
@@ -3034,8 +3112,8 @@ function setupPatterns(ctx) {
|
|
|
3034
3112
|
if (!files)
|
|
3035
3113
|
return;
|
|
3036
3114
|
const index = {
|
|
3037
|
-
js:
|
|
3038
|
-
dts:
|
|
3115
|
+
js: import_outdent43.default.string(files.map((file) => ctx.file.export(`./${file.name}`)).join("\n")),
|
|
3116
|
+
dts: import_outdent43.default.string(files.map((file) => `export * from './${file.name}'`).join("\n"))
|
|
3039
3117
|
};
|
|
3040
3118
|
return {
|
|
3041
3119
|
dir: ctx.paths.pattern,
|
|
@@ -3055,15 +3133,15 @@ function setupJsx(ctx) {
|
|
|
3055
3133
|
const factory = generateJsxFactory(ctx);
|
|
3056
3134
|
const patterns = generateJsxPatterns(ctx);
|
|
3057
3135
|
const index = {
|
|
3058
|
-
js:
|
|
3136
|
+
js: import_outdent43.default`
|
|
3059
3137
|
${ctx.file.export("./factory")}
|
|
3060
3138
|
${isValidProp?.js ? ctx.file.export("./is-valid-prop") : ""}
|
|
3061
|
-
${
|
|
3139
|
+
${import_outdent43.default.string(patterns.map((file) => ctx.file.export(`./${file.name}`)).join("\n"))}
|
|
3062
3140
|
`,
|
|
3063
|
-
dts:
|
|
3141
|
+
dts: import_outdent43.default`
|
|
3064
3142
|
export * from './factory'
|
|
3065
3143
|
${isValidProp?.dts ? `export * from './is-valid-prop'` : ""}
|
|
3066
|
-
${
|
|
3144
|
+
${import_outdent43.default.string(patterns.map((file) => `export * from './${file.name}'`).join("\n"))}
|
|
3067
3145
|
export type { ${ctx.jsx.typeName} } from '../types/jsx'
|
|
3068
3146
|
`
|
|
3069
3147
|
};
|
|
@@ -3083,15 +3161,17 @@ function setupJsx(ctx) {
|
|
|
3083
3161
|
}
|
|
3084
3162
|
function setupCssIndex(ctx) {
|
|
3085
3163
|
const index = {
|
|
3086
|
-
js:
|
|
3164
|
+
js: import_outdent43.default`
|
|
3087
3165
|
${ctx.file.export("./css")}
|
|
3088
3166
|
${ctx.file.export("./cx")}
|
|
3089
3167
|
${ctx.isTemplateLiteralSyntax ? "" : ctx.file.export("./cva")}
|
|
3168
|
+
${ctx.isTemplateLiteralSyntax ? "" : ctx.file.export("./sva")}
|
|
3090
3169
|
`,
|
|
3091
|
-
dts:
|
|
3170
|
+
dts: import_outdent43.default`
|
|
3092
3171
|
export * from './css'
|
|
3093
3172
|
export * from './cx'
|
|
3094
3173
|
${ctx.isTemplateLiteralSyntax ? "" : `export * from './cva'`}
|
|
3174
|
+
${ctx.isTemplateLiteralSyntax ? "" : `export * from './sva'`}
|
|
3095
3175
|
`
|
|
3096
3176
|
};
|
|
3097
3177
|
return {
|
|
@@ -3135,6 +3215,7 @@ var generateArtifacts = (ctx) => () => {
|
|
|
3135
3215
|
setupKeyframes(ctx),
|
|
3136
3216
|
setupTypes(ctx),
|
|
3137
3217
|
setupCva(ctx),
|
|
3218
|
+
setupSva(ctx),
|
|
3138
3219
|
setupCx(ctx),
|
|
3139
3220
|
setupCss(ctx),
|
|
3140
3221
|
setupRecipes(ctx),
|
|
@@ -3185,7 +3266,7 @@ var generateFlattenedCss = (ctx) => (options) => {
|
|
|
3185
3266
|
// src/artifacts/css/parser-css.ts
|
|
3186
3267
|
var import_logger2 = require("@pandacss/logger");
|
|
3187
3268
|
var import_func = require("lil-fp/func");
|
|
3188
|
-
var
|
|
3269
|
+
var import_ts_pattern7 = require("ts-pattern");
|
|
3189
3270
|
var generateParserCss = (ctx) => (result) => (0, import_func.pipe)(
|
|
3190
3271
|
{ ...ctx, sheet: ctx.createSheet(), result },
|
|
3191
3272
|
(0, import_func.tap)(({ sheet, result: result2, patterns, recipes }) => {
|
|
@@ -3199,6 +3280,11 @@ var generateParserCss = (ctx) => (result) => (0, import_func.pipe)(
|
|
|
3199
3280
|
sheet.processAtomicRecipe(data);
|
|
3200
3281
|
});
|
|
3201
3282
|
});
|
|
3283
|
+
result2.sva.forEach((sva) => {
|
|
3284
|
+
sva.data.forEach((data) => {
|
|
3285
|
+
sheet.processAtomicSlotRecipe(data);
|
|
3286
|
+
});
|
|
3287
|
+
});
|
|
3202
3288
|
result2.jsx.forEach((jsx) => {
|
|
3203
3289
|
jsx.data.forEach((data) => {
|
|
3204
3290
|
sheet.processStyleProps(data);
|
|
@@ -3210,7 +3296,7 @@ var generateParserCss = (ctx) => (result) => (0, import_func.pipe)(
|
|
|
3210
3296
|
const recipeConfig = recipes.getConfig(recipeName);
|
|
3211
3297
|
if (!recipeConfig)
|
|
3212
3298
|
continue;
|
|
3213
|
-
(0,
|
|
3299
|
+
(0, import_ts_pattern7.match)(recipe).with({ type: "jsx-recipe" }, () => {
|
|
3214
3300
|
recipe.data.forEach((data) => {
|
|
3215
3301
|
const [recipeProps, styleProps] = recipes.splitProps(recipeName, data);
|
|
3216
3302
|
sheet.processStyleProps(styleProps);
|
|
@@ -3229,7 +3315,7 @@ var generateParserCss = (ctx) => (result) => (0, import_func.pipe)(
|
|
|
3229
3315
|
result2.pattern.forEach((patternSet, name) => {
|
|
3230
3316
|
try {
|
|
3231
3317
|
for (const pattern of patternSet) {
|
|
3232
|
-
(0,
|
|
3318
|
+
(0, import_ts_pattern7.match)(pattern).with({ type: "jsx-pattern", name: import_ts_pattern7.P.string }, ({ name: jsxName }) => {
|
|
3233
3319
|
pattern.data.forEach((data) => {
|
|
3234
3320
|
const fnName = patterns.getFnName(jsxName);
|
|
3235
3321
|
const styleProps = patterns.transform(fnName, data);
|
|
@@ -3260,7 +3346,7 @@ var generateParserCss = (ctx) => (result) => (0, import_func.pipe)(
|
|
|
3260
3346
|
);
|
|
3261
3347
|
|
|
3262
3348
|
// src/engines/base.ts
|
|
3263
|
-
var
|
|
3349
|
+
var import_core5 = require("@pandacss/core");
|
|
3264
3350
|
var import_is_valid_prop3 = require("@pandacss/is-valid-prop");
|
|
3265
3351
|
var import_shared5 = require("@pandacss/shared");
|
|
3266
3352
|
var import_token_dictionary = require("@pandacss/token-dictionary");
|
|
@@ -3288,14 +3374,14 @@ var getBaseEngine = (conf) => {
|
|
|
3288
3374
|
prefix: prefix.tokens,
|
|
3289
3375
|
hash: hash.tokens
|
|
3290
3376
|
});
|
|
3291
|
-
const utility = new
|
|
3377
|
+
const utility = new import_core5.Utility({
|
|
3292
3378
|
prefix: prefix.className,
|
|
3293
3379
|
tokens,
|
|
3294
3380
|
config: isTemplateLiteralSyntax ? {} : config.utilities,
|
|
3295
3381
|
separator: config.separator,
|
|
3296
3382
|
shorthands: config.shorthands
|
|
3297
3383
|
});
|
|
3298
|
-
const conditions = new
|
|
3384
|
+
const conditions = new import_core5.Conditions({
|
|
3299
3385
|
conditions: isTemplateLiteralSyntax ? {} : config.conditions,
|
|
3300
3386
|
breakpoints: config.theme?.breakpoints
|
|
3301
3387
|
});
|
|
@@ -3305,7 +3391,7 @@ var getBaseEngine = (conf) => {
|
|
|
3305
3391
|
layerStyle: layerStyles
|
|
3306
3392
|
});
|
|
3307
3393
|
const compositionContext = { conditions, utility };
|
|
3308
|
-
(0,
|
|
3394
|
+
(0, import_core5.assignCompositions)(compositions, compositionContext);
|
|
3309
3395
|
const createSheetContext = () => ({
|
|
3310
3396
|
root: import_postcss3.default.root(),
|
|
3311
3397
|
conditions,
|
|
@@ -3315,13 +3401,15 @@ var getBaseEngine = (conf) => {
|
|
|
3315
3401
|
});
|
|
3316
3402
|
const createSheet = (options) => {
|
|
3317
3403
|
const sheetContext = createSheetContext();
|
|
3318
|
-
return new
|
|
3404
|
+
return new import_core5.Stylesheet(sheetContext, {
|
|
3319
3405
|
content: options?.content,
|
|
3320
|
-
recipes: theme?.recipes
|
|
3406
|
+
recipes: theme?.recipes,
|
|
3407
|
+
slotRecipes: theme?.slotRecipes
|
|
3321
3408
|
});
|
|
3322
3409
|
};
|
|
3323
3410
|
const recipeContext = createSheetContext();
|
|
3324
|
-
const
|
|
3411
|
+
const recipeConfigs = Object.assign({}, theme.recipes ?? {}, theme.slotRecipes ?? {});
|
|
3412
|
+
const recipes = new import_core5.Recipes(recipeConfigs, recipeContext);
|
|
3325
3413
|
recipes.save();
|
|
3326
3414
|
const properties = Array.from(/* @__PURE__ */ new Set(["css", ...utility.keys(), ...conditions.keys()]));
|
|
3327
3415
|
const propertyMap = new Map(properties.map((prop) => [prop, true]));
|
|
@@ -3382,10 +3470,6 @@ var getPathEngine = ({ cwd, emitPackage, outdir }) => {
|
|
|
3382
3470
|
// src/engines/pattern.ts
|
|
3383
3471
|
var import_shared7 = require("@pandacss/shared");
|
|
3384
3472
|
var helpers2 = { map: import_shared7.mapObject };
|
|
3385
|
-
var createRegex = (item) => {
|
|
3386
|
-
const regex = item.map((item2) => typeof item2 === "string" ? item2 : item2.source).join("|");
|
|
3387
|
-
return new RegExp(`^${regex}$`);
|
|
3388
|
-
};
|
|
3389
3473
|
var getPatternEngine = (config) => {
|
|
3390
3474
|
const patterns = config.patterns ?? {};
|
|
3391
3475
|
const getNames = (name) => {
|
|
@@ -3407,7 +3491,7 @@ var getPatternEngine = (config) => {
|
|
|
3407
3491
|
blocklistType: pattern?.blocklist ? `| '${pattern.blocklist.join("' | '")}'` : "",
|
|
3408
3492
|
config: pattern,
|
|
3409
3493
|
type: "pattern",
|
|
3410
|
-
match: createRegex(jsx),
|
|
3494
|
+
match: (0, import_shared7.createRegex)(jsx),
|
|
3411
3495
|
jsx
|
|
3412
3496
|
};
|
|
3413
3497
|
});
|