@pandacss/generator 0.30.1 → 0.31.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.js +163 -93
- package/dist/index.mjs +163 -93
- package/package.json +7 -7
package/dist/index.js
CHANGED
|
@@ -375,7 +375,7 @@ function generateCvaFn(ctx) {
|
|
|
375
375
|
|
|
376
376
|
export declare const cva: RecipeCreatorFn
|
|
377
377
|
|
|
378
|
-
${ctx.file.exportType("RecipeVariantProps", "../types/recipe")}
|
|
378
|
+
${ctx.file.exportType("RecipeVariant, RecipeVariantProps", "../types/recipe")}
|
|
379
379
|
`
|
|
380
380
|
};
|
|
381
381
|
}
|
|
@@ -420,7 +420,7 @@ var astish_mjs_default = {
|
|
|
420
420
|
|
|
421
421
|
// src/artifacts/generated/helpers.mjs.json
|
|
422
422
|
var helpers_mjs_default = {
|
|
423
|
-
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/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/important.ts\nvar importantRegex = /\\s*!(important)?/i;\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/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/merge-props.ts\nfunction mergeProps(...sources) {\n const objects = sources.filter(Boolean);\n return objects.reduce((prev, obj) => {\n Object.keys(obj).forEach((key) => {\n const prevValue = prev[key];\n const value = obj[key];\n if (isObject(prevValue) && isObject(value)) {\n prev[key] = mergeProps(prevValue, value);\n } else {\n prev[key] = value;\n }\n });\n return prev;\n }, {});\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, child) ?? 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 (Array.isArray(obj))\n return obj.map((value) => fn(value));\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 normalizeStyleObject(styles, context, shorthand = true) {\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: shorthand ? (prop) => hasShorthand ? resolveShorthand(prop) : prop : void 0\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(utility.toHash(baseArray, toHash));\n } else {\n const baseArray = [...conds.finalize(conditions), formatClassName(className)];\n result = baseArray.join(":");\n }\n return result;\n };\n return memo((
|
|
423
|
+
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/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/important.ts\nvar importantRegex = /\\s*!(important)?/i;\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/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/merge-props.ts\nfunction mergeProps(...sources) {\n const objects = sources.filter(Boolean);\n return objects.reduce((prev, obj) => {\n Object.keys(obj).forEach((key) => {\n const prevValue = prev[key];\n const value = obj[key];\n if (isObject(prevValue) && isObject(value)) {\n prev[key] = mergeProps(prevValue, value);\n } else {\n prev[key] = value;\n }\n });\n return prev;\n }, {});\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, child) ?? 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 (Array.isArray(obj))\n return obj.map((value) => fn(value));\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 normalizeStyleObject(styles, context, shorthand = true) {\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: shorthand ? (prop) => hasShorthand ? resolveShorthand(prop) : prop : void 0\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(utility.toHash(baseArray, toHash));\n } else {\n const baseArray = [...conds.finalize(conditions), formatClassName(className)];\n result = baseArray.join(":");\n }\n return result;\n };\n return memo(({ base, ...styles } = {}) => {\n const styleObject = Object.assign(styles, base);\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) => normalizeStyleObject(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: memo(mergeCss), assignCss };\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/is-css-function.ts\nvar fns = ["min", "max", "clamp", "calc"];\nvar fnRegExp = new RegExp(`^(${fns.join("|")})\\\\(.*\\\\)`);\nvar isCssFunction = (v) => typeof v === "string" && fnRegExp.test(v);\n\n// src/is-css-unit.ts\nvar lengthUnits = "cm,mm,Q,in,pc,pt,px,em,ex,ch,rem,lh,rlh,vw,vh,vmin,vmax,vb,vi,svw,svh,lvw,lvh,dvw,dvh,cqw,cqh,cqi,cqb,cqmin,cqmax,%";\nvar lengthUnitsPattern = `(?:${lengthUnits.split(",").join("|")})`;\nvar lengthRegExp = new RegExp(`^[+-]?[0-9]*.?[0-9]+(?:[eE][+-]?[0-9]+)?${lengthUnitsPattern}$`);\nvar isCssUnit = (v) => typeof v === "string" && lengthRegExp.test(v);\n\n// src/is-css-var.ts\nvar isCssVar = (v) => typeof v === "string" && /^var\\(--.+\\)$/.test(v);\n\n// src/pattern-fns.ts\nvar patternFns = {\n map: mapObject,\n isCssFunction,\n isCssVar,\n isCssUnit\n};\nvar getPatternStyles = (pattern, styles) => {\n if (!pattern.defaultValues)\n return styles;\n const defaults = typeof pattern.defaultValues === "function" ? pattern.defaultValues(styles) : pattern.defaultValues;\n return Object.assign({}, defaults, compact(styles));\n};\n\n// src/slot.ts\nvar getSlotRecipes = (recipe = {}) => {\n const init = (slot) => ({\n className: [recipe.className, slot].filter(Boolean).join("__"),\n base: recipe.base?.[slot] ?? {},\n variants: {},\n defaultVariants: recipe.defaultVariants ?? {},\n compoundVariants: recipe.compoundVariants ? getSlotCompoundVariant(recipe.compoundVariants, slot) : []\n });\n const slots = recipe.slots ?? [];\n const recipeParts = slots.map((slot) => [slot, init(slot)]);\n for (const [variantsKey, variantsSpec] of Object.entries(recipe.variants ?? {})) {\n for (const [variantKey, variantSpec] of Object.entries(variantsSpec)) {\n recipeParts.forEach(([slot, slotRecipe]) => {\n slotRecipe.variants[variantsKey] ??= {};\n slotRecipe.variants[variantsKey][variantKey] = variantSpec[slot] ?? {};\n });\n }\n }\n return Object.fromEntries(recipeParts);\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}\n\n// src/uniq.ts\nvar uniq = (...items) => items.filter(Boolean).reduce((acc, item) => Array.from(/* @__PURE__ */ new Set([...acc, ...item])), []);\nexport {\n compact,\n createCss,\n createMergeCss,\n filterBaseConditions,\n getPatternStyles,\n getSlotCompoundVariant,\n getSlotRecipes,\n hypenateProperty,\n isBaseCondition,\n isObject,\n mapObject,\n memo,\n mergeProps,\n patternFns,\n splitProps,\n toHash,\n uniq,\n walkObject,\n withoutSpace\n};\n'
|
|
424
424
|
};
|
|
425
425
|
|
|
426
426
|
// src/artifacts/generated/normalize-html.mjs.json
|
|
@@ -936,11 +936,12 @@ function generatePreactJsxFactory(ctx) {
|
|
|
936
936
|
options.defaultProps,
|
|
937
937
|
)
|
|
938
938
|
|
|
939
|
+
const __cvaFn__ = composeCvaFn(Dynamic.__cva__, cvaFn)
|
|
940
|
+
const __shouldForwardProps__ = composeShouldForwardProps(Dynamic, shouldForwardProp)
|
|
941
|
+
|
|
939
942
|
const ${componentName} = /* @__PURE__ */ forwardRef(function ${componentName}(props, ref) {
|
|
940
943
|
const { as: Element = Dynamic.__base__ || Dynamic, children, ...restProps } = props
|
|
941
944
|
|
|
942
|
-
const __cvaFn__ = composeCvaFn(Dynamic.__cva__, cvaFn)
|
|
943
|
-
const __shouldForwardProps__ = composeShouldForwardProps(Dynamic, shouldForwardProp)
|
|
944
945
|
|
|
945
946
|
const combinedProps = useMemo(() => Object.assign({}, defaultProps, restProps), [restProps])
|
|
946
947
|
|
|
@@ -974,7 +975,7 @@ function generatePreactJsxFactory(ctx) {
|
|
|
974
975
|
const name = getDisplayName(Dynamic)
|
|
975
976
|
|
|
976
977
|
${componentName}.displayName = \`${factoryName}.\${name}\`
|
|
977
|
-
${componentName}.__cva__ =
|
|
978
|
+
${componentName}.__cva__ = __cvaFn__
|
|
978
979
|
${componentName}.__base__ = Dynamic
|
|
979
980
|
${componentName}.__shouldForwardProps__ = shouldForwardProp
|
|
980
981
|
|
|
@@ -1261,12 +1262,12 @@ function generateQwikJsxFactory(ctx) {
|
|
|
1261
1262
|
options.defaultProps,
|
|
1262
1263
|
)
|
|
1263
1264
|
|
|
1265
|
+
const __cvaFn__ = composeCvaFn(Dynamic.__cva__, cvaFn)
|
|
1266
|
+
const __shouldForwardProps__ = composeShouldForwardProps(Dynamic, shouldForwardProp)
|
|
1267
|
+
|
|
1264
1268
|
const ${componentName} = function ${componentName}(props) {
|
|
1265
1269
|
const { as: Element = Dynamic.__base__ || Dynamic, children, className, ...restProps } = props
|
|
1266
1270
|
|
|
1267
|
-
const __cvaFn__ = composeCvaFn(Dynamic.__cva__, cvaFn)
|
|
1268
|
-
const __shouldForwardProps__ = composeShouldForwardProps(Dynamic, shouldForwardProp)
|
|
1269
|
-
|
|
1270
1271
|
const combinedProps = Object.assign({}, defaultProps, restProps)
|
|
1271
1272
|
|
|
1272
1273
|
const [htmlProps, forwardedProps, variantProps, styleProps, elementProps] =
|
|
@@ -1299,7 +1300,7 @@ function generateQwikJsxFactory(ctx) {
|
|
|
1299
1300
|
const name = getDisplayName(Dynamic)
|
|
1300
1301
|
|
|
1301
1302
|
${componentName}.displayName = \`${factoryName}.\${name}\`
|
|
1302
|
-
${componentName}.__cva__ =
|
|
1303
|
+
${componentName}.__cva__ = __cvaFn__
|
|
1303
1304
|
${componentName}.__base__ = Dynamic
|
|
1304
1305
|
${componentName}.__shouldForwardProps__ = shouldForwardProp
|
|
1305
1306
|
|
|
@@ -1593,12 +1594,12 @@ function generateReactJsxFactory(ctx) {
|
|
|
1593
1594
|
options.defaultProps,
|
|
1594
1595
|
)
|
|
1595
1596
|
|
|
1597
|
+
const __cvaFn__ = composeCvaFn(Dynamic.__cva__, cvaFn)
|
|
1598
|
+
const __shouldForwardProps__ = composeShouldForwardProps(Dynamic, shouldForwardProp)
|
|
1599
|
+
|
|
1596
1600
|
const ${componentName} = /* @__PURE__ */ forwardRef(function ${componentName}(props, ref) {
|
|
1597
1601
|
const { as: Element = Dynamic.__base__ || Dynamic, children, ...restProps } = props
|
|
1598
1602
|
|
|
1599
|
-
const __cvaFn__ = composeCvaFn(Dynamic.__cva__, cvaFn)
|
|
1600
|
-
const __shouldForwardProps__ = composeShouldForwardProps(Dynamic, shouldForwardProp)
|
|
1601
|
-
|
|
1602
1603
|
const combinedProps = useMemo(() => Object.assign({}, defaultProps, restProps), [restProps])
|
|
1603
1604
|
|
|
1604
1605
|
const [htmlProps, forwardedProps, variantProps, styleProps, elementProps] = useMemo(() => {
|
|
@@ -1631,7 +1632,7 @@ function generateReactJsxFactory(ctx) {
|
|
|
1631
1632
|
const name = getDisplayName(Dynamic)
|
|
1632
1633
|
|
|
1633
1634
|
${componentName}.displayName = \`${factoryName}.\${name}\`
|
|
1634
|
-
${componentName}.__cva__ =
|
|
1635
|
+
${componentName}.__cva__ = __cvaFn__
|
|
1635
1636
|
${componentName}.__base__ = Dynamic
|
|
1636
1637
|
${componentName}.__shouldForwardProps__ = shouldForwardProp
|
|
1637
1638
|
|
|
@@ -1903,63 +1904,87 @@ function generateSolidJsxFactory(ctx) {
|
|
|
1903
1904
|
const { componentName, factoryName } = ctx.jsx;
|
|
1904
1905
|
return {
|
|
1905
1906
|
js: import_outdent29.outdent`
|
|
1906
|
-
import { Dynamic } from 'solid-js/web'
|
|
1907
1907
|
import { createMemo, mergeProps, splitProps } from 'solid-js'
|
|
1908
|
-
import { createComponent } from 'solid-js/web'
|
|
1908
|
+
import { Dynamic, createComponent } from 'solid-js/web'
|
|
1909
|
+
${ctx.file.import("css, cx, cva", "../css/index")}
|
|
1910
|
+
${ctx.file.import("normalizeHTMLProps", "../helpers")}
|
|
1909
1911
|
${ctx.file.import(
|
|
1910
|
-
"
|
|
1912
|
+
"composeCvaFn, composeShouldForwardProps, defaultShouldForwardProp, getDisplayName",
|
|
1911
1913
|
"./factory-helper"
|
|
1912
1914
|
)}
|
|
1913
1915
|
${ctx.file.import("isCssProperty", "./is-valid-prop")}
|
|
1914
|
-
${ctx.file.import("css, cx, cva", "../css/index")}
|
|
1915
|
-
${ctx.file.import("normalizeHTMLProps", "../helpers")}
|
|
1916
1916
|
|
|
1917
1917
|
function styledFn(element, configOrCva = {}, options = {}) {
|
|
1918
|
-
const cvaFn =
|
|
1918
|
+
const cvaFn =
|
|
1919
|
+
configOrCva.__cva__ || configOrCva.__recipe__
|
|
1920
|
+
? configOrCva
|
|
1921
|
+
: cva(configOrCva)
|
|
1919
1922
|
|
|
1920
1923
|
const forwardFn = options.shouldForwardProp || defaultShouldForwardProp
|
|
1921
1924
|
const shouldForwardProp = (prop) => forwardFn(prop, cvaFn.variantKeys)
|
|
1922
1925
|
|
|
1923
1926
|
const defaultProps = Object.assign(
|
|
1924
|
-
options.dataAttr && configOrCva.__name__
|
|
1925
|
-
|
|
1927
|
+
options.dataAttr && configOrCva.__name__
|
|
1928
|
+
? { 'data-recipe': configOrCva.__name__ }
|
|
1929
|
+
: {},
|
|
1930
|
+
options.defaultProps
|
|
1931
|
+
)
|
|
1932
|
+
|
|
1933
|
+
const __cvaFn__ = composeCvaFn(element.__cva__, cvaFn)
|
|
1934
|
+
const __shouldForwardProps__ = composeShouldForwardProps(
|
|
1935
|
+
element,
|
|
1936
|
+
shouldForwardProp
|
|
1926
1937
|
)
|
|
1927
1938
|
|
|
1928
1939
|
const ${componentName} = (props) => {
|
|
1929
|
-
const mergedProps = mergeProps(
|
|
1940
|
+
const mergedProps = mergeProps(
|
|
1941
|
+
{ as: element.__base__ || element },
|
|
1942
|
+
defaultProps,
|
|
1943
|
+
props
|
|
1944
|
+
)
|
|
1930
1945
|
|
|
1931
|
-
const
|
|
1932
|
-
|
|
1946
|
+
const [localProps, restProps] = splitProps(mergedProps, [
|
|
1947
|
+
'as',
|
|
1948
|
+
'class',
|
|
1949
|
+
'className',
|
|
1950
|
+
])
|
|
1933
1951
|
|
|
1934
|
-
const
|
|
1935
|
-
Object.keys(props).filter((prop) => !normalizeHTMLProps.keys.includes(prop) && shouldForwardProp(prop)),
|
|
1936
|
-
)
|
|
1952
|
+
const [htmlProps, aProps] = splitProps(restProps, normalizeHTMLProps.keys)
|
|
1937
1953
|
|
|
1938
|
-
const
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
forwardedKeys()
|
|
1943
|
-
)
|
|
1954
|
+
const forwardedKeys = createMemo(() => {
|
|
1955
|
+
const keys = Object.keys(aProps)
|
|
1956
|
+
return keys.filter((prop) => __shouldForwardProps__(prop))
|
|
1957
|
+
})
|
|
1944
1958
|
|
|
1945
|
-
const
|
|
1959
|
+
const [forwardedProps, variantProps, bProps] = splitProps(aProps, forwardedKeys(), __cvaFn__.variantKeys)
|
|
1946
1960
|
|
|
1947
|
-
const
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1961
|
+
const cssPropKeys = createMemo(() => {
|
|
1962
|
+
const keys = Object.keys(bProps)
|
|
1963
|
+
return keys.filter((prop) => isCssProperty(prop))
|
|
1964
|
+
})
|
|
1965
|
+
|
|
1966
|
+
const [styleProps, elementProps] = splitProps(bProps, cssPropKeys())
|
|
1952
1967
|
|
|
1953
1968
|
function recipeClass() {
|
|
1954
1969
|
const { css: cssStyles, ...propStyles } = styleProps
|
|
1955
|
-
const compoundVariantStyles =
|
|
1956
|
-
|
|
1970
|
+
const compoundVariantStyles =
|
|
1971
|
+
__cvaFn__.__getCompoundVariantCss__?.(variantProps)
|
|
1972
|
+
return cx(
|
|
1973
|
+
__cvaFn__(variantProps, false),
|
|
1974
|
+
css(compoundVariantStyles, propStyles, cssStyles),
|
|
1975
|
+
localProps.class,
|
|
1976
|
+
localProps.className
|
|
1977
|
+
)
|
|
1957
1978
|
}
|
|
1958
1979
|
|
|
1959
1980
|
function cvaClass() {
|
|
1960
1981
|
const { css: cssStyles, ...propStyles } = styleProps
|
|
1961
1982
|
const cvaStyles = __cvaFn__.raw(variantProps)
|
|
1962
|
-
return cx(
|
|
1983
|
+
return cx(
|
|
1984
|
+
css(cvaStyles, propStyles, cssStyles),
|
|
1985
|
+
localProps.class,
|
|
1986
|
+
localProps.className
|
|
1987
|
+
)
|
|
1963
1988
|
}
|
|
1964
1989
|
|
|
1965
1990
|
const classes = configOrCva.__recipe__ ? recipeClass : cvaClass
|
|
@@ -1970,26 +1995,21 @@ function generateSolidJsxFactory(ctx) {
|
|
|
1970
1995
|
|
|
1971
1996
|
return createComponent(
|
|
1972
1997
|
Dynamic,
|
|
1973
|
-
mergeProps(
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
normalizeHTMLProps(htmlProps),
|
|
1977
|
-
{
|
|
1978
|
-
get component() {
|
|
1979
|
-
return localProps.as
|
|
1980
|
-
},
|
|
1981
|
-
get class() {
|
|
1982
|
-
return classes()
|
|
1983
|
-
}
|
|
1998
|
+
mergeProps(forwardedProps, elementProps, normalizeHTMLProps(htmlProps), {
|
|
1999
|
+
get component() {
|
|
2000
|
+
return localProps.as
|
|
1984
2001
|
},
|
|
1985
|
-
|
|
2002
|
+
get class() {
|
|
2003
|
+
return classes()
|
|
2004
|
+
},
|
|
2005
|
+
})
|
|
1986
2006
|
)
|
|
1987
2007
|
}
|
|
1988
2008
|
|
|
1989
2009
|
const name = getDisplayName(element)
|
|
1990
2010
|
|
|
1991
2011
|
${componentName}.displayName = \`${factoryName}.\${name}\`
|
|
1992
|
-
${componentName}.__cva__ =
|
|
2012
|
+
${componentName}.__cva__ = __cvaFn__
|
|
1993
2013
|
${componentName}.__base__ = element
|
|
1994
2014
|
${componentName}.__shouldForwardProps__ = shouldForwardProp
|
|
1995
2015
|
|
|
@@ -2284,15 +2304,17 @@ function generateVueJsxFactory(ctx) {
|
|
|
2284
2304
|
)
|
|
2285
2305
|
|
|
2286
2306
|
const name = getDisplayName(Dynamic)
|
|
2307
|
+
const __cvaFn__ = composeCvaFn(Dynamic.__cva__, cvaFn)
|
|
2308
|
+
const __shouldForwardProps__ = composeShouldForwardProps(Dynamic, shouldForwardProp)
|
|
2287
2309
|
|
|
2288
2310
|
const ${componentName} = defineComponent({
|
|
2289
2311
|
name: \`${factoryName}.\${name}\`,
|
|
2290
2312
|
inheritAttrs: false,
|
|
2291
|
-
props: {
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
|
|
2295
|
-
|
|
2313
|
+
props: {
|
|
2314
|
+
modelValue: null,
|
|
2315
|
+
as: { type: [String, Object], default: Dynamic.__base__ || Dynamic }
|
|
2316
|
+
},
|
|
2317
|
+
setup(props, { slots, attrs, emit }) {
|
|
2296
2318
|
const combinedProps = computed(() => Object.assign({}, defaultProps, attrs))
|
|
2297
2319
|
|
|
2298
2320
|
const splittedProps = computed(() => {
|
|
@@ -2315,43 +2337,68 @@ function generateVueJsxFactory(ctx) {
|
|
|
2315
2337
|
|
|
2316
2338
|
const classes = configOrCva.__recipe__ ? recipeClass : cvaClass
|
|
2317
2339
|
|
|
2340
|
+
const vModelProps = computed(() => {
|
|
2341
|
+
const result = {};
|
|
2342
|
+
|
|
2343
|
+
if (
|
|
2344
|
+
props.as === 'input' &&
|
|
2345
|
+
(props.type === 'checkbox' || props.type === 'radio')
|
|
2346
|
+
) {
|
|
2347
|
+
result.checked = props.modelValue;
|
|
2348
|
+
result.onChange = (event) => {
|
|
2349
|
+
const checked = !event.currentTarget.checked;
|
|
2350
|
+
emit('change', checked, event);
|
|
2351
|
+
emit('update:modelValue', checked, event);
|
|
2352
|
+
};
|
|
2353
|
+
} else if (
|
|
2354
|
+
props.as === 'input' ||
|
|
2355
|
+
props.as === 'textarea' ||
|
|
2356
|
+
props.as === 'select'
|
|
2357
|
+
) {
|
|
2358
|
+
result.value = props.modelValue;
|
|
2359
|
+
result.onInput = (event) => {
|
|
2360
|
+
const value = event.currentTarget.value;
|
|
2361
|
+
emit('input', value, event);
|
|
2362
|
+
emit('update:modelValue', value, event);
|
|
2363
|
+
};
|
|
2364
|
+
}
|
|
2365
|
+
|
|
2366
|
+
return result;
|
|
2367
|
+
});
|
|
2368
|
+
|
|
2318
2369
|
return () => {
|
|
2319
2370
|
const [htmlProps, forwardedProps, _variantProps, _styleProps, elementProps] = splittedProps.value
|
|
2371
|
+
|
|
2320
2372
|
return h(
|
|
2321
2373
|
props.as,
|
|
2322
2374
|
{
|
|
2323
2375
|
...forwardedProps,
|
|
2324
2376
|
...elementProps,
|
|
2325
2377
|
...normalizeHTMLProps(htmlProps),
|
|
2378
|
+
...vModelProps.value,
|
|
2326
2379
|
class: classes.value,
|
|
2327
2380
|
},
|
|
2328
|
-
slots
|
|
2381
|
+
slots,
|
|
2329
2382
|
)
|
|
2330
2383
|
}
|
|
2331
2384
|
},
|
|
2332
2385
|
})
|
|
2333
2386
|
|
|
2334
2387
|
${componentName}.displayName = \`${factoryName}.\${name}\`
|
|
2335
|
-
${componentName}.__cva__ =
|
|
2388
|
+
${componentName}.__cva__ = __cvaFn__
|
|
2336
2389
|
${componentName}.__base__ = Dynamic
|
|
2337
2390
|
${componentName}.__shouldForwardProps__ = shouldForwardProp
|
|
2338
2391
|
|
|
2339
2392
|
return ${componentName}
|
|
2340
2393
|
}
|
|
2341
2394
|
|
|
2342
|
-
|
|
2343
|
-
return new Proxy(styledFn, {
|
|
2344
|
-
apply(_, __, args) {
|
|
2345
|
-
return styledFn(...args)
|
|
2346
|
-
},
|
|
2347
|
-
get(_, el) {
|
|
2348
|
-
return styledFn(el)
|
|
2349
|
-
},
|
|
2350
|
-
})
|
|
2351
|
-
}
|
|
2395
|
+
const tags = 'a, abbr, address, area, article, aside, audio, b, base, bdi, bdo, big, blockquote, body, br, button, canvas, caption, cite, code, col, colgroup, data, datalist, dd, del, details, dfn, dialog, div, dl, dt, em, embed, fieldset, figcaption, figure, footer, form, h1, h2, h3, h4, h5, h6, head, header, hgroup, hr, html, i, iframe, img, input, ins, kbd, keygen, label, legend, li, link, main, map, mark, marquee, menu, menuitem, meta, meter, nav, noscript, object, ol, optgroup, option, output, p, param, picture, pre, progress, q, rp, rt, ruby, s, samp, script, section, select, small, source, span, strong, style, sub, summary, sup, table, tbody, td, textarea, tfoot, th, thead, time, title, tr, track, u, ul, var, video, wbr, circle, clipPath, defs, ellipse, foreignObject, g, image, line, linearGradient, mask, path, pattern, polygon, polyline, radialGradient, rect, stop, svg, text, tspan';
|
|
2352
2396
|
|
|
2353
|
-
export const ${factoryName} = /* @__PURE__ */
|
|
2397
|
+
export const ${factoryName} = /* @__PURE__ */ styledFn.bind();
|
|
2354
2398
|
|
|
2399
|
+
tags.split(', ').forEach((tag) => {
|
|
2400
|
+
styled[tag] = styled(tag);
|
|
2401
|
+
});
|
|
2355
2402
|
`
|
|
2356
2403
|
};
|
|
2357
2404
|
}
|
|
@@ -2375,11 +2422,43 @@ function generateVueJsxStringLiteralFactory(ctx) {
|
|
|
2375
2422
|
const ${componentName} = defineComponent({
|
|
2376
2423
|
name: \`${factoryName}.\${name}\`,
|
|
2377
2424
|
inheritAttrs: false,
|
|
2378
|
-
props: {
|
|
2379
|
-
|
|
2425
|
+
props: {
|
|
2426
|
+
modelValue: null,
|
|
2427
|
+
as: { type: [String, Object], default: Dynamic }
|
|
2428
|
+
},
|
|
2429
|
+
setup(props, { slots, attrs, emit }) {
|
|
2380
2430
|
const classes = computed(() => {
|
|
2381
2431
|
return cx(css(Dynamic.__styles__, styles), elementProps.className)
|
|
2382
2432
|
})
|
|
2433
|
+
|
|
2434
|
+
const vModelProps = computed(() => {
|
|
2435
|
+
const result = {};
|
|
2436
|
+
|
|
2437
|
+
if (
|
|
2438
|
+
props.as === 'input' &&
|
|
2439
|
+
(props.type === 'checkbox' || props.type === 'radio')
|
|
2440
|
+
) {
|
|
2441
|
+
result.checked = props.modelValue;
|
|
2442
|
+
result.onChange = (event) => {
|
|
2443
|
+
const checked = !event.currentTarget.checked;
|
|
2444
|
+
emit('change', checked, event);
|
|
2445
|
+
emit('update:modelValue', checked, event);
|
|
2446
|
+
};
|
|
2447
|
+
} else if (
|
|
2448
|
+
props.as === 'input' ||
|
|
2449
|
+
props.as === 'textarea' ||
|
|
2450
|
+
props.as === 'select'
|
|
2451
|
+
) {
|
|
2452
|
+
result.value = props.modelValue;
|
|
2453
|
+
result.onInput = (event) => {
|
|
2454
|
+
const value = event.currentTarget.value;
|
|
2455
|
+
emit('input', value, event);
|
|
2456
|
+
emit('update:modelValue', value, event);
|
|
2457
|
+
};
|
|
2458
|
+
}
|
|
2459
|
+
|
|
2460
|
+
return result;
|
|
2461
|
+
});
|
|
2383
2462
|
|
|
2384
2463
|
return () => {
|
|
2385
2464
|
return h(
|
|
@@ -2387,8 +2466,9 @@ function generateVueJsxStringLiteralFactory(ctx) {
|
|
|
2387
2466
|
{
|
|
2388
2467
|
class: classes.value,
|
|
2389
2468
|
...elementProps,
|
|
2469
|
+
...vModelProps.value,
|
|
2390
2470
|
},
|
|
2391
|
-
|
|
2471
|
+
slots
|
|
2392
2472
|
)
|
|
2393
2473
|
}
|
|
2394
2474
|
},
|
|
@@ -2401,23 +2481,13 @@ function generateVueJsxStringLiteralFactory(ctx) {
|
|
|
2401
2481
|
}
|
|
2402
2482
|
}
|
|
2403
2483
|
|
|
2404
|
-
|
|
2405
|
-
const cache = new Map()
|
|
2484
|
+
const tags = 'a, abbr, address, area, article, aside, audio, b, base, bdi, bdo, big, blockquote, body, br, button, canvas, caption, cite, code, col, colgroup, data, datalist, dd, del, details, dfn, dialog, div, dl, dt, em, embed, fieldset, figcaption, figure, footer, form, h1, h2, h3, h4, h5, h6, head, header, hgroup, hr, html, i, iframe, img, input, ins, kbd, keygen, label, legend, li, link, main, map, mark, marquee, menu, menuitem, meta, meter, nav, noscript, object, ol, optgroup, option, output, p, param, picture, pre, progress, q, rp, rt, ruby, s, samp, script, section, select, small, source, span, strong, style, sub, summary, sup, table, tbody, td, textarea, tfoot, th, thead, time, title, tr, track, u, ul, var, video, wbr, circle, clipPath, defs, ellipse, foreignObject, g, image, line, linearGradient, mask, path, pattern, polygon, polyline, radialGradient, rect, stop, svg, text, tspan';
|
|
2406
2485
|
|
|
2407
|
-
|
|
2408
|
-
apply(_, __, args) {
|
|
2409
|
-
return createStyled(...args)
|
|
2410
|
-
},
|
|
2411
|
-
get(_, el) {
|
|
2412
|
-
if (!cache.has(el)) {
|
|
2413
|
-
cache.set(el, createStyled(el))
|
|
2414
|
-
}
|
|
2415
|
-
return cache.get(el)
|
|
2416
|
-
},
|
|
2417
|
-
})
|
|
2418
|
-
}
|
|
2486
|
+
export const ${factoryName} = /* @__PURE__ */ styledFn.bind();
|
|
2419
2487
|
|
|
2420
|
-
|
|
2488
|
+
tags.split(', ').forEach((tag) => {
|
|
2489
|
+
styled[tag] = styled(tag);
|
|
2490
|
+
});
|
|
2421
2491
|
`
|
|
2422
2492
|
};
|
|
2423
2493
|
}
|
|
@@ -2734,7 +2804,7 @@ var pattern_d_ts_default = {
|
|
|
2734
2804
|
|
|
2735
2805
|
// src/artifacts/generated/recipe.d.ts.json
|
|
2736
2806
|
var recipe_d_ts_default = {
|
|
2737
|
-
content: "import type { RecipeRule } from './static-css'\nimport type { SystemStyleObject, DistributiveOmit, Pretty } from './system-types'\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]> | undefined\n }\n\nexport type RecipeVariantFn<T extends RecipeVariantRecord> = (props?: RecipeSelection<T>) => string\n\nexport type RecipeVariantProps<\n T extends RecipeVariantFn<RecipeVariantRecord> | SlotRecipeVariantFn<string, SlotRecipeVariantRecord<string>>,\n> = 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 interface RecipeRuntimeFn<T extends RecipeVariantRecord> extends RecipeVariantFn<T> {\n __type: RecipeSelection<T>\n variantKeys: (keyof T)[]\n variantMap: RecipeVariantMap<T>\n raw: (props?: RecipeSelection<T>) => SystemStyleObject\n config: RecipeConfig<T>\n splitVariantProps<Props extends RecipeSelection<T>>(\n props: Props,\n ): [RecipeSelection<T>, Pretty<DistributiveOmit<Props, keyof T>>]\n}\n\ntype OneOrMore<T> = T | Array<T>\n\nexport type RecipeCompoundSelection<T> = {\n [K in keyof T]?: OneOrMore<StringToBoolean<keyof T[K]>> | undefined\n}\n\nexport type RecipeCompoundVariant<T> = T & {\n css: SystemStyleObject\n}\n\nexport interface RecipeDefinition<T extends RecipeVariantRecord = 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\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?: Pretty<RecipeCompoundVariant<RecipeCompoundSelection<T>>>[]\n /**\n * Variants to pre-generate, will be include in the final `config.staticCss`\n */\n staticCss?: RecipeRule[]\n}\n\nexport type RecipeCreatorFn = <T extends RecipeVariantRecord>(config: RecipeDefinition<T>) => RecipeRuntimeFn<T>\n\ninterface 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 interface RecipeConfig<T extends RecipeVariantRecord = RecipeVariantRecord>\n extends RecipeDefinition<T>,\n 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 interface SlotRecipeRuntimeFn<S extends string, T extends SlotRecipeVariantRecord<S>>\n extends SlotRecipeVariantFn<S, T> {\n raw: (props?: RecipeSelection<T>) => Record<S, SystemStyleObject>\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> = T & {\n css: SlotRecord<S, SystemStyleObject>\n}\n\nexport interface SlotRecipeDefinition<\n S extends string = string,\n T extends SlotRecipeVariantRecord<S> = SlotRecipeVariantRecord<S>,\n> {\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\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?: Pretty<SlotRecipeCompoundVariant<S, RecipeCompoundSelection<T>>>[]\n /**\n * Variants to pre-generate, will be include in the final `config.staticCss`\n */\n staticCss?: RecipeRule[]\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"
|
|
2807
|
+
content: "import type { RecipeRule } from './static-css'\nimport type { SystemStyleObject, DistributiveOmit, Pretty } from './system-types'\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]> | undefined\n }\n\nexport type RecipeVariantFn<T extends RecipeVariantRecord> = (props?: RecipeSelection<T>) => string\n\n/**\n * Extract the variant as optional props from a `cva` function.\n * Intended to be used with a JSX component, prefer `RecipeVariant` for a more strict type.\n */\nexport type RecipeVariantProps<\n T extends RecipeVariantFn<RecipeVariantRecord> | SlotRecipeVariantFn<string, SlotRecipeVariantRecord<string>>,\n> = Pretty<Parameters<T>[0]>\n\n/**\n * Extract the variants from a `cva` function.\n */\nexport type RecipeVariant<\n T extends RecipeVariantFn<RecipeVariantRecord> | SlotRecipeVariantFn<string, SlotRecipeVariantRecord<string>>,\n> = Exclude<Pretty<Required<RecipeVariantProps<T>>>, undefined>\n\ntype RecipeVariantMap<T extends RecipeVariantRecord> = {\n [K in keyof T]: Array<keyof T[K]>\n}\n\n/* -----------------------------------------------------------------------------\n * Recipe / Standard\n * -----------------------------------------------------------------------------*/\n\nexport interface RecipeRuntimeFn<T extends RecipeVariantRecord> extends RecipeVariantFn<T> {\n __type: RecipeSelection<T>\n variantKeys: (keyof T)[]\n variantMap: RecipeVariantMap<T>\n raw: (props?: RecipeSelection<T>) => SystemStyleObject\n config: RecipeConfig<T>\n splitVariantProps<Props extends RecipeSelection<T>>(\n props: Props,\n ): [RecipeSelection<T>, Pretty<DistributiveOmit<Props, keyof T>>]\n}\n\ntype OneOrMore<T> = T | Array<T>\n\nexport type RecipeCompoundSelection<T> = {\n [K in keyof T]?: OneOrMore<StringToBoolean<keyof T[K]>> | undefined\n}\n\nexport type RecipeCompoundVariant<T> = T & {\n css: SystemStyleObject\n}\n\nexport interface RecipeDefinition<T extends RecipeVariantRecord = 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\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?: Pretty<RecipeCompoundVariant<RecipeCompoundSelection<T>>>[]\n /**\n * Variants to pre-generate, will be include in the final `config.staticCss`\n */\n staticCss?: RecipeRule[]\n}\n\nexport type RecipeCreatorFn = <T extends RecipeVariantRecord>(config: RecipeDefinition<T>) => RecipeRuntimeFn<T>\n\ninterface 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 interface RecipeConfig<T extends RecipeVariantRecord = RecipeVariantRecord>\n extends RecipeDefinition<T>,\n 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 interface SlotRecipeRuntimeFn<S extends string, T extends SlotRecipeVariantRecord<S>>\n extends SlotRecipeVariantFn<S, T> {\n raw: (props?: RecipeSelection<T>) => Record<S, SystemStyleObject>\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> = T & {\n css: SlotRecord<S, SystemStyleObject>\n}\n\nexport interface SlotRecipeDefinition<\n S extends string = string,\n T extends SlotRecipeVariantRecord<S> = SlotRecipeVariantRecord<S>,\n> {\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\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?: Pretty<SlotRecipeCompoundVariant<S, RecipeCompoundSelection<T>>>[]\n /**\n * Variants to pre-generate, will be include in the final `config.staticCss`\n */\n staticCss?: RecipeRule[]\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"
|
|
2738
2808
|
};
|
|
2739
2809
|
|
|
2740
2810
|
// src/artifacts/generated/selectors.d.ts.json
|
|
@@ -3560,7 +3630,7 @@ function generateResetCss(ctx, sheet) {
|
|
|
3560
3630
|
borderColor: "var(--global-color-border, currentColor)"
|
|
3561
3631
|
},
|
|
3562
3632
|
hr: { height: "0px", color: "inherit", borderTopWidth: "1px" },
|
|
3563
|
-
body: { height: "100%"
|
|
3633
|
+
body: { height: "100%" },
|
|
3564
3634
|
img: { borderStyle: "none" },
|
|
3565
3635
|
"img, svg, video, canvas, audio, iframe, embed, object": {
|
|
3566
3636
|
display: "block",
|
package/dist/index.mjs
CHANGED
|
@@ -339,7 +339,7 @@ function generateCvaFn(ctx) {
|
|
|
339
339
|
|
|
340
340
|
export declare const cva: RecipeCreatorFn
|
|
341
341
|
|
|
342
|
-
${ctx.file.exportType("RecipeVariantProps", "../types/recipe")}
|
|
342
|
+
${ctx.file.exportType("RecipeVariant, RecipeVariantProps", "../types/recipe")}
|
|
343
343
|
`
|
|
344
344
|
};
|
|
345
345
|
}
|
|
@@ -384,7 +384,7 @@ var astish_mjs_default = {
|
|
|
384
384
|
|
|
385
385
|
// src/artifacts/generated/helpers.mjs.json
|
|
386
386
|
var helpers_mjs_default = {
|
|
387
|
-
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/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/important.ts\nvar importantRegex = /\\s*!(important)?/i;\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/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/merge-props.ts\nfunction mergeProps(...sources) {\n const objects = sources.filter(Boolean);\n return objects.reduce((prev, obj) => {\n Object.keys(obj).forEach((key) => {\n const prevValue = prev[key];\n const value = obj[key];\n if (isObject(prevValue) && isObject(value)) {\n prev[key] = mergeProps(prevValue, value);\n } else {\n prev[key] = value;\n }\n });\n return prev;\n }, {});\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, child) ?? 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 (Array.isArray(obj))\n return obj.map((value) => fn(value));\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 normalizeStyleObject(styles, context, shorthand = true) {\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: shorthand ? (prop) => hasShorthand ? resolveShorthand(prop) : prop : void 0\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(utility.toHash(baseArray, toHash));\n } else {\n const baseArray = [...conds.finalize(conditions), formatClassName(className)];\n result = baseArray.join(":");\n }\n return result;\n };\n return memo((
|
|
387
|
+
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/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/important.ts\nvar importantRegex = /\\s*!(important)?/i;\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/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/merge-props.ts\nfunction mergeProps(...sources) {\n const objects = sources.filter(Boolean);\n return objects.reduce((prev, obj) => {\n Object.keys(obj).forEach((key) => {\n const prevValue = prev[key];\n const value = obj[key];\n if (isObject(prevValue) && isObject(value)) {\n prev[key] = mergeProps(prevValue, value);\n } else {\n prev[key] = value;\n }\n });\n return prev;\n }, {});\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, child) ?? 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 (Array.isArray(obj))\n return obj.map((value) => fn(value));\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 normalizeStyleObject(styles, context, shorthand = true) {\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: shorthand ? (prop) => hasShorthand ? resolveShorthand(prop) : prop : void 0\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(utility.toHash(baseArray, toHash));\n } else {\n const baseArray = [...conds.finalize(conditions), formatClassName(className)];\n result = baseArray.join(":");\n }\n return result;\n };\n return memo(({ base, ...styles } = {}) => {\n const styleObject = Object.assign(styles, base);\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) => normalizeStyleObject(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: memo(mergeCss), assignCss };\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/is-css-function.ts\nvar fns = ["min", "max", "clamp", "calc"];\nvar fnRegExp = new RegExp(`^(${fns.join("|")})\\\\(.*\\\\)`);\nvar isCssFunction = (v) => typeof v === "string" && fnRegExp.test(v);\n\n// src/is-css-unit.ts\nvar lengthUnits = "cm,mm,Q,in,pc,pt,px,em,ex,ch,rem,lh,rlh,vw,vh,vmin,vmax,vb,vi,svw,svh,lvw,lvh,dvw,dvh,cqw,cqh,cqi,cqb,cqmin,cqmax,%";\nvar lengthUnitsPattern = `(?:${lengthUnits.split(",").join("|")})`;\nvar lengthRegExp = new RegExp(`^[+-]?[0-9]*.?[0-9]+(?:[eE][+-]?[0-9]+)?${lengthUnitsPattern}$`);\nvar isCssUnit = (v) => typeof v === "string" && lengthRegExp.test(v);\n\n// src/is-css-var.ts\nvar isCssVar = (v) => typeof v === "string" && /^var\\(--.+\\)$/.test(v);\n\n// src/pattern-fns.ts\nvar patternFns = {\n map: mapObject,\n isCssFunction,\n isCssVar,\n isCssUnit\n};\nvar getPatternStyles = (pattern, styles) => {\n if (!pattern.defaultValues)\n return styles;\n const defaults = typeof pattern.defaultValues === "function" ? pattern.defaultValues(styles) : pattern.defaultValues;\n return Object.assign({}, defaults, compact(styles));\n};\n\n// src/slot.ts\nvar getSlotRecipes = (recipe = {}) => {\n const init = (slot) => ({\n className: [recipe.className, slot].filter(Boolean).join("__"),\n base: recipe.base?.[slot] ?? {},\n variants: {},\n defaultVariants: recipe.defaultVariants ?? {},\n compoundVariants: recipe.compoundVariants ? getSlotCompoundVariant(recipe.compoundVariants, slot) : []\n });\n const slots = recipe.slots ?? [];\n const recipeParts = slots.map((slot) => [slot, init(slot)]);\n for (const [variantsKey, variantsSpec] of Object.entries(recipe.variants ?? {})) {\n for (const [variantKey, variantSpec] of Object.entries(variantsSpec)) {\n recipeParts.forEach(([slot, slotRecipe]) => {\n slotRecipe.variants[variantsKey] ??= {};\n slotRecipe.variants[variantsKey][variantKey] = variantSpec[slot] ?? {};\n });\n }\n }\n return Object.fromEntries(recipeParts);\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}\n\n// src/uniq.ts\nvar uniq = (...items) => items.filter(Boolean).reduce((acc, item) => Array.from(/* @__PURE__ */ new Set([...acc, ...item])), []);\nexport {\n compact,\n createCss,\n createMergeCss,\n filterBaseConditions,\n getPatternStyles,\n getSlotCompoundVariant,\n getSlotRecipes,\n hypenateProperty,\n isBaseCondition,\n isObject,\n mapObject,\n memo,\n mergeProps,\n patternFns,\n splitProps,\n toHash,\n uniq,\n walkObject,\n withoutSpace\n};\n'
|
|
388
388
|
};
|
|
389
389
|
|
|
390
390
|
// src/artifacts/generated/normalize-html.mjs.json
|
|
@@ -900,11 +900,12 @@ function generatePreactJsxFactory(ctx) {
|
|
|
900
900
|
options.defaultProps,
|
|
901
901
|
)
|
|
902
902
|
|
|
903
|
+
const __cvaFn__ = composeCvaFn(Dynamic.__cva__, cvaFn)
|
|
904
|
+
const __shouldForwardProps__ = composeShouldForwardProps(Dynamic, shouldForwardProp)
|
|
905
|
+
|
|
903
906
|
const ${componentName} = /* @__PURE__ */ forwardRef(function ${componentName}(props, ref) {
|
|
904
907
|
const { as: Element = Dynamic.__base__ || Dynamic, children, ...restProps } = props
|
|
905
908
|
|
|
906
|
-
const __cvaFn__ = composeCvaFn(Dynamic.__cva__, cvaFn)
|
|
907
|
-
const __shouldForwardProps__ = composeShouldForwardProps(Dynamic, shouldForwardProp)
|
|
908
909
|
|
|
909
910
|
const combinedProps = useMemo(() => Object.assign({}, defaultProps, restProps), [restProps])
|
|
910
911
|
|
|
@@ -938,7 +939,7 @@ function generatePreactJsxFactory(ctx) {
|
|
|
938
939
|
const name = getDisplayName(Dynamic)
|
|
939
940
|
|
|
940
941
|
${componentName}.displayName = \`${factoryName}.\${name}\`
|
|
941
|
-
${componentName}.__cva__ =
|
|
942
|
+
${componentName}.__cva__ = __cvaFn__
|
|
942
943
|
${componentName}.__base__ = Dynamic
|
|
943
944
|
${componentName}.__shouldForwardProps__ = shouldForwardProp
|
|
944
945
|
|
|
@@ -1225,12 +1226,12 @@ function generateQwikJsxFactory(ctx) {
|
|
|
1225
1226
|
options.defaultProps,
|
|
1226
1227
|
)
|
|
1227
1228
|
|
|
1229
|
+
const __cvaFn__ = composeCvaFn(Dynamic.__cva__, cvaFn)
|
|
1230
|
+
const __shouldForwardProps__ = composeShouldForwardProps(Dynamic, shouldForwardProp)
|
|
1231
|
+
|
|
1228
1232
|
const ${componentName} = function ${componentName}(props) {
|
|
1229
1233
|
const { as: Element = Dynamic.__base__ || Dynamic, children, className, ...restProps } = props
|
|
1230
1234
|
|
|
1231
|
-
const __cvaFn__ = composeCvaFn(Dynamic.__cva__, cvaFn)
|
|
1232
|
-
const __shouldForwardProps__ = composeShouldForwardProps(Dynamic, shouldForwardProp)
|
|
1233
|
-
|
|
1234
1235
|
const combinedProps = Object.assign({}, defaultProps, restProps)
|
|
1235
1236
|
|
|
1236
1237
|
const [htmlProps, forwardedProps, variantProps, styleProps, elementProps] =
|
|
@@ -1263,7 +1264,7 @@ function generateQwikJsxFactory(ctx) {
|
|
|
1263
1264
|
const name = getDisplayName(Dynamic)
|
|
1264
1265
|
|
|
1265
1266
|
${componentName}.displayName = \`${factoryName}.\${name}\`
|
|
1266
|
-
${componentName}.__cva__ =
|
|
1267
|
+
${componentName}.__cva__ = __cvaFn__
|
|
1267
1268
|
${componentName}.__base__ = Dynamic
|
|
1268
1269
|
${componentName}.__shouldForwardProps__ = shouldForwardProp
|
|
1269
1270
|
|
|
@@ -1557,12 +1558,12 @@ function generateReactJsxFactory(ctx) {
|
|
|
1557
1558
|
options.defaultProps,
|
|
1558
1559
|
)
|
|
1559
1560
|
|
|
1561
|
+
const __cvaFn__ = composeCvaFn(Dynamic.__cva__, cvaFn)
|
|
1562
|
+
const __shouldForwardProps__ = composeShouldForwardProps(Dynamic, shouldForwardProp)
|
|
1563
|
+
|
|
1560
1564
|
const ${componentName} = /* @__PURE__ */ forwardRef(function ${componentName}(props, ref) {
|
|
1561
1565
|
const { as: Element = Dynamic.__base__ || Dynamic, children, ...restProps } = props
|
|
1562
1566
|
|
|
1563
|
-
const __cvaFn__ = composeCvaFn(Dynamic.__cva__, cvaFn)
|
|
1564
|
-
const __shouldForwardProps__ = composeShouldForwardProps(Dynamic, shouldForwardProp)
|
|
1565
|
-
|
|
1566
1567
|
const combinedProps = useMemo(() => Object.assign({}, defaultProps, restProps), [restProps])
|
|
1567
1568
|
|
|
1568
1569
|
const [htmlProps, forwardedProps, variantProps, styleProps, elementProps] = useMemo(() => {
|
|
@@ -1595,7 +1596,7 @@ function generateReactJsxFactory(ctx) {
|
|
|
1595
1596
|
const name = getDisplayName(Dynamic)
|
|
1596
1597
|
|
|
1597
1598
|
${componentName}.displayName = \`${factoryName}.\${name}\`
|
|
1598
|
-
${componentName}.__cva__ =
|
|
1599
|
+
${componentName}.__cva__ = __cvaFn__
|
|
1599
1600
|
${componentName}.__base__ = Dynamic
|
|
1600
1601
|
${componentName}.__shouldForwardProps__ = shouldForwardProp
|
|
1601
1602
|
|
|
@@ -1867,63 +1868,87 @@ function generateSolidJsxFactory(ctx) {
|
|
|
1867
1868
|
const { componentName, factoryName } = ctx.jsx;
|
|
1868
1869
|
return {
|
|
1869
1870
|
js: outdent29`
|
|
1870
|
-
import { Dynamic } from 'solid-js/web'
|
|
1871
1871
|
import { createMemo, mergeProps, splitProps } from 'solid-js'
|
|
1872
|
-
import { createComponent } from 'solid-js/web'
|
|
1872
|
+
import { Dynamic, createComponent } from 'solid-js/web'
|
|
1873
|
+
${ctx.file.import("css, cx, cva", "../css/index")}
|
|
1874
|
+
${ctx.file.import("normalizeHTMLProps", "../helpers")}
|
|
1873
1875
|
${ctx.file.import(
|
|
1874
|
-
"
|
|
1876
|
+
"composeCvaFn, composeShouldForwardProps, defaultShouldForwardProp, getDisplayName",
|
|
1875
1877
|
"./factory-helper"
|
|
1876
1878
|
)}
|
|
1877
1879
|
${ctx.file.import("isCssProperty", "./is-valid-prop")}
|
|
1878
|
-
${ctx.file.import("css, cx, cva", "../css/index")}
|
|
1879
|
-
${ctx.file.import("normalizeHTMLProps", "../helpers")}
|
|
1880
1880
|
|
|
1881
1881
|
function styledFn(element, configOrCva = {}, options = {}) {
|
|
1882
|
-
const cvaFn =
|
|
1882
|
+
const cvaFn =
|
|
1883
|
+
configOrCva.__cva__ || configOrCva.__recipe__
|
|
1884
|
+
? configOrCva
|
|
1885
|
+
: cva(configOrCva)
|
|
1883
1886
|
|
|
1884
1887
|
const forwardFn = options.shouldForwardProp || defaultShouldForwardProp
|
|
1885
1888
|
const shouldForwardProp = (prop) => forwardFn(prop, cvaFn.variantKeys)
|
|
1886
1889
|
|
|
1887
1890
|
const defaultProps = Object.assign(
|
|
1888
|
-
options.dataAttr && configOrCva.__name__
|
|
1889
|
-
|
|
1891
|
+
options.dataAttr && configOrCva.__name__
|
|
1892
|
+
? { 'data-recipe': configOrCva.__name__ }
|
|
1893
|
+
: {},
|
|
1894
|
+
options.defaultProps
|
|
1895
|
+
)
|
|
1896
|
+
|
|
1897
|
+
const __cvaFn__ = composeCvaFn(element.__cva__, cvaFn)
|
|
1898
|
+
const __shouldForwardProps__ = composeShouldForwardProps(
|
|
1899
|
+
element,
|
|
1900
|
+
shouldForwardProp
|
|
1890
1901
|
)
|
|
1891
1902
|
|
|
1892
1903
|
const ${componentName} = (props) => {
|
|
1893
|
-
const mergedProps = mergeProps(
|
|
1904
|
+
const mergedProps = mergeProps(
|
|
1905
|
+
{ as: element.__base__ || element },
|
|
1906
|
+
defaultProps,
|
|
1907
|
+
props
|
|
1908
|
+
)
|
|
1894
1909
|
|
|
1895
|
-
const
|
|
1896
|
-
|
|
1910
|
+
const [localProps, restProps] = splitProps(mergedProps, [
|
|
1911
|
+
'as',
|
|
1912
|
+
'class',
|
|
1913
|
+
'className',
|
|
1914
|
+
])
|
|
1897
1915
|
|
|
1898
|
-
const
|
|
1899
|
-
Object.keys(props).filter((prop) => !normalizeHTMLProps.keys.includes(prop) && shouldForwardProp(prop)),
|
|
1900
|
-
)
|
|
1916
|
+
const [htmlProps, aProps] = splitProps(restProps, normalizeHTMLProps.keys)
|
|
1901
1917
|
|
|
1902
|
-
const
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
forwardedKeys()
|
|
1907
|
-
)
|
|
1918
|
+
const forwardedKeys = createMemo(() => {
|
|
1919
|
+
const keys = Object.keys(aProps)
|
|
1920
|
+
return keys.filter((prop) => __shouldForwardProps__(prop))
|
|
1921
|
+
})
|
|
1908
1922
|
|
|
1909
|
-
const
|
|
1923
|
+
const [forwardedProps, variantProps, bProps] = splitProps(aProps, forwardedKeys(), __cvaFn__.variantKeys)
|
|
1910
1924
|
|
|
1911
|
-
const
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1925
|
+
const cssPropKeys = createMemo(() => {
|
|
1926
|
+
const keys = Object.keys(bProps)
|
|
1927
|
+
return keys.filter((prop) => isCssProperty(prop))
|
|
1928
|
+
})
|
|
1929
|
+
|
|
1930
|
+
const [styleProps, elementProps] = splitProps(bProps, cssPropKeys())
|
|
1916
1931
|
|
|
1917
1932
|
function recipeClass() {
|
|
1918
1933
|
const { css: cssStyles, ...propStyles } = styleProps
|
|
1919
|
-
const compoundVariantStyles =
|
|
1920
|
-
|
|
1934
|
+
const compoundVariantStyles =
|
|
1935
|
+
__cvaFn__.__getCompoundVariantCss__?.(variantProps)
|
|
1936
|
+
return cx(
|
|
1937
|
+
__cvaFn__(variantProps, false),
|
|
1938
|
+
css(compoundVariantStyles, propStyles, cssStyles),
|
|
1939
|
+
localProps.class,
|
|
1940
|
+
localProps.className
|
|
1941
|
+
)
|
|
1921
1942
|
}
|
|
1922
1943
|
|
|
1923
1944
|
function cvaClass() {
|
|
1924
1945
|
const { css: cssStyles, ...propStyles } = styleProps
|
|
1925
1946
|
const cvaStyles = __cvaFn__.raw(variantProps)
|
|
1926
|
-
return cx(
|
|
1947
|
+
return cx(
|
|
1948
|
+
css(cvaStyles, propStyles, cssStyles),
|
|
1949
|
+
localProps.class,
|
|
1950
|
+
localProps.className
|
|
1951
|
+
)
|
|
1927
1952
|
}
|
|
1928
1953
|
|
|
1929
1954
|
const classes = configOrCva.__recipe__ ? recipeClass : cvaClass
|
|
@@ -1934,26 +1959,21 @@ function generateSolidJsxFactory(ctx) {
|
|
|
1934
1959
|
|
|
1935
1960
|
return createComponent(
|
|
1936
1961
|
Dynamic,
|
|
1937
|
-
mergeProps(
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
normalizeHTMLProps(htmlProps),
|
|
1941
|
-
{
|
|
1942
|
-
get component() {
|
|
1943
|
-
return localProps.as
|
|
1944
|
-
},
|
|
1945
|
-
get class() {
|
|
1946
|
-
return classes()
|
|
1947
|
-
}
|
|
1962
|
+
mergeProps(forwardedProps, elementProps, normalizeHTMLProps(htmlProps), {
|
|
1963
|
+
get component() {
|
|
1964
|
+
return localProps.as
|
|
1948
1965
|
},
|
|
1949
|
-
|
|
1966
|
+
get class() {
|
|
1967
|
+
return classes()
|
|
1968
|
+
},
|
|
1969
|
+
})
|
|
1950
1970
|
)
|
|
1951
1971
|
}
|
|
1952
1972
|
|
|
1953
1973
|
const name = getDisplayName(element)
|
|
1954
1974
|
|
|
1955
1975
|
${componentName}.displayName = \`${factoryName}.\${name}\`
|
|
1956
|
-
${componentName}.__cva__ =
|
|
1976
|
+
${componentName}.__cva__ = __cvaFn__
|
|
1957
1977
|
${componentName}.__base__ = element
|
|
1958
1978
|
${componentName}.__shouldForwardProps__ = shouldForwardProp
|
|
1959
1979
|
|
|
@@ -2248,15 +2268,17 @@ function generateVueJsxFactory(ctx) {
|
|
|
2248
2268
|
)
|
|
2249
2269
|
|
|
2250
2270
|
const name = getDisplayName(Dynamic)
|
|
2271
|
+
const __cvaFn__ = composeCvaFn(Dynamic.__cva__, cvaFn)
|
|
2272
|
+
const __shouldForwardProps__ = composeShouldForwardProps(Dynamic, shouldForwardProp)
|
|
2251
2273
|
|
|
2252
2274
|
const ${componentName} = defineComponent({
|
|
2253
2275
|
name: \`${factoryName}.\${name}\`,
|
|
2254
2276
|
inheritAttrs: false,
|
|
2255
|
-
props: {
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2277
|
+
props: {
|
|
2278
|
+
modelValue: null,
|
|
2279
|
+
as: { type: [String, Object], default: Dynamic.__base__ || Dynamic }
|
|
2280
|
+
},
|
|
2281
|
+
setup(props, { slots, attrs, emit }) {
|
|
2260
2282
|
const combinedProps = computed(() => Object.assign({}, defaultProps, attrs))
|
|
2261
2283
|
|
|
2262
2284
|
const splittedProps = computed(() => {
|
|
@@ -2279,43 +2301,68 @@ function generateVueJsxFactory(ctx) {
|
|
|
2279
2301
|
|
|
2280
2302
|
const classes = configOrCva.__recipe__ ? recipeClass : cvaClass
|
|
2281
2303
|
|
|
2304
|
+
const vModelProps = computed(() => {
|
|
2305
|
+
const result = {};
|
|
2306
|
+
|
|
2307
|
+
if (
|
|
2308
|
+
props.as === 'input' &&
|
|
2309
|
+
(props.type === 'checkbox' || props.type === 'radio')
|
|
2310
|
+
) {
|
|
2311
|
+
result.checked = props.modelValue;
|
|
2312
|
+
result.onChange = (event) => {
|
|
2313
|
+
const checked = !event.currentTarget.checked;
|
|
2314
|
+
emit('change', checked, event);
|
|
2315
|
+
emit('update:modelValue', checked, event);
|
|
2316
|
+
};
|
|
2317
|
+
} else if (
|
|
2318
|
+
props.as === 'input' ||
|
|
2319
|
+
props.as === 'textarea' ||
|
|
2320
|
+
props.as === 'select'
|
|
2321
|
+
) {
|
|
2322
|
+
result.value = props.modelValue;
|
|
2323
|
+
result.onInput = (event) => {
|
|
2324
|
+
const value = event.currentTarget.value;
|
|
2325
|
+
emit('input', value, event);
|
|
2326
|
+
emit('update:modelValue', value, event);
|
|
2327
|
+
};
|
|
2328
|
+
}
|
|
2329
|
+
|
|
2330
|
+
return result;
|
|
2331
|
+
});
|
|
2332
|
+
|
|
2282
2333
|
return () => {
|
|
2283
2334
|
const [htmlProps, forwardedProps, _variantProps, _styleProps, elementProps] = splittedProps.value
|
|
2335
|
+
|
|
2284
2336
|
return h(
|
|
2285
2337
|
props.as,
|
|
2286
2338
|
{
|
|
2287
2339
|
...forwardedProps,
|
|
2288
2340
|
...elementProps,
|
|
2289
2341
|
...normalizeHTMLProps(htmlProps),
|
|
2342
|
+
...vModelProps.value,
|
|
2290
2343
|
class: classes.value,
|
|
2291
2344
|
},
|
|
2292
|
-
slots
|
|
2345
|
+
slots,
|
|
2293
2346
|
)
|
|
2294
2347
|
}
|
|
2295
2348
|
},
|
|
2296
2349
|
})
|
|
2297
2350
|
|
|
2298
2351
|
${componentName}.displayName = \`${factoryName}.\${name}\`
|
|
2299
|
-
${componentName}.__cva__ =
|
|
2352
|
+
${componentName}.__cva__ = __cvaFn__
|
|
2300
2353
|
${componentName}.__base__ = Dynamic
|
|
2301
2354
|
${componentName}.__shouldForwardProps__ = shouldForwardProp
|
|
2302
2355
|
|
|
2303
2356
|
return ${componentName}
|
|
2304
2357
|
}
|
|
2305
2358
|
|
|
2306
|
-
|
|
2307
|
-
return new Proxy(styledFn, {
|
|
2308
|
-
apply(_, __, args) {
|
|
2309
|
-
return styledFn(...args)
|
|
2310
|
-
},
|
|
2311
|
-
get(_, el) {
|
|
2312
|
-
return styledFn(el)
|
|
2313
|
-
},
|
|
2314
|
-
})
|
|
2315
|
-
}
|
|
2359
|
+
const tags = 'a, abbr, address, area, article, aside, audio, b, base, bdi, bdo, big, blockquote, body, br, button, canvas, caption, cite, code, col, colgroup, data, datalist, dd, del, details, dfn, dialog, div, dl, dt, em, embed, fieldset, figcaption, figure, footer, form, h1, h2, h3, h4, h5, h6, head, header, hgroup, hr, html, i, iframe, img, input, ins, kbd, keygen, label, legend, li, link, main, map, mark, marquee, menu, menuitem, meta, meter, nav, noscript, object, ol, optgroup, option, output, p, param, picture, pre, progress, q, rp, rt, ruby, s, samp, script, section, select, small, source, span, strong, style, sub, summary, sup, table, tbody, td, textarea, tfoot, th, thead, time, title, tr, track, u, ul, var, video, wbr, circle, clipPath, defs, ellipse, foreignObject, g, image, line, linearGradient, mask, path, pattern, polygon, polyline, radialGradient, rect, stop, svg, text, tspan';
|
|
2316
2360
|
|
|
2317
|
-
export const ${factoryName} = /* @__PURE__ */
|
|
2361
|
+
export const ${factoryName} = /* @__PURE__ */ styledFn.bind();
|
|
2318
2362
|
|
|
2363
|
+
tags.split(', ').forEach((tag) => {
|
|
2364
|
+
styled[tag] = styled(tag);
|
|
2365
|
+
});
|
|
2319
2366
|
`
|
|
2320
2367
|
};
|
|
2321
2368
|
}
|
|
@@ -2339,11 +2386,43 @@ function generateVueJsxStringLiteralFactory(ctx) {
|
|
|
2339
2386
|
const ${componentName} = defineComponent({
|
|
2340
2387
|
name: \`${factoryName}.\${name}\`,
|
|
2341
2388
|
inheritAttrs: false,
|
|
2342
|
-
props: {
|
|
2343
|
-
|
|
2389
|
+
props: {
|
|
2390
|
+
modelValue: null,
|
|
2391
|
+
as: { type: [String, Object], default: Dynamic }
|
|
2392
|
+
},
|
|
2393
|
+
setup(props, { slots, attrs, emit }) {
|
|
2344
2394
|
const classes = computed(() => {
|
|
2345
2395
|
return cx(css(Dynamic.__styles__, styles), elementProps.className)
|
|
2346
2396
|
})
|
|
2397
|
+
|
|
2398
|
+
const vModelProps = computed(() => {
|
|
2399
|
+
const result = {};
|
|
2400
|
+
|
|
2401
|
+
if (
|
|
2402
|
+
props.as === 'input' &&
|
|
2403
|
+
(props.type === 'checkbox' || props.type === 'radio')
|
|
2404
|
+
) {
|
|
2405
|
+
result.checked = props.modelValue;
|
|
2406
|
+
result.onChange = (event) => {
|
|
2407
|
+
const checked = !event.currentTarget.checked;
|
|
2408
|
+
emit('change', checked, event);
|
|
2409
|
+
emit('update:modelValue', checked, event);
|
|
2410
|
+
};
|
|
2411
|
+
} else if (
|
|
2412
|
+
props.as === 'input' ||
|
|
2413
|
+
props.as === 'textarea' ||
|
|
2414
|
+
props.as === 'select'
|
|
2415
|
+
) {
|
|
2416
|
+
result.value = props.modelValue;
|
|
2417
|
+
result.onInput = (event) => {
|
|
2418
|
+
const value = event.currentTarget.value;
|
|
2419
|
+
emit('input', value, event);
|
|
2420
|
+
emit('update:modelValue', value, event);
|
|
2421
|
+
};
|
|
2422
|
+
}
|
|
2423
|
+
|
|
2424
|
+
return result;
|
|
2425
|
+
});
|
|
2347
2426
|
|
|
2348
2427
|
return () => {
|
|
2349
2428
|
return h(
|
|
@@ -2351,8 +2430,9 @@ function generateVueJsxStringLiteralFactory(ctx) {
|
|
|
2351
2430
|
{
|
|
2352
2431
|
class: classes.value,
|
|
2353
2432
|
...elementProps,
|
|
2433
|
+
...vModelProps.value,
|
|
2354
2434
|
},
|
|
2355
|
-
|
|
2435
|
+
slots
|
|
2356
2436
|
)
|
|
2357
2437
|
}
|
|
2358
2438
|
},
|
|
@@ -2365,23 +2445,13 @@ function generateVueJsxStringLiteralFactory(ctx) {
|
|
|
2365
2445
|
}
|
|
2366
2446
|
}
|
|
2367
2447
|
|
|
2368
|
-
|
|
2369
|
-
const cache = new Map()
|
|
2448
|
+
const tags = 'a, abbr, address, area, article, aside, audio, b, base, bdi, bdo, big, blockquote, body, br, button, canvas, caption, cite, code, col, colgroup, data, datalist, dd, del, details, dfn, dialog, div, dl, dt, em, embed, fieldset, figcaption, figure, footer, form, h1, h2, h3, h4, h5, h6, head, header, hgroup, hr, html, i, iframe, img, input, ins, kbd, keygen, label, legend, li, link, main, map, mark, marquee, menu, menuitem, meta, meter, nav, noscript, object, ol, optgroup, option, output, p, param, picture, pre, progress, q, rp, rt, ruby, s, samp, script, section, select, small, source, span, strong, style, sub, summary, sup, table, tbody, td, textarea, tfoot, th, thead, time, title, tr, track, u, ul, var, video, wbr, circle, clipPath, defs, ellipse, foreignObject, g, image, line, linearGradient, mask, path, pattern, polygon, polyline, radialGradient, rect, stop, svg, text, tspan';
|
|
2370
2449
|
|
|
2371
|
-
|
|
2372
|
-
apply(_, __, args) {
|
|
2373
|
-
return createStyled(...args)
|
|
2374
|
-
},
|
|
2375
|
-
get(_, el) {
|
|
2376
|
-
if (!cache.has(el)) {
|
|
2377
|
-
cache.set(el, createStyled(el))
|
|
2378
|
-
}
|
|
2379
|
-
return cache.get(el)
|
|
2380
|
-
},
|
|
2381
|
-
})
|
|
2382
|
-
}
|
|
2450
|
+
export const ${factoryName} = /* @__PURE__ */ styledFn.bind();
|
|
2383
2451
|
|
|
2384
|
-
|
|
2452
|
+
tags.split(', ').forEach((tag) => {
|
|
2453
|
+
styled[tag] = styled(tag);
|
|
2454
|
+
});
|
|
2385
2455
|
`
|
|
2386
2456
|
};
|
|
2387
2457
|
}
|
|
@@ -2698,7 +2768,7 @@ var pattern_d_ts_default = {
|
|
|
2698
2768
|
|
|
2699
2769
|
// src/artifacts/generated/recipe.d.ts.json
|
|
2700
2770
|
var recipe_d_ts_default = {
|
|
2701
|
-
content: "import type { RecipeRule } from './static-css'\nimport type { SystemStyleObject, DistributiveOmit, Pretty } from './system-types'\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]> | undefined\n }\n\nexport type RecipeVariantFn<T extends RecipeVariantRecord> = (props?: RecipeSelection<T>) => string\n\nexport type RecipeVariantProps<\n T extends RecipeVariantFn<RecipeVariantRecord> | SlotRecipeVariantFn<string, SlotRecipeVariantRecord<string>>,\n> = 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 interface RecipeRuntimeFn<T extends RecipeVariantRecord> extends RecipeVariantFn<T> {\n __type: RecipeSelection<T>\n variantKeys: (keyof T)[]\n variantMap: RecipeVariantMap<T>\n raw: (props?: RecipeSelection<T>) => SystemStyleObject\n config: RecipeConfig<T>\n splitVariantProps<Props extends RecipeSelection<T>>(\n props: Props,\n ): [RecipeSelection<T>, Pretty<DistributiveOmit<Props, keyof T>>]\n}\n\ntype OneOrMore<T> = T | Array<T>\n\nexport type RecipeCompoundSelection<T> = {\n [K in keyof T]?: OneOrMore<StringToBoolean<keyof T[K]>> | undefined\n}\n\nexport type RecipeCompoundVariant<T> = T & {\n css: SystemStyleObject\n}\n\nexport interface RecipeDefinition<T extends RecipeVariantRecord = 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\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?: Pretty<RecipeCompoundVariant<RecipeCompoundSelection<T>>>[]\n /**\n * Variants to pre-generate, will be include in the final `config.staticCss`\n */\n staticCss?: RecipeRule[]\n}\n\nexport type RecipeCreatorFn = <T extends RecipeVariantRecord>(config: RecipeDefinition<T>) => RecipeRuntimeFn<T>\n\ninterface 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 interface RecipeConfig<T extends RecipeVariantRecord = RecipeVariantRecord>\n extends RecipeDefinition<T>,\n 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 interface SlotRecipeRuntimeFn<S extends string, T extends SlotRecipeVariantRecord<S>>\n extends SlotRecipeVariantFn<S, T> {\n raw: (props?: RecipeSelection<T>) => Record<S, SystemStyleObject>\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> = T & {\n css: SlotRecord<S, SystemStyleObject>\n}\n\nexport interface SlotRecipeDefinition<\n S extends string = string,\n T extends SlotRecipeVariantRecord<S> = SlotRecipeVariantRecord<S>,\n> {\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\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?: Pretty<SlotRecipeCompoundVariant<S, RecipeCompoundSelection<T>>>[]\n /**\n * Variants to pre-generate, will be include in the final `config.staticCss`\n */\n staticCss?: RecipeRule[]\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"
|
|
2771
|
+
content: "import type { RecipeRule } from './static-css'\nimport type { SystemStyleObject, DistributiveOmit, Pretty } from './system-types'\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]> | undefined\n }\n\nexport type RecipeVariantFn<T extends RecipeVariantRecord> = (props?: RecipeSelection<T>) => string\n\n/**\n * Extract the variant as optional props from a `cva` function.\n * Intended to be used with a JSX component, prefer `RecipeVariant` for a more strict type.\n */\nexport type RecipeVariantProps<\n T extends RecipeVariantFn<RecipeVariantRecord> | SlotRecipeVariantFn<string, SlotRecipeVariantRecord<string>>,\n> = Pretty<Parameters<T>[0]>\n\n/**\n * Extract the variants from a `cva` function.\n */\nexport type RecipeVariant<\n T extends RecipeVariantFn<RecipeVariantRecord> | SlotRecipeVariantFn<string, SlotRecipeVariantRecord<string>>,\n> = Exclude<Pretty<Required<RecipeVariantProps<T>>>, undefined>\n\ntype RecipeVariantMap<T extends RecipeVariantRecord> = {\n [K in keyof T]: Array<keyof T[K]>\n}\n\n/* -----------------------------------------------------------------------------\n * Recipe / Standard\n * -----------------------------------------------------------------------------*/\n\nexport interface RecipeRuntimeFn<T extends RecipeVariantRecord> extends RecipeVariantFn<T> {\n __type: RecipeSelection<T>\n variantKeys: (keyof T)[]\n variantMap: RecipeVariantMap<T>\n raw: (props?: RecipeSelection<T>) => SystemStyleObject\n config: RecipeConfig<T>\n splitVariantProps<Props extends RecipeSelection<T>>(\n props: Props,\n ): [RecipeSelection<T>, Pretty<DistributiveOmit<Props, keyof T>>]\n}\n\ntype OneOrMore<T> = T | Array<T>\n\nexport type RecipeCompoundSelection<T> = {\n [K in keyof T]?: OneOrMore<StringToBoolean<keyof T[K]>> | undefined\n}\n\nexport type RecipeCompoundVariant<T> = T & {\n css: SystemStyleObject\n}\n\nexport interface RecipeDefinition<T extends RecipeVariantRecord = 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\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?: Pretty<RecipeCompoundVariant<RecipeCompoundSelection<T>>>[]\n /**\n * Variants to pre-generate, will be include in the final `config.staticCss`\n */\n staticCss?: RecipeRule[]\n}\n\nexport type RecipeCreatorFn = <T extends RecipeVariantRecord>(config: RecipeDefinition<T>) => RecipeRuntimeFn<T>\n\ninterface 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 interface RecipeConfig<T extends RecipeVariantRecord = RecipeVariantRecord>\n extends RecipeDefinition<T>,\n 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 interface SlotRecipeRuntimeFn<S extends string, T extends SlotRecipeVariantRecord<S>>\n extends SlotRecipeVariantFn<S, T> {\n raw: (props?: RecipeSelection<T>) => Record<S, SystemStyleObject>\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> = T & {\n css: SlotRecord<S, SystemStyleObject>\n}\n\nexport interface SlotRecipeDefinition<\n S extends string = string,\n T extends SlotRecipeVariantRecord<S> = SlotRecipeVariantRecord<S>,\n> {\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\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?: Pretty<SlotRecipeCompoundVariant<S, RecipeCompoundSelection<T>>>[]\n /**\n * Variants to pre-generate, will be include in the final `config.staticCss`\n */\n staticCss?: RecipeRule[]\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"
|
|
2702
2772
|
};
|
|
2703
2773
|
|
|
2704
2774
|
// src/artifacts/generated/selectors.d.ts.json
|
|
@@ -3524,7 +3594,7 @@ function generateResetCss(ctx, sheet) {
|
|
|
3524
3594
|
borderColor: "var(--global-color-border, currentColor)"
|
|
3525
3595
|
},
|
|
3526
3596
|
hr: { height: "0px", color: "inherit", borderTopWidth: "1px" },
|
|
3527
|
-
body: { height: "100%"
|
|
3597
|
+
body: { height: "100%" },
|
|
3528
3598
|
img: { borderStyle: "none" },
|
|
3529
3599
|
"img, svg, video, canvas, audio, iframe, embed, object": {
|
|
3530
3600
|
display: "block",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pandacss/generator",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.31.0",
|
|
4
4
|
"description": "The css generator for css panda",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -37,12 +37,12 @@
|
|
|
37
37
|
"pluralize": "8.0.0",
|
|
38
38
|
"postcss": "^8.4.31",
|
|
39
39
|
"ts-pattern": "5.0.5",
|
|
40
|
-
"@pandacss/core": "0.
|
|
41
|
-
"@pandacss/is-valid-prop": "^0.
|
|
42
|
-
"@pandacss/logger": "0.
|
|
43
|
-
"@pandacss/shared": "0.
|
|
44
|
-
"@pandacss/token-dictionary": "0.
|
|
45
|
-
"@pandacss/types": "0.
|
|
40
|
+
"@pandacss/core": "0.31.0",
|
|
41
|
+
"@pandacss/is-valid-prop": "^0.31.0",
|
|
42
|
+
"@pandacss/logger": "0.31.0",
|
|
43
|
+
"@pandacss/shared": "0.31.0",
|
|
44
|
+
"@pandacss/token-dictionary": "0.31.0",
|
|
45
|
+
"@pandacss/types": "0.31.0"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"@types/pluralize": "0.0.33"
|