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