@plumeria/core 4.1.0 → 4.1.2

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.
Files changed (3) hide show
  1. package/dist/css.js +11 -18
  2. package/dist/css.mjs +11 -18
  3. package/package.json +1 -1
package/dist/css.js CHANGED
@@ -1,28 +1,21 @@
1
1
  function errorFn(fn) {
2
2
  throw new Error(`css.${fn} requires bundler-plugin setup`);
3
3
  }
4
+ const defined = new Set();
4
5
  function props(...rules) {
5
- const chosen = new Map();
6
- const lastIdx = rules.length - 1;
7
- for (let i = lastIdx; i >= 0; i--) {
6
+ defined.clear();
7
+ let result = "";
8
+ for (let i = rules.length - 1; i >= 0; i--) {
8
9
  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;
10
+ if (!arg || typeof arg !== "object") continue;
11
+ let chunk = "";
12
+ for (const key in arg) if (arg[key] && !defined.has(key)) {
13
+ defined.add(key);
14
+ chunk += chunk ? " " + arg[key] : arg[key];
20
15
  }
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]);
16
+ if (chunk) result = result ? chunk + " " + result : chunk;
23
17
  }
24
- for (const hash of rightmostList) classList.push(hash);
25
- return classList.join(" ");
18
+ return result;
26
19
  }
27
20
  const css = class _css {
28
21
  static create(_rule) {
package/dist/css.mjs CHANGED
@@ -1,28 +1,21 @@
1
1
  function errorFn(fn) {
2
2
  throw new Error(`css.${fn} requires bundler-plugin setup`);
3
3
  }
4
+ const defined = new Set();
4
5
  function props(...rules) {
5
- const chosen = new Map();
6
- const lastIdx = rules.length - 1;
7
- for (let i = lastIdx; i >= 0; i--) {
6
+ defined.clear();
7
+ let result = "";
8
+ for (let i = rules.length - 1; i >= 0; i--) {
8
9
  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;
10
+ if (!arg || typeof arg !== "object") continue;
11
+ let chunk = "";
12
+ for (const key in arg) if (arg[key] && !defined.has(key)) {
13
+ defined.add(key);
14
+ chunk += chunk ? " " + arg[key] : arg[key];
20
15
  }
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]);
16
+ if (chunk) result = result ? chunk + " " + result : chunk;
23
17
  }
24
- for (const hash of rightmostList) classList.push(hash);
25
- return classList.join(" ");
18
+ return result;
26
19
  }
27
20
  const css = class _css {
28
21
  static create(_rule) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plumeria/core",
3
- "version": "4.1.0",
3
+ "version": "4.1.2",
4
4
  "description": "An atomic CSS runtime designed to disappear.",
5
5
  "author": "Refirst 11",
6
6
  "license": "MIT",