@embeddr/react-ui 0.1.3 → 0.1.4
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/LICENSE.md +164 -164
- package/README.md +2 -7
- package/dist/context/EmbeddrContext.d.ts +8 -0
- package/dist/context/EmbeddrContext.d.ts.map +1 -0
- package/dist/context/EmbeddrContext.js +14 -0
- package/dist/context/EmbeddrContext.js.map +1 -0
- package/dist/context/ImageDialogContext.d.ts +1 -2
- package/dist/context/ImageDialogContext.d.ts.map +1 -1
- package/dist/context/ImageDialogContext.js +3 -14
- package/dist/context/ImageDialogContext.js.map +1 -1
- package/dist/context/index.d.ts +3 -0
- package/dist/context/index.d.ts.map +1 -0
- package/dist/context/index.js +3 -0
- package/dist/context/index.js.map +1 -0
- package/dist/hooks/index.d.ts +4 -0
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/hooks/index.js +4 -0
- package/dist/hooks/index.js.map +1 -0
- package/dist/hooks/useExternalNav.d.ts +1 -1
- package/dist/hooks/useExternalNav.d.ts.map +1 -1
- package/dist/hooks/useExternalNav.js +8 -11
- package/dist/hooks/useExternalNav.js.map +1 -1
- package/dist/hooks/useImageDialog.d.ts +1 -1
- package/dist/hooks/useImageDialog.d.ts.map +1 -1
- package/dist/hooks/useImageDialog.js +10 -0
- package/dist/hooks/useImageDialog.js.map +1 -0
- package/dist/hooks/useLocalStorage.d.ts +2 -0
- package/dist/hooks/useLocalStorage.d.ts.map +1 -0
- package/dist/hooks/useLocalStorage.js +37 -0
- package/dist/hooks/useLocalStorage.js.map +1 -0
- package/dist/index.d.ts +6 -33
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -125
- package/dist/index.js.map +1 -1
- package/dist/lib/utils.d.ts +1 -1
- package/dist/lib/utils.d.ts.map +1 -1
- package/dist/lib/utils.js +5 -8
- package/dist/lib/utils.js.map +1 -1
- package/dist/providers/{ExternalNav.d.ts → ExternalNavProvider.d.ts} +1 -1
- package/dist/providers/ExternalNavProvider.d.ts.map +1 -0
- package/dist/providers/ExternalNavProvider.js +26 -0
- package/dist/providers/ExternalNavProvider.js.map +1 -0
- package/dist/providers/ImageDialogProvider.d.ts.map +1 -1
- package/dist/providers/ImageDialogProvider.js +157 -132
- package/dist/providers/ImageDialogProvider.js.map +1 -1
- package/dist/providers/index.d.ts +3 -0
- package/dist/providers/index.d.ts.map +1 -0
- package/dist/providers/index.js +3 -0
- package/dist/providers/index.js.map +1 -0
- package/dist/types/domain.d.ts +73 -0
- package/dist/types/domain.d.ts.map +1 -0
- package/dist/types/domain.js +2 -0
- package/dist/types/domain.js.map +1 -0
- package/dist/types/gallery.d.ts +1 -0
- package/dist/types/gallery.d.ts.map +1 -1
- package/dist/types/gallery.js +2 -0
- package/dist/types/gallery.js.map +1 -0
- package/dist/types/index.d.ts +4 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +4 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/plugin.d.ts +94 -0
- package/dist/types/plugin.d.ts.map +1 -0
- package/dist/types/plugin.js +2 -0
- package/dist/types/plugin.js.map +1 -0
- package/dist/ui/accordion.js +15 -62
- package/dist/ui/accordion.js.map +1 -1
- package/dist/ui/aspect-ratio.d.ts.map +1 -1
- package/dist/ui/aspect-ratio.js +8 -0
- package/dist/ui/aspect-ratio.js.map +1 -0
- package/dist/ui/avatar.js +12 -49
- package/dist/ui/avatar.js.map +1 -1
- package/dist/ui/badge.d.ts +3 -3
- package/dist/ui/badge.d.ts.map +1 -1
- package/dist/ui/badge.js +20 -37
- package/dist/ui/badge.js.map +1 -1
- package/dist/ui/breadcrumb.js +29 -0
- package/dist/ui/breadcrumb.js.map +1 -0
- package/dist/ui/button.d.ts +4 -4
- package/dist/ui/button.d.ts.map +1 -1
- package/dist/ui/button.js +33 -53
- package/dist/ui/button.js.map +1 -1
- package/dist/ui/card.js +19 -96
- package/dist/ui/card.js.map +1 -1
- package/dist/ui/checkbox.js +10 -0
- package/dist/ui/checkbox.js.map +1 -0
- package/dist/ui/context-menu.d.ts +28 -0
- package/dist/ui/context-menu.d.ts.map +1 -0
- package/dist/ui/context-menu.js +34 -0
- package/dist/ui/context-menu.js.map +1 -0
- package/dist/ui/dialog.d.ts.map +1 -1
- package/dist/ui/dialog.js +27 -128
- package/dist/ui/dialog.js.map +1 -1
- package/dist/ui/draggable-panel.d.ts +47 -0
- package/dist/ui/draggable-panel.d.ts.map +1 -0
- package/dist/ui/draggable-panel.js +178 -0
- package/dist/ui/draggable-panel.js.map +1 -0
- package/dist/ui/dropdown-menu.js +37 -220
- package/dist/ui/dropdown-menu.js.map +1 -1
- package/dist/ui/index.d.ts +31 -0
- package/dist/ui/index.d.ts.map +1 -0
- package/dist/ui/index.js +31 -0
- package/dist/ui/index.js.map +1 -0
- package/dist/ui/input-group.d.ts +6 -6
- package/dist/ui/input-group.d.ts.map +1 -1
- package/dist/ui/input-group.js +49 -138
- package/dist/ui/input-group.js.map +1 -1
- package/dist/ui/input.js +7 -22
- package/dist/ui/input.js.map +1 -1
- package/dist/ui/label.js +8 -23
- package/dist/ui/label.js.map +1 -1
- package/dist/ui/lightbox/ComparisonSlider.d.ts +7 -0
- package/dist/ui/lightbox/ComparisonSlider.d.ts.map +1 -0
- package/dist/ui/lightbox/ComparisonSlider.js +62 -0
- package/dist/ui/lightbox/ComparisonSlider.js.map +1 -0
- package/dist/ui/lightbox/GalleryPicker.js +15 -61
- package/dist/ui/lightbox/GalleryPicker.js.map +1 -1
- package/dist/ui/lightbox/ImageThumbnailStrip.d.ts.map +1 -1
- package/dist/ui/lightbox/ImageThumbnailStrip.js +24 -94
- package/dist/ui/lightbox/ImageThumbnailStrip.js.map +1 -1
- package/dist/ui/lightbox/LightboxViewer.d.ts.map +1 -1
- package/dist/ui/lightbox/LightboxViewer.js +50 -112
- package/dist/ui/lightbox/LightboxViewer.js.map +1 -1
- package/dist/ui/lightbox/MediaCanvas.d.ts +13 -0
- package/dist/ui/lightbox/MediaCanvas.d.ts.map +1 -0
- package/dist/ui/lightbox/MediaCanvas.js +18 -0
- package/dist/ui/lightbox/MediaCanvas.js.map +1 -0
- package/dist/ui/lightbox/PannableImage.d.ts +3 -2
- package/dist/ui/lightbox/PannableImage.d.ts.map +1 -1
- package/dist/ui/lightbox/PannableImage.js +327 -222
- package/dist/ui/lightbox/PannableImage.js.map +1 -1
- package/dist/ui/lightbox/PannableVideo.d.ts +9 -0
- package/dist/ui/lightbox/PannableVideo.d.ts.map +1 -0
- package/dist/ui/lightbox/PannableVideo.js +183 -0
- package/dist/ui/lightbox/PannableVideo.js.map +1 -0
- package/dist/ui/lightbox/index.d.ts +8 -0
- package/dist/ui/lightbox/index.d.ts.map +1 -0
- package/dist/ui/lightbox/index.js +8 -0
- package/dist/ui/lightbox/index.js.map +1 -0
- package/dist/ui/menubar.js +55 -0
- package/dist/ui/menubar.js.map +1 -0
- package/dist/ui/progress.js +8 -32
- package/dist/ui/progress.js.map +1 -1
- package/dist/ui/resizable.js +13 -47
- package/dist/ui/resizable.js.map +1 -1
- package/dist/ui/scroll-area.js +11 -65
- package/dist/ui/scroll-area.js.map +1 -1
- package/dist/ui/select.js +29 -172
- package/dist/ui/select.js.map +1 -1
- package/dist/ui/separator.js +8 -27
- package/dist/ui/separator.js.map +1 -1
- package/dist/ui/skeleton.js +6 -17
- package/dist/ui/skeleton.js.map +1 -1
- package/dist/ui/slider.js +13 -63
- package/dist/ui/slider.js.map +1 -1
- package/dist/ui/sonner.d.ts.map +1 -1
- package/dist/ui/sonner.js +24 -40
- package/dist/ui/sonner.js.map +1 -1
- package/dist/ui/spinner.d.ts.map +1 -1
- package/dist/ui/spinner.js +7 -20
- package/dist/ui/spinner.js.map +1 -1
- package/dist/ui/switch.js +8 -32
- package/dist/ui/switch.js.map +1 -1
- package/dist/ui/table.js +29 -0
- package/dist/ui/table.js.map +1 -0
- package/dist/ui/tabs.js +15 -68
- package/dist/ui/tabs.js.map +1 -1
- package/dist/ui/textarea.js +7 -19
- package/dist/ui/textarea.js.map +1 -1
- package/dist/ui/tooltip.js +14 -53
- package/dist/ui/tooltip.js.map +1 -1
- package/package.json +29 -12
- package/dist/node_modules/.pnpm/@floating-ui_core@1.7.3/node_modules/@floating-ui/core/dist/floating-ui.core.js +0 -528
- package/dist/node_modules/.pnpm/@floating-ui_core@1.7.3/node_modules/@floating-ui/core/dist/floating-ui.core.js.map +0 -1
- package/dist/node_modules/.pnpm/@floating-ui_dom@1.7.4/node_modules/@floating-ui/dom/dist/floating-ui.dom.js +0 -403
- package/dist/node_modules/.pnpm/@floating-ui_dom@1.7.4/node_modules/@floating-ui/dom/dist/floating-ui.dom.js.map +0 -1
- package/dist/node_modules/.pnpm/@floating-ui_react-dom@2.1.6_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.js +0 -209
- package/dist/node_modules/.pnpm/@floating-ui_react-dom@2.1.6_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.js.map +0 -1
- package/dist/node_modules/.pnpm/@floating-ui_utils@0.2.10/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.js +0 -137
- package/dist/node_modules/.pnpm/@floating-ui_utils@0.2.10/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.js.map +0 -1
- package/dist/node_modules/.pnpm/@floating-ui_utils@0.2.10/node_modules/@floating-ui/utils/dist/floating-ui.utils.js +0 -131
- package/dist/node_modules/.pnpm/@floating-ui_utils@0.2.10/node_modules/@floating-ui/utils/dist/floating-ui.utils.js.map +0 -1
- package/dist/node_modules/.pnpm/@radix-ui_primitive@1.1.3/node_modules/@radix-ui/primitive/dist/index.js +0 -10
- package/dist/node_modules/.pnpm/@radix-ui_primitive@1.1.3/node_modules/@radix-ui/primitive/dist/index.js.map +0 -1
- package/dist/node_modules/.pnpm/@radix-ui_react-arrow@1.1.7_@types_react-dom@19.2.3_@types_react@19.2.7__@types_react@19.2.7__mszl4mxerbyoklygdzmmz7z344/node_modules/@radix-ui/react-arrow/dist/index.js +0 -25
- package/dist/node_modules/.pnpm/@radix-ui_react-arrow@1.1.7_@types_react-dom@19.2.3_@types_react@19.2.7__@types_react@19.2.7__mszl4mxerbyoklygdzmmz7z344/node_modules/@radix-ui/react-arrow/dist/index.js.map +0 -1
- package/dist/node_modules/.pnpm/@radix-ui_react-compose-refs@1.1.2_@types_react@19.2.7_react@19.2.3/node_modules/@radix-ui/react-compose-refs/dist/index.js +0 -30
- package/dist/node_modules/.pnpm/@radix-ui_react-compose-refs@1.1.2_@types_react@19.2.7_react@19.2.3/node_modules/@radix-ui/react-compose-refs/dist/index.js.map +0 -1
- package/dist/node_modules/.pnpm/@radix-ui_react-context@1.1.2_@types_react@19.2.7_react@19.2.3/node_modules/@radix-ui/react-context/dist/index.js +0 -54
- package/dist/node_modules/.pnpm/@radix-ui_react-context@1.1.2_@types_react@19.2.7_react@19.2.3/node_modules/@radix-ui/react-context/dist/index.js.map +0 -1
- package/dist/node_modules/.pnpm/@radix-ui_react-dismissable-layer@1.1.11_@types_react-dom@19.2.3_@types_react@19.2.7__@types__3rf2o2lqjhudzepmewjxnjpij4/node_modules/@radix-ui/react-dismissable-layer/dist/index.js +0 -128
- package/dist/node_modules/.pnpm/@radix-ui_react-dismissable-layer@1.1.11_@types_react-dom@19.2.3_@types_react@19.2.7__@types__3rf2o2lqjhudzepmewjxnjpij4/node_modules/@radix-ui/react-dismissable-layer/dist/index.js.map +0 -1
- package/dist/node_modules/.pnpm/@radix-ui_react-id@1.1.1_@types_react@19.2.7_react@19.2.3/node_modules/@radix-ui/react-id/dist/index.js +0 -14
- package/dist/node_modules/.pnpm/@radix-ui_react-id@1.1.1_@types_react@19.2.7_react@19.2.3/node_modules/@radix-ui/react-id/dist/index.js.map +0 -1
- package/dist/node_modules/.pnpm/@radix-ui_react-popper@1.2.8_@types_react-dom@19.2.3_@types_react@19.2.7__@types_react@19.2.7_khjb2df42vo4osw72fyixnkybq/node_modules/@radix-ui/react-popper/dist/index.js +0 -220
- package/dist/node_modules/.pnpm/@radix-ui_react-popper@1.2.8_@types_react-dom@19.2.3_@types_react@19.2.7__@types_react@19.2.7_khjb2df42vo4osw72fyixnkybq/node_modules/@radix-ui/react-popper/dist/index.js.map +0 -1
- package/dist/node_modules/.pnpm/@radix-ui_react-portal@1.1.9_@types_react-dom@19.2.3_@types_react@19.2.7__@types_react@19.2.7_wazm3ifinqzsamvsqllqreat3m/node_modules/@radix-ui/react-portal/dist/index.js +0 -16
- package/dist/node_modules/.pnpm/@radix-ui_react-portal@1.1.9_@types_react-dom@19.2.3_@types_react@19.2.7__@types_react@19.2.7_wazm3ifinqzsamvsqllqreat3m/node_modules/@radix-ui/react-portal/dist/index.js.map +0 -1
- package/dist/node_modules/.pnpm/@radix-ui_react-presence@1.1.5_@types_react-dom@19.2.3_@types_react@19.2.7__@types_react@19.2_g7nvzcflnhogkdp32witcuayfy/node_modules/@radix-ui/react-presence/dist/index.js +0 -71
- package/dist/node_modules/.pnpm/@radix-ui_react-presence@1.1.5_@types_react-dom@19.2.3_@types_react@19.2.7__@types_react@19.2_g7nvzcflnhogkdp32witcuayfy/node_modules/@radix-ui/react-presence/dist/index.js.map +0 -1
- package/dist/node_modules/.pnpm/@radix-ui_react-primitive@2.1.3_@types_react-dom@19.2.3_@types_react@19.2.7__@types_react@19._vrijsupjqixawruberrfb56pbm/node_modules/@radix-ui/react-primitive/dist/index.js +0 -37
- package/dist/node_modules/.pnpm/@radix-ui_react-primitive@2.1.3_@types_react-dom@19.2.3_@types_react@19.2.7__@types_react@19._vrijsupjqixawruberrfb56pbm/node_modules/@radix-ui/react-primitive/dist/index.js.map +0 -1
- package/dist/node_modules/.pnpm/@radix-ui_react-primitive@2.1.4_@types_react-dom@19.2.3_@types_react@19.2.7__@types_react@19._4sfldbbhvd3xapj4euqmtg5wga/node_modules/@radix-ui/react-primitive/dist/index.js +0 -33
- package/dist/node_modules/.pnpm/@radix-ui_react-primitive@2.1.4_@types_react-dom@19.2.3_@types_react@19.2.7__@types_react@19._4sfldbbhvd3xapj4euqmtg5wga/node_modules/@radix-ui/react-primitive/dist/index.js.map +0 -1
- package/dist/node_modules/.pnpm/@radix-ui_react-tooltip@1.2.8_@types_react-dom@19.2.3_@types_react@19.2.7__@types_react@19.2._lz7pdiyrbpqbbsap76pucwgg5i/node_modules/@radix-ui/react-tooltip/dist/index.js +0 -339
- package/dist/node_modules/.pnpm/@radix-ui_react-tooltip@1.2.8_@types_react-dom@19.2.3_@types_react@19.2.7__@types_react@19.2._lz7pdiyrbpqbbsap76pucwgg5i/node_modules/@radix-ui/react-tooltip/dist/index.js.map +0 -1
- package/dist/node_modules/.pnpm/@radix-ui_react-use-callback-ref@1.1.1_@types_react@19.2.7_react@19.2.3/node_modules/@radix-ui/react-use-callback-ref/dist/index.js +0 -11
- package/dist/node_modules/.pnpm/@radix-ui_react-use-callback-ref@1.1.1_@types_react@19.2.7_react@19.2.3/node_modules/@radix-ui/react-use-callback-ref/dist/index.js.map +0 -1
- package/dist/node_modules/.pnpm/@radix-ui_react-use-controllable-state@1.2.2_@types_react@19.2.7_react@19.2.3/node_modules/@radix-ui/react-use-controllable-state/dist/index.js +0 -53
- package/dist/node_modules/.pnpm/@radix-ui_react-use-controllable-state@1.2.2_@types_react@19.2.7_react@19.2.3/node_modules/@radix-ui/react-use-controllable-state/dist/index.js.map +0 -1
- package/dist/node_modules/.pnpm/@radix-ui_react-use-escape-keydown@1.1.1_@types_react@19.2.7_react@19.2.3/node_modules/@radix-ui/react-use-escape-keydown/dist/index.js +0 -15
- package/dist/node_modules/.pnpm/@radix-ui_react-use-escape-keydown@1.1.1_@types_react@19.2.7_react@19.2.3/node_modules/@radix-ui/react-use-escape-keydown/dist/index.js.map +0 -1
- package/dist/node_modules/.pnpm/@radix-ui_react-use-layout-effect@1.1.1_@types_react@19.2.7_react@19.2.3/node_modules/@radix-ui/react-use-layout-effect/dist/index.js +0 -7
- package/dist/node_modules/.pnpm/@radix-ui_react-use-layout-effect@1.1.1_@types_react@19.2.7_react@19.2.3/node_modules/@radix-ui/react-use-layout-effect/dist/index.js.map +0 -1
- package/dist/node_modules/.pnpm/@radix-ui_react-use-size@1.1.1_@types_react@19.2.7_react@19.2.3/node_modules/@radix-ui/react-use-size/dist/index.js +0 -28
- package/dist/node_modules/.pnpm/@radix-ui_react-use-size@1.1.1_@types_react@19.2.7_react@19.2.3/node_modules/@radix-ui/react-use-size/dist/index.js.map +0 -1
- package/dist/node_modules/.pnpm/@radix-ui_react-visually-hidden@1.2.3_@types_react-dom@19.2.3_@types_react@19.2.7__@types_rea_xyyq4kaffb3s2ucmc374detnx4/node_modules/@radix-ui/react-visually-hidden/dist/index.js +0 -33
- package/dist/node_modules/.pnpm/@radix-ui_react-visually-hidden@1.2.3_@types_react-dom@19.2.3_@types_react@19.2.7__@types_rea_xyyq4kaffb3s2ucmc374detnx4/node_modules/@radix-ui/react-visually-hidden/dist/index.js.map +0 -1
- package/dist/node_modules/.pnpm/@radix-ui_react-visually-hidden@1.2.4_@types_react-dom@19.2.3_@types_react@19.2.7__@types_rea_uxirz2wej36zwyzefmreqngy74/node_modules/@radix-ui/react-visually-hidden/dist/index.js +0 -31
- package/dist/node_modules/.pnpm/@radix-ui_react-visually-hidden@1.2.4_@types_react-dom@19.2.3_@types_react@19.2.7__@types_rea_uxirz2wej36zwyzefmreqngy74/node_modules/@radix-ui/react-visually-hidden/dist/index.js.map +0 -1
- package/dist/node_modules/.pnpm/class-variance-authority@0.7.1/node_modules/class-variance-authority/dist/index.js +0 -36
- package/dist/node_modules/.pnpm/class-variance-authority@0.7.1/node_modules/class-variance-authority/dist/index.js.map +0 -1
- package/dist/node_modules/.pnpm/clsx@2.1.1/node_modules/clsx/dist/clsx.js +0 -18
- package/dist/node_modules/.pnpm/clsx@2.1.1/node_modules/clsx/dist/clsx.js.map +0 -1
- package/dist/node_modules/.pnpm/lucide-react@0.562.0_react@19.2.3/node_modules/lucide-react/dist/esm/Icon.js +0 -36
- package/dist/node_modules/.pnpm/lucide-react@0.562.0_react@19.2.3/node_modules/lucide-react/dist/esm/Icon.js.map +0 -1
- package/dist/node_modules/.pnpm/lucide-react@0.562.0_react@19.2.3/node_modules/lucide-react/dist/esm/createLucideIcon.js +0 -22
- package/dist/node_modules/.pnpm/lucide-react@0.562.0_react@19.2.3/node_modules/lucide-react/dist/esm/createLucideIcon.js.map +0 -1
- package/dist/node_modules/.pnpm/lucide-react@0.562.0_react@19.2.3/node_modules/lucide-react/dist/esm/defaultAttributes.js +0 -15
- package/dist/node_modules/.pnpm/lucide-react@0.562.0_react@19.2.3/node_modules/lucide-react/dist/esm/defaultAttributes.js.map +0 -1
- package/dist/node_modules/.pnpm/lucide-react@0.562.0_react@19.2.3/node_modules/lucide-react/dist/esm/icons/check.js +0 -7
- package/dist/node_modules/.pnpm/lucide-react@0.562.0_react@19.2.3/node_modules/lucide-react/dist/esm/icons/check.js.map +0 -1
- package/dist/node_modules/.pnpm/lucide-react@0.562.0_react@19.2.3/node_modules/lucide-react/dist/esm/icons/chevron-down.js +0 -7
- package/dist/node_modules/.pnpm/lucide-react@0.562.0_react@19.2.3/node_modules/lucide-react/dist/esm/icons/chevron-down.js.map +0 -1
- package/dist/node_modules/.pnpm/lucide-react@0.562.0_react@19.2.3/node_modules/lucide-react/dist/esm/icons/chevron-right.js +0 -7
- package/dist/node_modules/.pnpm/lucide-react@0.562.0_react@19.2.3/node_modules/lucide-react/dist/esm/icons/chevron-right.js.map +0 -1
- package/dist/node_modules/.pnpm/lucide-react@0.562.0_react@19.2.3/node_modules/lucide-react/dist/esm/icons/chevron-up.js +0 -7
- package/dist/node_modules/.pnpm/lucide-react@0.562.0_react@19.2.3/node_modules/lucide-react/dist/esm/icons/chevron-up.js.map +0 -1
- package/dist/node_modules/.pnpm/lucide-react@0.562.0_react@19.2.3/node_modules/lucide-react/dist/esm/icons/circle-check.js +0 -10
- package/dist/node_modules/.pnpm/lucide-react@0.562.0_react@19.2.3/node_modules/lucide-react/dist/esm/icons/circle-check.js.map +0 -1
- package/dist/node_modules/.pnpm/lucide-react@0.562.0_react@19.2.3/node_modules/lucide-react/dist/esm/icons/circle.js +0 -7
- package/dist/node_modules/.pnpm/lucide-react@0.562.0_react@19.2.3/node_modules/lucide-react/dist/esm/icons/circle.js.map +0 -1
- package/dist/node_modules/.pnpm/lucide-react@0.562.0_react@19.2.3/node_modules/lucide-react/dist/esm/icons/grip-vertical.js +0 -14
- package/dist/node_modules/.pnpm/lucide-react@0.562.0_react@19.2.3/node_modules/lucide-react/dist/esm/icons/grip-vertical.js.map +0 -1
- package/dist/node_modules/.pnpm/lucide-react@0.562.0_react@19.2.3/node_modules/lucide-react/dist/esm/icons/info.js +0 -11
- package/dist/node_modules/.pnpm/lucide-react@0.562.0_react@19.2.3/node_modules/lucide-react/dist/esm/icons/info.js.map +0 -1
- package/dist/node_modules/.pnpm/lucide-react@0.562.0_react@19.2.3/node_modules/lucide-react/dist/esm/icons/loader-circle.js +0 -7
- package/dist/node_modules/.pnpm/lucide-react@0.562.0_react@19.2.3/node_modules/lucide-react/dist/esm/icons/loader-circle.js.map +0 -1
- package/dist/node_modules/.pnpm/lucide-react@0.562.0_react@19.2.3/node_modules/lucide-react/dist/esm/icons/octagon-x.js +0 -17
- package/dist/node_modules/.pnpm/lucide-react@0.562.0_react@19.2.3/node_modules/lucide-react/dist/esm/icons/octagon-x.js.map +0 -1
- package/dist/node_modules/.pnpm/lucide-react@0.562.0_react@19.2.3/node_modules/lucide-react/dist/esm/icons/pause.js +0 -10
- package/dist/node_modules/.pnpm/lucide-react@0.562.0_react@19.2.3/node_modules/lucide-react/dist/esm/icons/pause.js.map +0 -1
- package/dist/node_modules/.pnpm/lucide-react@0.562.0_react@19.2.3/node_modules/lucide-react/dist/esm/icons/play.js +0 -15
- package/dist/node_modules/.pnpm/lucide-react@0.562.0_react@19.2.3/node_modules/lucide-react/dist/esm/icons/play.js.map +0 -1
- package/dist/node_modules/.pnpm/lucide-react@0.562.0_react@19.2.3/node_modules/lucide-react/dist/esm/icons/rotate-ccw.js +0 -10
- package/dist/node_modules/.pnpm/lucide-react@0.562.0_react@19.2.3/node_modules/lucide-react/dist/esm/icons/rotate-ccw.js.map +0 -1
- package/dist/node_modules/.pnpm/lucide-react@0.562.0_react@19.2.3/node_modules/lucide-react/dist/esm/icons/rotate-cw.js +0 -10
- package/dist/node_modules/.pnpm/lucide-react@0.562.0_react@19.2.3/node_modules/lucide-react/dist/esm/icons/rotate-cw.js.map +0 -1
- package/dist/node_modules/.pnpm/lucide-react@0.562.0_react@19.2.3/node_modules/lucide-react/dist/esm/icons/triangle-alert.js +0 -17
- package/dist/node_modules/.pnpm/lucide-react@0.562.0_react@19.2.3/node_modules/lucide-react/dist/esm/icons/triangle-alert.js.map +0 -1
- package/dist/node_modules/.pnpm/lucide-react@0.562.0_react@19.2.3/node_modules/lucide-react/dist/esm/icons/x.js +0 -10
- package/dist/node_modules/.pnpm/lucide-react@0.562.0_react@19.2.3/node_modules/lucide-react/dist/esm/icons/x.js.map +0 -1
- package/dist/node_modules/.pnpm/lucide-react@0.562.0_react@19.2.3/node_modules/lucide-react/dist/esm/shared/src/utils.js +0 -19
- package/dist/node_modules/.pnpm/lucide-react@0.562.0_react@19.2.3/node_modules/lucide-react/dist/esm/shared/src/utils.js.map +0 -1
- package/dist/node_modules/.pnpm/tailwind-merge@3.4.0/node_modules/tailwind-merge/dist/bundle-mjs.js +0 -2766
- package/dist/node_modules/.pnpm/tailwind-merge@3.4.0/node_modules/tailwind-merge/dist/bundle-mjs.js.map +0 -1
- package/dist/providers/ExternalNav.d.ts.map +0 -1
- package/dist/providers/ExternalNav.js +0 -55
- package/dist/providers/ExternalNav.js.map +0 -1
- package/dist/providers/ImageDialog.d.ts +0 -2
- package/dist/providers/ImageDialog.d.ts.map +0 -1
|
@@ -1,224 +1,329 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useCallback, useEffect, useRef, useState } from "react";
|
|
3
|
+
import { RotateCcw, RotateCw } from "lucide-react";
|
|
4
|
+
import { Button } from "../button";
|
|
5
|
+
export const PannableImage = ({ src, mediaType = "image", className, isOpen, actions = [], controlsBottomOffset = 16, }) => {
|
|
6
|
+
const canvasRef = useRef(null);
|
|
7
|
+
const containerRef = useRef(null);
|
|
8
|
+
const imageRef = useRef(null);
|
|
9
|
+
const [isDragging, setIsDragging] = useState(false);
|
|
10
|
+
const [zoom, setZoom] = useState(1);
|
|
11
|
+
const zoomRef = useRef(1);
|
|
12
|
+
const [pan, setPan] = useState({ x: 0, y: 0 });
|
|
13
|
+
const panRef = useRef({ x: 0, y: 0 });
|
|
14
|
+
const [rotation, setRotation] = useState(0);
|
|
15
|
+
const rotationRef = useRef(0);
|
|
16
|
+
const [dragStart, setDragStart] = useState({ x: 0, y: 0 });
|
|
17
|
+
const [isImageLoaded, setIsImageLoaded] = useState(false);
|
|
18
|
+
const [showHelp, setShowHelp] = useState(false);
|
|
19
|
+
// Draw image on canvas
|
|
20
|
+
const drawImage = useCallback(() => {
|
|
21
|
+
if (!canvasRef.current || !imageRef.current)
|
|
22
|
+
return;
|
|
23
|
+
const canvas = canvasRef.current;
|
|
24
|
+
const ctx = canvas.getContext("2d");
|
|
25
|
+
if (!ctx || canvas.width === 0 || canvas.height === 0)
|
|
26
|
+
return;
|
|
27
|
+
const dpr = window.devicePixelRatio || 1;
|
|
28
|
+
const img = imageRef.current;
|
|
29
|
+
// Clear canvas
|
|
30
|
+
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
|
31
|
+
// Calculate fit dimensions
|
|
32
|
+
const r = rotationRef.current;
|
|
33
|
+
const isRotated = (r / 90) % 2 !== 0;
|
|
34
|
+
// Handle video dimensions
|
|
35
|
+
const naturalWidth = img instanceof HTMLVideoElement ? img.videoWidth : img.width;
|
|
36
|
+
const naturalHeight = img instanceof HTMLVideoElement ? img.videoHeight : img.height;
|
|
37
|
+
if (!naturalWidth || !naturalHeight)
|
|
38
|
+
return;
|
|
39
|
+
const canvasAspect = canvas.width / canvas.height;
|
|
40
|
+
const imageAspect = isRotated
|
|
41
|
+
? naturalHeight / naturalWidth
|
|
42
|
+
: naturalWidth / naturalHeight;
|
|
43
|
+
let fitWidth = canvas.width;
|
|
44
|
+
let fitHeight = canvas.height;
|
|
45
|
+
if (imageAspect > canvasAspect) {
|
|
46
|
+
// Image is wider than canvas (relative to aspect)
|
|
47
|
+
fitHeight = canvas.width / imageAspect;
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
// Image is taller than canvas
|
|
51
|
+
fitWidth = canvas.height * imageAspect;
|
|
52
|
+
}
|
|
53
|
+
// Apply zoom
|
|
54
|
+
const z = zoomRef.current;
|
|
55
|
+
const p = panRef.current;
|
|
56
|
+
// The dimensions of the image as it will be drawn (unrotated)
|
|
57
|
+
const drawWidth = (isRotated ? fitHeight : fitWidth) * z;
|
|
58
|
+
const drawHeight = (isRotated ? fitWidth : fitHeight) * z;
|
|
59
|
+
ctx.save();
|
|
60
|
+
// Move to center of canvas + pan
|
|
61
|
+
ctx.translate(canvas.width / 2 + p.x * dpr, canvas.height / 2 + p.y * dpr);
|
|
62
|
+
ctx.rotate((r * Math.PI) / 180);
|
|
63
|
+
// Draw image centered at 0,0
|
|
64
|
+
ctx.drawImage(img, -drawWidth / 2, -drawHeight / 2, drawWidth, drawHeight);
|
|
65
|
+
ctx.restore();
|
|
66
|
+
}, []);
|
|
67
|
+
// Ensure canvas gets sized correctly once layout stabilizes.
|
|
68
|
+
const ensureCanvasSize = useCallback(() => {
|
|
69
|
+
if (!containerRef.current || !canvasRef.current)
|
|
70
|
+
return;
|
|
71
|
+
const dpr = window.devicePixelRatio || 1;
|
|
72
|
+
let attempts = 0;
|
|
73
|
+
const maxAttempts = 60;
|
|
74
|
+
const trySet = () => {
|
|
75
|
+
if (!containerRef.current || !canvasRef.current)
|
|
76
|
+
return;
|
|
77
|
+
const rect = containerRef.current.getBoundingClientRect();
|
|
78
|
+
if (rect.width > 0 && rect.height > 0) {
|
|
79
|
+
canvasRef.current.width = rect.width * dpr;
|
|
80
|
+
canvasRef.current.height = rect.height * dpr;
|
|
81
|
+
canvasRef.current.style.width = `${rect.width}px`;
|
|
82
|
+
canvasRef.current.style.height = `${rect.height}px`;
|
|
83
|
+
drawImage();
|
|
84
|
+
}
|
|
85
|
+
else if (attempts < maxAttempts) {
|
|
86
|
+
attempts++;
|
|
87
|
+
requestAnimationFrame(trySet);
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
requestAnimationFrame(trySet);
|
|
91
|
+
}, [drawImage]);
|
|
92
|
+
// Resize handler
|
|
93
|
+
const handleResize = useCallback(() => {
|
|
94
|
+
ensureCanvasSize();
|
|
95
|
+
}, [ensureCanvasSize]);
|
|
96
|
+
// Trigger ensureCanvasSize when dialog is opened
|
|
97
|
+
useEffect(() => {
|
|
98
|
+
if (isOpen) {
|
|
99
|
+
// Small delay to allow dialog animation/layout to settle
|
|
100
|
+
setTimeout(ensureCanvasSize, 50);
|
|
101
|
+
setTimeout(ensureCanvasSize, 200);
|
|
102
|
+
}
|
|
103
|
+
}, [isOpen, ensureCanvasSize]);
|
|
104
|
+
// Load image or video
|
|
105
|
+
useEffect(() => {
|
|
106
|
+
setIsImageLoaded(false);
|
|
107
|
+
// Cleanup previous media
|
|
108
|
+
if (imageRef.current instanceof HTMLVideoElement) {
|
|
109
|
+
imageRef.current.pause();
|
|
110
|
+
imageRef.current.src = "";
|
|
111
|
+
imageRef.current.load();
|
|
112
|
+
}
|
|
113
|
+
imageRef.current = null;
|
|
114
|
+
if (mediaType === "video") {
|
|
115
|
+
const vid = document.createElement("video");
|
|
116
|
+
vid.src = src;
|
|
117
|
+
vid.loop = true;
|
|
118
|
+
vid.muted = true;
|
|
119
|
+
vid.playsInline = true;
|
|
120
|
+
vid.autoplay = true;
|
|
121
|
+
vid.onloadedmetadata = () => {
|
|
122
|
+
imageRef.current = vid;
|
|
123
|
+
setIsImageLoaded(true);
|
|
124
|
+
// Reset zoom/pan on new media
|
|
125
|
+
zoomRef.current = 1;
|
|
126
|
+
setZoom(1);
|
|
127
|
+
panRef.current = { x: 0, y: 0 };
|
|
128
|
+
setPan({ x: 0, y: 0 });
|
|
129
|
+
rotationRef.current = 0;
|
|
130
|
+
setRotation(0);
|
|
131
|
+
handleResize();
|
|
132
|
+
vid.play().catch((e) => console.error("Auto-play failed", e));
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
else {
|
|
136
|
+
const img = new Image();
|
|
137
|
+
img.src = src;
|
|
138
|
+
img.onload = () => {
|
|
139
|
+
imageRef.current = img;
|
|
140
|
+
setIsImageLoaded(true);
|
|
141
|
+
// Reset zoom/pan on new image
|
|
142
|
+
zoomRef.current = 1;
|
|
143
|
+
setZoom(1);
|
|
144
|
+
panRef.current = { x: 0, y: 0 };
|
|
145
|
+
setPan({ x: 0, y: 0 });
|
|
146
|
+
rotationRef.current = 0;
|
|
147
|
+
setRotation(0);
|
|
148
|
+
handleResize();
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
}, [src, mediaType, handleResize]);
|
|
152
|
+
// Animation loop for video
|
|
153
|
+
useEffect(() => {
|
|
154
|
+
let animationFrameId;
|
|
155
|
+
const render = () => {
|
|
156
|
+
if (mediaType === "video" && isImageLoaded) {
|
|
157
|
+
drawImage();
|
|
158
|
+
animationFrameId = requestAnimationFrame(render);
|
|
159
|
+
}
|
|
160
|
+
};
|
|
161
|
+
if (mediaType === "video" && isImageLoaded) {
|
|
162
|
+
render();
|
|
163
|
+
}
|
|
164
|
+
return () => {
|
|
165
|
+
if (animationFrameId)
|
|
166
|
+
cancelAnimationFrame(animationFrameId);
|
|
167
|
+
};
|
|
168
|
+
}, [mediaType, isImageLoaded, drawImage]);
|
|
169
|
+
// Setup resize observer and window listener
|
|
170
|
+
useEffect(() => {
|
|
171
|
+
window.addEventListener("resize", handleResize);
|
|
172
|
+
const resizeObserver = new ResizeObserver(() => handleResize());
|
|
173
|
+
if (containerRef.current) {
|
|
174
|
+
resizeObserver.observe(containerRef.current);
|
|
175
|
+
}
|
|
176
|
+
return () => {
|
|
177
|
+
window.removeEventListener("resize", handleResize);
|
|
178
|
+
resizeObserver.disconnect();
|
|
179
|
+
};
|
|
180
|
+
}, [handleResize]);
|
|
181
|
+
// Redraw when zoom or pan changes
|
|
182
|
+
useEffect(() => {
|
|
183
|
+
zoomRef.current = zoom;
|
|
184
|
+
panRef.current = pan;
|
|
185
|
+
rotationRef.current = rotation;
|
|
186
|
+
requestAnimationFrame(drawImage);
|
|
187
|
+
}, [zoom, pan, rotation, drawImage]);
|
|
188
|
+
// Mouse wheel zoom (with pivot at cursor)
|
|
189
|
+
const handleWheel = useCallback((e) => {
|
|
78
190
|
e.preventDefault();
|
|
79
|
-
const
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
e.
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
)
|
|
217
|
-
]
|
|
218
|
-
}
|
|
219
|
-
);
|
|
220
|
-
};
|
|
221
|
-
export {
|
|
222
|
-
me as PannableImage
|
|
191
|
+
const dpr = window.devicePixelRatio || 1;
|
|
192
|
+
const canvas = canvasRef.current;
|
|
193
|
+
if (!canvas)
|
|
194
|
+
return;
|
|
195
|
+
const rect = canvas.getBoundingClientRect();
|
|
196
|
+
const mouseX = (e.clientX - rect.left) * dpr;
|
|
197
|
+
const mouseY = (e.clientY - rect.top) * dpr;
|
|
198
|
+
// Center of canvas
|
|
199
|
+
const cx = canvas.width / 2;
|
|
200
|
+
const cy = canvas.height / 2;
|
|
201
|
+
// Mouse position relative to center (before zoom)
|
|
202
|
+
const rx = mouseX - cx - panRef.current.x * dpr;
|
|
203
|
+
const ry = mouseY - cy - panRef.current.y * dpr;
|
|
204
|
+
const delta = -Math.sign(e.deltaY) * 0.1;
|
|
205
|
+
const newZoom = Math.max(0.1, Math.min(10, zoomRef.current + delta));
|
|
206
|
+
const zoomFactor = newZoom / zoomRef.current;
|
|
207
|
+
// Adjust pan to keep mouse over same point
|
|
208
|
+
// newRx = rx * zoomFactor
|
|
209
|
+
// newRx = mouseX - cx - newPanX
|
|
210
|
+
// => newPanX = mouseX - cx - rx * zoomFactor
|
|
211
|
+
const newPanX = (mouseX - cx - rx * zoomFactor) / dpr;
|
|
212
|
+
const newPanY = (mouseY - cy - ry * zoomFactor) / dpr;
|
|
213
|
+
setZoom(newZoom);
|
|
214
|
+
setPan({ x: newPanX, y: newPanY });
|
|
215
|
+
}, []);
|
|
216
|
+
// Touch handling
|
|
217
|
+
const [touchState, setTouchState] = useState(null);
|
|
218
|
+
const handleTouchStart = useCallback((e) => {
|
|
219
|
+
if (e.touches.length === 2) {
|
|
220
|
+
e.preventDefault();
|
|
221
|
+
const t1 = e.touches[0];
|
|
222
|
+
const t2 = e.touches[1];
|
|
223
|
+
if (!t1 || !t2)
|
|
224
|
+
return;
|
|
225
|
+
const dist = Math.hypot(t1.clientX - t2.clientX, t1.clientY - t2.clientY);
|
|
226
|
+
const midX = (t1.clientX + t2.clientX) / 2;
|
|
227
|
+
const midY = (t1.clientY + t2.clientY) / 2;
|
|
228
|
+
setTouchState({
|
|
229
|
+
isPinching: true,
|
|
230
|
+
initialDistance: dist,
|
|
231
|
+
initialZoom: zoomRef.current,
|
|
232
|
+
initialPan: { ...panRef.current },
|
|
233
|
+
midPoint: { x: midX, y: midY },
|
|
234
|
+
});
|
|
235
|
+
}
|
|
236
|
+
else if (e.touches.length === 1) {
|
|
237
|
+
const t = e.touches[0];
|
|
238
|
+
if (!t)
|
|
239
|
+
return;
|
|
240
|
+
setDragStart({ x: t.clientX, y: t.clientY });
|
|
241
|
+
setIsDragging(true);
|
|
242
|
+
}
|
|
243
|
+
}, []);
|
|
244
|
+
const handleTouchMove = useCallback((e) => {
|
|
245
|
+
if (e.touches.length === 2 && touchState?.isPinching) {
|
|
246
|
+
e.preventDefault();
|
|
247
|
+
const t1 = e.touches[0];
|
|
248
|
+
const t2 = e.touches[1];
|
|
249
|
+
if (!t1 || !t2)
|
|
250
|
+
return;
|
|
251
|
+
const dist = Math.hypot(t1.clientX - t2.clientX, t1.clientY - t2.clientY);
|
|
252
|
+
const scale = dist / touchState.initialDistance;
|
|
253
|
+
setZoom(Math.max(0.1, Math.min(10, touchState.initialZoom * scale)));
|
|
254
|
+
// Optional: Handle pan during pinch (using midpoint delta)
|
|
255
|
+
// const midX = (t1.clientX + t2.clientX) / 2;
|
|
256
|
+
// const midY = (t1.clientY + t2.clientY) / 2;
|
|
257
|
+
// const dx = midX - touchState.midPoint.x;
|
|
258
|
+
// const dy = midY - touchState.midPoint.y;
|
|
259
|
+
// setPan({
|
|
260
|
+
// x: touchState.initialPan.x + dx,
|
|
261
|
+
// y: touchState.initialPan.y + dy
|
|
262
|
+
// });
|
|
263
|
+
}
|
|
264
|
+
else if (e.touches.length === 1 && isDragging) {
|
|
265
|
+
e.preventDefault(); // Prevent scrolling
|
|
266
|
+
const t = e.touches[0];
|
|
267
|
+
if (!t)
|
|
268
|
+
return;
|
|
269
|
+
const dx = t.clientX - dragStart.x;
|
|
270
|
+
const dy = t.clientY - dragStart.y;
|
|
271
|
+
setPan((p) => ({ x: p.x + dx, y: p.y + dy }));
|
|
272
|
+
setDragStart({ x: t.clientX, y: t.clientY });
|
|
273
|
+
}
|
|
274
|
+
}, [touchState, isDragging, dragStart]);
|
|
275
|
+
const handleTouchEnd = useCallback(() => {
|
|
276
|
+
setTouchState(null);
|
|
277
|
+
setIsDragging(false);
|
|
278
|
+
}, []);
|
|
279
|
+
// Mouse drag
|
|
280
|
+
const handleMouseDown = useCallback((e) => {
|
|
281
|
+
setDragStart({ x: e.clientX, y: e.clientY });
|
|
282
|
+
setIsDragging(true);
|
|
283
|
+
}, []);
|
|
284
|
+
const handleMouseMove = useCallback((e) => {
|
|
285
|
+
if (isDragging) {
|
|
286
|
+
const dx = e.clientX - dragStart.x;
|
|
287
|
+
const dy = e.clientY - dragStart.y;
|
|
288
|
+
setPan((p) => ({ x: p.x + dx, y: p.y + dy }));
|
|
289
|
+
setDragStart({ x: e.clientX, y: e.clientY });
|
|
290
|
+
}
|
|
291
|
+
}, [isDragging, dragStart]);
|
|
292
|
+
const handleMouseUp = useCallback(() => {
|
|
293
|
+
setIsDragging(false);
|
|
294
|
+
}, []);
|
|
295
|
+
// Reset view on double click
|
|
296
|
+
const handleDoubleClick = useCallback(() => {
|
|
297
|
+
setZoom(1);
|
|
298
|
+
setPan({ x: 0, y: 0 });
|
|
299
|
+
setRotation(0);
|
|
300
|
+
}, []);
|
|
301
|
+
// Attach event listeners
|
|
302
|
+
useEffect(() => {
|
|
303
|
+
const canvas = canvasRef.current;
|
|
304
|
+
if (!canvas)
|
|
305
|
+
return;
|
|
306
|
+
// Passive: false is important for preventing default scroll on touch
|
|
307
|
+
canvas.addEventListener("wheel", handleWheel, { passive: false });
|
|
308
|
+
canvas.addEventListener("touchstart", handleTouchStart, { passive: false });
|
|
309
|
+
canvas.addEventListener("touchmove", handleTouchMove, { passive: false });
|
|
310
|
+
canvas.addEventListener("touchend", handleTouchEnd);
|
|
311
|
+
return () => {
|
|
312
|
+
canvas.removeEventListener("wheel", handleWheel);
|
|
313
|
+
canvas.removeEventListener("touchstart", handleTouchStart);
|
|
314
|
+
canvas.removeEventListener("touchmove", handleTouchMove);
|
|
315
|
+
canvas.removeEventListener("touchend", handleTouchEnd);
|
|
316
|
+
};
|
|
317
|
+
}, [handleWheel, handleTouchStart, handleTouchMove, handleTouchEnd]);
|
|
318
|
+
return (_jsxs("div", { ref: containerRef, className: `${className} relative h-full w-full overflow-hidden`, children: [_jsx("canvas", { ref: canvasRef, onMouseDown: handleMouseDown, onMouseMove: handleMouseMove, onMouseUp: handleMouseUp, onMouseLeave: handleMouseUp, onDoubleClick: handleDoubleClick, className: `w-[100dvw] h-[100dvh] transition-opacity duration-500 ${isImageLoaded ? "opacity-100" : "opacity-0"} ${isDragging ? "cursor-grabbing" : "cursor-grab"} touch-none` }), _jsxs("div", { className: "absolute left-2 flex items-center gap-2 opacity-0 hover:opacity-100 transition-opacity duration-200 transition-all duration-300 ease-in-out", style: { bottom: `${controlsBottomOffset}px` }, children: [_jsx(Button, { onClick: (e) => {
|
|
319
|
+
e.stopPropagation();
|
|
320
|
+
setRotation((prev) => (prev - 90) % 360);
|
|
321
|
+
}, className: "h-8 w-8 bg-background/90 backdrop-blur-sm border border-border/50 flex items-center justify-center hover:bg-primary/20 transition-all duration-200", title: "Rotate Counter-clockwise", children: _jsx(RotateCcw, { className: "w-4 h-4 text-muted-foreground" }) }), _jsx(Button, { onClick: (e) => {
|
|
322
|
+
e.stopPropagation();
|
|
323
|
+
setRotation((prev) => (prev + 90) % 360);
|
|
324
|
+
}, className: "h-8 w-8 bg-background/90 backdrop-blur-sm border border-border/50 flex items-center justify-center hover:bg-primary/20 transition-all duration-200", title: "Rotate Clockwise", children: _jsx(RotateCw, { className: "w-4 h-4 text-muted-foreground" }) })] }), _jsxs("div", { className: "absolute right-2 flex items-center gap-2 transition-all duration-300 ease-in-out", style: { bottom: `${controlsBottomOffset}px` }, children: [actions.map((action, idx) => (_jsx(Button, { onClick: (e) => {
|
|
325
|
+
e.stopPropagation();
|
|
326
|
+
action.onClick();
|
|
327
|
+
}, className: "h-8 w-8 bg-background/90 backdrop-blur-sm border border-border/50 flex items-center justify-center hover:bg-primary/20 transition-all duration-200", title: action.label, children: action.icon }, idx))), _jsxs("div", { className: "h-8 ring-1 ring-foreground/10 bg-background/90 backdrop-blur-sm px-3 py-1.5 text-xs text-muted-foreground pointer-events-none border border-border/50 transition-opacity duration-0 items-center justify-center flex", children: [Math.round(zoom * 100), "%"] }), _jsxs("div", { className: "relative", children: [_jsx("div", { onMouseEnter: () => setShowHelp(true), onMouseLeave: () => setShowHelp(false), className: "w-8 h-8 ring-1 ring-foreground/10 bg-background/90 backdrop-blur-sm border border-border/50 flex items-center justify-center cursor-help transition-all duration-0 hover:bg-primary/20", children: _jsx("span", { className: "text-xs text-muted-foreground font-medium", children: "?" }) }), showHelp && (_jsx("div", { className: "absolute bottom-full right-0 mb-2 w-64 bg-background/95 backdrop-blur-sm border border-border p-3 text-xs text-muted-foreground shadow-lg", children: _jsxs("div", { className: "space-y-1", children: [_jsxs("div", { children: [_jsx("span", { className: "text-foreground", children: "Scroll/Pinch:" }), " Zoom in/out"] }), _jsxs("div", { children: [_jsx("span", { className: "text-foreground", children: "Drag:" }), " Pan around image"] }), _jsxs("div", { children: [_jsx("span", { className: "text-foreground", children: "Double-click:" }), " Reset view"] }), _jsxs("div", { children: [_jsx("span", { className: "text-foreground", children: "Escape:" }), " Close dialog"] })] }) }))] })] })] }));
|
|
223
328
|
};
|
|
224
|
-
//# sourceMappingURL=PannableImage.js.map
|
|
329
|
+
//# sourceMappingURL=PannableImage.js.map
|