@master/css 2.0.0-beta.20 → 2.0.0-beta.200

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.
Files changed (252) hide show
  1. package/README.md +113 -109
  2. package/dist/bin/index.bundle.js +36 -0
  3. package/dist/bin/index.d.ts +2 -0
  4. package/dist/config/animations.d.ts +110 -0
  5. package/dist/config/functions.d.ts +130 -0
  6. package/dist/config/index.d.ts +71 -25
  7. package/dist/config/{breakpoints.d.ts → media-queries.d.ts} +3 -2
  8. package/dist/config/rules.d.ts +279 -3
  9. package/dist/config/selectors.d.ts +3 -2
  10. package/dist/config/semantics.d.ts +189 -80
  11. package/dist/config/styles.d.ts +3 -0
  12. package/dist/config/variables.d.ts +129 -0
  13. package/dist/constants/config-esm-text.d.ts +1 -0
  14. package/dist/constants/config-text.d.ts +1 -0
  15. package/dist/constants/config-ts-text.d.ts +1 -0
  16. package/dist/constants/selector-symbols.d.ts +1 -0
  17. package/dist/constants/start-symbol.d.ts +2 -1
  18. package/dist/core.d.ts +121 -0
  19. package/dist/functions/init-runtime.d.ts +9 -0
  20. package/dist/functions/reorder-for-readable-classes.d.ts +8 -0
  21. package/dist/functions/transform-color-with-opacity.d.ts +1 -0
  22. package/dist/index.browser.bundle.js +1 -0
  23. package/dist/index.browser.d.ts +6 -1
  24. package/dist/index.bundle.js +35 -0
  25. package/dist/index.bundle.mjs +35 -0
  26. package/dist/index.d.ts +11 -21
  27. package/dist/layer.d.ts +11 -0
  28. package/dist/polyfills/css-escape.d.ts +0 -1
  29. package/dist/rule.d.ts +107 -52
  30. package/dist/types/css-declarations.d.ts +4 -0
  31. package/dist/utils/flatten-obj.d.ts +4 -0
  32. package/dist/utils/hex-to-rgb.d.ts +1 -1
  33. package/dist/utils/is-plain-object.d.ts +1 -1
  34. package/package.json +1 -162
  35. package/LICENSE +0 -21
  36. package/dist/apis/extend.d.ts +0 -5
  37. package/dist/apis/render-from-html.d.ts +0 -3
  38. package/dist/apis/render-into-html.d.ts +0 -3
  39. package/dist/apis/render.d.ts +0 -3
  40. package/dist/config/colors.d.ts +0 -25
  41. package/dist/config/root-size.d.ts +0 -2
  42. package/dist/config/scheme.d.ts +0 -7
  43. package/dist/config/themes.d.ts +0 -2
  44. package/dist/config/values.d.ts +0 -126
  45. package/dist/css.d.ts +0 -80
  46. package/dist/index.browser.js +0 -2
  47. package/dist/index.browser.js.map +0 -7
  48. package/dist/index.cjs +0 -2
  49. package/dist/index.cjs.map +0 -7
  50. package/dist/index.mjs +0 -2
  51. package/dist/index.mjs.map +0 -7
  52. package/dist/rules/accent-color.d.ts +0 -7
  53. package/dist/rules/align-content.d.ts +0 -6
  54. package/dist/rules/align-items.d.ts +0 -6
  55. package/dist/rules/align-self.d.ts +0 -6
  56. package/dist/rules/animation-delay.d.ts +0 -7
  57. package/dist/rules/animation-direction.d.ts +0 -6
  58. package/dist/rules/animation-duration.d.ts +0 -7
  59. package/dist/rules/animation-fill-mode.d.ts +0 -6
  60. package/dist/rules/animation-iteration-count.d.ts +0 -7
  61. package/dist/rules/animation-name.d.ts +0 -6
  62. package/dist/rules/animation-play-state.d.ts +0 -6
  63. package/dist/rules/animation-timing-function.d.ts +0 -6
  64. package/dist/rules/animation.d.ts +0 -8
  65. package/dist/rules/appearance.d.ts +0 -5
  66. package/dist/rules/aspect-radio.d.ts +0 -7
  67. package/dist/rules/backdrop-filter.d.ts +0 -11
  68. package/dist/rules/background-attachment.d.ts +0 -6
  69. package/dist/rules/background-blend-mode.d.ts +0 -5
  70. package/dist/rules/background-clip.d.ts +0 -9
  71. package/dist/rules/background-color.d.ts +0 -8
  72. package/dist/rules/background-image.d.ts +0 -7
  73. package/dist/rules/background-origin.d.ts +0 -6
  74. package/dist/rules/background-position.d.ts +0 -7
  75. package/dist/rules/background-repeat.d.ts +0 -6
  76. package/dist/rules/background-size.d.ts +0 -6
  77. package/dist/rules/background.d.ts +0 -8
  78. package/dist/rules/border-collapse.d.ts +0 -6
  79. package/dist/rules/border-color.d.ts +0 -11
  80. package/dist/rules/border-image-outset.d.ts +0 -5
  81. package/dist/rules/border-image-repeat.d.ts +0 -6
  82. package/dist/rules/border-image-slice.d.ts +0 -6
  83. package/dist/rules/border-image-source.d.ts +0 -6
  84. package/dist/rules/border-image-width.d.ts +0 -6
  85. package/dist/rules/border-image.d.ts +0 -6
  86. package/dist/rules/border-radius.d.ts +0 -9
  87. package/dist/rules/border-spacing.d.ts +0 -5
  88. package/dist/rules/border-style.d.ts +0 -9
  89. package/dist/rules/border-width.d.ts +0 -9
  90. package/dist/rules/border.d.ts +0 -10
  91. package/dist/rules/box-decoration-break.d.ts +0 -9
  92. package/dist/rules/box-shadow.d.ts +0 -7
  93. package/dist/rules/box-sizing.d.ts +0 -6
  94. package/dist/rules/break-after.d.ts +0 -5
  95. package/dist/rules/break-before.d.ts +0 -5
  96. package/dist/rules/break-inside.d.ts +0 -5
  97. package/dist/rules/caret-color.d.ts +0 -7
  98. package/dist/rules/clear.d.ts +0 -5
  99. package/dist/rules/clip-path.d.ts +0 -6
  100. package/dist/rules/color.d.ts +0 -8
  101. package/dist/rules/column-span.d.ts +0 -6
  102. package/dist/rules/columns.d.ts +0 -8
  103. package/dist/rules/contain.d.ts +0 -5
  104. package/dist/rules/content.d.ts +0 -5
  105. package/dist/rules/counter-increment.d.ts +0 -6
  106. package/dist/rules/cursor.d.ts +0 -5
  107. package/dist/rules/cx.d.ts +0 -6
  108. package/dist/rules/cy.d.ts +0 -6
  109. package/dist/rules/direction.d.ts +0 -5
  110. package/dist/rules/display.d.ts +0 -6
  111. package/dist/rules/fill.d.ts +0 -7
  112. package/dist/rules/filter.d.ts +0 -8
  113. package/dist/rules/flex-basis.d.ts +0 -5
  114. package/dist/rules/flex-direction.d.ts +0 -6
  115. package/dist/rules/flex-grow.d.ts +0 -6
  116. package/dist/rules/flex-shrink.d.ts +0 -6
  117. package/dist/rules/flex-wrap.d.ts +0 -6
  118. package/dist/rules/flex.d.ts +0 -7
  119. package/dist/rules/float.d.ts +0 -5
  120. package/dist/rules/font-family.d.ts +0 -6
  121. package/dist/rules/font-size.d.ts +0 -6
  122. package/dist/rules/font-smoothing.d.ts +0 -9
  123. package/dist/rules/font-style.d.ts +0 -7
  124. package/dist/rules/font-variant-numeric.d.ts +0 -6
  125. package/dist/rules/font-weight.d.ts +0 -7
  126. package/dist/rules/font.d.ts +0 -8
  127. package/dist/rules/gap.d.ts +0 -9
  128. package/dist/rules/grid-area.d.ts +0 -7
  129. package/dist/rules/grid-auto-columns.d.ts +0 -6
  130. package/dist/rules/grid-auto-flow.d.ts +0 -6
  131. package/dist/rules/grid-auto-rows.d.ts +0 -5
  132. package/dist/rules/grid-column-end.d.ts +0 -7
  133. package/dist/rules/grid-column-start.d.ts +0 -7
  134. package/dist/rules/grid-column.d.ts +0 -9
  135. package/dist/rules/grid-columns.d.ts +0 -10
  136. package/dist/rules/grid-row-end.d.ts +0 -6
  137. package/dist/rules/grid-row-start.d.ts +0 -6
  138. package/dist/rules/grid-row.d.ts +0 -9
  139. package/dist/rules/grid-rows.d.ts +0 -9
  140. package/dist/rules/grid-template-areas.d.ts +0 -5
  141. package/dist/rules/grid-template-columns.d.ts +0 -6
  142. package/dist/rules/grid-template-rows.d.ts +0 -5
  143. package/dist/rules/grid-template.d.ts +0 -6
  144. package/dist/rules/grid.d.ts +0 -6
  145. package/dist/rules/group.d.ts +0 -9
  146. package/dist/rules/height.d.ts +0 -6
  147. package/dist/rules/inset.d.ts +0 -9
  148. package/dist/rules/isolation.d.ts +0 -5
  149. package/dist/rules/justify-content.d.ts +0 -6
  150. package/dist/rules/justify-items.d.ts +0 -6
  151. package/dist/rules/justify-self.d.ts +0 -6
  152. package/dist/rules/letter-spacing.d.ts +0 -7
  153. package/dist/rules/line-clamp.d.ts +0 -9
  154. package/dist/rules/line-height.d.ts +0 -7
  155. package/dist/rules/lines.d.ts +0 -9
  156. package/dist/rules/list-style-image.d.ts +0 -6
  157. package/dist/rules/list-style-position.d.ts +0 -6
  158. package/dist/rules/list-style-type.d.ts +0 -6
  159. package/dist/rules/list-style.d.ts +0 -6
  160. package/dist/rules/margin.d.ts +0 -9
  161. package/dist/rules/mask-image.d.ts +0 -8
  162. package/dist/rules/max-height.d.ts +0 -6
  163. package/dist/rules/max-width.d.ts +0 -6
  164. package/dist/rules/min-height.d.ts +0 -6
  165. package/dist/rules/min-width.d.ts +0 -6
  166. package/dist/rules/mix-blend-mode.d.ts +0 -6
  167. package/dist/rules/object-fit.d.ts +0 -6
  168. package/dist/rules/object-position.d.ts +0 -6
  169. package/dist/rules/opacity.d.ts +0 -6
  170. package/dist/rules/order.d.ts +0 -7
  171. package/dist/rules/outline-color.d.ts +0 -7
  172. package/dist/rules/outline-offset.d.ts +0 -5
  173. package/dist/rules/outline-style.d.ts +0 -6
  174. package/dist/rules/outline-width.d.ts +0 -6
  175. package/dist/rules/outline.d.ts +0 -7
  176. package/dist/rules/overflow.d.ts +0 -9
  177. package/dist/rules/overscroll-behavior.d.ts +0 -8
  178. package/dist/rules/padding.d.ts +0 -9
  179. package/dist/rules/place-content.d.ts +0 -6
  180. package/dist/rules/place-items.d.ts +0 -6
  181. package/dist/rules/place-self.d.ts +0 -6
  182. package/dist/rules/placement.d.ts +0 -8
  183. package/dist/rules/pointer-events.d.ts +0 -5
  184. package/dist/rules/position.d.ts +0 -5
  185. package/dist/rules/quotes.d.ts +0 -5
  186. package/dist/rules/resize.d.ts +0 -5
  187. package/dist/rules/rx.d.ts +0 -6
  188. package/dist/rules/ry.d.ts +0 -6
  189. package/dist/rules/scroll-behavior.d.ts +0 -5
  190. package/dist/rules/scroll-margin.d.ts +0 -9
  191. package/dist/rules/scroll-padding.d.ts +0 -9
  192. package/dist/rules/scroll-snap-align.d.ts +0 -6
  193. package/dist/rules/scroll-snap-stop.d.ts +0 -6
  194. package/dist/rules/scroll-snap-type.d.ts +0 -6
  195. package/dist/rules/shape-image-threshold.d.ts +0 -6
  196. package/dist/rules/shape-margin.d.ts +0 -6
  197. package/dist/rules/shape-outside.d.ts +0 -6
  198. package/dist/rules/spacing.d.ts +0 -9
  199. package/dist/rules/stroke-dasharray.d.ts +0 -5
  200. package/dist/rules/stroke-dashoffset.d.ts +0 -5
  201. package/dist/rules/stroke-width.d.ts +0 -6
  202. package/dist/rules/stroke.d.ts +0 -6
  203. package/dist/rules/table-layout.d.ts +0 -5
  204. package/dist/rules/text-align.d.ts +0 -6
  205. package/dist/rules/text-decoration-color.d.ts +0 -7
  206. package/dist/rules/text-decoration-line.d.ts +0 -6
  207. package/dist/rules/text-decoration-style.d.ts +0 -6
  208. package/dist/rules/text-decoration-thickness.d.ts +0 -7
  209. package/dist/rules/text-decoration.d.ts +0 -8
  210. package/dist/rules/text-fill-color.d.ts +0 -10
  211. package/dist/rules/text-indent.d.ts +0 -5
  212. package/dist/rules/text-orientation.d.ts +0 -6
  213. package/dist/rules/text-overflow.d.ts +0 -6
  214. package/dist/rules/text-rendering.d.ts +0 -6
  215. package/dist/rules/text-shadow.d.ts +0 -6
  216. package/dist/rules/text-size.d.ts +0 -8
  217. package/dist/rules/text-stroke-color.d.ts +0 -10
  218. package/dist/rules/text-stroke-width.d.ts +0 -8
  219. package/dist/rules/text-stroke.d.ts +0 -8
  220. package/dist/rules/text-transform.d.ts +0 -6
  221. package/dist/rules/text-underline-offset.d.ts +0 -5
  222. package/dist/rules/touch-action.d.ts +0 -5
  223. package/dist/rules/transform-box.d.ts +0 -6
  224. package/dist/rules/transform-origin.d.ts +0 -7
  225. package/dist/rules/transform-style.d.ts +0 -6
  226. package/dist/rules/transform.d.ts +0 -9
  227. package/dist/rules/transition-delay.d.ts +0 -7
  228. package/dist/rules/transition-duration.d.ts +0 -7
  229. package/dist/rules/transition-property.d.ts +0 -6
  230. package/dist/rules/transition-timing-function.d.ts +0 -6
  231. package/dist/rules/transition.d.ts +0 -7
  232. package/dist/rules/user-drag.d.ts +0 -8
  233. package/dist/rules/user-select.d.ts +0 -8
  234. package/dist/rules/variable.d.ts +0 -9
  235. package/dist/rules/vertical-align.d.ts +0 -6
  236. package/dist/rules/visibility.d.ts +0 -5
  237. package/dist/rules/white-space.d.ts +0 -6
  238. package/dist/rules/width.d.ts +0 -6
  239. package/dist/rules/will-change.d.ts +0 -5
  240. package/dist/rules/word-break.d.ts +0 -6
  241. package/dist/rules/word-spacing.d.ts +0 -6
  242. package/dist/rules/writing-mode.d.ts +0 -6
  243. package/dist/rules/x.d.ts +0 -6
  244. package/dist/rules/y.d.ts +0 -6
  245. package/dist/rules/z-index.d.ts +0 -7
  246. package/dist/utils/get-border-props.d.ts +0 -3
  247. package/dist/utils/get-css-property-text.d.ts +0 -5
  248. package/dist/utils/normalize-css-calc-text.d.ts +0 -5
  249. package/dist/utils/parse-value-unit.d.ts +0 -2
  250. package/dist/utils/parse-value.d.ts +0 -6
  251. package/readme.md +0 -118
  252. /package/dist/{apis → functions}/fill-color-scale.d.ts +0 -0
package/dist/rule.d.ts CHANGED
@@ -1,65 +1,120 @@
1
- import MasterCSS from './css';
2
- import type { MasterCSSConfig } from './config';
3
- export default class MasterCSSRule {
1
+ import type { MasterCSS, Variable } from './core';
2
+ import { CSSDeclarations } from './types/css-declarations';
3
+ import { Layer } from './layer';
4
+ export declare class Rule {
4
5
  readonly className: string;
5
- readonly matching: MasterCSSRuleMatching;
6
+ readonly definition: RuleDefinition;
6
7
  css: MasterCSS;
7
- readonly prefix: string;
8
- readonly symbol: string;
9
- readonly token: string;
10
- readonly prefixSelectors: string[];
11
- readonly vendorSuffixSelectors: Record<string, string[]>;
12
- readonly important: boolean;
13
- readonly media: MasterCSSMedia;
14
8
  readonly at: Record<string, string>;
15
- readonly direction: string;
16
- readonly themeName: string;
17
- readonly unitToken: string;
18
- readonly hasWhere: boolean;
19
- readonly prioritySelectorIndex: number;
20
- readonly natives: {
21
- unit: string;
22
- value: string | Record<string, string | number>;
23
- text: string;
24
- themeName: string;
25
- cssRule?: CSSRule;
26
- }[];
27
- static id: string;
28
- static propName: string;
29
- static matches: RegExp;
30
- static colorStarts: string;
31
- static symbol: string;
32
- static unit: string;
33
- static colorful: boolean;
34
- static match(name: string, colorNames: string[]): MasterCSSRuleMatching;
35
- constructor(className: string, matching: MasterCSSRuleMatching, css: MasterCSS);
9
+ readonly priority: number;
10
+ readonly natives: NativeRule[];
11
+ readonly order: number;
12
+ readonly layer: Layer;
13
+ readonly stateToken: string;
14
+ readonly declarations: CSSDeclarations;
15
+ readonly colored: boolean;
16
+ animationNames: string[];
17
+ variableNames: string[];
18
+ constructor(className: string, definition: RuleDefinition, css: MasterCSS);
19
+ resolveValue: (valueComponents: ValueComponent[], unit: string, bypassVariableNames: string[]) => string;
20
+ get text(): string;
21
+ parseValue: (currentValueComponents: ValueComponent[], i: number, value: string, unit: string, endSymbol?: string, parentFunctionName?: any, bypassVariableNames?: string[]) => number;
22
+ parseValueComponent(token: string | number, unit?: any): StringValueComponent | NumericValueComponent;
36
23
  }
37
- export default interface MasterCSSRule {
38
- readonly order?: number;
39
- parseValue(value: string, config: MasterCSSConfig): string;
40
- get(declaration: MasterCSSDeclaration): Record<string, any>;
41
- getThemeProps(declaration: MasterCSSDeclaration, css: MasterCSS): Record<string, Record<string, string>>;
24
+ export type ValueComponent = StringValueComponent | NumericValueComponent | FunctionValueComponent | VariableValueComponent | SeparatorValueComponent;
25
+ export interface StringValueComponent {
26
+ text?: string;
27
+ token?: string;
28
+ type: 'string';
29
+ value: string;
42
30
  }
43
- export interface MasterCSSMediaFeatureRule {
44
- token: string;
45
- tokenType?: string;
46
- operator?: string;
47
- value?: number;
31
+ export interface NumericValueComponent {
32
+ text?: string;
33
+ token?: string;
34
+ type: 'number';
35
+ value: number;
48
36
  unit?: string;
49
37
  }
50
- export interface MasterCSSMedia {
38
+ export interface FunctionValueComponent {
39
+ text?: string;
40
+ token?: string;
41
+ type: 'function';
42
+ name: string;
43
+ symbol: string;
44
+ children: ValueComponent[];
45
+ }
46
+ export interface VariableValueComponent {
47
+ text?: string;
48
+ token?: string;
49
+ type: 'variable';
50
+ name: string;
51
+ alpha?: string;
52
+ fallback?: string;
53
+ variable?: Variable;
54
+ }
55
+ export interface SeparatorValueComponent {
56
+ text?: string;
57
+ type: 'separator';
58
+ value: string;
59
+ }
60
+ export interface Rule {
61
+ prefix?: string;
62
+ token?: string;
63
+ vendorPrefixSelectors?: Record<string, string[]>;
64
+ vendorSuffixSelectors?: Record<string, string[]>;
65
+ important?: boolean;
66
+ media?: MediaQuery;
67
+ direction?: string;
68
+ theme?: string;
69
+ unitToken?: string;
70
+ hasWhere?: boolean;
71
+ valueComponents?: Array<ValueComponent>;
72
+ constructor: {
73
+ match?(name: string, matches: RegExp, colors: Record<string, Record<string, string>>, colorNames: string[]): RuleMeta;
74
+ };
75
+ }
76
+ export interface RuleDefinition {
77
+ id?: string;
78
+ match?: RegExp | [string, string[]?];
79
+ resolvedMatch?: RegExp;
80
+ resolvedVariables?: any;
81
+ variables?: string[];
82
+ order?: number;
83
+ separators?: string[];
84
+ shorthand?: string;
85
+ colored?: boolean;
86
+ numeric?: boolean;
87
+ unit?: any;
88
+ native?: boolean;
89
+ declarations?: CSSDeclarations;
90
+ layer?: Layer;
91
+ analyze?: (this: Rule, className: string) => [valueToken: string, prefixToken?: string];
92
+ transformValue?(this: Rule, value: string): string;
93
+ transformValueComponents?(this: Rule, valueComponents: ValueComponent[]): ValueComponent[];
94
+ declare?(this: Rule, value: string, unit: string): CSSDeclarations;
95
+ delete?(this: Rule, className: string): void;
96
+ create?(this: Rule, className: string): void;
97
+ insert?(this: Rule): void;
98
+ }
99
+ export interface NativeRule {
100
+ text: string;
101
+ cssRule?: CSSRule;
102
+ }
103
+ export type MediaFeatureComponent = {
104
+ type: string;
105
+ tokenType?: string;
106
+ operator?: string;
107
+ value: number;
108
+ unit: string;
109
+ };
110
+ export interface MediaQuery {
51
111
  token: string;
52
112
  features?: {
53
- [key: string]: MasterCSSMediaFeatureRule;
113
+ [key: string]: MediaFeatureComponent;
54
114
  };
55
115
  type?: string;
56
116
  }
57
- export interface MasterCSSDeclaration {
58
- value: any;
59
- unit: string;
60
- important: boolean;
61
- }
62
- export interface MasterCSSRuleMatching {
63
- origin: 'matches' | 'semantics' | 'symbol';
64
- value?: string;
117
+ export interface RuleMeta {
118
+ value?: [string, string | Record<string, string>];
119
+ config?: RuleDefinition;
65
120
  }
@@ -0,0 +1,4 @@
1
+ import { PropertiesHyphen } from 'csstype';
2
+ export type CSSDeclarations = {
3
+ [key in keyof PropertiesHyphen]?: PropertiesHyphen[key];
4
+ };
@@ -0,0 +1,4 @@
1
+ export declare function flattenObj(obj: any, options?: {
2
+ joiner?: string;
3
+ parentKey?: string;
4
+ }): {};
@@ -1 +1 @@
1
- export declare function hexToRgb(hex: any): number[];
1
+ export declare function hexToRgb(hex: string): number[];
@@ -1,4 +1,4 @@
1
- export declare type PlainObject = Record<string | number | symbol, any>;
1
+ export type PlainObject = Record<string | number | symbol, any>;
2
2
  /**
3
3
  * Returns whether the payload is a plain JavaScript object (excluding special classes or objects with other prototypes)
4
4
  *
package/package.json CHANGED
@@ -1,162 +1 @@
1
- {
2
- "name": "@master/css",
3
- "license": "MIT",
4
- "description": "A Virtual CSS language with enhanced syntax. ( ~13KB )",
5
- "author": "Aoyue Design LLC.",
6
- "funding": "https://docs.master.co/css/donate",
7
- "homepage": "https://css.master.co",
8
- "repository": {
9
- "type": "git",
10
- "url": "https://github.com/master-co/css.git"
11
- },
12
- "keywords": [
13
- "style",
14
- "styles",
15
- "html",
16
- "variants",
17
- "virtual",
18
- "virtual-css",
19
- "utility",
20
- "css",
21
- "ui",
22
- "lightweight",
23
- "class",
24
- "webpack",
25
- "plugin",
26
- "integration",
27
- "vite",
28
- "parcel",
29
- "build-tools",
30
- "mastercss"
31
- ],
32
- "sideEffects": [
33
- "./src/polyfills/css-escape.ts"
34
- ],
35
- "scripts": {
36
- "build:iife": "esbuild src/index.browser.ts --bundle --outfile=dist/index.browser.js --format=iife",
37
- "build:cjs": "esbuild src/index.ts --bundle --outfile=dist/index.cjs --format=cjs --platform=node",
38
- "build:esm": "esbuild src/index.ts --bundle --outfile=dist/index.mjs --format=esm --platform=node",
39
- "build:css": "esbuild src/index.css --bundle --outfile=dist/index.css",
40
- "dev:iife": "npm run build:iife -- --watch",
41
- "dev:cjs": "npm run build:cjs -- --watch",
42
- "dev:esm": "npm run build:esm -- --watch",
43
- "prod": "rm -rf dist && npm run build:cjs -- --minify --sourcemap && npm run build:iife -- --minify --sourcemap && npm run build:esm -- --minify --sourcemap && tsc --emitDeclarationOnly",
44
- "test": "jest",
45
- "lint": "eslint ./src"
46
- },
47
- "main": "./dist/index.cjs",
48
- "jsnext:main": "./dist/index.mjs",
49
- "browser": "./dist/index.browser.js",
50
- "esnext": "./dist/index.mjs",
51
- "module": "./dist/index.mjs",
52
- "types": "./dist/index.d.ts",
53
- "exports": {
54
- ".": {
55
- "require": "./dist/index.cjs",
56
- "import": "./dist/index.mjs",
57
- "types": "./dist/index.d.ts"
58
- }
59
- },
60
- "jest": {
61
- "testEnvironment": "node",
62
- "transform": {
63
- "^.+\\.(t|j)sx?$": "@swc/jest"
64
- },
65
- "testMatch": [
66
- "<rootDir>/tests/*.ts",
67
- "<rootDir>/src/**/*.test.ts"
68
- ]
69
- },
70
- "private": false,
71
- "publishConfig": {
72
- "access": "public"
73
- },
74
- "engines": {
75
- "node": ">=14"
76
- },
77
- "release": {
78
- "plugins": [
79
- [
80
- "@semantic-release/commit-analyzer",
81
- {
82
- "preset": "angular",
83
- "releaseRules": [
84
- {
85
- "type": "docs",
86
- "scope": "README",
87
- "release": "patch"
88
- },
89
- {
90
- "type": "refactor",
91
- "release": "patch"
92
- },
93
- {
94
- "type": "style",
95
- "release": "patch"
96
- }
97
- ],
98
- "parserOpts": {
99
- "noteKeywords": [
100
- "BREAKING CHANGE",
101
- "BREAKING CHANGES"
102
- ]
103
- }
104
- }
105
- ],
106
- "@semantic-release/release-notes-generator",
107
- [
108
- "@semantic-release/exec",
109
- {
110
- "prepareCmd": "npm run prod"
111
- }
112
- ],
113
- [
114
- "@semantic-release/github",
115
- {
116
- "assets": [
117
- {
118
- "path": "dist/index.browser.js",
119
- "label": "master-css.min.js"
120
- }
121
- ]
122
- }
123
- ],
124
- [
125
- "@semantic-release/npm"
126
- ]
127
- ],
128
- "branches": [
129
- "+([0-9])?(.{+([0-9]),x}).x",
130
- "main",
131
- "next",
132
- "next-major",
133
- {
134
- "name": "beta",
135
- "prerelease": true
136
- },
137
- {
138
- "name": "alpha",
139
- "prerelease": true
140
- }
141
- ]
142
- },
143
- "files": [
144
- "dist"
145
- ],
146
- "devDependencies": {
147
- "@semantic-release/exec": "^6.0.3",
148
- "@swc/core": "^1.3.9",
149
- "@swc/jest": "^0.2.23",
150
- "@types/jest": "^29.2.0",
151
- "@types/node": "^18.11.0",
152
- "@typescript-eslint/eslint-plugin": "^5.40.1",
153
- "@typescript-eslint/parser": "^5.40.1",
154
- "esbuild": "^0.15.10",
155
- "eslint": "^8.25.0",
156
- "jest": "^29.2.2",
157
- "semantic-release": "^19.0.5",
158
- "typescript": "^4.8.4",
159
- "dedent": "^0.7.0"
160
- },
161
- "version": "2.0.0-beta.20"
162
- }
1
+ {"name":"@master/css","scripts":{"build":"techor pack --external @master/css-renderer @master/css-extractor","dev":"pnpm run build --watch --no-declare","test":"jest","type-check":"tsc --noEmit","lint":"eslint src"},"license":"MIT","description":"A markup-driven CSS language with enhanced syntax","author":"Aoyue Design LLC.","funding":"https://css.master.co/docs/donate","homepage":"https://css.master.co","bugs":{"url":"https://github.com/master-co/css/issues"},"repository":{"type":"git","url":"https://github.com/master-co/css.git","directory":"packages/css"},"keywords":["style","styles","html","variants","virtual","virtual-css","utility","css","ui","lightweight","class","webpack","plugin","integration","vite","parcel","build-tools","mastercss"],"sideEffects":false,"main":"./dist/index.bundle.js","jsnext:main":"./dist/index.bundle.mjs","esnext":"./dist/index.bundle.mjs","module":"./dist/index.bundle.mjs","browser":"./dist/index.browser.bundle.js","types":"./dist/index.d.ts","exports":{".":{"browser":{"import":"./dist/index.bundle.mjs","types":"./dist/index.browser.d.ts"},"require":"./dist/index.bundle.js","import":"./dist/index.bundle.mjs","types":"./dist/index.d.ts"}},"files":["dist"],"bin":{"mcss":"./dist/bin/index.bundle.js","mastercss":"./dist/bin/index.bundle.js"},"publishConfig":{"access":"public"},"dependencies":{"@master/normal.css":"^2.0.0-beta.200","@techor/fs":"^2.5.4","@techor/log":"^2.5.4","commander":"^11.0.0"},"devDependencies":{"@techor/extend":"^2.5.4","@techor/pack":"^2.5.4","css-shared":"^2.0.0-beta.200","csstype":"^3.1.2","puppeteer":"^21.0.1","vite":"^4.2.1"},"version":"2.0.0-beta.200"}
package/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- The MIT License
2
-
3
- Copyright (c) Aoyue Design LLC.
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in
13
- all copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
- THE SOFTWARE.
@@ -1,5 +0,0 @@
1
- declare type ExpandDeep<T> = T extends Record<string | number | symbol, unknown> ? {
2
- [K in keyof T]: ExpandDeep<T[K]>;
3
- } : T extends Array<infer E> ? Array<ExpandDeep<E>> : T;
4
- export default function extend<T extends Record<string, any>>(object: T, ...otherObjects: any[]): ExpandDeep<any>;
5
- export {};
@@ -1,3 +0,0 @@
1
- import MasterCSS from '../css';
2
- import '../polyfills/css-escape';
3
- export default function renderFromHTML(html: string, css?: MasterCSS): string;
@@ -1,3 +0,0 @@
1
- import MasterCSS from '../css';
2
- import '../polyfills/css-escape';
3
- export default function renderIntoHTML(html: string, css?: MasterCSS): string;
@@ -1,3 +0,0 @@
1
- import MasterCSS from '../css';
2
- import '../polyfills/css-escape';
3
- export default function render(classes: string[], css?: MasterCSS): string;
@@ -1,25 +0,0 @@
1
- declare const defaultColors: {
2
- slate: any;
3
- gray: any;
4
- brown: any;
5
- orange: any;
6
- gold: any;
7
- yellow: any;
8
- grass: any;
9
- green: any;
10
- beryl: any;
11
- teal: any;
12
- cyan: any;
13
- sky: any;
14
- blue: any;
15
- indigo: any;
16
- violet: any;
17
- purple: any;
18
- fuchsia: any;
19
- pink: any;
20
- crimson: any;
21
- red: any;
22
- black: string;
23
- white: string;
24
- };
25
- export default defaultColors;
@@ -1,2 +0,0 @@
1
- declare const defaultRootSize = 16;
2
- export default defaultRootSize;
@@ -1,7 +0,0 @@
1
- declare const defaultScheme: {
2
- storage: {
3
- sync: boolean;
4
- key: string;
5
- };
6
- };
7
- export default defaultScheme;
@@ -1,2 +0,0 @@
1
- declare const defaultThemes: string[];
2
- export default defaultThemes;
@@ -1,126 +0,0 @@
1
- declare const defaultValues: {
2
- BackgroundClip: {
3
- content: string;
4
- border: string;
5
- padding: string;
6
- };
7
- BackgroundOrigin: {
8
- content: string;
9
- border: string;
10
- padding: string;
11
- };
12
- BoxSizing: {
13
- content: string;
14
- border: string;
15
- };
16
- ClipPath: {
17
- margin: string;
18
- fill: string;
19
- stroke: string;
20
- view: string;
21
- content: string;
22
- border: string;
23
- padding: string;
24
- };
25
- FlexDirection: {
26
- col: string;
27
- 'col-reverse': string;
28
- };
29
- FontFamily: {
30
- mono: string;
31
- sans: string;
32
- serif: string;
33
- };
34
- FontWeight: {
35
- thin: number;
36
- extralight: number;
37
- light: number;
38
- regular: number;
39
- medium: number;
40
- semibold: number;
41
- bold: number;
42
- extrabold: number;
43
- heavy: number;
44
- };
45
- GridAutoColumns: {
46
- min: string;
47
- max: string;
48
- };
49
- GridAutoRows: {
50
- min: string;
51
- max: string;
52
- };
53
- GridTemplateColumns: {
54
- min: string;
55
- max: string;
56
- };
57
- GridTemplateRows: {
58
- min: string;
59
- max: string;
60
- };
61
- Order: {
62
- first: number;
63
- last: number;
64
- };
65
- Position: {
66
- abs: string;
67
- rel: string;
68
- };
69
- ShapeOutside: {
70
- margin: string;
71
- content: string;
72
- border: string;
73
- padding: string;
74
- };
75
- TransformBox: {
76
- fill: string;
77
- stroke: string;
78
- view: string;
79
- content: string;
80
- border: string;
81
- padding: string;
82
- };
83
- Width: {
84
- full: string;
85
- fit: string;
86
- max: string;
87
- min: string;
88
- };
89
- MinWidth: {
90
- full: string;
91
- fit: string;
92
- max: string;
93
- min: string;
94
- };
95
- MinHeight: {
96
- full: string;
97
- fit: string;
98
- max: string;
99
- min: string;
100
- };
101
- MaxWidth: {
102
- full: string;
103
- fit: string;
104
- max: string;
105
- min: string;
106
- };
107
- MaxHeight: {
108
- full: string;
109
- fit: string;
110
- max: string;
111
- min: string;
112
- };
113
- Height: {
114
- full: string;
115
- fit: string;
116
- max: string;
117
- min: string;
118
- };
119
- FlexBasis: {
120
- full: string;
121
- fit: string;
122
- max: string;
123
- min: string;
124
- };
125
- };
126
- export default defaultValues;
package/dist/css.d.ts DELETED
@@ -1,80 +0,0 @@
1
- import type { MasterCSSConfig } from './config';
2
- import MasterCSSRule from './rule';
3
- declare const MutationObserver: ObjectConstructor | {
4
- new (callback: MutationCallback): MutationObserver;
5
- prototype: MutationObserver;
6
- };
7
- export declare type MasterCSSOptions = {
8
- config?: MasterCSSConfig;
9
- override?: boolean;
10
- observe?: boolean;
11
- };
12
- export default class MasterCSS extends MutationObserver {
13
- #private;
14
- options?: MasterCSSOptions;
15
- static instances: MasterCSS[];
16
- static root: MasterCSS;
17
- /**
18
- * 全部 sheet 根據目前蒐集到的所有 DOM class 重新 findAndNew
19
- */
20
- static refresh(config: MasterCSSConfig): void;
21
- readonly style: HTMLStyleElement;
22
- readonly rules: MasterCSSRule[];
23
- readonly ruleOfClass: Record<string, MasterCSSRule>;
24
- readonly countOfClass: {};
25
- readonly host: Element;
26
- readonly root: Document | ShadowRoot;
27
- readonly ready: boolean;
28
- readonly config: MasterCSSConfig;
29
- semantics: [RegExp, string][];
30
- classes: Record<string, string[]>;
31
- colorsThemesMap: Record<string, Record<string, Record<string, string>>>;
32
- colorNames: string[];
33
- themeNames: string[];
34
- relationThemesMap: Record<string, Record<string, string[]>>;
35
- relations: Record<string, string[]>;
36
- selectors: Record<string, [RegExp, string[]][]>;
37
- private schemeMQL;
38
- constructor(options?: MasterCSSOptions);
39
- get storageScheme(): string;
40
- set scheme(scheme: string);
41
- get scheme(): string;
42
- set theme(theme: string);
43
- get theme(): string;
44
- private removeSchemeListener;
45
- private onThemeChange;
46
- private cache;
47
- observe(root: Document | ShadowRoot, options?: MutationObserverInit): this;
48
- disconnect(): void;
49
- /**
50
- * 尋找匹配的 MasterCSSRule 生成實例
51
- */
52
- findAndNew(name: string): MasterCSSRule | MasterCSSRule[];
53
- /**
54
- * 根據目前蒐集到的所有 DOM class 重新 findAndNew
55
- */
56
- refresh(config: MasterCSSConfig): void;
57
- destroy(): void;
58
- /**
59
- * 1. where
60
- * 2. normal
61
- * 3. where selectors
62
- * 4. normal selectors
63
- * 5. media where
64
- * 6. media normal
65
- * 7. media selectors
66
- * 8. media width where
67
- * 9. media width
68
- * 10. media width selectors
69
- */
70
- insert(rule: MasterCSSRule): void;
71
- delete(className: string): void;
72
- findAndInsert(className: string): void;
73
- get text(): string;
74
- }
75
- declare global {
76
- interface Window {
77
- MasterCSS: typeof MasterCSS;
78
- }
79
- }
80
- export {};