@embeddr/react-ui 0.1.2 → 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.
Files changed (271) hide show
  1. package/LICENSE.md +164 -164
  2. package/README.md +43 -10
  3. package/dist/context/EmbeddrContext.d.ts +8 -0
  4. package/dist/context/EmbeddrContext.d.ts.map +1 -0
  5. package/dist/context/EmbeddrContext.js +14 -0
  6. package/dist/context/EmbeddrContext.js.map +1 -0
  7. package/dist/context/ImageDialogContext.d.ts +1 -2
  8. package/dist/context/ImageDialogContext.d.ts.map +1 -1
  9. package/dist/context/ImageDialogContext.js +3 -14
  10. package/dist/context/ImageDialogContext.js.map +1 -1
  11. package/dist/context/index.d.ts +3 -0
  12. package/dist/context/index.d.ts.map +1 -0
  13. package/dist/context/index.js +3 -0
  14. package/dist/context/index.js.map +1 -0
  15. package/dist/hooks/index.d.ts +4 -0
  16. package/dist/hooks/index.d.ts.map +1 -0
  17. package/dist/hooks/index.js +4 -0
  18. package/dist/hooks/index.js.map +1 -0
  19. package/dist/hooks/useExternalNav.d.ts +1 -1
  20. package/dist/hooks/useExternalNav.d.ts.map +1 -1
  21. package/dist/hooks/useExternalNav.js +8 -11
  22. package/dist/hooks/useExternalNav.js.map +1 -1
  23. package/dist/hooks/useImageDialog.d.ts +1 -1
  24. package/dist/hooks/useImageDialog.d.ts.map +1 -1
  25. package/dist/hooks/useImageDialog.js +10 -0
  26. package/dist/hooks/useImageDialog.js.map +1 -0
  27. package/dist/hooks/useLocalStorage.d.ts +2 -0
  28. package/dist/hooks/useLocalStorage.d.ts.map +1 -0
  29. package/dist/hooks/useLocalStorage.js +37 -0
  30. package/dist/hooks/useLocalStorage.js.map +1 -0
  31. package/dist/index.d.ts +6 -33
  32. package/dist/index.d.ts.map +1 -1
  33. package/dist/index.js +7 -125
  34. package/dist/index.js.map +1 -1
  35. package/dist/lib/utils.d.ts +1 -1
  36. package/dist/lib/utils.d.ts.map +1 -1
  37. package/dist/lib/utils.js +5 -8
  38. package/dist/lib/utils.js.map +1 -1
  39. package/dist/providers/{ExternalNav.d.ts → ExternalNavProvider.d.ts} +1 -1
  40. package/dist/providers/ExternalNavProvider.d.ts.map +1 -0
  41. package/dist/providers/ExternalNavProvider.js +26 -0
  42. package/dist/providers/ExternalNavProvider.js.map +1 -0
  43. package/dist/providers/ImageDialogProvider.d.ts.map +1 -1
  44. package/dist/providers/ImageDialogProvider.js +157 -132
  45. package/dist/providers/ImageDialogProvider.js.map +1 -1
  46. package/dist/providers/index.d.ts +3 -0
  47. package/dist/providers/index.d.ts.map +1 -0
  48. package/dist/providers/index.js +3 -0
  49. package/dist/providers/index.js.map +1 -0
  50. package/dist/types/domain.d.ts +73 -0
  51. package/dist/types/domain.d.ts.map +1 -0
  52. package/dist/types/domain.js +2 -0
  53. package/dist/types/domain.js.map +1 -0
  54. package/dist/types/gallery.d.ts +1 -0
  55. package/dist/types/gallery.d.ts.map +1 -1
  56. package/dist/types/gallery.js +2 -0
  57. package/dist/types/gallery.js.map +1 -0
  58. package/dist/types/index.d.ts +4 -0
  59. package/dist/types/index.d.ts.map +1 -0
  60. package/dist/types/index.js +4 -0
  61. package/dist/types/index.js.map +1 -0
  62. package/dist/types/plugin.d.ts +94 -0
  63. package/dist/types/plugin.d.ts.map +1 -0
  64. package/dist/types/plugin.js +2 -0
  65. package/dist/types/plugin.js.map +1 -0
  66. package/dist/ui/accordion.js +15 -62
  67. package/dist/ui/accordion.js.map +1 -1
  68. package/dist/ui/aspect-ratio.d.ts.map +1 -1
  69. package/dist/ui/aspect-ratio.js +8 -0
  70. package/dist/ui/aspect-ratio.js.map +1 -0
  71. package/dist/ui/avatar.js +12 -49
  72. package/dist/ui/avatar.js.map +1 -1
  73. package/dist/ui/badge.d.ts +3 -3
  74. package/dist/ui/badge.d.ts.map +1 -1
  75. package/dist/ui/badge.js +20 -37
  76. package/dist/ui/badge.js.map +1 -1
  77. package/dist/ui/breadcrumb.js +29 -0
  78. package/dist/ui/breadcrumb.js.map +1 -0
  79. package/dist/ui/button.d.ts +4 -4
  80. package/dist/ui/button.d.ts.map +1 -1
  81. package/dist/ui/button.js +33 -53
  82. package/dist/ui/button.js.map +1 -1
  83. package/dist/ui/card.js +19 -96
  84. package/dist/ui/card.js.map +1 -1
  85. package/dist/ui/checkbox.js +10 -0
  86. package/dist/ui/checkbox.js.map +1 -0
  87. package/dist/ui/context-menu.d.ts +28 -0
  88. package/dist/ui/context-menu.d.ts.map +1 -0
  89. package/dist/ui/context-menu.js +34 -0
  90. package/dist/ui/context-menu.js.map +1 -0
  91. package/dist/ui/dialog.d.ts.map +1 -1
  92. package/dist/ui/dialog.js +27 -128
  93. package/dist/ui/dialog.js.map +1 -1
  94. package/dist/ui/draggable-panel.d.ts +47 -0
  95. package/dist/ui/draggable-panel.d.ts.map +1 -0
  96. package/dist/ui/draggable-panel.js +178 -0
  97. package/dist/ui/draggable-panel.js.map +1 -0
  98. package/dist/ui/dropdown-menu.js +37 -220
  99. package/dist/ui/dropdown-menu.js.map +1 -1
  100. package/dist/ui/index.d.ts +31 -0
  101. package/dist/ui/index.d.ts.map +1 -0
  102. package/dist/ui/index.js +31 -0
  103. package/dist/ui/index.js.map +1 -0
  104. package/dist/ui/input-group.d.ts +6 -6
  105. package/dist/ui/input-group.d.ts.map +1 -1
  106. package/dist/ui/input-group.js +49 -138
  107. package/dist/ui/input-group.js.map +1 -1
  108. package/dist/ui/input.js +7 -22
  109. package/dist/ui/input.js.map +1 -1
  110. package/dist/ui/label.js +8 -23
  111. package/dist/ui/label.js.map +1 -1
  112. package/dist/ui/lightbox/ComparisonSlider.d.ts +7 -0
  113. package/dist/ui/lightbox/ComparisonSlider.d.ts.map +1 -0
  114. package/dist/ui/lightbox/ComparisonSlider.js +62 -0
  115. package/dist/ui/lightbox/ComparisonSlider.js.map +1 -0
  116. package/dist/ui/lightbox/GalleryPicker.js +15 -61
  117. package/dist/ui/lightbox/GalleryPicker.js.map +1 -1
  118. package/dist/ui/lightbox/ImageThumbnailStrip.d.ts.map +1 -1
  119. package/dist/ui/lightbox/ImageThumbnailStrip.js +24 -94
  120. package/dist/ui/lightbox/ImageThumbnailStrip.js.map +1 -1
  121. package/dist/ui/lightbox/LightboxViewer.d.ts.map +1 -1
  122. package/dist/ui/lightbox/LightboxViewer.js +50 -112
  123. package/dist/ui/lightbox/LightboxViewer.js.map +1 -1
  124. package/dist/ui/lightbox/MediaCanvas.d.ts +13 -0
  125. package/dist/ui/lightbox/MediaCanvas.d.ts.map +1 -0
  126. package/dist/ui/lightbox/MediaCanvas.js +18 -0
  127. package/dist/ui/lightbox/MediaCanvas.js.map +1 -0
  128. package/dist/ui/lightbox/PannableImage.d.ts +3 -2
  129. package/dist/ui/lightbox/PannableImage.d.ts.map +1 -1
  130. package/dist/ui/lightbox/PannableImage.js +327 -222
  131. package/dist/ui/lightbox/PannableImage.js.map +1 -1
  132. package/dist/ui/lightbox/PannableVideo.d.ts +9 -0
  133. package/dist/ui/lightbox/PannableVideo.d.ts.map +1 -0
  134. package/dist/ui/lightbox/PannableVideo.js +183 -0
  135. package/dist/ui/lightbox/PannableVideo.js.map +1 -0
  136. package/dist/ui/lightbox/index.d.ts +8 -0
  137. package/dist/ui/lightbox/index.d.ts.map +1 -0
  138. package/dist/ui/lightbox/index.js +8 -0
  139. package/dist/ui/lightbox/index.js.map +1 -0
  140. package/dist/ui/menubar.js +55 -0
  141. package/dist/ui/menubar.js.map +1 -0
  142. package/dist/ui/progress.js +8 -32
  143. package/dist/ui/progress.js.map +1 -1
  144. package/dist/ui/resizable.js +13 -47
  145. package/dist/ui/resizable.js.map +1 -1
  146. package/dist/ui/scroll-area.js +11 -65
  147. package/dist/ui/scroll-area.js.map +1 -1
  148. package/dist/ui/select.js +29 -172
  149. package/dist/ui/select.js.map +1 -1
  150. package/dist/ui/separator.js +8 -27
  151. package/dist/ui/separator.js.map +1 -1
  152. package/dist/ui/skeleton.js +6 -17
  153. package/dist/ui/skeleton.js.map +1 -1
  154. package/dist/ui/slider.js +13 -63
  155. package/dist/ui/slider.js.map +1 -1
  156. package/dist/ui/sonner.d.ts.map +1 -1
  157. package/dist/ui/sonner.js +24 -40
  158. package/dist/ui/sonner.js.map +1 -1
  159. package/dist/ui/spinner.d.ts.map +1 -1
  160. package/dist/ui/spinner.js +7 -20
  161. package/dist/ui/spinner.js.map +1 -1
  162. package/dist/ui/switch.js +8 -32
  163. package/dist/ui/switch.js.map +1 -1
  164. package/dist/ui/table.js +29 -0
  165. package/dist/ui/table.js.map +1 -0
  166. package/dist/ui/tabs.js +15 -68
  167. package/dist/ui/tabs.js.map +1 -1
  168. package/dist/ui/textarea.js +7 -19
  169. package/dist/ui/textarea.js.map +1 -1
  170. package/dist/ui/tooltip.js +14 -53
  171. package/dist/ui/tooltip.js.map +1 -1
  172. package/package.json +29 -12
  173. package/dist/node_modules/.pnpm/@floating-ui_core@1.7.3/node_modules/@floating-ui/core/dist/floating-ui.core.js +0 -528
  174. package/dist/node_modules/.pnpm/@floating-ui_core@1.7.3/node_modules/@floating-ui/core/dist/floating-ui.core.js.map +0 -1
  175. package/dist/node_modules/.pnpm/@floating-ui_dom@1.7.4/node_modules/@floating-ui/dom/dist/floating-ui.dom.js +0 -403
  176. package/dist/node_modules/.pnpm/@floating-ui_dom@1.7.4/node_modules/@floating-ui/dom/dist/floating-ui.dom.js.map +0 -1
  177. 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
  178. 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
  179. package/dist/node_modules/.pnpm/@floating-ui_utils@0.2.10/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.js +0 -137
  180. 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
  181. package/dist/node_modules/.pnpm/@floating-ui_utils@0.2.10/node_modules/@floating-ui/utils/dist/floating-ui.utils.js +0 -131
  182. package/dist/node_modules/.pnpm/@floating-ui_utils@0.2.10/node_modules/@floating-ui/utils/dist/floating-ui.utils.js.map +0 -1
  183. package/dist/node_modules/.pnpm/@radix-ui_primitive@1.1.3/node_modules/@radix-ui/primitive/dist/index.js +0 -10
  184. package/dist/node_modules/.pnpm/@radix-ui_primitive@1.1.3/node_modules/@radix-ui/primitive/dist/index.js.map +0 -1
  185. 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
  186. 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
  187. 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
  188. 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
  189. 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
  190. 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
  191. 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
  192. 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
  193. 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
  194. 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
  195. 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
  196. 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
  197. 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
  198. 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
  199. 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
  200. 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
  201. 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
  202. 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
  203. 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
  204. 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
  205. 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
  206. 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
  207. 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
  208. 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
  209. 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
  210. 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
  211. 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
  212. 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
  213. 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
  214. 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
  215. 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
  216. 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
  217. 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
  218. 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
  219. 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
  220. 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
  221. package/dist/node_modules/.pnpm/class-variance-authority@0.7.1/node_modules/class-variance-authority/dist/index.js +0 -36
  222. package/dist/node_modules/.pnpm/class-variance-authority@0.7.1/node_modules/class-variance-authority/dist/index.js.map +0 -1
  223. package/dist/node_modules/.pnpm/clsx@2.1.1/node_modules/clsx/dist/clsx.js +0 -18
  224. package/dist/node_modules/.pnpm/clsx@2.1.1/node_modules/clsx/dist/clsx.js.map +0 -1
  225. package/dist/node_modules/.pnpm/lucide-react@0.562.0_react@19.2.3/node_modules/lucide-react/dist/esm/Icon.js +0 -36
  226. 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
  227. package/dist/node_modules/.pnpm/lucide-react@0.562.0_react@19.2.3/node_modules/lucide-react/dist/esm/createLucideIcon.js +0 -22
  228. 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
  229. package/dist/node_modules/.pnpm/lucide-react@0.562.0_react@19.2.3/node_modules/lucide-react/dist/esm/defaultAttributes.js +0 -15
  230. 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
  231. 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
  232. 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
  233. 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
  234. 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
  235. 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
  236. 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
  237. 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
  238. 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
  239. 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
  240. 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
  241. 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
  242. 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
  243. 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
  244. 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
  245. 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
  246. 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
  247. 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
  248. 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
  249. 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
  250. 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
  251. 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
  252. 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
  253. 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
  254. 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
  255. 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
  256. 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
  257. 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
  258. 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
  259. 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
  260. 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
  261. 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
  262. 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
  263. 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
  264. 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
  265. package/dist/node_modules/.pnpm/tailwind-merge@3.4.0/node_modules/tailwind-merge/dist/bundle-mjs.js +0 -2766
  266. package/dist/node_modules/.pnpm/tailwind-merge@3.4.0/node_modules/tailwind-merge/dist/bundle-mjs.js.map +0 -1
  267. package/dist/providers/ExternalNav.d.ts.map +0 -1
  268. package/dist/providers/ExternalNav.js +0 -55
  269. package/dist/providers/ExternalNav.js.map +0 -1
  270. package/dist/providers/ImageDialog.d.ts +0 -2
  271. package/dist/providers/ImageDialog.d.ts.map +0 -1
@@ -1,224 +1,329 @@
1
- import { jsxs as a, jsx as i } from "react/jsx-runtime";
2
- import { useRef as v, useState as d, useCallback as c, useEffect as N } from "react";
3
- import { Button as H } from "../button.js";
4
- import se from "../../node_modules/.pnpm/lucide-react@0.562.0_react@19.2.3/node_modules/lucide-react/dist/esm/icons/rotate-ccw.js";
5
- import ce from "../../node_modules/.pnpm/lucide-react@0.562.0_react@19.2.3/node_modules/lucide-react/dist/esm/icons/rotate-cw.js";
6
- const me = ({
7
- src: q,
8
- className: V,
9
- isOpen: W,
10
- actions: _ = [],
11
- controlsBottomOffset: B = 16
12
- }) => {
13
- const s = v(null), u = v(null), I = v(null), [b, P] = d(!1), [j, Y] = d(1), h = v(1), [U, x] = d({ x: 0, y: 0 }), m = v({ x: 0, y: 0 }), [G, C] = d(0), $ = v(0), [g, X] = d({ x: 0, y: 0 }), [ee, J] = d(!1), [te, K] = d(!1), D = c(() => {
14
- if (!s.current || !I.current) return;
15
- const e = s.current, t = e.getContext("2d");
16
- if (!t || e.width === 0 || e.height === 0) return;
17
- const n = window.devicePixelRatio || 1, r = I.current;
18
- t.clearRect(0, 0, e.width, e.height);
19
- const o = $.current, l = o / 90 % 2 !== 0, L = e.width / e.height, p = l ? r.height / r.width : r.width / r.height;
20
- let y = e.width, k = e.height;
21
- p > L ? k = e.width / p : y = e.height * p;
22
- const z = h.current, R = m.current, M = (l ? k : y) * z, S = (l ? y : k) * z;
23
- t.save(), t.translate(e.width / 2 + R.x * n, e.height / 2 + R.y * n), t.rotate(o * Math.PI / 180), t.drawImage(r, -M / 2, -S / 2, M, S), t.restore();
24
- }, []), w = c(() => {
25
- if (!u.current || !s.current) return;
26
- const e = window.devicePixelRatio || 1;
27
- let t = 0;
28
- const n = 60, r = () => {
29
- if (!u.current || !s.current) return;
30
- const o = u.current.getBoundingClientRect();
31
- o.width > 0 && o.height > 0 ? (s.current.width = o.width * e, s.current.height = o.height * e, s.current.style.width = `${o.width}px`, s.current.style.height = `${o.height}px`, D()) : t < n && (t++, requestAnimationFrame(r));
32
- };
33
- requestAnimationFrame(r);
34
- }, [D]), f = c(() => {
35
- w();
36
- }, [w]);
37
- N(() => {
38
- W && (setTimeout(w, 50), setTimeout(w, 200));
39
- }, [W, w]), N(() => {
40
- J(!1);
41
- const e = new Image();
42
- e.src = q, e.onload = () => {
43
- I.current = e, J(!0), h.current = 1, Y(1), m.current = { x: 0, y: 0 }, x({ x: 0, y: 0 }), $.current = 0, C(0), f();
44
- };
45
- }, [q, f]), N(() => {
46
- window.addEventListener("resize", f);
47
- const e = new ResizeObserver(() => f());
48
- return u.current && e.observe(u.current), () => {
49
- window.removeEventListener("resize", f), e.disconnect();
50
- };
51
- }, [f]), N(() => {
52
- h.current = j, m.current = U, $.current = G, requestAnimationFrame(D);
53
- }, [j, U, G, D]);
54
- const A = c((e) => {
55
- e.preventDefault();
56
- const t = window.devicePixelRatio || 1, n = s.current;
57
- if (!n) return;
58
- const r = n.getBoundingClientRect(), o = (e.clientX - r.left) * t, l = (e.clientY - r.top) * t, L = n.width / 2, p = n.height / 2, y = o - L - m.current.x * t, k = l - p - m.current.y * t, z = -Math.sign(e.deltaY) * 0.1, R = Math.max(0.1, Math.min(10, h.current + z)), M = R / h.current, S = (o - L - y * M) / t, ie = (l - p - k * M) / t;
59
- Y(R), x({ x: S, y: ie });
60
- }, []), [E, O] = d(null), T = c((e) => {
61
- if (e.touches.length === 2) {
62
- e.preventDefault();
63
- const t = e.touches[0], n = e.touches[1], r = Math.hypot(t.clientX - n.clientX, t.clientY - n.clientY), o = (t.clientX + n.clientX) / 2, l = (t.clientY + n.clientY) / 2;
64
- O({
65
- isPinching: !0,
66
- initialDistance: r,
67
- initialZoom: h.current,
68
- initialPan: { ...m.current },
69
- midPoint: { x: o, y: l }
70
- });
71
- } else if (e.touches.length === 1) {
72
- const t = e.touches[0];
73
- X({ x: t.clientX, y: t.clientY }), P(!0);
74
- }
75
- }, []), Z = c(
76
- (e) => {
77
- if (e.touches.length === 2 && E?.isPinching) {
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 t = e.touches[0], n = e.touches[1], o = Math.hypot(
80
- t.clientX - n.clientX,
81
- t.clientY - n.clientY
82
- ) / E.initialDistance;
83
- Y(Math.max(0.1, Math.min(10, E.initialZoom * o)));
84
- } else if (e.touches.length === 1 && b) {
85
- e.preventDefault();
86
- const t = e.touches[0], n = t.clientX - g.x, r = t.clientY - g.y;
87
- x((o) => ({ x: o.x + n, y: o.y + r })), X({ x: t.clientX, y: t.clientY });
88
- }
89
- },
90
- [E, b, g]
91
- ), F = c(() => {
92
- O(null), P(!1);
93
- }, []), ne = c((e) => {
94
- X({ x: e.clientX, y: e.clientY }), P(!0);
95
- }, []), re = c(
96
- (e) => {
97
- if (b) {
98
- const t = e.clientX - g.x, n = e.clientY - g.y;
99
- x((r) => ({ x: r.x + t, y: r.y + n })), X({ x: e.clientX, y: e.clientY });
100
- }
101
- },
102
- [b, g]
103
- ), Q = c(() => {
104
- P(!1);
105
- }, []), oe = c(() => {
106
- Y(1), x({ x: 0, y: 0 }), C(0);
107
- }, []);
108
- return N(() => {
109
- const e = s.current;
110
- if (e)
111
- return e.addEventListener("wheel", A, { passive: !1 }), e.addEventListener("touchstart", T, { passive: !1 }), e.addEventListener("touchmove", Z, { passive: !1 }), e.addEventListener("touchend", F), () => {
112
- e.removeEventListener("wheel", A), e.removeEventListener("touchstart", T), e.removeEventListener("touchmove", Z), e.removeEventListener("touchend", F);
113
- };
114
- }, [A, T, Z, F]), /* @__PURE__ */ a(
115
- "div",
116
- {
117
- ref: u,
118
- className: `${V} relative h-full w-full overflow-hidden`,
119
- children: [
120
- /* @__PURE__ */ i(
121
- "canvas",
122
- {
123
- ref: s,
124
- onMouseDown: ne,
125
- onMouseMove: re,
126
- onMouseUp: Q,
127
- onMouseLeave: Q,
128
- onDoubleClick: oe,
129
- className: `w-[100dvw] h-[100dvh] transition-opacity duration-200 ${ee ? "opacity-100" : "opacity-0"} ${b ? "cursor-grabbing" : "cursor-grab"} touch-none`
130
- }
131
- ),
132
- /* @__PURE__ */ a(
133
- "div",
134
- {
135
- 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",
136
- style: { bottom: `${B}px` },
137
- children: [
138
- /* @__PURE__ */ i(
139
- H,
140
- {
141
- onClick: (e) => {
142
- e.stopPropagation(), C((t) => (t - 90) % 360);
143
- },
144
- 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",
145
- title: "Rotate Counter-clockwise",
146
- children: /* @__PURE__ */ i(se, { className: "w-4 h-4 text-muted-foreground" })
147
- }
148
- ),
149
- /* @__PURE__ */ i(
150
- H,
151
- {
152
- onClick: (e) => {
153
- e.stopPropagation(), C((t) => (t + 90) % 360);
154
- },
155
- 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",
156
- title: "Rotate Clockwise",
157
- children: /* @__PURE__ */ i(ce, { className: "w-4 h-4 text-muted-foreground" })
158
- }
159
- )
160
- ]
161
- }
162
- ),
163
- /* @__PURE__ */ a(
164
- "div",
165
- {
166
- className: "absolute right-2 flex items-center gap-2 transition-all duration-300 ease-in-out",
167
- style: { bottom: `${B}px` },
168
- children: [
169
- _.map((e, t) => /* @__PURE__ */ i(
170
- H,
171
- {
172
- onClick: (n) => {
173
- n.stopPropagation(), e.onClick();
174
- },
175
- 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",
176
- title: e.label,
177
- children: e.icon
178
- },
179
- t
180
- )),
181
- /* @__PURE__ */ a("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: [
182
- Math.round(j * 100),
183
- "%"
184
- ] }),
185
- /* @__PURE__ */ a("div", { className: "relative", children: [
186
- /* @__PURE__ */ i(
187
- "div",
188
- {
189
- onMouseEnter: () => K(!0),
190
- onMouseLeave: () => K(!1),
191
- 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",
192
- children: /* @__PURE__ */ i("span", { className: "text-xs text-muted-foreground font-medium", children: "?" })
193
- }
194
- ),
195
- te && /* @__PURE__ */ i("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: /* @__PURE__ */ a("div", { className: "space-y-1", children: [
196
- /* @__PURE__ */ a("div", { children: [
197
- /* @__PURE__ */ i("span", { className: "text-foreground", children: "Scroll/Pinch:" }),
198
- " Zoom in/out"
199
- ] }),
200
- /* @__PURE__ */ a("div", { children: [
201
- /* @__PURE__ */ i("span", { className: "text-foreground", children: "Drag:" }),
202
- " Pan around image"
203
- ] }),
204
- /* @__PURE__ */ a("div", { children: [
205
- /* @__PURE__ */ i("span", { className: "text-foreground", children: "Double-click:" }),
206
- " Reset view"
207
- ] }),
208
- /* @__PURE__ */ a("div", { children: [
209
- /* @__PURE__ */ i("span", { className: "text-foreground", children: "Escape:" }),
210
- " Close dialog"
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