aliascss 1.4.5 → 1.5.0

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.
Files changed (75) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/bin/aliascss.js +118 -1
  3. package/dist/aliascss.js +1 -1
  4. package/lib/classPrinter.js +347 -21
  5. package/lib/compilers/color.js +5 -5
  6. package/lib/compilers/gradient.js +3 -3
  7. package/lib/compilers/stringAndContent.js +2 -1
  8. package/lib/component-elements.d.ts +155 -0
  9. package/lib/component-elements.js +223 -0
  10. package/lib/config.d.ts +2 -0
  11. package/lib/config.js +3 -1
  12. package/lib/css-properties-all.js +337 -202
  13. package/lib/custom-css-compilers.js +49 -116
  14. package/lib/extras-elements.d.ts +87 -0
  15. package/lib/extras-elements.js +184 -0
  16. package/lib/form-elements.d.ts +75 -0
  17. package/lib/form-elements.js +186 -0
  18. package/lib/layout-elements.d.ts +59 -0
  19. package/lib/layout-elements.js +113 -0
  20. package/lib/nav-elements.d.ts +71 -0
  21. package/lib/nav-elements.js +243 -0
  22. package/lib/node/compileFile-BK-291026.d.ts +27 -0
  23. package/lib/node/compileFile-BK-291026.js +309 -0
  24. package/lib/node/compileFile-bk.d.ts +14 -12
  25. package/lib/node/compileFile-bk.js +263 -252
  26. package/lib/node/compileFile.js +1 -1
  27. package/lib/node/extractClassNamesFromFile.js +208 -86
  28. package/lib/prebuild.d.ts +546 -12
  29. package/lib/prebuild.js +3 -852
  30. package/lib/prefix/PseudoPrefixNew.js +301 -16
  31. package/lib/prefix/attribute-selector.js +4 -2
  32. package/lib/prefix/element-selector.js +93 -20
  33. package/lib/prefix/extractPrefix.d.ts +1 -1
  34. package/lib/prefix/extractPrefix.js +113 -70
  35. package/lib/prefix/pseudoSelectorNew.js +184 -49
  36. package/lib/prefix/responsive.d.ts +13 -9
  37. package/lib/prefix/responsive.js +131 -9
  38. package/lib/returnPropertyAndValue.js +9 -4
  39. package/lib/returnStatement-bk-291026.d.ts +5 -0
  40. package/lib/returnStatement-bk-291026.js +470 -0
  41. package/lib/returnStatement-bk.d.ts +5 -0
  42. package/lib/returnStatement-bk.js +311 -0
  43. package/lib/returnStatement.d.ts +1 -0
  44. package/lib/returnStatement.js +262 -12
  45. package/lib/static/customStaticClassNames.js +35 -35
  46. package/lib/static/staticClassNamesAlias.js +18 -16
  47. package/lib/table-elements.d.ts +39 -0
  48. package/lib/table-elements.js +90 -0
  49. package/lib/utils/helper.d.ts +6 -0
  50. package/lib/utils/helper.js +52 -0
  51. package/lib/x-classes/x-bundle.d.ts +589 -0
  52. package/lib/x-classes/x-bundle.js +12 -0
  53. package/lib/x-classes/x-comps.d.ts +87 -0
  54. package/lib/x-classes/x-comps.js +189 -0
  55. package/lib/x-classes/x-extras.d.ts +155 -0
  56. package/lib/x-classes/x-extras.js +223 -0
  57. package/lib/x-classes/x-form-components.d.ts +75 -0
  58. package/lib/x-classes/x-form-components.js +186 -0
  59. package/lib/x-classes/x-helper-components.d.ts +63 -0
  60. package/lib/x-classes/x-helper-components.js +91 -0
  61. package/lib/x-classes/x-layout-components.d.ts +59 -0
  62. package/lib/x-classes/x-layout-components.js +113 -0
  63. package/lib/x-classes/x-menu.d.ts +23 -0
  64. package/lib/x-classes/x-menu.js +55 -0
  65. package/lib/x-classes/x-navs.d.ts +71 -0
  66. package/lib/x-classes/x-navs.js +243 -0
  67. package/lib/x-classes/x-row-col.d.ts +29 -0
  68. package/lib/x-classes/x-row-col.js +52 -0
  69. package/lib/x-classes/x-table.d.ts +39 -0
  70. package/lib/x-classes/x-table.js +90 -0
  71. package/lib/x-classes/x-theme.d.ts +15 -0
  72. package/lib/x-classes/x-theme.js +32 -0
  73. package/lib/x-imports.d.ts +31 -0
  74. package/lib/x-imports.js +748 -0
  75. package/package.json +1 -1
@@ -1,25 +1,27 @@
1
1
  export function createRegexForPseudo(prefix) {
2
- const prefixAlias = Object.keys(prefix).reduce((previous, current) => previous + "|" + current);
3
- return new RegExp("^(" + prefixAlias + ")(?=[-(|_])");
2
+ const keys = Object.keys(prefix)
3
+ .sort((a, b) => b.length - a.length)
4
+ .map(k => k.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'));
5
+ return new RegExp('^(' + keys.join('|') + ')(?=[-(_])');
4
6
  }
5
7
  const prefix = {
6
8
  '--active': ':active', // -a
7
9
  '--a': ':active',
8
10
  '--ac': ':active',
9
- '--after-hover': '::after:hover',
10
- '--afh': '::after:hover',
11
+ '--after-hover': ':hover::after',
12
+ '--afh': ':hover::after',
11
13
  '--after': '::after', // -af
12
14
  '--af': '::after', // -af
13
- '--autofill': ':-webkit-autofill',
14
- '--atf': ':-webkit-autofill',
15
+ '--autofill': ':autofill',
16
+ '--atf': ':autofill',
15
17
  '--any-link': ':any-link',
16
18
  '--al': ':any-link',
17
19
  '--backdrop': '::backdrop',
18
20
  '--bd': '::backdrop',
19
21
  '--blank': ':blank',
20
22
  '--bl': ':blank',
21
- '--before-hover': '::before:hover', // -bfh
22
- '--bfh': '::before:hover', // -bfh
23
+ '--before-hover': ':hover::before', // -bfh
24
+ '--bfh': ':hover::before', // -bfh
23
25
  '--before': '::before', // -bf
24
26
  '--bf': '::before', // -bf
25
27
  '--checked': ':checked', // -ck
@@ -32,6 +34,8 @@ const prefix = {
32
34
  '--de': ':default', // -df
33
35
  '--disabled': ':disabled', // -ds
34
36
  '--di': ':disabled', // -ds
37
+ '--details-content': '::details-content',
38
+ '--dc': '::details-content',
35
39
  '--empty': ':empty', // -em
36
40
  '--em': ':empty', // -em
37
41
  '--enabled': ':enabled', // -en
@@ -75,11 +79,11 @@ const prefix = {
75
79
  '--ind': ':indeterminate', // idt
76
80
  '--invalid': ':invalid', // -in
77
81
  '--inv': ':invalid', // -in
78
- '--is': ' :is',
79
- '--Is': ':is',
82
+ '--is': ':is',
83
+ '--Is': ' :is',
80
84
  // '--is':':is',
81
85
  '--lang': ':lang', // -ln
82
- '--lan': ':lan', // -ln
86
+ '--lan': ':lang', // -ln
83
87
  '--last-child': ':last-child', // -lc
84
88
  '--lc': ':last-child', // -lc
85
89
  '--last-of-type': ':last-of-type', // -lot
@@ -136,22 +140,303 @@ const prefix = {
136
140
  '--webkit-scrollbar-track': '::-webkit-scrollbar-track',
137
141
  '--st': '::-webkit-scrollbar-track',
138
142
  '--scrollbar-thumb': '::-webkit-scrollbar-thumb',
139
- '--web-kit-scrollbar-thumb': '::-webkit-scrollbar-thumb',
143
+ '--webkit-scrollbar-thumb': '::-webkit-scrollbar-thumb',
140
144
  '--stm': '::-webkit-scrollbar-thumb',
145
+ '--webkit-slider-thumb': '::-webkit-slider-thumb',
146
+ '--webkit-slider-runnable-track': '::-webkit-slider-runnable-track',
147
+ '--moz-range-thumb': '::-moz-range-thumb',
148
+ '--moz-range-track': '::-moz-range-track',
149
+ '--moz-range-progress': '::-moz-range-progress',
150
+ '--webkit-progress-bar': '::-webkit-progress-bar',
151
+ '--webkit-progress-value': '::-webkit-progress-value',
152
+ '--webkit-autofill': ':-webkit-autofill',
153
+ '--moz-progress-bar': '::-moz-progress-bar',
141
154
  '--target': ':target', // -tg
142
155
  '--tg': ':target', // -tg
143
156
  '--target-text': '::target-text', // -tg
144
157
  '--tt': '::target-text', // -tg
145
158
  '--user-invalid': ':user-invalid',
146
159
  '--ui': ':user-invalid',
160
+ '--user-valid': ':user-valid',
161
+ '--uv': ':user-valid',
147
162
  '--valid': ':valid', // -vl
148
163
  '--va': ':valid', // -vl
149
164
  '--visited': ':visited', // -vi
150
165
  '--vi': ':visited', // -vi
151
166
  '--v': ':visited', // -vi
152
- '--where': ' :where',
153
- '--w': ' :where',
154
- '--Where': ':where',
155
- '--W': ':where'
167
+ '--where': ':where',
168
+ '--w': ':where',
169
+ '--Where': ' :where',
170
+ '--W': ' :where',
171
+ '--open': ':open',
172
+ '--modal': ':modal',
173
+ '--picker-select': '::picker(select)',
174
+ '--checkmark': '::checkmark',
175
+ '--picker-icon': '::picker-icon'
156
176
  };
157
177
  export default prefix;
178
+ /*
179
+ // export function createRegexForPseudo(prefix:{[key:string]:string
180
+ // }){
181
+ // const prefixAlias= Object.keys(prefix).reduce((previous,current)=>previous+"|"+current);
182
+ // return new RegExp("^("+prefixAlias+")(?=[-(|_])");
183
+ // }
184
+
185
+ export function createRegexForPseudo(prefix: { [key: string]: string }) {
186
+ const keys = Object.keys(prefix)
187
+ .sort((a, b) => b.length - a.length)
188
+ .map(k => k.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'));
189
+ return new RegExp('^(' + keys.join('|') + ')(?=[-(_])');
190
+ }
191
+
192
+ const prefix:{[key:string]:string}={
193
+
194
+ '--active': ':active', // -a
195
+ '--a': ':active',
196
+ '--ac': ':active',
197
+
198
+ '--after-hover': '::after:hover',
199
+ '--afh': '::after:hover',
200
+
201
+
202
+ '--after': '::after', // -af
203
+ '--af': '::after', // -af
204
+ '--autofill':':autofill',
205
+ '--atf':':-webkit-autofill',
206
+ '--any-link':':any-link',
207
+ '--al':':any-link',
208
+
209
+ '--backdrop':'::backdrop',
210
+ '--bd':'::backdrop',
211
+
212
+ '--blank':':blank',
213
+ '--bl':':blank',
214
+
215
+ '--before-hover': '::before:hover', // -bfh
216
+ '--bfh': '::before:hover', // -bfh
217
+
218
+ '--before': '::before', // -bf
219
+ '--bf': '::before', // -bf
220
+
221
+ '--checked': ':checked', // -ck
222
+ '--ch': ':checked', // -ck
223
+
224
+ '--current': ':current', // -ck
225
+ '--cur': ':current',
226
+
227
+ '--cue':'::cue',
228
+ '--cu':'::cue',
229
+
230
+ '--default': ':default', // -df
231
+ '--de': ':default', // -df
232
+
233
+ '--disabled': ':disabled', // -ds
234
+ '--di': ':disabled', // -ds
235
+
236
+ '--details-content':'::details-content',
237
+ '--dc':'::details-content',
238
+
239
+ '--empty': ':empty', // -em
240
+ '--em': ':empty', // -em
241
+
242
+ '--enabled': ':enabled', // -en
243
+ '--en': ':enabled', // -en
244
+
245
+ '--file-selector-button':'::file-selector-button',
246
+ '--fsb':'::file-selector-button',
247
+
248
+ '--first-child': ':first-child', // -fc
249
+ '--fc': ':first-child',
250
+
251
+ '--first-letter': '::first-letter', // -f
252
+ '--fl': '::first-letter', // -fl
253
+
254
+ '--first-line': '::first-line', // -fln
255
+ '--fln': '::first-line', // -fln
256
+
257
+ '--first-of-type': ':first-of-type', // -fot
258
+ '--fot': ':first-of-type',
259
+
260
+ '--focus-within': ':focus-within', // -fo
261
+ '--fw': ':focus-within', // -fo
262
+
263
+ '--focus-visible': ':focus-visible', // -fo
264
+ '--fv': ':focus-visible', // -fo
265
+
266
+ '--focus': ':focus', // -fo
267
+ '--fo': ':focus', // -fo
268
+ '--f': ':focus', // -fo
269
+
270
+ '--fullscreen':':fullscreen',
271
+ '--fs':':fullscreen',
272
+
273
+ '--grammar-error':'::grammar-error',
274
+ '--ge':'::grammar-error',
275
+
276
+ '--has': ':has', // --has
277
+ '--hs': ':has', // -hs
278
+ '--Has': ' :has', // --has
279
+
280
+
281
+
282
+
283
+ '--hover-after': ':hover::after', // -haf
284
+ '--haf': ':hover::after', // -haf
285
+
286
+ '--hover-before': ':hover::before', // -hbf
287
+ '--hbf': ':hover::before', // -hbf
288
+
289
+ '--hover-target': ':hover:target', // -htg
290
+ '--htg': ':hover:target', // -htg
291
+
292
+ '--hover': ':hover', // -h
293
+ '--h': ':hover', // -h
294
+ '--ho': ':hover', // -h
295
+
296
+
297
+
298
+
299
+ '--in-range': ':in-range', // -ir
300
+ '--ir': ':in-range', // -ir
301
+
302
+ '--indeterminate': ':indeterminate', // idt
303
+ '--ind': ':indeterminate', // idt
304
+
305
+ '--invalid': ':invalid', // -in
306
+ '--inv': ':invalid', // -in
307
+ '--is':':is',
308
+ '--Is':' :is',
309
+ // '--is':':is',
310
+
311
+ '--lang': ':lang', // -ln
312
+ '--lan': ':lang', // -ln
313
+
314
+ '--last-child': ':last-child', // -lc
315
+ '--lc': ':last-child', // -lc
316
+
317
+ '--last-of-type': ':last-of-type', // -lot
318
+ '--lot': ':last-of-type', // -lot
319
+
320
+ '--link': ':link', // -l
321
+ '--ln': ':link', // -l
322
+ '--l': ':link', // -l
323
+
324
+ '--marker':'::marker',
325
+ '--m':'::marker',
326
+ '--not': ':not', // -n-
327
+ '--n': ':not', // -n-
328
+
329
+ '--nth-child': ':nth-child', // -nc2n
330
+ '--nc': ':nth-child', // -nc2n
331
+
332
+ '--nth-last-child': ':nth-last-child', // -nlc2n
333
+ '--nlc': ':nth-last-child', // -nlc2n
334
+
335
+ '--nth-last-of-type': ':nth-last-of-type', // -nlot2n
336
+ '--nlot': ':nth-last-of-type', // -nlot2n
337
+
338
+ '--nth-of-type': ':nth-of-type', // -not
339
+ '--nthot': ':nth-of-type', // -not
340
+
341
+ '--only-of-type': ':only-of-type', // -oot
342
+ '--oot': ':only-of-type', // -oot
343
+
344
+ '--only-child': ':only-child', // -oc
345
+ '--oc': ':only-child', // -oc
346
+
347
+ '--optional': ':optional', // -o
348
+ '--op': ':optional', // -o
349
+
350
+ '--out-of-range': ':out-of-range', // -oor
351
+ '--oor': ':out-of-range', // -oor
352
+
353
+ '--placeholder': '::placeholder', // -ph
354
+ '--ph': '::placeholder', // -ph
355
+
356
+ '--placeholder-shown': ':placeholder-shown', // -phs
357
+ '--phs': ':placeholder-shown', // -phs
358
+
359
+ '--popover-open':':popover-open',
360
+ '--po':':popover-open',
361
+
362
+ '--read-only': ':read-only', // -ro
363
+
364
+ '--ro': ':read-only', // -ro
365
+
366
+ '--read-write': ':read-write', // -rw
367
+ '--rw': ':read-write', // -rw
368
+
369
+ '--required': ':required', // -rq
370
+ '--rq': ':required', // -rq
371
+
372
+ '--root': ':root', // -rt
373
+ '--rt': ':root', // -rt
374
+
375
+ '--selection': '::selection', // -sl
376
+ '--s': '::selection', // -sl
377
+
378
+ '--search-cancel-button':'::-webkit-search-cancel-button',
379
+ '--webkit-search-cancel-button':'::-webkit-search-cancel-button',
380
+
381
+ '--search-decoration':'::-webkit-search-decoration',
382
+ '--webkit-search-decoration':'::-webkit-search-decoration',
383
+
384
+ '--spelling-error':'::spelling-error',
385
+ '--se':'::spelling-error',
386
+
387
+ '--scrollbar': '::-webkit-scrollbar',
388
+ '--webkit-scrollbar': '::-webkit-scrollbar',
389
+ '--sb': '::-webkit-scrollbar',
390
+ '--scrollbar-track': '::-webkit-scrollbar-track',
391
+ '--webkit-scrollbar-track': '::-webkit-scrollbar-track',
392
+ '--st': '::-webkit-scrollbar-track',
393
+ '--scrollbar-thumb': '::-webkit-scrollbar-thumb',
394
+ '--webkit-scrollbar-thumb': '::-webkit-scrollbar-thumb',
395
+ '--stm': '::-webkit-scrollbar-thumb',
396
+ '--webkit-slider-thumb':'::-webkit-slider-thumb',
397
+ '--webkit-slider-runnable-track':'::-webkit-slider-runnable-track',
398
+ '--moz-range-thumb':'::-moz-range-thumb',
399
+ '--moz-range-track':'::-moz-range-track',
400
+ '--moz-range-progress':'::-moz-range-progress',
401
+ '--webkit-progress-bar':'::-webkit-progress-bar',
402
+ '--webkit-progress-value':'::-webkit-progress-value',
403
+ '--webkit-autofill':':-webkit-autofill',
404
+ '--moz-progress-bar':'::-moz-progress-bar',
405
+ '--target': ':target', // -tg
406
+ '--tg': ':target', // -tg
407
+
408
+ '--target-text': '::target-text', // -tg
409
+ '--tt': '::target-text', // -tg
410
+
411
+ '--user-invalid':':user-invalid',
412
+ '--ui':':user-invalid',
413
+
414
+
415
+ '--user-valid':':uservalid',
416
+ '--uv':':user-valid',
417
+
418
+ '--valid': ':valid', // -vl
419
+ '--va': ':valid', // -vl
420
+
421
+ '--visited': ':visited', // -vi
422
+ '--vi': ':visited', // -vi
423
+ '--v': ':visited', // -vi
424
+
425
+ '--where':':where',
426
+ '--w':':where',
427
+ '--Where':' :where',
428
+ '--W':' :where',
429
+ '--open':':open',
430
+ '--modal':':modal',
431
+ '--picker-select':'::picker(select)',
432
+ '--checkmark':'::checkmark',
433
+ '--picker-icon':'::picker-icon'
434
+
435
+
436
+
437
+
438
+ }
439
+
440
+ export default prefix;
441
+
442
+ */
@@ -1,5 +1,5 @@
1
1
  const attribute = {
2
- test: /^[-,_]?[\[][a-zA-Z0-9-_:]+([~*$^]?[=][a-zA-Z0-9-_:/.]+)?[\]]/,
2
+ test: /^[-,_]?[\[][a-zA-Z0-9-_:]+([~*$^|]?[=][a-zA-Z0-9-_:/.\\]+)?[\]]/,
3
3
  process(className) {
4
4
  const match = className.match(this.test);
5
5
  if (match) {
@@ -8,7 +8,9 @@ const attribute = {
8
8
  const attrSplit = attr.split("=")[0];
9
9
  const result = attr.replace(attrSplit, attrSplit.replace(/:/g, '\\:'))
10
10
  // .replace(/^([-]?[\[][a-z0-9-_:]+)([~*$^]?[=][a-z0-9-_:/.]+)?[\]]/,(m,s,b)=>s.replace(/\:/g,'\:')+b+']')
11
- .replace(/-(eql|equal)-/, '=').replace(/[=]([a-zA-Z0-9-_:/.]+)[\]]/, '="$1"]').replace(/^[-_]/, ""); // replace(/([\[|\]])/g,'\\$1').replace(/([=])/g,'\\$1');
11
+ .replace(/-(eql|equal)-/, '=').replace(/[=]([a-zA-Z0-9-_:/.\\]+)[\]]/, '="$1"]').replace(/^[-_]/, "")
12
+ .replace(/\\_|_/g, (m) => (m === '_' ? ' ' : '_'));
13
+ ; // replace(/([\[|\]])/g,'\\$1').replace(/([=])/g,'\\$1');
12
14
  return [className.replace(attr, ''), /^[_]/.test(className) ? ' ' + result : result];
13
15
  }
14
16
  }
@@ -1,26 +1,99 @@
1
+ // ---------------------------------------------------------------------------
2
+ // Element / combinator prefix: _li-… __a-… ___p-… ____p-… _.card-… _all-…
3
+ // New: a class name with "-" goes in parentheses: _.(card-title)-c-red
4
+ // → " .card-title" (also compound: _.(card.is-active)-o-1 → " .card.is-active")
5
+ // ---------------------------------------------------------------------------
6
+ // Placeholders for .(…) groups: never contain "-", "_" or letters the rules below touch
7
+ const OPEN = '\u0001';
8
+ const CLOSE = '\u0002';
9
+ // Replace each ".(…)" with ".␁N␂" so the selector regex doesn't stop at its "-".
10
+ // Uses balanced parentheses, so nested (…) inside the group is kept intact.
11
+ function maskParenClasses(str, saved) {
12
+ let out = '';
13
+ for (let i = 0; i < str.length; i++) {
14
+ if (str[i] === '.' && str[i + 1] === '(') {
15
+ let depth = 0;
16
+ let j = i + 1;
17
+ for (; j < str.length; j++) {
18
+ if (str[j] === '(')
19
+ depth++;
20
+ else if (str[j] === ')' && --depth === 0)
21
+ break;
22
+ }
23
+ if (j >= str.length)
24
+ return null; // unbalanced: invalid class
25
+ const inner = str.slice(i + 2, j);
26
+ if (!/^[A-Za-z_][\w.-]*$/.test(inner))
27
+ return null; // only class names, optionally chained with "."
28
+ saved.push(inner);
29
+ out += '.' + OPEN + (saved.length - 1) + CLOSE;
30
+ i = j;
31
+ }
32
+ else {
33
+ out += str[i];
34
+ }
35
+ }
36
+ return out;
37
+ }
38
+ const restore = (str, saved) => str.replace(new RegExp(OPEN + '(\\d+)' + CLOSE, 'g'), (_m, n) => saved[Number(n)]);
1
39
  const element = {
2
- test: /^_[_]?[A-Za-z0-9_\.,]+(?=[@_[-])/,
40
+ test: new RegExp('^_[_]?[A-Za-z0-9_.,' + OPEN + CLOSE + ']+(?=[@_[-])'),
3
41
  process(className) {
4
- const match = className.match(this.test);
5
- if (match) {
42
+ const saved = [];
43
+ const masked = maskParenClasses(className, saved);
44
+ if (masked === null)
45
+ return undefined;
46
+ const match = masked.match(this.test);
47
+ if (!match)
48
+ return undefined;
49
+ const alias = match[0];
50
+ const result = alias
51
+ // keywords only as whole segments: _child_ _next_ _siblings_ (never inside a class name)
52
+ .replace(/(^|_)next(?=_)/g, '$1 + ')
53
+ .replace(/(^|_)child(?=_)/g, '$1 > ')
54
+ .replace(/(^|_)siblings(?=_)/g, '$1 ~ ')
55
+ .replace(/____/g, ' ~ ')
56
+ .replace(/___/g, ' + ')
57
+ .replace(/__/g, ' > ')
58
+ .replace(/_/g, ' ')
59
+ .replace(/(^|\s)all(?=\s|$)/g, '$1* ')
60
+ .replace(/[\s]+/g, ' ').trim();
61
+ const rest = masked.replace(alias, (/[^_][_]$/.test(alias) ? '_' : ''));
62
+ return [restore(rest, saved), ' ' + restore(result, saved)];
63
+ }
64
+ };
65
+ export default element;
66
+ /*
67
+ const element :{
68
+ [key:string]:any,
69
+ process: (...args: any[]) => any
70
+ }
71
+ = {
72
+ test:/^_[_]?[A-Za-z0-9_\.,]+(?=[@_[-])/,
73
+ process(className :string){
74
+ const match=className.match(this.test);
75
+ if(match){
6
76
  const alias = match[0];
7
- if (match)
8
- if (alias) {
9
- const result = alias
10
- .replace('next', ' + ')
11
- .replace('child', ' > ')
12
- .replace('siblings', ' ~')
13
- .replace(/____/g, ' ~ ')
14
- .replace(/___/g, ' + ')
15
- .replace(/__/g, ' > ')
16
- .replace(/_/g, ' ')
17
- .replace(/[\s]all/, ' * ')
18
- .replace(/[\s](dot)/g, (e, a) => { return ' .' + a.toLowerCase(); })
19
- // .replace(/[\s]([A-Z])/g, (e, a) => { return ' .' + a.toLowerCase();})
20
- .replace(/[\s]+/g, " ").trim();
21
- return [className.replace(alias, (/[^_][_]$/.test(alias) ? '_' : '')), ' ' + result];
22
- }
77
+ if(match)
78
+ if (alias) {
79
+ const result = alias
80
+ .replace('next',' + ')
81
+ .replace('child',' > ')
82
+ .replace('siblings',' ~')
83
+ .replace(/____/g, ' ~ ')
84
+ .replace(/___/g, ' + ')
85
+ .replace(/__/g, ' > ')
86
+ .replace(/_/g, ' ')
87
+ .replace(/[\s]all/, ' * ')
88
+ //.replace(/[\s](dot)/g, (e, a) => { return ' .' + a.toLowerCase();})
89
+ // .replace(/[\s]([A-Z])/g, (e, a) => { return ' .' + a.toLowerCase();})
90
+ .replace(/[\s]+/g," ").trim();
91
+
92
+
93
+ return [className.replace(alias, (/[^_][_]$/.test(alias)?'_':'')), ' ' + result];
94
+ }
23
95
  }
24
96
  }
25
- };
97
+ }
26
98
  export default element;
99
+ */
@@ -1 +1 @@
1
- export default function extractPrefix(className: string): string[];
1
+ export default function extractPrefix(className: string): [string, string];