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