@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.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
|
}
|
|
@@ -557,9 +572,11 @@ function generateConditions(ctx) {
|
|
|
557
572
|
dts: import_outdent2.default`
|
|
558
573
|
${ctx.file.importType("AnySelector, Selectors", "./selectors")}
|
|
559
574
|
|
|
560
|
-
export
|
|
575
|
+
export interface Conditions {
|
|
561
576
|
${keys.map(
|
|
562
|
-
(key) => ` ${key === "base" ? `/** The base (=no conditions) styles to apply
|
|
577
|
+
(key) => ` ${key === "base" ? `/** The base (=no conditions) styles to apply */
|
|
578
|
+
` : ctx.conditions.get(key) ? `/** \`${ctx.conditions.get(key)}\` */
|
|
579
|
+
` : ""} ${JSON.stringify(key)}: string`
|
|
563
580
|
).join("\n")}
|
|
564
581
|
}
|
|
565
582
|
|
|
@@ -868,7 +885,7 @@ var import_outdent8 = require("outdent");
|
|
|
868
885
|
|
|
869
886
|
// src/artifacts/generated/helpers.mjs.json
|
|
870
887
|
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 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
|
|
888
|
+
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
889
|
};
|
|
873
890
|
|
|
874
891
|
// src/artifacts/generated/astish.mjs.json
|
|
@@ -964,7 +981,7 @@ function generatePattern(ctx) {
|
|
|
964
981
|
${ctx.file.importType("DistributiveOmit", "../types/system-types")}
|
|
965
982
|
${ctx.file.importType("Tokens", "../tokens/index")}
|
|
966
983
|
|
|
967
|
-
export
|
|
984
|
+
export interface ${upperName}Properties {
|
|
968
985
|
${Object.keys(properties ?? {}).map((key) => {
|
|
969
986
|
const value = properties[key];
|
|
970
987
|
return (0, import_ts_pattern2.match)(value).with({ type: "property" }, (value2) => {
|
|
@@ -984,7 +1001,7 @@ function generatePattern(ctx) {
|
|
|
984
1001
|
|
|
985
1002
|
${strict ? import_outdent10.outdent`export declare function ${baseName}(styles: ${upperName}Properties): string` : import_outdent10.outdent`
|
|
986
1003
|
|
|
987
|
-
|
|
1004
|
+
interface ${upperName}Styles extends ${upperName}Properties, DistributiveOmit<SystemStyleObject, keyof ${upperName}Properties ${blocklistType}> {}
|
|
988
1005
|
|
|
989
1006
|
interface ${upperName}PatternFn {
|
|
990
1007
|
(styles?: ${upperName}Styles): string
|
|
@@ -1133,7 +1150,7 @@ function generateRecipes(ctx) {
|
|
|
1133
1150
|
${ctx.file.importType("Pretty", "../types/helpers")}
|
|
1134
1151
|
${ctx.file.importType("DistributiveOmit", "../types/system-types")}
|
|
1135
1152
|
|
|
1136
|
-
|
|
1153
|
+
interface ${upperName}Variant {
|
|
1137
1154
|
${Object.keys(variantKeyMap).map((key) => {
|
|
1138
1155
|
const values = variantKeyMap[key];
|
|
1139
1156
|
if (values.every(isBooleanValue))
|
|
@@ -1150,7 +1167,7 @@ function generateRecipes(ctx) {
|
|
|
1150
1167
|
[key in keyof ${upperName}Variant]?: ${compoundVariants?.length ? `${upperName}Variant[key]` : `ConditionalValue<${upperName}Variant[key]>`}
|
|
1151
1168
|
}
|
|
1152
1169
|
|
|
1153
|
-
interface ${upperName}Recipe {
|
|
1170
|
+
export interface ${upperName}Recipe {
|
|
1154
1171
|
__type: ${upperName}VariantProps
|
|
1155
1172
|
(props?: ${upperName}VariantProps): ${(0, import_core4.isSlotRecipe)(config) ? `Pretty<Record<${(0, import_shared2.unionType)(config.slots)}, string>>` : "string"}
|
|
1156
1173
|
raw: (props?: ${upperName}VariantProps) => ${upperName}VariantProps
|
|
@@ -1300,7 +1317,8 @@ function generatePreactJsxFactory(ctx) {
|
|
|
1300
1317
|
})
|
|
1301
1318
|
})
|
|
1302
1319
|
|
|
1303
|
-
|
|
1320
|
+
const name = (typeof Dynamic === 'string' ? Dynamic : Dynamic.displayName || Dynamic.name) || 'Component'
|
|
1321
|
+
${componentName}.displayName = \`${factoryName}.\${name}\`
|
|
1304
1322
|
return ${componentName}
|
|
1305
1323
|
}
|
|
1306
1324
|
|
|
@@ -1363,7 +1381,7 @@ function generatePreactJsxPattern(ctx) {
|
|
|
1363
1381
|
${ctx.file.importType("DistributiveOmit", "../types/system-types")}
|
|
1364
1382
|
${ctx.file.importType(typeName, "../types/jsx")}
|
|
1365
1383
|
|
|
1366
|
-
export
|
|
1384
|
+
export interface ${upperName}Props extends ${upperName}Properties, DistributiveOmit<${typeName}<'${jsxElement}'>, keyof ${upperName}Properties ${blocklistType}> {}
|
|
1367
1385
|
|
|
1368
1386
|
${description ? `/** ${description} */` : ""}
|
|
1369
1387
|
export declare const ${jsxName}: FunctionComponent<${upperName}Props>
|
|
@@ -1390,12 +1408,12 @@ type ElementType = keyof JSX.IntrinsicElements
|
|
|
1390
1408
|
|
|
1391
1409
|
type Dict = Record<string, unknown>
|
|
1392
1410
|
|
|
1393
|
-
export
|
|
1411
|
+
export interface ${componentName}<T extends ElementType, P extends Dict = {}> {
|
|
1394
1412
|
(props: JsxHTMLProps<ComponentProps<T>, P> & JsxStyleProps): JSX.Element
|
|
1395
1413
|
displayName?: string
|
|
1396
1414
|
}
|
|
1397
1415
|
|
|
1398
|
-
|
|
1416
|
+
interface RecipeFn = { __type: any }
|
|
1399
1417
|
|
|
1400
1418
|
interface JsxFactory {
|
|
1401
1419
|
${styleProps === "none" ? "" : `<T extends ElementType>(component: T): ${componentName}<T, {}>`}
|
|
@@ -1439,7 +1457,8 @@ function generatePreactJsxStringLiteralFactory(ctx) {
|
|
|
1439
1457
|
})
|
|
1440
1458
|
})
|
|
1441
1459
|
|
|
1442
|
-
|
|
1460
|
+
const name = (typeof Dynamic === 'string' ? Dynamic : Dynamic.displayName || Dynamic.name) || 'Component'
|
|
1461
|
+
${componentName}.displayName = \`${factoryName}.\${name}\`
|
|
1443
1462
|
return ${componentName}
|
|
1444
1463
|
}
|
|
1445
1464
|
}
|
|
@@ -1541,7 +1560,8 @@ function generateQwikJsxFactory(ctx) {
|
|
|
1541
1560
|
})
|
|
1542
1561
|
}
|
|
1543
1562
|
|
|
1544
|
-
|
|
1563
|
+
const name = (typeof Dynamic === 'string' ? Dynamic : Dynamic.displayName || Dynamic.name) || 'Component'
|
|
1564
|
+
${componentName}.displayName = \`${factoryName}.\${name}\`
|
|
1545
1565
|
return ${componentName}
|
|
1546
1566
|
}
|
|
1547
1567
|
|
|
@@ -1581,7 +1601,7 @@ function generateQwikJsxPattern(ctx) {
|
|
|
1581
1601
|
import { h } from '@builder.io/qwik'
|
|
1582
1602
|
${ctx.file.import(factoryName, "./factory")}
|
|
1583
1603
|
${ctx.file.import(styleFnName, `../patterns/${dashName}`)}
|
|
1584
|
-
|
|
1604
|
+
|
|
1585
1605
|
export const ${jsxName} = function ${jsxName}(props) {
|
|
1586
1606
|
${(0, import_ts_pattern5.match)(props.length).with(
|
|
1587
1607
|
0,
|
|
@@ -1604,8 +1624,8 @@ function generateQwikJsxPattern(ctx) {
|
|
|
1604
1624
|
${ctx.file.importType(typeName, "../types/jsx")}
|
|
1605
1625
|
${ctx.file.importType("Assign, DistributiveOmit", "../types/system-types")}
|
|
1606
1626
|
|
|
1607
|
-
export
|
|
1608
|
-
|
|
1627
|
+
export interface ${upperName}Props extends Assign<${typeName}<'${jsxElement}'>, DistributiveOmit<${upperName}Properties, ${blocklistType || '""'}>> {}
|
|
1628
|
+
|
|
1609
1629
|
${description ? `/** ${description} */` : ""}
|
|
1610
1630
|
export declare const ${jsxName}: Component<${upperName}Props>
|
|
1611
1631
|
`
|
|
@@ -1629,7 +1649,7 @@ import type { RecipeDefinition, RecipeSelection, RecipeVariantRecord } from './r
|
|
|
1629
1649
|
|
|
1630
1650
|
type ElementType = keyof QwikIntrinsicElements | Component<any>
|
|
1631
1651
|
|
|
1632
|
-
type ComponentProps<T extends ElementType> = T extends keyof QwikIntrinsicElements
|
|
1652
|
+
export type ComponentProps<T extends ElementType> = T extends keyof QwikIntrinsicElements
|
|
1633
1653
|
? QwikIntrinsicElements[T]
|
|
1634
1654
|
: T extends Component<infer P>
|
|
1635
1655
|
? P
|
|
@@ -1637,9 +1657,9 @@ type ComponentProps<T extends ElementType> = T extends keyof QwikIntrinsicElemen
|
|
|
1637
1657
|
|
|
1638
1658
|
type Dict = Record<string, unknown>
|
|
1639
1659
|
|
|
1640
|
-
export
|
|
1660
|
+
export interface ${componentName}<T extends ElementType, P extends Dict = {}> extends Component<Assign<ComponentProps<T>, PatchedHTMLProps, Assign<JsxStyleProps, P>>> {}
|
|
1641
1661
|
|
|
1642
|
-
|
|
1662
|
+
interface RecipeFn { __type: any }
|
|
1643
1663
|
|
|
1644
1664
|
interface JsxFactory {
|
|
1645
1665
|
${styleProps === "none" ? "" : `<T extends ElementType>(component: T): ${componentName}<T, {}>`}
|
|
@@ -1681,7 +1701,8 @@ function generateQwikJsxStringLiteralFactory(ctx) {
|
|
|
1681
1701
|
})
|
|
1682
1702
|
}
|
|
1683
1703
|
|
|
1684
|
-
|
|
1704
|
+
const name = (typeof Dynamic === 'string' ? Dynamic : Dynamic.displayName || Dynamic.name) || 'Component'
|
|
1705
|
+
${componentName}.displayName = \`${factoryName}.\${name}\`
|
|
1685
1706
|
return ${componentName}
|
|
1686
1707
|
}
|
|
1687
1708
|
}
|
|
@@ -1722,7 +1743,7 @@ import type { Component, QwikIntrinsicElements } from '@builder.io/qwik'
|
|
|
1722
1743
|
|
|
1723
1744
|
type ElementType = keyof QwikIntrinsicElements | Component<any>
|
|
1724
1745
|
|
|
1725
|
-
type ComponentProps<T extends ElementType> = T extends keyof QwikIntrinsicElements
|
|
1746
|
+
export type ComponentProps<T extends ElementType> = T extends keyof QwikIntrinsicElements
|
|
1726
1747
|
? QwikIntrinsicElements[T]
|
|
1727
1748
|
: T extends Component<infer P>
|
|
1728
1749
|
? P
|
|
@@ -1826,7 +1847,8 @@ function generateReactJsxFactory(ctx) {
|
|
|
1826
1847
|
})
|
|
1827
1848
|
})
|
|
1828
1849
|
|
|
1829
|
-
|
|
1850
|
+
const name = (typeof Dynamic === 'string' ? Dynamic : Dynamic.displayName || Dynamic.name) || 'Component'
|
|
1851
|
+
${componentName}.displayName = \`${factoryName}.\${name}\`
|
|
1830
1852
|
return ${componentName}
|
|
1831
1853
|
}
|
|
1832
1854
|
|
|
@@ -1889,7 +1911,7 @@ function generateReactJsxPattern(ctx) {
|
|
|
1889
1911
|
${ctx.file.importType(typeName, "../types/jsx")}
|
|
1890
1912
|
${ctx.file.importType("DistributiveOmit", "../types/system-types")}
|
|
1891
1913
|
|
|
1892
|
-
export
|
|
1914
|
+
export interface ${upperName}Props extends ${upperName}Properties, DistributiveOmit<${typeName}<'${jsxElement}'>, keyof ${upperName}Properties ${blocklistType}> {}
|
|
1893
1915
|
|
|
1894
1916
|
${description ? `/** ${description} */` : ""}
|
|
1895
1917
|
export declare const ${jsxName}: FunctionComponent<${upperName}Props>
|
|
@@ -1914,16 +1936,16 @@ ${ctx.file.importType("RecipeDefinition, RecipeSelection, RecipeVariantRecord",
|
|
|
1914
1936
|
|
|
1915
1937
|
type Dict = Record<string, unknown>
|
|
1916
1938
|
|
|
1917
|
-
type ComponentProps<T extends ElementType> = DistributiveOmit<ComponentPropsWithoutRef<T>, 'ref'> & {
|
|
1939
|
+
export type ComponentProps<T extends ElementType> = DistributiveOmit<ComponentPropsWithoutRef<T>, 'ref'> & {
|
|
1918
1940
|
ref?: Ref<ElementRef<T>>
|
|
1919
1941
|
}
|
|
1920
1942
|
|
|
1921
|
-
export
|
|
1943
|
+
export interface ${componentName}<T extends ElementType, P extends Dict = {}> {
|
|
1922
1944
|
(props: JsxHTMLProps<ComponentProps<T>, Assign<JsxStyleProps, P>>): JSX.Element
|
|
1923
1945
|
displayName?: string
|
|
1924
1946
|
}
|
|
1925
1947
|
|
|
1926
|
-
|
|
1948
|
+
interface RecipeFn { __type: any }
|
|
1927
1949
|
|
|
1928
1950
|
interface JsxFactory {
|
|
1929
1951
|
${styleProps === "none" ? "" : `<T extends ElementType>(component: T): ${componentName}<T, {}>`}
|
|
@@ -1966,7 +1988,8 @@ function generateReactJsxStringLiteralFactory(ctx) {
|
|
|
1966
1988
|
})
|
|
1967
1989
|
})
|
|
1968
1990
|
|
|
1969
|
-
|
|
1991
|
+
const name = (typeof Dynamic === 'string' ? Dynamic : Dynamic.displayName || Dynamic.name) || 'Component'
|
|
1992
|
+
${componentName}.displayName = \`${factoryName}.\${name}\`
|
|
1970
1993
|
return ${componentName}
|
|
1971
1994
|
}
|
|
1972
1995
|
}
|
|
@@ -2008,7 +2031,7 @@ ${ctx.file.importType("DistributiveOmit", "../types/system-types")}
|
|
|
2008
2031
|
|
|
2009
2032
|
type Dict = Record<string, unknown>
|
|
2010
2033
|
|
|
2011
|
-
type ComponentProps<T extends ElementType> = DistributiveOmit<ComponentPropsWithoutRef<T>, 'ref'> & {
|
|
2034
|
+
export type ComponentProps<T extends ElementType> = DistributiveOmit<ComponentPropsWithoutRef<T>, 'ref'> & {
|
|
2012
2035
|
ref?: Ref<ElementRef<T>>
|
|
2013
2036
|
}
|
|
2014
2037
|
|
|
@@ -2149,7 +2172,7 @@ function generateSolidJsxPattern(ctx) {
|
|
|
2149
2172
|
${ctx.file.importType(typeName, "../types/jsx")}
|
|
2150
2173
|
${ctx.file.importType("DistributiveOmit", "../types/system-types")}
|
|
2151
2174
|
|
|
2152
|
-
export
|
|
2175
|
+
export interface ${upperName}Props extends ${upperName}Properties, DistributiveOmit<${typeName}<'${jsxElement}'>, keyof ${upperName}Properties ${blocklistType}> {}
|
|
2153
2176
|
|
|
2154
2177
|
${description ? `/** ${description} */` : ""}
|
|
2155
2178
|
export declare const ${jsxName}: Component<${upperName}Props>
|
|
@@ -2176,12 +2199,12 @@ type Dict = Record<string, unknown>
|
|
|
2176
2199
|
|
|
2177
2200
|
type ElementType<P = any> = keyof JSX.IntrinsicElements | Component<P>
|
|
2178
2201
|
|
|
2179
|
-
export
|
|
2202
|
+
export interface ${componentName}<T extends ElementType, P extends Dict = {}> {
|
|
2180
2203
|
(props: JsxHTMLProps<ComponentProps<T>, Assign<JsxStyleProps, P>>): JSX.Element
|
|
2181
2204
|
displayName?: string
|
|
2182
2205
|
}
|
|
2183
2206
|
|
|
2184
|
-
|
|
2207
|
+
interface RecipeFn { __type: any }
|
|
2185
2208
|
|
|
2186
2209
|
interface JsxFactory {
|
|
2187
2210
|
${styleProps === "none" ? "" : `<T extends ElementType>(component: T): ${componentName}<T, {}>`}
|
|
@@ -2304,9 +2327,10 @@ function generateVueJsxFactory(ctx) {
|
|
|
2304
2327
|
|
|
2305
2328
|
function styledFn(Dynamic, configOrCva = {}) {
|
|
2306
2329
|
const cvaFn = configOrCva.__cva__ || configOrCva.__recipe__ ? configOrCva : cva(configOrCva)
|
|
2330
|
+
const name = (typeof Dynamic === 'string' ? Dynamic : Dynamic.displayName || Dynamic.name) || 'Component'
|
|
2307
2331
|
|
|
2308
2332
|
return defineComponent({
|
|
2309
|
-
name: \`${factoryName}.\${
|
|
2333
|
+
name: \`${factoryName}.\${name}\`,
|
|
2310
2334
|
inheritAttrs: false,
|
|
2311
2335
|
props: { as: { type: [String, Object], default: Dynamic } },
|
|
2312
2336
|
setup(props, { slots, attrs }) {
|
|
@@ -2379,10 +2403,12 @@ function generateVueJsxStringLiteralFactory(ctx) {
|
|
|
2379
2403
|
${ctx.file.import("css, cx", "../css/index")}
|
|
2380
2404
|
|
|
2381
2405
|
function createStyled(Dynamic) {
|
|
2406
|
+
const name = (typeof Dynamic === 'string' ? Dynamic : Dynamic.displayName || Dynamic.name) || 'Component'
|
|
2407
|
+
|
|
2382
2408
|
function styledFn(template) {
|
|
2383
2409
|
const baseClassName = css(template)
|
|
2384
2410
|
return defineComponent({
|
|
2385
|
-
name: \`${factoryName}.\${
|
|
2411
|
+
name: \`${factoryName}.\${name}\`,
|
|
2386
2412
|
inheritAttrs: false,
|
|
2387
2413
|
props: { as: { type: [String, Object], default: Dynamic } },
|
|
2388
2414
|
setup(props, { slots, attrs }) {
|
|
@@ -2457,7 +2483,7 @@ function generateVueJsxPattern(ctx) {
|
|
|
2457
2483
|
${ctx.file.importType(typeName, "../types/jsx")}
|
|
2458
2484
|
${ctx.file.importType("DistributiveOmit", "../types/system-types")}
|
|
2459
2485
|
|
|
2460
|
-
export
|
|
2486
|
+
export interface ${upperName}Props extends ${upperName}Properties, DistributiveOmit<${typeName}<'${jsxElement}'>, keyof ${upperName}Properties ${blocklistType}> {}
|
|
2461
2487
|
|
|
2462
2488
|
${description ? `/** ${description} */` : ""}
|
|
2463
2489
|
export declare const ${jsxName}: FunctionalComponent<${upperName}Props>
|
|
@@ -2485,17 +2511,17 @@ ${ctx.file.importType("Assign, JsxStyleProps, JsxHTMLProps", "./system-types")}
|
|
|
2485
2511
|
type IntrinsicElement = keyof NativeElements
|
|
2486
2512
|
type ElementType = IntrinsicElement | Component
|
|
2487
2513
|
|
|
2488
|
-
type ComponentProps<T extends ElementType> = T extends IntrinsicElement
|
|
2514
|
+
export type ComponentProps<T extends ElementType> = T extends IntrinsicElement
|
|
2489
2515
|
? NativeElements[T]
|
|
2490
2516
|
: T extends Component<infer Props>
|
|
2491
2517
|
? Props
|
|
2492
2518
|
: never
|
|
2493
2519
|
|
|
2494
|
-
|
|
2520
|
+
interface ${componentName}<T extends ElementType, P extends Dict = {}> extends FunctionalComponent<
|
|
2495
2521
|
JsxHTMLProps<ComponentProps<T>, Assign<JsxStyleProps, P>>
|
|
2496
|
-
>
|
|
2522
|
+
> {}
|
|
2497
2523
|
|
|
2498
|
-
|
|
2524
|
+
interface RecipeFn = { __type: any }
|
|
2499
2525
|
|
|
2500
2526
|
interface JsxFactory {
|
|
2501
2527
|
${styleProps === "none" ? "" : `<T extends ElementType>(component: T): ${componentName}<T, {}>`}
|
|
@@ -2531,7 +2557,7 @@ import type { Component, FunctionalComponent, NativeElements } from 'vue'
|
|
|
2531
2557
|
type IntrinsicElement = keyof NativeElements
|
|
2532
2558
|
type ElementType = IntrinsicElement | Component
|
|
2533
2559
|
|
|
2534
|
-
type ComponentProps<T extends ElementType> = T extends IntrinsicElement
|
|
2560
|
+
export type ComponentProps<T extends ElementType> = T extends IntrinsicElement
|
|
2535
2561
|
? NativeElements[T]
|
|
2536
2562
|
: T extends Component<infer Props>
|
|
2537
2563
|
? Props
|
|
@@ -2661,27 +2687,27 @@ var csstype_d_ts_default = {
|
|
|
2661
2687
|
|
|
2662
2688
|
// src/artifacts/generated/system-types.d.ts.json
|
|
2663
2689
|
var system_types_d_ts_default = {
|
|
2664
|
-
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
|
|
2690
|
+
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"
|
|
2665
2691
|
};
|
|
2666
2692
|
|
|
2667
2693
|
// src/artifacts/generated/composition.d.ts.json
|
|
2668
2694
|
var composition_d_ts_default = {
|
|
2669
|
-
content: "import type { CompositionStyleObject } from './system-types'\n\
|
|
2695
|
+
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"
|
|
2670
2696
|
};
|
|
2671
2697
|
|
|
2672
2698
|
// src/artifacts/generated/recipe.d.ts.json
|
|
2673
2699
|
var recipe_d_ts_default = {
|
|
2674
|
-
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
|
|
2700
|
+
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"
|
|
2675
2701
|
};
|
|
2676
2702
|
|
|
2677
2703
|
// src/artifacts/generated/pattern.d.ts.json
|
|
2678
2704
|
var pattern_d_ts_default = {
|
|
2679
|
-
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
|
|
2705
|
+
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"
|
|
2680
2706
|
};
|
|
2681
2707
|
|
|
2682
2708
|
// src/artifacts/generated/parts.d.ts.json
|
|
2683
2709
|
var parts_d_ts_default = {
|
|
2684
|
-
content: "export
|
|
2710
|
+
content: "export interface Part {\n selector: string\n}\n\nexport type Parts = Record<string, Part>\n"
|
|
2685
2711
|
};
|
|
2686
2712
|
|
|
2687
2713
|
// src/artifacts/generated/selectors.d.ts.json
|
|
@@ -2712,7 +2738,7 @@ var import_outdent39 = require("outdent");
|
|
|
2712
2738
|
var generateTypesEntry = (ctx) => ({
|
|
2713
2739
|
global: import_outdent39.outdent`
|
|
2714
2740
|
// @ts-nocheck
|
|
2715
|
-
import type
|
|
2741
|
+
import type * as Panda from '@pandacss/dev'
|
|
2716
2742
|
${ctx.file.importType("RecipeVariantRecord, RecipeConfig, SlotRecipeVariantRecord, SlotRecipeConfig", "./recipe")}
|
|
2717
2743
|
${ctx.file.importType("Parts", "./parts")}
|
|
2718
2744
|
${ctx.file.importType("PatternConfig, PatternProperties", "./pattern")}
|
|
@@ -2720,23 +2746,25 @@ var generateTypesEntry = (ctx) => ({
|
|
|
2720
2746
|
${ctx.file.importType("CompositionStyles", "./composition")}
|
|
2721
2747
|
|
|
2722
2748
|
declare module '@pandacss/dev' {
|
|
2723
|
-
export function defineRecipe<V extends RecipeVariantRecord>(config: RecipeConfig<V>): RecipeConfig
|
|
2724
|
-
export function defineSlotRecipe<S extends string, V extends SlotRecipeVariantRecord<S>>(config: SlotRecipeConfig<S, V>): SlotRecipeConfig
|
|
2749
|
+
export function defineRecipe<V extends RecipeVariantRecord>(config: RecipeConfig<V>): Panda.RecipeConfig
|
|
2750
|
+
export function defineSlotRecipe<S extends string, V extends SlotRecipeVariantRecord<S>>(config: SlotRecipeConfig<S, V>): Panda.SlotRecipeConfig
|
|
2725
2751
|
export function defineStyles(definition: SystemStyleObject): SystemStyleObject
|
|
2726
|
-
export function defineGlobalStyles(definition: GlobalStyleObject): GlobalStyleObject
|
|
2727
|
-
export function defineTextStyles(definition: CompositionStyles['textStyles']): TextStyles
|
|
2728
|
-
export function defineLayerStyles(definition: CompositionStyles['layerStyles']): LayerStyles
|
|
2729
|
-
export function definePattern<T extends PatternProperties>(config: PatternConfig<T>): PatternConfig
|
|
2752
|
+
export function defineGlobalStyles(definition: GlobalStyleObject): Panda.GlobalStyleObject
|
|
2753
|
+
export function defineTextStyles(definition: CompositionStyles['textStyles']): Panda.TextStyles
|
|
2754
|
+
export function defineLayerStyles(definition: CompositionStyles['layerStyles']): Panda.LayerStyles
|
|
2755
|
+
export function definePattern<T extends PatternProperties>(config: PatternConfig<T>): Panda.PatternConfig
|
|
2730
2756
|
export function defineParts<T extends Parts>(parts: T): (config: Partial<Record<keyof T, SystemStyleObject>>) => Partial<Record<keyof T, SystemStyleObject>>
|
|
2731
2757
|
}
|
|
2732
2758
|
`,
|
|
2733
2759
|
// 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'`
|
|
2734
2760
|
index: import_outdent39.outdent`
|
|
2735
2761
|
import '${ctx.file.extDts("./global")}'
|
|
2736
|
-
${ctx.file.
|
|
2737
|
-
${ctx.file.
|
|
2738
|
-
${ctx.file.
|
|
2739
|
-
${ctx.file.
|
|
2762
|
+
${ctx.file.exportTypeStar("./conditions")}
|
|
2763
|
+
${ctx.file.exportTypeStar("./pattern")}
|
|
2764
|
+
${ctx.file.exportTypeStar("./recipe")}
|
|
2765
|
+
${ctx.file.exportTypeStar("./system-types")}
|
|
2766
|
+
${ctx.file.exportTypeStar("./jsx")}
|
|
2767
|
+
${ctx.file.exportTypeStar("./style-props")}
|
|
2740
2768
|
|
|
2741
2769
|
`,
|
|
2742
2770
|
helpers: import_outdent39.outdent`
|
|
@@ -2758,7 +2786,7 @@ function generatePropTypes(ctx) {
|
|
|
2758
2786
|
${ctx.file.importType("CssProperties", "./system-types")}
|
|
2759
2787
|
${ctx.file.importType("Tokens", "../tokens/index")}
|
|
2760
2788
|
|
|
2761
|
-
|
|
2789
|
+
interface PropertyValueTypes {`
|
|
2762
2790
|
];
|
|
2763
2791
|
const types = utility.getTypes();
|
|
2764
2792
|
for (const [prop, values] of types.entries()) {
|
|
@@ -2770,7 +2798,7 @@ function generatePropTypes(ctx) {
|
|
|
2770
2798
|
|
|
2771
2799
|
type Shorthand<T> = T extends keyof PropertyValueTypes ? PropertyValueTypes[T]${strictText} : CssValue<T>
|
|
2772
2800
|
|
|
2773
|
-
export
|
|
2801
|
+
export interface PropertyTypes extends PropertyValueTypes {
|
|
2774
2802
|
`);
|
|
2775
2803
|
utility.shorthands.forEach((value, key) => {
|
|
2776
2804
|
result.push(` ${key}: Shorthand<${JSON.stringify(value)}>;`);
|
|
@@ -2801,7 +2829,7 @@ function generateStyleProps(ctx) {
|
|
|
2801
2829
|
[key in \`--\${string}\`]?: ConditionalValue<Token | (string & {}) | (number & {})>
|
|
2802
2830
|
}
|
|
2803
2831
|
|
|
2804
|
-
export
|
|
2832
|
+
export interface SystemProperties {
|
|
2805
2833
|
${Array.from(props).map((v) => ` ${v}?: PropertyValue<'${v}'>`).join("\n")}
|
|
2806
2834
|
}
|
|
2807
2835
|
`;
|