@pandacss/generator 0.0.0-dev-20240108181940 → 0.0.0-dev-20240108205048
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 +91 -26
- package/dist/index.mjs +91 -26
- package/package.json +7 -7
package/dist/index.js
CHANGED
|
@@ -36,7 +36,7 @@ module.exports = __toCommonJS(src_exports);
|
|
|
36
36
|
|
|
37
37
|
// src/generator.ts
|
|
38
38
|
var import_core4 = require("@pandacss/core");
|
|
39
|
-
var
|
|
39
|
+
var import_ts_pattern12 = require("ts-pattern");
|
|
40
40
|
|
|
41
41
|
// src/artifacts/setup-artifacts.ts
|
|
42
42
|
var import_outdent43 = __toESM(require("outdent"));
|
|
@@ -2818,9 +2818,10 @@ var generateTypesEntry = (ctx, isJsxRequired) => {
|
|
|
2818
2818
|
|
|
2819
2819
|
// src/artifacts/types/prop-types.ts
|
|
2820
2820
|
var import_outdent40 = require("outdent");
|
|
2821
|
+
var import_ts_pattern11 = require("ts-pattern");
|
|
2821
2822
|
function generatePropTypes(ctx) {
|
|
2822
2823
|
const {
|
|
2823
|
-
config: { strictTokens },
|
|
2824
|
+
config: { strictTokens, strictPropertyValues },
|
|
2824
2825
|
utility
|
|
2825
2826
|
} = ctx;
|
|
2826
2827
|
const result = [
|
|
@@ -2850,40 +2851,104 @@ function generatePropTypes(ctx) {
|
|
|
2850
2851
|
return import_outdent40.outdent`
|
|
2851
2852
|
${result.join("\n")}
|
|
2852
2853
|
|
|
2853
|
-
|
|
2854
|
-
|
|
2855
|
-
|
|
2856
|
-
|
|
2857
|
-
|
|
2858
|
-
|
|
2859
|
-
|
|
2860
|
-
|
|
2861
|
-
|
|
2862
|
-
|
|
2863
|
-
|
|
2864
|
-
|
|
2865
|
-
|
|
2866
|
-
|
|
2867
|
-
|
|
2868
|
-
|
|
2869
|
-
|
|
2870
|
-
|
|
2871
|
-
|
|
2854
|
+
type StrictableProps =
|
|
2855
|
+
| 'alignContent'
|
|
2856
|
+
| 'alignItems'
|
|
2857
|
+
| 'alignSelf'
|
|
2858
|
+
| 'all'
|
|
2859
|
+
| 'animationComposition'
|
|
2860
|
+
| 'animationDirection'
|
|
2861
|
+
| 'animationFillMode'
|
|
2862
|
+
| 'appearance'
|
|
2863
|
+
| 'backfaceVisibility'
|
|
2864
|
+
| 'backgroundAttachment'
|
|
2865
|
+
| 'backgroundClip'
|
|
2866
|
+
| 'borderCollapse'
|
|
2867
|
+
| 'border'
|
|
2868
|
+
| 'borderBlock'
|
|
2869
|
+
| 'borderBlockEnd'
|
|
2870
|
+
| 'borderBlockStart'
|
|
2871
|
+
| 'borderBottom'
|
|
2872
|
+
| 'borderInline'
|
|
2873
|
+
| 'borderInlineEnd'
|
|
2874
|
+
| 'borderInlineStart'
|
|
2875
|
+
| 'borderLeft'
|
|
2876
|
+
| 'borderRight'
|
|
2877
|
+
| 'borderTop'
|
|
2878
|
+
| 'borderBlockEndStyle'
|
|
2879
|
+
| 'borderBlockStartStyle'
|
|
2880
|
+
| 'borderBlockStyle'
|
|
2881
|
+
| 'borderBottomStyle'
|
|
2882
|
+
| 'borderInlineEndStyle'
|
|
2883
|
+
| 'borderInlineStartStyle'
|
|
2884
|
+
| 'borderInlineStyle'
|
|
2885
|
+
| 'borderLeftStyle'
|
|
2886
|
+
| 'borderRightStyle'
|
|
2887
|
+
| 'borderTopStyle'
|
|
2888
|
+
| 'boxDecorationBreak'
|
|
2889
|
+
| 'boxSizing'
|
|
2890
|
+
| 'breakAfter'
|
|
2891
|
+
| 'breakBefore'
|
|
2892
|
+
| 'breakInside'
|
|
2893
|
+
| 'captionSide'
|
|
2894
|
+
| 'clear'
|
|
2895
|
+
| 'columnFill'
|
|
2896
|
+
| 'columnRuleStyle'
|
|
2897
|
+
| 'contentVisibility'
|
|
2898
|
+
| 'direction'
|
|
2899
|
+
| 'display'
|
|
2900
|
+
| 'emptyCells'
|
|
2901
|
+
| 'flexDirection'
|
|
2902
|
+
| 'flexWrap'
|
|
2903
|
+
| 'float'
|
|
2904
|
+
| 'fontKerning'
|
|
2905
|
+
| 'forcedColorAdjust'
|
|
2906
|
+
| 'isolation'
|
|
2907
|
+
| 'lineBreak'
|
|
2908
|
+
| 'mixBlendMode'
|
|
2909
|
+
| 'objectFit'
|
|
2910
|
+
| 'outlineStyle'
|
|
2911
|
+
| 'overflow'
|
|
2912
|
+
| 'overflowX'
|
|
2913
|
+
| 'overflowY'
|
|
2914
|
+
| 'overflowBlock'
|
|
2915
|
+
| 'overflowInline'
|
|
2916
|
+
| 'overflowWrap'
|
|
2917
|
+
| 'pointerEvents'
|
|
2918
|
+
| 'position'
|
|
2919
|
+
| 'resize'
|
|
2920
|
+
| 'scrollBehavior'
|
|
2921
|
+
| 'touchAction'
|
|
2922
|
+
| 'transformBox'
|
|
2923
|
+
| 'transformStyle'
|
|
2924
|
+
| 'userSelect'
|
|
2925
|
+
| 'visibility'
|
|
2926
|
+
| 'wordBreak'
|
|
2927
|
+
| 'writingMode'
|
|
2928
|
+
type WithEscapeHatch<T> = T | \`[\${string}]\`
|
|
2929
|
+
type FilterVagueString<Key, Value> = Value extends boolean
|
|
2930
|
+
? Value
|
|
2931
|
+
: Key extends StrictableProps
|
|
2932
|
+
? Value extends \`\${infer _}\` ? Value : never
|
|
2933
|
+
: Value
|
|
2934
|
+
type PropOrCondition<Key, Value> = ${(0, import_ts_pattern11.match)(ctx.config).with(
|
|
2935
|
+
{ strictTokens: true, strictPropertyValues: true },
|
|
2936
|
+
() => "ConditionalValue<WithEscapeHatch<FilterVagueString<Key, Value>>>"
|
|
2937
|
+
).with({ strictTokens: true }, () => "ConditionalValue<WithEscapeHatch<Value>>").with({ strictPropertyValues: true }, () => "ConditionalValue<WithEscapeHatch<FilterVagueString<Key, Value>>>").otherwise(() => "ConditionalValue<Value | (string & {})>")}
|
|
2872
2938
|
|
|
2873
2939
|
type PropertyTypeValue<T extends string> = T extends keyof PropertyTypes
|
|
2874
|
-
?
|
|
2940
|
+
? PropOrCondition<T, ${strictPropertyValues && !strictTokens ? "T extends StrictableProps ? PropertyTypes[T] : PropertyTypes[T] | CssValue<T>" : "PropertyTypes[T] | CssValue<T>"}>
|
|
2875
2941
|
: never;
|
|
2876
2942
|
|
|
2877
2943
|
type CssPropertyValue<T extends string> = T extends keyof CssProperties
|
|
2878
|
-
?
|
|
2944
|
+
? PropOrCondition<T, CssProperties[T]>
|
|
2879
2945
|
: never;
|
|
2880
2946
|
|
|
2881
2947
|
export type PropertyValue<T extends string> = T extends keyof PropertyTypes
|
|
2882
2948
|
? PropertyTypeValue<T>
|
|
2883
2949
|
: T extends keyof CssProperties
|
|
2884
2950
|
? CssPropertyValue<T>
|
|
2885
|
-
:
|
|
2886
|
-
`}
|
|
2951
|
+
: PropOrCondition<T, string | number>
|
|
2887
2952
|
`;
|
|
2888
2953
|
}
|
|
2889
2954
|
|
|
@@ -3795,7 +3860,7 @@ var Generator = class extends import_core4.Context {
|
|
|
3795
3860
|
return generateArtifacts(this, ids);
|
|
3796
3861
|
};
|
|
3797
3862
|
appendCssOfType = (type, sheet) => {
|
|
3798
|
-
(0,
|
|
3863
|
+
(0, import_ts_pattern12.match)(type).with("preflight", () => generateResetCss(this, sheet)).with("tokens", () => generateTokenCss(this, sheet)).with("static", () => generateStaticCss(this, sheet)).with("global", () => generateGlobalCss(this, sheet)).with("keyframes", () => generateKeyframeCss(this, sheet)).otherwise(() => {
|
|
3799
3864
|
throw new Error(`Unknown css artifact type <${type}>`);
|
|
3800
3865
|
});
|
|
3801
3866
|
};
|
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// src/generator.ts
|
|
2
2
|
import { Context } from "@pandacss/core";
|
|
3
|
-
import { match as
|
|
3
|
+
import { match as match12 } from "ts-pattern";
|
|
4
4
|
|
|
5
5
|
// src/artifacts/setup-artifacts.ts
|
|
6
6
|
import outdent43 from "outdent";
|
|
@@ -2782,9 +2782,10 @@ var generateTypesEntry = (ctx, isJsxRequired) => {
|
|
|
2782
2782
|
|
|
2783
2783
|
// src/artifacts/types/prop-types.ts
|
|
2784
2784
|
import { outdent as outdent40 } from "outdent";
|
|
2785
|
+
import { match as match11 } from "ts-pattern";
|
|
2785
2786
|
function generatePropTypes(ctx) {
|
|
2786
2787
|
const {
|
|
2787
|
-
config: { strictTokens },
|
|
2788
|
+
config: { strictTokens, strictPropertyValues },
|
|
2788
2789
|
utility
|
|
2789
2790
|
} = ctx;
|
|
2790
2791
|
const result = [
|
|
@@ -2814,40 +2815,104 @@ function generatePropTypes(ctx) {
|
|
|
2814
2815
|
return outdent40`
|
|
2815
2816
|
${result.join("\n")}
|
|
2816
2817
|
|
|
2817
|
-
|
|
2818
|
-
|
|
2819
|
-
|
|
2820
|
-
|
|
2821
|
-
|
|
2822
|
-
|
|
2823
|
-
|
|
2824
|
-
|
|
2825
|
-
|
|
2826
|
-
|
|
2827
|
-
|
|
2828
|
-
|
|
2829
|
-
|
|
2830
|
-
|
|
2831
|
-
|
|
2832
|
-
|
|
2833
|
-
|
|
2834
|
-
|
|
2835
|
-
|
|
2818
|
+
type StrictableProps =
|
|
2819
|
+
| 'alignContent'
|
|
2820
|
+
| 'alignItems'
|
|
2821
|
+
| 'alignSelf'
|
|
2822
|
+
| 'all'
|
|
2823
|
+
| 'animationComposition'
|
|
2824
|
+
| 'animationDirection'
|
|
2825
|
+
| 'animationFillMode'
|
|
2826
|
+
| 'appearance'
|
|
2827
|
+
| 'backfaceVisibility'
|
|
2828
|
+
| 'backgroundAttachment'
|
|
2829
|
+
| 'backgroundClip'
|
|
2830
|
+
| 'borderCollapse'
|
|
2831
|
+
| 'border'
|
|
2832
|
+
| 'borderBlock'
|
|
2833
|
+
| 'borderBlockEnd'
|
|
2834
|
+
| 'borderBlockStart'
|
|
2835
|
+
| 'borderBottom'
|
|
2836
|
+
| 'borderInline'
|
|
2837
|
+
| 'borderInlineEnd'
|
|
2838
|
+
| 'borderInlineStart'
|
|
2839
|
+
| 'borderLeft'
|
|
2840
|
+
| 'borderRight'
|
|
2841
|
+
| 'borderTop'
|
|
2842
|
+
| 'borderBlockEndStyle'
|
|
2843
|
+
| 'borderBlockStartStyle'
|
|
2844
|
+
| 'borderBlockStyle'
|
|
2845
|
+
| 'borderBottomStyle'
|
|
2846
|
+
| 'borderInlineEndStyle'
|
|
2847
|
+
| 'borderInlineStartStyle'
|
|
2848
|
+
| 'borderInlineStyle'
|
|
2849
|
+
| 'borderLeftStyle'
|
|
2850
|
+
| 'borderRightStyle'
|
|
2851
|
+
| 'borderTopStyle'
|
|
2852
|
+
| 'boxDecorationBreak'
|
|
2853
|
+
| 'boxSizing'
|
|
2854
|
+
| 'breakAfter'
|
|
2855
|
+
| 'breakBefore'
|
|
2856
|
+
| 'breakInside'
|
|
2857
|
+
| 'captionSide'
|
|
2858
|
+
| 'clear'
|
|
2859
|
+
| 'columnFill'
|
|
2860
|
+
| 'columnRuleStyle'
|
|
2861
|
+
| 'contentVisibility'
|
|
2862
|
+
| 'direction'
|
|
2863
|
+
| 'display'
|
|
2864
|
+
| 'emptyCells'
|
|
2865
|
+
| 'flexDirection'
|
|
2866
|
+
| 'flexWrap'
|
|
2867
|
+
| 'float'
|
|
2868
|
+
| 'fontKerning'
|
|
2869
|
+
| 'forcedColorAdjust'
|
|
2870
|
+
| 'isolation'
|
|
2871
|
+
| 'lineBreak'
|
|
2872
|
+
| 'mixBlendMode'
|
|
2873
|
+
| 'objectFit'
|
|
2874
|
+
| 'outlineStyle'
|
|
2875
|
+
| 'overflow'
|
|
2876
|
+
| 'overflowX'
|
|
2877
|
+
| 'overflowY'
|
|
2878
|
+
| 'overflowBlock'
|
|
2879
|
+
| 'overflowInline'
|
|
2880
|
+
| 'overflowWrap'
|
|
2881
|
+
| 'pointerEvents'
|
|
2882
|
+
| 'position'
|
|
2883
|
+
| 'resize'
|
|
2884
|
+
| 'scrollBehavior'
|
|
2885
|
+
| 'touchAction'
|
|
2886
|
+
| 'transformBox'
|
|
2887
|
+
| 'transformStyle'
|
|
2888
|
+
| 'userSelect'
|
|
2889
|
+
| 'visibility'
|
|
2890
|
+
| 'wordBreak'
|
|
2891
|
+
| 'writingMode'
|
|
2892
|
+
type WithEscapeHatch<T> = T | \`[\${string}]\`
|
|
2893
|
+
type FilterVagueString<Key, Value> = Value extends boolean
|
|
2894
|
+
? Value
|
|
2895
|
+
: Key extends StrictableProps
|
|
2896
|
+
? Value extends \`\${infer _}\` ? Value : never
|
|
2897
|
+
: Value
|
|
2898
|
+
type PropOrCondition<Key, Value> = ${match11(ctx.config).with(
|
|
2899
|
+
{ strictTokens: true, strictPropertyValues: true },
|
|
2900
|
+
() => "ConditionalValue<WithEscapeHatch<FilterVagueString<Key, Value>>>"
|
|
2901
|
+
).with({ strictTokens: true }, () => "ConditionalValue<WithEscapeHatch<Value>>").with({ strictPropertyValues: true }, () => "ConditionalValue<WithEscapeHatch<FilterVagueString<Key, Value>>>").otherwise(() => "ConditionalValue<Value | (string & {})>")}
|
|
2836
2902
|
|
|
2837
2903
|
type PropertyTypeValue<T extends string> = T extends keyof PropertyTypes
|
|
2838
|
-
?
|
|
2904
|
+
? PropOrCondition<T, ${strictPropertyValues && !strictTokens ? "T extends StrictableProps ? PropertyTypes[T] : PropertyTypes[T] | CssValue<T>" : "PropertyTypes[T] | CssValue<T>"}>
|
|
2839
2905
|
: never;
|
|
2840
2906
|
|
|
2841
2907
|
type CssPropertyValue<T extends string> = T extends keyof CssProperties
|
|
2842
|
-
?
|
|
2908
|
+
? PropOrCondition<T, CssProperties[T]>
|
|
2843
2909
|
: never;
|
|
2844
2910
|
|
|
2845
2911
|
export type PropertyValue<T extends string> = T extends keyof PropertyTypes
|
|
2846
2912
|
? PropertyTypeValue<T>
|
|
2847
2913
|
: T extends keyof CssProperties
|
|
2848
2914
|
? CssPropertyValue<T>
|
|
2849
|
-
:
|
|
2850
|
-
`}
|
|
2915
|
+
: PropOrCondition<T, string | number>
|
|
2851
2916
|
`;
|
|
2852
2917
|
}
|
|
2853
2918
|
|
|
@@ -3759,7 +3824,7 @@ var Generator = class extends Context {
|
|
|
3759
3824
|
return generateArtifacts(this, ids);
|
|
3760
3825
|
};
|
|
3761
3826
|
appendCssOfType = (type, sheet) => {
|
|
3762
|
-
|
|
3827
|
+
match12(type).with("preflight", () => generateResetCss(this, sheet)).with("tokens", () => generateTokenCss(this, sheet)).with("static", () => generateStaticCss(this, sheet)).with("global", () => generateGlobalCss(this, sheet)).with("keyframes", () => generateKeyframeCss(this, sheet)).otherwise(() => {
|
|
3763
3828
|
throw new Error(`Unknown css artifact type <${type}>`);
|
|
3764
3829
|
});
|
|
3765
3830
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pandacss/generator",
|
|
3
|
-
"version": "0.0.0-dev-
|
|
3
|
+
"version": "0.0.0-dev-20240108205048",
|
|
4
4
|
"description": "The css generator for css panda",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -37,12 +37,12 @@
|
|
|
37
37
|
"pluralize": "8.0.0",
|
|
38
38
|
"postcss": "^8.4.31",
|
|
39
39
|
"ts-pattern": "5.0.5",
|
|
40
|
-
"@pandacss/core": "0.0.0-dev-
|
|
41
|
-
"@pandacss/is-valid-prop": "^0.0.0-dev-
|
|
42
|
-
"@pandacss/logger": "0.0.0-dev-
|
|
43
|
-
"@pandacss/shared": "0.0.0-dev-
|
|
44
|
-
"@pandacss/token-dictionary": "0.0.0-dev-
|
|
45
|
-
"@pandacss/types": "0.0.0-dev-
|
|
40
|
+
"@pandacss/core": "0.0.0-dev-20240108205048",
|
|
41
|
+
"@pandacss/is-valid-prop": "^0.0.0-dev-20240108205048",
|
|
42
|
+
"@pandacss/logger": "0.0.0-dev-20240108205048",
|
|
43
|
+
"@pandacss/shared": "0.0.0-dev-20240108205048",
|
|
44
|
+
"@pandacss/token-dictionary": "0.0.0-dev-20240108205048",
|
|
45
|
+
"@pandacss/types": "0.0.0-dev-20240108205048"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"@types/pluralize": "0.0.33",
|