@plumeria/core 3.0.0 → 3.1.0
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 +10 -9
- package/dist/css.js +44 -32
- package/dist/css.mjs +44 -32
- package/package.json +1 -1
package/dist/css.d.ts
CHANGED
|
@@ -61,18 +61,19 @@ type ViewTransition = {
|
|
|
61
61
|
old?: CSSProperties;
|
|
62
62
|
};
|
|
63
63
|
|
|
64
|
-
declare
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
64
|
+
declare function props(...rules: (false | CSSProperties | null | undefined)[]): string;
|
|
65
|
+
declare const css: {
|
|
66
|
+
new (): {};
|
|
67
|
+
create<const T extends Record<string, CSSProperties>>(_rule: CreateStyleType<T>): ReturnType<T>;
|
|
68
|
+
props: typeof props;
|
|
69
|
+
createTheme<const T extends CreateTheme>(_rule: T): ReturnVariableType<T>;
|
|
70
|
+
createStatic<const T extends CreateStatic>(_rule: T): T;
|
|
71
|
+
keyframes(_rule: Keyframes): string;
|
|
72
|
+
viewTransition(_rule: ViewTransition): string;
|
|
73
|
+
};
|
|
72
74
|
declare const x: (className: string, styles: Styles) => {
|
|
73
75
|
className: string;
|
|
74
76
|
styles: Styles;
|
|
75
77
|
};
|
|
76
|
-
declare const css: typeof _css;
|
|
77
78
|
|
|
78
79
|
export { type CSSProperties, type CreateStyle, css, x };
|
package/dist/css.js
CHANGED
|
@@ -1,50 +1,62 @@
|
|
|
1
1
|
|
|
2
2
|
function errorFn(fn) {
|
|
3
|
-
throw new Error(
|
|
4
|
-
}
|
|
5
|
-
function create(_rule) {
|
|
6
|
-
throw errorFn("create");
|
|
3
|
+
throw new Error(`css.${fn} requires bundler-plugin setup`);
|
|
7
4
|
}
|
|
8
5
|
function props(...rules) {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}
|
|
20
|
-
function viewTransition(_rule) {
|
|
21
|
-
throw errorFn("viewTransition");
|
|
22
|
-
}
|
|
23
|
-
var _css = class {
|
|
24
|
-
static create(rule) {
|
|
25
|
-
return create(rule);
|
|
6
|
+
const chosen = new Map();
|
|
7
|
+
const classList = [];
|
|
8
|
+
const orderedKeys = [];
|
|
9
|
+
const rightmostKeys = [];
|
|
10
|
+
for (let i = rules.length - 1; i >= 0; i--) {
|
|
11
|
+
const arg = rules[i];
|
|
12
|
+
if (!arg || typeof arg === "string") continue;
|
|
13
|
+
for (const [key, hash] of Object.entries(arg)) if (!chosen.has(key)) chosen.set(key, {
|
|
14
|
+
hash,
|
|
15
|
+
propsIdx: i
|
|
16
|
+
});
|
|
26
17
|
}
|
|
27
|
-
|
|
28
|
-
|
|
18
|
+
for (let i = 0; i < rules.length; i++) {
|
|
19
|
+
const arg = rules[i];
|
|
20
|
+
if (!arg) continue;
|
|
21
|
+
if (typeof arg === "string") {
|
|
22
|
+
classList.push(arg);
|
|
23
|
+
continue;
|
|
24
|
+
}
|
|
25
|
+
for (const [key] of Object.entries(arg)) {
|
|
26
|
+
const info = chosen.get(key);
|
|
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
|
+
}
|
|
33
|
+
}
|
|
34
|
+
for (const { hash } of orderedKeys) classList.push(hash);
|
|
35
|
+
for (const { hash } of rightmostKeys) classList.push(hash);
|
|
36
|
+
return classList.join(" ");
|
|
37
|
+
}
|
|
38
|
+
const css = class _css {
|
|
39
|
+
static create(_rule) {
|
|
40
|
+
throw errorFn("create");
|
|
29
41
|
}
|
|
30
|
-
static
|
|
31
|
-
|
|
42
|
+
static props = props;
|
|
43
|
+
static createTheme(_rule) {
|
|
44
|
+
throw errorFn("createTheme");
|
|
32
45
|
}
|
|
33
|
-
static createStatic(
|
|
34
|
-
|
|
46
|
+
static createStatic(_rule) {
|
|
47
|
+
throw errorFn("createStatic");
|
|
35
48
|
}
|
|
36
|
-
static keyframes(
|
|
37
|
-
|
|
49
|
+
static keyframes(_rule) {
|
|
50
|
+
throw errorFn("keyframes");
|
|
38
51
|
}
|
|
39
|
-
static viewTransition(
|
|
40
|
-
|
|
52
|
+
static viewTransition(_rule) {
|
|
53
|
+
throw errorFn("viewTransition");
|
|
41
54
|
}
|
|
42
55
|
};
|
|
43
56
|
const x = (className, styles) => ({
|
|
44
57
|
className,
|
|
45
58
|
styles
|
|
46
59
|
});
|
|
47
|
-
const css = _css;
|
|
48
60
|
|
|
49
61
|
exports.css = css;
|
|
50
62
|
exports.x = x;
|
package/dist/css.mjs
CHANGED
|
@@ -1,49 +1,61 @@
|
|
|
1
1
|
|
|
2
2
|
function errorFn(fn) {
|
|
3
|
-
throw new Error(
|
|
4
|
-
}
|
|
5
|
-
function create(_rule) {
|
|
6
|
-
throw errorFn("create");
|
|
3
|
+
throw new Error(`css.${fn} requires bundler-plugin setup`);
|
|
7
4
|
}
|
|
8
5
|
function props(...rules) {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}
|
|
20
|
-
function viewTransition(_rule) {
|
|
21
|
-
throw errorFn("viewTransition");
|
|
22
|
-
}
|
|
23
|
-
var _css = class {
|
|
24
|
-
static create(rule) {
|
|
25
|
-
return create(rule);
|
|
6
|
+
const chosen = new Map();
|
|
7
|
+
const classList = [];
|
|
8
|
+
const orderedKeys = [];
|
|
9
|
+
const rightmostKeys = [];
|
|
10
|
+
for (let i = rules.length - 1; i >= 0; i--) {
|
|
11
|
+
const arg = rules[i];
|
|
12
|
+
if (!arg || typeof arg === "string") continue;
|
|
13
|
+
for (const [key, hash] of Object.entries(arg)) if (!chosen.has(key)) chosen.set(key, {
|
|
14
|
+
hash,
|
|
15
|
+
propsIdx: i
|
|
16
|
+
});
|
|
26
17
|
}
|
|
27
|
-
|
|
28
|
-
|
|
18
|
+
for (let i = 0; i < rules.length; i++) {
|
|
19
|
+
const arg = rules[i];
|
|
20
|
+
if (!arg) continue;
|
|
21
|
+
if (typeof arg === "string") {
|
|
22
|
+
classList.push(arg);
|
|
23
|
+
continue;
|
|
24
|
+
}
|
|
25
|
+
for (const [key] of Object.entries(arg)) {
|
|
26
|
+
const info = chosen.get(key);
|
|
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
|
+
}
|
|
33
|
+
}
|
|
34
|
+
for (const { hash } of orderedKeys) classList.push(hash);
|
|
35
|
+
for (const { hash } of rightmostKeys) classList.push(hash);
|
|
36
|
+
return classList.join(" ");
|
|
37
|
+
}
|
|
38
|
+
const css = class _css {
|
|
39
|
+
static create(_rule) {
|
|
40
|
+
throw errorFn("create");
|
|
29
41
|
}
|
|
30
|
-
static
|
|
31
|
-
|
|
42
|
+
static props = props;
|
|
43
|
+
static createTheme(_rule) {
|
|
44
|
+
throw errorFn("createTheme");
|
|
32
45
|
}
|
|
33
|
-
static createStatic(
|
|
34
|
-
|
|
46
|
+
static createStatic(_rule) {
|
|
47
|
+
throw errorFn("createStatic");
|
|
35
48
|
}
|
|
36
|
-
static keyframes(
|
|
37
|
-
|
|
49
|
+
static keyframes(_rule) {
|
|
50
|
+
throw errorFn("keyframes");
|
|
38
51
|
}
|
|
39
|
-
static viewTransition(
|
|
40
|
-
|
|
52
|
+
static viewTransition(_rule) {
|
|
53
|
+
throw errorFn("viewTransition");
|
|
41
54
|
}
|
|
42
55
|
};
|
|
43
56
|
const x = (className, styles) => ({
|
|
44
57
|
className,
|
|
45
58
|
styles
|
|
46
59
|
});
|
|
47
|
-
const css = _css;
|
|
48
60
|
|
|
49
61
|
export { css, x };
|