@plumeria/core 4.0.5 → 4.1.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/dist/css.d.ts CHANGED
@@ -76,4 +76,4 @@ declare const x: (className: string, style: Style) => {
76
76
  style: Style;
77
77
  };
78
78
 
79
- export { type CSSProperties, type CreateStyle, css, x };
79
+ export { type CSSProperties, type CreateStyle, css, x };
package/dist/css.js CHANGED
@@ -2,27 +2,19 @@ function errorFn(fn) {
2
2
  throw new Error(`css.${fn} requires bundler-plugin setup`);
3
3
  }
4
4
  function props(...rules) {
5
- const chosen = new Map();
6
- const lastIdx = rules.length - 1;
7
- for (let i = lastIdx; i >= 0; i--) {
5
+ const defined = [];
6
+ let result = "";
7
+ for (let i = rules.length - 1; i >= 0; i--) {
8
8
  const arg = rules[i];
9
- if (!arg || typeof arg === "string") continue;
10
- for (const key in arg) if (!chosen.has(key)) chosen.set(key, i);
11
- }
12
- const classList = [];
13
- const rightmostList = [];
14
- for (let i = 0; i <= lastIdx; i++) {
15
- const arg = rules[i];
16
- if (!arg) continue;
17
- if (typeof arg === "string") {
18
- classList.push(arg);
19
- continue;
9
+ if (!arg || typeof arg !== "object") continue;
10
+ let chunk = "";
11
+ for (const key in arg) if (arg[key] && !defined.includes(key)) {
12
+ defined.push(key);
13
+ chunk += chunk ? " " + arg[key] : arg[key];
20
14
  }
21
- for (const key in arg) if (chosen.get(key) === i && arg[key]) if (i === lastIdx) rightmostList.push(arg[key]);
22
- else classList.push(arg[key]);
15
+ if (chunk) result = result ? chunk + " " + result : chunk;
23
16
  }
24
- for (const hash of rightmostList) classList.push(hash);
25
- return classList.join(" ");
17
+ return result;
26
18
  }
27
19
  const css = class _css {
28
20
  static create(_rule) {
@@ -48,4 +40,4 @@ const x = (className, style) => ({
48
40
  });
49
41
 
50
42
  exports.css = css;
51
- exports.x = x;
43
+ exports.x = x;
package/dist/css.mjs CHANGED
@@ -2,27 +2,19 @@ function errorFn(fn) {
2
2
  throw new Error(`css.${fn} requires bundler-plugin setup`);
3
3
  }
4
4
  function props(...rules) {
5
- const chosen = new Map();
6
- const lastIdx = rules.length - 1;
7
- for (let i = lastIdx; i >= 0; i--) {
5
+ const defined = [];
6
+ let result = "";
7
+ for (let i = rules.length - 1; i >= 0; i--) {
8
8
  const arg = rules[i];
9
- if (!arg || typeof arg === "string") continue;
10
- for (const key in arg) if (!chosen.has(key)) chosen.set(key, i);
11
- }
12
- const classList = [];
13
- const rightmostList = [];
14
- for (let i = 0; i <= lastIdx; i++) {
15
- const arg = rules[i];
16
- if (!arg) continue;
17
- if (typeof arg === "string") {
18
- classList.push(arg);
19
- continue;
9
+ if (!arg || typeof arg !== "object") continue;
10
+ let chunk = "";
11
+ for (const key in arg) if (arg[key] && !defined.includes(key)) {
12
+ defined.push(key);
13
+ chunk += chunk ? " " + arg[key] : arg[key];
20
14
  }
21
- for (const key in arg) if (chosen.get(key) === i && arg[key]) if (i === lastIdx) rightmostList.push(arg[key]);
22
- else classList.push(arg[key]);
15
+ if (chunk) result = result ? chunk + " " + result : chunk;
23
16
  }
24
- for (const hash of rightmostList) classList.push(hash);
25
- return classList.join(" ");
17
+ return result;
26
18
  }
27
19
  const css = class _css {
28
20
  static create(_rule) {
@@ -47,4 +39,4 @@ const x = (className, style) => ({
47
39
  style
48
40
  });
49
41
 
50
- export { css, x };
42
+ export { css, x };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plumeria/core",
3
- "version": "4.0.5",
3
+ "version": "4.1.1",
4
4
  "description": "An atomic CSS runtime designed to disappear.",
5
5
  "author": "Refirst 11",
6
6
  "license": "MIT",