ether-code 0.3.4 → 0.3.6

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 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.4'
9
+ const VERSION = '0.3.6'
10
10
 
11
11
  const COLORS = {
12
12
  reset: '\x1b[0m',
@@ -76,6 +76,331 @@ 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.7;
346
+ color: var(--color-text-muted);
347
+ white-space: pre;
348
+ display: block;
349
+ }
350
+
351
+ .code-arrow {
352
+ display: flex;
353
+ align-items: center;
354
+ font-size: 2rem;
355
+ color: var(--color-primary);
356
+ padding: 0 0.5rem;
357
+ }
358
+
359
+ .footer {
360
+ text-align: center;
361
+ padding: 3rem 5%;
362
+ background: var(--color-bg);
363
+ border-top: 1px solid rgba(255, 255, 255, 0.05);
364
+ }
365
+
366
+ .footer p {
367
+ color: var(--color-text-muted);
368
+ }
369
+
370
+ .heart {
371
+ color: #ef4444;
372
+ }
373
+
374
+ .copyright {
375
+ margin-top: 0.5rem;
376
+ font-size: 0.875rem;
377
+ opacity: 0.7;
378
+ }
379
+
380
+ @media (max-width: 768px) {
381
+ .hero-title {
382
+ font-size: 2.5rem;
383
+ }
384
+
385
+ .nav-links {
386
+ display: none;
387
+ }
388
+
389
+ .code-arrow {
390
+ transform: rotate(90deg);
391
+ padding: 1rem 0;
392
+ }
393
+
394
+ .code-comparison {
395
+ flex-direction: column;
396
+ }
397
+
398
+ .code-block {
399
+ min-width: 100%;
400
+ }
401
+ }
402
+ `
403
+
79
404
  function log(msg, color) {
80
405
  console.log((color || '') + msg + COLORS.reset)
81
406
  }
@@ -298,13 +623,13 @@ document
298
623
  corps
299
624
  entete classe: "hero"
300
625
  nav classe: "navbar"
301
- div classe: "logo"
626
+ lien href: "/", classe: "logo"
302
627
  image src: "/images/logo.svg", alt: "Ether", classe: "logo-icon"
303
628
  span "Ether"
304
629
  liste-non-ordonnee classe: "nav-links"
305
630
  element-liste
306
631
  lien href: "#features"
307
- "Fonctionnalités"
632
+ "Fonctionnalites"
308
633
  element-liste
309
634
  lien href: "#examples"
310
635
  "Exemples"
@@ -314,7 +639,7 @@ document
314
639
 
315
640
  div classe: "hero-content"
316
641
  titre1 classe: "hero-title"
317
- "Écrivez du code"
642
+ "Ecrivez du code"
318
643
  saut-ligne
319
644
  span classe: "gradient-text"
320
645
  "comme vous pensez"
@@ -335,17 +660,17 @@ document
335
660
  div classe: "feature-icon"
336
661
  "🎯"
337
662
  titre3 "Intuitif"
338
- paragraphe "Écrivez du code en langage naturel. Plus besoin de mémoriser des syntaxes complexes."
663
+ paragraphe "Ecrivez du code en langage naturel. Plus besoin de memoriser des syntaxes complexes."
339
664
  article classe: "feature-card"
340
665
  div classe: "feature-icon"
341
666
  "⚡"
342
667
  titre3 "Rapide"
343
- paragraphe "Compilation instantanée avec rechargement automatique en mode développement."
668
+ paragraphe "Compilation instantanee avec rechargement automatique en mode developpement."
344
669
  article classe: "feature-card"
345
670
  div classe: "feature-icon"
346
671
  "🌍"
347
672
  titre3 "Multilingue"
348
- paragraphe "Codez en français, anglais, espagnol et plus. Votre langue, votre code."
673
+ paragraphe "Codez en francais, anglais, espagnol et plus. Votre langue, votre code."
349
674
  article classe: "feature-card"
350
675
  div classe: "feature-icon"
351
676
  "🔧"
@@ -354,271 +679,45 @@ document
354
679
 
355
680
  section id: "examples", classe: "examples"
356
681
  titre2 classe: "section-title"
357
- "Simple et élégant"
682
+ "Simple et elegant"
358
683
  div classe: "code-comparison"
359
684
  div classe: "code-block"
360
685
  div classe: "code-header"
361
686
  "Ether"
362
687
  pre
363
- code
364
- "document\\n corps\\n titre1 \\"Bonjour\\"\\n paragraphe \\"Le monde\\""
688
+ code classe: "ether-code"
689
+ "document\n corps\n titre1 Bonjour\n paragraphe Le monde"
365
690
  div classe: "code-arrow"
366
691
  "→"
367
692
  div classe: "code-block"
368
693
  div classe: "code-header"
369
694
  "HTML"
370
695
  pre
371
- code
372
- "&lt;!DOCTYPE html&gt;\\n&lt;html&gt;\\n &lt;body&gt;\\n &lt;h1&gt;Bonjour&lt;/h1&gt;\\n &lt;p&gt;Le monde&lt;/p&gt;\\n &lt;/body&gt;\\n&lt;/html&gt;"
696
+ code classe: "html-code"
697
+ "html\n body\n h1 Bonjour\n p Le monde"
373
698
 
374
699
  pied classe: "footer"
375
700
  paragraphe
376
- "Créé avec"
701
+ "Cree avec "
377
702
  span classe: "heart"
378
- " "
379
- "par la communauté Ether"
703
+ "♥"
704
+ " par la communaute Ether"
380
705
  paragraphe classe: "copyright"
381
706
  "© 2025 Ether. MIT License."
382
707
 
383
708
  script src: "app.js"
384
709
  `
385
710
 
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
711
  const appContent = `// cible: js
598
712
 
599
- constante annee = nouveau Date().getFullYear()
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
713
+ console.log("Ether v0.3.5 ready!")
615
714
  `
616
715
 
617
716
  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
717
 
619
718
  fs.writeFileSync(path.join(projectDir, 'ether.config.js'), configContent)
620
719
  fs.writeFileSync(path.join(srcDir, 'index.eth'), indexContent)
621
- fs.writeFileSync(path.join(srcDir, 'styles.eth'), stylesContent)
720
+ fs.writeFileSync(path.join(distDir, 'styles.css'), STYLES_CSS)
622
721
  fs.writeFileSync(path.join(srcDir, 'app.eth'), appContent)
623
722
  fs.writeFileSync(path.join(projectDir, 'package.json'), packageContent)
624
723
 
@@ -626,8 +725,8 @@ document.addEventListener "DOMContentLoaded", initialiser
626
725
  console.log('')
627
726
  logInfo('Structure creee:')
628
727
  console.log(' src/index.eth')
629
- console.log(' src/styles.eth')
630
728
  console.log(' src/app.eth')
729
+ console.log(' dist/styles.css')
631
730
  console.log(' public/images/logo.svg')
632
731
  console.log(' public/favicon.svg')
633
732
  console.log(' public/videos/')
package/ether-parser.js CHANGED
@@ -451,6 +451,7 @@ class EtherParser {
451
451
  .replace(/\s+\)/g, ')')
452
452
  .replace(/\s+,/g, ',')
453
453
  .replace(/-\s+/g, '-')
454
+ .replace(/(\d+)\s+(%|px|em|rem|vh|vw|vmin|vmax|fr|s|ms|deg)/gi, '$1$2')
454
455
  .replace(/\s+/g, ' ')
455
456
  .trim()
456
457
  }
@@ -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
- property = this.translateProperty(property)
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') {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ether-code",
3
- "version": "0.3.4",
3
+ "version": "0.3.6",
4
4
  "description": "Ether - Le langage intentionnel",
5
5
  "main": "cli/compiler.js",
6
6
  "bin": {