@pandacss/generator 0.22.1 → 0.23.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 +11 -1
- package/dist/index.d.ts +11 -1
- package/dist/index.js +181 -63
- package/dist/index.mjs +181 -63
- package/package.json +8 -9
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as _pandacss_types from '@pandacss/types';
|
|
2
2
|
import { UserConfig, PatternConfig, Dict, ArtifactFilters, ConfigResultWithHooks, RequiredBy, StudioOptions, HashOptions, PrefixOptions, Theme, CascadeLayers, TSConfig, ArtifactId, ParserResultType } from '@pandacss/types';
|
|
3
3
|
import { Utility, Recipes, Conditions, Layers, Stylesheet, RecipeContext, RecipeNode } from '@pandacss/core';
|
|
4
|
+
import { mapObject } from '@pandacss/shared';
|
|
4
5
|
import { TokenDictionary } from '@pandacss/token-dictionary';
|
|
5
6
|
|
|
6
7
|
declare class FileEngine {
|
|
@@ -108,7 +109,15 @@ declare class Context {
|
|
|
108
109
|
createLayers(layers: CascadeLayers): Layers;
|
|
109
110
|
setupCompositions(theme: Theme): void;
|
|
110
111
|
setupProperties(): void;
|
|
111
|
-
|
|
112
|
+
get baseSheetContext(): {
|
|
113
|
+
conditions: Conditions;
|
|
114
|
+
layers: Layers;
|
|
115
|
+
utility: Utility;
|
|
116
|
+
helpers: {
|
|
117
|
+
map: typeof mapObject;
|
|
118
|
+
};
|
|
119
|
+
hash: boolean | undefined;
|
|
120
|
+
};
|
|
112
121
|
createSheet(): Stylesheet;
|
|
113
122
|
createRecipes(theme: Theme, context: RecipeContext): Recipes;
|
|
114
123
|
}
|
|
@@ -175,6 +184,7 @@ interface ParserJsxOptions {
|
|
|
175
184
|
interface ParserOptions {
|
|
176
185
|
importMap: ParserImportMap;
|
|
177
186
|
jsx: ParserJsxOptions;
|
|
187
|
+
isTemplateLiteralSyntax: boolean;
|
|
178
188
|
patternKeys: Context['patterns']['keys'];
|
|
179
189
|
recipeKeys: Context['recipes']['keys'];
|
|
180
190
|
getRecipesByJsxName: Context['recipes']['filter'];
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as _pandacss_types from '@pandacss/types';
|
|
2
2
|
import { UserConfig, PatternConfig, Dict, ArtifactFilters, ConfigResultWithHooks, RequiredBy, StudioOptions, HashOptions, PrefixOptions, Theme, CascadeLayers, TSConfig, ArtifactId, ParserResultType } from '@pandacss/types';
|
|
3
3
|
import { Utility, Recipes, Conditions, Layers, Stylesheet, RecipeContext, RecipeNode } from '@pandacss/core';
|
|
4
|
+
import { mapObject } from '@pandacss/shared';
|
|
4
5
|
import { TokenDictionary } from '@pandacss/token-dictionary';
|
|
5
6
|
|
|
6
7
|
declare class FileEngine {
|
|
@@ -108,7 +109,15 @@ declare class Context {
|
|
|
108
109
|
createLayers(layers: CascadeLayers): Layers;
|
|
109
110
|
setupCompositions(theme: Theme): void;
|
|
110
111
|
setupProperties(): void;
|
|
111
|
-
|
|
112
|
+
get baseSheetContext(): {
|
|
113
|
+
conditions: Conditions;
|
|
114
|
+
layers: Layers;
|
|
115
|
+
utility: Utility;
|
|
116
|
+
helpers: {
|
|
117
|
+
map: typeof mapObject;
|
|
118
|
+
};
|
|
119
|
+
hash: boolean | undefined;
|
|
120
|
+
};
|
|
112
121
|
createSheet(): Stylesheet;
|
|
113
122
|
createRecipes(theme: Theme, context: RecipeContext): Recipes;
|
|
114
123
|
}
|
|
@@ -175,6 +184,7 @@ interface ParserJsxOptions {
|
|
|
175
184
|
interface ParserOptions {
|
|
176
185
|
importMap: ParserImportMap;
|
|
177
186
|
jsx: ParserJsxOptions;
|
|
187
|
+
isTemplateLiteralSyntax: boolean;
|
|
178
188
|
patternKeys: Context['patterns']['keys'];
|
|
179
189
|
recipeKeys: Context['recipes']['keys'];
|
|
180
190
|
getRecipesByJsxName: Context['recipes']['filter'];
|
package/dist/index.js
CHANGED
|
@@ -132,7 +132,7 @@ var getMessages = (ctx) => ({
|
|
|
132
132
|
});
|
|
133
133
|
|
|
134
134
|
// src/generator.ts
|
|
135
|
-
var
|
|
135
|
+
var import_ts_pattern12 = require("ts-pattern");
|
|
136
136
|
|
|
137
137
|
// src/artifacts/setup-artifacts.ts
|
|
138
138
|
var import_outdent44 = __toESM(require("outdent"));
|
|
@@ -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",
|
|
1116
1123
|
() => import_outdent16.outdent`
|
|
1117
|
-
const
|
|
1118
|
-
|
|
1119
|
-
|
|
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)
|
|
1120
1131
|
`
|
|
1121
|
-
)
|
|
1132
|
+
).with(
|
|
1133
|
+
"all",
|
|
1134
|
+
() => import_outdent16.outdent`
|
|
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)
|
|
1141
|
+
`
|
|
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)
|
|
1456
|
+
`
|
|
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)
|
|
1424
1466
|
`
|
|
1425
|
-
)}
|
|
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",
|
|
1770
|
+
() => import_outdent26.outdent`
|
|
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 })
|
|
1777
|
+
`
|
|
1778
|
+
).with(
|
|
1779
|
+
"minimal",
|
|
1726
1780
|
() => import_outdent26.outdent`
|
|
1727
|
-
|
|
1728
|
-
|
|
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)
|
|
1729
1788
|
`
|
|
1730
|
-
).
|
|
1789
|
+
).with(
|
|
1790
|
+
"all",
|
|
1731
1791
|
() => import_outdent26.outdent`
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
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)
|
|
1735
1798
|
`
|
|
1736
|
-
)}
|
|
1737
|
-
|
|
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)
|
|
2072
2147
|
`
|
|
2073
|
-
)
|
|
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)
|
|
2157
|
+
`
|
|
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
|
`,
|
|
@@ -2719,7 +2836,7 @@ var static_css_d_ts_default = {
|
|
|
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(
|
|
@@ -3425,7 +3542,7 @@ function generateKeyframeCss(ctx) {
|
|
|
3425
3542
|
|
|
3426
3543
|
// src/artifacts/css/parser-css.ts
|
|
3427
3544
|
var import_logger2 = require("@pandacss/logger");
|
|
3428
|
-
var
|
|
3545
|
+
var import_ts_pattern11 = require("ts-pattern");
|
|
3429
3546
|
var generateParserCss = (ctx, result) => {
|
|
3430
3547
|
const { patterns, recipes } = ctx;
|
|
3431
3548
|
result.css.forEach((css2) => {
|
|
@@ -3454,7 +3571,7 @@ var generateParserCss = (ctx, result) => {
|
|
|
3454
3571
|
const recipeConfig = recipes.getConfig(recipeName);
|
|
3455
3572
|
if (!recipeConfig)
|
|
3456
3573
|
continue;
|
|
3457
|
-
(0,
|
|
3574
|
+
(0, import_ts_pattern11.match)(recipe).with({ type: "jsx-recipe" }, () => {
|
|
3458
3575
|
recipe.data.forEach((data) => {
|
|
3459
3576
|
const [recipeProps, styleProps] = recipes.splitProps(recipeName, data);
|
|
3460
3577
|
ctx.stylesheet.processStyleProps(filterProps(ctx, styleProps));
|
|
@@ -3473,7 +3590,7 @@ var generateParserCss = (ctx, result) => {
|
|
|
3473
3590
|
result.pattern.forEach((patternSet, name) => {
|
|
3474
3591
|
try {
|
|
3475
3592
|
for (const pattern of patternSet) {
|
|
3476
|
-
(0,
|
|
3593
|
+
(0, import_ts_pattern11.match)(pattern).with({ type: "jsx-pattern", name: import_ts_pattern11.P.string }, ({ name: jsxName }) => {
|
|
3477
3594
|
pattern.data.forEach((data) => {
|
|
3478
3595
|
const fnName = patterns.find(jsxName);
|
|
3479
3596
|
const styleProps = patterns.transform(fnName, data);
|
|
@@ -4138,7 +4255,7 @@ var Context = class {
|
|
|
4138
4255
|
return new import_core5.Utility({
|
|
4139
4256
|
prefix: this.prefix.className,
|
|
4140
4257
|
tokens: this.tokens,
|
|
4141
|
-
config: this.isTemplateLiteralSyntax ? {} : config.utilities,
|
|
4258
|
+
config: this.isTemplateLiteralSyntax ? {} : Object.assign({}, config.utilities),
|
|
4142
4259
|
separator: config.separator,
|
|
4143
4260
|
shorthands: config.shorthands,
|
|
4144
4261
|
strictTokens: config.strictTokens
|
|
@@ -4217,6 +4334,7 @@ var getParserOptions = (ctx) => {
|
|
|
4217
4334
|
isStyleProp: isValidProperty,
|
|
4218
4335
|
nodes: [...patterns.details, ...recipes.details]
|
|
4219
4336
|
},
|
|
4337
|
+
isTemplateLiteralSyntax: ctx.isTemplateLiteralSyntax,
|
|
4220
4338
|
patternKeys: patterns.keys,
|
|
4221
4339
|
recipeKeys: recipes.keys,
|
|
4222
4340
|
getRecipesByJsxName: recipes.filter,
|
|
@@ -4239,7 +4357,7 @@ var Generator = class extends Context {
|
|
|
4239
4357
|
return generateArtifacts(this, ids);
|
|
4240
4358
|
}
|
|
4241
4359
|
appendCss(type) {
|
|
4242
|
-
(0,
|
|
4360
|
+
(0, import_ts_pattern12.match)(type).with("preflight", () => generateResetCss(this)).with("tokens", () => generateTokenCss(this)).with("static", () => generateStaticCss(this)).with("global", () => generateGlobalCss(this)).with("keyframes", () => generateKeyframeCss(this)).otherwise(() => {
|
|
4243
4361
|
throw new Error(`Unknown css artifact type <${type}>`);
|
|
4244
4362
|
});
|
|
4245
4363
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -101,7 +101,7 @@ var getMessages = (ctx) => ({
|
|
|
101
101
|
});
|
|
102
102
|
|
|
103
103
|
// src/generator.ts
|
|
104
|
-
import { match as
|
|
104
|
+
import { match as match12 } from "ts-pattern";
|
|
105
105
|
|
|
106
106
|
// src/artifacts/setup-artifacts.ts
|
|
107
107
|
import outdent44 from "outdent";
|
|
@@ -1061,7 +1061,7 @@ function generatePreactJsxFactory(ctx) {
|
|
|
1061
1061
|
import { outdent as outdent16 } from "outdent";
|
|
1062
1062
|
import { match as match5 } from "ts-pattern";
|
|
1063
1063
|
function generatePreactJsxPattern(ctx, filters) {
|
|
1064
|
-
const { typeName, factoryName } = ctx.jsx;
|
|
1064
|
+
const { typeName, factoryName, styleProps: jsxStyleProps2 } = ctx.jsx;
|
|
1065
1065
|
const details = ctx.patterns.filterDetails(filters);
|
|
1066
1066
|
return details.map((pattern) => {
|
|
1067
1067
|
const { upperName, styleFnName, dashName, jsxName, props, blocklistType } = pattern;
|
|
@@ -1071,23 +1071,44 @@ function generatePreactJsxPattern(ctx, filters) {
|
|
|
1071
1071
|
js: outdent16`
|
|
1072
1072
|
import { h } from 'preact'
|
|
1073
1073
|
import { forwardRef } from 'preact/compat'
|
|
1074
|
-
${ctx.file.import(
|
|
1074
|
+
${ctx.file.import("mergeCss", "../css/css")}
|
|
1075
|
+
${ctx.file.import("splitProps", "../helpers")}
|
|
1075
1076
|
${ctx.file.import(styleFnName, `../patterns/${dashName}`)}
|
|
1077
|
+
${ctx.file.import(factoryName, "./factory")}
|
|
1076
1078
|
|
|
1077
1079
|
export const ${jsxName} = /* @__PURE__ */ forwardRef(function ${jsxName}(props, ref) {
|
|
1078
|
-
${match5(
|
|
1079
|
-
|
|
1080
|
+
${match5(jsxStyleProps2).with(
|
|
1081
|
+
"none",
|
|
1080
1082
|
() => outdent16`
|
|
1081
|
-
const
|
|
1082
|
-
|
|
1083
|
+
const [patternProps, restProps] = splitProps(props, ${JSON.stringify(props)})
|
|
1084
|
+
|
|
1085
|
+
const styleProps = ${styleFnName}(patternProps)
|
|
1086
|
+
const Comp = ${factoryName}("${jsxElement}", { base: styleProps })
|
|
1087
|
+
|
|
1088
|
+
return h(Comp, { ref, ...restProps })
|
|
1089
|
+
`
|
|
1090
|
+
).with(
|
|
1091
|
+
"minimal",
|
|
1092
|
+
() => outdent16`
|
|
1093
|
+
const [patternProps, restProps] = splitProps(props, ${JSON.stringify(props)})
|
|
1094
|
+
|
|
1095
|
+
const styleProps = ${styleFnName}(patternProps)
|
|
1096
|
+
const cssProps = { css: mergeCss(styleProps, props.css) }
|
|
1097
|
+
const mergedProps = { ref, ...restProps, ...cssProps }
|
|
1098
|
+
|
|
1099
|
+
return h(${factoryName}.${jsxElement}, mergedProps)
|
|
1083
1100
|
`
|
|
1084
|
-
).
|
|
1101
|
+
).with(
|
|
1102
|
+
"all",
|
|
1085
1103
|
() => outdent16`
|
|
1086
|
-
const
|
|
1087
|
-
|
|
1088
|
-
|
|
1104
|
+
const [patternProps, restProps] = splitProps(props, ${JSON.stringify(props)})
|
|
1105
|
+
|
|
1106
|
+
const styleProps = ${styleFnName}(patternProps)
|
|
1107
|
+
const mergedProps = { ref, ...styleProps, ...restProps }
|
|
1108
|
+
|
|
1109
|
+
return h(${factoryName}.${jsxElement}, mergedProps)
|
|
1089
1110
|
`
|
|
1090
|
-
)}
|
|
1111
|
+
).exhaustive()}
|
|
1091
1112
|
})
|
|
1092
1113
|
`,
|
|
1093
1114
|
dts: outdent16`
|
|
@@ -1366,7 +1387,7 @@ function generateQwikJsxFactory(ctx) {
|
|
|
1366
1387
|
import { outdent as outdent21 } from "outdent";
|
|
1367
1388
|
import { match as match6 } from "ts-pattern";
|
|
1368
1389
|
function generateQwikJsxPattern(ctx, filters) {
|
|
1369
|
-
const { typeName, factoryName } = ctx.jsx;
|
|
1390
|
+
const { typeName, factoryName, styleProps: jsxStyleProps2 } = ctx.jsx;
|
|
1370
1391
|
const details = ctx.patterns.filterDetails(filters);
|
|
1371
1392
|
return details.map((pattern) => {
|
|
1372
1393
|
const { upperName, styleFnName, dashName, jsxName, props, blocklistType } = pattern;
|
|
@@ -1375,23 +1396,44 @@ function generateQwikJsxPattern(ctx, filters) {
|
|
|
1375
1396
|
name: dashName,
|
|
1376
1397
|
js: outdent21`
|
|
1377
1398
|
import { h } from '@builder.io/qwik'
|
|
1378
|
-
${ctx.file.import(
|
|
1399
|
+
${ctx.file.import("mergeCss", "../css/css")}
|
|
1400
|
+
${ctx.file.import("splitProps", "../helpers")}
|
|
1379
1401
|
${ctx.file.import(styleFnName, `../patterns/${dashName}`)}
|
|
1402
|
+
${ctx.file.import(factoryName, "./factory")}
|
|
1380
1403
|
|
|
1381
|
-
export const ${jsxName} = function ${jsxName}(props) {
|
|
1382
|
-
${match6(
|
|
1383
|
-
|
|
1404
|
+
export const ${jsxName} = /* @__PURE__ */ function ${jsxName}(props) {
|
|
1405
|
+
${match6(jsxStyleProps2).with(
|
|
1406
|
+
"none",
|
|
1384
1407
|
() => outdent21`
|
|
1385
|
-
|
|
1386
|
-
|
|
1408
|
+
const [patternProps, restProps] = splitProps(props, ${JSON.stringify(props)})
|
|
1409
|
+
|
|
1410
|
+
const styleProps = ${styleFnName}(patternProps)
|
|
1411
|
+
const Comp = ${factoryName}("${jsxElement}", { base: styleProps })
|
|
1412
|
+
|
|
1413
|
+
return h(Comp, restProps)
|
|
1387
1414
|
`
|
|
1388
|
-
).
|
|
1415
|
+
).with(
|
|
1416
|
+
"minimal",
|
|
1389
1417
|
() => outdent21`
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1418
|
+
const [patternProps, restProps] = splitProps(props, ${JSON.stringify(props)})
|
|
1419
|
+
|
|
1420
|
+
const styleProps = ${styleFnName}(patternProps)
|
|
1421
|
+
const cssProps = { css: mergeCss(styleProps, props.css) }
|
|
1422
|
+
const mergedProps = { ...restProps, ...cssProps }
|
|
1423
|
+
|
|
1424
|
+
return h(${factoryName}.${jsxElement}, mergedProps)
|
|
1393
1425
|
`
|
|
1394
|
-
)
|
|
1426
|
+
).with(
|
|
1427
|
+
"all",
|
|
1428
|
+
() => outdent21`
|
|
1429
|
+
const [patternProps, restProps] = splitProps(props, ${JSON.stringify(props)})
|
|
1430
|
+
|
|
1431
|
+
const styleProps = ${styleFnName}(patternProps)
|
|
1432
|
+
const mergedProps = { ...styleProps, ...restProps }
|
|
1433
|
+
|
|
1434
|
+
return h(${factoryName}.${jsxElement}, mergedProps)
|
|
1435
|
+
`
|
|
1436
|
+
).exhaustive()}
|
|
1395
1437
|
}
|
|
1396
1438
|
`,
|
|
1397
1439
|
dts: outdent21`
|
|
@@ -1677,7 +1719,7 @@ function generateReactJsxFactory(ctx) {
|
|
|
1677
1719
|
import { outdent as outdent26 } from "outdent";
|
|
1678
1720
|
import { match as match7 } from "ts-pattern";
|
|
1679
1721
|
function generateReactJsxPattern(ctx, filters) {
|
|
1680
|
-
const { typeName, factoryName } = ctx.jsx;
|
|
1722
|
+
const { typeName, factoryName, styleProps: jsxStyleProps2 } = ctx.jsx;
|
|
1681
1723
|
const details = ctx.patterns.filterDetails(filters);
|
|
1682
1724
|
return details.map((pattern) => {
|
|
1683
1725
|
const { upperName, styleFnName, dashName, jsxName, props, blocklistType } = pattern;
|
|
@@ -1686,24 +1728,45 @@ function generateReactJsxPattern(ctx, filters) {
|
|
|
1686
1728
|
name: dashName,
|
|
1687
1729
|
js: outdent26`
|
|
1688
1730
|
import { createElement, forwardRef } from 'react'
|
|
1689
|
-
${ctx.file.import(
|
|
1731
|
+
${ctx.file.import("mergeCss", "../css/css")}
|
|
1732
|
+
${ctx.file.import("splitProps", "../helpers")}
|
|
1690
1733
|
${ctx.file.import(styleFnName, `../patterns/${dashName}`)}
|
|
1734
|
+
${ctx.file.import(factoryName, "./factory")}
|
|
1691
1735
|
|
|
1692
1736
|
export const ${jsxName} = /* @__PURE__ */ forwardRef(function ${jsxName}(props, ref) {
|
|
1693
|
-
${match7(
|
|
1694
|
-
|
|
1737
|
+
${match7(jsxStyleProps2).with(
|
|
1738
|
+
"none",
|
|
1739
|
+
() => outdent26`
|
|
1740
|
+
const [patternProps, restProps] = splitProps(props, ${JSON.stringify(props)})
|
|
1741
|
+
|
|
1742
|
+
const styleProps = ${styleFnName}(patternProps)
|
|
1743
|
+
const Comp = ${factoryName}("${jsxElement}", { base: styleProps })
|
|
1744
|
+
|
|
1745
|
+
return createElement(Comp, { ref, ...restProps })
|
|
1746
|
+
`
|
|
1747
|
+
).with(
|
|
1748
|
+
"minimal",
|
|
1695
1749
|
() => outdent26`
|
|
1696
|
-
|
|
1697
|
-
|
|
1750
|
+
const [patternProps, restProps] = splitProps(props, ${JSON.stringify(props)})
|
|
1751
|
+
|
|
1752
|
+
const styleProps = ${styleFnName}(patternProps)
|
|
1753
|
+
const cssProps = { css: mergeCss(styleProps, props.css) }
|
|
1754
|
+
const mergedProps = { ref, ...restProps, ...cssProps }
|
|
1755
|
+
|
|
1756
|
+
return createElement(${factoryName}.${jsxElement}, mergedProps)
|
|
1698
1757
|
`
|
|
1699
|
-
).
|
|
1758
|
+
).with(
|
|
1759
|
+
"all",
|
|
1700
1760
|
() => outdent26`
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1761
|
+
const [patternProps, restProps] = splitProps(props, ${JSON.stringify(props)})
|
|
1762
|
+
|
|
1763
|
+
const styleProps = ${styleFnName}(patternProps)
|
|
1764
|
+
const mergedProps = { ref, ...styleProps, ...restProps }
|
|
1765
|
+
|
|
1766
|
+
return createElement(${factoryName}.${jsxElement}, mergedProps)
|
|
1704
1767
|
`
|
|
1705
|
-
)}
|
|
1706
|
-
|
|
1768
|
+
).exhaustive()}
|
|
1769
|
+
})
|
|
1707
1770
|
`,
|
|
1708
1771
|
dts: outdent26`
|
|
1709
1772
|
import type { FunctionComponent } from 'react'
|
|
@@ -2013,7 +2076,7 @@ function generateSolidJsxFactory(ctx) {
|
|
|
2013
2076
|
import { outdent as outdent31 } from "outdent";
|
|
2014
2077
|
import { match as match8 } from "ts-pattern";
|
|
2015
2078
|
function generateSolidJsxPattern(ctx, filters) {
|
|
2016
|
-
const { typeName, factoryName } = ctx.jsx;
|
|
2079
|
+
const { typeName, factoryName, styleProps: jsxStyleProps2 } = ctx.jsx;
|
|
2017
2080
|
const details = ctx.patterns.filterDetails(filters);
|
|
2018
2081
|
return details.map((pattern) => {
|
|
2019
2082
|
const { upperName, styleFnName, dashName, jsxName, props, blocklistType } = pattern;
|
|
@@ -2021,25 +2084,47 @@ function generateSolidJsxPattern(ctx, filters) {
|
|
|
2021
2084
|
return {
|
|
2022
2085
|
name: dashName,
|
|
2023
2086
|
js: outdent31`
|
|
2024
|
-
import {
|
|
2087
|
+
import { createMemo, mergeProps, splitProps } from 'solid-js'
|
|
2025
2088
|
import { createComponent } from 'solid-js/web'
|
|
2026
|
-
${ctx.file.import(
|
|
2089
|
+
${ctx.file.import("mergeCss", "../css/css")}
|
|
2027
2090
|
${ctx.file.import(styleFnName, `../patterns/${dashName}`)}
|
|
2091
|
+
${ctx.file.import(factoryName, "./factory")}
|
|
2028
2092
|
|
|
2029
|
-
export function ${jsxName}(props) {
|
|
2030
|
-
${match8(
|
|
2031
|
-
|
|
2093
|
+
export const ${jsxName} = /* @__PURE__ */ function ${jsxName}(props) {
|
|
2094
|
+
${match8(jsxStyleProps2).with(
|
|
2095
|
+
"none",
|
|
2032
2096
|
() => outdent31`
|
|
2033
|
-
|
|
2034
|
-
|
|
2097
|
+
const [patternProps, restProps] = splitProps(props, ${JSON.stringify(props)})
|
|
2098
|
+
|
|
2099
|
+
const styleProps = ${styleFnName}(patternProps)
|
|
2100
|
+
const Comp = ${factoryName}("${jsxElement}", { base: styleProps })
|
|
2101
|
+
|
|
2102
|
+
return createComponent(Comp, restProps)
|
|
2035
2103
|
`
|
|
2036
|
-
).
|
|
2104
|
+
).with(
|
|
2105
|
+
"minimal",
|
|
2037
2106
|
() => outdent31`
|
|
2038
|
-
|
|
2107
|
+
const [patternProps, restProps] = splitProps(props, ${JSON.stringify(props)})
|
|
2108
|
+
|
|
2109
|
+
const cssProps = createMemo(() => {
|
|
2039
2110
|
const styleProps = ${styleFnName}(patternProps)
|
|
2040
|
-
return
|
|
2111
|
+
return { css: mergeCss(styleProps, props.css) }
|
|
2112
|
+
})
|
|
2113
|
+
const mergedProps = mergeProps(restProps, cssProps)
|
|
2114
|
+
|
|
2115
|
+
return createComponent(${factoryName}.${jsxElement}, mergedProps)
|
|
2041
2116
|
`
|
|
2042
|
-
)
|
|
2117
|
+
).with(
|
|
2118
|
+
"all",
|
|
2119
|
+
() => outdent31`
|
|
2120
|
+
const [patternProps, restProps] = splitProps(props, ${JSON.stringify(props)})
|
|
2121
|
+
|
|
2122
|
+
const styleProps = ${styleFnName}(patternProps)
|
|
2123
|
+
const mergedProps = mergeProps(styleProps, restProps)
|
|
2124
|
+
|
|
2125
|
+
return createComponent(${factoryName}.${jsxElement}, mergedProps)
|
|
2126
|
+
`
|
|
2127
|
+
).exhaustive()}
|
|
2043
2128
|
}
|
|
2044
2129
|
`,
|
|
2045
2130
|
dts: outdent31`
|
|
@@ -2266,7 +2351,7 @@ function generateVueJsxFactory(ctx) {
|
|
|
2266
2351
|
const combinedProps = computed(() => Object.assign({}, defaultProps, attrs))
|
|
2267
2352
|
|
|
2268
2353
|
const splittedProps = computed(() => {
|
|
2269
|
-
return splitProps(combinedProps.value, normalizeHTMLProps.keys,
|
|
2354
|
+
return splitProps(combinedProps.value, normalizeHTMLProps.keys, __shouldForwardProps__, __cvaFn__.variantKeys, isCssProperty)
|
|
2270
2355
|
})
|
|
2271
2356
|
|
|
2272
2357
|
const recipeClass = computed(() => {
|
|
@@ -2394,30 +2479,62 @@ function generateVueJsxStringLiteralFactory(ctx) {
|
|
|
2394
2479
|
|
|
2395
2480
|
// src/artifacts/vue-jsx/pattern.ts
|
|
2396
2481
|
import { outdent as outdent37 } from "outdent";
|
|
2482
|
+
import { match as match9 } from "ts-pattern";
|
|
2397
2483
|
function generateVueJsxPattern(ctx, filters) {
|
|
2398
|
-
const { typeName, factoryName } = ctx.jsx;
|
|
2484
|
+
const { typeName, factoryName, styleProps: jsxStyleProps2 } = ctx.jsx;
|
|
2399
2485
|
const details = ctx.patterns.filterDetails(filters);
|
|
2400
2486
|
return details.map((pattern) => {
|
|
2401
2487
|
const { upperName, styleFnName, dashName, jsxName, props, blocklistType } = pattern;
|
|
2402
2488
|
const { description, jsxElement = "div" } = pattern.config;
|
|
2403
|
-
const propList = props.map((v) => JSON.stringify(v)).join(", ");
|
|
2404
2489
|
return {
|
|
2405
2490
|
name: dashName,
|
|
2406
2491
|
js: outdent37`
|
|
2407
2492
|
import { defineComponent, h, computed } from 'vue'
|
|
2408
|
-
${ctx.file.import(
|
|
2493
|
+
${ctx.file.import("mergeCss", "../css/css")}
|
|
2409
2494
|
${ctx.file.import(styleFnName, `../patterns/${dashName}`)}
|
|
2495
|
+
${ctx.file.import(factoryName, "./factory")}
|
|
2410
2496
|
|
|
2411
|
-
export const ${jsxName} = defineComponent({
|
|
2497
|
+
export const ${jsxName} = /* @__PURE__ */ defineComponent({
|
|
2412
2498
|
name: '${jsxName}',
|
|
2413
2499
|
inheritAttrs: false,
|
|
2414
|
-
props:
|
|
2500
|
+
props: ${JSON.stringify(props)},
|
|
2415
2501
|
setup(props, { attrs, slots }) {
|
|
2502
|
+
${match9(jsxStyleProps2).with(
|
|
2503
|
+
"none",
|
|
2504
|
+
() => outdent37`
|
|
2505
|
+
const Comp = computed(() => {
|
|
2506
|
+
const styleProps = ${styleFnName}(props)
|
|
2507
|
+
return ${factoryName}("${jsxElement}", { base: styleProps })
|
|
2508
|
+
})
|
|
2509
|
+
|
|
2510
|
+
return () => {
|
|
2511
|
+
return h(Comp.value, attrs, slots)
|
|
2512
|
+
}
|
|
2513
|
+
`
|
|
2514
|
+
).with(
|
|
2515
|
+
"minimal",
|
|
2516
|
+
() => outdent37`
|
|
2517
|
+
const cssProps = computed(() => {
|
|
2518
|
+
const styleProps = ${styleFnName}(props)
|
|
2519
|
+
return { css: mergeCss(styleProps, attrs.css) }
|
|
2520
|
+
})
|
|
2521
|
+
|
|
2522
|
+
return () => {
|
|
2523
|
+
const mergedProps = { ...attrs, ...cssProps.value }
|
|
2524
|
+
return h(${factoryName}.${jsxElement}, mergedProps, slots)
|
|
2525
|
+
}
|
|
2526
|
+
`
|
|
2527
|
+
).with(
|
|
2528
|
+
"all",
|
|
2529
|
+
() => outdent37`
|
|
2416
2530
|
const styleProps = computed(() => ${styleFnName}(props))
|
|
2531
|
+
|
|
2417
2532
|
return () => {
|
|
2418
|
-
|
|
2419
|
-
|
|
2533
|
+
const mergedProps = { ...styleProps.value, ...attrs }
|
|
2534
|
+
return h(${factoryName}.${jsxElement}, mergedProps, slots)
|
|
2420
2535
|
}
|
|
2536
|
+
`
|
|
2537
|
+
).exhaustive()}
|
|
2421
2538
|
}
|
|
2422
2539
|
})
|
|
2423
2540
|
`,
|
|
@@ -2688,7 +2805,7 @@ var static_css_d_ts_default = {
|
|
|
2688
2805
|
};
|
|
2689
2806
|
|
|
2690
2807
|
// src/artifacts/types/generated.ts
|
|
2691
|
-
import { match as
|
|
2808
|
+
import { match as match10 } from "ts-pattern";
|
|
2692
2809
|
function getGeneratedTypes(ctx) {
|
|
2693
2810
|
const rewriteImports = (code) => code.replace(/import\s+type\s+\{([^}]+)\}\s+from\s+['"]([^'"]+)['"]/g, ctx.file.importType("$1", "$2"));
|
|
2694
2811
|
return {
|
|
@@ -2706,7 +2823,7 @@ function getGeneratedSystemTypes(ctx) {
|
|
|
2706
2823
|
const rewriteImports = (code) => code.replace(/import\s+type\s+\{([^}]+)\}\s+from\s+['"]([^'"]+)['"]/g, ctx.file.importType("$1", "$2"));
|
|
2707
2824
|
return {
|
|
2708
2825
|
system: rewriteImports(
|
|
2709
|
-
|
|
2826
|
+
match10(ctx.jsx.styleProps).with("all", () => system_types_d_ts_default.content).with(
|
|
2710
2827
|
"minimal",
|
|
2711
2828
|
() => system_types_d_ts_default.content.replace("WithHTMLProps<T>,", "T,").replace(jsxStyleProps, "export type JsxStyleProps = WithCss")
|
|
2712
2829
|
).with(
|
|
@@ -3394,7 +3511,7 @@ function generateKeyframeCss(ctx) {
|
|
|
3394
3511
|
|
|
3395
3512
|
// src/artifacts/css/parser-css.ts
|
|
3396
3513
|
import { logger } from "@pandacss/logger";
|
|
3397
|
-
import { P, match as
|
|
3514
|
+
import { P, match as match11 } from "ts-pattern";
|
|
3398
3515
|
var generateParserCss = (ctx, result) => {
|
|
3399
3516
|
const { patterns, recipes } = ctx;
|
|
3400
3517
|
result.css.forEach((css2) => {
|
|
@@ -3423,7 +3540,7 @@ var generateParserCss = (ctx, result) => {
|
|
|
3423
3540
|
const recipeConfig = recipes.getConfig(recipeName);
|
|
3424
3541
|
if (!recipeConfig)
|
|
3425
3542
|
continue;
|
|
3426
|
-
|
|
3543
|
+
match11(recipe).with({ type: "jsx-recipe" }, () => {
|
|
3427
3544
|
recipe.data.forEach((data) => {
|
|
3428
3545
|
const [recipeProps, styleProps] = recipes.splitProps(recipeName, data);
|
|
3429
3546
|
ctx.stylesheet.processStyleProps(filterProps(ctx, styleProps));
|
|
@@ -3442,7 +3559,7 @@ var generateParserCss = (ctx, result) => {
|
|
|
3442
3559
|
result.pattern.forEach((patternSet, name) => {
|
|
3443
3560
|
try {
|
|
3444
3561
|
for (const pattern of patternSet) {
|
|
3445
|
-
|
|
3562
|
+
match11(pattern).with({ type: "jsx-pattern", name: P.string }, ({ name: jsxName }) => {
|
|
3446
3563
|
pattern.data.forEach((data) => {
|
|
3447
3564
|
const fnName = patterns.find(jsxName);
|
|
3448
3565
|
const styleProps = patterns.transform(fnName, data);
|
|
@@ -4114,7 +4231,7 @@ var Context = class {
|
|
|
4114
4231
|
return new Utility({
|
|
4115
4232
|
prefix: this.prefix.className,
|
|
4116
4233
|
tokens: this.tokens,
|
|
4117
|
-
config: this.isTemplateLiteralSyntax ? {} : config.utilities,
|
|
4234
|
+
config: this.isTemplateLiteralSyntax ? {} : Object.assign({}, config.utilities),
|
|
4118
4235
|
separator: config.separator,
|
|
4119
4236
|
shorthands: config.shorthands,
|
|
4120
4237
|
strictTokens: config.strictTokens
|
|
@@ -4193,6 +4310,7 @@ var getParserOptions = (ctx) => {
|
|
|
4193
4310
|
isStyleProp: isValidProperty,
|
|
4194
4311
|
nodes: [...patterns.details, ...recipes.details]
|
|
4195
4312
|
},
|
|
4313
|
+
isTemplateLiteralSyntax: ctx.isTemplateLiteralSyntax,
|
|
4196
4314
|
patternKeys: patterns.keys,
|
|
4197
4315
|
recipeKeys: recipes.keys,
|
|
4198
4316
|
getRecipesByJsxName: recipes.filter,
|
|
@@ -4215,7 +4333,7 @@ var Generator = class extends Context {
|
|
|
4215
4333
|
return generateArtifacts(this, ids);
|
|
4216
4334
|
}
|
|
4217
4335
|
appendCss(type) {
|
|
4218
|
-
|
|
4336
|
+
match12(type).with("preflight", () => generateResetCss(this)).with("tokens", () => generateTokenCss(this)).with("static", () => generateStaticCss(this)).with("global", () => generateGlobalCss(this)).with("keyframes", () => generateKeyframeCss(this)).otherwise(() => {
|
|
4219
4337
|
throw new Error(`Unknown css artifact type <${type}>`);
|
|
4220
4338
|
});
|
|
4221
4339
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pandacss/generator",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.23.0",
|
|
4
4
|
"description": "The css generator for css panda",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -32,17 +32,16 @@
|
|
|
32
32
|
"pluralize": "8.0.0",
|
|
33
33
|
"postcss": "^8.4.31",
|
|
34
34
|
"ts-pattern": "5.0.5",
|
|
35
|
-
"@pandacss/core": "0.
|
|
36
|
-
"@pandacss/is-valid-prop": "0.
|
|
37
|
-
"@pandacss/logger": "0.
|
|
38
|
-
"@pandacss/shared": "0.
|
|
39
|
-
"@pandacss/token-dictionary": "0.
|
|
40
|
-
"@pandacss/types": "0.
|
|
35
|
+
"@pandacss/core": "0.23.0",
|
|
36
|
+
"@pandacss/is-valid-prop": "0.23.0",
|
|
37
|
+
"@pandacss/logger": "0.23.0",
|
|
38
|
+
"@pandacss/shared": "0.23.0",
|
|
39
|
+
"@pandacss/token-dictionary": "0.23.0",
|
|
40
|
+
"@pandacss/types": "0.23.0"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@types/pluralize": "0.0.33",
|
|
44
|
-
"hookable": "5.5.3"
|
|
45
|
-
"@pandacss/fixture": "0.22.1"
|
|
44
|
+
"hookable": "5.5.3"
|
|
46
45
|
},
|
|
47
46
|
"scripts": {
|
|
48
47
|
"build": "tsup src/index.ts --format=esm,cjs --dts",
|