@master/css 2.0.0-beta.184 → 2.0.0-beta.186

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 CHANGED
@@ -65,12 +65,12 @@ Visit [beta.css.master.co](https://beta.css.master.co) to view the full document
65
65
  ## Getting Started
66
66
  Check out the [official guides](https://beta.css.master.co/docs) to get started with Master CSS, or walk through the [examples](https://github.com/master-co/css/tree/beta/examples) for a quick overview of integrating with your framework.
67
67
 
68
- ## Compilation Modes
69
- Master CSS provides various [compilation modes](https://beta.css.master.co/docs/compilation), allowing you to choose according to the characteristics and needs of different projects.
68
+ ## Rendering Modes
69
+ Master CSS provides various [rendering modes](https://beta.css.master.co/docs/rendering-modes), allowing you to choose according to the characteristics and needs of different projects.
70
70
 
71
- - [Progressive Rendering](https://beta.css.master.co/docs/compilation/progressive-rendering) - Scan the requested HTML on the server side, generate CSS rules, and enable runtime-rendering compilation on the browser side
72
- - [Runtime Rendering](https://beta.css.master.co/docs/compilation/runtime-rendering) - Observe the DOM tree, manipulate CSS rules according to the changed class name, and synchronize to the running style sheet at runtime
73
- - [Static Extraction](https://beta.css.master.co/docs/compilation/static-extraction) - Scan source files for class names at build time, extract class names, and generate CSS files/virtual modules, then import them in the entry file
71
+ - [Progressive Rendering](https://beta.css.master.co/docs/rendering-modes/progressive-rendering) - Scan the requested HTML on the server side, generate CSS rules, and enable runtime engine on the browser side
72
+ - [Runtime Rendering](https://beta.css.master.co/docs/rendering-modes/runtime-rendering) - Observe the DOM tree, manipulate CSS rules according to the changed class name, and synchronize to the running style sheet at runtime
73
+ - [Static Extraction](https://beta.css.master.co/docs/rendering-modes/static-extraction) - Scan source files for class names at build time, extract class names, and generate CSS files/virtual modules, then import them in the entry file
74
74
 
75
75
  ## Ecosystem
76
76
  We've built various Master CSS core functionality/integration packages:
@@ -1,12 +1,11 @@
1
1
  #!/usr/bin/env node
2
- var h=Object.create;var d=Object.defineProperty;var C=Object.getOwnPropertyDescriptor;var _=Object.getOwnPropertyNames;var v=Object.getPrototypeOf,x=Object.prototype.hasOwnProperty;var E=(e,o,t,i)=>{if(o&&typeof o=="object"||typeof o=="function")for(let s of _(o))!x.call(e,s)&&s!==t&&d(e,s,{get:()=>o[s],enumerable:!(i=C(o,s))||i.enumerable});return e};var p=(e,o,t)=>(t=e!=null?h(v(e)):{},E(o||!e||!e.__esModule?d(t,"default",{value:e,enumerable:!0}):t,e));var T=require("commander"),m=p(require("path")),a=p(require("fs"));var S=`/** @type {import('@master/css').Config} */
2
+ var h=Object.create;var d=Object.defineProperty;var C=Object.getOwnPropertyDescriptor;var _=Object.getOwnPropertyNames;var x=Object.getPrototypeOf,E=Object.prototype.hasOwnProperty;var O=(e,o,t,i)=>{if(o&&typeof o=="object"||typeof o=="function")for(let s of _(o))!E.call(e,s)&&s!==t&&d(e,s,{get:()=>o[s],enumerable:!(i=C(o,s))||i.enumerable});return e};var p=(e,o,t)=>(t=e!=null?h(x(e)):{},O(o||!e||!e.__esModule?d(t,"default",{value:e,enumerable:!0}):t,e));var T=require("commander"),m=p(require("path")),a=p(require("fs"));var S=`/** @type {import('@master/css').Config} */
3
3
  export default {
4
4
  styles: {},
5
5
  colors: {},
6
6
  rules: {},
7
7
  variables: {},
8
8
  semantics: {},
9
- viewports: {},
10
9
  mediaQueries: {},
11
10
  animations: {},
12
11
  selectors: {},
@@ -19,7 +18,6 @@ module.exports = {
19
18
  rules: {},
20
19
  variables: {},
21
20
  semantics: {},
22
- viewports: {},
23
21
  mediaQueries: {},
24
22
  animations: {},
25
23
  selectors: {},
@@ -33,10 +31,9 @@ export default {
33
31
  rules: {},
34
32
  variables: {},
35
33
  semantics: {},
36
- viewports: {},
37
34
  mediaQueries: {},
38
35
  animations: {},
39
36
  selectors: {},
40
37
  functions: {}
41
38
  } as Config
42
- `;var n=p(require("@techor/log")),l=require("@techor/fs"),{version:O,name:w,description:j}=(0,l.readJSONFileSync)(m.default.resolve(__dirname,"../../package.json")),c=new T.Command;c.name(w).description(j).version(O||"0.0.0");c.command("init").description("Initialize definition files for Master CSS").option("-o, --override","Override existing definition file").option("--esm","ES Module .mjs").option("--ts","TypeScript .ts").option("--cjs","CommonJS .js").action(async function(e){let{esm:o,ts:t,cjs:i}=e;if(!o&&!t&&!i)if(a.default.existsSync("tsconfig.json"))t=!0;else{let{type:r}=(0,l.readJSONFileSync)("./package.json")||{};r==="module"?o=!0:i=!0}let s=(r,f)=>{let u=a.default.existsSync(m.default.join(process.cwd(),r));u?u&&e.override?(a.default.writeFileSync(r,f),n.default.ok`**${r}** file is overridden`):n.default.x`**${r}** file already exists`:(a.default.writeFileSync(r,f),n.default.ok`**${r}** file is created`)};o&&s("master.css.mjs",S),t&&s("master.css.ts",y),i&&s("master.css.js",g)});c.command("render").description("Scans HTML and injects generated CSS rules").argument("<source paths>","The path in glob patterns of the source of the HTML file").option("-c --config <path>","The source path of the Master CSS configuration","master.css.*").option("-a --analyze","Analyze injected CSS and HTML size ( brotli ) without writing to file").action(async function(e,o){try{await require("@master/css-renderer/actions/main")(e,o)}catch(t){t.code==="ERR_MODULE_NOT_FOUND"?n.default.i`Please run **npm** **install** **@master/css-renderer** first`:console.error(t)}});c.command("extract").argument("[source paths]","The glob pattern path to extract sources").option("-w, --watch","Watch file changed and generate CSS rules.").option("-o, --output <path>","Specify your CSS file output path").option("-v, --verbose","Verbose logging 0~N","1").option("--options <path>","Specify your extractor options sources","master.css-extractor.*").action(async function(e,o){try{await require("@master/css-extractor/actions/main")(e,o)}catch(t){t.code==="ERR_MODULE_NOT_FOUND"?n.default.i`Please run **npm** **install** **@master/css-extractor** first`:console.error(t)}});c.parse();
39
+ `;var n=p(require("@techor/log")),l=require("@techor/fs"),{version:v,name:j,description:F}=(0,l.readJSONFileSync)(m.default.resolve(__dirname,"../../package.json")),c=new T.Command;c.name(j).description(F).version(v||"0.0.0");c.command("init").description("Initialize definition files for Master CSS").option("-o, --override","Override existing definition file").option("--esm","ES Module .mjs").option("--ts","TypeScript .ts").option("--cjs","CommonJS .js").action(async function(e){let{esm:o,ts:t,cjs:i}=e;if(!o&&!t&&!i)if(a.default.existsSync("tsconfig.json"))t=!0;else{let{type:r}=(0,l.readJSONFileSync)("./package.json")||{};r==="module"?o=!0:i=!0}let s=(r,f)=>{let u=a.default.existsSync(m.default.join(process.cwd(),r));u?u&&e.override?(a.default.writeFileSync(r,f),n.default.ok`**${r}** file is overridden`):n.default.x`**${r}** file already exists`:(a.default.writeFileSync(r,f),n.default.ok`**${r}** file is created`)};o&&s("master.css.mjs",S),t&&s("master.css.ts",y),i&&s("master.css.js",g)});c.command("render").description("Scans HTML and injects generated CSS rules").argument("<source paths>","The path in glob patterns of the source of the HTML file").option("-c --config <path>","The source path of the Master CSS configuration","master.css.*").option("-a --analyze","Analyze injected CSS and HTML size ( brotli ) without writing to file").action(async function(e,o){try{await require("@master/css-renderer/actions/main")(e,o)}catch(t){t.code==="ERR_MODULE_NOT_FOUND"?n.default.i`Please run **npm** **install** **@master/css-renderer** first`:console.error(t)}});c.command("extract").argument("[source paths]","The glob pattern path to extract sources").option("-w, --watch","Watch file changed and generate CSS rules.").option("-o, --output <path>","Specify your CSS file output path").option("-v, --verbose","Verbose logging 0~N","1").option("--options <path>","Specify your extractor options sources","master.css-extractor.*").action(async function(e,o){try{await require("@master/css-extractor/actions/main")(e,o)}catch(t){t.code==="ERR_MODULE_NOT_FOUND"?n.default.i`Please run **npm** **install** **@master/css-extractor** first`:console.error(t)}});c.parse();
@@ -8,40 +8,11 @@ import rules from './rules';
8
8
  import functions from './functions';
9
9
  import { CSSDeclarations } from '../types/css-declarations';
10
10
  import type { Rule } from '../rule';
11
- import { CoreLayer, Layer } from '../layer';
12
11
  declare const config: Config;
13
12
  export { config, mediaQueries, colors, selectors, semantics, rules, functions, animations, variables };
14
- export interface RuleOptions {
15
- id?: string;
16
- match?: RegExp | [string, string[]?];
17
- resolvedMatch?: RegExp;
18
- resolvedVariables?: any;
19
- variables?: Record<string, string | number> | Array<string | number | Record<string, string | number>>;
20
- order?: number;
21
- separators?: string[];
22
- shorthand?: string;
23
- colored?: boolean;
24
- numeric?: boolean;
25
- unit?: any;
26
- native?: boolean;
27
- declarations?: CSSDeclarations;
28
- resolvedPropName?: string;
29
- layer?: Layer | CoreLayer;
30
- analyze?(this: Rule, className: string): [valueToken: string, prefixToken?: string];
31
- transform?(this: Rule, value: string): string;
32
- declare?(this: Rule, value: string, unit: string): CSSDeclarations;
33
- delete?(this: Rule, className: string): void;
34
- create?(this: Rule, className: string): void;
35
- insert?(this: Rule): void;
36
- }
37
- type VariableValue = number | string | VariableGroup | (number | string)[];
13
+ type Variable = number | string | (number | string)[];
38
14
  type VariableGroup = {
39
- [key: string]: VariableValue;
40
- };
41
- type Variables = {
42
- [key in keyof typeof rules]: VariableGroup;
43
- } | {
44
- [key in string]: VariableGroup | VariableValue;
15
+ [key: string]: Variable;
45
16
  };
46
17
  export interface Config {
47
18
  extends?: (Config | {
@@ -54,7 +25,7 @@ export interface Config {
54
25
  [key: string]: string | Config['colors'];
55
26
  };
56
27
  mediaQueries?: {
57
- [key: string]: number | Config['mediaQueries'];
28
+ [key: string]: number | string | Config['mediaQueries'];
58
29
  };
59
30
  selectors?: {
60
31
  [key: string]: string | string[] | Config['selectors'];
@@ -64,9 +35,13 @@ export interface Config {
64
35
  } & {
65
36
  [key: string]: CSSDeclarations;
66
37
  };
67
- variables?: Variables;
38
+ variables?: {
39
+ [key in keyof typeof rules]: VariableGroup;
40
+ } | {
41
+ [key in string]: VariableGroup | Variable;
42
+ };
68
43
  rules?: {
69
- [key in keyof typeof rules | string]?: RuleOptions;
44
+ [key in keyof typeof rules | string]?: Rule['options'];
70
45
  };
71
46
  rootSize?: number;
72
47
  scope?: string;