@master/css 2.0.0-beta.206 → 2.0.0-beta.208
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 +4 -4
- package/dist/config/functions.d.ts +2 -129
- package/dist/config/index.d.ts +9 -12
- package/dist/constants/base-unit-regex.d.ts +1 -0
- package/dist/core.d.ts +21 -25
- package/dist/index.bundle.js +4 -4
- package/dist/index.bundle.mjs +4 -4
- package/dist/index.d.ts +2 -1
- package/dist/rule.d.ts +32 -36
- package/dist/runtime.browser.bundle.js +1 -1
- package/dist/runtime.browser.d.ts +1 -3
- package/dist/runtime.d.ts +3 -10
- package/dist/types/global.d.ts +11 -0
- package/dist/utils/hex-to-rgb.d.ts +1 -1
- package/dist/utils/rgb-to-hex.d.ts +1 -1
- package/package.json +1 -1
- package/dist/types/css-declarations.d.ts +0 -4
- package/dist/variables.d.ts +0 -113
package/dist/bin/index.bundle.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
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,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} */
|
|
2
|
+
"use strict";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
5
|
rules: {},
|
|
@@ -10,7 +10,7 @@ export default {
|
|
|
10
10
|
selectors: {},
|
|
11
11
|
functions: {}
|
|
12
12
|
}
|
|
13
|
-
`;var
|
|
13
|
+
`;var y=`/** @type {import('@master/css').Config} */
|
|
14
14
|
module.exports = {
|
|
15
15
|
styles: {},
|
|
16
16
|
rules: {},
|
|
@@ -21,7 +21,7 @@ module.exports = {
|
|
|
21
21
|
selectors: {},
|
|
22
22
|
functions: {}
|
|
23
23
|
}
|
|
24
|
-
`;var
|
|
24
|
+
`;var g=`import type { Config } from '@master/css'
|
|
25
25
|
|
|
26
26
|
export default {
|
|
27
27
|
styles: {},
|
|
@@ -33,4 +33,4 @@ export default {
|
|
|
33
33
|
selectors: {},
|
|
34
34
|
functions: {}
|
|
35
35
|
} as Config
|
|
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",
|
|
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",g),r&&s("master.css.js",y)});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();
|
|
@@ -1,130 +1,3 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
declare const functions:
|
|
3
|
-
$: {
|
|
4
|
-
colored: boolean;
|
|
5
|
-
transform(value: any): {
|
|
6
|
-
type: string;
|
|
7
|
-
name: string;
|
|
8
|
-
fallback: string;
|
|
9
|
-
}[];
|
|
10
|
-
};
|
|
11
|
-
calc: FunctionDefinition;
|
|
12
|
-
translate: {
|
|
13
|
-
unit: string;
|
|
14
|
-
};
|
|
15
|
-
translateX: {
|
|
16
|
-
unit: string;
|
|
17
|
-
};
|
|
18
|
-
translateY: {
|
|
19
|
-
unit: string;
|
|
20
|
-
};
|
|
21
|
-
translateZ: {
|
|
22
|
-
unit: string;
|
|
23
|
-
};
|
|
24
|
-
translate3d: {
|
|
25
|
-
unit: string;
|
|
26
|
-
};
|
|
27
|
-
skew: {
|
|
28
|
-
unit: string;
|
|
29
|
-
};
|
|
30
|
-
skewX: {
|
|
31
|
-
unit: string;
|
|
32
|
-
};
|
|
33
|
-
skewY: {
|
|
34
|
-
unit: string;
|
|
35
|
-
};
|
|
36
|
-
skewZ: {
|
|
37
|
-
unit: string;
|
|
38
|
-
};
|
|
39
|
-
skew3d: {
|
|
40
|
-
unit: string;
|
|
41
|
-
};
|
|
42
|
-
rotate: {
|
|
43
|
-
unit: string;
|
|
44
|
-
};
|
|
45
|
-
rotateX: {
|
|
46
|
-
unit: string;
|
|
47
|
-
};
|
|
48
|
-
rotateY: {
|
|
49
|
-
unit: string;
|
|
50
|
-
};
|
|
51
|
-
rotateZ: {
|
|
52
|
-
unit: string;
|
|
53
|
-
};
|
|
54
|
-
rotate3d: {
|
|
55
|
-
unit: string;
|
|
56
|
-
};
|
|
57
|
-
blur: {
|
|
58
|
-
unit: string;
|
|
59
|
-
};
|
|
60
|
-
'drop-shadow': {
|
|
61
|
-
unit: string;
|
|
62
|
-
};
|
|
63
|
-
'hue-rotate': {
|
|
64
|
-
unit: string;
|
|
65
|
-
};
|
|
66
|
-
rgb: {
|
|
67
|
-
unit: string;
|
|
68
|
-
};
|
|
69
|
-
rgba: {
|
|
70
|
-
unit: string;
|
|
71
|
-
};
|
|
72
|
-
hsl: {
|
|
73
|
-
unit: string;
|
|
74
|
-
};
|
|
75
|
-
hsla: {
|
|
76
|
-
unit: string;
|
|
77
|
-
};
|
|
78
|
-
color: {
|
|
79
|
-
unit: string;
|
|
80
|
-
colored: boolean;
|
|
81
|
-
};
|
|
82
|
-
'color-contrast': {
|
|
83
|
-
unit: string;
|
|
84
|
-
colored: boolean;
|
|
85
|
-
};
|
|
86
|
-
'color-mix': {
|
|
87
|
-
unit: string;
|
|
88
|
-
colored: boolean;
|
|
89
|
-
};
|
|
90
|
-
hwb: {
|
|
91
|
-
unit: string;
|
|
92
|
-
};
|
|
93
|
-
lab: {
|
|
94
|
-
unit: string;
|
|
95
|
-
};
|
|
96
|
-
lch: {
|
|
97
|
-
unit: string;
|
|
98
|
-
};
|
|
99
|
-
oklab: {
|
|
100
|
-
unit: string;
|
|
101
|
-
};
|
|
102
|
-
oklch: {
|
|
103
|
-
unit: string;
|
|
104
|
-
};
|
|
105
|
-
clamp: {
|
|
106
|
-
unit: string;
|
|
107
|
-
};
|
|
108
|
-
repeat: {
|
|
109
|
-
unit: string;
|
|
110
|
-
};
|
|
111
|
-
'linear-gradient': {
|
|
112
|
-
colored: boolean;
|
|
113
|
-
};
|
|
114
|
-
'radial-gradient': {
|
|
115
|
-
colored: boolean;
|
|
116
|
-
};
|
|
117
|
-
'conic-gradient': {
|
|
118
|
-
colored: boolean;
|
|
119
|
-
};
|
|
120
|
-
'repeating-linear-gradient': {
|
|
121
|
-
colored: boolean;
|
|
122
|
-
};
|
|
123
|
-
'repeating-radial-gradient': {
|
|
124
|
-
colored: boolean;
|
|
125
|
-
};
|
|
126
|
-
'repeating-conic-gradient': {
|
|
127
|
-
colored: boolean;
|
|
128
|
-
};
|
|
129
|
-
};
|
|
1
|
+
import type { FunctionDefinitions } from './';
|
|
2
|
+
declare const functions: FunctionDefinitions;
|
|
130
3
|
export default functions;
|
package/dist/config/index.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ import animations from './animations';
|
|
|
5
5
|
import variables from './variables';
|
|
6
6
|
import rules from './rules';
|
|
7
7
|
import functions from './functions';
|
|
8
|
-
import {
|
|
8
|
+
import type { PropertiesHyphen } from 'csstype';
|
|
9
9
|
import type { Rule, RuleDefinition, ValueComponent } from '../rule';
|
|
10
10
|
declare const config: Config;
|
|
11
11
|
export { config, mediaQueries, selectors, semantics, rules, functions, animations, variables };
|
|
@@ -15,13 +15,11 @@ export type VariableDefinition = {
|
|
|
15
15
|
} & {
|
|
16
16
|
[key: string]: VariableValue | VariableDefinition;
|
|
17
17
|
};
|
|
18
|
-
export type
|
|
19
|
-
[key in 'from' | 'to']
|
|
20
|
-
} & {
|
|
21
|
-
[key: string]: CSSDeclarations;
|
|
18
|
+
export type CSSKeyframes = {
|
|
19
|
+
[key in 'from' | 'to' | string]: PropertiesHyphen;
|
|
22
20
|
};
|
|
23
21
|
export type AnimationDefinitions = {
|
|
24
|
-
[key: string]:
|
|
22
|
+
[key: string]: CSSKeyframes;
|
|
25
23
|
};
|
|
26
24
|
export type SelectorDefinitions = {
|
|
27
25
|
[key: string]: string | string[] | SelectorDefinitions;
|
|
@@ -41,22 +39,20 @@ export type VariableDefinitions = {
|
|
|
41
39
|
[key: string]: VariableDefinition | VariableValue;
|
|
42
40
|
};
|
|
43
41
|
export type SemanticDefinitions = {
|
|
44
|
-
[key in keyof typeof semantics]?:
|
|
42
|
+
[key in keyof typeof semantics]?: PropertiesHyphen;
|
|
45
43
|
} & {
|
|
46
|
-
[key: string]:
|
|
44
|
+
[key: string]: PropertiesHyphen;
|
|
47
45
|
};
|
|
48
46
|
export interface FunctionDefinition {
|
|
49
47
|
unit?: string;
|
|
50
48
|
colored?: boolean;
|
|
51
|
-
transform?(this: Rule, value: string): string | ValueComponent[];
|
|
49
|
+
transform?(this: Rule, value: string, bypassVariableNames: string[]): string | ValueComponent[];
|
|
52
50
|
}
|
|
53
51
|
export type FunctionDefinitions = {
|
|
54
52
|
[key: string]: FunctionDefinition;
|
|
55
53
|
};
|
|
56
54
|
export interface Config {
|
|
57
|
-
extends?: (Config |
|
|
58
|
-
config: Config;
|
|
59
|
-
})[];
|
|
55
|
+
extends?: (Config | any)[];
|
|
60
56
|
styles?: StyleDefinitions;
|
|
61
57
|
mediaQueries?: MediaQueryDefinitions;
|
|
62
58
|
selectors?: SelectorDefinitions;
|
|
@@ -64,6 +60,7 @@ export interface Config {
|
|
|
64
60
|
variables?: VariableDefinitions;
|
|
65
61
|
rules?: RuleDefinitions;
|
|
66
62
|
rootSize?: number;
|
|
63
|
+
baseUnit?: number;
|
|
67
64
|
scope?: string;
|
|
68
65
|
important?: boolean;
|
|
69
66
|
override?: boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const BASE_UNIT_REGEX: RegExp;
|
package/dist/core.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { Rule, NativeRule,
|
|
1
|
+
import { Rule, NativeRule, RegisteredRule } from './rule';
|
|
2
2
|
import type { Config, AnimationDefinitions } from './config';
|
|
3
|
+
import './types/global';
|
|
3
4
|
type VariableValue = {
|
|
4
5
|
type: 'string';
|
|
5
6
|
value: string;
|
|
@@ -38,32 +39,38 @@ export declare class MasterCSS {
|
|
|
38
39
|
static config: Config;
|
|
39
40
|
readonly rules: Rule[];
|
|
40
41
|
readonly ruleBy: Record<string, Rule>;
|
|
41
|
-
readonly classesUsage:
|
|
42
|
+
readonly classesUsage: Record<string, number>;
|
|
42
43
|
readonly config: Config;
|
|
43
|
-
|
|
44
|
-
|
|
44
|
+
readonly RegisteredSemanticRules: RegisteredRule[];
|
|
45
|
+
readonly RegisteredRules: RegisteredRule[];
|
|
45
46
|
constructor(customConfig?: Config);
|
|
46
47
|
resolve(): void;
|
|
47
48
|
/**
|
|
48
|
-
* Match check if Master CSS
|
|
49
|
-
* @param
|
|
49
|
+
* Match check if Master CSS syntax
|
|
50
|
+
* @param className
|
|
50
51
|
* @returns css text
|
|
51
52
|
*/
|
|
52
|
-
match(
|
|
53
|
+
match(className: string): RegisteredRule | undefined;
|
|
53
54
|
/**
|
|
54
|
-
*
|
|
55
|
-
* @param
|
|
55
|
+
* Generate rules from class name
|
|
56
|
+
* @param className
|
|
56
57
|
* @returns Rule[]
|
|
57
58
|
*/
|
|
58
|
-
|
|
59
|
+
generate(className: string): Rule[];
|
|
60
|
+
/**
|
|
61
|
+
* Create rule from given syntax
|
|
62
|
+
* @param syntax
|
|
63
|
+
* @returns Rule
|
|
64
|
+
*/
|
|
65
|
+
create(syntax: string): Rule | undefined;
|
|
59
66
|
/**
|
|
60
67
|
* 根據蒐集到的所有 DOM class 重新 create
|
|
61
68
|
*/
|
|
62
69
|
refresh(customConfig?: Config): this;
|
|
63
70
|
reset(): this;
|
|
64
71
|
destroy(): this;
|
|
65
|
-
add(
|
|
66
|
-
delete(
|
|
72
|
+
add(...classNames: string[]): this;
|
|
73
|
+
delete(...classNames: string[]): void;
|
|
67
74
|
/**
|
|
68
75
|
* 加工插入規則
|
|
69
76
|
* 1. where
|
|
@@ -79,22 +86,11 @@ export declare class MasterCSS {
|
|
|
79
86
|
* 11. media width where selectors
|
|
80
87
|
* 12. media width selectors
|
|
81
88
|
*/
|
|
82
|
-
insert(
|
|
89
|
+
insert(rule: Rule): void;
|
|
83
90
|
get text(): string;
|
|
84
91
|
handleRuleWithAnimationNames(rule: Rule, initializing?: boolean): void;
|
|
85
92
|
handleRuleWithVariableNames(rule: Rule, initializing?: boolean): void;
|
|
86
93
|
pushVariableNativeRule(theme: string, variableCSSRule: CSSStyleRule): NativeRule;
|
|
87
94
|
}
|
|
88
|
-
declare
|
|
89
|
-
interface Window {
|
|
90
|
-
MasterCSS: typeof MasterCSS;
|
|
91
|
-
masterCSSs: MasterCSS[];
|
|
92
|
-
}
|
|
93
|
-
namespace NodeJS {
|
|
94
|
-
interface Global {
|
|
95
|
-
MasterCSS: typeof MasterCSS;
|
|
96
|
-
masterCSSs: MasterCSS[];
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
}
|
|
95
|
+
export declare const masterCSSs: MasterCSS[];
|
|
100
96
|
export {};
|