@salty-css/core 0.1.0-alpha.0 → 0.1.0-alpha.1
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/compiler/helpers.cjs +2 -1
- package/compiler/helpers.js +2 -1
- package/css/keyframes.cjs +1 -1
- package/css/keyframes.js +1 -1
- package/css/merge.cjs +2 -1
- package/css/merge.js +2 -1
- package/generators/index.cjs +1 -1
- package/generators/index.js +1 -1
- package/package.json +1 -1
package/compiler/helpers.cjs
CHANGED
|
@@ -16,7 +16,8 @@ const resolveExportValue = async (value, maxLevel = 10, _level = 0) => {
|
|
|
16
16
|
return value;
|
|
17
17
|
};
|
|
18
18
|
const saltyFileExtensions = ["salty", "css", "styles", "styled"];
|
|
19
|
-
const
|
|
19
|
+
const escapeRegExp = (str) => str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
20
|
+
const saltyFileRegExp = (additional = []) => new RegExp(`\\.(${[...saltyFileExtensions, ...additional].map(escapeRegExp).join("|")})\\.`);
|
|
20
21
|
const isSaltyFile = (file, additional = []) => saltyFileRegExp(additional).test(file);
|
|
21
22
|
exports.getCorePackageRoot = getCorePackageRoot;
|
|
22
23
|
exports.isSaltyFile = isSaltyFile;
|
package/compiler/helpers.js
CHANGED
|
@@ -13,7 +13,8 @@ const resolveExportValue = async (value, maxLevel = 10, _level = 0) => {
|
|
|
13
13
|
return value;
|
|
14
14
|
};
|
|
15
15
|
const saltyFileExtensions = ["salty", "css", "styles", "styled"];
|
|
16
|
-
const
|
|
16
|
+
const escapeRegExp = (str) => str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
17
|
+
const saltyFileRegExp = (additional = []) => new RegExp(`\\.(${[...saltyFileExtensions, ...additional].map(escapeRegExp).join("|")})\\.`);
|
|
17
18
|
const isSaltyFile = (file, additional = []) => saltyFileRegExp(additional).test(file);
|
|
18
19
|
export {
|
|
19
20
|
getCorePackageRoot,
|
package/css/keyframes.cjs
CHANGED
|
@@ -26,7 +26,7 @@ const keyframes = ({ animationName: _name, params: _params, appendInitialStyles,
|
|
|
26
26
|
const promises = entries.map(async ([key, value]) => {
|
|
27
27
|
if (!value) return "";
|
|
28
28
|
const styles = await parseStyles.parseAndJoinStyles(value, "");
|
|
29
|
-
const keyStr =
|
|
29
|
+
const keyStr = /^-?\d+$/.test(key) ? `${key}%` : key;
|
|
30
30
|
return `${keyStr}{${styles}}`;
|
|
31
31
|
});
|
|
32
32
|
const resolved = await Promise.all(promises);
|
package/css/keyframes.js
CHANGED
|
@@ -24,7 +24,7 @@ const keyframes = ({ animationName: _name, params: _params, appendInitialStyles,
|
|
|
24
24
|
const promises = entries.map(async ([key, value]) => {
|
|
25
25
|
if (!value) return "";
|
|
26
26
|
const styles = await parseAndJoinStyles(value, "");
|
|
27
|
-
const keyStr =
|
|
27
|
+
const keyStr = /^-?\d+$/.test(key) ? `${key}%` : key;
|
|
28
28
|
return `${keyStr}{${styles}}`;
|
|
29
29
|
});
|
|
30
30
|
const resolved = await Promise.all(promises);
|
package/css/merge.cjs
CHANGED
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const mergeObjects = (...styles) => {
|
|
4
4
|
return styles.flat().reduce((acc, style) => {
|
|
5
|
-
if (style
|
|
5
|
+
if (!style || typeof style !== "object") return acc;
|
|
6
|
+
if ("_current" in style && style._current && typeof style._current === "object") return { ...acc, ...style._current };
|
|
6
7
|
return { ...acc, ...style };
|
|
7
8
|
}, {});
|
|
8
9
|
};
|
package/css/merge.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
const mergeObjects = (...styles) => {
|
|
2
2
|
return styles.flat().reduce((acc, style) => {
|
|
3
|
-
if (style
|
|
3
|
+
if (!style || typeof style !== "object") return acc;
|
|
4
|
+
if ("_current" in style && style._current && typeof style._current === "object") return { ...acc, ...style._current };
|
|
4
5
|
return { ...acc, ...style };
|
|
5
6
|
}, {});
|
|
6
7
|
};
|
package/generators/index.cjs
CHANGED
|
@@ -11,7 +11,7 @@ class StyledGenerator extends classNameGenerator.StylesGenerator {
|
|
|
11
11
|
get priority() {
|
|
12
12
|
var _a;
|
|
13
13
|
if (this.params.priority) return this.params.priority;
|
|
14
|
-
if (typeof this.tagName === "function" || typeof this.tagName === "object") {
|
|
14
|
+
if (this.tagName && (typeof this.tagName === "function" || typeof this.tagName === "object")) {
|
|
15
15
|
const prev = ((_a = this.tagName.generator) == null ? void 0 : _a.priority) || 0;
|
|
16
16
|
return prev + 1;
|
|
17
17
|
}
|
package/generators/index.js
CHANGED
|
@@ -10,7 +10,7 @@ class StyledGenerator extends StylesGenerator {
|
|
|
10
10
|
get priority() {
|
|
11
11
|
var _a;
|
|
12
12
|
if (this.params.priority) return this.params.priority;
|
|
13
|
-
if (typeof this.tagName === "function" || typeof this.tagName === "object") {
|
|
13
|
+
if (this.tagName && (typeof this.tagName === "function" || typeof this.tagName === "object")) {
|
|
14
14
|
const prev = ((_a = this.tagName.generator) == null ? void 0 : _a.priority) || 0;
|
|
15
15
|
return prev + 1;
|
|
16
16
|
}
|