@bamboocss/generator 1.24.0 → 1.25.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.cjs CHANGED
@@ -584,10 +584,25 @@ const declaration = outdent.default`
584
584
  classNameByValue: Record<string, string>,
585
585
  fallback?: string,
586
586
  ): string
587
+
588
+ /**
589
+ * Split a props object into the listed keys and everything else.
590
+ *
591
+ * Re-exported here so the build has one module to reach for when it lowers a recipe: this
592
+ * is what \`recipe.splitVariantProps\` calls, so a lowered call is the same function reached
593
+ * directly rather than through the recipe object — which is what lets the recipe's config
594
+ * leave the bundle.
595
+ */
596
+ export declare function splitProps<T extends Record<string, unknown>, K extends Array<keyof T>>(
597
+ props: T,
598
+ ...keys: K
599
+ ): [Record<string, unknown>, Record<string, unknown>]
587
600
  `;
588
- function generateCx() {
601
+ function generateCx(ctx) {
589
602
  return {
590
603
  js: outdent.default`
604
+ ${ctx.file.import("splitProps", "../helpers")}
605
+
591
606
  function cx(...args) {
592
607
  let str = ''
593
608
 
@@ -615,7 +630,7 @@ function generateCx() {
615
630
  return Object.hasOwn(classNameByValue, value) ? classNameByValue[value] : ''
616
631
  }
617
632
 
618
- export { cx, cvaPick }
633
+ export { cx, cvaPick, splitProps }
619
634
  `,
620
635
  dts: declaration
621
636
  };
@@ -2955,7 +2970,7 @@ function setupSva(ctx) {
2955
2970
  };
2956
2971
  }
2957
2972
  function setupCx(ctx) {
2958
- const code = generateCx();
2973
+ const code = generateCx(ctx);
2959
2974
  return {
2960
2975
  id: "cx",
2961
2976
  dir: ctx.paths.css,
package/dist/index.mjs CHANGED
@@ -558,10 +558,25 @@ const declaration = outdent$1`
558
558
  classNameByValue: Record<string, string>,
559
559
  fallback?: string,
560
560
  ): string
561
+
562
+ /**
563
+ * Split a props object into the listed keys and everything else.
564
+ *
565
+ * Re-exported here so the build has one module to reach for when it lowers a recipe: this
566
+ * is what \`recipe.splitVariantProps\` calls, so a lowered call is the same function reached
567
+ * directly rather than through the recipe object — which is what lets the recipe's config
568
+ * leave the bundle.
569
+ */
570
+ export declare function splitProps<T extends Record<string, unknown>, K extends Array<keyof T>>(
571
+ props: T,
572
+ ...keys: K
573
+ ): [Record<string, unknown>, Record<string, unknown>]
561
574
  `;
562
- function generateCx() {
575
+ function generateCx(ctx) {
563
576
  return {
564
577
  js: outdent$1`
578
+ ${ctx.file.import("splitProps", "../helpers")}
579
+
565
580
  function cx(...args) {
566
581
  let str = ''
567
582
 
@@ -589,7 +604,7 @@ function generateCx() {
589
604
  return Object.hasOwn(classNameByValue, value) ? classNameByValue[value] : ''
590
605
  }
591
606
 
592
- export { cx, cvaPick }
607
+ export { cx, cvaPick, splitProps }
593
608
  `,
594
609
  dts: declaration
595
610
  };
@@ -2929,7 +2944,7 @@ function setupSva(ctx) {
2929
2944
  };
2930
2945
  }
2931
2946
  function setupCx(ctx) {
2932
- const code = generateCx();
2947
+ const code = generateCx(ctx);
2933
2948
  return {
2934
2949
  id: "cx",
2935
2950
  dir: ctx.paths.css,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bamboocss/generator",
3
- "version": "1.24.0",
3
+ "version": "1.25.0",
4
4
  "description": "The css generator for css bamboo",
5
5
  "homepage": "https://bamboocss.com",
6
6
  "license": "MIT",
@@ -38,12 +38,12 @@
38
38
  "pluralize": "8.0.0",
39
39
  "postcss": "8.5.26",
40
40
  "ts-pattern": "5.9.0",
41
- "@bamboocss/core": "1.24.0",
42
- "@bamboocss/is-valid-prop": "^1.24.0",
43
- "@bamboocss/logger": "1.24.0",
44
- "@bamboocss/shared": "1.24.0",
45
- "@bamboocss/token-dictionary": "1.24.0",
46
- "@bamboocss/types": "1.24.0"
41
+ "@bamboocss/core": "1.25.0",
42
+ "@bamboocss/is-valid-prop": "^1.25.0",
43
+ "@bamboocss/logger": "1.25.0",
44
+ "@bamboocss/shared": "1.25.0",
45
+ "@bamboocss/token-dictionary": "1.25.0",
46
+ "@bamboocss/types": "1.25.0"
47
47
  },
48
48
  "devDependencies": {
49
49
  "@types/pluralize": "0.0.33"