fermmap-shared 0.1.7 → 0.1.9

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
@@ -2482,6 +2482,49 @@ function $e00b7714d9bed1e1$export$3d96ec278d3efce4({ children: children, ...prop
2482
2482
 
2483
2483
 
2484
2484
 
2485
+ /**
2486
+ * Safe browser API wrappers that work in SSR
2487
+ */ const $de0c62f65c50224a$export$4e09c449d6c407f7 = typeof window !== 'undefined';
2488
+ const $de0c62f65c50224a$export$7dd80fbc14cd23b1 = {
2489
+ get innerHeight () {
2490
+ return $de0c62f65c50224a$export$4e09c449d6c407f7 ? window.innerHeight : 0;
2491
+ },
2492
+ matchMedia: (query)=>{
2493
+ if (!$de0c62f65c50224a$export$4e09c449d6c407f7) return {
2494
+ matches: false,
2495
+ media: query,
2496
+ addEventListener: ()=>{},
2497
+ removeEventListener: ()=>{}
2498
+ };
2499
+ return window.matchMedia(query);
2500
+ }
2501
+ };
2502
+ const $de0c62f65c50224a$export$9aee702616bdf23c = {
2503
+ get documentElement () {
2504
+ if (!$de0c62f65c50224a$export$4e09c449d6c407f7) return null;
2505
+ return document.documentElement;
2506
+ }
2507
+ };
2508
+ const $de0c62f65c50224a$export$2aa78e70b3d79ddc = {
2509
+ getItem: (key)=>{
2510
+ if (!$de0c62f65c50224a$export$4e09c449d6c407f7) return null;
2511
+ try {
2512
+ return localStorage.getItem(key);
2513
+ } catch {
2514
+ return null;
2515
+ }
2516
+ },
2517
+ setItem: (key, value)=>{
2518
+ if (!$de0c62f65c50224a$export$4e09c449d6c407f7) return;
2519
+ try {
2520
+ localStorage.setItem(key, value);
2521
+ } catch {
2522
+ // Silent fail
2523
+ }
2524
+ }
2525
+ };
2526
+
2527
+
2485
2528
 
2486
2529
  const $fad215bb6064e329$var$textareaStyles = function anonymous(props) {
2487
2530
  let rules = " ";
@@ -2530,13 +2573,12 @@ function $fad215bb6064e329$export$f5c9f3c2c4054eec({ label: label, error: error,
2530
2573
  const textareaRef = (0, $fs04y$react.useRef)(null);
2531
2574
  // Auto-grow on value change
2532
2575
  (0, $fs04y$react.useEffect)(()=>{
2533
- if (typeof window === 'undefined') return;
2534
2576
  const textarea = textareaRef.current;
2535
2577
  if (!textarea) return;
2536
2578
  // Reset height to recalculate
2537
2579
  textarea.style.height = '75px';
2538
2580
  // Set to scrollHeight (content height)
2539
- const newHeight = Math.min(textarea.scrollHeight, window.innerHeight * 0.75);
2581
+ const newHeight = Math.min(textarea.scrollHeight, (0, $de0c62f65c50224a$export$7dd80fbc14cd23b1).innerHeight * 0.75);
2540
2582
  textarea.style.height = `${newHeight}px`;
2541
2583
  }, [
2542
2584
  value
@@ -2579,29 +2621,28 @@ $parcel$export($885bdde2b07b7632$exports, "AxeDevTools", () => $ac6c22366fad60ff
2579
2621
  // Contexts & Providers
2580
2622
 
2581
2623
 
2624
+
2582
2625
  const $3a1d0d18027ba81c$var$ThemeContext = /*#__PURE__*/ (0, $fs04y$react.createContext)(undefined);
2583
2626
  const $3a1d0d18027ba81c$var$THEME_STORAGE_KEY = 'fermmap-theme';
2584
2627
  // Get initial theme synchronously to prevent flicker
2585
2628
  function $3a1d0d18027ba81c$var$getInitialTheme() {
2586
- if (typeof window === 'undefined') return 'light';
2587
- try {
2588
- // First check if blocking script already set the attribute
2589
- const htmlAttribute = document.documentElement.getAttribute('data-color-scheme');
2629
+ if (!(0, $de0c62f65c50224a$export$4e09c449d6c407f7)) return 'light';
2630
+ // First check if blocking script already set the attribute
2631
+ const htmlElement = (0, $de0c62f65c50224a$export$9aee702616bdf23c).documentElement;
2632
+ if (htmlElement) {
2633
+ const htmlAttribute = htmlElement.getAttribute('data-color-scheme');
2590
2634
  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
2635
  }
2636
+ // Fallback to localStorage
2637
+ const stored = (0, $de0c62f65c50224a$export$2aa78e70b3d79ddc).getItem($3a1d0d18027ba81c$var$THEME_STORAGE_KEY);
2638
+ if (stored && (stored === 'light' || stored === 'dark')) return stored;
2639
+ // Final fallback to system preference
2640
+ return (0, $de0c62f65c50224a$export$7dd80fbc14cd23b1).matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';
2600
2641
  }
2601
2642
  function $3a1d0d18027ba81c$export$d8964aec282183a3({ children: children }) {
2602
2643
  // Initialize with a function to avoid SSR issues
2603
2644
  const [colorScheme, setColorScheme] = (0, $fs04y$react.useState)(()=>{
2604
- if (typeof window === 'undefined') return 'light';
2645
+ if (!(0, $de0c62f65c50224a$export$4e09c449d6c407f7)) return 'light';
2605
2646
  return $3a1d0d18027ba81c$var$getInitialTheme();
2606
2647
  });
2607
2648
  const [mounted, setMounted] = (0, $fs04y$react.useState)(false);
@@ -2614,9 +2655,10 @@ function $3a1d0d18027ba81c$export$d8964aec282183a3({ children: children }) {
2614
2655
  }, []);
2615
2656
  // Update html attribute and localStorage when scheme changes
2616
2657
  (0, $fs04y$react.useEffect)(()=>{
2617
- if (!mounted) return;
2618
- document.documentElement.setAttribute('data-color-scheme', colorScheme);
2619
- localStorage.setItem($3a1d0d18027ba81c$var$THEME_STORAGE_KEY, colorScheme);
2658
+ if (!mounted || !(0, $de0c62f65c50224a$export$4e09c449d6c407f7)) return;
2659
+ const htmlElement = (0, $de0c62f65c50224a$export$9aee702616bdf23c).documentElement;
2660
+ if (htmlElement) htmlElement.setAttribute('data-color-scheme', colorScheme);
2661
+ (0, $de0c62f65c50224a$export$2aa78e70b3d79ddc).setItem($3a1d0d18027ba81c$var$THEME_STORAGE_KEY, colorScheme);
2620
2662
  }, [
2621
2663
  colorScheme,
2622
2664
  mounted
@@ -2742,6 +2784,10 @@ var $0911ce1d49060a15$exports = {};
2742
2784
  $parcel$export($0911ce1d49060a15$exports, "textFieldInputStyles", () => $53c8911eec26a318$export$457d6d213bf79459);
2743
2785
  $parcel$export($0911ce1d49060a15$exports, "getCategoryColors", () => $9df03defd63c82e0$export$2514cbae0d5c71c5);
2744
2786
  $parcel$export($0911ce1d49060a15$exports, "api", () => $ace12160cbee4ea7$export$644d8ea042df96a6);
2787
+ $parcel$export($0911ce1d49060a15$exports, "isBrowser", () => $de0c62f65c50224a$export$4e09c449d6c407f7);
2788
+ $parcel$export($0911ce1d49060a15$exports, "safeWindow", () => $de0c62f65c50224a$export$7dd80fbc14cd23b1);
2789
+ $parcel$export($0911ce1d49060a15$exports, "safeDocument", () => $de0c62f65c50224a$export$9aee702616bdf23c);
2790
+ $parcel$export($0911ce1d49060a15$exports, "safeLocalStorage", () => $de0c62f65c50224a$export$2aa78e70b3d79ddc);
2745
2791
  // Utilities
2746
2792
  const $53c8911eec26a318$export$457d6d213bf79459 = ()=>({
2747
2793
  padding: 12,
@@ -2879,6 +2925,7 @@ const $53c8911eec26a318$export$457d6d213bf79459 = ()=>({
2879
2925
 
2880
2926
 
2881
2927
 
2928
+
2882
2929
  var $fef1a353edd33d81$exports = {};
2883
2930
  var $26e22b40e52bb1d8$exports = {};
2884
2931