@salty-css/core 0.0.1-alpha.30 → 0.0.1-alpha.301

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 (118) hide show
  1. package/.saltyrc.schema.json +48 -0
  2. package/README.md +469 -26
  3. package/bin/index.cjs +3 -1
  4. package/bin/index.js +2 -2
  5. package/bin/main.cjs +445 -8
  6. package/bin/main.js +424 -121
  7. package/cache/resolve-dynamic-config-cache.cjs +13 -0
  8. package/cache/resolve-dynamic-config-cache.d.ts +1 -0
  9. package/cache/resolve-dynamic-config-cache.js +13 -0
  10. package/compiler/get-files.d.ts +3 -0
  11. package/compiler/get-function-range.d.ts +1 -0
  12. package/compiler/helpers.d.ts +2 -0
  13. package/compiler/index.cjs +774 -11
  14. package/compiler/index.d.ts +22 -11
  15. package/compiler/index.js +735 -153
  16. package/config/define-config.d.ts +1 -1
  17. package/config/index.cjs +16 -1
  18. package/config/index.d.ts +2 -1
  19. package/config/index.js +14 -2
  20. package/css/index.cjs +12 -1
  21. package/css/index.d.ts +4 -1
  22. package/css/index.js +10 -2
  23. package/css/keyframes.cjs +49 -0
  24. package/css/keyframes.d.ts +22 -0
  25. package/css/keyframes.js +49 -0
  26. package/css/media.cjs +93 -0
  27. package/css/media.d.ts +87 -0
  28. package/css/media.js +93 -0
  29. package/css/merge.cjs +15 -0
  30. package/css/merge.d.ts +7 -0
  31. package/css/merge.js +15 -0
  32. package/css/token.cjs +4 -0
  33. package/css/token.d.ts +1 -0
  34. package/css/token.js +4 -0
  35. package/dash-case-Cz8wwE9a.cjs +32 -0
  36. package/dash-case-NMk0mXyT.js +33 -0
  37. package/define-templates-CVhhgPnd.js +60 -0
  38. package/define-templates-Deq1aCbN.cjs +59 -0
  39. package/factories/define-global-styles.d.ts +7 -0
  40. package/factories/define-media-query.d.ts +8 -0
  41. package/factories/define-templates.d.ts +27 -0
  42. package/factories/define-variables.d.ts +12 -0
  43. package/factories/index.cjs +37 -0
  44. package/factories/index.d.ts +4 -0
  45. package/factories/index.js +37 -0
  46. package/generators/class-name-generator.d.ts +6 -0
  47. package/generators/index.cjs +121 -0
  48. package/generators/index.d.ts +2 -0
  49. package/generators/index.js +121 -0
  50. package/generators/styled-generator.d.ts +20 -0
  51. package/generators/styles-generator.d.ts +22 -0
  52. package/helpers/color.d.ts +18 -0
  53. package/helpers/index.cjs +53 -0
  54. package/helpers/index.d.ts +2 -0
  55. package/helpers/index.js +53 -0
  56. package/helpers/viewport-clamp.d.ts +9 -0
  57. package/helpers-DM2fbDDz.js +18 -0
  58. package/helpers-wv74jTRI.cjs +18 -0
  59. package/index-ByR0nfaf.cjs +4 -0
  60. package/index-DKz1QXqs.js +4 -0
  61. package/package.json +54 -6
  62. package/parse-styles-CqBQc3eQ.js +232 -0
  63. package/parse-styles-D-p_guRO.cjs +231 -0
  64. package/parsers/index.cjs +57 -0
  65. package/parsers/index.d.ts +5 -0
  66. package/parsers/index.js +58 -0
  67. package/parsers/parse-modifiers.d.ts +3 -0
  68. package/parsers/parse-styles.d.ts +13 -0
  69. package/parsers/parse-templates.d.ts +4 -0
  70. package/parsers/parse-tokens.d.ts +3 -0
  71. package/parsers/parser-types.d.ts +8 -0
  72. package/parsers/property-name-check.d.ts +1 -0
  73. package/parsers/unit-check.d.ts +7 -0
  74. package/pascal-case-By_l58S-.cjs +7 -0
  75. package/pascal-case-F3Usi5Wf.js +8 -0
  76. package/{react-styled-file-CGVf5n1B.js → react-styled-file-B99mwk0w.js} +2 -2
  77. package/react-styled-file-U02jek-B.cjs +11 -0
  78. package/react-vanilla-file-Bj6XC8GS.cjs +18 -0
  79. package/react-vanilla-file-D9px70iK.js +18 -0
  80. package/salty.config-DjosWdPw.js +4 -0
  81. package/salty.config-cqavVm2t.cjs +4 -0
  82. package/server/index.cjs +4 -0
  83. package/server/index.d.ts +1 -0
  84. package/server/index.js +4 -0
  85. package/server/should-restart.d.ts +1 -0
  86. package/should-restart-5jI-bzz0.js +18 -0
  87. package/should-restart-DoaGoD5T.cjs +17 -0
  88. package/templates/salty-reset.d.ts +2 -0
  89. package/types/cli-types.d.ts +10 -0
  90. package/types/config-types.d.ts +85 -0
  91. package/types/index.d.ts +57 -23
  92. package/util/dot-case.d.ts +1 -0
  93. package/util/index.cjs +13 -1
  94. package/util/index.js +10 -8
  95. package/util/module-type.d.ts +1 -0
  96. package/viewport-clamp-CEmzmcSj.cjs +10 -0
  97. package/viewport-clamp-K553uXu3.js +11 -0
  98. package/config/config-types.d.ts +0 -59
  99. package/dash-case-DKzpenwY.cjs +0 -1
  100. package/dash-case-DMQMcCO6.js +0 -19
  101. package/generator/index.cjs +0 -1
  102. package/generator/index.d.ts +0 -1
  103. package/generator/index.js +0 -61
  104. package/generator/parse-modifiers.d.ts +0 -3
  105. package/generator/parse-styles.d.ts +0 -2
  106. package/generator/parse-templates.d.ts +0 -2
  107. package/generator/parse-tokens.d.ts +0 -2
  108. package/generator/parser-types.d.ts +0 -4
  109. package/generator/style-generator.d.ts +0 -28
  110. package/index-84Wroia-.cjs +0 -1
  111. package/index-D_732b92.js +0 -4
  112. package/parse-templates-D4p3pgQR.js +0 -92
  113. package/parse-templates-W0YfTmOT.cjs +0 -8
  114. package/pascal-case-BQpR5PdN.js +0 -6
  115. package/pascal-case-iWoaJWwT.cjs +0 -1
  116. package/react-styled-file-Dkubsz-U.cjs +0 -8
  117. package/salty.config-BupieCfE.cjs +0 -6
  118. package/salty.config-D9ANEDiH.js +0 -9
@@ -1,2 +1,2 @@
1
- import { SaltyConfig } from './config-types';
1
+ import { SaltyConfig } from '../types/config-types';
2
2
  export declare const defineConfig: <T extends SaltyConfig>(config: T) => T;
package/config/index.cjs CHANGED
@@ -1 +1,16 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=e=>e;exports.defineConfig=n;
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const factories_index = require("../factories/index.cjs");
4
+ const defineTemplates = require("../define-templates-Deq1aCbN.cjs");
5
+ const defineConfig = (config) => {
6
+ return config;
7
+ };
8
+ exports.GlobalStylesFactory = factories_index.GlobalStylesFactory;
9
+ exports.VariablesFactory = factories_index.VariablesFactory;
10
+ exports.defineGlobalStyles = factories_index.defineGlobalStyles;
11
+ exports.defineMediaQuery = factories_index.defineMediaQuery;
12
+ exports.defineVariables = factories_index.defineVariables;
13
+ exports.TemplateFactory = defineTemplates.TemplateFactory;
14
+ exports.TemplatesFactory = defineTemplates.TemplatesFactory;
15
+ exports.defineTemplates = defineTemplates.defineTemplates;
16
+ exports.defineConfig = defineConfig;
package/config/index.d.ts CHANGED
@@ -1,2 +1,3 @@
1
- export * from './config-types';
2
1
  export * from './define-config';
2
+ export * from '../factories';
3
+ export * from '../types/config-types';
package/config/index.js CHANGED
@@ -1,4 +1,16 @@
1
- const n = (e) => e;
1
+ import { GlobalStylesFactory, VariablesFactory, defineGlobalStyles, defineMediaQuery, defineVariables } from "../factories/index.js";
2
+ import { T, a, d } from "../define-templates-CVhhgPnd.js";
3
+ const defineConfig = (config) => {
4
+ return config;
5
+ };
2
6
  export {
3
- n as defineConfig
7
+ GlobalStylesFactory,
8
+ T as TemplateFactory,
9
+ a as TemplatesFactory,
10
+ VariablesFactory,
11
+ defineConfig,
12
+ defineGlobalStyles,
13
+ defineMediaQuery,
14
+ d as defineTemplates,
15
+ defineVariables
4
16
  };
package/css/index.cjs CHANGED
@@ -1 +1,12 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=e=>`{${e}}`;exports.token=t;
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const css_keyframes = require("./keyframes.cjs");
4
+ const css_media = require("./media.cjs");
5
+ const css_token = require("./token.cjs");
6
+ const css_merge = require("./merge.cjs");
7
+ exports.keyframes = css_keyframes.keyframes;
8
+ exports.MediaQueryFactory = css_media.MediaQueryFactory;
9
+ exports.media = css_media.media;
10
+ exports.token = css_token.token;
11
+ exports.mergeFactories = css_merge.mergeFactories;
12
+ exports.mergeObjects = css_merge.mergeObjects;
package/css/index.d.ts CHANGED
@@ -1 +1,4 @@
1
- export declare const token: <T extends VariableTokens>(token: T) => string;
1
+ export * from './keyframes';
2
+ export * from './media';
3
+ export * from './token';
4
+ export * from './merge';
package/css/index.js CHANGED
@@ -1,4 +1,12 @@
1
- const t = (o) => `{${o}}`;
1
+ import { keyframes } from "./keyframes.js";
2
+ import { MediaQueryFactory, media } from "./media.js";
3
+ import { token } from "./token.js";
4
+ import { mergeFactories, mergeObjects } from "./merge.js";
2
5
  export {
3
- t as token
6
+ MediaQueryFactory,
7
+ keyframes,
8
+ media,
9
+ mergeFactories,
10
+ mergeObjects,
11
+ token
4
12
  };
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const parseStyles = require("../parse-styles-D-p_guRO.cjs");
4
+ const dashCase = require("../dash-case-Cz8wwE9a.cjs");
5
+ const keyframes = ({ animationName: _name, params: _params, appendInitialStyles, ...keyframes2 }) => {
6
+ const modifyKeyframes = async (params = {}) => {
7
+ const animationName = _name || dashCase.toHash(keyframes2);
8
+ const fn = async () => {
9
+ const {
10
+ duration = "500ms",
11
+ easing = "ease-in-out",
12
+ delay = "0s",
13
+ iterationCount = "1",
14
+ direction = "normal",
15
+ fillMode = "forwards",
16
+ playState = "running"
17
+ } = { ..._params, ...params };
18
+ const animation = `${animationName} ${duration} ${easing} ${delay} ${iterationCount} ${direction} ${fillMode} ${playState}`;
19
+ if (!appendInitialStyles) return animation;
20
+ const startingFrom = keyframes2.from || keyframes2["0%"];
21
+ if (!startingFrom) return animation;
22
+ const startStyles = await parseStyles.parseAndJoinStyles(startingFrom, "");
23
+ return `${animation};${startStyles}`;
24
+ };
25
+ const entries = Object.entries(keyframes2);
26
+ const promises = entries.map(async ([key, value]) => {
27
+ if (!value) return "";
28
+ const styles = await parseStyles.parseAndJoinStyles(value, "");
29
+ const keyStr = typeof key === "number" ? `${key}%` : key;
30
+ return `${keyStr}{${styles}}`;
31
+ });
32
+ const resolved = await Promise.all(promises);
33
+ const keyframesCss = resolved.join("");
34
+ const css = `@keyframes ${animationName} {${keyframesCss}}`;
35
+ Object.assign(fn, {
36
+ toString: fn,
37
+ isKeyframes: true,
38
+ animationName,
39
+ css,
40
+ keyframes: keyframes2
41
+ });
42
+ return fn;
43
+ };
44
+ Object.assign(modifyKeyframes, {
45
+ _shouldResolve: true
46
+ });
47
+ return modifyKeyframes;
48
+ };
49
+ exports.keyframes = keyframes;
@@ -0,0 +1,22 @@
1
+ import { CssStyles, StyleValue } from '../types';
2
+ type KeyframeKeys = number | 'from' | 'to' | `${number}%`;
3
+ type Keyframes = {
4
+ [key in KeyframeKeys]?: CssStyles;
5
+ };
6
+ interface KeyframesConfig {
7
+ animationName?: string;
8
+ appendInitialStyles?: boolean;
9
+ params?: KeyframesParams;
10
+ }
11
+ interface KeyframesParams {
12
+ duration?: string;
13
+ delay?: string;
14
+ iterationCount?: string | number;
15
+ easing?: StyleValue<'animationTimingFunction'>;
16
+ direction?: StyleValue<'animationDirection'>;
17
+ fillMode?: StyleValue<'animationFillMode'>;
18
+ playState?: StyleValue<'animationPlayState'>;
19
+ }
20
+ type KeyframesProps = Keyframes & KeyframesConfig;
21
+ export declare const keyframes: ({ animationName: _name, params: _params, appendInitialStyles, ...keyframes }: KeyframesProps) => (params?: KeyframesParams) => Promise<() => Promise<string>>;
22
+ export {};
@@ -0,0 +1,49 @@
1
+ import { p as parseAndJoinStyles } from "../parse-styles-CqBQc3eQ.js";
2
+ import { t as toHash } from "../dash-case-NMk0mXyT.js";
3
+ const keyframes = ({ animationName: _name, params: _params, appendInitialStyles, ...keyframes2 }) => {
4
+ const modifyKeyframes = async (params = {}) => {
5
+ const animationName = _name || toHash(keyframes2);
6
+ const fn = async () => {
7
+ const {
8
+ duration = "500ms",
9
+ easing = "ease-in-out",
10
+ delay = "0s",
11
+ iterationCount = "1",
12
+ direction = "normal",
13
+ fillMode = "forwards",
14
+ playState = "running"
15
+ } = { ..._params, ...params };
16
+ const animation = `${animationName} ${duration} ${easing} ${delay} ${iterationCount} ${direction} ${fillMode} ${playState}`;
17
+ if (!appendInitialStyles) return animation;
18
+ const startingFrom = keyframes2.from || keyframes2["0%"];
19
+ if (!startingFrom) return animation;
20
+ const startStyles = await parseAndJoinStyles(startingFrom, "");
21
+ return `${animation};${startStyles}`;
22
+ };
23
+ const entries = Object.entries(keyframes2);
24
+ const promises = entries.map(async ([key, value]) => {
25
+ if (!value) return "";
26
+ const styles = await parseAndJoinStyles(value, "");
27
+ const keyStr = typeof key === "number" ? `${key}%` : key;
28
+ return `${keyStr}{${styles}}`;
29
+ });
30
+ const resolved = await Promise.all(promises);
31
+ const keyframesCss = resolved.join("");
32
+ const css = `@keyframes ${animationName} {${keyframesCss}}`;
33
+ Object.assign(fn, {
34
+ toString: fn,
35
+ isKeyframes: true,
36
+ animationName,
37
+ css,
38
+ keyframes: keyframes2
39
+ });
40
+ return fn;
41
+ };
42
+ Object.assign(modifyKeyframes, {
43
+ _shouldResolve: true
44
+ });
45
+ return modifyKeyframes;
46
+ };
47
+ export {
48
+ keyframes
49
+ };
package/css/media.cjs ADDED
@@ -0,0 +1,93 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
4
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
5
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
6
+ class MediaQueryFactory {
7
+ constructor(base = "@media") {
8
+ __publicField(this, "next", (value) => {
9
+ const str = new String(value);
10
+ Object.assign(str, {
11
+ get isMedia() {
12
+ return true;
13
+ },
14
+ get and() {
15
+ return new MediaQueryFactory(`${value} and`);
16
+ },
17
+ get or() {
18
+ return new MediaQueryFactory(`${value},`);
19
+ }
20
+ });
21
+ return str;
22
+ });
23
+ this.base = base;
24
+ }
25
+ custom(value) {
26
+ return this.next(`${this.base} ${value}`);
27
+ }
28
+ minWidth(width) {
29
+ const _width = typeof width === "number" ? `${width}px` : width;
30
+ const value = `${this.base} (min-width: ${_width})`;
31
+ return this.next(value);
32
+ }
33
+ maxWidth(width) {
34
+ const _width = typeof width === "number" ? `${width}px` : width;
35
+ const value = `${this.base} (max-width: ${_width})`;
36
+ return this.next(value);
37
+ }
38
+ minHeight(height) {
39
+ const _height = typeof height === "number" ? `${height}px` : height;
40
+ const value = `${this.base} (min-height: ${_height})`;
41
+ return this.next(value);
42
+ }
43
+ maxHeight(height) {
44
+ const _height = typeof height === "number" ? `${height}px` : height;
45
+ const value = `${this.base} (max-height: ${_height})`;
46
+ return this.next(value);
47
+ }
48
+ get portrait() {
49
+ const value = `${this.base} (orientation: portrait)`;
50
+ return this.next(value);
51
+ }
52
+ get landscape() {
53
+ const value = `${this.base} (orientation: landscape)`;
54
+ return this.next(value);
55
+ }
56
+ prefersColorScheme(scheme) {
57
+ const value = `${this.base} (prefers-color-scheme: ${scheme})`;
58
+ return this.next(value);
59
+ }
60
+ get dark() {
61
+ return this.prefersColorScheme("dark");
62
+ }
63
+ get light() {
64
+ return this.prefersColorScheme("light");
65
+ }
66
+ get print() {
67
+ const value = `${this.base} print`;
68
+ return this.next(value);
69
+ }
70
+ get screen() {
71
+ const value = `${this.base} screen`;
72
+ return this.next(value);
73
+ }
74
+ get speech() {
75
+ const value = `${this.base} speech`;
76
+ return this.next(value);
77
+ }
78
+ get all() {
79
+ const value = `${this.base} all`;
80
+ return this.next(value);
81
+ }
82
+ get not() {
83
+ const value = `${this.base} not`;
84
+ return this.next(value);
85
+ }
86
+ get reducedMotion() {
87
+ const value = `${this.base} (prefers-reduced-motion: reduce)`;
88
+ return this.next(value);
89
+ }
90
+ }
91
+ const media = new MediaQueryFactory();
92
+ exports.MediaQueryFactory = MediaQueryFactory;
93
+ exports.media = media;
package/css/media.d.ts ADDED
@@ -0,0 +1,87 @@
1
+ import { OrString, OrNumber } from '../types/util-types';
2
+ export declare class MediaQueryFactory {
3
+ private base;
4
+ constructor(base?: string);
5
+ private next;
6
+ custom(value: string): string & {
7
+ isMedia: boolean;
8
+ and: MediaQueryFactory;
9
+ or: MediaQueryFactory;
10
+ };
11
+ minWidth(width: OrString | OrNumber): string & {
12
+ isMedia: boolean;
13
+ and: MediaQueryFactory;
14
+ or: MediaQueryFactory;
15
+ };
16
+ maxWidth(width: OrString | OrNumber): string & {
17
+ isMedia: boolean;
18
+ and: MediaQueryFactory;
19
+ or: MediaQueryFactory;
20
+ };
21
+ minHeight(height: OrString | OrNumber): string & {
22
+ isMedia: boolean;
23
+ and: MediaQueryFactory;
24
+ or: MediaQueryFactory;
25
+ };
26
+ maxHeight(height: OrString | OrNumber): string & {
27
+ isMedia: boolean;
28
+ and: MediaQueryFactory;
29
+ or: MediaQueryFactory;
30
+ };
31
+ get portrait(): string & {
32
+ isMedia: boolean;
33
+ and: MediaQueryFactory;
34
+ or: MediaQueryFactory;
35
+ };
36
+ get landscape(): string & {
37
+ isMedia: boolean;
38
+ and: MediaQueryFactory;
39
+ or: MediaQueryFactory;
40
+ };
41
+ prefersColorScheme(scheme: 'dark' | 'light' | OrString): string & {
42
+ isMedia: boolean;
43
+ and: MediaQueryFactory;
44
+ or: MediaQueryFactory;
45
+ };
46
+ get dark(): string & {
47
+ isMedia: boolean;
48
+ and: MediaQueryFactory;
49
+ or: MediaQueryFactory;
50
+ };
51
+ get light(): string & {
52
+ isMedia: boolean;
53
+ and: MediaQueryFactory;
54
+ or: MediaQueryFactory;
55
+ };
56
+ get print(): string & {
57
+ isMedia: boolean;
58
+ and: MediaQueryFactory;
59
+ or: MediaQueryFactory;
60
+ };
61
+ get screen(): string & {
62
+ isMedia: boolean;
63
+ and: MediaQueryFactory;
64
+ or: MediaQueryFactory;
65
+ };
66
+ get speech(): string & {
67
+ isMedia: boolean;
68
+ and: MediaQueryFactory;
69
+ or: MediaQueryFactory;
70
+ };
71
+ get all(): string & {
72
+ isMedia: boolean;
73
+ and: MediaQueryFactory;
74
+ or: MediaQueryFactory;
75
+ };
76
+ get not(): string & {
77
+ isMedia: boolean;
78
+ and: MediaQueryFactory;
79
+ or: MediaQueryFactory;
80
+ };
81
+ get reducedMotion(): string & {
82
+ isMedia: boolean;
83
+ and: MediaQueryFactory;
84
+ or: MediaQueryFactory;
85
+ };
86
+ }
87
+ export declare const media: MediaQueryFactory;
package/css/media.js ADDED
@@ -0,0 +1,93 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
4
+ class MediaQueryFactory {
5
+ constructor(base = "@media") {
6
+ __publicField(this, "next", (value) => {
7
+ const str = new String(value);
8
+ Object.assign(str, {
9
+ get isMedia() {
10
+ return true;
11
+ },
12
+ get and() {
13
+ return new MediaQueryFactory(`${value} and`);
14
+ },
15
+ get or() {
16
+ return new MediaQueryFactory(`${value},`);
17
+ }
18
+ });
19
+ return str;
20
+ });
21
+ this.base = base;
22
+ }
23
+ custom(value) {
24
+ return this.next(`${this.base} ${value}`);
25
+ }
26
+ minWidth(width) {
27
+ const _width = typeof width === "number" ? `${width}px` : width;
28
+ const value = `${this.base} (min-width: ${_width})`;
29
+ return this.next(value);
30
+ }
31
+ maxWidth(width) {
32
+ const _width = typeof width === "number" ? `${width}px` : width;
33
+ const value = `${this.base} (max-width: ${_width})`;
34
+ return this.next(value);
35
+ }
36
+ minHeight(height) {
37
+ const _height = typeof height === "number" ? `${height}px` : height;
38
+ const value = `${this.base} (min-height: ${_height})`;
39
+ return this.next(value);
40
+ }
41
+ maxHeight(height) {
42
+ const _height = typeof height === "number" ? `${height}px` : height;
43
+ const value = `${this.base} (max-height: ${_height})`;
44
+ return this.next(value);
45
+ }
46
+ get portrait() {
47
+ const value = `${this.base} (orientation: portrait)`;
48
+ return this.next(value);
49
+ }
50
+ get landscape() {
51
+ const value = `${this.base} (orientation: landscape)`;
52
+ return this.next(value);
53
+ }
54
+ prefersColorScheme(scheme) {
55
+ const value = `${this.base} (prefers-color-scheme: ${scheme})`;
56
+ return this.next(value);
57
+ }
58
+ get dark() {
59
+ return this.prefersColorScheme("dark");
60
+ }
61
+ get light() {
62
+ return this.prefersColorScheme("light");
63
+ }
64
+ get print() {
65
+ const value = `${this.base} print`;
66
+ return this.next(value);
67
+ }
68
+ get screen() {
69
+ const value = `${this.base} screen`;
70
+ return this.next(value);
71
+ }
72
+ get speech() {
73
+ const value = `${this.base} speech`;
74
+ return this.next(value);
75
+ }
76
+ get all() {
77
+ const value = `${this.base} all`;
78
+ return this.next(value);
79
+ }
80
+ get not() {
81
+ const value = `${this.base} not`;
82
+ return this.next(value);
83
+ }
84
+ get reducedMotion() {
85
+ const value = `${this.base} (prefers-reduced-motion: reduce)`;
86
+ return this.next(value);
87
+ }
88
+ }
89
+ const media = new MediaQueryFactory();
90
+ export {
91
+ MediaQueryFactory,
92
+ media
93
+ };
package/css/merge.cjs ADDED
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const mergeObjects = (...styles) => {
4
+ return styles.flat().reduce((acc, style) => {
5
+ if (style == null ? void 0 : style._current) return { ...acc, ...style._current };
6
+ return { ...acc, ...style };
7
+ }, {});
8
+ };
9
+ const mergeFactories = (...factories) => {
10
+ return factories.flat().reduce((acc, factory) => {
11
+ return { ...acc, ...factory._children };
12
+ }, {});
13
+ };
14
+ exports.mergeFactories = mergeFactories;
15
+ exports.mergeObjects = mergeObjects;
package/css/merge.d.ts ADDED
@@ -0,0 +1,7 @@
1
+ interface StyleFactory {
2
+ _current: Record<string, any>;
3
+ _children: Record<string, any>;
4
+ }
5
+ export declare const mergeObjects: <T = any>(...styles: any[]) => T;
6
+ export declare const mergeFactories: <T extends StyleFactory>(...factories: T[][]) => T;
7
+ export {};
package/css/merge.js ADDED
@@ -0,0 +1,15 @@
1
+ const mergeObjects = (...styles) => {
2
+ return styles.flat().reduce((acc, style) => {
3
+ if (style == null ? void 0 : style._current) return { ...acc, ...style._current };
4
+ return { ...acc, ...style };
5
+ }, {});
6
+ };
7
+ const mergeFactories = (...factories) => {
8
+ return factories.flat().reduce((acc, factory) => {
9
+ return { ...acc, ...factory._children };
10
+ }, {});
11
+ };
12
+ export {
13
+ mergeFactories,
14
+ mergeObjects
15
+ };
package/css/token.cjs ADDED
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const token = (token2) => `{${token2}}`;
4
+ exports.token = token;
package/css/token.d.ts ADDED
@@ -0,0 +1 @@
1
+ export declare const token: <T extends VariableTokens>(token: T) => string;
package/css/token.js ADDED
@@ -0,0 +1,4 @@
1
+ const token = (token2) => `{${token2}}`;
2
+ export {
3
+ token
4
+ };
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ const toAlphabeticChar = (code) => String.fromCharCode(code + (code > 25 ? 39 : 97));
3
+ const toAlphabeticName = (code, length) => {
4
+ let name = "";
5
+ let x;
6
+ for (x = Math.abs(code); x > 52; x = x / 52 | 0) name = toAlphabeticChar(x % 52) + name;
7
+ name = toAlphabeticChar(x % 52) + name;
8
+ if (name.length < length) {
9
+ name = name.padStart(length, "a");
10
+ } else if (name.length > length) {
11
+ name = name.slice(-length);
12
+ }
13
+ return name;
14
+ };
15
+ const toPhash = (h, x) => {
16
+ let i = x.length;
17
+ while (i) h = h * 33 ^ x.charCodeAt(--i);
18
+ return h;
19
+ };
20
+ const toHash = (value, length = 5) => {
21
+ const numericHash = toPhash(5381, JSON.stringify(value)) >>> 0;
22
+ return toAlphabeticName(numericHash, length);
23
+ };
24
+ function dashCase(str) {
25
+ if (!str) return "";
26
+ if (typeof str !== "string") return dashCase(String(str));
27
+ return str.replace(/[\s.]/g, "-").replace(/[A-Z](?:(?=[^A-Z])|[A-Z]*(?=[A-Z][^A-Z]|$))/g, (s, i) => {
28
+ return (i > 0 ? "-" : "") + s.toLowerCase();
29
+ });
30
+ }
31
+ exports.dashCase = dashCase;
32
+ exports.toHash = toHash;
@@ -0,0 +1,33 @@
1
+ const toAlphabeticChar = (code) => String.fromCharCode(code + (code > 25 ? 39 : 97));
2
+ const toAlphabeticName = (code, length) => {
3
+ let name = "";
4
+ let x;
5
+ for (x = Math.abs(code); x > 52; x = x / 52 | 0) name = toAlphabeticChar(x % 52) + name;
6
+ name = toAlphabeticChar(x % 52) + name;
7
+ if (name.length < length) {
8
+ name = name.padStart(length, "a");
9
+ } else if (name.length > length) {
10
+ name = name.slice(-length);
11
+ }
12
+ return name;
13
+ };
14
+ const toPhash = (h, x) => {
15
+ let i = x.length;
16
+ while (i) h = h * 33 ^ x.charCodeAt(--i);
17
+ return h;
18
+ };
19
+ const toHash = (value, length = 5) => {
20
+ const numericHash = toPhash(5381, JSON.stringify(value)) >>> 0;
21
+ return toAlphabeticName(numericHash, length);
22
+ };
23
+ function dashCase(str) {
24
+ if (!str) return "";
25
+ if (typeof str !== "string") return dashCase(String(str));
26
+ return str.replace(/[\s.]/g, "-").replace(/[A-Z](?:(?=[^A-Z])|[A-Z]*(?=[A-Z][^A-Z]|$))/g, (s, i) => {
27
+ return (i > 0 ? "-" : "") + s.toLowerCase();
28
+ });
29
+ }
30
+ export {
31
+ dashCase as d,
32
+ toHash as t
33
+ };
@@ -0,0 +1,60 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
4
+ class TemplateFactory {
5
+ constructor(params) {
6
+ __publicField(this, "_path");
7
+ this.params = params;
8
+ }
9
+ get _current() {
10
+ return this.params.template;
11
+ }
12
+ get isDefineTemplate() {
13
+ return true;
14
+ }
15
+ _setPath(path) {
16
+ this._path = path;
17
+ return this;
18
+ }
19
+ }
20
+ class TemplatesFactory {
21
+ constructor(params) {
22
+ __publicField(this, "_path");
23
+ __publicField(this, "templates", []);
24
+ this.params = params;
25
+ Object.entries(params).forEach(([name, template]) => {
26
+ this.templates.push(
27
+ new TemplateFactory({
28
+ name,
29
+ template
30
+ })
31
+ );
32
+ });
33
+ }
34
+ get _current() {
35
+ return this.params;
36
+ }
37
+ get _children() {
38
+ return Object.fromEntries(
39
+ this.templates.map((template) => {
40
+ return [template.params.name, template];
41
+ })
42
+ );
43
+ }
44
+ get isDefineTemplates() {
45
+ return true;
46
+ }
47
+ _setPath(path) {
48
+ this._path = path;
49
+ this.templates.forEach((template) => template._setPath(path));
50
+ return this;
51
+ }
52
+ }
53
+ const defineTemplates = (templates) => {
54
+ return new TemplatesFactory(templates);
55
+ };
56
+ export {
57
+ TemplateFactory as T,
58
+ TemplatesFactory as a,
59
+ defineTemplates as d
60
+ };