@master/css 2.0.0-rc.27 → 2.0.0-rc.28
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/index.cjs +3 -2
- package/dist/config/index.d.ts +4 -1
- package/dist/config/index.mjs +3 -2
- package/dist/config/modes.cjs +8 -0
- package/dist/config/modes.d.ts +3 -0
- package/dist/config/modes.mjs +6 -0
- package/dist/core.cjs +1 -1
- package/dist/core.mjs +1 -1
- package/dist/rule.cjs +3 -3
- package/dist/rule.mjs +3 -3
- package/package.json +1 -1
package/dist/config/index.cjs
CHANGED
|
@@ -6,6 +6,7 @@ var utilities = require('./utilities.cjs');
|
|
|
6
6
|
var animations = require('./animations.cjs');
|
|
7
7
|
var variables = require('./variables.cjs');
|
|
8
8
|
var rules = require('./rules.cjs');
|
|
9
|
+
var modes = require('./modes.cjs');
|
|
9
10
|
var functions = require('./functions.cjs');
|
|
10
11
|
|
|
11
12
|
const config = {
|
|
@@ -16,12 +17,12 @@ const config = {
|
|
|
16
17
|
functions,
|
|
17
18
|
animations,
|
|
18
19
|
variables,
|
|
20
|
+
modes,
|
|
19
21
|
scope: '',
|
|
20
22
|
rootSize: 16,
|
|
21
23
|
baseUnit: 4,
|
|
22
24
|
override: false,
|
|
23
|
-
important: false
|
|
24
|
-
modeDriver: 'class'
|
|
25
|
+
important: false
|
|
25
26
|
};
|
|
26
27
|
|
|
27
28
|
exports.queries = queries;
|
package/dist/config/index.d.ts
CHANGED
|
@@ -41,6 +41,9 @@ export type UtilityDefinitions = {
|
|
|
41
41
|
} & {
|
|
42
42
|
[key: string]: PropertiesHyphen;
|
|
43
43
|
};
|
|
44
|
+
export type ModeDefinitions = {
|
|
45
|
+
[key: string]: 'class' | 'media' | 'host';
|
|
46
|
+
};
|
|
44
47
|
export interface FunctionDefinition {
|
|
45
48
|
unit?: string;
|
|
46
49
|
transform?(this: Rule, value: string, bypassVariableNames: string[]): string | ValueComponent[];
|
|
@@ -63,5 +66,5 @@ export interface Config {
|
|
|
63
66
|
override?: boolean;
|
|
64
67
|
functions?: FunctionDefinitions;
|
|
65
68
|
animations?: AnimationDefinitions;
|
|
66
|
-
|
|
69
|
+
modes?: Record<string, 'class' | 'media' | 'host' | false>;
|
|
67
70
|
}
|
package/dist/config/index.mjs
CHANGED
|
@@ -4,6 +4,7 @@ import utilities from './utilities.mjs';
|
|
|
4
4
|
import animations from './animations.mjs';
|
|
5
5
|
import variables from './variables.mjs';
|
|
6
6
|
import rules from './rules.mjs';
|
|
7
|
+
import modes from './modes.mjs';
|
|
7
8
|
import functions from './functions.mjs';
|
|
8
9
|
|
|
9
10
|
const config = {
|
|
@@ -14,12 +15,12 @@ const config = {
|
|
|
14
15
|
functions,
|
|
15
16
|
animations,
|
|
16
17
|
variables,
|
|
18
|
+
modes,
|
|
17
19
|
scope: '',
|
|
18
20
|
rootSize: 16,
|
|
19
21
|
baseUnit: 4,
|
|
20
22
|
override: false,
|
|
21
|
-
important: false
|
|
22
|
-
modeDriver: 'class'
|
|
23
|
+
important: false
|
|
23
24
|
};
|
|
24
25
|
|
|
25
26
|
export { animations, config, functions, queries, rules, selectors, utilities, variables };
|
package/dist/core.cjs
CHANGED
|
@@ -922,7 +922,7 @@ class MasterCSS {
|
|
|
922
922
|
let mediaConditionText;
|
|
923
923
|
let selectorText;
|
|
924
924
|
if (mode) {
|
|
925
|
-
switch(this.config.
|
|
925
|
+
switch(this.config.modes?.[mode]){
|
|
926
926
|
case 'media':
|
|
927
927
|
mediaConditionText = `@media(prefers-color-scheme:${mode})`;
|
|
928
928
|
selectorText = ':root';
|
package/dist/core.mjs
CHANGED
|
@@ -918,7 +918,7 @@ class MasterCSS {
|
|
|
918
918
|
let mediaConditionText;
|
|
919
919
|
let selectorText;
|
|
920
920
|
if (mode) {
|
|
921
|
-
switch(this.config.
|
|
921
|
+
switch(this.config.modes?.[mode]){
|
|
922
922
|
case 'media':
|
|
923
923
|
mediaConditionText = `@media(prefers-color-scheme:${mode})`;
|
|
924
924
|
selectorText = ':root';
|
package/dist/rule.cjs
CHANGED
|
@@ -266,7 +266,7 @@ class Rule {
|
|
|
266
266
|
if (!definition.separators) definition.separators = [
|
|
267
267
|
','
|
|
268
268
|
];
|
|
269
|
-
const { scope, important,
|
|
269
|
+
const { scope, important, modes } = css.config;
|
|
270
270
|
const { selectors, queries, stylesBy, animations } = css;
|
|
271
271
|
const classNames = stylesBy[className];
|
|
272
272
|
if (create) create.call(this, className);
|
|
@@ -624,7 +624,7 @@ class Rule {
|
|
|
624
624
|
const prefixSelectors = this.vendorPrefixSelectors[prefixSelectorVendor];
|
|
625
625
|
const suffixSelectors = this.vendorSuffixSelectors[eachSuffixSelectorVendor];
|
|
626
626
|
const prefixTexts = prefixSelectors.map((eachPrefixSelector)=>eachPrefixSelector + prefixText);
|
|
627
|
-
const getCssText = (name)=>prefixTexts.map((eachPrefixText)=>(this.mode &&
|
|
627
|
+
const getCssText = (name)=>prefixTexts.map((eachPrefixText)=>(this.mode && modes?.[this.mode] !== 'media' ? modes?.[this.mode] === 'host' ? `:host(.${this.mode}) ` : `.${this.mode} ` : '') + (scope ? scope + ' ' : '') + eachPrefixText).reduce((arr, eachPrefixText)=>{
|
|
628
628
|
arr.push(suffixSelectors.reduce((_arr, eachSuffixSelector)=>{
|
|
629
629
|
_arr.push(eachPrefixText + '.' + cssEscape(name) + eachSuffixSelector);
|
|
630
630
|
return _arr;
|
|
@@ -635,7 +635,7 @@ class Rule {
|
|
|
635
635
|
for (const key of Object.keys(this.at).sort((_a, b)=>b === 'supports' ? -1 : 1)){
|
|
636
636
|
cssText = '@' + key + (key.includes(' ') ? '' : ' ') + this.at[key].map((eachAtComponent)=>this.resolveAtComponent(eachAtComponent)).join(' ') + '{' + cssText + '}';
|
|
637
637
|
}
|
|
638
|
-
if (this.mode &&
|
|
638
|
+
if (this.mode && modes?.[this.mode] === 'media') {
|
|
639
639
|
cssText = `@media(prefers-color-scheme:${this.mode}){` + cssText + '}';
|
|
640
640
|
}
|
|
641
641
|
this.natives.push({
|
package/dist/rule.mjs
CHANGED
|
@@ -264,7 +264,7 @@ class Rule {
|
|
|
264
264
|
if (!definition.separators) definition.separators = [
|
|
265
265
|
','
|
|
266
266
|
];
|
|
267
|
-
const { scope, important,
|
|
267
|
+
const { scope, important, modes } = css.config;
|
|
268
268
|
const { selectors, queries, stylesBy, animations } = css;
|
|
269
269
|
const classNames = stylesBy[className];
|
|
270
270
|
if (create) create.call(this, className);
|
|
@@ -622,7 +622,7 @@ class Rule {
|
|
|
622
622
|
const prefixSelectors = this.vendorPrefixSelectors[prefixSelectorVendor];
|
|
623
623
|
const suffixSelectors = this.vendorSuffixSelectors[eachSuffixSelectorVendor];
|
|
624
624
|
const prefixTexts = prefixSelectors.map((eachPrefixSelector)=>eachPrefixSelector + prefixText);
|
|
625
|
-
const getCssText = (name)=>prefixTexts.map((eachPrefixText)=>(this.mode &&
|
|
625
|
+
const getCssText = (name)=>prefixTexts.map((eachPrefixText)=>(this.mode && modes?.[this.mode] !== 'media' ? modes?.[this.mode] === 'host' ? `:host(.${this.mode}) ` : `.${this.mode} ` : '') + (scope ? scope + ' ' : '') + eachPrefixText).reduce((arr, eachPrefixText)=>{
|
|
626
626
|
arr.push(suffixSelectors.reduce((_arr, eachSuffixSelector)=>{
|
|
627
627
|
_arr.push(eachPrefixText + '.' + cssEscape(name) + eachSuffixSelector);
|
|
628
628
|
return _arr;
|
|
@@ -633,7 +633,7 @@ class Rule {
|
|
|
633
633
|
for (const key of Object.keys(this.at).sort((_a, b)=>b === 'supports' ? -1 : 1)){
|
|
634
634
|
cssText = '@' + key + (key.includes(' ') ? '' : ' ') + this.at[key].map((eachAtComponent)=>this.resolveAtComponent(eachAtComponent)).join(' ') + '{' + cssText + '}';
|
|
635
635
|
}
|
|
636
|
-
if (this.mode &&
|
|
636
|
+
if (this.mode && modes?.[this.mode] === 'media') {
|
|
637
637
|
cssText = `@media(prefers-color-scheme:${this.mode}){` + cssText + '}';
|
|
638
638
|
}
|
|
639
639
|
this.natives.push({
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"@master/css","type":"module","scripts":{"build":"techor build \"src/**/*.ts\"","dev":"pnpm build --watch","test":"jest","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/css"},"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":"^2.1.0","@techor/extend":"^3.0.18"},"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":"jest","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/css"},"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":"^2.1.0","@techor/extend":"^3.0.18"},"devDependencies":{"@master/css-shared":"^2.0.0-rc.28","csstype":"^3.1.3"},"version":"2.0.0-rc.28"}
|