@pandacss/generator 0.15.0 → 0.15.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +13 -13
- package/dist/index.d.ts +13 -13
- package/dist/index.js +91 -63
- package/dist/index.mjs +91 -63
- package/package.json +9 -9
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
|
}
|
|
@@ -526,9 +541,11 @@ function generateConditions(ctx) {
|
|
|
526
541
|
dts: outdent2`
|
|
527
542
|
${ctx.file.importType("AnySelector, Selectors", "./selectors")}
|
|
528
543
|
|
|
529
|
-
export
|
|
544
|
+
export interface Conditions {
|
|
530
545
|
${keys.map(
|
|
531
|
-
(key) => ` ${key === "base" ? `/** The base (=no conditions) styles to apply
|
|
546
|
+
(key) => ` ${key === "base" ? `/** The base (=no conditions) styles to apply */
|
|
547
|
+
` : ctx.conditions.get(key) ? `/** \`${ctx.conditions.get(key)}\` */
|
|
548
|
+
` : ""} ${JSON.stringify(key)}: string`
|
|
532
549
|
).join("\n")}
|
|
533
550
|
}
|
|
534
551
|
|
|
@@ -837,7 +854,7 @@ import { outdent as outdent8 } from "outdent";
|
|
|
837
854
|
|
|
838
855
|
// src/artifacts/generated/helpers.mjs.json
|
|
839
856
|
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 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
|
|
857
|
+
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
858
|
};
|
|
842
859
|
|
|
843
860
|
// src/artifacts/generated/astish.mjs.json
|
|
@@ -933,7 +950,7 @@ function generatePattern(ctx) {
|
|
|
933
950
|
${ctx.file.importType("DistributiveOmit", "../types/system-types")}
|
|
934
951
|
${ctx.file.importType("Tokens", "../tokens/index")}
|
|
935
952
|
|
|
936
|
-
export
|
|
953
|
+
export interface ${upperName}Properties {
|
|
937
954
|
${Object.keys(properties ?? {}).map((key) => {
|
|
938
955
|
const value = properties[key];
|
|
939
956
|
return match2(value).with({ type: "property" }, (value2) => {
|
|
@@ -953,7 +970,7 @@ function generatePattern(ctx) {
|
|
|
953
970
|
|
|
954
971
|
${strict ? outdent10`export declare function ${baseName}(styles: ${upperName}Properties): string` : outdent10`
|
|
955
972
|
|
|
956
|
-
|
|
973
|
+
interface ${upperName}Styles extends ${upperName}Properties, DistributiveOmit<SystemStyleObject, keyof ${upperName}Properties ${blocklistType}> {}
|
|
957
974
|
|
|
958
975
|
interface ${upperName}PatternFn {
|
|
959
976
|
(styles?: ${upperName}Styles): string
|
|
@@ -1102,7 +1119,7 @@ function generateRecipes(ctx) {
|
|
|
1102
1119
|
${ctx.file.importType("Pretty", "../types/helpers")}
|
|
1103
1120
|
${ctx.file.importType("DistributiveOmit", "../types/system-types")}
|
|
1104
1121
|
|
|
1105
|
-
|
|
1122
|
+
interface ${upperName}Variant {
|
|
1106
1123
|
${Object.keys(variantKeyMap).map((key) => {
|
|
1107
1124
|
const values = variantKeyMap[key];
|
|
1108
1125
|
if (values.every(isBooleanValue))
|
|
@@ -1119,7 +1136,7 @@ function generateRecipes(ctx) {
|
|
|
1119
1136
|
[key in keyof ${upperName}Variant]?: ${compoundVariants?.length ? `${upperName}Variant[key]` : `ConditionalValue<${upperName}Variant[key]>`}
|
|
1120
1137
|
}
|
|
1121
1138
|
|
|
1122
|
-
interface ${upperName}Recipe {
|
|
1139
|
+
export interface ${upperName}Recipe {
|
|
1123
1140
|
__type: ${upperName}VariantProps
|
|
1124
1141
|
(props?: ${upperName}VariantProps): ${isSlotRecipe(config) ? `Pretty<Record<${unionType2(config.slots)}, string>>` : "string"}
|
|
1125
1142
|
raw: (props?: ${upperName}VariantProps) => ${upperName}VariantProps
|
|
@@ -1269,7 +1286,8 @@ function generatePreactJsxFactory(ctx) {
|
|
|
1269
1286
|
})
|
|
1270
1287
|
})
|
|
1271
1288
|
|
|
1272
|
-
|
|
1289
|
+
const name = (typeof Dynamic === 'string' ? Dynamic : Dynamic.displayName || Dynamic.name) || 'Component'
|
|
1290
|
+
${componentName}.displayName = \`${factoryName}.\${name}\`
|
|
1273
1291
|
return ${componentName}
|
|
1274
1292
|
}
|
|
1275
1293
|
|
|
@@ -1332,7 +1350,7 @@ function generatePreactJsxPattern(ctx) {
|
|
|
1332
1350
|
${ctx.file.importType("DistributiveOmit", "../types/system-types")}
|
|
1333
1351
|
${ctx.file.importType(typeName, "../types/jsx")}
|
|
1334
1352
|
|
|
1335
|
-
export
|
|
1353
|
+
export interface ${upperName}Props extends ${upperName}Properties, DistributiveOmit<${typeName}<'${jsxElement}'>, keyof ${upperName}Properties ${blocklistType}> {}
|
|
1336
1354
|
|
|
1337
1355
|
${description ? `/** ${description} */` : ""}
|
|
1338
1356
|
export declare const ${jsxName}: FunctionComponent<${upperName}Props>
|
|
@@ -1359,12 +1377,12 @@ type ElementType = keyof JSX.IntrinsicElements
|
|
|
1359
1377
|
|
|
1360
1378
|
type Dict = Record<string, unknown>
|
|
1361
1379
|
|
|
1362
|
-
export
|
|
1380
|
+
export interface ${componentName}<T extends ElementType, P extends Dict = {}> {
|
|
1363
1381
|
(props: JsxHTMLProps<ComponentProps<T>, P> & JsxStyleProps): JSX.Element
|
|
1364
1382
|
displayName?: string
|
|
1365
1383
|
}
|
|
1366
1384
|
|
|
1367
|
-
|
|
1385
|
+
interface RecipeFn = { __type: any }
|
|
1368
1386
|
|
|
1369
1387
|
interface JsxFactory {
|
|
1370
1388
|
${styleProps === "none" ? "" : `<T extends ElementType>(component: T): ${componentName}<T, {}>`}
|
|
@@ -1408,7 +1426,8 @@ function generatePreactJsxStringLiteralFactory(ctx) {
|
|
|
1408
1426
|
})
|
|
1409
1427
|
})
|
|
1410
1428
|
|
|
1411
|
-
|
|
1429
|
+
const name = (typeof Dynamic === 'string' ? Dynamic : Dynamic.displayName || Dynamic.name) || 'Component'
|
|
1430
|
+
${componentName}.displayName = \`${factoryName}.\${name}\`
|
|
1412
1431
|
return ${componentName}
|
|
1413
1432
|
}
|
|
1414
1433
|
}
|
|
@@ -1510,7 +1529,8 @@ function generateQwikJsxFactory(ctx) {
|
|
|
1510
1529
|
})
|
|
1511
1530
|
}
|
|
1512
1531
|
|
|
1513
|
-
|
|
1532
|
+
const name = (typeof Dynamic === 'string' ? Dynamic : Dynamic.displayName || Dynamic.name) || 'Component'
|
|
1533
|
+
${componentName}.displayName = \`${factoryName}.\${name}\`
|
|
1514
1534
|
return ${componentName}
|
|
1515
1535
|
}
|
|
1516
1536
|
|
|
@@ -1550,7 +1570,7 @@ function generateQwikJsxPattern(ctx) {
|
|
|
1550
1570
|
import { h } from '@builder.io/qwik'
|
|
1551
1571
|
${ctx.file.import(factoryName, "./factory")}
|
|
1552
1572
|
${ctx.file.import(styleFnName, `../patterns/${dashName}`)}
|
|
1553
|
-
|
|
1573
|
+
|
|
1554
1574
|
export const ${jsxName} = function ${jsxName}(props) {
|
|
1555
1575
|
${match5(props.length).with(
|
|
1556
1576
|
0,
|
|
@@ -1573,8 +1593,8 @@ function generateQwikJsxPattern(ctx) {
|
|
|
1573
1593
|
${ctx.file.importType(typeName, "../types/jsx")}
|
|
1574
1594
|
${ctx.file.importType("Assign, DistributiveOmit", "../types/system-types")}
|
|
1575
1595
|
|
|
1576
|
-
export
|
|
1577
|
-
|
|
1596
|
+
export interface ${upperName}Props extends Assign<${typeName}<'${jsxElement}'>, DistributiveOmit<${upperName}Properties, ${blocklistType || '""'}>> {}
|
|
1597
|
+
|
|
1578
1598
|
${description ? `/** ${description} */` : ""}
|
|
1579
1599
|
export declare const ${jsxName}: Component<${upperName}Props>
|
|
1580
1600
|
`
|
|
@@ -1598,7 +1618,7 @@ import type { RecipeDefinition, RecipeSelection, RecipeVariantRecord } from './r
|
|
|
1598
1618
|
|
|
1599
1619
|
type ElementType = keyof QwikIntrinsicElements | Component<any>
|
|
1600
1620
|
|
|
1601
|
-
type ComponentProps<T extends ElementType> = T extends keyof QwikIntrinsicElements
|
|
1621
|
+
export type ComponentProps<T extends ElementType> = T extends keyof QwikIntrinsicElements
|
|
1602
1622
|
? QwikIntrinsicElements[T]
|
|
1603
1623
|
: T extends Component<infer P>
|
|
1604
1624
|
? P
|
|
@@ -1606,9 +1626,9 @@ type ComponentProps<T extends ElementType> = T extends keyof QwikIntrinsicElemen
|
|
|
1606
1626
|
|
|
1607
1627
|
type Dict = Record<string, unknown>
|
|
1608
1628
|
|
|
1609
|
-
export
|
|
1629
|
+
export interface ${componentName}<T extends ElementType, P extends Dict = {}> extends Component<Assign<ComponentProps<T>, PatchedHTMLProps, Assign<JsxStyleProps, P>>> {}
|
|
1610
1630
|
|
|
1611
|
-
|
|
1631
|
+
interface RecipeFn { __type: any }
|
|
1612
1632
|
|
|
1613
1633
|
interface JsxFactory {
|
|
1614
1634
|
${styleProps === "none" ? "" : `<T extends ElementType>(component: T): ${componentName}<T, {}>`}
|
|
@@ -1650,7 +1670,8 @@ function generateQwikJsxStringLiteralFactory(ctx) {
|
|
|
1650
1670
|
})
|
|
1651
1671
|
}
|
|
1652
1672
|
|
|
1653
|
-
|
|
1673
|
+
const name = (typeof Dynamic === 'string' ? Dynamic : Dynamic.displayName || Dynamic.name) || 'Component'
|
|
1674
|
+
${componentName}.displayName = \`${factoryName}.\${name}\`
|
|
1654
1675
|
return ${componentName}
|
|
1655
1676
|
}
|
|
1656
1677
|
}
|
|
@@ -1691,7 +1712,7 @@ import type { Component, QwikIntrinsicElements } from '@builder.io/qwik'
|
|
|
1691
1712
|
|
|
1692
1713
|
type ElementType = keyof QwikIntrinsicElements | Component<any>
|
|
1693
1714
|
|
|
1694
|
-
type ComponentProps<T extends ElementType> = T extends keyof QwikIntrinsicElements
|
|
1715
|
+
export type ComponentProps<T extends ElementType> = T extends keyof QwikIntrinsicElements
|
|
1695
1716
|
? QwikIntrinsicElements[T]
|
|
1696
1717
|
: T extends Component<infer P>
|
|
1697
1718
|
? P
|
|
@@ -1795,7 +1816,8 @@ function generateReactJsxFactory(ctx) {
|
|
|
1795
1816
|
})
|
|
1796
1817
|
})
|
|
1797
1818
|
|
|
1798
|
-
|
|
1819
|
+
const name = (typeof Dynamic === 'string' ? Dynamic : Dynamic.displayName || Dynamic.name) || 'Component'
|
|
1820
|
+
${componentName}.displayName = \`${factoryName}.\${name}\`
|
|
1799
1821
|
return ${componentName}
|
|
1800
1822
|
}
|
|
1801
1823
|
|
|
@@ -1858,7 +1880,7 @@ function generateReactJsxPattern(ctx) {
|
|
|
1858
1880
|
${ctx.file.importType(typeName, "../types/jsx")}
|
|
1859
1881
|
${ctx.file.importType("DistributiveOmit", "../types/system-types")}
|
|
1860
1882
|
|
|
1861
|
-
export
|
|
1883
|
+
export interface ${upperName}Props extends ${upperName}Properties, DistributiveOmit<${typeName}<'${jsxElement}'>, keyof ${upperName}Properties ${blocklistType}> {}
|
|
1862
1884
|
|
|
1863
1885
|
${description ? `/** ${description} */` : ""}
|
|
1864
1886
|
export declare const ${jsxName}: FunctionComponent<${upperName}Props>
|
|
@@ -1883,16 +1905,16 @@ ${ctx.file.importType("RecipeDefinition, RecipeSelection, RecipeVariantRecord",
|
|
|
1883
1905
|
|
|
1884
1906
|
type Dict = Record<string, unknown>
|
|
1885
1907
|
|
|
1886
|
-
type ComponentProps<T extends ElementType> = DistributiveOmit<ComponentPropsWithoutRef<T>, 'ref'> & {
|
|
1908
|
+
export type ComponentProps<T extends ElementType> = DistributiveOmit<ComponentPropsWithoutRef<T>, 'ref'> & {
|
|
1887
1909
|
ref?: Ref<ElementRef<T>>
|
|
1888
1910
|
}
|
|
1889
1911
|
|
|
1890
|
-
export
|
|
1912
|
+
export interface ${componentName}<T extends ElementType, P extends Dict = {}> {
|
|
1891
1913
|
(props: JsxHTMLProps<ComponentProps<T>, Assign<JsxStyleProps, P>>): JSX.Element
|
|
1892
1914
|
displayName?: string
|
|
1893
1915
|
}
|
|
1894
1916
|
|
|
1895
|
-
|
|
1917
|
+
interface RecipeFn { __type: any }
|
|
1896
1918
|
|
|
1897
1919
|
interface JsxFactory {
|
|
1898
1920
|
${styleProps === "none" ? "" : `<T extends ElementType>(component: T): ${componentName}<T, {}>`}
|
|
@@ -1935,7 +1957,8 @@ function generateReactJsxStringLiteralFactory(ctx) {
|
|
|
1935
1957
|
})
|
|
1936
1958
|
})
|
|
1937
1959
|
|
|
1938
|
-
|
|
1960
|
+
const name = (typeof Dynamic === 'string' ? Dynamic : Dynamic.displayName || Dynamic.name) || 'Component'
|
|
1961
|
+
${componentName}.displayName = \`${factoryName}.\${name}\`
|
|
1939
1962
|
return ${componentName}
|
|
1940
1963
|
}
|
|
1941
1964
|
}
|
|
@@ -1977,7 +2000,7 @@ ${ctx.file.importType("DistributiveOmit", "../types/system-types")}
|
|
|
1977
2000
|
|
|
1978
2001
|
type Dict = Record<string, unknown>
|
|
1979
2002
|
|
|
1980
|
-
type ComponentProps<T extends ElementType> = DistributiveOmit<ComponentPropsWithoutRef<T>, 'ref'> & {
|
|
2003
|
+
export type ComponentProps<T extends ElementType> = DistributiveOmit<ComponentPropsWithoutRef<T>, 'ref'> & {
|
|
1981
2004
|
ref?: Ref<ElementRef<T>>
|
|
1982
2005
|
}
|
|
1983
2006
|
|
|
@@ -2118,7 +2141,7 @@ function generateSolidJsxPattern(ctx) {
|
|
|
2118
2141
|
${ctx.file.importType(typeName, "../types/jsx")}
|
|
2119
2142
|
${ctx.file.importType("DistributiveOmit", "../types/system-types")}
|
|
2120
2143
|
|
|
2121
|
-
export
|
|
2144
|
+
export interface ${upperName}Props extends ${upperName}Properties, DistributiveOmit<${typeName}<'${jsxElement}'>, keyof ${upperName}Properties ${blocklistType}> {}
|
|
2122
2145
|
|
|
2123
2146
|
${description ? `/** ${description} */` : ""}
|
|
2124
2147
|
export declare const ${jsxName}: Component<${upperName}Props>
|
|
@@ -2145,12 +2168,12 @@ type Dict = Record<string, unknown>
|
|
|
2145
2168
|
|
|
2146
2169
|
type ElementType<P = any> = keyof JSX.IntrinsicElements | Component<P>
|
|
2147
2170
|
|
|
2148
|
-
export
|
|
2171
|
+
export interface ${componentName}<T extends ElementType, P extends Dict = {}> {
|
|
2149
2172
|
(props: JsxHTMLProps<ComponentProps<T>, Assign<JsxStyleProps, P>>): JSX.Element
|
|
2150
2173
|
displayName?: string
|
|
2151
2174
|
}
|
|
2152
2175
|
|
|
2153
|
-
|
|
2176
|
+
interface RecipeFn { __type: any }
|
|
2154
2177
|
|
|
2155
2178
|
interface JsxFactory {
|
|
2156
2179
|
${styleProps === "none" ? "" : `<T extends ElementType>(component: T): ${componentName}<T, {}>`}
|
|
@@ -2273,9 +2296,10 @@ function generateVueJsxFactory(ctx) {
|
|
|
2273
2296
|
|
|
2274
2297
|
function styledFn(Dynamic, configOrCva = {}) {
|
|
2275
2298
|
const cvaFn = configOrCva.__cva__ || configOrCva.__recipe__ ? configOrCva : cva(configOrCva)
|
|
2299
|
+
const name = (typeof Dynamic === 'string' ? Dynamic : Dynamic.displayName || Dynamic.name) || 'Component'
|
|
2276
2300
|
|
|
2277
2301
|
return defineComponent({
|
|
2278
|
-
name: \`${factoryName}.\${
|
|
2302
|
+
name: \`${factoryName}.\${name}\`,
|
|
2279
2303
|
inheritAttrs: false,
|
|
2280
2304
|
props: { as: { type: [String, Object], default: Dynamic } },
|
|
2281
2305
|
setup(props, { slots, attrs }) {
|
|
@@ -2348,10 +2372,12 @@ function generateVueJsxStringLiteralFactory(ctx) {
|
|
|
2348
2372
|
${ctx.file.import("css, cx", "../css/index")}
|
|
2349
2373
|
|
|
2350
2374
|
function createStyled(Dynamic) {
|
|
2375
|
+
const name = (typeof Dynamic === 'string' ? Dynamic : Dynamic.displayName || Dynamic.name) || 'Component'
|
|
2376
|
+
|
|
2351
2377
|
function styledFn(template) {
|
|
2352
2378
|
const baseClassName = css(template)
|
|
2353
2379
|
return defineComponent({
|
|
2354
|
-
name: \`${factoryName}.\${
|
|
2380
|
+
name: \`${factoryName}.\${name}\`,
|
|
2355
2381
|
inheritAttrs: false,
|
|
2356
2382
|
props: { as: { type: [String, Object], default: Dynamic } },
|
|
2357
2383
|
setup(props, { slots, attrs }) {
|
|
@@ -2426,7 +2452,7 @@ function generateVueJsxPattern(ctx) {
|
|
|
2426
2452
|
${ctx.file.importType(typeName, "../types/jsx")}
|
|
2427
2453
|
${ctx.file.importType("DistributiveOmit", "../types/system-types")}
|
|
2428
2454
|
|
|
2429
|
-
export
|
|
2455
|
+
export interface ${upperName}Props extends ${upperName}Properties, DistributiveOmit<${typeName}<'${jsxElement}'>, keyof ${upperName}Properties ${blocklistType}> {}
|
|
2430
2456
|
|
|
2431
2457
|
${description ? `/** ${description} */` : ""}
|
|
2432
2458
|
export declare const ${jsxName}: FunctionalComponent<${upperName}Props>
|
|
@@ -2454,17 +2480,17 @@ ${ctx.file.importType("Assign, JsxStyleProps, JsxHTMLProps", "./system-types")}
|
|
|
2454
2480
|
type IntrinsicElement = keyof NativeElements
|
|
2455
2481
|
type ElementType = IntrinsicElement | Component
|
|
2456
2482
|
|
|
2457
|
-
type ComponentProps<T extends ElementType> = T extends IntrinsicElement
|
|
2483
|
+
export type ComponentProps<T extends ElementType> = T extends IntrinsicElement
|
|
2458
2484
|
? NativeElements[T]
|
|
2459
2485
|
: T extends Component<infer Props>
|
|
2460
2486
|
? Props
|
|
2461
2487
|
: never
|
|
2462
2488
|
|
|
2463
|
-
|
|
2489
|
+
interface ${componentName}<T extends ElementType, P extends Dict = {}> extends FunctionalComponent<
|
|
2464
2490
|
JsxHTMLProps<ComponentProps<T>, Assign<JsxStyleProps, P>>
|
|
2465
|
-
>
|
|
2491
|
+
> {}
|
|
2466
2492
|
|
|
2467
|
-
|
|
2493
|
+
interface RecipeFn = { __type: any }
|
|
2468
2494
|
|
|
2469
2495
|
interface JsxFactory {
|
|
2470
2496
|
${styleProps === "none" ? "" : `<T extends ElementType>(component: T): ${componentName}<T, {}>`}
|
|
@@ -2500,7 +2526,7 @@ import type { Component, FunctionalComponent, NativeElements } from 'vue'
|
|
|
2500
2526
|
type IntrinsicElement = keyof NativeElements
|
|
2501
2527
|
type ElementType = IntrinsicElement | Component
|
|
2502
2528
|
|
|
2503
|
-
type ComponentProps<T extends ElementType> = T extends IntrinsicElement
|
|
2529
|
+
export type ComponentProps<T extends ElementType> = T extends IntrinsicElement
|
|
2504
2530
|
? NativeElements[T]
|
|
2505
2531
|
: T extends Component<infer Props>
|
|
2506
2532
|
? Props
|
|
@@ -2630,27 +2656,27 @@ var csstype_d_ts_default = {
|
|
|
2630
2656
|
|
|
2631
2657
|
// src/artifacts/generated/system-types.d.ts.json
|
|
2632
2658
|
var system_types_d_ts_default = {
|
|
2633
|
-
content: "import type { ConditionalValue, Conditions, Nested } from './conditions'\nimport type { PropertiesFallback } from './csstype'\nimport type { SystemProperties, CssVarProperties } from './style-props'\n\ntype String = string & {}\ntype Number = number & {}\n\n/* -----------------------------------------------------------------------------\n * Native css properties\n * -----------------------------------------------------------------------------*/\n\nexport type CssProperty = keyof PropertiesFallback\n\nexport
|
|
2659
|
+
content: "import type { ConditionalValue, Conditions, Nested } from './conditions'\nimport type { PropertiesFallback } from './csstype'\nimport type { SystemProperties, CssVarProperties } from './style-props'\n\ntype String = string & {}\ntype Number = number & {}\n\n/* -----------------------------------------------------------------------------\n * Native css properties\n * -----------------------------------------------------------------------------*/\n\nexport type CssProperty = keyof PropertiesFallback\n\nexport interface CssProperties extends PropertiesFallback<String | Number>, CssVarProperties {}\n\nexport interface CssKeyframes {\n [name: string]: {\n [time: string]: CssProperties\n }\n}\n\n/* -----------------------------------------------------------------------------\n * Conditional css properties\n * -----------------------------------------------------------------------------*/\n\ntype MinimalNested<P> = {\n [K in keyof Conditions]?: Nested<P>\n}\n\ninterface GenericProperties {\n [key: string]: ConditionalValue<String | Number | boolean>\n}\n\n/* -----------------------------------------------------------------------------\n * Native css props\n * -----------------------------------------------------------------------------*/\n\nexport type NestedCssProperties = Nested<CssProperties>\n\nexport type SystemStyleObject = Nested<SystemProperties & CssVarProperties>\n\nexport interface GlobalStyleObject {\n [selector: string]: SystemStyleObject\n}\nexport interface ExtendableGlobalStyleObject {\n [selector: string]: SystemStyleObject | undefined\n extend?: GlobalStyleObject | undefined\n}\n\nexport type CompositionStyleObject<Property extends string> = Nested<{\n [K in Property]?: K extends keyof SystemStyleObject ? SystemStyleObject[K] : unknown\n}>\n\n/* -----------------------------------------------------------------------------\n * Jsx style props\n * -----------------------------------------------------------------------------*/\ninterface WithCss {\n css?: SystemStyleObject\n}\ntype StyleProps = SystemProperties & MinimalNested<SystemStyleObject>\n\nexport type JsxStyleProps = StyleProps & WithCss\n\nexport type DistributiveOmit<T, K extends keyof any> = T extends unknown ? Omit<T, K> : never\n\nexport type Assign<T, U> = {\n [K in keyof T]: K extends keyof U ? U[K] : T[K]\n} & U\n\nexport interface PatchedHTMLProps {\n htmlWidth?: string | number\n htmlHeight?: string | number\n htmlTranslate?: 'yes' | 'no' | undefined\n htmlContent?: string\n}\n\nexport type OmittedHTMLProps = 'color' | 'translate' | 'transition' | 'width' | 'height' | 'content'\n\ntype WithHTMLProps<T> = DistributiveOmit<T, OmittedHTMLProps> & PatchedHTMLProps\n\nexport type JsxHTMLProps<T extends Record<string, any>, P extends Record<string, any> = {}> = Assign<\n WithHTMLProps<T>,\n P\n>\n"
|
|
2634
2660
|
};
|
|
2635
2661
|
|
|
2636
2662
|
// src/artifacts/generated/composition.d.ts.json
|
|
2637
2663
|
var composition_d_ts_default = {
|
|
2638
|
-
content: "import type { CompositionStyleObject } from './system-types'\n\
|
|
2664
|
+
content: "import type { CompositionStyleObject } from './system-types'\n\ninterface Recursive<T> {\n [key: string]: Recursive<T> | T\n}\n\nexport interface Token<Value = any> {\n value: Value\n description?: string\n}\n\n/* -----------------------------------------------------------------------------\n * Text styles\n * -----------------------------------------------------------------------------*/\n\ntype TextStyleProperty =\n | 'fontSize'\n | 'fontSizeAdjust'\n | 'fontVariationSettings'\n | 'fontVariantPosition'\n | 'fontVariantCaps'\n | 'fontVariantNumeric'\n | 'fontVariantAlternates'\n | 'fontVariantLigatures'\n | 'fontFamily'\n | 'fontWeight'\n | 'fontSynthesis'\n | 'fontStyle'\n | 'fontVariant'\n | 'lineHeight'\n | 'letterSpacing'\n | 'textDecoration'\n | 'textTransform'\n | 'textIndent'\n | 'textDecorationColor'\n | 'textDecorationLine'\n | 'textDecorationStyle'\n | 'textEmphasisColor'\n | 'textEmphasisPosition'\n | 'textEmphasisStyle'\n | 'hyphenateCharacter'\n | 'textOrientation'\n | 'textOverflow'\n | 'textRendering'\n\nexport type TextStyle = CompositionStyleObject<TextStyleProperty>\n\nexport type TextStyles = Recursive<Token<TextStyle>>\n\n/* -----------------------------------------------------------------------------\n * Layer styles\n * -----------------------------------------------------------------------------*/\n\ntype Placement =\n | 'Top'\n | 'Right'\n | 'Bottom'\n | 'Left'\n | 'Inline'\n | 'Block'\n | 'InlineStart'\n | 'InlineEnd'\n | 'BlockStart'\n | 'BlockEnd'\n\ntype Radius =\n | `Top${'Right' | 'Left'}`\n | `Bottom${'Right' | 'Left'}`\n | `Start${'Start' | 'End'}`\n | `End${'Start' | 'End'}`\n\ntype LayerStyleProperty =\n | 'background'\n | 'backgroundColor'\n | 'backgroundImage'\n | 'borderRadius'\n | 'border'\n | 'borderWidth'\n | 'borderColor'\n | 'borderStyle'\n | 'boxShadow'\n | 'filter'\n | 'backdropFilter'\n | 'transform'\n | 'color'\n | 'opacity'\n | 'backgroundBlendMode'\n | 'backgroundAttachment'\n | 'backgroundClip'\n | 'backgroundOrigin'\n | 'backgroundPosition'\n | 'backgroundRepeat'\n | 'backgroundSize'\n | `border${Placement}`\n | `border${Placement}Width`\n | 'borderRadius'\n | `border${Radius}Radius`\n | `border${Placement}Color`\n | `border${Placement}Style`\n | 'padding'\n | `padding${Placement}`\n\nexport type LayerStyle = CompositionStyleObject<LayerStyleProperty>\n\nexport type LayerStyles = Recursive<Token<LayerStyle>>\n\nexport interface CompositionStyles {\n textStyles: TextStyles\n layerStyles: LayerStyles\n}\n"
|
|
2639
2665
|
};
|
|
2640
2666
|
|
|
2641
2667
|
// src/artifacts/generated/recipe.d.ts.json
|
|
2642
2668
|
var recipe_d_ts_default = {
|
|
2643
|
-
content: "import type { SystemStyleObject, DistributiveOmit } from './system-types'\n\ntype Pretty<T> = { [K in keyof T]: T[K] } & {}\n\ntype StringToBoolean<T> = T extends 'true' | 'false' ? boolean : T\n\nexport type RecipeVariantRecord = Record<any, Record<any, SystemStyleObject>>\n\nexport type RecipeSelection<T extends RecipeVariantRecord> = keyof any extends keyof T\n ? {}\n : {\n [K in keyof T]?: StringToBoolean<keyof T[K]>\n }\n\nexport type RecipeVariantFn<T extends RecipeVariantRecord> = (props?: RecipeSelection<T>) => string\n\nexport type RecipeVariantProps<\n T extends RecipeVariantFn<RecipeVariantRecord> | SlotRecipeVariantFn<string, SlotRecipeVariantRecord<string>>,\n> = Pretty<Parameters<T>[0]>\n\ntype RecipeVariantMap<T extends RecipeVariantRecord> = {\n [K in keyof T]: Array<keyof T[K]>\n}\n\n/* -----------------------------------------------------------------------------\n * Recipe / Standard\n * -----------------------------------------------------------------------------*/\n\nexport
|
|
2669
|
+
content: "import type { SystemStyleObject, DistributiveOmit } from './system-types'\n\ntype Pretty<T> = { [K in keyof T]: T[K] } & {}\n\ntype StringToBoolean<T> = T extends 'true' | 'false' ? boolean : T\n\nexport type RecipeVariantRecord = Record<any, Record<any, SystemStyleObject>>\n\nexport type RecipeSelection<T extends RecipeVariantRecord> = keyof any extends keyof T\n ? {}\n : {\n [K in keyof T]?: StringToBoolean<keyof T[K]>\n }\n\nexport type RecipeVariantFn<T extends RecipeVariantRecord> = (props?: RecipeSelection<T>) => string\n\nexport type RecipeVariantProps<\n T extends RecipeVariantFn<RecipeVariantRecord> | SlotRecipeVariantFn<string, SlotRecipeVariantRecord<string>>,\n> = Pretty<Parameters<T>[0]>\n\ntype RecipeVariantMap<T extends RecipeVariantRecord> = {\n [K in keyof T]: Array<keyof T[K]>\n}\n\n/* -----------------------------------------------------------------------------\n * Recipe / Standard\n * -----------------------------------------------------------------------------*/\n\nexport interface RecipeRuntimeFn<T extends RecipeVariantRecord> extends RecipeVariantFn<T> {\n __type: RecipeSelection<T>\n variantKeys: (keyof T)[]\n variantMap: RecipeVariantMap<T>\n raw: (props?: RecipeSelection<T>) => SystemStyleObject\n config: RecipeConfig<T>\n splitVariantProps<Props extends RecipeSelection<T>>(\n props: Props,\n ): [RecipeSelection<T>, Pretty<DistributiveOmit<Props, keyof T>>]\n}\n\nexport type RecipeCompoundSelection<T extends RecipeVariantRecord> = {\n [K in keyof T]?: StringToBoolean<keyof T[K]> | Array<StringToBoolean<keyof T[K]>>\n}\n\nexport type RecipeCompoundVariant<T extends RecipeVariantRecord> = RecipeCompoundSelection<T> & {\n css: SystemStyleObject\n}\n\nexport interface RecipeDefinition<T extends RecipeVariantRecord> {\n /**\n * The base styles of the recipe.\n */\n base?: SystemStyleObject\n /**\n * The multi-variant styles of the recipe.\n */\n variants?: T | RecipeVariantRecord\n /**\n * The default variants of the recipe.\n */\n defaultVariants?: RecipeSelection<T>\n /**\n * The styles to apply when a combination of variants is selected.\n */\n compoundVariants?: Array<RecipeCompoundVariant<T>>\n}\n\nexport type RecipeCreatorFn = <T extends RecipeVariantRecord>(config: RecipeDefinition<T>) => RecipeRuntimeFn<T>\n\ninterface RecipeConfigMeta {\n /**\n * The name of the recipe.\n */\n className: string\n /**\n * The description of the recipe. This will be used in the JSDoc comment.\n */\n description?: string\n /**\n * The jsx elements to track for this recipe. Can be string or Regexp.\n *\n * @default capitalize(recipe.name)\n * @example ['Button', 'Link', /Button$/]\n */\n jsx?: Array<string | RegExp>\n}\n\nexport interface RecipeConfig<T extends RecipeVariantRecord = RecipeVariantRecord>\n extends RecipeDefinition<T>,\n RecipeConfigMeta {}\n\n/* -----------------------------------------------------------------------------\n * Recipe / Slot\n * -----------------------------------------------------------------------------*/\n\ntype SlotRecord<S extends string, T> = Partial<Record<S, T>>\n\nexport type SlotRecipeVariantRecord<S extends string> = Record<any, Record<any, SlotRecord<S, SystemStyleObject>>>\n\nexport type SlotRecipeVariantFn<S extends string, T extends RecipeVariantRecord> = (\n props?: RecipeSelection<T>,\n) => SlotRecord<S, string>\n\nexport interface SlotRecipeRuntimeFn<S extends string, T extends SlotRecipeVariantRecord<S>>\n extends SlotRecipeVariantFn<S, T> {\n raw: (props?: RecipeSelection<T>) => Record<S, SystemStyleObject>\n variantKeys: (keyof T)[]\n variantMap: RecipeVariantMap<T>\n splitVariantProps<Props extends RecipeSelection<T>>(props: Props): [RecipeSelection<T>, Pretty<Omit<Props, keyof T>>]\n}\n\nexport type SlotRecipeCompoundVariant<S extends string, T extends RecipeVariantRecord> = RecipeCompoundSelection<T> & {\n css: SlotRecord<S, SystemStyleObject>\n}\n\nexport interface SlotRecipeDefinition<S extends string, T extends SlotRecipeVariantRecord<S>> {\n /**\n * The parts/slots of the recipe.\n */\n slots: S[] | Readonly<S[]>\n /**\n * The base styles of the recipe.\n */\n base?: SlotRecord<S, SystemStyleObject>\n /**\n * The multi-variant styles of the recipe.\n */\n variants?: T | SlotRecipeVariantRecord<S>\n /**\n * The default variants of the recipe.\n */\n defaultVariants?: RecipeSelection<T>\n /**\n * The styles to apply when a combination of variants is selected.\n */\n compoundVariants?: Array<SlotRecipeCompoundVariant<S, T>>\n}\n\nexport type SlotRecipeCreatorFn = <S extends string, T extends SlotRecipeVariantRecord<S>>(\n config: SlotRecipeDefinition<S, T>,\n) => SlotRecipeRuntimeFn<S, T>\n\nexport type SlotRecipeConfig<\n S extends string = string,\n T extends SlotRecipeVariantRecord<S> = SlotRecipeVariantRecord<S>,\n> = SlotRecipeDefinition<S, T> & RecipeConfigMeta\n"
|
|
2644
2670
|
};
|
|
2645
2671
|
|
|
2646
2672
|
// src/artifacts/generated/pattern.d.ts.json
|
|
2647
2673
|
var pattern_d_ts_default = {
|
|
2648
|
-
content: "import type { CssProperty, SystemStyleObject } from './system-types'\nimport type { TokenCategory } from '../tokens'\n\ntype Primitive = string | number | boolean | null | undefined\ntype LiteralUnion<T, K extends Primitive = string> = T | (K & Record<never, never>)\n\nexport type PatternProperty =\n | { type: 'property'; value: CssProperty }\n | { type: 'enum'; value: string[] }\n | { type: 'token'; value: TokenCategory; property?: CssProperty }\n | { type: 'string' | 'boolean' | 'number' }\n\nexport
|
|
2674
|
+
content: "import type { CssProperty, SystemStyleObject } from './system-types'\nimport type { TokenCategory } from '../tokens'\n\ntype Primitive = string | number | boolean | null | undefined\ntype LiteralUnion<T, K extends Primitive = string> = T | (K & Record<never, never>)\n\nexport type PatternProperty =\n | { type: 'property'; value: CssProperty }\n | { type: 'enum'; value: string[] }\n | { type: 'token'; value: TokenCategory; property?: CssProperty }\n | { type: 'string' | 'boolean' | 'number' }\n\nexport interface PatternHelpers {\n map: (value: any, fn: (value: string) => string | undefined) => any\n}\n\nexport type PatternProperties = Record<string, PatternProperty>\n\ntype Props<T> = Record<LiteralUnion<keyof T>, any>\n\nexport interface PatternConfig<T extends PatternProperties = PatternProperties> {\n /**\n * The description of the pattern. This will be used in the JSDoc comment.\n */\n description?: string\n /**\n * The JSX element rendered by the pattern\n * @default 'div'\n */\n jsxElement?: string\n /**\n * The properties of the pattern.\n */\n properties?: T\n /**\n * The css object this pattern will generate.\n */\n transform?: (props: Props<T>, helpers: PatternHelpers) => SystemStyleObject\n /**\n * The jsx element name this pattern will generate.\n */\n jsxName?: string\n /**\n * The jsx elements to track for this pattern. Can be string or Regexp.\n *\n * @default capitalize(pattern.name)\n * @example ['Button', 'Link', /Button$/]\n */\n jsx?: Array<string | RegExp>\n /**\n * Whether to only generate types for the specified properties.\n * This will disallow css properties\n */\n strict?: boolean\n /**\n * @experimental\n * Disallow certain css properties for this pattern\n */\n blocklist?: LiteralUnion<CssProperty>[]\n}\n"
|
|
2649
2675
|
};
|
|
2650
2676
|
|
|
2651
2677
|
// src/artifacts/generated/parts.d.ts.json
|
|
2652
2678
|
var parts_d_ts_default = {
|
|
2653
|
-
content: "export
|
|
2679
|
+
content: "export interface Part {\n selector: string\n}\n\nexport type Parts = Record<string, Part>\n"
|
|
2654
2680
|
};
|
|
2655
2681
|
|
|
2656
2682
|
// src/artifacts/generated/selectors.d.ts.json
|
|
@@ -2681,7 +2707,7 @@ import { outdent as outdent39 } from "outdent";
|
|
|
2681
2707
|
var generateTypesEntry = (ctx) => ({
|
|
2682
2708
|
global: outdent39`
|
|
2683
2709
|
// @ts-nocheck
|
|
2684
|
-
import type
|
|
2710
|
+
import type * as Panda from '@pandacss/dev'
|
|
2685
2711
|
${ctx.file.importType("RecipeVariantRecord, RecipeConfig, SlotRecipeVariantRecord, SlotRecipeConfig", "./recipe")}
|
|
2686
2712
|
${ctx.file.importType("Parts", "./parts")}
|
|
2687
2713
|
${ctx.file.importType("PatternConfig, PatternProperties", "./pattern")}
|
|
@@ -2689,23 +2715,25 @@ var generateTypesEntry = (ctx) => ({
|
|
|
2689
2715
|
${ctx.file.importType("CompositionStyles", "./composition")}
|
|
2690
2716
|
|
|
2691
2717
|
declare module '@pandacss/dev' {
|
|
2692
|
-
export function defineRecipe<V extends RecipeVariantRecord>(config: RecipeConfig<V>): RecipeConfig
|
|
2693
|
-
export function defineSlotRecipe<S extends string, V extends SlotRecipeVariantRecord<S>>(config: SlotRecipeConfig<S, V>): SlotRecipeConfig
|
|
2718
|
+
export function defineRecipe<V extends RecipeVariantRecord>(config: RecipeConfig<V>): Panda.RecipeConfig
|
|
2719
|
+
export function defineSlotRecipe<S extends string, V extends SlotRecipeVariantRecord<S>>(config: SlotRecipeConfig<S, V>): Panda.SlotRecipeConfig
|
|
2694
2720
|
export function defineStyles(definition: SystemStyleObject): SystemStyleObject
|
|
2695
|
-
export function defineGlobalStyles(definition: GlobalStyleObject): GlobalStyleObject
|
|
2696
|
-
export function defineTextStyles(definition: CompositionStyles['textStyles']): TextStyles
|
|
2697
|
-
export function defineLayerStyles(definition: CompositionStyles['layerStyles']): LayerStyles
|
|
2698
|
-
export function definePattern<T extends PatternProperties>(config: PatternConfig<T>): PatternConfig
|
|
2721
|
+
export function defineGlobalStyles(definition: GlobalStyleObject): Panda.GlobalStyleObject
|
|
2722
|
+
export function defineTextStyles(definition: CompositionStyles['textStyles']): Panda.TextStyles
|
|
2723
|
+
export function defineLayerStyles(definition: CompositionStyles['layerStyles']): Panda.LayerStyles
|
|
2724
|
+
export function definePattern<T extends PatternProperties>(config: PatternConfig<T>): Panda.PatternConfig
|
|
2699
2725
|
export function defineParts<T extends Parts>(parts: T): (config: Partial<Record<keyof T, SystemStyleObject>>) => Partial<Record<keyof T, SystemStyleObject>>
|
|
2700
2726
|
}
|
|
2701
2727
|
`,
|
|
2702
2728
|
// We need to export types used in the global.d.ts here to avoid TS errors such as `The inferred type of 'xxx' cannot be named without a reference to 'yyy'`
|
|
2703
2729
|
index: outdent39`
|
|
2704
2730
|
import '${ctx.file.extDts("./global")}'
|
|
2705
|
-
${ctx.file.
|
|
2706
|
-
${ctx.file.
|
|
2707
|
-
${ctx.file.
|
|
2708
|
-
${ctx.file.
|
|
2731
|
+
${ctx.file.exportTypeStar("./conditions")}
|
|
2732
|
+
${ctx.file.exportTypeStar("./pattern")}
|
|
2733
|
+
${ctx.file.exportTypeStar("./recipe")}
|
|
2734
|
+
${ctx.file.exportTypeStar("./system-types")}
|
|
2735
|
+
${ctx.file.exportTypeStar("./jsx")}
|
|
2736
|
+
${ctx.file.exportTypeStar("./style-props")}
|
|
2709
2737
|
|
|
2710
2738
|
`,
|
|
2711
2739
|
helpers: outdent39`
|
|
@@ -2727,7 +2755,7 @@ function generatePropTypes(ctx) {
|
|
|
2727
2755
|
${ctx.file.importType("CssProperties", "./system-types")}
|
|
2728
2756
|
${ctx.file.importType("Tokens", "../tokens/index")}
|
|
2729
2757
|
|
|
2730
|
-
|
|
2758
|
+
interface PropertyValueTypes {`
|
|
2731
2759
|
];
|
|
2732
2760
|
const types = utility.getTypes();
|
|
2733
2761
|
for (const [prop, values] of types.entries()) {
|
|
@@ -2739,7 +2767,7 @@ function generatePropTypes(ctx) {
|
|
|
2739
2767
|
|
|
2740
2768
|
type Shorthand<T> = T extends keyof PropertyValueTypes ? PropertyValueTypes[T]${strictText} : CssValue<T>
|
|
2741
2769
|
|
|
2742
|
-
export
|
|
2770
|
+
export interface PropertyTypes extends PropertyValueTypes {
|
|
2743
2771
|
`);
|
|
2744
2772
|
utility.shorthands.forEach((value, key) => {
|
|
2745
2773
|
result.push(` ${key}: Shorthand<${JSON.stringify(value)}>;`);
|
|
@@ -2770,7 +2798,7 @@ function generateStyleProps(ctx) {
|
|
|
2770
2798
|
[key in \`--\${string}\`]?: ConditionalValue<Token | (string & {}) | (number & {})>
|
|
2771
2799
|
}
|
|
2772
2800
|
|
|
2773
|
-
export
|
|
2801
|
+
export interface SystemProperties {
|
|
2774
2802
|
${Array.from(props).map((v) => ` ${v}?: PropertyValue<'${v}'>`).join("\n")}
|
|
2775
2803
|
}
|
|
2776
2804
|
`;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pandacss/generator",
|
|
3
|
-
"version": "0.15.
|
|
3
|
+
"version": "0.15.2",
|
|
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.15.
|
|
24
|
-
"@pandacss/is-valid-prop": "0.15.
|
|
25
|
-
"@pandacss/logger": "0.15.
|
|
26
|
-
"@pandacss/shared": "0.15.
|
|
27
|
-
"@pandacss/token-dictionary": "0.15.
|
|
28
|
-
"@pandacss/types": "0.15.
|
|
22
|
+
"ts-pattern": "5.0.5",
|
|
23
|
+
"@pandacss/core": "0.15.2",
|
|
24
|
+
"@pandacss/is-valid-prop": "0.15.2",
|
|
25
|
+
"@pandacss/logger": "0.15.2",
|
|
26
|
+
"@pandacss/shared": "0.15.2",
|
|
27
|
+
"@pandacss/token-dictionary": "0.15.2",
|
|
28
|
+
"@pandacss/types": "0.15.2"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@types/pluralize": "0.0.30",
|
|
32
32
|
"hookable": "5.5.3",
|
|
33
|
-
"@pandacss/fixture": "0.15.
|
|
33
|
+
"@pandacss/fixture": "0.15.2"
|
|
34
34
|
},
|
|
35
35
|
"scripts": {
|
|
36
36
|
"prebuild": "tsx scripts/prebuild.ts",
|