@henriquepetrelli/hp-design-system 1.1.14 → 1.1.16

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,12 +1427,19 @@
1427
1427
 
1428
1428
  const emit = __emit;
1429
1429
 
1430
- const isDarkMode = vue.ref(false);
1430
+ const isDarkMode = vue.ref(
1431
+ typeof window !== 'undefined' && localStorage.getItem('theme') === 'dark'
1432
+ );
1431
1433
 
1432
1434
  const applyTheme = (isDark) => {
1433
- document.documentElement.classList.toggle('dark', isDark);
1434
- document.documentElement.classList.toggle('light', !isDark);
1435
- localStorage.setItem('theme', isDark ? 'dark' : 'light');
1435
+ if (typeof document === 'undefined') return
1436
+
1437
+ const theme = isDark ? 'dark' : 'light';
1438
+
1439
+ document.documentElement.classList.remove('dark', 'light');
1440
+ document.documentElement.classList.add(theme);
1441
+
1442
+ localStorage.setItem('theme', theme);
1436
1443
  };
1437
1444
 
1438
1445
  const toggleTheme = () => {
@@ -1445,17 +1452,6 @@
1445
1452
  toggleTheme();
1446
1453
  };
1447
1454
 
1448
- vue.onMounted(() => {
1449
- const savedTheme =
1450
- localStorage.getItem('theme') ||
1451
- (window.matchMedia('(prefers-color-scheme: dark)').matches
1452
- ? 'dark'
1453
- : 'light');
1454
-
1455
- isDarkMode.value = savedTheme === 'dark';
1456
- applyTheme(isDarkMode.value);
1457
- });
1458
-
1459
1455
  vue.watch(
1460
1456
  () => props.modelValue,
1461
1457
  (value) => {
@@ -1518,7 +1514,7 @@
1518
1514
  }
1519
1515
 
1520
1516
  };
1521
- const ThemeSwitcher = /*#__PURE__*/_export_sfc(_sfc_main$4, [['__scopeId',"data-v-699fb0fe"]]);
1517
+ const ThemeSwitcher = /*#__PURE__*/_export_sfc(_sfc_main$4, [['__scopeId',"data-v-ba2225dd"]]);
1522
1518
 
1523
1519
  const _hoisted_1$3 = { class: "input__fieldset" };
1524
1520
  const _hoisted_2$3 = {