@master/css 2.0.0-beta.191 → 2.0.0-beta.192

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.
@@ -1,8 +1,7 @@
1
1
  #!/usr/bin/env node
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} */
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,r)=>{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:!(r=C(o,s))||r.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
- colors: {},
6
5
  rules: {},
7
6
  variables: {},
8
7
  semantics: {},
@@ -14,7 +13,6 @@ export default {
14
13
  `;var g=`/** @type {import('@master/css').Config} */
15
14
  module.exports = {
16
15
  styles: {},
17
- colors: {},
18
16
  rules: {},
19
17
  variables: {},
20
18
  semantics: {},
@@ -27,7 +25,6 @@ module.exports = {
27
25
 
28
26
  export default {
29
27
  styles: {},
30
- colors: {},
31
28
  rules: {},
32
29
  variables: {},
33
30
  semantics: {},
@@ -36,4 +33,4 @@ export default {
36
33
  selectors: {},
37
34
  functions: {}
38
35
  } as Config
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();
36
+ `;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:r}=e;if(!o&&!t&&!r)if(a.default.existsSync("tsconfig.json"))t=!0;else{let{type:i}=(0,l.readJSONFileSync)("./package.json")||{};i==="module"?o=!0:r=!0}let s=(i,f)=>{let u=a.default.existsSync(m.default.join(process.cwd(),i));u?u&&e.override?(a.default.writeFileSync(i,f),n.default.ok`**${i}** file is overridden`):n.default.x`**${i}** file already exists`:(a.default.writeFileSync(i,f),n.default.ok`**${i}** file is created`)};o&&s("master.css.mjs",S),t&&s("master.css.ts",y),r&&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();
@@ -3,7 +3,30 @@ declare const functions: {
3
3
  transform(opening: any, value: any, closing: any): any;
4
4
  };
5
5
  calc: {
6
- transform(opening: any, value: any, closing: any): string;
6
+ transform(opening: any, value: any, closing: any): (string | number | {
7
+ type: "function";
8
+ name: string;
9
+ symbol: string;
10
+ childrens: (string | number | any | {
11
+ type: "variable";
12
+ name: string;
13
+ alpha?: string;
14
+ } | {
15
+ type: "separator";
16
+ value: string;
17
+ prefixWhite?: boolean;
18
+ suffixWhite?: boolean;
19
+ })[];
20
+ } | {
21
+ type: "variable";
22
+ name: string;
23
+ alpha?: string;
24
+ } | {
25
+ type: "separator";
26
+ value: string;
27
+ prefixWhite?: boolean;
28
+ suffixWhite?: boolean;
29
+ })[];
7
30
  };
8
31
  translate: {
9
32
  unit: string;
@@ -1,5 +1,4 @@
1
1
  import mediaQueries from './media-queries';
2
- import colors from './colors';
3
2
  import selectors from './selectors';
4
3
  import semantics from './semantics';
5
4
  import animations from './animations';
@@ -9,10 +8,12 @@ import functions from './functions';
9
8
  import { CSSDeclarations } from '../types/css-declarations';
10
9
  import type { Rule } from '../rule';
11
10
  declare const config: Config;
12
- export { config, mediaQueries, colors, selectors, semantics, rules, functions, animations, variables };
13
- type Variable = number | string | (number | string)[];
14
- type VariableGroup = {
15
- [key: string]: Variable;
11
+ export { config, mediaQueries, selectors, semantics, rules, functions, animations, variables };
12
+ export type ConfigVariable = number | string | Array<number | string>;
13
+ export type ConfigVariableGroup = {
14
+ [key in '' | `@${string}`]?: ConfigVariable;
15
+ } & {
16
+ [key: string]: ConfigVariable | ConfigVariableGroup;
16
17
  };
17
18
  export interface Config {
18
19
  extends?: (Config | {
@@ -21,9 +22,6 @@ export interface Config {
21
22
  styles?: {
22
23
  [key: string]: string | Config['styles'];
23
24
  };
24
- colors?: {
25
- [key: string]: string | Config['colors'];
26
- };
27
25
  mediaQueries?: {
28
26
  [key: string]: number | string | Config['mediaQueries'];
29
27
  };
@@ -36,9 +34,9 @@ export interface Config {
36
34
  [key: string]: CSSDeclarations;
37
35
  };
38
36
  variables?: {
39
- [key in keyof typeof rules]: VariableGroup;
40
- } | {
41
- [key in string]: VariableGroup | Variable;
37
+ [key in keyof typeof rules]?: ConfigVariableGroup;
38
+ } & {
39
+ [key: string]: ConfigVariableGroup | ConfigVariable;
42
40
  };
43
41
  rules?: {
44
42
  [key in keyof typeof rules | string]?: Rule['options'];
@@ -50,7 +48,7 @@ export interface Config {
50
48
  functions?: Record<string, {
51
49
  unit?: string;
52
50
  colored?: boolean;
53
- transform?(this: Rule, opening: string, value: string, closing: string): string;
51
+ transform?(this: Rule, opening: string, value: string, closing: string): string | Rule['valueNodes'];
54
52
  }>;
55
53
  animations?: Record<string, {
56
54
  [key in 'from' | 'to']?: CSSDeclarations;