@pandacss/generator 0.14.0 → 0.15.1
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 +95 -298
- package/dist/index.mjs +95 -298
- package/package.json +9 -9
package/dist/index.js
CHANGED
|
@@ -228,8 +228,8 @@ function generateResetCss(ctx, scope = "") {
|
|
|
228
228
|
'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol',
|
|
229
229
|
'Noto Color Emoji';
|
|
230
230
|
-webkit-text-size-adjust: 100%;
|
|
231
|
-
-webkit-text-size-adjust: 100%;
|
|
232
231
|
-webkit-font-smoothing: antialiased;
|
|
232
|
+
-moz-osx-font-smoothing: grayscale;
|
|
233
233
|
-moz-tab-size: 4;
|
|
234
234
|
tab-size: 4;
|
|
235
235
|
font-family: var(--global-font-body, var(--font-fallback));
|
|
@@ -371,24 +371,39 @@ function generateResetCss(ctx, scope = "") {
|
|
|
371
371
|
font-family: var(--global-font-mono, var(--font-fallback));
|
|
372
372
|
}
|
|
373
373
|
|
|
374
|
-
|
|
374
|
+
|
|
375
|
+
${selector}input[type="text"],
|
|
376
|
+
${selector}input[type="email"],
|
|
377
|
+
${selector}input[type="search"],
|
|
378
|
+
${selector}input[type="password"] {
|
|
379
|
+
-webkit-appearance: none;
|
|
380
|
+
-moz-appearance: none;
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
${selector}input[type='search'] {
|
|
375
384
|
-webkit-appearance: textfield;
|
|
376
385
|
outline-offset: -2px;
|
|
377
386
|
}
|
|
378
387
|
|
|
379
|
-
${selector}::-webkit-search-decoration
|
|
388
|
+
${selector}::-webkit-search-decoration,
|
|
389
|
+
${selector}::-webkit-search-cancel-button {
|
|
380
390
|
-webkit-appearance: none;
|
|
381
391
|
}
|
|
382
392
|
|
|
383
393
|
${selector}::-webkit-file-upload-button {
|
|
384
394
|
-webkit-appearance: button;
|
|
395
|
+
font: inherit;
|
|
385
396
|
}
|
|
386
397
|
|
|
387
|
-
${selector}::-webkit-inner-spin-button,
|
|
388
|
-
${selector}::-webkit-outer-spin-button {
|
|
398
|
+
${selector}input[type="number"]::-webkit-inner-spin-button,
|
|
399
|
+
${selector}input[type="number"]::-webkit-outer-spin-button {
|
|
389
400
|
height: auto;
|
|
390
401
|
}
|
|
391
402
|
|
|
403
|
+
${selector}input[type='number']{
|
|
404
|
+
-moz-appearance: textfield;
|
|
405
|
+
}
|
|
406
|
+
|
|
392
407
|
${selector}:-moz-ui-invalid {
|
|
393
408
|
box-shadow: none;
|
|
394
409
|
}
|
|
@@ -817,7 +832,7 @@ function generateCvaFn(ctx) {
|
|
|
817
832
|
}
|
|
818
833
|
|
|
819
834
|
export function assertCompoundVariant(name, compoundVariants, variants, prop) {
|
|
820
|
-
if (compoundVariants.length > 0 && typeof variants[prop] === 'object') {
|
|
835
|
+
if (compoundVariants.length > 0 && typeof variants?.[prop] === 'object') {
|
|
821
836
|
throw new Error(\`[recipe:\${name}:\${prop}] Conditions are not supported when using compound variants.\`)
|
|
822
837
|
}
|
|
823
838
|
}
|
|
@@ -868,7 +883,7 @@ var import_outdent8 = require("outdent");
|
|
|
868
883
|
|
|
869
884
|
// src/artifacts/generated/helpers.mjs.json
|
|
870
885
|
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
|
|
886
|
+
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 slots = recipe.slots ?? [];\n const recipeParts = slots.map((slot) => [slot, init(slot)]);\n for (const [variantsKey, variantsSpec] of Object.entries(recipe.variants ?? {})) {\n for (const [variantKey, variantSpec] of Object.entries(variantsSpec)) {\n recipeParts.forEach(([slot, slotRecipe]) => {\n slotRecipe.variants[variantsKey] ??= {};\n slotRecipe.variants[variantsKey][variantKey] = variantSpec[slot] ?? {};\n });\n }\n }\n return Object.fromEntries(recipeParts);\n};\nvar getSlotCompoundVariant = (compoundVariants, slotName) => compoundVariants.filter((compoundVariant) => compoundVariant.css[slotName]).map((compoundVariant) => ({ ...compoundVariant, css: compoundVariant.css[slotName] }));\n\n// src/split-props.ts\nfunction splitProps(props, ...keys) {\n const descriptors = Object.getOwnPropertyDescriptors(props);\n const dKeys = Object.keys(descriptors);\n const split = (k) => {\n const clone = {};\n for (let i = 0; i < k.length; i++) {\n const key = k[i];\n if (descriptors[key]) {\n Object.defineProperty(clone, key, descriptors[key]);\n delete descriptors[key];\n }\n }\n return clone;\n };\n const fn = (key) => split(Array.isArray(key) ? key : dKeys.filter(key));\n return keys.map(fn).concat(split(dKeys));\n}\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
887
|
};
|
|
873
888
|
|
|
874
889
|
// src/artifacts/generated/astish.mjs.json
|
|
@@ -1300,7 +1315,8 @@ function generatePreactJsxFactory(ctx) {
|
|
|
1300
1315
|
})
|
|
1301
1316
|
})
|
|
1302
1317
|
|
|
1303
|
-
|
|
1318
|
+
const name = (typeof Dynamic === 'string' ? Dynamic : Dynamic.displayName || Dynamic.name) || 'Component'
|
|
1319
|
+
${componentName}.displayName = \`${factoryName}.\${name}\`
|
|
1304
1320
|
return ${componentName}
|
|
1305
1321
|
}
|
|
1306
1322
|
|
|
@@ -1439,7 +1455,8 @@ function generatePreactJsxStringLiteralFactory(ctx) {
|
|
|
1439
1455
|
})
|
|
1440
1456
|
})
|
|
1441
1457
|
|
|
1442
|
-
|
|
1458
|
+
const name = (typeof Dynamic === 'string' ? Dynamic : Dynamic.displayName || Dynamic.name) || 'Component'
|
|
1459
|
+
${componentName}.displayName = \`${factoryName}.\${name}\`
|
|
1443
1460
|
return ${componentName}
|
|
1444
1461
|
}
|
|
1445
1462
|
}
|
|
@@ -1541,7 +1558,8 @@ function generateQwikJsxFactory(ctx) {
|
|
|
1541
1558
|
})
|
|
1542
1559
|
}
|
|
1543
1560
|
|
|
1544
|
-
|
|
1561
|
+
const name = (typeof Dynamic === 'string' ? Dynamic : Dynamic.displayName || Dynamic.name) || 'Component'
|
|
1562
|
+
${componentName}.displayName = \`${factoryName}.\${name}\`
|
|
1545
1563
|
return ${componentName}
|
|
1546
1564
|
}
|
|
1547
1565
|
|
|
@@ -1681,7 +1699,8 @@ function generateQwikJsxStringLiteralFactory(ctx) {
|
|
|
1681
1699
|
})
|
|
1682
1700
|
}
|
|
1683
1701
|
|
|
1684
|
-
|
|
1702
|
+
const name = (typeof Dynamic === 'string' ? Dynamic : Dynamic.displayName || Dynamic.name) || 'Component'
|
|
1703
|
+
${componentName}.displayName = \`${factoryName}.\${name}\`
|
|
1685
1704
|
return ${componentName}
|
|
1686
1705
|
}
|
|
1687
1706
|
}
|
|
@@ -1826,7 +1845,8 @@ function generateReactJsxFactory(ctx) {
|
|
|
1826
1845
|
})
|
|
1827
1846
|
})
|
|
1828
1847
|
|
|
1829
|
-
|
|
1848
|
+
const name = (typeof Dynamic === 'string' ? Dynamic : Dynamic.displayName || Dynamic.name) || 'Component'
|
|
1849
|
+
${componentName}.displayName = \`${factoryName}.\${name}\`
|
|
1830
1850
|
return ${componentName}
|
|
1831
1851
|
}
|
|
1832
1852
|
|
|
@@ -1966,7 +1986,8 @@ function generateReactJsxStringLiteralFactory(ctx) {
|
|
|
1966
1986
|
})
|
|
1967
1987
|
})
|
|
1968
1988
|
|
|
1969
|
-
|
|
1989
|
+
const name = (typeof Dynamic === 'string' ? Dynamic : Dynamic.displayName || Dynamic.name) || 'Component'
|
|
1990
|
+
${componentName}.displayName = \`${factoryName}.\${name}\`
|
|
1970
1991
|
return ${componentName}
|
|
1971
1992
|
}
|
|
1972
1993
|
}
|
|
@@ -2304,9 +2325,10 @@ function generateVueJsxFactory(ctx) {
|
|
|
2304
2325
|
|
|
2305
2326
|
function styledFn(Dynamic, configOrCva = {}) {
|
|
2306
2327
|
const cvaFn = configOrCva.__cva__ || configOrCva.__recipe__ ? configOrCva : cva(configOrCva)
|
|
2328
|
+
const name = (typeof Dynamic === 'string' ? Dynamic : Dynamic.displayName || Dynamic.name) || 'Component'
|
|
2307
2329
|
|
|
2308
2330
|
return defineComponent({
|
|
2309
|
-
name: \`${factoryName}.\${
|
|
2331
|
+
name: \`${factoryName}.\${name}\`,
|
|
2310
2332
|
inheritAttrs: false,
|
|
2311
2333
|
props: { as: { type: [String, Object], default: Dynamic } },
|
|
2312
2334
|
setup(props, { slots, attrs }) {
|
|
@@ -2379,10 +2401,12 @@ function generateVueJsxStringLiteralFactory(ctx) {
|
|
|
2379
2401
|
${ctx.file.import("css, cx", "../css/index")}
|
|
2380
2402
|
|
|
2381
2403
|
function createStyled(Dynamic) {
|
|
2404
|
+
const name = (typeof Dynamic === 'string' ? Dynamic : Dynamic.displayName || Dynamic.name) || 'Component'
|
|
2405
|
+
|
|
2382
2406
|
function styledFn(template) {
|
|
2383
2407
|
const baseClassName = css(template)
|
|
2384
2408
|
return defineComponent({
|
|
2385
|
-
name: \`${factoryName}.\${
|
|
2409
|
+
name: \`${factoryName}.\${name}\`,
|
|
2386
2410
|
inheritAttrs: false,
|
|
2387
2411
|
props: { as: { type: [String, Object], default: Dynamic } },
|
|
2388
2412
|
setup(props, { slots, attrs }) {
|
|
@@ -2477,158 +2501,40 @@ ${ctx.file.importType(upperName, "../types/jsx")}
|
|
|
2477
2501
|
export declare const ${factoryName}: ${upperName}
|
|
2478
2502
|
`,
|
|
2479
2503
|
jsxType: import_outdent37.outdent`
|
|
2480
|
-
import type { Component, FunctionalComponent } from 'vue'
|
|
2504
|
+
import type { Component, FunctionalComponent, NativeElements } from 'vue'
|
|
2481
2505
|
|
|
2482
2506
|
${ctx.file.importType("RecipeDefinition, RecipeSelection, RecipeVariantRecord", "./recipe")}
|
|
2483
2507
|
${ctx.file.importType("Assign, JsxStyleProps, JsxHTMLProps", "./system-types")}
|
|
2484
2508
|
|
|
2485
|
-
type IntrinsicElement =
|
|
2486
|
-
|
|
2487
|
-
| 'abbr'
|
|
2488
|
-
| 'address'
|
|
2489
|
-
| 'area'
|
|
2490
|
-
| 'article'
|
|
2491
|
-
| 'aside'
|
|
2492
|
-
| 'audio'
|
|
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
|
-
>
|
|
2509
|
+
type IntrinsicElement = keyof NativeElements
|
|
2510
|
+
type ElementType = IntrinsicElement | Component
|
|
2615
2511
|
|
|
2616
|
-
|
|
2512
|
+
type ComponentProps<T extends ElementType> = T extends IntrinsicElement
|
|
2513
|
+
? NativeElements[T]
|
|
2514
|
+
: T extends Component<infer Props>
|
|
2515
|
+
? Props
|
|
2516
|
+
: never
|
|
2617
2517
|
|
|
2618
|
-
|
|
2619
|
-
|
|
2620
|
-
|
|
2621
|
-
|
|
2622
|
-
|
|
2623
|
-
|
|
2624
|
-
|
|
2625
|
-
}
|
|
2518
|
+
type ${componentName}<T extends ElementType, P extends Dict = {}> = FunctionalComponent<
|
|
2519
|
+
JsxHTMLProps<ComponentProps<T>, Assign<JsxStyleProps, P>>
|
|
2520
|
+
>
|
|
2521
|
+
|
|
2522
|
+
type RecipeFn = { __type: any }
|
|
2523
|
+
|
|
2524
|
+
interface JsxFactory {
|
|
2525
|
+
${styleProps === "none" ? "" : `<T extends ElementType>(component: T): ${componentName}<T, {}>`}
|
|
2526
|
+
<T extends ElementType, P extends RecipeVariantRecord>(component: T, recipe: RecipeDefinition<P>): ${componentName}<
|
|
2527
|
+
T,
|
|
2528
|
+
RecipeSelection<P>
|
|
2529
|
+
>
|
|
2530
|
+
<T extends ElementType, P extends RecipeFn>(component: T, recipeFn: P): ${componentName}<T, P['__type']>
|
|
2531
|
+
}
|
|
2626
2532
|
|
|
2627
|
-
|
|
2533
|
+
type JsxElements = { [K in IntrinsicElement]: ${componentName}<K, {}> }
|
|
2628
2534
|
|
|
2629
|
-
|
|
2535
|
+
export type ${upperName} = JsxFactory ${styleProps === "none" ? "" : "& JsxElements"}
|
|
2630
2536
|
|
|
2631
|
-
|
|
2537
|
+
export type ${typeName}<T extends ElementType> = JsxHTMLProps<ComponentProps<T>, JsxStyleProps>
|
|
2632
2538
|
`
|
|
2633
2539
|
};
|
|
2634
2540
|
}
|
|
@@ -2644,147 +2550,29 @@ ${ctx.file.importType(upperName, "../types/jsx")}
|
|
|
2644
2550
|
export declare const ${factoryName}: ${upperName}
|
|
2645
2551
|
`,
|
|
2646
2552
|
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
|
-
>
|
|
2553
|
+
import type { Component, FunctionalComponent, NativeElements } from 'vue'
|
|
2778
2554
|
|
|
2779
|
-
|
|
2780
|
-
|
|
2781
|
-
|
|
2555
|
+
type IntrinsicElement = keyof NativeElements
|
|
2556
|
+
type ElementType = IntrinsicElement | Component
|
|
2557
|
+
|
|
2558
|
+
type ComponentProps<T extends ElementType> = T extends IntrinsicElement
|
|
2559
|
+
? NativeElements[T]
|
|
2560
|
+
: T extends Component<infer Props>
|
|
2561
|
+
? Props
|
|
2562
|
+
: never
|
|
2782
2563
|
|
|
2783
|
-
|
|
2564
|
+
type ${componentName}<T extends ElementType> = FunctionalComponent<ComponentProps<T>>
|
|
2565
|
+
>
|
|
2784
2566
|
|
|
2785
|
-
|
|
2567
|
+
interface JsxFactory {
|
|
2568
|
+
<T extends ElementType>(component: T): ${componentName}<T>
|
|
2569
|
+
}
|
|
2570
|
+
|
|
2571
|
+
type JsxElements = { [K in IntrinsicElement]: ${componentName}<K> }
|
|
2572
|
+
|
|
2573
|
+
export type ${upperName} = JsxFactory ${styleProps === "none" ? "" : "& JsxElements"}
|
|
2786
2574
|
|
|
2787
|
-
|
|
2575
|
+
export type ${typeName}<T extends ElementType> = ComponentProps<T>
|
|
2788
2576
|
`
|
|
2789
2577
|
};
|
|
2790
2578
|
}
|
|
@@ -3405,7 +3193,7 @@ var generateParserCss = (ctx) => (result) => (0, import_func.pipe)(
|
|
|
3405
3193
|
});
|
|
3406
3194
|
result2.jsx.forEach((jsx) => {
|
|
3407
3195
|
jsx.data.forEach((data) => {
|
|
3408
|
-
sheet.processStyleProps(data);
|
|
3196
|
+
sheet.processStyleProps(filterProps(ctx, data));
|
|
3409
3197
|
});
|
|
3410
3198
|
});
|
|
3411
3199
|
result2.recipe.forEach((recipeSet, recipeName) => {
|
|
@@ -3417,7 +3205,7 @@ var generateParserCss = (ctx) => (result) => (0, import_func.pipe)(
|
|
|
3417
3205
|
(0, import_ts_pattern10.match)(recipe).with({ type: "jsx-recipe" }, () => {
|
|
3418
3206
|
recipe.data.forEach((data) => {
|
|
3419
3207
|
const [recipeProps, styleProps] = recipes.splitProps(recipeName, data);
|
|
3420
|
-
sheet.processStyleProps(styleProps);
|
|
3208
|
+
sheet.processStyleProps(filterProps(ctx, styleProps));
|
|
3421
3209
|
sheet.processRecipe(recipeName, recipeConfig, recipeProps);
|
|
3422
3210
|
});
|
|
3423
3211
|
}).otherwise(() => {
|
|
@@ -3437,7 +3225,7 @@ var generateParserCss = (ctx) => (result) => (0, import_func.pipe)(
|
|
|
3437
3225
|
pattern.data.forEach((data) => {
|
|
3438
3226
|
const fnName = patterns.find(jsxName);
|
|
3439
3227
|
const styleProps = patterns.transform(fnName, data);
|
|
3440
|
-
sheet.processStyleProps(styleProps);
|
|
3228
|
+
sheet.processStyleProps(filterProps(ctx, styleProps));
|
|
3441
3229
|
});
|
|
3442
3230
|
}).otherwise(() => {
|
|
3443
3231
|
pattern.data.forEach((data) => {
|
|
@@ -3462,6 +3250,15 @@ var generateParserCss = (ctx) => (result) => (0, import_func.pipe)(
|
|
|
3462
3250
|
}
|
|
3463
3251
|
)
|
|
3464
3252
|
);
|
|
3253
|
+
var filterProps = (ctx, props) => {
|
|
3254
|
+
const clone = {};
|
|
3255
|
+
for (const [key, value] of Object.entries(props)) {
|
|
3256
|
+
if (ctx.isValidProperty(key)) {
|
|
3257
|
+
clone[key] = value;
|
|
3258
|
+
}
|
|
3259
|
+
}
|
|
3260
|
+
return clone;
|
|
3261
|
+
};
|
|
3465
3262
|
|
|
3466
3263
|
// src/engines/base.ts
|
|
3467
3264
|
var import_core5 = require("@pandacss/core");
|
package/dist/index.mjs
CHANGED
|
@@ -197,8 +197,8 @@ function generateResetCss(ctx, scope = "") {
|
|
|
197
197
|
'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol',
|
|
198
198
|
'Noto Color Emoji';
|
|
199
199
|
-webkit-text-size-adjust: 100%;
|
|
200
|
-
-webkit-text-size-adjust: 100%;
|
|
201
200
|
-webkit-font-smoothing: antialiased;
|
|
201
|
+
-moz-osx-font-smoothing: grayscale;
|
|
202
202
|
-moz-tab-size: 4;
|
|
203
203
|
tab-size: 4;
|
|
204
204
|
font-family: var(--global-font-body, var(--font-fallback));
|
|
@@ -340,24 +340,39 @@ function generateResetCss(ctx, scope = "") {
|
|
|
340
340
|
font-family: var(--global-font-mono, var(--font-fallback));
|
|
341
341
|
}
|
|
342
342
|
|
|
343
|
-
|
|
343
|
+
|
|
344
|
+
${selector}input[type="text"],
|
|
345
|
+
${selector}input[type="email"],
|
|
346
|
+
${selector}input[type="search"],
|
|
347
|
+
${selector}input[type="password"] {
|
|
348
|
+
-webkit-appearance: none;
|
|
349
|
+
-moz-appearance: none;
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
${selector}input[type='search'] {
|
|
344
353
|
-webkit-appearance: textfield;
|
|
345
354
|
outline-offset: -2px;
|
|
346
355
|
}
|
|
347
356
|
|
|
348
|
-
${selector}::-webkit-search-decoration
|
|
357
|
+
${selector}::-webkit-search-decoration,
|
|
358
|
+
${selector}::-webkit-search-cancel-button {
|
|
349
359
|
-webkit-appearance: none;
|
|
350
360
|
}
|
|
351
361
|
|
|
352
362
|
${selector}::-webkit-file-upload-button {
|
|
353
363
|
-webkit-appearance: button;
|
|
364
|
+
font: inherit;
|
|
354
365
|
}
|
|
355
366
|
|
|
356
|
-
${selector}::-webkit-inner-spin-button,
|
|
357
|
-
${selector}::-webkit-outer-spin-button {
|
|
367
|
+
${selector}input[type="number"]::-webkit-inner-spin-button,
|
|
368
|
+
${selector}input[type="number"]::-webkit-outer-spin-button {
|
|
358
369
|
height: auto;
|
|
359
370
|
}
|
|
360
371
|
|
|
372
|
+
${selector}input[type='number']{
|
|
373
|
+
-moz-appearance: textfield;
|
|
374
|
+
}
|
|
375
|
+
|
|
361
376
|
${selector}:-moz-ui-invalid {
|
|
362
377
|
box-shadow: none;
|
|
363
378
|
}
|
|
@@ -786,7 +801,7 @@ function generateCvaFn(ctx) {
|
|
|
786
801
|
}
|
|
787
802
|
|
|
788
803
|
export function assertCompoundVariant(name, compoundVariants, variants, prop) {
|
|
789
|
-
if (compoundVariants.length > 0 && typeof variants[prop] === 'object') {
|
|
804
|
+
if (compoundVariants.length > 0 && typeof variants?.[prop] === 'object') {
|
|
790
805
|
throw new Error(\`[recipe:\${name}:\${prop}] Conditions are not supported when using compound variants.\`)
|
|
791
806
|
}
|
|
792
807
|
}
|
|
@@ -837,7 +852,7 @@ import { outdent as outdent8 } from "outdent";
|
|
|
837
852
|
|
|
838
853
|
// src/artifacts/generated/helpers.mjs.json
|
|
839
854
|
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
|
|
855
|
+
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 slots = recipe.slots ?? [];\n const recipeParts = slots.map((slot) => [slot, init(slot)]);\n for (const [variantsKey, variantsSpec] of Object.entries(recipe.variants ?? {})) {\n for (const [variantKey, variantSpec] of Object.entries(variantsSpec)) {\n recipeParts.forEach(([slot, slotRecipe]) => {\n slotRecipe.variants[variantsKey] ??= {};\n slotRecipe.variants[variantsKey][variantKey] = variantSpec[slot] ?? {};\n });\n }\n }\n return Object.fromEntries(recipeParts);\n};\nvar getSlotCompoundVariant = (compoundVariants, slotName) => compoundVariants.filter((compoundVariant) => compoundVariant.css[slotName]).map((compoundVariant) => ({ ...compoundVariant, css: compoundVariant.css[slotName] }));\n\n// src/split-props.ts\nfunction splitProps(props, ...keys) {\n const descriptors = Object.getOwnPropertyDescriptors(props);\n const dKeys = Object.keys(descriptors);\n const split = (k) => {\n const clone = {};\n for (let i = 0; i < k.length; i++) {\n const key = k[i];\n if (descriptors[key]) {\n Object.defineProperty(clone, key, descriptors[key]);\n delete descriptors[key];\n }\n }\n return clone;\n };\n const fn = (key) => split(Array.isArray(key) ? key : dKeys.filter(key));\n return keys.map(fn).concat(split(dKeys));\n}\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
856
|
};
|
|
842
857
|
|
|
843
858
|
// src/artifacts/generated/astish.mjs.json
|
|
@@ -1269,7 +1284,8 @@ function generatePreactJsxFactory(ctx) {
|
|
|
1269
1284
|
})
|
|
1270
1285
|
})
|
|
1271
1286
|
|
|
1272
|
-
|
|
1287
|
+
const name = (typeof Dynamic === 'string' ? Dynamic : Dynamic.displayName || Dynamic.name) || 'Component'
|
|
1288
|
+
${componentName}.displayName = \`${factoryName}.\${name}\`
|
|
1273
1289
|
return ${componentName}
|
|
1274
1290
|
}
|
|
1275
1291
|
|
|
@@ -1408,7 +1424,8 @@ function generatePreactJsxStringLiteralFactory(ctx) {
|
|
|
1408
1424
|
})
|
|
1409
1425
|
})
|
|
1410
1426
|
|
|
1411
|
-
|
|
1427
|
+
const name = (typeof Dynamic === 'string' ? Dynamic : Dynamic.displayName || Dynamic.name) || 'Component'
|
|
1428
|
+
${componentName}.displayName = \`${factoryName}.\${name}\`
|
|
1412
1429
|
return ${componentName}
|
|
1413
1430
|
}
|
|
1414
1431
|
}
|
|
@@ -1510,7 +1527,8 @@ function generateQwikJsxFactory(ctx) {
|
|
|
1510
1527
|
})
|
|
1511
1528
|
}
|
|
1512
1529
|
|
|
1513
|
-
|
|
1530
|
+
const name = (typeof Dynamic === 'string' ? Dynamic : Dynamic.displayName || Dynamic.name) || 'Component'
|
|
1531
|
+
${componentName}.displayName = \`${factoryName}.\${name}\`
|
|
1514
1532
|
return ${componentName}
|
|
1515
1533
|
}
|
|
1516
1534
|
|
|
@@ -1650,7 +1668,8 @@ function generateQwikJsxStringLiteralFactory(ctx) {
|
|
|
1650
1668
|
})
|
|
1651
1669
|
}
|
|
1652
1670
|
|
|
1653
|
-
|
|
1671
|
+
const name = (typeof Dynamic === 'string' ? Dynamic : Dynamic.displayName || Dynamic.name) || 'Component'
|
|
1672
|
+
${componentName}.displayName = \`${factoryName}.\${name}\`
|
|
1654
1673
|
return ${componentName}
|
|
1655
1674
|
}
|
|
1656
1675
|
}
|
|
@@ -1795,7 +1814,8 @@ function generateReactJsxFactory(ctx) {
|
|
|
1795
1814
|
})
|
|
1796
1815
|
})
|
|
1797
1816
|
|
|
1798
|
-
|
|
1817
|
+
const name = (typeof Dynamic === 'string' ? Dynamic : Dynamic.displayName || Dynamic.name) || 'Component'
|
|
1818
|
+
${componentName}.displayName = \`${factoryName}.\${name}\`
|
|
1799
1819
|
return ${componentName}
|
|
1800
1820
|
}
|
|
1801
1821
|
|
|
@@ -1935,7 +1955,8 @@ function generateReactJsxStringLiteralFactory(ctx) {
|
|
|
1935
1955
|
})
|
|
1936
1956
|
})
|
|
1937
1957
|
|
|
1938
|
-
|
|
1958
|
+
const name = (typeof Dynamic === 'string' ? Dynamic : Dynamic.displayName || Dynamic.name) || 'Component'
|
|
1959
|
+
${componentName}.displayName = \`${factoryName}.\${name}\`
|
|
1939
1960
|
return ${componentName}
|
|
1940
1961
|
}
|
|
1941
1962
|
}
|
|
@@ -2273,9 +2294,10 @@ function generateVueJsxFactory(ctx) {
|
|
|
2273
2294
|
|
|
2274
2295
|
function styledFn(Dynamic, configOrCva = {}) {
|
|
2275
2296
|
const cvaFn = configOrCva.__cva__ || configOrCva.__recipe__ ? configOrCva : cva(configOrCva)
|
|
2297
|
+
const name = (typeof Dynamic === 'string' ? Dynamic : Dynamic.displayName || Dynamic.name) || 'Component'
|
|
2276
2298
|
|
|
2277
2299
|
return defineComponent({
|
|
2278
|
-
name: \`${factoryName}.\${
|
|
2300
|
+
name: \`${factoryName}.\${name}\`,
|
|
2279
2301
|
inheritAttrs: false,
|
|
2280
2302
|
props: { as: { type: [String, Object], default: Dynamic } },
|
|
2281
2303
|
setup(props, { slots, attrs }) {
|
|
@@ -2348,10 +2370,12 @@ function generateVueJsxStringLiteralFactory(ctx) {
|
|
|
2348
2370
|
${ctx.file.import("css, cx", "../css/index")}
|
|
2349
2371
|
|
|
2350
2372
|
function createStyled(Dynamic) {
|
|
2373
|
+
const name = (typeof Dynamic === 'string' ? Dynamic : Dynamic.displayName || Dynamic.name) || 'Component'
|
|
2374
|
+
|
|
2351
2375
|
function styledFn(template) {
|
|
2352
2376
|
const baseClassName = css(template)
|
|
2353
2377
|
return defineComponent({
|
|
2354
|
-
name: \`${factoryName}.\${
|
|
2378
|
+
name: \`${factoryName}.\${name}\`,
|
|
2355
2379
|
inheritAttrs: false,
|
|
2356
2380
|
props: { as: { type: [String, Object], default: Dynamic } },
|
|
2357
2381
|
setup(props, { slots, attrs }) {
|
|
@@ -2446,158 +2470,40 @@ ${ctx.file.importType(upperName, "../types/jsx")}
|
|
|
2446
2470
|
export declare const ${factoryName}: ${upperName}
|
|
2447
2471
|
`,
|
|
2448
2472
|
jsxType: outdent37`
|
|
2449
|
-
import type { Component, FunctionalComponent } from 'vue'
|
|
2473
|
+
import type { Component, FunctionalComponent, NativeElements } from 'vue'
|
|
2450
2474
|
|
|
2451
2475
|
${ctx.file.importType("RecipeDefinition, RecipeSelection, RecipeVariantRecord", "./recipe")}
|
|
2452
2476
|
${ctx.file.importType("Assign, JsxStyleProps, JsxHTMLProps", "./system-types")}
|
|
2453
2477
|
|
|
2454
|
-
type IntrinsicElement =
|
|
2455
|
-
|
|
2456
|
-
| 'abbr'
|
|
2457
|
-
| 'address'
|
|
2458
|
-
| 'area'
|
|
2459
|
-
| 'article'
|
|
2460
|
-
| 'aside'
|
|
2461
|
-
| 'audio'
|
|
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
|
-
>
|
|
2478
|
+
type IntrinsicElement = keyof NativeElements
|
|
2479
|
+
type ElementType = IntrinsicElement | Component
|
|
2584
2480
|
|
|
2585
|
-
|
|
2481
|
+
type ComponentProps<T extends ElementType> = T extends IntrinsicElement
|
|
2482
|
+
? NativeElements[T]
|
|
2483
|
+
: T extends Component<infer Props>
|
|
2484
|
+
? Props
|
|
2485
|
+
: never
|
|
2586
2486
|
|
|
2587
|
-
|
|
2588
|
-
|
|
2589
|
-
|
|
2590
|
-
|
|
2591
|
-
|
|
2592
|
-
|
|
2593
|
-
|
|
2594
|
-
}
|
|
2487
|
+
type ${componentName}<T extends ElementType, P extends Dict = {}> = FunctionalComponent<
|
|
2488
|
+
JsxHTMLProps<ComponentProps<T>, Assign<JsxStyleProps, P>>
|
|
2489
|
+
>
|
|
2490
|
+
|
|
2491
|
+
type RecipeFn = { __type: any }
|
|
2492
|
+
|
|
2493
|
+
interface JsxFactory {
|
|
2494
|
+
${styleProps === "none" ? "" : `<T extends ElementType>(component: T): ${componentName}<T, {}>`}
|
|
2495
|
+
<T extends ElementType, P extends RecipeVariantRecord>(component: T, recipe: RecipeDefinition<P>): ${componentName}<
|
|
2496
|
+
T,
|
|
2497
|
+
RecipeSelection<P>
|
|
2498
|
+
>
|
|
2499
|
+
<T extends ElementType, P extends RecipeFn>(component: T, recipeFn: P): ${componentName}<T, P['__type']>
|
|
2500
|
+
}
|
|
2595
2501
|
|
|
2596
|
-
|
|
2502
|
+
type JsxElements = { [K in IntrinsicElement]: ${componentName}<K, {}> }
|
|
2597
2503
|
|
|
2598
|
-
|
|
2504
|
+
export type ${upperName} = JsxFactory ${styleProps === "none" ? "" : "& JsxElements"}
|
|
2599
2505
|
|
|
2600
|
-
|
|
2506
|
+
export type ${typeName}<T extends ElementType> = JsxHTMLProps<ComponentProps<T>, JsxStyleProps>
|
|
2601
2507
|
`
|
|
2602
2508
|
};
|
|
2603
2509
|
}
|
|
@@ -2613,147 +2519,29 @@ ${ctx.file.importType(upperName, "../types/jsx")}
|
|
|
2613
2519
|
export declare const ${factoryName}: ${upperName}
|
|
2614
2520
|
`,
|
|
2615
2521
|
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
|
-
>
|
|
2522
|
+
import type { Component, FunctionalComponent, NativeElements } from 'vue'
|
|
2747
2523
|
|
|
2748
|
-
|
|
2749
|
-
|
|
2750
|
-
|
|
2524
|
+
type IntrinsicElement = keyof NativeElements
|
|
2525
|
+
type ElementType = IntrinsicElement | Component
|
|
2526
|
+
|
|
2527
|
+
type ComponentProps<T extends ElementType> = T extends IntrinsicElement
|
|
2528
|
+
? NativeElements[T]
|
|
2529
|
+
: T extends Component<infer Props>
|
|
2530
|
+
? Props
|
|
2531
|
+
: never
|
|
2751
2532
|
|
|
2752
|
-
|
|
2533
|
+
type ${componentName}<T extends ElementType> = FunctionalComponent<ComponentProps<T>>
|
|
2534
|
+
>
|
|
2753
2535
|
|
|
2754
|
-
|
|
2536
|
+
interface JsxFactory {
|
|
2537
|
+
<T extends ElementType>(component: T): ${componentName}<T>
|
|
2538
|
+
}
|
|
2539
|
+
|
|
2540
|
+
type JsxElements = { [K in IntrinsicElement]: ${componentName}<K> }
|
|
2541
|
+
|
|
2542
|
+
export type ${upperName} = JsxFactory ${styleProps === "none" ? "" : "& JsxElements"}
|
|
2755
2543
|
|
|
2756
|
-
|
|
2544
|
+
export type ${typeName}<T extends ElementType> = ComponentProps<T>
|
|
2757
2545
|
`
|
|
2758
2546
|
};
|
|
2759
2547
|
}
|
|
@@ -3374,7 +3162,7 @@ var generateParserCss = (ctx) => (result) => pipe(
|
|
|
3374
3162
|
});
|
|
3375
3163
|
result2.jsx.forEach((jsx) => {
|
|
3376
3164
|
jsx.data.forEach((data) => {
|
|
3377
|
-
sheet.processStyleProps(data);
|
|
3165
|
+
sheet.processStyleProps(filterProps(ctx, data));
|
|
3378
3166
|
});
|
|
3379
3167
|
});
|
|
3380
3168
|
result2.recipe.forEach((recipeSet, recipeName) => {
|
|
@@ -3386,7 +3174,7 @@ var generateParserCss = (ctx) => (result) => pipe(
|
|
|
3386
3174
|
match10(recipe).with({ type: "jsx-recipe" }, () => {
|
|
3387
3175
|
recipe.data.forEach((data) => {
|
|
3388
3176
|
const [recipeProps, styleProps] = recipes.splitProps(recipeName, data);
|
|
3389
|
-
sheet.processStyleProps(styleProps);
|
|
3177
|
+
sheet.processStyleProps(filterProps(ctx, styleProps));
|
|
3390
3178
|
sheet.processRecipe(recipeName, recipeConfig, recipeProps);
|
|
3391
3179
|
});
|
|
3392
3180
|
}).otherwise(() => {
|
|
@@ -3406,7 +3194,7 @@ var generateParserCss = (ctx) => (result) => pipe(
|
|
|
3406
3194
|
pattern.data.forEach((data) => {
|
|
3407
3195
|
const fnName = patterns.find(jsxName);
|
|
3408
3196
|
const styleProps = patterns.transform(fnName, data);
|
|
3409
|
-
sheet.processStyleProps(styleProps);
|
|
3197
|
+
sheet.processStyleProps(filterProps(ctx, styleProps));
|
|
3410
3198
|
});
|
|
3411
3199
|
}).otherwise(() => {
|
|
3412
3200
|
pattern.data.forEach((data) => {
|
|
@@ -3431,6 +3219,15 @@ var generateParserCss = (ctx) => (result) => pipe(
|
|
|
3431
3219
|
}
|
|
3432
3220
|
)
|
|
3433
3221
|
);
|
|
3222
|
+
var filterProps = (ctx, props) => {
|
|
3223
|
+
const clone = {};
|
|
3224
|
+
for (const [key, value] of Object.entries(props)) {
|
|
3225
|
+
if (ctx.isValidProperty(key)) {
|
|
3226
|
+
clone[key] = value;
|
|
3227
|
+
}
|
|
3228
|
+
}
|
|
3229
|
+
return clone;
|
|
3230
|
+
};
|
|
3434
3231
|
|
|
3435
3232
|
// src/engines/base.ts
|
|
3436
3233
|
import {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pandacss/generator",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.15.1",
|
|
4
4
|
"description": "The css generator for css panda",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -19,18 +19,18 @@
|
|
|
19
19
|
"outdent": " ^0.8.0",
|
|
20
20
|
"pluralize": "8.0.0",
|
|
21
21
|
"postcss": "8.4.27",
|
|
22
|
-
"ts-pattern": "5.0.
|
|
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.
|
|
22
|
+
"ts-pattern": "5.0.5",
|
|
23
|
+
"@pandacss/core": "0.15.1",
|
|
24
|
+
"@pandacss/is-valid-prop": "0.15.1",
|
|
25
|
+
"@pandacss/logger": "0.15.1",
|
|
26
|
+
"@pandacss/shared": "0.15.1",
|
|
27
|
+
"@pandacss/token-dictionary": "0.15.1",
|
|
28
|
+
"@pandacss/types": "0.15.1"
|
|
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.1"
|
|
34
34
|
},
|
|
35
35
|
"scripts": {
|
|
36
36
|
"prebuild": "tsx scripts/prebuild.ts",
|