@pandacss/generator 0.0.0-dev-20230720154108 → 0.0.0-dev-20230721153104

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
@@ -624,16 +624,22 @@ function generateCssFn(ctx) {
624
624
  return {
625
625
  dts: import_outdent4.outdent`
626
626
  import type { SystemStyleObject } from '../types'
627
- export declare function css(styles: SystemStyleObject): string
627
+
628
+ interface CssFunction {
629
+ (styles: SystemStyleObject): string
630
+ raw: (styles: SystemStyleObject) => SystemStyleObject
631
+ }
632
+
633
+ export declare const css: CssFunction;
628
634
  `,
629
635
  js: import_outdent4.outdent`
630
636
  ${ctx.file.import("createCss, createMergeCss, hypenateProperty, withoutSpace", "../helpers")}
631
637
  ${ctx.file.import("sortConditions, finalizeConditions", "./conditions")}
632
638
 
633
639
  const classNameMap = ${stringify(utility.entries())}
634
-
640
+
635
641
  const shorthands = ${stringify(utility.shorthands)}
636
-
642
+
637
643
  const breakpointKeys = ${JSON.stringify(conditions.breakpoints.keys)}
638
644
 
639
645
  const hasShorthand = ${utility.hasShorthand ? "true" : "false"}
@@ -663,6 +669,7 @@ function generateCssFn(ctx) {
663
669
  }
664
670
 
665
671
  export const css = createCss(context)
672
+ css.raw = (styles) => styles
666
673
 
667
674
  export const { mergeCss, assignCss } = createMergeCss(context)
668
675
  `
@@ -926,8 +933,13 @@ function generatePattern(ctx) {
926
933
 
927
934
  type ${upperName}Options = ${upperName}Properties & Omit<SystemStyleObject, keyof ${upperName}Properties ${blocklistType}>
928
935
 
936
+ interface ${upperName}PatternFn {
937
+ (options?: ${upperName}Options): string
938
+ raw: (options: ${upperName}Options) => ${upperName}Options
939
+ }
940
+
929
941
  ${description ? `/** ${description} */` : ""}
930
- export declare function ${name}(options?: ${upperName}Options): string
942
+ export declare const ${name}: ${upperName}PatternFn;
931
943
  `}
932
944
 
933
945
  `,
@@ -941,6 +953,7 @@ transform`)}
941
953
  export const ${styleFnName} = (styles = {}) => ${name}Config.transform(styles, { map: mapObject })
942
954
 
943
955
  export const ${name} = (styles) => css(${styleFnName}(styles))
956
+ ${name}.raw = (styles) => styles
944
957
  `
945
958
  };
946
959
  });
@@ -1050,6 +1063,7 @@ function generateRecipes(ctx) {
1050
1063
  interface ${upperName}Recipe {
1051
1064
  __type: ${upperName}VariantProps
1052
1065
  (props?: ${upperName}VariantProps): string
1066
+ raw: (props?: ${upperName}VariantProps) => ${upperName}VariantProps
1053
1067
  variantMap: ${upperName}VariantMap
1054
1068
  variantKeys: Array<keyof ${upperName}Variant>
1055
1069
  splitVariantProps<Props extends ${upperName}VariantProps>(props: Props): [${upperName}VariantProps, Pretty<Omit<Props, keyof ${upperName}VariantProps>>]
@@ -1737,12 +1751,16 @@ import { ${upperName} } from '../types/jsx'
1737
1751
  export declare const ${factoryName}: ${upperName}
1738
1752
  `,
1739
1753
  jsxType: import_outdent25.outdent`
1740
- import type { ComponentProps, ElementType } from 'react'
1754
+ import type { ComponentPropsWithoutRef, ElementType, ElementRef, Ref } from 'react'
1741
1755
  import type { Assign, JsxStyleProps, JsxHTMLProps } from './system-types'
1742
1756
  import type { RecipeDefinition, RecipeSelection, RecipeVariantRecord } from './recipe'
1743
1757
 
1744
1758
  type Dict = Record<string, unknown>
1745
1759
 
1760
+ type ComponentProps<T extends ElementType> = Omit<ComponentPropsWithoutRef<T>, 'ref'> & {
1761
+ ref?: Ref<ElementRef<T>>
1762
+ }
1763
+
1746
1764
  export type ${componentName}<T extends ElementType, P extends Dict = {}> = {
1747
1765
  (props: JsxHTMLProps<ComponentProps<T>, Assign<JsxStyleProps, P>>): JSX.Element
1748
1766
  displayName?: string
@@ -1828,10 +1846,14 @@ import { ${upperName} } from '../types/jsx'
1828
1846
  export declare const ${factoryName}: ${upperName}
1829
1847
  `,
1830
1848
  jsxType: import_outdent27.outdent`
1831
- import type { ComponentProps, ElementType } from 'react'
1849
+ import type { ComponentPropsWithoutRef, ElementType, ElementRef, Ref } from 'react'
1832
1850
 
1833
1851
  type Dict = Record<string, unknown>
1834
1852
 
1853
+ type ComponentProps<T extends ElementType> = Omit<ComponentPropsWithoutRef<T>, 'ref'> & {
1854
+ ref?: Ref<ElementRef<T>>
1855
+ }
1856
+
1835
1857
  export type ${componentName}<T extends ElementType> = {
1836
1858
  (args: { raw: readonly string[] | ArrayLike<string> }): (props: ComponentProps<T>) => JSX.Element
1837
1859
  displayName?: string
package/dist/index.mjs CHANGED
@@ -593,16 +593,22 @@ function generateCssFn(ctx) {
593
593
  return {
594
594
  dts: outdent4`
595
595
  import type { SystemStyleObject } from '../types'
596
- export declare function css(styles: SystemStyleObject): string
596
+
597
+ interface CssFunction {
598
+ (styles: SystemStyleObject): string
599
+ raw: (styles: SystemStyleObject) => SystemStyleObject
600
+ }
601
+
602
+ export declare const css: CssFunction;
597
603
  `,
598
604
  js: outdent4`
599
605
  ${ctx.file.import("createCss, createMergeCss, hypenateProperty, withoutSpace", "../helpers")}
600
606
  ${ctx.file.import("sortConditions, finalizeConditions", "./conditions")}
601
607
 
602
608
  const classNameMap = ${stringify(utility.entries())}
603
-
609
+
604
610
  const shorthands = ${stringify(utility.shorthands)}
605
-
611
+
606
612
  const breakpointKeys = ${JSON.stringify(conditions.breakpoints.keys)}
607
613
 
608
614
  const hasShorthand = ${utility.hasShorthand ? "true" : "false"}
@@ -632,6 +638,7 @@ function generateCssFn(ctx) {
632
638
  }
633
639
 
634
640
  export const css = createCss(context)
641
+ css.raw = (styles) => styles
635
642
 
636
643
  export const { mergeCss, assignCss } = createMergeCss(context)
637
644
  `
@@ -895,8 +902,13 @@ function generatePattern(ctx) {
895
902
 
896
903
  type ${upperName}Options = ${upperName}Properties & Omit<SystemStyleObject, keyof ${upperName}Properties ${blocklistType}>
897
904
 
905
+ interface ${upperName}PatternFn {
906
+ (options?: ${upperName}Options): string
907
+ raw: (options: ${upperName}Options) => ${upperName}Options
908
+ }
909
+
898
910
  ${description ? `/** ${description} */` : ""}
899
- export declare function ${name}(options?: ${upperName}Options): string
911
+ export declare const ${name}: ${upperName}PatternFn;
900
912
  `}
901
913
 
902
914
  `,
@@ -910,6 +922,7 @@ transform`)}
910
922
  export const ${styleFnName} = (styles = {}) => ${name}Config.transform(styles, { map: mapObject })
911
923
 
912
924
  export const ${name} = (styles) => css(${styleFnName}(styles))
925
+ ${name}.raw = (styles) => styles
913
926
  `
914
927
  };
915
928
  });
@@ -1019,6 +1032,7 @@ function generateRecipes(ctx) {
1019
1032
  interface ${upperName}Recipe {
1020
1033
  __type: ${upperName}VariantProps
1021
1034
  (props?: ${upperName}VariantProps): string
1035
+ raw: (props?: ${upperName}VariantProps) => ${upperName}VariantProps
1022
1036
  variantMap: ${upperName}VariantMap
1023
1037
  variantKeys: Array<keyof ${upperName}Variant>
1024
1038
  splitVariantProps<Props extends ${upperName}VariantProps>(props: Props): [${upperName}VariantProps, Pretty<Omit<Props, keyof ${upperName}VariantProps>>]
@@ -1706,12 +1720,16 @@ import { ${upperName} } from '../types/jsx'
1706
1720
  export declare const ${factoryName}: ${upperName}
1707
1721
  `,
1708
1722
  jsxType: outdent25`
1709
- import type { ComponentProps, ElementType } from 'react'
1723
+ import type { ComponentPropsWithoutRef, ElementType, ElementRef, Ref } from 'react'
1710
1724
  import type { Assign, JsxStyleProps, JsxHTMLProps } from './system-types'
1711
1725
  import type { RecipeDefinition, RecipeSelection, RecipeVariantRecord } from './recipe'
1712
1726
 
1713
1727
  type Dict = Record<string, unknown>
1714
1728
 
1729
+ type ComponentProps<T extends ElementType> = Omit<ComponentPropsWithoutRef<T>, 'ref'> & {
1730
+ ref?: Ref<ElementRef<T>>
1731
+ }
1732
+
1715
1733
  export type ${componentName}<T extends ElementType, P extends Dict = {}> = {
1716
1734
  (props: JsxHTMLProps<ComponentProps<T>, Assign<JsxStyleProps, P>>): JSX.Element
1717
1735
  displayName?: string
@@ -1797,10 +1815,14 @@ import { ${upperName} } from '../types/jsx'
1797
1815
  export declare const ${factoryName}: ${upperName}
1798
1816
  `,
1799
1817
  jsxType: outdent27`
1800
- import type { ComponentProps, ElementType } from 'react'
1818
+ import type { ComponentPropsWithoutRef, ElementType, ElementRef, Ref } from 'react'
1801
1819
 
1802
1820
  type Dict = Record<string, unknown>
1803
1821
 
1822
+ type ComponentProps<T extends ElementType> = Omit<ComponentPropsWithoutRef<T>, 'ref'> & {
1823
+ ref?: Ref<ElementRef<T>>
1824
+ }
1825
+
1804
1826
  export type ${componentName}<T extends ElementType> = {
1805
1827
  (args: { raw: readonly string[] | ArrayLike<string> }): (props: ComponentProps<T>) => JSX.Element
1806
1828
  displayName?: string
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pandacss/generator",
3
- "version": "0.0.0-dev-20230720154108",
3
+ "version": "0.0.0-dev-20230721153104",
4
4
  "description": "The css generator for css panda",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -20,17 +20,17 @@
20
20
  "pluralize": "8.0.0",
21
21
  "postcss": "8.4.25",
22
22
  "ts-pattern": "5.0.1",
23
- "@pandacss/core": "0.0.0-dev-20230720154108",
24
- "@pandacss/is-valid-prop": "0.0.0-dev-20230720154108",
25
- "@pandacss/logger": "0.0.0-dev-20230720154108",
26
- "@pandacss/shared": "0.0.0-dev-20230720154108",
27
- "@pandacss/token-dictionary": "0.0.0-dev-20230720154108",
28
- "@pandacss/types": "0.0.0-dev-20230720154108"
23
+ "@pandacss/core": "0.0.0-dev-20230721153104",
24
+ "@pandacss/is-valid-prop": "0.0.0-dev-20230721153104",
25
+ "@pandacss/logger": "0.0.0-dev-20230721153104",
26
+ "@pandacss/shared": "0.0.0-dev-20230721153104",
27
+ "@pandacss/token-dictionary": "0.0.0-dev-20230721153104",
28
+ "@pandacss/types": "0.0.0-dev-20230721153104"
29
29
  },
30
30
  "devDependencies": {
31
31
  "@types/pluralize": "0.0.30",
32
32
  "hookable": "5.5.3",
33
- "@pandacss/fixture": "0.0.0-dev-20230720154108"
33
+ "@pandacss/fixture": "0.0.0-dev-20230721153104"
34
34
  },
35
35
  "scripts": {
36
36
  "prebuild": "tsx scripts/prebuild.ts",