@pandacss/generator 0.7.0 → 0.8.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.d.mts +38 -24
- package/dist/index.d.ts +38 -24
- package/dist/index.js +53 -32
- package/dist/index.mjs +53 -32
- package/package.json +9 -9
package/dist/index.d.mts
CHANGED
|
@@ -3,18 +3,11 @@ import * as _pandacss_core from '@pandacss/core';
|
|
|
3
3
|
import * as _pandacss_token_dictionary from '@pandacss/token-dictionary';
|
|
4
4
|
import * as _pandacss_types from '@pandacss/types';
|
|
5
5
|
import { ConfigResultWithHooks, TSConfig } from '@pandacss/types';
|
|
6
|
-
import * as _pandacss_core_src_types from '@pandacss/core/src/types';
|
|
7
6
|
|
|
8
7
|
declare const getEngine: (conf: ConfigResultWithHooks) => {
|
|
9
8
|
patterns: {
|
|
10
|
-
transform: (name: string, data: _pandacss_types.Dict) => _pandacss_types.SystemStyleObject;
|
|
11
|
-
nodes: {
|
|
12
|
-
type: "pattern";
|
|
13
|
-
name: string;
|
|
14
|
-
props: string[];
|
|
15
|
-
baseName: string;
|
|
16
|
-
}[];
|
|
17
9
|
patterns: Record<string, _pandacss_types.PatternConfig>;
|
|
10
|
+
transform: (name: string, data: _pandacss_types.Dict) => _pandacss_types.SystemStyleObject;
|
|
18
11
|
getConfig: (name: string) => _pandacss_types.PatternConfig;
|
|
19
12
|
getNames: (name: string) => {
|
|
20
13
|
name: string;
|
|
@@ -33,6 +26,12 @@ declare const getEngine: (conf: ConfigResultWithHooks) => {
|
|
|
33
26
|
styleFnName: string;
|
|
34
27
|
jsxName: string;
|
|
35
28
|
}[];
|
|
29
|
+
nodes: {
|
|
30
|
+
type: "pattern";
|
|
31
|
+
name: string;
|
|
32
|
+
props: string[];
|
|
33
|
+
baseName: string;
|
|
34
|
+
}[];
|
|
36
35
|
getFnName: (jsx: string) => string;
|
|
37
36
|
isEmpty: () => boolean;
|
|
38
37
|
};
|
|
@@ -41,7 +40,7 @@ declare const getEngine: (conf: ConfigResultWithHooks) => {
|
|
|
41
40
|
upperName: string;
|
|
42
41
|
typeName: string;
|
|
43
42
|
componentName: string;
|
|
44
|
-
framework: ("
|
|
43
|
+
framework: ("react" | "solid" | "preact" | "vue" | "qwik") | undefined;
|
|
45
44
|
};
|
|
46
45
|
paths: {
|
|
47
46
|
get: (file?: string | undefined) => string[];
|
|
@@ -87,8 +86,9 @@ declare const getEngine: (conf: ConfigResultWithHooks) => {
|
|
|
87
86
|
createSheet: (options?: Pick<_pandacss_core.StylesheetOptions, "content"> | undefined) => _pandacss_core.Stylesheet;
|
|
88
87
|
hooks: _pandacss_types.PandaHookable;
|
|
89
88
|
path: string;
|
|
90
|
-
config: _pandacss_types_dist_shared.UnwrapExtend<_pandacss_types.RequiredBy<_pandacss_types.Config, "
|
|
89
|
+
config: _pandacss_types_dist_shared.UnwrapExtend<_pandacss_types.RequiredBy<_pandacss_types.Config, "outdir" | "cwd" | "include">>;
|
|
91
90
|
tsconfig?: TSConfig | undefined;
|
|
91
|
+
tsOptions?: _pandacss_types.ConfigTsOptions | undefined;
|
|
92
92
|
tsconfigFile?: string | undefined;
|
|
93
93
|
dependencies: string[];
|
|
94
94
|
};
|
|
@@ -155,10 +155,10 @@ declare const createGenerator: (conf: ConfigResultWithHooks) => {
|
|
|
155
155
|
};
|
|
156
156
|
parserOptions: {
|
|
157
157
|
importMap: {
|
|
158
|
-
css: string;
|
|
159
|
-
recipe: string;
|
|
160
|
-
pattern: string;
|
|
161
|
-
jsx: string;
|
|
158
|
+
css: string[];
|
|
159
|
+
recipe: string[];
|
|
160
|
+
pattern: string[];
|
|
161
|
+
jsx: string[];
|
|
162
162
|
};
|
|
163
163
|
jsx: {
|
|
164
164
|
factory: string;
|
|
@@ -177,17 +177,24 @@ declare const createGenerator: (conf: ConfigResultWithHooks) => {
|
|
|
177
177
|
match: RegExp;
|
|
178
178
|
})[];
|
|
179
179
|
};
|
|
180
|
-
getRecipesByJsxName: (jsxName: string) =>
|
|
181
|
-
};
|
|
182
|
-
patterns: {
|
|
183
|
-
transform: (name: string, data: _pandacss_types.Dict) => _pandacss_types.SystemStyleObject;
|
|
184
|
-
nodes: {
|
|
185
|
-
type: "pattern";
|
|
180
|
+
getRecipesByJsxName: (jsxName: string) => {
|
|
186
181
|
name: string;
|
|
187
|
-
|
|
188
|
-
|
|
182
|
+
variantKeys: string[];
|
|
183
|
+
variantKeyMap: Record<string, string[]>;
|
|
184
|
+
jsx: (string | RegExp)[];
|
|
185
|
+
upperName: string;
|
|
186
|
+
dashName: string;
|
|
187
|
+
jsxName: string;
|
|
188
|
+
match: RegExp;
|
|
189
|
+
config: _pandacss_types.RecipeConfig;
|
|
190
|
+
splitProps: (props: _pandacss_types.Dict) => [_pandacss_types.Dict, _pandacss_types.Dict];
|
|
189
191
|
}[];
|
|
192
|
+
compilerOptions: any;
|
|
193
|
+
tsOptions: _pandacss_types.ConfigTsOptions | undefined;
|
|
194
|
+
};
|
|
195
|
+
patterns: {
|
|
190
196
|
patterns: Record<string, _pandacss_types.PatternConfig>;
|
|
197
|
+
transform: (name: string, data: _pandacss_types.Dict) => _pandacss_types.SystemStyleObject;
|
|
191
198
|
getConfig: (name: string) => _pandacss_types.PatternConfig;
|
|
192
199
|
getNames: (name: string) => {
|
|
193
200
|
name: string;
|
|
@@ -206,6 +213,12 @@ declare const createGenerator: (conf: ConfigResultWithHooks) => {
|
|
|
206
213
|
styleFnName: string;
|
|
207
214
|
jsxName: string;
|
|
208
215
|
}[];
|
|
216
|
+
nodes: {
|
|
217
|
+
type: "pattern";
|
|
218
|
+
name: string;
|
|
219
|
+
props: string[];
|
|
220
|
+
baseName: string;
|
|
221
|
+
}[];
|
|
209
222
|
getFnName: (jsx: string) => string;
|
|
210
223
|
isEmpty: () => boolean;
|
|
211
224
|
};
|
|
@@ -214,7 +227,7 @@ declare const createGenerator: (conf: ConfigResultWithHooks) => {
|
|
|
214
227
|
upperName: string;
|
|
215
228
|
typeName: string;
|
|
216
229
|
componentName: string;
|
|
217
|
-
framework: ("
|
|
230
|
+
framework: ("react" | "solid" | "preact" | "vue" | "qwik") | undefined;
|
|
218
231
|
};
|
|
219
232
|
paths: {
|
|
220
233
|
get: (file?: string | undefined) => string[];
|
|
@@ -260,8 +273,9 @@ declare const createGenerator: (conf: ConfigResultWithHooks) => {
|
|
|
260
273
|
createSheet: (options?: Pick<_pandacss_core.StylesheetOptions, "content"> | undefined) => _pandacss_core.Stylesheet;
|
|
261
274
|
hooks: _pandacss_types.PandaHookable;
|
|
262
275
|
path: string;
|
|
263
|
-
config: _pandacss_types_dist_shared.UnwrapExtend<_pandacss_types.RequiredBy<_pandacss_types.Config, "
|
|
276
|
+
config: _pandacss_types_dist_shared.UnwrapExtend<_pandacss_types.RequiredBy<_pandacss_types.Config, "outdir" | "cwd" | "include">>;
|
|
264
277
|
tsconfig?: TSConfig | undefined;
|
|
278
|
+
tsOptions?: _pandacss_types.ConfigTsOptions | undefined;
|
|
265
279
|
tsconfigFile?: string | undefined;
|
|
266
280
|
dependencies: string[];
|
|
267
281
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -3,18 +3,11 @@ import * as _pandacss_core from '@pandacss/core';
|
|
|
3
3
|
import * as _pandacss_token_dictionary from '@pandacss/token-dictionary';
|
|
4
4
|
import * as _pandacss_types from '@pandacss/types';
|
|
5
5
|
import { ConfigResultWithHooks, TSConfig } from '@pandacss/types';
|
|
6
|
-
import * as _pandacss_core_src_types from '@pandacss/core/src/types';
|
|
7
6
|
|
|
8
7
|
declare const getEngine: (conf: ConfigResultWithHooks) => {
|
|
9
8
|
patterns: {
|
|
10
|
-
transform: (name: string, data: _pandacss_types.Dict) => _pandacss_types.SystemStyleObject;
|
|
11
|
-
nodes: {
|
|
12
|
-
type: "pattern";
|
|
13
|
-
name: string;
|
|
14
|
-
props: string[];
|
|
15
|
-
baseName: string;
|
|
16
|
-
}[];
|
|
17
9
|
patterns: Record<string, _pandacss_types.PatternConfig>;
|
|
10
|
+
transform: (name: string, data: _pandacss_types.Dict) => _pandacss_types.SystemStyleObject;
|
|
18
11
|
getConfig: (name: string) => _pandacss_types.PatternConfig;
|
|
19
12
|
getNames: (name: string) => {
|
|
20
13
|
name: string;
|
|
@@ -33,6 +26,12 @@ declare const getEngine: (conf: ConfigResultWithHooks) => {
|
|
|
33
26
|
styleFnName: string;
|
|
34
27
|
jsxName: string;
|
|
35
28
|
}[];
|
|
29
|
+
nodes: {
|
|
30
|
+
type: "pattern";
|
|
31
|
+
name: string;
|
|
32
|
+
props: string[];
|
|
33
|
+
baseName: string;
|
|
34
|
+
}[];
|
|
36
35
|
getFnName: (jsx: string) => string;
|
|
37
36
|
isEmpty: () => boolean;
|
|
38
37
|
};
|
|
@@ -41,7 +40,7 @@ declare const getEngine: (conf: ConfigResultWithHooks) => {
|
|
|
41
40
|
upperName: string;
|
|
42
41
|
typeName: string;
|
|
43
42
|
componentName: string;
|
|
44
|
-
framework: ("
|
|
43
|
+
framework: ("react" | "solid" | "preact" | "vue" | "qwik") | undefined;
|
|
45
44
|
};
|
|
46
45
|
paths: {
|
|
47
46
|
get: (file?: string | undefined) => string[];
|
|
@@ -87,8 +86,9 @@ declare const getEngine: (conf: ConfigResultWithHooks) => {
|
|
|
87
86
|
createSheet: (options?: Pick<_pandacss_core.StylesheetOptions, "content"> | undefined) => _pandacss_core.Stylesheet;
|
|
88
87
|
hooks: _pandacss_types.PandaHookable;
|
|
89
88
|
path: string;
|
|
90
|
-
config: _pandacss_types_dist_shared.UnwrapExtend<_pandacss_types.RequiredBy<_pandacss_types.Config, "
|
|
89
|
+
config: _pandacss_types_dist_shared.UnwrapExtend<_pandacss_types.RequiredBy<_pandacss_types.Config, "outdir" | "cwd" | "include">>;
|
|
91
90
|
tsconfig?: TSConfig | undefined;
|
|
91
|
+
tsOptions?: _pandacss_types.ConfigTsOptions | undefined;
|
|
92
92
|
tsconfigFile?: string | undefined;
|
|
93
93
|
dependencies: string[];
|
|
94
94
|
};
|
|
@@ -155,10 +155,10 @@ declare const createGenerator: (conf: ConfigResultWithHooks) => {
|
|
|
155
155
|
};
|
|
156
156
|
parserOptions: {
|
|
157
157
|
importMap: {
|
|
158
|
-
css: string;
|
|
159
|
-
recipe: string;
|
|
160
|
-
pattern: string;
|
|
161
|
-
jsx: string;
|
|
158
|
+
css: string[];
|
|
159
|
+
recipe: string[];
|
|
160
|
+
pattern: string[];
|
|
161
|
+
jsx: string[];
|
|
162
162
|
};
|
|
163
163
|
jsx: {
|
|
164
164
|
factory: string;
|
|
@@ -177,17 +177,24 @@ declare const createGenerator: (conf: ConfigResultWithHooks) => {
|
|
|
177
177
|
match: RegExp;
|
|
178
178
|
})[];
|
|
179
179
|
};
|
|
180
|
-
getRecipesByJsxName: (jsxName: string) =>
|
|
181
|
-
};
|
|
182
|
-
patterns: {
|
|
183
|
-
transform: (name: string, data: _pandacss_types.Dict) => _pandacss_types.SystemStyleObject;
|
|
184
|
-
nodes: {
|
|
185
|
-
type: "pattern";
|
|
180
|
+
getRecipesByJsxName: (jsxName: string) => {
|
|
186
181
|
name: string;
|
|
187
|
-
|
|
188
|
-
|
|
182
|
+
variantKeys: string[];
|
|
183
|
+
variantKeyMap: Record<string, string[]>;
|
|
184
|
+
jsx: (string | RegExp)[];
|
|
185
|
+
upperName: string;
|
|
186
|
+
dashName: string;
|
|
187
|
+
jsxName: string;
|
|
188
|
+
match: RegExp;
|
|
189
|
+
config: _pandacss_types.RecipeConfig;
|
|
190
|
+
splitProps: (props: _pandacss_types.Dict) => [_pandacss_types.Dict, _pandacss_types.Dict];
|
|
189
191
|
}[];
|
|
192
|
+
compilerOptions: any;
|
|
193
|
+
tsOptions: _pandacss_types.ConfigTsOptions | undefined;
|
|
194
|
+
};
|
|
195
|
+
patterns: {
|
|
190
196
|
patterns: Record<string, _pandacss_types.PatternConfig>;
|
|
197
|
+
transform: (name: string, data: _pandacss_types.Dict) => _pandacss_types.SystemStyleObject;
|
|
191
198
|
getConfig: (name: string) => _pandacss_types.PatternConfig;
|
|
192
199
|
getNames: (name: string) => {
|
|
193
200
|
name: string;
|
|
@@ -206,6 +213,12 @@ declare const createGenerator: (conf: ConfigResultWithHooks) => {
|
|
|
206
213
|
styleFnName: string;
|
|
207
214
|
jsxName: string;
|
|
208
215
|
}[];
|
|
216
|
+
nodes: {
|
|
217
|
+
type: "pattern";
|
|
218
|
+
name: string;
|
|
219
|
+
props: string[];
|
|
220
|
+
baseName: string;
|
|
221
|
+
}[];
|
|
209
222
|
getFnName: (jsx: string) => string;
|
|
210
223
|
isEmpty: () => boolean;
|
|
211
224
|
};
|
|
@@ -214,7 +227,7 @@ declare const createGenerator: (conf: ConfigResultWithHooks) => {
|
|
|
214
227
|
upperName: string;
|
|
215
228
|
typeName: string;
|
|
216
229
|
componentName: string;
|
|
217
|
-
framework: ("
|
|
230
|
+
framework: ("react" | "solid" | "preact" | "vue" | "qwik") | undefined;
|
|
218
231
|
};
|
|
219
232
|
paths: {
|
|
220
233
|
get: (file?: string | undefined) => string[];
|
|
@@ -260,8 +273,9 @@ declare const createGenerator: (conf: ConfigResultWithHooks) => {
|
|
|
260
273
|
createSheet: (options?: Pick<_pandacss_core.StylesheetOptions, "content"> | undefined) => _pandacss_core.Stylesheet;
|
|
261
274
|
hooks: _pandacss_types.PandaHookable;
|
|
262
275
|
path: string;
|
|
263
|
-
config: _pandacss_types_dist_shared.UnwrapExtend<_pandacss_types.RequiredBy<_pandacss_types.Config, "
|
|
276
|
+
config: _pandacss_types_dist_shared.UnwrapExtend<_pandacss_types.RequiredBy<_pandacss_types.Config, "outdir" | "cwd" | "include">>;
|
|
264
277
|
tsconfig?: TSConfig | undefined;
|
|
278
|
+
tsOptions?: _pandacss_types.ConfigTsOptions | undefined;
|
|
265
279
|
tsconfigFile?: string | undefined;
|
|
266
280
|
dependencies: string[];
|
|
267
281
|
};
|
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
|
-
|
|
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
|
|
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
|
});
|
|
@@ -1017,17 +1030,14 @@ function generateRecipes(ctx) {
|
|
|
1017
1030
|
compoundVariants ?? []
|
|
1018
1031
|
)})
|
|
1019
1032
|
|
|
1020
|
-
const variantKeys = ${stringify3(Object.keys(variantKeyMap))}
|
|
1021
|
-
|
|
1022
|
-
function splitVariantProps(props) {
|
|
1023
|
-
return splitProps(props, variantKeys)
|
|
1024
|
-
}
|
|
1025
|
-
|
|
1026
1033
|
export const ${name} = Object.assign(${name}Fn, {
|
|
1027
1034
|
__recipe__: true,
|
|
1028
|
-
|
|
1035
|
+
raw: (props) => props,
|
|
1036
|
+
variantKeys: ${stringify3(Object.keys(variantKeyMap))},
|
|
1029
1037
|
variantMap: ${stringify3(variantKeyMap)},
|
|
1030
|
-
splitVariantProps
|
|
1038
|
+
splitVariantProps(props) {
|
|
1039
|
+
return splitProps(props, ${stringify3(Object.keys(variantKeyMap))})
|
|
1040
|
+
},
|
|
1031
1041
|
})
|
|
1032
1042
|
`,
|
|
1033
1043
|
dts: import_outdent11.outdent`
|
|
@@ -1054,6 +1064,7 @@ function generateRecipes(ctx) {
|
|
|
1054
1064
|
interface ${upperName}Recipe {
|
|
1055
1065
|
__type: ${upperName}VariantProps
|
|
1056
1066
|
(props?: ${upperName}VariantProps): string
|
|
1067
|
+
raw: (props?: ${upperName}VariantProps) => ${upperName}VariantProps
|
|
1057
1068
|
variantMap: ${upperName}VariantMap
|
|
1058
1069
|
variantKeys: Array<keyof ${upperName}Variant>
|
|
1059
1070
|
splitVariantProps<Props extends ${upperName}VariantProps>(props: Props): [${upperName}VariantProps, Pretty<Omit<Props, keyof ${upperName}VariantProps>>]
|
|
@@ -1741,12 +1752,16 @@ import { ${upperName} } from '../types/jsx'
|
|
|
1741
1752
|
export declare const ${factoryName}: ${upperName}
|
|
1742
1753
|
`,
|
|
1743
1754
|
jsxType: import_outdent25.outdent`
|
|
1744
|
-
import type {
|
|
1755
|
+
import type { ComponentPropsWithoutRef, ElementType, ElementRef, Ref } from 'react'
|
|
1745
1756
|
import type { Assign, JsxStyleProps, JsxHTMLProps } from './system-types'
|
|
1746
1757
|
import type { RecipeDefinition, RecipeSelection, RecipeVariantRecord } from './recipe'
|
|
1747
1758
|
|
|
1748
1759
|
type Dict = Record<string, unknown>
|
|
1749
1760
|
|
|
1761
|
+
type ComponentProps<T extends ElementType> = Omit<ComponentPropsWithoutRef<T>, 'ref'> & {
|
|
1762
|
+
ref?: Ref<ElementRef<T>>
|
|
1763
|
+
}
|
|
1764
|
+
|
|
1750
1765
|
export type ${componentName}<T extends ElementType, P extends Dict = {}> = {
|
|
1751
1766
|
(props: JsxHTMLProps<ComponentProps<T>, Assign<JsxStyleProps, P>>): JSX.Element
|
|
1752
1767
|
displayName?: string
|
|
@@ -1832,10 +1847,14 @@ import { ${upperName} } from '../types/jsx'
|
|
|
1832
1847
|
export declare const ${factoryName}: ${upperName}
|
|
1833
1848
|
`,
|
|
1834
1849
|
jsxType: import_outdent27.outdent`
|
|
1835
|
-
import type {
|
|
1850
|
+
import type { ComponentPropsWithoutRef, ElementType, ElementRef, Ref } from 'react'
|
|
1836
1851
|
|
|
1837
1852
|
type Dict = Record<string, unknown>
|
|
1838
1853
|
|
|
1854
|
+
type ComponentProps<T extends ElementType> = Omit<ComponentPropsWithoutRef<T>, 'ref'> & {
|
|
1855
|
+
ref?: Ref<ElementRef<T>>
|
|
1856
|
+
}
|
|
1857
|
+
|
|
1839
1858
|
export type ${componentName}<T extends ElementType> = {
|
|
1840
1859
|
(args: { raw: readonly string[] | ArrayLike<string> }): (props: ComponentProps<T>) => JSX.Element
|
|
1841
1860
|
displayName?: string
|
|
@@ -2667,38 +2686,38 @@ function generateJsxPatterns(ctx) {
|
|
|
2667
2686
|
// src/artifacts/pkg-json.ts
|
|
2668
2687
|
function generatePackageJson(ctx) {
|
|
2669
2688
|
const {
|
|
2670
|
-
config: { outdir }
|
|
2689
|
+
config: { outdir, outExtension: ext = "mjs" }
|
|
2671
2690
|
} = ctx;
|
|
2672
2691
|
const pkg = {
|
|
2673
2692
|
name: outdir,
|
|
2674
|
-
description: "This package is auto-generated by CSS
|
|
2693
|
+
description: "This package is auto-generated by Panda CSS",
|
|
2675
2694
|
version: `0.0.0-${performance.now()}`,
|
|
2676
2695
|
type: "module",
|
|
2677
2696
|
exports: {
|
|
2678
2697
|
"./css": {
|
|
2679
2698
|
types: "./css/index.d.ts",
|
|
2680
|
-
require:
|
|
2681
|
-
import:
|
|
2699
|
+
require: `./css/index.${ext}`,
|
|
2700
|
+
import: `./css/index.${ext}`
|
|
2682
2701
|
},
|
|
2683
2702
|
"./jsx": {
|
|
2684
2703
|
types: "./jsx/index.d.ts",
|
|
2685
|
-
require:
|
|
2686
|
-
import:
|
|
2704
|
+
require: `./jsx/index.${ext}`,
|
|
2705
|
+
import: `./jsx/index.${ext}`
|
|
2687
2706
|
},
|
|
2688
2707
|
"./patterns": {
|
|
2689
2708
|
types: "./patterns/index.d.ts",
|
|
2690
|
-
require:
|
|
2691
|
-
import:
|
|
2709
|
+
require: `./patterns/index.${ext}`,
|
|
2710
|
+
import: `./patterns/index.${ext}`
|
|
2692
2711
|
},
|
|
2693
2712
|
"./recipes": {
|
|
2694
2713
|
types: "./recipes/index.d.ts",
|
|
2695
|
-
require:
|
|
2696
|
-
import:
|
|
2714
|
+
require: `./recipes/index.${ext}`,
|
|
2715
|
+
import: `./recipes/index.${ext}`
|
|
2697
2716
|
},
|
|
2698
2717
|
"./tokens": {
|
|
2699
2718
|
types: "./tokens/index.d.ts",
|
|
2700
|
-
require:
|
|
2701
|
-
import:
|
|
2719
|
+
require: `./tokens/index.${ext}`,
|
|
2720
|
+
import: `./tokens/index.${ext}`
|
|
2702
2721
|
},
|
|
2703
2722
|
"./types": {
|
|
2704
2723
|
types: "./types/index.d.ts"
|
|
@@ -3442,10 +3461,10 @@ var defaults = (conf) => ({
|
|
|
3442
3461
|
}
|
|
3443
3462
|
});
|
|
3444
3463
|
var getImportMap = (outdir) => ({
|
|
3445
|
-
css:
|
|
3446
|
-
recipe:
|
|
3447
|
-
pattern:
|
|
3448
|
-
jsx:
|
|
3464
|
+
css: [outdir, "css"],
|
|
3465
|
+
recipe: [outdir, "recipes"],
|
|
3466
|
+
pattern: [outdir, "patterns"],
|
|
3467
|
+
jsx: [outdir, "jsx"]
|
|
3449
3468
|
});
|
|
3450
3469
|
var createGenerator = (conf) => {
|
|
3451
3470
|
const ctx = getEngine(defaults(conf));
|
|
@@ -3453,7 +3472,7 @@ var createGenerator = (conf) => {
|
|
|
3453
3472
|
const compilerOptions = conf.tsconfig?.compilerOptions ?? {};
|
|
3454
3473
|
const baseUrl = compilerOptions.baseUrl ?? "";
|
|
3455
3474
|
const cwd = conf.config.cwd;
|
|
3456
|
-
const relativeBaseUrl = baseUrl ? baseUrl.replace(cwd, "").slice(1)
|
|
3475
|
+
const relativeBaseUrl = baseUrl !== cwd ? baseUrl.replace(cwd, "").slice(1) : cwd;
|
|
3457
3476
|
return {
|
|
3458
3477
|
...ctx,
|
|
3459
3478
|
getArtifacts: generateArtifacts(ctx),
|
|
@@ -3467,7 +3486,9 @@ var createGenerator = (conf) => {
|
|
|
3467
3486
|
isStyleProp: isValidProperty,
|
|
3468
3487
|
nodes: [...patterns.nodes, ...recipes.nodes]
|
|
3469
3488
|
},
|
|
3470
|
-
getRecipesByJsxName: recipes.filter
|
|
3489
|
+
getRecipesByJsxName: recipes.filter,
|
|
3490
|
+
compilerOptions,
|
|
3491
|
+
tsOptions: conf.tsOptions
|
|
3471
3492
|
}
|
|
3472
3493
|
};
|
|
3473
3494
|
};
|
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
|
-
|
|
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
|
|
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
|
});
|
|
@@ -986,17 +999,14 @@ function generateRecipes(ctx) {
|
|
|
986
999
|
compoundVariants ?? []
|
|
987
1000
|
)})
|
|
988
1001
|
|
|
989
|
-
const variantKeys = ${stringify3(Object.keys(variantKeyMap))}
|
|
990
|
-
|
|
991
|
-
function splitVariantProps(props) {
|
|
992
|
-
return splitProps(props, variantKeys)
|
|
993
|
-
}
|
|
994
|
-
|
|
995
1002
|
export const ${name} = Object.assign(${name}Fn, {
|
|
996
1003
|
__recipe__: true,
|
|
997
|
-
|
|
1004
|
+
raw: (props) => props,
|
|
1005
|
+
variantKeys: ${stringify3(Object.keys(variantKeyMap))},
|
|
998
1006
|
variantMap: ${stringify3(variantKeyMap)},
|
|
999
|
-
splitVariantProps
|
|
1007
|
+
splitVariantProps(props) {
|
|
1008
|
+
return splitProps(props, ${stringify3(Object.keys(variantKeyMap))})
|
|
1009
|
+
},
|
|
1000
1010
|
})
|
|
1001
1011
|
`,
|
|
1002
1012
|
dts: outdent11`
|
|
@@ -1023,6 +1033,7 @@ function generateRecipes(ctx) {
|
|
|
1023
1033
|
interface ${upperName}Recipe {
|
|
1024
1034
|
__type: ${upperName}VariantProps
|
|
1025
1035
|
(props?: ${upperName}VariantProps): string
|
|
1036
|
+
raw: (props?: ${upperName}VariantProps) => ${upperName}VariantProps
|
|
1026
1037
|
variantMap: ${upperName}VariantMap
|
|
1027
1038
|
variantKeys: Array<keyof ${upperName}Variant>
|
|
1028
1039
|
splitVariantProps<Props extends ${upperName}VariantProps>(props: Props): [${upperName}VariantProps, Pretty<Omit<Props, keyof ${upperName}VariantProps>>]
|
|
@@ -1710,12 +1721,16 @@ import { ${upperName} } from '../types/jsx'
|
|
|
1710
1721
|
export declare const ${factoryName}: ${upperName}
|
|
1711
1722
|
`,
|
|
1712
1723
|
jsxType: outdent25`
|
|
1713
|
-
import type {
|
|
1724
|
+
import type { ComponentPropsWithoutRef, ElementType, ElementRef, Ref } from 'react'
|
|
1714
1725
|
import type { Assign, JsxStyleProps, JsxHTMLProps } from './system-types'
|
|
1715
1726
|
import type { RecipeDefinition, RecipeSelection, RecipeVariantRecord } from './recipe'
|
|
1716
1727
|
|
|
1717
1728
|
type Dict = Record<string, unknown>
|
|
1718
1729
|
|
|
1730
|
+
type ComponentProps<T extends ElementType> = Omit<ComponentPropsWithoutRef<T>, 'ref'> & {
|
|
1731
|
+
ref?: Ref<ElementRef<T>>
|
|
1732
|
+
}
|
|
1733
|
+
|
|
1719
1734
|
export type ${componentName}<T extends ElementType, P extends Dict = {}> = {
|
|
1720
1735
|
(props: JsxHTMLProps<ComponentProps<T>, Assign<JsxStyleProps, P>>): JSX.Element
|
|
1721
1736
|
displayName?: string
|
|
@@ -1801,10 +1816,14 @@ import { ${upperName} } from '../types/jsx'
|
|
|
1801
1816
|
export declare const ${factoryName}: ${upperName}
|
|
1802
1817
|
`,
|
|
1803
1818
|
jsxType: outdent27`
|
|
1804
|
-
import type {
|
|
1819
|
+
import type { ComponentPropsWithoutRef, ElementType, ElementRef, Ref } from 'react'
|
|
1805
1820
|
|
|
1806
1821
|
type Dict = Record<string, unknown>
|
|
1807
1822
|
|
|
1823
|
+
type ComponentProps<T extends ElementType> = Omit<ComponentPropsWithoutRef<T>, 'ref'> & {
|
|
1824
|
+
ref?: Ref<ElementRef<T>>
|
|
1825
|
+
}
|
|
1826
|
+
|
|
1808
1827
|
export type ${componentName}<T extends ElementType> = {
|
|
1809
1828
|
(args: { raw: readonly string[] | ArrayLike<string> }): (props: ComponentProps<T>) => JSX.Element
|
|
1810
1829
|
displayName?: string
|
|
@@ -2636,38 +2655,38 @@ function generateJsxPatterns(ctx) {
|
|
|
2636
2655
|
// src/artifacts/pkg-json.ts
|
|
2637
2656
|
function generatePackageJson(ctx) {
|
|
2638
2657
|
const {
|
|
2639
|
-
config: { outdir }
|
|
2658
|
+
config: { outdir, outExtension: ext = "mjs" }
|
|
2640
2659
|
} = ctx;
|
|
2641
2660
|
const pkg = {
|
|
2642
2661
|
name: outdir,
|
|
2643
|
-
description: "This package is auto-generated by CSS
|
|
2662
|
+
description: "This package is auto-generated by Panda CSS",
|
|
2644
2663
|
version: `0.0.0-${performance.now()}`,
|
|
2645
2664
|
type: "module",
|
|
2646
2665
|
exports: {
|
|
2647
2666
|
"./css": {
|
|
2648
2667
|
types: "./css/index.d.ts",
|
|
2649
|
-
require:
|
|
2650
|
-
import:
|
|
2668
|
+
require: `./css/index.${ext}`,
|
|
2669
|
+
import: `./css/index.${ext}`
|
|
2651
2670
|
},
|
|
2652
2671
|
"./jsx": {
|
|
2653
2672
|
types: "./jsx/index.d.ts",
|
|
2654
|
-
require:
|
|
2655
|
-
import:
|
|
2673
|
+
require: `./jsx/index.${ext}`,
|
|
2674
|
+
import: `./jsx/index.${ext}`
|
|
2656
2675
|
},
|
|
2657
2676
|
"./patterns": {
|
|
2658
2677
|
types: "./patterns/index.d.ts",
|
|
2659
|
-
require:
|
|
2660
|
-
import:
|
|
2678
|
+
require: `./patterns/index.${ext}`,
|
|
2679
|
+
import: `./patterns/index.${ext}`
|
|
2661
2680
|
},
|
|
2662
2681
|
"./recipes": {
|
|
2663
2682
|
types: "./recipes/index.d.ts",
|
|
2664
|
-
require:
|
|
2665
|
-
import:
|
|
2683
|
+
require: `./recipes/index.${ext}`,
|
|
2684
|
+
import: `./recipes/index.${ext}`
|
|
2666
2685
|
},
|
|
2667
2686
|
"./tokens": {
|
|
2668
2687
|
types: "./tokens/index.d.ts",
|
|
2669
|
-
require:
|
|
2670
|
-
import:
|
|
2688
|
+
require: `./tokens/index.${ext}`,
|
|
2689
|
+
import: `./tokens/index.${ext}`
|
|
2671
2690
|
},
|
|
2672
2691
|
"./types": {
|
|
2673
2692
|
types: "./types/index.d.ts"
|
|
@@ -3417,10 +3436,10 @@ var defaults = (conf) => ({
|
|
|
3417
3436
|
}
|
|
3418
3437
|
});
|
|
3419
3438
|
var getImportMap = (outdir) => ({
|
|
3420
|
-
css:
|
|
3421
|
-
recipe:
|
|
3422
|
-
pattern:
|
|
3423
|
-
jsx:
|
|
3439
|
+
css: [outdir, "css"],
|
|
3440
|
+
recipe: [outdir, "recipes"],
|
|
3441
|
+
pattern: [outdir, "patterns"],
|
|
3442
|
+
jsx: [outdir, "jsx"]
|
|
3424
3443
|
});
|
|
3425
3444
|
var createGenerator = (conf) => {
|
|
3426
3445
|
const ctx = getEngine(defaults(conf));
|
|
@@ -3428,7 +3447,7 @@ var createGenerator = (conf) => {
|
|
|
3428
3447
|
const compilerOptions = conf.tsconfig?.compilerOptions ?? {};
|
|
3429
3448
|
const baseUrl = compilerOptions.baseUrl ?? "";
|
|
3430
3449
|
const cwd = conf.config.cwd;
|
|
3431
|
-
const relativeBaseUrl = baseUrl ? baseUrl.replace(cwd, "").slice(1)
|
|
3450
|
+
const relativeBaseUrl = baseUrl !== cwd ? baseUrl.replace(cwd, "").slice(1) : cwd;
|
|
3432
3451
|
return {
|
|
3433
3452
|
...ctx,
|
|
3434
3453
|
getArtifacts: generateArtifacts(ctx),
|
|
@@ -3442,7 +3461,9 @@ var createGenerator = (conf) => {
|
|
|
3442
3461
|
isStyleProp: isValidProperty,
|
|
3443
3462
|
nodes: [...patterns.nodes, ...recipes.nodes]
|
|
3444
3463
|
},
|
|
3445
|
-
getRecipesByJsxName: recipes.filter
|
|
3464
|
+
getRecipesByJsxName: recipes.filter,
|
|
3465
|
+
compilerOptions,
|
|
3466
|
+
tsOptions: conf.tsOptions
|
|
3446
3467
|
}
|
|
3447
3468
|
};
|
|
3448
3469
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pandacss/generator",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"description": "The css generator for css panda",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -19,18 +19,18 @@
|
|
|
19
19
|
"outdent": " ^0.8.0",
|
|
20
20
|
"pluralize": "8.0.0",
|
|
21
21
|
"postcss": "8.4.25",
|
|
22
|
-
"ts-pattern": "5.0.
|
|
23
|
-
"@pandacss/core": "0.
|
|
24
|
-
"@pandacss/is-valid-prop": "0.
|
|
25
|
-
"@pandacss/logger": "0.
|
|
26
|
-
"@pandacss/shared": "0.
|
|
27
|
-
"@pandacss/token-dictionary": "0.
|
|
28
|
-
"@pandacss/types": "0.
|
|
22
|
+
"ts-pattern": "5.0.4",
|
|
23
|
+
"@pandacss/core": "0.8.0",
|
|
24
|
+
"@pandacss/is-valid-prop": "0.8.0",
|
|
25
|
+
"@pandacss/logger": "0.8.0",
|
|
26
|
+
"@pandacss/shared": "0.8.0",
|
|
27
|
+
"@pandacss/token-dictionary": "0.8.0",
|
|
28
|
+
"@pandacss/types": "0.8.0"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@types/pluralize": "0.0.30",
|
|
32
32
|
"hookable": "5.5.3",
|
|
33
|
-
"@pandacss/fixture": "0.
|
|
33
|
+
"@pandacss/fixture": "0.8.0"
|
|
34
34
|
},
|
|
35
35
|
"scripts": {
|
|
36
36
|
"prebuild": "tsx scripts/prebuild.ts",
|