-
-
Notifications
You must be signed in to change notification settings - Fork 34
Expand file tree
/
Copy pathindex.ts
More file actions
318 lines (305 loc) · 8.4 KB
/
index.ts
File metadata and controls
318 lines (305 loc) · 8.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
import { config, react } from "@grida/builder-config";
import { Framework, Language } from "@grida/builder-platform-types";
const _jsx_component_declaration_style = {
exporting_style: {
type: "export-named-functional-component",
exporting_position: "with-declaration",
declaration_syntax_choice: "function",
export_declaration_syntax_choice: "export",
},
};
export const react_presets = {
react_default: <config.ReactFrameworkConfig>{
framework: Framework.react,
language: Language.tsx,
styling: {
type: "styled-components",
module: "@emotion/styled",
},
component_declaration_style: _jsx_component_declaration_style,
},
react_with_styled_components: <config.ReactFrameworkConfig>{
framework: Framework.react,
language: Language.tsx,
styling: {
type: "styled-components",
module: "styled-components",
},
component_declaration_style: _jsx_component_declaration_style,
},
react_with_emotion_styled: <config.ReactFrameworkConfig>{
framework: Framework.react,
language: Language.tsx,
styling: {
type: "styled-components",
module: "@emotion/styled",
},
component_declaration_style: _jsx_component_declaration_style,
},
react_with_inline_css: <config.ReactFrameworkConfig>{
framework: Framework.react,
language: Language.tsx,
styling: {
type: "inline-css",
},
component_declaration_style: _jsx_component_declaration_style,
},
react_with_css_module: <config.ReactFrameworkConfig>{
framework: Framework.react,
language: Language.tsx,
styling: {
type: "css-module",
lang: "css",
importDefault: "styles",
loader: "css-loader",
},
component_declaration_style: _jsx_component_declaration_style,
},
react_with_css: <config.ReactFrameworkConfig>{
framework: Framework.react,
language: Language.tsx,
styling: { type: "css" },
},
component_declaration_style: _jsx_component_declaration_style,
};
export const reactnative_presets = {
reactnative_default: <config.ReactNativeFrameworkConfig>{
framework: Framework.reactnative,
language: Language.tsx,
svg: null as unknown, // TODO:
gradient: null as unknown, // TODO:
styling: {
type: "react-native-stylesheet",
module: "react-native",
},
component_declaration_style: _jsx_component_declaration_style,
},
reactnative_with_style_sheet: <config.ReactNativeFrameworkConfig>{
framework: Framework.reactnative,
language: Language.tsx,
svg: null as unknown, // TODO:
gradient: null as unknown, // TODO:
styling: {
type: "react-native-stylesheet",
module: "react-native",
},
component_declaration_style: _jsx_component_declaration_style,
},
reactnative_with_styled_components: <config.ReactNativeFrameworkConfig>{
framework: Framework.reactnative,
language: Language.tsx,
svg: null as unknown, // TODO:
gradient: null as unknown, // TODO:
styling: {
type: "styled-components",
module: "styled-components/native",
},
component_declaration_style: _jsx_component_declaration_style,
},
reactnative_with_inline_style: <config.ReactNativeFrameworkConfig>{
framework: Framework.reactnative,
language: Language.tsx,
svg: null as unknown, // TODO:
gradient: null as unknown, // TODO:
styling: {
type: "inline-style",
},
component_declaration_style: _jsx_component_declaration_style,
},
};
export const preact_presets = {
default: <config.PreactFrameworkConfig>{
framework: Framework.preact,
language: Language.tsx,
styling: {
type: "styled-components",
module: "@emotion/styled",
},
component_declaration_style: _jsx_component_declaration_style,
},
with_styled_components: <config.PreactFrameworkConfig>{
framework: Framework.preact,
language: Language.tsx,
styling: {
type: "styled-components",
module: "styled-components",
},
component_declaration_style: _jsx_component_declaration_style,
},
with_emotion_styled: <config.PreactFrameworkConfig>{
framework: Framework.preact,
language: Language.tsx,
styling: {
type: "styled-components",
module: "@emotion/styled",
},
component_declaration_style: _jsx_component_declaration_style,
},
with_inline_css: <config.PreactFrameworkConfig>{
framework: Framework.preact,
language: Language.tsx,
styling: {
type: "inline-css",
},
component_declaration_style: _jsx_component_declaration_style,
},
with_css_module: <config.PreactFrameworkConfig>{
framework: Framework.preact,
language: Language.tsx,
styling: {
type: "css-module",
lang: "css",
importDefault: "styles",
loader: "css-loader",
},
component_declaration_style: _jsx_component_declaration_style,
},
with_css: <config.PreactFrameworkConfig>{
framework: Framework.preact,
language: Language.tsx,
styling: { type: "css" },
},
component_declaration_style: _jsx_component_declaration_style,
};
export const solid_presets = {
solid_with_styled_components: <config.SolidFrameworkConfig>{
framework: Framework.solid,
language: Language.tsx,
styling: {
type: "styled-components",
module: "solid-styled-components",
},
component_declaration_style: _jsx_component_declaration_style,
},
solid_default: <config.SolidFrameworkConfig>{
framework: Framework.solid,
language: Language.tsx,
styling: {
type: "styled-components",
module: "solid-styled-components",
},
component_declaration_style: _jsx_component_declaration_style,
},
solid_with_inline_css: <config.SolidFrameworkConfig>{
framework: Framework.solid,
language: Language.tsx,
styling: {
type: "inline-css",
},
component_declaration_style: _jsx_component_declaration_style,
},
};
export const vanilla_presets = {
vanilla_default: <config.VanillaFrameworkConfig>{
framework: Framework.vanilla,
language: Language.html,
imgage_alt: {
no_alt: true,
},
},
};
export const preview_presets = {
default: <config.VanillaPreviewFrameworkConfig>{
framework: "preview",
language: Language.html,
imgage_alt: {
no_alt: true,
},
},
};
export const flutter_presets = {
flutter_default: <config.FlutterFrameworkConfig>{
framework: Framework.flutter,
language: Language.dart,
},
};
export const presets = {
react: react_presets,
flutter: flutter_presets,
vanilla: vanilla_presets,
};
export const all_preset_options__prod = [
flutter_presets.flutter_default,
react_presets.react_default,
react_presets.react_with_styled_components,
preact_presets.default,
vanilla_presets.vanilla_default,
// react_with_css_in_jsx // NOT ON PRODUCTION
// react_with_css // NOT ON PRODUCTION
];
export const all_preset_options_map__prod = {
none: null,
flutter_default: flutter_presets.flutter_default,
react_default: react_presets.react_default,
react_with_styled_components: react_presets.react_with_styled_components,
vanilla_default: vanilla_presets.vanilla_default,
// react_with_css_in_jsx // NOT ON PRODUCTION
// react_with_css // NOT ON PRODUCTION
};
export const react_styles: {
[alias in react.ReactStylingStrategy["type"]]: react.ReactStylingStrategy[];
} = {
"styled-components": [
{
type: "styled-components",
module: "@emotion/styled",
},
{
type: "styled-components",
module: "styled-components",
},
],
"inline-css": [
{
type: "inline-css",
},
],
"css-module": [
{
type: "css-module",
importDefault: "styles",
loader: "css-loader",
lang: "css",
},
{
type: "css-module",
importDefault: "styles",
loader: "css-loader",
lang: "scss",
},
],
css: [
{
type: "css",
lang: "css",
},
{
type: "css",
lang: "scss",
},
],
};
export function defaultConfigByFramework(
framework: config.FrameworkConfig["framework"]
) {
switch (framework) {
case "react": {
return react_presets.react_default;
}
case "flutter": {
return flutter_presets.flutter_default;
}
case "react-native": {
return reactnative_presets.reactnative_default;
}
case "solid-js": {
return solid_presets.solid_default;
}
case "vanilla": {
return vanilla_presets.vanilla_default;
}
case "preview": {
return preview_presets.default;
}
}
}