@plumeria/vite-plugin 6.0.0 → 6.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.
Files changed (2) hide show
  1. package/dist/index.js +11 -19
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -611,18 +611,10 @@ export function plumeria(options = {}) {
611
611
  const table = {};
612
612
  const combinations = 1 << conditionals.length;
613
613
  for (let i = 0; i < combinations; i++) {
614
- let currentClassNames = [];
614
+ let currentStyle = { ...baseStyle };
615
615
  const seenGroups = new Set();
616
616
  let impossible = false;
617
- if (Object.keys(baseStyle).length > 0) {
618
- extractOndemandStyles(baseStyle, extractedSheets, scannedTables);
619
- const hash = genBase36Hash(baseStyle, 1, 8);
620
- const records = getStyleRecords(hash, baseStyle, 2);
621
- records.forEach((r) => extractedSheets.push(r.sheet));
622
- currentClassNames.push(...records.map((r) => r.hash));
623
- }
624
617
  for (let j = 0; j < conditionals.length; j++) {
625
- let targetStyle = {};
626
618
  if ((i >> j) & 1) {
627
619
  if (conditionals[j].groupId !== undefined) {
628
620
  if (seenGroups.has(conditionals[j].groupId)) {
@@ -631,24 +623,24 @@ export function plumeria(options = {}) {
631
623
  }
632
624
  seenGroups.add(conditionals[j].groupId);
633
625
  }
634
- targetStyle = conditionals[j].truthy;
626
+ currentStyle = deepMerge(currentStyle, conditionals[j].truthy);
635
627
  }
636
628
  else {
637
- targetStyle = conditionals[j].falsy;
638
- }
639
- if (Object.keys(targetStyle).length > 0) {
640
- extractOndemandStyles(targetStyle, extractedSheets, scannedTables);
641
- const hash = genBase36Hash(targetStyle, 1, 8);
642
- const records = getStyleRecords(hash, targetStyle, 2);
643
- records.forEach((r) => extractedSheets.push(r.sheet));
644
- currentClassNames.push(...records.map((r) => r.hash));
629
+ currentStyle = deepMerge(currentStyle, conditionals[j].falsy);
645
630
  }
646
631
  }
647
632
  if (impossible) {
648
633
  table[i] = '';
649
634
  continue;
650
635
  }
651
- table[i] = currentClassNames.join(' ');
636
+ extractOndemandStyles(currentStyle, extractedSheets, scannedTables);
637
+ const hash = genBase36Hash(currentStyle, 1, 8);
638
+ const records = getStyleRecords(hash, currentStyle, 2);
639
+ records.forEach((r) => extractedSheets.push(r.sheet));
640
+ const className = records
641
+ .map((r) => r.hash)
642
+ .join(' ');
643
+ table[i] = className;
652
644
  }
653
645
  let indexExpr = '';
654
646
  if (conditionals.length === 0) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plumeria/vite-plugin",
3
- "version": "6.0.0",
3
+ "version": "6.0.1",
4
4
  "type": "module",
5
5
  "description": "Plumeria Vite plugin",
6
6
  "author": "Refirst 11",
@@ -22,7 +22,7 @@
22
22
  "dist/"
23
23
  ],
24
24
  "dependencies": {
25
- "@plumeria/utils": "^6.0.0"
25
+ "@plumeria/utils": "^6.0.1"
26
26
  },
27
27
  "devDependencies": {
28
28
  "@swc/core": "1.15.8",