@pandacss/generator 0.39.2 → 0.40.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 CHANGED
@@ -477,7 +477,7 @@ function generateIsValidProp(ctx) {
477
477
  let content = is_valid_prop_mjs_default.content;
478
478
  content = content.replace(
479
479
  'var userGeneratedStr = "";',
480
- `var userGeneratedStr = "${(0, import_ts_pattern.match)(ctx.jsx.styleProps).with("all", () => Array.from(ctx.properties).join(",")).with("minimal", () => "css").with("none", () => "").exhaustive()}"`
480
+ `var userGeneratedStr = "${(0, import_ts_pattern.match)(ctx.jsx.styleProps).with("all", () => Array.from(ctx.properties).join(",")).with("minimal", () => "css").with("none", () => "css").exhaustive()}"`
481
481
  );
482
482
  content = content.replace(memoFnDeclarationRegex, "var cssPropertySelectorRegex");
483
483
  if (ctx.jsx.styleProps === "minimal" || ctx.jsx.styleProps === "none") {
@@ -1053,9 +1053,9 @@ function generatePreactJsxPattern(ctx, filters) {
1053
1053
  const [patternProps, restProps] = splitProps(props, ${JSON.stringify(props)})
1054
1054
 
1055
1055
  const styleProps = ${styleFnName}(patternProps)
1056
- const Comp = ${factoryName}("${jsxElement}", { base: styleProps })
1056
+ const mergedProps = { ref, ...restProps, css: styleProps }
1057
1057
 
1058
- return h(Comp, { ref, ...restProps })
1058
+ return h(${factoryName}.${jsxElement}, mergedProps)
1059
1059
  `
1060
1060
  ).with(
1061
1061
  "minimal",
@@ -1380,9 +1380,9 @@ function generateQwikJsxPattern(ctx, filters) {
1380
1380
  const [patternProps, restProps] = splitProps(props, ${JSON.stringify(props)})
1381
1381
 
1382
1382
  const styleProps = ${styleFnName}(patternProps)
1383
- const Comp = ${factoryName}("${jsxElement}", { base: styleProps })
1383
+ const mergedProps = { ref, ...restProps, css: styleProps }
1384
1384
 
1385
- return h(Comp, restProps)
1385
+ return h(${factoryName}.${jsxElement}, mergedProps)
1386
1386
  `
1387
1387
  ).with(
1388
1388
  "minimal",
@@ -1714,9 +1714,9 @@ function generateReactJsxPattern(ctx, filters) {
1714
1714
  const [patternProps, restProps] = splitProps(props, ${JSON.stringify(props)})
1715
1715
 
1716
1716
  const styleProps = ${styleFnName}(patternProps)
1717
- const Comp = ${factoryName}("${jsxElement}", { base: styleProps })
1717
+ const mergedProps = { ref, ...restProps, css: styleProps }
1718
1718
 
1719
- return createElement(Comp, { ref, ...restProps })
1719
+ return createElement(${factoryName}.${jsxElement}, mergedProps)
1720
1720
  `
1721
1721
  ).with(
1722
1722
  "minimal",
@@ -2090,10 +2090,14 @@ function generateSolidJsxPattern(ctx, filters) {
2090
2090
  () => import_outdent30.outdent`
2091
2091
  const [patternProps, restProps] = splitProps(props, ${JSON.stringify(props)})
2092
2092
 
2093
- const styleProps = ${styleFnName}(patternProps)
2094
- const Comp = ${factoryName}("${jsxElement}", { base: styleProps })
2093
+ const cssProps = createMemo(() => {
2094
+ const styleProps = ${styleFnName}(patternProps)
2095
+ return { css: styleProps }
2096
+ })
2095
2097
 
2096
- return createComponent(Comp, restProps)
2098
+ const mergedProps = mergeProps(restProps, cssProps)
2099
+
2100
+ return createComponent(${factoryName}.${jsxElement}, mergedProps)
2097
2101
  `
2098
2102
  ).with(
2099
2103
  "minimal",
@@ -2104,6 +2108,7 @@ function generateSolidJsxPattern(ctx, filters) {
2104
2108
  const styleProps = ${styleFnName}(patternProps)
2105
2109
  return { css: mergeCss(styleProps, props.css) }
2106
2110
  })
2111
+
2107
2112
  const mergedProps = mergeProps(restProps, cssProps)
2108
2113
 
2109
2114
  return createComponent(${factoryName}.${jsxElement}, mergedProps)
@@ -2546,13 +2551,14 @@ function generateVueJsxPattern(ctx, filters) {
2546
2551
  ${(0, import_ts_pattern9.match)(jsxStyleProps2).with(
2547
2552
  "none",
2548
2553
  () => import_outdent36.outdent`
2549
- const Comp = computed(() => {
2554
+ const cssProps = computed(() => {
2550
2555
  const styleProps = ${styleFnName}(props)
2551
- return ${factoryName}("${jsxElement}", { base: styleProps })
2556
+ return { css: styleProps }
2552
2557
  })
2553
2558
 
2554
2559
  return () => {
2555
- return h(Comp.value, attrs, slots)
2560
+ const mergedProps = { ...attrs, ...cssProps.value }
2561
+ return h(${factoryName}.${jsxElement}, mergedProps, slots)
2556
2562
  }
2557
2563
  `
2558
2564
  ).with(
@@ -3555,22 +3561,20 @@ var system_types_d_ts_default = {
3555
3561
 
3556
3562
  // src/artifacts/types/generated.ts
3557
3563
  function getGeneratedTypes(ctx) {
3558
- const rewriteImports = (code) => code.replace(/import\s+type\s+\{([^}]+)\}\s+from\s+['"]([^'"]+)['"]/g, ctx.file.importType("$1", "$2"));
3559
3564
  return {
3560
3565
  cssType: csstype_d_ts_default.content,
3561
3566
  static: static_css_d_ts_default.content,
3562
- recipe: rewriteImports(recipe_d_ts_default.content),
3563
- pattern: rewriteImports(pattern_d_ts_default.content.replace("../tokens", "../tokens/index")),
3564
- parts: rewriteImports(parts_d_ts_default.content),
3565
- composition: rewriteImports(composition_d_ts_default.content),
3566
- selectors: rewriteImports(selectors_d_ts_default.content)
3567
+ recipe: ctx.file.rewriteTypeImport(recipe_d_ts_default.content),
3568
+ pattern: ctx.file.rewriteTypeImport(pattern_d_ts_default.content.replace("../tokens", "../tokens/index")),
3569
+ parts: ctx.file.rewriteTypeImport(parts_d_ts_default.content),
3570
+ composition: ctx.file.rewriteTypeImport(composition_d_ts_default.content),
3571
+ selectors: ctx.file.rewriteTypeImport(selectors_d_ts_default.content)
3567
3572
  };
3568
3573
  }
3569
- var jsxStyleProps = "export type JsxStyleProps = StyleProps & WithCss";
3574
+ var jsxStyleProps = "export type JsxStyleProps = SystemStyleObject & WithCss";
3570
3575
  function getGeneratedSystemTypes(ctx) {
3571
- const rewriteImports = (code) => code.replace(/import\s+type\s+\{([^}]+)\}\s+from\s+['"]([^'"]+)['"]/g, ctx.file.importType("$1", "$2"));
3572
3576
  return {
3573
- system: rewriteImports(
3577
+ system: ctx.file.rewriteTypeImport(
3574
3578
  (0, import_ts_pattern10.match)(ctx.jsx.styleProps).with("all", () => system_types_d_ts_default.content).with(
3575
3579
  "minimal",
3576
3580
  () => system_types_d_ts_default.content.replace("WithHTMLProps<T>,", "T,").replace(jsxStyleProps, "export type JsxStyleProps = WithCss")
package/dist/index.mjs CHANGED
@@ -441,7 +441,7 @@ function generateIsValidProp(ctx) {
441
441
  let content = is_valid_prop_mjs_default.content;
442
442
  content = content.replace(
443
443
  'var userGeneratedStr = "";',
444
- `var userGeneratedStr = "${match(ctx.jsx.styleProps).with("all", () => Array.from(ctx.properties).join(",")).with("minimal", () => "css").with("none", () => "").exhaustive()}"`
444
+ `var userGeneratedStr = "${match(ctx.jsx.styleProps).with("all", () => Array.from(ctx.properties).join(",")).with("minimal", () => "css").with("none", () => "css").exhaustive()}"`
445
445
  );
446
446
  content = content.replace(memoFnDeclarationRegex, "var cssPropertySelectorRegex");
447
447
  if (ctx.jsx.styleProps === "minimal" || ctx.jsx.styleProps === "none") {
@@ -1017,9 +1017,9 @@ function generatePreactJsxPattern(ctx, filters) {
1017
1017
  const [patternProps, restProps] = splitProps(props, ${JSON.stringify(props)})
1018
1018
 
1019
1019
  const styleProps = ${styleFnName}(patternProps)
1020
- const Comp = ${factoryName}("${jsxElement}", { base: styleProps })
1020
+ const mergedProps = { ref, ...restProps, css: styleProps }
1021
1021
 
1022
- return h(Comp, { ref, ...restProps })
1022
+ return h(${factoryName}.${jsxElement}, mergedProps)
1023
1023
  `
1024
1024
  ).with(
1025
1025
  "minimal",
@@ -1344,9 +1344,9 @@ function generateQwikJsxPattern(ctx, filters) {
1344
1344
  const [patternProps, restProps] = splitProps(props, ${JSON.stringify(props)})
1345
1345
 
1346
1346
  const styleProps = ${styleFnName}(patternProps)
1347
- const Comp = ${factoryName}("${jsxElement}", { base: styleProps })
1347
+ const mergedProps = { ref, ...restProps, css: styleProps }
1348
1348
 
1349
- return h(Comp, restProps)
1349
+ return h(${factoryName}.${jsxElement}, mergedProps)
1350
1350
  `
1351
1351
  ).with(
1352
1352
  "minimal",
@@ -1678,9 +1678,9 @@ function generateReactJsxPattern(ctx, filters) {
1678
1678
  const [patternProps, restProps] = splitProps(props, ${JSON.stringify(props)})
1679
1679
 
1680
1680
  const styleProps = ${styleFnName}(patternProps)
1681
- const Comp = ${factoryName}("${jsxElement}", { base: styleProps })
1681
+ const mergedProps = { ref, ...restProps, css: styleProps }
1682
1682
 
1683
- return createElement(Comp, { ref, ...restProps })
1683
+ return createElement(${factoryName}.${jsxElement}, mergedProps)
1684
1684
  `
1685
1685
  ).with(
1686
1686
  "minimal",
@@ -2054,10 +2054,14 @@ function generateSolidJsxPattern(ctx, filters) {
2054
2054
  () => outdent30`
2055
2055
  const [patternProps, restProps] = splitProps(props, ${JSON.stringify(props)})
2056
2056
 
2057
- const styleProps = ${styleFnName}(patternProps)
2058
- const Comp = ${factoryName}("${jsxElement}", { base: styleProps })
2057
+ const cssProps = createMemo(() => {
2058
+ const styleProps = ${styleFnName}(patternProps)
2059
+ return { css: styleProps }
2060
+ })
2059
2061
 
2060
- return createComponent(Comp, restProps)
2062
+ const mergedProps = mergeProps(restProps, cssProps)
2063
+
2064
+ return createComponent(${factoryName}.${jsxElement}, mergedProps)
2061
2065
  `
2062
2066
  ).with(
2063
2067
  "minimal",
@@ -2068,6 +2072,7 @@ function generateSolidJsxPattern(ctx, filters) {
2068
2072
  const styleProps = ${styleFnName}(patternProps)
2069
2073
  return { css: mergeCss(styleProps, props.css) }
2070
2074
  })
2075
+
2071
2076
  const mergedProps = mergeProps(restProps, cssProps)
2072
2077
 
2073
2078
  return createComponent(${factoryName}.${jsxElement}, mergedProps)
@@ -2510,13 +2515,14 @@ function generateVueJsxPattern(ctx, filters) {
2510
2515
  ${match9(jsxStyleProps2).with(
2511
2516
  "none",
2512
2517
  () => outdent36`
2513
- const Comp = computed(() => {
2518
+ const cssProps = computed(() => {
2514
2519
  const styleProps = ${styleFnName}(props)
2515
- return ${factoryName}("${jsxElement}", { base: styleProps })
2520
+ return { css: styleProps }
2516
2521
  })
2517
2522
 
2518
2523
  return () => {
2519
- return h(Comp.value, attrs, slots)
2524
+ const mergedProps = { ...attrs, ...cssProps.value }
2525
+ return h(${factoryName}.${jsxElement}, mergedProps, slots)
2520
2526
  }
2521
2527
  `
2522
2528
  ).with(
@@ -3519,22 +3525,20 @@ var system_types_d_ts_default = {
3519
3525
 
3520
3526
  // src/artifacts/types/generated.ts
3521
3527
  function getGeneratedTypes(ctx) {
3522
- const rewriteImports = (code) => code.replace(/import\s+type\s+\{([^}]+)\}\s+from\s+['"]([^'"]+)['"]/g, ctx.file.importType("$1", "$2"));
3523
3528
  return {
3524
3529
  cssType: csstype_d_ts_default.content,
3525
3530
  static: static_css_d_ts_default.content,
3526
- recipe: rewriteImports(recipe_d_ts_default.content),
3527
- pattern: rewriteImports(pattern_d_ts_default.content.replace("../tokens", "../tokens/index")),
3528
- parts: rewriteImports(parts_d_ts_default.content),
3529
- composition: rewriteImports(composition_d_ts_default.content),
3530
- selectors: rewriteImports(selectors_d_ts_default.content)
3531
+ recipe: ctx.file.rewriteTypeImport(recipe_d_ts_default.content),
3532
+ pattern: ctx.file.rewriteTypeImport(pattern_d_ts_default.content.replace("../tokens", "../tokens/index")),
3533
+ parts: ctx.file.rewriteTypeImport(parts_d_ts_default.content),
3534
+ composition: ctx.file.rewriteTypeImport(composition_d_ts_default.content),
3535
+ selectors: ctx.file.rewriteTypeImport(selectors_d_ts_default.content)
3531
3536
  };
3532
3537
  }
3533
- var jsxStyleProps = "export type JsxStyleProps = StyleProps & WithCss";
3538
+ var jsxStyleProps = "export type JsxStyleProps = SystemStyleObject & WithCss";
3534
3539
  function getGeneratedSystemTypes(ctx) {
3535
- const rewriteImports = (code) => code.replace(/import\s+type\s+\{([^}]+)\}\s+from\s+['"]([^'"]+)['"]/g, ctx.file.importType("$1", "$2"));
3536
3540
  return {
3537
- system: rewriteImports(
3541
+ system: ctx.file.rewriteTypeImport(
3538
3542
  match10(ctx.jsx.styleProps).with("all", () => system_types_d_ts_default.content).with(
3539
3543
  "minimal",
3540
3544
  () => system_types_d_ts_default.content.replace("WithHTMLProps<T>,", "T,").replace(jsxStyleProps, "export type JsxStyleProps = WithCss")
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pandacss/generator",
3
- "version": "0.39.2",
3
+ "version": "0.40.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.38",
39
39
  "ts-pattern": "5.0.8",
40
- "@pandacss/core": "0.39.2",
41
- "@pandacss/is-valid-prop": "^0.39.2",
42
- "@pandacss/logger": "0.39.2",
43
- "@pandacss/shared": "0.39.2",
44
- "@pandacss/token-dictionary": "0.39.2",
45
- "@pandacss/types": "0.39.2"
40
+ "@pandacss/core": "0.40.1",
41
+ "@pandacss/is-valid-prop": "^0.40.1",
42
+ "@pandacss/logger": "0.40.1",
43
+ "@pandacss/shared": "0.40.1",
44
+ "@pandacss/token-dictionary": "0.40.1",
45
+ "@pandacss/types": "0.40.1"
46
46
  },
47
47
  "devDependencies": {
48
48
  "@types/pluralize": "0.0.33"