@henriquepetrelli/hp-design-system 1.1.18 → 1.1.19

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.
@@ -1427,16 +1427,17 @@
1427
1427
 
1428
1428
  const emit = __emit;
1429
1429
 
1430
- /**
1431
- * 🔑 Fonte única da verdade
1432
- */
1433
- const getInitialTheme = () => localStorage.getItem('theme') === 'dark';
1430
+ const getStoredTheme = () => localStorage.getItem('theme');
1431
+ const isStoredDark = () => getStoredTheme() === 'dark';
1434
1432
 
1435
- const isDarkMode = vue.ref(getInitialTheme());
1433
+ const isDarkMode = vue.ref(isStoredDark());
1436
1434
 
1437
1435
  const applyTheme = (isDark) => {
1438
- document.documentElement.classList.toggle('dark', isDark);
1439
- document.documentElement.classList.toggle('light', !isDark);
1436
+ const root = document.documentElement;
1437
+
1438
+ root.classList.toggle('dark', isDark);
1439
+ root.classList.remove('light'); // light é o default via :root
1440
+
1440
1441
  localStorage.setItem('theme', isDark ? 'dark' : 'light');
1441
1442
  };
1442
1443
 
@@ -1450,12 +1451,10 @@
1450
1451
  toggleTheme();
1451
1452
  };
1452
1453
 
1453
- /**
1454
- * ✅ Sincroniza o toggle com o tema real após F5
1455
- */
1456
1454
  vue.onMounted(() => {
1457
- const isDark = getInitialTheme();
1455
+ const isDark = isStoredDark();
1458
1456
  isDarkMode.value = isDark;
1457
+ applyTheme(isDark);
1459
1458
  emit('update:modelValue', isDark);
1460
1459
  });
1461
1460
 
@@ -1522,7 +1521,7 @@
1522
1521
  }
1523
1522
 
1524
1523
  };
1525
- const ThemeSwitcher = /*#__PURE__*/_export_sfc(_sfc_main$4, [['__scopeId',"data-v-f9bbbf36"]]);
1524
+ const ThemeSwitcher = /*#__PURE__*/_export_sfc(_sfc_main$4, [['__scopeId',"data-v-ed2b100c"]]);
1526
1525
 
1527
1526
  const _hoisted_1$3 = { class: "input__fieldset" };
1528
1527
  const _hoisted_2$3 = {