@pandacss/generator 0.14.0 → 0.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +58 -285
- package/dist/index.mjs +58 -285
- package/package.json +8 -8
package/dist/index.js
CHANGED
|
@@ -817,7 +817,7 @@ function generateCvaFn(ctx) {
|
|
|
817
817
|
}
|
|
818
818
|
|
|
819
819
|
export function assertCompoundVariant(name, compoundVariants, variants, prop) {
|
|
820
|
-
if (compoundVariants.length > 0 && typeof variants[prop] === 'object') {
|
|
820
|
+
if (compoundVariants.length > 0 && typeof variants?.[prop] === 'object') {
|
|
821
821
|
throw new Error(\`[recipe:\${name}:\${prop}] Conditions are not supported when using compound variants.\`)
|
|
822
822
|
}
|
|
823
823
|
}
|
|
@@ -868,7 +868,7 @@ var import_outdent8 = require("outdent");
|
|
|
868
868
|
|
|
869
869
|
// src/artifacts/generated/helpers.mjs.json
|
|
870
870
|
var helpers_mjs_default = {
|
|
871
|
-
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
|
|
871
|
+
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 getSlotRecipes = (recipe) => {\n const init = (slot) => ({\n className: [recipe.className, slot].filter(Boolean).join("__"),\n base: recipe.base?.[slot] ?? {},\n variants: {},\n defaultVariants: recipe.defaultVariants ?? {},\n compoundVariants: recipe.compoundVariants ? getSlotCompoundVariant(recipe.compoundVariants, slot) : []\n });\n const recipeParts = recipe.slots.map((slot) => [slot, init(slot)]);\n for (const [variantsKey, variantsSpec] of Object.entries(recipe.variants ?? {})) {\n for (const [variantKey, variantSpec] of Object.entries(variantsSpec)) {\n recipeParts.forEach(([slot, slotRecipe]) => {\n slotRecipe.variants[variantsKey] ??= {};\n slotRecipe.variants[variantsKey][variantKey] = variantSpec[slot] ?? {};\n });\n }\n }\n return Object.fromEntries(recipeParts);\n};\nvar getSlotCompoundVariant = (compoundVariants, slotName) => compoundVariants.filter((compoundVariant) => compoundVariant.css[slotName]).map((compoundVariant) => ({ ...compoundVariant, css: compoundVariant.css[slotName] }));\n\n// src/split-props.ts\nfunction splitProps(props, ...keys) {\n const descriptors = Object.getOwnPropertyDescriptors(props);\n const dKeys = Object.keys(descriptors);\n const split = (k) => {\n const clone = {};\n for (let i = 0; i < k.length; i++) {\n const key = k[i];\n if (descriptors[key]) {\n Object.defineProperty(clone, key, descriptors[key]);\n delete descriptors[key];\n }\n }\n return clone;\n };\n const fn = (key) => split(Array.isArray(key) ? key : dKeys.filter(key));\n return keys.map(fn).concat(split(dKeys));\n}\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'
|
|
872
872
|
};
|
|
873
873
|
|
|
874
874
|
// src/artifacts/generated/astish.mjs.json
|
|
@@ -2477,158 +2477,40 @@ ${ctx.file.importType(upperName, "../types/jsx")}
|
|
|
2477
2477
|
export declare const ${factoryName}: ${upperName}
|
|
2478
2478
|
`,
|
|
2479
2479
|
jsxType: import_outdent37.outdent`
|
|
2480
|
-
import type { Component, FunctionalComponent } from 'vue'
|
|
2480
|
+
import type { Component, FunctionalComponent, NativeElements } from 'vue'
|
|
2481
2481
|
|
|
2482
2482
|
${ctx.file.importType("RecipeDefinition, RecipeSelection, RecipeVariantRecord", "./recipe")}
|
|
2483
2483
|
${ctx.file.importType("Assign, JsxStyleProps, JsxHTMLProps", "./system-types")}
|
|
2484
2484
|
|
|
2485
|
-
type IntrinsicElement =
|
|
2486
|
-
|
|
2487
|
-
|
|
2488
|
-
|
|
2489
|
-
|
|
2490
|
-
|
|
2491
|
-
|
|
2492
|
-
|
|
2493
|
-
| 'b'
|
|
2494
|
-
| 'base'
|
|
2495
|
-
| 'bdi'
|
|
2496
|
-
| 'bdo'
|
|
2497
|
-
| 'blockquote'
|
|
2498
|
-
| 'body'
|
|
2499
|
-
| 'br'
|
|
2500
|
-
| 'button'
|
|
2501
|
-
| 'canvas'
|
|
2502
|
-
| 'caption'
|
|
2503
|
-
| 'cite'
|
|
2504
|
-
| 'code'
|
|
2505
|
-
| 'col'
|
|
2506
|
-
| 'colgroup'
|
|
2507
|
-
| 'data'
|
|
2508
|
-
| 'datalist'
|
|
2509
|
-
| 'dd'
|
|
2510
|
-
| 'del'
|
|
2511
|
-
| 'details'
|
|
2512
|
-
| 'dfn'
|
|
2513
|
-
| 'dialog'
|
|
2514
|
-
| 'div'
|
|
2515
|
-
| 'dl'
|
|
2516
|
-
| 'dt'
|
|
2517
|
-
| 'em'
|
|
2518
|
-
| 'embed'
|
|
2519
|
-
| 'fieldset'
|
|
2520
|
-
| 'figcaption'
|
|
2521
|
-
| 'figure'
|
|
2522
|
-
| 'footer'
|
|
2523
|
-
| 'form'
|
|
2524
|
-
| 'h1'
|
|
2525
|
-
| 'h2'
|
|
2526
|
-
| 'h3'
|
|
2527
|
-
| 'h4'
|
|
2528
|
-
| 'h5'
|
|
2529
|
-
| 'h6'
|
|
2530
|
-
| 'head'
|
|
2531
|
-
| 'header'
|
|
2532
|
-
| 'hgroup'
|
|
2533
|
-
| 'hr'
|
|
2534
|
-
| 'html'
|
|
2535
|
-
| 'i'
|
|
2536
|
-
| 'iframe'
|
|
2537
|
-
| 'img'
|
|
2538
|
-
| 'input'
|
|
2539
|
-
| 'ins'
|
|
2540
|
-
| 'kbd'
|
|
2541
|
-
| 'label'
|
|
2542
|
-
| 'legend'
|
|
2543
|
-
| 'li'
|
|
2544
|
-
| 'link'
|
|
2545
|
-
| 'main'
|
|
2546
|
-
| 'map'
|
|
2547
|
-
| 'mark'
|
|
2548
|
-
| 'math'
|
|
2549
|
-
| 'menu'
|
|
2550
|
-
| 'menuitem'
|
|
2551
|
-
| 'meta'
|
|
2552
|
-
| 'meter'
|
|
2553
|
-
| 'nav'
|
|
2554
|
-
| 'noscript'
|
|
2555
|
-
| 'object'
|
|
2556
|
-
| 'ol'
|
|
2557
|
-
| 'optgroup'
|
|
2558
|
-
| 'option'
|
|
2559
|
-
| 'output'
|
|
2560
|
-
| 'p'
|
|
2561
|
-
| 'param'
|
|
2562
|
-
| 'picture'
|
|
2563
|
-
| 'pre'
|
|
2564
|
-
| 'progress'
|
|
2565
|
-
| 'q'
|
|
2566
|
-
| 'rb'
|
|
2567
|
-
| 'rp'
|
|
2568
|
-
| 'rt'
|
|
2569
|
-
| 'rtc'
|
|
2570
|
-
| 'ruby'
|
|
2571
|
-
| 's'
|
|
2572
|
-
| 'samp'
|
|
2573
|
-
| 'script'
|
|
2574
|
-
| 'section'
|
|
2575
|
-
| 'select'
|
|
2576
|
-
| 'slot'
|
|
2577
|
-
| 'small'
|
|
2578
|
-
| 'source'
|
|
2579
|
-
| 'span'
|
|
2580
|
-
| 'strong'
|
|
2581
|
-
| 'style'
|
|
2582
|
-
| 'sub'
|
|
2583
|
-
| 'summary'
|
|
2584
|
-
| 'sup'
|
|
2585
|
-
| 'svg'
|
|
2586
|
-
| 'table'
|
|
2587
|
-
| 'tbody'
|
|
2588
|
-
| 'td'
|
|
2589
|
-
| 'template'
|
|
2590
|
-
| 'textarea'
|
|
2591
|
-
| 'tfoot'
|
|
2592
|
-
| 'th'
|
|
2593
|
-
| 'thead'
|
|
2594
|
-
| 'time'
|
|
2595
|
-
| 'title'
|
|
2596
|
-
| 'tr'
|
|
2597
|
-
| 'track'
|
|
2598
|
-
| 'u'
|
|
2599
|
-
| 'ul'
|
|
2600
|
-
| 'var'
|
|
2601
|
-
| 'video'
|
|
2602
|
-
| 'wbr'
|
|
2603
|
-
|
|
2604
|
-
type ElementType = IntrinsicElement | Component
|
|
2605
|
-
|
|
2606
|
-
type ComponentProps<T extends ElementType> = T extends keyof JSX.IntrinsicElements
|
|
2607
|
-
? JSX.IntrinsicElements[T]
|
|
2608
|
-
: T extends Component<infer Props>
|
|
2609
|
-
? Props
|
|
2610
|
-
: never
|
|
2611
|
-
|
|
2612
|
-
type ${componentName}<T extends ElementType, P extends Dict = {}> = FunctionalComponent<
|
|
2613
|
-
JsxHTMLProps<ComponentProps<T>, Assign<JsxStyleProps, P>>
|
|
2614
|
-
>
|
|
2485
|
+
type IntrinsicElement = keyof NativeElements
|
|
2486
|
+
type ElementType = IntrinsicElement | Component
|
|
2487
|
+
|
|
2488
|
+
type ComponentProps<T extends ElementType> = T extends IntrinsicElement
|
|
2489
|
+
? NativeElements[T]
|
|
2490
|
+
: T extends Component<infer Props>
|
|
2491
|
+
? Props
|
|
2492
|
+
: never
|
|
2615
2493
|
|
|
2616
|
-
|
|
2494
|
+
type ${componentName}<T extends ElementType, P extends Dict = {}> = FunctionalComponent<
|
|
2495
|
+
JsxHTMLProps<ComponentProps<T>, Assign<JsxStyleProps, P>>
|
|
2496
|
+
>
|
|
2617
2497
|
|
|
2618
|
-
|
|
2619
|
-
|
|
2620
|
-
|
|
2621
|
-
|
|
2622
|
-
|
|
2623
|
-
|
|
2624
|
-
<
|
|
2625
|
-
|
|
2498
|
+
type RecipeFn = { __type: any }
|
|
2499
|
+
|
|
2500
|
+
interface JsxFactory {
|
|
2501
|
+
${styleProps === "none" ? "" : `<T extends ElementType>(component: T): ${componentName}<T, {}>`}
|
|
2502
|
+
<T extends ElementType, P extends RecipeVariantRecord>(component: T, recipe: RecipeDefinition<P>): ${componentName}<
|
|
2503
|
+
T,
|
|
2504
|
+
RecipeSelection<P>
|
|
2505
|
+
>
|
|
2506
|
+
<T extends ElementType, P extends RecipeFn>(component: T, recipeFn: P): ${componentName}<T, P['__type']>
|
|
2507
|
+
}
|
|
2626
2508
|
|
|
2627
|
-
|
|
2509
|
+
type JsxElements = { [K in IntrinsicElement]: ${componentName}<K, {}> }
|
|
2628
2510
|
|
|
2629
|
-
|
|
2511
|
+
export type ${upperName} = JsxFactory ${styleProps === "none" ? "" : "& JsxElements"}
|
|
2630
2512
|
|
|
2631
|
-
|
|
2513
|
+
export type ${typeName}<T extends ElementType> = JsxHTMLProps<ComponentProps<T>, JsxStyleProps>
|
|
2632
2514
|
`
|
|
2633
2515
|
};
|
|
2634
2516
|
}
|
|
@@ -2644,147 +2526,29 @@ ${ctx.file.importType(upperName, "../types/jsx")}
|
|
|
2644
2526
|
export declare const ${factoryName}: ${upperName}
|
|
2645
2527
|
`,
|
|
2646
2528
|
jsxType: import_outdent38.outdent`
|
|
2647
|
-
import type { Component, FunctionalComponent } from 'vue'
|
|
2648
|
-
|
|
2649
|
-
type IntrinsicElement =
|
|
2650
|
-
| 'a'
|
|
2651
|
-
| 'abbr'
|
|
2652
|
-
| 'address'
|
|
2653
|
-
| 'area'
|
|
2654
|
-
| 'article'
|
|
2655
|
-
| 'aside'
|
|
2656
|
-
| 'audio'
|
|
2657
|
-
| 'b'
|
|
2658
|
-
| 'base'
|
|
2659
|
-
| 'bdi'
|
|
2660
|
-
| 'bdo'
|
|
2661
|
-
| 'blockquote'
|
|
2662
|
-
| 'body'
|
|
2663
|
-
| 'br'
|
|
2664
|
-
| 'button'
|
|
2665
|
-
| 'canvas'
|
|
2666
|
-
| 'caption'
|
|
2667
|
-
| 'cite'
|
|
2668
|
-
| 'code'
|
|
2669
|
-
| 'col'
|
|
2670
|
-
| 'colgroup'
|
|
2671
|
-
| 'data'
|
|
2672
|
-
| 'datalist'
|
|
2673
|
-
| 'dd'
|
|
2674
|
-
| 'del'
|
|
2675
|
-
| 'details'
|
|
2676
|
-
| 'dfn'
|
|
2677
|
-
| 'dialog'
|
|
2678
|
-
| 'div'
|
|
2679
|
-
| 'dl'
|
|
2680
|
-
| 'dt'
|
|
2681
|
-
| 'em'
|
|
2682
|
-
| 'embed'
|
|
2683
|
-
| 'fieldset'
|
|
2684
|
-
| 'figcaption'
|
|
2685
|
-
| 'figure'
|
|
2686
|
-
| 'footer'
|
|
2687
|
-
| 'form'
|
|
2688
|
-
| 'h1'
|
|
2689
|
-
| 'h2'
|
|
2690
|
-
| 'h3'
|
|
2691
|
-
| 'h4'
|
|
2692
|
-
| 'h5'
|
|
2693
|
-
| 'h6'
|
|
2694
|
-
| 'head'
|
|
2695
|
-
| 'header'
|
|
2696
|
-
| 'hgroup'
|
|
2697
|
-
| 'hr'
|
|
2698
|
-
| 'html'
|
|
2699
|
-
| 'i'
|
|
2700
|
-
| 'iframe'
|
|
2701
|
-
| 'img'
|
|
2702
|
-
| 'input'
|
|
2703
|
-
| 'ins'
|
|
2704
|
-
| 'kbd'
|
|
2705
|
-
| 'label'
|
|
2706
|
-
| 'legend'
|
|
2707
|
-
| 'li'
|
|
2708
|
-
| 'link'
|
|
2709
|
-
| 'main'
|
|
2710
|
-
| 'map'
|
|
2711
|
-
| 'mark'
|
|
2712
|
-
| 'math'
|
|
2713
|
-
| 'menu'
|
|
2714
|
-
| 'menuitem'
|
|
2715
|
-
| 'meta'
|
|
2716
|
-
| 'meter'
|
|
2717
|
-
| 'nav'
|
|
2718
|
-
| 'noscript'
|
|
2719
|
-
| 'object'
|
|
2720
|
-
| 'ol'
|
|
2721
|
-
| 'optgroup'
|
|
2722
|
-
| 'option'
|
|
2723
|
-
| 'output'
|
|
2724
|
-
| 'p'
|
|
2725
|
-
| 'param'
|
|
2726
|
-
| 'picture'
|
|
2727
|
-
| 'pre'
|
|
2728
|
-
| 'progress'
|
|
2729
|
-
| 'q'
|
|
2730
|
-
| 'rb'
|
|
2731
|
-
| 'rp'
|
|
2732
|
-
| 'rt'
|
|
2733
|
-
| 'rtc'
|
|
2734
|
-
| 'ruby'
|
|
2735
|
-
| 's'
|
|
2736
|
-
| 'samp'
|
|
2737
|
-
| 'script'
|
|
2738
|
-
| 'section'
|
|
2739
|
-
| 'select'
|
|
2740
|
-
| 'slot'
|
|
2741
|
-
| 'small'
|
|
2742
|
-
| 'source'
|
|
2743
|
-
| 'span'
|
|
2744
|
-
| 'strong'
|
|
2745
|
-
| 'style'
|
|
2746
|
-
| 'sub'
|
|
2747
|
-
| 'summary'
|
|
2748
|
-
| 'sup'
|
|
2749
|
-
| 'svg'
|
|
2750
|
-
| 'table'
|
|
2751
|
-
| 'tbody'
|
|
2752
|
-
| 'td'
|
|
2753
|
-
| 'template'
|
|
2754
|
-
| 'textarea'
|
|
2755
|
-
| 'tfoot'
|
|
2756
|
-
| 'th'
|
|
2757
|
-
| 'thead'
|
|
2758
|
-
| 'time'
|
|
2759
|
-
| 'title'
|
|
2760
|
-
| 'tr'
|
|
2761
|
-
| 'track'
|
|
2762
|
-
| 'u'
|
|
2763
|
-
| 'ul'
|
|
2764
|
-
| 'var'
|
|
2765
|
-
| 'video'
|
|
2766
|
-
| 'wbr'
|
|
2767
|
-
|
|
2768
|
-
type ElementType = IntrinsicElement | Component
|
|
2769
|
-
|
|
2770
|
-
type ComponentProps<T extends ElementType> = T extends keyof JSX.IntrinsicElements
|
|
2771
|
-
? JSX.IntrinsicElements[T]
|
|
2772
|
-
: T extends Component<infer Props>
|
|
2773
|
-
? Props
|
|
2774
|
-
: never
|
|
2775
|
-
|
|
2776
|
-
type ${componentName}<T extends ElementType> = FunctionalComponent<ComponentProps<T>>
|
|
2777
|
-
>
|
|
2529
|
+
import type { Component, FunctionalComponent, NativeElements } from 'vue'
|
|
2778
2530
|
|
|
2779
|
-
|
|
2780
|
-
|
|
2781
|
-
|
|
2531
|
+
type IntrinsicElement = keyof NativeElements
|
|
2532
|
+
type ElementType = IntrinsicElement | Component
|
|
2533
|
+
|
|
2534
|
+
type ComponentProps<T extends ElementType> = T extends IntrinsicElement
|
|
2535
|
+
? NativeElements[T]
|
|
2536
|
+
: T extends Component<infer Props>
|
|
2537
|
+
? Props
|
|
2538
|
+
: never
|
|
2782
2539
|
|
|
2783
|
-
|
|
2540
|
+
type ${componentName}<T extends ElementType> = FunctionalComponent<ComponentProps<T>>
|
|
2541
|
+
>
|
|
2784
2542
|
|
|
2785
|
-
|
|
2543
|
+
interface JsxFactory {
|
|
2544
|
+
<T extends ElementType>(component: T): ${componentName}<T>
|
|
2545
|
+
}
|
|
2786
2546
|
|
|
2787
|
-
|
|
2547
|
+
type JsxElements = { [K in IntrinsicElement]: ${componentName}<K> }
|
|
2548
|
+
|
|
2549
|
+
export type ${upperName} = JsxFactory ${styleProps === "none" ? "" : "& JsxElements"}
|
|
2550
|
+
|
|
2551
|
+
export type ${typeName}<T extends ElementType> = ComponentProps<T>
|
|
2788
2552
|
`
|
|
2789
2553
|
};
|
|
2790
2554
|
}
|
|
@@ -3405,7 +3169,7 @@ var generateParserCss = (ctx) => (result) => (0, import_func.pipe)(
|
|
|
3405
3169
|
});
|
|
3406
3170
|
result2.jsx.forEach((jsx) => {
|
|
3407
3171
|
jsx.data.forEach((data) => {
|
|
3408
|
-
sheet.processStyleProps(data);
|
|
3172
|
+
sheet.processStyleProps(filterProps(ctx, data));
|
|
3409
3173
|
});
|
|
3410
3174
|
});
|
|
3411
3175
|
result2.recipe.forEach((recipeSet, recipeName) => {
|
|
@@ -3417,7 +3181,7 @@ var generateParserCss = (ctx) => (result) => (0, import_func.pipe)(
|
|
|
3417
3181
|
(0, import_ts_pattern10.match)(recipe).with({ type: "jsx-recipe" }, () => {
|
|
3418
3182
|
recipe.data.forEach((data) => {
|
|
3419
3183
|
const [recipeProps, styleProps] = recipes.splitProps(recipeName, data);
|
|
3420
|
-
sheet.processStyleProps(styleProps);
|
|
3184
|
+
sheet.processStyleProps(filterProps(ctx, styleProps));
|
|
3421
3185
|
sheet.processRecipe(recipeName, recipeConfig, recipeProps);
|
|
3422
3186
|
});
|
|
3423
3187
|
}).otherwise(() => {
|
|
@@ -3437,7 +3201,7 @@ var generateParserCss = (ctx) => (result) => (0, import_func.pipe)(
|
|
|
3437
3201
|
pattern.data.forEach((data) => {
|
|
3438
3202
|
const fnName = patterns.find(jsxName);
|
|
3439
3203
|
const styleProps = patterns.transform(fnName, data);
|
|
3440
|
-
sheet.processStyleProps(styleProps);
|
|
3204
|
+
sheet.processStyleProps(filterProps(ctx, styleProps));
|
|
3441
3205
|
});
|
|
3442
3206
|
}).otherwise(() => {
|
|
3443
3207
|
pattern.data.forEach((data) => {
|
|
@@ -3462,6 +3226,15 @@ var generateParserCss = (ctx) => (result) => (0, import_func.pipe)(
|
|
|
3462
3226
|
}
|
|
3463
3227
|
)
|
|
3464
3228
|
);
|
|
3229
|
+
var filterProps = (ctx, props) => {
|
|
3230
|
+
const clone = {};
|
|
3231
|
+
for (const [key, value] of Object.entries(props)) {
|
|
3232
|
+
if (ctx.isValidProperty(key)) {
|
|
3233
|
+
clone[key] = value;
|
|
3234
|
+
}
|
|
3235
|
+
}
|
|
3236
|
+
return clone;
|
|
3237
|
+
};
|
|
3465
3238
|
|
|
3466
3239
|
// src/engines/base.ts
|
|
3467
3240
|
var import_core5 = require("@pandacss/core");
|
package/dist/index.mjs
CHANGED
|
@@ -786,7 +786,7 @@ function generateCvaFn(ctx) {
|
|
|
786
786
|
}
|
|
787
787
|
|
|
788
788
|
export function assertCompoundVariant(name, compoundVariants, variants, prop) {
|
|
789
|
-
if (compoundVariants.length > 0 && typeof variants[prop] === 'object') {
|
|
789
|
+
if (compoundVariants.length > 0 && typeof variants?.[prop] === 'object') {
|
|
790
790
|
throw new Error(\`[recipe:\${name}:\${prop}] Conditions are not supported when using compound variants.\`)
|
|
791
791
|
}
|
|
792
792
|
}
|
|
@@ -837,7 +837,7 @@ import { outdent as outdent8 } from "outdent";
|
|
|
837
837
|
|
|
838
838
|
// src/artifacts/generated/helpers.mjs.json
|
|
839
839
|
var helpers_mjs_default = {
|
|
840
|
-
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
|
|
840
|
+
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 getSlotRecipes = (recipe) => {\n const init = (slot) => ({\n className: [recipe.className, slot].filter(Boolean).join("__"),\n base: recipe.base?.[slot] ?? {},\n variants: {},\n defaultVariants: recipe.defaultVariants ?? {},\n compoundVariants: recipe.compoundVariants ? getSlotCompoundVariant(recipe.compoundVariants, slot) : []\n });\n const recipeParts = recipe.slots.map((slot) => [slot, init(slot)]);\n for (const [variantsKey, variantsSpec] of Object.entries(recipe.variants ?? {})) {\n for (const [variantKey, variantSpec] of Object.entries(variantsSpec)) {\n recipeParts.forEach(([slot, slotRecipe]) => {\n slotRecipe.variants[variantsKey] ??= {};\n slotRecipe.variants[variantsKey][variantKey] = variantSpec[slot] ?? {};\n });\n }\n }\n return Object.fromEntries(recipeParts);\n};\nvar getSlotCompoundVariant = (compoundVariants, slotName) => compoundVariants.filter((compoundVariant) => compoundVariant.css[slotName]).map((compoundVariant) => ({ ...compoundVariant, css: compoundVariant.css[slotName] }));\n\n// src/split-props.ts\nfunction splitProps(props, ...keys) {\n const descriptors = Object.getOwnPropertyDescriptors(props);\n const dKeys = Object.keys(descriptors);\n const split = (k) => {\n const clone = {};\n for (let i = 0; i < k.length; i++) {\n const key = k[i];\n if (descriptors[key]) {\n Object.defineProperty(clone, key, descriptors[key]);\n delete descriptors[key];\n }\n }\n return clone;\n };\n const fn = (key) => split(Array.isArray(key) ? key : dKeys.filter(key));\n return keys.map(fn).concat(split(dKeys));\n}\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'
|
|
841
841
|
};
|
|
842
842
|
|
|
843
843
|
// src/artifacts/generated/astish.mjs.json
|
|
@@ -2446,158 +2446,40 @@ ${ctx.file.importType(upperName, "../types/jsx")}
|
|
|
2446
2446
|
export declare const ${factoryName}: ${upperName}
|
|
2447
2447
|
`,
|
|
2448
2448
|
jsxType: outdent37`
|
|
2449
|
-
import type { Component, FunctionalComponent } from 'vue'
|
|
2449
|
+
import type { Component, FunctionalComponent, NativeElements } from 'vue'
|
|
2450
2450
|
|
|
2451
2451
|
${ctx.file.importType("RecipeDefinition, RecipeSelection, RecipeVariantRecord", "./recipe")}
|
|
2452
2452
|
${ctx.file.importType("Assign, JsxStyleProps, JsxHTMLProps", "./system-types")}
|
|
2453
2453
|
|
|
2454
|
-
type IntrinsicElement =
|
|
2455
|
-
|
|
2456
|
-
|
|
2457
|
-
|
|
2458
|
-
|
|
2459
|
-
|
|
2460
|
-
|
|
2461
|
-
|
|
2462
|
-
| 'b'
|
|
2463
|
-
| 'base'
|
|
2464
|
-
| 'bdi'
|
|
2465
|
-
| 'bdo'
|
|
2466
|
-
| 'blockquote'
|
|
2467
|
-
| 'body'
|
|
2468
|
-
| 'br'
|
|
2469
|
-
| 'button'
|
|
2470
|
-
| 'canvas'
|
|
2471
|
-
| 'caption'
|
|
2472
|
-
| 'cite'
|
|
2473
|
-
| 'code'
|
|
2474
|
-
| 'col'
|
|
2475
|
-
| 'colgroup'
|
|
2476
|
-
| 'data'
|
|
2477
|
-
| 'datalist'
|
|
2478
|
-
| 'dd'
|
|
2479
|
-
| 'del'
|
|
2480
|
-
| 'details'
|
|
2481
|
-
| 'dfn'
|
|
2482
|
-
| 'dialog'
|
|
2483
|
-
| 'div'
|
|
2484
|
-
| 'dl'
|
|
2485
|
-
| 'dt'
|
|
2486
|
-
| 'em'
|
|
2487
|
-
| 'embed'
|
|
2488
|
-
| 'fieldset'
|
|
2489
|
-
| 'figcaption'
|
|
2490
|
-
| 'figure'
|
|
2491
|
-
| 'footer'
|
|
2492
|
-
| 'form'
|
|
2493
|
-
| 'h1'
|
|
2494
|
-
| 'h2'
|
|
2495
|
-
| 'h3'
|
|
2496
|
-
| 'h4'
|
|
2497
|
-
| 'h5'
|
|
2498
|
-
| 'h6'
|
|
2499
|
-
| 'head'
|
|
2500
|
-
| 'header'
|
|
2501
|
-
| 'hgroup'
|
|
2502
|
-
| 'hr'
|
|
2503
|
-
| 'html'
|
|
2504
|
-
| 'i'
|
|
2505
|
-
| 'iframe'
|
|
2506
|
-
| 'img'
|
|
2507
|
-
| 'input'
|
|
2508
|
-
| 'ins'
|
|
2509
|
-
| 'kbd'
|
|
2510
|
-
| 'label'
|
|
2511
|
-
| 'legend'
|
|
2512
|
-
| 'li'
|
|
2513
|
-
| 'link'
|
|
2514
|
-
| 'main'
|
|
2515
|
-
| 'map'
|
|
2516
|
-
| 'mark'
|
|
2517
|
-
| 'math'
|
|
2518
|
-
| 'menu'
|
|
2519
|
-
| 'menuitem'
|
|
2520
|
-
| 'meta'
|
|
2521
|
-
| 'meter'
|
|
2522
|
-
| 'nav'
|
|
2523
|
-
| 'noscript'
|
|
2524
|
-
| 'object'
|
|
2525
|
-
| 'ol'
|
|
2526
|
-
| 'optgroup'
|
|
2527
|
-
| 'option'
|
|
2528
|
-
| 'output'
|
|
2529
|
-
| 'p'
|
|
2530
|
-
| 'param'
|
|
2531
|
-
| 'picture'
|
|
2532
|
-
| 'pre'
|
|
2533
|
-
| 'progress'
|
|
2534
|
-
| 'q'
|
|
2535
|
-
| 'rb'
|
|
2536
|
-
| 'rp'
|
|
2537
|
-
| 'rt'
|
|
2538
|
-
| 'rtc'
|
|
2539
|
-
| 'ruby'
|
|
2540
|
-
| 's'
|
|
2541
|
-
| 'samp'
|
|
2542
|
-
| 'script'
|
|
2543
|
-
| 'section'
|
|
2544
|
-
| 'select'
|
|
2545
|
-
| 'slot'
|
|
2546
|
-
| 'small'
|
|
2547
|
-
| 'source'
|
|
2548
|
-
| 'span'
|
|
2549
|
-
| 'strong'
|
|
2550
|
-
| 'style'
|
|
2551
|
-
| 'sub'
|
|
2552
|
-
| 'summary'
|
|
2553
|
-
| 'sup'
|
|
2554
|
-
| 'svg'
|
|
2555
|
-
| 'table'
|
|
2556
|
-
| 'tbody'
|
|
2557
|
-
| 'td'
|
|
2558
|
-
| 'template'
|
|
2559
|
-
| 'textarea'
|
|
2560
|
-
| 'tfoot'
|
|
2561
|
-
| 'th'
|
|
2562
|
-
| 'thead'
|
|
2563
|
-
| 'time'
|
|
2564
|
-
| 'title'
|
|
2565
|
-
| 'tr'
|
|
2566
|
-
| 'track'
|
|
2567
|
-
| 'u'
|
|
2568
|
-
| 'ul'
|
|
2569
|
-
| 'var'
|
|
2570
|
-
| 'video'
|
|
2571
|
-
| 'wbr'
|
|
2572
|
-
|
|
2573
|
-
type ElementType = IntrinsicElement | Component
|
|
2574
|
-
|
|
2575
|
-
type ComponentProps<T extends ElementType> = T extends keyof JSX.IntrinsicElements
|
|
2576
|
-
? JSX.IntrinsicElements[T]
|
|
2577
|
-
: T extends Component<infer Props>
|
|
2578
|
-
? Props
|
|
2579
|
-
: never
|
|
2580
|
-
|
|
2581
|
-
type ${componentName}<T extends ElementType, P extends Dict = {}> = FunctionalComponent<
|
|
2582
|
-
JsxHTMLProps<ComponentProps<T>, Assign<JsxStyleProps, P>>
|
|
2583
|
-
>
|
|
2454
|
+
type IntrinsicElement = keyof NativeElements
|
|
2455
|
+
type ElementType = IntrinsicElement | Component
|
|
2456
|
+
|
|
2457
|
+
type ComponentProps<T extends ElementType> = T extends IntrinsicElement
|
|
2458
|
+
? NativeElements[T]
|
|
2459
|
+
: T extends Component<infer Props>
|
|
2460
|
+
? Props
|
|
2461
|
+
: never
|
|
2584
2462
|
|
|
2585
|
-
|
|
2463
|
+
type ${componentName}<T extends ElementType, P extends Dict = {}> = FunctionalComponent<
|
|
2464
|
+
JsxHTMLProps<ComponentProps<T>, Assign<JsxStyleProps, P>>
|
|
2465
|
+
>
|
|
2586
2466
|
|
|
2587
|
-
|
|
2588
|
-
|
|
2589
|
-
|
|
2590
|
-
|
|
2591
|
-
|
|
2592
|
-
|
|
2593
|
-
<
|
|
2594
|
-
|
|
2467
|
+
type RecipeFn = { __type: any }
|
|
2468
|
+
|
|
2469
|
+
interface JsxFactory {
|
|
2470
|
+
${styleProps === "none" ? "" : `<T extends ElementType>(component: T): ${componentName}<T, {}>`}
|
|
2471
|
+
<T extends ElementType, P extends RecipeVariantRecord>(component: T, recipe: RecipeDefinition<P>): ${componentName}<
|
|
2472
|
+
T,
|
|
2473
|
+
RecipeSelection<P>
|
|
2474
|
+
>
|
|
2475
|
+
<T extends ElementType, P extends RecipeFn>(component: T, recipeFn: P): ${componentName}<T, P['__type']>
|
|
2476
|
+
}
|
|
2595
2477
|
|
|
2596
|
-
|
|
2478
|
+
type JsxElements = { [K in IntrinsicElement]: ${componentName}<K, {}> }
|
|
2597
2479
|
|
|
2598
|
-
|
|
2480
|
+
export type ${upperName} = JsxFactory ${styleProps === "none" ? "" : "& JsxElements"}
|
|
2599
2481
|
|
|
2600
|
-
|
|
2482
|
+
export type ${typeName}<T extends ElementType> = JsxHTMLProps<ComponentProps<T>, JsxStyleProps>
|
|
2601
2483
|
`
|
|
2602
2484
|
};
|
|
2603
2485
|
}
|
|
@@ -2613,147 +2495,29 @@ ${ctx.file.importType(upperName, "../types/jsx")}
|
|
|
2613
2495
|
export declare const ${factoryName}: ${upperName}
|
|
2614
2496
|
`,
|
|
2615
2497
|
jsxType: outdent38`
|
|
2616
|
-
import type { Component, FunctionalComponent } from 'vue'
|
|
2617
|
-
|
|
2618
|
-
type IntrinsicElement =
|
|
2619
|
-
| 'a'
|
|
2620
|
-
| 'abbr'
|
|
2621
|
-
| 'address'
|
|
2622
|
-
| 'area'
|
|
2623
|
-
| 'article'
|
|
2624
|
-
| 'aside'
|
|
2625
|
-
| 'audio'
|
|
2626
|
-
| 'b'
|
|
2627
|
-
| 'base'
|
|
2628
|
-
| 'bdi'
|
|
2629
|
-
| 'bdo'
|
|
2630
|
-
| 'blockquote'
|
|
2631
|
-
| 'body'
|
|
2632
|
-
| 'br'
|
|
2633
|
-
| 'button'
|
|
2634
|
-
| 'canvas'
|
|
2635
|
-
| 'caption'
|
|
2636
|
-
| 'cite'
|
|
2637
|
-
| 'code'
|
|
2638
|
-
| 'col'
|
|
2639
|
-
| 'colgroup'
|
|
2640
|
-
| 'data'
|
|
2641
|
-
| 'datalist'
|
|
2642
|
-
| 'dd'
|
|
2643
|
-
| 'del'
|
|
2644
|
-
| 'details'
|
|
2645
|
-
| 'dfn'
|
|
2646
|
-
| 'dialog'
|
|
2647
|
-
| 'div'
|
|
2648
|
-
| 'dl'
|
|
2649
|
-
| 'dt'
|
|
2650
|
-
| 'em'
|
|
2651
|
-
| 'embed'
|
|
2652
|
-
| 'fieldset'
|
|
2653
|
-
| 'figcaption'
|
|
2654
|
-
| 'figure'
|
|
2655
|
-
| 'footer'
|
|
2656
|
-
| 'form'
|
|
2657
|
-
| 'h1'
|
|
2658
|
-
| 'h2'
|
|
2659
|
-
| 'h3'
|
|
2660
|
-
| 'h4'
|
|
2661
|
-
| 'h5'
|
|
2662
|
-
| 'h6'
|
|
2663
|
-
| 'head'
|
|
2664
|
-
| 'header'
|
|
2665
|
-
| 'hgroup'
|
|
2666
|
-
| 'hr'
|
|
2667
|
-
| 'html'
|
|
2668
|
-
| 'i'
|
|
2669
|
-
| 'iframe'
|
|
2670
|
-
| 'img'
|
|
2671
|
-
| 'input'
|
|
2672
|
-
| 'ins'
|
|
2673
|
-
| 'kbd'
|
|
2674
|
-
| 'label'
|
|
2675
|
-
| 'legend'
|
|
2676
|
-
| 'li'
|
|
2677
|
-
| 'link'
|
|
2678
|
-
| 'main'
|
|
2679
|
-
| 'map'
|
|
2680
|
-
| 'mark'
|
|
2681
|
-
| 'math'
|
|
2682
|
-
| 'menu'
|
|
2683
|
-
| 'menuitem'
|
|
2684
|
-
| 'meta'
|
|
2685
|
-
| 'meter'
|
|
2686
|
-
| 'nav'
|
|
2687
|
-
| 'noscript'
|
|
2688
|
-
| 'object'
|
|
2689
|
-
| 'ol'
|
|
2690
|
-
| 'optgroup'
|
|
2691
|
-
| 'option'
|
|
2692
|
-
| 'output'
|
|
2693
|
-
| 'p'
|
|
2694
|
-
| 'param'
|
|
2695
|
-
| 'picture'
|
|
2696
|
-
| 'pre'
|
|
2697
|
-
| 'progress'
|
|
2698
|
-
| 'q'
|
|
2699
|
-
| 'rb'
|
|
2700
|
-
| 'rp'
|
|
2701
|
-
| 'rt'
|
|
2702
|
-
| 'rtc'
|
|
2703
|
-
| 'ruby'
|
|
2704
|
-
| 's'
|
|
2705
|
-
| 'samp'
|
|
2706
|
-
| 'script'
|
|
2707
|
-
| 'section'
|
|
2708
|
-
| 'select'
|
|
2709
|
-
| 'slot'
|
|
2710
|
-
| 'small'
|
|
2711
|
-
| 'source'
|
|
2712
|
-
| 'span'
|
|
2713
|
-
| 'strong'
|
|
2714
|
-
| 'style'
|
|
2715
|
-
| 'sub'
|
|
2716
|
-
| 'summary'
|
|
2717
|
-
| 'sup'
|
|
2718
|
-
| 'svg'
|
|
2719
|
-
| 'table'
|
|
2720
|
-
| 'tbody'
|
|
2721
|
-
| 'td'
|
|
2722
|
-
| 'template'
|
|
2723
|
-
| 'textarea'
|
|
2724
|
-
| 'tfoot'
|
|
2725
|
-
| 'th'
|
|
2726
|
-
| 'thead'
|
|
2727
|
-
| 'time'
|
|
2728
|
-
| 'title'
|
|
2729
|
-
| 'tr'
|
|
2730
|
-
| 'track'
|
|
2731
|
-
| 'u'
|
|
2732
|
-
| 'ul'
|
|
2733
|
-
| 'var'
|
|
2734
|
-
| 'video'
|
|
2735
|
-
| 'wbr'
|
|
2736
|
-
|
|
2737
|
-
type ElementType = IntrinsicElement | Component
|
|
2738
|
-
|
|
2739
|
-
type ComponentProps<T extends ElementType> = T extends keyof JSX.IntrinsicElements
|
|
2740
|
-
? JSX.IntrinsicElements[T]
|
|
2741
|
-
: T extends Component<infer Props>
|
|
2742
|
-
? Props
|
|
2743
|
-
: never
|
|
2744
|
-
|
|
2745
|
-
type ${componentName}<T extends ElementType> = FunctionalComponent<ComponentProps<T>>
|
|
2746
|
-
>
|
|
2498
|
+
import type { Component, FunctionalComponent, NativeElements } from 'vue'
|
|
2747
2499
|
|
|
2748
|
-
|
|
2749
|
-
|
|
2750
|
-
|
|
2500
|
+
type IntrinsicElement = keyof NativeElements
|
|
2501
|
+
type ElementType = IntrinsicElement | Component
|
|
2502
|
+
|
|
2503
|
+
type ComponentProps<T extends ElementType> = T extends IntrinsicElement
|
|
2504
|
+
? NativeElements[T]
|
|
2505
|
+
: T extends Component<infer Props>
|
|
2506
|
+
? Props
|
|
2507
|
+
: never
|
|
2751
2508
|
|
|
2752
|
-
|
|
2509
|
+
type ${componentName}<T extends ElementType> = FunctionalComponent<ComponentProps<T>>
|
|
2510
|
+
>
|
|
2753
2511
|
|
|
2754
|
-
|
|
2512
|
+
interface JsxFactory {
|
|
2513
|
+
<T extends ElementType>(component: T): ${componentName}<T>
|
|
2514
|
+
}
|
|
2755
2515
|
|
|
2756
|
-
|
|
2516
|
+
type JsxElements = { [K in IntrinsicElement]: ${componentName}<K> }
|
|
2517
|
+
|
|
2518
|
+
export type ${upperName} = JsxFactory ${styleProps === "none" ? "" : "& JsxElements"}
|
|
2519
|
+
|
|
2520
|
+
export type ${typeName}<T extends ElementType> = ComponentProps<T>
|
|
2757
2521
|
`
|
|
2758
2522
|
};
|
|
2759
2523
|
}
|
|
@@ -3374,7 +3138,7 @@ var generateParserCss = (ctx) => (result) => pipe(
|
|
|
3374
3138
|
});
|
|
3375
3139
|
result2.jsx.forEach((jsx) => {
|
|
3376
3140
|
jsx.data.forEach((data) => {
|
|
3377
|
-
sheet.processStyleProps(data);
|
|
3141
|
+
sheet.processStyleProps(filterProps(ctx, data));
|
|
3378
3142
|
});
|
|
3379
3143
|
});
|
|
3380
3144
|
result2.recipe.forEach((recipeSet, recipeName) => {
|
|
@@ -3386,7 +3150,7 @@ var generateParserCss = (ctx) => (result) => pipe(
|
|
|
3386
3150
|
match10(recipe).with({ type: "jsx-recipe" }, () => {
|
|
3387
3151
|
recipe.data.forEach((data) => {
|
|
3388
3152
|
const [recipeProps, styleProps] = recipes.splitProps(recipeName, data);
|
|
3389
|
-
sheet.processStyleProps(styleProps);
|
|
3153
|
+
sheet.processStyleProps(filterProps(ctx, styleProps));
|
|
3390
3154
|
sheet.processRecipe(recipeName, recipeConfig, recipeProps);
|
|
3391
3155
|
});
|
|
3392
3156
|
}).otherwise(() => {
|
|
@@ -3406,7 +3170,7 @@ var generateParserCss = (ctx) => (result) => pipe(
|
|
|
3406
3170
|
pattern.data.forEach((data) => {
|
|
3407
3171
|
const fnName = patterns.find(jsxName);
|
|
3408
3172
|
const styleProps = patterns.transform(fnName, data);
|
|
3409
|
-
sheet.processStyleProps(styleProps);
|
|
3173
|
+
sheet.processStyleProps(filterProps(ctx, styleProps));
|
|
3410
3174
|
});
|
|
3411
3175
|
}).otherwise(() => {
|
|
3412
3176
|
pattern.data.forEach((data) => {
|
|
@@ -3431,6 +3195,15 @@ var generateParserCss = (ctx) => (result) => pipe(
|
|
|
3431
3195
|
}
|
|
3432
3196
|
)
|
|
3433
3197
|
);
|
|
3198
|
+
var filterProps = (ctx, props) => {
|
|
3199
|
+
const clone = {};
|
|
3200
|
+
for (const [key, value] of Object.entries(props)) {
|
|
3201
|
+
if (ctx.isValidProperty(key)) {
|
|
3202
|
+
clone[key] = value;
|
|
3203
|
+
}
|
|
3204
|
+
}
|
|
3205
|
+
return clone;
|
|
3206
|
+
};
|
|
3434
3207
|
|
|
3435
3208
|
// src/engines/base.ts
|
|
3436
3209
|
import {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pandacss/generator",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.15.0",
|
|
4
4
|
"description": "The css generator for css panda",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -20,17 +20,17 @@
|
|
|
20
20
|
"pluralize": "8.0.0",
|
|
21
21
|
"postcss": "8.4.27",
|
|
22
22
|
"ts-pattern": "5.0.4",
|
|
23
|
-
"@pandacss/core": "0.
|
|
24
|
-
"@pandacss/is-valid-prop": "0.
|
|
25
|
-
"@pandacss/logger": "0.
|
|
26
|
-
"@pandacss/shared": "0.
|
|
27
|
-
"@pandacss/token-dictionary": "0.
|
|
28
|
-
"@pandacss/types": "0.
|
|
23
|
+
"@pandacss/core": "0.15.0",
|
|
24
|
+
"@pandacss/is-valid-prop": "0.15.0",
|
|
25
|
+
"@pandacss/logger": "0.15.0",
|
|
26
|
+
"@pandacss/shared": "0.15.0",
|
|
27
|
+
"@pandacss/token-dictionary": "0.15.0",
|
|
28
|
+
"@pandacss/types": "0.15.0"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@types/pluralize": "0.0.30",
|
|
32
32
|
"hookable": "5.5.3",
|
|
33
|
-
"@pandacss/fixture": "0.
|
|
33
|
+
"@pandacss/fixture": "0.15.0"
|
|
34
34
|
},
|
|
35
35
|
"scripts": {
|
|
36
36
|
"prebuild": "tsx scripts/prebuild.ts",
|