ether-code 0.3.3 → 0.3.5
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/cli/ether.js +344 -237
- package/ether-parser.js +10 -1
- package/generators/css-generator.js +16 -4
- package/package.json +1 -1
package/cli/ether.js
CHANGED
|
@@ -6,7 +6,7 @@ const http = require('http')
|
|
|
6
6
|
const { EtherCompiler } = require('./compiler')
|
|
7
7
|
const { Watcher } = require('./watcher')
|
|
8
8
|
|
|
9
|
-
const VERSION = '0.3.
|
|
9
|
+
const VERSION = '0.3.5'
|
|
10
10
|
|
|
11
11
|
const COLORS = {
|
|
12
12
|
reset: '\x1b[0m',
|
|
@@ -76,6 +76,330 @@ const FAVICON_SVG = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 499 50
|
|
|
76
76
|
<path fill="url(#f3)" d="M213.282,235.909c14.12-20.019,28.129-36.342,31.945-40.798c5.362-6.26,5.762-5.197,8.629-5.197c2.869,0,132.714,0.003,132.714,0.003s2.916-0.469,4.863,1.864c1.029,1.235-0.298,5.654-0.298,5.654l-9.552,40.332c0,0-1.318,5.72-6.366,5.649C334.696,242.847,208.748,250.903,213.282,235.909"/>
|
|
77
77
|
</svg>`
|
|
78
78
|
|
|
79
|
+
const STYLES_CSS = `:root {
|
|
80
|
+
--color-primary: #6366f1;
|
|
81
|
+
--color-secondary: #8b5cf6;
|
|
82
|
+
--color-accent: #06b6d4;
|
|
83
|
+
--color-bg: #16162a;
|
|
84
|
+
--color-bg-light: #1e1e3a;
|
|
85
|
+
--color-surface: #252545;
|
|
86
|
+
--color-text: #e2e8f0;
|
|
87
|
+
--color-text-muted: #94a3b8;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
* {
|
|
91
|
+
margin: 0;
|
|
92
|
+
padding: 0;
|
|
93
|
+
box-sizing: border-box;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
body {
|
|
97
|
+
font-family: 'Inter', system-ui, -apple-system, sans-serif;
|
|
98
|
+
background: linear-gradient(180deg, var(--color-bg) 0%, var(--color-bg-light) 50%, var(--color-bg) 100%);
|
|
99
|
+
color: var(--color-text);
|
|
100
|
+
line-height: 1.6;
|
|
101
|
+
min-height: 100vh;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
.hero {
|
|
105
|
+
min-height: 100vh;
|
|
106
|
+
position: relative;
|
|
107
|
+
overflow: hidden;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
.hero::before {
|
|
111
|
+
content: '';
|
|
112
|
+
position: absolute;
|
|
113
|
+
top: 0;
|
|
114
|
+
left: 0;
|
|
115
|
+
right: 0;
|
|
116
|
+
bottom: 0;
|
|
117
|
+
background:
|
|
118
|
+
radial-gradient(ellipse at 20% 20%, rgba(99, 102, 241, 0.15) 0%, transparent 50%),
|
|
119
|
+
radial-gradient(ellipse at 80% 80%, rgba(139, 92, 246, 0.1) 0%, transparent 50%),
|
|
120
|
+
radial-gradient(ellipse at 50% 50%, rgba(6, 182, 212, 0.05) 0%, transparent 70%);
|
|
121
|
+
pointer-events: none;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
.navbar {
|
|
125
|
+
display: flex;
|
|
126
|
+
justify-content: space-between;
|
|
127
|
+
align-items: center;
|
|
128
|
+
padding: 1.25rem 5%;
|
|
129
|
+
position: fixed;
|
|
130
|
+
width: 100%;
|
|
131
|
+
top: 0;
|
|
132
|
+
z-index: 100;
|
|
133
|
+
background: rgba(22, 22, 42, 0.85);
|
|
134
|
+
backdrop-filter: blur(12px);
|
|
135
|
+
border-bottom: 1px solid rgba(255, 255, 255, 0.05);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
.logo {
|
|
139
|
+
display: flex;
|
|
140
|
+
align-items: center;
|
|
141
|
+
gap: 0.75rem;
|
|
142
|
+
font-size: 1.5rem;
|
|
143
|
+
font-weight: 700;
|
|
144
|
+
color: var(--color-text);
|
|
145
|
+
text-decoration: none;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
.logo-icon {
|
|
149
|
+
width: 2.5rem;
|
|
150
|
+
height: 2.5rem;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
.nav-links {
|
|
154
|
+
display: flex;
|
|
155
|
+
list-style: none;
|
|
156
|
+
gap: 2.5rem;
|
|
157
|
+
margin-left: auto;
|
|
158
|
+
padding-right: 1rem;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
.nav-links a {
|
|
162
|
+
color: var(--color-text-muted);
|
|
163
|
+
text-decoration: none;
|
|
164
|
+
font-weight: 500;
|
|
165
|
+
font-size: 0.95rem;
|
|
166
|
+
transition: color 0.2s ease;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
.nav-links a:hover {
|
|
170
|
+
color: var(--color-accent);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
.hero-content {
|
|
174
|
+
position: relative;
|
|
175
|
+
text-align: center;
|
|
176
|
+
padding: 10rem 5% 6rem;
|
|
177
|
+
max-width: 900px;
|
|
178
|
+
margin: 0 auto;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
.hero-title {
|
|
182
|
+
font-size: 4rem;
|
|
183
|
+
font-weight: 800;
|
|
184
|
+
margin-bottom: 1.5rem;
|
|
185
|
+
line-height: 1.1;
|
|
186
|
+
letter-spacing: -0.02em;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
.gradient-text {
|
|
190
|
+
background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-accent) 50%, var(--color-secondary) 100%);
|
|
191
|
+
-webkit-background-clip: text;
|
|
192
|
+
-webkit-text-fill-color: transparent;
|
|
193
|
+
background-clip: text;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
.hero-subtitle {
|
|
197
|
+
font-size: 1.25rem;
|
|
198
|
+
color: var(--color-text-muted);
|
|
199
|
+
margin-bottom: 2.5rem;
|
|
200
|
+
max-width: 600px;
|
|
201
|
+
margin-left: auto;
|
|
202
|
+
margin-right: auto;
|
|
203
|
+
line-height: 1.7;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
.hero-buttons {
|
|
207
|
+
display: flex;
|
|
208
|
+
gap: 1rem;
|
|
209
|
+
justify-content: center;
|
|
210
|
+
flex-wrap: wrap;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
.btn {
|
|
214
|
+
display: inline-flex;
|
|
215
|
+
align-items: center;
|
|
216
|
+
padding: 0.9rem 2rem;
|
|
217
|
+
border-radius: 0.75rem;
|
|
218
|
+
font-size: 1rem;
|
|
219
|
+
font-weight: 600;
|
|
220
|
+
text-decoration: none;
|
|
221
|
+
transition: all 0.2s ease;
|
|
222
|
+
border: none;
|
|
223
|
+
cursor: pointer;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
.btn-primary {
|
|
227
|
+
background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-secondary) 100%);
|
|
228
|
+
color: white;
|
|
229
|
+
box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
.btn-primary:hover {
|
|
233
|
+
transform: translateY(-2px);
|
|
234
|
+
box-shadow: 0 8px 25px rgba(99, 102, 241, 0.4);
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
.btn-secondary {
|
|
238
|
+
background: rgba(255, 255, 255, 0.05);
|
|
239
|
+
color: var(--color-text);
|
|
240
|
+
border: 1px solid rgba(255, 255, 255, 0.1);
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
.btn-secondary:hover {
|
|
244
|
+
background: rgba(255, 255, 255, 0.1);
|
|
245
|
+
border-color: rgba(255, 255, 255, 0.2);
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
.features {
|
|
249
|
+
padding: 6rem 5%;
|
|
250
|
+
position: relative;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
.section-title {
|
|
254
|
+
text-align: center;
|
|
255
|
+
font-size: 2.5rem;
|
|
256
|
+
font-weight: 700;
|
|
257
|
+
margin-bottom: 3.5rem;
|
|
258
|
+
letter-spacing: -0.01em;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
.features-grid {
|
|
262
|
+
display: grid;
|
|
263
|
+
grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
|
|
264
|
+
gap: 1.5rem;
|
|
265
|
+
max-width: 1200px;
|
|
266
|
+
margin: 0 auto;
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
.feature-card {
|
|
270
|
+
background: rgba(255, 255, 255, 0.03);
|
|
271
|
+
border: 1px solid rgba(255, 255, 255, 0.06);
|
|
272
|
+
padding: 2rem;
|
|
273
|
+
border-radius: 1rem;
|
|
274
|
+
text-align: center;
|
|
275
|
+
transition: all 0.3s ease;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
.feature-card:hover {
|
|
279
|
+
transform: translateY(-4px);
|
|
280
|
+
background: rgba(255, 255, 255, 0.05);
|
|
281
|
+
border-color: rgba(99, 102, 241, 0.3);
|
|
282
|
+
box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
.feature-icon {
|
|
286
|
+
font-size: 2.5rem;
|
|
287
|
+
margin-bottom: 1rem;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
.feature-card h3 {
|
|
291
|
+
margin-bottom: 0.75rem;
|
|
292
|
+
font-size: 1.25rem;
|
|
293
|
+
font-weight: 600;
|
|
294
|
+
color: var(--color-text);
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
.feature-card p {
|
|
298
|
+
color: var(--color-text-muted);
|
|
299
|
+
font-size: 0.95rem;
|
|
300
|
+
line-height: 1.6;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
.examples {
|
|
304
|
+
padding: 6rem 5%;
|
|
305
|
+
background: var(--color-bg-light);
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
.code-comparison {
|
|
309
|
+
display: flex;
|
|
310
|
+
align-items: stretch;
|
|
311
|
+
justify-content: center;
|
|
312
|
+
gap: 1.5rem;
|
|
313
|
+
flex-wrap: wrap;
|
|
314
|
+
max-width: 1000px;
|
|
315
|
+
margin: 0 auto;
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
.code-block {
|
|
319
|
+
background: var(--color-bg);
|
|
320
|
+
border: 1px solid rgba(255, 255, 255, 0.08);
|
|
321
|
+
border-radius: 1rem;
|
|
322
|
+
overflow: hidden;
|
|
323
|
+
min-width: 320px;
|
|
324
|
+
flex: 1;
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
.code-header {
|
|
328
|
+
background: rgba(99, 102, 241, 0.15);
|
|
329
|
+
padding: 0.875rem 1.25rem;
|
|
330
|
+
font-weight: 600;
|
|
331
|
+
font-size: 0.9rem;
|
|
332
|
+
color: var(--color-accent);
|
|
333
|
+
border-bottom: 1px solid rgba(255, 255, 255, 0.05);
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
.code-block pre {
|
|
337
|
+
padding: 1.5rem;
|
|
338
|
+
margin: 0;
|
|
339
|
+
overflow-x: auto;
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
.code-block code {
|
|
343
|
+
font-family: 'Fira Code', 'Monaco', 'Consolas', monospace;
|
|
344
|
+
font-size: 0.875rem;
|
|
345
|
+
line-height: 1.6;
|
|
346
|
+
color: var(--color-text-muted);
|
|
347
|
+
white-space: pre;
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
.code-arrow {
|
|
351
|
+
display: flex;
|
|
352
|
+
align-items: center;
|
|
353
|
+
font-size: 2rem;
|
|
354
|
+
color: var(--color-primary);
|
|
355
|
+
padding: 0 0.5rem;
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
.footer {
|
|
359
|
+
text-align: center;
|
|
360
|
+
padding: 3rem 5%;
|
|
361
|
+
background: var(--color-bg);
|
|
362
|
+
border-top: 1px solid rgba(255, 255, 255, 0.05);
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
.footer p {
|
|
366
|
+
color: var(--color-text-muted);
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
.heart {
|
|
370
|
+
color: #ef4444;
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
.copyright {
|
|
374
|
+
margin-top: 0.5rem;
|
|
375
|
+
font-size: 0.875rem;
|
|
376
|
+
opacity: 0.7;
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
@media (max-width: 768px) {
|
|
380
|
+
.hero-title {
|
|
381
|
+
font-size: 2.5rem;
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
.nav-links {
|
|
385
|
+
display: none;
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
.code-arrow {
|
|
389
|
+
transform: rotate(90deg);
|
|
390
|
+
padding: 1rem 0;
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
.code-comparison {
|
|
394
|
+
flex-direction: column;
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
.code-block {
|
|
398
|
+
min-width: 100%;
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
`
|
|
402
|
+
|
|
79
403
|
function log(msg, color) {
|
|
80
404
|
console.log((color || '') + msg + COLORS.reset)
|
|
81
405
|
}
|
|
@@ -298,7 +622,7 @@ document
|
|
|
298
622
|
corps
|
|
299
623
|
entete classe: "hero"
|
|
300
624
|
nav classe: "navbar"
|
|
301
|
-
|
|
625
|
+
lien href: "/", classe: "logo"
|
|
302
626
|
image src: "/images/logo.svg", alt: "Ether", classe: "logo-icon"
|
|
303
627
|
span "Ether"
|
|
304
628
|
liste-non-ordonnee classe: "nav-links"
|
|
@@ -361,7 +685,10 @@ document
|
|
|
361
685
|
"Ether"
|
|
362
686
|
pre
|
|
363
687
|
code
|
|
364
|
-
"document
|
|
688
|
+
"document
|
|
689
|
+
corps
|
|
690
|
+
titre1 \\"Bonjour\\"
|
|
691
|
+
paragraphe \\"Le monde\\""
|
|
365
692
|
div classe: "code-arrow"
|
|
366
693
|
"→"
|
|
367
694
|
div classe: "code-block"
|
|
@@ -369,256 +696,36 @@ document
|
|
|
369
696
|
"HTML"
|
|
370
697
|
pre
|
|
371
698
|
code
|
|
372
|
-
"
|
|
699
|
+
"<!DOCTYPE html>
|
|
700
|
+
<html>
|
|
701
|
+
<body>
|
|
702
|
+
<h1>Bonjour</h1>
|
|
703
|
+
<p>Le monde</p>
|
|
704
|
+
</body>
|
|
705
|
+
</html>"
|
|
373
706
|
|
|
374
707
|
pied classe: "footer"
|
|
375
708
|
paragraphe
|
|
376
|
-
"Créé avec"
|
|
709
|
+
"Créé avec "
|
|
377
710
|
span classe: "heart"
|
|
378
|
-
"
|
|
379
|
-
"par la communauté Ether"
|
|
711
|
+
"♥"
|
|
712
|
+
" par la communauté Ether"
|
|
380
713
|
paragraphe classe: "copyright"
|
|
381
714
|
"© 2025 Ether. MIT License."
|
|
382
715
|
|
|
383
716
|
script src: "app.js"
|
|
384
717
|
`
|
|
385
718
|
|
|
386
|
-
const stylesContent = `// cible: css
|
|
387
|
-
|
|
388
|
-
racine
|
|
389
|
-
couleur-primaire: "#6366f1"
|
|
390
|
-
couleur-secondaire: "#8b5cf6"
|
|
391
|
-
couleur-accent: "#06b6d4"
|
|
392
|
-
couleur-fond: "#0f0f23"
|
|
393
|
-
couleur-surface: "#1a1a2e"
|
|
394
|
-
couleur-texte: "#e2e8f0"
|
|
395
|
-
couleur-texte-pale: "#94a3b8"
|
|
396
|
-
|
|
397
|
-
*
|
|
398
|
-
marge: 0
|
|
399
|
-
remplissage: 0
|
|
400
|
-
modele-boite: border-box
|
|
401
|
-
|
|
402
|
-
corps
|
|
403
|
-
famille-police: "system-ui", "-apple-system", "sans-serif"
|
|
404
|
-
couleur-fond: var(--couleur-fond)
|
|
405
|
-
couleur: var(--couleur-texte)
|
|
406
|
-
hauteur-ligne: 1.6
|
|
407
|
-
|
|
408
|
-
.hero
|
|
409
|
-
min-hauteur: 100vh
|
|
410
|
-
fond: "linear-gradient(135deg, var(--couleur-fond) 0%, var(--couleur-surface) 100%)"
|
|
411
|
-
position: relative
|
|
412
|
-
debordement: cache
|
|
413
|
-
|
|
414
|
-
.navbar
|
|
415
|
-
affichage: flex
|
|
416
|
-
justifier-contenu: space-between
|
|
417
|
-
aligner-elements: center
|
|
418
|
-
remplissage: "1.5rem 5%"
|
|
419
|
-
position: fixed
|
|
420
|
-
largeur: 100%
|
|
421
|
-
haut: 0
|
|
422
|
-
z-index: 100
|
|
423
|
-
fond: "rgba(15, 15, 35, 0.9)"
|
|
424
|
-
flou-fond: "10px"
|
|
425
|
-
|
|
426
|
-
.logo
|
|
427
|
-
affichage: flex
|
|
428
|
-
aligner-elements: center
|
|
429
|
-
espace: "0.75rem"
|
|
430
|
-
taille-police: "1.5rem"
|
|
431
|
-
poids-police: 700
|
|
432
|
-
|
|
433
|
-
.logo-icon
|
|
434
|
-
largeur: "2.5rem"
|
|
435
|
-
hauteur: "2.5rem"
|
|
436
|
-
|
|
437
|
-
.nav-links
|
|
438
|
-
affichage: flex
|
|
439
|
-
liste-style: none
|
|
440
|
-
espace: "2rem"
|
|
441
|
-
|
|
442
|
-
.nav-links lien
|
|
443
|
-
couleur: var(--couleur-texte-pale)
|
|
444
|
-
decoration-texte: none
|
|
445
|
-
transition: "couleur 0.3s"
|
|
446
|
-
au survol
|
|
447
|
-
couleur: var(--couleur-primaire)
|
|
448
|
-
|
|
449
|
-
.hero-content
|
|
450
|
-
texte-aligne: center
|
|
451
|
-
remplissage: "12rem 5% 5rem"
|
|
452
|
-
max-largeur: "800px"
|
|
453
|
-
marge: "0 auto"
|
|
454
|
-
|
|
455
|
-
.hero-title
|
|
456
|
-
taille-police: "3.5rem"
|
|
457
|
-
poids-police: 800
|
|
458
|
-
marge-bas: "1.5rem"
|
|
459
|
-
hauteur-ligne: 1.2
|
|
460
|
-
|
|
461
|
-
.gradient-text
|
|
462
|
-
fond: "linear-gradient(90deg, var(--couleur-primaire), var(--couleur-accent))"
|
|
463
|
-
decoupe-fond: text
|
|
464
|
-
couleur: transparent
|
|
465
|
-
|
|
466
|
-
.hero-subtitle
|
|
467
|
-
taille-police: "1.25rem"
|
|
468
|
-
couleur: var(--couleur-texte-pale)
|
|
469
|
-
marge-bas: "2.5rem"
|
|
470
|
-
max-largeur: "600px"
|
|
471
|
-
marge-gauche: auto
|
|
472
|
-
marge-droite: auto
|
|
473
|
-
|
|
474
|
-
.hero-buttons
|
|
475
|
-
affichage: flex
|
|
476
|
-
espace: "1rem"
|
|
477
|
-
justifier-contenu: center
|
|
478
|
-
|
|
479
|
-
.btn
|
|
480
|
-
remplissage: "0.875rem 2rem"
|
|
481
|
-
rayon-bordure: "0.5rem"
|
|
482
|
-
taille-police: "1rem"
|
|
483
|
-
poids-police: 600
|
|
484
|
-
decoration-texte: none
|
|
485
|
-
transition: "transform 0.2s, box-shadow 0.2s"
|
|
486
|
-
au survol
|
|
487
|
-
transformation: "translateY(-2px)"
|
|
488
|
-
|
|
489
|
-
.btn-primary
|
|
490
|
-
fond: "linear-gradient(90deg, var(--couleur-primaire), var(--couleur-secondaire))"
|
|
491
|
-
couleur: white
|
|
492
|
-
au survol
|
|
493
|
-
ombre-boite: "0 10px 30px rgba(99, 102, 241, 0.4)"
|
|
494
|
-
|
|
495
|
-
.btn-secondary
|
|
496
|
-
fond: transparent
|
|
497
|
-
couleur: var(--couleur-texte)
|
|
498
|
-
bordure: "2px solid var(--couleur-primaire)"
|
|
499
|
-
au survol
|
|
500
|
-
fond: "rgba(99, 102, 241, 0.1)"
|
|
501
|
-
|
|
502
|
-
.features
|
|
503
|
-
remplissage: "6rem 5%"
|
|
504
|
-
|
|
505
|
-
.section-title
|
|
506
|
-
texte-aligne: center
|
|
507
|
-
taille-police: "2.5rem"
|
|
508
|
-
marge-bas: "3rem"
|
|
509
|
-
|
|
510
|
-
.features-grid
|
|
511
|
-
affichage: grid
|
|
512
|
-
colonnes-grille: "repeat(auto-fit, minmax(250px, 1fr))"
|
|
513
|
-
espace: "2rem"
|
|
514
|
-
max-largeur: "1200px"
|
|
515
|
-
marge: "0 auto"
|
|
516
|
-
|
|
517
|
-
.feature-card
|
|
518
|
-
fond: var(--couleur-surface)
|
|
519
|
-
remplissage: "2rem"
|
|
520
|
-
rayon-bordure: "1rem"
|
|
521
|
-
texte-aligne: center
|
|
522
|
-
transition: "transform 0.3s"
|
|
523
|
-
au survol
|
|
524
|
-
transformation: "translateY(-5px)"
|
|
525
|
-
|
|
526
|
-
.feature-icon
|
|
527
|
-
taille-police: "3rem"
|
|
528
|
-
marge-bas: "1rem"
|
|
529
|
-
|
|
530
|
-
.feature-card titre3
|
|
531
|
-
marge-bas: "0.75rem"
|
|
532
|
-
taille-police: "1.25rem"
|
|
533
|
-
|
|
534
|
-
.feature-card paragraphe
|
|
535
|
-
couleur: var(--couleur-texte-pale)
|
|
536
|
-
|
|
537
|
-
.examples
|
|
538
|
-
remplissage: "6rem 5%"
|
|
539
|
-
fond: var(--couleur-surface)
|
|
540
|
-
|
|
541
|
-
.code-comparison
|
|
542
|
-
affichage: flex
|
|
543
|
-
aligner-elements: center
|
|
544
|
-
justifier-contenu: center
|
|
545
|
-
espace: "2rem"
|
|
546
|
-
flex-wrap: wrap
|
|
547
|
-
max-largeur: "1000px"
|
|
548
|
-
marge: "0 auto"
|
|
549
|
-
|
|
550
|
-
.code-block
|
|
551
|
-
fond: var(--couleur-fond)
|
|
552
|
-
rayon-bordure: "0.75rem"
|
|
553
|
-
debordement: cache
|
|
554
|
-
min-largeur: "300px"
|
|
555
|
-
|
|
556
|
-
.code-header
|
|
557
|
-
fond: "rgba(99, 102, 241, 0.2)"
|
|
558
|
-
remplissage: "0.75rem 1rem"
|
|
559
|
-
poids-police: 600
|
|
560
|
-
couleur: var(--couleur-primaire)
|
|
561
|
-
|
|
562
|
-
.code-block pre
|
|
563
|
-
remplissage: "1.5rem"
|
|
564
|
-
marge: 0
|
|
565
|
-
|
|
566
|
-
.code-block code
|
|
567
|
-
famille-police: "Fira Code", "Monaco", monospace
|
|
568
|
-
taille-police: "0.9rem"
|
|
569
|
-
blanc: pre
|
|
570
|
-
|
|
571
|
-
.code-arrow
|
|
572
|
-
taille-police: "2rem"
|
|
573
|
-
couleur: var(--couleur-primaire)
|
|
574
|
-
|
|
575
|
-
.footer
|
|
576
|
-
texte-aligne: center
|
|
577
|
-
remplissage: "3rem 5%"
|
|
578
|
-
fond: var(--couleur-fond)
|
|
579
|
-
|
|
580
|
-
.heart
|
|
581
|
-
couleur: "#ef4444"
|
|
582
|
-
|
|
583
|
-
.copyright
|
|
584
|
-
marge-haut: "0.5rem"
|
|
585
|
-
couleur: var(--couleur-texte-pale)
|
|
586
|
-
taille-police: "0.875rem"
|
|
587
|
-
|
|
588
|
-
@media (max-largeur: 768px)
|
|
589
|
-
.hero-title
|
|
590
|
-
taille-police: "2.5rem"
|
|
591
|
-
.nav-links
|
|
592
|
-
affichage: none
|
|
593
|
-
.code-arrow
|
|
594
|
-
transformation: "rotate(90deg)"
|
|
595
|
-
`
|
|
596
|
-
|
|
597
719
|
const appContent = `// cible: js
|
|
598
720
|
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
fonction initialiser()
|
|
602
|
-
constante copyright = document.querySelector(".copyright")
|
|
603
|
-
si copyright
|
|
604
|
-
copyright.textContent = "© " + annee + " Ether. MIT License."
|
|
605
|
-
|
|
606
|
-
constante liens = document.querySelectorAll("a[href^='#']")
|
|
607
|
-
pour chaque lien dans liens
|
|
608
|
-
lien.addEventListener "click", fonction(e)
|
|
609
|
-
e.preventDefault()
|
|
610
|
-
constante cible = document.querySelector(this.getAttribute("href"))
|
|
611
|
-
si cible
|
|
612
|
-
cible.scrollIntoView({ behavior: "smooth" })
|
|
613
|
-
|
|
614
|
-
document.addEventListener "DOMContentLoaded", initialiser
|
|
721
|
+
console.log("Ether v0.3.4 ready!")
|
|
615
722
|
`
|
|
616
723
|
|
|
617
724
|
const packageContent = '{\n "name": "mon-projet-ether",\n "version": "1.0.0",\n "scripts": {\n "dev": "ether dev",\n "build": "ether build"\n }\n}\n'
|
|
618
725
|
|
|
619
726
|
fs.writeFileSync(path.join(projectDir, 'ether.config.js'), configContent)
|
|
620
727
|
fs.writeFileSync(path.join(srcDir, 'index.eth'), indexContent)
|
|
621
|
-
fs.writeFileSync(path.join(
|
|
728
|
+
fs.writeFileSync(path.join(distDir, 'styles.css'), STYLES_CSS)
|
|
622
729
|
fs.writeFileSync(path.join(srcDir, 'app.eth'), appContent)
|
|
623
730
|
fs.writeFileSync(path.join(projectDir, 'package.json'), packageContent)
|
|
624
731
|
|
|
@@ -626,8 +733,8 @@ document.addEventListener "DOMContentLoaded", initialiser
|
|
|
626
733
|
console.log('')
|
|
627
734
|
logInfo('Structure creee:')
|
|
628
735
|
console.log(' src/index.eth')
|
|
629
|
-
console.log(' src/styles.eth')
|
|
630
736
|
console.log(' src/app.eth')
|
|
737
|
+
console.log(' dist/styles.css')
|
|
631
738
|
console.log(' public/images/logo.svg')
|
|
632
739
|
console.log(' public/favicon.svg')
|
|
633
740
|
console.log(' public/videos/')
|
|
@@ -840,4 +947,4 @@ function main() {
|
|
|
840
947
|
console.log('Tapez "ether help" pour voir les commandes disponibles')
|
|
841
948
|
}
|
|
842
949
|
|
|
843
|
-
main()
|
|
950
|
+
main()
|
package/ether-parser.js
CHANGED
|
@@ -434,6 +434,8 @@ class EtherParser {
|
|
|
434
434
|
valueParts.push('%')
|
|
435
435
|
} else if (current.type === TokenType.SLASH) {
|
|
436
436
|
valueParts.push('/')
|
|
437
|
+
} else if (current.type === TokenType.MINUS) {
|
|
438
|
+
valueParts.push('-')
|
|
437
439
|
} else {
|
|
438
440
|
break
|
|
439
441
|
}
|
|
@@ -444,7 +446,14 @@ class EtherParser {
|
|
|
444
446
|
return {
|
|
445
447
|
type: 'Declaration',
|
|
446
448
|
property: property,
|
|
447
|
-
value: valueParts.join(' ')
|
|
449
|
+
value: valueParts.join(' ')
|
|
450
|
+
.replace(/\(\s+/g, '(')
|
|
451
|
+
.replace(/\s+\)/g, ')')
|
|
452
|
+
.replace(/\s+,/g, ',')
|
|
453
|
+
.replace(/-\s+/g, '-')
|
|
454
|
+
.replace(/(\d+)\s+(%|px|em|rem|vh|vw|vmin|vmax|fr|s|ms|deg)/gi, '$1$2')
|
|
455
|
+
.replace(/\s+/g, ' ')
|
|
456
|
+
.trim()
|
|
448
457
|
}
|
|
449
458
|
}
|
|
450
459
|
|
|
@@ -358,7 +358,13 @@ class CSSGenerator {
|
|
|
358
358
|
'en-ligne': 'inline',
|
|
359
359
|
'bloc-en-ligne': 'inline-block',
|
|
360
360
|
'flex-en-ligne': 'inline-flex',
|
|
361
|
-
'grille-en-ligne': 'inline-grid'
|
|
361
|
+
'grille-en-ligne': 'inline-grid',
|
|
362
|
+
'espace-blanc': 'white-space',
|
|
363
|
+
'blanc-espace': 'white-space',
|
|
364
|
+
'pre': 'pre',
|
|
365
|
+
'pre-ligne': 'pre-line',
|
|
366
|
+
'pre-enveloppe': 'pre-wrap',
|
|
367
|
+
'sans-retour': 'nowrap'
|
|
362
368
|
}
|
|
363
369
|
|
|
364
370
|
const lower = text.toLowerCase()
|
|
@@ -497,13 +503,14 @@ class CSSGenerator {
|
|
|
497
503
|
generateRule(node) {
|
|
498
504
|
const selectors = node.selectors || [node.selector]
|
|
499
505
|
const translatedSelectors = selectors.map(s => this.translateSelector(s))
|
|
506
|
+
const isRoot = translatedSelectors.some(s => s === ':root')
|
|
500
507
|
|
|
501
508
|
this.writeLine(`${translatedSelectors.join(', ')} {`)
|
|
502
509
|
this.indent++
|
|
503
510
|
|
|
504
511
|
const declarations = node.declarations || node.properties || []
|
|
505
512
|
for (const decl of declarations) {
|
|
506
|
-
this.generateDeclaration(decl)
|
|
513
|
+
this.generateDeclaration(decl, isRoot)
|
|
507
514
|
}
|
|
508
515
|
|
|
509
516
|
if (node.children) {
|
|
@@ -523,13 +530,18 @@ class CSSGenerator {
|
|
|
523
530
|
}
|
|
524
531
|
}
|
|
525
532
|
|
|
526
|
-
generateDeclaration(decl) {
|
|
533
|
+
generateDeclaration(decl, isRoot = false) {
|
|
527
534
|
if (!decl) return
|
|
528
535
|
|
|
529
536
|
let property = decl.property || decl.name
|
|
530
537
|
let value = decl.value
|
|
531
538
|
|
|
532
|
-
|
|
539
|
+
if (isRoot) {
|
|
540
|
+
property = '--' + property.toLowerCase()
|
|
541
|
+
} else {
|
|
542
|
+
property = this.translateProperty(property)
|
|
543
|
+
}
|
|
544
|
+
|
|
533
545
|
value = this.translateValue(value)
|
|
534
546
|
|
|
535
547
|
if (typeof value === 'object' && value.type === 'animation') {
|