@master/css 2.0.0-rc.39 → 2.0.0-rc.40
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/{queries.cjs → at.cjs} +3 -6
- package/dist/config/at.d.ts +11 -0
- package/dist/config/{queries.mjs → at.mjs} +3 -6
- package/dist/config/index.cjs +3 -3
- package/dist/config/index.d.ts +5 -5
- package/dist/config/index.mjs +3 -3
- package/dist/config/rules.cjs +1 -0
- package/dist/config/rules.mjs +1 -0
- package/dist/config/variables.cjs +13 -2
- package/dist/config/variables.d.ts +5 -5
- package/dist/config/variables.mjs +13 -2
- package/dist/core.cjs +10 -5
- package/dist/core.d.ts +3 -3
- package/dist/core.mjs +10 -5
- package/dist/index.cjs +4 -4
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +2 -2
- package/dist/rule.cjs +8 -8
- package/dist/rule.mjs +8 -8
- package/dist/utils/{are-rule-queries-equal.cjs → are-rule-at-equal.cjs} +2 -2
- package/dist/utils/are-rule-at-equal.d.ts +2 -0
- package/dist/utils/{are-rule-queries-equal.mjs → are-rule-at-equal.mjs} +2 -2
- package/dist/utils/are-rule-states-equal.cjs +2 -2
- package/dist/utils/are-rule-states-equal.mjs +2 -2
- package/dist/utils/extend-config.cjs +4 -3
- package/dist/utils/extend-config.d.ts +1 -1
- package/dist/utils/extend-config.mjs +4 -3
- package/package.json +1 -1
- package/dist/config/queries.d.ts +0 -22
- package/dist/tokens/screen-sizes.cjs +0 -17
- package/dist/tokens/screen-sizes.d.ts +0 -14
- package/dist/tokens/screen-sizes.mjs +0 -15
- package/dist/utils/are-rule-queries-equal.d.ts +0 -2
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const queries = {
|
|
3
|
+
const at = {
|
|
6
4
|
all: 'media all',
|
|
7
5
|
print: 'media print',
|
|
8
6
|
screen: 'media screen',
|
|
@@ -10,8 +8,7 @@ const queries = {
|
|
|
10
8
|
landscape: 'media (orientation:landscape)',
|
|
11
9
|
portrait: 'media (orientation:portrait)',
|
|
12
10
|
motion: 'media (prefers-reduced-motion:no-preference)',
|
|
13
|
-
'reduced-motion': 'media (prefers-reduced-motion:reduce)'
|
|
14
|
-
...screenSizes
|
|
11
|
+
'reduced-motion': 'media (prefers-reduced-motion:reduce)'
|
|
15
12
|
};
|
|
16
13
|
|
|
17
|
-
module.exports =
|
|
14
|
+
module.exports = at;
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const queries = {
|
|
1
|
+
const at = {
|
|
4
2
|
all: 'media all',
|
|
5
3
|
print: 'media print',
|
|
6
4
|
screen: 'media screen',
|
|
@@ -8,8 +6,7 @@ const queries = {
|
|
|
8
6
|
landscape: 'media (orientation:landscape)',
|
|
9
7
|
portrait: 'media (orientation:portrait)',
|
|
10
8
|
motion: 'media (prefers-reduced-motion:no-preference)',
|
|
11
|
-
'reduced-motion': 'media (prefers-reduced-motion:reduce)'
|
|
12
|
-
...screenSizes
|
|
9
|
+
'reduced-motion': 'media (prefers-reduced-motion:reduce)'
|
|
13
10
|
};
|
|
14
11
|
|
|
15
|
-
export {
|
|
12
|
+
export { at as default };
|
package/dist/config/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var at = require('./at.cjs');
|
|
4
4
|
var selectors = require('./selectors.cjs');
|
|
5
5
|
var utilities = require('./utilities.cjs');
|
|
6
6
|
var animations = require('./animations.cjs');
|
|
@@ -10,7 +10,7 @@ var modes = require('./modes.cjs');
|
|
|
10
10
|
var functions = require('./functions.cjs');
|
|
11
11
|
|
|
12
12
|
const config = {
|
|
13
|
-
|
|
13
|
+
at,
|
|
14
14
|
selectors,
|
|
15
15
|
utilities,
|
|
16
16
|
rules,
|
|
@@ -25,7 +25,7 @@ const config = {
|
|
|
25
25
|
important: false
|
|
26
26
|
};
|
|
27
27
|
|
|
28
|
-
exports.
|
|
28
|
+
exports.at = at;
|
|
29
29
|
exports.selectors = selectors;
|
|
30
30
|
exports.utilities = utilities;
|
|
31
31
|
exports.animations = animations;
|
package/dist/config/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import at from './at';
|
|
2
2
|
import selectors from './selectors';
|
|
3
3
|
import utilities from './utilities';
|
|
4
4
|
import animations from './animations';
|
|
@@ -9,7 +9,7 @@ import functions from './functions';
|
|
|
9
9
|
import type { PropertiesHyphen } from 'csstype';
|
|
10
10
|
import type { Rule, RuleDefinition, ValueComponent } from '../rule';
|
|
11
11
|
declare const config: Config;
|
|
12
|
-
export { config,
|
|
12
|
+
export { config, at, selectors, utilities, rules, functions, animations, variables, modes };
|
|
13
13
|
export type VariableValue = number | string | Array<number | string>;
|
|
14
14
|
export type VariableDefinition = {
|
|
15
15
|
[key in '' | `@${string}` | string]?: VariableValue | VariableDefinition;
|
|
@@ -23,8 +23,8 @@ export type AnimationDefinitions = {
|
|
|
23
23
|
export type SelectorDefinitions = {
|
|
24
24
|
[key: string]: string | string[];
|
|
25
25
|
};
|
|
26
|
-
export type
|
|
27
|
-
[key: string]: number | string |
|
|
26
|
+
export type AtDefinitions = {
|
|
27
|
+
[key: string]: number | string | AtDefinitions;
|
|
28
28
|
};
|
|
29
29
|
export type StyleDefinitions = {
|
|
30
30
|
[key: string]: string | StyleDefinitions;
|
|
@@ -55,7 +55,7 @@ export type FunctionDefinitions = {
|
|
|
55
55
|
export interface Config {
|
|
56
56
|
extends?: (Config | any)[];
|
|
57
57
|
styles?: StyleDefinitions;
|
|
58
|
-
|
|
58
|
+
at?: AtDefinitions;
|
|
59
59
|
selectors?: SelectorDefinitions;
|
|
60
60
|
utilities?: UtilityDefinitions;
|
|
61
61
|
variables?: VariableDefinitions;
|
package/dist/config/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import at from './at.mjs';
|
|
2
2
|
import selectors from './selectors.mjs';
|
|
3
3
|
import utilities from './utilities.mjs';
|
|
4
4
|
import animations from './animations.mjs';
|
|
@@ -8,7 +8,7 @@ import modes from './modes.mjs';
|
|
|
8
8
|
import functions from './functions.mjs';
|
|
9
9
|
|
|
10
10
|
const config = {
|
|
11
|
-
|
|
11
|
+
at,
|
|
12
12
|
selectors,
|
|
13
13
|
utilities,
|
|
14
14
|
rules,
|
|
@@ -23,4 +23,4 @@ const config = {
|
|
|
23
23
|
important: false
|
|
24
24
|
};
|
|
25
25
|
|
|
26
|
-
export { animations, config, functions, modes,
|
|
26
|
+
export { animations, at, config, functions, modes, rules, selectors, utilities, variables };
|
package/dist/config/rules.cjs
CHANGED
package/dist/config/rules.mjs
CHANGED
|
@@ -1,13 +1,25 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var colors = require('@master/colors');
|
|
4
|
-
var screenSizes = require('../tokens/screen-sizes.cjs');
|
|
5
4
|
|
|
6
5
|
const variables = {
|
|
7
6
|
full: '100%',
|
|
8
7
|
fit: 'fit-content',
|
|
9
8
|
max: 'max-content',
|
|
10
9
|
min: 'min-content',
|
|
10
|
+
screen: {
|
|
11
|
+
'4xs': 360,
|
|
12
|
+
'3xs': 480,
|
|
13
|
+
'2xs': 600,
|
|
14
|
+
'xs': 768,
|
|
15
|
+
'sm': 834,
|
|
16
|
+
'md': 1024,
|
|
17
|
+
'lg': 1280,
|
|
18
|
+
'xl': 1440,
|
|
19
|
+
'2xl': 1600,
|
|
20
|
+
'3xl': 1920,
|
|
21
|
+
'4xl': 2560
|
|
22
|
+
},
|
|
11
23
|
'font-family': {
|
|
12
24
|
mono: [
|
|
13
25
|
'ui-monospace',
|
|
@@ -44,7 +56,6 @@ const variables = {
|
|
|
44
56
|
'serif'
|
|
45
57
|
]
|
|
46
58
|
},
|
|
47
|
-
screen: screenSizes,
|
|
48
59
|
'font-weight': {
|
|
49
60
|
thin: 100,
|
|
50
61
|
extralight: 200,
|
|
@@ -419,11 +419,6 @@ declare const variables: {
|
|
|
419
419
|
fit: string;
|
|
420
420
|
max: string;
|
|
421
421
|
min: string;
|
|
422
|
-
'font-family': {
|
|
423
|
-
mono: string[];
|
|
424
|
-
sans: string[];
|
|
425
|
-
serif: string[];
|
|
426
|
-
};
|
|
427
422
|
screen: {
|
|
428
423
|
'4xs': number;
|
|
429
424
|
'3xs': number;
|
|
@@ -437,6 +432,11 @@ declare const variables: {
|
|
|
437
432
|
'3xl': number;
|
|
438
433
|
'4xl': number;
|
|
439
434
|
};
|
|
435
|
+
'font-family': {
|
|
436
|
+
mono: string[];
|
|
437
|
+
sans: string[];
|
|
438
|
+
serif: string[];
|
|
439
|
+
};
|
|
440
440
|
'font-weight': {
|
|
441
441
|
thin: number;
|
|
442
442
|
extralight: number;
|
|
@@ -1,11 +1,23 @@
|
|
|
1
1
|
import colors from '@master/colors';
|
|
2
|
-
import screenSizes from '../tokens/screen-sizes.mjs';
|
|
3
2
|
|
|
4
3
|
const variables = {
|
|
5
4
|
full: '100%',
|
|
6
5
|
fit: 'fit-content',
|
|
7
6
|
max: 'max-content',
|
|
8
7
|
min: 'min-content',
|
|
8
|
+
screen: {
|
|
9
|
+
'4xs': 360,
|
|
10
|
+
'3xs': 480,
|
|
11
|
+
'2xs': 600,
|
|
12
|
+
'xs': 768,
|
|
13
|
+
'sm': 834,
|
|
14
|
+
'md': 1024,
|
|
15
|
+
'lg': 1280,
|
|
16
|
+
'xl': 1440,
|
|
17
|
+
'2xl': 1600,
|
|
18
|
+
'3xl': 1920,
|
|
19
|
+
'4xl': 2560
|
|
20
|
+
},
|
|
9
21
|
'font-family': {
|
|
10
22
|
mono: [
|
|
11
23
|
'ui-monospace',
|
|
@@ -42,7 +54,6 @@ const variables = {
|
|
|
42
54
|
'serif'
|
|
43
55
|
]
|
|
44
56
|
},
|
|
45
|
-
screen: screenSizes,
|
|
46
57
|
'font-weight': {
|
|
47
58
|
thin: 100,
|
|
48
59
|
extralight: 200,
|
package/dist/core.cjs
CHANGED
|
@@ -17,7 +17,7 @@ class MasterCSS {
|
|
|
17
17
|
classesUsage;
|
|
18
18
|
config;
|
|
19
19
|
Rules;
|
|
20
|
-
constructor(customConfig
|
|
20
|
+
constructor(customConfig){
|
|
21
21
|
this.customConfig = customConfig;
|
|
22
22
|
this.rules = [];
|
|
23
23
|
this.ruleBy = {};
|
|
@@ -38,7 +38,7 @@ class MasterCSS {
|
|
|
38
38
|
this.stylesBy = {};
|
|
39
39
|
this.selectors = {};
|
|
40
40
|
this.variables = {};
|
|
41
|
-
this.
|
|
41
|
+
this.at = {};
|
|
42
42
|
this.animations = {};
|
|
43
43
|
this.Rules.length = 0;
|
|
44
44
|
this.variablesNativeRules = {};
|
|
@@ -48,7 +48,7 @@ class MasterCSS {
|
|
|
48
48
|
currentColor: undefined,
|
|
49
49
|
transparent: undefined
|
|
50
50
|
};
|
|
51
|
-
const { styles, selectors, variables, utilities,
|
|
51
|
+
const { styles, selectors, variables, utilities, at, rules, animations } = this.config;
|
|
52
52
|
function escapeString(str) {
|
|
53
53
|
return str.replace(/[-/\\^$*+?.()|[\]{}]/g, '\\$&');
|
|
54
54
|
}
|
|
@@ -99,6 +99,11 @@ class MasterCSS {
|
|
|
99
99
|
}
|
|
100
100
|
colorVariableNames[flatName] = undefined;
|
|
101
101
|
}
|
|
102
|
+
/**
|
|
103
|
+
* resolve `variables.screen-*` to `at.*`
|
|
104
|
+
*/ if (variable.name.startsWith('screen-') && variable.type === 'number') {
|
|
105
|
+
this.at[variable.name.slice(7)] = variable.value;
|
|
106
|
+
}
|
|
102
107
|
const currentMode = replacedMode ?? mode;
|
|
103
108
|
if (currentMode !== undefined) {
|
|
104
109
|
if (Object.prototype.hasOwnProperty.call(this.variables, flatName)) {
|
|
@@ -259,8 +264,8 @@ class MasterCSS {
|
|
|
259
264
|
}
|
|
260
265
|
}
|
|
261
266
|
}
|
|
262
|
-
if (
|
|
263
|
-
this.
|
|
267
|
+
if (at) {
|
|
268
|
+
Object.assign(this.at, flattenObject.flattenObject(at));
|
|
264
269
|
}
|
|
265
270
|
if (animations) {
|
|
266
271
|
for(const animationName in animations){
|
package/dist/core.d.ts
CHANGED
|
@@ -26,14 +26,14 @@ export type ColorVariable = {
|
|
|
26
26
|
export type TypeVariable = StringVariable | NumberVariable | ColorVariable;
|
|
27
27
|
export type Variable = TypeVariable & VariableCommon;
|
|
28
28
|
export default class MasterCSS {
|
|
29
|
-
customConfig
|
|
29
|
+
customConfig?: Config | undefined;
|
|
30
30
|
static config: Config;
|
|
31
31
|
readonly rules: Rule[];
|
|
32
32
|
readonly ruleBy: Record<string, Rule>;
|
|
33
33
|
readonly classesUsage: Record<string, number>;
|
|
34
34
|
readonly config: Config;
|
|
35
35
|
readonly Rules: RegisteredRule[];
|
|
36
|
-
constructor(customConfig?: Config);
|
|
36
|
+
constructor(customConfig?: Config | undefined);
|
|
37
37
|
resolve(): void;
|
|
38
38
|
/**
|
|
39
39
|
* Match check if Master CSS syntax
|
|
@@ -89,7 +89,7 @@ export default interface MasterCSS {
|
|
|
89
89
|
stylesBy: Record<string, string[]>;
|
|
90
90
|
selectors: Record<string, [RegExp, string[]][]>;
|
|
91
91
|
variables: Record<string, Variable>;
|
|
92
|
-
|
|
92
|
+
at: Record<string, string | number>;
|
|
93
93
|
variablesNativeRules: Record<string, NativeRule>;
|
|
94
94
|
hasKeyframesRule: boolean;
|
|
95
95
|
animations: Record<string, AnimationDefinitions & {
|
package/dist/core.mjs
CHANGED
|
@@ -13,7 +13,7 @@ class MasterCSS {
|
|
|
13
13
|
classesUsage;
|
|
14
14
|
config;
|
|
15
15
|
Rules;
|
|
16
|
-
constructor(customConfig
|
|
16
|
+
constructor(customConfig){
|
|
17
17
|
this.customConfig = customConfig;
|
|
18
18
|
this.rules = [];
|
|
19
19
|
this.ruleBy = {};
|
|
@@ -34,7 +34,7 @@ class MasterCSS {
|
|
|
34
34
|
this.stylesBy = {};
|
|
35
35
|
this.selectors = {};
|
|
36
36
|
this.variables = {};
|
|
37
|
-
this.
|
|
37
|
+
this.at = {};
|
|
38
38
|
this.animations = {};
|
|
39
39
|
this.Rules.length = 0;
|
|
40
40
|
this.variablesNativeRules = {};
|
|
@@ -44,7 +44,7 @@ class MasterCSS {
|
|
|
44
44
|
currentColor: undefined,
|
|
45
45
|
transparent: undefined
|
|
46
46
|
};
|
|
47
|
-
const { styles, selectors, variables, utilities,
|
|
47
|
+
const { styles, selectors, variables, utilities, at, rules, animations } = this.config;
|
|
48
48
|
function escapeString(str) {
|
|
49
49
|
return str.replace(/[-/\\^$*+?.()|[\]{}]/g, '\\$&');
|
|
50
50
|
}
|
|
@@ -95,6 +95,11 @@ class MasterCSS {
|
|
|
95
95
|
}
|
|
96
96
|
colorVariableNames[flatName] = undefined;
|
|
97
97
|
}
|
|
98
|
+
/**
|
|
99
|
+
* resolve `variables.screen-*` to `at.*`
|
|
100
|
+
*/ if (variable.name.startsWith('screen-') && variable.type === 'number') {
|
|
101
|
+
this.at[variable.name.slice(7)] = variable.value;
|
|
102
|
+
}
|
|
98
103
|
const currentMode = replacedMode ?? mode;
|
|
99
104
|
if (currentMode !== undefined) {
|
|
100
105
|
if (Object.prototype.hasOwnProperty.call(this.variables, flatName)) {
|
|
@@ -255,8 +260,8 @@ class MasterCSS {
|
|
|
255
260
|
}
|
|
256
261
|
}
|
|
257
262
|
}
|
|
258
|
-
if (
|
|
259
|
-
this.
|
|
263
|
+
if (at) {
|
|
264
|
+
Object.assign(this.at, flattenObject(at));
|
|
260
265
|
}
|
|
261
266
|
if (animations) {
|
|
262
267
|
for(const animationName in animations){
|
package/dist/index.cjs
CHANGED
|
@@ -10,13 +10,13 @@ var layer = require('./layer.cjs');
|
|
|
10
10
|
var extendConfig = require('./utils/extend-config.cjs');
|
|
11
11
|
var reorderForReadableClasses = require('./utils/reorder-for-readable-classes.cjs');
|
|
12
12
|
var areRuleModesEqual = require('./utils/are-rule-modes-equal.cjs');
|
|
13
|
-
var
|
|
13
|
+
var areRuleAtEqual = require('./utils/are-rule-at-equal.cjs');
|
|
14
14
|
var areRuleSelectorsEqual = require('./utils/are-rule-selectors-equal.cjs');
|
|
15
15
|
var areRuleStatesEqual = require('./utils/are-rule-states-equal.cjs');
|
|
16
16
|
var areRulesDuplicated = require('./utils/are-rules-duplicated.cjs');
|
|
17
17
|
var generateCss = require('./utils/generate-css.cjs');
|
|
18
18
|
var isCoreRule = require('./utils/is-core-rule.cjs');
|
|
19
|
-
var
|
|
19
|
+
var at = require('./config/at.cjs');
|
|
20
20
|
var selectors = require('./config/selectors.cjs');
|
|
21
21
|
var utilities = require('./config/utilities.cjs');
|
|
22
22
|
var functions = require('./config/functions.cjs');
|
|
@@ -57,13 +57,13 @@ exports.Layer = layer;
|
|
|
57
57
|
exports.extendConfig = extendConfig;
|
|
58
58
|
exports.reorderForReadableClasses = reorderForReadableClasses;
|
|
59
59
|
exports.areRuleModesEqual = areRuleModesEqual;
|
|
60
|
-
exports.
|
|
60
|
+
exports.areRuleAtEqual = areRuleAtEqual;
|
|
61
61
|
exports.areRuleSelectorsEqual = areRuleSelectorsEqual;
|
|
62
62
|
exports.areRuleStatesEqual = areRuleStatesEqual;
|
|
63
63
|
exports.areRulesDuplicated = areRulesDuplicated;
|
|
64
64
|
exports.generateCSS = generateCss;
|
|
65
65
|
exports.isCoreRule = isCoreRule;
|
|
66
|
-
exports.
|
|
66
|
+
exports.at = at;
|
|
67
67
|
exports.selectors = selectors;
|
|
68
68
|
exports.utilities = utilities;
|
|
69
69
|
exports.functions = functions;
|
package/dist/index.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ export { default as MasterCSS, default } from './core';
|
|
|
8
8
|
export { default as extendConfig } from './utils/extend-config';
|
|
9
9
|
export { default as reorderForReadableClasses } from './utils/reorder-for-readable-classes';
|
|
10
10
|
export { default as areRuleModesEqual } from './utils/are-rule-modes-equal';
|
|
11
|
-
export { default as
|
|
11
|
+
export { default as areRuleAtEqual } from './utils/are-rule-at-equal';
|
|
12
12
|
export { default as areRuleSelectorsEqual } from './utils/are-rule-selectors-equal';
|
|
13
13
|
export { default as areRuleStatesEqual } from './utils/are-rule-states-equal';
|
|
14
14
|
export { default as areRulesDuplicated } from './utils/are-rules-duplicated';
|
package/dist/index.mjs
CHANGED
|
@@ -6,13 +6,13 @@ export { default as Layer } from './layer.mjs';
|
|
|
6
6
|
export { default as extendConfig } from './utils/extend-config.mjs';
|
|
7
7
|
export { default as reorderForReadableClasses } from './utils/reorder-for-readable-classes.mjs';
|
|
8
8
|
export { default as areRuleModesEqual } from './utils/are-rule-modes-equal.mjs';
|
|
9
|
-
export { default as
|
|
9
|
+
export { default as areRuleAtEqual } from './utils/are-rule-at-equal.mjs';
|
|
10
10
|
export { default as areRuleSelectorsEqual } from './utils/are-rule-selectors-equal.mjs';
|
|
11
11
|
export { default as areRuleStatesEqual } from './utils/are-rule-states-equal.mjs';
|
|
12
12
|
export { default as areRulesDuplicated } from './utils/are-rules-duplicated.mjs';
|
|
13
13
|
export { default as generateCSS } from './utils/generate-css.mjs';
|
|
14
14
|
export { default as isCoreRule } from './utils/is-core-rule.mjs';
|
|
15
|
-
export { default as
|
|
15
|
+
export { default as at } from './config/at.mjs';
|
|
16
16
|
export { default as selectors } from './config/selectors.mjs';
|
|
17
17
|
export { default as utilities } from './config/utilities.mjs';
|
|
18
18
|
export { default as functions } from './config/functions.mjs';
|
package/dist/rule.cjs
CHANGED
|
@@ -267,7 +267,7 @@ class Rule {
|
|
|
267
267
|
','
|
|
268
268
|
];
|
|
269
269
|
const { scope, important, modes } = css.config;
|
|
270
|
-
const { selectors,
|
|
270
|
+
const { selectors, at, stylesBy, animations } = css;
|
|
271
271
|
const classNames = stylesBy[className];
|
|
272
272
|
if (create) create.call(this, className);
|
|
273
273
|
// 1. value / selectorToken
|
|
@@ -480,14 +480,14 @@ class Rule {
|
|
|
480
480
|
value: 'and'
|
|
481
481
|
});
|
|
482
482
|
} else if (atComponentToken.startsWith('')) {
|
|
483
|
-
const
|
|
484
|
-
if (
|
|
485
|
-
const match =
|
|
483
|
+
const targetAt = at[atComponentToken];
|
|
484
|
+
if (targetAt && typeof targetAt === 'string') {
|
|
485
|
+
const match = targetAt.match(queryTypeRegExp);
|
|
486
486
|
queryType = match ? match[1] : '';
|
|
487
|
-
if (!queryType) throw new Error(`Invalid query '${atComponentToken}': '${
|
|
487
|
+
if (!queryType) throw new Error(`Invalid query '${atComponentToken}': '${targetAt}'`);
|
|
488
488
|
atComponents.push({
|
|
489
489
|
type: 'arbitrary',
|
|
490
|
-
value:
|
|
490
|
+
value: targetAt.slice(match ? match[1].length + 1 : 0)
|
|
491
491
|
});
|
|
492
492
|
} else {
|
|
493
493
|
// todo: container queries
|
|
@@ -506,12 +506,12 @@ class Rule {
|
|
|
506
506
|
extremumOperator = '<';
|
|
507
507
|
featureName = 'max-width';
|
|
508
508
|
correction = -.02;
|
|
509
|
-
} else if (atComponentToken.startsWith('>=') ||
|
|
509
|
+
} else if (atComponentToken.startsWith('>=') || targetAt) {
|
|
510
510
|
extremumOperator = '>=';
|
|
511
511
|
featureName = 'min-width';
|
|
512
512
|
}
|
|
513
513
|
const token = extremumOperator ? atComponentToken.replace(extremumOperator, '') : atComponentToken;
|
|
514
|
-
const viewport =
|
|
514
|
+
const viewport = at[token];
|
|
515
515
|
switch(featureName){
|
|
516
516
|
case 'max-width':
|
|
517
517
|
case 'min-width':
|
package/dist/rule.mjs
CHANGED
|
@@ -265,7 +265,7 @@ class Rule {
|
|
|
265
265
|
','
|
|
266
266
|
];
|
|
267
267
|
const { scope, important, modes } = css.config;
|
|
268
|
-
const { selectors,
|
|
268
|
+
const { selectors, at, stylesBy, animations } = css;
|
|
269
269
|
const classNames = stylesBy[className];
|
|
270
270
|
if (create) create.call(this, className);
|
|
271
271
|
// 1. value / selectorToken
|
|
@@ -478,14 +478,14 @@ class Rule {
|
|
|
478
478
|
value: 'and'
|
|
479
479
|
});
|
|
480
480
|
} else if (atComponentToken.startsWith('')) {
|
|
481
|
-
const
|
|
482
|
-
if (
|
|
483
|
-
const match =
|
|
481
|
+
const targetAt = at[atComponentToken];
|
|
482
|
+
if (targetAt && typeof targetAt === 'string') {
|
|
483
|
+
const match = targetAt.match(queryTypeRegExp);
|
|
484
484
|
queryType = match ? match[1] : '';
|
|
485
|
-
if (!queryType) throw new Error(`Invalid query '${atComponentToken}': '${
|
|
485
|
+
if (!queryType) throw new Error(`Invalid query '${atComponentToken}': '${targetAt}'`);
|
|
486
486
|
atComponents.push({
|
|
487
487
|
type: 'arbitrary',
|
|
488
|
-
value:
|
|
488
|
+
value: targetAt.slice(match ? match[1].length + 1 : 0)
|
|
489
489
|
});
|
|
490
490
|
} else {
|
|
491
491
|
// todo: container queries
|
|
@@ -504,12 +504,12 @@ class Rule {
|
|
|
504
504
|
extremumOperator = '<';
|
|
505
505
|
featureName = 'max-width';
|
|
506
506
|
correction = -.02;
|
|
507
|
-
} else if (atComponentToken.startsWith('>=') ||
|
|
507
|
+
} else if (atComponentToken.startsWith('>=') || targetAt) {
|
|
508
508
|
extremumOperator = '>=';
|
|
509
509
|
featureName = 'min-width';
|
|
510
510
|
}
|
|
511
511
|
const token = extremumOperator ? atComponentToken.replace(extremumOperator, '') : atComponentToken;
|
|
512
|
-
const viewport =
|
|
512
|
+
const viewport = at[token];
|
|
513
513
|
switch(featureName){
|
|
514
514
|
case 'max-width':
|
|
515
515
|
case 'min-width':
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
function
|
|
3
|
+
function areRuleAtEqual(aRule, bRule) {
|
|
4
4
|
const aQueryTypes = Object.keys(aRule.at);
|
|
5
5
|
const bQueryTypes = Object.keys(bRule.at);
|
|
6
6
|
if (aQueryTypes.length !== bQueryTypes.length) {
|
|
@@ -19,4 +19,4 @@ function areRuleQueriesEqual(aRule, bRule) {
|
|
|
19
19
|
return true;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
module.exports =
|
|
22
|
+
module.exports = areRuleAtEqual;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
function
|
|
1
|
+
function areRuleAtEqual(aRule, bRule) {
|
|
2
2
|
const aQueryTypes = Object.keys(aRule.at);
|
|
3
3
|
const bQueryTypes = Object.keys(bRule.at);
|
|
4
4
|
if (aQueryTypes.length !== bQueryTypes.length) {
|
|
@@ -17,4 +17,4 @@ function areRuleQueriesEqual(aRule, bRule) {
|
|
|
17
17
|
return true;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
export {
|
|
20
|
+
export { areRuleAtEqual as default };
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
var areRuleSelectorsEqual = require('./are-rule-selectors-equal.cjs');
|
|
4
4
|
var areRuleModesEqual = require('./are-rule-modes-equal.cjs');
|
|
5
|
-
var
|
|
5
|
+
var areRuleAtEqual = require('./are-rule-at-equal.cjs');
|
|
6
6
|
|
|
7
7
|
function areRuleStatesEqual(aRule, bRule) {
|
|
8
|
-
return areRuleSelectorsEqual(aRule, bRule) && areRuleModesEqual(aRule, bRule) &&
|
|
8
|
+
return areRuleSelectorsEqual(aRule, bRule) && areRuleModesEqual(aRule, bRule) && areRuleAtEqual(aRule, bRule);
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
module.exports = areRuleStatesEqual;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import areRuleSelectorsEqual from './are-rule-selectors-equal.mjs';
|
|
2
2
|
import areRuleModesEqual from './are-rule-modes-equal.mjs';
|
|
3
|
-
import
|
|
3
|
+
import areRuleAtEqual from './are-rule-at-equal.mjs';
|
|
4
4
|
|
|
5
5
|
function areRuleStatesEqual(aRule, bRule) {
|
|
6
|
-
return areRuleSelectorsEqual(aRule, bRule) && areRuleModesEqual(aRule, bRule) &&
|
|
6
|
+
return areRuleSelectorsEqual(aRule, bRule) && areRuleModesEqual(aRule, bRule) && areRuleAtEqual(aRule, bRule);
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
export { areRuleStatesEqual as default };
|
|
@@ -20,8 +20,8 @@ function extendConfig(...configs) {
|
|
|
20
20
|
if (clonedConfig.styles) {
|
|
21
21
|
formatDeeply(clonedConfig.styles);
|
|
22
22
|
}
|
|
23
|
-
if (clonedConfig.
|
|
24
|
-
formatDeeply(clonedConfig.
|
|
23
|
+
if (clonedConfig.at) {
|
|
24
|
+
formatDeeply(clonedConfig.at);
|
|
25
25
|
}
|
|
26
26
|
if (clonedConfig.variables) {
|
|
27
27
|
formatDeeply(clonedConfig.variables);
|
|
@@ -30,6 +30,7 @@ function extendConfig(...configs) {
|
|
|
30
30
|
};
|
|
31
31
|
const formattedConfigs = [];
|
|
32
32
|
for (const eachConfig of configs){
|
|
33
|
+
if (!eachConfig) continue;
|
|
33
34
|
(function getConfigsDeeply(config) {
|
|
34
35
|
if (config.extends?.length) {
|
|
35
36
|
for (const eachExtend of config.extends){
|
|
@@ -42,7 +43,7 @@ function extendConfig(...configs) {
|
|
|
42
43
|
let extendedConfig = {
|
|
43
44
|
animations: {},
|
|
44
45
|
styles: {},
|
|
45
|
-
|
|
46
|
+
at: {},
|
|
46
47
|
variables: {}
|
|
47
48
|
};
|
|
48
49
|
for(let i = 0; i < formattedConfigs.length; i++){
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { Config } from '../config';
|
|
2
|
-
export default function extendConfig(...configs: Config[]): Config;
|
|
2
|
+
export default function extendConfig(...configs: (Config | undefined)[]): Config;
|
|
@@ -18,8 +18,8 @@ function extendConfig(...configs) {
|
|
|
18
18
|
if (clonedConfig.styles) {
|
|
19
19
|
formatDeeply(clonedConfig.styles);
|
|
20
20
|
}
|
|
21
|
-
if (clonedConfig.
|
|
22
|
-
formatDeeply(clonedConfig.
|
|
21
|
+
if (clonedConfig.at) {
|
|
22
|
+
formatDeeply(clonedConfig.at);
|
|
23
23
|
}
|
|
24
24
|
if (clonedConfig.variables) {
|
|
25
25
|
formatDeeply(clonedConfig.variables);
|
|
@@ -28,6 +28,7 @@ function extendConfig(...configs) {
|
|
|
28
28
|
};
|
|
29
29
|
const formattedConfigs = [];
|
|
30
30
|
for (const eachConfig of configs){
|
|
31
|
+
if (!eachConfig) continue;
|
|
31
32
|
(function getConfigsDeeply(config) {
|
|
32
33
|
if (config.extends?.length) {
|
|
33
34
|
for (const eachExtend of config.extends){
|
|
@@ -40,7 +41,7 @@ function extendConfig(...configs) {
|
|
|
40
41
|
let extendedConfig = {
|
|
41
42
|
animations: {},
|
|
42
43
|
styles: {},
|
|
43
|
-
|
|
44
|
+
at: {},
|
|
44
45
|
variables: {}
|
|
45
46
|
};
|
|
46
47
|
for(let i = 0; i < formattedConfigs.length; i++){
|
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 src"},"license":"MIT","description":"The CSS language and framework for rapidly building modern and high-performance websites","author":"Aoyue Design LLC.","funding":"https://css.master.co/docs/donate","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":{".":{"require":"./dist/index.cjs","import":"./dist/index.mjs","types":"./dist/index.d.ts"}},"bin":"./dist/bin/index.mjs","files":["dist"],"publishConfig":{"access":"public","provenance":true},"dependencies":{"@master/colors":"^2.0.0","@master/normal.css":"^3.0.0","@techor/extend":"^3.0.22","csstype":"^3.1.3"},"devDependencies":{"@master/css-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 src"},"license":"MIT","description":"The CSS language and framework for rapidly building modern and high-performance websites","author":"Aoyue Design LLC.","funding":"https://css.master.co/docs/donate","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":{".":{"require":"./dist/index.cjs","import":"./dist/index.mjs","types":"./dist/index.d.ts"}},"bin":"./dist/bin/index.mjs","files":["dist"],"publishConfig":{"access":"public","provenance":true},"dependencies":{"@master/colors":"^2.0.0","@master/normal.css":"^3.0.0","@techor/extend":"^3.0.22","csstype":"^3.1.3"},"devDependencies":{"@master/css-shared":"^2.0.0-rc.40"},"version":"2.0.0-rc.40"}
|
package/dist/config/queries.d.ts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
declare const queries: {
|
|
2
|
-
'4xs': number;
|
|
3
|
-
'3xs': number;
|
|
4
|
-
'2xs': number;
|
|
5
|
-
xs: number;
|
|
6
|
-
sm: number;
|
|
7
|
-
md: number;
|
|
8
|
-
lg: number;
|
|
9
|
-
xl: number;
|
|
10
|
-
'2xl': number;
|
|
11
|
-
'3xl': number;
|
|
12
|
-
'4xl': number;
|
|
13
|
-
all: string;
|
|
14
|
-
print: string;
|
|
15
|
-
screen: string;
|
|
16
|
-
speech: string;
|
|
17
|
-
landscape: string;
|
|
18
|
-
portrait: string;
|
|
19
|
-
motion: string;
|
|
20
|
-
'reduced-motion': string;
|
|
21
|
-
};
|
|
22
|
-
export default queries;
|