@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.
@@ -1423,16 +1423,17 @@ const props = __props;
1423
1423
 
1424
1424
  const emit = __emit;
1425
1425
 
1426
- /**
1427
- * 🔑 Fonte única da verdade
1428
- */
1429
- const getInitialTheme = () => localStorage.getItem('theme') === 'dark';
1426
+ const getStoredTheme = () => localStorage.getItem('theme');
1427
+ const isStoredDark = () => getStoredTheme() === 'dark';
1430
1428
 
1431
- const isDarkMode = ref(getInitialTheme());
1429
+ const isDarkMode = ref(isStoredDark());
1432
1430
 
1433
1431
  const applyTheme = (isDark) => {
1434
- document.documentElement.classList.toggle('dark', isDark);
1435
- document.documentElement.classList.toggle('light', !isDark);
1432
+ const root = document.documentElement;
1433
+
1434
+ root.classList.toggle('dark', isDark);
1435
+ root.classList.remove('light'); // light é o default via :root
1436
+
1436
1437
  localStorage.setItem('theme', isDark ? 'dark' : 'light');
1437
1438
  };
1438
1439
 
@@ -1446,12 +1447,10 @@ const handleKeydown = () => {
1446
1447
  toggleTheme();
1447
1448
  };
1448
1449
 
1449
- /**
1450
- * ✅ Sincroniza o toggle com o tema real após F5
1451
- */
1452
1450
  onMounted(() => {
1453
- const isDark = getInitialTheme();
1451
+ const isDark = isStoredDark();
1454
1452
  isDarkMode.value = isDark;
1453
+ applyTheme(isDark);
1455
1454
  emit('update:modelValue', isDark);
1456
1455
  });
1457
1456
 
@@ -1518,7 +1517,7 @@ return (_ctx, _cache) => {
1518
1517
  }
1519
1518
 
1520
1519
  };
1521
- const ThemeSwitcher = /*#__PURE__*/_export_sfc(_sfc_main$4, [['__scopeId',"data-v-f9bbbf36"]]);
1520
+ const ThemeSwitcher = /*#__PURE__*/_export_sfc(_sfc_main$4, [['__scopeId',"data-v-ed2b100c"]]);
1522
1521
 
1523
1522
  const _hoisted_1$3 = { class: "input__fieldset" };
1524
1523
  const _hoisted_2$3 = {