@pandacss/generator 1.11.0 → 1.11.2

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
@@ -261,7 +261,26 @@ function generateStringLiteralCssFn(ctx) {
261
261
  const { separator } = utility;
262
262
  return {
263
263
  dts: import_outdent4.outdent`
264
- export declare function css(template: { raw: readonly string[] | ArrayLike<string> }): string
264
+ ${ctx.file.importType("SystemStyleObject", "../types/index")}
265
+
266
+ type Styles =
267
+ | { raw: readonly string[] | ArrayLike<string> }
268
+ | SystemStyleObject
269
+ | boolean
270
+ | null
271
+ | undefined
272
+
273
+ interface CssRawFunction {
274
+ (...styles: Styles[]): SystemStyleObject
275
+ }
276
+
277
+ interface CssFunction {
278
+ (...styles: Styles[]): string
279
+
280
+ raw: CssRawFunction
281
+ }
282
+
283
+ export declare const css: CssFunction;
265
284
  `,
266
285
  js: import_outdent4.outdent`
267
286
  ${ctx.file.import("astish, createCss, isObject, mergeProps, withoutSpace", "../helpers")}
@@ -1364,7 +1383,10 @@ function generatePreactCreateStyleContext(ctx) {
1364
1383
 
1365
1384
  const WithProvider = forwardRef(function WithProvider(props, ref) {
1366
1385
  const [variantProps, restProps] = svaFn.splitVariantProps(props)
1367
-
1386
+ options?.forwardProps?.forEach((key) => {
1387
+ if (key in variantProps) restProps[key] = variantProps[key]
1388
+ })
1389
+
1368
1390
  const slotStyles = isConfigRecipe ? svaFn(variantProps) : svaFn.raw(variantProps)
1369
1391
  slotStyles._classNameMap = svaFn.classNameMap
1370
1392
 
@@ -2279,7 +2301,10 @@ function generateReactCreateStyleContext(ctx) {
2279
2301
 
2280
2302
  const WithProvider = forwardRef((props, ref) => {
2281
2303
  const [variantProps, restProps] = svaFn.splitVariantProps(props)
2282
-
2304
+ options?.forwardProps?.forEach((key) => {
2305
+ if (key in variantProps) restProps[key] = variantProps[key]
2306
+ })
2307
+
2283
2308
  const slotStyles = isConfigRecipe ? svaFn(variantProps) : svaFn.raw(variantProps)
2284
2309
  slotStyles._classNameMap = svaFn.classNameMap
2285
2310
 
@@ -2901,6 +2926,14 @@ function generateSolidCreateStyleContext(ctx) {
2901
2926
  const [variantProps, restProps] = svaFn.splitVariantProps(props)
2902
2927
  const [local, propsWithoutChildren] = splitProps(restProps, ["children"])
2903
2928
 
2929
+ // forward selected variant props to the component without losing reactivity
2930
+ const forwardedProps = {}
2931
+ options?.forwardProps?.forEach((key) => {
2932
+ if (key in variantProps) {
2933
+ Object.defineProperty(forwardedProps, key, { get: () => variantProps[key], enumerable: true })
2934
+ }
2935
+ })
2936
+
2904
2937
  const slotStyles = createMemo(() => {
2905
2938
  const styles = isConfigRecipe ? svaFn(variantProps) : svaFn.raw(variantProps)
2906
2939
  styles._classNameMap = svaFn.classNameMap
@@ -2924,7 +2957,7 @@ function generateSolidCreateStyleContext(ctx) {
2924
2957
  get children() {
2925
2958
  return createComponent(
2926
2959
  StyledComponent,
2927
- mergeProps(resolvedProps, {
2960
+ mergeProps(resolvedProps, forwardedProps, {
2928
2961
  get children() {
2929
2962
  return local.children
2930
2963
  },
@@ -3548,6 +3581,9 @@ function generateVueCreateStyleContext(ctx) {
3548
3581
  })
3549
3582
  const res = computed(() => {
3550
3583
  const [variantProps, restProps] = svaFn.splitVariantProps(props.value)
3584
+ options?.forwardProps?.forEach((key) => {
3585
+ if (key in variantProps) restProps[key] = variantProps[key]
3586
+ })
3551
3587
  return { variantProps, restProps }
3552
3588
  })
3553
3589
 
package/dist/index.mjs CHANGED
@@ -224,7 +224,26 @@ function generateStringLiteralCssFn(ctx) {
224
224
  const { separator } = utility;
225
225
  return {
226
226
  dts: outdent4`
227
- export declare function css(template: { raw: readonly string[] | ArrayLike<string> }): string
227
+ ${ctx.file.importType("SystemStyleObject", "../types/index")}
228
+
229
+ type Styles =
230
+ | { raw: readonly string[] | ArrayLike<string> }
231
+ | SystemStyleObject
232
+ | boolean
233
+ | null
234
+ | undefined
235
+
236
+ interface CssRawFunction {
237
+ (...styles: Styles[]): SystemStyleObject
238
+ }
239
+
240
+ interface CssFunction {
241
+ (...styles: Styles[]): string
242
+
243
+ raw: CssRawFunction
244
+ }
245
+
246
+ export declare const css: CssFunction;
228
247
  `,
229
248
  js: outdent4`
230
249
  ${ctx.file.import("astish, createCss, isObject, mergeProps, withoutSpace", "../helpers")}
@@ -1327,7 +1346,10 @@ function generatePreactCreateStyleContext(ctx) {
1327
1346
 
1328
1347
  const WithProvider = forwardRef(function WithProvider(props, ref) {
1329
1348
  const [variantProps, restProps] = svaFn.splitVariantProps(props)
1330
-
1349
+ options?.forwardProps?.forEach((key) => {
1350
+ if (key in variantProps) restProps[key] = variantProps[key]
1351
+ })
1352
+
1331
1353
  const slotStyles = isConfigRecipe ? svaFn(variantProps) : svaFn.raw(variantProps)
1332
1354
  slotStyles._classNameMap = svaFn.classNameMap
1333
1355
 
@@ -2242,7 +2264,10 @@ function generateReactCreateStyleContext(ctx) {
2242
2264
 
2243
2265
  const WithProvider = forwardRef((props, ref) => {
2244
2266
  const [variantProps, restProps] = svaFn.splitVariantProps(props)
2245
-
2267
+ options?.forwardProps?.forEach((key) => {
2268
+ if (key in variantProps) restProps[key] = variantProps[key]
2269
+ })
2270
+
2246
2271
  const slotStyles = isConfigRecipe ? svaFn(variantProps) : svaFn.raw(variantProps)
2247
2272
  slotStyles._classNameMap = svaFn.classNameMap
2248
2273
 
@@ -2864,6 +2889,14 @@ function generateSolidCreateStyleContext(ctx) {
2864
2889
  const [variantProps, restProps] = svaFn.splitVariantProps(props)
2865
2890
  const [local, propsWithoutChildren] = splitProps(restProps, ["children"])
2866
2891
 
2892
+ // forward selected variant props to the component without losing reactivity
2893
+ const forwardedProps = {}
2894
+ options?.forwardProps?.forEach((key) => {
2895
+ if (key in variantProps) {
2896
+ Object.defineProperty(forwardedProps, key, { get: () => variantProps[key], enumerable: true })
2897
+ }
2898
+ })
2899
+
2867
2900
  const slotStyles = createMemo(() => {
2868
2901
  const styles = isConfigRecipe ? svaFn(variantProps) : svaFn.raw(variantProps)
2869
2902
  styles._classNameMap = svaFn.classNameMap
@@ -2887,7 +2920,7 @@ function generateSolidCreateStyleContext(ctx) {
2887
2920
  get children() {
2888
2921
  return createComponent(
2889
2922
  StyledComponent,
2890
- mergeProps(resolvedProps, {
2923
+ mergeProps(resolvedProps, forwardedProps, {
2891
2924
  get children() {
2892
2925
  return local.children
2893
2926
  },
@@ -3511,6 +3544,9 @@ function generateVueCreateStyleContext(ctx) {
3511
3544
  })
3512
3545
  const res = computed(() => {
3513
3546
  const [variantProps, restProps] = svaFn.splitVariantProps(props.value)
3547
+ options?.forwardProps?.forEach((key) => {
3548
+ if (key in variantProps) restProps[key] = variantProps[key]
3549
+ })
3514
3550
  return { variantProps, restProps }
3515
3551
  })
3516
3552
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pandacss/generator",
3
- "version": "1.11.0",
3
+ "version": "1.11.2",
4
4
  "description": "The css generator for css panda",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -36,14 +36,14 @@
36
36
  "javascript-stringify": "2.1.0",
37
37
  "outdent": " ^0.8.0",
38
38
  "pluralize": "8.0.0",
39
- "postcss": "8.5.6",
39
+ "postcss": "8.5.14",
40
40
  "ts-pattern": "5.9.0",
41
- "@pandacss/core": "1.11.0",
42
- "@pandacss/is-valid-prop": "^1.11.0",
43
- "@pandacss/logger": "1.11.0",
44
- "@pandacss/shared": "1.11.0",
45
- "@pandacss/token-dictionary": "1.11.0",
46
- "@pandacss/types": "1.11.0"
41
+ "@pandacss/core": "1.11.2",
42
+ "@pandacss/is-valid-prop": "^1.11.2",
43
+ "@pandacss/logger": "1.11.2",
44
+ "@pandacss/shared": "1.11.2",
45
+ "@pandacss/token-dictionary": "1.11.2",
46
+ "@pandacss/types": "1.11.2"
47
47
  },
48
48
  "devDependencies": {
49
49
  "@types/pluralize": "0.0.33"