@master/css 2.0.0-rc.66 → 2.0.0-rc.67
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/config/rules.cjs +7 -0
- package/dist/config/rules.d.ts +1469 -278
- package/dist/config/rules.mjs +7 -0
- package/dist/config/utilities.cjs +11 -3
- package/dist/config/utilities.d.ts +10 -2
- package/dist/config/utilities.mjs +11 -3
- package/dist/core.cjs +34 -43
- package/dist/core.mjs +34 -43
- package/package.json +1 -1
- package/dist/config/styles.cjs +0 -2
- package/dist/config/styles.d.ts +0 -3
- package/dist/config/styles.mjs +0 -1
package/dist/config/rules.mjs
CHANGED
|
@@ -171,6 +171,10 @@ const rules = {
|
|
|
171
171
|
'-webkit-font-smoothing': 'antialiased',
|
|
172
172
|
'-moz-osx-font-smoothing': 'grayscale'
|
|
173
173
|
};
|
|
174
|
+
default:
|
|
175
|
+
return {
|
|
176
|
+
'font-smooth': value
|
|
177
|
+
};
|
|
174
178
|
}
|
|
175
179
|
}
|
|
176
180
|
},
|
|
@@ -792,6 +796,9 @@ const rules = {
|
|
|
792
796
|
key: 'cols',
|
|
793
797
|
type: SyntaxRuleType.NativeShorthand
|
|
794
798
|
},
|
|
799
|
+
'overflow-wrap': {
|
|
800
|
+
type: SyntaxRuleType.Native
|
|
801
|
+
},
|
|
795
802
|
'white-space': {
|
|
796
803
|
type: SyntaxRuleType.Native
|
|
797
804
|
},
|
|
@@ -89,7 +89,7 @@ const utilities = {
|
|
|
89
89
|
isolate: {
|
|
90
90
|
isolation: 'isolate'
|
|
91
91
|
},
|
|
92
|
-
|
|
92
|
+
overflow: {
|
|
93
93
|
overflow: 'visible'
|
|
94
94
|
},
|
|
95
95
|
untouchable: {
|
|
@@ -190,8 +190,16 @@ const utilities = {
|
|
|
190
190
|
'white-space': 'break-spaces'
|
|
191
191
|
},
|
|
192
192
|
'break-word': {
|
|
193
|
-
'
|
|
194
|
-
|
|
193
|
+
'word-break': 'break-word'
|
|
194
|
+
},
|
|
195
|
+
'wrap-break-word': {
|
|
196
|
+
'overflow-wrap': 'break-word'
|
|
197
|
+
},
|
|
198
|
+
'wrap-anywhere': {
|
|
199
|
+
'overflow-wrap': 'anywhere'
|
|
200
|
+
},
|
|
201
|
+
'wrap-normal': {
|
|
202
|
+
'overflow-wrap': 'normal'
|
|
195
203
|
},
|
|
196
204
|
'gradient-text': {
|
|
197
205
|
'-webkit-text-fill-color': 'transparent',
|
|
@@ -87,7 +87,7 @@ declare const utilities: {
|
|
|
87
87
|
readonly isolate: {
|
|
88
88
|
readonly isolation: "isolate";
|
|
89
89
|
};
|
|
90
|
-
readonly
|
|
90
|
+
readonly overflow: {
|
|
91
91
|
readonly overflow: "visible";
|
|
92
92
|
};
|
|
93
93
|
readonly untouchable: {
|
|
@@ -188,8 +188,16 @@ declare const utilities: {
|
|
|
188
188
|
readonly 'white-space': "break-spaces";
|
|
189
189
|
};
|
|
190
190
|
readonly 'break-word': {
|
|
191
|
+
readonly 'word-break': "break-word";
|
|
192
|
+
};
|
|
193
|
+
readonly 'wrap-break-word': {
|
|
191
194
|
readonly 'overflow-wrap': "break-word";
|
|
192
|
-
|
|
195
|
+
};
|
|
196
|
+
readonly 'wrap-anywhere': {
|
|
197
|
+
readonly 'overflow-wrap': "anywhere";
|
|
198
|
+
};
|
|
199
|
+
readonly 'wrap-normal': {
|
|
200
|
+
readonly 'overflow-wrap': "normal";
|
|
193
201
|
};
|
|
194
202
|
readonly 'gradient-text': {
|
|
195
203
|
readonly '-webkit-text-fill-color': "transparent";
|
|
@@ -87,7 +87,7 @@ const utilities = {
|
|
|
87
87
|
isolate: {
|
|
88
88
|
isolation: 'isolate'
|
|
89
89
|
},
|
|
90
|
-
|
|
90
|
+
overflow: {
|
|
91
91
|
overflow: 'visible'
|
|
92
92
|
},
|
|
93
93
|
untouchable: {
|
|
@@ -188,8 +188,16 @@ const utilities = {
|
|
|
188
188
|
'white-space': 'break-spaces'
|
|
189
189
|
},
|
|
190
190
|
'break-word': {
|
|
191
|
-
'
|
|
192
|
-
|
|
191
|
+
'word-break': 'break-word'
|
|
192
|
+
},
|
|
193
|
+
'wrap-break-word': {
|
|
194
|
+
'overflow-wrap': 'break-word'
|
|
195
|
+
},
|
|
196
|
+
'wrap-anywhere': {
|
|
197
|
+
'overflow-wrap': 'anywhere'
|
|
198
|
+
},
|
|
199
|
+
'wrap-normal': {
|
|
200
|
+
'overflow-wrap': 'normal'
|
|
193
201
|
},
|
|
194
202
|
'gradient-text': {
|
|
195
203
|
'-webkit-text-fill-color': 'transparent',
|
package/dist/core.cjs
CHANGED
|
@@ -224,52 +224,41 @@ class MasterCSS {
|
|
|
224
224
|
resolveComponents() {
|
|
225
225
|
const { components } = this.config;
|
|
226
226
|
const flatComps = components ? flattenObject.flattenObject(components) : {};
|
|
227
|
-
const
|
|
228
|
-
const
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
227
|
+
const flatNames = Object.keys(flatComps);
|
|
228
|
+
const resolve = (name, currentClasses = [])=>{
|
|
229
|
+
const compClasses = this.components.get(name);
|
|
230
|
+
if (compClasses) {
|
|
231
|
+
currentClasses.push(...compClasses);
|
|
232
|
+
return;
|
|
233
|
+
}
|
|
234
234
|
const className = flatComps[name];
|
|
235
|
-
if (!className)
|
|
236
|
-
const
|
|
237
|
-
const
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
seen.add(cls);
|
|
241
|
-
currentClass.push(cls);
|
|
242
|
-
}
|
|
243
|
-
};
|
|
244
|
-
for (const eachClassName of classNames){
|
|
245
|
-
if (nameSet.has(eachClassName)) {
|
|
246
|
-
addClass(eachClassName);
|
|
247
|
-
// Lazy expand dependencies if not processed
|
|
248
|
-
if (!this.components.has(eachClassName)) {
|
|
249
|
-
const componentClass = flatComps[eachClassName];
|
|
250
|
-
if (componentClass) {
|
|
251
|
-
this.components.set(eachClassName, []) // placeholder to prevent infinite loop
|
|
252
|
-
;
|
|
253
|
-
// Recursively resolve
|
|
254
|
-
const depClassNames = componentClass.replace(/(?:\n\s*)+/g, ' ').trim().split(' ');
|
|
255
|
-
depClassNames.forEach(addClass);
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
const componentClasses = this.components.get(eachClassName);
|
|
259
|
-
componentClasses?.forEach(addClass);
|
|
235
|
+
if (!className) return;
|
|
236
|
+
const classes = className.replace(/(?:\n\s*)+/g, ' ').trim().split(' ');
|
|
237
|
+
for (const cls of classes){
|
|
238
|
+
if (flatNames.includes(cls)) {
|
|
239
|
+
resolve(cls, currentClasses);
|
|
260
240
|
} else {
|
|
261
|
-
|
|
241
|
+
currentClasses.push(cls);
|
|
262
242
|
}
|
|
263
243
|
}
|
|
244
|
+
this.components.set(name, [
|
|
245
|
+
...currentClasses
|
|
246
|
+
]);
|
|
247
|
+
};
|
|
248
|
+
// First pass: expand class names recursively
|
|
249
|
+
for (const name of flatNames){
|
|
250
|
+
resolve(name);
|
|
264
251
|
}
|
|
265
252
|
// Second pass: convert to grouped syntax rule strings
|
|
266
|
-
this.components.forEach((
|
|
253
|
+
this.components.forEach((compClasses, componentName)=>{
|
|
267
254
|
const syntaxRulesByStateToken = {};
|
|
268
|
-
for (const syntax of
|
|
255
|
+
for (const syntax of compClasses){
|
|
269
256
|
const parsed = this.create(syntax);
|
|
270
|
-
if (parsed?.
|
|
257
|
+
if (parsed?.valid) {
|
|
271
258
|
const group = syntaxRulesByStateToken[parsed.stateToken] ||= [];
|
|
272
259
|
group.push(parsed);
|
|
260
|
+
} else {
|
|
261
|
+
console.error(`Invalid class "${syntax}" found in ${componentName} component.`);
|
|
273
262
|
}
|
|
274
263
|
}
|
|
275
264
|
const result = Object.entries(syntaxRulesByStateToken).map(([stateToken, syntaxRules])=>{
|
|
@@ -554,22 +543,24 @@ class MasterCSS {
|
|
|
554
543
|
* @returns SyntaxRule[]
|
|
555
544
|
*/ generate(className, mode) {
|
|
556
545
|
let syntaxRules = [];
|
|
557
|
-
const
|
|
558
|
-
if (
|
|
559
|
-
|
|
560
|
-
const syntaxRule = this.create(
|
|
546
|
+
const compClasses = this.components.get(className);
|
|
547
|
+
if (compClasses) {
|
|
548
|
+
compClasses.forEach((cls)=>{
|
|
549
|
+
const syntaxRule = this.create(cls, className, mode);
|
|
561
550
|
if (syntaxRule && syntaxRule.valid) {
|
|
562
551
|
syntaxRules.push(syntaxRule);
|
|
552
|
+
} else {
|
|
553
|
+
console.error(`Invalid syntax class "${cls}" is in ${className} component.`);
|
|
563
554
|
}
|
|
564
555
|
});
|
|
565
556
|
} else {
|
|
566
557
|
const atIndex = className.indexOf('@');
|
|
567
558
|
if (atIndex !== -1) {
|
|
568
559
|
const name = className.slice(0, atIndex);
|
|
569
|
-
const
|
|
570
|
-
if (
|
|
560
|
+
const compClasses = this.components.get(name);
|
|
561
|
+
if (compClasses) {
|
|
571
562
|
const atToken = className.slice(atIndex);
|
|
572
|
-
|
|
563
|
+
compClasses.forEach((eachSyntax)=>{
|
|
573
564
|
const syntaxRule = this.create(eachSyntax + atToken, className, mode);
|
|
574
565
|
if (syntaxRule && syntaxRule.valid) {
|
|
575
566
|
syntaxRules.push(syntaxRule);
|
package/dist/core.mjs
CHANGED
|
@@ -222,52 +222,41 @@ class MasterCSS {
|
|
|
222
222
|
resolveComponents() {
|
|
223
223
|
const { components } = this.config;
|
|
224
224
|
const flatComps = components ? flattenObject(components) : {};
|
|
225
|
-
const
|
|
226
|
-
const
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
225
|
+
const flatNames = Object.keys(flatComps);
|
|
226
|
+
const resolve = (name, currentClasses = [])=>{
|
|
227
|
+
const compClasses = this.components.get(name);
|
|
228
|
+
if (compClasses) {
|
|
229
|
+
currentClasses.push(...compClasses);
|
|
230
|
+
return;
|
|
231
|
+
}
|
|
232
232
|
const className = flatComps[name];
|
|
233
|
-
if (!className)
|
|
234
|
-
const
|
|
235
|
-
const
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
seen.add(cls);
|
|
239
|
-
currentClass.push(cls);
|
|
240
|
-
}
|
|
241
|
-
};
|
|
242
|
-
for (const eachClassName of classNames){
|
|
243
|
-
if (nameSet.has(eachClassName)) {
|
|
244
|
-
addClass(eachClassName);
|
|
245
|
-
// Lazy expand dependencies if not processed
|
|
246
|
-
if (!this.components.has(eachClassName)) {
|
|
247
|
-
const componentClass = flatComps[eachClassName];
|
|
248
|
-
if (componentClass) {
|
|
249
|
-
this.components.set(eachClassName, []) // placeholder to prevent infinite loop
|
|
250
|
-
;
|
|
251
|
-
// Recursively resolve
|
|
252
|
-
const depClassNames = componentClass.replace(/(?:\n\s*)+/g, ' ').trim().split(' ');
|
|
253
|
-
depClassNames.forEach(addClass);
|
|
254
|
-
}
|
|
255
|
-
}
|
|
256
|
-
const componentClasses = this.components.get(eachClassName);
|
|
257
|
-
componentClasses?.forEach(addClass);
|
|
233
|
+
if (!className) return;
|
|
234
|
+
const classes = className.replace(/(?:\n\s*)+/g, ' ').trim().split(' ');
|
|
235
|
+
for (const cls of classes){
|
|
236
|
+
if (flatNames.includes(cls)) {
|
|
237
|
+
resolve(cls, currentClasses);
|
|
258
238
|
} else {
|
|
259
|
-
|
|
239
|
+
currentClasses.push(cls);
|
|
260
240
|
}
|
|
261
241
|
}
|
|
242
|
+
this.components.set(name, [
|
|
243
|
+
...currentClasses
|
|
244
|
+
]);
|
|
245
|
+
};
|
|
246
|
+
// First pass: expand class names recursively
|
|
247
|
+
for (const name of flatNames){
|
|
248
|
+
resolve(name);
|
|
262
249
|
}
|
|
263
250
|
// Second pass: convert to grouped syntax rule strings
|
|
264
|
-
this.components.forEach((
|
|
251
|
+
this.components.forEach((compClasses, componentName)=>{
|
|
265
252
|
const syntaxRulesByStateToken = {};
|
|
266
|
-
for (const syntax of
|
|
253
|
+
for (const syntax of compClasses){
|
|
267
254
|
const parsed = this.create(syntax);
|
|
268
|
-
if (parsed?.
|
|
255
|
+
if (parsed?.valid) {
|
|
269
256
|
const group = syntaxRulesByStateToken[parsed.stateToken] ||= [];
|
|
270
257
|
group.push(parsed);
|
|
258
|
+
} else {
|
|
259
|
+
console.error(`Invalid class "${syntax}" found in ${componentName} component.`);
|
|
271
260
|
}
|
|
272
261
|
}
|
|
273
262
|
const result = Object.entries(syntaxRulesByStateToken).map(([stateToken, syntaxRules])=>{
|
|
@@ -552,22 +541,24 @@ class MasterCSS {
|
|
|
552
541
|
* @returns SyntaxRule[]
|
|
553
542
|
*/ generate(className, mode) {
|
|
554
543
|
let syntaxRules = [];
|
|
555
|
-
const
|
|
556
|
-
if (
|
|
557
|
-
|
|
558
|
-
const syntaxRule = this.create(
|
|
544
|
+
const compClasses = this.components.get(className);
|
|
545
|
+
if (compClasses) {
|
|
546
|
+
compClasses.forEach((cls)=>{
|
|
547
|
+
const syntaxRule = this.create(cls, className, mode);
|
|
559
548
|
if (syntaxRule && syntaxRule.valid) {
|
|
560
549
|
syntaxRules.push(syntaxRule);
|
|
550
|
+
} else {
|
|
551
|
+
console.error(`Invalid syntax class "${cls}" is in ${className} component.`);
|
|
561
552
|
}
|
|
562
553
|
});
|
|
563
554
|
} else {
|
|
564
555
|
const atIndex = className.indexOf('@');
|
|
565
556
|
if (atIndex !== -1) {
|
|
566
557
|
const name = className.slice(0, atIndex);
|
|
567
|
-
const
|
|
568
|
-
if (
|
|
558
|
+
const compClasses = this.components.get(name);
|
|
559
|
+
if (compClasses) {
|
|
569
560
|
const atToken = className.slice(atIndex);
|
|
570
|
-
|
|
561
|
+
compClasses.forEach((eachSyntax)=>{
|
|
571
562
|
const syntaxRule = this.create(eachSyntax + atToken, className, mode);
|
|
572
563
|
if (syntaxRule && syntaxRule.valid) {
|
|
573
564
|
syntaxRules.push(syntaxRule);
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"@master/css","type":"module","scripts":{"build":"techor build \"src/**/*.ts\"","dev":"pnpm build --watch","test":"vitest","type-check":"tsc --noEmit","lint":"eslint"},"license":"MIT","description":"The CSS language and framework for rapidly building modern and high-performance websites","author":"Aoyue Design LLC.","funding":"https://rc.css.master.co/sponsor","homepage":"https://css.master.co","bugs":{"url":"https://github.com/master-co/css/issues"},"repository":{"type":"git","url":"https://github.com/master-co/css.git","directory":"packages/core"},"keywords":["style","styles","html","variants","virtual","virtual-css","utility","css","ui","lightweight","class","webpack","plugin","integration","vite","parcel","build-tools","mastercss"],"sideEffects":false,"main":"./dist/index.cjs","jsnext:main":"./dist/index.mjs","esnext":"./dist/index.mjs","module":"./dist/index.mjs","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","require":"./dist/index.cjs","import":"./dist/index.mjs"}},"bin":"./dist/bin/index.mjs","files":["dist"],"publishConfig":{"access":"public","provenance":true},"dependencies":{"@master/colors":"^2.1.1","@master/normal.css":"^3.2.0","@techor/extend":"^3.2.0","csstype":"^3.1.3"},"devDependencies":{"shared":"^2.0.0-rc.
|
|
1
|
+
{"name":"@master/css","type":"module","scripts":{"build":"techor build \"src/**/*.ts\"","dev":"pnpm build --watch","test":"vitest","type-check":"tsc --noEmit","lint":"eslint"},"license":"MIT","description":"The CSS language and framework for rapidly building modern and high-performance websites","author":"Aoyue Design LLC.","funding":"https://rc.css.master.co/sponsor","homepage":"https://css.master.co","bugs":{"url":"https://github.com/master-co/css/issues"},"repository":{"type":"git","url":"https://github.com/master-co/css.git","directory":"packages/core"},"keywords":["style","styles","html","variants","virtual","virtual-css","utility","css","ui","lightweight","class","webpack","plugin","integration","vite","parcel","build-tools","mastercss"],"sideEffects":false,"main":"./dist/index.cjs","jsnext:main":"./dist/index.mjs","esnext":"./dist/index.mjs","module":"./dist/index.mjs","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","require":"./dist/index.cjs","import":"./dist/index.mjs"}},"bin":"./dist/bin/index.mjs","files":["dist"],"publishConfig":{"access":"public","provenance":true},"dependencies":{"@master/colors":"^2.1.1","@master/normal.css":"^3.2.0","@techor/extend":"^3.2.0","csstype":"^3.1.3"},"devDependencies":{"shared":"^2.0.0-rc.67"},"version":"2.0.0-rc.67"}
|
package/dist/config/styles.cjs
DELETED
package/dist/config/styles.d.ts
DELETED
package/dist/config/styles.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
|