fermmap-shared 0.1.6 → 0.1.7

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.
package/dist/module.mjs CHANGED
@@ -2526,6 +2526,7 @@ function $db470a4073e4639a$export$f5c9f3c2c4054eec({ label: label, error: error,
2526
2526
  const textareaRef = (0, $3A86U$useRef)(null);
2527
2527
  // Auto-grow on value change
2528
2528
  (0, $3A86U$useEffect)(()=>{
2529
+ if (typeof window === 'undefined') return;
2529
2530
  const textarea = textareaRef.current;
2530
2531
  if (!textarea) return;
2531
2532
  // Reset height to recalculate
@@ -2579,14 +2580,19 @@ const $14dac782240849bf$var$THEME_STORAGE_KEY = 'fermmap-theme';
2579
2580
  // Get initial theme synchronously to prevent flicker
2580
2581
  function $14dac782240849bf$var$getInitialTheme() {
2581
2582
  if (typeof window === 'undefined') return 'light';
2582
- // First check if blocking script already set the attribute
2583
- const htmlAttribute = document.documentElement.getAttribute('data-color-scheme');
2584
- if (htmlAttribute && (htmlAttribute === 'light' || htmlAttribute === 'dark')) return htmlAttribute;
2585
- // Fallback to localStorage
2586
- const stored = localStorage.getItem($14dac782240849bf$var$THEME_STORAGE_KEY);
2587
- if (stored && (stored === 'light' || stored === 'dark')) return stored;
2588
- // Final fallback to system preference
2589
- return window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';
2583
+ try {
2584
+ // First check if blocking script already set the attribute
2585
+ const htmlAttribute = document.documentElement.getAttribute('data-color-scheme');
2586
+ if (htmlAttribute && (htmlAttribute === 'light' || htmlAttribute === 'dark')) return htmlAttribute;
2587
+ // Fallback to localStorage
2588
+ const stored = localStorage.getItem($14dac782240849bf$var$THEME_STORAGE_KEY);
2589
+ if (stored && (stored === 'light' || stored === 'dark')) return stored;
2590
+ // Final fallback to system preference
2591
+ return window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';
2592
+ } catch {
2593
+ // Fallback if any browser API fails
2594
+ return 'light';
2595
+ }
2590
2596
  }
2591
2597
  function $14dac782240849bf$export$d8964aec282183a3({ children: children }) {
2592
2598
  // Initialize with a function to avoid SSR issues