@plumeria/core 2.0.0 → 2.0.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/index.js CHANGED
@@ -11,36 +11,36 @@ function create(object) {
11
11
  const finalFlat = (0, zss_engine.overrideLonghand)(flat);
12
12
  const records = [];
13
13
  Object.entries(finalFlat).forEach(([prop, value]) => {
14
- const hashes = new Set();
15
- const sheets = new Set();
16
- (0, zss_engine.processAtomicProps)({ [prop]: value }, hashes, sheets);
17
- const hashArray = [...hashes];
18
- const sheetArray = [...sheets];
19
- const baseSheetParts = [];
20
- const baseHashParts = [];
21
- const querySheetParts = [];
22
- const queryHashParts = [];
23
- for (let i = 0; i < sheetArray.length; i++) {
24
- const sheet = sheetArray[i];
25
- const hash = hashArray[i];
26
- if (sheet.includes("@media") || sheet.includes("@container")) {
14
+ if ((prop.startsWith("@media") || prop.startsWith("@container")) && typeof value === "object" && value !== null) Object.entries(value).forEach(([innerProp, innerValue]) => {
15
+ const atomicMap = new Map();
16
+ (0, zss_engine.processAtomicProps)({ [innerProp]: innerValue }, atomicMap, prop);
17
+ const querySheetParts = [];
18
+ const queryHashParts = [];
19
+ for (const [hash, sheet] of atomicMap) {
27
20
  querySheetParts.push(sheet.replace(`.${hash}`, `.${hash}:not(#\\#)`));
28
21
  queryHashParts.push(hash);
29
- } else {
22
+ }
23
+ if (querySheetParts.length > 0) records.push({
24
+ key: prop + innerProp,
25
+ hash: queryHashParts.join(" "),
26
+ sheet: querySheetParts.join("")
27
+ });
28
+ });
29
+ else {
30
+ const atomicMap = new Map();
31
+ (0, zss_engine.processAtomicProps)({ [prop]: value }, atomicMap);
32
+ const baseSheetParts = [];
33
+ const baseHashParts = [];
34
+ for (const [hash, sheet] of atomicMap) {
30
35
  baseSheetParts.push(sheet);
31
36
  baseHashParts.push(hash);
32
37
  }
38
+ if (baseSheetParts.length > 0) records.push({
39
+ key: prop,
40
+ hash: baseHashParts.join(" "),
41
+ sheet: baseSheetParts.join("")
42
+ });
33
43
  }
34
- if (baseSheetParts.length > 0) records.push({
35
- key: prop,
36
- hash: baseHashParts.join(" "),
37
- sheet: baseSheetParts.join("")
38
- });
39
- if (querySheetParts.length > 0) records.push({
40
- key: prop + "__queries__",
41
- hash: queryHashParts.join(" "),
42
- sheet: querySheetParts.join("")
43
- });
44
44
  });
45
45
  if (Object.keys(nonFlat).length > 0) {
46
46
  const nonFlatBase = {};
package/dist/index.mjs CHANGED
@@ -11,36 +11,36 @@ function create(object) {
11
11
  const finalFlat = overrideLonghand(flat);
12
12
  const records = [];
13
13
  Object.entries(finalFlat).forEach(([prop, value]) => {
14
- const hashes = new Set();
15
- const sheets = new Set();
16
- processAtomicProps({ [prop]: value }, hashes, sheets);
17
- const hashArray = [...hashes];
18
- const sheetArray = [...sheets];
19
- const baseSheetParts = [];
20
- const baseHashParts = [];
21
- const querySheetParts = [];
22
- const queryHashParts = [];
23
- for (let i = 0; i < sheetArray.length; i++) {
24
- const sheet = sheetArray[i];
25
- const hash = hashArray[i];
26
- if (sheet.includes("@media") || sheet.includes("@container")) {
14
+ if ((prop.startsWith("@media") || prop.startsWith("@container")) && typeof value === "object" && value !== null) Object.entries(value).forEach(([innerProp, innerValue]) => {
15
+ const atomicMap = new Map();
16
+ processAtomicProps({ [innerProp]: innerValue }, atomicMap, prop);
17
+ const querySheetParts = [];
18
+ const queryHashParts = [];
19
+ for (const [hash, sheet] of atomicMap) {
27
20
  querySheetParts.push(sheet.replace(`.${hash}`, `.${hash}:not(#\\#)`));
28
21
  queryHashParts.push(hash);
29
- } else {
22
+ }
23
+ if (querySheetParts.length > 0) records.push({
24
+ key: prop + innerProp,
25
+ hash: queryHashParts.join(" "),
26
+ sheet: querySheetParts.join("")
27
+ });
28
+ });
29
+ else {
30
+ const atomicMap = new Map();
31
+ processAtomicProps({ [prop]: value }, atomicMap);
32
+ const baseSheetParts = [];
33
+ const baseHashParts = [];
34
+ for (const [hash, sheet] of atomicMap) {
30
35
  baseSheetParts.push(sheet);
31
36
  baseHashParts.push(hash);
32
37
  }
38
+ if (baseSheetParts.length > 0) records.push({
39
+ key: prop,
40
+ hash: baseHashParts.join(" "),
41
+ sheet: baseSheetParts.join("")
42
+ });
33
43
  }
34
- if (baseSheetParts.length > 0) records.push({
35
- key: prop,
36
- hash: baseHashParts.join(" "),
37
- sheet: baseSheetParts.join("")
38
- });
39
- if (querySheetParts.length > 0) records.push({
40
- key: prop + "__queries__",
41
- hash: queryHashParts.join(" "),
42
- sheet: querySheetParts.join("")
43
- });
44
44
  });
45
45
  if (Object.keys(nonFlat).length > 0) {
46
46
  const nonFlatBase = {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plumeria/core",
3
- "version": "2.0.0",
3
+ "version": "2.0.1",
4
4
  "description": "The atomic on-demand CSS-in-JS.",
5
5
  "author": "Refirst 11",
6
6
  "license": "MIT",
@@ -45,7 +45,7 @@
45
45
  "stylesheet.css"
46
46
  ],
47
47
  "dependencies": {
48
- "zss-engine": "1.1.0"
48
+ "zss-engine": "1.2.0"
49
49
  },
50
50
  "publishConfig": {
51
51
  "access": "public",