@master/css 2.0.0-beta.174 → 2.0.0-beta.176

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,9 +1,8 @@
1
1
  #!/usr/bin/env node
2
- var y=Object.create;var d=Object.defineProperty;var C=Object.getOwnPropertyDescriptor;var _=Object.getOwnPropertyNames;var v=Object.getPrototypeOf,x=Object.prototype.hasOwnProperty;var E=(e,s,t,i)=>{if(s&&typeof s=="object"||typeof s=="function")for(let o of _(s))!x.call(e,o)&&o!==t&&d(e,o,{get:()=>s[o],enumerable:!(i=C(s,o))||i.enumerable});return e};var p=(e,s,t)=>(t=e!=null?y(v(e)):{},E(s||!e||!e.__esModule?d(t,"default",{value:e,enumerable:!0}):t,e));var T=require("commander"),m=p(require("path")),c=p(require("fs"));var S=`/** @type {import('@master/css').Config} */
2
+ var y=Object.create;var d=Object.defineProperty;var C=Object.getOwnPropertyDescriptor;var _=Object.getOwnPropertyNames;var v=Object.getPrototypeOf,x=Object.prototype.hasOwnProperty;var E=(e,t,o,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of _(t))!x.call(e,s)&&s!==o&&d(e,s,{get:()=>t[s],enumerable:!(i=C(t,s))||i.enumerable});return e};var p=(e,t,o)=>(o=e!=null?y(v(e)):{},E(t||!e||!e.__esModule?d(o,"default",{value:e,enumerable:!0}):o,e));var h=require("commander"),m=p(require("path")),c=p(require("fs"));var S=`/** @type {import('@master/css').Config} */
3
3
  export default {
4
4
  classes: {},
5
5
  colors: {},
6
- themes: {},
7
6
  rules: {},
8
7
  values: {},
9
8
  semantics: {},
@@ -17,7 +16,6 @@ export default {
17
16
  module.exports = {
18
17
  classes: {},
19
18
  colors: {},
20
- themes: {},
21
19
  rules: {},
22
20
  values: {},
23
21
  semantics: {},
@@ -27,12 +25,11 @@ module.exports = {
27
25
  selectors: {},
28
26
  functions: {}
29
27
  }
30
- `;var h=`import type { Config } from '@master/css'
28
+ `;var T=`import type { Config } from '@master/css'
31
29
 
32
30
  export default {
33
31
  classes: {},
34
32
  colors: {},
35
- themes: {},
36
33
  rules: {},
37
34
  values: {},
38
35
  semantics: {},
@@ -42,4 +39,4 @@ export default {
42
39
  selectors: {},
43
40
  functions: {}
44
41
  } as Config
45
- `;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")),a=new T.Command;a.name(w).description(j).version(O||"0.0.0");a.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:s,ts:t,cjs:i}=e;if(!s&&!t&&!i)if(c.default.existsSync("tsconfig.json"))t=!0;else{let{type:r}=(0,l.readJSONFileSync)("./package.json")||{};r==="module"?s=!0:i=!0}let o=(r,f)=>{let u=c.default.existsSync(m.default.join(process.cwd(),r));u?u&&e.override?(c.default.writeFileSync(r,f),n.default.ok`**${r}** file is overridden`):n.default.x`**${r}** file already exists`:(c.default.writeFileSync(r,f),n.default.ok`**${r}** file is created`)};s&&o("master.css.mjs",S),t&&o("master.css.ts",h),i&&o("master.css.js",g)});a.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,s){try{await require("@master/css-renderer/actions/main")(e,s)}catch(t){t.code==="ERR_MODULE_NOT_FOUND"?n.default.i`Please run **npm** **install** **@master/css-renderer** first`:console.error(t)}});a.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,s){try{await require("@master/css-extractor/actions/main")(e,s)}catch(t){t.code==="ERR_MODULE_NOT_FOUND"?n.default.i`Please run **npm** **install** **@master/css-extractor** first`:console.error(t)}});a.parse();
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")),a=new h.Command;a.name(w).description(j).version(O||"0.0.0");a.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:t,ts:o,cjs:i}=e;if(!t&&!o&&!i)if(c.default.existsSync("tsconfig.json"))o=!0;else{let{type:r}=(0,l.readJSONFileSync)("./package.json")||{};r==="module"?t=!0:i=!0}let s=(r,f)=>{let u=c.default.existsSync(m.default.join(process.cwd(),r));u?u&&e.override?(c.default.writeFileSync(r,f),n.default.ok`**${r}** file is overridden`):n.default.x`**${r}** file already exists`:(c.default.writeFileSync(r,f),n.default.ok`**${r}** file is created`)};t&&s("master.css.mjs",S),o&&s("master.css.ts",T),i&&s("master.css.js",g)});a.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,t){try{await require("@master/css-renderer/actions/main")(e,t)}catch(o){o.code==="ERR_MODULE_NOT_FOUND"?n.default.i`Please run **npm** **install** **@master/css-renderer** first`:console.error(o)}});a.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,t){try{await require("@master/css-extractor/actions/main")(e,t)}catch(o){o.code==="ERR_MODULE_NOT_FOUND"?n.default.i`Please run **npm** **install** **@master/css-extractor** first`:console.error(o)}});a.parse();
@@ -1,8 +1,3 @@
1
- import type { CSSProperties } from '../types/css-properties';
2
- declare const animations: Animations;
1
+ import type { Config } from './';
2
+ declare const animations: Config['animations'];
3
3
  export default animations;
4
- export type Animations = Record<string, {
5
- [key in 'from' | 'to']?: CSSProperties;
6
- } & {
7
- [key: string]: CSSProperties;
8
- }>;
@@ -1,5 +1,3 @@
1
- declare const colors: Colors;
1
+ import type { Config } from './';
2
+ declare const colors: Config['colors'];
2
3
  export default colors;
3
- export type Colors = {
4
- [key: string]: string | Colors;
5
- };
@@ -1,10 +1,6 @@
1
- import type { MasterCSS } from '../core';
2
1
  declare const fonts: {
3
2
  mono: string[];
4
3
  sans: string[];
5
4
  serif: string[];
6
5
  };
7
6
  export default fonts;
8
- export type Fonts = {
9
- [key: string]: string | string[];
10
- } | ((css: MasterCSS) => Fonts);
@@ -1,9 +1,3 @@
1
- import { Rule } from '../rule';
2
- declare const functions: Functions;
1
+ import type { Config } from './';
2
+ declare const functions: Config['functions'];
3
3
  export default functions;
4
- export interface FunctionConfig {
5
- unit?: string;
6
- name?: string;
7
- transform?(this: Rule, value: string): string;
8
- }
9
- export type Functions = Record<string, FunctionConfig>;
@@ -1,40 +1,89 @@
1
- import viewports, { type Viewports } from './viewports';
2
- import colors, { type Colors } from './colors';
3
- import selectors, { type Selectors } from './selectors';
4
- import semantics, { type Semantics } from './semantics';
5
- import animations, { type Animations } from './animations';
6
- import rules, { type Rules } from './rules';
7
- import functions, { type Functions } from './functions';
8
- import rootSize from './root-size';
9
- import scope from './scope';
10
- import override from './override';
1
+ import viewports from './viewports';
2
+ import colors from './colors';
3
+ import selectors from './selectors';
4
+ import semantics from './semantics';
5
+ import animations from './animations';
6
+ import rules from './rules';
7
+ import functions from './functions';
11
8
  import fonts from './fonts';
12
- import important from './important';
13
- import themeDriver, { type ThemeDriver } from './theme-driver';
14
- import type { MediaQueries } from './media-queries';
15
- import type { Values } from './values';
16
- import type { Classes } from './classes';
17
- import type { Fonts } from './fonts';
9
+ import { CSSDeclarations } from '../types/css-declarations';
10
+ import type { Rule } from '../rule';
11
+ import type { MasterCSS } from '../core';
12
+ import { CoreLayer, Layer } from '../layer';
18
13
  declare const config: Config;
19
- export { config, viewports, colors, rootSize, scope, selectors, semantics, rules, fonts, override, important, functions, animations, themeDriver, Viewports, Colors, MediaQueries, Values, Classes, Selectors, Semantics, Rules, Fonts, Functions, Animations, ThemeDriver };
14
+ export { config, viewports, colors, selectors, semantics, rules, fonts, functions, animations };
15
+ type ExtendedValues = {
16
+ [key: string]: string | number | ExtendedValues;
17
+ };
18
+ export interface RuleConfig {
19
+ id?: string;
20
+ match?: RegExp | [string, string[]?];
21
+ _resolvedMatch?: RegExp;
22
+ order?: number;
23
+ separators?: string[];
24
+ colored?: boolean;
25
+ numeric?: boolean;
26
+ unit?: any;
27
+ native?: boolean;
28
+ _semantic?: boolean;
29
+ _declarations?: CSSDeclarations;
30
+ _propName?: string;
31
+ layer?: Layer | CoreLayer;
32
+ values?: Config['values'];
33
+ analyze?(this: Rule, className: string): [valueToken: string, prefixToken?: string];
34
+ transform?(this: Rule, value: string): string;
35
+ declare?(this: Rule, value: string, unit: string): CSSDeclarations;
36
+ delete?(this: Rule, className: string): void;
37
+ create?(this: Rule, className: string): void;
38
+ insert?(this: Rule): void;
39
+ }
20
40
  export interface Config {
21
41
  extends?: (Config | {
22
42
  config: Config;
23
43
  })[];
24
- classes?: Classes;
25
- colors?: Colors;
26
- viewports?: Viewports;
27
- mediaQueries?: MediaQueries;
28
- selectors?: Selectors;
29
- semantics?: Semantics;
30
- values?: Values;
31
- fonts?: Fonts;
32
- rules?: Rules;
44
+ classes?: {
45
+ [key: string]: string | Config['classes'];
46
+ };
47
+ colors?: {
48
+ [key: string]: string | Config['colors'];
49
+ };
50
+ viewports?: {
51
+ [key: string]: number | Config['viewports'];
52
+ };
53
+ mediaQueries?: {
54
+ [key: string]: string | Config['mediaQueries'];
55
+ };
56
+ selectors?: {
57
+ [key: string]: string | string[] | Config['selectors'];
58
+ };
59
+ semantics?: {
60
+ [key in keyof typeof semantics]?: CSSDeclarations;
61
+ } & {
62
+ [key: string]: CSSDeclarations;
63
+ };
64
+ values?: ExtendedValues | ((this: MasterCSS, resolvedValues: Record<string, Record<string, string | number>>) => ExtendedValues);
65
+ fonts?: {
66
+ [key: string]: string | string[];
67
+ } | ((css: MasterCSS) => Config['fonts']);
68
+ rules?: {
69
+ [key in keyof typeof rules]?: RuleConfig;
70
+ } & {
71
+ [key: string]: RuleConfig;
72
+ };
33
73
  rootSize?: number;
34
74
  scope?: string;
35
75
  important?: boolean;
36
76
  override?: boolean;
37
- functions?: Functions;
38
- animations?: Animations;
39
- themeDriver?: ThemeDriver;
77
+ functions?: Record<string, {
78
+ unit?: string;
79
+ name?: string;
80
+ colored?: boolean;
81
+ transform?(this: Rule, value: string): string;
82
+ }>;
83
+ animations?: Record<string, {
84
+ [key in 'from' | 'to']?: CSSDeclarations;
85
+ } & {
86
+ [key: string]: CSSDeclarations;
87
+ }>;
88
+ themeDriver?: 'class' | 'media' | 'host';
40
89
  }