@lucaismyname/create-l1-stack 0.1.2 → 0.1.4
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/package.json +1 -1
- package/src/index.js +316 -14
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -26,16 +26,124 @@ const THEME_PRESETS = {
|
|
|
26
26
|
ring: 'oklch(0.556 0 0)',
|
|
27
27
|
},
|
|
28
28
|
},
|
|
29
|
-
|
|
29
|
+
gray: {
|
|
30
30
|
light: {
|
|
31
|
-
primary: 'oklch(0.
|
|
31
|
+
primary: 'oklch(0.205 0 0)',
|
|
32
|
+
primaryForeground: 'oklch(0.985 0 0)',
|
|
33
|
+
ring: 'oklch(0.708 0 0)',
|
|
34
|
+
},
|
|
35
|
+
dark: {
|
|
36
|
+
primary: 'oklch(0.922 0 0)',
|
|
37
|
+
primaryForeground: 'oklch(0.205 0 0)',
|
|
38
|
+
ring: 'oklch(0.556 0 0)',
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
zinc: {
|
|
42
|
+
light: {
|
|
43
|
+
primary: 'oklch(0.205 0 0)',
|
|
44
|
+
primaryForeground: 'oklch(0.985 0 0)',
|
|
45
|
+
ring: 'oklch(0.708 0 0)',
|
|
46
|
+
},
|
|
47
|
+
dark: {
|
|
48
|
+
primary: 'oklch(0.922 0 0)',
|
|
49
|
+
primaryForeground: 'oklch(0.205 0 0)',
|
|
50
|
+
ring: 'oklch(0.556 0 0)',
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
neutral: {
|
|
54
|
+
light: {
|
|
55
|
+
primary: 'oklch(0.205 0 0)',
|
|
56
|
+
primaryForeground: 'oklch(0.985 0 0)',
|
|
57
|
+
ring: 'oklch(0.708 0 0)',
|
|
58
|
+
},
|
|
59
|
+
dark: {
|
|
60
|
+
primary: 'oklch(0.922 0 0)',
|
|
61
|
+
primaryForeground: 'oklch(0.205 0 0)',
|
|
62
|
+
ring: 'oklch(0.556 0 0)',
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
stone: {
|
|
66
|
+
light: {
|
|
67
|
+
primary: 'oklch(0.205 0 0)',
|
|
68
|
+
primaryForeground: 'oklch(0.985 0 0)',
|
|
69
|
+
ring: 'oklch(0.708 0 0)',
|
|
70
|
+
},
|
|
71
|
+
dark: {
|
|
72
|
+
primary: 'oklch(0.922 0 0)',
|
|
73
|
+
primaryForeground: 'oklch(0.205 0 0)',
|
|
74
|
+
ring: 'oklch(0.556 0 0)',
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
red: {
|
|
78
|
+
light: {
|
|
79
|
+
primary: 'oklch(0.62 0.24 20)',
|
|
32
80
|
primaryForeground: 'oklch(0.98 0 0)',
|
|
33
|
-
ring: 'oklch(0.62 0.
|
|
81
|
+
ring: 'oklch(0.62 0.24 20)',
|
|
34
82
|
},
|
|
35
83
|
dark: {
|
|
36
|
-
primary: 'oklch(0.
|
|
84
|
+
primary: 'oklch(0.74 0.18 20)',
|
|
37
85
|
primaryForeground: 'oklch(0.18 0 0)',
|
|
38
|
-
ring: 'oklch(0.
|
|
86
|
+
ring: 'oklch(0.74 0.18 20)',
|
|
87
|
+
},
|
|
88
|
+
},
|
|
89
|
+
orange: {
|
|
90
|
+
light: {
|
|
91
|
+
primary: 'oklch(0.65 0.20 45)',
|
|
92
|
+
primaryForeground: 'oklch(0.98 0 0)',
|
|
93
|
+
ring: 'oklch(0.65 0.20 45)',
|
|
94
|
+
},
|
|
95
|
+
dark: {
|
|
96
|
+
primary: 'oklch(0.78 0.16 45)',
|
|
97
|
+
primaryForeground: 'oklch(0.18 0 0)',
|
|
98
|
+
ring: 'oklch(0.78 0.16 45)',
|
|
99
|
+
},
|
|
100
|
+
},
|
|
101
|
+
amber: {
|
|
102
|
+
light: {
|
|
103
|
+
primary: 'oklch(0.68 0.18 65)',
|
|
104
|
+
primaryForeground: 'oklch(0.98 0 0)',
|
|
105
|
+
ring: 'oklch(0.68 0.18 65)',
|
|
106
|
+
},
|
|
107
|
+
dark: {
|
|
108
|
+
primary: 'oklch(0.80 0.14 65)',
|
|
109
|
+
primaryForeground: 'oklch(0.18 0 0)',
|
|
110
|
+
ring: 'oklch(0.80 0.14 65)',
|
|
111
|
+
},
|
|
112
|
+
},
|
|
113
|
+
yellow: {
|
|
114
|
+
light: {
|
|
115
|
+
primary: 'oklch(0.72 0.16 85)',
|
|
116
|
+
primaryForeground: 'oklch(0.98 0 0)',
|
|
117
|
+
ring: 'oklch(0.72 0.16 85)',
|
|
118
|
+
},
|
|
119
|
+
dark: {
|
|
120
|
+
primary: 'oklch(0.82 0.12 85)',
|
|
121
|
+
primaryForeground: 'oklch(0.18 0 0)',
|
|
122
|
+
ring: 'oklch(0.82 0.12 85)',
|
|
123
|
+
},
|
|
124
|
+
},
|
|
125
|
+
lime: {
|
|
126
|
+
light: {
|
|
127
|
+
primary: 'oklch(0.68 0.16 125)',
|
|
128
|
+
primaryForeground: 'oklch(0.98 0 0)',
|
|
129
|
+
ring: 'oklch(0.68 0.16 125)',
|
|
130
|
+
},
|
|
131
|
+
dark: {
|
|
132
|
+
primary: 'oklch(0.80 0.12 125)',
|
|
133
|
+
primaryForeground: 'oklch(0.18 0 0)',
|
|
134
|
+
ring: 'oklch(0.80 0.12 125)',
|
|
135
|
+
},
|
|
136
|
+
},
|
|
137
|
+
green: {
|
|
138
|
+
light: {
|
|
139
|
+
primary: 'oklch(0.67 0.17 155)',
|
|
140
|
+
primaryForeground: 'oklch(0.98 0 0)',
|
|
141
|
+
ring: 'oklch(0.67 0.17 155)',
|
|
142
|
+
},
|
|
143
|
+
dark: {
|
|
144
|
+
primary: 'oklch(0.78 0.14 155)',
|
|
145
|
+
primaryForeground: 'oklch(0.18 0 0)',
|
|
146
|
+
ring: 'oklch(0.78 0.14 155)',
|
|
39
147
|
},
|
|
40
148
|
},
|
|
41
149
|
emerald: {
|
|
@@ -50,6 +158,66 @@ const THEME_PRESETS = {
|
|
|
50
158
|
ring: 'oklch(0.78 0.14 155)',
|
|
51
159
|
},
|
|
52
160
|
},
|
|
161
|
+
teal: {
|
|
162
|
+
light: {
|
|
163
|
+
primary: 'oklch(0.65 0.18 175)',
|
|
164
|
+
primaryForeground: 'oklch(0.98 0 0)',
|
|
165
|
+
ring: 'oklch(0.65 0.18 175)',
|
|
166
|
+
},
|
|
167
|
+
dark: {
|
|
168
|
+
primary: 'oklch(0.77 0.14 175)',
|
|
169
|
+
primaryForeground: 'oklch(0.18 0 0)',
|
|
170
|
+
ring: 'oklch(0.77 0.14 175)',
|
|
171
|
+
},
|
|
172
|
+
},
|
|
173
|
+
cyan: {
|
|
174
|
+
light: {
|
|
175
|
+
primary: 'oklch(0.63 0.19 195)',
|
|
176
|
+
primaryForeground: 'oklch(0.98 0 0)',
|
|
177
|
+
ring: 'oklch(0.63 0.19 195)',
|
|
178
|
+
},
|
|
179
|
+
dark: {
|
|
180
|
+
primary: 'oklch(0.76 0.15 195)',
|
|
181
|
+
primaryForeground: 'oklch(0.18 0 0)',
|
|
182
|
+
ring: 'oklch(0.76 0.15 195)',
|
|
183
|
+
},
|
|
184
|
+
},
|
|
185
|
+
sky: {
|
|
186
|
+
light: {
|
|
187
|
+
primary: 'oklch(0.62 0.19 215)',
|
|
188
|
+
primaryForeground: 'oklch(0.98 0 0)',
|
|
189
|
+
ring: 'oklch(0.62 0.19 215)',
|
|
190
|
+
},
|
|
191
|
+
dark: {
|
|
192
|
+
primary: 'oklch(0.75 0.15 215)',
|
|
193
|
+
primaryForeground: 'oklch(0.18 0 0)',
|
|
194
|
+
ring: 'oklch(0.75 0.15 215)',
|
|
195
|
+
},
|
|
196
|
+
},
|
|
197
|
+
blue: {
|
|
198
|
+
light: {
|
|
199
|
+
primary: 'oklch(0.62 0.19 255)',
|
|
200
|
+
primaryForeground: 'oklch(0.98 0 0)',
|
|
201
|
+
ring: 'oklch(0.62 0.19 255)',
|
|
202
|
+
},
|
|
203
|
+
dark: {
|
|
204
|
+
primary: 'oklch(0.78 0.14 255)',
|
|
205
|
+
primaryForeground: 'oklch(0.18 0 0)',
|
|
206
|
+
ring: 'oklch(0.78 0.14 255)',
|
|
207
|
+
},
|
|
208
|
+
},
|
|
209
|
+
indigo: {
|
|
210
|
+
light: {
|
|
211
|
+
primary: 'oklch(0.60 0.21 275)',
|
|
212
|
+
primaryForeground: 'oklch(0.98 0 0)',
|
|
213
|
+
ring: 'oklch(0.60 0.21 275)',
|
|
214
|
+
},
|
|
215
|
+
dark: {
|
|
216
|
+
primary: 'oklch(0.74 0.16 275)',
|
|
217
|
+
primaryForeground: 'oklch(0.18 0 0)',
|
|
218
|
+
ring: 'oklch(0.74 0.16 275)',
|
|
219
|
+
},
|
|
220
|
+
},
|
|
53
221
|
violet: {
|
|
54
222
|
light: {
|
|
55
223
|
primary: 'oklch(0.62 0.23 300)',
|
|
@@ -62,6 +230,42 @@ const THEME_PRESETS = {
|
|
|
62
230
|
ring: 'oklch(0.75 0.18 300)',
|
|
63
231
|
},
|
|
64
232
|
},
|
|
233
|
+
purple: {
|
|
234
|
+
light: {
|
|
235
|
+
primary: 'oklch(0.63 0.24 315)',
|
|
236
|
+
primaryForeground: 'oklch(0.98 0 0)',
|
|
237
|
+
ring: 'oklch(0.63 0.24 315)',
|
|
238
|
+
},
|
|
239
|
+
dark: {
|
|
240
|
+
primary: 'oklch(0.76 0.19 315)',
|
|
241
|
+
primaryForeground: 'oklch(0.18 0 0)',
|
|
242
|
+
ring: 'oklch(0.76 0.19 315)',
|
|
243
|
+
},
|
|
244
|
+
},
|
|
245
|
+
fuchsia: {
|
|
246
|
+
light: {
|
|
247
|
+
primary: 'oklch(0.64 0.25 330)',
|
|
248
|
+
primaryForeground: 'oklch(0.98 0 0)',
|
|
249
|
+
ring: 'oklch(0.64 0.25 330)',
|
|
250
|
+
},
|
|
251
|
+
dark: {
|
|
252
|
+
primary: 'oklch(0.77 0.20 330)',
|
|
253
|
+
primaryForeground: 'oklch(0.18 0 0)',
|
|
254
|
+
ring: 'oklch(0.77 0.20 330)',
|
|
255
|
+
},
|
|
256
|
+
},
|
|
257
|
+
pink: {
|
|
258
|
+
light: {
|
|
259
|
+
primary: 'oklch(0.65 0.24 345)',
|
|
260
|
+
primaryForeground: 'oklch(0.98 0 0)',
|
|
261
|
+
ring: 'oklch(0.65 0.24 345)',
|
|
262
|
+
},
|
|
263
|
+
dark: {
|
|
264
|
+
primary: 'oklch(0.78 0.19 345)',
|
|
265
|
+
primaryForeground: 'oklch(0.18 0 0)',
|
|
266
|
+
ring: 'oklch(0.78 0.19 345)',
|
|
267
|
+
},
|
|
268
|
+
},
|
|
65
269
|
rose: {
|
|
66
270
|
light: {
|
|
67
271
|
primary: 'oklch(0.62 0.24 20)',
|
|
@@ -76,6 +280,31 @@ const THEME_PRESETS = {
|
|
|
76
280
|
},
|
|
77
281
|
}
|
|
78
282
|
|
|
283
|
+
const BASE_COLOR_PRESETS = {
|
|
284
|
+
slate: { bg: 'bg-slate-50', text: 'text-slate-950' },
|
|
285
|
+
gray: { bg: 'bg-gray-50', text: 'text-gray-950' },
|
|
286
|
+
zinc: { bg: 'bg-zinc-50', text: 'text-zinc-950' },
|
|
287
|
+
neutral: { bg: 'bg-neutral-50', text: 'text-neutral-950' },
|
|
288
|
+
stone: { bg: 'bg-stone-50', text: 'text-stone-950' },
|
|
289
|
+
red: { bg: 'bg-red-50', text: 'text-red-950' },
|
|
290
|
+
orange: { bg: 'bg-orange-50', text: 'text-orange-950' },
|
|
291
|
+
amber: { bg: 'bg-amber-50', text: 'text-amber-950' },
|
|
292
|
+
yellow: { bg: 'bg-yellow-50', text: 'text-yellow-950' },
|
|
293
|
+
lime: { bg: 'bg-lime-50', text: 'text-lime-950' },
|
|
294
|
+
green: { bg: 'bg-green-50', text: 'text-green-950' },
|
|
295
|
+
emerald: { bg: 'bg-emerald-50', text: 'text-emerald-950' },
|
|
296
|
+
teal: { bg: 'bg-teal-50', text: 'text-teal-950' },
|
|
297
|
+
cyan: { bg: 'bg-cyan-50', text: 'text-cyan-950' },
|
|
298
|
+
sky: { bg: 'bg-sky-50', text: 'text-sky-950' },
|
|
299
|
+
blue: { bg: 'bg-blue-50', text: 'text-blue-950' },
|
|
300
|
+
indigo: { bg: 'bg-indigo-50', text: 'text-indigo-950' },
|
|
301
|
+
violet: { bg: 'bg-violet-50', text: 'text-violet-950' },
|
|
302
|
+
purple: { bg: 'bg-purple-50', text: 'text-purple-950' },
|
|
303
|
+
fuchsia: { bg: 'bg-fuchsia-50', text: 'text-fuchsia-950' },
|
|
304
|
+
pink: { bg: 'bg-pink-50', text: 'text-pink-950' },
|
|
305
|
+
rose: { bg: 'bg-rose-50', text: 'text-rose-950' },
|
|
306
|
+
}
|
|
307
|
+
|
|
79
308
|
const INTEGRATIONS = {
|
|
80
309
|
contentful: {
|
|
81
310
|
label: 'Contentful',
|
|
@@ -184,19 +413,19 @@ function updateCssVarInBlock(css, blockSelector, varName, value) {
|
|
|
184
413
|
return css.replace(full, `${open}${nextBody}${close}`)
|
|
185
414
|
}
|
|
186
415
|
|
|
187
|
-
async function applyPrimaryTheme(targetDir,
|
|
416
|
+
async function applyPrimaryTheme(targetDir, primaryPreset, basePreset) {
|
|
188
417
|
const indexCssPath = path.join(targetDir, 'src', 'index.css')
|
|
189
418
|
try {
|
|
190
419
|
const css = await fs.readFile(indexCssPath, 'utf8')
|
|
191
420
|
let next = css
|
|
192
421
|
|
|
193
|
-
next = updateCssVarInBlock(next, ':root', '--primary',
|
|
194
|
-
next = updateCssVarInBlock(next, ':root', '--primary-foreground',
|
|
195
|
-
next = updateCssVarInBlock(next, ':root', '--ring',
|
|
422
|
+
next = updateCssVarInBlock(next, ':root', '--primary', primaryPreset.light.primary)
|
|
423
|
+
next = updateCssVarInBlock(next, ':root', '--primary-foreground', primaryPreset.light.primaryForeground)
|
|
424
|
+
next = updateCssVarInBlock(next, ':root', '--ring', primaryPreset.light.ring)
|
|
196
425
|
|
|
197
|
-
next = updateCssVarInBlock(next, '\\.dark', '--primary',
|
|
198
|
-
next = updateCssVarInBlock(next, '\\.dark', '--primary-foreground',
|
|
199
|
-
next = updateCssVarInBlock(next, '\\.dark', '--ring',
|
|
426
|
+
next = updateCssVarInBlock(next, '\\.dark', '--primary', primaryPreset.dark.primary)
|
|
427
|
+
next = updateCssVarInBlock(next, '\\.dark', '--primary-foreground', primaryPreset.dark.primaryForeground)
|
|
428
|
+
next = updateCssVarInBlock(next, '\\.dark', '--ring', primaryPreset.dark.ring)
|
|
200
429
|
|
|
201
430
|
if (next !== css) {
|
|
202
431
|
await fs.writeFile(indexCssPath, next, 'utf8')
|
|
@@ -204,6 +433,25 @@ async function applyPrimaryTheme(targetDir, preset) {
|
|
|
204
433
|
} catch {
|
|
205
434
|
// ignore if index.css doesn't exist
|
|
206
435
|
}
|
|
436
|
+
|
|
437
|
+
// Apply base color to body background and text in light mode
|
|
438
|
+
const appTsxPath = path.join(targetDir, 'src', 'App.tsx')
|
|
439
|
+
try {
|
|
440
|
+
const app = await fs.readFile(appTsxPath, 'utf8')
|
|
441
|
+
let next = app
|
|
442
|
+
|
|
443
|
+
// Replace the default background and text classes with base color
|
|
444
|
+
next = next.replace(
|
|
445
|
+
/className="min-h-dvh"/g,
|
|
446
|
+
`className="min-h-dvh ${basePreset.bg} ${basePreset.text}"`
|
|
447
|
+
)
|
|
448
|
+
|
|
449
|
+
if (next !== app) {
|
|
450
|
+
await fs.writeFile(appTsxPath, next, 'utf8')
|
|
451
|
+
}
|
|
452
|
+
} catch {
|
|
453
|
+
// ignore
|
|
454
|
+
}
|
|
207
455
|
}
|
|
208
456
|
|
|
209
457
|
async function applyIconSet(targetDir, language, iconSetKey) {
|
|
@@ -614,9 +862,26 @@ async function main() {
|
|
|
614
862
|
message: 'Primary color',
|
|
615
863
|
options: [
|
|
616
864
|
{ value: 'slate', label: 'Slate (default)' },
|
|
617
|
-
{ value: '
|
|
865
|
+
{ value: 'gray', label: 'Gray' },
|
|
866
|
+
{ value: 'zinc', label: 'Zinc' },
|
|
867
|
+
{ value: 'neutral', label: 'Neutral' },
|
|
868
|
+
{ value: 'stone', label: 'Stone' },
|
|
869
|
+
{ value: 'red', label: 'Red' },
|
|
870
|
+
{ value: 'orange', label: 'Orange' },
|
|
871
|
+
{ value: 'amber', label: 'Amber' },
|
|
872
|
+
{ value: 'yellow', label: 'Yellow' },
|
|
873
|
+
{ value: 'lime', label: 'Lime' },
|
|
874
|
+
{ value: 'green', label: 'Green' },
|
|
618
875
|
{ value: 'emerald', label: 'Emerald' },
|
|
876
|
+
{ value: 'teal', label: 'Teal' },
|
|
877
|
+
{ value: 'cyan', label: 'Cyan' },
|
|
878
|
+
{ value: 'sky', label: 'Sky' },
|
|
879
|
+
{ value: 'blue', label: 'Blue' },
|
|
880
|
+
{ value: 'indigo', label: 'Indigo' },
|
|
619
881
|
{ value: 'violet', label: 'Violet' },
|
|
882
|
+
{ value: 'purple', label: 'Purple' },
|
|
883
|
+
{ value: 'fuchsia', label: 'Fuchsia' },
|
|
884
|
+
{ value: 'pink', label: 'Pink' },
|
|
620
885
|
{ value: 'rose', label: 'Rose' },
|
|
621
886
|
],
|
|
622
887
|
initialValue: 'slate',
|
|
@@ -626,6 +891,39 @@ async function main() {
|
|
|
626
891
|
process.exit(0)
|
|
627
892
|
}
|
|
628
893
|
|
|
894
|
+
const baseColor = await select({
|
|
895
|
+
message: 'Base color (background/text in light mode)',
|
|
896
|
+
options: [
|
|
897
|
+
{ value: 'slate', label: 'Slate (default)' },
|
|
898
|
+
{ value: 'gray', label: 'Gray' },
|
|
899
|
+
{ value: 'zinc', label: 'Zinc' },
|
|
900
|
+
{ value: 'neutral', label: 'Neutral' },
|
|
901
|
+
{ value: 'stone', label: 'Stone' },
|
|
902
|
+
{ value: 'red', label: 'Red' },
|
|
903
|
+
{ value: 'orange', label: 'Orange' },
|
|
904
|
+
{ value: 'amber', label: 'Amber' },
|
|
905
|
+
{ value: 'yellow', label: 'Yellow' },
|
|
906
|
+
{ value: 'lime', label: 'Lime' },
|
|
907
|
+
{ value: 'green', label: 'Green' },
|
|
908
|
+
{ value: 'emerald', label: 'Emerald' },
|
|
909
|
+
{ value: 'teal', label: 'Teal' },
|
|
910
|
+
{ value: 'cyan', label: 'Cyan' },
|
|
911
|
+
{ value: 'sky', label: 'Sky' },
|
|
912
|
+
{ value: 'blue', label: 'Blue' },
|
|
913
|
+
{ value: 'indigo', label: 'Indigo' },
|
|
914
|
+
{ value: 'violet', label: 'Violet' },
|
|
915
|
+
{ value: 'purple', label: 'Purple' },
|
|
916
|
+
{ value: 'fuchsia', label: 'Fuchsia' },
|
|
917
|
+
{ value: 'pink', label: 'Pink' },
|
|
918
|
+
{ value: 'rose', label: 'Rose' },
|
|
919
|
+
],
|
|
920
|
+
initialValue: 'slate',
|
|
921
|
+
})
|
|
922
|
+
if (isCancel(baseColor)) {
|
|
923
|
+
cancel('Cancelled')
|
|
924
|
+
process.exit(0)
|
|
925
|
+
}
|
|
926
|
+
|
|
629
927
|
const iconSet = await select({
|
|
630
928
|
message: 'Icon set',
|
|
631
929
|
options: [
|
|
@@ -753,7 +1051,11 @@ async function main() {
|
|
|
753
1051
|
}
|
|
754
1052
|
}
|
|
755
1053
|
|
|
756
|
-
await applyPrimaryTheme(
|
|
1054
|
+
await applyPrimaryTheme(
|
|
1055
|
+
targetDir,
|
|
1056
|
+
THEME_PRESETS[primaryColor] ?? THEME_PRESETS.slate,
|
|
1057
|
+
BASE_COLOR_PRESETS[baseColor] ?? BASE_COLOR_PRESETS.slate
|
|
1058
|
+
)
|
|
757
1059
|
await applyIconSet(targetDir, language, iconSet)
|
|
758
1060
|
await applyEnvAndConfig(targetDir, language, integrations)
|
|
759
1061
|
await applyIntegrations(targetDir, language, integrations)
|