@hanzo/ui 5.0.1 → 5.0.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hanzo/ui",
3
- "version": "5.0.1",
3
+ "version": "5.0.2",
4
4
  "description": "Multi-framework UI library with React, Vue, Svelte, and React Native support. Based on shadcn/ui with comprehensive framework coverage.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/",
@@ -4,7 +4,6 @@ import { RotateCcw, Download } from 'lucide-react';
4
4
  import mermaid from 'mermaid';
5
5
  import { FC, useEffect, useRef, useState, useCallback } from 'react';
6
6
  import { toast } from 'sonner';
7
- import svgPanZoom from 'svg-pan-zoom';
8
7
  import { cn } from '../src/utils';
9
8
  import { Button } from './button';
10
9
  import { SyntaxHighlighterProps } from './markdown-preview';
@@ -115,13 +114,19 @@ export const MermaidDiagram: FC<MermaidDiagramProps> = ({
115
114
  svgElement.style.top = '0';
116
115
  svgElement.style.left = '0';
117
116
 
118
- const panZoomInstance = svgPanZoom(svgElement);
119
- panZoomInstance.fit();
120
- panZoomInstance.center();
121
- panZoomInstance.zoomAtPoint(1, { x: 0, y: 0 });
122
- panZoomInstance.disablePan();
123
- panZoomInstance.disableZoom();
124
- setInstance(panZoomInstance);
117
+ // Dynamically import svg-pan-zoom only on client side
118
+ if (typeof window !== 'undefined') {
119
+ const svgPanZoomModule = await import('svg-pan-zoom');
120
+ const svgPanZoom = svgPanZoomModule.default || svgPanZoomModule;
121
+
122
+ const panZoomInstance = svgPanZoom(svgElement);
123
+ panZoomInstance.fit();
124
+ panZoomInstance.center();
125
+ panZoomInstance.zoomAtPoint(1, { x: 0, y: 0 });
126
+ panZoomInstance.disablePan();
127
+ panZoomInstance.disableZoom();
128
+ setInstance(panZoomInstance);
129
+ }
125
130
  }
126
131
  }
127
132