@master/css 2.0.0-beta.173 → 2.0.0-beta.175
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/bin/index.bundle.js +3 -6
- package/dist/config/animations.d.ts +2 -7
- package/dist/config/colors.d.ts +2 -4
- package/dist/config/fonts.d.ts +6 -0
- package/dist/config/functions.d.ts +2 -8
- package/dist/config/index.d.ts +79 -27
- package/dist/config/rules.d.ts +265 -276
- package/dist/config/selectors.d.ts +2 -4
- package/dist/config/semantics.d.ts +190 -8
- package/dist/config/viewports.d.ts +2 -4
- package/dist/constants/config-esm-text.d.ts +1 -1
- package/dist/constants/config-text.d.ts +1 -1
- package/dist/constants/config-ts-text.d.ts +1 -1
- package/dist/core.d.ts +16 -12
- package/dist/index.browser.bundle.js +1 -1
- package/dist/index.bundle.js +4 -7
- package/dist/index.bundle.mjs +4 -7
- package/dist/index.d.ts +2 -1
- package/dist/layer.d.ts +12 -0
- package/dist/rule.d.ts +5 -25
- package/dist/types/css-declarations.d.ts +4 -0
- package/package.json +1 -1
- package/dist/config/classes.d.ts +0 -3
- package/dist/config/important.d.ts +0 -2
- package/dist/config/media-queries.d.ts +0 -3
- package/dist/config/override.d.ts +0 -2
- package/dist/config/root-size.d.ts +0 -2
- package/dist/config/scope.d.ts +0 -2
- package/dist/config/theme-driver.d.ts +0 -3
- package/dist/config/values.d.ts +0 -3
- package/dist/types/css-properties.d.ts +0 -4
- package/dist/utils/camel-2-kebab.d.ts +0 -1
package/dist/bin/index.bundle.js
CHANGED
|
@@ -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,
|
|
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
|
|
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
|
|
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 {
|
|
2
|
-
declare const 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
|
-
}>;
|
package/dist/config/colors.d.ts
CHANGED
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
declare const 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>;
|
package/dist/config/index.d.ts
CHANGED
|
@@ -1,37 +1,89 @@
|
|
|
1
|
-
import viewports
|
|
2
|
-
import colors
|
|
3
|
-
import selectors
|
|
4
|
-
import semantics
|
|
5
|
-
import animations
|
|
6
|
-
import rules
|
|
7
|
-
import functions
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import type { MediaQueries } from './media-queries';
|
|
14
|
-
import type { Values } from './values';
|
|
15
|
-
import type { Classes } from './classes';
|
|
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';
|
|
8
|
+
import 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';
|
|
16
13
|
declare const config: Config;
|
|
17
|
-
export { config, viewports, colors,
|
|
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
|
+
}
|
|
18
40
|
export interface Config {
|
|
19
41
|
extends?: (Config | {
|
|
20
42
|
config: Config;
|
|
21
43
|
})[];
|
|
22
|
-
classes?:
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
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
|
+
};
|
|
30
73
|
rootSize?: number;
|
|
31
74
|
scope?: string;
|
|
32
75
|
important?: boolean;
|
|
33
76
|
override?: boolean;
|
|
34
|
-
functions?:
|
|
35
|
-
|
|
36
|
-
|
|
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';
|
|
37
89
|
}
|