@pandacss/generator 0.22.1 → 0.24.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +22 -86
- package/dist/index.d.ts +22 -86
- package/dist/index.js +277 -443
- package/dist/index.mjs +272 -445
- package/package.json +14 -10
package/dist/index.js
CHANGED
|
@@ -82,7 +82,7 @@ var artifactsGenerated = (ctx) => {
|
|
|
82
82
|
var configExists = (cmd) => import_outdent.outdent`
|
|
83
83
|
\n
|
|
84
84
|
It looks like you already have panda created\`.
|
|
85
|
-
|
|
85
|
+
|
|
86
86
|
You can now run ${(0, import_logger.quote)(cmd, " panda --watch")}.
|
|
87
87
|
|
|
88
88
|
`;
|
|
@@ -96,9 +96,9 @@ var thankYou = () => import_outdent.outdent`
|
|
|
96
96
|
var codegenComplete = () => import_outdent.outdent`
|
|
97
97
|
|
|
98
98
|
${import_logger.colors.bold().cyan("Next steps:")}
|
|
99
|
-
|
|
99
|
+
|
|
100
100
|
[1] Create a ${(0, import_logger.quote)("index.css")} file in your project that contains:
|
|
101
|
-
|
|
101
|
+
|
|
102
102
|
@layer reset, base, tokens, recipes, utilities;
|
|
103
103
|
|
|
104
104
|
|
|
@@ -1092,7 +1092,7 @@ function generatePreactJsxFactory(ctx) {
|
|
|
1092
1092
|
var import_outdent16 = require("outdent");
|
|
1093
1093
|
var import_ts_pattern5 = require("ts-pattern");
|
|
1094
1094
|
function generatePreactJsxPattern(ctx, filters) {
|
|
1095
|
-
const { typeName, factoryName } = ctx.jsx;
|
|
1095
|
+
const { typeName, factoryName, styleProps: jsxStyleProps2 } = ctx.jsx;
|
|
1096
1096
|
const details = ctx.patterns.filterDetails(filters);
|
|
1097
1097
|
return details.map((pattern) => {
|
|
1098
1098
|
const { upperName, styleFnName, dashName, jsxName, props, blocklistType } = pattern;
|
|
@@ -1102,23 +1102,44 @@ function generatePreactJsxPattern(ctx, filters) {
|
|
|
1102
1102
|
js: import_outdent16.outdent`
|
|
1103
1103
|
import { h } from 'preact'
|
|
1104
1104
|
import { forwardRef } from 'preact/compat'
|
|
1105
|
-
${ctx.file.import(
|
|
1105
|
+
${ctx.file.import("mergeCss", "../css/css")}
|
|
1106
|
+
${ctx.file.import("splitProps", "../helpers")}
|
|
1106
1107
|
${ctx.file.import(styleFnName, `../patterns/${dashName}`)}
|
|
1108
|
+
${ctx.file.import(factoryName, "./factory")}
|
|
1107
1109
|
|
|
1108
1110
|
export const ${jsxName} = /* @__PURE__ */ forwardRef(function ${jsxName}(props, ref) {
|
|
1109
|
-
${(0, import_ts_pattern5.match)(
|
|
1110
|
-
|
|
1111
|
+
${(0, import_ts_pattern5.match)(jsxStyleProps2).with(
|
|
1112
|
+
"none",
|
|
1111
1113
|
() => import_outdent16.outdent`
|
|
1112
|
-
const
|
|
1113
|
-
|
|
1114
|
+
const [patternProps, restProps] = splitProps(props, ${JSON.stringify(props)})
|
|
1115
|
+
|
|
1116
|
+
const styleProps = ${styleFnName}(patternProps)
|
|
1117
|
+
const Comp = ${factoryName}("${jsxElement}", { base: styleProps })
|
|
1118
|
+
|
|
1119
|
+
return h(Comp, { ref, ...restProps })
|
|
1114
1120
|
`
|
|
1115
|
-
).
|
|
1121
|
+
).with(
|
|
1122
|
+
"minimal",
|
|
1123
|
+
() => import_outdent16.outdent`
|
|
1124
|
+
const [patternProps, restProps] = splitProps(props, ${JSON.stringify(props)})
|
|
1125
|
+
|
|
1126
|
+
const styleProps = ${styleFnName}(patternProps)
|
|
1127
|
+
const cssProps = { css: mergeCss(styleProps, props.css) }
|
|
1128
|
+
const mergedProps = { ref, ...restProps, ...cssProps }
|
|
1129
|
+
|
|
1130
|
+
return h(${factoryName}.${jsxElement}, mergedProps)
|
|
1131
|
+
`
|
|
1132
|
+
).with(
|
|
1133
|
+
"all",
|
|
1116
1134
|
() => import_outdent16.outdent`
|
|
1117
|
-
const
|
|
1118
|
-
|
|
1119
|
-
|
|
1135
|
+
const [patternProps, restProps] = splitProps(props, ${JSON.stringify(props)})
|
|
1136
|
+
|
|
1137
|
+
const styleProps = ${styleFnName}(patternProps)
|
|
1138
|
+
const mergedProps = { ref, ...styleProps, ...restProps }
|
|
1139
|
+
|
|
1140
|
+
return h(${factoryName}.${jsxElement}, mergedProps)
|
|
1120
1141
|
`
|
|
1121
|
-
)}
|
|
1142
|
+
).exhaustive()}
|
|
1122
1143
|
})
|
|
1123
1144
|
`,
|
|
1124
1145
|
dts: import_outdent16.outdent`
|
|
@@ -1397,7 +1418,7 @@ function generateQwikJsxFactory(ctx) {
|
|
|
1397
1418
|
var import_outdent21 = require("outdent");
|
|
1398
1419
|
var import_ts_pattern6 = require("ts-pattern");
|
|
1399
1420
|
function generateQwikJsxPattern(ctx, filters) {
|
|
1400
|
-
const { typeName, factoryName } = ctx.jsx;
|
|
1421
|
+
const { typeName, factoryName, styleProps: jsxStyleProps2 } = ctx.jsx;
|
|
1401
1422
|
const details = ctx.patterns.filterDetails(filters);
|
|
1402
1423
|
return details.map((pattern) => {
|
|
1403
1424
|
const { upperName, styleFnName, dashName, jsxName, props, blocklistType } = pattern;
|
|
@@ -1406,23 +1427,44 @@ function generateQwikJsxPattern(ctx, filters) {
|
|
|
1406
1427
|
name: dashName,
|
|
1407
1428
|
js: import_outdent21.outdent`
|
|
1408
1429
|
import { h } from '@builder.io/qwik'
|
|
1409
|
-
${ctx.file.import(
|
|
1430
|
+
${ctx.file.import("mergeCss", "../css/css")}
|
|
1431
|
+
${ctx.file.import("splitProps", "../helpers")}
|
|
1410
1432
|
${ctx.file.import(styleFnName, `../patterns/${dashName}`)}
|
|
1433
|
+
${ctx.file.import(factoryName, "./factory")}
|
|
1411
1434
|
|
|
1412
|
-
export const ${jsxName} = function ${jsxName}(props) {
|
|
1413
|
-
${(0, import_ts_pattern6.match)(
|
|
1414
|
-
|
|
1435
|
+
export const ${jsxName} = /* @__PURE__ */ function ${jsxName}(props) {
|
|
1436
|
+
${(0, import_ts_pattern6.match)(jsxStyleProps2).with(
|
|
1437
|
+
"none",
|
|
1415
1438
|
() => import_outdent21.outdent`
|
|
1416
|
-
|
|
1417
|
-
|
|
1439
|
+
const [patternProps, restProps] = splitProps(props, ${JSON.stringify(props)})
|
|
1440
|
+
|
|
1441
|
+
const styleProps = ${styleFnName}(patternProps)
|
|
1442
|
+
const Comp = ${factoryName}("${jsxElement}", { base: styleProps })
|
|
1443
|
+
|
|
1444
|
+
return h(Comp, restProps)
|
|
1418
1445
|
`
|
|
1419
|
-
).
|
|
1446
|
+
).with(
|
|
1447
|
+
"minimal",
|
|
1420
1448
|
() => import_outdent21.outdent`
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1449
|
+
const [patternProps, restProps] = splitProps(props, ${JSON.stringify(props)})
|
|
1450
|
+
|
|
1451
|
+
const styleProps = ${styleFnName}(patternProps)
|
|
1452
|
+
const cssProps = { css: mergeCss(styleProps, props.css) }
|
|
1453
|
+
const mergedProps = { ...restProps, ...cssProps }
|
|
1454
|
+
|
|
1455
|
+
return h(${factoryName}.${jsxElement}, mergedProps)
|
|
1424
1456
|
`
|
|
1425
|
-
)
|
|
1457
|
+
).with(
|
|
1458
|
+
"all",
|
|
1459
|
+
() => import_outdent21.outdent`
|
|
1460
|
+
const [patternProps, restProps] = splitProps(props, ${JSON.stringify(props)})
|
|
1461
|
+
|
|
1462
|
+
const styleProps = ${styleFnName}(patternProps)
|
|
1463
|
+
const mergedProps = { ...styleProps, ...restProps }
|
|
1464
|
+
|
|
1465
|
+
return h(${factoryName}.${jsxElement}, mergedProps)
|
|
1466
|
+
`
|
|
1467
|
+
).exhaustive()}
|
|
1426
1468
|
}
|
|
1427
1469
|
`,
|
|
1428
1470
|
dts: import_outdent21.outdent`
|
|
@@ -1708,7 +1750,7 @@ function generateReactJsxFactory(ctx) {
|
|
|
1708
1750
|
var import_outdent26 = require("outdent");
|
|
1709
1751
|
var import_ts_pattern7 = require("ts-pattern");
|
|
1710
1752
|
function generateReactJsxPattern(ctx, filters) {
|
|
1711
|
-
const { typeName, factoryName } = ctx.jsx;
|
|
1753
|
+
const { typeName, factoryName, styleProps: jsxStyleProps2 } = ctx.jsx;
|
|
1712
1754
|
const details = ctx.patterns.filterDetails(filters);
|
|
1713
1755
|
return details.map((pattern) => {
|
|
1714
1756
|
const { upperName, styleFnName, dashName, jsxName, props, blocklistType } = pattern;
|
|
@@ -1717,24 +1759,45 @@ function generateReactJsxPattern(ctx, filters) {
|
|
|
1717
1759
|
name: dashName,
|
|
1718
1760
|
js: import_outdent26.outdent`
|
|
1719
1761
|
import { createElement, forwardRef } from 'react'
|
|
1720
|
-
${ctx.file.import(
|
|
1762
|
+
${ctx.file.import("mergeCss", "../css/css")}
|
|
1763
|
+
${ctx.file.import("splitProps", "../helpers")}
|
|
1721
1764
|
${ctx.file.import(styleFnName, `../patterns/${dashName}`)}
|
|
1765
|
+
${ctx.file.import(factoryName, "./factory")}
|
|
1722
1766
|
|
|
1723
1767
|
export const ${jsxName} = /* @__PURE__ */ forwardRef(function ${jsxName}(props, ref) {
|
|
1724
|
-
${(0, import_ts_pattern7.match)(
|
|
1725
|
-
|
|
1768
|
+
${(0, import_ts_pattern7.match)(jsxStyleProps2).with(
|
|
1769
|
+
"none",
|
|
1726
1770
|
() => import_outdent26.outdent`
|
|
1727
|
-
|
|
1728
|
-
|
|
1771
|
+
const [patternProps, restProps] = splitProps(props, ${JSON.stringify(props)})
|
|
1772
|
+
|
|
1773
|
+
const styleProps = ${styleFnName}(patternProps)
|
|
1774
|
+
const Comp = ${factoryName}("${jsxElement}", { base: styleProps })
|
|
1775
|
+
|
|
1776
|
+
return createElement(Comp, { ref, ...restProps })
|
|
1729
1777
|
`
|
|
1730
|
-
).
|
|
1778
|
+
).with(
|
|
1779
|
+
"minimal",
|
|
1731
1780
|
() => import_outdent26.outdent`
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1781
|
+
const [patternProps, restProps] = splitProps(props, ${JSON.stringify(props)})
|
|
1782
|
+
|
|
1783
|
+
const styleProps = ${styleFnName}(patternProps)
|
|
1784
|
+
const cssProps = { css: mergeCss(styleProps, props.css) }
|
|
1785
|
+
const mergedProps = { ref, ...restProps, ...cssProps }
|
|
1786
|
+
|
|
1787
|
+
return createElement(${factoryName}.${jsxElement}, mergedProps)
|
|
1735
1788
|
`
|
|
1736
|
-
)
|
|
1737
|
-
|
|
1789
|
+
).with(
|
|
1790
|
+
"all",
|
|
1791
|
+
() => import_outdent26.outdent`
|
|
1792
|
+
const [patternProps, restProps] = splitProps(props, ${JSON.stringify(props)})
|
|
1793
|
+
|
|
1794
|
+
const styleProps = ${styleFnName}(patternProps)
|
|
1795
|
+
const mergedProps = { ref, ...styleProps, ...restProps }
|
|
1796
|
+
|
|
1797
|
+
return createElement(${factoryName}.${jsxElement}, mergedProps)
|
|
1798
|
+
`
|
|
1799
|
+
).exhaustive()}
|
|
1800
|
+
})
|
|
1738
1801
|
`,
|
|
1739
1802
|
dts: import_outdent26.outdent`
|
|
1740
1803
|
import type { FunctionComponent } from 'react'
|
|
@@ -2044,7 +2107,7 @@ function generateSolidJsxFactory(ctx) {
|
|
|
2044
2107
|
var import_outdent31 = require("outdent");
|
|
2045
2108
|
var import_ts_pattern8 = require("ts-pattern");
|
|
2046
2109
|
function generateSolidJsxPattern(ctx, filters) {
|
|
2047
|
-
const { typeName, factoryName } = ctx.jsx;
|
|
2110
|
+
const { typeName, factoryName, styleProps: jsxStyleProps2 } = ctx.jsx;
|
|
2048
2111
|
const details = ctx.patterns.filterDetails(filters);
|
|
2049
2112
|
return details.map((pattern) => {
|
|
2050
2113
|
const { upperName, styleFnName, dashName, jsxName, props, blocklistType } = pattern;
|
|
@@ -2052,25 +2115,47 @@ function generateSolidJsxPattern(ctx, filters) {
|
|
|
2052
2115
|
return {
|
|
2053
2116
|
name: dashName,
|
|
2054
2117
|
js: import_outdent31.outdent`
|
|
2055
|
-
import {
|
|
2118
|
+
import { createMemo, mergeProps, splitProps } from 'solid-js'
|
|
2056
2119
|
import { createComponent } from 'solid-js/web'
|
|
2057
|
-
${ctx.file.import(
|
|
2120
|
+
${ctx.file.import("mergeCss", "../css/css")}
|
|
2058
2121
|
${ctx.file.import(styleFnName, `../patterns/${dashName}`)}
|
|
2122
|
+
${ctx.file.import(factoryName, "./factory")}
|
|
2059
2123
|
|
|
2060
|
-
export function ${jsxName}(props) {
|
|
2061
|
-
${(0, import_ts_pattern8.match)(
|
|
2062
|
-
|
|
2124
|
+
export const ${jsxName} = /* @__PURE__ */ function ${jsxName}(props) {
|
|
2125
|
+
${(0, import_ts_pattern8.match)(jsxStyleProps2).with(
|
|
2126
|
+
"none",
|
|
2063
2127
|
() => import_outdent31.outdent`
|
|
2064
|
-
|
|
2065
|
-
|
|
2128
|
+
const [patternProps, restProps] = splitProps(props, ${JSON.stringify(props)})
|
|
2129
|
+
|
|
2130
|
+
const styleProps = ${styleFnName}(patternProps)
|
|
2131
|
+
const Comp = ${factoryName}("${jsxElement}", { base: styleProps })
|
|
2132
|
+
|
|
2133
|
+
return createComponent(Comp, restProps)
|
|
2066
2134
|
`
|
|
2067
|
-
).
|
|
2135
|
+
).with(
|
|
2136
|
+
"minimal",
|
|
2068
2137
|
() => import_outdent31.outdent`
|
|
2069
|
-
|
|
2138
|
+
const [patternProps, restProps] = splitProps(props, ${JSON.stringify(props)})
|
|
2139
|
+
|
|
2140
|
+
const cssProps = createMemo(() => {
|
|
2070
2141
|
const styleProps = ${styleFnName}(patternProps)
|
|
2071
|
-
return
|
|
2142
|
+
return { css: mergeCss(styleProps, props.css) }
|
|
2143
|
+
})
|
|
2144
|
+
const mergedProps = mergeProps(restProps, cssProps)
|
|
2145
|
+
|
|
2146
|
+
return createComponent(${factoryName}.${jsxElement}, mergedProps)
|
|
2147
|
+
`
|
|
2148
|
+
).with(
|
|
2149
|
+
"all",
|
|
2150
|
+
() => import_outdent31.outdent`
|
|
2151
|
+
const [patternProps, restProps] = splitProps(props, ${JSON.stringify(props)})
|
|
2152
|
+
|
|
2153
|
+
const styleProps = ${styleFnName}(patternProps)
|
|
2154
|
+
const mergedProps = mergeProps(styleProps, restProps)
|
|
2155
|
+
|
|
2156
|
+
return createComponent(${factoryName}.${jsxElement}, mergedProps)
|
|
2072
2157
|
`
|
|
2073
|
-
)}
|
|
2158
|
+
).exhaustive()}
|
|
2074
2159
|
}
|
|
2075
2160
|
`,
|
|
2076
2161
|
dts: import_outdent31.outdent`
|
|
@@ -2297,7 +2382,7 @@ function generateVueJsxFactory(ctx) {
|
|
|
2297
2382
|
const combinedProps = computed(() => Object.assign({}, defaultProps, attrs))
|
|
2298
2383
|
|
|
2299
2384
|
const splittedProps = computed(() => {
|
|
2300
|
-
return splitProps(combinedProps.value, normalizeHTMLProps.keys,
|
|
2385
|
+
return splitProps(combinedProps.value, normalizeHTMLProps.keys, __shouldForwardProps__, __cvaFn__.variantKeys, isCssProperty)
|
|
2301
2386
|
})
|
|
2302
2387
|
|
|
2303
2388
|
const recipeClass = computed(() => {
|
|
@@ -2425,30 +2510,62 @@ function generateVueJsxStringLiteralFactory(ctx) {
|
|
|
2425
2510
|
|
|
2426
2511
|
// src/artifacts/vue-jsx/pattern.ts
|
|
2427
2512
|
var import_outdent37 = require("outdent");
|
|
2513
|
+
var import_ts_pattern9 = require("ts-pattern");
|
|
2428
2514
|
function generateVueJsxPattern(ctx, filters) {
|
|
2429
|
-
const { typeName, factoryName } = ctx.jsx;
|
|
2515
|
+
const { typeName, factoryName, styleProps: jsxStyleProps2 } = ctx.jsx;
|
|
2430
2516
|
const details = ctx.patterns.filterDetails(filters);
|
|
2431
2517
|
return details.map((pattern) => {
|
|
2432
2518
|
const { upperName, styleFnName, dashName, jsxName, props, blocklistType } = pattern;
|
|
2433
2519
|
const { description, jsxElement = "div" } = pattern.config;
|
|
2434
|
-
const propList = props.map((v) => JSON.stringify(v)).join(", ");
|
|
2435
2520
|
return {
|
|
2436
2521
|
name: dashName,
|
|
2437
2522
|
js: import_outdent37.outdent`
|
|
2438
2523
|
import { defineComponent, h, computed } from 'vue'
|
|
2439
|
-
${ctx.file.import(
|
|
2524
|
+
${ctx.file.import("mergeCss", "../css/css")}
|
|
2440
2525
|
${ctx.file.import(styleFnName, `../patterns/${dashName}`)}
|
|
2526
|
+
${ctx.file.import(factoryName, "./factory")}
|
|
2441
2527
|
|
|
2442
|
-
export const ${jsxName} = defineComponent({
|
|
2528
|
+
export const ${jsxName} = /* @__PURE__ */ defineComponent({
|
|
2443
2529
|
name: '${jsxName}',
|
|
2444
2530
|
inheritAttrs: false,
|
|
2445
|
-
props:
|
|
2531
|
+
props: ${JSON.stringify(props)},
|
|
2446
2532
|
setup(props, { attrs, slots }) {
|
|
2533
|
+
${(0, import_ts_pattern9.match)(jsxStyleProps2).with(
|
|
2534
|
+
"none",
|
|
2535
|
+
() => import_outdent37.outdent`
|
|
2536
|
+
const Comp = computed(() => {
|
|
2537
|
+
const styleProps = ${styleFnName}(props)
|
|
2538
|
+
return ${factoryName}("${jsxElement}", { base: styleProps })
|
|
2539
|
+
})
|
|
2540
|
+
|
|
2541
|
+
return () => {
|
|
2542
|
+
return h(Comp.value, attrs, slots)
|
|
2543
|
+
}
|
|
2544
|
+
`
|
|
2545
|
+
).with(
|
|
2546
|
+
"minimal",
|
|
2547
|
+
() => import_outdent37.outdent`
|
|
2548
|
+
const cssProps = computed(() => {
|
|
2549
|
+
const styleProps = ${styleFnName}(props)
|
|
2550
|
+
return { css: mergeCss(styleProps, attrs.css) }
|
|
2551
|
+
})
|
|
2552
|
+
|
|
2553
|
+
return () => {
|
|
2554
|
+
const mergedProps = { ...attrs, ...cssProps.value }
|
|
2555
|
+
return h(${factoryName}.${jsxElement}, mergedProps, slots)
|
|
2556
|
+
}
|
|
2557
|
+
`
|
|
2558
|
+
).with(
|
|
2559
|
+
"all",
|
|
2560
|
+
() => import_outdent37.outdent`
|
|
2447
2561
|
const styleProps = computed(() => ${styleFnName}(props))
|
|
2562
|
+
|
|
2448
2563
|
return () => {
|
|
2449
|
-
|
|
2450
|
-
|
|
2564
|
+
const mergedProps = { ...styleProps.value, ...attrs }
|
|
2565
|
+
return h(${factoryName}.${jsxElement}, mergedProps, slots)
|
|
2451
2566
|
}
|
|
2567
|
+
`
|
|
2568
|
+
).exhaustive()}
|
|
2452
2569
|
}
|
|
2453
2570
|
})
|
|
2454
2571
|
`,
|
|
@@ -2715,11 +2832,11 @@ var selectors_d_ts_default = {
|
|
|
2715
2832
|
|
|
2716
2833
|
// src/artifacts/generated/static-css.d.ts.json
|
|
2717
2834
|
var static_css_d_ts_default = {
|
|
2718
|
-
content: "interface
|
|
2835
|
+
content: "interface WithConditions {\n /**\n * The css conditions to generate for the rule.\n * @example ['hover', 'focus']\n */\n conditions?: string[]\n responsive?: boolean\n}\n\nexport interface CssRule extends WithConditions {\n /**\n * The css properties to generate utilities for.\n * @example ['margin', 'padding']\n */\n properties: {\n [property: string]: Array<string | number>\n }\n}\n\ninterface RecipeRuleVariants {\n [variant: string]: boolean | string[]\n}\n\nexport type RecipeRule = '*' | (RecipeRuleVariants & WithConditions)\nexport type PatternRule = '*' | CssRule\n\nexport interface StaticCssOptions {\n /**\n * The css utility classes to generate.\n */\n css?: CssRule[]\n /**\n * The css recipes to generate.\n */\n recipes?: {\n [recipe: string]: RecipeRule[]\n }\n /**\n * The css patterns to generate.\n */\n patterns?: {\n [pattern: string]: PatternRule[]\n }\n}\n"
|
|
2719
2836
|
};
|
|
2720
2837
|
|
|
2721
2838
|
// src/artifacts/types/generated.ts
|
|
2722
|
-
var
|
|
2839
|
+
var import_ts_pattern10 = require("ts-pattern");
|
|
2723
2840
|
function getGeneratedTypes(ctx) {
|
|
2724
2841
|
const rewriteImports = (code) => code.replace(/import\s+type\s+\{([^}]+)\}\s+from\s+['"]([^'"]+)['"]/g, ctx.file.importType("$1", "$2"));
|
|
2725
2842
|
return {
|
|
@@ -2737,7 +2854,7 @@ function getGeneratedSystemTypes(ctx) {
|
|
|
2737
2854
|
const rewriteImports = (code) => code.replace(/import\s+type\s+\{([^}]+)\}\s+from\s+['"]([^'"]+)['"]/g, ctx.file.importType("$1", "$2"));
|
|
2738
2855
|
return {
|
|
2739
2856
|
system: rewriteImports(
|
|
2740
|
-
(0,
|
|
2857
|
+
(0, import_ts_pattern10.match)(ctx.jsx.styleProps).with("all", () => system_types_d_ts_default.content).with(
|
|
2741
2858
|
"minimal",
|
|
2742
2859
|
() => system_types_d_ts_default.content.replace("WithHTMLProps<T>,", "T,").replace(jsxStyleProps, "export type JsxStyleProps = WithCss")
|
|
2743
2860
|
).with(
|
|
@@ -3180,11 +3297,11 @@ function setupJsxFactory(ctx) {
|
|
|
3180
3297
|
function setupJsxHelpers(ctx) {
|
|
3181
3298
|
if (!ctx.jsx.framework)
|
|
3182
3299
|
return;
|
|
3183
|
-
const
|
|
3300
|
+
const helpers = generatedJsxHelpers(ctx);
|
|
3184
3301
|
return {
|
|
3185
3302
|
id: "jsx-helpers",
|
|
3186
3303
|
dir: ctx.paths.jsx,
|
|
3187
|
-
files: [{ file: ctx.file.ext("factory-helper"), code:
|
|
3304
|
+
files: [{ file: ctx.file.ext("factory-helper"), code: helpers.js }]
|
|
3188
3305
|
};
|
|
3189
3306
|
}
|
|
3190
3307
|
function setupJsxPatterns(ctx, filters) {
|
|
@@ -3363,31 +3480,31 @@ var generateArtifacts = (ctx, ids) => {
|
|
|
3363
3480
|
};
|
|
3364
3481
|
|
|
3365
3482
|
// src/artifacts/css/global-css.ts
|
|
3366
|
-
var generateGlobalCss = (ctx) => {
|
|
3483
|
+
var generateGlobalCss = (ctx, sheet) => {
|
|
3367
3484
|
const { globalCss = {} } = ctx.config;
|
|
3368
|
-
|
|
3485
|
+
sheet.processGlobalCss({
|
|
3369
3486
|
":root": {
|
|
3370
3487
|
"--made-with-panda": `'\u{1F43C}'`
|
|
3371
3488
|
},
|
|
3372
3489
|
"*, *::before, *::after, ::backdrop": {
|
|
3373
|
-
"--blur": "
|
|
3374
|
-
"--brightness": "
|
|
3375
|
-
"--contrast": "
|
|
3376
|
-
"--grayscale": "
|
|
3377
|
-
"--hue-rotate": "
|
|
3378
|
-
"--invert": "
|
|
3379
|
-
"--saturate": "
|
|
3380
|
-
"--sepia": "
|
|
3381
|
-
"--drop-shadow": "
|
|
3382
|
-
"--backdrop-blur": "
|
|
3383
|
-
"--backdrop-brightness": "
|
|
3384
|
-
"--backdrop-contrast": "
|
|
3385
|
-
"--backdrop-grayscale": "
|
|
3386
|
-
"--backdrop-hue-rotate": "
|
|
3387
|
-
"--backdrop-invert": "
|
|
3388
|
-
"--backdrop-opacity": "
|
|
3389
|
-
"--backdrop-saturate": "
|
|
3390
|
-
"--backdrop-sepia": "
|
|
3490
|
+
"--blur": "/*-*/ /*-*/",
|
|
3491
|
+
"--brightness": "/*-*/ /*-*/",
|
|
3492
|
+
"--contrast": "/*-*/ /*-*/",
|
|
3493
|
+
"--grayscale": "/*-*/ /*-*/",
|
|
3494
|
+
"--hue-rotate": "/*-*/ /*-*/",
|
|
3495
|
+
"--invert": "/*-*/ /*-*/",
|
|
3496
|
+
"--saturate": "/*-*/ /*-*/",
|
|
3497
|
+
"--sepia": "/*-*/ /*-*/",
|
|
3498
|
+
"--drop-shadow": "/*-*/ /*-*/",
|
|
3499
|
+
"--backdrop-blur": "/*-*/ /*-*/",
|
|
3500
|
+
"--backdrop-brightness": "/*-*/ /*-*/",
|
|
3501
|
+
"--backdrop-contrast": "/*-*/ /*-*/",
|
|
3502
|
+
"--backdrop-grayscale": "/*-*/ /*-*/",
|
|
3503
|
+
"--backdrop-hue-rotate": "/*-*/ /*-*/",
|
|
3504
|
+
"--backdrop-invert": "/*-*/ /*-*/",
|
|
3505
|
+
"--backdrop-opacity": "/*-*/ /*-*/",
|
|
3506
|
+
"--backdrop-saturate": "/*-*/ /*-*/",
|
|
3507
|
+
"--backdrop-sepia": "/*-*/ /*-*/",
|
|
3391
3508
|
"--scroll-snap-strictness": "proximity",
|
|
3392
3509
|
"--border-spacing-x": 0,
|
|
3393
3510
|
"--border-spacing-y": 0,
|
|
@@ -3400,14 +3517,14 @@ var generateGlobalCss = (ctx) => {
|
|
|
3400
3517
|
"--scale-y": 1
|
|
3401
3518
|
}
|
|
3402
3519
|
});
|
|
3403
|
-
|
|
3520
|
+
sheet.processGlobalCss(globalCss);
|
|
3404
3521
|
void ctx.hooks.callHook("generator:css", "global.css", "");
|
|
3405
3522
|
};
|
|
3406
3523
|
|
|
3407
3524
|
// src/artifacts/css/keyframe-css.ts
|
|
3408
3525
|
var import_core2 = require("@pandacss/core");
|
|
3409
3526
|
var import_postcss = __toESM(require("postcss"));
|
|
3410
|
-
function generateKeyframeCss(ctx) {
|
|
3527
|
+
function generateKeyframeCss(ctx, sheet) {
|
|
3411
3528
|
const { keyframes = {} } = ctx.config.theme ?? {};
|
|
3412
3529
|
const root = import_postcss.default.root();
|
|
3413
3530
|
for (const [name, definition] of Object.entries(keyframes)) {
|
|
@@ -3419,93 +3536,32 @@ function generateKeyframeCss(ctx) {
|
|
|
3419
3536
|
})
|
|
3420
3537
|
);
|
|
3421
3538
|
}
|
|
3422
|
-
|
|
3539
|
+
sheet.layers.tokens.append(root);
|
|
3423
3540
|
void ctx.hooks.callHook("generator:css", "keyframes.css", "");
|
|
3424
3541
|
}
|
|
3425
3542
|
|
|
3426
3543
|
// src/artifacts/css/parser-css.ts
|
|
3427
3544
|
var import_logger2 = require("@pandacss/logger");
|
|
3428
|
-
var
|
|
3429
|
-
|
|
3430
|
-
|
|
3431
|
-
|
|
3432
|
-
|
|
3433
|
-
|
|
3434
|
-
|
|
3435
|
-
|
|
3436
|
-
|
|
3437
|
-
|
|
3438
|
-
|
|
3439
|
-
|
|
3440
|
-
|
|
3441
|
-
result.sva.forEach((sva) => {
|
|
3442
|
-
sva.data.forEach((data) => {
|
|
3443
|
-
ctx.stylesheet.processAtomicSlotRecipe(data);
|
|
3444
|
-
});
|
|
3445
|
-
});
|
|
3446
|
-
result.jsx.forEach((jsx) => {
|
|
3447
|
-
jsx.data.forEach((data) => {
|
|
3448
|
-
ctx.stylesheet.processStyleProps(filterProps(ctx, data));
|
|
3449
|
-
});
|
|
3450
|
-
});
|
|
3451
|
-
result.recipe.forEach((recipeSet, recipeName) => {
|
|
3452
|
-
try {
|
|
3453
|
-
for (const recipe of recipeSet) {
|
|
3454
|
-
const recipeConfig = recipes.getConfig(recipeName);
|
|
3455
|
-
if (!recipeConfig)
|
|
3456
|
-
continue;
|
|
3457
|
-
(0, import_ts_pattern10.match)(recipe).with({ type: "jsx-recipe" }, () => {
|
|
3458
|
-
recipe.data.forEach((data) => {
|
|
3459
|
-
const [recipeProps, styleProps] = recipes.splitProps(recipeName, data);
|
|
3460
|
-
ctx.stylesheet.processStyleProps(filterProps(ctx, styleProps));
|
|
3461
|
-
ctx.stylesheet.processRecipe(recipeName, recipeConfig, recipeProps);
|
|
3462
|
-
});
|
|
3463
|
-
}).otherwise(() => {
|
|
3464
|
-
recipe.data.forEach((data) => {
|
|
3465
|
-
ctx.stylesheet.processRecipe(recipeName, recipeConfig, data);
|
|
3466
|
-
});
|
|
3467
|
-
});
|
|
3468
|
-
}
|
|
3469
|
-
} catch (error) {
|
|
3470
|
-
import_logger2.logger.error("serializer:recipe", error);
|
|
3471
|
-
}
|
|
3472
|
-
});
|
|
3473
|
-
result.pattern.forEach((patternSet, name) => {
|
|
3474
|
-
try {
|
|
3475
|
-
for (const pattern of patternSet) {
|
|
3476
|
-
(0, import_ts_pattern10.match)(pattern).with({ type: "jsx-pattern", name: import_ts_pattern10.P.string }, ({ name: jsxName }) => {
|
|
3477
|
-
pattern.data.forEach((data) => {
|
|
3478
|
-
const fnName = patterns.find(jsxName);
|
|
3479
|
-
const styleProps = patterns.transform(fnName, data);
|
|
3480
|
-
ctx.stylesheet.processStyleProps(filterProps(ctx, styleProps));
|
|
3481
|
-
});
|
|
3482
|
-
}).otherwise(() => {
|
|
3483
|
-
pattern.data.forEach((data) => {
|
|
3484
|
-
const styleProps = patterns.transform(name, data);
|
|
3485
|
-
ctx.stylesheet.processAtomic(styleProps);
|
|
3486
|
-
});
|
|
3487
|
-
});
|
|
3488
|
-
}
|
|
3489
|
-
} catch (error) {
|
|
3490
|
-
import_logger2.logger.error("serializer:pattern", error);
|
|
3491
|
-
}
|
|
3492
|
-
});
|
|
3493
|
-
void ctx.hooks.callHook("parser:css", result.filePath ?? "", "");
|
|
3494
|
-
};
|
|
3495
|
-
var filterProps = (ctx, props) => {
|
|
3496
|
-
const clone = {};
|
|
3497
|
-
for (const [key, value] of Object.entries(props)) {
|
|
3498
|
-
if (ctx.isValidProperty(key)) {
|
|
3499
|
-
clone[key] = value;
|
|
3500
|
-
}
|
|
3545
|
+
var generateParserCss = (ctx, decoder, filePath) => {
|
|
3546
|
+
if (!decoder)
|
|
3547
|
+
return "";
|
|
3548
|
+
const sheet = ctx.createSheet();
|
|
3549
|
+
const { minify, optimize } = ctx.config;
|
|
3550
|
+
sheet.processDecoder(decoder);
|
|
3551
|
+
try {
|
|
3552
|
+
const css2 = sheet.toCss({ minify, optimize });
|
|
3553
|
+
ctx.hooks.callHook("parser:css", filePath ?? "", css2);
|
|
3554
|
+
return css2;
|
|
3555
|
+
} catch (err) {
|
|
3556
|
+
import_logger2.logger.error("serializer:css", "Failed to serialize CSS: " + err);
|
|
3557
|
+
return "";
|
|
3501
3558
|
}
|
|
3502
|
-
return clone;
|
|
3503
3559
|
};
|
|
3504
3560
|
|
|
3505
3561
|
// src/artifacts/css/reset-css.ts
|
|
3506
3562
|
var import_shared4 = require("@pandacss/shared");
|
|
3507
3563
|
var css = String.raw;
|
|
3508
|
-
function generateResetCss(ctx) {
|
|
3564
|
+
function generateResetCss(ctx, sheet) {
|
|
3509
3565
|
const { preflight } = ctx.config;
|
|
3510
3566
|
const scope = (0, import_shared4.isObject)(preflight) ? preflight.scope : void 0;
|
|
3511
3567
|
const selector = scope ? `${scope} ` : "";
|
|
@@ -3688,7 +3744,7 @@ function generateResetCss(ctx) {
|
|
|
3688
3744
|
${selector}input[type="search"],
|
|
3689
3745
|
${selector}input[type="password"] {
|
|
3690
3746
|
-webkit-appearance: none;
|
|
3691
|
-
-moz-appearance: none;
|
|
3747
|
+
-moz-appearance: none;
|
|
3692
3748
|
}
|
|
3693
3749
|
|
|
3694
3750
|
${selector}input[type='search'] {
|
|
@@ -3723,57 +3779,26 @@ function generateResetCss(ctx) {
|
|
|
3723
3779
|
outline: auto;
|
|
3724
3780
|
}
|
|
3725
3781
|
`;
|
|
3726
|
-
|
|
3782
|
+
sheet.layers.reset.append(output);
|
|
3727
3783
|
void ctx.hooks.callHook("generator:css", "reset.css", "");
|
|
3728
3784
|
}
|
|
3729
3785
|
|
|
3730
3786
|
// src/artifacts/css/static-css.ts
|
|
3731
|
-
var
|
|
3732
|
-
|
|
3733
|
-
const
|
|
3734
|
-
|
|
3735
|
-
|
|
3736
|
-
|
|
3737
|
-
|
|
3738
|
-
|
|
3739
|
-
|
|
3740
|
-
}
|
|
3741
|
-
});
|
|
3742
|
-
const getResult = (0, import_core3.getStaticCss)(staticCss);
|
|
3743
|
-
const results = getResult({
|
|
3744
|
-
breakpoints: Object.keys(theme.breakpoints ?? {}),
|
|
3745
|
-
getPropertyKeys: (prop) => {
|
|
3746
|
-
const propConfig = utility.config[prop];
|
|
3747
|
-
if (!propConfig)
|
|
3748
|
-
return [];
|
|
3749
|
-
const values = utility.getPropertyValues(propConfig);
|
|
3750
|
-
if (!values)
|
|
3751
|
-
return [];
|
|
3752
|
-
return Object.keys(values);
|
|
3753
|
-
},
|
|
3754
|
-
getRecipeKeys: (recipe) => {
|
|
3755
|
-
const recipeConfig = recipes.details.find((detail) => detail.baseName === recipe);
|
|
3756
|
-
return Object.assign({ __base: recipeConfig?.config.base }, recipeConfig?.variantKeyMap ?? {});
|
|
3757
|
-
}
|
|
3758
|
-
});
|
|
3759
|
-
results.css.forEach((css2) => {
|
|
3760
|
-
ctx.stylesheet.processAtomic(css2);
|
|
3761
|
-
});
|
|
3762
|
-
results.recipes.forEach((result) => {
|
|
3763
|
-
Object.entries(result).forEach(([name, value]) => {
|
|
3764
|
-
const recipeConfig = recipes.getConfig(name);
|
|
3765
|
-
if (!recipeConfig)
|
|
3766
|
-
return;
|
|
3767
|
-
ctx.stylesheet.processRecipe(name, recipeConfig, value);
|
|
3768
|
-
});
|
|
3769
|
-
});
|
|
3770
|
-
void ctx.hooks.callHook("generator:css", "static.css", "");
|
|
3787
|
+
var generateStaticCss = (ctx, sheet) => {
|
|
3788
|
+
const { config, staticCss } = ctx;
|
|
3789
|
+
const engine = staticCss.process(ctx.config.staticCss ?? {}, sheet);
|
|
3790
|
+
if (!sheet) {
|
|
3791
|
+
const { optimize = true, minify } = config;
|
|
3792
|
+
const output = engine.sheet.toCss({ optimize, minify });
|
|
3793
|
+
void ctx.hooks.callHook("generator:css", "static.css", output);
|
|
3794
|
+
return output;
|
|
3795
|
+
}
|
|
3771
3796
|
};
|
|
3772
3797
|
|
|
3773
3798
|
// src/artifacts/css/token-css.ts
|
|
3774
|
-
var
|
|
3799
|
+
var import_core3 = require("@pandacss/core");
|
|
3775
3800
|
var import_postcss2 = __toESM(require("postcss"));
|
|
3776
|
-
function generateTokenCss(ctx) {
|
|
3801
|
+
function generateTokenCss(ctx, sheet) {
|
|
3777
3802
|
const {
|
|
3778
3803
|
config: { cssVarRoot },
|
|
3779
3804
|
conditions,
|
|
@@ -3786,25 +3811,25 @@ function generateTokenCss(ctx) {
|
|
|
3786
3811
|
if (Object.keys(varsObj).length === 0)
|
|
3787
3812
|
continue;
|
|
3788
3813
|
if (key === "base") {
|
|
3789
|
-
const { css: css3 } = (0,
|
|
3814
|
+
const { css: css3 } = (0, import_core3.toCss)({ [root]: varsObj });
|
|
3790
3815
|
results.push(css3);
|
|
3791
3816
|
} else {
|
|
3792
3817
|
const keys = key.split(":");
|
|
3793
|
-
const { css: css3 } = (0,
|
|
3818
|
+
const { css: css3 } = (0, import_core3.toCss)(varsObj);
|
|
3794
3819
|
const mapped = keys.map((key2) => conditions.get(key2)).filter(Boolean).map((condition) => {
|
|
3795
|
-
const parent = (0,
|
|
3820
|
+
const parent = (0, import_core3.extractParentSelectors)(condition);
|
|
3796
3821
|
return parent ? `&${parent}` : condition;
|
|
3797
3822
|
});
|
|
3798
3823
|
const rule = getDeepestRule(root, mapped);
|
|
3799
3824
|
if (!rule)
|
|
3800
3825
|
continue;
|
|
3801
3826
|
getDeepestNode(rule)?.append(css3);
|
|
3802
|
-
results.push((0,
|
|
3827
|
+
results.push((0, import_core3.expandNestedCss)(rule.toString()));
|
|
3803
3828
|
}
|
|
3804
3829
|
}
|
|
3805
3830
|
let css2 = results.join("\n\n");
|
|
3806
3831
|
css2 = "\n\n" + cleanupSelectors(css2, root);
|
|
3807
|
-
|
|
3832
|
+
sheet.layers.tokens.append(css2);
|
|
3808
3833
|
void ctx.hooks.callHook("generator:css", "tokens.css", "");
|
|
3809
3834
|
}
|
|
3810
3835
|
function getDeepestRule(root, selectors) {
|
|
@@ -3854,11 +3879,7 @@ function cleanupSelectors(css2, varSelector) {
|
|
|
3854
3879
|
}
|
|
3855
3880
|
|
|
3856
3881
|
// src/engines/index.ts
|
|
3857
|
-
var
|
|
3858
|
-
var import_is_valid_prop3 = require("@pandacss/is-valid-prop");
|
|
3859
|
-
var import_shared7 = require("@pandacss/shared");
|
|
3860
|
-
var import_token_dictionary = require("@pandacss/token-dictionary");
|
|
3861
|
-
var import_lil_fp = require("lil-fp");
|
|
3882
|
+
var import_core4 = require("@pandacss/core");
|
|
3862
3883
|
|
|
3863
3884
|
// src/engines/file.ts
|
|
3864
3885
|
var FileEngine = class {
|
|
@@ -3976,214 +3997,22 @@ var PathEngine = class {
|
|
|
3976
3997
|
}
|
|
3977
3998
|
};
|
|
3978
3999
|
|
|
3979
|
-
// src/engines/pattern.ts
|
|
3980
|
-
var import_shared6 = require("@pandacss/shared");
|
|
3981
|
-
var helpers = { map: import_shared6.mapObject };
|
|
3982
|
-
var Patterns = class {
|
|
3983
|
-
patterns;
|
|
3984
|
-
details;
|
|
3985
|
-
constructor(config) {
|
|
3986
|
-
this.patterns = config.patterns ?? {};
|
|
3987
|
-
this.details = Object.entries(this.patterns).map(([name, pattern]) => this.createDetail(name, pattern));
|
|
3988
|
-
}
|
|
3989
|
-
createDetail(name, pattern) {
|
|
3990
|
-
const names = this.getNames(name);
|
|
3991
|
-
const jsx = (pattern.jsx ?? []).concat([names.jsxName]);
|
|
3992
|
-
return {
|
|
3993
|
-
...names,
|
|
3994
|
-
props: Object.keys(pattern?.properties ?? {}),
|
|
3995
|
-
blocklistType: pattern?.blocklist ? `| '${pattern.blocklist.join("' | '")}'` : "",
|
|
3996
|
-
config: pattern,
|
|
3997
|
-
type: "pattern",
|
|
3998
|
-
match: (0, import_shared6.createRegex)(jsx),
|
|
3999
|
-
jsx
|
|
4000
|
-
};
|
|
4001
|
-
}
|
|
4002
|
-
get keys() {
|
|
4003
|
-
return Object.keys(this.patterns);
|
|
4004
|
-
}
|
|
4005
|
-
getConfig(name) {
|
|
4006
|
-
return this.patterns[name];
|
|
4007
|
-
}
|
|
4008
|
-
transform(name, data) {
|
|
4009
|
-
return this.patterns[name]?.transform?.(data, helpers) ?? {};
|
|
4010
|
-
}
|
|
4011
|
-
getNames(name) {
|
|
4012
|
-
const upperName = (0, import_shared6.capitalize)(name);
|
|
4013
|
-
return {
|
|
4014
|
-
upperName,
|
|
4015
|
-
baseName: name,
|
|
4016
|
-
dashName: (0, import_shared6.dashCase)(name),
|
|
4017
|
-
styleFnName: `get${upperName}Style`,
|
|
4018
|
-
jsxName: this.patterns[name]?.jsxName ?? upperName
|
|
4019
|
-
};
|
|
4020
|
-
}
|
|
4021
|
-
find = (0, import_shared6.memo)((jsxName) => {
|
|
4022
|
-
return this.details.find((node) => node.match.test(jsxName))?.baseName ?? (0, import_shared6.uncapitalize)(jsxName);
|
|
4023
|
-
});
|
|
4024
|
-
filter = (0, import_shared6.memo)((jsxName) => {
|
|
4025
|
-
return this.details.filter((node) => node.match.test(jsxName));
|
|
4026
|
-
});
|
|
4027
|
-
isEmpty() {
|
|
4028
|
-
return this.keys.length === 0;
|
|
4029
|
-
}
|
|
4030
|
-
saveOne(name, pattern) {
|
|
4031
|
-
this.patterns[name] = pattern;
|
|
4032
|
-
const detailIndex = this.details.findIndex((detail) => detail.baseName === name);
|
|
4033
|
-
const updated = this.createDetail(name, pattern);
|
|
4034
|
-
if (detailIndex > -1) {
|
|
4035
|
-
this.details[detailIndex] = updated;
|
|
4036
|
-
} else {
|
|
4037
|
-
this.details.push(updated);
|
|
4038
|
-
}
|
|
4039
|
-
}
|
|
4040
|
-
remove(name) {
|
|
4041
|
-
delete this.patterns[name];
|
|
4042
|
-
const detailIndex = this.details.findIndex((detail) => detail.baseName === name);
|
|
4043
|
-
if (detailIndex > -1) {
|
|
4044
|
-
this.details.splice(detailIndex, 1);
|
|
4045
|
-
}
|
|
4046
|
-
}
|
|
4047
|
-
filterDetails(filters) {
|
|
4048
|
-
const patternDiffs = filters?.affecteds?.patterns;
|
|
4049
|
-
return patternDiffs ? this.details.filter((pattern) => patternDiffs.includes(pattern.dashName)) : this.details;
|
|
4050
|
-
}
|
|
4051
|
-
};
|
|
4052
|
-
|
|
4053
4000
|
// src/engines/index.ts
|
|
4054
|
-
var
|
|
4055
|
-
var defaults = (config) => ({
|
|
4056
|
-
cssVarRoot: ":where(:root, :host)",
|
|
4057
|
-
jsxFactory: "styled",
|
|
4058
|
-
jsxStyleProps: "all",
|
|
4059
|
-
outExtension: "mjs",
|
|
4060
|
-
shorthands: true,
|
|
4061
|
-
syntax: "object-literal",
|
|
4062
|
-
...config,
|
|
4063
|
-
layers: {
|
|
4064
|
-
reset: "reset",
|
|
4065
|
-
base: "base",
|
|
4066
|
-
tokens: "tokens",
|
|
4067
|
-
recipes: "recipes",
|
|
4068
|
-
utilities: "utilities",
|
|
4069
|
-
...config.layers
|
|
4070
|
-
}
|
|
4071
|
-
});
|
|
4072
|
-
var Context = class {
|
|
4001
|
+
var Context = class extends import_core4.CoreContext {
|
|
4073
4002
|
constructor(conf) {
|
|
4003
|
+
super(conf);
|
|
4074
4004
|
this.conf = conf;
|
|
4075
|
-
const config =
|
|
4076
|
-
const theme = config.theme ?? {};
|
|
4077
|
-
conf.config = config;
|
|
4078
|
-
this.tokens = this.createTokenDictionary(theme);
|
|
4079
|
-
this.utility = this.createUtility(config);
|
|
4080
|
-
this.conditions = this.createConditions(config);
|
|
4081
|
-
this.layers = this.createLayers(config.layers);
|
|
4082
|
-
this.patterns = new Patterns(config);
|
|
4005
|
+
const config = conf.config;
|
|
4083
4006
|
this.jsx = new JsxEngine(config);
|
|
4084
4007
|
this.paths = new PathEngine(config);
|
|
4085
4008
|
this.file = new FileEngine(config);
|
|
4086
|
-
this.studio = { outdir: `${config.outdir}-studio`, ...conf.config.studio };
|
|
4087
|
-
this.setupCompositions(theme);
|
|
4088
|
-
this.setupProperties();
|
|
4089
|
-
this.recipes = this.createRecipes(theme, this.baseSheetContext);
|
|
4090
|
-
this.stylesheet = this.createSheet();
|
|
4091
4009
|
}
|
|
4092
|
-
studio;
|
|
4093
|
-
// Engines
|
|
4094
|
-
tokens;
|
|
4095
|
-
utility;
|
|
4096
|
-
recipes;
|
|
4097
|
-
conditions;
|
|
4098
|
-
patterns;
|
|
4099
|
-
layers;
|
|
4100
4010
|
jsx;
|
|
4101
4011
|
paths;
|
|
4102
4012
|
file;
|
|
4103
|
-
stylesheet;
|
|
4104
|
-
// Props
|
|
4105
|
-
properties;
|
|
4106
|
-
isValidProperty;
|
|
4107
|
-
get config() {
|
|
4108
|
-
return this.conf.config;
|
|
4109
|
-
}
|
|
4110
|
-
get hooks() {
|
|
4111
|
-
return this.conf.hooks;
|
|
4112
|
-
}
|
|
4113
|
-
get isTemplateLiteralSyntax() {
|
|
4114
|
-
return this.config.syntax === "template-literal";
|
|
4115
|
-
}
|
|
4116
|
-
get hash() {
|
|
4117
|
-
return {
|
|
4118
|
-
tokens: (0, import_lil_fp.isBool)(this.config.hash) ? this.config.hash : this.config.hash?.cssVar,
|
|
4119
|
-
className: (0, import_lil_fp.isBool)(this.config.hash) ? this.config.hash : this.config.hash?.className
|
|
4120
|
-
};
|
|
4121
|
-
}
|
|
4122
|
-
get prefix() {
|
|
4123
|
-
return {
|
|
4124
|
-
tokens: (0, import_lil_fp.isStr)(this.config.prefix) ? this.config.prefix : this.config.prefix?.cssVar,
|
|
4125
|
-
className: (0, import_lil_fp.isStr)(this.config.prefix) ? this.config.prefix : this.config.prefix?.className
|
|
4126
|
-
};
|
|
4127
|
-
}
|
|
4128
|
-
createTokenDictionary(theme) {
|
|
4129
|
-
return new import_token_dictionary.TokenDictionary({
|
|
4130
|
-
breakpoints: theme.breakpoints,
|
|
4131
|
-
tokens: theme.tokens,
|
|
4132
|
-
semanticTokens: theme.semanticTokens,
|
|
4133
|
-
prefix: this.prefix.tokens,
|
|
4134
|
-
hash: this.hash.tokens
|
|
4135
|
-
});
|
|
4136
|
-
}
|
|
4137
|
-
createUtility(config) {
|
|
4138
|
-
return new import_core5.Utility({
|
|
4139
|
-
prefix: this.prefix.className,
|
|
4140
|
-
tokens: this.tokens,
|
|
4141
|
-
config: this.isTemplateLiteralSyntax ? {} : config.utilities,
|
|
4142
|
-
separator: config.separator,
|
|
4143
|
-
shorthands: config.shorthands,
|
|
4144
|
-
strictTokens: config.strictTokens
|
|
4145
|
-
});
|
|
4146
|
-
}
|
|
4147
|
-
createConditions(config) {
|
|
4148
|
-
return new import_core5.Conditions({
|
|
4149
|
-
conditions: config.conditions,
|
|
4150
|
-
breakpoints: config.theme?.breakpoints
|
|
4151
|
-
});
|
|
4152
|
-
}
|
|
4153
|
-
createLayers(layers) {
|
|
4154
|
-
return new import_core5.Layers(layers);
|
|
4155
|
-
}
|
|
4156
|
-
setupCompositions(theme) {
|
|
4157
|
-
const { textStyles, layerStyles } = theme;
|
|
4158
|
-
const compositions = (0, import_shared7.compact)({ textStyle: textStyles, layerStyle: layerStyles });
|
|
4159
|
-
(0, import_core5.assignCompositions)(compositions, { conditions: this.conditions, utility: this.utility });
|
|
4160
|
-
}
|
|
4161
|
-
setupProperties() {
|
|
4162
|
-
this.properties = /* @__PURE__ */ new Set(["css", ...this.utility.keys(), ...this.conditions.keys()]);
|
|
4163
|
-
this.isValidProperty = (0, import_shared7.memo)((key) => this.properties.has(key) || (0, import_is_valid_prop3.isCssProperty)(key));
|
|
4164
|
-
}
|
|
4165
|
-
get baseSheetContext() {
|
|
4166
|
-
return {
|
|
4167
|
-
conditions: this.conditions,
|
|
4168
|
-
layers: this.layers,
|
|
4169
|
-
utility: this.utility,
|
|
4170
|
-
helpers: helpers2,
|
|
4171
|
-
hash: this.hash.className
|
|
4172
|
-
};
|
|
4173
|
-
}
|
|
4174
|
-
createSheet() {
|
|
4175
|
-
return new import_core5.Stylesheet({
|
|
4176
|
-
...this.baseSheetContext,
|
|
4177
|
-
recipes: this.recipes
|
|
4178
|
-
});
|
|
4179
|
-
}
|
|
4180
|
-
createRecipes(theme, context) {
|
|
4181
|
-
const recipeConfigs = Object.assign({}, theme.recipes ?? {}, theme.slotRecipes ?? {});
|
|
4182
|
-
return new import_core5.Recipes(recipeConfigs, context);
|
|
4183
|
-
}
|
|
4184
4013
|
};
|
|
4185
4014
|
|
|
4186
|
-
// src/
|
|
4015
|
+
// src/import-map.ts
|
|
4187
4016
|
var getImportMap = (outdir, configImportMap) => {
|
|
4188
4017
|
if (typeof configImportMap === "string") {
|
|
4189
4018
|
return {
|
|
@@ -4201,14 +4030,16 @@ var getImportMap = (outdir, configImportMap) => {
|
|
|
4201
4030
|
jsx: jsx ? [jsx] : [outdir, "jsx"]
|
|
4202
4031
|
};
|
|
4203
4032
|
};
|
|
4033
|
+
|
|
4034
|
+
// src/parser-options.ts
|
|
4204
4035
|
var getParserOptions = (ctx) => {
|
|
4205
4036
|
const { config, jsx, isValidProperty, patterns, recipes } = ctx;
|
|
4206
|
-
const
|
|
4207
|
-
const compilerOptions = tsconfig?.compilerOptions ?? {};
|
|
4037
|
+
const compilerOptions = ctx.conf.tsconfig?.compilerOptions ?? {};
|
|
4208
4038
|
const baseUrl = compilerOptions.baseUrl ?? "";
|
|
4209
4039
|
const cwd = config.cwd;
|
|
4210
4040
|
const relativeBaseUrl = baseUrl !== cwd ? baseUrl.replace(cwd, "").slice(1) : cwd;
|
|
4211
4041
|
return {
|
|
4042
|
+
hash: ctx.hash,
|
|
4212
4043
|
importMap: getImportMap(config.outdir.replace(relativeBaseUrl, ""), config.importMap),
|
|
4213
4044
|
jsx: {
|
|
4214
4045
|
framework: jsx.framework,
|
|
@@ -4217,12 +4048,14 @@ var getParserOptions = (ctx) => {
|
|
|
4217
4048
|
isStyleProp: isValidProperty,
|
|
4218
4049
|
nodes: [...patterns.details, ...recipes.details]
|
|
4219
4050
|
},
|
|
4220
|
-
|
|
4221
|
-
|
|
4222
|
-
|
|
4223
|
-
|
|
4051
|
+
syntax: config.syntax,
|
|
4052
|
+
isValidProperty,
|
|
4053
|
+
recipes,
|
|
4054
|
+
patterns,
|
|
4055
|
+
encoder: ctx.encoder,
|
|
4224
4056
|
compilerOptions,
|
|
4225
|
-
tsOptions
|
|
4057
|
+
tsOptions: ctx.conf.tsOptions,
|
|
4058
|
+
join: (...paths) => paths.join("/")
|
|
4226
4059
|
};
|
|
4227
4060
|
};
|
|
4228
4061
|
|
|
@@ -4235,41 +4068,42 @@ var Generator = class extends Context {
|
|
|
4235
4068
|
this.parserOptions = getParserOptions(this);
|
|
4236
4069
|
this.messages = getMessages(this);
|
|
4237
4070
|
}
|
|
4238
|
-
getArtifacts(ids) {
|
|
4071
|
+
getArtifacts = (ids) => {
|
|
4239
4072
|
return generateArtifacts(this, ids);
|
|
4240
|
-
}
|
|
4241
|
-
|
|
4242
|
-
(0, import_ts_pattern11.match)(type).with("preflight", () => generateResetCss(this)).with("tokens", () => generateTokenCss(this)).with("static", () => generateStaticCss(this)).with("global", () => generateGlobalCss(this)).with("keyframes", () => generateKeyframeCss(this)).otherwise(() => {
|
|
4073
|
+
};
|
|
4074
|
+
appendCssOfType = (type, sheet) => {
|
|
4075
|
+
(0, import_ts_pattern11.match)(type).with("preflight", () => generateResetCss(this, sheet)).with("tokens", () => generateTokenCss(this, sheet)).with("static", () => generateStaticCss(this, sheet)).with("global", () => generateGlobalCss(this, sheet)).with("keyframes", () => generateKeyframeCss(this, sheet)).otherwise(() => {
|
|
4243
4076
|
throw new Error(`Unknown css artifact type <${type}>`);
|
|
4244
4077
|
});
|
|
4245
|
-
}
|
|
4246
|
-
appendLayerParams() {
|
|
4247
|
-
|
|
4248
|
-
}
|
|
4249
|
-
appendBaselineCss() {
|
|
4078
|
+
};
|
|
4079
|
+
appendLayerParams = (sheet) => {
|
|
4080
|
+
sheet.layers.root.prepend(sheet.layers.params);
|
|
4081
|
+
};
|
|
4082
|
+
appendBaselineCss = (sheet) => {
|
|
4250
4083
|
if (this.config.preflight)
|
|
4251
|
-
this.
|
|
4084
|
+
this.appendCssOfType("preflight", sheet);
|
|
4252
4085
|
if (!this.tokens.isEmpty)
|
|
4253
|
-
this.
|
|
4086
|
+
this.appendCssOfType("tokens", sheet);
|
|
4254
4087
|
if (this.config.staticCss)
|
|
4255
|
-
this.
|
|
4256
|
-
this.
|
|
4088
|
+
this.appendCssOfType("static", sheet);
|
|
4089
|
+
this.appendCssOfType("global", sheet);
|
|
4257
4090
|
if (this.config.theme?.keyframes)
|
|
4258
|
-
this.
|
|
4259
|
-
}
|
|
4260
|
-
appendParserCss(
|
|
4261
|
-
|
|
4262
|
-
|
|
4263
|
-
|
|
4264
|
-
|
|
4265
|
-
|
|
4266
|
-
}
|
|
4267
|
-
getCss() {
|
|
4268
|
-
|
|
4091
|
+
this.appendCssOfType("keyframes", sheet);
|
|
4092
|
+
};
|
|
4093
|
+
appendParserCss = (sheet) => {
|
|
4094
|
+
const decoder = this.decoder.collect(this.encoder);
|
|
4095
|
+
sheet.processDecoder(decoder);
|
|
4096
|
+
};
|
|
4097
|
+
getParserCss = (decoder, filePath) => {
|
|
4098
|
+
return generateParserCss(this, decoder, filePath);
|
|
4099
|
+
};
|
|
4100
|
+
getCss = (stylesheet) => {
|
|
4101
|
+
const sheet = stylesheet ?? this.createSheet();
|
|
4102
|
+
return sheet.toCss({
|
|
4269
4103
|
optimize: true,
|
|
4270
4104
|
minify: this.config.minify
|
|
4271
4105
|
});
|
|
4272
|
-
}
|
|
4106
|
+
};
|
|
4273
4107
|
};
|
|
4274
4108
|
// Annotate the CommonJS export names for ESM import in node:
|
|
4275
4109
|
0 && (module.exports = {
|