@henriquepetrelli/hp-design-system 1.1.17 → 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,17 +1427,23 @@
|
|
|
1427
1427
|
|
|
1428
1428
|
const emit = __emit;
|
|
1429
1429
|
|
|
1430
|
-
const
|
|
1430
|
+
const getStoredTheme = () => localStorage.getItem('theme');
|
|
1431
|
+
const isStoredDark = () => getStoredTheme() === 'dark';
|
|
1432
|
+
|
|
1433
|
+
const isDarkMode = vue.ref(isStoredDark());
|
|
1431
1434
|
|
|
1432
1435
|
const applyTheme = (isDark) => {
|
|
1433
|
-
const
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
+
const root = document.documentElement;
|
|
1437
|
+
|
|
1438
|
+
root.classList.toggle('dark', isDark);
|
|
1439
|
+
root.classList.remove('light'); // light é o default via :root
|
|
1440
|
+
|
|
1441
|
+
localStorage.setItem('theme', isDark ? 'dark' : 'light');
|
|
1436
1442
|
};
|
|
1437
1443
|
|
|
1438
1444
|
const toggleTheme = () => {
|
|
1439
|
-
emit('update:modelValue', isDarkMode.value);
|
|
1440
1445
|
applyTheme(isDarkMode.value);
|
|
1446
|
+
emit('update:modelValue', isDarkMode.value);
|
|
1441
1447
|
};
|
|
1442
1448
|
|
|
1443
1449
|
const handleKeydown = () => {
|
|
@@ -1446,16 +1452,20 @@
|
|
|
1446
1452
|
};
|
|
1447
1453
|
|
|
1448
1454
|
vue.onMounted(() => {
|
|
1449
|
-
|
|
1455
|
+
const isDark = isStoredDark();
|
|
1456
|
+
isDarkMode.value = isDark;
|
|
1457
|
+
applyTheme(isDark);
|
|
1458
|
+
emit('update:modelValue', isDark);
|
|
1450
1459
|
});
|
|
1451
1460
|
|
|
1452
1461
|
vue.watch(
|
|
1453
1462
|
() => props.modelValue,
|
|
1454
1463
|
(value) => {
|
|
1455
|
-
isDarkMode.value
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1464
|
+
if (value !== isDarkMode.value) {
|
|
1465
|
+
isDarkMode.value = value;
|
|
1466
|
+
applyTheme(value);
|
|
1467
|
+
}
|
|
1468
|
+
}
|
|
1459
1469
|
);
|
|
1460
1470
|
|
|
1461
1471
|
const computedLightBorderColor = vue.computed(
|
|
@@ -1511,7 +1521,7 @@
|
|
|
1511
1521
|
}
|
|
1512
1522
|
|
|
1513
1523
|
};
|
|
1514
|
-
const ThemeSwitcher = /*#__PURE__*/_export_sfc(_sfc_main$4, [['__scopeId',"data-v-
|
|
1524
|
+
const ThemeSwitcher = /*#__PURE__*/_export_sfc(_sfc_main$4, [['__scopeId',"data-v-ed2b100c"]]);
|
|
1515
1525
|
|
|
1516
1526
|
const _hoisted_1$3 = { class: "input__fieldset" };
|
|
1517
1527
|
const _hoisted_2$3 = {
|