aliascss 1.5.4 → 1.5.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/CHANGELOG.md +57 -0
- package/dist/aliascss.js +1 -1
- package/lib/classPrinter.js +26 -1
- package/lib/config.js +2 -2
- package/lib/css-properties-all.js +92 -78
- package/lib/prefix/pseudoSelectorNew.js +5 -1
- package/lib/returnPropertyAndValue.js +3 -3
- package/lib/static/staticClassNamesAlias.js +3 -3
- package/lib/utils/createCompilerObj.d.ts +3 -0
- package/lib/utils/createCompilerObj.js +18 -0
- package/lib/utils/helper.js +7 -3
- package/package.json +2 -1
- package/.prettierrc +0 -5
- package/READMEEdititng.md +0 -615
- package/aliascss.config.bk.js +0 -131
- package/aliascss.config.js +0 -50
- package/custom-compilers.js +0 -61
- package/dashed-ident.patch +0 -216
- package/docc.md +0 -486
- package/docs/PseudoSelector.js +0 -141
- package/docs/colors-tokens.js +0 -3771
- package/docs/mediaSelector.js +0 -49
- package/docs/staticClassNames.js +0 -15731
- package/docs/utilitiesClassName.js +0 -204
- package/jestconfig.json +0 -8
- package/old-custom-compilers.js +0 -149
- package/ts-22.js +0 -2631
- package/ts.js +0 -36
- package/tsconfig.json +0 -16
- package/tsconfig.test.json +0 -10
- package/tslint.json +0 -9
- package/webpack.config.js +0 -11
package/lib/classPrinter.js
CHANGED
|
@@ -12,7 +12,7 @@ export let classPrinter = {
|
|
|
12
12
|
flushQueued: false,
|
|
13
13
|
styleTagExists: false,
|
|
14
14
|
customCheck: false,
|
|
15
|
-
useColon:
|
|
15
|
+
useColon: false,
|
|
16
16
|
cls: {},
|
|
17
17
|
kfs: {},
|
|
18
18
|
kfNames: {},
|
|
@@ -262,6 +262,14 @@ export let classPrinter = {
|
|
|
262
262
|
const result = this.compileElement(e, classList);
|
|
263
263
|
statement += result ? result : '';
|
|
264
264
|
});
|
|
265
|
+
const groupAttr = this.useColon ? /^class[-_:]/ : /^class[-_]/;
|
|
266
|
+
const groupOnly = (e) => !e.hasAttribute('class') && [...e.attributes].some((a) => groupAttr.test(a.name));
|
|
267
|
+
const all = [...$el.querySelectorAll('*')];
|
|
268
|
+
$el.querySelectorAll('template').forEach((t) => all.push(...t.content.querySelectorAll('*')));
|
|
269
|
+
all.filter(groupOnly).forEach((e) => {
|
|
270
|
+
const result = this.compileElement(e, classList);
|
|
271
|
+
statement += result ? result : '';
|
|
272
|
+
});
|
|
265
273
|
return statement;
|
|
266
274
|
},
|
|
267
275
|
run(el) {
|
|
@@ -281,13 +289,30 @@ export let classPrinter = {
|
|
|
281
289
|
const kfRoot = (el || document.body);
|
|
282
290
|
const kfNodes = [kfRoot, ...kfRoot.querySelectorAll('*')];
|
|
283
291
|
kfRoot.querySelectorAll('template').forEach((t) => kfNodes.push(...t.content.querySelectorAll('*')));
|
|
292
|
+
// kfNodes.forEach((node) => {
|
|
293
|
+
// for (const attr of node.attributes) {
|
|
294
|
+
// const m = attr.name.match(/^keyframes[-_:](.+)$/i);
|
|
295
|
+
// if (m) this.kfNames[m[1].toLowerCase()] = m[1];
|
|
296
|
+
// }
|
|
297
|
+
// });
|
|
298
|
+
// Elements with only a group attribute (class-card="…") aren't matched by [class],
|
|
299
|
+
// so they're collected here, in the loop that already reads every attribute.
|
|
300
|
+
const groupAttr = this.useColon ? /^class[-_:]/ : /^class[-_]/;
|
|
301
|
+
const groupOnly = [];
|
|
284
302
|
kfNodes.forEach((node) => {
|
|
303
|
+
let hasGroup = false;
|
|
285
304
|
for (const attr of node.attributes) {
|
|
286
305
|
const m = attr.name.match(/^keyframes[-_:](.+)$/i);
|
|
287
306
|
if (m)
|
|
288
307
|
this.kfNames[m[1].toLowerCase()] = m[1];
|
|
308
|
+
if (groupAttr.test(attr.name))
|
|
309
|
+
hasGroup = true;
|
|
289
310
|
}
|
|
311
|
+
// Elements with class are printed by the [class] pass below
|
|
312
|
+
if (hasGroup && !node.hasAttribute('class'))
|
|
313
|
+
groupOnly.push(node);
|
|
290
314
|
});
|
|
315
|
+
groupOnly.forEach((node) => this.print(node));
|
|
291
316
|
// <template> element
|
|
292
317
|
Array.prototype.forEach.call($root.querySelectorAll('template'), (template) => {
|
|
293
318
|
// Array.prototype.forEach.call(template.content.querySelectorAll('[class],[acss-class]'), (e) => {
|
package/lib/config.js
CHANGED
|
@@ -9,8 +9,8 @@ const config = {
|
|
|
9
9
|
useCSSModule: false,
|
|
10
10
|
matchCSSModuleFunction: new RegExp('(?:' + 'x|@' + ')' + "[\\s*]?(`|\\([" + `"'])` + "([^)`]+)" + "(`|" + `["']` + "\\))"),
|
|
11
11
|
// matchRegExp:/(?:(class|className|class[-_][\w-\[\]=_]+))=[\s*]?(?:["']\W+\s*(?:\w+)\()?["']([^'"]+)['"]/,
|
|
12
|
-
matchRegExp: /(?:(class|className|class[-_][\w-\[\]=_&:\(\)
|
|
13
|
-
matchRegExpWithColon: /(?:(class|className|class[-_:][\w-\[\]=_&:\(\)
|
|
12
|
+
matchRegExp: /(?:(class|className|class[-_][\w-\[\]=_&:\(\)\~\*\$\^\|@]+))=[\s*]?(?:["']\W+\s*(?:\w+)\()?["']([^'"]+)['"]/,
|
|
13
|
+
matchRegExpWithColon: /(?:(class|className|class[-_:][\w-\[\]=_&:\(\)\~\*\$\^\|@]+))=[\s*]?(?:["']\W+\s*(?:\w+)\()?["']([^'"]+)['"]/,
|
|
14
14
|
matchRegExpKeyFrame: /[\s](?:(keyframes[-_][\w-]+))=[\s*]?(?:["']\W+\s*(?:\w+)\()?["']([^'"]+)['"]/,
|
|
15
15
|
matchRegExpWithColonKeyFrame: /[\s](?:(keyframes[-_:][\w-]+))=[\s*]?(?:["']\W+\s*(?:\w+)\()?["']([^'"]+)['"]/,
|
|
16
16
|
createExtractorRegex: (fname) => new RegExp('(?:' + fname + ')' + "[\\s*]?(`|\\([" + `"'])` + "([^'`" + '"]+)' + "(`|" + `["']` + "\\))"),
|
|
@@ -25,6 +25,13 @@ const gridBy = (value) => value
|
|
|
25
25
|
.replace(/-by-/g, " / ")
|
|
26
26
|
.replace(/[-]?(span|[-]?[\d]+)[-]?/g, ' $1 ')
|
|
27
27
|
.replace(/[-]?Minus[\s]*/g, '-');
|
|
28
|
+
const positionOffset = (value) => value
|
|
29
|
+
.replace(/^-/, '') // the separator dash
|
|
30
|
+
.replace(/__/g, ',') // layers
|
|
31
|
+
.replace(/(?<=[^-,])-/g, ' ') // a dash after a value is a space; a dash after a dash or comma is a minus
|
|
32
|
+
.replace(/(\d)d(\d)/g, '$1.$2') // 0d5 → 0.5
|
|
33
|
+
.replace(/(\d)p(?=[\s,]|$)/g, '$1%') // 50p → 50%
|
|
34
|
+
.replace(/,/g, ', ').replace(/\b([xy]) (start|end)\b/g, '$1-$2'); // keep x-start, y-end… whole
|
|
28
35
|
const cssProps = {
|
|
29
36
|
// type:s=static,d=dynamic
|
|
30
37
|
// -----------------xc----------------
|
|
@@ -291,19 +298,19 @@ const cssProps = {
|
|
|
291
298
|
alias: 'bgp',
|
|
292
299
|
type: 'd',
|
|
293
300
|
// compiler:length,
|
|
294
|
-
compiler: (value)
|
|
301
|
+
compiler: positionOffset, // (value)=>value.replace(/-/g,' ').replace(/(\d)d(\d)/g,'$1.$2').replace(/__/g,', ').replace(/([\d])p([\s,])/g,"$1%$2 ").replace(/([\d])p$/,"$1%"),
|
|
295
302
|
values: ['bottom:b', 'bottom center:bc', 'bottom left:bl', 'bottom right:br', 'center:c', 'center bottom:cb', 'center center:cc', 'center top:ct', 'left:l', 'left bottom:lb', 'left center:lc', 'left top:lt', 'right:r', 'right bottom:rb', 'right center:rc', 'right top:rt', 'top:t', 'top center:tc', 'top left:tl', 'top right:tr'],
|
|
296
303
|
},
|
|
297
304
|
'background-position-x': {
|
|
298
305
|
// alias:'bgpx', // 1.5.4 drop: rarely used (0 uses) and doesn't follow the first-letter rule (bpx)
|
|
299
306
|
type: 'd',
|
|
300
|
-
compiler: (value)
|
|
307
|
+
compiler: positionOffset, // (value)=>value.replace(/-/g,' ').replace(/(\d)d(\d)/g,'$1.$2').replace(/__/g,', ').replace(/([\d])p([\s,])/g,"$1%$2 ").replace(/([\d])p$/,"$1%"),
|
|
301
308
|
values: ['right:r', 'left:l', 'center:c'],
|
|
302
309
|
},
|
|
303
310
|
'background-position-y': {
|
|
304
311
|
// alias:'bgpy', // 1.5.4 drop: rarely used (0 uses) and doesn't follow the first-letter rule (bpy)
|
|
305
312
|
type: 'd',
|
|
306
|
-
compiler: (value)
|
|
313
|
+
compiler: positionOffset, // (value)=>value.replace(/-/g,' ').replace(/(\d)d(\d)/g,'$1.$2').replace(/__/g,', ').replace(/([\d])p([\s,])/g,"$1%$2 ").replace(/([\d])p$/,"$1%"),
|
|
307
314
|
values: ['top:t', 'center:c', 'bottom:b'],
|
|
308
315
|
},
|
|
309
316
|
'background-repeat': {
|
|
@@ -332,12 +339,12 @@ const cssProps = {
|
|
|
332
339
|
values: ['auto:a', 'contain:c', 'cover:co'],
|
|
333
340
|
},
|
|
334
341
|
// 'bleed':{},
|
|
335
|
-
'block-overflow':
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
},
|
|
342
|
+
// 'block-overflow':{
|
|
343
|
+
// alias:'',
|
|
344
|
+
// type:'d',
|
|
345
|
+
// compiler:(value:string)=>value.replace(/^-/,''),
|
|
346
|
+
// values:['clip:c','ellipsis:e']
|
|
347
|
+
// },
|
|
341
348
|
'block-size': {
|
|
342
349
|
alias: '', // border-spacing-bs
|
|
343
350
|
type: 'd',
|
|
@@ -354,7 +361,7 @@ const cssProps = {
|
|
|
354
361
|
alias: '',
|
|
355
362
|
type: 'd',
|
|
356
363
|
compiler: border,
|
|
357
|
-
values: [''],
|
|
364
|
+
values: ['none:n', '0'],
|
|
358
365
|
},
|
|
359
366
|
'border-block-color': {
|
|
360
367
|
alias: '',
|
|
@@ -414,7 +421,7 @@ const cssProps = {
|
|
|
414
421
|
alias: 'bb',
|
|
415
422
|
type: 'd',
|
|
416
423
|
compiler: border,
|
|
417
|
-
values: [''],
|
|
424
|
+
values: ['none:n', '0'],
|
|
418
425
|
},
|
|
419
426
|
'border-bottom-color': {
|
|
420
427
|
alias: 'bbc',
|
|
@@ -446,11 +453,11 @@ const cssProps = {
|
|
|
446
453
|
compiler: length,
|
|
447
454
|
values: width,
|
|
448
455
|
},
|
|
449
|
-
'border-boundary':
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
},
|
|
456
|
+
// 'border-boundary':{
|
|
457
|
+
// alias:'',
|
|
458
|
+
// type:'s',
|
|
459
|
+
// 'values':['none:n','parent:p','display:d']
|
|
460
|
+
// },
|
|
454
461
|
'border-collapse': {
|
|
455
462
|
alias: '',
|
|
456
463
|
type: 's',
|
|
@@ -535,7 +542,7 @@ const cssProps = {
|
|
|
535
542
|
// alias:'bi', // 1.5.4 drop: rarely used (0 uses); a 2-letter alias takes a common name prefix
|
|
536
543
|
type: 'd',
|
|
537
544
|
compiler: border,
|
|
538
|
-
values: [''],
|
|
545
|
+
values: ['none:n', '0'],
|
|
539
546
|
},
|
|
540
547
|
'border-inline-color': {
|
|
541
548
|
alias: 'bic',
|
|
@@ -595,7 +602,7 @@ const cssProps = {
|
|
|
595
602
|
alias: 'bl',
|
|
596
603
|
type: 'd',
|
|
597
604
|
compiler: border,
|
|
598
|
-
values: [''],
|
|
605
|
+
values: ['none:n', '0'],
|
|
599
606
|
},
|
|
600
607
|
'border-left-color': {
|
|
601
608
|
alias: 'blc',
|
|
@@ -625,7 +632,7 @@ const cssProps = {
|
|
|
625
632
|
alias: 'brt',
|
|
626
633
|
type: 'd',
|
|
627
634
|
compiler: border,
|
|
628
|
-
values: [''],
|
|
635
|
+
values: ['none:n', '0'],
|
|
629
636
|
},
|
|
630
637
|
'border-right-color': {
|
|
631
638
|
alias: 'brc',
|
|
@@ -673,7 +680,7 @@ const cssProps = {
|
|
|
673
680
|
alias: 'bt',
|
|
674
681
|
type: 'd',
|
|
675
682
|
compiler: border,
|
|
676
|
-
values: [''],
|
|
683
|
+
values: ['none:n', '0'],
|
|
677
684
|
},
|
|
678
685
|
'border-top-color': {
|
|
679
686
|
alias: 'btc',
|
|
@@ -724,6 +731,13 @@ const cssProps = {
|
|
|
724
731
|
values: ['slice:s', 'clone:c'],
|
|
725
732
|
},
|
|
726
733
|
'box-reflect': {
|
|
734
|
+
// alias:'bxr', // 1.5.4 drop: rarely used (0 uses) and doesn't follow the first-letter rule (br)
|
|
735
|
+
property: '-webkit-box-reflect',
|
|
736
|
+
type: 'd',
|
|
737
|
+
compiler: length,
|
|
738
|
+
values: ['none:n', 'below:b', 'above:a', 'left:l', 'right:r'],
|
|
739
|
+
},
|
|
740
|
+
'-webkit-box-reflect': {
|
|
727
741
|
// alias:'bxr', // 1.5.4 drop: rarely used (0 uses) and doesn't follow the first-letter rule (br)
|
|
728
742
|
type: 'd',
|
|
729
743
|
compiler: length,
|
|
@@ -750,14 +764,14 @@ const cssProps = {
|
|
|
750
764
|
'break-before': {
|
|
751
765
|
alias: '',
|
|
752
766
|
type: 's',
|
|
753
|
-
// compiler:'',
|
|
767
|
+
// compiler:'', auto, avoid, avoid-page, avoid-column, avoid-region
|
|
754
768
|
values: ['auto:au', 'all', 'always:al', 'avoid:av', 'avoid-column:ac', 'avoid-page:ap', 'avoid-region:ar', 'column:c', 'left:l', 'page:p', 'recto:rec', 'region:reg', 'right:r', 'verso:v'],
|
|
755
769
|
},
|
|
756
770
|
'break-inside': {
|
|
757
771
|
alias: '', // ----
|
|
758
772
|
type: 's',
|
|
759
773
|
// compiler:'',
|
|
760
|
-
values: ['auto:au', '
|
|
774
|
+
values: ['auto:au', 'avoid:av', 'avoid-column:ac', 'avoid-page:ap', 'avoid-region:ar'],
|
|
761
775
|
},
|
|
762
776
|
// ----------C--------
|
|
763
777
|
'caption-side': {
|
|
@@ -824,13 +838,13 @@ const cssProps = {
|
|
|
824
838
|
alias: 'cg',
|
|
825
839
|
type: 'd',
|
|
826
840
|
compiler: length,
|
|
827
|
-
values: ['normal:n', ...remUnits],
|
|
841
|
+
values: ['normal:nl:n', ...remUnits],
|
|
828
842
|
},
|
|
829
843
|
'column-rule': {
|
|
830
844
|
// alias:'cr', // 1.5.4 drop: rarely used (0 uses); a 2-letter alias takes a common name prefix (it turned cr-card into CSS)
|
|
831
845
|
type: 'd',
|
|
832
846
|
compiler: border,
|
|
833
|
-
values: [''],
|
|
847
|
+
values: ['none:n', '0'],
|
|
834
848
|
},
|
|
835
849
|
'column-rule-color': {
|
|
836
850
|
alias: 'crc',
|
|
@@ -878,30 +892,30 @@ const cssProps = {
|
|
|
878
892
|
alias: '',
|
|
879
893
|
type: 'd',
|
|
880
894
|
compiler: length,
|
|
881
|
-
values: ['none:n'
|
|
895
|
+
values: ['none:n']
|
|
882
896
|
},
|
|
883
897
|
'contain-intrinsic-height': {
|
|
884
898
|
alias: '',
|
|
885
899
|
type: 'd',
|
|
886
900
|
compiler: length,
|
|
887
|
-
values: ['none:n'
|
|
901
|
+
values: ['none:n']
|
|
888
902
|
},
|
|
889
903
|
'contain-intrinsic-inline-size': {
|
|
890
904
|
alias: '',
|
|
891
905
|
type: 'd',
|
|
892
906
|
compiler: length,
|
|
893
|
-
values: ['none:n'
|
|
907
|
+
values: ['none:n']
|
|
894
908
|
},
|
|
895
909
|
'contain-intrinsic-size': {
|
|
896
910
|
alias: '',
|
|
897
911
|
type: 'd',
|
|
898
912
|
compiler: length,
|
|
899
|
-
values: ['none:n'
|
|
913
|
+
values: ['none:n']
|
|
900
914
|
}, 'contain-intrinsic-width': {
|
|
901
915
|
alias: '',
|
|
902
916
|
type: 'd',
|
|
903
917
|
compiler: length,
|
|
904
|
-
values: ['none:n'
|
|
918
|
+
values: ['none:n']
|
|
905
919
|
},
|
|
906
920
|
'container': {
|
|
907
921
|
alias: '',
|
|
@@ -971,7 +985,7 @@ const cssProps = {
|
|
|
971
985
|
alias: 'd',
|
|
972
986
|
type: 's',
|
|
973
987
|
// compiler:'',
|
|
974
|
-
values: ['-webkit-box:webkit-box:wb:box', 'block:b', '
|
|
988
|
+
values: ['-webkit-box:webkit-box:wb:box', 'block:b', 'contents:cont', 'flex:f', 'grid:g', 'inline:i', 'inline-block:ib',
|
|
975
989
|
'inline-flex:if', 'inline-grid:ig', 'inline-table:it',
|
|
976
990
|
'list-item:li', 'none:n', 'run-in:ri', 'table:t', 'table-caption:tcap', 'table-cell:tcl', 'table-column:tc',
|
|
977
991
|
'table-column-group:tcg', 'table-footer-group:tfg', 'table-header-group:thg', 'table-row:tr', 'table-row-group:trg'],
|
|
@@ -1072,7 +1086,7 @@ const cssProps = {
|
|
|
1072
1086
|
alias: 'flo',
|
|
1073
1087
|
type: 'd',
|
|
1074
1088
|
compiler: (value) => value.replace(/(\w+)/, '"$1"'),
|
|
1075
|
-
values: ['normal
|
|
1089
|
+
values: ['normal:nl'],
|
|
1076
1090
|
},
|
|
1077
1091
|
'font-size': {
|
|
1078
1092
|
alias: 'fs',
|
|
@@ -1180,7 +1194,7 @@ const cssProps = {
|
|
|
1180
1194
|
alias: 'g',
|
|
1181
1195
|
type: 'd',
|
|
1182
1196
|
compiler: length,
|
|
1183
|
-
values: ['
|
|
1197
|
+
values: ['normal:nl:n', ...remUnits],
|
|
1184
1198
|
},
|
|
1185
1199
|
'grid': {
|
|
1186
1200
|
// alias:'gd', // 1.5.4 drop: rarely used (0 uses); a 2-letter alias takes a common name prefix
|
|
@@ -1260,7 +1274,7 @@ const cssProps = {
|
|
|
1260
1274
|
alias: 'gcg',
|
|
1261
1275
|
type: 'd',
|
|
1262
1276
|
compiler: length,
|
|
1263
|
-
values: ['
|
|
1277
|
+
values: ['normal:nl:n', ...remUnits],
|
|
1264
1278
|
},
|
|
1265
1279
|
'grid-column-start': {
|
|
1266
1280
|
alias: 'gcs',
|
|
@@ -1273,7 +1287,7 @@ const cssProps = {
|
|
|
1273
1287
|
// alias:'gg', // 1.5.4 drop: rarely used (0 uses); a 2-letter alias takes a common name prefix
|
|
1274
1288
|
type: 'd',
|
|
1275
1289
|
compiler: lenByNumPer,
|
|
1276
|
-
values: ['
|
|
1290
|
+
values: ['normal:nl:n', ...remUnits],
|
|
1277
1291
|
},
|
|
1278
1292
|
'grid-row': {
|
|
1279
1293
|
alias: 'gr',
|
|
@@ -1293,7 +1307,7 @@ const cssProps = {
|
|
|
1293
1307
|
alias: 'grg',
|
|
1294
1308
|
type: 'd',
|
|
1295
1309
|
compiler: length,
|
|
1296
|
-
values: ['
|
|
1310
|
+
values: ['normal:nl:n', ...remUnits],
|
|
1297
1311
|
},
|
|
1298
1312
|
'grid-row-start': {
|
|
1299
1313
|
alias: 'grs',
|
|
@@ -1389,16 +1403,16 @@ const cssProps = {
|
|
|
1389
1403
|
compiler: length,
|
|
1390
1404
|
values: ['auto:a'],
|
|
1391
1405
|
},
|
|
1392
|
-
'inset-area':
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
},
|
|
1406
|
+
// 'inset-area':{
|
|
1407
|
+
// // alias:'ia', // 1.5.4 drop: rarely used (0 uses); a 2-letter alias takes a common name prefix
|
|
1408
|
+
// values:['none:n','top left:top-left:tl','start end:start-end:se','block-start center:block-start-center:bsc',
|
|
1409
|
+
// 'inline-start block-end:inline-start-block-end:isbe','x-start y-end:x-start-y-end:xsye',
|
|
1410
|
+
// 'center y-self-end:center-y-self-end:cye','top span-left:top-span-left:tsl',
|
|
1411
|
+
// 'center span-start:center-span-start:css','inline-start span-block-end:inline-start-span-block-end:issbe',
|
|
1412
|
+
// 'y-start span-x-end:y-start-span-x-end:yssxe','top span-all:top-span-all:tsa','block-end span-all:block-end-span-all:besa',
|
|
1413
|
+
// 'x-self-start span-all:x-self-start-span-all:xsssa','top:t', 'inline-start:is', 'center:c', 'span-all:sa','end:e'
|
|
1414
|
+
// ],
|
|
1415
|
+
// },
|
|
1402
1416
|
'inset-block': {
|
|
1403
1417
|
// alias:'ib', // 1.5.4 drop: rarely used (0 uses); a 2-letter alias takes a common name prefix
|
|
1404
1418
|
type: 'd',
|
|
@@ -1454,7 +1468,7 @@ const cssProps = {
|
|
|
1454
1468
|
// compiler:'',
|
|
1455
1469
|
values: ['legacy:le:l2', 'stretch:st:s2', 'start:s', 'left:l', 'center:c', 'end:e', 'right:r', 'flex-start:fs', 'flex-end:fe',
|
|
1456
1470
|
'normal:nl', 'baseline:b', 'first baseline:first-baseline:fb', 'last baseline:last-baseline:lb', 'self-start:ss', 'self-end:se',
|
|
1457
|
-
'
|
|
1471
|
+
'safe center:safe-center:sc', 'unsafe center:unsafe-center:uc', 'legacy right:legacy-right:lr',
|
|
1458
1472
|
'legacy left:legacy-left:ll', 'legacy center:legacy-center:lc'],
|
|
1459
1473
|
},
|
|
1460
1474
|
'justify-self': {
|
|
@@ -1656,7 +1670,7 @@ const cssProps = {
|
|
|
1656
1670
|
'mask-position': {
|
|
1657
1671
|
alias: '',
|
|
1658
1672
|
type: 'd',
|
|
1659
|
-
compiler: length,
|
|
1673
|
+
compiler: positionOffset, // length,
|
|
1660
1674
|
values: ['top:t', 'right:r', 'bottom:b', 'left:l', 'center:c'],
|
|
1661
1675
|
},
|
|
1662
1676
|
'mask-repeat': {
|
|
@@ -1723,25 +1737,25 @@ const cssProps = {
|
|
|
1723
1737
|
alias: '',
|
|
1724
1738
|
type: 'd',
|
|
1725
1739
|
compiler: length,
|
|
1726
|
-
values: ['max-content:xc', 'min-content:mc'
|
|
1740
|
+
values: ['max-content:xc', 'min-content:mc'],
|
|
1727
1741
|
},
|
|
1728
1742
|
'min-inline-size': {
|
|
1729
1743
|
alias: '',
|
|
1730
1744
|
type: 'd',
|
|
1731
1745
|
compiler: length,
|
|
1732
|
-
values: ['max-content:xc', 'min-content:mc'
|
|
1746
|
+
values: ['max-content:xc', 'min-content:mc'],
|
|
1733
1747
|
},
|
|
1734
1748
|
'min-height': {
|
|
1735
1749
|
alias: 'mh',
|
|
1736
1750
|
type: 'd',
|
|
1737
1751
|
compiler: length,
|
|
1738
|
-
values: ['max-content:xc', 'min-content:mc', '
|
|
1752
|
+
values: ['max-content:xc', 'min-content:mc', 'fit-content:fc'],
|
|
1739
1753
|
},
|
|
1740
1754
|
'min-width': {
|
|
1741
1755
|
alias: 'mw',
|
|
1742
1756
|
type: 'd',
|
|
1743
1757
|
compiler: length,
|
|
1744
|
-
values: ['max-content:xc', 'min-content:mc', '
|
|
1758
|
+
values: ['max-content:xc', 'min-content:mc', 'fit-content:fc'],
|
|
1745
1759
|
},
|
|
1746
1760
|
'mix-blend-mode': {
|
|
1747
1761
|
alias: 'mbm',
|
|
@@ -1759,7 +1773,7 @@ const cssProps = {
|
|
|
1759
1773
|
'object-position': {
|
|
1760
1774
|
alias: '',
|
|
1761
1775
|
type: 'd',
|
|
1762
|
-
compiler: length,
|
|
1776
|
+
compiler: positionOffset, // length,
|
|
1763
1777
|
values: ['top:t', 'left:l', 'center:c', 'bottom:b', 'right:r'],
|
|
1764
1778
|
},
|
|
1765
1779
|
// 'offset':{// --
|
|
@@ -1789,7 +1803,7 @@ const cssProps = {
|
|
|
1789
1803
|
'offset-position': {
|
|
1790
1804
|
// alias:'ofpos', // 1.5.4 drop: rarely used (0 uses) and doesn't follow the first-letter rule (op)
|
|
1791
1805
|
type: 'd',
|
|
1792
|
-
compiler: length,
|
|
1806
|
+
compiler: positionOffset, // length,
|
|
1793
1807
|
values: [''],
|
|
1794
1808
|
},
|
|
1795
1809
|
'offset-rotate': {
|
|
@@ -1820,7 +1834,7 @@ const cssProps = {
|
|
|
1820
1834
|
alias: 'ol',
|
|
1821
1835
|
type: 's',
|
|
1822
1836
|
compiler: border,
|
|
1823
|
-
values: ['none:n', 'auto:a'],
|
|
1837
|
+
values: ['none:n', '0', 'auto:a'],
|
|
1824
1838
|
},
|
|
1825
1839
|
'outline-color': {
|
|
1826
1840
|
alias: 'olc',
|
|
@@ -1838,7 +1852,7 @@ const cssProps = {
|
|
|
1838
1852
|
alias: 'ols',
|
|
1839
1853
|
type: 's',
|
|
1840
1854
|
// compiler:'',
|
|
1841
|
-
values:
|
|
1855
|
+
values: ['dotted:d', 'dashed:da', 'solid:s', 'double:db', 'groove:g', 'ridge:ri', 'inset:i', 'outset:o', 'none:n'],
|
|
1842
1856
|
},
|
|
1843
1857
|
'outline-width': {
|
|
1844
1858
|
alias: 'olw',
|
|
@@ -2115,7 +2129,7 @@ const cssProps = {
|
|
|
2115
2129
|
alias: 'rg',
|
|
2116
2130
|
type: 'd',
|
|
2117
2131
|
compiler: length,
|
|
2118
|
-
values: ['
|
|
2132
|
+
values: ['normal:nl:n', ...remUnits],
|
|
2119
2133
|
},
|
|
2120
2134
|
// ----------S--------
|
|
2121
2135
|
'scale': {
|
|
@@ -2200,67 +2214,67 @@ const cssProps = {
|
|
|
2200
2214
|
// alias:'sp', // 1.5.4 drop: rarely used (0 uses); a 2-letter alias takes a common name prefix
|
|
2201
2215
|
type: 'd',
|
|
2202
2216
|
compiler: length,
|
|
2203
|
-
values: ['
|
|
2217
|
+
values: ['auto:a', ...remUnits],
|
|
2204
2218
|
},
|
|
2205
2219
|
'scroll-padding-block': {
|
|
2206
2220
|
alias: '',
|
|
2207
2221
|
type: 'd',
|
|
2208
2222
|
compiler: length,
|
|
2209
|
-
values: ['
|
|
2223
|
+
values: ['auto:a', ...remUnits],
|
|
2210
2224
|
},
|
|
2211
2225
|
'scroll-padding-block-end': {
|
|
2212
2226
|
alias: 'spbe',
|
|
2213
2227
|
type: 'd',
|
|
2214
2228
|
compiler: length,
|
|
2215
|
-
values: ['
|
|
2229
|
+
values: ['auto:a', ...remUnits],
|
|
2216
2230
|
},
|
|
2217
2231
|
'scroll-padding-block-start': {
|
|
2218
2232
|
alias: 'spbs',
|
|
2219
2233
|
type: 'd',
|
|
2220
2234
|
compiler: length,
|
|
2221
|
-
values: ['
|
|
2235
|
+
values: ['auto:a', ...remUnits],
|
|
2222
2236
|
},
|
|
2223
2237
|
'scroll-padding-bottom': {
|
|
2224
2238
|
alias: 'spb',
|
|
2225
2239
|
type: 'd',
|
|
2226
2240
|
compiler: length,
|
|
2227
|
-
values: ['
|
|
2241
|
+
values: ['auto:a', ...remUnits],
|
|
2228
2242
|
},
|
|
2229
2243
|
'scroll-padding-inline': {
|
|
2230
2244
|
alias: 'spi',
|
|
2231
2245
|
type: 'd',
|
|
2232
2246
|
compiler: length,
|
|
2233
|
-
values: ['
|
|
2247
|
+
values: ['auto:a', ...remUnits],
|
|
2234
2248
|
},
|
|
2235
2249
|
'scroll-padding-inline-end': {
|
|
2236
2250
|
alias: 'spie',
|
|
2237
2251
|
type: 'd',
|
|
2238
2252
|
compiler: length,
|
|
2239
|
-
values: ['
|
|
2253
|
+
values: ['auto:a', ...remUnits],
|
|
2240
2254
|
},
|
|
2241
2255
|
'scroll-padding-inline-start': {
|
|
2242
2256
|
alias: 'spis',
|
|
2243
2257
|
type: 'd',
|
|
2244
2258
|
compiler: length,
|
|
2245
|
-
values: ['
|
|
2259
|
+
values: ['auto:a', ...remUnits],
|
|
2246
2260
|
},
|
|
2247
2261
|
'scroll-padding-left': {
|
|
2248
2262
|
alias: 'spl',
|
|
2249
2263
|
type: 'd',
|
|
2250
2264
|
compiler: length,
|
|
2251
|
-
values: ['
|
|
2265
|
+
values: ['auto:a', ...remUnits],
|
|
2252
2266
|
},
|
|
2253
2267
|
'scroll-padding-right': {
|
|
2254
2268
|
alias: 'spr',
|
|
2255
2269
|
type: 'd',
|
|
2256
2270
|
compiler: length,
|
|
2257
|
-
values: ['
|
|
2271
|
+
values: ['auto:a', ...remUnits],
|
|
2258
2272
|
},
|
|
2259
2273
|
'scroll-padding-top': {
|
|
2260
2274
|
alias: 'spt',
|
|
2261
2275
|
type: 'd',
|
|
2262
2276
|
compiler: length,
|
|
2263
|
-
values: ['
|
|
2277
|
+
values: ['auto:a', ...remUnits],
|
|
2264
2278
|
},
|
|
2265
2279
|
'scroll-snap-align': {
|
|
2266
2280
|
alias: 'ssa',
|
|
@@ -2291,7 +2305,7 @@ const cssProps = {
|
|
|
2291
2305
|
'scroll-timeline-axis': {
|
|
2292
2306
|
'alias': 'sta',
|
|
2293
2307
|
// compiler:'',
|
|
2294
|
-
values: ['
|
|
2308
|
+
values: ['block:b', 'inline:i', 'y', 'x']
|
|
2295
2309
|
},
|
|
2296
2310
|
'scroll-timeline-name': {
|
|
2297
2311
|
'alias': 'stn',
|
|
@@ -2363,7 +2377,7 @@ const cssProps = {
|
|
|
2363
2377
|
alias: 'ta',
|
|
2364
2378
|
type: 's',
|
|
2365
2379
|
// compiler:'',
|
|
2366
|
-
values: ['
|
|
2380
|
+
values: ['left:l', 'right:r', 'center:c', 'justify:j', 'end:e', 'start:s'],
|
|
2367
2381
|
},
|
|
2368
2382
|
'text-align-last': {
|
|
2369
2383
|
alias: 'tal',
|
|
@@ -2387,7 +2401,7 @@ const cssProps = {
|
|
|
2387
2401
|
alias: 'td',
|
|
2388
2402
|
type: 's',
|
|
2389
2403
|
// compiler:'',
|
|
2390
|
-
values: [
|
|
2404
|
+
values: ['none:n', 'dotted:d', 'dashed:da', 'solid:s', 'double:db', 'wavy:w', 'underline:u', 'overline:ol:o2', 'line-through:lt'],
|
|
2391
2405
|
},
|
|
2392
2406
|
'text-decoration-color': {
|
|
2393
2407
|
alias: 'tdc',
|
|
@@ -2405,7 +2419,7 @@ const cssProps = {
|
|
|
2405
2419
|
alias: 'tds',
|
|
2406
2420
|
type: '',
|
|
2407
2421
|
// compiler:'',
|
|
2408
|
-
values: [
|
|
2422
|
+
values: ['dotted:d', 'dashed:da', 'solid:s', 'double:db', 'wavy:w'],
|
|
2409
2423
|
},
|
|
2410
2424
|
'text-decoration-thickness': {
|
|
2411
2425
|
alias: 'tdt',
|
|
@@ -2709,7 +2723,7 @@ const cssProps = {
|
|
|
2709
2723
|
// alias:'zo', // 1.5.4 drop: rarely used (0 uses); a 2-letter alias takes a common name prefix
|
|
2710
2724
|
type: 'd',
|
|
2711
2725
|
compiler: length,
|
|
2712
|
-
values: ['
|
|
2726
|
+
values: ['normal:nl']
|
|
2713
2727
|
},
|
|
2714
2728
|
// ----------------SVG-----------------------------
|
|
2715
2729
|
// 'alignment-baseline':{
|
|
@@ -2946,25 +2960,25 @@ const cssProps = {
|
|
|
2946
2960
|
alias: '',
|
|
2947
2961
|
type: 'd',
|
|
2948
2962
|
compiler: border,
|
|
2949
|
-
values: ['none:n'],
|
|
2963
|
+
values: ['none:n', '0'],
|
|
2950
2964
|
},
|
|
2951
2965
|
'border-block-end': {
|
|
2952
2966
|
alias: '',
|
|
2953
2967
|
type: 'd',
|
|
2954
2968
|
compiler: border,
|
|
2955
|
-
values: ['none:n'],
|
|
2969
|
+
values: ['none:n', '0'],
|
|
2956
2970
|
},
|
|
2957
2971
|
'border-inline-start': {
|
|
2958
2972
|
alias: '',
|
|
2959
2973
|
type: 'd',
|
|
2960
2974
|
compiler: border,
|
|
2961
|
-
values: ['none:n'],
|
|
2975
|
+
values: ['none:n', '0'],
|
|
2962
2976
|
},
|
|
2963
2977
|
'border-inline-end': {
|
|
2964
2978
|
alias: '',
|
|
2965
2979
|
type: 'd',
|
|
2966
2980
|
compiler: border,
|
|
2967
|
-
values: ['none:n'],
|
|
2981
|
+
values: ['none:n', '0'],
|
|
2968
2982
|
},
|
|
2969
2983
|
// ---------- Overflow (logical) ----------
|
|
2970
2984
|
'overflow-block': {
|
|
@@ -3105,7 +3119,7 @@ const cssProps = {
|
|
|
3105
3119
|
property: 'min-height',
|
|
3106
3120
|
type: 'd',
|
|
3107
3121
|
compiler: length,
|
|
3108
|
-
values: ['max-content:xc', 'min-content:mc', '
|
|
3122
|
+
values: ['max-content:xc', 'min-content:mc', 'fit-content:fc'],
|
|
3109
3123
|
},
|
|
3110
3124
|
'max-w': {
|
|
3111
3125
|
property: 'max-width',
|
|
@@ -3117,7 +3131,7 @@ const cssProps = {
|
|
|
3117
3131
|
property: 'min-width',
|
|
3118
3132
|
type: 'd',
|
|
3119
3133
|
compiler: length,
|
|
3120
|
-
values: ['max-content:xc', 'min-content:mc', '
|
|
3134
|
+
values: ['max-content:xc', 'min-content:mc', 'fit-content:fc'],
|
|
3121
3135
|
},
|
|
3122
3136
|
};
|
|
3123
3137
|
export default cssProps;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import prefix, { createRegexForPseudo } from './PseudoPrefixNew.js';
|
|
2
2
|
import extractPrefix from './extractPrefix.js';
|
|
3
|
+
import { splitTopLevel } from '../utils/helper.js';
|
|
3
4
|
// ---------------------------------------------------------------------------
|
|
4
5
|
// Built once at module load, not on every call
|
|
5
6
|
// ---------------------------------------------------------------------------
|
|
@@ -50,7 +51,10 @@ export default function PseudoEleStateNew(data) {
|
|
|
50
51
|
const [inner, rest] = parts;
|
|
51
52
|
if (!inner)
|
|
52
53
|
return [rest, ''];
|
|
53
|
-
|
|
54
|
+
// Inside ( ), a bare word is an element: nav → _nav, h1,h2 → _h1,_h2
|
|
55
|
+
const args = splitTopLevel(inner).map((a) => (/^[a-zA-Z]/.test(a) ? '_' + a : a)).join(',');
|
|
56
|
+
const [result] = extractPrefix(args + '-display-none');
|
|
57
|
+
// const [result] = extractPrefix(inner + '-display-none');
|
|
54
58
|
return [rest, `${prefix['-' + fn[1]]}(${result})`];
|
|
55
59
|
}
|
|
56
60
|
// 2. --nth-child(…) --nc(…) …: argument passed through as is
|
|
@@ -222,10 +222,10 @@ bool = false) {
|
|
|
222
222
|
}
|
|
223
223
|
else {
|
|
224
224
|
const asWritten = valuePortion.replace(/^-/, '');
|
|
225
|
+
if (!asWritten)
|
|
226
|
+
return bool ? [null, null] : null; // "fs", "adu", "c": a property with no value is not a class
|
|
225
227
|
console.warn(`AliasCSS: "${className}": couldn't compile the value "${asWritten}", used it as written`);
|
|
226
|
-
|
|
227
|
-
// (the old one-liner returned only the value: `prop + ":" + x ? x : …` parses as `(prop + ":" + x) ? x : …`)
|
|
228
|
-
return bool ? [prop, v] : prop + ":" + v;
|
|
228
|
+
return bool ? [prop, asWritten] : prop + ":" + asWritten;
|
|
229
229
|
}
|
|
230
230
|
}
|
|
231
231
|
else {
|