@plumeria/core 4.0.2 → 4.0.4
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/css.d.ts +3 -3
- package/dist/css.js +11 -21
- package/dist/css.mjs +11 -21
- package/package.json +2 -3
package/dist/css.d.ts
CHANGED
|
@@ -49,7 +49,7 @@ type ReturnType<T> = { [K in keyof T]: Readonly<{ [P in keyof T[K]]: P extends `
|
|
|
49
49
|
type CreateStatic = Record<string, string | number>;
|
|
50
50
|
type CreateTheme = Record<string, Record<string, string | number>>;
|
|
51
51
|
type ReturnVariableType<T> = { [K in keyof T]: CSSVariableValue };
|
|
52
|
-
type
|
|
52
|
+
type Style = {
|
|
53
53
|
[key: CSSVariableKey]: string;
|
|
54
54
|
};
|
|
55
55
|
type KeyframesInSelector = 'from' | 'to' | `${number}%`;
|
|
@@ -71,9 +71,9 @@ declare const css: {
|
|
|
71
71
|
keyframes(_rule: Keyframes): string;
|
|
72
72
|
viewTransition(_rule: ViewTransition): string;
|
|
73
73
|
};
|
|
74
|
-
declare const x: (className: string,
|
|
74
|
+
declare const x: (className: string, style: Style) => {
|
|
75
75
|
className: string;
|
|
76
|
-
|
|
76
|
+
style: Style;
|
|
77
77
|
};
|
|
78
78
|
|
|
79
79
|
export { type CSSProperties, type CreateStyle, css, x };
|
package/dist/css.js
CHANGED
|
@@ -4,35 +4,25 @@ function errorFn(fn) {
|
|
|
4
4
|
}
|
|
5
5
|
function props(...rules) {
|
|
6
6
|
const chosen = new Map();
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
const rightmostKeys = [];
|
|
10
|
-
for (let i = rules.length - 1; i >= 0; i--) {
|
|
7
|
+
const lastIdx = rules.length - 1;
|
|
8
|
+
for (let i = lastIdx; i >= 0; i--) {
|
|
11
9
|
const arg = rules[i];
|
|
12
10
|
if (!arg || typeof arg === "string") continue;
|
|
13
|
-
for (const
|
|
14
|
-
hash,
|
|
15
|
-
propsIdx: i
|
|
16
|
-
});
|
|
11
|
+
for (const key in arg) if (!chosen.has(key)) chosen.set(key, i);
|
|
17
12
|
}
|
|
18
|
-
|
|
13
|
+
const classList = [];
|
|
14
|
+
const rightmostList = [];
|
|
15
|
+
for (let i = 0; i <= lastIdx; i++) {
|
|
19
16
|
const arg = rules[i];
|
|
20
17
|
if (!arg) continue;
|
|
21
18
|
if (typeof arg === "string") {
|
|
22
19
|
classList.push(arg);
|
|
23
20
|
continue;
|
|
24
21
|
}
|
|
25
|
-
for (const [key]
|
|
26
|
-
|
|
27
|
-
if (info && info.propsIdx === i) {
|
|
28
|
-
if (i === rules.length - 1) rightmostKeys.push(info);
|
|
29
|
-
else orderedKeys.push(info);
|
|
30
|
-
chosen.delete(key);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
22
|
+
for (const key in arg) if (chosen.get(key) === i && arg[key]) if (i === lastIdx) rightmostList.push(arg[key]);
|
|
23
|
+
else classList.push(arg[key]);
|
|
33
24
|
}
|
|
34
|
-
for (const
|
|
35
|
-
for (const { hash } of rightmostKeys) classList.push(hash);
|
|
25
|
+
for (const hash of rightmostList) classList.push(hash);
|
|
36
26
|
return classList.join(" ");
|
|
37
27
|
}
|
|
38
28
|
const css = class _css {
|
|
@@ -53,9 +43,9 @@ const css = class _css {
|
|
|
53
43
|
throw errorFn("viewTransition");
|
|
54
44
|
}
|
|
55
45
|
};
|
|
56
|
-
const x = (className,
|
|
46
|
+
const x = (className, style) => ({
|
|
57
47
|
className,
|
|
58
|
-
|
|
48
|
+
style
|
|
59
49
|
});
|
|
60
50
|
|
|
61
51
|
exports.css = css;
|
package/dist/css.mjs
CHANGED
|
@@ -4,35 +4,25 @@ function errorFn(fn) {
|
|
|
4
4
|
}
|
|
5
5
|
function props(...rules) {
|
|
6
6
|
const chosen = new Map();
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
const rightmostKeys = [];
|
|
10
|
-
for (let i = rules.length - 1; i >= 0; i--) {
|
|
7
|
+
const lastIdx = rules.length - 1;
|
|
8
|
+
for (let i = lastIdx; i >= 0; i--) {
|
|
11
9
|
const arg = rules[i];
|
|
12
10
|
if (!arg || typeof arg === "string") continue;
|
|
13
|
-
for (const
|
|
14
|
-
hash,
|
|
15
|
-
propsIdx: i
|
|
16
|
-
});
|
|
11
|
+
for (const key in arg) if (!chosen.has(key)) chosen.set(key, i);
|
|
17
12
|
}
|
|
18
|
-
|
|
13
|
+
const classList = [];
|
|
14
|
+
const rightmostList = [];
|
|
15
|
+
for (let i = 0; i <= lastIdx; i++) {
|
|
19
16
|
const arg = rules[i];
|
|
20
17
|
if (!arg) continue;
|
|
21
18
|
if (typeof arg === "string") {
|
|
22
19
|
classList.push(arg);
|
|
23
20
|
continue;
|
|
24
21
|
}
|
|
25
|
-
for (const [key]
|
|
26
|
-
|
|
27
|
-
if (info && info.propsIdx === i) {
|
|
28
|
-
if (i === rules.length - 1) rightmostKeys.push(info);
|
|
29
|
-
else orderedKeys.push(info);
|
|
30
|
-
chosen.delete(key);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
22
|
+
for (const key in arg) if (chosen.get(key) === i && arg[key]) if (i === lastIdx) rightmostList.push(arg[key]);
|
|
23
|
+
else classList.push(arg[key]);
|
|
33
24
|
}
|
|
34
|
-
for (const
|
|
35
|
-
for (const { hash } of rightmostKeys) classList.push(hash);
|
|
25
|
+
for (const hash of rightmostList) classList.push(hash);
|
|
36
26
|
return classList.join(" ");
|
|
37
27
|
}
|
|
38
28
|
const css = class _css {
|
|
@@ -53,9 +43,9 @@ const css = class _css {
|
|
|
53
43
|
throw errorFn("viewTransition");
|
|
54
44
|
}
|
|
55
45
|
};
|
|
56
|
-
const x = (className,
|
|
46
|
+
const x = (className, style) => ({
|
|
57
47
|
className,
|
|
58
|
-
|
|
48
|
+
style
|
|
59
49
|
});
|
|
60
50
|
|
|
61
51
|
export { css, x };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plumeria/core",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.4",
|
|
4
4
|
"description": "An atomic CSS runtime designed to disappear.",
|
|
5
5
|
"author": "Refirst 11",
|
|
6
6
|
"license": "MIT",
|
|
@@ -28,8 +28,7 @@
|
|
|
28
28
|
"module": "dist/css.mjs",
|
|
29
29
|
"types": "dist/css.d.ts",
|
|
30
30
|
"files": [
|
|
31
|
-
"dist/"
|
|
32
|
-
"stylesheet.css"
|
|
31
|
+
"dist/"
|
|
33
32
|
],
|
|
34
33
|
"dependencies": {
|
|
35
34
|
"csstype": "^3.2.3"
|