@salty-css/core 0.0.1-alpha.300 → 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.
- package/.saltyrc.schema.json +1 -1
- package/bin/index.cjs +3 -1
- package/bin/index.js +2 -2
- package/bin/main.cjs +445 -11
- package/bin/main.js +405 -224
- package/cache/resolve-dynamic-config-cache.cjs +13 -1
- package/cache/resolve-dynamic-config-cache.js +10 -8
- package/compiler/index.cjs +774 -1
- package/compiler/index.d.ts +3 -0
- package/compiler/index.js +754 -20
- package/config/index.cjs +16 -1
- package/config/index.js +14 -12
- package/css/index.cjs +12 -1
- package/css/index.js +10 -10
- package/css/keyframes.cjs +49 -1
- package/css/keyframes.js +44 -34
- package/css/media.cjs +93 -1
- package/css/media.js +54 -49
- package/css/merge.cjs +15 -1
- package/css/merge.js +13 -3
- package/css/token.cjs +4 -1
- package/css/token.js +2 -2
- package/dash-case-Cz8wwE9a.cjs +32 -0
- package/dash-case-NMk0mXyT.js +33 -0
- package/define-templates-CVhhgPnd.js +60 -0
- package/define-templates-Deq1aCbN.cjs +59 -0
- package/factories/index.cjs +37 -1
- package/factories/index.js +27 -20
- package/generators/index.cjs +121 -1
- package/generators/index.js +82 -49
- package/helpers/index.cjs +53 -1
- package/helpers/index.js +40 -1170
- package/helpers-DM2fbDDz.js +18 -0
- package/helpers-wv74jTRI.cjs +18 -0
- package/index-ByR0nfaf.cjs +4 -0
- package/index-DKz1QXqs.js +4 -0
- package/package.json +1 -1
- package/parse-styles-CqBQc3eQ.js +232 -0
- package/parse-styles-D-p_guRO.cjs +231 -0
- package/parsers/index.cjs +57 -2
- package/parsers/index.js +55 -30
- package/pascal-case-By_l58S-.cjs +7 -0
- package/pascal-case-F3Usi5Wf.js +8 -0
- package/{react-styled-file-CGVf5n1B.js → react-styled-file-B99mwk0w.js} +2 -2
- package/react-styled-file-U02jek-B.cjs +11 -0
- package/react-vanilla-file-Bj6XC8GS.cjs +18 -0
- package/{react-vanilla-file-CCXbsjIb.js → react-vanilla-file-D9px70iK.js} +2 -2
- package/salty.config-DjosWdPw.js +4 -0
- package/salty.config-cqavVm2t.cjs +4 -0
- package/server/index.cjs +4 -1
- package/server/index.js +2 -2
- package/should-restart-5jI-bzz0.js +18 -0
- package/should-restart-DoaGoD5T.cjs +17 -0
- package/util/index.cjs +13 -1
- package/util/index.js +10 -8
- package/viewport-clamp-CEmzmcSj.cjs +10 -0
- package/viewport-clamp-K553uXu3.js +11 -0
- package/dash-case-BJEkFEGQ.cjs +0 -1
- package/dash-case-DBThphLm.js +0 -19
- package/define-templates-4A2yHcMF.js +0 -52
- package/define-templates-Cunsb_Tr.cjs +0 -1
- package/helpers-CC5pFyba.cjs +0 -1
- package/helpers-nHqH4L9L.js +0 -11
- package/index-84Wroia-.cjs +0 -1
- package/index-CituHO0U.js +0 -524
- package/index-D_732b92.js +0 -4
- package/index-ol1Q_xul.cjs +0 -41
- package/parse-styles-B1E0JeC7.cjs +0 -5
- package/parse-styles-y_-drahL.js +0 -161
- package/pascal-case-BQpR5PdN.js +0 -6
- package/pascal-case-iWoaJWwT.cjs +0 -1
- package/react-styled-file-Dkubsz-U.cjs +0 -8
- package/react-vanilla-file-CG_WJLam.cjs +0 -15
- package/salty.config-BhBY_oOk.js +0 -10
- package/salty.config-Dk6ZcCxI.cjs +0 -7
- package/should-restart-C6VJ-qaY.js +0 -12
- package/should-restart-DAhvRrtu.cjs +0 -1
- package/viewport-clamp-CaYwREKc.js +0 -7
- package/viewport-clamp-mq_DFtRR.cjs +0 -1
package/config/index.cjs
CHANGED
@@ -1 +1,16 @@
|
|
1
|
-
"use strict";
|
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.js
CHANGED
@@ -1,14 +1,16 @@
|
|
1
|
-
import { GlobalStylesFactory
|
2
|
-
import { T
|
3
|
-
const
|
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
|
+
};
|
4
6
|
export {
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
7
|
+
GlobalStylesFactory,
|
8
|
+
T as TemplateFactory,
|
9
|
+
a as TemplatesFactory,
|
10
|
+
VariablesFactory,
|
11
|
+
defineConfig,
|
12
|
+
defineGlobalStyles,
|
13
|
+
defineMediaQuery,
|
14
|
+
d as defineTemplates,
|
15
|
+
defineVariables
|
14
16
|
};
|
package/css/index.cjs
CHANGED
@@ -1 +1,12 @@
|
|
1
|
-
"use strict";
|
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.js
CHANGED
@@ -1,12 +1,12 @@
|
|
1
|
-
import { keyframes
|
2
|
-
import { MediaQueryFactory
|
3
|
-
import { token
|
4
|
-
import { mergeFactories
|
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";
|
5
5
|
export {
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
6
|
+
MediaQueryFactory,
|
7
|
+
keyframes,
|
8
|
+
media,
|
9
|
+
mergeFactories,
|
10
|
+
mergeObjects,
|
11
|
+
token
|
12
12
|
};
|
package/css/keyframes.cjs
CHANGED
@@ -1 +1,49 @@
|
|
1
|
-
"use strict";
|
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;
|
package/css/keyframes.js
CHANGED
@@ -1,39 +1,49 @@
|
|
1
|
-
import { p as
|
2
|
-
import { t as
|
3
|
-
const
|
4
|
-
const
|
5
|
-
const
|
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 () => {
|
6
7
|
const {
|
7
|
-
duration
|
8
|
-
easing
|
9
|
-
delay
|
10
|
-
iterationCount
|
11
|
-
direction
|
12
|
-
fillMode
|
13
|
-
playState
|
14
|
-
} = { ...
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
}
|
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;
|
32
41
|
};
|
33
|
-
|
34
|
-
_shouldResolve:
|
35
|
-
})
|
42
|
+
Object.assign(modifyKeyframes, {
|
43
|
+
_shouldResolve: true
|
44
|
+
});
|
45
|
+
return modifyKeyframes;
|
36
46
|
};
|
37
47
|
export {
|
38
|
-
|
48
|
+
keyframes
|
39
49
|
};
|
package/css/media.cjs
CHANGED
@@ -1 +1,93 @@
|
|
1
|
-
"use strict";
|
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.js
CHANGED
@@ -1,54 +1,59 @@
|
|
1
|
-
var
|
2
|
-
var
|
3
|
-
var
|
4
|
-
class
|
5
|
-
constructor(
|
6
|
-
|
7
|
-
const
|
8
|
-
|
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
9
|
get isMedia() {
|
10
|
-
return
|
10
|
+
return true;
|
11
11
|
},
|
12
12
|
get and() {
|
13
|
-
return new
|
13
|
+
return new MediaQueryFactory(`${value} and`);
|
14
14
|
},
|
15
15
|
get or() {
|
16
|
-
return new
|
16
|
+
return new MediaQueryFactory(`${value},`);
|
17
17
|
}
|
18
|
-
})
|
18
|
+
});
|
19
|
+
return str;
|
19
20
|
});
|
20
|
-
this.base =
|
21
|
+
this.base = base;
|
21
22
|
}
|
22
|
-
custom(
|
23
|
-
return this.next(`${this.base} ${
|
23
|
+
custom(value) {
|
24
|
+
return this.next(`${this.base} ${value}`);
|
24
25
|
}
|
25
|
-
minWidth(
|
26
|
-
const
|
27
|
-
|
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);
|
28
30
|
}
|
29
|
-
maxWidth(
|
30
|
-
const
|
31
|
-
|
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);
|
32
35
|
}
|
33
|
-
minHeight(
|
34
|
-
const
|
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);
|
36
40
|
}
|
37
|
-
maxHeight(
|
38
|
-
const
|
39
|
-
|
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);
|
40
45
|
}
|
41
46
|
get portrait() {
|
42
|
-
const
|
43
|
-
return this.next(
|
47
|
+
const value = `${this.base} (orientation: portrait)`;
|
48
|
+
return this.next(value);
|
44
49
|
}
|
45
50
|
get landscape() {
|
46
|
-
const
|
47
|
-
return this.next(
|
51
|
+
const value = `${this.base} (orientation: landscape)`;
|
52
|
+
return this.next(value);
|
48
53
|
}
|
49
|
-
prefersColorScheme(
|
50
|
-
const
|
51
|
-
return this.next(
|
54
|
+
prefersColorScheme(scheme) {
|
55
|
+
const value = `${this.base} (prefers-color-scheme: ${scheme})`;
|
56
|
+
return this.next(value);
|
52
57
|
}
|
53
58
|
get dark() {
|
54
59
|
return this.prefersColorScheme("dark");
|
@@ -57,32 +62,32 @@ class r {
|
|
57
62
|
return this.prefersColorScheme("light");
|
58
63
|
}
|
59
64
|
get print() {
|
60
|
-
const
|
61
|
-
return this.next(
|
65
|
+
const value = `${this.base} print`;
|
66
|
+
return this.next(value);
|
62
67
|
}
|
63
68
|
get screen() {
|
64
|
-
const
|
65
|
-
return this.next(
|
69
|
+
const value = `${this.base} screen`;
|
70
|
+
return this.next(value);
|
66
71
|
}
|
67
72
|
get speech() {
|
68
|
-
const
|
69
|
-
return this.next(
|
73
|
+
const value = `${this.base} speech`;
|
74
|
+
return this.next(value);
|
70
75
|
}
|
71
76
|
get all() {
|
72
|
-
const
|
73
|
-
return this.next(
|
77
|
+
const value = `${this.base} all`;
|
78
|
+
return this.next(value);
|
74
79
|
}
|
75
80
|
get not() {
|
76
|
-
const
|
77
|
-
return this.next(
|
81
|
+
const value = `${this.base} not`;
|
82
|
+
return this.next(value);
|
78
83
|
}
|
79
84
|
get reducedMotion() {
|
80
|
-
const
|
81
|
-
return this.next(
|
85
|
+
const value = `${this.base} (prefers-reduced-motion: reduce)`;
|
86
|
+
return this.next(value);
|
82
87
|
}
|
83
88
|
}
|
84
|
-
const
|
89
|
+
const media = new MediaQueryFactory();
|
85
90
|
export {
|
86
|
-
|
87
|
-
|
91
|
+
MediaQueryFactory,
|
92
|
+
media
|
88
93
|
};
|
package/css/merge.cjs
CHANGED
@@ -1 +1,15 @@
|
|
1
|
-
"use strict";
|
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.js
CHANGED
@@ -1,5 +1,15 @@
|
|
1
|
-
const
|
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
|
+
};
|
2
12
|
export {
|
3
|
-
|
4
|
-
|
13
|
+
mergeFactories,
|
14
|
+
mergeObjects
|
5
15
|
};
|
package/css/token.cjs
CHANGED
@@ -1 +1,4 @@
|
|
1
|
-
"use strict";
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
3
|
+
const token = (token2) => `{${token2}}`;
|
4
|
+
exports.token = token;
|
package/css/token.js
CHANGED
@@ -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
|
+
};
|