@master/css 2.0.0-rc.69 → 2.0.0-rc.70
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/README.md +6 -8
- package/dist/index.d.ts +2 -40
- package/dist/index.mjs +1 -42
- package/package.json +1 -1
- package/src/base.css +1 -0
- package/src/index.css +1 -0
- package/src/theme.css +1 -0
- package/src/utilities.css +1 -0
- package/src/variants.css +1 -0
- package/dist/_virtual/_commonjsHelpers.cjs +0 -10
- package/dist/_virtual/_commonjsHelpers.mjs +0 -7
- package/dist/_virtual/css-escape.cjs +0 -5
- package/dist/_virtual/css-escape.mjs +0 -3
- package/dist/animation-rule.cjs +0 -24
- package/dist/animation-rule.d.ts +0 -11
- package/dist/animation-rule.mjs +0 -22
- package/dist/bin/index.cjs +0 -11
- package/dist/bin/index.d.ts +0 -1
- package/dist/bin/index.mjs +0 -9
- package/dist/common.cjs +0 -208
- package/dist/common.d.ts +0 -40
- package/dist/common.mjs +0 -180
- package/dist/config/animations.cjs +0 -113
- package/dist/config/animations.d.ts +0 -110
- package/dist/config/animations.mjs +0 -111
- package/dist/config/at.cjs +0 -19
- package/dist/config/at.d.ts +0 -16
- package/dist/config/at.mjs +0 -17
- package/dist/config/functions.cjs +0 -141
- package/dist/config/functions.d.ts +0 -138
- package/dist/config/functions.mjs +0 -139
- package/dist/config/index.cjs +0 -40
- package/dist/config/index.d.ts +0 -12
- package/dist/config/index.mjs +0 -29
- package/dist/config/modes.cjs +0 -312
- package/dist/config/modes.d.ts +0 -309
- package/dist/config/modes.mjs +0 -310
- package/dist/config/rules.cjs +0 -2277
- package/dist/config/rules.d.ts +0 -1485
- package/dist/config/rules.mjs +0 -2275
- package/dist/config/screens.cjs +0 -17
- package/dist/config/screens.d.ts +0 -14
- package/dist/config/screens.mjs +0 -15
- package/dist/config/selectors.cjs +0 -25
- package/dist/config/selectors.d.ts +0 -22
- package/dist/config/selectors.mjs +0 -23
- package/dist/config/utilities.cjs +0 -446
- package/dist/config/utilities.d.ts +0 -443
- package/dist/config/utilities.mjs +0 -444
- package/dist/config/variables.cjs +0 -99
- package/dist/config/variables.d.ts +0 -423
- package/dist/config/variables.mjs +0 -97
- package/dist/core.cjs +0 -674
- package/dist/core.d.ts +0 -128
- package/dist/core.mjs +0 -672
- package/dist/create.cjs +0 -10
- package/dist/create.d.ts +0 -3
- package/dist/create.mjs +0 -8
- package/dist/declarers/core.group.cjs +0 -99
- package/dist/declarers/core.group.d.ts +0 -2
- package/dist/declarers/core.group.mjs +0 -97
- package/dist/declarers/core.variable.cjs +0 -9
- package/dist/declarers/core.variable.d.ts +0 -4
- package/dist/declarers/core.variable.mjs +0 -7
- package/dist/declarers/index.cjs +0 -13
- package/dist/declarers/index.d.ts +0 -10
- package/dist/declarers/index.mjs +0 -11
- package/dist/declarers/pair.cjs +0 -12
- package/dist/declarers/pair.d.ts +0 -4
- package/dist/declarers/pair.mjs +0 -10
- package/dist/factories/with-syntax-layer.cjs +0 -83
- package/dist/factories/with-syntax-layer.d.ts +0 -26
- package/dist/factories/with-syntax-layer.mjs +0 -81
- package/dist/function-transformers/core.calc.cjs +0 -225
- package/dist/function-transformers/core.calc.d.ts +0 -2
- package/dist/function-transformers/core.calc.mjs +0 -223
- package/dist/function-transformers/core.variable.cjs +0 -23
- package/dist/function-transformers/core.variable.d.ts +0 -7
- package/dist/function-transformers/core.variable.mjs +0 -21
- package/dist/function-transformers/index.cjs +0 -11
- package/dist/function-transformers/index.d.ts +0 -8
- package/dist/function-transformers/index.mjs +0 -9
- package/dist/index.cjs +0 -118
- package/dist/layer.cjs +0 -52
- package/dist/layer.d.ts +0 -16
- package/dist/layer.mjs +0 -50
- package/dist/non-layer.cjs +0 -55
- package/dist/non-layer.d.ts +0 -12
- package/dist/non-layer.mjs +0 -53
- package/dist/polyfills/css-escape.cjs +0 -9
- package/dist/polyfills/css-escape.d.ts +0 -0
- package/dist/polyfills/css-escape.mjs +0 -7
- package/dist/polyfills/css-escape2.cjs +0 -76
- package/dist/polyfills/css-escape2.mjs +0 -74
- package/dist/register-global.cjs +0 -7
- package/dist/register-global.d.ts +0 -5
- package/dist/register-global.mjs +0 -5
- package/dist/rule.cjs +0 -16
- package/dist/rule.d.ts +0 -7
- package/dist/rule.mjs +0 -14
- package/dist/shared/utils/css-escape.cjs +0 -56
- package/dist/shared/utils/css-escape.mjs +0 -54
- package/dist/shared/utils/find-native-css-rule-index.cjs +0 -12
- package/dist/shared/utils/find-native-css-rule-index.mjs +0 -10
- package/dist/syntax-layer.cjs +0 -8
- package/dist/syntax-layer.d.ts +0 -18
- package/dist/syntax-layer.mjs +0 -6
- package/dist/syntax-rule-type.cjs +0 -27
- package/dist/syntax-rule-type.d.ts +0 -28
- package/dist/syntax-rule-type.mjs +0 -25
- package/dist/syntax-rule.cjs +0 -506
- package/dist/syntax-rule.d.ts +0 -44
- package/dist/syntax-rule.mjs +0 -504
- package/dist/transformers/auto-fill-solid.cjs +0 -31
- package/dist/transformers/auto-fill-solid.d.ts +0 -2
- package/dist/transformers/auto-fill-solid.mjs +0 -29
- package/dist/transformers/index.cjs +0 -9
- package/dist/transformers/index.d.ts +0 -6
- package/dist/transformers/index.mjs +0 -7
- package/dist/types/common.cjs +0 -2
- package/dist/types/common.d.ts +0 -1
- package/dist/types/common.mjs +0 -1
- package/dist/types/config.cjs +0 -2
- package/dist/types/config.d.ts +0 -79
- package/dist/types/config.mjs +0 -1
- package/dist/types/syntax.cjs +0 -2
- package/dist/types/syntax.d.ts +0 -89
- package/dist/types/syntax.mjs +0 -1
- package/dist/utils/compare-rule-priority.cjs +0 -143
- package/dist/utils/compare-rule-priority.d.ts +0 -7
- package/dist/utils/compare-rule-priority.mjs +0 -138
- package/dist/utils/equal-at-rules.cjs +0 -22
- package/dist/utils/equal-at-rules.d.ts +0 -2
- package/dist/utils/equal-at-rules.mjs +0 -20
- package/dist/utils/equal-declarations.cjs +0 -10
- package/dist/utils/equal-declarations.d.ts +0 -2
- package/dist/utils/equal-declarations.mjs +0 -8
- package/dist/utils/equal-selectors.cjs +0 -69
- package/dist/utils/equal-selectors.d.ts +0 -2
- package/dist/utils/equal-selectors.mjs +0 -67
- package/dist/utils/equal-variants.cjs +0 -10
- package/dist/utils/equal-variants.d.ts +0 -2
- package/dist/utils/equal-variants.mjs +0 -8
- package/dist/utils/extend-config.cjs +0 -97
- package/dist/utils/extend-config.d.ts +0 -11
- package/dist/utils/extend-config.mjs +0 -95
- package/dist/utils/flatten-meta-object.cjs +0 -38
- package/dist/utils/flatten-meta-object.d.ts +0 -13
- package/dist/utils/flatten-meta-object.mjs +0 -36
- package/dist/utils/flatten-object.cjs +0 -19
- package/dist/utils/flatten-object.d.ts +0 -1
- package/dist/utils/flatten-object.mjs +0 -17
- package/dist/utils/generate-at.cjs +0 -30
- package/dist/utils/generate-at.d.ts +0 -2
- package/dist/utils/generate-at.mjs +0 -28
- package/dist/utils/generate-css.cjs +0 -13
- package/dist/utils/generate-css.d.ts +0 -1
- package/dist/utils/generate-css.mjs +0 -11
- package/dist/utils/generate-selector.cjs +0 -50
- package/dist/utils/generate-selector.d.ts +0 -2
- package/dist/utils/generate-selector.mjs +0 -48
- package/dist/utils/get-single-at-number-rule-node.cjs +0 -9
- package/dist/utils/get-single-at-number-rule-node.d.ts +0 -2
- package/dist/utils/get-single-at-number-rule-node.mjs +0 -7
- package/dist/utils/hex-to-rgb.cjs +0 -30
- package/dist/utils/hex-to-rgb.d.ts +0 -1
- package/dist/utils/hex-to-rgb.mjs +0 -28
- package/dist/utils/is-core-rule.cjs +0 -9
- package/dist/utils/is-core-rule.d.ts +0 -1
- package/dist/utils/is-core-rule.mjs +0 -7
- package/dist/utils/minify-extended-config.cjs +0 -64
- package/dist/utils/minify-extended-config.d.ts +0 -9
- package/dist/utils/minify-extended-config.mjs +0 -62
- package/dist/utils/nest-meta-object.cjs +0 -25
- package/dist/utils/nest-meta-object.d.ts +0 -7
- package/dist/utils/nest-meta-object.mjs +0 -23
- package/dist/utils/parse-at.cjs +0 -156
- package/dist/utils/parse-at.d.ts +0 -39
- package/dist/utils/parse-at.mjs +0 -154
- package/dist/utils/parse-pair.cjs +0 -48
- package/dist/utils/parse-pair.d.ts +0 -8
- package/dist/utils/parse-pair.mjs +0 -46
- package/dist/utils/parse-selector.cjs +0 -114
- package/dist/utils/parse-selector.d.ts +0 -19
- package/dist/utils/parse-selector.mjs +0 -112
- package/dist/utils/parse-value.cjs +0 -39
- package/dist/utils/parse-value.d.ts +0 -2
- package/dist/utils/parse-value.mjs +0 -37
- package/dist/utils/replace-char-outside-quotes.cjs +0 -21
- package/dist/utils/replace-char-outside-quotes.d.ts +0 -1
- package/dist/utils/replace-char-outside-quotes.mjs +0 -19
- package/dist/utils/sort-readable-classes.cjs +0 -86
- package/dist/utils/sort-readable-classes.d.ts +0 -7
- package/dist/utils/sort-readable-classes.mjs +0 -84
- package/dist/utils/split-char-outside-quotes.cjs +0 -29
- package/dist/utils/split-char-outside-quotes.d.ts +0 -1
- package/dist/utils/split-char-outside-quotes.mjs +0 -27
- package/dist/variable-rule.cjs +0 -92
- package/dist/variable-rule.d.ts +0 -33
- package/dist/variable-rule.mjs +0 -87
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var cssEscape = require('../shared/utils/css-escape.cjs');
|
|
4
|
-
var common = require('../common.cjs');
|
|
5
|
-
|
|
6
|
-
function coreGroup(value) {
|
|
7
|
-
const declarations = {};
|
|
8
|
-
const addProp = (propertyName)=>{
|
|
9
|
-
const indexOfColon = propertyName.indexOf(':');
|
|
10
|
-
if (indexOfColon !== -1) {
|
|
11
|
-
const propName = propertyName.slice(0, indexOfColon);
|
|
12
|
-
declarations[propName] = propertyName.slice(indexOfColon + 1);
|
|
13
|
-
}
|
|
14
|
-
};
|
|
15
|
-
const handleRule = (rule)=>{
|
|
16
|
-
const addProps = (cssText)=>{
|
|
17
|
-
const cssProperties = cssText.slice(cssEscape(rule.name).length).match(/\{(.*)\}/)?.[1].split(';');
|
|
18
|
-
if (cssProperties) for (const eachCssProperty of cssProperties){
|
|
19
|
-
addProp(eachCssProperty);
|
|
20
|
-
}
|
|
21
|
-
};
|
|
22
|
-
addProps(rule.text);
|
|
23
|
-
// animation
|
|
24
|
-
if (rule.animationNames) {
|
|
25
|
-
if (!this.animationNames) {
|
|
26
|
-
this.animationNames = new Set();
|
|
27
|
-
}
|
|
28
|
-
for (const eachKeyframeName of rule.animationNames){
|
|
29
|
-
this.animationNames.add(eachKeyframeName);
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
// variable
|
|
33
|
-
if (rule.variableNames) {
|
|
34
|
-
if (this.variableNames) {
|
|
35
|
-
for (const eachVariableName of rule.variableNames){
|
|
36
|
-
this.variableNames.add(eachVariableName);
|
|
37
|
-
}
|
|
38
|
-
} else {
|
|
39
|
-
this.variableNames = new Set(rule.variableNames);
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
};
|
|
43
|
-
const names = [];
|
|
44
|
-
let currentName = '';
|
|
45
|
-
const addName = ()=>{
|
|
46
|
-
if (currentName) {
|
|
47
|
-
names.push(currentName.replace(/ /g, '|'));
|
|
48
|
-
currentName = '';
|
|
49
|
-
}
|
|
50
|
-
};
|
|
51
|
-
let i = 1;
|
|
52
|
-
(function analyze(end) {
|
|
53
|
-
for(; i < value.length; i++){
|
|
54
|
-
const char = value[i];
|
|
55
|
-
if (!end) {
|
|
56
|
-
if (char === ';') {
|
|
57
|
-
addName();
|
|
58
|
-
continue;
|
|
59
|
-
}
|
|
60
|
-
if (char === '}') {
|
|
61
|
-
break;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
currentName += char;
|
|
65
|
-
if (end === char) {
|
|
66
|
-
if (end === '\'' || end === '"') {
|
|
67
|
-
let count = 0;
|
|
68
|
-
for(let j = currentName.length - 2;; j--){
|
|
69
|
-
if (currentName[j] !== '\\') {
|
|
70
|
-
break;
|
|
71
|
-
}
|
|
72
|
-
count++;
|
|
73
|
-
}
|
|
74
|
-
if (count % 2) {
|
|
75
|
-
continue;
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
break;
|
|
79
|
-
} else if (char in common.VALUE_DELIMITERS && end !== '\'' && end !== '"') {
|
|
80
|
-
i++;
|
|
81
|
-
analyze(common.VALUE_DELIMITERS[char]);
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
})('');
|
|
85
|
-
addName();
|
|
86
|
-
for (const eachName of names){
|
|
87
|
-
const rules = this.css.generate(eachName, this.mode);
|
|
88
|
-
if (rules.length) {
|
|
89
|
-
for (const eachRule of rules){
|
|
90
|
-
handleRule(eachRule);
|
|
91
|
-
}
|
|
92
|
-
} else {
|
|
93
|
-
addProp(eachName);
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
return declarations;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
module.exports = coreGroup;
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
import cssEscape from '../shared/utils/css-escape.mjs';
|
|
2
|
-
import { VALUE_DELIMITERS } from '../common.mjs';
|
|
3
|
-
|
|
4
|
-
function coreGroup(value) {
|
|
5
|
-
const declarations = {};
|
|
6
|
-
const addProp = (propertyName)=>{
|
|
7
|
-
const indexOfColon = propertyName.indexOf(':');
|
|
8
|
-
if (indexOfColon !== -1) {
|
|
9
|
-
const propName = propertyName.slice(0, indexOfColon);
|
|
10
|
-
declarations[propName] = propertyName.slice(indexOfColon + 1);
|
|
11
|
-
}
|
|
12
|
-
};
|
|
13
|
-
const handleRule = (rule)=>{
|
|
14
|
-
const addProps = (cssText)=>{
|
|
15
|
-
const cssProperties = cssText.slice(cssEscape(rule.name).length).match(/\{(.*)\}/)?.[1].split(';');
|
|
16
|
-
if (cssProperties) for (const eachCssProperty of cssProperties){
|
|
17
|
-
addProp(eachCssProperty);
|
|
18
|
-
}
|
|
19
|
-
};
|
|
20
|
-
addProps(rule.text);
|
|
21
|
-
// animation
|
|
22
|
-
if (rule.animationNames) {
|
|
23
|
-
if (!this.animationNames) {
|
|
24
|
-
this.animationNames = new Set();
|
|
25
|
-
}
|
|
26
|
-
for (const eachKeyframeName of rule.animationNames){
|
|
27
|
-
this.animationNames.add(eachKeyframeName);
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
// variable
|
|
31
|
-
if (rule.variableNames) {
|
|
32
|
-
if (this.variableNames) {
|
|
33
|
-
for (const eachVariableName of rule.variableNames){
|
|
34
|
-
this.variableNames.add(eachVariableName);
|
|
35
|
-
}
|
|
36
|
-
} else {
|
|
37
|
-
this.variableNames = new Set(rule.variableNames);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
};
|
|
41
|
-
const names = [];
|
|
42
|
-
let currentName = '';
|
|
43
|
-
const addName = ()=>{
|
|
44
|
-
if (currentName) {
|
|
45
|
-
names.push(currentName.replace(/ /g, '|'));
|
|
46
|
-
currentName = '';
|
|
47
|
-
}
|
|
48
|
-
};
|
|
49
|
-
let i = 1;
|
|
50
|
-
(function analyze(end) {
|
|
51
|
-
for(; i < value.length; i++){
|
|
52
|
-
const char = value[i];
|
|
53
|
-
if (!end) {
|
|
54
|
-
if (char === ';') {
|
|
55
|
-
addName();
|
|
56
|
-
continue;
|
|
57
|
-
}
|
|
58
|
-
if (char === '}') {
|
|
59
|
-
break;
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
currentName += char;
|
|
63
|
-
if (end === char) {
|
|
64
|
-
if (end === '\'' || end === '"') {
|
|
65
|
-
let count = 0;
|
|
66
|
-
for(let j = currentName.length - 2;; j--){
|
|
67
|
-
if (currentName[j] !== '\\') {
|
|
68
|
-
break;
|
|
69
|
-
}
|
|
70
|
-
count++;
|
|
71
|
-
}
|
|
72
|
-
if (count % 2) {
|
|
73
|
-
continue;
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
break;
|
|
77
|
-
} else if (char in VALUE_DELIMITERS && end !== '\'' && end !== '"') {
|
|
78
|
-
i++;
|
|
79
|
-
analyze(VALUE_DELIMITERS[char]);
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
})('');
|
|
83
|
-
addName();
|
|
84
|
-
for (const eachName of names){
|
|
85
|
-
const rules = this.css.generate(eachName, this.mode);
|
|
86
|
-
if (rules.length) {
|
|
87
|
-
for (const eachRule of rules){
|
|
88
|
-
handleRule(eachRule);
|
|
89
|
-
}
|
|
90
|
-
} else {
|
|
91
|
-
addProp(eachName);
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
return declarations;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
export { coreGroup as default };
|
package/dist/declarers/index.cjs
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var core_group = require('./core.group.cjs');
|
|
4
|
-
var core_variable = require('./core.variable.cjs');
|
|
5
|
-
var pair = require('./pair.cjs');
|
|
6
|
-
|
|
7
|
-
const declarers = {
|
|
8
|
-
pair,
|
|
9
|
-
'core.group': core_group,
|
|
10
|
-
'core.variable': core_variable
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
module.exports = declarers;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import coreGroup from './core.group';
|
|
2
|
-
import coreVariable from './core.variable';
|
|
3
|
-
import pair from './pair';
|
|
4
|
-
declare const declarers: {
|
|
5
|
-
pair: typeof pair;
|
|
6
|
-
'core.group': typeof coreGroup;
|
|
7
|
-
'core.variable': typeof coreVariable;
|
|
8
|
-
};
|
|
9
|
-
export default declarers;
|
|
10
|
-
export type DeclarerNames = keyof typeof declarers;
|
package/dist/declarers/index.mjs
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import coreGroup from './core.group.mjs';
|
|
2
|
-
import coreVariable from './core.variable.mjs';
|
|
3
|
-
import pair from './pair.mjs';
|
|
4
|
-
|
|
5
|
-
const declarers = {
|
|
6
|
-
pair,
|
|
7
|
-
'core.group': coreGroup,
|
|
8
|
-
'core.variable': coreVariable
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
export { declarers as default };
|
package/dist/declarers/pair.cjs
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
function pair(_, valueComponents, data) {
|
|
4
|
-
const [x, y] = data;
|
|
5
|
-
const length = valueComponents.length;
|
|
6
|
-
return {
|
|
7
|
-
[x]: length === 1 ? valueComponents[0].text : valueComponents[0].text,
|
|
8
|
-
[y]: length === 1 ? valueComponents[0].text : valueComponents[2].text
|
|
9
|
-
};
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
module.exports = pair;
|
package/dist/declarers/pair.d.ts
DELETED
package/dist/declarers/pair.mjs
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
function pair(_, valueComponents, data) {
|
|
2
|
-
const [x, y] = data;
|
|
3
|
-
const length = valueComponents.length;
|
|
4
|
-
return {
|
|
5
|
-
[x]: length === 1 ? valueComponents[0].text : valueComponents[0].text,
|
|
6
|
-
[y]: length === 1 ? valueComponents[0].text : valueComponents[2].text
|
|
7
|
-
};
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export { pair as default };
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var animationRule = require('../animation-rule.cjs');
|
|
4
|
-
var compareRulePriority = require('../utils/compare-rule-priority.cjs');
|
|
5
|
-
var variableRule = require('../variable-rule.cjs');
|
|
6
|
-
|
|
7
|
-
function withSyntaxLayer(Base) {
|
|
8
|
-
return class SyntaxLayer extends Base {
|
|
9
|
-
rules = [];
|
|
10
|
-
/**
|
|
11
|
-
* normal
|
|
12
|
-
* normal selectors
|
|
13
|
-
* media normal
|
|
14
|
-
* media selectors
|
|
15
|
-
* media width
|
|
16
|
-
* media width selectors
|
|
17
|
-
*/ insert(syntaxRule) {
|
|
18
|
-
if (this.rules.includes(syntaxRule) || !syntaxRule.valid) return;
|
|
19
|
-
let index = this.rules.length;
|
|
20
|
-
for(let i = 0; i < this.rules.length; i++){
|
|
21
|
-
const rule = this.rules[i];
|
|
22
|
-
if (compareRulePriority.default(syntaxRule, rule) < 0) {
|
|
23
|
-
index = i;
|
|
24
|
-
break;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
super.insert(syntaxRule, index);
|
|
28
|
-
this.insertVariables(syntaxRule);
|
|
29
|
-
this.insertAnimations(syntaxRule);
|
|
30
|
-
return index;
|
|
31
|
-
}
|
|
32
|
-
delete(key) {
|
|
33
|
-
const syntaxRule = super.delete(key);
|
|
34
|
-
if (!syntaxRule) return;
|
|
35
|
-
const deleteLayerToken = (layerToken, layer)=>{
|
|
36
|
-
const count = layer.tokenCounts.get(layerToken) ?? 0;
|
|
37
|
-
if (count <= 1) {
|
|
38
|
-
layer.delete(layerToken);
|
|
39
|
-
layer.tokenCounts.delete(layerToken);
|
|
40
|
-
} else {
|
|
41
|
-
layer.tokenCounts.set(layerToken, count - 1);
|
|
42
|
-
}
|
|
43
|
-
};
|
|
44
|
-
syntaxRule.variableNames?.forEach((eachVariableName)=>{
|
|
45
|
-
deleteLayerToken(eachVariableName, this.css.themeLayer);
|
|
46
|
-
});
|
|
47
|
-
syntaxRule.animationNames?.forEach((eachAnimationName)=>{
|
|
48
|
-
deleteLayerToken(eachAnimationName, this.css.animationsNonLayer);
|
|
49
|
-
});
|
|
50
|
-
return syntaxRule;
|
|
51
|
-
}
|
|
52
|
-
insertVariables(syntaxRule) {
|
|
53
|
-
syntaxRule.variableNames?.forEach((eachVariableName)=>{
|
|
54
|
-
if (this.css.themeLayer.rules.find(({ name })=>name === eachVariableName)) {
|
|
55
|
-
const count = this.css.themeLayer.tokenCounts.get(eachVariableName) || 0;
|
|
56
|
-
this.css.themeLayer.tokenCounts.set(eachVariableName, count + 1);
|
|
57
|
-
} else {
|
|
58
|
-
const variable = this.css.variables.get(eachVariableName);
|
|
59
|
-
if (!variable) return;
|
|
60
|
-
const newRule = new variableRule.default(eachVariableName, variable, this.css);
|
|
61
|
-
this.css.themeLayer.insert(newRule);
|
|
62
|
-
this.css.themeLayer.tokenCounts.set(eachVariableName, 1);
|
|
63
|
-
}
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
insertAnimations(syntaxRule) {
|
|
67
|
-
syntaxRule.animationNames?.forEach((eachAnimationName)=>{
|
|
68
|
-
if (this.css.animationsNonLayer.rules.find(({ name })=>name === eachAnimationName)) {
|
|
69
|
-
const count = this.css.animationsNonLayer.tokenCounts.get(eachAnimationName) || 0;
|
|
70
|
-
this.css.animationsNonLayer.tokenCounts.set(eachAnimationName, count + 1);
|
|
71
|
-
} else {
|
|
72
|
-
const keyframes = this.css.animations.get(eachAnimationName);
|
|
73
|
-
if (!keyframes) return;
|
|
74
|
-
const newRule = new animationRule(eachAnimationName, keyframes, this.css);
|
|
75
|
-
this.css.animationsNonLayer.insert(newRule);
|
|
76
|
-
this.css.animationsNonLayer.tokenCounts.set(eachAnimationName, 1);
|
|
77
|
-
}
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
};
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
module.exports = withSyntaxLayer;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import Layer from '../layer';
|
|
2
|
-
import { SyntaxRule } from '../syntax-rule';
|
|
3
|
-
export default function withSyntaxLayer<TBase extends new (...args: any[]) => Layer>(Base: TBase): {
|
|
4
|
-
new (...args: any[]): {
|
|
5
|
-
rules: SyntaxRule[];
|
|
6
|
-
/**
|
|
7
|
-
* normal
|
|
8
|
-
* normal selectors
|
|
9
|
-
* media normal
|
|
10
|
-
* media selectors
|
|
11
|
-
* media width
|
|
12
|
-
* media width selectors
|
|
13
|
-
*/
|
|
14
|
-
insert(syntaxRule: SyntaxRule): number | undefined;
|
|
15
|
-
delete(key: string): SyntaxRule | undefined;
|
|
16
|
-
insertVariables(syntaxRule: SyntaxRule): void;
|
|
17
|
-
insertAnimations(syntaxRule: SyntaxRule): void;
|
|
18
|
-
readonly tokenCounts: Map<string, number>;
|
|
19
|
-
name: string;
|
|
20
|
-
css: import("..").MasterCSS;
|
|
21
|
-
attach(): void;
|
|
22
|
-
detach(): void;
|
|
23
|
-
reset(): void;
|
|
24
|
-
readonly text: string;
|
|
25
|
-
};
|
|
26
|
-
} & TBase;
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
import AnimationRule from '../animation-rule.mjs';
|
|
2
|
-
import compareRulePriority from '../utils/compare-rule-priority.mjs';
|
|
3
|
-
import VariableRule from '../variable-rule.mjs';
|
|
4
|
-
|
|
5
|
-
function withSyntaxLayer(Base) {
|
|
6
|
-
return class SyntaxLayer extends Base {
|
|
7
|
-
rules = [];
|
|
8
|
-
/**
|
|
9
|
-
* normal
|
|
10
|
-
* normal selectors
|
|
11
|
-
* media normal
|
|
12
|
-
* media selectors
|
|
13
|
-
* media width
|
|
14
|
-
* media width selectors
|
|
15
|
-
*/ insert(syntaxRule) {
|
|
16
|
-
if (this.rules.includes(syntaxRule) || !syntaxRule.valid) return;
|
|
17
|
-
let index = this.rules.length;
|
|
18
|
-
for(let i = 0; i < this.rules.length; i++){
|
|
19
|
-
const rule = this.rules[i];
|
|
20
|
-
if (compareRulePriority(syntaxRule, rule) < 0) {
|
|
21
|
-
index = i;
|
|
22
|
-
break;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
super.insert(syntaxRule, index);
|
|
26
|
-
this.insertVariables(syntaxRule);
|
|
27
|
-
this.insertAnimations(syntaxRule);
|
|
28
|
-
return index;
|
|
29
|
-
}
|
|
30
|
-
delete(key) {
|
|
31
|
-
const syntaxRule = super.delete(key);
|
|
32
|
-
if (!syntaxRule) return;
|
|
33
|
-
const deleteLayerToken = (layerToken, layer)=>{
|
|
34
|
-
const count = layer.tokenCounts.get(layerToken) ?? 0;
|
|
35
|
-
if (count <= 1) {
|
|
36
|
-
layer.delete(layerToken);
|
|
37
|
-
layer.tokenCounts.delete(layerToken);
|
|
38
|
-
} else {
|
|
39
|
-
layer.tokenCounts.set(layerToken, count - 1);
|
|
40
|
-
}
|
|
41
|
-
};
|
|
42
|
-
syntaxRule.variableNames?.forEach((eachVariableName)=>{
|
|
43
|
-
deleteLayerToken(eachVariableName, this.css.themeLayer);
|
|
44
|
-
});
|
|
45
|
-
syntaxRule.animationNames?.forEach((eachAnimationName)=>{
|
|
46
|
-
deleteLayerToken(eachAnimationName, this.css.animationsNonLayer);
|
|
47
|
-
});
|
|
48
|
-
return syntaxRule;
|
|
49
|
-
}
|
|
50
|
-
insertVariables(syntaxRule) {
|
|
51
|
-
syntaxRule.variableNames?.forEach((eachVariableName)=>{
|
|
52
|
-
if (this.css.themeLayer.rules.find(({ name })=>name === eachVariableName)) {
|
|
53
|
-
const count = this.css.themeLayer.tokenCounts.get(eachVariableName) || 0;
|
|
54
|
-
this.css.themeLayer.tokenCounts.set(eachVariableName, count + 1);
|
|
55
|
-
} else {
|
|
56
|
-
const variable = this.css.variables.get(eachVariableName);
|
|
57
|
-
if (!variable) return;
|
|
58
|
-
const newRule = new VariableRule(eachVariableName, variable, this.css);
|
|
59
|
-
this.css.themeLayer.insert(newRule);
|
|
60
|
-
this.css.themeLayer.tokenCounts.set(eachVariableName, 1);
|
|
61
|
-
}
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
insertAnimations(syntaxRule) {
|
|
65
|
-
syntaxRule.animationNames?.forEach((eachAnimationName)=>{
|
|
66
|
-
if (this.css.animationsNonLayer.rules.find(({ name })=>name === eachAnimationName)) {
|
|
67
|
-
const count = this.css.animationsNonLayer.tokenCounts.get(eachAnimationName) || 0;
|
|
68
|
-
this.css.animationsNonLayer.tokenCounts.set(eachAnimationName, count + 1);
|
|
69
|
-
} else {
|
|
70
|
-
const keyframes = this.css.animations.get(eachAnimationName);
|
|
71
|
-
if (!keyframes) return;
|
|
72
|
-
const newRule = new AnimationRule(eachAnimationName, keyframes, this.css);
|
|
73
|
-
this.css.animationsNonLayer.insert(newRule);
|
|
74
|
-
this.css.animationsNonLayer.tokenCounts.set(eachAnimationName, 1);
|
|
75
|
-
}
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
|
-
};
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
export { withSyntaxLayer as default };
|