@master/css 2.0.0-rc.48 → 2.0.0-rc.49
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/core.cjs +11 -11
- package/dist/core.d.ts +2 -2
- package/dist/core.mjs +11 -11
- package/dist/syntax-rule.cjs +1 -1
- package/dist/syntax-rule.mjs +1 -1
- package/package.json +1 -1
package/dist/core.cjs
CHANGED
|
@@ -18,14 +18,14 @@ class MasterCSS {
|
|
|
18
18
|
static config = index.config;
|
|
19
19
|
definedRules;
|
|
20
20
|
config;
|
|
21
|
-
|
|
21
|
+
classUsages;
|
|
22
22
|
layerStatementRule;
|
|
23
23
|
rules;
|
|
24
24
|
animationsNonLayer;
|
|
25
25
|
baseLayer;
|
|
26
26
|
themeLayer;
|
|
27
27
|
presetLayer;
|
|
28
|
-
|
|
28
|
+
componentsLayer;
|
|
29
29
|
generalLayer;
|
|
30
30
|
get text() {
|
|
31
31
|
return this.rules.sort((a, b)=>{
|
|
@@ -45,7 +45,7 @@ class MasterCSS {
|
|
|
45
45
|
constructor(customConfig){
|
|
46
46
|
this.customConfig = customConfig;
|
|
47
47
|
this.definedRules = [];
|
|
48
|
-
this.
|
|
48
|
+
this.classUsages = new Map();
|
|
49
49
|
this.layerStatementRule = new rule.Rule('layer-statement', [
|
|
50
50
|
{
|
|
51
51
|
text: '@layer base,theme,preset,components,general;'
|
|
@@ -58,7 +58,7 @@ class MasterCSS {
|
|
|
58
58
|
this.baseLayer = new syntaxLayer('base', this);
|
|
59
59
|
this.themeLayer = new layer('theme', this);
|
|
60
60
|
this.presetLayer = new syntaxLayer('preset', this);
|
|
61
|
-
this.
|
|
61
|
+
this.componentsLayer = new syntaxLayer('components', this);
|
|
62
62
|
this.generalLayer = new syntaxLayer('general', this);
|
|
63
63
|
this.config = customConfig?.override ? extendConfig(customConfig) : extendConfig(index.config, customConfig);
|
|
64
64
|
this.resolve();
|
|
@@ -589,23 +589,23 @@ class MasterCSS {
|
|
|
589
589
|
/**
|
|
590
590
|
* 拿當前所有的 classNames 按照最新的 colors, config.rules 匹配並生成新的 style
|
|
591
591
|
* 所以 refresh 過後 rules 可能會變多也可能會變少
|
|
592
|
-
*/
|
|
593
|
-
this.add(
|
|
594
|
-
}
|
|
592
|
+
*/ this.classUsages.forEach((_, className)=>{
|
|
593
|
+
this.add(className);
|
|
594
|
+
});
|
|
595
595
|
return this;
|
|
596
596
|
}
|
|
597
597
|
reset() {
|
|
598
598
|
this.baseLayer.reset();
|
|
599
599
|
this.themeLayer.reset();
|
|
600
600
|
this.presetLayer.reset();
|
|
601
|
-
this.
|
|
601
|
+
this.componentsLayer.reset();
|
|
602
602
|
this.generalLayer.reset();
|
|
603
603
|
this.animationsNonLayer.reset();
|
|
604
604
|
return this;
|
|
605
605
|
}
|
|
606
606
|
destroy() {
|
|
607
607
|
// @ts-ignore
|
|
608
|
-
this.
|
|
608
|
+
this.classUsages = new Map();
|
|
609
609
|
masterCSSs.splice(masterCSSs.indexOf(this), 1);
|
|
610
610
|
return this;
|
|
611
611
|
}
|
|
@@ -622,7 +622,7 @@ class MasterCSS {
|
|
|
622
622
|
*/ for (const className of classNames){
|
|
623
623
|
if (Object.prototype.hasOwnProperty.call(this.components, className)) {
|
|
624
624
|
for (const eachSyntax of this.components[className]){
|
|
625
|
-
this.
|
|
625
|
+
this.componentsLayer.delete(className + ' ' + eachSyntax);
|
|
626
626
|
}
|
|
627
627
|
} else {
|
|
628
628
|
const atIndex = className.indexOf('@');
|
|
@@ -631,7 +631,7 @@ class MasterCSS {
|
|
|
631
631
|
if (Object.prototype.hasOwnProperty.call(this.components, name)) {
|
|
632
632
|
const atToken = className.slice(atIndex);
|
|
633
633
|
for (const eachSyntax of this.components[name]){
|
|
634
|
-
this.
|
|
634
|
+
this.componentsLayer.delete(eachSyntax + atToken + ' ' + className);
|
|
635
635
|
}
|
|
636
636
|
} else {
|
|
637
637
|
this.generalLayer.delete(className);
|
package/dist/core.d.ts
CHANGED
|
@@ -11,14 +11,14 @@ export default class MasterCSS {
|
|
|
11
11
|
static config: Config;
|
|
12
12
|
readonly definedRules: DefinedRule[];
|
|
13
13
|
readonly config: Config;
|
|
14
|
-
readonly
|
|
14
|
+
readonly classUsages: Map<string, number>;
|
|
15
15
|
readonly layerStatementRule: Rule;
|
|
16
16
|
readonly rules: (Layer | Rule)[];
|
|
17
17
|
readonly animationsNonLayer: NonLayer;
|
|
18
18
|
readonly baseLayer: SyntaxLayer;
|
|
19
19
|
readonly themeLayer: Layer;
|
|
20
20
|
readonly presetLayer: SyntaxLayer;
|
|
21
|
-
readonly
|
|
21
|
+
readonly componentsLayer: SyntaxLayer;
|
|
22
22
|
readonly generalLayer: SyntaxLayer;
|
|
23
23
|
get text(): string;
|
|
24
24
|
constructor(customConfig?: Config | undefined);
|
package/dist/core.mjs
CHANGED
|
@@ -14,14 +14,14 @@ class MasterCSS {
|
|
|
14
14
|
static config = config;
|
|
15
15
|
definedRules;
|
|
16
16
|
config;
|
|
17
|
-
|
|
17
|
+
classUsages;
|
|
18
18
|
layerStatementRule;
|
|
19
19
|
rules;
|
|
20
20
|
animationsNonLayer;
|
|
21
21
|
baseLayer;
|
|
22
22
|
themeLayer;
|
|
23
23
|
presetLayer;
|
|
24
|
-
|
|
24
|
+
componentsLayer;
|
|
25
25
|
generalLayer;
|
|
26
26
|
get text() {
|
|
27
27
|
return this.rules.sort((a, b)=>{
|
|
@@ -41,7 +41,7 @@ class MasterCSS {
|
|
|
41
41
|
constructor(customConfig){
|
|
42
42
|
this.customConfig = customConfig;
|
|
43
43
|
this.definedRules = [];
|
|
44
|
-
this.
|
|
44
|
+
this.classUsages = new Map();
|
|
45
45
|
this.layerStatementRule = new Rule('layer-statement', [
|
|
46
46
|
{
|
|
47
47
|
text: '@layer base,theme,preset,components,general;'
|
|
@@ -54,7 +54,7 @@ class MasterCSS {
|
|
|
54
54
|
this.baseLayer = new SyntaxLayer('base', this);
|
|
55
55
|
this.themeLayer = new Layer('theme', this);
|
|
56
56
|
this.presetLayer = new SyntaxLayer('preset', this);
|
|
57
|
-
this.
|
|
57
|
+
this.componentsLayer = new SyntaxLayer('components', this);
|
|
58
58
|
this.generalLayer = new SyntaxLayer('general', this);
|
|
59
59
|
this.config = customConfig?.override ? extendConfig(customConfig) : extendConfig(config, customConfig);
|
|
60
60
|
this.resolve();
|
|
@@ -585,23 +585,23 @@ class MasterCSS {
|
|
|
585
585
|
/**
|
|
586
586
|
* 拿當前所有的 classNames 按照最新的 colors, config.rules 匹配並生成新的 style
|
|
587
587
|
* 所以 refresh 過後 rules 可能會變多也可能會變少
|
|
588
|
-
*/
|
|
589
|
-
this.add(
|
|
590
|
-
}
|
|
588
|
+
*/ this.classUsages.forEach((_, className)=>{
|
|
589
|
+
this.add(className);
|
|
590
|
+
});
|
|
591
591
|
return this;
|
|
592
592
|
}
|
|
593
593
|
reset() {
|
|
594
594
|
this.baseLayer.reset();
|
|
595
595
|
this.themeLayer.reset();
|
|
596
596
|
this.presetLayer.reset();
|
|
597
|
-
this.
|
|
597
|
+
this.componentsLayer.reset();
|
|
598
598
|
this.generalLayer.reset();
|
|
599
599
|
this.animationsNonLayer.reset();
|
|
600
600
|
return this;
|
|
601
601
|
}
|
|
602
602
|
destroy() {
|
|
603
603
|
// @ts-ignore
|
|
604
|
-
this.
|
|
604
|
+
this.classUsages = new Map();
|
|
605
605
|
masterCSSs.splice(masterCSSs.indexOf(this), 1);
|
|
606
606
|
return this;
|
|
607
607
|
}
|
|
@@ -618,7 +618,7 @@ class MasterCSS {
|
|
|
618
618
|
*/ for (const className of classNames){
|
|
619
619
|
if (Object.prototype.hasOwnProperty.call(this.components, className)) {
|
|
620
620
|
for (const eachSyntax of this.components[className]){
|
|
621
|
-
this.
|
|
621
|
+
this.componentsLayer.delete(className + ' ' + eachSyntax);
|
|
622
622
|
}
|
|
623
623
|
} else {
|
|
624
624
|
const atIndex = className.indexOf('@');
|
|
@@ -627,7 +627,7 @@ class MasterCSS {
|
|
|
627
627
|
if (Object.prototype.hasOwnProperty.call(this.components, name)) {
|
|
628
628
|
const atToken = className.slice(atIndex);
|
|
629
629
|
for (const eachSyntax of this.components[name]){
|
|
630
|
-
this.
|
|
630
|
+
this.componentsLayer.delete(eachSyntax + atToken + ' ' + className);
|
|
631
631
|
}
|
|
632
632
|
} else {
|
|
633
633
|
this.generalLayer.delete(className);
|
package/dist/syntax-rule.cjs
CHANGED
package/dist/syntax-rule.mjs
CHANGED
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.0","@master/normal.css":"^3.1.0","@techor/extend":"^3.1.7","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.0","@master/normal.css":"^3.1.0","@techor/extend":"^3.1.7","csstype":"^3.1.3"},"devDependencies":{"shared":"^2.0.0-rc.49"},"version":"2.0.0-rc.49"}
|