@pandacss/generator 0.17.4 → 0.18.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.js CHANGED
@@ -815,9 +815,9 @@ function generateCvaFn(ctx) {
815
815
  return mergeCss(variantCss, compoundVariantCss)
816
816
  }
817
817
 
818
- function merge(cvaConfig) {
819
- const override = defaults(cvaConfig)
820
- const variantKeys = uniq(override.variantKeys, Object.keys(variants))
818
+ function merge(__cva) {
819
+ const override = defaults(__cva.config)
820
+ const variantKeys = uniq(__cva.variantKeys, Object.keys(variants))
821
821
  return cva({
822
822
  base: mergeCss(base, override.base),
823
823
  variants: Object.fromEntries(
@@ -926,7 +926,7 @@ var helpers_mjs_default = {
926
926
 
927
927
  // src/artifacts/generated/astish.mjs.json
928
928
  var astish_mjs_default = {
929
- content: '// src/astish.ts\nvar newRule = /(?:([\\u0080-\\uFFFF\\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\\s*)/g;\nvar ruleClean = /\\/\\*[^]*?\\*\\/|\\s\\s+|\\n/g;\nvar astish = (val, tree = [{}]) => {\n const block = newRule.exec((val ?? "").replace(ruleClean, ""));\n if (!block)\n return tree[0];\n if (block[4])\n tree.shift();\n else if (block[3])\n tree.unshift(tree[0][block[3]] = tree[0][block[3]] || {});\n else\n tree[0][block[1]] = block[2];\n return astish(val, tree);\n};\nexport {\n astish\n};\n'
929
+ content: '// src/astish.ts\nvar newRule = /(?:([\\u0080-\\uFFFF\\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\\s*)/g;\nvar ruleClean = /\\/\\*[^]*?\\*\\/| +/g;\nvar ruleNewline = /\\n+/g;\nvar empty = " ";\nvar astish = (val, tree = [{}]) => {\n if (!val)\n return tree[0];\n let block, left;\n while (block = newRule.exec(val.replace(ruleClean, ""))) {\n if (block[4])\n tree.shift();\n else if (block[3]) {\n left = block[3].replace(ruleNewline, empty).trim();\n tree.unshift(tree[0][left] = tree[0][left] || {});\n } else\n tree[0][block[1]] = block[2].replace(ruleNewline, empty).trim();\n }\n return tree[0];\n};\nexport {\n astish\n};\n'
930
930
  };
931
931
 
932
932
  // src/artifacts/generated/normalize-html.mjs.json
@@ -979,12 +979,15 @@ function generateIsValidProp(ctx) {
979
979
  } else {
980
980
  content = ctx.file.import("memo", "../helpers") + "\n" + content;
981
981
  }
982
+ content = ctx.file.import("splitProps", "../helpers") + "\n" + content;
983
+ content += `export const splitCssProps = /* @__PURE__ */ (props) => splitProps(props, isCssProperty)`;
982
984
  return {
983
985
  js: content,
984
986
  dts: import_outdent9.outdent`
985
987
  declare const isCssProperty: (value: string) => boolean;
988
+ declare const splitCssProps: <TProps extends Record<string, unknown>>(props: TProps) => [Pick<TProps, CssProperty>, Omit<TProps, CssProperty>]
986
989
 
987
- export { isCssProperty };
990
+ export { isCssProperty, splitCssProps };
988
991
  `
989
992
  };
990
993
  }
@@ -1015,7 +1018,7 @@ function generatedJsxHelpers(ctx) {
1015
1018
  export const composeCvaFn = (cvaA, cvaB) => {
1016
1019
  if (cvaA && !cvaB) return cvaA
1017
1020
  if (!cvaA && cvaB) return cvaB
1018
- if ((cvaA.__cva__ && cvaB.__cva__) || (cvaA.__recipe__ && cvaB.__recipe__)) return cvaA.merge(cvaB.config)
1021
+ if ((cvaA.__cva__ && cvaB.__cva__) || (cvaA.__recipe__ && cvaB.__recipe__)) return cvaA.merge(cvaB)
1019
1022
  const error = new TypeError('Cannot merge cva with recipe. Please use either cva or recipe.')
1020
1023
  TypeError.captureStackTrace?.(error)
1021
1024
  throw error
@@ -2330,7 +2333,7 @@ function generateSolidJsxFactory(ctx) {
2330
2333
  "defaultShouldForwardProp, composeShouldForwardProps, composeCvaFn, getDisplayName",
2331
2334
  "./factory-helper"
2332
2335
  )}
2333
- ${ctx.file.import("isCssProperty, allCssProperties", "./is-valid-prop")}
2336
+ ${ctx.file.import("isCssProperty", "./is-valid-prop")}
2334
2337
  ${ctx.file.import("css, cx, cva", "../css/index")}
2335
2338
  ${ctx.file.import("normalizeHTMLProps", "../helpers")}
2336
2339
 
@@ -2355,13 +2358,19 @@ function generateSolidJsxFactory(ctx) {
2355
2358
  Object.keys(props).filter((prop) => !normalizeHTMLProps.keys.includes(prop) && shouldForwardProp(prop)),
2356
2359
  )
2357
2360
 
2358
- const [localProps, htmlProps, forwardedProps, variantProps, styleProps, elementProps] = splitProps(
2361
+ const [localProps, htmlProps, forwardedProps, restProps] = splitProps(
2359
2362
  mergedProps,
2360
2363
  ['as', 'class', 'className'],
2361
2364
  normalizeHTMLProps.keys,
2362
- forwardedKeys(),
2365
+ forwardedKeys()
2366
+ )
2367
+
2368
+ const cssPropertyKeys = createMemo(() => Object.keys(restProps).filter((prop) => isCssProperty(prop)))
2369
+
2370
+ const [variantProps, styleProps, elementProps] = splitProps(
2371
+ restProps,
2363
2372
  __cvaFn__.variantKeys,
2364
- allCssProperties,
2373
+ cssPropertyKeys(),
2365
2374
  )
2366
2375
 
2367
2376
  function recipeClass() {
package/dist/index.mjs CHANGED
@@ -784,9 +784,9 @@ function generateCvaFn(ctx) {
784
784
  return mergeCss(variantCss, compoundVariantCss)
785
785
  }
786
786
 
787
- function merge(cvaConfig) {
788
- const override = defaults(cvaConfig)
789
- const variantKeys = uniq(override.variantKeys, Object.keys(variants))
787
+ function merge(__cva) {
788
+ const override = defaults(__cva.config)
789
+ const variantKeys = uniq(__cva.variantKeys, Object.keys(variants))
790
790
  return cva({
791
791
  base: mergeCss(base, override.base),
792
792
  variants: Object.fromEntries(
@@ -895,7 +895,7 @@ var helpers_mjs_default = {
895
895
 
896
896
  // src/artifacts/generated/astish.mjs.json
897
897
  var astish_mjs_default = {
898
- content: '// src/astish.ts\nvar newRule = /(?:([\\u0080-\\uFFFF\\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\\s*)/g;\nvar ruleClean = /\\/\\*[^]*?\\*\\/|\\s\\s+|\\n/g;\nvar astish = (val, tree = [{}]) => {\n const block = newRule.exec((val ?? "").replace(ruleClean, ""));\n if (!block)\n return tree[0];\n if (block[4])\n tree.shift();\n else if (block[3])\n tree.unshift(tree[0][block[3]] = tree[0][block[3]] || {});\n else\n tree[0][block[1]] = block[2];\n return astish(val, tree);\n};\nexport {\n astish\n};\n'
898
+ content: '// src/astish.ts\nvar newRule = /(?:([\\u0080-\\uFFFF\\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\\s*)/g;\nvar ruleClean = /\\/\\*[^]*?\\*\\/| +/g;\nvar ruleNewline = /\\n+/g;\nvar empty = " ";\nvar astish = (val, tree = [{}]) => {\n if (!val)\n return tree[0];\n let block, left;\n while (block = newRule.exec(val.replace(ruleClean, ""))) {\n if (block[4])\n tree.shift();\n else if (block[3]) {\n left = block[3].replace(ruleNewline, empty).trim();\n tree.unshift(tree[0][left] = tree[0][left] || {});\n } else\n tree[0][block[1]] = block[2].replace(ruleNewline, empty).trim();\n }\n return tree[0];\n};\nexport {\n astish\n};\n'
899
899
  };
900
900
 
901
901
  // src/artifacts/generated/normalize-html.mjs.json
@@ -948,12 +948,15 @@ function generateIsValidProp(ctx) {
948
948
  } else {
949
949
  content = ctx.file.import("memo", "../helpers") + "\n" + content;
950
950
  }
951
+ content = ctx.file.import("splitProps", "../helpers") + "\n" + content;
952
+ content += `export const splitCssProps = /* @__PURE__ */ (props) => splitProps(props, isCssProperty)`;
951
953
  return {
952
954
  js: content,
953
955
  dts: outdent9`
954
956
  declare const isCssProperty: (value: string) => boolean;
957
+ declare const splitCssProps: <TProps extends Record<string, unknown>>(props: TProps) => [Pick<TProps, CssProperty>, Omit<TProps, CssProperty>]
955
958
 
956
- export { isCssProperty };
959
+ export { isCssProperty, splitCssProps };
957
960
  `
958
961
  };
959
962
  }
@@ -984,7 +987,7 @@ function generatedJsxHelpers(ctx) {
984
987
  export const composeCvaFn = (cvaA, cvaB) => {
985
988
  if (cvaA && !cvaB) return cvaA
986
989
  if (!cvaA && cvaB) return cvaB
987
- if ((cvaA.__cva__ && cvaB.__cva__) || (cvaA.__recipe__ && cvaB.__recipe__)) return cvaA.merge(cvaB.config)
990
+ if ((cvaA.__cva__ && cvaB.__cva__) || (cvaA.__recipe__ && cvaB.__recipe__)) return cvaA.merge(cvaB)
988
991
  const error = new TypeError('Cannot merge cva with recipe. Please use either cva or recipe.')
989
992
  TypeError.captureStackTrace?.(error)
990
993
  throw error
@@ -2299,7 +2302,7 @@ function generateSolidJsxFactory(ctx) {
2299
2302
  "defaultShouldForwardProp, composeShouldForwardProps, composeCvaFn, getDisplayName",
2300
2303
  "./factory-helper"
2301
2304
  )}
2302
- ${ctx.file.import("isCssProperty, allCssProperties", "./is-valid-prop")}
2305
+ ${ctx.file.import("isCssProperty", "./is-valid-prop")}
2303
2306
  ${ctx.file.import("css, cx, cva", "../css/index")}
2304
2307
  ${ctx.file.import("normalizeHTMLProps", "../helpers")}
2305
2308
 
@@ -2324,13 +2327,19 @@ function generateSolidJsxFactory(ctx) {
2324
2327
  Object.keys(props).filter((prop) => !normalizeHTMLProps.keys.includes(prop) && shouldForwardProp(prop)),
2325
2328
  )
2326
2329
 
2327
- const [localProps, htmlProps, forwardedProps, variantProps, styleProps, elementProps] = splitProps(
2330
+ const [localProps, htmlProps, forwardedProps, restProps] = splitProps(
2328
2331
  mergedProps,
2329
2332
  ['as', 'class', 'className'],
2330
2333
  normalizeHTMLProps.keys,
2331
- forwardedKeys(),
2334
+ forwardedKeys()
2335
+ )
2336
+
2337
+ const cssPropertyKeys = createMemo(() => Object.keys(restProps).filter((prop) => isCssProperty(prop)))
2338
+
2339
+ const [variantProps, styleProps, elementProps] = splitProps(
2340
+ restProps,
2332
2341
  __cvaFn__.variantKeys,
2333
- allCssProperties,
2342
+ cssPropertyKeys(),
2334
2343
  )
2335
2344
 
2336
2345
  function recipeClass() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pandacss/generator",
3
- "version": "0.17.4",
3
+ "version": "0.18.0",
4
4
  "description": "The css generator for css panda",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -32,20 +32,21 @@
32
32
  "pluralize": "8.0.0",
33
33
  "postcss": "^8.4.31",
34
34
  "ts-pattern": "5.0.5",
35
- "@pandacss/core": "0.17.4",
36
- "@pandacss/is-valid-prop": "0.17.4",
37
- "@pandacss/logger": "0.17.4",
38
- "@pandacss/shared": "0.17.4",
39
- "@pandacss/token-dictionary": "0.17.4",
40
- "@pandacss/types": "0.17.4"
35
+ "@pandacss/core": "0.18.0",
36
+ "@pandacss/is-valid-prop": "0.18.0",
37
+ "@pandacss/logger": "0.18.0",
38
+ "@pandacss/shared": "0.18.0",
39
+ "@pandacss/token-dictionary": "0.18.0",
40
+ "@pandacss/types": "0.18.0"
41
41
  },
42
42
  "devDependencies": {
43
43
  "@types/pluralize": "0.0.30",
44
44
  "hookable": "5.5.3",
45
- "@pandacss/fixture": "0.17.4"
45
+ "@pandacss/fixture": "0.18.0"
46
46
  },
47
47
  "scripts": {
48
48
  "build": "tsup src/index.ts --format=esm,cjs --dts",
49
- "build-fast": "tsup src/index.ts --format=esm,cjs --no-dts"
49
+ "build-fast": "tsup src/index.ts --format=esm,cjs --no-dts",
50
+ "dev": "pnpm build-fast --watch"
50
51
  }
51
52
  }