ether-code 0.3.1 → 0.3.3
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 +1 -1
- package/ether-parser.js +4 -0
- package/generators/css-generator.js +149 -7
- package/package.json +1 -1
package/cli/ether.js
CHANGED
package/ether-parser.js
CHANGED
|
@@ -278,6 +278,8 @@ class EtherParser {
|
|
|
278
278
|
const decl = this.parseCSSDeclaration()
|
|
279
279
|
if (decl) {
|
|
280
280
|
declarations.push(decl)
|
|
281
|
+
} else {
|
|
282
|
+
this.advance()
|
|
281
283
|
}
|
|
282
284
|
}
|
|
283
285
|
|
|
@@ -474,6 +476,8 @@ class EtherParser {
|
|
|
474
476
|
const decl = this.parseCSSDeclaration()
|
|
475
477
|
if (decl) {
|
|
476
478
|
declarations.push(decl)
|
|
479
|
+
} else {
|
|
480
|
+
this.advance()
|
|
477
481
|
}
|
|
478
482
|
}
|
|
479
483
|
|
|
@@ -127,6 +127,140 @@ class CSSGenerator {
|
|
|
127
127
|
|
|
128
128
|
translateGeneric(text) {
|
|
129
129
|
const translations = {
|
|
130
|
+
'couleur-fond': 'background-color',
|
|
131
|
+
'couleur-texte': 'color',
|
|
132
|
+
'couleur-bordure': 'border-color',
|
|
133
|
+
'couleur-primaire': '--color-primary',
|
|
134
|
+
'couleur-secondaire': '--color-secondary',
|
|
135
|
+
'couleur-accent': '--color-accent',
|
|
136
|
+
'couleur-surface': '--color-surface',
|
|
137
|
+
'couleur-texte-pale': '--color-text-muted',
|
|
138
|
+
'famille-police': 'font-family',
|
|
139
|
+
'taille-police': 'font-size',
|
|
140
|
+
'poids-police': 'font-weight',
|
|
141
|
+
'style-police': 'font-style',
|
|
142
|
+
'hauteur-ligne': 'line-height',
|
|
143
|
+
'espacement-lettres': 'letter-spacing',
|
|
144
|
+
'espacement-mots': 'word-spacing',
|
|
145
|
+
'texte-aligne': 'text-align',
|
|
146
|
+
'alignement-texte': 'text-align',
|
|
147
|
+
'decoration-texte': 'text-decoration',
|
|
148
|
+
'transformation-texte': 'text-transform',
|
|
149
|
+
'retrait-texte': 'text-indent',
|
|
150
|
+
'ombre-texte': 'text-shadow',
|
|
151
|
+
'debordement-texte': 'text-overflow',
|
|
152
|
+
'coupure-mot': 'word-break',
|
|
153
|
+
'retour-ligne': 'word-wrap',
|
|
154
|
+
'espace-blanc': 'white-space',
|
|
155
|
+
'marge-haut': 'margin-top',
|
|
156
|
+
'marge-bas': 'margin-bottom',
|
|
157
|
+
'marge-gauche': 'margin-left',
|
|
158
|
+
'marge-droite': 'margin-right',
|
|
159
|
+
'marge-bloc': 'margin-block',
|
|
160
|
+
'marge-en-ligne': 'margin-inline',
|
|
161
|
+
'remplissage-haut': 'padding-top',
|
|
162
|
+
'remplissage-bas': 'padding-bottom',
|
|
163
|
+
'remplissage-gauche': 'padding-left',
|
|
164
|
+
'remplissage-droite': 'padding-right',
|
|
165
|
+
'remplissage-bloc': 'padding-block',
|
|
166
|
+
'remplissage-en-ligne': 'padding-inline',
|
|
167
|
+
'bordure-haut': 'border-top',
|
|
168
|
+
'bordure-bas': 'border-bottom',
|
|
169
|
+
'bordure-gauche': 'border-left',
|
|
170
|
+
'bordure-droite': 'border-right',
|
|
171
|
+
'largeur-bordure': 'border-width',
|
|
172
|
+
'style-bordure': 'border-style',
|
|
173
|
+
'rayon-bordure': 'border-radius',
|
|
174
|
+
'rayon-haut-gauche': 'border-top-left-radius',
|
|
175
|
+
'rayon-haut-droite': 'border-top-right-radius',
|
|
176
|
+
'rayon-bas-gauche': 'border-bottom-left-radius',
|
|
177
|
+
'rayon-bas-droite': 'border-bottom-right-radius',
|
|
178
|
+
'ombre-boite': 'box-shadow',
|
|
179
|
+
'modele-boite': 'box-sizing',
|
|
180
|
+
'max-largeur': 'max-width',
|
|
181
|
+
'min-largeur': 'min-width',
|
|
182
|
+
'max-hauteur': 'max-height',
|
|
183
|
+
'min-hauteur': 'min-height',
|
|
184
|
+
'ajustement-objet': 'object-fit',
|
|
185
|
+
'position-objet': 'object-position',
|
|
186
|
+
'debordement-x': 'overflow-x',
|
|
187
|
+
'debordement-y': 'overflow-y',
|
|
188
|
+
'comportement-defilement': 'scroll-behavior',
|
|
189
|
+
'justifier-contenu': 'justify-content',
|
|
190
|
+
'aligner-elements': 'align-items',
|
|
191
|
+
'aligner-contenu': 'align-content',
|
|
192
|
+
'aligner-soi': 'align-self',
|
|
193
|
+
'justifier-soi': 'justify-self',
|
|
194
|
+
'justifier-elements': 'justify-items',
|
|
195
|
+
'direction-flex': 'flex-direction',
|
|
196
|
+
'enveloppe-flex': 'flex-wrap',
|
|
197
|
+
'flux-flex': 'flex-flow',
|
|
198
|
+
'croissance-flex': 'flex-grow',
|
|
199
|
+
'retrecissement-flex': 'flex-shrink',
|
|
200
|
+
'base-flex': 'flex-basis',
|
|
201
|
+
'ordre': 'order',
|
|
202
|
+
'colonnes-grille': 'grid-template-columns',
|
|
203
|
+
'lignes-grille': 'grid-template-rows',
|
|
204
|
+
'zones-grille': 'grid-template-areas',
|
|
205
|
+
'colonne-grille': 'grid-column',
|
|
206
|
+
'ligne-grille': 'grid-row',
|
|
207
|
+
'zone-grille': 'grid-area',
|
|
208
|
+
'ecart-grille': 'grid-gap',
|
|
209
|
+
'ecart-colonnes': 'column-gap',
|
|
210
|
+
'ecart-lignes': 'row-gap',
|
|
211
|
+
'flux-auto-grille': 'grid-auto-flow',
|
|
212
|
+
'colonnes-auto-grille': 'grid-auto-columns',
|
|
213
|
+
'lignes-auto-grille': 'grid-auto-rows',
|
|
214
|
+
'z-index': 'z-index',
|
|
215
|
+
'index-z': 'z-index',
|
|
216
|
+
'liste-style': 'list-style',
|
|
217
|
+
'type-liste': 'list-style-type',
|
|
218
|
+
'position-liste': 'list-style-position',
|
|
219
|
+
'image-liste': 'list-style-image',
|
|
220
|
+
'duree-transition': 'transition-duration',
|
|
221
|
+
'delai-transition': 'transition-delay',
|
|
222
|
+
'propriete-transition': 'transition-property',
|
|
223
|
+
'fonction-transition': 'transition-timing-function',
|
|
224
|
+
'nom-animation': 'animation-name',
|
|
225
|
+
'duree-animation': 'animation-duration',
|
|
226
|
+
'delai-animation': 'animation-delay',
|
|
227
|
+
'fonction-animation': 'animation-timing-function',
|
|
228
|
+
'iteration-animation': 'animation-iteration-count',
|
|
229
|
+
'direction-animation': 'animation-direction',
|
|
230
|
+
'remplissage-animation': 'animation-fill-mode',
|
|
231
|
+
'etat-animation': 'animation-play-state',
|
|
232
|
+
'origine-transformation': 'transform-origin',
|
|
233
|
+
'style-transformation': 'transform-style',
|
|
234
|
+
'perspective': 'perspective',
|
|
235
|
+
'origine-perspective': 'perspective-origin',
|
|
236
|
+
'face-arriere': 'backface-visibility',
|
|
237
|
+
'flou-fond': 'backdrop-filter',
|
|
238
|
+
'mode-melange': 'mix-blend-mode',
|
|
239
|
+
'mode-melange-fond': 'background-blend-mode',
|
|
240
|
+
'image-fond': 'background-image',
|
|
241
|
+
'position-fond': 'background-position',
|
|
242
|
+
'taille-fond': 'background-size',
|
|
243
|
+
'repetition-fond': 'background-repeat',
|
|
244
|
+
'attachement-fond': 'background-attachment',
|
|
245
|
+
'origine-fond': 'background-origin',
|
|
246
|
+
'decoupe-fond': 'background-clip',
|
|
247
|
+
'selection-utilisateur': 'user-select',
|
|
248
|
+
'evenements-pointeur': 'pointer-events',
|
|
249
|
+
'accrochage-defilement': 'scroll-snap-type',
|
|
250
|
+
'alignement-accrochage': 'scroll-snap-align',
|
|
251
|
+
'redimensionnement': 'resize',
|
|
252
|
+
'apparence': 'appearance',
|
|
253
|
+
'contour': 'outline',
|
|
254
|
+
'largeur-contour': 'outline-width',
|
|
255
|
+
'style-contour': 'outline-style',
|
|
256
|
+
'couleur-contour': 'outline-color',
|
|
257
|
+
'decalage-contour': 'outline-offset',
|
|
258
|
+
'compteur-reset': 'counter-reset',
|
|
259
|
+
'compteur-increment': 'counter-increment',
|
|
260
|
+
'guillemets': 'quotes',
|
|
261
|
+
'coupure-colonne': 'break-inside',
|
|
262
|
+
'orphelins': 'orphans',
|
|
263
|
+
'veuves': 'widows',
|
|
130
264
|
'fond': 'background',
|
|
131
265
|
'couleur': 'color',
|
|
132
266
|
'police': 'font-family',
|
|
@@ -135,7 +269,7 @@ class CSSGenerator {
|
|
|
135
269
|
'style': 'font-style',
|
|
136
270
|
'alignement': 'text-align',
|
|
137
271
|
'decoration': 'text-decoration',
|
|
138
|
-
'transformation': '
|
|
272
|
+
'transformation': 'transform',
|
|
139
273
|
'debordement': 'overflow',
|
|
140
274
|
'largeur': 'width',
|
|
141
275
|
'hauteur': 'height',
|
|
@@ -144,7 +278,6 @@ class CSSGenerator {
|
|
|
144
278
|
'bordure': 'border',
|
|
145
279
|
'arrondi': 'border-radius',
|
|
146
280
|
'ombre': 'box-shadow',
|
|
147
|
-
'ombre texte': 'text-shadow',
|
|
148
281
|
'affichage': 'display',
|
|
149
282
|
'position': 'position',
|
|
150
283
|
'haut': 'top',
|
|
@@ -167,6 +300,7 @@ class CSSGenerator {
|
|
|
167
300
|
'lignes': 'grid-template-rows',
|
|
168
301
|
'zone': 'grid-area',
|
|
169
302
|
'ecart': 'gap',
|
|
303
|
+
'espace': 'gap',
|
|
170
304
|
'direction': 'flex-direction',
|
|
171
305
|
'envelopper': 'flex-wrap',
|
|
172
306
|
'justifier': 'justify-content',
|
|
@@ -221,10 +355,10 @@ class CSSGenerator {
|
|
|
221
355
|
'contenir': 'contain',
|
|
222
356
|
'remplir': 'fill',
|
|
223
357
|
'bloc': 'block',
|
|
224
|
-
'en
|
|
225
|
-
'
|
|
226
|
-
'
|
|
227
|
-
'
|
|
358
|
+
'en-ligne': 'inline',
|
|
359
|
+
'bloc-en-ligne': 'inline-block',
|
|
360
|
+
'flex-en-ligne': 'inline-flex',
|
|
361
|
+
'grille-en-ligne': 'inline-grid'
|
|
228
362
|
}
|
|
229
363
|
|
|
230
364
|
const lower = text.toLowerCase()
|
|
@@ -477,10 +611,18 @@ class CSSGenerator {
|
|
|
477
611
|
query = query.replace(/ecran/gi, 'screen')
|
|
478
612
|
query = query.replace(/imprimante/gi, 'print')
|
|
479
613
|
query = query.replace(/tous/gi, 'all')
|
|
614
|
+
query = query.replace(/largeur-min/gi, 'min-width')
|
|
480
615
|
query = query.replace(/largeur min/gi, 'min-width')
|
|
616
|
+
query = query.replace(/largeur-max/gi, 'max-width')
|
|
481
617
|
query = query.replace(/largeur max/gi, 'max-width')
|
|
618
|
+
query = query.replace(/max-largeur/gi, 'max-width')
|
|
619
|
+
query = query.replace(/min-largeur/gi, 'min-width')
|
|
620
|
+
query = query.replace(/hauteur-min/gi, 'min-height')
|
|
482
621
|
query = query.replace(/hauteur min/gi, 'min-height')
|
|
622
|
+
query = query.replace(/hauteur-max/gi, 'max-height')
|
|
483
623
|
query = query.replace(/hauteur max/gi, 'max-height')
|
|
624
|
+
query = query.replace(/max-hauteur/gi, 'max-height')
|
|
625
|
+
query = query.replace(/min-hauteur/gi, 'min-height')
|
|
484
626
|
query = query.replace(/orientation/gi, 'orientation')
|
|
485
627
|
query = query.replace(/paysage/gi, 'landscape')
|
|
486
628
|
query = query.replace(/portrait/gi, 'portrait')
|
|
@@ -567,4 +709,4 @@ class CSSGenerator {
|
|
|
567
709
|
|
|
568
710
|
module.exports = {
|
|
569
711
|
CSSGenerator
|
|
570
|
-
}
|
|
712
|
+
}
|