aliascss 1.4.5 → 1.4.7
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/dist/aliascss.js +1 -1
- package/lib/compilers/color.js +5 -5
- package/lib/compilers/gradient.js +3 -3
- package/lib/compilers/stringAndContent.js +2 -1
- package/lib/component-elements.d.ts +155 -0
- package/lib/component-elements.js +223 -0
- package/lib/config.d.ts +1 -0
- package/lib/config.js +2 -1
- package/lib/css-properties-all.js +337 -202
- package/lib/custom-css-compilers.js +54 -54
- package/lib/extras-elements.d.ts +87 -0
- package/lib/extras-elements.js +184 -0
- package/lib/form-elements.d.ts +75 -0
- package/lib/form-elements.js +186 -0
- package/lib/layout-elements.d.ts +59 -0
- package/lib/layout-elements.js +113 -0
- package/lib/nav-elements.d.ts +71 -0
- package/lib/nav-elements.js +243 -0
- package/lib/prebuild.d.ts +520 -12
- package/lib/prebuild.js +9 -852
- package/lib/prefix/PseudoPrefixNew.js +301 -16
- package/lib/prefix/attribute-selector.js +4 -2
- package/lib/prefix/pseudoSelectorNew.js +184 -49
- package/lib/prefix/responsive.d.ts +13 -9
- package/lib/prefix/responsive.js +131 -9
- package/lib/returnPropertyAndValue.js +9 -4
- package/lib/returnStatement-bk.d.ts +5 -0
- package/lib/returnStatement-bk.js +311 -0
- package/lib/returnStatement.js +165 -2
- package/lib/static/customStaticClassNames.js +35 -35
- package/lib/static/staticClassNamesAlias.js +18 -16
- package/lib/table-elements.d.ts +39 -0
- package/lib/table-elements.js +90 -0
- package/lib/utils/helper.d.ts +6 -0
- package/lib/utils/helper.js +52 -0
- package/lib/x-classes/x-bundle.d.ts +563 -0
- package/lib/x-classes/x-bundle.js +11 -0
- package/lib/x-classes/x-comps.d.ts +87 -0
- package/lib/x-classes/x-comps.js +189 -0
- package/lib/x-classes/x-extras.d.ts +155 -0
- package/lib/x-classes/x-extras.js +223 -0
- package/lib/x-classes/x-form-components.d.ts +75 -0
- package/lib/x-classes/x-form-components.js +186 -0
- package/lib/x-classes/x-helper-components.d.ts +63 -0
- package/lib/x-classes/x-helper-components.js +91 -0
- package/lib/x-classes/x-layout-components.d.ts +59 -0
- package/lib/x-classes/x-layout-components.js +113 -0
- package/lib/x-classes/x-menu.d.ts +23 -0
- package/lib/x-classes/x-menu.js +55 -0
- package/lib/x-classes/x-navs.d.ts +71 -0
- package/lib/x-classes/x-navs.js +243 -0
- package/lib/x-classes/x-table.d.ts +39 -0
- package/lib/x-classes/x-table.js +90 -0
- package/lib/x-classes/x-theme.d.ts +15 -0
- package/lib/x-classes/x-theme.js +32 -0
- package/lib/x-imports.d.ts +31 -0
- package/lib/x-imports.js +748 -0
- package/package.json +1 -1
package/lib/returnStatement.js
CHANGED
|
@@ -12,10 +12,12 @@ import config from "./config.js";
|
|
|
12
12
|
import cssProps from "./css-properties-all.js";
|
|
13
13
|
import { staticClassNamesAlias } from "./static/staticClassNamesAlias.js";
|
|
14
14
|
import postcss from "postcss";
|
|
15
|
-
import { splitByCommaOutsideParens } from "./utils/helper.js";
|
|
15
|
+
import { splitByCommaOutsideParens, matchTrailingGroup, splitTopLevel, joinGroupItem } from "./utils/helper.js";
|
|
16
16
|
import cssCustomCompilers from "./custom-css-compilers.js";
|
|
17
17
|
// import customGroups from './prebuild.js';
|
|
18
18
|
const [staticClassNamesWithAlias, cssPropsWithAlias] = createCompilerObj(cssProps, config.globalValues);
|
|
19
|
+
const NAME = '[a-zA-Z_][\\w-]*(?:\\/[a-zA-Z_][\\w-]*)*';
|
|
20
|
+
const AS_EXPORT = new RegExp(`--as-(?<names>${NAME}|\\[${NAME}(?:,${NAME})*\\])$`);
|
|
19
21
|
export const compiler = {
|
|
20
22
|
// cache will cache propertyAndValue
|
|
21
23
|
cache: { propertyAndValue: Object.assign({}, customStaticClassNames) },
|
|
@@ -59,6 +61,158 @@ export const compiler = {
|
|
|
59
61
|
return this.cssProps[className].statement;
|
|
60
62
|
}
|
|
61
63
|
}
|
|
64
|
+
// Budle atomice class name in new
|
|
65
|
+
if (AS_EXPORT.test(className)) {
|
|
66
|
+
const asMatch = (_a = className.match(AS_EXPORT)) !== null && _a !== void 0 ? _a : [null, null];
|
|
67
|
+
if (asMatch[0] && asMatch[1]) {
|
|
68
|
+
return this.group(className.replace(asMatch[0], ''), asMatch[1]);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
let unPrefixedClassName = className;
|
|
72
|
+
// check for [group-acss,]
|
|
73
|
+
// old
|
|
74
|
+
// const matchGroupCSS=className.match(/\[([^[]*)\]$/);
|
|
75
|
+
// if(matchGroupCSS){
|
|
76
|
+
// const asString=splitByCommaOutsideParens(matchGroupCSS[1])
|
|
77
|
+
// // .split(',')
|
|
78
|
+
// .map(e=>(className.replace(matchGroupCSS[0],'')+"-").replace(/--$/,'-')+e.replace(/^--/,'-'))
|
|
79
|
+
// .join(' ');
|
|
80
|
+
// return this.group(asString,as?as:className);
|
|
81
|
+
// }
|
|
82
|
+
// --end old
|
|
83
|
+
// New
|
|
84
|
+
const grp = matchTrailingGroup(className);
|
|
85
|
+
if (grp) {
|
|
86
|
+
const asString = splitTopLevel(grp.body).map(e => joinGroupItem(grp.prefix, e)).join(' ');
|
|
87
|
+
return this.group(asString, as ? as : className);
|
|
88
|
+
}
|
|
89
|
+
// EONEW
|
|
90
|
+
let beforeClassNameSelector = '';
|
|
91
|
+
if (this.prefix && !className.match(new RegExp('^' + this.prefix + "[-]"))) {
|
|
92
|
+
return null;
|
|
93
|
+
}
|
|
94
|
+
else if (this.prefix) {
|
|
95
|
+
unPrefixedClassName = className.replace(new RegExp('^' + this.prefix + "[-]"), '');
|
|
96
|
+
}
|
|
97
|
+
if (!this.mediaTest)
|
|
98
|
+
this.mediaTest = createRegexForMedia(this.mediaSelector);
|
|
99
|
+
// 1. check and extract Media prefix and return className with prefix treatment,
|
|
100
|
+
let [extractedMedia, workingClassName] = extractMediaPrefix(unPrefixedClassName, this.mediaSelector, this.mediaTest);
|
|
101
|
+
const mediaEX = extractedMedia;
|
|
102
|
+
// lint escape for const
|
|
103
|
+
extractedMedia = extractedMedia;
|
|
104
|
+
// 2. search for '&' which tells us to use selector before or after className
|
|
105
|
+
if (workingClassName.match(/[&]/)) {
|
|
106
|
+
const [before, after] = workingClassName.split('&');
|
|
107
|
+
beforeClassNameSelector = extractPrefix(before + "-display-none")[0] + " ";
|
|
108
|
+
if (!beforeClassNameSelector.trim()) {
|
|
109
|
+
console.error('Not a valid AliasCSS className:' + className, 'Make sure to provide valid css aliascss selector before "&" identifier');
|
|
110
|
+
return null;
|
|
111
|
+
}
|
|
112
|
+
else {
|
|
113
|
+
beforeClassNameSelector = beforeClassNameSelector.replace(/^([\s]?[+~>])(.*)/, "$2$1 ");
|
|
114
|
+
}
|
|
115
|
+
workingClassName = workingClassName.replace(before, '').replace('&', '');
|
|
116
|
+
}
|
|
117
|
+
let [elementAndPseudo, important] = ['', ''];
|
|
118
|
+
// workingClassName=workingClassName.replace(/[_][\.]([a-zA-Z])/g,(s,e)=>"_"+'ACSS').replace(/[.]/g,"d").replace(/[%]/g,'p')
|
|
119
|
+
// 3. Process --important flag
|
|
120
|
+
if (/(-i|--important)$/.test(className)) {
|
|
121
|
+
important = ' !important';
|
|
122
|
+
workingClassName = workingClassName.replace(/(-i|--important)$/, '');
|
|
123
|
+
}
|
|
124
|
+
// 4. process Pseudo State
|
|
125
|
+
const prefixPseudoElementAttribute = extractPrefix(workingClassName);
|
|
126
|
+
workingClassName = prefixPseudoElementAttribute[1];
|
|
127
|
+
elementAndPseudo = prefixPseudoElementAttribute[0];
|
|
128
|
+
// ---------------------------------------------------------------------
|
|
129
|
+
const pnv = workingClassName.replace(/^-([a-zA-Z])/, '$1');
|
|
130
|
+
let result = '';
|
|
131
|
+
// x-class
|
|
132
|
+
// if(/^(x-width|x-height)/.test(pnv)){
|
|
133
|
+
// const extract=getPropertyAndValue(pnv.replace('x-',''), this.cssProps, this.staticClassNames, this.custom,extractProperty);
|
|
134
|
+
// if(typeof extract === 'string'){
|
|
135
|
+
// const [p,v]=extract.split(':');
|
|
136
|
+
// if(p && v){
|
|
137
|
+
// result=`${p}:calc(${v} + var(--x-${p}-grow,0px) - var(--x-${p}-shrink,0px));`
|
|
138
|
+
// }
|
|
139
|
+
// }
|
|
140
|
+
// }else
|
|
141
|
+
if (this.cache.propertyAndValue.hasOwnProperty(pnv)) {
|
|
142
|
+
result = this.cache.propertyAndValue[pnv];
|
|
143
|
+
}
|
|
144
|
+
else {
|
|
145
|
+
try {
|
|
146
|
+
result = getPropertyAndValue(pnv, this.cssProps, this.staticClassNames, this.custom, extractProperty);
|
|
147
|
+
}
|
|
148
|
+
catch (error) {
|
|
149
|
+
console.log(error);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
// if(result){
|
|
153
|
+
// className=className.replace(/([$.&%=\]\[@~:*#+\(\)\/^])/g,'\\$1');
|
|
154
|
+
// if(bool===true) return result;
|
|
155
|
+
// this.cache.propertyAndValue[pnv]=result;
|
|
156
|
+
// if(media){
|
|
157
|
+
// return `${media}{${
|
|
158
|
+
// beforeClassNameSelector+'.'+(as?as:className)+ elementAndPseudo
|
|
159
|
+
// }{${result}${important}}}`;
|
|
160
|
+
// }else{
|
|
161
|
+
// return `${beforeClassNameSelector}.${(as?as:className)}${elementAndPseudo}{${result}${important}}`;
|
|
162
|
+
// }
|
|
163
|
+
// }else{
|
|
164
|
+
// console.log(`Unable to process ${className} [media:${media},pseudoSelector:${elementAndPseudo},imp:${important}]`)
|
|
165
|
+
// }
|
|
166
|
+
// ------------PostCSSParse
|
|
167
|
+
if (result) {
|
|
168
|
+
let stm = '';
|
|
169
|
+
className = (as ? as : className).replace(/([$.&%=\]\[@~,:*#+\(\)\/^/</>\\|])/g, '\\$1');
|
|
170
|
+
if (bool === true)
|
|
171
|
+
return result;
|
|
172
|
+
this.cache.propertyAndValue[pnv] = result;
|
|
173
|
+
if (mediaEX.length) {
|
|
174
|
+
let [bf, af] = ['', ''];
|
|
175
|
+
mediaEX.map((e) => {
|
|
176
|
+
const mediaQuery = e.split('::::')[0];
|
|
177
|
+
const mediaPrefix = e.split('::::')[1].replace(/^@/, '');
|
|
178
|
+
if (['xs', 'sm', 'md', 'lg', 'xl', 'xxl'].indexOf(mediaPrefix) !== -1) {
|
|
179
|
+
bf = bf + `@layer ${mediaPrefix}{ ${mediaQuery} {`;
|
|
180
|
+
af = af + "}}";
|
|
181
|
+
}
|
|
182
|
+
else {
|
|
183
|
+
bf = bf + mediaQuery + "{ ";
|
|
184
|
+
af = af + "}";
|
|
185
|
+
}
|
|
186
|
+
});
|
|
187
|
+
stm = `${bf}${beforeClassNameSelector + '.' + className + elementAndPseudo}{${result}${important}}${af}`;
|
|
188
|
+
}
|
|
189
|
+
else {
|
|
190
|
+
stm = `${beforeClassNameSelector}.${className}${elementAndPseudo}{${result}${important}}`;
|
|
191
|
+
}
|
|
192
|
+
try {
|
|
193
|
+
postcss.parse(stm);
|
|
194
|
+
return stm;
|
|
195
|
+
}
|
|
196
|
+
catch (error) {
|
|
197
|
+
console.log('Not a Valid CSS Statement, PostCSS Parse:', stm);
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
else {
|
|
201
|
+
console.log(`Unable to process ${className} [media:${mediaEX},pseudoSelector:${elementAndPseudo},imp:${important}]`);
|
|
202
|
+
}
|
|
203
|
+
},
|
|
204
|
+
makeNested(className, as, bool) {
|
|
205
|
+
var _a;
|
|
206
|
+
// --Group Statement
|
|
207
|
+
if (this.cssProps.hasOwnProperty(className)) {
|
|
208
|
+
if (this.cssProps[className].hasOwnProperty('type') && (this.cssProps[className].type === 'statement')) {
|
|
209
|
+
return this.group(this.cssProps[className].statement, className);
|
|
210
|
+
}
|
|
211
|
+
if (this.cssProps[className].hasOwnProperty('type') && (this.cssProps[className].type === 'raw')) {
|
|
212
|
+
return this.cssProps[className].statement;
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
// inline-group
|
|
62
216
|
if (/--as-[a-zA-Z0-9-_]+$/.test(className)) {
|
|
63
217
|
const asMatch = (_a = className.match(/--as-([a-zA-Z0-9-_]+)$/)) !== null && _a !== void 0 ? _a : [null, null];
|
|
64
218
|
if (asMatch[0] && asMatch[1]) {
|
|
@@ -155,7 +309,7 @@ export const compiler = {
|
|
|
155
309
|
// ------------PostCSSParse
|
|
156
310
|
if (result) {
|
|
157
311
|
let stm = '';
|
|
158
|
-
className = (as ? as : className).replace(/([$.&%=\]\[@~,:*#+\(\)
|
|
312
|
+
className = (as ? as : className).replace(/([$.&%=\]\[@~,:*#+\(\)\/^/</>\\])/g, '\\$1');
|
|
159
313
|
if (bool === true)
|
|
160
314
|
return result;
|
|
161
315
|
this.cache.propertyAndValue[pnv] = result;
|
|
@@ -202,6 +356,15 @@ export const compiler = {
|
|
|
202
356
|
});
|
|
203
357
|
return statement;
|
|
204
358
|
},
|
|
359
|
+
groupMulti(str, as) {
|
|
360
|
+
let statement = '.' + as + '{\n';
|
|
361
|
+
[...str.trim().split(/\s+/)].forEach((e) => {
|
|
362
|
+
const getEachClassNameCompiled = this.make(e, as, true);
|
|
363
|
+
if (getEachClassNameCompiled)
|
|
364
|
+
statement += getEachClassNameCompiled + '; \n';
|
|
365
|
+
});
|
|
366
|
+
return statement + '}';
|
|
367
|
+
},
|
|
205
368
|
prebuild(a, b) {
|
|
206
369
|
if (typeof a === 'object') {
|
|
207
370
|
for (const key in a) {
|
|
@@ -10,16 +10,16 @@ export const customStaticClassNames = {
|
|
|
10
10
|
'width-md': 'width:var(--width-md, clamp(30.0000rem, calc(25.2632rem + 23.6842vw), 48.0000rem))', // Scales from 480px to 768px
|
|
11
11
|
'width-lg': 'width:var(--width-lg, clamp(40.0000rem, calc(33.6842rem + 31.5789vw), 64.0000rem))', // Scales from 640px to 1024px
|
|
12
12
|
'width-xl': 'width:var(--width-xl, clamp(48.0000rem, calc(39.5789rem + 42.1053vw), 80.0000rem))', // Scales from 768px to 1280px
|
|
13
|
-
'width-
|
|
13
|
+
'width-xxl': 'width:var(--width-xxl, clamp(64.0000rem, calc(55.5789rem + 42.1053vw), 96.0000rem))', // Scales from 1024px to 1536px
|
|
14
14
|
// Shorthand Utilities
|
|
15
15
|
'w-xs': 'width:var(--width-xs, clamp(17.5000rem, calc(14.2105rem + 16.4474vw), 30.0000rem))',
|
|
16
16
|
'w-sm': 'width:var(--width-sm, clamp(20.0000rem, calc(14.7368rem + 26.3158vw), 40.0000rem))',
|
|
17
17
|
'w-md': 'width:var(--width-md, clamp(30.0000rem, calc(25.2632rem + 23.6842vw), 48.0000rem))',
|
|
18
18
|
'w-lg': 'width:var(--width-lg, clamp(40.0000rem, calc(33.6842rem + 31.5789vw), 64.0000rem))',
|
|
19
19
|
'w-xl': 'width:var(--width-xl, clamp(48.0000rem, calc(39.5789rem + 42.1053vw), 80.0000rem))',
|
|
20
|
-
'w-
|
|
20
|
+
'w-xxl': 'width:var(--width-xxl, clamp(64.0000rem, calc(55.5789rem + 42.1053vw), 96.0000rem))',
|
|
21
21
|
"x-radius-xs": 'border-radius:var(--radius-xs,4px)',
|
|
22
|
-
"br-xs": 'border-radius:var(--radius-xs,
|
|
22
|
+
"br-xs": 'border-radius:var(--radius-xs,4px)',
|
|
23
23
|
"x-radius-sm": 'border-radius:var(--radius-sm,6px)',
|
|
24
24
|
"br-sm": 'border-radius:var(--radius-sm,6px)',
|
|
25
25
|
"border-radius-sm": 'border-radius:var(--radius-sm,6px)',
|
|
@@ -47,8 +47,8 @@ export const customStaticClassNames = {
|
|
|
47
47
|
// "x-padding-md":'padding:var(--x-padding-md,8px)',
|
|
48
48
|
// "x-padding-lg":'padding:var(--x-padding-lg,12px)',
|
|
49
49
|
// "x-padding-xl":'padding:var(--x-padding-xl,16px)',
|
|
50
|
-
// "x-padding-
|
|
51
|
-
// "x-padding-
|
|
50
|
+
// "x-padding-xxl":'padding:var(--x-padding-xxl,20px)',
|
|
51
|
+
// "x-padding-xxxl":'padding:var(--x-padding-xxxl,24px)',
|
|
52
52
|
// "x-padding-4xl":'padding:var(--x-padding-4xl,32px)',
|
|
53
53
|
// "x-padding-5xl":'padding:var(--x-padding-5xl,40px)',
|
|
54
54
|
// "x-padding-6xl":'padding:var(--x-padding-6xl,48px)',
|
|
@@ -69,8 +69,8 @@ export const customStaticClassNames = {
|
|
|
69
69
|
// "x-width-md":'width:var(--x-width-md,560px)',
|
|
70
70
|
// "x-width-lg":'width:var(--x-width-lg,640px)',
|
|
71
71
|
// "x-width-xl":'width:var(--x-width-xl,768px)',
|
|
72
|
-
// "x-width-
|
|
73
|
-
// "x-width-
|
|
72
|
+
// "x-width-xxl":'width:var(--x-width-xxl,1024px)',
|
|
73
|
+
// "x-width-xxxl":'width:var(--x-width-xxxl,1280px)',
|
|
74
74
|
// "x-width-4xl":'width:var(--x-width-4xl,1440px)',
|
|
75
75
|
// "x-width-5xl":'width:var(--x-width-5xl,1600px)',
|
|
76
76
|
// "x-width-6xl":'width:var(--x-width-6xl,1920px)',
|
|
@@ -83,7 +83,7 @@ export const customStaticClassNames = {
|
|
|
83
83
|
// "x-container-max-width-desktop":'max-width:var(--x-container-max-width-desktop,1280px)',
|
|
84
84
|
// "x-paragraph-max-width":'max-width:var(--x-paragraph-max-width,720px)',
|
|
85
85
|
// ---old
|
|
86
|
-
'x-display-
|
|
86
|
+
'x-display-xxl': 'font-size: var(--display-xxl,4.5rem); line-height: 1.25; letter-spacing: -0.02em',
|
|
87
87
|
'x-display-xl': 'font-size: var(--display-xl,3.75rem); line-height: 1.2; letter-spacing: -0.02em',
|
|
88
88
|
'x-display-lg': 'font-size: var(--display-lg,3rem); line-height: 1.25; letter-spacing: -0.02em',
|
|
89
89
|
'x-display-md': 'font-size: var(--display-md,2.25rem); line-height: 1.22; letter-spacing: -0.02em',
|
|
@@ -108,12 +108,12 @@ export const customStaticClassNames = {
|
|
|
108
108
|
'x-text-xs': 'font-size: var(--text-xs,0.75rem); line-height: 1.125rem',
|
|
109
109
|
'fs-xs': 'font-size: var(--text-xs,0.75rem)',
|
|
110
110
|
'font-size-xs': 'font-size: var(--text-xs,0.75rem)',
|
|
111
|
-
'x-text-
|
|
112
|
-
'fs-
|
|
113
|
-
'font-size-
|
|
114
|
-
'x-text-
|
|
115
|
-
'fs-
|
|
116
|
-
'font-size-
|
|
111
|
+
'x-text-xxl': 'font-size: var(--text-xxl,1.5rem); line-height: 1.2',
|
|
112
|
+
'fs-xxl': 'font-size: var(--text-xxl,1.5rem)',
|
|
113
|
+
'font-size-xxl': 'font-size: var(--text-xxl,1.5rem)',
|
|
114
|
+
'x-text-xxxl': 'font-size: var(--text-xxxl,1.875rem); line-height: 1.1',
|
|
115
|
+
'fs-xxxl': 'font-size: var(--text-xxxl,1.875rem)',
|
|
116
|
+
'font-size-xxxl': 'font-size: var(--text-xxxl,1.875rem)',
|
|
117
117
|
'x-text-hero': 'font-size: var(--text-hero,2.25rem); line-height: 1',
|
|
118
118
|
// Blur
|
|
119
119
|
'x-blur-sm': 'backdrop-filter: var(--x-blur-sm,blur(4px))',
|
|
@@ -122,7 +122,7 @@ export const customStaticClassNames = {
|
|
|
122
122
|
'x-blur-xl': 'backdrop-filter: var(--x-blur-xl,blur(20px))',
|
|
123
123
|
// 'x-button-xxl':
|
|
124
124
|
// 'display:inline-flex;justify-content:center;align-items:center;gap:8px;padding:16px 28px;border-radius:8px;box-sizing:border-box',
|
|
125
|
-
// 'x-button-
|
|
125
|
+
// 'x-button-xxl':
|
|
126
126
|
// 'display:inline-flex;justify-content:center;align-items:center;gap:8px;padding:16px 28px;border-radius:8px;box-sizing:border-box',
|
|
127
127
|
// 'x-button-xl':
|
|
128
128
|
// 'display:inline-flex;justify-content:center;align-items:center;gap:8px;padding:12px 20px;border-radius:8px;box-sizing:border-box',
|
|
@@ -134,9 +134,9 @@ export const customStaticClassNames = {
|
|
|
134
134
|
// 'display:inline-flex;justify-content:center;align-items:center;gap:8px;padding:8px 14px;border-radius:8px;box-sizing:border-box',
|
|
135
135
|
// 'x-button-xs':
|
|
136
136
|
// 'display:inline-flex;justify-content:center;align-items:center;gap:8px;padding:8px 12px;border-radius:8px;box-sizing:border-box',
|
|
137
|
-
// 'x-shadow-
|
|
137
|
+
// 'x-shadow-xxxl': 'box-shadow:var(--shadow-xxxl, 0px 32px 64px -12px rgba(16, 24, 40, 0.14))',
|
|
138
138
|
// 'x-shadow-xxxl': 'box-shadow:var(--x-shadow-xxxl, 0px 32px 64px -12px rgba(16, 24, 40, 0.14))',
|
|
139
|
-
// 'x-shadow-
|
|
139
|
+
// 'x-shadow-xxl': 'box-shadow:var(--shadow-xxl, 0px 24px 48px -12px rgba(16, 24, 40, 0.18))',
|
|
140
140
|
// 'x-shadow-xxl': 'box-shadow:var(--x-shadow-xxl, 0px 24px 48px -12px rgba(16, 24, 40, 0.18))',
|
|
141
141
|
// 'x-shadow-xl': 'box-shadow:var(--shadow-xl, 0px 20px 24px -4px rgba(16, 24, 40, 0.08), 0px 8px 8px -4px rgba(16, 24, 40, 0.03))',
|
|
142
142
|
'x-shadow-lg': 'box-shadow:var(--shadow-lg, 0px 12px 16px -4px rgba(16, 24, 40, 0.08), 0px 4px 6px -2px rgba(16, 24, 40, 0.03))',
|
|
@@ -166,7 +166,7 @@ export const customStaticClassNames = {
|
|
|
166
166
|
'x-inline-grid-center': 'display:inline-grid; justify-content:center;align-content:center',
|
|
167
167
|
'x-absolute-center': "position:absolute;margin:auto;top:0;left:0;right:0;bottom:0;",
|
|
168
168
|
'x-absolute-inset': "position:absolute;inset:0",
|
|
169
|
-
'x-absolute-content-inset': 'position:absolute;inset:0
|
|
169
|
+
'x-absolute-content-inset': 'position:absolute;inset:0;content:" "',
|
|
170
170
|
'x-absolute-inset-y': "position:absolute;margin:auto;top:0;bottom:0;",
|
|
171
171
|
'x-absolute-inset-x': "position:absolute;left:0;right:0;",
|
|
172
172
|
'x-fixed-center': "position:fixed;margin:auto;top:0;left:0;right:0;bottom:0;",
|
|
@@ -176,7 +176,7 @@ export const customStaticClassNames = {
|
|
|
176
176
|
// 'x-flex':'display:flex',
|
|
177
177
|
'flex-center': 'display:flex;align-items:center;justify-content:center',
|
|
178
178
|
'inline-flex-center': 'display:inline-flex;align-items:center;justify-content:center',
|
|
179
|
-
'absolute-center': 'position:absolute;top:0;right:0;left:0;bottom:0
|
|
179
|
+
'absolute-center': 'position:absolute;top:0;right:0;left:0;bottom:0;margin:auto',
|
|
180
180
|
'sr-only': 'position:absolute;overflow:hidden;clip:rect(0 0 0 0);height:1px;width:1px;margin:-1px;padding:0;border:0',
|
|
181
181
|
'hidden': 'display:none',
|
|
182
182
|
'x-hidden': 'display:none',
|
|
@@ -215,33 +215,33 @@ export const customStaticClassNames = {
|
|
|
215
215
|
'x-flex-between': 'display:flex;align-items:center;justify-content:space-between',
|
|
216
216
|
'flex-between': 'display:flex;align-items:center;justify-content:space-between',
|
|
217
217
|
// ------new Added
|
|
218
|
-
'min-h-screen':
|
|
219
|
-
'max-w-sm':
|
|
220
|
-
'max-w-md':
|
|
221
|
-
'max-w-lg':
|
|
222
|
-
'max-w-xl':
|
|
223
|
-
'max-w-
|
|
224
|
-
'max-w-full':
|
|
225
|
-
'x-min-h-screen':
|
|
226
|
-
'x-max-w-sm':
|
|
227
|
-
'x-max-w-md':
|
|
228
|
-
'x-max-w-lg':
|
|
229
|
-
'x-max-w-xl':
|
|
230
|
-
'x-max-w-
|
|
231
|
-
'x-max-w-full':
|
|
218
|
+
// 'min-h-screen':'min-height: 100vh',
|
|
219
|
+
// 'max-w-sm':'max-width: 24rem', // 384px
|
|
220
|
+
// 'max-w-md':'max-width: 28rem', // 448px
|
|
221
|
+
// 'max-w-lg':'max-width: 32rem', // 512px
|
|
222
|
+
// 'max-w-xl':'max-width: 36rem', // 576px
|
|
223
|
+
// 'max-w-xxl':'max-width: 42rem', // 672px
|
|
224
|
+
// 'max-w-full':'max-width: 100%',
|
|
225
|
+
// 'x-min-h-screen':'min-height: 100vh',
|
|
226
|
+
// 'x-max-w-sm':'max-width: 24rem', // 384px
|
|
227
|
+
// 'x-max-w-md':'max-width: 28rem', // 448px
|
|
228
|
+
// 'x-max-w-lg':'max-width: 32rem', // 512px
|
|
229
|
+
// 'x-max-w-xl':'max-width: 36rem', // 576px
|
|
230
|
+
// 'x-max-w-xxl':'max-width: 42rem', // 672px
|
|
231
|
+
// 'x-max-w-full':'max-width: 100%',
|
|
232
232
|
'mh-screen': 'min-height: 100vh',
|
|
233
233
|
'xw-sm': 'max-width: 24rem', // 384px
|
|
234
234
|
'xw-md': 'max-width: 28rem', // 448px
|
|
235
235
|
'xw-lg': 'max-width: 32rem', // 512px
|
|
236
236
|
'xw-xl': 'max-width: 36rem', // 576px
|
|
237
|
-
'xw-
|
|
237
|
+
'xw-xxl': 'max-width: 42rem', // 672px
|
|
238
238
|
'xw-full': 'max-width: 100%',
|
|
239
239
|
'x-mh-screen': 'min-height: 100vh',
|
|
240
240
|
'x-xw-sm': 'max-width: 24rem', // 384px
|
|
241
241
|
'x-xw-md': 'max-width: 28rem', // 448px
|
|
242
242
|
'x-xw-lg': 'max-width: 32rem', // 512px
|
|
243
243
|
'x-xw-xl': 'max-width: 36rem', // 576px
|
|
244
|
-
'x-xw-
|
|
244
|
+
'x-xw-xxl': 'max-width: 42rem', // 672px
|
|
245
245
|
'x-xw-full': 'max-width: 100%',
|
|
246
246
|
'truncate': 'overflow: hidden; text-overflow: ellipsis; white-space: nowrap',
|
|
247
247
|
'x-truncate': 'overflow: hidden; text-overflow: ellipsis; white-space: nowrap',
|
|
@@ -130,7 +130,7 @@ export const staticClassNamesAlias = {
|
|
|
130
130
|
'bdbs': 'box-decoration-break: slice',
|
|
131
131
|
'bfi2': 'backdrop-filter:inherit',
|
|
132
132
|
'bfi/inherit': 'backdrop-filter:inherit',
|
|
133
|
-
'bfi/initial': 'backdrop-filter:
|
|
133
|
+
'bfi/initial': 'backdrop-filter:initial',
|
|
134
134
|
'bfi': 'backdrop-filter:initial',
|
|
135
135
|
'bfin': 'backdrop-filter:inherit',
|
|
136
136
|
'bfn': 'backdrop-filter:none',
|
|
@@ -150,7 +150,7 @@ export const staticClassNamesAlias = {
|
|
|
150
150
|
'bgbml2': 'background-blend-mode: luminosity',
|
|
151
151
|
'bgbml': 'background-blend-mode: lighten',
|
|
152
152
|
'bgbml/luminosity': 'background-blend-mode: luminosity',
|
|
153
|
-
'bgbml/
|
|
153
|
+
'bgbml/lighten': 'background-blend-mode: lighten',
|
|
154
154
|
'bgbmlu': 'background-blend-mode: luminosity',
|
|
155
155
|
'bgbmm': 'background-blend-mode: multiply',
|
|
156
156
|
'bgbmn': 'background-blend-mode: normal',
|
|
@@ -505,7 +505,7 @@ export const staticClassNamesAlias = {
|
|
|
505
505
|
'cnsr': 'cursor: ns-resize',
|
|
506
506
|
'cnwr': 'cursor: nw-resize',
|
|
507
507
|
'cnwser': 'cursor: nwse-resize',
|
|
508
|
-
'con': 'content:"
|
|
508
|
+
// 'con': 'content:""',
|
|
509
509
|
'concq': 'content: close-quote',
|
|
510
510
|
'ccq': 'content: close-quote',
|
|
511
511
|
'coni': 'content: icon',
|
|
@@ -577,6 +577,8 @@ export const staticClassNamesAlias = {
|
|
|
577
577
|
'db': 'display: block',
|
|
578
578
|
'dc2': 'display: compact',
|
|
579
579
|
'dc': 'display: container',
|
|
580
|
+
'd/contents': 'display: contents',
|
|
581
|
+
// 'dconts': 'display: container',
|
|
580
582
|
'dc/compact': 'display: compact',
|
|
581
583
|
'dc/container': 'display: container',
|
|
582
584
|
'dcp': 'display: compact',
|
|
@@ -950,7 +952,7 @@ export const staticClassNamesAlias = {
|
|
|
950
952
|
'mbmh': 'mix-blend-mode: hue',
|
|
951
953
|
'mbml2': 'mix-blend-mode: luminosity',
|
|
952
954
|
'mbml': 'mix-blend-mode: lighten',
|
|
953
|
-
'mbml/
|
|
955
|
+
'mbml/luminosity': 'mix-blend-mode: luminosity',
|
|
954
956
|
'mbml/lighten': 'mix-blend-mode: lighten',
|
|
955
957
|
'mbmlu': 'mix-blend-mode: luminosity',
|
|
956
958
|
'mbmm': 'mix-blend-mode: multiply',
|
|
@@ -1226,11 +1228,11 @@ export const staticClassNamesAlias = {
|
|
|
1226
1228
|
'rh': 'resize: horizontal',
|
|
1227
1229
|
'rv': 'resize: vertical',
|
|
1228
1230
|
'sba': 'scroll-behavior:auto',
|
|
1229
|
-
'sbi2': 'scroll-behavior
|
|
1230
|
-
'sbi': 'scroll-behavior
|
|
1231
|
-
'sbi/inherit': 'scroll-behavior
|
|
1232
|
-
'sbi/initial': 'scroll-behavior
|
|
1233
|
-
'sbin': 'scroll-behavior
|
|
1231
|
+
'sbi2': 'scroll-behavior:inherit',
|
|
1232
|
+
'sbi': 'scroll-behavior:initial',
|
|
1233
|
+
'sbi/inherit': 'scroll-behavior:inherit',
|
|
1234
|
+
'sbi/initial': 'scroll-behavior:initial',
|
|
1235
|
+
'sbin': 'scroll-behavior:inherit',
|
|
1234
1236
|
'sbs': 'scroll-behavior:smooth',
|
|
1235
1237
|
'sla': 'stroke-linejoin:arcs',
|
|
1236
1238
|
'slb2': 'stroke-linejoin:bevel',
|
|
@@ -1242,11 +1244,11 @@ export const staticClassNamesAlias = {
|
|
|
1242
1244
|
'slcs': 'stroke-linecap:square',
|
|
1243
1245
|
'slja': 'stroke-linejoin:arcs',
|
|
1244
1246
|
'sljb': 'stroke-linejoin:bevel',
|
|
1245
|
-
'sljm': 'stroke-linejoin:
|
|
1246
|
-
'sljmc': 'stroke-linejoin:
|
|
1247
|
+
'sljm': 'stroke-linejoin:miter',
|
|
1248
|
+
'sljmc': 'stroke-linejoin:miter-clip',
|
|
1247
1249
|
'sljr': 'stroke-linejoin:round',
|
|
1248
|
-
'slm': 'stroke-linejoin:
|
|
1249
|
-
'slmc': 'stroke-linejoin:
|
|
1250
|
+
'slm': 'stroke-linejoin:miter',
|
|
1251
|
+
'slmc': 'stroke-linejoin:miter-clip',
|
|
1250
1252
|
'slr2': 'stroke-linejoin:round',
|
|
1251
1253
|
'slr': 'stroke-linecap:round',
|
|
1252
1254
|
'slr/linejoin': 'stroke-linejoin:round',
|
|
@@ -1307,9 +1309,9 @@ export const staticClassNamesAlias = {
|
|
|
1307
1309
|
'tdn': 'text-decoration: none',
|
|
1308
1310
|
'tdo': 'text-decoration: overline',
|
|
1309
1311
|
'tdsbd': 'text-decoration-skip: box-decoration',
|
|
1310
|
-
'tdsd2': 'text-decoration-style:
|
|
1312
|
+
'tdsd2': 'text-decoration-style:doubled ',
|
|
1311
1313
|
'tdsd3': 'text-decoration-style: dotted',
|
|
1312
|
-
'tdsd': 'text-decoration-style:
|
|
1314
|
+
'tdsd': 'text-decoration-style: dashed',
|
|
1313
1315
|
'tdsd/double': 'text-decoration-style: dashed',
|
|
1314
1316
|
'tdsd/dotted': 'text-decoration-style: dotted',
|
|
1315
1317
|
'tdsd/dashed': 'text-decoration-style: double',
|
|
@@ -1513,7 +1515,7 @@ export const staticClassNamesAlias = {
|
|
|
1513
1515
|
'wsn/spacing': 'word-spacing:normal',
|
|
1514
1516
|
'wsn/nowrap': 'white-space: nowrap',
|
|
1515
1517
|
'wsnl': 'white-space: normal',
|
|
1516
|
-
'wsnw': 'white-space:
|
|
1518
|
+
'wsnw': 'white-space: nowrap',
|
|
1517
1519
|
'wsp': 'white-space: pre',
|
|
1518
1520
|
'wspl': 'white-space: pre-line',
|
|
1519
1521
|
'wspw': 'white-space: pre-wrap',
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
declare const tableComponents: {
|
|
2
|
+
'x-table': {
|
|
3
|
+
type: string;
|
|
4
|
+
statement: string;
|
|
5
|
+
};
|
|
6
|
+
'x-table-striped': {
|
|
7
|
+
type: string;
|
|
8
|
+
statement: string;
|
|
9
|
+
};
|
|
10
|
+
'x-table-bordered': {
|
|
11
|
+
type: string;
|
|
12
|
+
statement: string;
|
|
13
|
+
};
|
|
14
|
+
'x-table-minimal': {
|
|
15
|
+
type: string;
|
|
16
|
+
statement: string;
|
|
17
|
+
};
|
|
18
|
+
'x-table-compact': {
|
|
19
|
+
type: string;
|
|
20
|
+
statement: string;
|
|
21
|
+
};
|
|
22
|
+
'x-table-card': {
|
|
23
|
+
type: string;
|
|
24
|
+
statement: string;
|
|
25
|
+
};
|
|
26
|
+
'x-table-hover': {
|
|
27
|
+
type: string;
|
|
28
|
+
statement: string;
|
|
29
|
+
};
|
|
30
|
+
'x-table-sticky': {
|
|
31
|
+
type: string;
|
|
32
|
+
statement: string;
|
|
33
|
+
};
|
|
34
|
+
'x-table-num': {
|
|
35
|
+
type: string;
|
|
36
|
+
statement: string;
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
export default tableComponents;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
// AliasCSS table components
|
|
2
|
+
// ------------------------------------------------------------------
|
|
3
|
+
// Base: x-table (on <table>)
|
|
4
|
+
// Variants: x-table-striped zebra rows
|
|
5
|
+
// x-table-bordered full cell grid
|
|
6
|
+
// x-table-minimal no row lines, airy
|
|
7
|
+
// x-table-compact dense rows
|
|
8
|
+
// x-table-card (on a wrapper <div>) rounded card + horizontal scroll
|
|
9
|
+
// Behaviors: x-table-hover row hover highlight
|
|
10
|
+
// x-table-sticky sticky header (needs a scroll container, e.g. x-table-card with a max-height)
|
|
11
|
+
// x-table-num (on <th>/<td>) right-aligned tabular numbers
|
|
12
|
+
// Selected rows: <tr aria-selected="true">
|
|
13
|
+
//
|
|
14
|
+
// Variants and behaviors combine: class="x-table x-table-striped x-table-hover x-table-compact"
|
|
15
|
+
//
|
|
16
|
+
// Variables (all optional, with token fallbacks):
|
|
17
|
+
// --x-table-cell-padding (12px 16px) set as --x-table-cell-padding:(6px_12px)
|
|
18
|
+
// --x-table-font-size (14px)
|
|
19
|
+
// --x-table-color (gray700)
|
|
20
|
+
// --x-table-border-color (gray200) row lines / grid
|
|
21
|
+
// --x-table-head-bg (gray50)
|
|
22
|
+
// --x-table-head-color (gray500)
|
|
23
|
+
// --x-table-head-font-size (12px)
|
|
24
|
+
// --x-table-head-border-color (gray200)
|
|
25
|
+
// --x-table-stripe-bg (gray50)
|
|
26
|
+
// --x-table-hover-bg (gray100)
|
|
27
|
+
// --x-table-selected-bg (primary50)
|
|
28
|
+
// --x-table-card-bg (white)
|
|
29
|
+
// --x-table-radius (12px)
|
|
30
|
+
// ------------------------------------------------------------------
|
|
31
|
+
const tableComponents = {
|
|
32
|
+
'x-table': {
|
|
33
|
+
type: 'statement',
|
|
34
|
+
statement: `
|
|
35
|
+
@components[w-100%,border-collapse-separate,border-spacing-0,fs--x-table-font-size:14px,lh-20px,c--x-table-color:gray700,text-align-left]
|
|
36
|
+
@components_th[padding(var(--x-table-cell-padding,12px_16px)),fs--x-table-head-font-size:12px,fw-600,les-0.04em,text-transform-uppercase,c--x-table-head-color:gray500,bgc--x-table-head-bg:gray50,border-bottom-width-1px,border-bottom-style-solid,border-bottom-color--x-table-head-border-color:gray200,vertical-align-bottom,white-space-nowrap]
|
|
37
|
+
@components_td[padding(var(--x-table-cell-padding,12px_16px)),border-bottom-width-1px,border-bottom-style-solid,border-bottom-color--x-table-border-color:gray200,vertical-align-middle]
|
|
38
|
+
@components_tbody__tr[transition-property-background-color,transition-duration-0.15s]
|
|
39
|
+
@components_tbody__tr[aria-selected=true]-bgc--x-table-selected-bg:primary50
|
|
40
|
+
@components_tfoot_td[fw-600,c-gray900,border-bottom-width-0px]
|
|
41
|
+
@components_caption[caption-side-bottom,p-12px-16px,fs-13px,c-gray500,text-align-left]
|
|
42
|
+
`
|
|
43
|
+
},
|
|
44
|
+
// ---------------- Variants ----------------
|
|
45
|
+
'x-table-striped': {
|
|
46
|
+
type: 'statement',
|
|
47
|
+
statement: `@components_tbody__tr--nth-child(even)-bgc--x-table-stripe-bg:gray50`
|
|
48
|
+
},
|
|
49
|
+
'x-table-bordered': {
|
|
50
|
+
type: 'statement',
|
|
51
|
+
statement: `
|
|
52
|
+
@components-border-collapse-collapse
|
|
53
|
+
@components_th[border-width-1px,border-style-solid,border-color--x-table-border-color:gray200]
|
|
54
|
+
@components_td[border-width-1px,border-style-solid,border-color--x-table-border-color:gray200]
|
|
55
|
+
`
|
|
56
|
+
},
|
|
57
|
+
'x-table-minimal': {
|
|
58
|
+
type: 'statement',
|
|
59
|
+
statement: `--x-table-border-color:transparent --x-table-head-bg:transparent --x-table-head-border-color:gray300`
|
|
60
|
+
},
|
|
61
|
+
'x-table-compact': {
|
|
62
|
+
type: 'statement',
|
|
63
|
+
statement: `--x-table-cell-padding:(6px_12px) --x-table-font-size:13px --x-table-head-font-size:11px`
|
|
64
|
+
},
|
|
65
|
+
// Wrapper: <div class="x-table-card"><table class="x-table">…</table></div>
|
|
66
|
+
'x-table-card': {
|
|
67
|
+
type: 'statement',
|
|
68
|
+
statement: `
|
|
69
|
+
@components[d-block,w-100%,overflow-x-auto,box-sizing-border-box,border-width-1px,border-style-solid,border-color--x-table-border-color:gray200,br--x-table-radius:12px,bgc--x-table-card-bg:white]
|
|
70
|
+
@components_tbody__tr--last-child__td-border-bottom-width-0px
|
|
71
|
+
`
|
|
72
|
+
},
|
|
73
|
+
// ---------------- Behaviors ----------------
|
|
74
|
+
// [class] bumps specificity so hover wins over striped rows
|
|
75
|
+
'x-table-hover': {
|
|
76
|
+
type: 'statement',
|
|
77
|
+
statement: `@components-[class]_tbody__tr--hover-bgc--x-table-hover-bg:gray100`
|
|
78
|
+
},
|
|
79
|
+
// Sticks to the nearest scroll container (page, or a wrapper with max-height + overflow)
|
|
80
|
+
'x-table-sticky': {
|
|
81
|
+
type: 'statement',
|
|
82
|
+
statement: `@components_thead_th[position-sticky,t-0,zi-1]`
|
|
83
|
+
},
|
|
84
|
+
// On <th>/<td>: <td class="x-table-num">1,240.50</td>
|
|
85
|
+
'x-table-num': {
|
|
86
|
+
type: 'statement',
|
|
87
|
+
statement: `@components[text-align-right,font-variant-numeric-tabular-nums]`
|
|
88
|
+
},
|
|
89
|
+
};
|
|
90
|
+
export default tableComponents;
|
package/lib/utils/helper.d.ts
CHANGED
|
@@ -11,3 +11,9 @@ export declare function objectToCSS(obj: {
|
|
|
11
11
|
export declare function stylesToCSS(stylesObj: {
|
|
12
12
|
[key: string]: string;
|
|
13
13
|
}, selector: string): string;
|
|
14
|
+
export declare function matchTrailingGroup(s: string): {
|
|
15
|
+
prefix: string;
|
|
16
|
+
body: string;
|
|
17
|
+
} | null;
|
|
18
|
+
export declare function splitTopLevel(str: string): string[];
|
|
19
|
+
export declare const joinGroupItem: (prefix: string, item: string) => string;
|
package/lib/utils/helper.js
CHANGED
|
@@ -79,3 +79,55 @@ export function stylesToCSS(stylesObj, selector) {
|
|
|
79
79
|
.join(' ');
|
|
80
80
|
return cssRules;
|
|
81
81
|
}
|
|
82
|
+
// Find the group: the trailing "]" and the "[" that really opens it.
|
|
83
|
+
// Brackets inside (...) are ignored.
|
|
84
|
+
export function matchTrailingGroup(s) {
|
|
85
|
+
if (!s.endsWith(']'))
|
|
86
|
+
return null;
|
|
87
|
+
let sq = 0;
|
|
88
|
+
let par = 0;
|
|
89
|
+
for (let i = s.length - 1; i >= 0; i--) {
|
|
90
|
+
const c = s[i];
|
|
91
|
+
if (c === ')')
|
|
92
|
+
par++;
|
|
93
|
+
else if (c === '(')
|
|
94
|
+
par--;
|
|
95
|
+
else if (par === 0) {
|
|
96
|
+
if (c === ']')
|
|
97
|
+
sq++;
|
|
98
|
+
else if (c === '[' && --sq === 0)
|
|
99
|
+
return { prefix: s.slice(0, i), body: s.slice(i + 1, -1) };
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
return null;
|
|
103
|
+
}
|
|
104
|
+
// Split on commas that are outside both (...) and [...]
|
|
105
|
+
export function splitTopLevel(str) {
|
|
106
|
+
const out = [];
|
|
107
|
+
let sq = 0;
|
|
108
|
+
let par = 0;
|
|
109
|
+
let cur = '';
|
|
110
|
+
for (const c of str) {
|
|
111
|
+
if (c === '(')
|
|
112
|
+
par++;
|
|
113
|
+
else if (c === ')')
|
|
114
|
+
par--;
|
|
115
|
+
else if (c === '[')
|
|
116
|
+
sq++;
|
|
117
|
+
else if (c === ']')
|
|
118
|
+
sq--;
|
|
119
|
+
if (c === ',' && !sq && !par) {
|
|
120
|
+
out.push(cur);
|
|
121
|
+
cur = '';
|
|
122
|
+
}
|
|
123
|
+
else
|
|
124
|
+
cur += c;
|
|
125
|
+
}
|
|
126
|
+
if (cur)
|
|
127
|
+
out.push(cur);
|
|
128
|
+
return out;
|
|
129
|
+
}
|
|
130
|
+
// Join prefix + item. A combinator item (starts with "_") is attached directly.
|
|
131
|
+
export const joinGroupItem = (prefix, item) => prefix && item.startsWith('_')
|
|
132
|
+
? prefix + item
|
|
133
|
+
: (prefix + '-').replace(/--$/, '-') + item.replace(/^--/, '-');
|