@pandacss/generator 0.29.1 → 0.30.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +136 -265
- package/dist/index.mjs +131 -260
- package/package.json +7 -7
package/dist/index.js
CHANGED
|
@@ -35,7 +35,7 @@ __export(src_exports, {
|
|
|
35
35
|
module.exports = __toCommonJS(src_exports);
|
|
36
36
|
|
|
37
37
|
// src/generator.ts
|
|
38
|
-
var
|
|
38
|
+
var import_core5 = require("@pandacss/core");
|
|
39
39
|
var import_ts_pattern12 = require("ts-pattern");
|
|
40
40
|
|
|
41
41
|
// src/artifacts/setup-artifacts.ts
|
|
@@ -219,6 +219,7 @@ function generateCssFn(ctx) {
|
|
|
219
219
|
return { className: \`\${propKey}${separator}\${withoutSpace(value)}\` }
|
|
220
220
|
}` : `(key, value) => ({ className: \`\${classNameByProp.get(key) || hypenateProperty(key)}${separator}\${withoutSpace(value)}\` })`},
|
|
221
221
|
${utility.hasShorthand ? "hasShorthand: true," : ""}
|
|
222
|
+
toHash: ${utility.toHash},
|
|
222
223
|
resolveShorthand: ${utility.hasShorthand ? "resolveShorthand" : "prop => prop"},
|
|
223
224
|
}
|
|
224
225
|
}
|
|
@@ -261,6 +262,7 @@ function generateStringLiteralCssFn(ctx) {
|
|
|
261
262
|
prefix: ${prefix.className ? JSON.stringify(prefix.className) : void 0},
|
|
262
263
|
transform,
|
|
263
264
|
hasShorthand: false,
|
|
265
|
+
toHash: ${utility.toHash},
|
|
264
266
|
resolveShorthand(prop) {
|
|
265
267
|
return prop
|
|
266
268
|
},
|
|
@@ -418,7 +420,7 @@ var astish_mjs_default = {
|
|
|
418
420
|
|
|
419
421
|
// src/artifacts/generated/helpers.mjs.json
|
|
420
422
|
var helpers_mjs_default = {
|
|
421
|
-
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/
|
|
423
|
+
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/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/important.ts\nvar importantRegex = /\\s*!(important)?/i;\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/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/merge-props.ts\nfunction mergeProps(...sources) {\n const objects = sources.filter(Boolean);\n return objects.reduce((prev, obj) => {\n Object.keys(obj).forEach((key) => {\n const prevValue = prev[key];\n const value = obj[key];\n if (isObject(prevValue) && isObject(value)) {\n prev[key] = mergeProps(prevValue, value);\n } else {\n prev[key] = value;\n }\n });\n return prev;\n }, {});\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, child) ?? 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 (Array.isArray(obj))\n return obj.map((value) => fn(value));\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 normalizeStyleObject(styles, context, shorthand = true) {\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: shorthand ? (prop) => hasShorthand ? resolveShorthand(prop) : prop : void 0\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(utility.toHash(baseArray, toHash));\n } else {\n const baseArray = [...conds.finalize(conditions), formatClassName(className)];\n result = baseArray.join(":");\n }\n return result;\n };\n return memo((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) => normalizeStyleObject(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: memo(mergeCss), assignCss };\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/is-css-function.ts\nvar fns = ["min", "max", "clamp", "calc"];\nvar fnRegExp = new RegExp(`^(${fns.join("|")})\\\\(.*\\\\)`);\nvar isCssFunction = (v) => typeof v === "string" && fnRegExp.test(v);\n\n// src/is-css-unit.ts\nvar lengthUnits = "cm,mm,Q,in,pc,pt,px,em,ex,ch,rem,lh,rlh,vw,vh,vmin,vmax,vb,vi,svw,svh,lvw,lvh,dvw,dvh,cqw,cqh,cqi,cqb,cqmin,cqmax,%";\nvar lengthUnitsPattern = `(?:${lengthUnits.split(",").join("|")})`;\nvar lengthRegExp = new RegExp(`^[+-]?[0-9]*.?[0-9]+(?:[eE][+-]?[0-9]+)?${lengthUnitsPattern}$`);\nvar isCssUnit = (v) => typeof v === "string" && lengthRegExp.test(v);\n\n// src/is-css-var.ts\nvar isCssVar = (v) => typeof v === "string" && /^var\\(--.+\\)$/.test(v);\n\n// src/pattern-fns.ts\nvar patternFns = {\n map: mapObject,\n isCssFunction,\n isCssVar,\n isCssUnit\n};\nvar getPatternStyles = (pattern, styles) => {\n if (!pattern.defaultValues)\n return styles;\n const defaults = typeof pattern.defaultValues === "function" ? pattern.defaultValues(styles) : pattern.defaultValues;\n return Object.assign({}, defaults, compact(styles));\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}\n\n// src/uniq.ts\nvar uniq = (...items) => items.filter(Boolean).reduce((acc, item) => Array.from(/* @__PURE__ */ new Set([...acc, ...item])), []);\nexport {\n compact,\n createCss,\n createMergeCss,\n filterBaseConditions,\n getPatternStyles,\n getSlotCompoundVariant,\n getSlotRecipes,\n hypenateProperty,\n isBaseCondition,\n isObject,\n mapObject,\n memo,\n mergeProps,\n patternFns,\n splitProps,\n toHash,\n uniq,\n walkObject,\n withoutSpace\n};\n'
|
|
422
424
|
};
|
|
423
425
|
|
|
424
426
|
// src/artifacts/generated/normalize-html.mjs.json
|
|
@@ -623,13 +625,7 @@ var import_ts_pattern4 = require("ts-pattern");
|
|
|
623
625
|
var stringify2 = (value) => JSON.stringify(value, null, 2);
|
|
624
626
|
var isBooleanValue = (value) => value === "true" || value === "false";
|
|
625
627
|
function generateCreateRecipe(ctx) {
|
|
626
|
-
const {
|
|
627
|
-
conditions,
|
|
628
|
-
recipes,
|
|
629
|
-
prefix,
|
|
630
|
-
hash,
|
|
631
|
-
utility: { separator }
|
|
632
|
-
} = ctx;
|
|
628
|
+
const { conditions, recipes, prefix, hash, utility } = ctx;
|
|
633
629
|
if (recipes.isEmpty())
|
|
634
630
|
return;
|
|
635
631
|
return {
|
|
@@ -660,7 +656,7 @@ function generateCreateRecipe(ctx) {
|
|
|
660
656
|
}
|
|
661
657
|
|
|
662
658
|
value = withoutSpace(value)
|
|
663
|
-
return { className: \`\${name}--\${prop}${separator}\${value}\` }
|
|
659
|
+
return { className: \`\${name}--\${prop}${utility.separator}\${value}\` }
|
|
664
660
|
}
|
|
665
661
|
|
|
666
662
|
const recipeCss = createCss({
|
|
@@ -672,6 +668,7 @@ function generateCreateRecipe(ctx) {
|
|
|
672
668
|
},
|
|
673
669
|
utility: {
|
|
674
670
|
${prefix.className ? "prefix: " + JSON.stringify(prefix.className) + "," : ""}
|
|
671
|
+
toHash: ${utility.toHash},
|
|
675
672
|
transform,
|
|
676
673
|
}
|
|
677
674
|
})
|
|
@@ -3026,16 +3023,16 @@ function generateTokenTypes(ctx) {
|
|
|
3026
3023
|
config: { theme }
|
|
3027
3024
|
} = ctx;
|
|
3028
3025
|
const set = /* @__PURE__ */ new Set();
|
|
3029
|
-
set.add(`export type Token = ${tokens.isEmpty ? "string" : (0, import_shared3.unionType)(tokens.
|
|
3026
|
+
set.add(`export type Token = ${tokens.isEmpty ? "string" : (0, import_shared3.unionType)(Array.from(tokens.byName.keys()))}`);
|
|
3030
3027
|
const result = /* @__PURE__ */ new Set(["export type Tokens = {"]);
|
|
3031
3028
|
if (tokens.isEmpty) {
|
|
3032
3029
|
result.add("[token: string]: string");
|
|
3033
3030
|
} else {
|
|
3034
|
-
const colorPaletteKeys =
|
|
3031
|
+
const colorPaletteKeys = Array.from(tokens.view.colorPalettes.keys());
|
|
3035
3032
|
if (colorPaletteKeys.length) {
|
|
3036
|
-
set.add(`export type ColorPalette = ${(0, import_shared3.unionType)(
|
|
3033
|
+
set.add(`export type ColorPalette = ${(0, import_shared3.unionType)(colorPaletteKeys)}`);
|
|
3037
3034
|
}
|
|
3038
|
-
for (const [key, value] of tokens.categoryMap.entries()) {
|
|
3035
|
+
for (const [key, value] of tokens.view.categoryMap.entries()) {
|
|
3039
3036
|
const typeName = (0, import_shared3.capitalize)(import_pluralize.default.singular(key));
|
|
3040
3037
|
set.add(`export type ${typeName}Token = ${(0, import_shared3.unionType)(value.keys())}`);
|
|
3041
3038
|
result.add(` ${key}: ${typeName}Token`);
|
|
@@ -3446,8 +3443,8 @@ var entries = [
|
|
|
3446
3443
|
var getMatchingArtifacts = (ctx, filters) => {
|
|
3447
3444
|
const ids = filters?.ids;
|
|
3448
3445
|
if (!ids)
|
|
3449
|
-
return entries.map(([_artifactId, fn]) => fn(ctx));
|
|
3450
|
-
return entries.filter(([artifactId]) => ids.includes(artifactId)).map(([_artifactId, fn]) => fn(ctx, filters));
|
|
3446
|
+
return entries.map(([_artifactId, fn]) => fn(ctx)).filter(Boolean);
|
|
3447
|
+
return entries.filter(([artifactId]) => ids.includes(artifactId)).map(([_artifactId, fn]) => fn(ctx, filters)).filter(Boolean);
|
|
3451
3448
|
};
|
|
3452
3449
|
var transformArtifact = (ctx, artifact) => {
|
|
3453
3450
|
const files = (artifact?.files ?? []).filter((item) => !!item?.code).map((item) => {
|
|
@@ -3469,7 +3466,7 @@ var setupArtifacts = (ctx, ids) => {
|
|
|
3469
3466
|
// src/artifacts/index.ts
|
|
3470
3467
|
var generateArtifacts = (ctx, ids) => {
|
|
3471
3468
|
if (ctx.config.emitTokensOnly) {
|
|
3472
|
-
return [setupDesignTokens(ctx)];
|
|
3469
|
+
return [setupDesignTokens(ctx)].filter(Boolean);
|
|
3473
3470
|
}
|
|
3474
3471
|
return setupArtifacts(ctx, ids);
|
|
3475
3472
|
};
|
|
@@ -3523,11 +3520,11 @@ function generateKeyframeCss(ctx, sheet) {
|
|
|
3523
3520
|
for (const [name, definition] of Object.entries(keyframes)) {
|
|
3524
3521
|
result[`@keyframes ${name}`] = definition;
|
|
3525
3522
|
}
|
|
3526
|
-
let
|
|
3523
|
+
let css = (0, import_core2.stringify)(sheet.serialize(result));
|
|
3527
3524
|
if (ctx.hooks["cssgen:done"]) {
|
|
3528
|
-
|
|
3525
|
+
css = ctx.hooks["cssgen:done"]({ artifact: "keyframes", content: css }) ?? css;
|
|
3529
3526
|
}
|
|
3530
|
-
sheet.layers.tokens.append(
|
|
3527
|
+
sheet.layers.tokens.append(css);
|
|
3531
3528
|
}
|
|
3532
3529
|
|
|
3533
3530
|
// src/artifacts/css/parser-css.ts
|
|
@@ -3539,8 +3536,8 @@ var generateParserCss = (ctx, decoder) => {
|
|
|
3539
3536
|
const { minify, optimize } = ctx.config;
|
|
3540
3537
|
sheet.processDecoder(decoder);
|
|
3541
3538
|
try {
|
|
3542
|
-
const
|
|
3543
|
-
return
|
|
3539
|
+
const css = sheet.toCss({ minify, optimize });
|
|
3540
|
+
return css;
|
|
3544
3541
|
} catch (err) {
|
|
3545
3542
|
import_logger.logger.error("serializer:css", "Failed to serialize CSS: " + err);
|
|
3546
3543
|
return "";
|
|
@@ -3548,234 +3545,108 @@ var generateParserCss = (ctx, decoder) => {
|
|
|
3548
3545
|
};
|
|
3549
3546
|
|
|
3550
3547
|
// src/artifacts/css/reset-css.ts
|
|
3548
|
+
var import_core3 = require("@pandacss/core");
|
|
3551
3549
|
var import_shared4 = require("@pandacss/shared");
|
|
3552
|
-
var css = String.raw;
|
|
3553
3550
|
function generateResetCss(ctx, sheet) {
|
|
3554
3551
|
const { preflight } = ctx.config;
|
|
3555
3552
|
const scope = (0, import_shared4.isObject)(preflight) ? preflight.scope : void 0;
|
|
3556
3553
|
const selector = scope ? `${scope} ` : "";
|
|
3557
|
-
|
|
3558
|
-
|
|
3559
|
-
|
|
3560
|
-
|
|
3561
|
-
|
|
3562
|
-
|
|
3563
|
-
|
|
3564
|
-
|
|
3565
|
-
|
|
3566
|
-
|
|
3567
|
-
|
|
3568
|
-
|
|
3569
|
-
|
|
3570
|
-
|
|
3571
|
-
|
|
3572
|
-
|
|
3573
|
-
|
|
3574
|
-
|
|
3575
|
-
|
|
3576
|
-
|
|
3577
|
-
|
|
3578
|
-
|
|
3579
|
-
|
|
3580
|
-
|
|
3581
|
-
|
|
3582
|
-
|
|
3583
|
-
|
|
3584
|
-
|
|
3585
|
-
|
|
3586
|
-
|
|
3587
|
-
|
|
3588
|
-
|
|
3589
|
-
|
|
3590
|
-
|
|
3591
|
-
|
|
3592
|
-
|
|
3593
|
-
|
|
3594
|
-
|
|
3595
|
-
|
|
3596
|
-
|
|
3597
|
-
|
|
3598
|
-
|
|
3599
|
-
|
|
3600
|
-
|
|
3601
|
-
|
|
3602
|
-
|
|
3603
|
-
|
|
3604
|
-
|
|
3605
|
-
|
|
3606
|
-
|
|
3607
|
-
|
|
3608
|
-
|
|
3609
|
-
|
|
3610
|
-
|
|
3611
|
-
|
|
3612
|
-
|
|
3613
|
-
|
|
3614
|
-
|
|
3615
|
-
|
|
3616
|
-
|
|
3617
|
-
|
|
3618
|
-
|
|
3619
|
-
|
|
3620
|
-
|
|
3621
|
-
|
|
3622
|
-
|
|
3623
|
-
|
|
3624
|
-
|
|
3625
|
-
|
|
3626
|
-
|
|
3627
|
-
|
|
3628
|
-
|
|
3629
|
-
|
|
3630
|
-
|
|
3631
|
-
|
|
3632
|
-
|
|
3633
|
-
|
|
3634
|
-
|
|
3635
|
-
|
|
3636
|
-
|
|
3637
|
-
|
|
3638
|
-
|
|
3639
|
-
|
|
3640
|
-
|
|
3641
|
-
|
|
3642
|
-
|
|
3643
|
-
|
|
3644
|
-
|
|
3645
|
-
|
|
3646
|
-
|
|
3647
|
-
|
|
3648
|
-
|
|
3649
|
-
|
|
3650
|
-
|
|
3651
|
-
${selector}input,
|
|
3652
|
-
${selector}optgroup,
|
|
3653
|
-
${selector}select,
|
|
3654
|
-
${selector}textarea {
|
|
3655
|
-
color: inherit;
|
|
3656
|
-
}
|
|
3657
|
-
|
|
3658
|
-
${selector}button,
|
|
3659
|
-
${selector}select {
|
|
3660
|
-
text-transform: none;
|
|
3661
|
-
}
|
|
3662
|
-
|
|
3663
|
-
${selector}table {
|
|
3664
|
-
text-indent: 0;
|
|
3665
|
-
border-color: inherit;
|
|
3666
|
-
border-collapse: collapse;
|
|
3667
|
-
}
|
|
3668
|
-
|
|
3669
|
-
${selector}input::placeholder,
|
|
3670
|
-
${selector}textarea::placeholder {
|
|
3671
|
-
opacity: 1;
|
|
3672
|
-
color: var(--global-color-placeholder, #9ca3af);
|
|
3673
|
-
}
|
|
3674
|
-
|
|
3675
|
-
${selector}textarea {
|
|
3676
|
-
resize: vertical;
|
|
3677
|
-
}
|
|
3678
|
-
|
|
3679
|
-
${selector}summary {
|
|
3680
|
-
display: list-item;
|
|
3681
|
-
}
|
|
3682
|
-
|
|
3683
|
-
${selector}small {
|
|
3684
|
-
font-size: 80%;
|
|
3685
|
-
}
|
|
3686
|
-
|
|
3687
|
-
${selector}sub,
|
|
3688
|
-
${selector}sup {
|
|
3689
|
-
font-size: 75%;
|
|
3690
|
-
line-height: 0;
|
|
3691
|
-
position: relative;
|
|
3692
|
-
vertical-align: baseline;
|
|
3693
|
-
}
|
|
3694
|
-
|
|
3695
|
-
${selector}sub {
|
|
3696
|
-
bottom: -0.25em;
|
|
3697
|
-
}
|
|
3698
|
-
|
|
3699
|
-
${selector}sup {
|
|
3700
|
-
top: -0.5em;
|
|
3701
|
-
}
|
|
3702
|
-
|
|
3703
|
-
${selector}dialog {
|
|
3704
|
-
padding: 0;
|
|
3705
|
-
}
|
|
3706
|
-
|
|
3707
|
-
${selector}a {
|
|
3708
|
-
color: inherit;
|
|
3709
|
-
text-decoration: inherit;
|
|
3710
|
-
}
|
|
3711
|
-
|
|
3712
|
-
${selector}abbr:where([title]) {
|
|
3713
|
-
text-decoration: underline dotted;
|
|
3714
|
-
}
|
|
3715
|
-
|
|
3716
|
-
${selector}b,
|
|
3717
|
-
${selector}strong {
|
|
3718
|
-
font-weight: bolder;
|
|
3719
|
-
}
|
|
3720
|
-
|
|
3721
|
-
${selector}code,
|
|
3722
|
-
${selector}kbd,
|
|
3723
|
-
${selector}samp,
|
|
3724
|
-
${selector}pre {
|
|
3725
|
-
font-size: 1em;
|
|
3726
|
-
--font-mono-fallback: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New';
|
|
3727
|
-
font-family: var(--global-font-mono, var(--font-mono-fallback));
|
|
3728
|
-
}
|
|
3729
|
-
|
|
3730
|
-
|
|
3731
|
-
${selector}input[type="text"],
|
|
3732
|
-
${selector}input[type="email"],
|
|
3733
|
-
${selector}input[type="search"],
|
|
3734
|
-
${selector}input[type="password"] {
|
|
3735
|
-
-webkit-appearance: none;
|
|
3736
|
-
-moz-appearance: none;
|
|
3737
|
-
}
|
|
3738
|
-
|
|
3739
|
-
${selector}input[type='search'] {
|
|
3740
|
-
-webkit-appearance: textfield;
|
|
3741
|
-
outline-offset: -2px;
|
|
3742
|
-
}
|
|
3743
|
-
|
|
3744
|
-
${selector}::-webkit-search-decoration,
|
|
3745
|
-
${selector}::-webkit-search-cancel-button {
|
|
3746
|
-
-webkit-appearance: none;
|
|
3747
|
-
}
|
|
3748
|
-
|
|
3749
|
-
${selector}::-webkit-file-upload-button {
|
|
3750
|
-
-webkit-appearance: button;
|
|
3751
|
-
font: inherit;
|
|
3752
|
-
}
|
|
3753
|
-
|
|
3754
|
-
${selector}input[type="number"]::-webkit-inner-spin-button,
|
|
3755
|
-
${selector}input[type="number"]::-webkit-outer-spin-button {
|
|
3756
|
-
height: auto;
|
|
3757
|
-
}
|
|
3758
|
-
|
|
3759
|
-
${selector}input[type='number']{
|
|
3760
|
-
-moz-appearance: textfield;
|
|
3761
|
-
}
|
|
3762
|
-
|
|
3763
|
-
${selector}:-moz-ui-invalid {
|
|
3764
|
-
box-shadow: none;
|
|
3765
|
-
}
|
|
3766
|
-
|
|
3767
|
-
${selector}:-moz-focusring {
|
|
3768
|
-
outline: auto;
|
|
3769
|
-
}
|
|
3770
|
-
|
|
3771
|
-
${selector}[hidden] {
|
|
3772
|
-
display: none !important;
|
|
3773
|
-
}
|
|
3774
|
-
`;
|
|
3775
|
-
if (ctx.hooks["cssgen:done"]) {
|
|
3776
|
-
output = ctx.hooks["cssgen:done"]({ artifact: "reset", content: output }) ?? output;
|
|
3554
|
+
const scoped = {
|
|
3555
|
+
"*": { margin: "0px", padding: "0px", font: "inherit" },
|
|
3556
|
+
"*, *::before, *::after": {
|
|
3557
|
+
boxSizing: "border-box",
|
|
3558
|
+
borderWidth: "0px",
|
|
3559
|
+
borderStyle: "solid",
|
|
3560
|
+
borderColor: "var(--global-color-border, currentColor)"
|
|
3561
|
+
},
|
|
3562
|
+
hr: { height: "0px", color: "inherit", borderTopWidth: "1px" },
|
|
3563
|
+
body: { height: "100%", lineHeight: "inherit" },
|
|
3564
|
+
img: { borderStyle: "none" },
|
|
3565
|
+
"img, svg, video, canvas, audio, iframe, embed, object": {
|
|
3566
|
+
display: "block",
|
|
3567
|
+
verticalAlign: "middle"
|
|
3568
|
+
},
|
|
3569
|
+
"img, video": { maxWidth: "100%", height: "auto" },
|
|
3570
|
+
"p, h1, h2, h3, h4, h5, h6": { overflowWrap: "break-word" },
|
|
3571
|
+
"ol, ul": { listStyle: "none" },
|
|
3572
|
+
"code, kbd, pre, samp": { fontSize: "1em" },
|
|
3573
|
+
"button, [type='button'], [type='reset'], [type='submit']": {
|
|
3574
|
+
WebkitAppearance: "button",
|
|
3575
|
+
backgroundColor: "transparent",
|
|
3576
|
+
backgroundImage: "none"
|
|
3577
|
+
},
|
|
3578
|
+
"button, input, optgroup, select, textarea": { color: "inherit" },
|
|
3579
|
+
"button, select": { textTransform: "none" },
|
|
3580
|
+
table: {
|
|
3581
|
+
textIndent: "0px",
|
|
3582
|
+
borderColor: "inherit",
|
|
3583
|
+
borderCollapse: "collapse"
|
|
3584
|
+
},
|
|
3585
|
+
"input::placeholder, textarea::placeholder": {
|
|
3586
|
+
opacity: 1,
|
|
3587
|
+
color: "var(--global-color-placeholder, #9ca3af)"
|
|
3588
|
+
},
|
|
3589
|
+
textarea: { resize: "vertical" },
|
|
3590
|
+
summary: { display: "list-item" },
|
|
3591
|
+
small: { fontSize: "80%" },
|
|
3592
|
+
"sub, sup": {
|
|
3593
|
+
fontSize: "75%",
|
|
3594
|
+
lineHeight: 0,
|
|
3595
|
+
position: "relative",
|
|
3596
|
+
verticalAlign: "baseline"
|
|
3597
|
+
},
|
|
3598
|
+
sub: { bottom: "-0.25em" },
|
|
3599
|
+
sup: { top: "-0.5em" },
|
|
3600
|
+
dialog: { padding: "0px" },
|
|
3601
|
+
a: { color: "inherit", textDecoration: "inherit" },
|
|
3602
|
+
"abbr:where([title])": { textDecoration: "underline dotted" },
|
|
3603
|
+
"b, strong": { fontWeight: "bolder" },
|
|
3604
|
+
"code, kbd, samp, pre": {
|
|
3605
|
+
fontSize: "1em",
|
|
3606
|
+
"--font-mono-fallback": "ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New'",
|
|
3607
|
+
fontFamily: "var(--global-font-mono, var(--font-mono-fallback))"
|
|
3608
|
+
},
|
|
3609
|
+
'input[type="text"], input[type="email"], input[type="search"], input[type="password"]': {
|
|
3610
|
+
WebkitAppearance: "none",
|
|
3611
|
+
MozAppearance: "none"
|
|
3612
|
+
},
|
|
3613
|
+
"input[type='search']": {
|
|
3614
|
+
WebkitAppearance: "textfield",
|
|
3615
|
+
outlineOffset: "-2px"
|
|
3616
|
+
},
|
|
3617
|
+
"::-webkit-search-decoration, ::-webkit-search-cancel-button": {
|
|
3618
|
+
WebkitAppearance: "none"
|
|
3619
|
+
},
|
|
3620
|
+
"::-webkit-file-upload-button": {
|
|
3621
|
+
WebkitAppearance: "button",
|
|
3622
|
+
font: "inherit"
|
|
3623
|
+
},
|
|
3624
|
+
'input[type="number"]::-webkit-inner-spin-button, input[type="number"]::-webkit-outer-spin-button': {
|
|
3625
|
+
height: "auto"
|
|
3626
|
+
},
|
|
3627
|
+
"input[type='number']": { MozAppearance: "textfield" },
|
|
3628
|
+
":-moz-ui-invalid": { boxShadow: "none" },
|
|
3629
|
+
":-moz-focusring": { outline: "auto" },
|
|
3630
|
+
"[hidden]": { display: "none !important" }
|
|
3631
|
+
};
|
|
3632
|
+
const reset = {
|
|
3633
|
+
[scope || "html"]: {
|
|
3634
|
+
lineHeight: 1.5,
|
|
3635
|
+
"--font-fallback": "ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'",
|
|
3636
|
+
WebkitTextSizeAdjust: "100%",
|
|
3637
|
+
WebkitFontSmoothing: "antialiased",
|
|
3638
|
+
MozOsxFontSmoothing: "grayscale",
|
|
3639
|
+
MozTabSize: "[4]",
|
|
3640
|
+
tabSize: "[4]",
|
|
3641
|
+
fontFamily: "var(--global-font-body, var(--font-fallback))"
|
|
3642
|
+
}
|
|
3643
|
+
};
|
|
3644
|
+
if (selector) {
|
|
3645
|
+
reset[selector] = scoped;
|
|
3646
|
+
} else {
|
|
3647
|
+
Object.assign(reset, scoped);
|
|
3777
3648
|
}
|
|
3778
|
-
sheet.
|
|
3649
|
+
sheet.processResetCss(reset);
|
|
3779
3650
|
}
|
|
3780
3651
|
|
|
3781
3652
|
// src/artifacts/css/static-css.ts
|
|
@@ -3784,16 +3655,16 @@ var generateStaticCss = (ctx, sheet) => {
|
|
|
3784
3655
|
const engine = staticCss.process(ctx.config.staticCss ?? {}, sheet);
|
|
3785
3656
|
if (!sheet) {
|
|
3786
3657
|
const { optimize = true, minify } = config;
|
|
3787
|
-
let
|
|
3658
|
+
let css = engine.sheet.toCss({ optimize, minify });
|
|
3788
3659
|
if (ctx.hooks["cssgen:done"]) {
|
|
3789
|
-
|
|
3660
|
+
css = ctx.hooks["cssgen:done"]({ artifact: "static", content: css }) ?? css;
|
|
3790
3661
|
}
|
|
3791
|
-
return
|
|
3662
|
+
return css;
|
|
3792
3663
|
}
|
|
3793
3664
|
};
|
|
3794
3665
|
|
|
3795
3666
|
// src/artifacts/css/token-css.ts
|
|
3796
|
-
var
|
|
3667
|
+
var import_core4 = require("@pandacss/core");
|
|
3797
3668
|
var import_postcss = __toESM(require("postcss"));
|
|
3798
3669
|
function generateTokenCss(ctx, sheet) {
|
|
3799
3670
|
const {
|
|
@@ -3803,33 +3674,33 @@ function generateTokenCss(ctx, sheet) {
|
|
|
3803
3674
|
} = ctx;
|
|
3804
3675
|
const root = cssVarRoot;
|
|
3805
3676
|
const results = [];
|
|
3806
|
-
for (const [key, values] of tokens.vars.entries()) {
|
|
3677
|
+
for (const [key, values] of tokens.view.vars.entries()) {
|
|
3807
3678
|
const varsObj = Object.fromEntries(values);
|
|
3808
3679
|
if (Object.keys(varsObj).length === 0)
|
|
3809
3680
|
continue;
|
|
3810
3681
|
if (key === "base") {
|
|
3811
|
-
const
|
|
3812
|
-
results.push(
|
|
3682
|
+
const css2 = (0, import_core4.stringify)({ [root]: varsObj });
|
|
3683
|
+
results.push(css2);
|
|
3813
3684
|
} else {
|
|
3814
3685
|
const keys = key.split(":");
|
|
3815
|
-
const
|
|
3686
|
+
const css2 = (0, import_core4.stringify)(varsObj);
|
|
3816
3687
|
const mapped = keys.map((key2) => conditions.get(key2)).filter(Boolean).map((condition) => {
|
|
3817
|
-
const parent = (0,
|
|
3688
|
+
const parent = (0, import_core4.extractParentSelectors)(condition);
|
|
3818
3689
|
return parent ? `&${parent}` : condition;
|
|
3819
3690
|
});
|
|
3820
3691
|
const rule = getDeepestRule(root, mapped);
|
|
3821
3692
|
if (!rule)
|
|
3822
3693
|
continue;
|
|
3823
|
-
getDeepestNode(rule)?.append(
|
|
3824
|
-
results.push((0,
|
|
3694
|
+
getDeepestNode(rule)?.append(css2);
|
|
3695
|
+
results.push((0, import_core4.expandNestedCss)(rule.toString()));
|
|
3825
3696
|
}
|
|
3826
3697
|
}
|
|
3827
|
-
let
|
|
3828
|
-
|
|
3698
|
+
let css = results.join("\n\n");
|
|
3699
|
+
css = "\n\n" + cleanupSelectors(css, root);
|
|
3829
3700
|
if (ctx.hooks["cssgen:done"]) {
|
|
3830
|
-
|
|
3701
|
+
css = ctx.hooks["cssgen:done"]({ artifact: "tokens", content: css }) ?? css;
|
|
3831
3702
|
}
|
|
3832
|
-
sheet.layers.tokens.append(
|
|
3703
|
+
sheet.layers.tokens.append(css);
|
|
3833
3704
|
}
|
|
3834
3705
|
function getDeepestRule(root, selectors) {
|
|
3835
3706
|
const rule = import_postcss.default.rule({ selector: "" });
|
|
@@ -3851,8 +3722,8 @@ function getDeepestNode(node) {
|
|
|
3851
3722
|
}
|
|
3852
3723
|
return node;
|
|
3853
3724
|
}
|
|
3854
|
-
function cleanupSelectors(
|
|
3855
|
-
const root = import_postcss.default.parse(
|
|
3725
|
+
function cleanupSelectors(css, varSelector) {
|
|
3726
|
+
const root = import_postcss.default.parse(css);
|
|
3856
3727
|
root.walkRules((rule) => {
|
|
3857
3728
|
const selectors = [];
|
|
3858
3729
|
rule.selectors.forEach((selector) => {
|
|
@@ -3878,7 +3749,7 @@ function cleanupSelectors(css2, varSelector) {
|
|
|
3878
3749
|
}
|
|
3879
3750
|
|
|
3880
3751
|
// src/generator.ts
|
|
3881
|
-
var Generator = class extends
|
|
3752
|
+
var Generator = class extends import_core5.Context {
|
|
3882
3753
|
constructor(conf) {
|
|
3883
3754
|
super(conf);
|
|
3884
3755
|
}
|
|
@@ -3912,14 +3783,14 @@ var Generator = class extends import_core4.Context {
|
|
|
3912
3783
|
};
|
|
3913
3784
|
getCss = (stylesheet) => {
|
|
3914
3785
|
const sheet = stylesheet ?? this.createSheet();
|
|
3915
|
-
let
|
|
3786
|
+
let css = sheet.toCss({
|
|
3916
3787
|
optimize: true,
|
|
3917
3788
|
minify: this.config.minify
|
|
3918
3789
|
});
|
|
3919
3790
|
if (this.hooks["cssgen:done"]) {
|
|
3920
|
-
|
|
3791
|
+
css = this.hooks["cssgen:done"]({ artifact: "styles.css", content: css }) ?? css;
|
|
3921
3792
|
}
|
|
3922
|
-
return
|
|
3793
|
+
return css;
|
|
3923
3794
|
};
|
|
3924
3795
|
};
|
|
3925
3796
|
// Annotate the CommonJS export names for ESM import in node:
|
package/dist/index.mjs
CHANGED
|
@@ -183,6 +183,7 @@ function generateCssFn(ctx) {
|
|
|
183
183
|
return { className: \`\${propKey}${separator}\${withoutSpace(value)}\` }
|
|
184
184
|
}` : `(key, value) => ({ className: \`\${classNameByProp.get(key) || hypenateProperty(key)}${separator}\${withoutSpace(value)}\` })`},
|
|
185
185
|
${utility.hasShorthand ? "hasShorthand: true," : ""}
|
|
186
|
+
toHash: ${utility.toHash},
|
|
186
187
|
resolveShorthand: ${utility.hasShorthand ? "resolveShorthand" : "prop => prop"},
|
|
187
188
|
}
|
|
188
189
|
}
|
|
@@ -225,6 +226,7 @@ function generateStringLiteralCssFn(ctx) {
|
|
|
225
226
|
prefix: ${prefix.className ? JSON.stringify(prefix.className) : void 0},
|
|
226
227
|
transform,
|
|
227
228
|
hasShorthand: false,
|
|
229
|
+
toHash: ${utility.toHash},
|
|
228
230
|
resolveShorthand(prop) {
|
|
229
231
|
return prop
|
|
230
232
|
},
|
|
@@ -382,7 +384,7 @@ var astish_mjs_default = {
|
|
|
382
384
|
|
|
383
385
|
// src/artifacts/generated/helpers.mjs.json
|
|
384
386
|
var helpers_mjs_default = {
|
|
385
|
-
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/
|
|
387
|
+
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/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/important.ts\nvar importantRegex = /\\s*!(important)?/i;\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/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/merge-props.ts\nfunction mergeProps(...sources) {\n const objects = sources.filter(Boolean);\n return objects.reduce((prev, obj) => {\n Object.keys(obj).forEach((key) => {\n const prevValue = prev[key];\n const value = obj[key];\n if (isObject(prevValue) && isObject(value)) {\n prev[key] = mergeProps(prevValue, value);\n } else {\n prev[key] = value;\n }\n });\n return prev;\n }, {});\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, child) ?? 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 (Array.isArray(obj))\n return obj.map((value) => fn(value));\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 normalizeStyleObject(styles, context, shorthand = true) {\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: shorthand ? (prop) => hasShorthand ? resolveShorthand(prop) : prop : void 0\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(utility.toHash(baseArray, toHash));\n } else {\n const baseArray = [...conds.finalize(conditions), formatClassName(className)];\n result = baseArray.join(":");\n }\n return result;\n };\n return memo((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) => normalizeStyleObject(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: memo(mergeCss), assignCss };\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/is-css-function.ts\nvar fns = ["min", "max", "clamp", "calc"];\nvar fnRegExp = new RegExp(`^(${fns.join("|")})\\\\(.*\\\\)`);\nvar isCssFunction = (v) => typeof v === "string" && fnRegExp.test(v);\n\n// src/is-css-unit.ts\nvar lengthUnits = "cm,mm,Q,in,pc,pt,px,em,ex,ch,rem,lh,rlh,vw,vh,vmin,vmax,vb,vi,svw,svh,lvw,lvh,dvw,dvh,cqw,cqh,cqi,cqb,cqmin,cqmax,%";\nvar lengthUnitsPattern = `(?:${lengthUnits.split(",").join("|")})`;\nvar lengthRegExp = new RegExp(`^[+-]?[0-9]*.?[0-9]+(?:[eE][+-]?[0-9]+)?${lengthUnitsPattern}$`);\nvar isCssUnit = (v) => typeof v === "string" && lengthRegExp.test(v);\n\n// src/is-css-var.ts\nvar isCssVar = (v) => typeof v === "string" && /^var\\(--.+\\)$/.test(v);\n\n// src/pattern-fns.ts\nvar patternFns = {\n map: mapObject,\n isCssFunction,\n isCssVar,\n isCssUnit\n};\nvar getPatternStyles = (pattern, styles) => {\n if (!pattern.defaultValues)\n return styles;\n const defaults = typeof pattern.defaultValues === "function" ? pattern.defaultValues(styles) : pattern.defaultValues;\n return Object.assign({}, defaults, compact(styles));\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}\n\n// src/uniq.ts\nvar uniq = (...items) => items.filter(Boolean).reduce((acc, item) => Array.from(/* @__PURE__ */ new Set([...acc, ...item])), []);\nexport {\n compact,\n createCss,\n createMergeCss,\n filterBaseConditions,\n getPatternStyles,\n getSlotCompoundVariant,\n getSlotRecipes,\n hypenateProperty,\n isBaseCondition,\n isObject,\n mapObject,\n memo,\n mergeProps,\n patternFns,\n splitProps,\n toHash,\n uniq,\n walkObject,\n withoutSpace\n};\n'
|
|
386
388
|
};
|
|
387
389
|
|
|
388
390
|
// src/artifacts/generated/normalize-html.mjs.json
|
|
@@ -587,13 +589,7 @@ import { match as match4 } from "ts-pattern";
|
|
|
587
589
|
var stringify2 = (value) => JSON.stringify(value, null, 2);
|
|
588
590
|
var isBooleanValue = (value) => value === "true" || value === "false";
|
|
589
591
|
function generateCreateRecipe(ctx) {
|
|
590
|
-
const {
|
|
591
|
-
conditions,
|
|
592
|
-
recipes,
|
|
593
|
-
prefix,
|
|
594
|
-
hash,
|
|
595
|
-
utility: { separator }
|
|
596
|
-
} = ctx;
|
|
592
|
+
const { conditions, recipes, prefix, hash, utility } = ctx;
|
|
597
593
|
if (recipes.isEmpty())
|
|
598
594
|
return;
|
|
599
595
|
return {
|
|
@@ -624,7 +620,7 @@ function generateCreateRecipe(ctx) {
|
|
|
624
620
|
}
|
|
625
621
|
|
|
626
622
|
value = withoutSpace(value)
|
|
627
|
-
return { className: \`\${name}--\${prop}${separator}\${value}\` }
|
|
623
|
+
return { className: \`\${name}--\${prop}${utility.separator}\${value}\` }
|
|
628
624
|
}
|
|
629
625
|
|
|
630
626
|
const recipeCss = createCss({
|
|
@@ -636,6 +632,7 @@ function generateCreateRecipe(ctx) {
|
|
|
636
632
|
},
|
|
637
633
|
utility: {
|
|
638
634
|
${prefix.className ? "prefix: " + JSON.stringify(prefix.className) + "," : ""}
|
|
635
|
+
toHash: ${utility.toHash},
|
|
639
636
|
transform,
|
|
640
637
|
}
|
|
641
638
|
})
|
|
@@ -2990,16 +2987,16 @@ function generateTokenTypes(ctx) {
|
|
|
2990
2987
|
config: { theme }
|
|
2991
2988
|
} = ctx;
|
|
2992
2989
|
const set = /* @__PURE__ */ new Set();
|
|
2993
|
-
set.add(`export type Token = ${tokens.isEmpty ? "string" : unionType3(tokens.
|
|
2990
|
+
set.add(`export type Token = ${tokens.isEmpty ? "string" : unionType3(Array.from(tokens.byName.keys()))}`);
|
|
2994
2991
|
const result = /* @__PURE__ */ new Set(["export type Tokens = {"]);
|
|
2995
2992
|
if (tokens.isEmpty) {
|
|
2996
2993
|
result.add("[token: string]: string");
|
|
2997
2994
|
} else {
|
|
2998
|
-
const colorPaletteKeys =
|
|
2995
|
+
const colorPaletteKeys = Array.from(tokens.view.colorPalettes.keys());
|
|
2999
2996
|
if (colorPaletteKeys.length) {
|
|
3000
|
-
set.add(`export type ColorPalette = ${unionType3(
|
|
2997
|
+
set.add(`export type ColorPalette = ${unionType3(colorPaletteKeys)}`);
|
|
3001
2998
|
}
|
|
3002
|
-
for (const [key, value] of tokens.categoryMap.entries()) {
|
|
2999
|
+
for (const [key, value] of tokens.view.categoryMap.entries()) {
|
|
3003
3000
|
const typeName = capitalize(pluralize.singular(key));
|
|
3004
3001
|
set.add(`export type ${typeName}Token = ${unionType3(value.keys())}`);
|
|
3005
3002
|
result.add(` ${key}: ${typeName}Token`);
|
|
@@ -3410,8 +3407,8 @@ var entries = [
|
|
|
3410
3407
|
var getMatchingArtifacts = (ctx, filters) => {
|
|
3411
3408
|
const ids = filters?.ids;
|
|
3412
3409
|
if (!ids)
|
|
3413
|
-
return entries.map(([_artifactId, fn]) => fn(ctx));
|
|
3414
|
-
return entries.filter(([artifactId]) => ids.includes(artifactId)).map(([_artifactId, fn]) => fn(ctx, filters));
|
|
3410
|
+
return entries.map(([_artifactId, fn]) => fn(ctx)).filter(Boolean);
|
|
3411
|
+
return entries.filter(([artifactId]) => ids.includes(artifactId)).map(([_artifactId, fn]) => fn(ctx, filters)).filter(Boolean);
|
|
3415
3412
|
};
|
|
3416
3413
|
var transformArtifact = (ctx, artifact) => {
|
|
3417
3414
|
const files = (artifact?.files ?? []).filter((item) => !!item?.code).map((item) => {
|
|
@@ -3433,7 +3430,7 @@ var setupArtifacts = (ctx, ids) => {
|
|
|
3433
3430
|
// src/artifacts/index.ts
|
|
3434
3431
|
var generateArtifacts = (ctx, ids) => {
|
|
3435
3432
|
if (ctx.config.emitTokensOnly) {
|
|
3436
|
-
return [setupDesignTokens(ctx)];
|
|
3433
|
+
return [setupDesignTokens(ctx)].filter(Boolean);
|
|
3437
3434
|
}
|
|
3438
3435
|
return setupArtifacts(ctx, ids);
|
|
3439
3436
|
};
|
|
@@ -3487,11 +3484,11 @@ function generateKeyframeCss(ctx, sheet) {
|
|
|
3487
3484
|
for (const [name, definition] of Object.entries(keyframes)) {
|
|
3488
3485
|
result[`@keyframes ${name}`] = definition;
|
|
3489
3486
|
}
|
|
3490
|
-
let
|
|
3487
|
+
let css = stringify3(sheet.serialize(result));
|
|
3491
3488
|
if (ctx.hooks["cssgen:done"]) {
|
|
3492
|
-
|
|
3489
|
+
css = ctx.hooks["cssgen:done"]({ artifact: "keyframes", content: css }) ?? css;
|
|
3493
3490
|
}
|
|
3494
|
-
sheet.layers.tokens.append(
|
|
3491
|
+
sheet.layers.tokens.append(css);
|
|
3495
3492
|
}
|
|
3496
3493
|
|
|
3497
3494
|
// src/artifacts/css/parser-css.ts
|
|
@@ -3503,8 +3500,8 @@ var generateParserCss = (ctx, decoder) => {
|
|
|
3503
3500
|
const { minify, optimize } = ctx.config;
|
|
3504
3501
|
sheet.processDecoder(decoder);
|
|
3505
3502
|
try {
|
|
3506
|
-
const
|
|
3507
|
-
return
|
|
3503
|
+
const css = sheet.toCss({ minify, optimize });
|
|
3504
|
+
return css;
|
|
3508
3505
|
} catch (err) {
|
|
3509
3506
|
logger.error("serializer:css", "Failed to serialize CSS: " + err);
|
|
3510
3507
|
return "";
|
|
@@ -3512,234 +3509,108 @@ var generateParserCss = (ctx, decoder) => {
|
|
|
3512
3509
|
};
|
|
3513
3510
|
|
|
3514
3511
|
// src/artifacts/css/reset-css.ts
|
|
3512
|
+
import "@pandacss/core";
|
|
3515
3513
|
import { isObject } from "@pandacss/shared";
|
|
3516
|
-
var css = String.raw;
|
|
3517
3514
|
function generateResetCss(ctx, sheet) {
|
|
3518
3515
|
const { preflight } = ctx.config;
|
|
3519
3516
|
const scope = isObject(preflight) ? preflight.scope : void 0;
|
|
3520
3517
|
const selector = scope ? `${scope} ` : "";
|
|
3521
|
-
|
|
3522
|
-
|
|
3523
|
-
|
|
3524
|
-
|
|
3525
|
-
|
|
3526
|
-
|
|
3527
|
-
|
|
3528
|
-
|
|
3529
|
-
|
|
3530
|
-
|
|
3531
|
-
|
|
3532
|
-
|
|
3533
|
-
|
|
3534
|
-
|
|
3535
|
-
|
|
3536
|
-
|
|
3537
|
-
|
|
3538
|
-
|
|
3539
|
-
|
|
3540
|
-
|
|
3541
|
-
|
|
3542
|
-
|
|
3543
|
-
|
|
3544
|
-
|
|
3545
|
-
|
|
3546
|
-
|
|
3547
|
-
|
|
3548
|
-
|
|
3549
|
-
|
|
3550
|
-
|
|
3551
|
-
|
|
3552
|
-
|
|
3553
|
-
|
|
3554
|
-
|
|
3555
|
-
|
|
3556
|
-
|
|
3557
|
-
|
|
3558
|
-
|
|
3559
|
-
|
|
3560
|
-
|
|
3561
|
-
|
|
3562
|
-
|
|
3563
|
-
|
|
3564
|
-
|
|
3565
|
-
|
|
3566
|
-
|
|
3567
|
-
|
|
3568
|
-
|
|
3569
|
-
|
|
3570
|
-
|
|
3571
|
-
|
|
3572
|
-
|
|
3573
|
-
|
|
3574
|
-
|
|
3575
|
-
|
|
3576
|
-
|
|
3577
|
-
|
|
3578
|
-
|
|
3579
|
-
|
|
3580
|
-
|
|
3581
|
-
|
|
3582
|
-
|
|
3583
|
-
|
|
3584
|
-
|
|
3585
|
-
|
|
3586
|
-
|
|
3587
|
-
|
|
3588
|
-
|
|
3589
|
-
|
|
3590
|
-
|
|
3591
|
-
|
|
3592
|
-
|
|
3593
|
-
|
|
3594
|
-
|
|
3595
|
-
|
|
3596
|
-
|
|
3597
|
-
|
|
3598
|
-
|
|
3599
|
-
|
|
3600
|
-
|
|
3601
|
-
|
|
3602
|
-
|
|
3603
|
-
|
|
3604
|
-
|
|
3605
|
-
|
|
3606
|
-
|
|
3607
|
-
|
|
3608
|
-
|
|
3609
|
-
|
|
3610
|
-
|
|
3611
|
-
|
|
3612
|
-
|
|
3613
|
-
|
|
3614
|
-
|
|
3615
|
-
${selector}input,
|
|
3616
|
-
${selector}optgroup,
|
|
3617
|
-
${selector}select,
|
|
3618
|
-
${selector}textarea {
|
|
3619
|
-
color: inherit;
|
|
3620
|
-
}
|
|
3621
|
-
|
|
3622
|
-
${selector}button,
|
|
3623
|
-
${selector}select {
|
|
3624
|
-
text-transform: none;
|
|
3625
|
-
}
|
|
3626
|
-
|
|
3627
|
-
${selector}table {
|
|
3628
|
-
text-indent: 0;
|
|
3629
|
-
border-color: inherit;
|
|
3630
|
-
border-collapse: collapse;
|
|
3631
|
-
}
|
|
3632
|
-
|
|
3633
|
-
${selector}input::placeholder,
|
|
3634
|
-
${selector}textarea::placeholder {
|
|
3635
|
-
opacity: 1;
|
|
3636
|
-
color: var(--global-color-placeholder, #9ca3af);
|
|
3637
|
-
}
|
|
3638
|
-
|
|
3639
|
-
${selector}textarea {
|
|
3640
|
-
resize: vertical;
|
|
3641
|
-
}
|
|
3642
|
-
|
|
3643
|
-
${selector}summary {
|
|
3644
|
-
display: list-item;
|
|
3645
|
-
}
|
|
3646
|
-
|
|
3647
|
-
${selector}small {
|
|
3648
|
-
font-size: 80%;
|
|
3649
|
-
}
|
|
3650
|
-
|
|
3651
|
-
${selector}sub,
|
|
3652
|
-
${selector}sup {
|
|
3653
|
-
font-size: 75%;
|
|
3654
|
-
line-height: 0;
|
|
3655
|
-
position: relative;
|
|
3656
|
-
vertical-align: baseline;
|
|
3657
|
-
}
|
|
3658
|
-
|
|
3659
|
-
${selector}sub {
|
|
3660
|
-
bottom: -0.25em;
|
|
3661
|
-
}
|
|
3662
|
-
|
|
3663
|
-
${selector}sup {
|
|
3664
|
-
top: -0.5em;
|
|
3665
|
-
}
|
|
3666
|
-
|
|
3667
|
-
${selector}dialog {
|
|
3668
|
-
padding: 0;
|
|
3669
|
-
}
|
|
3670
|
-
|
|
3671
|
-
${selector}a {
|
|
3672
|
-
color: inherit;
|
|
3673
|
-
text-decoration: inherit;
|
|
3674
|
-
}
|
|
3675
|
-
|
|
3676
|
-
${selector}abbr:where([title]) {
|
|
3677
|
-
text-decoration: underline dotted;
|
|
3678
|
-
}
|
|
3679
|
-
|
|
3680
|
-
${selector}b,
|
|
3681
|
-
${selector}strong {
|
|
3682
|
-
font-weight: bolder;
|
|
3683
|
-
}
|
|
3684
|
-
|
|
3685
|
-
${selector}code,
|
|
3686
|
-
${selector}kbd,
|
|
3687
|
-
${selector}samp,
|
|
3688
|
-
${selector}pre {
|
|
3689
|
-
font-size: 1em;
|
|
3690
|
-
--font-mono-fallback: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New';
|
|
3691
|
-
font-family: var(--global-font-mono, var(--font-mono-fallback));
|
|
3692
|
-
}
|
|
3693
|
-
|
|
3694
|
-
|
|
3695
|
-
${selector}input[type="text"],
|
|
3696
|
-
${selector}input[type="email"],
|
|
3697
|
-
${selector}input[type="search"],
|
|
3698
|
-
${selector}input[type="password"] {
|
|
3699
|
-
-webkit-appearance: none;
|
|
3700
|
-
-moz-appearance: none;
|
|
3701
|
-
}
|
|
3702
|
-
|
|
3703
|
-
${selector}input[type='search'] {
|
|
3704
|
-
-webkit-appearance: textfield;
|
|
3705
|
-
outline-offset: -2px;
|
|
3706
|
-
}
|
|
3707
|
-
|
|
3708
|
-
${selector}::-webkit-search-decoration,
|
|
3709
|
-
${selector}::-webkit-search-cancel-button {
|
|
3710
|
-
-webkit-appearance: none;
|
|
3711
|
-
}
|
|
3712
|
-
|
|
3713
|
-
${selector}::-webkit-file-upload-button {
|
|
3714
|
-
-webkit-appearance: button;
|
|
3715
|
-
font: inherit;
|
|
3716
|
-
}
|
|
3717
|
-
|
|
3718
|
-
${selector}input[type="number"]::-webkit-inner-spin-button,
|
|
3719
|
-
${selector}input[type="number"]::-webkit-outer-spin-button {
|
|
3720
|
-
height: auto;
|
|
3721
|
-
}
|
|
3722
|
-
|
|
3723
|
-
${selector}input[type='number']{
|
|
3724
|
-
-moz-appearance: textfield;
|
|
3725
|
-
}
|
|
3726
|
-
|
|
3727
|
-
${selector}:-moz-ui-invalid {
|
|
3728
|
-
box-shadow: none;
|
|
3729
|
-
}
|
|
3730
|
-
|
|
3731
|
-
${selector}:-moz-focusring {
|
|
3732
|
-
outline: auto;
|
|
3733
|
-
}
|
|
3734
|
-
|
|
3735
|
-
${selector}[hidden] {
|
|
3736
|
-
display: none !important;
|
|
3737
|
-
}
|
|
3738
|
-
`;
|
|
3739
|
-
if (ctx.hooks["cssgen:done"]) {
|
|
3740
|
-
output = ctx.hooks["cssgen:done"]({ artifact: "reset", content: output }) ?? output;
|
|
3518
|
+
const scoped = {
|
|
3519
|
+
"*": { margin: "0px", padding: "0px", font: "inherit" },
|
|
3520
|
+
"*, *::before, *::after": {
|
|
3521
|
+
boxSizing: "border-box",
|
|
3522
|
+
borderWidth: "0px",
|
|
3523
|
+
borderStyle: "solid",
|
|
3524
|
+
borderColor: "var(--global-color-border, currentColor)"
|
|
3525
|
+
},
|
|
3526
|
+
hr: { height: "0px", color: "inherit", borderTopWidth: "1px" },
|
|
3527
|
+
body: { height: "100%", lineHeight: "inherit" },
|
|
3528
|
+
img: { borderStyle: "none" },
|
|
3529
|
+
"img, svg, video, canvas, audio, iframe, embed, object": {
|
|
3530
|
+
display: "block",
|
|
3531
|
+
verticalAlign: "middle"
|
|
3532
|
+
},
|
|
3533
|
+
"img, video": { maxWidth: "100%", height: "auto" },
|
|
3534
|
+
"p, h1, h2, h3, h4, h5, h6": { overflowWrap: "break-word" },
|
|
3535
|
+
"ol, ul": { listStyle: "none" },
|
|
3536
|
+
"code, kbd, pre, samp": { fontSize: "1em" },
|
|
3537
|
+
"button, [type='button'], [type='reset'], [type='submit']": {
|
|
3538
|
+
WebkitAppearance: "button",
|
|
3539
|
+
backgroundColor: "transparent",
|
|
3540
|
+
backgroundImage: "none"
|
|
3541
|
+
},
|
|
3542
|
+
"button, input, optgroup, select, textarea": { color: "inherit" },
|
|
3543
|
+
"button, select": { textTransform: "none" },
|
|
3544
|
+
table: {
|
|
3545
|
+
textIndent: "0px",
|
|
3546
|
+
borderColor: "inherit",
|
|
3547
|
+
borderCollapse: "collapse"
|
|
3548
|
+
},
|
|
3549
|
+
"input::placeholder, textarea::placeholder": {
|
|
3550
|
+
opacity: 1,
|
|
3551
|
+
color: "var(--global-color-placeholder, #9ca3af)"
|
|
3552
|
+
},
|
|
3553
|
+
textarea: { resize: "vertical" },
|
|
3554
|
+
summary: { display: "list-item" },
|
|
3555
|
+
small: { fontSize: "80%" },
|
|
3556
|
+
"sub, sup": {
|
|
3557
|
+
fontSize: "75%",
|
|
3558
|
+
lineHeight: 0,
|
|
3559
|
+
position: "relative",
|
|
3560
|
+
verticalAlign: "baseline"
|
|
3561
|
+
},
|
|
3562
|
+
sub: { bottom: "-0.25em" },
|
|
3563
|
+
sup: { top: "-0.5em" },
|
|
3564
|
+
dialog: { padding: "0px" },
|
|
3565
|
+
a: { color: "inherit", textDecoration: "inherit" },
|
|
3566
|
+
"abbr:where([title])": { textDecoration: "underline dotted" },
|
|
3567
|
+
"b, strong": { fontWeight: "bolder" },
|
|
3568
|
+
"code, kbd, samp, pre": {
|
|
3569
|
+
fontSize: "1em",
|
|
3570
|
+
"--font-mono-fallback": "ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New'",
|
|
3571
|
+
fontFamily: "var(--global-font-mono, var(--font-mono-fallback))"
|
|
3572
|
+
},
|
|
3573
|
+
'input[type="text"], input[type="email"], input[type="search"], input[type="password"]': {
|
|
3574
|
+
WebkitAppearance: "none",
|
|
3575
|
+
MozAppearance: "none"
|
|
3576
|
+
},
|
|
3577
|
+
"input[type='search']": {
|
|
3578
|
+
WebkitAppearance: "textfield",
|
|
3579
|
+
outlineOffset: "-2px"
|
|
3580
|
+
},
|
|
3581
|
+
"::-webkit-search-decoration, ::-webkit-search-cancel-button": {
|
|
3582
|
+
WebkitAppearance: "none"
|
|
3583
|
+
},
|
|
3584
|
+
"::-webkit-file-upload-button": {
|
|
3585
|
+
WebkitAppearance: "button",
|
|
3586
|
+
font: "inherit"
|
|
3587
|
+
},
|
|
3588
|
+
'input[type="number"]::-webkit-inner-spin-button, input[type="number"]::-webkit-outer-spin-button': {
|
|
3589
|
+
height: "auto"
|
|
3590
|
+
},
|
|
3591
|
+
"input[type='number']": { MozAppearance: "textfield" },
|
|
3592
|
+
":-moz-ui-invalid": { boxShadow: "none" },
|
|
3593
|
+
":-moz-focusring": { outline: "auto" },
|
|
3594
|
+
"[hidden]": { display: "none !important" }
|
|
3595
|
+
};
|
|
3596
|
+
const reset = {
|
|
3597
|
+
[scope || "html"]: {
|
|
3598
|
+
lineHeight: 1.5,
|
|
3599
|
+
"--font-fallback": "ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'",
|
|
3600
|
+
WebkitTextSizeAdjust: "100%",
|
|
3601
|
+
WebkitFontSmoothing: "antialiased",
|
|
3602
|
+
MozOsxFontSmoothing: "grayscale",
|
|
3603
|
+
MozTabSize: "[4]",
|
|
3604
|
+
tabSize: "[4]",
|
|
3605
|
+
fontFamily: "var(--global-font-body, var(--font-fallback))"
|
|
3606
|
+
}
|
|
3607
|
+
};
|
|
3608
|
+
if (selector) {
|
|
3609
|
+
reset[selector] = scoped;
|
|
3610
|
+
} else {
|
|
3611
|
+
Object.assign(reset, scoped);
|
|
3741
3612
|
}
|
|
3742
|
-
sheet.
|
|
3613
|
+
sheet.processResetCss(reset);
|
|
3743
3614
|
}
|
|
3744
3615
|
|
|
3745
3616
|
// src/artifacts/css/static-css.ts
|
|
@@ -3748,11 +3619,11 @@ var generateStaticCss = (ctx, sheet) => {
|
|
|
3748
3619
|
const engine = staticCss.process(ctx.config.staticCss ?? {}, sheet);
|
|
3749
3620
|
if (!sheet) {
|
|
3750
3621
|
const { optimize = true, minify } = config;
|
|
3751
|
-
let
|
|
3622
|
+
let css = engine.sheet.toCss({ optimize, minify });
|
|
3752
3623
|
if (ctx.hooks["cssgen:done"]) {
|
|
3753
|
-
|
|
3624
|
+
css = ctx.hooks["cssgen:done"]({ artifact: "static", content: css }) ?? css;
|
|
3754
3625
|
}
|
|
3755
|
-
return
|
|
3626
|
+
return css;
|
|
3756
3627
|
}
|
|
3757
3628
|
};
|
|
3758
3629
|
|
|
@@ -3767,16 +3638,16 @@ function generateTokenCss(ctx, sheet) {
|
|
|
3767
3638
|
} = ctx;
|
|
3768
3639
|
const root = cssVarRoot;
|
|
3769
3640
|
const results = [];
|
|
3770
|
-
for (const [key, values] of tokens.vars.entries()) {
|
|
3641
|
+
for (const [key, values] of tokens.view.vars.entries()) {
|
|
3771
3642
|
const varsObj = Object.fromEntries(values);
|
|
3772
3643
|
if (Object.keys(varsObj).length === 0)
|
|
3773
3644
|
continue;
|
|
3774
3645
|
if (key === "base") {
|
|
3775
|
-
const
|
|
3776
|
-
results.push(
|
|
3646
|
+
const css2 = stringify4({ [root]: varsObj });
|
|
3647
|
+
results.push(css2);
|
|
3777
3648
|
} else {
|
|
3778
3649
|
const keys = key.split(":");
|
|
3779
|
-
const
|
|
3650
|
+
const css2 = stringify4(varsObj);
|
|
3780
3651
|
const mapped = keys.map((key2) => conditions.get(key2)).filter(Boolean).map((condition) => {
|
|
3781
3652
|
const parent = extractParentSelectors(condition);
|
|
3782
3653
|
return parent ? `&${parent}` : condition;
|
|
@@ -3784,16 +3655,16 @@ function generateTokenCss(ctx, sheet) {
|
|
|
3784
3655
|
const rule = getDeepestRule(root, mapped);
|
|
3785
3656
|
if (!rule)
|
|
3786
3657
|
continue;
|
|
3787
|
-
getDeepestNode(rule)?.append(
|
|
3658
|
+
getDeepestNode(rule)?.append(css2);
|
|
3788
3659
|
results.push(expandNestedCss(rule.toString()));
|
|
3789
3660
|
}
|
|
3790
3661
|
}
|
|
3791
|
-
let
|
|
3792
|
-
|
|
3662
|
+
let css = results.join("\n\n");
|
|
3663
|
+
css = "\n\n" + cleanupSelectors(css, root);
|
|
3793
3664
|
if (ctx.hooks["cssgen:done"]) {
|
|
3794
|
-
|
|
3665
|
+
css = ctx.hooks["cssgen:done"]({ artifact: "tokens", content: css }) ?? css;
|
|
3795
3666
|
}
|
|
3796
|
-
sheet.layers.tokens.append(
|
|
3667
|
+
sheet.layers.tokens.append(css);
|
|
3797
3668
|
}
|
|
3798
3669
|
function getDeepestRule(root, selectors) {
|
|
3799
3670
|
const rule = postcss.rule({ selector: "" });
|
|
@@ -3815,8 +3686,8 @@ function getDeepestNode(node) {
|
|
|
3815
3686
|
}
|
|
3816
3687
|
return node;
|
|
3817
3688
|
}
|
|
3818
|
-
function cleanupSelectors(
|
|
3819
|
-
const root = postcss.parse(
|
|
3689
|
+
function cleanupSelectors(css, varSelector) {
|
|
3690
|
+
const root = postcss.parse(css);
|
|
3820
3691
|
root.walkRules((rule) => {
|
|
3821
3692
|
const selectors = [];
|
|
3822
3693
|
rule.selectors.forEach((selector) => {
|
|
@@ -3876,14 +3747,14 @@ var Generator = class extends Context2 {
|
|
|
3876
3747
|
};
|
|
3877
3748
|
getCss = (stylesheet) => {
|
|
3878
3749
|
const sheet = stylesheet ?? this.createSheet();
|
|
3879
|
-
let
|
|
3750
|
+
let css = sheet.toCss({
|
|
3880
3751
|
optimize: true,
|
|
3881
3752
|
minify: this.config.minify
|
|
3882
3753
|
});
|
|
3883
3754
|
if (this.hooks["cssgen:done"]) {
|
|
3884
|
-
|
|
3755
|
+
css = this.hooks["cssgen:done"]({ artifact: "styles.css", content: css }) ?? css;
|
|
3885
3756
|
}
|
|
3886
|
-
return
|
|
3757
|
+
return css;
|
|
3887
3758
|
};
|
|
3888
3759
|
};
|
|
3889
3760
|
export {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pandacss/generator",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.30.1",
|
|
4
4
|
"description": "The css generator for css panda",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -37,12 +37,12 @@
|
|
|
37
37
|
"pluralize": "8.0.0",
|
|
38
38
|
"postcss": "^8.4.31",
|
|
39
39
|
"ts-pattern": "5.0.5",
|
|
40
|
-
"@pandacss/core": "0.
|
|
41
|
-
"@pandacss/is-valid-prop": "^0.
|
|
42
|
-
"@pandacss/logger": "0.
|
|
43
|
-
"@pandacss/shared": "0.
|
|
44
|
-
"@pandacss/token-dictionary": "0.
|
|
45
|
-
"@pandacss/types": "0.
|
|
40
|
+
"@pandacss/core": "0.30.1",
|
|
41
|
+
"@pandacss/is-valid-prop": "^0.30.1",
|
|
42
|
+
"@pandacss/logger": "0.30.1",
|
|
43
|
+
"@pandacss/shared": "0.30.1",
|
|
44
|
+
"@pandacss/token-dictionary": "0.30.1",
|
|
45
|
+
"@pandacss/types": "0.30.1"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"@types/pluralize": "0.0.33"
|