@pandacss/generator 0.0.0-dev-20230804140727 → 0.0.0-dev-20230806134213
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 +3 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +288 -207
- package/dist/index.mjs +290 -209
- package/package.json +8 -8
package/dist/index.js
CHANGED
|
@@ -521,7 +521,8 @@ function generateConditions(ctx) {
|
|
|
521
521
|
js: import_outdent2.default`
|
|
522
522
|
${ctx.file.import("withoutSpace", "../helpers")}
|
|
523
523
|
|
|
524
|
-
const
|
|
524
|
+
const conditionsStr = "${keys.join(",")}"
|
|
525
|
+
const conditions = new Set(conditionsStr.split(','))
|
|
525
526
|
|
|
526
527
|
export function isCondition(value){
|
|
527
528
|
return conditions.has(value) || /^@|&|&$/.test(value)
|
|
@@ -616,7 +617,6 @@ function generateStringLiteralConditions(ctx) {
|
|
|
616
617
|
|
|
617
618
|
// src/artifacts/js/css-fn.ts
|
|
618
619
|
var import_outdent4 = require("outdent");
|
|
619
|
-
var stringify = (v) => JSON.stringify(Object.fromEntries(v), null, 2);
|
|
620
620
|
function generateCssFn(ctx) {
|
|
621
621
|
const {
|
|
622
622
|
utility,
|
|
@@ -624,6 +624,10 @@ function generateCssFn(ctx) {
|
|
|
624
624
|
conditions
|
|
625
625
|
} = ctx;
|
|
626
626
|
const { separator } = utility;
|
|
627
|
+
const shorthandsByProp = Array.from(utility.shorthands.entries()).reduce((acc, [shorthand, prop]) => {
|
|
628
|
+
acc[prop] = shorthand;
|
|
629
|
+
return acc;
|
|
630
|
+
}, {});
|
|
627
631
|
return {
|
|
628
632
|
dts: import_outdent4.outdent`
|
|
629
633
|
import type { SystemStyleObject } from '../types'
|
|
@@ -639,35 +643,45 @@ function generateCssFn(ctx) {
|
|
|
639
643
|
${ctx.file.import("createCss, createMergeCss, hypenateProperty, withoutSpace", "../helpers")}
|
|
640
644
|
${ctx.file.import("sortConditions, finalizeConditions", "./conditions")}
|
|
641
645
|
|
|
642
|
-
const
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
646
|
+
const utilities = "${utility.entries().map(([prop, className]) => {
|
|
647
|
+
const shorthand = shorthandsByProp[prop];
|
|
648
|
+
return [prop, shorthand ? [className, shorthand === className ? 1 : shorthand].join("/") : className].join(":");
|
|
649
|
+
}).join(",")}"
|
|
650
|
+
|
|
651
|
+
const classMap = {}
|
|
652
|
+
${utility.hasShorthand ? import_outdent4.outdent`
|
|
653
|
+
const shorthands = {}
|
|
654
|
+
utilities.split(',').forEach((utility) => {
|
|
655
|
+
const [prop, meta] = utility.split(':')
|
|
656
|
+
const [className, shorthand] = meta.split('/')
|
|
657
|
+
classMap[prop] = className
|
|
658
|
+
if (shorthand) shorthands[shorthand === '1' ? className : shorthand] = prop
|
|
659
|
+
})
|
|
649
660
|
|
|
650
661
|
const resolveShorthand = (prop) => shorthands[prop] || prop
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
const
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
}
|
|
662
|
+
` : import_outdent4.outdent`
|
|
663
|
+
utilities.split(',').forEach((utility) => {
|
|
664
|
+
const [prop, className] = utility.split(':')
|
|
665
|
+
classMap[prop] = className
|
|
666
|
+
})
|
|
667
|
+
`}
|
|
658
668
|
|
|
659
669
|
const context = {
|
|
660
|
-
|
|
670
|
+
${hash ? "hash: true," : ""}
|
|
661
671
|
conditions: {
|
|
662
672
|
shift: sortConditions,
|
|
663
673
|
finalize: finalizeConditions,
|
|
664
|
-
breakpoints: { keys:
|
|
674
|
+
breakpoints: { keys: ${JSON.stringify(conditions.breakpoints.keys)} }
|
|
665
675
|
},
|
|
666
676
|
utility: {
|
|
667
|
-
|
|
668
|
-
transform,
|
|
669
|
-
|
|
670
|
-
|
|
677
|
+
${prefix ? "prefix: " + JSON.stringify(prefix) + "," : ""}
|
|
678
|
+
transform: ${utility.hasShorthand ? `(prop, value) => {
|
|
679
|
+
const key = resolveShorthand(prop)
|
|
680
|
+
const propKey = classMap[key] || hypenateProperty(key)
|
|
681
|
+
return { className: \`\${propKey}${separator}\${withoutSpace(value)}\` }
|
|
682
|
+
}` : `(key, value) => ({ className: \`\${classMap[key] || hypenateProperty(key)}${separator}\${withoutSpace(value)}\` })`},
|
|
683
|
+
${utility.hasShorthand ? "hasShorthand: true," : ""}
|
|
684
|
+
resolveShorthand: ${utility.hasShorthand ? "resolveShorthand" : "prop => prop"},
|
|
671
685
|
}
|
|
672
686
|
}
|
|
673
687
|
|
|
@@ -842,20 +856,33 @@ var import_outdent8 = require("outdent");
|
|
|
842
856
|
|
|
843
857
|
// src/artifacts/generated/helpers.mjs.json
|
|
844
858
|
var helpers_mjs_default = {
|
|
845
|
-
content: '// src/assert.ts\nfunction isObject(value) {\n return typeof value === "object" && value != null && !Array.isArray(value);\n}\n\n// src/
|
|
859
|
+
content: '// src/assert.ts\nfunction isObject(value) {\n return typeof value === "object" && value != null && !Array.isArray(value);\n}\n\n// src/compact.ts\nfunction compact(value) {\n return Object.fromEntries(Object.entries(value ?? {}).filter(([_, value2]) => value2 !== void 0));\n}\n\n// src/condition.ts\nvar isBaseCondition = (v) => v === "base";\nfunction filterBaseConditions(c) {\n return c.slice().filter((v) => !isBaseCondition(v));\n}\n\n// src/css-important.ts\nvar importantRegex = /!(important)?$/;\nfunction isImportant(value) {\n return typeof value === "string" ? importantRegex.test(value) : false;\n}\nfunction withoutImportant(value) {\n return typeof value === "string" ? value.replace(importantRegex, "").trim() : value;\n}\nfunction withoutSpace(str) {\n return typeof str === "string" ? str.replaceAll(" ", "_") : str;\n}\n\n// src/hash.ts\nfunction toChar(code) {\n return String.fromCharCode(code + (code > 25 ? 39 : 97));\n}\nfunction toName(code) {\n let name = "";\n let x;\n for (x = Math.abs(code); x > 52; x = x / 52 | 0)\n name = toChar(x % 52) + name;\n return toChar(x % 52) + name;\n}\nfunction toPhash(h, x) {\n let i = x.length;\n while (i)\n h = h * 33 ^ x.charCodeAt(--i);\n return h;\n}\nfunction toHash(value) {\n return toName(toPhash(5381, value) >>> 0);\n}\n\n// src/merge-props.ts\nfunction mergeProps(...sources) {\n const result = {};\n for (const source of sources) {\n for (const [key, value] of Object.entries(source)) {\n if (isObject(value)) {\n result[key] = mergeProps(result[key] || {}, value);\n } else {\n result[key] = value;\n }\n }\n }\n return result;\n}\n\n// src/walk-object.ts\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/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 compact,\n createCss,\n createMergeCss,\n filterBaseConditions,\n getSlotCompoundVariant,\n getSlotRecipes,\n hypenateProperty,\n isBaseCondition,\n isObject,\n mapObject,\n memo,\n mergeProps,\n splitProps,\n toHash,\n walkObject,\n withoutSpace\n};\n'
|
|
860
|
+
};
|
|
861
|
+
|
|
862
|
+
// src/artifacts/generated/astish.mjs.json
|
|
863
|
+
var astish_mjs_default = {
|
|
864
|
+
content: '// 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};\nexport {\n astish\n};\n'
|
|
865
|
+
};
|
|
866
|
+
|
|
867
|
+
// src/artifacts/generated/normalize-html.mjs.json
|
|
868
|
+
var normalize_html_mjs_default = {
|
|
869
|
+
content: '// 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;\nexport {\n normalizeHTMLProps\n};\n'
|
|
846
870
|
};
|
|
847
871
|
|
|
848
872
|
// src/artifacts/js/helpers.ts
|
|
849
|
-
function generateHelpers() {
|
|
873
|
+
function generateHelpers(ctx) {
|
|
850
874
|
return {
|
|
851
875
|
js: import_outdent8.outdent`
|
|
852
876
|
${helpers_mjs_default.content}
|
|
877
|
+
${ctx.isTemplateLiteralSyntax ? astish_mjs_default.content : ""}
|
|
853
878
|
|
|
854
|
-
|
|
879
|
+
${ctx.jsx.framework ? `${normalize_html_mjs_default.content}` : ""}
|
|
880
|
+
|
|
881
|
+
export function __spreadValues(a, b) {
|
|
855
882
|
return { ...a, ...b }
|
|
856
883
|
}
|
|
857
884
|
|
|
858
|
-
export function __objRest(source, exclude){
|
|
885
|
+
export function __objRest(source, exclude) {
|
|
859
886
|
return Object.fromEntries(Object.entries(source).filter(([key]) => !exclude.includes(key)))
|
|
860
887
|
}
|
|
861
888
|
`
|
|
@@ -864,19 +891,29 @@ function generateHelpers() {
|
|
|
864
891
|
|
|
865
892
|
// src/artifacts/generated/is-valid-prop.mjs.json
|
|
866
893
|
var is_valid_prop_mjs_default = {
|
|
867
|
-
content: '// src/index.ts\nvar userGenerated = [];\nvar allCssProperties = [\n "MsAccelerator",\n "MsBlockProgression",\n "MsContentZoomChaining",\n "MsContentZooming",\n "MsContentZoomLimit",\n "MsContentZoomLimitMax",\n "MsContentZoomLimitMin",\n "MsContentZoomSnap",\n "MsContentZoomSnapPoints",\n "MsContentZoomSnapType",\n "MsFilter",\n "MsFlowFrom",\n "MsFlowInto",\n "MsGridColumns",\n "MsGridRows",\n "MsHighContrastAdjust",\n "MsHyphenateLimitChars",\n "MsHyphenateLimitLines",\n "MsHyphenateLimitZone",\n "MsImeAlign",\n "MsOverflowStyle",\n "MsScrollbar3dlightColor",\n "MsScrollbarArrowColor",\n "MsScrollbarBaseColor",\n "MsScrollbarDarkshadowColor",\n "MsScrollbarFaceColor",\n "MsScrollbarHighlightColor",\n "MsScrollbarShadowColor",\n "MsScrollbarTrackColor",\n "MsScrollChaining",\n "MsScrollLimit",\n "MsScrollLimitXMax",\n "MsScrollLimitXMin",\n "MsScrollLimitYMax",\n "MsScrollLimitYMin",\n "MsScrollRails",\n "MsScrollSnapPointsX",\n "MsScrollSnapPointsY",\n "MsScrollSnapType",\n "MsScrollSnapX",\n "MsScrollSnapY",\n "MsScrollTranslation",\n "MsTextAutospace",\n "MsTouchSelect",\n "MsUserSelect",\n "MsWrapFlow",\n "MsWrapMargin",\n "MsWrapThrough",\n "MozAppearance",\n "MozBinding",\n "MozBorderBottomColors",\n "MozBorderLeftColors",\n "MozBorderRightColors",\n "MozBorderTopColors",\n "MozContextProperties",\n "MozFloatEdge",\n "MozForceBrokenImageIcon",\n "MozImageRegion",\n "MozOrient",\n "MozOutlineRadius",\n "MozOutlineRadiusBottomleft",\n "MozOutlineRadiusBottomright",\n "MozOutlineRadiusTopleft",\n "MozOutlineRadiusTopright",\n "MozStackSizing",\n "MozTextBlink",\n "MozUserFocus",\n "MozUserInput",\n "MozUserModify",\n "MozWindowDragging",\n "MozWindowShadow",\n "WebkitAppearance",\n "WebkitBorderBefore",\n "WebkitBorderBeforeColor",\n "WebkitBorderBeforeStyle",\n "WebkitBorderBeforeWidth",\n "WebkitBoxReflect",\n "WebkitLineClamp",\n "WebkitMask",\n "WebkitMaskAttachment",\n "WebkitMaskClip",\n "WebkitMaskComposite",\n "WebkitMaskImage",\n "WebkitMaskOrigin",\n "WebkitMaskPosition",\n "WebkitMaskPositionX",\n "WebkitMaskPositionY",\n "WebkitMaskRepeat",\n "WebkitMaskRepeatX",\n "WebkitMaskRepeatY",\n "WebkitMaskSize",\n "WebkitOverflowScrolling",\n "WebkitTapHighlightColor",\n "WebkitTextFillColor",\n "WebkitTextStroke",\n "WebkitTextStrokeColor",\n "WebkitTextStrokeWidth",\n "WebkitTouchCallout",\n "WebkitUserModify",\n "accentColor",\n "alignContent",\n "alignItems",\n "alignSelf",\n "alignTracks",\n "all",\n "animation",\n "animationComposition",\n "animationDelay",\n "animationDirection",\n "animationDuration",\n "animationFillMode",\n "animationIterationCount",\n "animationName",\n "animationPlayState",\n "animationTimingFunction",\n "animationTimeline",\n "appearance",\n "aspectRatio",\n "azimuth",\n "backdropFilter",\n "backfaceVisibility",\n "background",\n "backgroundAttachment",\n "backgroundBlendMode",\n "backgroundClip",\n "backgroundColor",\n "backgroundImage",\n "backgroundOrigin",\n "backgroundPosition",\n "backgroundPositionX",\n "backgroundPositionY",\n "backgroundRepeat",\n "backgroundSize",\n "blockOverflow",\n "blockSize",\n "border",\n "borderBlock",\n "borderBlockColor",\n "borderBlockStyle",\n "borderBlockWidth",\n "borderBlockEnd",\n "borderBlockEndColor",\n "borderBlockEndStyle",\n "borderBlockEndWidth",\n "borderBlockStart",\n "borderBlockStartColor",\n "borderBlockStartStyle",\n "borderBlockStartWidth",\n "borderBottom",\n "borderBottomColor",\n "borderBottomLeftRadius",\n "borderBottomRightRadius",\n "borderBottomStyle",\n "borderBottomWidth",\n "borderCollapse",\n "borderColor",\n "borderEndEndRadius",\n "borderEndStartRadius",\n "borderImage",\n "borderImageOutset",\n "borderImageRepeat",\n "borderImageSlice",\n "borderImageSource",\n "borderImageWidth",\n "borderInline",\n "borderInlineEnd",\n "borderInlineColor",\n "borderInlineStyle",\n "borderInlineWidth",\n "borderInlineEndColor",\n "borderInlineEndStyle",\n "borderInlineEndWidth",\n "borderInlineStart",\n "borderInlineStartColor",\n "borderInlineStartStyle",\n "borderInlineStartWidth",\n "borderLeft",\n "borderLeftColor",\n "borderLeftStyle",\n "borderLeftWidth",\n "borderRadius",\n "borderRight",\n "borderRightColor",\n "borderRightStyle",\n "borderRightWidth",\n "borderSpacing",\n "borderStartEndRadius",\n "borderStartStartRadius",\n "borderStyle",\n "borderTop",\n "borderTopColor",\n "borderTopLeftRadius",\n "borderTopRightRadius",\n "borderTopStyle",\n "borderTopWidth",\n "borderWidth",\n "bottom",\n "boxAlign",\n "boxDecorationBreak",\n "boxDirection",\n "boxFlex",\n "boxFlexGroup",\n "boxLines",\n "boxOrdinalGroup",\n "boxOrient",\n "boxPack",\n "boxShadow",\n "boxSizing",\n "breakAfter",\n "breakBefore",\n "breakInside",\n "captionSide",\n "caret",\n "caretColor",\n "caretShape",\n "clear",\n "clip",\n "clipPath",\n "color",\n "colorScheme",\n "columnCount",\n "columnFill",\n "columnGap",\n "columnRule",\n "columnRuleColor",\n "columnRuleStyle",\n "columnRuleWidth",\n "columnSpan",\n "columnWidth",\n "columns",\n "contain",\n "containIntrinsicSize",\n "containIntrinsicBlockSize",\n "containIntrinsicHeight",\n "containIntrinsicInlineSize",\n "containIntrinsicWidth",\n "container",\n "containerName",\n "containerType",\n "content",\n "contentVisibility",\n "counterIncrement",\n "counterReset",\n "counterSet",\n "cursor",\n "direction",\n "display",\n "emptyCells",\n "filter",\n "flex",\n "flexBasis",\n "flexDirection",\n "flexFlow",\n "flexGrow",\n "flexShrink",\n "flexWrap",\n "float",\n "font",\n "fontFamily",\n "fontFeatureSettings",\n "fontKerning",\n "fontLanguageOverride",\n "fontOpticalSizing",\n "fontPalette",\n "fontVariationSettings",\n "fontSize",\n "fontSizeAdjust",\n "fontSmooth",\n "fontStretch",\n "fontStyle",\n "fontSynthesis",\n "fontVariant",\n "fontVariantAlternates",\n "fontVariantCaps",\n "fontVariantEastAsian",\n "fontVariantEmoji",\n "fontVariantLigatures",\n "fontVariantNumeric",\n "fontVariantPosition",\n "fontWeight",\n "forcedColorAdjust",\n "gap",\n "grid",\n "gridArea",\n "gridAutoColumns",\n "gridAutoFlow",\n "gridAutoRows",\n "gridColumn",\n "gridColumnEnd",\n "gridColumnGap",\n "gridColumnStart",\n "gridGap",\n "gridRow",\n "gridRowEnd",\n "gridRowGap",\n "gridRowStart",\n "gridTemplate",\n "gridTemplateAreas",\n "gridTemplateColumns",\n "gridTemplateRows",\n "hangingPunctuation",\n "height",\n "hyphenateCharacter",\n "hyphenateLimitChars",\n "hyphens",\n "imageOrientation",\n "imageRendering",\n "imageResolution",\n "imeMode",\n "initialLetter",\n "initialLetterAlign",\n "inlineSize",\n "inputSecurity",\n "inset",\n "insetBlock",\n "insetBlockEnd",\n "insetBlockStart",\n "insetInline",\n "insetInlineEnd",\n "insetInlineStart",\n "isolation",\n "justifyContent",\n "justifyItems",\n "justifySelf",\n "justifyTracks",\n "left",\n "letterSpacing",\n "lineBreak",\n "lineClamp",\n "lineHeight",\n "lineHeightStep",\n "listStyle",\n "listStyleImage",\n "listStylePosition",\n "listStyleType",\n "margin",\n "marginBlock",\n "marginBlockEnd",\n "marginBlockStart",\n "marginBottom",\n "marginInline",\n "marginInlineEnd",\n "marginInlineStart",\n "marginLeft",\n "marginRight",\n "marginTop",\n "marginTrim",\n "mask",\n "maskBorder",\n "maskBorderMode",\n "maskBorderOutset",\n "maskBorderRepeat",\n "maskBorderSlice",\n "maskBorderSource",\n "maskBorderWidth",\n "maskClip",\n "maskComposite",\n "maskImage",\n "maskMode",\n "maskOrigin",\n "maskPosition",\n "maskRepeat",\n "maskSize",\n "maskType",\n "masonryAutoFlow",\n "mathDepth",\n "mathShift",\n "mathStyle",\n "maxBlockSize",\n "maxHeight",\n "maxInlineSize",\n "maxLines",\n "maxWidth",\n "minBlockSize",\n "minHeight",\n "minInlineSize",\n "minWidth",\n "mixBlendMode",\n "objectFit",\n "objectPosition",\n "offset",\n "offsetAnchor",\n "offsetDistance",\n "offsetPath",\n "offsetPosition",\n "offsetRotate",\n "opacity",\n "order",\n "orphans",\n "outline",\n "outlineColor",\n "outlineOffset",\n "outlineStyle",\n "outlineWidth",\n "overflow",\n "overflowAnchor",\n "overflowBlock",\n "overflowClipBox",\n "overflowClipMargin",\n "overflowInline",\n "overflowWrap",\n "overflowX",\n "overflowY",\n "overscrollBehavior",\n "overscrollBehaviorBlock",\n "overscrollBehaviorInline",\n "overscrollBehaviorX",\n "overscrollBehaviorY",\n "padding",\n "paddingBlock",\n "paddingBlockEnd",\n "paddingBlockStart",\n "paddingBottom",\n "paddingInline",\n "paddingInlineEnd",\n "paddingInlineStart",\n "paddingLeft",\n "paddingRight",\n "paddingTop",\n "page",\n "pageBreakAfter",\n "pageBreakBefore",\n "pageBreakInside",\n "paintOrder",\n "perspective",\n "perspectiveOrigin",\n "placeContent",\n "placeItems",\n "placeSelf",\n "pointerEvents",\n "position",\n "printColorAdjust",\n "quotes",\n "resize",\n "right",\n "rotate",\n "rowGap",\n "rubyAlign",\n "rubyMerge",\n "rubyPosition",\n "scale",\n "scrollbarColor",\n "scrollbarGutter",\n "scrollbarWidth",\n "scrollBehavior",\n "scrollMargin",\n "scrollMarginBlock",\n "scrollMarginBlockStart",\n "scrollMarginBlockEnd",\n "scrollMarginBottom",\n "scrollMarginInline",\n "scrollMarginInlineStart",\n "scrollMarginInlineEnd",\n "scrollMarginLeft",\n "scrollMarginRight",\n "scrollMarginTop",\n "scrollPadding",\n "scrollPaddingBlock",\n "scrollPaddingBlockStart",\n "scrollPaddingBlockEnd",\n "scrollPaddingBottom",\n "scrollPaddingInline",\n "scrollPaddingInlineStart",\n "scrollPaddingInlineEnd",\n "scrollPaddingLeft",\n "scrollPaddingRight",\n "scrollPaddingTop",\n "scrollSnapAlign",\n "scrollSnapCoordinate",\n "scrollSnapDestination",\n "scrollSnapPointsX",\n "scrollSnapPointsY",\n "scrollSnapStop",\n "scrollSnapType",\n "scrollSnapTypeX",\n "scrollSnapTypeY",\n "scrollTimeline",\n "scrollTimelineAxis",\n "scrollTimelineName",\n "shapeImageThreshold",\n "shapeMargin",\n "shapeOutside",\n "tabSize",\n "tableLayout",\n "textAlign",\n "textAlignLast",\n "textCombineUpright",\n "textDecoration",\n "textDecorationColor",\n "textDecorationLine",\n "textDecorationSkip",\n "textDecorationSkipInk",\n "textDecorationStyle",\n "textDecorationThickness",\n "textEmphasis",\n "textEmphasisColor",\n "textEmphasisPosition",\n "textEmphasisStyle",\n "textIndent",\n "textJustify",\n "textOrientation",\n "textOverflow",\n "textRendering",\n "textShadow",\n "textSizeAdjust",\n "textTransform",\n "textUnderlineOffset",\n "textUnderlinePosition",\n "top",\n "touchAction",\n "transform",\n "transformBox",\n "transformOrigin",\n "transformStyle",\n "transition",\n "transitionDelay",\n "transitionDuration",\n "transitionProperty",\n "transitionTimingFunction",\n "translate",\n "unicodeBidi",\n "userSelect",\n "verticalAlign",\n "viewTransitionName",\n "visibility",\n "whiteSpace",\n "widows",\n "width",\n "willChange",\n "wordBreak",\n "wordSpacing",\n "wordWrap",\n "writingMode",\n "zIndex",\n "zoom",\n ...userGenerated\n];\nvar properties = new Map(allCssProperties.map((prop) => [prop, true]));\nfunction memo(fn) {\n const cache = /* @__PURE__ */ Object.create(null);\n return (arg) => {\n if (cache[arg] === void 0)\n cache[arg] = fn(arg);\n return cache[arg];\n };\n}\nvar selectorRegex = /&|@/;\nvar isCssProperty = memo((prop) => {\n return properties.has(prop) || prop.startsWith("--") || selectorRegex.test(prop);\n});\nexport {\n allCssProperties,\n isCssProperty\n};\n'
|
|
894
|
+
content: '// src/index.ts\nvar userGeneratedStr = "";\nvar userGenerated = userGeneratedStr.split(",");\nvar cssPropertiesStr = "WebkitAppearance,WebkitBorderBefore,WebkitBorderBeforeColor,WebkitBorderBeforeStyle,WebkitBorderBeforeWidth,WebkitBoxReflect,WebkitLineClamp,WebkitMask,WebkitMaskAttachment,WebkitMaskClip,WebkitMaskComposite,WebkitMaskImage,WebkitMaskOrigin,WebkitMaskPosition,WebkitMaskPositionX,WebkitMaskPositionY,WebkitMaskRepeat,WebkitMaskRepeatX,WebkitMaskRepeatY,WebkitMaskSize,WebkitOverflowScrolling,WebkitTapHighlightColor,WebkitTextFillColor,WebkitTextStroke,WebkitTextStrokeColor,WebkitTextStrokeWidth,WebkitTouchCallout,WebkitUserModify,accentColor,alignContent,alignItems,alignSelf,alignTracks,all,animation,animationComposition,animationDelay,animationDirection,animationDuration,animationFillMode,animationIterationCount,animationName,animationPlayState,animationTimingFunction,animationTimeline,appearance,aspectRatio,azimuth,backdropFilter,backfaceVisibility,background,backgroundAttachment,backgroundBlendMode,backgroundClip,backgroundColor,backgroundImage,backgroundOrigin,backgroundPosition,backgroundPositionX,backgroundPositionY,backgroundRepeat,backgroundSize,blockOverflow,blockSize,border,borderBlock,borderBlockColor,borderBlockStyle,borderBlockWidth,borderBlockEnd,borderBlockEndColor,borderBlockEndStyle,borderBlockEndWidth,borderBlockStart,borderBlockStartColor,borderBlockStartStyle,borderBlockStartWidth,borderBottom,borderBottomColor,borderBottomLeftRadius,borderBottomRightRadius,borderBottomStyle,borderBottomWidth,borderCollapse,borderColor,borderEndEndRadius,borderEndStartRadius,borderImage,borderImageOutset,borderImageRepeat,borderImageSlice,borderImageSource,borderImageWidth,borderInline,borderInlineEnd,borderInlineColor,borderInlineStyle,borderInlineWidth,borderInlineEndColor,borderInlineEndStyle,borderInlineEndWidth,borderInlineStart,borderInlineStartColor,borderInlineStartStyle,borderInlineStartWidth,borderLeft,borderLeftColor,borderLeftStyle,borderLeftWidth,borderRadius,borderRight,borderRightColor,borderRightStyle,borderRightWidth,borderSpacing,borderStartEndRadius,borderStartStartRadius,borderStyle,borderTop,borderTopColor,borderTopLeftRadius,borderTopRightRadius,borderTopStyle,borderTopWidth,borderWidth,bottom,boxAlign,boxDecorationBreak,boxDirection,boxFlex,boxFlexGroup,boxLines,boxOrdinalGroup,boxOrient,boxPack,boxShadow,boxSizing,breakAfter,breakBefore,breakInside,captionSide,caret,caretColor,caretShape,clear,clip,clipPath,color,colorScheme,columnCount,columnFill,columnGap,columnRule,columnRuleColor,columnRuleStyle,columnRuleWidth,columnSpan,columnWidth,columns,contain,containIntrinsicSize,containIntrinsicBlockSize,containIntrinsicHeight,containIntrinsicInlineSize,containIntrinsicWidth,container,containerName,containerType,content,contentVisibility,counterIncrement,counterReset,counterSet,cursor,direction,display,emptyCells,filter,flex,flexBasis,flexDirection,flexFlow,flexGrow,flexShrink,flexWrap,float,font,fontFamily,fontFeatureSettings,fontKerning,fontLanguageOverride,fontOpticalSizing,fontPalette,fontVariationSettings,fontSize,fontSizeAdjust,fontSmooth,fontStretch,fontStyle,fontSynthesis,fontVariant,fontVariantAlternates,fontVariantCaps,fontVariantEastAsian,fontVariantEmoji,fontVariantLigatures,fontVariantNumeric,fontVariantPosition,fontWeight,forcedColorAdjust,gap,grid,gridArea,gridAutoColumns,gridAutoFlow,gridAutoRows,gridColumn,gridColumnEnd,gridColumnGap,gridColumnStart,gridGap,gridRow,gridRowEnd,gridRowGap,gridRowStart,gridTemplate,gridTemplateAreas,gridTemplateColumns,gridTemplateRows,hangingPunctuation,height,hyphenateCharacter,hyphenateLimitChars,hyphens,imageOrientation,imageRendering,imageResolution,imeMode,initialLetter,initialLetterAlign,inlineSize,inputSecurity,inset,insetBlock,insetBlockEnd,insetBlockStart,insetInline,insetInlineEnd,insetInlineStart,isolation,justifyContent,justifyItems,justifySelf,justifyTracks,left,letterSpacing,lineBreak,lineClamp,lineHeight,lineHeightStep,listStyle,listStyleImage,listStylePosition,listStyleType,margin,marginBlock,marginBlockEnd,marginBlockStart,marginBottom,marginInline,marginInlineEnd,marginInlineStart,marginLeft,marginRight,marginTop,marginTrim,mask,maskBorder,maskBorderMode,maskBorderOutset,maskBorderRepeat,maskBorderSlice,maskBorderSource,maskBorderWidth,maskClip,maskComposite,maskImage,maskMode,maskOrigin,maskPosition,maskRepeat,maskSize,maskType,masonryAutoFlow,mathDepth,mathShift,mathStyle,maxBlockSize,maxHeight,maxInlineSize,maxLines,maxWidth,minBlockSize,minHeight,minInlineSize,minWidth,mixBlendMode,objectFit,objectPosition,offset,offsetAnchor,offsetDistance,offsetPath,offsetPosition,offsetRotate,opacity,order,orphans,outline,outlineColor,outlineOffset,outlineStyle,outlineWidth,overflow,overflowAnchor,overflowBlock,overflowClipBox,overflowClipMargin,overflowInline,overflowWrap,overflowX,overflowY,overscrollBehavior,overscrollBehaviorBlock,overscrollBehaviorInline,overscrollBehaviorX,overscrollBehaviorY,padding,paddingBlock,paddingBlockEnd,paddingBlockStart,paddingBottom,paddingInline,paddingInlineEnd,paddingInlineStart,paddingLeft,paddingRight,paddingTop,page,pageBreakAfter,pageBreakBefore,pageBreakInside,paintOrder,perspective,perspectiveOrigin,placeContent,placeItems,placeSelf,pointerEvents,position,printColorAdjust,quotes,resize,right,rotate,rowGap,rubyAlign,rubyMerge,rubyPosition,scale,scrollbarColor,scrollbarGutter,scrollbarWidth,scrollBehavior,scrollMargin,scrollMarginBlock,scrollMarginBlockStart,scrollMarginBlockEnd,scrollMarginBottom,scrollMarginInline,scrollMarginInlineStart,scrollMarginInlineEnd,scrollMarginLeft,scrollMarginRight,scrollMarginTop,scrollPadding,scrollPaddingBlock,scrollPaddingBlockStart,scrollPaddingBlockEnd,scrollPaddingBottom,scrollPaddingInline,scrollPaddingInlineStart,scrollPaddingInlineEnd,scrollPaddingLeft,scrollPaddingRight,scrollPaddingTop,scrollSnapAlign,scrollSnapCoordinate,scrollSnapDestination,scrollSnapPointsX,scrollSnapPointsY,scrollSnapStop,scrollSnapType,scrollSnapTypeX,scrollSnapTypeY,scrollTimeline,scrollTimelineAxis,scrollTimelineName,shapeImageThreshold,shapeMargin,shapeOutside,tabSize,tableLayout,textAlign,textAlignLast,textCombineUpright,textDecoration,textDecorationColor,textDecorationLine,textDecorationSkip,textDecorationSkipInk,textDecorationStyle,textDecorationThickness,textEmphasis,textEmphasisColor,textEmphasisPosition,textEmphasisStyle,textIndent,textJustify,textOrientation,textOverflow,textRendering,textShadow,textSizeAdjust,textTransform,textUnderlineOffset,textUnderlinePosition,top,touchAction,transform,transformBox,transformOrigin,transformStyle,transition,transitionDelay,transitionDuration,transitionProperty,transitionTimingFunction,translate,unicodeBidi,userSelect,verticalAlign,viewTransitionName,visibility,whiteSpace,widows,width,willChange,wordBreak,wordSpacing,wordWrap,writingMode,zIndex,zoom";\nvar allCssProperties = cssPropertiesStr.split(",").concat(userGenerated);\nvar properties = new Map(allCssProperties.map((prop) => [prop, true]));\nfunction memo(fn) {\n const cache = /* @__PURE__ */ Object.create(null);\n return (arg) => {\n if (cache[arg] === void 0)\n cache[arg] = fn(arg);\n return cache[arg];\n };\n}\nvar selectorRegex = /&|@/;\nvar isCssProperty = /* @__PURE__ */ memo((prop) => {\n return properties.has(prop) || prop.startsWith("--") || selectorRegex.test(prop);\n});\nexport {\n allCssProperties,\n isCssProperty\n};\n'
|
|
868
895
|
};
|
|
869
896
|
|
|
870
897
|
// src/artifacts/js/is-valid-prop.ts
|
|
871
898
|
var import_outdent9 = require("outdent");
|
|
872
|
-
|
|
899
|
+
var import_ts_pattern = require("ts-pattern");
|
|
900
|
+
var cssPropRegex = /var cssPropertiesStr = ".*?";/;
|
|
901
|
+
var memoFnDeclarationRegex = /function memo(.+?)\nvar selectorRegex/s;
|
|
902
|
+
function generateIsValidProp(ctx) {
|
|
873
903
|
if (ctx.isTemplateLiteralSyntax)
|
|
874
904
|
return;
|
|
875
905
|
let content = is_valid_prop_mjs_default.content;
|
|
876
906
|
content = content.replace(
|
|
877
|
-
|
|
878
|
-
`var
|
|
907
|
+
'var userGeneratedStr = "";',
|
|
908
|
+
`var userGeneratedStr = "${(0, import_ts_pattern.match)(ctx.jsx.styleProps).with("all", () => Array.from(new Set(ctx.properties)).join(",")).with("minimal", () => "css").with("none", () => "").exhaustive()}"`
|
|
879
909
|
);
|
|
910
|
+
content = content.replace(memoFnDeclarationRegex, "var selectorRegex");
|
|
911
|
+
if (ctx.jsx.styleProps === "minimal" || ctx.jsx.styleProps === "none") {
|
|
912
|
+
content = content.replace("/* @__PURE__ */ memo(", "/* @__PURE__ */ (");
|
|
913
|
+
content = content.replace(cssPropRegex, 'var cssPropertiesStr = "";');
|
|
914
|
+
} else {
|
|
915
|
+
content = ctx.file.import("memo", "../helpers") + "\n" + content;
|
|
916
|
+
}
|
|
880
917
|
return {
|
|
881
918
|
js: content,
|
|
882
919
|
dts: import_outdent9.outdent`
|
|
@@ -891,7 +928,7 @@ function generateisValidProp(ctx) {
|
|
|
891
928
|
var import_shared = require("@pandacss/shared");
|
|
892
929
|
var import_javascript_stringify = require("javascript-stringify");
|
|
893
930
|
var import_outdent10 = require("outdent");
|
|
894
|
-
var
|
|
931
|
+
var import_ts_pattern2 = require("ts-pattern");
|
|
895
932
|
function generatePattern(ctx) {
|
|
896
933
|
if (ctx.patterns.isEmpty())
|
|
897
934
|
return;
|
|
@@ -917,7 +954,7 @@ function generatePattern(ctx) {
|
|
|
917
954
|
export type ${upperName}Properties = {
|
|
918
955
|
${Object.keys(properties ?? {}).map((key) => {
|
|
919
956
|
const value = properties[key];
|
|
920
|
-
return (0,
|
|
957
|
+
return (0, import_ts_pattern2.match)(value).with({ type: "property" }, (value2) => {
|
|
921
958
|
return `${key}?: PropertyValue<'${value2.value}'>`;
|
|
922
959
|
}).with({ type: "token" }, (value2) => {
|
|
923
960
|
if (value2.property) {
|
|
@@ -966,8 +1003,8 @@ transform`)}
|
|
|
966
1003
|
var import_core4 = require("@pandacss/core");
|
|
967
1004
|
var import_shared2 = require("@pandacss/shared");
|
|
968
1005
|
var import_outdent11 = require("outdent");
|
|
969
|
-
var
|
|
970
|
-
var
|
|
1006
|
+
var import_ts_pattern3 = require("ts-pattern");
|
|
1007
|
+
var stringify2 = (value) => JSON.stringify(value, null, 2);
|
|
971
1008
|
var isBooleanValue = (value) => value === "true" || value === "false";
|
|
972
1009
|
function generateRecipes(ctx) {
|
|
973
1010
|
const {
|
|
@@ -1000,9 +1037,9 @@ function generateRecipes(ctx) {
|
|
|
1000
1037
|
}
|
|
1001
1038
|
|
|
1002
1039
|
const recipeCss = createCss({
|
|
1003
|
-
|
|
1040
|
+
${hash ? "hash: true," : ""}
|
|
1004
1041
|
utility: {
|
|
1005
|
-
|
|
1042
|
+
${prefix ? "prefix: " + JSON.stringify(prefix) + "," : ""}
|
|
1006
1043
|
transform,
|
|
1007
1044
|
}
|
|
1008
1045
|
})
|
|
@@ -1025,29 +1062,31 @@ function generateRecipes(ctx) {
|
|
|
1025
1062
|
...ctx.recipes.details.map((recipe) => {
|
|
1026
1063
|
const { baseName, config, upperName, variantKeyMap, dashName } = recipe;
|
|
1027
1064
|
const { description, defaultVariants, compoundVariants } = config;
|
|
1028
|
-
const jsCode = (0,
|
|
1065
|
+
const jsCode = (0, import_ts_pattern3.match)(config).when(
|
|
1029
1066
|
import_core4.isSlotRecipe,
|
|
1030
1067
|
(config2) => import_outdent11.outdent`
|
|
1031
1068
|
${ctx.file.import("splitProps, getSlotCompoundVariant", "../helpers")}
|
|
1032
1069
|
${ctx.file.import("createRecipe", "./create-recipe")}
|
|
1033
1070
|
|
|
1034
|
-
const
|
|
1035
|
-
const
|
|
1036
|
-
|
|
1037
|
-
const
|
|
1038
|
-
const
|
|
1071
|
+
const ${baseName}DefaultVariants = ${stringify2(defaultVariants ?? {})}
|
|
1072
|
+
const ${baseName}CompoundVariants = ${stringify2(compoundVariants ?? [])}
|
|
1073
|
+
|
|
1074
|
+
const ${baseName}SlotNames = ${stringify2(config2.slots.map((slot) => [slot, `${config2.className}__${slot}`]))}
|
|
1075
|
+
const ${baseName}SlotFns = ${baseName}SlotNames.map(([slotName, slotKey]) => [slotName, createRecipe(slotKey, ${baseName}DefaultVariants, getSlotCompoundVariant(${baseName}CompoundVariants, slotName))])
|
|
1039
1076
|
|
|
1040
1077
|
const ${baseName}Fn = (props = {}) => {
|
|
1041
|
-
return Object.fromEntries(
|
|
1078
|
+
return Object.fromEntries(${baseName}SlotFns.map(([slotName, slotFn]) => [slotName, slotFn(props)]))
|
|
1042
1079
|
}
|
|
1043
|
-
|
|
1080
|
+
|
|
1081
|
+
const ${baseName}VariantKeys = ${stringify2(Object.keys(variantKeyMap))}
|
|
1082
|
+
|
|
1044
1083
|
export const ${baseName} = Object.assign(${baseName}Fn, {
|
|
1045
1084
|
__recipe__: false,
|
|
1046
1085
|
raw: (props) => props,
|
|
1047
|
-
variantKeys: ${
|
|
1048
|
-
variantMap: ${
|
|
1086
|
+
variantKeys: ${baseName}VariantKeys,
|
|
1087
|
+
variantMap: ${stringify2(variantKeyMap)},
|
|
1049
1088
|
splitVariantProps(props) {
|
|
1050
|
-
return splitProps(props, ${
|
|
1089
|
+
return splitProps(props, ${baseName}VariantKeys)
|
|
1051
1090
|
},
|
|
1052
1091
|
})
|
|
1053
1092
|
`
|
|
@@ -1056,17 +1095,19 @@ function generateRecipes(ctx) {
|
|
|
1056
1095
|
${ctx.file.import("splitProps", "../helpers")}
|
|
1057
1096
|
${ctx.file.import("createRecipe", "./create-recipe")}
|
|
1058
1097
|
|
|
1059
|
-
const ${baseName}Fn = createRecipe('${config2.className}', ${
|
|
1098
|
+
const ${baseName}Fn = createRecipe('${config2.className}', ${stringify2(defaultVariants ?? {})}, ${stringify2(
|
|
1060
1099
|
compoundVariants ?? []
|
|
1061
1100
|
)})
|
|
1062
1101
|
|
|
1102
|
+
const ${baseName}VariantMap = ${stringify2(variantKeyMap)}
|
|
1103
|
+
const ${baseName}VariantKeys = Object.keys(${baseName}VariantMap)
|
|
1063
1104
|
export const ${baseName} = Object.assign(${baseName}Fn, {
|
|
1064
1105
|
__recipe__: true,
|
|
1065
1106
|
raw: (props) => props,
|
|
1066
|
-
variantKeys: ${
|
|
1067
|
-
variantMap: ${
|
|
1107
|
+
variantKeys: ${baseName}VariantKeys,
|
|
1108
|
+
variantMap: ${baseName}VariantMap,
|
|
1068
1109
|
splitVariantProps(props) {
|
|
1069
|
-
return splitProps(props, ${
|
|
1110
|
+
return splitProps(props, ${baseName}VariantKeys)
|
|
1070
1111
|
},
|
|
1071
1112
|
})
|
|
1072
1113
|
`
|
|
@@ -1196,32 +1237,32 @@ function generatePreactJsxFactory(ctx) {
|
|
|
1196
1237
|
${ctx.file.import("css, cx, assignCss", "../css/index")}
|
|
1197
1238
|
${ctx.file.import("splitProps, normalizeHTMLProps", "../helpers")}
|
|
1198
1239
|
${ctx.file.import("isCssProperty", "./is-valid-prop")}
|
|
1199
|
-
|
|
1240
|
+
|
|
1200
1241
|
function styledFn(Dynamic, configOrCva = {}) {
|
|
1201
1242
|
const cvaFn = configOrCva.__cva__ || configOrCva.__recipe__ ? configOrCva : cva(configOrCva)
|
|
1202
|
-
|
|
1203
|
-
const ${componentName} = forwardRef(function ${componentName}(props, ref) {
|
|
1243
|
+
|
|
1244
|
+
const ${componentName} = /* @__PURE__ */ forwardRef(function ${componentName}(props, ref) {
|
|
1204
1245
|
const { as: Element = Dynamic, ...restProps } = props
|
|
1205
1246
|
|
|
1206
1247
|
const [variantProps, styleProps, htmlProps, elementProps] = useMemo(() => {
|
|
1207
1248
|
return splitProps(restProps, cvaFn.variantKeys, isCssProperty, normalizeHTMLProps.keys)
|
|
1208
1249
|
}, [restProps])
|
|
1209
|
-
|
|
1250
|
+
|
|
1210
1251
|
function recipeClass() {
|
|
1211
1252
|
const { css: cssStyles, ...propStyles } = styleProps
|
|
1212
1253
|
const styles = assignCss(propStyles, cssStyles)
|
|
1213
1254
|
return cx(cvaFn(variantProps), css(styles), elementProps.className, elementProps.class)
|
|
1214
1255
|
}
|
|
1215
|
-
|
|
1256
|
+
|
|
1216
1257
|
function cvaClass() {
|
|
1217
1258
|
const { css: cssStyles, ...propStyles } = styleProps
|
|
1218
1259
|
const cvaStyles = cvaFn.resolve(variantProps)
|
|
1219
1260
|
const styles = assignCss(cvaStyles, propStyles, cssStyles)
|
|
1220
1261
|
return cx(css(styles), elementProps.className, elementProps.class)
|
|
1221
1262
|
}
|
|
1222
|
-
|
|
1263
|
+
|
|
1223
1264
|
const classes = configOrCva.__recipe__ ? recipeClass : cvaClass
|
|
1224
|
-
|
|
1265
|
+
|
|
1225
1266
|
return h(Element, {
|
|
1226
1267
|
...elementProps,
|
|
1227
1268
|
...normalizeHTMLProps(htmlProps),
|
|
@@ -1229,14 +1270,14 @@ function generatePreactJsxFactory(ctx) {
|
|
|
1229
1270
|
className: classes()
|
|
1230
1271
|
})
|
|
1231
1272
|
})
|
|
1232
|
-
|
|
1273
|
+
|
|
1233
1274
|
${componentName}.displayName = \`${factoryName}.\${Dynamic}\`
|
|
1234
1275
|
return ${componentName}
|
|
1235
1276
|
}
|
|
1236
|
-
|
|
1277
|
+
|
|
1237
1278
|
function createJsxFactory() {
|
|
1238
1279
|
const cache = new Map()
|
|
1239
|
-
|
|
1280
|
+
|
|
1240
1281
|
return new Proxy(styledFn, {
|
|
1241
1282
|
apply(_, __, args) {
|
|
1242
1283
|
return styledFn(...args)
|
|
@@ -1250,14 +1291,14 @@ function generatePreactJsxFactory(ctx) {
|
|
|
1250
1291
|
})
|
|
1251
1292
|
}
|
|
1252
1293
|
|
|
1253
|
-
export const ${factoryName} = createJsxFactory()
|
|
1294
|
+
export const ${factoryName} = /* @__PURE__ */ createJsxFactory()
|
|
1254
1295
|
`
|
|
1255
1296
|
};
|
|
1256
1297
|
}
|
|
1257
1298
|
|
|
1258
1299
|
// src/artifacts/preact-jsx/pattern.ts
|
|
1259
1300
|
var import_outdent15 = require("outdent");
|
|
1260
|
-
var
|
|
1301
|
+
var import_ts_pattern4 = require("ts-pattern");
|
|
1261
1302
|
function generatePreactJsxPattern(ctx) {
|
|
1262
1303
|
const { typeName, factoryName } = ctx.jsx;
|
|
1263
1304
|
return ctx.patterns.details.map((pattern) => {
|
|
@@ -1270,9 +1311,9 @@ function generatePreactJsxPattern(ctx) {
|
|
|
1270
1311
|
import { forwardRef } from 'preact/compat'
|
|
1271
1312
|
${ctx.file.import(factoryName, "./factory")}
|
|
1272
1313
|
${ctx.file.import(styleFnName, `../patterns/${dashName}`)}
|
|
1273
|
-
|
|
1274
|
-
export const ${jsxName} = forwardRef(function ${jsxName}(props, ref) {
|
|
1275
|
-
${(0,
|
|
1314
|
+
|
|
1315
|
+
export const ${jsxName} = /* @__PURE__ */ forwardRef(function ${jsxName}(props, ref) {
|
|
1316
|
+
${(0, import_ts_pattern4.match)(props.length).with(
|
|
1276
1317
|
0,
|
|
1277
1318
|
() => import_outdent15.outdent`
|
|
1278
1319
|
const styleProps = ${styleFnName}()
|
|
@@ -1285,15 +1326,15 @@ function generatePreactJsxPattern(ctx) {
|
|
|
1285
1326
|
return h(${factoryName}.${jsxElement}, { ref, ...styleProps, ...restProps })
|
|
1286
1327
|
`
|
|
1287
1328
|
)}
|
|
1288
|
-
})
|
|
1329
|
+
})
|
|
1289
1330
|
`,
|
|
1290
1331
|
dts: import_outdent15.outdent`
|
|
1291
1332
|
import type { FunctionComponent } from 'preact'
|
|
1292
1333
|
import type { ${upperName}Properties } from '../patterns/${dashName}'
|
|
1293
1334
|
import type { ${typeName} } from '../types/jsx'
|
|
1294
|
-
|
|
1335
|
+
|
|
1295
1336
|
export type ${upperName}Props = ${upperName}Properties & Omit<${typeName}<'${jsxElement}'>, keyof ${upperName}Properties ${blocklistType}>
|
|
1296
|
-
|
|
1337
|
+
|
|
1297
1338
|
${description ? `/** ${description} */` : ""}
|
|
1298
1339
|
export declare const ${jsxName}: FunctionComponent<${upperName}Props>
|
|
1299
1340
|
`
|
|
@@ -1304,7 +1345,7 @@ function generatePreactJsxPattern(ctx) {
|
|
|
1304
1345
|
// src/artifacts/preact-jsx/types.ts
|
|
1305
1346
|
var import_outdent16 = require("outdent");
|
|
1306
1347
|
function generatePreactJsxTypes(ctx) {
|
|
1307
|
-
const { factoryName, componentName, upperName, typeName } = ctx.jsx;
|
|
1348
|
+
const { factoryName, styleProps, componentName, upperName, typeName } = ctx.jsx;
|
|
1308
1349
|
return {
|
|
1309
1350
|
jsxFactory: import_outdent16.outdent`
|
|
1310
1351
|
import type { ${upperName} } from '../types/jsx'
|
|
@@ -1327,7 +1368,7 @@ export type ${componentName}<T extends ElementType, P extends Dict = {}> = {
|
|
|
1327
1368
|
type RecipeFn = { __type: any }
|
|
1328
1369
|
|
|
1329
1370
|
interface JsxFactory {
|
|
1330
|
-
|
|
1371
|
+
${styleProps === "none" ? "" : `<T extends ElementType>(component: T): ${componentName}<T, {}>`}
|
|
1331
1372
|
<T extends ElementType, P extends RecipeVariantRecord>(component: T, recipe: RecipeDefinition<P>): ${componentName}<
|
|
1332
1373
|
T,
|
|
1333
1374
|
RecipeSelection<P>
|
|
@@ -1337,7 +1378,7 @@ interface JsxFactory {
|
|
|
1337
1378
|
|
|
1338
1379
|
type JsxElements = { [K in keyof JSX.IntrinsicElements]: ${componentName}<K, {}> }
|
|
1339
1380
|
|
|
1340
|
-
export type ${upperName} = JsxFactory & JsxElements
|
|
1381
|
+
export type ${upperName} = JsxFactory ${styleProps === "none" ? "" : "& JsxElements"}
|
|
1341
1382
|
|
|
1342
1383
|
export type ${typeName}<T extends ElementType> = JsxHTMLProps<ComponentProps<T>, JsxStyleProps>
|
|
1343
1384
|
`
|
|
@@ -1353,29 +1394,29 @@ function generatePreactJsxStringLiteralFactory(ctx) {
|
|
|
1353
1394
|
import { h } from 'preact'
|
|
1354
1395
|
import { forwardRef } from 'preact/compat'
|
|
1355
1396
|
${ctx.file.import("css, cx", "../css/index")}
|
|
1356
|
-
|
|
1397
|
+
|
|
1357
1398
|
function createStyledFn(Dynamic) {
|
|
1358
1399
|
return function styledFn(template) {
|
|
1359
1400
|
const baseClassName = css(template)
|
|
1360
|
-
const ${componentName} = forwardRef(function ${componentName}(props, ref) {
|
|
1401
|
+
const ${componentName} = /* @__PURE__ */ forwardRef(function ${componentName}(props, ref) {
|
|
1361
1402
|
const { as: Element = Dynamic, ...elementProps } = props
|
|
1362
1403
|
const classes = () => cx(baseClassName, elementProps.className)
|
|
1363
|
-
|
|
1404
|
+
|
|
1364
1405
|
return h(Element, {
|
|
1365
1406
|
ref,
|
|
1366
1407
|
...elementProps,
|
|
1367
1408
|
className: classes(),
|
|
1368
1409
|
})
|
|
1369
1410
|
})
|
|
1370
|
-
|
|
1411
|
+
|
|
1371
1412
|
${componentName}.displayName = \`${factoryName}.\${Dynamic}\`
|
|
1372
1413
|
return ${componentName}
|
|
1373
1414
|
}
|
|
1374
1415
|
}
|
|
1375
|
-
|
|
1416
|
+
|
|
1376
1417
|
function createJsxFactory() {
|
|
1377
1418
|
const cache = new Map()
|
|
1378
|
-
|
|
1419
|
+
|
|
1379
1420
|
return new Proxy(createStyledFn, {
|
|
1380
1421
|
apply(_, __, args) {
|
|
1381
1422
|
return createStyledFn(...args)
|
|
@@ -1389,7 +1430,7 @@ function generatePreactJsxStringLiteralFactory(ctx) {
|
|
|
1389
1430
|
})
|
|
1390
1431
|
}
|
|
1391
1432
|
|
|
1392
|
-
export const ${factoryName} = createJsxFactory()
|
|
1433
|
+
export const ${factoryName} = /* @__PURE__ */ createJsxFactory()
|
|
1393
1434
|
`
|
|
1394
1435
|
};
|
|
1395
1436
|
}
|
|
@@ -1397,7 +1438,7 @@ function generatePreactJsxStringLiteralFactory(ctx) {
|
|
|
1397
1438
|
// src/artifacts/preact-jsx/types.string-literal.ts
|
|
1398
1439
|
var import_outdent18 = require("outdent");
|
|
1399
1440
|
function generatePreactJsxStringLiteralTypes(ctx) {
|
|
1400
|
-
const { factoryName, componentName, upperName, typeName } = ctx.jsx;
|
|
1441
|
+
const { factoryName, styleProps, componentName, upperName, typeName } = ctx.jsx;
|
|
1401
1442
|
return {
|
|
1402
1443
|
jsxFactory: import_outdent18.outdent`
|
|
1403
1444
|
import type { ${upperName} } from '../types/jsx'
|
|
@@ -1421,7 +1462,7 @@ interface JsxFactory {
|
|
|
1421
1462
|
|
|
1422
1463
|
type JsxElements = { [K in keyof JSX.IntrinsicElements]: ${componentName}<K> }
|
|
1423
1464
|
|
|
1424
|
-
export type ${upperName} = JsxFactory & JsxElements
|
|
1465
|
+
export type ${upperName} = JsxFactory ${styleProps === "none" ? "" : "& JsxElements"}
|
|
1425
1466
|
|
|
1426
1467
|
export type ${typeName}<T extends ElementType> = ComponentProps<T>
|
|
1427
1468
|
`
|
|
@@ -1438,45 +1479,45 @@ function generateQwikJsxFactory(ctx) {
|
|
|
1438
1479
|
${ctx.file.import("css, cx, cva, assignCss", "../css/index")}
|
|
1439
1480
|
${ctx.file.import("splitProps, normalizeHTMLProps", "../helpers")}
|
|
1440
1481
|
${ctx.file.import("isCssProperty", "./is-valid-prop")}
|
|
1441
|
-
|
|
1482
|
+
|
|
1442
1483
|
function styledFn(Dynamic, configOrCva = {}) {
|
|
1443
1484
|
const cvaFn = configOrCva.__cva__ || configOrCva.__recipe__ ? configOrCva : cva(configOrCva)
|
|
1444
|
-
|
|
1485
|
+
|
|
1445
1486
|
const ${componentName} = function ${componentName}(props) {
|
|
1446
1487
|
const { as: Element = Dynamic, ...restProps } = props
|
|
1447
|
-
|
|
1448
|
-
const [variantProps, styleProps, htmlProps, elementProps] =
|
|
1488
|
+
|
|
1489
|
+
const [variantProps, styleProps, htmlProps, elementProps] =
|
|
1449
1490
|
splitProps(restProps, cvaFn.variantKeys, isCssProperty, normalizeHTMLProps.keys)
|
|
1450
|
-
|
|
1491
|
+
|
|
1451
1492
|
const { css: cssStyles, ...propStyles } = styleProps
|
|
1452
|
-
|
|
1493
|
+
|
|
1453
1494
|
function recipeClass() {
|
|
1454
1495
|
const styles = assignCss(propStyles, cssStyles)
|
|
1455
1496
|
return cx(cvaFn(variantProps), css(styles), elementProps.class)
|
|
1456
1497
|
}
|
|
1457
|
-
|
|
1498
|
+
|
|
1458
1499
|
function cvaClass() {
|
|
1459
1500
|
const cvaStyles = cvaFn.resolve(variantProps)
|
|
1460
1501
|
const styles = assignCss(cvaStyles, propStyles, cssStyles)
|
|
1461
1502
|
return cx(css(styles), elementProps.class)
|
|
1462
1503
|
}
|
|
1463
|
-
|
|
1504
|
+
|
|
1464
1505
|
const classes = configOrCva.__recipe__ ? recipeClass : cvaClass
|
|
1465
|
-
|
|
1506
|
+
|
|
1466
1507
|
return h(Element, {
|
|
1467
1508
|
...elementProps,
|
|
1468
1509
|
...normalizeHTMLProps(htmlProps),
|
|
1469
1510
|
class: classes(),
|
|
1470
1511
|
})
|
|
1471
1512
|
}
|
|
1472
|
-
|
|
1513
|
+
|
|
1473
1514
|
${componentName}.displayName = \`${factoryName}.\${Dynamic}\`
|
|
1474
1515
|
return ${componentName}
|
|
1475
1516
|
}
|
|
1476
|
-
|
|
1517
|
+
|
|
1477
1518
|
function createJsxFactory() {
|
|
1478
1519
|
const cache = new Map()
|
|
1479
|
-
|
|
1520
|
+
|
|
1480
1521
|
return new Proxy(styledFn, {
|
|
1481
1522
|
apply(_, __, args) {
|
|
1482
1523
|
return styledFn(...args)
|
|
@@ -1490,7 +1531,7 @@ function generateQwikJsxFactory(ctx) {
|
|
|
1490
1531
|
})
|
|
1491
1532
|
}
|
|
1492
1533
|
|
|
1493
|
-
export const ${factoryName} = createJsxFactory()
|
|
1534
|
+
export const ${factoryName} = /* @__PURE__ */ createJsxFactory()
|
|
1494
1535
|
|
|
1495
1536
|
`
|
|
1496
1537
|
};
|
|
@@ -1498,7 +1539,7 @@ function generateQwikJsxFactory(ctx) {
|
|
|
1498
1539
|
|
|
1499
1540
|
// src/artifacts/qwik-jsx/pattern.ts
|
|
1500
1541
|
var import_outdent20 = require("outdent");
|
|
1501
|
-
var
|
|
1542
|
+
var import_ts_pattern5 = require("ts-pattern");
|
|
1502
1543
|
function generateQwikJsxPattern(ctx) {
|
|
1503
1544
|
const { typeName, factoryName } = ctx.jsx;
|
|
1504
1545
|
return ctx.patterns.details.map((pattern) => {
|
|
@@ -1512,7 +1553,7 @@ function generateQwikJsxPattern(ctx) {
|
|
|
1512
1553
|
${ctx.file.import(styleFnName, `../patterns/${dashName}`)}
|
|
1513
1554
|
|
|
1514
1555
|
export const ${jsxName} = function ${jsxName}(props) {
|
|
1515
|
-
${(0,
|
|
1556
|
+
${(0, import_ts_pattern5.match)(props.length).with(
|
|
1516
1557
|
0,
|
|
1517
1558
|
() => import_outdent20.outdent`
|
|
1518
1559
|
const styleProps = ${styleFnName}()
|
|
@@ -1548,7 +1589,7 @@ function generateQwikJsxPattern(ctx) {
|
|
|
1548
1589
|
// src/artifacts/qwik-jsx/types.ts
|
|
1549
1590
|
var import_outdent21 = require("outdent");
|
|
1550
1591
|
function generateQwikJsxTypes(ctx) {
|
|
1551
|
-
const { factoryName, componentName, upperName, typeName } = ctx.jsx;
|
|
1592
|
+
const { factoryName, styleProps, componentName, upperName, typeName } = ctx.jsx;
|
|
1552
1593
|
return {
|
|
1553
1594
|
jsxFactory: import_outdent21.outdent`
|
|
1554
1595
|
import { ${upperName} } from '../types/jsx'
|
|
@@ -1590,7 +1631,7 @@ export type ${componentName}<T extends ElementType, P extends Dict = {}> = Funct
|
|
|
1590
1631
|
type RecipeFn = { __type: any }
|
|
1591
1632
|
|
|
1592
1633
|
interface JsxFactory {
|
|
1593
|
-
|
|
1634
|
+
${styleProps === "none" ? "" : `<T extends ElementType>(component: T): ${componentName}<T, {}>`}
|
|
1594
1635
|
<T extends ElementType, P extends RecipeVariantRecord>(component: T, recipe: RecipeDefinition<P>): ${componentName}<
|
|
1595
1636
|
T,
|
|
1596
1637
|
RecipeSelection<P>
|
|
@@ -1600,7 +1641,7 @@ interface JsxFactory {
|
|
|
1600
1641
|
|
|
1601
1642
|
type JsxElements = { [K in keyof QwikIntrinsicElements]: ${componentName}<K, {}> }
|
|
1602
1643
|
|
|
1603
|
-
export type ${upperName} = JsxFactory & JsxElements
|
|
1644
|
+
export type ${upperName} = JsxFactory ${styleProps === "none" ? "" : "& JsxElements"}
|
|
1604
1645
|
|
|
1605
1646
|
export type ${typeName}<T extends ElementType> = Assign<ComponentProps<T>, JsxStyleProps>
|
|
1606
1647
|
`
|
|
@@ -1615,28 +1656,28 @@ function generateQwikJsxStringLiteralFactory(ctx) {
|
|
|
1615
1656
|
js: import_outdent22.outdent`
|
|
1616
1657
|
import { h } from '@builder.io/qwik'
|
|
1617
1658
|
${ctx.file.import("css, cx", "../css/index")}
|
|
1618
|
-
|
|
1659
|
+
|
|
1619
1660
|
function createStyledFn(Dynamic) {
|
|
1620
1661
|
return function styledFn(template) {
|
|
1621
1662
|
const baseClassName = css(template)
|
|
1622
1663
|
const ${componentName} = function ${componentName}(props) {
|
|
1623
1664
|
const { as: Element = Dynamic, ...elementProps } = props
|
|
1624
1665
|
const classes = () => cx(baseClassName, elementProps.className)
|
|
1625
|
-
|
|
1666
|
+
|
|
1626
1667
|
return h(Element, {
|
|
1627
1668
|
...elementProps,
|
|
1628
1669
|
className: classes(),
|
|
1629
1670
|
})
|
|
1630
1671
|
}
|
|
1631
|
-
|
|
1672
|
+
|
|
1632
1673
|
${componentName}.displayName = \`${factoryName}.\${Dynamic}\`
|
|
1633
1674
|
return ${componentName}
|
|
1634
1675
|
}
|
|
1635
1676
|
}
|
|
1636
|
-
|
|
1677
|
+
|
|
1637
1678
|
function createJsxFactory() {
|
|
1638
1679
|
const cache = new Map()
|
|
1639
|
-
|
|
1680
|
+
|
|
1640
1681
|
return new Proxy(createStyledFn, {
|
|
1641
1682
|
apply(_, __, args) {
|
|
1642
1683
|
return createStyledFn(...args)
|
|
@@ -1650,7 +1691,7 @@ function generateQwikJsxStringLiteralFactory(ctx) {
|
|
|
1650
1691
|
})
|
|
1651
1692
|
}
|
|
1652
1693
|
|
|
1653
|
-
export const ${factoryName} = createJsxFactory()
|
|
1694
|
+
export const ${factoryName} = /* @__PURE__ */ createJsxFactory()
|
|
1654
1695
|
|
|
1655
1696
|
`
|
|
1656
1697
|
};
|
|
@@ -1659,7 +1700,7 @@ function generateQwikJsxStringLiteralFactory(ctx) {
|
|
|
1659
1700
|
// src/artifacts/qwik-jsx/types.string-literal.ts
|
|
1660
1701
|
var import_outdent23 = require("outdent");
|
|
1661
1702
|
function generateQwikJsxStringLiteralTypes(ctx) {
|
|
1662
|
-
const { factoryName, componentName, upperName, typeName } = ctx.jsx;
|
|
1703
|
+
const { factoryName, styleProps, componentName, upperName, typeName } = ctx.jsx;
|
|
1663
1704
|
return {
|
|
1664
1705
|
jsxFactory: import_outdent23.outdent`
|
|
1665
1706
|
import { ${upperName} } from '../types/jsx'
|
|
@@ -1688,7 +1729,7 @@ interface JsxFactory {
|
|
|
1688
1729
|
|
|
1689
1730
|
type JsxElements = { [K in keyof QwikIntrinsicElements]: ${componentName}<K> }
|
|
1690
1731
|
|
|
1691
|
-
export type ${upperName} = JsxFactory & JsxElements
|
|
1732
|
+
export type ${upperName} = JsxFactory ${styleProps === "none" ? "" : "& JsxElements"}
|
|
1692
1733
|
|
|
1693
1734
|
export type ${typeName}<T extends ElementType> = ComponentProps<T>
|
|
1694
1735
|
`
|
|
@@ -1697,6 +1738,7 @@ export type ${typeName}<T extends ElementType> = ComponentProps<T>
|
|
|
1697
1738
|
|
|
1698
1739
|
// src/artifacts/react-jsx/jsx.ts
|
|
1699
1740
|
var import_outdent24 = require("outdent");
|
|
1741
|
+
var import_ts_pattern6 = require("ts-pattern");
|
|
1700
1742
|
function generateReactJsxFactory(ctx) {
|
|
1701
1743
|
const { factoryName, componentName } = ctx.jsx;
|
|
1702
1744
|
return {
|
|
@@ -1704,33 +1746,67 @@ function generateReactJsxFactory(ctx) {
|
|
|
1704
1746
|
import { createElement, forwardRef, useMemo } from 'react'
|
|
1705
1747
|
${ctx.file.import("css, cx, cva, assignCss", "../css/index")}
|
|
1706
1748
|
${ctx.file.import("splitProps, normalizeHTMLProps", "../helpers")}
|
|
1707
|
-
${ctx.file.import("isCssProperty", "./is-valid-prop")}
|
|
1708
|
-
|
|
1749
|
+
${ctx.jsx.styleProps === "all" ? ctx.file.import("isCssProperty", "./is-valid-prop") : ""}
|
|
1750
|
+
|
|
1709
1751
|
function styledFn(Dynamic, configOrCva = {}) {
|
|
1710
1752
|
const cvaFn = configOrCva.__cva__ || configOrCva.__recipe__ ? configOrCva : cva(configOrCva)
|
|
1711
|
-
|
|
1712
|
-
const ${componentName} = forwardRef(function ${componentName}(props, ref) {
|
|
1753
|
+
|
|
1754
|
+
const ${componentName} = /* @__PURE__ */ forwardRef(function ${componentName}(props, ref) {
|
|
1713
1755
|
const { as: Element = Dynamic, ...restProps } = props
|
|
1714
|
-
|
|
1715
|
-
const [variantProps, styleProps, htmlProps, elementProps] = useMemo(() => {
|
|
1716
|
-
return splitProps(restProps, cvaFn.variantKeys, isCssProperty, normalizeHTMLProps.keys)
|
|
1717
|
-
}, [restProps])
|
|
1718
1756
|
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
const
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1757
|
+
${(0, import_ts_pattern6.match)(ctx.jsx.styleProps).with("all", () => {
|
|
1758
|
+
return import_outdent24.outdent`
|
|
1759
|
+
const [variantProps, styleProps, htmlProps, elementProps] = useMemo(() => {
|
|
1760
|
+
return splitProps(restProps, cvaFn.variantKeys, isCssProperty, normalizeHTMLProps.keys)
|
|
1761
|
+
}, [restProps])
|
|
1762
|
+
|
|
1763
|
+
function recipeClass() {
|
|
1764
|
+
const { css: cssStyles, ...propStyles } = styleProps
|
|
1765
|
+
const styles = assignCss(propStyles, cssStyles)
|
|
1766
|
+
return cx(cvaFn(variantProps), css(styles), elementProps.className)
|
|
1767
|
+
}
|
|
1768
|
+
|
|
1769
|
+
function cvaClass() {
|
|
1770
|
+
const { css: cssStyles, ...propStyles } = styleProps
|
|
1771
|
+
const cvaStyles = cvaFn.resolve(variantProps)
|
|
1772
|
+
const styles = assignCss(cvaStyles, propStyles, cssStyles)
|
|
1773
|
+
return cx(css(styles), elementProps.className)
|
|
1774
|
+
}`;
|
|
1775
|
+
}).with("minimal", () => {
|
|
1776
|
+
return import_outdent24.outdent`
|
|
1777
|
+
const [variantProps, htmlProps, elementProps] = useMemo(() => {
|
|
1778
|
+
return splitProps(restProps, cvaFn.variantKeys, normalizeHTMLProps.keys)
|
|
1779
|
+
}, [restProps])
|
|
1780
|
+
|
|
1781
|
+
function recipeClass() {
|
|
1782
|
+
return cx(cvaFn(variantProps), css(assignCss(elementProps.css)), elementProps.className)
|
|
1783
|
+
}
|
|
1784
|
+
|
|
1785
|
+
function cvaClass() {
|
|
1786
|
+
const cvaStyles = cvaFn.resolve(variantProps)
|
|
1787
|
+
const styles = assignCss(cvaStyles, elementProps.css)
|
|
1788
|
+
return cx(css(styles), elementProps.className)
|
|
1789
|
+
}`;
|
|
1790
|
+
}).with("none", () => {
|
|
1791
|
+
return import_outdent24.outdent`
|
|
1792
|
+
const [variantProps, htmlProps, elementProps] = useMemo(() => {
|
|
1793
|
+
return splitProps(restProps, cvaFn.variantKeys, normalizeHTMLProps.keys)
|
|
1794
|
+
}, [restProps])
|
|
1795
|
+
|
|
1796
|
+
function recipeClass() {
|
|
1797
|
+
return cx(cvaFn(variantProps), elementProps.className)
|
|
1798
|
+
}
|
|
1799
|
+
|
|
1800
|
+
function cvaClass() {
|
|
1801
|
+
const cvaStyles = cvaFn.resolve(variantProps)
|
|
1802
|
+
const styles = assignCss(cvaStyles)
|
|
1803
|
+
return cx(css(styles), elementProps.className)
|
|
1804
|
+
}`;
|
|
1805
|
+
}).run()}
|
|
1806
|
+
|
|
1807
|
+
|
|
1732
1808
|
const classes = configOrCva.__recipe__ ? recipeClass : cvaClass
|
|
1733
|
-
|
|
1809
|
+
|
|
1734
1810
|
return createElement(Element, {
|
|
1735
1811
|
ref,
|
|
1736
1812
|
...elementProps,
|
|
@@ -1738,14 +1814,14 @@ function generateReactJsxFactory(ctx) {
|
|
|
1738
1814
|
className: classes(),
|
|
1739
1815
|
})
|
|
1740
1816
|
})
|
|
1741
|
-
|
|
1817
|
+
|
|
1742
1818
|
${componentName}.displayName = \`${factoryName}.\${Dynamic}\`
|
|
1743
1819
|
return ${componentName}
|
|
1744
1820
|
}
|
|
1745
|
-
|
|
1821
|
+
|
|
1746
1822
|
function createJsxFactory() {
|
|
1747
1823
|
const cache = new Map()
|
|
1748
|
-
|
|
1824
|
+
|
|
1749
1825
|
return new Proxy(styledFn, {
|
|
1750
1826
|
apply(_, __, args) {
|
|
1751
1827
|
return styledFn(...args)
|
|
@@ -1759,7 +1835,7 @@ function generateReactJsxFactory(ctx) {
|
|
|
1759
1835
|
})
|
|
1760
1836
|
}
|
|
1761
1837
|
|
|
1762
|
-
export const ${factoryName} = createJsxFactory()
|
|
1838
|
+
export const ${factoryName} = /* @__PURE__ */ createJsxFactory()
|
|
1763
1839
|
|
|
1764
1840
|
`
|
|
1765
1841
|
};
|
|
@@ -1767,7 +1843,7 @@ function generateReactJsxFactory(ctx) {
|
|
|
1767
1843
|
|
|
1768
1844
|
// src/artifacts/react-jsx/pattern.ts
|
|
1769
1845
|
var import_outdent25 = require("outdent");
|
|
1770
|
-
var
|
|
1846
|
+
var import_ts_pattern7 = require("ts-pattern");
|
|
1771
1847
|
function generateReactJsxPattern(ctx) {
|
|
1772
1848
|
const { typeName, factoryName } = ctx.jsx;
|
|
1773
1849
|
return ctx.patterns.details.map((pattern) => {
|
|
@@ -1779,9 +1855,9 @@ function generateReactJsxPattern(ctx) {
|
|
|
1779
1855
|
import { createElement, forwardRef } from 'react'
|
|
1780
1856
|
${ctx.file.import(factoryName, "./factory")}
|
|
1781
1857
|
${ctx.file.import(styleFnName, `../patterns/${dashName}`)}
|
|
1782
|
-
|
|
1783
|
-
export const ${jsxName} = forwardRef(function ${jsxName}(props, ref) {
|
|
1784
|
-
${(0,
|
|
1858
|
+
|
|
1859
|
+
export const ${jsxName} = /* @__PURE__ */ forwardRef(function ${jsxName}(props, ref) {
|
|
1860
|
+
${(0, import_ts_pattern7.match)(props.length).with(
|
|
1785
1861
|
0,
|
|
1786
1862
|
() => import_outdent25.outdent`
|
|
1787
1863
|
const styleProps = ${styleFnName}()
|
|
@@ -1794,15 +1870,15 @@ function generateReactJsxPattern(ctx) {
|
|
|
1794
1870
|
return createElement(${factoryName}.${jsxElement}, { ref, ...styleProps, ...restProps })
|
|
1795
1871
|
`
|
|
1796
1872
|
)}
|
|
1797
|
-
})
|
|
1873
|
+
})
|
|
1798
1874
|
`,
|
|
1799
1875
|
dts: import_outdent25.outdent`
|
|
1800
1876
|
import type { FunctionComponent } from 'react'
|
|
1801
1877
|
import type { ${upperName}Properties } from '../patterns/${dashName}'
|
|
1802
1878
|
import type { ${typeName} } from '../types/jsx'
|
|
1803
|
-
|
|
1879
|
+
|
|
1804
1880
|
export type ${upperName}Props = ${upperName}Properties & Omit<${typeName}<'${jsxElement}'>, keyof ${upperName}Properties ${blocklistType}>
|
|
1805
|
-
|
|
1881
|
+
|
|
1806
1882
|
${description ? `/** ${description} */` : ""}
|
|
1807
1883
|
export declare const ${jsxName}: FunctionComponent<${upperName}Props>
|
|
1808
1884
|
`
|
|
@@ -1813,7 +1889,7 @@ function generateReactJsxPattern(ctx) {
|
|
|
1813
1889
|
// src/artifacts/react-jsx/types.ts
|
|
1814
1890
|
var import_outdent26 = require("outdent");
|
|
1815
1891
|
function generateReactJsxTypes(ctx) {
|
|
1816
|
-
const { factoryName, componentName, upperName, typeName } = ctx.jsx;
|
|
1892
|
+
const { factoryName, styleProps, componentName, upperName, typeName } = ctx.jsx;
|
|
1817
1893
|
return {
|
|
1818
1894
|
jsxFactory: import_outdent26.outdent`
|
|
1819
1895
|
import { ${upperName} } from '../types/jsx'
|
|
@@ -1838,7 +1914,7 @@ export type ${componentName}<T extends ElementType, P extends Dict = {}> = {
|
|
|
1838
1914
|
type RecipeFn = { __type: any }
|
|
1839
1915
|
|
|
1840
1916
|
interface JsxFactory {
|
|
1841
|
-
|
|
1917
|
+
${styleProps === "none" ? "" : `<T extends ElementType>(component: T): ${componentName}<T, {}>`}
|
|
1842
1918
|
<T extends ElementType, P extends RecipeVariantRecord>(component: T, recipe: RecipeDefinition<P>): ${componentName}<
|
|
1843
1919
|
T,
|
|
1844
1920
|
RecipeSelection<P>
|
|
@@ -1848,7 +1924,7 @@ interface JsxFactory {
|
|
|
1848
1924
|
|
|
1849
1925
|
type JsxElements = { [K in keyof JSX.IntrinsicElements]: ${componentName}<K, {}> }
|
|
1850
1926
|
|
|
1851
|
-
export type ${upperName} = JsxFactory & JsxElements
|
|
1927
|
+
export type ${upperName} = JsxFactory ${styleProps === "none" ? "" : "& JsxElements"}
|
|
1852
1928
|
|
|
1853
1929
|
export type ${typeName}<T extends ElementType> = JsxHTMLProps<ComponentProps<T>, JsxStyleProps>
|
|
1854
1930
|
`
|
|
@@ -1863,29 +1939,29 @@ function generateReactJsxStringLiteralFactory(ctx) {
|
|
|
1863
1939
|
js: import_outdent27.outdent`
|
|
1864
1940
|
import { createElement, forwardRef } from 'react'
|
|
1865
1941
|
${ctx.file.import("css, cx", "../css/index")}
|
|
1866
|
-
|
|
1942
|
+
|
|
1867
1943
|
function createStyledFn(Dynamic) {
|
|
1868
1944
|
return function styledFn(template) {
|
|
1869
1945
|
const baseClassName = css(template)
|
|
1870
|
-
const ${componentName} = forwardRef(function ${componentName}(props, ref) {
|
|
1946
|
+
const ${componentName} = /* @__PURE__ */ forwardRef(function ${componentName}(props, ref) {
|
|
1871
1947
|
const { as: Element = Dynamic, ...elementProps } = props
|
|
1872
1948
|
const classes = () => cx(baseClassName, elementProps.className)
|
|
1873
|
-
|
|
1949
|
+
|
|
1874
1950
|
return createElement(Element, {
|
|
1875
1951
|
ref,
|
|
1876
1952
|
...elementProps,
|
|
1877
1953
|
className: classes(),
|
|
1878
1954
|
})
|
|
1879
1955
|
})
|
|
1880
|
-
|
|
1956
|
+
|
|
1881
1957
|
${componentName}.displayName = \`${factoryName}.\${Dynamic}\`
|
|
1882
1958
|
return ${componentName}
|
|
1883
1959
|
}
|
|
1884
1960
|
}
|
|
1885
|
-
|
|
1961
|
+
|
|
1886
1962
|
function createJsxFactory() {
|
|
1887
1963
|
const cache = new Map()
|
|
1888
|
-
|
|
1964
|
+
|
|
1889
1965
|
return new Proxy(createStyledFn, {
|
|
1890
1966
|
apply(_, __, args) {
|
|
1891
1967
|
return createStyledFn(...args)
|
|
@@ -1899,7 +1975,7 @@ function generateReactJsxStringLiteralFactory(ctx) {
|
|
|
1899
1975
|
})
|
|
1900
1976
|
}
|
|
1901
1977
|
|
|
1902
|
-
export const ${factoryName} = createJsxFactory()
|
|
1978
|
+
export const ${factoryName} = /* @__PURE__ */ createJsxFactory()
|
|
1903
1979
|
|
|
1904
1980
|
`
|
|
1905
1981
|
};
|
|
@@ -1908,7 +1984,7 @@ function generateReactJsxStringLiteralFactory(ctx) {
|
|
|
1908
1984
|
// src/artifacts/react-jsx/types.string-literal.ts
|
|
1909
1985
|
var import_outdent28 = require("outdent");
|
|
1910
1986
|
function generateReactJsxStringLiteralTypes(ctx) {
|
|
1911
|
-
const { factoryName, componentName, upperName, typeName } = ctx.jsx;
|
|
1987
|
+
const { factoryName, styleProps, componentName, upperName, typeName } = ctx.jsx;
|
|
1912
1988
|
return {
|
|
1913
1989
|
jsxFactory: import_outdent28.outdent`
|
|
1914
1990
|
import { ${upperName} } from '../types/jsx'
|
|
@@ -1934,7 +2010,7 @@ interface JsxFactory {
|
|
|
1934
2010
|
|
|
1935
2011
|
type JsxElements = { [K in keyof JSX.IntrinsicElements]: ${componentName}<K> }
|
|
1936
2012
|
|
|
1937
|
-
export type ${upperName} = JsxFactory & JsxElements
|
|
2013
|
+
export type ${upperName} = JsxFactory ${styleProps === "none" ? "" : "& JsxElements"}
|
|
1938
2014
|
|
|
1939
2015
|
export type ${typeName}<T extends ElementType> = ComponentProps<T>
|
|
1940
2016
|
`
|
|
@@ -1953,13 +2029,13 @@ function generateSolidJsxFactory(ctx) {
|
|
|
1953
2029
|
${ctx.file.import("css, cx, cva, assignCss", "../css/index")}
|
|
1954
2030
|
${ctx.file.import("normalizeHTMLProps", "../helpers")}
|
|
1955
2031
|
${ctx.file.import("allCssProperties", "./is-valid-prop")}
|
|
1956
|
-
|
|
2032
|
+
|
|
1957
2033
|
function styledFn(element, configOrCva = {}) {
|
|
1958
2034
|
const cvaFn = configOrCva.__cva__ ? configOrCva : cva(configOrCva)
|
|
1959
|
-
|
|
2035
|
+
|
|
1960
2036
|
return function ${componentName}(props) {
|
|
1961
2037
|
const mergedProps = mergeProps({ as: element }, props)
|
|
1962
|
-
|
|
2038
|
+
|
|
1963
2039
|
const [localProps, variantProps, styleProps, htmlProps, elementProps] = splitProps(
|
|
1964
2040
|
mergedProps,
|
|
1965
2041
|
['as', 'class'],
|
|
@@ -1973,16 +2049,16 @@ function generateSolidJsxFactory(ctx) {
|
|
|
1973
2049
|
const styles = assignCss(propStyles, cssStyles)
|
|
1974
2050
|
return cx(cvaFn(variantProps), css(styles), localProps.class)
|
|
1975
2051
|
}
|
|
1976
|
-
|
|
2052
|
+
|
|
1977
2053
|
function cvaClass() {
|
|
1978
2054
|
const { css: cssStyles, ...propStyles } = styleProps
|
|
1979
2055
|
const cvaStyles = cvaFn.resolve(variantProps)
|
|
1980
2056
|
const styles = assignCss(cvaStyles, propStyles, cssStyles)
|
|
1981
2057
|
return cx(css(styles), localProps.class)
|
|
1982
2058
|
}
|
|
1983
|
-
|
|
2059
|
+
|
|
1984
2060
|
const classes = configOrCva.__recipe__ ? recipeClass : cvaClass
|
|
1985
|
-
|
|
2061
|
+
|
|
1986
2062
|
return createComponent(
|
|
1987
2063
|
Dynamic,
|
|
1988
2064
|
mergeProps(
|
|
@@ -2000,10 +2076,10 @@ function generateSolidJsxFactory(ctx) {
|
|
|
2000
2076
|
)
|
|
2001
2077
|
}
|
|
2002
2078
|
}
|
|
2003
|
-
|
|
2079
|
+
|
|
2004
2080
|
function createJsxFactory() {
|
|
2005
2081
|
const cache = new Map()
|
|
2006
|
-
|
|
2082
|
+
|
|
2007
2083
|
return new Proxy(styledFn, {
|
|
2008
2084
|
apply(_, __, args) {
|
|
2009
2085
|
return styledFn(...args)
|
|
@@ -2016,15 +2092,15 @@ function generateSolidJsxFactory(ctx) {
|
|
|
2016
2092
|
},
|
|
2017
2093
|
})
|
|
2018
2094
|
}
|
|
2019
|
-
|
|
2020
|
-
export const ${factoryName} = createJsxFactory()
|
|
2095
|
+
|
|
2096
|
+
export const ${factoryName} = /* @__PURE__ */ createJsxFactory()
|
|
2021
2097
|
`
|
|
2022
2098
|
};
|
|
2023
2099
|
}
|
|
2024
2100
|
|
|
2025
2101
|
// src/artifacts/solid-jsx/pattern.ts
|
|
2026
2102
|
var import_outdent30 = require("outdent");
|
|
2027
|
-
var
|
|
2103
|
+
var import_ts_pattern8 = require("ts-pattern");
|
|
2028
2104
|
function generateSolidJsxPattern(ctx) {
|
|
2029
2105
|
const { typeName, factoryName } = ctx.jsx;
|
|
2030
2106
|
return ctx.patterns.details.map((pattern) => {
|
|
@@ -2039,7 +2115,7 @@ function generateSolidJsxPattern(ctx) {
|
|
|
2039
2115
|
${ctx.file.import(styleFnName, `../patterns/${dashName}`)}
|
|
2040
2116
|
|
|
2041
2117
|
export function ${jsxName}(props) {
|
|
2042
|
-
${(0,
|
|
2118
|
+
${(0, import_ts_pattern8.match)(props.length).with(
|
|
2043
2119
|
0,
|
|
2044
2120
|
() => import_outdent30.outdent`
|
|
2045
2121
|
const styleProps = ${styleFnName}()
|
|
@@ -2071,7 +2147,7 @@ function generateSolidJsxPattern(ctx) {
|
|
|
2071
2147
|
// src/artifacts/solid-jsx/types.ts
|
|
2072
2148
|
var import_outdent31 = require("outdent");
|
|
2073
2149
|
function generateSolidJsxTypes(ctx) {
|
|
2074
|
-
const { factoryName, componentName, upperName, typeName } = ctx.jsx;
|
|
2150
|
+
const { factoryName, styleProps, componentName, upperName, typeName } = ctx.jsx;
|
|
2075
2151
|
return {
|
|
2076
2152
|
jsxFactory: import_outdent31.outdent`
|
|
2077
2153
|
import type { ${upperName} } from '../types/jsx'
|
|
@@ -2094,7 +2170,7 @@ export type ${componentName}<T extends ElementType, P extends Dict = {}> = {
|
|
|
2094
2170
|
type RecipeFn = { __type: any }
|
|
2095
2171
|
|
|
2096
2172
|
interface JsxFactory {
|
|
2097
|
-
|
|
2173
|
+
${styleProps === "none" ? "" : `<T extends ElementType>(component: T): ${componentName}<T, {}>`}
|
|
2098
2174
|
<T extends ElementType, P extends RecipeVariantRecord>(component: T, recipe: RecipeDefinition<P>): ${componentName}<
|
|
2099
2175
|
T,
|
|
2100
2176
|
RecipeSelection<P>
|
|
@@ -2104,7 +2180,7 @@ interface JsxFactory {
|
|
|
2104
2180
|
|
|
2105
2181
|
type JsxElements = { [K in keyof JSX.IntrinsicElements]: ${componentName}<K, {}> }
|
|
2106
2182
|
|
|
2107
|
-
export type ${upperName} = JsxFactory & JsxElements
|
|
2183
|
+
export type ${upperName} = JsxFactory ${styleProps === "none" ? "" : "& JsxElements"}
|
|
2108
2184
|
|
|
2109
2185
|
export type ${typeName}<T extends ElementType> = JsxHTMLProps<ComponentProps<T>, JsxStyleProps>
|
|
2110
2186
|
`
|
|
@@ -2127,7 +2203,7 @@ function createStyled(element) {
|
|
|
2127
2203
|
return function ${componentName}(props) {
|
|
2128
2204
|
const mergedProps = mergeProps({ as: element }, props)
|
|
2129
2205
|
const [localProps, elementProps] = splitProps(mergedProps, ['as', 'class'])
|
|
2130
|
-
|
|
2206
|
+
|
|
2131
2207
|
return createComponent(
|
|
2132
2208
|
Dynamic,
|
|
2133
2209
|
mergeProps(
|
|
@@ -2162,7 +2238,7 @@ function createJsxFactory() {
|
|
|
2162
2238
|
})
|
|
2163
2239
|
}
|
|
2164
2240
|
|
|
2165
|
-
export const ${factoryName} = createJsxFactory()
|
|
2241
|
+
export const ${factoryName} = /* @__PURE__ */ createJsxFactory()
|
|
2166
2242
|
`
|
|
2167
2243
|
};
|
|
2168
2244
|
}
|
|
@@ -2170,7 +2246,7 @@ export const ${factoryName} = createJsxFactory()
|
|
|
2170
2246
|
// src/artifacts/solid-jsx/types.string-literal.ts
|
|
2171
2247
|
var import_outdent33 = require("outdent");
|
|
2172
2248
|
function generateSolidJsxStringLiteralTypes(ctx) {
|
|
2173
|
-
const { factoryName, componentName, upperName, typeName } = ctx.jsx;
|
|
2249
|
+
const { factoryName, styleProps, componentName, upperName, typeName } = ctx.jsx;
|
|
2174
2250
|
return {
|
|
2175
2251
|
jsxFactory: import_outdent33.outdent`
|
|
2176
2252
|
import type { ${upperName} } from '../types/jsx'
|
|
@@ -2194,7 +2270,7 @@ interface JsxFactory {
|
|
|
2194
2270
|
|
|
2195
2271
|
type JsxElements = { [K in keyof JSX.IntrinsicElements]: ${componentName}<K> }
|
|
2196
2272
|
|
|
2197
|
-
export type
|
|
2273
|
+
export type ${upperName} = JsxFactory ${styleProps === "none" ? "" : "& JsxElements"}
|
|
2198
2274
|
|
|
2199
2275
|
export type ${typeName}<T extends ElementType> = ComponentProps<T>
|
|
2200
2276
|
`
|
|
@@ -2211,7 +2287,7 @@ function generateVueJsxFactory(ctx) {
|
|
|
2211
2287
|
${ctx.file.import("css, cx, cva, assignCss", "../css/index")}
|
|
2212
2288
|
${ctx.file.import("splitProps, normalizeHTMLProps", "../helpers")}
|
|
2213
2289
|
${ctx.file.import("isCssProperty", "./is-valid-prop")}
|
|
2214
|
-
|
|
2290
|
+
|
|
2215
2291
|
function styledFn(Dynamic, configOrCva = {}) {
|
|
2216
2292
|
const cvaFn = configOrCva.__cva__ || configOrCva.__recipe__ ? configOrCva : cva(configOrCva)
|
|
2217
2293
|
|
|
@@ -2239,10 +2315,10 @@ function generateVueJsxFactory(ctx) {
|
|
|
2239
2315
|
})
|
|
2240
2316
|
|
|
2241
2317
|
const classes = configOrCva.__recipe__ ? recipeClass : cvaClass
|
|
2242
|
-
|
|
2318
|
+
|
|
2243
2319
|
return () => {
|
|
2244
2320
|
const [_styleProps, _variantProps, htmlProps, elementProps] = splittedProps.value
|
|
2245
|
-
|
|
2321
|
+
|
|
2246
2322
|
return h(
|
|
2247
2323
|
props.as,
|
|
2248
2324
|
{
|
|
@@ -2256,10 +2332,10 @@ function generateVueJsxFactory(ctx) {
|
|
|
2256
2332
|
},
|
|
2257
2333
|
})
|
|
2258
2334
|
}
|
|
2259
|
-
|
|
2335
|
+
|
|
2260
2336
|
function createJsxFactory() {
|
|
2261
2337
|
const cache = new Map()
|
|
2262
|
-
|
|
2338
|
+
|
|
2263
2339
|
return new Proxy(styledFn, {
|
|
2264
2340
|
apply(_, __, args) {
|
|
2265
2341
|
return styledFn(...args)
|
|
@@ -2273,7 +2349,7 @@ function generateVueJsxFactory(ctx) {
|
|
|
2273
2349
|
})
|
|
2274
2350
|
}
|
|
2275
2351
|
|
|
2276
|
-
export const ${factoryName} = createJsxFactory()
|
|
2352
|
+
export const ${factoryName} = /* @__PURE__ */ createJsxFactory()
|
|
2277
2353
|
|
|
2278
2354
|
`
|
|
2279
2355
|
};
|
|
@@ -2287,7 +2363,7 @@ function generateVueJsxStringLiteralFactory(ctx) {
|
|
|
2287
2363
|
js: import_outdent35.outdent`
|
|
2288
2364
|
import { defineComponent, h, computed } from 'vue'
|
|
2289
2365
|
${ctx.file.import("css, cx", "../css/index")}
|
|
2290
|
-
|
|
2366
|
+
|
|
2291
2367
|
function createStyled(Dynamic) {
|
|
2292
2368
|
function styledFn(template) {
|
|
2293
2369
|
const baseClassName = css(template)
|
|
@@ -2311,10 +2387,10 @@ function generateVueJsxStringLiteralFactory(ctx) {
|
|
|
2311
2387
|
})
|
|
2312
2388
|
}
|
|
2313
2389
|
}
|
|
2314
|
-
|
|
2390
|
+
|
|
2315
2391
|
function createJsxFactory() {
|
|
2316
2392
|
const cache = new Map()
|
|
2317
|
-
|
|
2393
|
+
|
|
2318
2394
|
return new Proxy(createStyled, {
|
|
2319
2395
|
apply(_, __, args) {
|
|
2320
2396
|
return createStyled(...args)
|
|
@@ -2328,7 +2404,7 @@ function generateVueJsxStringLiteralFactory(ctx) {
|
|
|
2328
2404
|
})
|
|
2329
2405
|
}
|
|
2330
2406
|
|
|
2331
|
-
export const ${factoryName} = createJsxFactory()
|
|
2407
|
+
export const ${factoryName} = /* @__PURE__ */ createJsxFactory()
|
|
2332
2408
|
`
|
|
2333
2409
|
};
|
|
2334
2410
|
}
|
|
@@ -2378,7 +2454,7 @@ function generateVueJsxPattern(ctx) {
|
|
|
2378
2454
|
// src/artifacts/vue-jsx/types.ts
|
|
2379
2455
|
var import_outdent37 = require("outdent");
|
|
2380
2456
|
function generateVueJsxTypes(ctx) {
|
|
2381
|
-
const { factoryName, componentName, upperName, typeName } = ctx.jsx;
|
|
2457
|
+
const { factoryName, styleProps, componentName, upperName, typeName } = ctx.jsx;
|
|
2382
2458
|
return {
|
|
2383
2459
|
jsxFactory: import_outdent37.outdent`
|
|
2384
2460
|
import { ${upperName} } from '../types/jsx'
|
|
@@ -2523,18 +2599,18 @@ type IntrinsicElement =
|
|
|
2523
2599
|
type RecipeFn = { __type: any }
|
|
2524
2600
|
|
|
2525
2601
|
interface JsxFactory {
|
|
2526
|
-
|
|
2602
|
+
${styleProps === "none" ? "" : `<T extends ElementType>(component: T): ${componentName}<T, {}>`}
|
|
2527
2603
|
<T extends ElementType, P extends RecipeVariantRecord>(component: T, recipe: RecipeDefinition<P>): ${componentName}<
|
|
2528
2604
|
T,
|
|
2529
2605
|
RecipeSelection<P>
|
|
2530
2606
|
>
|
|
2531
2607
|
<T extends ElementType, P extends RecipeFn>(component: T, recipeFn: P): ${componentName}<T, P['__type']>
|
|
2532
2608
|
}
|
|
2533
|
-
|
|
2609
|
+
|
|
2534
2610
|
type JsxElements = { [K in keyof JSX.IntrinsicElements]: ${componentName}<K, {}> }
|
|
2535
|
-
|
|
2536
|
-
export type ${upperName} = JsxFactory & JsxElements
|
|
2537
|
-
|
|
2611
|
+
|
|
2612
|
+
export type ${upperName} = JsxFactory ${styleProps === "none" ? "" : "& JsxElements"}
|
|
2613
|
+
|
|
2538
2614
|
export type ${typeName}<T extends ElementType> = JsxHTMLProps<ComponentProps<T>, JsxStyleProps>
|
|
2539
2615
|
`
|
|
2540
2616
|
};
|
|
@@ -2543,7 +2619,7 @@ type IntrinsicElement =
|
|
|
2543
2619
|
// src/artifacts/vue-jsx/types.string-literal.ts
|
|
2544
2620
|
var import_outdent38 = require("outdent");
|
|
2545
2621
|
function generateVueJsxStringLiteralTypes(ctx) {
|
|
2546
|
-
const { factoryName, componentName, upperName, typeName } = ctx.jsx;
|
|
2622
|
+
const { factoryName, styleProps, componentName, upperName, typeName } = ctx.jsx;
|
|
2547
2623
|
return {
|
|
2548
2624
|
jsxFactory: import_outdent38.outdent`
|
|
2549
2625
|
import { ${upperName} } from '../types/jsx'
|
|
@@ -2685,11 +2761,11 @@ type IntrinsicElement =
|
|
|
2685
2761
|
interface JsxFactory {
|
|
2686
2762
|
<T extends ElementType>(component: T): ${componentName}<T>
|
|
2687
2763
|
}
|
|
2688
|
-
|
|
2764
|
+
|
|
2689
2765
|
type JsxElements = { [K in keyof JSX.IntrinsicElements]: ${componentName}<K> }
|
|
2690
|
-
|
|
2691
|
-
export type ${upperName} = JsxFactory & JsxElements
|
|
2692
|
-
|
|
2766
|
+
|
|
2767
|
+
export type ${upperName} = JsxFactory ${styleProps === "none" ? "" : "& JsxElements"}
|
|
2768
|
+
|
|
2693
2769
|
export type ${typeName}<T extends ElementType> = ComponentProps<T>
|
|
2694
2770
|
`
|
|
2695
2771
|
};
|
|
@@ -2704,8 +2780,8 @@ var typesMap = {
|
|
|
2704
2780
|
qwik: generateQwikJsxTypes
|
|
2705
2781
|
};
|
|
2706
2782
|
var typesStringLiteralMap = {
|
|
2707
|
-
react:
|
|
2708
|
-
solid:
|
|
2783
|
+
react: generateReactJsxStringLiteralTypes,
|
|
2784
|
+
solid: generateSolidJsxStringLiteralTypes,
|
|
2709
2785
|
qwik: generateQwikJsxStringLiteralTypes,
|
|
2710
2786
|
preact: generatePreactJsxStringLiteralTypes,
|
|
2711
2787
|
vue: generateVueJsxStringLiteralTypes
|
|
@@ -2803,7 +2879,7 @@ var csstype_d_ts_default = {
|
|
|
2803
2879
|
|
|
2804
2880
|
// src/artifacts/generated/system-types.d.ts.json
|
|
2805
2881
|
var system_types_d_ts_default = {
|
|
2806
|
-
content: "import type { ConditionalValue, Conditions, Nested } from './conditions'\nimport type { PropertiesFallback } from './csstype'\nimport type { SystemProperties, CssVarProperties } from './style-props'\n\ntype String = string & {}\ntype Number = number & {}\n\n/* -----------------------------------------------------------------------------\n * Native css properties\n * -----------------------------------------------------------------------------*/\n\nexport type CssProperty = keyof PropertiesFallback\n\nexport type CssProperties = PropertiesFallback<String | Number> & CssVarProperties\n\nexport type CssKeyframes = {\n [name: string]: {\n [time: string]: CssProperties\n }\n}\n\n/* -----------------------------------------------------------------------------\n * Conditional css properties\n * -----------------------------------------------------------------------------*/\n\ntype MinimalNested<P> = {\n [K in keyof Conditions]?: Nested<P>\n}\n\ntype GenericProperties = {\n [key: string]: ConditionalValue<String | Number | boolean>\n}\n\n/* -----------------------------------------------------------------------------\n * Native css props\n * -----------------------------------------------------------------------------*/\n\nexport type NestedCssProperties = Nested<CssProperties>\n\nexport type SystemStyleObject = Nested<SystemProperties & CssVarProperties>\n\nexport type GlobalStyleObject = {\n [selector: string]: SystemStyleObject\n}\n\nexport type CompositionStyleObject<Property extends string> = Nested<{\n [K in Property]?: K extends keyof SystemStyleObject ? SystemStyleObject[K] : unknown\n}>\n\n/* -----------------------------------------------------------------------------\n * Jsx style props\n * -----------------------------------------------------------------------------*/\n\nexport type JsxStyleProps =
|
|
2882
|
+
content: "import type { ConditionalValue, Conditions, Nested } from './conditions'\nimport type { PropertiesFallback } from './csstype'\nimport type { SystemProperties, CssVarProperties } from './style-props'\n\ntype String = string & {}\ntype Number = number & {}\n\n/* -----------------------------------------------------------------------------\n * Native css properties\n * -----------------------------------------------------------------------------*/\n\nexport type CssProperty = keyof PropertiesFallback\n\nexport type CssProperties = PropertiesFallback<String | Number> & CssVarProperties\n\nexport type CssKeyframes = {\n [name: string]: {\n [time: string]: CssProperties\n }\n}\n\n/* -----------------------------------------------------------------------------\n * Conditional css properties\n * -----------------------------------------------------------------------------*/\n\ntype MinimalNested<P> = {\n [K in keyof Conditions]?: Nested<P>\n}\n\ntype GenericProperties = {\n [key: string]: ConditionalValue<String | Number | boolean>\n}\n\n/* -----------------------------------------------------------------------------\n * Native css props\n * -----------------------------------------------------------------------------*/\n\nexport type NestedCssProperties = Nested<CssProperties>\n\nexport type SystemStyleObject = Nested<SystemProperties & CssVarProperties>\n\nexport type GlobalStyleObject = {\n [selector: string]: SystemStyleObject\n}\n\nexport type CompositionStyleObject<Property extends string> = Nested<{\n [K in Property]?: K extends keyof SystemStyleObject ? SystemStyleObject[K] : unknown\n}>\n\n/* -----------------------------------------------------------------------------\n * Jsx style props\n * -----------------------------------------------------------------------------*/\ntype WithCss = { css?: SystemStyleObject }\ntype StyleProps = SystemProperties & MinimalNested<SystemStyleObject>\n\nexport type JsxStyleProps = StyleProps & WithCss\n\nexport type Assign<T, U> = Omit<T, keyof U> & U\n\nexport type PatchedHTMLProps = {\n htmlSize?: string | number\n htmlWidth?: string | number\n htmlHeight?: string | number\n htmlTranslate?: 'yes' | 'no' | undefined\n htmlContent?: string\n}\n\nexport type OmittedHTMLProps = 'color' | 'translate' | 'transition' | 'width' | 'height' | 'size' | 'content'\n\ntype WithHTMLProps<T> = Omit<T, OmittedHTMLProps> & PatchedHTMLProps\n\nexport type JsxHTMLProps<T extends Record<string, any>, P extends Record<string, any> = {}> = Assign<\n WithHTMLProps<T>,\n P\n>\n"
|
|
2807
2883
|
};
|
|
2808
2884
|
|
|
2809
2885
|
// src/artifacts/generated/composition.d.ts.json
|
|
@@ -2813,7 +2889,7 @@ var composition_d_ts_default = {
|
|
|
2813
2889
|
|
|
2814
2890
|
// src/artifacts/generated/recipe.d.ts.json
|
|
2815
2891
|
var recipe_d_ts_default = {
|
|
2816
|
-
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
|
|
2892
|
+
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<\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 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"
|
|
2817
2893
|
};
|
|
2818
2894
|
|
|
2819
2895
|
// src/artifacts/generated/pattern.d.ts.json
|
|
@@ -2832,7 +2908,9 @@ var selectors_d_ts_default = {
|
|
|
2832
2908
|
};
|
|
2833
2909
|
|
|
2834
2910
|
// src/artifacts/types/generated.ts
|
|
2835
|
-
|
|
2911
|
+
var import_ts_pattern9 = require("ts-pattern");
|
|
2912
|
+
var jsxStyleProps = "export type JsxStyleProps = StyleProps & WithCss";
|
|
2913
|
+
function getGeneratedTypes(ctx) {
|
|
2836
2914
|
return {
|
|
2837
2915
|
cssType: csstype_d_ts_default.content,
|
|
2838
2916
|
recipe: recipe_d_ts_default.content,
|
|
@@ -2840,7 +2918,7 @@ function getGeneratedTypes() {
|
|
|
2840
2918
|
parts: parts_d_ts_default.content,
|
|
2841
2919
|
composition: composition_d_ts_default.content,
|
|
2842
2920
|
selectors: selectors_d_ts_default.content,
|
|
2843
|
-
system: system_types_d_ts_default.content
|
|
2921
|
+
system: (0, import_ts_pattern9.match)(ctx.jsx.styleProps).with("all", () => system_types_d_ts_default.content).with("minimal", () => system_types_d_ts_default.content.replace(jsxStyleProps, "export type JsxStyleProps = WithCss")).with("none", () => system_types_d_ts_default.content.replace(jsxStyleProps, "export type JsxStyleProps = {}")).exhaustive()
|
|
2844
2922
|
};
|
|
2845
2923
|
}
|
|
2846
2924
|
|
|
@@ -2923,7 +3001,7 @@ function generatePropTypes(ctx) {
|
|
|
2923
3001
|
var import_is_valid_prop = require("@pandacss/is-valid-prop");
|
|
2924
3002
|
var import_outdent41 = __toESM(require("outdent"));
|
|
2925
3003
|
function generateStyleProps(ctx) {
|
|
2926
|
-
const props = new Set(import_is_valid_prop.allCssProperties.concat(ctx.utility.keys()));
|
|
3004
|
+
const props = new Set(import_is_valid_prop.allCssProperties.concat(ctx.utility.keys()).filter(Boolean));
|
|
2927
3005
|
return import_outdent41.default`
|
|
2928
3006
|
import type { ConditionalValue } from './conditions'
|
|
2929
3007
|
import type { PropertyValue } from './prop-type'
|
|
@@ -2991,7 +3069,7 @@ function generateTokenTypes(ctx) {
|
|
|
2991
3069
|
|
|
2992
3070
|
// src/artifacts/index.ts
|
|
2993
3071
|
function setupHelpers(ctx) {
|
|
2994
|
-
const code = generateHelpers();
|
|
3072
|
+
const code = generateHelpers(ctx);
|
|
2995
3073
|
return {
|
|
2996
3074
|
files: [{ file: ctx.file.ext("helpers"), code: code.js }]
|
|
2997
3075
|
};
|
|
@@ -3019,7 +3097,7 @@ function setupDesignTokens(ctx) {
|
|
|
3019
3097
|
};
|
|
3020
3098
|
}
|
|
3021
3099
|
function setupTypes(ctx) {
|
|
3022
|
-
const gen = getGeneratedTypes();
|
|
3100
|
+
const gen = getGeneratedTypes(ctx);
|
|
3023
3101
|
const conditions = generateConditions(ctx);
|
|
3024
3102
|
const jsx = generateJsxTypes(ctx);
|
|
3025
3103
|
const entry = generateTypesEntry();
|
|
@@ -3131,7 +3209,7 @@ function setupPatterns(ctx) {
|
|
|
3131
3209
|
function setupJsx(ctx) {
|
|
3132
3210
|
if (!ctx.jsx.framework)
|
|
3133
3211
|
return;
|
|
3134
|
-
const isValidProp =
|
|
3212
|
+
const isValidProp = generateIsValidProp(ctx);
|
|
3135
3213
|
const types = generateJsxTypes(ctx);
|
|
3136
3214
|
const factory = generateJsxFactory(ctx);
|
|
3137
3215
|
const patterns = generateJsxPatterns(ctx);
|
|
@@ -3269,7 +3347,7 @@ var generateFlattenedCss = (ctx) => (options) => {
|
|
|
3269
3347
|
// src/artifacts/css/parser-css.ts
|
|
3270
3348
|
var import_logger2 = require("@pandacss/logger");
|
|
3271
3349
|
var import_func = require("lil-fp/func");
|
|
3272
|
-
var
|
|
3350
|
+
var import_ts_pattern10 = require("ts-pattern");
|
|
3273
3351
|
var generateParserCss = (ctx) => (result) => (0, import_func.pipe)(
|
|
3274
3352
|
{ ...ctx, sheet: ctx.createSheet(), result },
|
|
3275
3353
|
(0, import_func.tap)(({ sheet, result: result2, patterns, recipes }) => {
|
|
@@ -3299,7 +3377,7 @@ var generateParserCss = (ctx) => (result) => (0, import_func.pipe)(
|
|
|
3299
3377
|
const recipeConfig = recipes.getConfig(recipeName);
|
|
3300
3378
|
if (!recipeConfig)
|
|
3301
3379
|
continue;
|
|
3302
|
-
(0,
|
|
3380
|
+
(0, import_ts_pattern10.match)(recipe).with({ type: "jsx-recipe" }, () => {
|
|
3303
3381
|
recipe.data.forEach((data) => {
|
|
3304
3382
|
const [recipeProps, styleProps] = recipes.splitProps(recipeName, data);
|
|
3305
3383
|
sheet.processStyleProps(styleProps);
|
|
@@ -3318,7 +3396,7 @@ var generateParserCss = (ctx) => (result) => (0, import_func.pipe)(
|
|
|
3318
3396
|
result2.pattern.forEach((patternSet, name) => {
|
|
3319
3397
|
try {
|
|
3320
3398
|
for (const pattern of patternSet) {
|
|
3321
|
-
(0,
|
|
3399
|
+
(0, import_ts_pattern10.match)(pattern).with({ type: "jsx-pattern", name: import_ts_pattern10.P.string }, ({ name: jsxName }) => {
|
|
3322
3400
|
pattern.data.forEach((data) => {
|
|
3323
3401
|
const fnName = patterns.getFnName(jsxName);
|
|
3324
3402
|
const styleProps = patterns.transform(fnName, data);
|
|
@@ -3443,13 +3521,14 @@ var getBaseEngine = (conf) => {
|
|
|
3443
3521
|
// src/engines/jsx.ts
|
|
3444
3522
|
var import_shared6 = require("@pandacss/shared");
|
|
3445
3523
|
var getJsxEngine = (config) => {
|
|
3446
|
-
const { jsxFactory, jsxFramework } = config;
|
|
3524
|
+
const { jsxFactory, jsxFramework, jsxStyleProps: jsxStyleProps2 } = config;
|
|
3447
3525
|
return {
|
|
3448
3526
|
factoryName: jsxFactory,
|
|
3449
3527
|
upperName: (0, import_shared6.capitalize)(jsxFactory),
|
|
3450
3528
|
typeName: `HTML${(0, import_shared6.capitalize)(jsxFactory)}Props`,
|
|
3451
3529
|
componentName: `${(0, import_shared6.capitalize)(jsxFactory)}Component`,
|
|
3452
|
-
framework: jsxFramework
|
|
3530
|
+
framework: jsxFramework,
|
|
3531
|
+
styleProps: jsxStyleProps2 ?? "all"
|
|
3453
3532
|
};
|
|
3454
3533
|
};
|
|
3455
3534
|
|
|
@@ -3540,6 +3619,7 @@ var defaults = (conf) => ({
|
|
|
3540
3619
|
config: {
|
|
3541
3620
|
cssVarRoot: ":where(:root, :host)",
|
|
3542
3621
|
jsxFactory: "styled",
|
|
3622
|
+
jsxStyleProps: "all",
|
|
3543
3623
|
outExtension: "mjs",
|
|
3544
3624
|
shorthands: true,
|
|
3545
3625
|
syntax: "object-literal",
|
|
@@ -3569,6 +3649,7 @@ var createGenerator = (conf) => {
|
|
|
3569
3649
|
importMap: getImportMap(config.outdir.replace(relativeBaseUrl, "")),
|
|
3570
3650
|
jsx: {
|
|
3571
3651
|
factory: jsx.factoryName,
|
|
3652
|
+
styleProps: jsx.styleProps,
|
|
3572
3653
|
isStyleProp: isValidProperty,
|
|
3573
3654
|
nodes: [...patterns.details, ...recipes.details]
|
|
3574
3655
|
},
|