@master/css 2.0.0-rc.54 → 2.0.0-rc.56
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 +9 -17
- package/dist/core.d.ts +1 -3
- package/dist/core.mjs +9 -14
- package/dist/index.cjs +2 -3
- package/dist/index.mjs +1 -1
- package/dist/register-global.cjs +7 -0
- package/dist/register-global.d.ts +5 -0
- package/dist/register-global.mjs +5 -0
- package/dist/utils/generate-css.cjs +1 -1
- package/dist/utils/reorder-for-readable-classes.cjs +1 -1
- package/package.json +1 -1
- package/dist/types/global.cjs +0 -2
- package/dist/types/global.d.ts +0 -5
- package/dist/types/global.mjs +0 -1
package/dist/core.cjs
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
3
|
var syntaxRule = require('./syntax-rule.cjs');
|
|
6
4
|
var index = require('./config/index.cjs');
|
|
7
5
|
var hexToRgb = require('./utils/hex-to-rgb.cjs');
|
|
@@ -12,13 +10,14 @@ var rule = require('./rule.cjs');
|
|
|
12
10
|
var syntaxRuleType = require('./syntax-rule-type.cjs');
|
|
13
11
|
var layer = require('./layer.cjs');
|
|
14
12
|
var nonLayer = require('./non-layer.cjs');
|
|
13
|
+
var registerGlobal = require('./register-global.cjs');
|
|
15
14
|
|
|
16
15
|
class MasterCSS {
|
|
17
16
|
customConfig;
|
|
18
17
|
static config = index.config;
|
|
19
18
|
definedRules;
|
|
20
19
|
config;
|
|
21
|
-
|
|
20
|
+
classCounts;
|
|
22
21
|
layerStatementRule;
|
|
23
22
|
rules;
|
|
24
23
|
animationsNonLayer;
|
|
@@ -45,7 +44,7 @@ class MasterCSS {
|
|
|
45
44
|
constructor(customConfig){
|
|
46
45
|
this.customConfig = customConfig;
|
|
47
46
|
this.definedRules = [];
|
|
48
|
-
this.
|
|
47
|
+
this.classCounts = new Map();
|
|
49
48
|
this.layerStatementRule = new rule.Rule('layer-statement', [
|
|
50
49
|
{
|
|
51
50
|
text: '@layer base,theme,preset,components,general;'
|
|
@@ -62,9 +61,6 @@ class MasterCSS {
|
|
|
62
61
|
this.generalLayer = new syntaxLayer('general', this);
|
|
63
62
|
this.config = customConfig?.override ? extendConfig(customConfig) : extendConfig(index.config, customConfig);
|
|
64
63
|
this.resolve();
|
|
65
|
-
if (this.constructor === MasterCSS) {
|
|
66
|
-
masterCSSs.push(this);
|
|
67
|
-
}
|
|
68
64
|
}
|
|
69
65
|
resolve() {
|
|
70
66
|
this.components = {};
|
|
@@ -672,7 +668,7 @@ class MasterCSS {
|
|
|
672
668
|
/**
|
|
673
669
|
* 拿當前所有的 classNames 按照最新的 colors, config.rules 匹配並生成新的 style
|
|
674
670
|
* 所以 refresh 過後 rules 可能會變多也可能會變少
|
|
675
|
-
*/ this.
|
|
671
|
+
*/ this.classCounts.forEach((_, className)=>{
|
|
676
672
|
this.add(className);
|
|
677
673
|
});
|
|
678
674
|
return this;
|
|
@@ -688,8 +684,7 @@ class MasterCSS {
|
|
|
688
684
|
}
|
|
689
685
|
destroy() {
|
|
690
686
|
this.reset();
|
|
691
|
-
this.
|
|
692
|
-
masterCSSs.splice(masterCSSs.indexOf(this), 1);
|
|
687
|
+
this.classCounts.clear();
|
|
693
688
|
return this;
|
|
694
689
|
}
|
|
695
690
|
add(...classNames) {
|
|
@@ -737,11 +732,8 @@ class MasterCSS {
|
|
|
737
732
|
}
|
|
738
733
|
}
|
|
739
734
|
}
|
|
740
|
-
|
|
741
|
-
(
|
|
742
|
-
|
|
743
|
-
globalThis.masterCSSs = masterCSSs;
|
|
744
|
-
})();
|
|
735
|
+
(function(MasterCSS) {
|
|
736
|
+
registerGlobal(MasterCSS);
|
|
737
|
+
})(MasterCSS);
|
|
745
738
|
|
|
746
|
-
exports
|
|
747
|
-
exports.masterCSSs = masterCSSs;
|
|
739
|
+
module.exports = MasterCSS;
|
package/dist/core.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { SyntaxRule } from './syntax-rule';
|
|
2
|
-
import './types/global';
|
|
3
2
|
import SyntaxLayer from './syntax-layer';
|
|
4
3
|
import { Rule } from './rule';
|
|
5
4
|
import Layer from './layer';
|
|
@@ -12,7 +11,7 @@ export default class MasterCSS {
|
|
|
12
11
|
static config: Config;
|
|
13
12
|
readonly definedRules: DefinedRule[];
|
|
14
13
|
readonly config: Config;
|
|
15
|
-
readonly
|
|
14
|
+
readonly classCounts: Map<string, number>;
|
|
16
15
|
readonly layerStatementRule: Rule;
|
|
17
16
|
readonly rules: (Layer | Rule)[];
|
|
18
17
|
readonly animationsNonLayer: NonLayer;
|
|
@@ -58,7 +57,6 @@ export default class MasterCSS {
|
|
|
58
57
|
remove(...classNames: string[]): void;
|
|
59
58
|
getModeSelector(modeName: string): string | undefined;
|
|
60
59
|
}
|
|
61
|
-
export declare const masterCSSs: MasterCSS[];
|
|
62
60
|
export default interface MasterCSS {
|
|
63
61
|
supportVendors: Set<Vendors>;
|
|
64
62
|
style: HTMLStyleElement | null;
|
package/dist/core.mjs
CHANGED
|
@@ -8,13 +8,14 @@ import { Rule } from './rule.mjs';
|
|
|
8
8
|
import SyntaxRuleType from './syntax-rule-type.mjs';
|
|
9
9
|
import Layer from './layer.mjs';
|
|
10
10
|
import NonLayer from './non-layer.mjs';
|
|
11
|
+
import registerGlobal from './register-global.mjs';
|
|
11
12
|
|
|
12
13
|
class MasterCSS {
|
|
13
14
|
customConfig;
|
|
14
15
|
static config = config;
|
|
15
16
|
definedRules;
|
|
16
17
|
config;
|
|
17
|
-
|
|
18
|
+
classCounts;
|
|
18
19
|
layerStatementRule;
|
|
19
20
|
rules;
|
|
20
21
|
animationsNonLayer;
|
|
@@ -41,7 +42,7 @@ class MasterCSS {
|
|
|
41
42
|
constructor(customConfig){
|
|
42
43
|
this.customConfig = customConfig;
|
|
43
44
|
this.definedRules = [];
|
|
44
|
-
this.
|
|
45
|
+
this.classCounts = new Map();
|
|
45
46
|
this.layerStatementRule = new Rule('layer-statement', [
|
|
46
47
|
{
|
|
47
48
|
text: '@layer base,theme,preset,components,general;'
|
|
@@ -58,9 +59,6 @@ class MasterCSS {
|
|
|
58
59
|
this.generalLayer = new SyntaxLayer('general', this);
|
|
59
60
|
this.config = customConfig?.override ? extendConfig(customConfig) : extendConfig(config, customConfig);
|
|
60
61
|
this.resolve();
|
|
61
|
-
if (this.constructor === MasterCSS) {
|
|
62
|
-
masterCSSs.push(this);
|
|
63
|
-
}
|
|
64
62
|
}
|
|
65
63
|
resolve() {
|
|
66
64
|
this.components = {};
|
|
@@ -668,7 +666,7 @@ class MasterCSS {
|
|
|
668
666
|
/**
|
|
669
667
|
* 拿當前所有的 classNames 按照最新的 colors, config.rules 匹配並生成新的 style
|
|
670
668
|
* 所以 refresh 過後 rules 可能會變多也可能會變少
|
|
671
|
-
*/ this.
|
|
669
|
+
*/ this.classCounts.forEach((_, className)=>{
|
|
672
670
|
this.add(className);
|
|
673
671
|
});
|
|
674
672
|
return this;
|
|
@@ -684,8 +682,7 @@ class MasterCSS {
|
|
|
684
682
|
}
|
|
685
683
|
destroy() {
|
|
686
684
|
this.reset();
|
|
687
|
-
this.
|
|
688
|
-
masterCSSs.splice(masterCSSs.indexOf(this), 1);
|
|
685
|
+
this.classCounts.clear();
|
|
689
686
|
return this;
|
|
690
687
|
}
|
|
691
688
|
add(...classNames) {
|
|
@@ -733,10 +730,8 @@ class MasterCSS {
|
|
|
733
730
|
}
|
|
734
731
|
}
|
|
735
732
|
}
|
|
736
|
-
|
|
737
|
-
(
|
|
738
|
-
|
|
739
|
-
globalThis.masterCSSs = masterCSSs;
|
|
740
|
-
})();
|
|
733
|
+
(function(MasterCSS) {
|
|
734
|
+
registerGlobal(MasterCSS);
|
|
735
|
+
})(MasterCSS);
|
|
741
736
|
|
|
742
|
-
export { MasterCSS as default
|
|
737
|
+
export { MasterCSS as default };
|
package/dist/index.cjs
CHANGED
|
@@ -53,9 +53,8 @@ exports.TRANSITION_SIGN = common.TRANSITION_SIGN;
|
|
|
53
53
|
exports.UNIT_REGEX = common.UNIT_REGEX;
|
|
54
54
|
exports.VALUE_DELIMITERS = common.VALUE_DELIMITERS;
|
|
55
55
|
exports.VALUE_UNITS = common.VALUE_UNITS;
|
|
56
|
-
exports.MasterCSS = core
|
|
57
|
-
exports.default = core
|
|
58
|
-
exports.masterCSSs = core.masterCSSs;
|
|
56
|
+
exports.MasterCSS = core;
|
|
57
|
+
exports.default = core;
|
|
59
58
|
exports.SyntaxRule = syntaxRule.SyntaxRule;
|
|
60
59
|
exports.Rule = rule.Rule;
|
|
61
60
|
exports.Layer = layer;
|
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { config } from './config/index.mjs';
|
|
2
2
|
export { ANIMATION_SIGN, AT_SIGN, BASE_UNIT_REGEX, BORDER_STYLE_VALUES, CLASS_ATTRIBUTES, CLASS_DECLARATIONS, CLASS_FUNCTIONS, COLOR_VALUE_REGEX, DELIMITER_SIGN, IMAGE_VALUE_REGEX, NUMBER_VALUE_REGEX, OFFICIAL_URL, QUERY_COMPARISON_OPERATORS, QUERY_LOGICAL_OPERATORS, SELECTOR_SIGNS, SEPARATOR_SIGN, SEPARATOR_SIGNS, TRANSITION_SIGN, UNIT_REGEX, VALUE_DELIMITERS, VALUE_UNITS } from './common.mjs';
|
|
3
|
-
export { default as MasterCSS, default
|
|
3
|
+
export { default as MasterCSS, default } from './core.mjs';
|
|
4
4
|
export { SyntaxRule } from './syntax-rule.mjs';
|
|
5
5
|
export { Rule } from './rule.mjs';
|
|
6
6
|
export { default as Layer } from './layer.mjs';
|
|
@@ -8,7 +8,7 @@ var core = require('../core.cjs');
|
|
|
8
8
|
* @param classes
|
|
9
9
|
* @param options
|
|
10
10
|
* @returns consistent classes
|
|
11
|
-
*/ function reorderForReadableClasses(classes, css = new core
|
|
11
|
+
*/ function reorderForReadableClasses(classes, css = new core()) {
|
|
12
12
|
css.add(...classes);
|
|
13
13
|
const orderedClasses = css.generalLayer.rules// 只保留樣式語法相關的 rules, 排除 keyframes 與 variables 在外
|
|
14
14
|
.filter((eachRule)=>eachRule.type).sort((a, b)=>{
|
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
|
+
{"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.2.0","csstype":"^3.1.3"},"devDependencies":{"shared":"^2.0.0-rc.56"},"version":"2.0.0-rc.56"}
|
package/dist/types/global.cjs
DELETED
package/dist/types/global.d.ts
DELETED
package/dist/types/global.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
|