@henriquepetrelli/hp-design-system 1.1.18 → 1.1.20

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,17 +1427,16 @@
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') || 'light';
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);
1440
- localStorage.setItem('theme', isDark ? 'dark' : 'light');
1436
+ const theme = isDark ? 'dark' : 'light';
1437
+
1438
+ document.documentElement.setAttribute('data-theme', theme);
1439
+ localStorage.setItem('theme', theme);
1441
1440
  };
1442
1441
 
1443
1442
  const toggleTheme = () => {
@@ -1450,12 +1449,10 @@
1450
1449
  toggleTheme();
1451
1450
  };
1452
1451
 
1453
- /**
1454
- * ✅ Sincroniza o toggle com o tema real após F5
1455
- */
1456
1452
  vue.onMounted(() => {
1457
- const isDark = getInitialTheme();
1453
+ const isDark = isStoredDark();
1458
1454
  isDarkMode.value = isDark;
1455
+ applyTheme(isDark);
1459
1456
  emit('update:modelValue', isDark);
1460
1457
  });
1461
1458
 
@@ -1522,7 +1519,7 @@
1522
1519
  }
1523
1520
 
1524
1521
  };
1525
- const ThemeSwitcher = /*#__PURE__*/_export_sfc(_sfc_main$4, [['__scopeId',"data-v-f9bbbf36"]]);
1522
+ const ThemeSwitcher = /*#__PURE__*/_export_sfc(_sfc_main$4, [['__scopeId',"data-v-f2c78aa3"]]);
1526
1523
 
1527
1524
  const _hoisted_1$3 = { class: "input__fieldset" };
1528
1525
  const _hoisted_2$3 = {