@henriquepetrelli/hp-design-system 1.1.17 → 1.1.18
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,22 @@ const props = __props;
|
|
|
1423
1423
|
|
|
1424
1424
|
const emit = __emit;
|
|
1425
1425
|
|
|
1426
|
-
|
|
1426
|
+
/**
|
|
1427
|
+
* 🔑 Fonte única da verdade
|
|
1428
|
+
*/
|
|
1429
|
+
const getInitialTheme = () => localStorage.getItem('theme') === 'dark';
|
|
1430
|
+
|
|
1431
|
+
const isDarkMode = ref(getInitialTheme());
|
|
1427
1432
|
|
|
1428
1433
|
const applyTheme = (isDark) => {
|
|
1429
|
-
|
|
1430
|
-
document.documentElement.
|
|
1431
|
-
localStorage.setItem('theme',
|
|
1434
|
+
document.documentElement.classList.toggle('dark', isDark);
|
|
1435
|
+
document.documentElement.classList.toggle('light', !isDark);
|
|
1436
|
+
localStorage.setItem('theme', isDark ? 'dark' : 'light');
|
|
1432
1437
|
};
|
|
1433
1438
|
|
|
1434
1439
|
const toggleTheme = () => {
|
|
1435
|
-
emit('update:modelValue', isDarkMode.value);
|
|
1436
1440
|
applyTheme(isDarkMode.value);
|
|
1441
|
+
emit('update:modelValue', isDarkMode.value);
|
|
1437
1442
|
};
|
|
1438
1443
|
|
|
1439
1444
|
const handleKeydown = () => {
|
|
@@ -1441,17 +1446,23 @@ const handleKeydown = () => {
|
|
|
1441
1446
|
toggleTheme();
|
|
1442
1447
|
};
|
|
1443
1448
|
|
|
1449
|
+
/**
|
|
1450
|
+
* ✅ Sincroniza o toggle com o tema real após F5
|
|
1451
|
+
*/
|
|
1444
1452
|
onMounted(() => {
|
|
1445
|
-
|
|
1453
|
+
const isDark = getInitialTheme();
|
|
1454
|
+
isDarkMode.value = isDark;
|
|
1455
|
+
emit('update:modelValue', isDark);
|
|
1446
1456
|
});
|
|
1447
1457
|
|
|
1448
1458
|
watch(
|
|
1449
1459
|
() => props.modelValue,
|
|
1450
1460
|
(value) => {
|
|
1451
|
-
isDarkMode.value
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1461
|
+
if (value !== isDarkMode.value) {
|
|
1462
|
+
isDarkMode.value = value;
|
|
1463
|
+
applyTheme(value);
|
|
1464
|
+
}
|
|
1465
|
+
}
|
|
1455
1466
|
);
|
|
1456
1467
|
|
|
1457
1468
|
const computedLightBorderColor = computed(
|
|
@@ -1507,7 +1518,7 @@ return (_ctx, _cache) => {
|
|
|
1507
1518
|
}
|
|
1508
1519
|
|
|
1509
1520
|
};
|
|
1510
|
-
const ThemeSwitcher = /*#__PURE__*/_export_sfc(_sfc_main$4, [['__scopeId',"data-v-
|
|
1521
|
+
const ThemeSwitcher = /*#__PURE__*/_export_sfc(_sfc_main$4, [['__scopeId',"data-v-f9bbbf36"]]);
|
|
1511
1522
|
|
|
1512
1523
|
const _hoisted_1$3 = { class: "input__fieldset" };
|
|
1513
1524
|
const _hoisted_2$3 = {
|