@pandacss/generator 0.9.0 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +5 -2
- package/dist/index.d.ts +5 -2
- package/dist/index.js +500 -320
- package/dist/index.mjs +497 -317
- package/package.json +9 -9
package/dist/index.js
CHANGED
|
@@ -130,7 +130,7 @@ var getMessages = (ctx) => ({
|
|
|
130
130
|
|
|
131
131
|
// src/artifacts/index.ts
|
|
132
132
|
var import_shared4 = require("@pandacss/shared");
|
|
133
|
-
var
|
|
133
|
+
var import_outdent43 = __toESM(require("outdent"));
|
|
134
134
|
|
|
135
135
|
// src/artifacts/css/global-css.ts
|
|
136
136
|
var generateGlobalCss = (ctx) => {
|
|
@@ -419,7 +419,10 @@ var generateStaticCss = (ctx) => {
|
|
|
419
419
|
return [];
|
|
420
420
|
return Object.keys(values);
|
|
421
421
|
},
|
|
422
|
-
getRecipeKeys: (recipe) =>
|
|
422
|
+
getRecipeKeys: (recipe) => {
|
|
423
|
+
const recipeConfig = recipes.details.find((detail) => detail.baseName === recipe);
|
|
424
|
+
return Object.assign({ __base: recipeConfig?.config.base }, recipeConfig?.variantKeyMap ?? {});
|
|
425
|
+
}
|
|
423
426
|
});
|
|
424
427
|
results.css.forEach((css2) => {
|
|
425
428
|
sheet.processAtomic(css2);
|
|
@@ -518,14 +521,15 @@ function generateConditions(ctx) {
|
|
|
518
521
|
js: import_outdent2.default`
|
|
519
522
|
${ctx.file.import("withoutSpace", "../helpers")}
|
|
520
523
|
|
|
521
|
-
const
|
|
524
|
+
const conditionsStr = "${keys.join(",")}"
|
|
525
|
+
const conditions = new Set(conditionsStr.split(','))
|
|
522
526
|
|
|
523
527
|
export function isCondition(value){
|
|
524
528
|
return conditions.has(value) || /^@|&|&$/.test(value)
|
|
525
529
|
}
|
|
526
530
|
|
|
527
531
|
const underscoreRegex = /^_/
|
|
528
|
-
const
|
|
532
|
+
const conditionsSelectorRegex = /&|@/
|
|
529
533
|
|
|
530
534
|
export function finalizeConditions(paths){
|
|
531
535
|
return paths.map((path) => {
|
|
@@ -533,7 +537,7 @@ function generateConditions(ctx) {
|
|
|
533
537
|
return path.replace(underscoreRegex, '')
|
|
534
538
|
}
|
|
535
539
|
|
|
536
|
-
if (
|
|
540
|
+
if (conditionsSelectorRegex.test(path)){
|
|
537
541
|
return \`[\${withoutSpace(path.trim())}]\`
|
|
538
542
|
}
|
|
539
543
|
|
|
@@ -613,14 +617,13 @@ function generateStringLiteralConditions(ctx) {
|
|
|
613
617
|
|
|
614
618
|
// src/artifacts/js/css-fn.ts
|
|
615
619
|
var import_outdent4 = require("outdent");
|
|
616
|
-
var stringify = (v) => JSON.stringify(Object.fromEntries(v), null, 2);
|
|
617
620
|
function generateCssFn(ctx) {
|
|
618
621
|
const {
|
|
619
622
|
utility,
|
|
620
623
|
config: { hash, prefix },
|
|
621
624
|
conditions
|
|
622
625
|
} = ctx;
|
|
623
|
-
const { separator } = utility;
|
|
626
|
+
const { separator, getPropShorthands } = utility;
|
|
624
627
|
return {
|
|
625
628
|
dts: import_outdent4.outdent`
|
|
626
629
|
import type { SystemStyleObject } from '../types'
|
|
@@ -636,35 +639,59 @@ function generateCssFn(ctx) {
|
|
|
636
639
|
${ctx.file.import("createCss, createMergeCss, hypenateProperty, withoutSpace", "../helpers")}
|
|
637
640
|
${ctx.file.import("sortConditions, finalizeConditions", "./conditions")}
|
|
638
641
|
|
|
639
|
-
const
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
642
|
+
const utilities = "${utility.entries().map(([prop, className]) => {
|
|
643
|
+
const shorthandList = getPropShorthands(prop);
|
|
644
|
+
const result = [
|
|
645
|
+
prop,
|
|
646
|
+
[
|
|
647
|
+
className,
|
|
648
|
+
shorthandList.length ? (
|
|
649
|
+
// mark shorthand equal to className as 1 to save a few bytes
|
|
650
|
+
shorthandList.map((shorthand) => shorthand === className ? 1 : shorthand).join("/")
|
|
651
|
+
) : null
|
|
652
|
+
].filter(Boolean).join("/")
|
|
653
|
+
].join(":");
|
|
654
|
+
return result;
|
|
655
|
+
}).join(",")}"
|
|
656
|
+
|
|
657
|
+
const classNames = new Map()
|
|
658
|
+
${utility.hasShorthand ? import_outdent4.outdent`
|
|
659
|
+
const shorthands = new Map()
|
|
660
|
+
utilities.split(',').forEach((utility) => {
|
|
661
|
+
const [prop, meta] = utility.split(':')
|
|
662
|
+
const [className, ...shorthandList] = meta.split('/')
|
|
663
|
+
classNames.set(prop, className)
|
|
664
|
+
if (shorthandList.length) {
|
|
665
|
+
shorthandList.forEach((shorthand) => {
|
|
666
|
+
shorthands.set(shorthand === '1' ? className : shorthand, prop)
|
|
667
|
+
})
|
|
668
|
+
}
|
|
669
|
+
})
|
|
648
670
|
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
const className =
|
|
653
|
-
|
|
654
|
-
}
|
|
671
|
+
const resolveShorthand = (prop) => shorthands.get(prop) || prop
|
|
672
|
+
` : import_outdent4.outdent`
|
|
673
|
+
utilities.split(',').forEach((utility) => {
|
|
674
|
+
const [prop, className] = utility.split(':')
|
|
675
|
+
classNames.set(prop, className)
|
|
676
|
+
})
|
|
677
|
+
`}
|
|
655
678
|
|
|
656
679
|
const context = {
|
|
657
|
-
|
|
680
|
+
${hash ? "hash: true," : ""}
|
|
658
681
|
conditions: {
|
|
659
682
|
shift: sortConditions,
|
|
660
683
|
finalize: finalizeConditions,
|
|
661
|
-
breakpoints: { keys:
|
|
684
|
+
breakpoints: { keys: ${JSON.stringify(conditions.breakpoints.keys)} }
|
|
662
685
|
},
|
|
663
686
|
utility: {
|
|
664
|
-
|
|
665
|
-
transform,
|
|
666
|
-
|
|
667
|
-
|
|
687
|
+
${prefix ? "prefix: " + JSON.stringify(prefix) + "," : ""}
|
|
688
|
+
transform: ${utility.hasShorthand ? `(prop, value) => {
|
|
689
|
+
const key = resolveShorthand(prop)
|
|
690
|
+
const propKey = classNames.get(key) || hypenateProperty(key)
|
|
691
|
+
return { className: \`\${propKey}${separator}\${withoutSpace(value)}\` }
|
|
692
|
+
}` : `(key, value) => ({ className: \`\${classNames.get(key) || hypenateProperty(key)}${separator}\${withoutSpace(value)}\` })`},
|
|
693
|
+
${utility.hasShorthand ? "hasShorthand: true," : ""}
|
|
694
|
+
resolveShorthand: ${utility.hasShorthand ? "resolveShorthand" : "prop => prop"},
|
|
668
695
|
}
|
|
669
696
|
}
|
|
670
697
|
|
|
@@ -839,20 +866,33 @@ var import_outdent8 = require("outdent");
|
|
|
839
866
|
|
|
840
867
|
// src/artifacts/generated/helpers.mjs.json
|
|
841
868
|
var helpers_mjs_default = {
|
|
842
|
-
content: '// src/assert.ts\nfunction isObject(value) {\n return typeof value === "object" && value != null && !Array.isArray(value);\n}\n\n// src/
|
|
869
|
+
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'
|
|
870
|
+
};
|
|
871
|
+
|
|
872
|
+
// src/artifacts/generated/astish.mjs.json
|
|
873
|
+
var astish_mjs_default = {
|
|
874
|
+
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'
|
|
875
|
+
};
|
|
876
|
+
|
|
877
|
+
// src/artifacts/generated/normalize-html.mjs.json
|
|
878
|
+
var normalize_html_mjs_default = {
|
|
879
|
+
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'
|
|
843
880
|
};
|
|
844
881
|
|
|
845
882
|
// src/artifacts/js/helpers.ts
|
|
846
|
-
function generateHelpers() {
|
|
883
|
+
function generateHelpers(ctx) {
|
|
847
884
|
return {
|
|
848
885
|
js: import_outdent8.outdent`
|
|
849
886
|
${helpers_mjs_default.content}
|
|
887
|
+
${ctx.isTemplateLiteralSyntax ? astish_mjs_default.content : ""}
|
|
888
|
+
|
|
889
|
+
${ctx.jsx.framework ? `${normalize_html_mjs_default.content}` : ""}
|
|
850
890
|
|
|
851
|
-
export function __spreadValues(a, b){
|
|
891
|
+
export function __spreadValues(a, b) {
|
|
852
892
|
return { ...a, ...b }
|
|
853
893
|
}
|
|
854
894
|
|
|
855
|
-
export function __objRest(source, exclude){
|
|
895
|
+
export function __objRest(source, exclude) {
|
|
856
896
|
return Object.fromEntries(Object.entries(source).filter(([key]) => !exclude.includes(key)))
|
|
857
897
|
}
|
|
858
898
|
`
|
|
@@ -861,19 +901,29 @@ function generateHelpers() {
|
|
|
861
901
|
|
|
862
902
|
// src/artifacts/generated/is-valid-prop.mjs.json
|
|
863
903
|
var is_valid_prop_mjs_default = {
|
|
864
|
-
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'
|
|
904
|
+
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'
|
|
865
905
|
};
|
|
866
906
|
|
|
867
907
|
// src/artifacts/js/is-valid-prop.ts
|
|
868
908
|
var import_outdent9 = require("outdent");
|
|
869
|
-
|
|
909
|
+
var import_ts_pattern = require("ts-pattern");
|
|
910
|
+
var cssPropRegex = /var cssPropertiesStr = ".*?";/;
|
|
911
|
+
var memoFnDeclarationRegex = /function memo(.+?)\nvar selectorRegex/s;
|
|
912
|
+
function generateIsValidProp(ctx) {
|
|
870
913
|
if (ctx.isTemplateLiteralSyntax)
|
|
871
914
|
return;
|
|
872
915
|
let content = is_valid_prop_mjs_default.content;
|
|
873
916
|
content = content.replace(
|
|
874
|
-
|
|
875
|
-
`var
|
|
917
|
+
'var userGeneratedStr = "";',
|
|
918
|
+
`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()}"`
|
|
876
919
|
);
|
|
920
|
+
content = content.replace(memoFnDeclarationRegex, "var selectorRegex");
|
|
921
|
+
if (ctx.jsx.styleProps === "minimal" || ctx.jsx.styleProps === "none") {
|
|
922
|
+
content = content.replace("/* @__PURE__ */ memo(", "/* @__PURE__ */ (");
|
|
923
|
+
content = content.replace(cssPropRegex, 'var cssPropertiesStr = "";');
|
|
924
|
+
} else {
|
|
925
|
+
content = ctx.file.import("memo", "../helpers") + "\n" + content;
|
|
926
|
+
}
|
|
877
927
|
return {
|
|
878
928
|
js: content,
|
|
879
929
|
dts: import_outdent9.outdent`
|
|
@@ -888,7 +938,7 @@ function generateisValidProp(ctx) {
|
|
|
888
938
|
var import_shared = require("@pandacss/shared");
|
|
889
939
|
var import_javascript_stringify = require("javascript-stringify");
|
|
890
940
|
var import_outdent10 = require("outdent");
|
|
891
|
-
var
|
|
941
|
+
var import_ts_pattern2 = require("ts-pattern");
|
|
892
942
|
function generatePattern(ctx) {
|
|
893
943
|
if (ctx.patterns.isEmpty())
|
|
894
944
|
return;
|
|
@@ -914,7 +964,7 @@ function generatePattern(ctx) {
|
|
|
914
964
|
export type ${upperName}Properties = {
|
|
915
965
|
${Object.keys(properties ?? {}).map((key) => {
|
|
916
966
|
const value = properties[key];
|
|
917
|
-
return (0,
|
|
967
|
+
return (0, import_ts_pattern2.match)(value).with({ type: "property" }, (value2) => {
|
|
918
968
|
return `${key}?: PropertyValue<'${value2.value}'>`;
|
|
919
969
|
}).with({ type: "token" }, (value2) => {
|
|
920
970
|
if (value2.property) {
|
|
@@ -960,9 +1010,11 @@ transform`)}
|
|
|
960
1010
|
}
|
|
961
1011
|
|
|
962
1012
|
// src/artifacts/js/recipe.ts
|
|
1013
|
+
var import_core4 = require("@pandacss/core");
|
|
963
1014
|
var import_shared2 = require("@pandacss/shared");
|
|
964
1015
|
var import_outdent11 = require("outdent");
|
|
965
|
-
var
|
|
1016
|
+
var import_ts_pattern3 = require("ts-pattern");
|
|
1017
|
+
var stringify2 = (value) => JSON.stringify(value, null, 2);
|
|
966
1018
|
var isBooleanValue = (value) => value === "true" || value === "false";
|
|
967
1019
|
function generateRecipes(ctx) {
|
|
968
1020
|
const {
|
|
@@ -995,9 +1047,9 @@ function generateRecipes(ctx) {
|
|
|
995
1047
|
}
|
|
996
1048
|
|
|
997
1049
|
const recipeCss = createCss({
|
|
998
|
-
|
|
1050
|
+
${hash ? "hash: true," : ""}
|
|
999
1051
|
utility: {
|
|
1000
|
-
|
|
1052
|
+
${prefix ? "prefix: " + JSON.stringify(prefix) + "," : ""}
|
|
1001
1053
|
transform,
|
|
1002
1054
|
}
|
|
1003
1055
|
})
|
|
@@ -1020,26 +1072,59 @@ function generateRecipes(ctx) {
|
|
|
1020
1072
|
...ctx.recipes.details.map((recipe) => {
|
|
1021
1073
|
const { baseName, config, upperName, variantKeyMap, dashName } = recipe;
|
|
1022
1074
|
const { description, defaultVariants, compoundVariants } = config;
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1075
|
+
const jsCode = (0, import_ts_pattern3.match)(config).when(
|
|
1076
|
+
import_core4.isSlotRecipe,
|
|
1077
|
+
(config2) => import_outdent11.outdent`
|
|
1078
|
+
${ctx.file.import("splitProps, getSlotCompoundVariant", "../helpers")}
|
|
1079
|
+
${ctx.file.import("createRecipe", "./create-recipe")}
|
|
1080
|
+
|
|
1081
|
+
const ${baseName}DefaultVariants = ${stringify2(defaultVariants ?? {})}
|
|
1082
|
+
const ${baseName}CompoundVariants = ${stringify2(compoundVariants ?? [])}
|
|
1083
|
+
|
|
1084
|
+
const ${baseName}SlotNames = ${stringify2(config2.slots.map((slot) => [slot, `${config2.className}__${slot}`]))}
|
|
1085
|
+
const ${baseName}SlotFns = ${baseName}SlotNames.map(([slotName, slotKey]) => [slotName, createRecipe(slotKey, ${baseName}DefaultVariants, getSlotCompoundVariant(${baseName}CompoundVariants, slotName))])
|
|
1086
|
+
|
|
1087
|
+
const ${baseName}Fn = (props = {}) => {
|
|
1088
|
+
return Object.fromEntries(${baseName}SlotFns.map(([slotName, slotFn]) => [slotName, slotFn(props)]))
|
|
1089
|
+
}
|
|
1090
|
+
|
|
1091
|
+
const ${baseName}VariantKeys = ${stringify2(Object.keys(variantKeyMap))}
|
|
1092
|
+
|
|
1093
|
+
export const ${baseName} = Object.assign(${baseName}Fn, {
|
|
1094
|
+
__recipe__: false,
|
|
1095
|
+
raw: (props) => props,
|
|
1096
|
+
variantKeys: ${baseName}VariantKeys,
|
|
1097
|
+
variantMap: ${stringify2(variantKeyMap)},
|
|
1098
|
+
splitVariantProps(props) {
|
|
1099
|
+
return splitProps(props, ${baseName}VariantKeys)
|
|
1100
|
+
},
|
|
1101
|
+
})
|
|
1102
|
+
`
|
|
1103
|
+
).otherwise(
|
|
1104
|
+
(config2) => import_outdent11.outdent`
|
|
1026
1105
|
${ctx.file.import("splitProps", "../helpers")}
|
|
1027
1106
|
${ctx.file.import("createRecipe", "./create-recipe")}
|
|
1028
1107
|
|
|
1029
|
-
const ${baseName}Fn = createRecipe('${
|
|
1108
|
+
const ${baseName}Fn = createRecipe('${config2.className}', ${stringify2(defaultVariants ?? {})}, ${stringify2(
|
|
1030
1109
|
compoundVariants ?? []
|
|
1031
1110
|
)})
|
|
1032
1111
|
|
|
1112
|
+
const ${baseName}VariantMap = ${stringify2(variantKeyMap)}
|
|
1113
|
+
const ${baseName}VariantKeys = Object.keys(${baseName}VariantMap)
|
|
1033
1114
|
export const ${baseName} = Object.assign(${baseName}Fn, {
|
|
1034
1115
|
__recipe__: true,
|
|
1035
1116
|
raw: (props) => props,
|
|
1036
|
-
variantKeys: ${
|
|
1037
|
-
variantMap: ${
|
|
1117
|
+
variantKeys: ${baseName}VariantKeys,
|
|
1118
|
+
variantMap: ${baseName}VariantMap,
|
|
1038
1119
|
splitVariantProps(props) {
|
|
1039
|
-
return splitProps(props, ${
|
|
1120
|
+
return splitProps(props, ${baseName}VariantKeys)
|
|
1040
1121
|
},
|
|
1041
1122
|
})
|
|
1042
|
-
|
|
1123
|
+
`
|
|
1124
|
+
);
|
|
1125
|
+
return {
|
|
1126
|
+
name: dashName,
|
|
1127
|
+
js: jsCode,
|
|
1043
1128
|
dts: import_outdent11.outdent`
|
|
1044
1129
|
import type { ConditionalValue } from '../types'
|
|
1045
1130
|
import type { Pretty } from '../types/helpers'
|
|
@@ -1063,7 +1148,7 @@ function generateRecipes(ctx) {
|
|
|
1063
1148
|
|
|
1064
1149
|
interface ${upperName}Recipe {
|
|
1065
1150
|
__type: ${upperName}VariantProps
|
|
1066
|
-
(props?: ${upperName}VariantProps): string
|
|
1151
|
+
(props?: ${upperName}VariantProps): ${(0, import_core4.isSlotRecipe)(config) ? `Pretty<Record<${(0, import_shared2.unionType)(config.slots)}, string>>` : "string"}
|
|
1067
1152
|
raw: (props?: ${upperName}VariantProps) => ${upperName}VariantProps
|
|
1068
1153
|
variantMap: ${upperName}VariantMap
|
|
1069
1154
|
variantKeys: Array<keyof ${upperName}Variant>
|
|
@@ -1078,8 +1163,42 @@ function generateRecipes(ctx) {
|
|
|
1078
1163
|
];
|
|
1079
1164
|
}
|
|
1080
1165
|
|
|
1166
|
+
// src/artifacts/js/sva.ts
|
|
1167
|
+
var import_outdent12 = require("outdent");
|
|
1168
|
+
function generateSvaFn(ctx) {
|
|
1169
|
+
return {
|
|
1170
|
+
js: import_outdent12.outdent`
|
|
1171
|
+
${ctx.file.import("getSlotRecipes", "../helpers")}
|
|
1172
|
+
${ctx.file.import("cva", "./cva")}
|
|
1173
|
+
|
|
1174
|
+
export function sva(config) {
|
|
1175
|
+
const slots = Object.entries(getSlotRecipes(config)).map(([slot, slotCva]) => [slot, cva(slotCva)])
|
|
1176
|
+
|
|
1177
|
+
function svaFn(props) {
|
|
1178
|
+
const result = slots.map(([slot, cvaFn]) => [slot, cvaFn(props)])
|
|
1179
|
+
return Object.fromEntries(result)
|
|
1180
|
+
}
|
|
1181
|
+
|
|
1182
|
+
const [, firstCva] = slots[0]
|
|
1183
|
+
|
|
1184
|
+
return Object.assign(svaFn, {
|
|
1185
|
+
__cva__: false,
|
|
1186
|
+
variantMap: firstCva.variantMap,
|
|
1187
|
+
variantKeys: firstCva.variantKeys,
|
|
1188
|
+
splitVariantProps: firstCva.splitVariantProps,
|
|
1189
|
+
})
|
|
1190
|
+
}
|
|
1191
|
+
`,
|
|
1192
|
+
dts: import_outdent12.outdent`
|
|
1193
|
+
import type { SlotRecipeCreatorFn } from '../types/recipe'
|
|
1194
|
+
|
|
1195
|
+
export declare const sva: SlotRecipeCreatorFn
|
|
1196
|
+
`
|
|
1197
|
+
};
|
|
1198
|
+
}
|
|
1199
|
+
|
|
1081
1200
|
// src/artifacts/js/token.ts
|
|
1082
|
-
var
|
|
1201
|
+
var import_outdent13 = __toESM(require("outdent"));
|
|
1083
1202
|
function generateTokenJs(ctx) {
|
|
1084
1203
|
const { tokens } = ctx;
|
|
1085
1204
|
const map = /* @__PURE__ */ new Map();
|
|
@@ -1090,7 +1209,7 @@ function generateTokenJs(ctx) {
|
|
|
1090
1209
|
});
|
|
1091
1210
|
const obj = Object.fromEntries(map);
|
|
1092
1211
|
return {
|
|
1093
|
-
js:
|
|
1212
|
+
js: import_outdent13.default`
|
|
1094
1213
|
const tokens = ${JSON.stringify(obj, null, 2)}
|
|
1095
1214
|
|
|
1096
1215
|
export function token(path, fallback) {
|
|
@@ -1103,7 +1222,7 @@ function generateTokenJs(ctx) {
|
|
|
1103
1222
|
|
|
1104
1223
|
token.var = tokenVar
|
|
1105
1224
|
`,
|
|
1106
|
-
dts:
|
|
1225
|
+
dts: import_outdent13.default`
|
|
1107
1226
|
import type { Token } from './tokens'
|
|
1108
1227
|
|
|
1109
1228
|
export declare const token: {
|
|
@@ -1117,43 +1236,43 @@ function generateTokenJs(ctx) {
|
|
|
1117
1236
|
}
|
|
1118
1237
|
|
|
1119
1238
|
// src/artifacts/preact-jsx/jsx.ts
|
|
1120
|
-
var
|
|
1239
|
+
var import_outdent14 = require("outdent");
|
|
1121
1240
|
function generatePreactJsxFactory(ctx) {
|
|
1122
1241
|
const { factoryName, componentName } = ctx.jsx;
|
|
1123
1242
|
return {
|
|
1124
|
-
js:
|
|
1243
|
+
js: import_outdent14.outdent`
|
|
1125
1244
|
import { h } from 'preact'
|
|
1126
1245
|
import { forwardRef } from 'preact/compat'
|
|
1127
1246
|
import { useMemo } from 'preact/hooks'
|
|
1128
1247
|
${ctx.file.import("css, cx, assignCss", "../css/index")}
|
|
1129
1248
|
${ctx.file.import("splitProps, normalizeHTMLProps", "../helpers")}
|
|
1130
1249
|
${ctx.file.import("isCssProperty", "./is-valid-prop")}
|
|
1131
|
-
|
|
1250
|
+
|
|
1132
1251
|
function styledFn(Dynamic, configOrCva = {}) {
|
|
1133
1252
|
const cvaFn = configOrCva.__cva__ || configOrCva.__recipe__ ? configOrCva : cva(configOrCva)
|
|
1134
|
-
|
|
1135
|
-
const ${componentName} = forwardRef(function ${componentName}(props, ref) {
|
|
1253
|
+
|
|
1254
|
+
const ${componentName} = /* @__PURE__ */ forwardRef(function ${componentName}(props, ref) {
|
|
1136
1255
|
const { as: Element = Dynamic, ...restProps } = props
|
|
1137
1256
|
|
|
1138
1257
|
const [variantProps, styleProps, htmlProps, elementProps] = useMemo(() => {
|
|
1139
1258
|
return splitProps(restProps, cvaFn.variantKeys, isCssProperty, normalizeHTMLProps.keys)
|
|
1140
1259
|
}, [restProps])
|
|
1141
|
-
|
|
1260
|
+
|
|
1142
1261
|
function recipeClass() {
|
|
1143
1262
|
const { css: cssStyles, ...propStyles } = styleProps
|
|
1144
1263
|
const styles = assignCss(propStyles, cssStyles)
|
|
1145
1264
|
return cx(cvaFn(variantProps), css(styles), elementProps.className, elementProps.class)
|
|
1146
1265
|
}
|
|
1147
|
-
|
|
1266
|
+
|
|
1148
1267
|
function cvaClass() {
|
|
1149
1268
|
const { css: cssStyles, ...propStyles } = styleProps
|
|
1150
1269
|
const cvaStyles = cvaFn.resolve(variantProps)
|
|
1151
1270
|
const styles = assignCss(cvaStyles, propStyles, cssStyles)
|
|
1152
1271
|
return cx(css(styles), elementProps.className, elementProps.class)
|
|
1153
1272
|
}
|
|
1154
|
-
|
|
1273
|
+
|
|
1155
1274
|
const classes = configOrCva.__recipe__ ? recipeClass : cvaClass
|
|
1156
|
-
|
|
1275
|
+
|
|
1157
1276
|
return h(Element, {
|
|
1158
1277
|
...elementProps,
|
|
1159
1278
|
...normalizeHTMLProps(htmlProps),
|
|
@@ -1161,14 +1280,14 @@ function generatePreactJsxFactory(ctx) {
|
|
|
1161
1280
|
className: classes()
|
|
1162
1281
|
})
|
|
1163
1282
|
})
|
|
1164
|
-
|
|
1283
|
+
|
|
1165
1284
|
${componentName}.displayName = \`${factoryName}.\${Dynamic}\`
|
|
1166
1285
|
return ${componentName}
|
|
1167
1286
|
}
|
|
1168
|
-
|
|
1287
|
+
|
|
1169
1288
|
function createJsxFactory() {
|
|
1170
1289
|
const cache = new Map()
|
|
1171
|
-
|
|
1290
|
+
|
|
1172
1291
|
return new Proxy(styledFn, {
|
|
1173
1292
|
apply(_, __, args) {
|
|
1174
1293
|
return styledFn(...args)
|
|
@@ -1182,14 +1301,14 @@ function generatePreactJsxFactory(ctx) {
|
|
|
1182
1301
|
})
|
|
1183
1302
|
}
|
|
1184
1303
|
|
|
1185
|
-
export const ${factoryName} = createJsxFactory()
|
|
1304
|
+
export const ${factoryName} = /* @__PURE__ */ createJsxFactory()
|
|
1186
1305
|
`
|
|
1187
1306
|
};
|
|
1188
1307
|
}
|
|
1189
1308
|
|
|
1190
1309
|
// src/artifacts/preact-jsx/pattern.ts
|
|
1191
|
-
var
|
|
1192
|
-
var
|
|
1310
|
+
var import_outdent15 = require("outdent");
|
|
1311
|
+
var import_ts_pattern4 = require("ts-pattern");
|
|
1193
1312
|
function generatePreactJsxPattern(ctx) {
|
|
1194
1313
|
const { typeName, factoryName } = ctx.jsx;
|
|
1195
1314
|
return ctx.patterns.details.map((pattern) => {
|
|
@@ -1197,35 +1316,35 @@ function generatePreactJsxPattern(ctx) {
|
|
|
1197
1316
|
const { description, jsxElement = "div" } = pattern.config;
|
|
1198
1317
|
return {
|
|
1199
1318
|
name: dashName,
|
|
1200
|
-
js:
|
|
1319
|
+
js: import_outdent15.outdent`
|
|
1201
1320
|
import { h } from 'preact'
|
|
1202
1321
|
import { forwardRef } from 'preact/compat'
|
|
1203
1322
|
${ctx.file.import(factoryName, "./factory")}
|
|
1204
1323
|
${ctx.file.import(styleFnName, `../patterns/${dashName}`)}
|
|
1205
|
-
|
|
1206
|
-
export const ${jsxName} = forwardRef(function ${jsxName}(props, ref) {
|
|
1207
|
-
${(0,
|
|
1324
|
+
|
|
1325
|
+
export const ${jsxName} = /* @__PURE__ */ forwardRef(function ${jsxName}(props, ref) {
|
|
1326
|
+
${(0, import_ts_pattern4.match)(props.length).with(
|
|
1208
1327
|
0,
|
|
1209
|
-
() =>
|
|
1328
|
+
() => import_outdent15.outdent`
|
|
1210
1329
|
const styleProps = ${styleFnName}()
|
|
1211
1330
|
return h(${factoryName}.${jsxElement}, { ref, ...styleProps, ...props })
|
|
1212
1331
|
`
|
|
1213
1332
|
).otherwise(
|
|
1214
|
-
() =>
|
|
1333
|
+
() => import_outdent15.outdent`
|
|
1215
1334
|
const { ${props.join(", ")}, ...restProps } = props
|
|
1216
1335
|
const styleProps = ${styleFnName}({${props.join(", ")}})
|
|
1217
1336
|
return h(${factoryName}.${jsxElement}, { ref, ...styleProps, ...restProps })
|
|
1218
1337
|
`
|
|
1219
1338
|
)}
|
|
1220
|
-
})
|
|
1339
|
+
})
|
|
1221
1340
|
`,
|
|
1222
|
-
dts:
|
|
1341
|
+
dts: import_outdent15.outdent`
|
|
1223
1342
|
import type { FunctionComponent } from 'preact'
|
|
1224
1343
|
import type { ${upperName}Properties } from '../patterns/${dashName}'
|
|
1225
1344
|
import type { ${typeName} } from '../types/jsx'
|
|
1226
|
-
|
|
1345
|
+
|
|
1227
1346
|
export type ${upperName}Props = ${upperName}Properties & Omit<${typeName}<'${jsxElement}'>, keyof ${upperName}Properties ${blocklistType}>
|
|
1228
|
-
|
|
1347
|
+
|
|
1229
1348
|
${description ? `/** ${description} */` : ""}
|
|
1230
1349
|
export declare const ${jsxName}: FunctionComponent<${upperName}Props>
|
|
1231
1350
|
`
|
|
@@ -1234,15 +1353,15 @@ function generatePreactJsxPattern(ctx) {
|
|
|
1234
1353
|
}
|
|
1235
1354
|
|
|
1236
1355
|
// src/artifacts/preact-jsx/types.ts
|
|
1237
|
-
var
|
|
1356
|
+
var import_outdent16 = require("outdent");
|
|
1238
1357
|
function generatePreactJsxTypes(ctx) {
|
|
1239
|
-
const { factoryName, componentName, upperName, typeName } = ctx.jsx;
|
|
1358
|
+
const { factoryName, styleProps, componentName, upperName, typeName } = ctx.jsx;
|
|
1240
1359
|
return {
|
|
1241
|
-
jsxFactory:
|
|
1360
|
+
jsxFactory: import_outdent16.outdent`
|
|
1242
1361
|
import type { ${upperName} } from '../types/jsx'
|
|
1243
1362
|
export declare const ${factoryName}: ${upperName}
|
|
1244
1363
|
`,
|
|
1245
|
-
jsxType:
|
|
1364
|
+
jsxType: import_outdent16.outdent`
|
|
1246
1365
|
import type { ComponentProps, JSX } from 'preact'
|
|
1247
1366
|
import type { Assign, JsxStyleProps, JsxHTMLProps } from './system-types'
|
|
1248
1367
|
import type { RecipeDefinition, RecipeSelection, RecipeVariantRecord } from './recipe'
|
|
@@ -1259,7 +1378,7 @@ export type ${componentName}<T extends ElementType, P extends Dict = {}> = {
|
|
|
1259
1378
|
type RecipeFn = { __type: any }
|
|
1260
1379
|
|
|
1261
1380
|
interface JsxFactory {
|
|
1262
|
-
|
|
1381
|
+
${styleProps === "none" ? "" : `<T extends ElementType>(component: T): ${componentName}<T, {}>`}
|
|
1263
1382
|
<T extends ElementType, P extends RecipeVariantRecord>(component: T, recipe: RecipeDefinition<P>): ${componentName}<
|
|
1264
1383
|
T,
|
|
1265
1384
|
RecipeSelection<P>
|
|
@@ -1269,7 +1388,7 @@ interface JsxFactory {
|
|
|
1269
1388
|
|
|
1270
1389
|
type JsxElements = { [K in keyof JSX.IntrinsicElements]: ${componentName}<K, {}> }
|
|
1271
1390
|
|
|
1272
|
-
export type ${upperName} = JsxFactory & JsxElements
|
|
1391
|
+
export type ${upperName} = JsxFactory ${styleProps === "none" ? "" : "& JsxElements"}
|
|
1273
1392
|
|
|
1274
1393
|
export type ${typeName}<T extends ElementType> = JsxHTMLProps<ComponentProps<T>, JsxStyleProps>
|
|
1275
1394
|
`
|
|
@@ -1277,37 +1396,37 @@ export type ${typeName}<T extends ElementType> = JsxHTMLProps<ComponentProps<T>,
|
|
|
1277
1396
|
}
|
|
1278
1397
|
|
|
1279
1398
|
// src/artifacts/preact-jsx/jsx.string-literal.ts
|
|
1280
|
-
var
|
|
1399
|
+
var import_outdent17 = require("outdent");
|
|
1281
1400
|
function generatePreactJsxStringLiteralFactory(ctx) {
|
|
1282
1401
|
const { factoryName, componentName } = ctx.jsx;
|
|
1283
1402
|
return {
|
|
1284
|
-
js:
|
|
1403
|
+
js: import_outdent17.outdent`
|
|
1285
1404
|
import { h } from 'preact'
|
|
1286
1405
|
import { forwardRef } from 'preact/compat'
|
|
1287
1406
|
${ctx.file.import("css, cx", "../css/index")}
|
|
1288
|
-
|
|
1407
|
+
|
|
1289
1408
|
function createStyledFn(Dynamic) {
|
|
1290
1409
|
return function styledFn(template) {
|
|
1291
1410
|
const baseClassName = css(template)
|
|
1292
|
-
const ${componentName} = forwardRef(function ${componentName}(props, ref) {
|
|
1411
|
+
const ${componentName} = /* @__PURE__ */ forwardRef(function ${componentName}(props, ref) {
|
|
1293
1412
|
const { as: Element = Dynamic, ...elementProps } = props
|
|
1294
1413
|
const classes = () => cx(baseClassName, elementProps.className)
|
|
1295
|
-
|
|
1414
|
+
|
|
1296
1415
|
return h(Element, {
|
|
1297
1416
|
ref,
|
|
1298
1417
|
...elementProps,
|
|
1299
1418
|
className: classes(),
|
|
1300
1419
|
})
|
|
1301
1420
|
})
|
|
1302
|
-
|
|
1421
|
+
|
|
1303
1422
|
${componentName}.displayName = \`${factoryName}.\${Dynamic}\`
|
|
1304
1423
|
return ${componentName}
|
|
1305
1424
|
}
|
|
1306
1425
|
}
|
|
1307
|
-
|
|
1426
|
+
|
|
1308
1427
|
function createJsxFactory() {
|
|
1309
1428
|
const cache = new Map()
|
|
1310
|
-
|
|
1429
|
+
|
|
1311
1430
|
return new Proxy(createStyledFn, {
|
|
1312
1431
|
apply(_, __, args) {
|
|
1313
1432
|
return createStyledFn(...args)
|
|
@@ -1321,21 +1440,21 @@ function generatePreactJsxStringLiteralFactory(ctx) {
|
|
|
1321
1440
|
})
|
|
1322
1441
|
}
|
|
1323
1442
|
|
|
1324
|
-
export const ${factoryName} = createJsxFactory()
|
|
1443
|
+
export const ${factoryName} = /* @__PURE__ */ createJsxFactory()
|
|
1325
1444
|
`
|
|
1326
1445
|
};
|
|
1327
1446
|
}
|
|
1328
1447
|
|
|
1329
1448
|
// src/artifacts/preact-jsx/types.string-literal.ts
|
|
1330
|
-
var
|
|
1449
|
+
var import_outdent18 = require("outdent");
|
|
1331
1450
|
function generatePreactJsxStringLiteralTypes(ctx) {
|
|
1332
|
-
const { factoryName, componentName, upperName, typeName } = ctx.jsx;
|
|
1451
|
+
const { factoryName, styleProps, componentName, upperName, typeName } = ctx.jsx;
|
|
1333
1452
|
return {
|
|
1334
|
-
jsxFactory:
|
|
1453
|
+
jsxFactory: import_outdent18.outdent`
|
|
1335
1454
|
import type { ${upperName} } from '../types/jsx'
|
|
1336
1455
|
export declare const ${factoryName}: ${upperName}
|
|
1337
1456
|
`,
|
|
1338
|
-
jsxType:
|
|
1457
|
+
jsxType: import_outdent18.outdent`
|
|
1339
1458
|
import type { ComponentProps, JSX } from 'preact'
|
|
1340
1459
|
|
|
1341
1460
|
type ElementType = keyof JSX.IntrinsicElements
|
|
@@ -1353,7 +1472,7 @@ interface JsxFactory {
|
|
|
1353
1472
|
|
|
1354
1473
|
type JsxElements = { [K in keyof JSX.IntrinsicElements]: ${componentName}<K> }
|
|
1355
1474
|
|
|
1356
|
-
export type ${upperName} = JsxFactory & JsxElements
|
|
1475
|
+
export type ${upperName} = JsxFactory ${styleProps === "none" ? "" : "& JsxElements"}
|
|
1357
1476
|
|
|
1358
1477
|
export type ${typeName}<T extends ElementType> = ComponentProps<T>
|
|
1359
1478
|
`
|
|
@@ -1361,54 +1480,54 @@ export type ${typeName}<T extends ElementType> = ComponentProps<T>
|
|
|
1361
1480
|
}
|
|
1362
1481
|
|
|
1363
1482
|
// src/artifacts/qwik-jsx/jsx.ts
|
|
1364
|
-
var
|
|
1483
|
+
var import_outdent19 = require("outdent");
|
|
1365
1484
|
function generateQwikJsxFactory(ctx) {
|
|
1366
1485
|
const { factoryName, componentName } = ctx.jsx;
|
|
1367
1486
|
return {
|
|
1368
|
-
js:
|
|
1487
|
+
js: import_outdent19.outdent`
|
|
1369
1488
|
import { h } from '@builder.io/qwik'
|
|
1370
1489
|
${ctx.file.import("css, cx, cva, assignCss", "../css/index")}
|
|
1371
1490
|
${ctx.file.import("splitProps, normalizeHTMLProps", "../helpers")}
|
|
1372
1491
|
${ctx.file.import("isCssProperty", "./is-valid-prop")}
|
|
1373
|
-
|
|
1492
|
+
|
|
1374
1493
|
function styledFn(Dynamic, configOrCva = {}) {
|
|
1375
1494
|
const cvaFn = configOrCva.__cva__ || configOrCva.__recipe__ ? configOrCva : cva(configOrCva)
|
|
1376
|
-
|
|
1495
|
+
|
|
1377
1496
|
const ${componentName} = function ${componentName}(props) {
|
|
1378
1497
|
const { as: Element = Dynamic, ...restProps } = props
|
|
1379
|
-
|
|
1380
|
-
const [variantProps, styleProps, htmlProps, elementProps] =
|
|
1498
|
+
|
|
1499
|
+
const [variantProps, styleProps, htmlProps, elementProps] =
|
|
1381
1500
|
splitProps(restProps, cvaFn.variantKeys, isCssProperty, normalizeHTMLProps.keys)
|
|
1382
|
-
|
|
1501
|
+
|
|
1383
1502
|
const { css: cssStyles, ...propStyles } = styleProps
|
|
1384
|
-
|
|
1503
|
+
|
|
1385
1504
|
function recipeClass() {
|
|
1386
1505
|
const styles = assignCss(propStyles, cssStyles)
|
|
1387
1506
|
return cx(cvaFn(variantProps), css(styles), elementProps.class)
|
|
1388
1507
|
}
|
|
1389
|
-
|
|
1508
|
+
|
|
1390
1509
|
function cvaClass() {
|
|
1391
1510
|
const cvaStyles = cvaFn.resolve(variantProps)
|
|
1392
1511
|
const styles = assignCss(cvaStyles, propStyles, cssStyles)
|
|
1393
1512
|
return cx(css(styles), elementProps.class)
|
|
1394
1513
|
}
|
|
1395
|
-
|
|
1514
|
+
|
|
1396
1515
|
const classes = configOrCva.__recipe__ ? recipeClass : cvaClass
|
|
1397
|
-
|
|
1516
|
+
|
|
1398
1517
|
return h(Element, {
|
|
1399
1518
|
...elementProps,
|
|
1400
1519
|
...normalizeHTMLProps(htmlProps),
|
|
1401
1520
|
class: classes(),
|
|
1402
1521
|
})
|
|
1403
1522
|
}
|
|
1404
|
-
|
|
1523
|
+
|
|
1405
1524
|
${componentName}.displayName = \`${factoryName}.\${Dynamic}\`
|
|
1406
1525
|
return ${componentName}
|
|
1407
1526
|
}
|
|
1408
|
-
|
|
1527
|
+
|
|
1409
1528
|
function createJsxFactory() {
|
|
1410
1529
|
const cache = new Map()
|
|
1411
|
-
|
|
1530
|
+
|
|
1412
1531
|
return new Proxy(styledFn, {
|
|
1413
1532
|
apply(_, __, args) {
|
|
1414
1533
|
return styledFn(...args)
|
|
@@ -1422,15 +1541,15 @@ function generateQwikJsxFactory(ctx) {
|
|
|
1422
1541
|
})
|
|
1423
1542
|
}
|
|
1424
1543
|
|
|
1425
|
-
export const ${factoryName} = createJsxFactory()
|
|
1544
|
+
export const ${factoryName} = /* @__PURE__ */ createJsxFactory()
|
|
1426
1545
|
|
|
1427
1546
|
`
|
|
1428
1547
|
};
|
|
1429
1548
|
}
|
|
1430
1549
|
|
|
1431
1550
|
// src/artifacts/qwik-jsx/pattern.ts
|
|
1432
|
-
var
|
|
1433
|
-
var
|
|
1551
|
+
var import_outdent20 = require("outdent");
|
|
1552
|
+
var import_ts_pattern5 = require("ts-pattern");
|
|
1434
1553
|
function generateQwikJsxPattern(ctx) {
|
|
1435
1554
|
const { typeName, factoryName } = ctx.jsx;
|
|
1436
1555
|
return ctx.patterns.details.map((pattern) => {
|
|
@@ -1438,20 +1557,20 @@ function generateQwikJsxPattern(ctx) {
|
|
|
1438
1557
|
const { description, jsxElement = "div" } = pattern.config;
|
|
1439
1558
|
return {
|
|
1440
1559
|
name: dashName,
|
|
1441
|
-
js:
|
|
1560
|
+
js: import_outdent20.outdent`
|
|
1442
1561
|
import { h } from '@builder.io/qwik'
|
|
1443
1562
|
${ctx.file.import(factoryName, "./factory")}
|
|
1444
1563
|
${ctx.file.import(styleFnName, `../patterns/${dashName}`)}
|
|
1445
1564
|
|
|
1446
1565
|
export const ${jsxName} = function ${jsxName}(props) {
|
|
1447
|
-
${(0,
|
|
1566
|
+
${(0, import_ts_pattern5.match)(props.length).with(
|
|
1448
1567
|
0,
|
|
1449
|
-
() =>
|
|
1568
|
+
() => import_outdent20.outdent`
|
|
1450
1569
|
const styleProps = ${styleFnName}()
|
|
1451
1570
|
return h(${factoryName}.${jsxElement}, { ...styleProps, ...props })
|
|
1452
1571
|
`
|
|
1453
1572
|
).otherwise(
|
|
1454
|
-
() =>
|
|
1573
|
+
() => import_outdent20.outdent`
|
|
1455
1574
|
const { ${props.join(", ")}, ...restProps } = props
|
|
1456
1575
|
const styleProps = ${styleFnName}({${props.join(", ")}})
|
|
1457
1576
|
return h(${factoryName}.${jsxElement}, { ...styleProps, ...restProps })
|
|
@@ -1459,7 +1578,7 @@ function generateQwikJsxPattern(ctx) {
|
|
|
1459
1578
|
)}
|
|
1460
1579
|
}
|
|
1461
1580
|
`,
|
|
1462
|
-
dts:
|
|
1581
|
+
dts: import_outdent20.outdent`
|
|
1463
1582
|
import type { FunctionComponent } from '@builder.io/qwik'
|
|
1464
1583
|
import type { ${upperName}Properties } from '../patterns/${dashName}'
|
|
1465
1584
|
import type { ${typeName} } from '../types/jsx'
|
|
@@ -1478,15 +1597,15 @@ function generateQwikJsxPattern(ctx) {
|
|
|
1478
1597
|
}
|
|
1479
1598
|
|
|
1480
1599
|
// src/artifacts/qwik-jsx/types.ts
|
|
1481
|
-
var
|
|
1600
|
+
var import_outdent21 = require("outdent");
|
|
1482
1601
|
function generateQwikJsxTypes(ctx) {
|
|
1483
|
-
const { factoryName, componentName, upperName, typeName } = ctx.jsx;
|
|
1602
|
+
const { factoryName, styleProps, componentName, upperName, typeName } = ctx.jsx;
|
|
1484
1603
|
return {
|
|
1485
|
-
jsxFactory:
|
|
1604
|
+
jsxFactory: import_outdent21.outdent`
|
|
1486
1605
|
import { ${upperName} } from '../types/jsx'
|
|
1487
1606
|
export declare const ${factoryName}: ${upperName}
|
|
1488
1607
|
`,
|
|
1489
|
-
jsxType:
|
|
1608
|
+
jsxType: import_outdent21.outdent`
|
|
1490
1609
|
import type { FunctionComponent, QwikIntrinsicElements } from '@builder.io/qwik'
|
|
1491
1610
|
import type { Assign as _Assign, JsxStyleProps, PatchedHTMLProps } from './system-types'
|
|
1492
1611
|
import type { RecipeDefinition, RecipeSelection, RecipeVariantRecord } from './recipe'
|
|
@@ -1522,7 +1641,7 @@ export type ${componentName}<T extends ElementType, P extends Dict = {}> = Funct
|
|
|
1522
1641
|
type RecipeFn = { __type: any }
|
|
1523
1642
|
|
|
1524
1643
|
interface JsxFactory {
|
|
1525
|
-
|
|
1644
|
+
${styleProps === "none" ? "" : `<T extends ElementType>(component: T): ${componentName}<T, {}>`}
|
|
1526
1645
|
<T extends ElementType, P extends RecipeVariantRecord>(component: T, recipe: RecipeDefinition<P>): ${componentName}<
|
|
1527
1646
|
T,
|
|
1528
1647
|
RecipeSelection<P>
|
|
@@ -1532,7 +1651,7 @@ interface JsxFactory {
|
|
|
1532
1651
|
|
|
1533
1652
|
type JsxElements = { [K in keyof QwikIntrinsicElements]: ${componentName}<K, {}> }
|
|
1534
1653
|
|
|
1535
|
-
export type ${upperName} = JsxFactory & JsxElements
|
|
1654
|
+
export type ${upperName} = JsxFactory ${styleProps === "none" ? "" : "& JsxElements"}
|
|
1536
1655
|
|
|
1537
1656
|
export type ${typeName}<T extends ElementType> = Assign<ComponentProps<T>, JsxStyleProps>
|
|
1538
1657
|
`
|
|
@@ -1540,35 +1659,35 @@ export type ${typeName}<T extends ElementType> = Assign<ComponentProps<T>, JsxSt
|
|
|
1540
1659
|
}
|
|
1541
1660
|
|
|
1542
1661
|
// src/artifacts/qwik-jsx/jsx.string-literal.ts
|
|
1543
|
-
var
|
|
1662
|
+
var import_outdent22 = require("outdent");
|
|
1544
1663
|
function generateQwikJsxStringLiteralFactory(ctx) {
|
|
1545
1664
|
const { factoryName, componentName } = ctx.jsx;
|
|
1546
1665
|
return {
|
|
1547
|
-
js:
|
|
1666
|
+
js: import_outdent22.outdent`
|
|
1548
1667
|
import { h } from '@builder.io/qwik'
|
|
1549
1668
|
${ctx.file.import("css, cx", "../css/index")}
|
|
1550
|
-
|
|
1669
|
+
|
|
1551
1670
|
function createStyledFn(Dynamic) {
|
|
1552
1671
|
return function styledFn(template) {
|
|
1553
1672
|
const baseClassName = css(template)
|
|
1554
1673
|
const ${componentName} = function ${componentName}(props) {
|
|
1555
1674
|
const { as: Element = Dynamic, ...elementProps } = props
|
|
1556
1675
|
const classes = () => cx(baseClassName, elementProps.className)
|
|
1557
|
-
|
|
1676
|
+
|
|
1558
1677
|
return h(Element, {
|
|
1559
1678
|
...elementProps,
|
|
1560
1679
|
className: classes(),
|
|
1561
1680
|
})
|
|
1562
1681
|
}
|
|
1563
|
-
|
|
1682
|
+
|
|
1564
1683
|
${componentName}.displayName = \`${factoryName}.\${Dynamic}\`
|
|
1565
1684
|
return ${componentName}
|
|
1566
1685
|
}
|
|
1567
1686
|
}
|
|
1568
|
-
|
|
1687
|
+
|
|
1569
1688
|
function createJsxFactory() {
|
|
1570
1689
|
const cache = new Map()
|
|
1571
|
-
|
|
1690
|
+
|
|
1572
1691
|
return new Proxy(createStyledFn, {
|
|
1573
1692
|
apply(_, __, args) {
|
|
1574
1693
|
return createStyledFn(...args)
|
|
@@ -1582,22 +1701,22 @@ function generateQwikJsxStringLiteralFactory(ctx) {
|
|
|
1582
1701
|
})
|
|
1583
1702
|
}
|
|
1584
1703
|
|
|
1585
|
-
export const ${factoryName} = createJsxFactory()
|
|
1704
|
+
export const ${factoryName} = /* @__PURE__ */ createJsxFactory()
|
|
1586
1705
|
|
|
1587
1706
|
`
|
|
1588
1707
|
};
|
|
1589
1708
|
}
|
|
1590
1709
|
|
|
1591
1710
|
// src/artifacts/qwik-jsx/types.string-literal.ts
|
|
1592
|
-
var
|
|
1711
|
+
var import_outdent23 = require("outdent");
|
|
1593
1712
|
function generateQwikJsxStringLiteralTypes(ctx) {
|
|
1594
|
-
const { factoryName, componentName, upperName, typeName } = ctx.jsx;
|
|
1713
|
+
const { factoryName, styleProps, componentName, upperName, typeName } = ctx.jsx;
|
|
1595
1714
|
return {
|
|
1596
|
-
jsxFactory:
|
|
1715
|
+
jsxFactory: import_outdent23.outdent`
|
|
1597
1716
|
import { ${upperName} } from '../types/jsx'
|
|
1598
1717
|
export declare const ${factoryName}: ${upperName}
|
|
1599
1718
|
`,
|
|
1600
|
-
jsxType:
|
|
1719
|
+
jsxType: import_outdent23.outdent`
|
|
1601
1720
|
import type { FunctionComponent, QwikIntrinsicElements } from '@builder.io/qwik'
|
|
1602
1721
|
|
|
1603
1722
|
type ElementType = keyof QwikIntrinsicElements | FunctionComponent<any>
|
|
@@ -1620,7 +1739,7 @@ interface JsxFactory {
|
|
|
1620
1739
|
|
|
1621
1740
|
type JsxElements = { [K in keyof QwikIntrinsicElements]: ${componentName}<K> }
|
|
1622
1741
|
|
|
1623
|
-
export type ${upperName} = JsxFactory & JsxElements
|
|
1742
|
+
export type ${upperName} = JsxFactory ${styleProps === "none" ? "" : "& JsxElements"}
|
|
1624
1743
|
|
|
1625
1744
|
export type ${typeName}<T extends ElementType> = ComponentProps<T>
|
|
1626
1745
|
`
|
|
@@ -1628,41 +1747,76 @@ export type ${typeName}<T extends ElementType> = ComponentProps<T>
|
|
|
1628
1747
|
}
|
|
1629
1748
|
|
|
1630
1749
|
// src/artifacts/react-jsx/jsx.ts
|
|
1631
|
-
var
|
|
1750
|
+
var import_outdent24 = require("outdent");
|
|
1751
|
+
var import_ts_pattern6 = require("ts-pattern");
|
|
1632
1752
|
function generateReactJsxFactory(ctx) {
|
|
1633
1753
|
const { factoryName, componentName } = ctx.jsx;
|
|
1634
1754
|
return {
|
|
1635
|
-
js:
|
|
1755
|
+
js: import_outdent24.outdent`
|
|
1636
1756
|
import { createElement, forwardRef, useMemo } from 'react'
|
|
1637
1757
|
${ctx.file.import("css, cx, cva, assignCss", "../css/index")}
|
|
1638
1758
|
${ctx.file.import("splitProps, normalizeHTMLProps", "../helpers")}
|
|
1639
|
-
${ctx.file.import("isCssProperty", "./is-valid-prop")}
|
|
1640
|
-
|
|
1759
|
+
${ctx.jsx.styleProps === "all" ? ctx.file.import("isCssProperty", "./is-valid-prop") : ""}
|
|
1760
|
+
|
|
1641
1761
|
function styledFn(Dynamic, configOrCva = {}) {
|
|
1642
1762
|
const cvaFn = configOrCva.__cva__ || configOrCva.__recipe__ ? configOrCva : cva(configOrCva)
|
|
1643
|
-
|
|
1644
|
-
const ${componentName} = forwardRef(function ${componentName}(props, ref) {
|
|
1763
|
+
|
|
1764
|
+
const ${componentName} = /* @__PURE__ */ forwardRef(function ${componentName}(props, ref) {
|
|
1645
1765
|
const { as: Element = Dynamic, ...restProps } = props
|
|
1646
|
-
|
|
1647
|
-
const [variantProps, styleProps, htmlProps, elementProps] = useMemo(() => {
|
|
1648
|
-
return splitProps(restProps, cvaFn.variantKeys, isCssProperty, normalizeHTMLProps.keys)
|
|
1649
|
-
}, [restProps])
|
|
1650
1766
|
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
const
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1767
|
+
${(0, import_ts_pattern6.match)(ctx.jsx.styleProps).with("all", () => {
|
|
1768
|
+
return import_outdent24.outdent`
|
|
1769
|
+
const [variantProps, styleProps, htmlProps, elementProps] = useMemo(() => {
|
|
1770
|
+
return splitProps(restProps, cvaFn.variantKeys, isCssProperty, normalizeHTMLProps.keys)
|
|
1771
|
+
}, [restProps])
|
|
1772
|
+
|
|
1773
|
+
function recipeClass() {
|
|
1774
|
+
const { css: cssStyles, ...propStyles } = styleProps
|
|
1775
|
+
const styles = assignCss(propStyles, cssStyles)
|
|
1776
|
+
return cx(cvaFn(variantProps), css(styles), elementProps.className)
|
|
1777
|
+
}
|
|
1778
|
+
|
|
1779
|
+
function cvaClass() {
|
|
1780
|
+
const { css: cssStyles, ...propStyles } = styleProps
|
|
1781
|
+
const cvaStyles = cvaFn.resolve(variantProps)
|
|
1782
|
+
const styles = assignCss(cvaStyles, propStyles, cssStyles)
|
|
1783
|
+
return cx(css(styles), elementProps.className)
|
|
1784
|
+
}`;
|
|
1785
|
+
}).with("minimal", () => {
|
|
1786
|
+
return import_outdent24.outdent`
|
|
1787
|
+
const [variantProps, htmlProps, elementProps] = useMemo(() => {
|
|
1788
|
+
return splitProps(restProps, cvaFn.variantKeys, normalizeHTMLProps.keys)
|
|
1789
|
+
}, [restProps])
|
|
1790
|
+
|
|
1791
|
+
function recipeClass() {
|
|
1792
|
+
return cx(cvaFn(variantProps), css(assignCss(elementProps.css)), elementProps.className)
|
|
1793
|
+
}
|
|
1794
|
+
|
|
1795
|
+
function cvaClass() {
|
|
1796
|
+
const cvaStyles = cvaFn.resolve(variantProps)
|
|
1797
|
+
const styles = assignCss(cvaStyles, elementProps.css)
|
|
1798
|
+
return cx(css(styles), elementProps.className)
|
|
1799
|
+
}`;
|
|
1800
|
+
}).with("none", () => {
|
|
1801
|
+
return import_outdent24.outdent`
|
|
1802
|
+
const [variantProps, htmlProps, elementProps] = useMemo(() => {
|
|
1803
|
+
return splitProps(restProps, cvaFn.variantKeys, normalizeHTMLProps.keys)
|
|
1804
|
+
}, [restProps])
|
|
1805
|
+
|
|
1806
|
+
function recipeClass() {
|
|
1807
|
+
return cx(cvaFn(variantProps), elementProps.className)
|
|
1808
|
+
}
|
|
1809
|
+
|
|
1810
|
+
function cvaClass() {
|
|
1811
|
+
const cvaStyles = cvaFn.resolve(variantProps)
|
|
1812
|
+
const styles = assignCss(cvaStyles)
|
|
1813
|
+
return cx(css(styles), elementProps.className)
|
|
1814
|
+
}`;
|
|
1815
|
+
}).run()}
|
|
1816
|
+
|
|
1817
|
+
|
|
1664
1818
|
const classes = configOrCva.__recipe__ ? recipeClass : cvaClass
|
|
1665
|
-
|
|
1819
|
+
|
|
1666
1820
|
return createElement(Element, {
|
|
1667
1821
|
ref,
|
|
1668
1822
|
...elementProps,
|
|
@@ -1670,14 +1824,14 @@ function generateReactJsxFactory(ctx) {
|
|
|
1670
1824
|
className: classes(),
|
|
1671
1825
|
})
|
|
1672
1826
|
})
|
|
1673
|
-
|
|
1827
|
+
|
|
1674
1828
|
${componentName}.displayName = \`${factoryName}.\${Dynamic}\`
|
|
1675
1829
|
return ${componentName}
|
|
1676
1830
|
}
|
|
1677
|
-
|
|
1831
|
+
|
|
1678
1832
|
function createJsxFactory() {
|
|
1679
1833
|
const cache = new Map()
|
|
1680
|
-
|
|
1834
|
+
|
|
1681
1835
|
return new Proxy(styledFn, {
|
|
1682
1836
|
apply(_, __, args) {
|
|
1683
1837
|
return styledFn(...args)
|
|
@@ -1691,15 +1845,15 @@ function generateReactJsxFactory(ctx) {
|
|
|
1691
1845
|
})
|
|
1692
1846
|
}
|
|
1693
1847
|
|
|
1694
|
-
export const ${factoryName} = createJsxFactory()
|
|
1848
|
+
export const ${factoryName} = /* @__PURE__ */ createJsxFactory()
|
|
1695
1849
|
|
|
1696
1850
|
`
|
|
1697
1851
|
};
|
|
1698
1852
|
}
|
|
1699
1853
|
|
|
1700
1854
|
// src/artifacts/react-jsx/pattern.ts
|
|
1701
|
-
var
|
|
1702
|
-
var
|
|
1855
|
+
var import_outdent25 = require("outdent");
|
|
1856
|
+
var import_ts_pattern7 = require("ts-pattern");
|
|
1703
1857
|
function generateReactJsxPattern(ctx) {
|
|
1704
1858
|
const { typeName, factoryName } = ctx.jsx;
|
|
1705
1859
|
return ctx.patterns.details.map((pattern) => {
|
|
@@ -1707,34 +1861,34 @@ function generateReactJsxPattern(ctx) {
|
|
|
1707
1861
|
const { description, jsxElement = "div" } = pattern.config;
|
|
1708
1862
|
return {
|
|
1709
1863
|
name: dashName,
|
|
1710
|
-
js:
|
|
1864
|
+
js: import_outdent25.outdent`
|
|
1711
1865
|
import { createElement, forwardRef } from 'react'
|
|
1712
1866
|
${ctx.file.import(factoryName, "./factory")}
|
|
1713
1867
|
${ctx.file.import(styleFnName, `../patterns/${dashName}`)}
|
|
1714
|
-
|
|
1715
|
-
export const ${jsxName} = forwardRef(function ${jsxName}(props, ref) {
|
|
1716
|
-
${(0,
|
|
1868
|
+
|
|
1869
|
+
export const ${jsxName} = /* @__PURE__ */ forwardRef(function ${jsxName}(props, ref) {
|
|
1870
|
+
${(0, import_ts_pattern7.match)(props.length).with(
|
|
1717
1871
|
0,
|
|
1718
|
-
() =>
|
|
1872
|
+
() => import_outdent25.outdent`
|
|
1719
1873
|
const styleProps = ${styleFnName}()
|
|
1720
1874
|
return createElement(${factoryName}.${jsxElement}, { ref, ...styleProps, ...props })
|
|
1721
1875
|
`
|
|
1722
1876
|
).otherwise(
|
|
1723
|
-
() =>
|
|
1877
|
+
() => import_outdent25.outdent`
|
|
1724
1878
|
const { ${props.join(", ")}, ...restProps } = props
|
|
1725
1879
|
const styleProps = ${styleFnName}({${props.join(", ")}})
|
|
1726
1880
|
return createElement(${factoryName}.${jsxElement}, { ref, ...styleProps, ...restProps })
|
|
1727
1881
|
`
|
|
1728
1882
|
)}
|
|
1729
|
-
})
|
|
1883
|
+
})
|
|
1730
1884
|
`,
|
|
1731
|
-
dts:
|
|
1885
|
+
dts: import_outdent25.outdent`
|
|
1732
1886
|
import type { FunctionComponent } from 'react'
|
|
1733
1887
|
import type { ${upperName}Properties } from '../patterns/${dashName}'
|
|
1734
1888
|
import type { ${typeName} } from '../types/jsx'
|
|
1735
|
-
|
|
1889
|
+
|
|
1736
1890
|
export type ${upperName}Props = ${upperName}Properties & Omit<${typeName}<'${jsxElement}'>, keyof ${upperName}Properties ${blocklistType}>
|
|
1737
|
-
|
|
1891
|
+
|
|
1738
1892
|
${description ? `/** ${description} */` : ""}
|
|
1739
1893
|
export declare const ${jsxName}: FunctionComponent<${upperName}Props>
|
|
1740
1894
|
`
|
|
@@ -1743,15 +1897,15 @@ function generateReactJsxPattern(ctx) {
|
|
|
1743
1897
|
}
|
|
1744
1898
|
|
|
1745
1899
|
// src/artifacts/react-jsx/types.ts
|
|
1746
|
-
var
|
|
1900
|
+
var import_outdent26 = require("outdent");
|
|
1747
1901
|
function generateReactJsxTypes(ctx) {
|
|
1748
|
-
const { factoryName, componentName, upperName, typeName } = ctx.jsx;
|
|
1902
|
+
const { factoryName, styleProps, componentName, upperName, typeName } = ctx.jsx;
|
|
1749
1903
|
return {
|
|
1750
|
-
jsxFactory:
|
|
1904
|
+
jsxFactory: import_outdent26.outdent`
|
|
1751
1905
|
import { ${upperName} } from '../types/jsx'
|
|
1752
1906
|
export declare const ${factoryName}: ${upperName}
|
|
1753
1907
|
`,
|
|
1754
|
-
jsxType:
|
|
1908
|
+
jsxType: import_outdent26.outdent`
|
|
1755
1909
|
import type { ComponentPropsWithoutRef, ElementType, ElementRef, Ref } from 'react'
|
|
1756
1910
|
import type { Assign, JsxStyleProps, JsxHTMLProps } from './system-types'
|
|
1757
1911
|
import type { RecipeDefinition, RecipeSelection, RecipeVariantRecord } from './recipe'
|
|
@@ -1770,7 +1924,7 @@ export type ${componentName}<T extends ElementType, P extends Dict = {}> = {
|
|
|
1770
1924
|
type RecipeFn = { __type: any }
|
|
1771
1925
|
|
|
1772
1926
|
interface JsxFactory {
|
|
1773
|
-
|
|
1927
|
+
${styleProps === "none" ? "" : `<T extends ElementType>(component: T): ${componentName}<T, {}>`}
|
|
1774
1928
|
<T extends ElementType, P extends RecipeVariantRecord>(component: T, recipe: RecipeDefinition<P>): ${componentName}<
|
|
1775
1929
|
T,
|
|
1776
1930
|
RecipeSelection<P>
|
|
@@ -1780,7 +1934,7 @@ interface JsxFactory {
|
|
|
1780
1934
|
|
|
1781
1935
|
type JsxElements = { [K in keyof JSX.IntrinsicElements]: ${componentName}<K, {}> }
|
|
1782
1936
|
|
|
1783
|
-
export type ${upperName} = JsxFactory & JsxElements
|
|
1937
|
+
export type ${upperName} = JsxFactory ${styleProps === "none" ? "" : "& JsxElements"}
|
|
1784
1938
|
|
|
1785
1939
|
export type ${typeName}<T extends ElementType> = JsxHTMLProps<ComponentProps<T>, JsxStyleProps>
|
|
1786
1940
|
`
|
|
@@ -1788,36 +1942,36 @@ export type ${typeName}<T extends ElementType> = JsxHTMLProps<ComponentProps<T>,
|
|
|
1788
1942
|
}
|
|
1789
1943
|
|
|
1790
1944
|
// src/artifacts/react-jsx/jsx.string-literal.ts
|
|
1791
|
-
var
|
|
1945
|
+
var import_outdent27 = require("outdent");
|
|
1792
1946
|
function generateReactJsxStringLiteralFactory(ctx) {
|
|
1793
1947
|
const { factoryName, componentName } = ctx.jsx;
|
|
1794
1948
|
return {
|
|
1795
|
-
js:
|
|
1949
|
+
js: import_outdent27.outdent`
|
|
1796
1950
|
import { createElement, forwardRef } from 'react'
|
|
1797
1951
|
${ctx.file.import("css, cx", "../css/index")}
|
|
1798
|
-
|
|
1952
|
+
|
|
1799
1953
|
function createStyledFn(Dynamic) {
|
|
1800
1954
|
return function styledFn(template) {
|
|
1801
1955
|
const baseClassName = css(template)
|
|
1802
|
-
const ${componentName} = forwardRef(function ${componentName}(props, ref) {
|
|
1956
|
+
const ${componentName} = /* @__PURE__ */ forwardRef(function ${componentName}(props, ref) {
|
|
1803
1957
|
const { as: Element = Dynamic, ...elementProps } = props
|
|
1804
1958
|
const classes = () => cx(baseClassName, elementProps.className)
|
|
1805
|
-
|
|
1959
|
+
|
|
1806
1960
|
return createElement(Element, {
|
|
1807
1961
|
ref,
|
|
1808
1962
|
...elementProps,
|
|
1809
1963
|
className: classes(),
|
|
1810
1964
|
})
|
|
1811
1965
|
})
|
|
1812
|
-
|
|
1966
|
+
|
|
1813
1967
|
${componentName}.displayName = \`${factoryName}.\${Dynamic}\`
|
|
1814
1968
|
return ${componentName}
|
|
1815
1969
|
}
|
|
1816
1970
|
}
|
|
1817
|
-
|
|
1971
|
+
|
|
1818
1972
|
function createJsxFactory() {
|
|
1819
1973
|
const cache = new Map()
|
|
1820
|
-
|
|
1974
|
+
|
|
1821
1975
|
return new Proxy(createStyledFn, {
|
|
1822
1976
|
apply(_, __, args) {
|
|
1823
1977
|
return createStyledFn(...args)
|
|
@@ -1831,22 +1985,22 @@ function generateReactJsxStringLiteralFactory(ctx) {
|
|
|
1831
1985
|
})
|
|
1832
1986
|
}
|
|
1833
1987
|
|
|
1834
|
-
export const ${factoryName} = createJsxFactory()
|
|
1988
|
+
export const ${factoryName} = /* @__PURE__ */ createJsxFactory()
|
|
1835
1989
|
|
|
1836
1990
|
`
|
|
1837
1991
|
};
|
|
1838
1992
|
}
|
|
1839
1993
|
|
|
1840
1994
|
// src/artifacts/react-jsx/types.string-literal.ts
|
|
1841
|
-
var
|
|
1995
|
+
var import_outdent28 = require("outdent");
|
|
1842
1996
|
function generateReactJsxStringLiteralTypes(ctx) {
|
|
1843
|
-
const { factoryName, componentName, upperName, typeName } = ctx.jsx;
|
|
1997
|
+
const { factoryName, styleProps, componentName, upperName, typeName } = ctx.jsx;
|
|
1844
1998
|
return {
|
|
1845
|
-
jsxFactory:
|
|
1999
|
+
jsxFactory: import_outdent28.outdent`
|
|
1846
2000
|
import { ${upperName} } from '../types/jsx'
|
|
1847
2001
|
export declare const ${factoryName}: ${upperName}
|
|
1848
2002
|
`,
|
|
1849
|
-
jsxType:
|
|
2003
|
+
jsxType: import_outdent28.outdent`
|
|
1850
2004
|
import type { ComponentPropsWithoutRef, ElementType, ElementRef, Ref } from 'react'
|
|
1851
2005
|
|
|
1852
2006
|
type Dict = Record<string, unknown>
|
|
@@ -1866,7 +2020,7 @@ interface JsxFactory {
|
|
|
1866
2020
|
|
|
1867
2021
|
type JsxElements = { [K in keyof JSX.IntrinsicElements]: ${componentName}<K> }
|
|
1868
2022
|
|
|
1869
|
-
export type ${upperName} = JsxFactory & JsxElements
|
|
2023
|
+
export type ${upperName} = JsxFactory ${styleProps === "none" ? "" : "& JsxElements"}
|
|
1870
2024
|
|
|
1871
2025
|
export type ${typeName}<T extends ElementType> = ComponentProps<T>
|
|
1872
2026
|
`
|
|
@@ -1874,24 +2028,24 @@ export type ${typeName}<T extends ElementType> = ComponentProps<T>
|
|
|
1874
2028
|
}
|
|
1875
2029
|
|
|
1876
2030
|
// src/artifacts/solid-jsx/jsx.ts
|
|
1877
|
-
var
|
|
2031
|
+
var import_outdent29 = require("outdent");
|
|
1878
2032
|
function generateSolidJsxFactory(ctx) {
|
|
1879
2033
|
const { componentName, factoryName } = ctx.jsx;
|
|
1880
2034
|
return {
|
|
1881
|
-
js:
|
|
2035
|
+
js: import_outdent29.outdent`
|
|
1882
2036
|
import { Dynamic } from 'solid-js/web'
|
|
1883
2037
|
import { mergeProps, splitProps } from 'solid-js'
|
|
1884
2038
|
import { createComponent } from 'solid-js/web'
|
|
1885
2039
|
${ctx.file.import("css, cx, cva, assignCss", "../css/index")}
|
|
1886
2040
|
${ctx.file.import("normalizeHTMLProps", "../helpers")}
|
|
1887
2041
|
${ctx.file.import("allCssProperties", "./is-valid-prop")}
|
|
1888
|
-
|
|
2042
|
+
|
|
1889
2043
|
function styledFn(element, configOrCva = {}) {
|
|
1890
2044
|
const cvaFn = configOrCva.__cva__ ? configOrCva : cva(configOrCva)
|
|
1891
|
-
|
|
2045
|
+
|
|
1892
2046
|
return function ${componentName}(props) {
|
|
1893
2047
|
const mergedProps = mergeProps({ as: element }, props)
|
|
1894
|
-
|
|
2048
|
+
|
|
1895
2049
|
const [localProps, variantProps, styleProps, htmlProps, elementProps] = splitProps(
|
|
1896
2050
|
mergedProps,
|
|
1897
2051
|
['as', 'class'],
|
|
@@ -1905,16 +2059,16 @@ function generateSolidJsxFactory(ctx) {
|
|
|
1905
2059
|
const styles = assignCss(propStyles, cssStyles)
|
|
1906
2060
|
return cx(cvaFn(variantProps), css(styles), localProps.class)
|
|
1907
2061
|
}
|
|
1908
|
-
|
|
2062
|
+
|
|
1909
2063
|
function cvaClass() {
|
|
1910
2064
|
const { css: cssStyles, ...propStyles } = styleProps
|
|
1911
2065
|
const cvaStyles = cvaFn.resolve(variantProps)
|
|
1912
2066
|
const styles = assignCss(cvaStyles, propStyles, cssStyles)
|
|
1913
2067
|
return cx(css(styles), localProps.class)
|
|
1914
2068
|
}
|
|
1915
|
-
|
|
2069
|
+
|
|
1916
2070
|
const classes = configOrCva.__recipe__ ? recipeClass : cvaClass
|
|
1917
|
-
|
|
2071
|
+
|
|
1918
2072
|
return createComponent(
|
|
1919
2073
|
Dynamic,
|
|
1920
2074
|
mergeProps(
|
|
@@ -1932,10 +2086,10 @@ function generateSolidJsxFactory(ctx) {
|
|
|
1932
2086
|
)
|
|
1933
2087
|
}
|
|
1934
2088
|
}
|
|
1935
|
-
|
|
2089
|
+
|
|
1936
2090
|
function createJsxFactory() {
|
|
1937
2091
|
const cache = new Map()
|
|
1938
|
-
|
|
2092
|
+
|
|
1939
2093
|
return new Proxy(styledFn, {
|
|
1940
2094
|
apply(_, __, args) {
|
|
1941
2095
|
return styledFn(...args)
|
|
@@ -1948,15 +2102,15 @@ function generateSolidJsxFactory(ctx) {
|
|
|
1948
2102
|
},
|
|
1949
2103
|
})
|
|
1950
2104
|
}
|
|
1951
|
-
|
|
1952
|
-
export const ${factoryName} = createJsxFactory()
|
|
2105
|
+
|
|
2106
|
+
export const ${factoryName} = /* @__PURE__ */ createJsxFactory()
|
|
1953
2107
|
`
|
|
1954
2108
|
};
|
|
1955
2109
|
}
|
|
1956
2110
|
|
|
1957
2111
|
// src/artifacts/solid-jsx/pattern.ts
|
|
1958
|
-
var
|
|
1959
|
-
var
|
|
2112
|
+
var import_outdent30 = require("outdent");
|
|
2113
|
+
var import_ts_pattern8 = require("ts-pattern");
|
|
1960
2114
|
function generateSolidJsxPattern(ctx) {
|
|
1961
2115
|
const { typeName, factoryName } = ctx.jsx;
|
|
1962
2116
|
return ctx.patterns.details.map((pattern) => {
|
|
@@ -1964,21 +2118,21 @@ function generateSolidJsxPattern(ctx) {
|
|
|
1964
2118
|
const { description, jsxElement = "div" } = pattern.config;
|
|
1965
2119
|
return {
|
|
1966
2120
|
name: dashName,
|
|
1967
|
-
js:
|
|
2121
|
+
js: import_outdent30.outdent`
|
|
1968
2122
|
import { splitProps, mergeProps } from 'solid-js'
|
|
1969
2123
|
import { createComponent } from 'solid-js/web'
|
|
1970
2124
|
${ctx.file.import(factoryName, "./factory")}
|
|
1971
2125
|
${ctx.file.import(styleFnName, `../patterns/${dashName}`)}
|
|
1972
2126
|
|
|
1973
2127
|
export function ${jsxName}(props) {
|
|
1974
|
-
${(0,
|
|
2128
|
+
${(0, import_ts_pattern8.match)(props.length).with(
|
|
1975
2129
|
0,
|
|
1976
|
-
() =>
|
|
2130
|
+
() => import_outdent30.outdent`
|
|
1977
2131
|
const styleProps = ${styleFnName}()
|
|
1978
2132
|
return createComponent(${factoryName}.${jsxElement}, mergeProps(styleProps, props))
|
|
1979
2133
|
`
|
|
1980
2134
|
).otherwise(
|
|
1981
|
-
() =>
|
|
2135
|
+
() => import_outdent30.outdent`
|
|
1982
2136
|
const [patternProps, restProps] = splitProps(props, [${props.map((v) => JSON.stringify(v)).join(", ")}]);
|
|
1983
2137
|
const styleProps = ${styleFnName}(patternProps)
|
|
1984
2138
|
return createComponent(${factoryName}.${jsxElement}, mergeProps(styleProps, restProps))
|
|
@@ -1986,7 +2140,7 @@ function generateSolidJsxPattern(ctx) {
|
|
|
1986
2140
|
)}
|
|
1987
2141
|
}
|
|
1988
2142
|
`,
|
|
1989
|
-
dts:
|
|
2143
|
+
dts: import_outdent30.outdent`
|
|
1990
2144
|
import { Component } from 'solid-js'
|
|
1991
2145
|
import { ${upperName}Properties } from '../patterns/${dashName}'
|
|
1992
2146
|
import { ${typeName} } from '../types/jsx'
|
|
@@ -2001,15 +2155,15 @@ function generateSolidJsxPattern(ctx) {
|
|
|
2001
2155
|
}
|
|
2002
2156
|
|
|
2003
2157
|
// src/artifacts/solid-jsx/types.ts
|
|
2004
|
-
var
|
|
2158
|
+
var import_outdent31 = require("outdent");
|
|
2005
2159
|
function generateSolidJsxTypes(ctx) {
|
|
2006
|
-
const { factoryName, componentName, upperName, typeName } = ctx.jsx;
|
|
2160
|
+
const { factoryName, styleProps, componentName, upperName, typeName } = ctx.jsx;
|
|
2007
2161
|
return {
|
|
2008
|
-
jsxFactory:
|
|
2162
|
+
jsxFactory: import_outdent31.outdent`
|
|
2009
2163
|
import type { ${upperName} } from '../types/jsx'
|
|
2010
2164
|
export declare const ${factoryName}: ${upperName}
|
|
2011
2165
|
`,
|
|
2012
|
-
jsxType:
|
|
2166
|
+
jsxType: import_outdent31.outdent`
|
|
2013
2167
|
import type { ComponentProps, Component, JSX } from 'solid-js'
|
|
2014
2168
|
import type { Assign, JsxStyleProps, JsxHTMLProps } from './system-types'
|
|
2015
2169
|
import type { RecipeDefinition, RecipeSelection, RecipeVariantRecord } from './recipe'
|
|
@@ -2026,7 +2180,7 @@ export type ${componentName}<T extends ElementType, P extends Dict = {}> = {
|
|
|
2026
2180
|
type RecipeFn = { __type: any }
|
|
2027
2181
|
|
|
2028
2182
|
interface JsxFactory {
|
|
2029
|
-
|
|
2183
|
+
${styleProps === "none" ? "" : `<T extends ElementType>(component: T): ${componentName}<T, {}>`}
|
|
2030
2184
|
<T extends ElementType, P extends RecipeVariantRecord>(component: T, recipe: RecipeDefinition<P>): ${componentName}<
|
|
2031
2185
|
T,
|
|
2032
2186
|
RecipeSelection<P>
|
|
@@ -2036,7 +2190,7 @@ interface JsxFactory {
|
|
|
2036
2190
|
|
|
2037
2191
|
type JsxElements = { [K in keyof JSX.IntrinsicElements]: ${componentName}<K, {}> }
|
|
2038
2192
|
|
|
2039
|
-
export type ${upperName} = JsxFactory & JsxElements
|
|
2193
|
+
export type ${upperName} = JsxFactory ${styleProps === "none" ? "" : "& JsxElements"}
|
|
2040
2194
|
|
|
2041
2195
|
export type ${typeName}<T extends ElementType> = JsxHTMLProps<ComponentProps<T>, JsxStyleProps>
|
|
2042
2196
|
`
|
|
@@ -2044,11 +2198,11 @@ export type ${typeName}<T extends ElementType> = JsxHTMLProps<ComponentProps<T>,
|
|
|
2044
2198
|
}
|
|
2045
2199
|
|
|
2046
2200
|
// src/artifacts/solid-jsx/jsx.string-literal.ts
|
|
2047
|
-
var
|
|
2201
|
+
var import_outdent32 = require("outdent");
|
|
2048
2202
|
function generateSolidJsxStringLiteralFactory(ctx) {
|
|
2049
2203
|
const { componentName, factoryName } = ctx.jsx;
|
|
2050
2204
|
return {
|
|
2051
|
-
js:
|
|
2205
|
+
js: import_outdent32.outdent`
|
|
2052
2206
|
import { mergeProps, splitProps } from 'solid-js'
|
|
2053
2207
|
import { Dynamic, createComponent } from 'solid-js/web'
|
|
2054
2208
|
${ctx.file.import("css, cx", "../css/index")}
|
|
@@ -2059,7 +2213,7 @@ function createStyled(element) {
|
|
|
2059
2213
|
return function ${componentName}(props) {
|
|
2060
2214
|
const mergedProps = mergeProps({ as: element }, props)
|
|
2061
2215
|
const [localProps, elementProps] = splitProps(mergedProps, ['as', 'class'])
|
|
2062
|
-
|
|
2216
|
+
|
|
2063
2217
|
return createComponent(
|
|
2064
2218
|
Dynamic,
|
|
2065
2219
|
mergeProps(
|
|
@@ -2094,21 +2248,21 @@ function createJsxFactory() {
|
|
|
2094
2248
|
})
|
|
2095
2249
|
}
|
|
2096
2250
|
|
|
2097
|
-
export const ${factoryName} = createJsxFactory()
|
|
2251
|
+
export const ${factoryName} = /* @__PURE__ */ createJsxFactory()
|
|
2098
2252
|
`
|
|
2099
2253
|
};
|
|
2100
2254
|
}
|
|
2101
2255
|
|
|
2102
2256
|
// src/artifacts/solid-jsx/types.string-literal.ts
|
|
2103
|
-
var
|
|
2257
|
+
var import_outdent33 = require("outdent");
|
|
2104
2258
|
function generateSolidJsxStringLiteralTypes(ctx) {
|
|
2105
|
-
const { factoryName, componentName, upperName, typeName } = ctx.jsx;
|
|
2259
|
+
const { factoryName, styleProps, componentName, upperName, typeName } = ctx.jsx;
|
|
2106
2260
|
return {
|
|
2107
|
-
jsxFactory:
|
|
2261
|
+
jsxFactory: import_outdent33.outdent`
|
|
2108
2262
|
import type { ${upperName} } from '../types/jsx'
|
|
2109
2263
|
export declare const ${factoryName}: ${upperName}
|
|
2110
2264
|
`,
|
|
2111
|
-
jsxType:
|
|
2265
|
+
jsxType: import_outdent33.outdent`
|
|
2112
2266
|
import type { Component, ComponentProps, JSX } from 'solid-js'
|
|
2113
2267
|
|
|
2114
2268
|
type Dict = Record<string, unknown>
|
|
@@ -2126,7 +2280,7 @@ interface JsxFactory {
|
|
|
2126
2280
|
|
|
2127
2281
|
type JsxElements = { [K in keyof JSX.IntrinsicElements]: ${componentName}<K> }
|
|
2128
2282
|
|
|
2129
|
-
export type
|
|
2283
|
+
export type ${upperName} = JsxFactory ${styleProps === "none" ? "" : "& JsxElements"}
|
|
2130
2284
|
|
|
2131
2285
|
export type ${typeName}<T extends ElementType> = ComponentProps<T>
|
|
2132
2286
|
`
|
|
@@ -2134,16 +2288,16 @@ export type ${typeName}<T extends ElementType> = ComponentProps<T>
|
|
|
2134
2288
|
}
|
|
2135
2289
|
|
|
2136
2290
|
// src/artifacts/vue-jsx/jsx.ts
|
|
2137
|
-
var
|
|
2291
|
+
var import_outdent34 = require("outdent");
|
|
2138
2292
|
function generateVueJsxFactory(ctx) {
|
|
2139
2293
|
const { factoryName } = ctx.jsx;
|
|
2140
2294
|
return {
|
|
2141
|
-
js:
|
|
2295
|
+
js: import_outdent34.outdent`
|
|
2142
2296
|
import { defineComponent, h, computed } from 'vue'
|
|
2143
2297
|
${ctx.file.import("css, cx, cva, assignCss", "../css/index")}
|
|
2144
2298
|
${ctx.file.import("splitProps, normalizeHTMLProps", "../helpers")}
|
|
2145
2299
|
${ctx.file.import("isCssProperty", "./is-valid-prop")}
|
|
2146
|
-
|
|
2300
|
+
|
|
2147
2301
|
function styledFn(Dynamic, configOrCva = {}) {
|
|
2148
2302
|
const cvaFn = configOrCva.__cva__ || configOrCva.__recipe__ ? configOrCva : cva(configOrCva)
|
|
2149
2303
|
|
|
@@ -2171,10 +2325,10 @@ function generateVueJsxFactory(ctx) {
|
|
|
2171
2325
|
})
|
|
2172
2326
|
|
|
2173
2327
|
const classes = configOrCva.__recipe__ ? recipeClass : cvaClass
|
|
2174
|
-
|
|
2328
|
+
|
|
2175
2329
|
return () => {
|
|
2176
2330
|
const [_styleProps, _variantProps, htmlProps, elementProps] = splittedProps.value
|
|
2177
|
-
|
|
2331
|
+
|
|
2178
2332
|
return h(
|
|
2179
2333
|
props.as,
|
|
2180
2334
|
{
|
|
@@ -2188,10 +2342,10 @@ function generateVueJsxFactory(ctx) {
|
|
|
2188
2342
|
},
|
|
2189
2343
|
})
|
|
2190
2344
|
}
|
|
2191
|
-
|
|
2345
|
+
|
|
2192
2346
|
function createJsxFactory() {
|
|
2193
2347
|
const cache = new Map()
|
|
2194
|
-
|
|
2348
|
+
|
|
2195
2349
|
return new Proxy(styledFn, {
|
|
2196
2350
|
apply(_, __, args) {
|
|
2197
2351
|
return styledFn(...args)
|
|
@@ -2205,21 +2359,21 @@ function generateVueJsxFactory(ctx) {
|
|
|
2205
2359
|
})
|
|
2206
2360
|
}
|
|
2207
2361
|
|
|
2208
|
-
export const ${factoryName} = createJsxFactory()
|
|
2362
|
+
export const ${factoryName} = /* @__PURE__ */ createJsxFactory()
|
|
2209
2363
|
|
|
2210
2364
|
`
|
|
2211
2365
|
};
|
|
2212
2366
|
}
|
|
2213
2367
|
|
|
2214
2368
|
// src/artifacts/vue-jsx/jsx.string-literal.ts
|
|
2215
|
-
var
|
|
2369
|
+
var import_outdent35 = require("outdent");
|
|
2216
2370
|
function generateVueJsxStringLiteralFactory(ctx) {
|
|
2217
2371
|
const { factoryName } = ctx.jsx;
|
|
2218
2372
|
return {
|
|
2219
|
-
js:
|
|
2373
|
+
js: import_outdent35.outdent`
|
|
2220
2374
|
import { defineComponent, h, computed } from 'vue'
|
|
2221
2375
|
${ctx.file.import("css, cx", "../css/index")}
|
|
2222
|
-
|
|
2376
|
+
|
|
2223
2377
|
function createStyled(Dynamic) {
|
|
2224
2378
|
function styledFn(template) {
|
|
2225
2379
|
const baseClassName = css(template)
|
|
@@ -2243,10 +2397,10 @@ function generateVueJsxStringLiteralFactory(ctx) {
|
|
|
2243
2397
|
})
|
|
2244
2398
|
}
|
|
2245
2399
|
}
|
|
2246
|
-
|
|
2400
|
+
|
|
2247
2401
|
function createJsxFactory() {
|
|
2248
2402
|
const cache = new Map()
|
|
2249
|
-
|
|
2403
|
+
|
|
2250
2404
|
return new Proxy(createStyled, {
|
|
2251
2405
|
apply(_, __, args) {
|
|
2252
2406
|
return createStyled(...args)
|
|
@@ -2260,13 +2414,13 @@ function generateVueJsxStringLiteralFactory(ctx) {
|
|
|
2260
2414
|
})
|
|
2261
2415
|
}
|
|
2262
2416
|
|
|
2263
|
-
export const ${factoryName} = createJsxFactory()
|
|
2417
|
+
export const ${factoryName} = /* @__PURE__ */ createJsxFactory()
|
|
2264
2418
|
`
|
|
2265
2419
|
};
|
|
2266
2420
|
}
|
|
2267
2421
|
|
|
2268
2422
|
// src/artifacts/vue-jsx/pattern.ts
|
|
2269
|
-
var
|
|
2423
|
+
var import_outdent36 = require("outdent");
|
|
2270
2424
|
function generateVueJsxPattern(ctx) {
|
|
2271
2425
|
const { typeName, factoryName } = ctx.jsx;
|
|
2272
2426
|
return ctx.patterns.details.map((pattern) => {
|
|
@@ -2275,7 +2429,7 @@ function generateVueJsxPattern(ctx) {
|
|
|
2275
2429
|
const propList = props.map((v) => JSON.stringify(v)).join(", ");
|
|
2276
2430
|
return {
|
|
2277
2431
|
name: dashName,
|
|
2278
|
-
js:
|
|
2432
|
+
js: import_outdent36.outdent`
|
|
2279
2433
|
import { defineComponent, h, computed } from 'vue'
|
|
2280
2434
|
${ctx.file.import(factoryName, "./factory")}
|
|
2281
2435
|
${ctx.file.import(styleFnName, `../patterns/${dashName}`)}
|
|
@@ -2293,7 +2447,7 @@ function generateVueJsxPattern(ctx) {
|
|
|
2293
2447
|
}
|
|
2294
2448
|
})
|
|
2295
2449
|
`,
|
|
2296
|
-
dts:
|
|
2450
|
+
dts: import_outdent36.outdent`
|
|
2297
2451
|
import { FunctionalComponent } from 'vue'
|
|
2298
2452
|
import { ${upperName}Properties } from '../patterns/${dashName}'
|
|
2299
2453
|
import { ${typeName} } from '../types/jsx'
|
|
@@ -2308,15 +2462,15 @@ function generateVueJsxPattern(ctx) {
|
|
|
2308
2462
|
}
|
|
2309
2463
|
|
|
2310
2464
|
// src/artifacts/vue-jsx/types.ts
|
|
2311
|
-
var
|
|
2465
|
+
var import_outdent37 = require("outdent");
|
|
2312
2466
|
function generateVueJsxTypes(ctx) {
|
|
2313
|
-
const { factoryName, componentName, upperName, typeName } = ctx.jsx;
|
|
2467
|
+
const { factoryName, styleProps, componentName, upperName, typeName } = ctx.jsx;
|
|
2314
2468
|
return {
|
|
2315
|
-
jsxFactory:
|
|
2469
|
+
jsxFactory: import_outdent37.outdent`
|
|
2316
2470
|
import { ${upperName} } from '../types/jsx'
|
|
2317
2471
|
export declare const ${factoryName}: ${upperName}
|
|
2318
2472
|
`,
|
|
2319
|
-
jsxType:
|
|
2473
|
+
jsxType: import_outdent37.outdent`
|
|
2320
2474
|
import type { Component, FunctionalComponent } from 'vue'
|
|
2321
2475
|
import type { Assign, JsxStyleProps, JsxHTMLProps } from './system-types'
|
|
2322
2476
|
import type { RecipeDefinition, RecipeSelection, RecipeVariantRecord } from './recipe'
|
|
@@ -2455,33 +2609,33 @@ type IntrinsicElement =
|
|
|
2455
2609
|
type RecipeFn = { __type: any }
|
|
2456
2610
|
|
|
2457
2611
|
interface JsxFactory {
|
|
2458
|
-
|
|
2612
|
+
${styleProps === "none" ? "" : `<T extends ElementType>(component: T): ${componentName}<T, {}>`}
|
|
2459
2613
|
<T extends ElementType, P extends RecipeVariantRecord>(component: T, recipe: RecipeDefinition<P>): ${componentName}<
|
|
2460
2614
|
T,
|
|
2461
2615
|
RecipeSelection<P>
|
|
2462
2616
|
>
|
|
2463
2617
|
<T extends ElementType, P extends RecipeFn>(component: T, recipeFn: P): ${componentName}<T, P['__type']>
|
|
2464
2618
|
}
|
|
2465
|
-
|
|
2619
|
+
|
|
2466
2620
|
type JsxElements = { [K in keyof JSX.IntrinsicElements]: ${componentName}<K, {}> }
|
|
2467
|
-
|
|
2468
|
-
export type ${upperName} = JsxFactory & JsxElements
|
|
2469
|
-
|
|
2621
|
+
|
|
2622
|
+
export type ${upperName} = JsxFactory ${styleProps === "none" ? "" : "& JsxElements"}
|
|
2623
|
+
|
|
2470
2624
|
export type ${typeName}<T extends ElementType> = JsxHTMLProps<ComponentProps<T>, JsxStyleProps>
|
|
2471
2625
|
`
|
|
2472
2626
|
};
|
|
2473
2627
|
}
|
|
2474
2628
|
|
|
2475
2629
|
// src/artifacts/vue-jsx/types.string-literal.ts
|
|
2476
|
-
var
|
|
2630
|
+
var import_outdent38 = require("outdent");
|
|
2477
2631
|
function generateVueJsxStringLiteralTypes(ctx) {
|
|
2478
|
-
const { factoryName, componentName, upperName, typeName } = ctx.jsx;
|
|
2632
|
+
const { factoryName, styleProps, componentName, upperName, typeName } = ctx.jsx;
|
|
2479
2633
|
return {
|
|
2480
|
-
jsxFactory:
|
|
2634
|
+
jsxFactory: import_outdent38.outdent`
|
|
2481
2635
|
import { ${upperName} } from '../types/jsx'
|
|
2482
2636
|
export declare const ${factoryName}: ${upperName}
|
|
2483
2637
|
`,
|
|
2484
|
-
jsxType:
|
|
2638
|
+
jsxType: import_outdent38.outdent`
|
|
2485
2639
|
import type { Component, FunctionalComponent } from 'vue'
|
|
2486
2640
|
|
|
2487
2641
|
type IntrinsicElement =
|
|
@@ -2617,11 +2771,11 @@ type IntrinsicElement =
|
|
|
2617
2771
|
interface JsxFactory {
|
|
2618
2772
|
<T extends ElementType>(component: T): ${componentName}<T>
|
|
2619
2773
|
}
|
|
2620
|
-
|
|
2774
|
+
|
|
2621
2775
|
type JsxElements = { [K in keyof JSX.IntrinsicElements]: ${componentName}<K> }
|
|
2622
|
-
|
|
2623
|
-
export type ${upperName} = JsxFactory & JsxElements
|
|
2624
|
-
|
|
2776
|
+
|
|
2777
|
+
export type ${upperName} = JsxFactory ${styleProps === "none" ? "" : "& JsxElements"}
|
|
2778
|
+
|
|
2625
2779
|
export type ${typeName}<T extends ElementType> = ComponentProps<T>
|
|
2626
2780
|
`
|
|
2627
2781
|
};
|
|
@@ -2636,8 +2790,8 @@ var typesMap = {
|
|
|
2636
2790
|
qwik: generateQwikJsxTypes
|
|
2637
2791
|
};
|
|
2638
2792
|
var typesStringLiteralMap = {
|
|
2639
|
-
react:
|
|
2640
|
-
solid:
|
|
2793
|
+
react: generateReactJsxStringLiteralTypes,
|
|
2794
|
+
solid: generateSolidJsxStringLiteralTypes,
|
|
2641
2795
|
qwik: generateQwikJsxStringLiteralTypes,
|
|
2642
2796
|
preact: generatePreactJsxStringLiteralTypes,
|
|
2643
2797
|
vue: generateVueJsxStringLiteralTypes
|
|
@@ -2735,7 +2889,7 @@ var csstype_d_ts_default = {
|
|
|
2735
2889
|
|
|
2736
2890
|
// src/artifacts/generated/system-types.d.ts.json
|
|
2737
2891
|
var system_types_d_ts_default = {
|
|
2738
|
-
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 =
|
|
2892
|
+
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"
|
|
2739
2893
|
};
|
|
2740
2894
|
|
|
2741
2895
|
// src/artifacts/generated/composition.d.ts.json
|
|
@@ -2745,7 +2899,7 @@ var composition_d_ts_default = {
|
|
|
2745
2899
|
|
|
2746
2900
|
// src/artifacts/generated/recipe.d.ts.json
|
|
2747
2901
|
var recipe_d_ts_default = {
|
|
2748
|
-
content: "import type { SystemStyleObject } from './system-types'\n\ntype Pretty<T> =
|
|
2902
|
+
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"
|
|
2749
2903
|
};
|
|
2750
2904
|
|
|
2751
2905
|
// src/artifacts/generated/pattern.d.ts.json
|
|
@@ -2764,7 +2918,9 @@ var selectors_d_ts_default = {
|
|
|
2764
2918
|
};
|
|
2765
2919
|
|
|
2766
2920
|
// src/artifacts/types/generated.ts
|
|
2767
|
-
|
|
2921
|
+
var import_ts_pattern9 = require("ts-pattern");
|
|
2922
|
+
var jsxStyleProps = "export type JsxStyleProps = StyleProps & WithCss";
|
|
2923
|
+
function getGeneratedTypes(ctx) {
|
|
2768
2924
|
return {
|
|
2769
2925
|
cssType: csstype_d_ts_default.content,
|
|
2770
2926
|
recipe: recipe_d_ts_default.content,
|
|
@@ -2772,15 +2928,15 @@ function getGeneratedTypes() {
|
|
|
2772
2928
|
parts: parts_d_ts_default.content,
|
|
2773
2929
|
composition: composition_d_ts_default.content,
|
|
2774
2930
|
selectors: selectors_d_ts_default.content,
|
|
2775
|
-
system: system_types_d_ts_default.content
|
|
2931
|
+
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()
|
|
2776
2932
|
};
|
|
2777
2933
|
}
|
|
2778
2934
|
|
|
2779
2935
|
// src/artifacts/types/main.ts
|
|
2780
|
-
var
|
|
2936
|
+
var import_outdent39 = require("outdent");
|
|
2781
2937
|
var generateTypesEntry = () => ({
|
|
2782
|
-
global:
|
|
2783
|
-
import type { RecipeVariantRecord, RecipeConfig } from './recipe'
|
|
2938
|
+
global: import_outdent39.outdent`
|
|
2939
|
+
import type { RecipeVariantRecord, RecipeConfig, SlotRecipeVariantRecord, SlotRecipeConfig } from './recipe'
|
|
2784
2940
|
import type { Parts } from './parts'
|
|
2785
2941
|
import type { PatternConfig, PatternProperties } from './pattern'
|
|
2786
2942
|
import type { GlobalStyleObject, SystemStyleObject } from './system-types'
|
|
@@ -2788,27 +2944,28 @@ var generateTypesEntry = () => ({
|
|
|
2788
2944
|
|
|
2789
2945
|
declare module '@pandacss/dev' {
|
|
2790
2946
|
export function defineRecipe<V extends RecipeVariantRecord>(config: RecipeConfig<V>): RecipeConfig
|
|
2947
|
+
export function defineSlotRecipe<S extends string, V extends SlotRecipeVariantRecord<S>>(config: SlotRecipeConfig<S, V>): SlotRecipeConfig
|
|
2791
2948
|
export function defineStyles(definition: SystemStyleObject): SystemStyleObject
|
|
2792
2949
|
export function defineGlobalStyles(definition: GlobalStyleObject): GlobalStyleObject
|
|
2793
2950
|
export function defineTextStyles(definition: CompositionStyles['textStyles']): CompositionStyles['textStyles']
|
|
2794
2951
|
export function defineLayerStyles(definition: CompositionStyles['layerStyles']): CompositionStyles['layerStyles']
|
|
2795
2952
|
export function definePattern<T extends PatternProperties>(config: PatternConfig<T>): PatternConfig
|
|
2796
|
-
export function defineParts<T extends Parts>(parts: T): (config: Partial<Record<keyof T, SystemStyleObject>>) => Partial<Record<keyof T, SystemStyleObject
|
|
2953
|
+
export function defineParts<T extends Parts>(parts: T): (config: Partial<Record<keyof T, SystemStyleObject>>) => Partial<Record<keyof T, SystemStyleObject>>
|
|
2797
2954
|
}
|
|
2798
2955
|
`,
|
|
2799
|
-
index:
|
|
2956
|
+
index: import_outdent39.outdent`
|
|
2800
2957
|
import './global'
|
|
2801
2958
|
export type { ConditionalValue } from './conditions'
|
|
2802
2959
|
export type { GlobalStyleObject, JsxStyleProps, SystemStyleObject } from './system-types'
|
|
2803
2960
|
|
|
2804
2961
|
`,
|
|
2805
|
-
helpers:
|
|
2962
|
+
helpers: import_outdent39.outdent`
|
|
2806
2963
|
export type Pretty<T> = T extends infer U ? { [K in keyof U]: U[K] } : never
|
|
2807
2964
|
`
|
|
2808
2965
|
});
|
|
2809
2966
|
|
|
2810
2967
|
// src/artifacts/types/prop-types.ts
|
|
2811
|
-
var
|
|
2968
|
+
var import_outdent40 = require("outdent");
|
|
2812
2969
|
function generatePropTypes(ctx) {
|
|
2813
2970
|
const {
|
|
2814
2971
|
config: { strictTokens },
|
|
@@ -2816,7 +2973,7 @@ function generatePropTypes(ctx) {
|
|
|
2816
2973
|
} = ctx;
|
|
2817
2974
|
const strictText = `${strictTokens ? "" : " | CssValue<T>"}`;
|
|
2818
2975
|
const result = [
|
|
2819
|
-
|
|
2976
|
+
import_outdent40.outdent`
|
|
2820
2977
|
import type { ConditionalValue } from './conditions';
|
|
2821
2978
|
import type { CssProperties } from './system-types'
|
|
2822
2979
|
import type { Tokens } from '../tokens'
|
|
@@ -2839,23 +2996,23 @@ function generatePropTypes(ctx) {
|
|
|
2839
2996
|
result.push(` ${key}: Shorthand<${JSON.stringify(value)}>;`);
|
|
2840
2997
|
});
|
|
2841
2998
|
result.push("}");
|
|
2842
|
-
return
|
|
2999
|
+
return import_outdent40.outdent`
|
|
2843
3000
|
${result.join("\n")}
|
|
2844
3001
|
|
|
2845
3002
|
export type PropertyValue<T extends string> = T extends keyof PropertyTypes
|
|
2846
|
-
? ConditionalValue<PropertyTypes[T]${strictText}>
|
|
3003
|
+
? ConditionalValue<PropertyTypes[T]${strictText} | (string & {})>
|
|
2847
3004
|
: T extends keyof CssProperties
|
|
2848
|
-
? ConditionalValue<CssProperties[T]>
|
|
3005
|
+
? ConditionalValue<CssProperties[T] | (string & {})>
|
|
2849
3006
|
: ConditionalValue<string | number>
|
|
2850
3007
|
`;
|
|
2851
3008
|
}
|
|
2852
3009
|
|
|
2853
3010
|
// src/artifacts/types/style-props.ts
|
|
2854
3011
|
var import_is_valid_prop = require("@pandacss/is-valid-prop");
|
|
2855
|
-
var
|
|
3012
|
+
var import_outdent41 = __toESM(require("outdent"));
|
|
2856
3013
|
function generateStyleProps(ctx) {
|
|
2857
|
-
const props = new Set(import_is_valid_prop.allCssProperties.concat(ctx.utility.keys()));
|
|
2858
|
-
return
|
|
3014
|
+
const props = new Set(import_is_valid_prop.allCssProperties.concat(ctx.utility.keys()).filter(Boolean));
|
|
3015
|
+
return import_outdent41.default`
|
|
2859
3016
|
import type { ConditionalValue } from './conditions'
|
|
2860
3017
|
import type { PropertyValue } from './prop-type'
|
|
2861
3018
|
import type { Token } from '../tokens'
|
|
@@ -2872,7 +3029,7 @@ function generateStyleProps(ctx) {
|
|
|
2872
3029
|
|
|
2873
3030
|
// src/artifacts/types/token-types.ts
|
|
2874
3031
|
var import_shared3 = require("@pandacss/shared");
|
|
2875
|
-
var
|
|
3032
|
+
var import_outdent42 = require("outdent");
|
|
2876
3033
|
var import_pluralize = __toESM(require("pluralize"));
|
|
2877
3034
|
var categories = [
|
|
2878
3035
|
"zIndex",
|
|
@@ -2917,12 +3074,12 @@ function generateTokenTypes(ctx) {
|
|
|
2917
3074
|
result.add("} & { [token: string]: never }");
|
|
2918
3075
|
set.add(Array.from(result).join("\n"));
|
|
2919
3076
|
set.add(`export type TokenCategory = ${(0, import_shared3.unionType)(categories)}`);
|
|
2920
|
-
return
|
|
3077
|
+
return import_outdent42.outdent.string(Array.from(set).join("\n\n"));
|
|
2921
3078
|
}
|
|
2922
3079
|
|
|
2923
3080
|
// src/artifacts/index.ts
|
|
2924
3081
|
function setupHelpers(ctx) {
|
|
2925
|
-
const code = generateHelpers();
|
|
3082
|
+
const code = generateHelpers(ctx);
|
|
2926
3083
|
return {
|
|
2927
3084
|
files: [{ file: ctx.file.ext("helpers"), code: code.js }]
|
|
2928
3085
|
};
|
|
@@ -2950,7 +3107,7 @@ function setupDesignTokens(ctx) {
|
|
|
2950
3107
|
};
|
|
2951
3108
|
}
|
|
2952
3109
|
function setupTypes(ctx) {
|
|
2953
|
-
const gen = getGeneratedTypes();
|
|
3110
|
+
const gen = getGeneratedTypes(ctx);
|
|
2954
3111
|
const conditions = generateConditions(ctx);
|
|
2955
3112
|
const jsx = generateJsxTypes(ctx);
|
|
2956
3113
|
const entry = generateTypesEntry();
|
|
@@ -2998,6 +3155,18 @@ function setupCva(ctx) {
|
|
|
2998
3155
|
]
|
|
2999
3156
|
};
|
|
3000
3157
|
}
|
|
3158
|
+
function setupSva(ctx) {
|
|
3159
|
+
if (ctx.isTemplateLiteralSyntax)
|
|
3160
|
+
return;
|
|
3161
|
+
const code = generateSvaFn(ctx);
|
|
3162
|
+
return {
|
|
3163
|
+
dir: ctx.paths.css,
|
|
3164
|
+
files: [
|
|
3165
|
+
{ file: ctx.file.ext("sva"), code: code.js },
|
|
3166
|
+
{ file: "sva.d.ts", code: code.dts }
|
|
3167
|
+
]
|
|
3168
|
+
};
|
|
3169
|
+
}
|
|
3001
3170
|
function setupCx(ctx) {
|
|
3002
3171
|
const code = generateCx();
|
|
3003
3172
|
return {
|
|
@@ -3014,8 +3183,8 @@ function setupRecipes(ctx) {
|
|
|
3014
3183
|
return;
|
|
3015
3184
|
const indexFiles = files.filter((file) => !file.name.includes("create-recipe"));
|
|
3016
3185
|
const index = {
|
|
3017
|
-
js:
|
|
3018
|
-
dts:
|
|
3186
|
+
js: import_outdent43.default.string(indexFiles.map((file) => ctx.file.export(`./${file.name}`)).join("\n")),
|
|
3187
|
+
dts: import_outdent43.default.string(indexFiles.map((file) => `export * from './${file.name}'`).join("\n"))
|
|
3019
3188
|
};
|
|
3020
3189
|
return {
|
|
3021
3190
|
dir: ctx.paths.recipe,
|
|
@@ -3034,8 +3203,8 @@ function setupPatterns(ctx) {
|
|
|
3034
3203
|
if (!files)
|
|
3035
3204
|
return;
|
|
3036
3205
|
const index = {
|
|
3037
|
-
js:
|
|
3038
|
-
dts:
|
|
3206
|
+
js: import_outdent43.default.string(files.map((file) => ctx.file.export(`./${file.name}`)).join("\n")),
|
|
3207
|
+
dts: import_outdent43.default.string(files.map((file) => `export * from './${file.name}'`).join("\n"))
|
|
3039
3208
|
};
|
|
3040
3209
|
return {
|
|
3041
3210
|
dir: ctx.paths.pattern,
|
|
@@ -3050,20 +3219,20 @@ function setupPatterns(ctx) {
|
|
|
3050
3219
|
function setupJsx(ctx) {
|
|
3051
3220
|
if (!ctx.jsx.framework)
|
|
3052
3221
|
return;
|
|
3053
|
-
const isValidProp =
|
|
3222
|
+
const isValidProp = generateIsValidProp(ctx);
|
|
3054
3223
|
const types = generateJsxTypes(ctx);
|
|
3055
3224
|
const factory = generateJsxFactory(ctx);
|
|
3056
3225
|
const patterns = generateJsxPatterns(ctx);
|
|
3057
3226
|
const index = {
|
|
3058
|
-
js:
|
|
3227
|
+
js: import_outdent43.default`
|
|
3059
3228
|
${ctx.file.export("./factory")}
|
|
3060
3229
|
${isValidProp?.js ? ctx.file.export("./is-valid-prop") : ""}
|
|
3061
|
-
${
|
|
3230
|
+
${import_outdent43.default.string(patterns.map((file) => ctx.file.export(`./${file.name}`)).join("\n"))}
|
|
3062
3231
|
`,
|
|
3063
|
-
dts:
|
|
3232
|
+
dts: import_outdent43.default`
|
|
3064
3233
|
export * from './factory'
|
|
3065
3234
|
${isValidProp?.dts ? `export * from './is-valid-prop'` : ""}
|
|
3066
|
-
${
|
|
3235
|
+
${import_outdent43.default.string(patterns.map((file) => `export * from './${file.name}'`).join("\n"))}
|
|
3067
3236
|
export type { ${ctx.jsx.typeName} } from '../types/jsx'
|
|
3068
3237
|
`
|
|
3069
3238
|
};
|
|
@@ -3083,15 +3252,17 @@ function setupJsx(ctx) {
|
|
|
3083
3252
|
}
|
|
3084
3253
|
function setupCssIndex(ctx) {
|
|
3085
3254
|
const index = {
|
|
3086
|
-
js:
|
|
3255
|
+
js: import_outdent43.default`
|
|
3087
3256
|
${ctx.file.export("./css")}
|
|
3088
3257
|
${ctx.file.export("./cx")}
|
|
3089
3258
|
${ctx.isTemplateLiteralSyntax ? "" : ctx.file.export("./cva")}
|
|
3259
|
+
${ctx.isTemplateLiteralSyntax ? "" : ctx.file.export("./sva")}
|
|
3090
3260
|
`,
|
|
3091
|
-
dts:
|
|
3261
|
+
dts: import_outdent43.default`
|
|
3092
3262
|
export * from './css'
|
|
3093
3263
|
export * from './cx'
|
|
3094
3264
|
${ctx.isTemplateLiteralSyntax ? "" : `export * from './cva'`}
|
|
3265
|
+
${ctx.isTemplateLiteralSyntax ? "" : `export * from './sva'`}
|
|
3095
3266
|
`
|
|
3096
3267
|
};
|
|
3097
3268
|
return {
|
|
@@ -3135,6 +3306,7 @@ var generateArtifacts = (ctx) => () => {
|
|
|
3135
3306
|
setupKeyframes(ctx),
|
|
3136
3307
|
setupTypes(ctx),
|
|
3137
3308
|
setupCva(ctx),
|
|
3309
|
+
setupSva(ctx),
|
|
3138
3310
|
setupCx(ctx),
|
|
3139
3311
|
setupCss(ctx),
|
|
3140
3312
|
setupRecipes(ctx),
|
|
@@ -3179,13 +3351,15 @@ var generateFlattenedCss = (ctx) => (options) => {
|
|
|
3179
3351
|
].filter(Boolean).join("\n\n") : unresolved
|
|
3180
3352
|
});
|
|
3181
3353
|
sheet.append(...files);
|
|
3182
|
-
|
|
3354
|
+
const output = sheet.toCss({ optimize: true, minify });
|
|
3355
|
+
ctx.hooks.callHook("generator:css", "styles.css", output);
|
|
3356
|
+
return output;
|
|
3183
3357
|
};
|
|
3184
3358
|
|
|
3185
3359
|
// src/artifacts/css/parser-css.ts
|
|
3186
3360
|
var import_logger2 = require("@pandacss/logger");
|
|
3187
3361
|
var import_func = require("lil-fp/func");
|
|
3188
|
-
var
|
|
3362
|
+
var import_ts_pattern10 = require("ts-pattern");
|
|
3189
3363
|
var generateParserCss = (ctx) => (result) => (0, import_func.pipe)(
|
|
3190
3364
|
{ ...ctx, sheet: ctx.createSheet(), result },
|
|
3191
3365
|
(0, import_func.tap)(({ sheet, result: result2, patterns, recipes }) => {
|
|
@@ -3199,6 +3373,11 @@ var generateParserCss = (ctx) => (result) => (0, import_func.pipe)(
|
|
|
3199
3373
|
sheet.processAtomicRecipe(data);
|
|
3200
3374
|
});
|
|
3201
3375
|
});
|
|
3376
|
+
result2.sva.forEach((sva) => {
|
|
3377
|
+
sva.data.forEach((data) => {
|
|
3378
|
+
sheet.processAtomicSlotRecipe(data);
|
|
3379
|
+
});
|
|
3380
|
+
});
|
|
3202
3381
|
result2.jsx.forEach((jsx) => {
|
|
3203
3382
|
jsx.data.forEach((data) => {
|
|
3204
3383
|
sheet.processStyleProps(data);
|
|
@@ -3210,7 +3389,7 @@ var generateParserCss = (ctx) => (result) => (0, import_func.pipe)(
|
|
|
3210
3389
|
const recipeConfig = recipes.getConfig(recipeName);
|
|
3211
3390
|
if (!recipeConfig)
|
|
3212
3391
|
continue;
|
|
3213
|
-
(0,
|
|
3392
|
+
(0, import_ts_pattern10.match)(recipe).with({ type: "jsx-recipe" }, () => {
|
|
3214
3393
|
recipe.data.forEach((data) => {
|
|
3215
3394
|
const [recipeProps, styleProps] = recipes.splitProps(recipeName, data);
|
|
3216
3395
|
sheet.processStyleProps(styleProps);
|
|
@@ -3229,7 +3408,7 @@ var generateParserCss = (ctx) => (result) => (0, import_func.pipe)(
|
|
|
3229
3408
|
result2.pattern.forEach((patternSet, name) => {
|
|
3230
3409
|
try {
|
|
3231
3410
|
for (const pattern of patternSet) {
|
|
3232
|
-
(0,
|
|
3411
|
+
(0, import_ts_pattern10.match)(pattern).with({ type: "jsx-pattern", name: import_ts_pattern10.P.string }, ({ name: jsxName }) => {
|
|
3233
3412
|
pattern.data.forEach((data) => {
|
|
3234
3413
|
const fnName = patterns.getFnName(jsxName);
|
|
3235
3414
|
const styleProps = patterns.transform(fnName, data);
|
|
@@ -3260,7 +3439,7 @@ var generateParserCss = (ctx) => (result) => (0, import_func.pipe)(
|
|
|
3260
3439
|
);
|
|
3261
3440
|
|
|
3262
3441
|
// src/engines/base.ts
|
|
3263
|
-
var
|
|
3442
|
+
var import_core5 = require("@pandacss/core");
|
|
3264
3443
|
var import_is_valid_prop3 = require("@pandacss/is-valid-prop");
|
|
3265
3444
|
var import_shared5 = require("@pandacss/shared");
|
|
3266
3445
|
var import_token_dictionary = require("@pandacss/token-dictionary");
|
|
@@ -3288,14 +3467,14 @@ var getBaseEngine = (conf) => {
|
|
|
3288
3467
|
prefix: prefix.tokens,
|
|
3289
3468
|
hash: hash.tokens
|
|
3290
3469
|
});
|
|
3291
|
-
const utility = new
|
|
3470
|
+
const utility = new import_core5.Utility({
|
|
3292
3471
|
prefix: prefix.className,
|
|
3293
3472
|
tokens,
|
|
3294
3473
|
config: isTemplateLiteralSyntax ? {} : config.utilities,
|
|
3295
3474
|
separator: config.separator,
|
|
3296
3475
|
shorthands: config.shorthands
|
|
3297
3476
|
});
|
|
3298
|
-
const conditions = new
|
|
3477
|
+
const conditions = new import_core5.Conditions({
|
|
3299
3478
|
conditions: isTemplateLiteralSyntax ? {} : config.conditions,
|
|
3300
3479
|
breakpoints: config.theme?.breakpoints
|
|
3301
3480
|
});
|
|
@@ -3305,7 +3484,7 @@ var getBaseEngine = (conf) => {
|
|
|
3305
3484
|
layerStyle: layerStyles
|
|
3306
3485
|
});
|
|
3307
3486
|
const compositionContext = { conditions, utility };
|
|
3308
|
-
(0,
|
|
3487
|
+
(0, import_core5.assignCompositions)(compositions, compositionContext);
|
|
3309
3488
|
const createSheetContext = () => ({
|
|
3310
3489
|
root: import_postcss3.default.root(),
|
|
3311
3490
|
conditions,
|
|
@@ -3315,13 +3494,15 @@ var getBaseEngine = (conf) => {
|
|
|
3315
3494
|
});
|
|
3316
3495
|
const createSheet = (options) => {
|
|
3317
3496
|
const sheetContext = createSheetContext();
|
|
3318
|
-
return new
|
|
3497
|
+
return new import_core5.Stylesheet(sheetContext, {
|
|
3319
3498
|
content: options?.content,
|
|
3320
|
-
recipes: theme?.recipes
|
|
3499
|
+
recipes: theme?.recipes,
|
|
3500
|
+
slotRecipes: theme?.slotRecipes
|
|
3321
3501
|
});
|
|
3322
3502
|
};
|
|
3323
3503
|
const recipeContext = createSheetContext();
|
|
3324
|
-
const
|
|
3504
|
+
const recipeConfigs = Object.assign({}, theme.recipes ?? {}, theme.slotRecipes ?? {});
|
|
3505
|
+
const recipes = new import_core5.Recipes(recipeConfigs, recipeContext);
|
|
3325
3506
|
recipes.save();
|
|
3326
3507
|
const properties = Array.from(/* @__PURE__ */ new Set(["css", ...utility.keys(), ...conditions.keys()]));
|
|
3327
3508
|
const propertyMap = new Map(properties.map((prop) => [prop, true]));
|
|
@@ -3352,13 +3533,14 @@ var getBaseEngine = (conf) => {
|
|
|
3352
3533
|
// src/engines/jsx.ts
|
|
3353
3534
|
var import_shared6 = require("@pandacss/shared");
|
|
3354
3535
|
var getJsxEngine = (config) => {
|
|
3355
|
-
const { jsxFactory, jsxFramework } = config;
|
|
3536
|
+
const { jsxFactory, jsxFramework, jsxStyleProps: jsxStyleProps2 } = config;
|
|
3356
3537
|
return {
|
|
3357
3538
|
factoryName: jsxFactory,
|
|
3358
3539
|
upperName: (0, import_shared6.capitalize)(jsxFactory),
|
|
3359
3540
|
typeName: `HTML${(0, import_shared6.capitalize)(jsxFactory)}Props`,
|
|
3360
3541
|
componentName: `${(0, import_shared6.capitalize)(jsxFactory)}Component`,
|
|
3361
|
-
framework: jsxFramework
|
|
3542
|
+
framework: jsxFramework,
|
|
3543
|
+
styleProps: jsxStyleProps2 ?? "all"
|
|
3362
3544
|
};
|
|
3363
3545
|
};
|
|
3364
3546
|
|
|
@@ -3382,10 +3564,6 @@ var getPathEngine = ({ cwd, emitPackage, outdir }) => {
|
|
|
3382
3564
|
// src/engines/pattern.ts
|
|
3383
3565
|
var import_shared7 = require("@pandacss/shared");
|
|
3384
3566
|
var helpers2 = { map: import_shared7.mapObject };
|
|
3385
|
-
var createRegex = (item) => {
|
|
3386
|
-
const regex = item.map((item2) => typeof item2 === "string" ? item2 : item2.source).join("|");
|
|
3387
|
-
return new RegExp(`^${regex}$`);
|
|
3388
|
-
};
|
|
3389
3567
|
var getPatternEngine = (config) => {
|
|
3390
3568
|
const patterns = config.patterns ?? {};
|
|
3391
3569
|
const getNames = (name) => {
|
|
@@ -3407,7 +3585,7 @@ var getPatternEngine = (config) => {
|
|
|
3407
3585
|
blocklistType: pattern?.blocklist ? `| '${pattern.blocklist.join("' | '")}'` : "",
|
|
3408
3586
|
config: pattern,
|
|
3409
3587
|
type: "pattern",
|
|
3410
|
-
match: createRegex(jsx),
|
|
3588
|
+
match: (0, import_shared7.createRegex)(jsx),
|
|
3411
3589
|
jsx
|
|
3412
3590
|
};
|
|
3413
3591
|
});
|
|
@@ -3453,6 +3631,7 @@ var defaults = (conf) => ({
|
|
|
3453
3631
|
config: {
|
|
3454
3632
|
cssVarRoot: ":where(:root, :host)",
|
|
3455
3633
|
jsxFactory: "styled",
|
|
3634
|
+
jsxStyleProps: "all",
|
|
3456
3635
|
outExtension: "mjs",
|
|
3457
3636
|
shorthands: true,
|
|
3458
3637
|
syntax: "object-literal",
|
|
@@ -3482,6 +3661,7 @@ var createGenerator = (conf) => {
|
|
|
3482
3661
|
importMap: getImportMap(config.outdir.replace(relativeBaseUrl, "")),
|
|
3483
3662
|
jsx: {
|
|
3484
3663
|
factory: jsx.factoryName,
|
|
3664
|
+
styleProps: jsx.styleProps,
|
|
3485
3665
|
isStyleProp: isValidProperty,
|
|
3486
3666
|
nodes: [...patterns.details, ...recipes.details]
|
|
3487
3667
|
},
|