@pandacss/generator 1.4.2 → 1.4.3
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 +66 -40
- package/dist/index.mjs +66 -40
- package/package.json +8 -8
package/dist/index.js
CHANGED
|
@@ -2639,7 +2639,7 @@ export interface AsProps {
|
|
|
2639
2639
|
as?: ElementType | undefined
|
|
2640
2640
|
}
|
|
2641
2641
|
|
|
2642
|
-
export type ElementType
|
|
2642
|
+
export type ElementType = keyof JSX.IntrinsicElements | Component<any>
|
|
2643
2643
|
|
|
2644
2644
|
export interface ${componentName}<T extends ElementType, P extends Dict = {}> {
|
|
2645
2645
|
(props: JsxHTMLProps<ComponentProps<T> & UnstyledProps & AsProps, Assign<JsxStyleProps, P>>): JSX.Element
|
|
@@ -2696,7 +2696,7 @@ function generateSolidCreateStyleContext(ctx) {
|
|
|
2696
2696
|
${ctx.file.import(factoryName, "./factory")}
|
|
2697
2697
|
${ctx.file.import("getDisplayName", "./factory-helper")}
|
|
2698
2698
|
import { createComponent, mergeProps } from 'solid-js/web'
|
|
2699
|
-
import { createContext,
|
|
2699
|
+
import { createContext, createMemo, splitProps, useContext } from 'solid-js'
|
|
2700
2700
|
|
|
2701
2701
|
export function createStyleContext(recipe) {
|
|
2702
2702
|
const StyleContext = createContext({})
|
|
@@ -2707,35 +2707,39 @@ function generateSolidCreateStyleContext(ctx) {
|
|
|
2707
2707
|
const { unstyled, ...restProps } = props
|
|
2708
2708
|
if (unstyled) return restProps
|
|
2709
2709
|
if (isConfigRecipe) {
|
|
2710
|
-
return { ...restProps,
|
|
2710
|
+
return { ...restProps, class: cx(slotStyles, restProps.class) }
|
|
2711
2711
|
}
|
|
2712
2712
|
${import_outdent34.outdent.string(
|
|
2713
2713
|
(0, import_ts_pattern11.match)(ctx.config.jsxStyleProps).with("all", () => `return { ...slotStyles, ...restProps }`).with("minimal", () => `return { ...restProps, css: css.raw(slotStyles, restProps.css) }`).with("none", () => `return { ...restProps, class: cx(css(slotStyles), restProps.class) }`).otherwise(() => `return restProps`)
|
|
2714
2714
|
)}
|
|
2715
2715
|
}
|
|
2716
|
-
|
|
2717
2716
|
|
|
2718
2717
|
const withRootProvider = (Component, options) => {
|
|
2719
2718
|
const WithRootProvider = (props) => {
|
|
2720
|
-
const
|
|
2721
|
-
|
|
2722
|
-
|
|
2723
|
-
|
|
2724
|
-
|
|
2719
|
+
const [variantProps, otherProps] = svaFn.splitVariantProps(props)
|
|
2720
|
+
const [local, propsWithoutChildren] = splitProps(otherProps, ['children'])
|
|
2721
|
+
|
|
2722
|
+
const slotStyles = createMemo(() => {
|
|
2723
|
+
const styles = isConfigRecipe ? svaFn(variantProps) : svaFn.raw(variantProps)
|
|
2724
|
+
styles._classNameMap = svaFn.classNameMap
|
|
2725
|
+
return styles
|
|
2726
|
+
})
|
|
2725
2727
|
|
|
2726
|
-
|
|
2727
|
-
|
|
2728
|
-
return {
|
|
2728
|
+
const mergedProps = createMemo(() => {
|
|
2729
|
+
if (!options?.defaultProps) return propsWithoutChildren
|
|
2730
|
+
return { ...options.defaultProps, ...propsWithoutChildren }
|
|
2729
2731
|
})
|
|
2730
2732
|
|
|
2731
2733
|
return createComponent(StyleContext.Provider, {
|
|
2732
|
-
value
|
|
2734
|
+
get value() {
|
|
2735
|
+
return slotStyles()
|
|
2736
|
+
},
|
|
2733
2737
|
get children() {
|
|
2734
2738
|
return createComponent(
|
|
2735
2739
|
Component,
|
|
2736
|
-
mergeProps(
|
|
2740
|
+
mergeProps(mergedProps, {
|
|
2737
2741
|
get children() {
|
|
2738
|
-
return
|
|
2742
|
+
return local.children
|
|
2739
2743
|
},
|
|
2740
2744
|
}),
|
|
2741
2745
|
)
|
|
@@ -2745,7 +2749,6 @@ function generateSolidCreateStyleContext(ctx) {
|
|
|
2745
2749
|
|
|
2746
2750
|
const componentName = getDisplayName(Component)
|
|
2747
2751
|
WithRootProvider.displayName = \`withRootProvider(\${componentName})\`
|
|
2748
|
-
|
|
2749
2752
|
return WithRootProvider
|
|
2750
2753
|
}
|
|
2751
2754
|
|
|
@@ -2753,29 +2756,37 @@ function generateSolidCreateStyleContext(ctx) {
|
|
|
2753
2756
|
const StyledComponent = ${factoryName}(Component, {}, options)
|
|
2754
2757
|
|
|
2755
2758
|
const WithProvider = (props) => {
|
|
2756
|
-
const
|
|
2757
|
-
|
|
2759
|
+
const [variantProps, restProps] = svaFn.splitVariantProps(props)
|
|
2760
|
+
const [local, propsWithoutChildren] = splitProps(restProps, ["children"])
|
|
2758
2761
|
|
|
2759
|
-
|
|
2760
|
-
|
|
2762
|
+
const slotStyles = createMemo(() => {
|
|
2763
|
+
const styles = isConfigRecipe ? svaFn(variantProps) : svaFn.raw(variantProps)
|
|
2764
|
+
styles._classNameMap = svaFn.classNameMap
|
|
2765
|
+
return styles
|
|
2766
|
+
})
|
|
2761
2767
|
|
|
2762
|
-
|
|
2763
|
-
const
|
|
2764
|
-
|
|
2765
|
-
|
|
2766
|
-
|
|
2768
|
+
const resolvedProps = createMemo(() => {
|
|
2769
|
+
const propsWithClass = {
|
|
2770
|
+
...propsWithoutChildren,
|
|
2771
|
+
class: propsWithoutChildren.class ?? options?.defaultProps?.class,
|
|
2772
|
+
}
|
|
2773
|
+
const resolved = getResolvedProps(propsWithClass, slotStyles()[slot])
|
|
2774
|
+
resolved.class = cx(resolved.class, slotStyles()._classNameMap[slot])
|
|
2775
|
+
return resolved
|
|
2767
2776
|
})
|
|
2768
2777
|
|
|
2769
2778
|
return createComponent(StyleContext.Provider, {
|
|
2770
|
-
value
|
|
2779
|
+
get value() {
|
|
2780
|
+
return slotStyles()
|
|
2781
|
+
},
|
|
2771
2782
|
get children() {
|
|
2772
2783
|
return createComponent(
|
|
2773
2784
|
StyledComponent,
|
|
2774
|
-
mergeProps(
|
|
2785
|
+
mergeProps(resolvedProps, {
|
|
2775
2786
|
get children() {
|
|
2776
|
-
return
|
|
2787
|
+
return local.children
|
|
2777
2788
|
},
|
|
2778
|
-
})
|
|
2789
|
+
})
|
|
2779
2790
|
)
|
|
2780
2791
|
},
|
|
2781
2792
|
})
|
|
@@ -2783,7 +2794,6 @@ function generateSolidCreateStyleContext(ctx) {
|
|
|
2783
2794
|
|
|
2784
2795
|
const componentName = getDisplayName(Component)
|
|
2785
2796
|
WithProvider.displayName = \`withProvider(\${componentName})\`
|
|
2786
|
-
|
|
2787
2797
|
return WithProvider
|
|
2788
2798
|
}
|
|
2789
2799
|
|
|
@@ -2792,19 +2802,30 @@ function generateSolidCreateStyleContext(ctx) {
|
|
|
2792
2802
|
|
|
2793
2803
|
const WithContext = (props) => {
|
|
2794
2804
|
const slotStyles = useContext(StyleContext)
|
|
2795
|
-
const
|
|
2796
|
-
|
|
2797
|
-
|
|
2798
|
-
|
|
2799
|
-
|
|
2805
|
+
const [local, propsWithoutChildren] = splitProps(props, ["children"])
|
|
2806
|
+
|
|
2807
|
+
const resolvedProps = createMemo(() => {
|
|
2808
|
+
const propsWithClass = {
|
|
2809
|
+
...propsWithoutChildren,
|
|
2810
|
+
class: propsWithoutChildren.class ?? options?.defaultProps?.class,
|
|
2811
|
+
}
|
|
2812
|
+
const resolved = getResolvedProps(propsWithClass, slotStyles[slot])
|
|
2813
|
+
resolved.class = cx(resolved.class, slotStyles._classNameMap?.[slot])
|
|
2814
|
+
return resolved
|
|
2800
2815
|
})
|
|
2801
2816
|
|
|
2802
|
-
return createComponent(
|
|
2817
|
+
return createComponent(
|
|
2818
|
+
StyledComponent,
|
|
2819
|
+
mergeProps(resolvedProps, {
|
|
2820
|
+
get children() {
|
|
2821
|
+
return local.children
|
|
2822
|
+
},
|
|
2823
|
+
})
|
|
2824
|
+
)
|
|
2803
2825
|
}
|
|
2804
2826
|
|
|
2805
2827
|
const componentName = getDisplayName(Component)
|
|
2806
2828
|
WithContext.displayName = \`withContext(\${componentName})\`
|
|
2807
|
-
|
|
2808
2829
|
return WithContext
|
|
2809
2830
|
}
|
|
2810
2831
|
|
|
@@ -2825,10 +2846,11 @@ function generateSolidCreateStyleContext(ctx) {
|
|
|
2825
2846
|
unstyled?: boolean | undefined
|
|
2826
2847
|
}
|
|
2827
2848
|
|
|
2828
|
-
interface WithProviderOptions<P
|
|
2849
|
+
interface WithProviderOptions<P> {
|
|
2829
2850
|
defaultProps?: Partial<P> | undefined
|
|
2830
2851
|
}
|
|
2831
|
-
|
|
2852
|
+
|
|
2853
|
+
type ElementType = keyof JSX.IntrinsicElements | Component<any>
|
|
2832
2854
|
|
|
2833
2855
|
type SvaFn<S extends string = any> = SlotRecipeRuntimeFn<S, any>
|
|
2834
2856
|
interface SlotRecipeFn {
|
|
@@ -2838,7 +2860,11 @@ function generateSolidCreateStyleContext(ctx) {
|
|
|
2838
2860
|
}
|
|
2839
2861
|
type SlotRecipe = SvaFn | SlotRecipeFn
|
|
2840
2862
|
|
|
2841
|
-
type InferSlot<R extends SlotRecipe> = R extends SlotRecipeFn
|
|
2863
|
+
type InferSlot<R extends SlotRecipe> = R extends SlotRecipeFn
|
|
2864
|
+
? R['__slot']
|
|
2865
|
+
: R extends SvaFn<infer S>
|
|
2866
|
+
? S
|
|
2867
|
+
: never
|
|
2842
2868
|
|
|
2843
2869
|
type StyleContextProvider<T extends ElementType, R extends SlotRecipe> = Component<
|
|
2844
2870
|
JsxHTMLProps<ComponentProps<T> & UnstyledProps, Assign<RecipeVariantProps<R>, JsxStyleProps>>
|
package/dist/index.mjs
CHANGED
|
@@ -2603,7 +2603,7 @@ export interface AsProps {
|
|
|
2603
2603
|
as?: ElementType | undefined
|
|
2604
2604
|
}
|
|
2605
2605
|
|
|
2606
|
-
export type ElementType
|
|
2606
|
+
export type ElementType = keyof JSX.IntrinsicElements | Component<any>
|
|
2607
2607
|
|
|
2608
2608
|
export interface ${componentName}<T extends ElementType, P extends Dict = {}> {
|
|
2609
2609
|
(props: JsxHTMLProps<ComponentProps<T> & UnstyledProps & AsProps, Assign<JsxStyleProps, P>>): JSX.Element
|
|
@@ -2660,7 +2660,7 @@ function generateSolidCreateStyleContext(ctx) {
|
|
|
2660
2660
|
${ctx.file.import(factoryName, "./factory")}
|
|
2661
2661
|
${ctx.file.import("getDisplayName", "./factory-helper")}
|
|
2662
2662
|
import { createComponent, mergeProps } from 'solid-js/web'
|
|
2663
|
-
import { createContext,
|
|
2663
|
+
import { createContext, createMemo, splitProps, useContext } from 'solid-js'
|
|
2664
2664
|
|
|
2665
2665
|
export function createStyleContext(recipe) {
|
|
2666
2666
|
const StyleContext = createContext({})
|
|
@@ -2671,35 +2671,39 @@ function generateSolidCreateStyleContext(ctx) {
|
|
|
2671
2671
|
const { unstyled, ...restProps } = props
|
|
2672
2672
|
if (unstyled) return restProps
|
|
2673
2673
|
if (isConfigRecipe) {
|
|
2674
|
-
return { ...restProps,
|
|
2674
|
+
return { ...restProps, class: cx(slotStyles, restProps.class) }
|
|
2675
2675
|
}
|
|
2676
2676
|
${outdent34.string(
|
|
2677
2677
|
match11(ctx.config.jsxStyleProps).with("all", () => `return { ...slotStyles, ...restProps }`).with("minimal", () => `return { ...restProps, css: css.raw(slotStyles, restProps.css) }`).with("none", () => `return { ...restProps, class: cx(css(slotStyles), restProps.class) }`).otherwise(() => `return restProps`)
|
|
2678
2678
|
)}
|
|
2679
2679
|
}
|
|
2680
|
-
|
|
2681
2680
|
|
|
2682
2681
|
const withRootProvider = (Component, options) => {
|
|
2683
2682
|
const WithRootProvider = (props) => {
|
|
2684
|
-
const
|
|
2685
|
-
|
|
2686
|
-
|
|
2687
|
-
|
|
2688
|
-
|
|
2683
|
+
const [variantProps, otherProps] = svaFn.splitVariantProps(props)
|
|
2684
|
+
const [local, propsWithoutChildren] = splitProps(otherProps, ['children'])
|
|
2685
|
+
|
|
2686
|
+
const slotStyles = createMemo(() => {
|
|
2687
|
+
const styles = isConfigRecipe ? svaFn(variantProps) : svaFn.raw(variantProps)
|
|
2688
|
+
styles._classNameMap = svaFn.classNameMap
|
|
2689
|
+
return styles
|
|
2690
|
+
})
|
|
2689
2691
|
|
|
2690
|
-
|
|
2691
|
-
|
|
2692
|
-
return {
|
|
2692
|
+
const mergedProps = createMemo(() => {
|
|
2693
|
+
if (!options?.defaultProps) return propsWithoutChildren
|
|
2694
|
+
return { ...options.defaultProps, ...propsWithoutChildren }
|
|
2693
2695
|
})
|
|
2694
2696
|
|
|
2695
2697
|
return createComponent(StyleContext.Provider, {
|
|
2696
|
-
value
|
|
2698
|
+
get value() {
|
|
2699
|
+
return slotStyles()
|
|
2700
|
+
},
|
|
2697
2701
|
get children() {
|
|
2698
2702
|
return createComponent(
|
|
2699
2703
|
Component,
|
|
2700
|
-
mergeProps(
|
|
2704
|
+
mergeProps(mergedProps, {
|
|
2701
2705
|
get children() {
|
|
2702
|
-
return
|
|
2706
|
+
return local.children
|
|
2703
2707
|
},
|
|
2704
2708
|
}),
|
|
2705
2709
|
)
|
|
@@ -2709,7 +2713,6 @@ function generateSolidCreateStyleContext(ctx) {
|
|
|
2709
2713
|
|
|
2710
2714
|
const componentName = getDisplayName(Component)
|
|
2711
2715
|
WithRootProvider.displayName = \`withRootProvider(\${componentName})\`
|
|
2712
|
-
|
|
2713
2716
|
return WithRootProvider
|
|
2714
2717
|
}
|
|
2715
2718
|
|
|
@@ -2717,29 +2720,37 @@ function generateSolidCreateStyleContext(ctx) {
|
|
|
2717
2720
|
const StyledComponent = ${factoryName}(Component, {}, options)
|
|
2718
2721
|
|
|
2719
2722
|
const WithProvider = (props) => {
|
|
2720
|
-
const
|
|
2721
|
-
|
|
2723
|
+
const [variantProps, restProps] = svaFn.splitVariantProps(props)
|
|
2724
|
+
const [local, propsWithoutChildren] = splitProps(restProps, ["children"])
|
|
2722
2725
|
|
|
2723
|
-
|
|
2724
|
-
|
|
2726
|
+
const slotStyles = createMemo(() => {
|
|
2727
|
+
const styles = isConfigRecipe ? svaFn(variantProps) : svaFn.raw(variantProps)
|
|
2728
|
+
styles._classNameMap = svaFn.classNameMap
|
|
2729
|
+
return styles
|
|
2730
|
+
})
|
|
2725
2731
|
|
|
2726
|
-
|
|
2727
|
-
const
|
|
2728
|
-
|
|
2729
|
-
|
|
2730
|
-
|
|
2732
|
+
const resolvedProps = createMemo(() => {
|
|
2733
|
+
const propsWithClass = {
|
|
2734
|
+
...propsWithoutChildren,
|
|
2735
|
+
class: propsWithoutChildren.class ?? options?.defaultProps?.class,
|
|
2736
|
+
}
|
|
2737
|
+
const resolved = getResolvedProps(propsWithClass, slotStyles()[slot])
|
|
2738
|
+
resolved.class = cx(resolved.class, slotStyles()._classNameMap[slot])
|
|
2739
|
+
return resolved
|
|
2731
2740
|
})
|
|
2732
2741
|
|
|
2733
2742
|
return createComponent(StyleContext.Provider, {
|
|
2734
|
-
value
|
|
2743
|
+
get value() {
|
|
2744
|
+
return slotStyles()
|
|
2745
|
+
},
|
|
2735
2746
|
get children() {
|
|
2736
2747
|
return createComponent(
|
|
2737
2748
|
StyledComponent,
|
|
2738
|
-
mergeProps(
|
|
2749
|
+
mergeProps(resolvedProps, {
|
|
2739
2750
|
get children() {
|
|
2740
|
-
return
|
|
2751
|
+
return local.children
|
|
2741
2752
|
},
|
|
2742
|
-
})
|
|
2753
|
+
})
|
|
2743
2754
|
)
|
|
2744
2755
|
},
|
|
2745
2756
|
})
|
|
@@ -2747,7 +2758,6 @@ function generateSolidCreateStyleContext(ctx) {
|
|
|
2747
2758
|
|
|
2748
2759
|
const componentName = getDisplayName(Component)
|
|
2749
2760
|
WithProvider.displayName = \`withProvider(\${componentName})\`
|
|
2750
|
-
|
|
2751
2761
|
return WithProvider
|
|
2752
2762
|
}
|
|
2753
2763
|
|
|
@@ -2756,19 +2766,30 @@ function generateSolidCreateStyleContext(ctx) {
|
|
|
2756
2766
|
|
|
2757
2767
|
const WithContext = (props) => {
|
|
2758
2768
|
const slotStyles = useContext(StyleContext)
|
|
2759
|
-
const
|
|
2760
|
-
|
|
2761
|
-
|
|
2762
|
-
|
|
2763
|
-
|
|
2769
|
+
const [local, propsWithoutChildren] = splitProps(props, ["children"])
|
|
2770
|
+
|
|
2771
|
+
const resolvedProps = createMemo(() => {
|
|
2772
|
+
const propsWithClass = {
|
|
2773
|
+
...propsWithoutChildren,
|
|
2774
|
+
class: propsWithoutChildren.class ?? options?.defaultProps?.class,
|
|
2775
|
+
}
|
|
2776
|
+
const resolved = getResolvedProps(propsWithClass, slotStyles[slot])
|
|
2777
|
+
resolved.class = cx(resolved.class, slotStyles._classNameMap?.[slot])
|
|
2778
|
+
return resolved
|
|
2764
2779
|
})
|
|
2765
2780
|
|
|
2766
|
-
return createComponent(
|
|
2781
|
+
return createComponent(
|
|
2782
|
+
StyledComponent,
|
|
2783
|
+
mergeProps(resolvedProps, {
|
|
2784
|
+
get children() {
|
|
2785
|
+
return local.children
|
|
2786
|
+
},
|
|
2787
|
+
})
|
|
2788
|
+
)
|
|
2767
2789
|
}
|
|
2768
2790
|
|
|
2769
2791
|
const componentName = getDisplayName(Component)
|
|
2770
2792
|
WithContext.displayName = \`withContext(\${componentName})\`
|
|
2771
|
-
|
|
2772
2793
|
return WithContext
|
|
2773
2794
|
}
|
|
2774
2795
|
|
|
@@ -2789,10 +2810,11 @@ function generateSolidCreateStyleContext(ctx) {
|
|
|
2789
2810
|
unstyled?: boolean | undefined
|
|
2790
2811
|
}
|
|
2791
2812
|
|
|
2792
|
-
interface WithProviderOptions<P
|
|
2813
|
+
interface WithProviderOptions<P> {
|
|
2793
2814
|
defaultProps?: Partial<P> | undefined
|
|
2794
2815
|
}
|
|
2795
|
-
|
|
2816
|
+
|
|
2817
|
+
type ElementType = keyof JSX.IntrinsicElements | Component<any>
|
|
2796
2818
|
|
|
2797
2819
|
type SvaFn<S extends string = any> = SlotRecipeRuntimeFn<S, any>
|
|
2798
2820
|
interface SlotRecipeFn {
|
|
@@ -2802,7 +2824,11 @@ function generateSolidCreateStyleContext(ctx) {
|
|
|
2802
2824
|
}
|
|
2803
2825
|
type SlotRecipe = SvaFn | SlotRecipeFn
|
|
2804
2826
|
|
|
2805
|
-
type InferSlot<R extends SlotRecipe> = R extends SlotRecipeFn
|
|
2827
|
+
type InferSlot<R extends SlotRecipe> = R extends SlotRecipeFn
|
|
2828
|
+
? R['__slot']
|
|
2829
|
+
: R extends SvaFn<infer S>
|
|
2830
|
+
? S
|
|
2831
|
+
: never
|
|
2806
2832
|
|
|
2807
2833
|
type StyleContextProvider<T extends ElementType, R extends SlotRecipe> = Component<
|
|
2808
2834
|
JsxHTMLProps<ComponentProps<T> & UnstyledProps, Assign<RecipeVariantProps<R>, JsxStyleProps>>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pandacss/generator",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.3",
|
|
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.
|
|
39
|
+
"postcss": "8.5.6",
|
|
40
40
|
"ts-pattern": "5.8.0",
|
|
41
|
-
"@pandacss/core": "1.4.
|
|
42
|
-
"@pandacss/is-valid-prop": "^1.4.
|
|
43
|
-
"@pandacss/logger": "1.4.
|
|
44
|
-
"@pandacss/shared": "1.4.
|
|
45
|
-
"@pandacss/token-dictionary": "1.4.
|
|
46
|
-
"@pandacss/types": "1.4.
|
|
41
|
+
"@pandacss/core": "1.4.3",
|
|
42
|
+
"@pandacss/is-valid-prop": "^1.4.3",
|
|
43
|
+
"@pandacss/logger": "1.4.3",
|
|
44
|
+
"@pandacss/shared": "1.4.3",
|
|
45
|
+
"@pandacss/token-dictionary": "1.4.3",
|
|
46
|
+
"@pandacss/types": "1.4.3"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"@types/pluralize": "0.0.33"
|