@instincthub/react-ui 0.1.63 → 0.2.0

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 (194) hide show
  1. package/README.md +43 -3
  2. package/dist/_virtual/_rollupPluginBabelHelpers.js +2 -2
  3. package/dist/node_modules/.pnpm/@tiptap_core@2.27.1_@tiptap_pm@2.27.1/node_modules/@tiptap/core/dist/index.js +1 -1
  4. package/dist/node_modules/.pnpm/@tiptap_core@2.27.1_@tiptap_pm@2.27.1/node_modules/@tiptap/core/dist/index.js.map +1 -1
  5. package/dist/node_modules/.pnpm/@tiptap_react@2.27.1_@tiptap_core@2.27.1_@tiptap_pm@2.27.1__@tiptap_pm@2.27.1_react-dom_3687a02a33de69fe477ccd0d970063c0/node_modules/@tiptap/react/dist/index.js +3 -3
  6. package/dist/node_modules/.pnpm/@tiptap_react@2.27.1_@tiptap_core@2.27.1_@tiptap_pm@2.27.1__@tiptap_pm@2.27.1_react-dom_3687a02a33de69fe477ccd0d970063c0/node_modules/@tiptap/react/dist/index.js.map +1 -1
  7. package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/align-center.js +1 -1
  8. package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/align-center.js.map +1 -1
  9. package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/align-left.js +1 -1
  10. package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/align-left.js.map +1 -1
  11. package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/align-right.js +1 -1
  12. package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/align-right.js.map +1 -1
  13. package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/arrow-down.js +1 -1
  14. package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/arrow-down.js.map +1 -1
  15. package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/arrow-left.js +1 -1
  16. package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/arrow-left.js.map +1 -1
  17. package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/arrow-right.js +1 -1
  18. package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/arrow-right.js.map +1 -1
  19. package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/arrow-up.js +1 -1
  20. package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/arrow-up.js.map +1 -1
  21. package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/ban.js +1 -1
  22. package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/ban.js.map +1 -1
  23. package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/baseline.js +1 -1
  24. package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/baseline.js.map +1 -1
  25. package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/download.js +1 -1
  26. package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/download.js.map +1 -1
  27. package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/file-text.js +1 -1
  28. package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/file-text.js.map +1 -1
  29. package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/film.js +1 -1
  30. package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/film.js.map +1 -1
  31. package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/grip-horizontal.js +1 -1
  32. package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/grip-horizontal.js.map +1 -1
  33. package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/heading-1.js +1 -1
  34. package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/heading-1.js.map +1 -1
  35. package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/heading.js +1 -1
  36. package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/heading.js.map +1 -1
  37. package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/highlighter.js +1 -1
  38. package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/highlighter.js.map +1 -1
  39. package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/lightbulb.js +1 -1
  40. package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/lightbulb.js.map +1 -1
  41. package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/link-2.js +1 -1
  42. package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/link-2.js.map +1 -1
  43. package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/monitor-play.js +1 -1
  44. package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/monitor-play.js.map +1 -1
  45. package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/mouse-pointer-click.js +1 -1
  46. package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/mouse-pointer-click.js.map +1 -1
  47. package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/music.js +1 -1
  48. package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/music.js.map +1 -1
  49. package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/paint-bucket.js +1 -1
  50. package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/paint-bucket.js.map +1 -1
  51. package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/palette.js +1 -1
  52. package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/palette.js.map +1 -1
  53. package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/panel-left.js +1 -1
  54. package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/panel-left.js.map +1 -1
  55. package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/panel-top.js +1 -1
  56. package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/panel-top.js.map +1 -1
  57. package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/paperclip.js +1 -1
  58. package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/paperclip.js.map +1 -1
  59. package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/refresh-cw.js +1 -1
  60. package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/refresh-cw.js.map +1 -1
  61. package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/remove-formatting.js +1 -1
  62. package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/remove-formatting.js.map +1 -1
  63. package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/settings-2.js +1 -1
  64. package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/settings-2.js.map +1 -1
  65. package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/square-chevron-right.js +1 -1
  66. package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/square-chevron-right.js.map +1 -1
  67. package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/type.js +1 -1
  68. package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/type.js.map +1 -1
  69. package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/upload.js +1 -1
  70. package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/upload.js.map +1 -1
  71. package/dist/src/assets/css/ui/ihub-text-editor-blocks.css +951 -0
  72. package/dist/src/assets/css/ui/ui-index.css +1 -0
  73. package/dist/src/components/ui/ComponentLists.js +1 -1
  74. package/dist/src/components/ui/editor/ihub-editor/IHubTextEditor.js +1 -1
  75. package/dist/src/components/ui/editor/ihub-editor/blocks/BlockHandle.js +2 -0
  76. package/dist/src/components/ui/editor/ihub-editor/blocks/BlockHandle.js.map +1 -0
  77. package/dist/src/components/ui/editor/ihub-editor/blocks/BlockKeymap.js +2 -0
  78. package/dist/src/components/ui/editor/ihub-editor/blocks/BlockKeymap.js.map +1 -0
  79. package/dist/src/components/ui/editor/ihub-editor/blocks/blockLayout.js +2 -0
  80. package/dist/src/components/ui/editor/ihub-editor/blocks/blockLayout.js.map +1 -0
  81. package/dist/src/components/ui/editor/ihub-editor/blocks/blockOps.js +2 -0
  82. package/dist/src/components/ui/editor/ihub-editor/blocks/blockOps.js.map +1 -0
  83. package/dist/src/components/ui/editor/ihub-editor/blocks/useBlockDrag.js +2 -0
  84. package/dist/src/components/ui/editor/ihub-editor/blocks/useBlockDrag.js.map +1 -0
  85. package/dist/src/components/ui/editor/ihub-editor/components/BubbleToolbar.js +1 -1
  86. package/dist/src/components/ui/editor/ihub-editor/components/ColorPalette.js +2 -0
  87. package/dist/src/components/ui/editor/ihub-editor/components/ColorPalette.js.map +1 -0
  88. package/dist/src/components/ui/editor/ihub-editor/components/FloatingAddButton.js +1 -1
  89. package/dist/src/components/ui/editor/ihub-editor/components/SlashCommandMenu.js +1 -1
  90. package/dist/src/components/ui/editor/ihub-editor/components/TableToolbar.js +1 -1
  91. package/dist/src/components/ui/editor/ihub-editor/components/blocks/ButtonBlockView.js +2 -0
  92. package/dist/src/components/ui/editor/ihub-editor/components/blocks/ButtonBlockView.js.map +1 -0
  93. package/dist/src/components/ui/editor/ihub-editor/components/blocks/CalloutView.js +2 -0
  94. package/dist/src/components/ui/editor/ihub-editor/components/blocks/CalloutView.js.map +1 -0
  95. package/dist/src/components/ui/editor/ihub-editor/components/blocks/SectionBannerView.js +2 -0
  96. package/dist/src/components/ui/editor/ihub-editor/components/blocks/SectionBannerView.js.map +1 -0
  97. package/dist/src/components/ui/editor/ihub-editor/components/blocks/useDismiss.js +2 -0
  98. package/dist/src/components/ui/editor/ihub-editor/components/blocks/useDismiss.js.map +1 -0
  99. package/dist/src/components/ui/editor/ihub-editor/components/commandIcons.js +2 -0
  100. package/dist/src/components/ui/editor/ihub-editor/components/commandIcons.js.map +1 -0
  101. package/dist/src/components/ui/editor/ihub-editor/components/media/MediaBlockView.js +2 -0
  102. package/dist/src/components/ui/editor/ihub-editor/components/media/MediaBlockView.js.map +1 -0
  103. package/dist/src/components/ui/editor/ihub-editor/components/media/MediaPlaceholder.js +2 -0
  104. package/dist/src/components/ui/editor/ihub-editor/components/media/MediaPlaceholder.js.map +1 -0
  105. package/dist/src/components/ui/editor/ihub-editor/components/media/MediaPreview.js +2 -0
  106. package/dist/src/components/ui/editor/ihub-editor/components/media/MediaPreview.js.map +1 -0
  107. package/dist/src/components/ui/editor/ihub-editor/constants.js +1 -1
  108. package/dist/src/components/ui/editor/ihub-editor/constants.js.map +1 -1
  109. package/dist/src/components/ui/editor/ihub-editor/extensions/ButtonBlock.js +2 -0
  110. package/dist/src/components/ui/editor/ihub-editor/extensions/ButtonBlock.js.map +1 -0
  111. package/dist/src/components/ui/editor/ihub-editor/extensions/Callout.js +2 -0
  112. package/dist/src/components/ui/editor/ihub-editor/extensions/Callout.js.map +1 -0
  113. package/dist/src/components/ui/editor/ihub-editor/extensions/MediaBlock.js +2 -0
  114. package/dist/src/components/ui/editor/ihub-editor/extensions/MediaBlock.js.map +1 -0
  115. package/dist/src/components/ui/editor/ihub-editor/extensions/PreserveStyles.js +2 -0
  116. package/dist/src/components/ui/editor/ihub-editor/extensions/PreserveStyles.js.map +1 -0
  117. package/dist/src/components/ui/editor/ihub-editor/extensions/SectionBanner.js +2 -0
  118. package/dist/src/components/ui/editor/ihub-editor/extensions/SectionBanner.js.map +1 -0
  119. package/dist/src/components/ui/editor/ihub-editor/extensions/TableExtensions.js +2 -0
  120. package/dist/src/components/ui/editor/ihub-editor/extensions/TableExtensions.js.map +1 -0
  121. package/dist/src/components/ui/editor/ihub-editor/extensions/ToggleBlock.js +2 -0
  122. package/dist/src/components/ui/editor/ihub-editor/extensions/ToggleBlock.js.map +1 -0
  123. package/dist/src/components/ui/editor/ihub-editor/extensions/colorUtils.js +2 -0
  124. package/dist/src/components/ui/editor/ihub-editor/extensions/colorUtils.js.map +1 -0
  125. package/dist/src/components/ui/editor/ihub-editor/hooks/useIHubEditor.js +1 -1
  126. package/dist/src/components/ui/editor/ihub-editor/hooks/useMediaEmbed.js +1 -1
  127. package/dist/src/components/ui/editor/ihub-editor/hooks/useSurfaceClick.js +2 -0
  128. package/dist/src/components/ui/editor/ihub-editor/hooks/useSurfaceClick.js.map +1 -0
  129. package/dist/src/components/ui/editor/ihub-editor/table/TableControls.js +2 -0
  130. package/dist/src/components/ui/editor/ihub-editor/table/TableControls.js.map +1 -0
  131. package/dist/src/components/ui/editor/ihub-editor/table/TableLineMenu.js +2 -0
  132. package/dist/src/components/ui/editor/ihub-editor/table/TableLineMenu.js.map +1 -0
  133. package/dist/src/components/ui/editor/ihub-editor/table/tableOps.js +2 -0
  134. package/dist/src/components/ui/editor/ihub-editor/table/tableOps.js.map +1 -0
  135. package/dist/src/components/ui/editor/ihub-editor/table/useTableHover.js +2 -0
  136. package/dist/src/components/ui/editor/ihub-editor/table/useTableHover.js.map +1 -0
  137. package/dist/src/components/ui/editor/ihub-editor/types.js +1 -1
  138. package/dist/src/components/ui/editor/ihub-editor/types.js.map +1 -1
  139. package/dist/src/components/ui/editor/ihub-editor/upload/mediaKinds.js +2 -0
  140. package/dist/src/components/ui/editor/ihub-editor/upload/mediaKinds.js.map +1 -0
  141. package/dist/src/components/ui/editor/ihub-editor/upload/s3Direct.js +2 -0
  142. package/dist/src/components/ui/editor/ihub-editor/upload/s3Direct.js.map +1 -0
  143. package/dist/src/components/ui/editor/ihub-editor/upload/uploadFile.js +2 -0
  144. package/dist/src/components/ui/editor/ihub-editor/upload/uploadFile.js.map +1 -0
  145. package/dist/src/components/ui/editor/ihub-editor/upload/uploadRegistry.js +2 -0
  146. package/dist/src/components/ui/editor/ihub-editor/upload/uploadRegistry.js.map +1 -0
  147. package/dist/src/types/components/ui/editor/ihub-editor/IHubTextEditor.d.ts +1 -1
  148. package/dist/src/types/components/ui/editor/ihub-editor/blocks/BlockHandle.d.ts +16 -0
  149. package/dist/src/types/components/ui/editor/ihub-editor/blocks/BlockKeymap.d.ts +11 -0
  150. package/dist/src/types/components/ui/editor/ihub-editor/blocks/blockLayout.d.ts +37 -0
  151. package/dist/src/types/components/ui/editor/ihub-editor/blocks/blockOps.d.ts +45 -0
  152. package/dist/src/types/components/ui/editor/ihub-editor/blocks/useBlockDrag.d.ts +30 -0
  153. package/dist/src/types/components/ui/editor/ihub-editor/components/ColorPalette.d.ts +14 -0
  154. package/dist/src/types/components/ui/editor/ihub-editor/components/FloatingAddButton.d.ts +3 -2
  155. package/dist/src/types/components/ui/editor/ihub-editor/components/blocks/ButtonBlockView.d.ts +2 -0
  156. package/dist/src/types/components/ui/editor/ihub-editor/components/blocks/CalloutView.d.ts +2 -0
  157. package/dist/src/types/components/ui/editor/ihub-editor/components/blocks/SectionBannerView.d.ts +2 -0
  158. package/dist/src/types/components/ui/editor/ihub-editor/components/blocks/useDismiss.d.ts +3 -0
  159. package/dist/src/types/components/ui/editor/ihub-editor/components/commandIcons.d.ts +3 -0
  160. package/dist/src/types/components/ui/editor/ihub-editor/components/media/MediaBlockView.d.ts +6 -0
  161. package/dist/src/types/components/ui/editor/ihub-editor/components/media/MediaPlaceholder.d.ts +10 -0
  162. package/dist/src/types/components/ui/editor/ihub-editor/components/media/MediaPreview.d.ts +10 -0
  163. package/dist/src/types/components/ui/editor/ihub-editor/constants.d.ts +5 -1
  164. package/dist/src/types/components/ui/editor/ihub-editor/extensions/ButtonBlock.d.ts +21 -0
  165. package/dist/src/types/components/ui/editor/ihub-editor/extensions/Callout.d.ts +20 -0
  166. package/dist/src/types/components/ui/editor/ihub-editor/extensions/MediaBlock.d.ts +39 -0
  167. package/dist/src/types/components/ui/editor/ihub-editor/extensions/PreserveStyles.d.ts +6 -0
  168. package/dist/src/types/components/ui/editor/ihub-editor/extensions/SectionBanner.d.ts +15 -0
  169. package/dist/src/types/components/ui/editor/ihub-editor/extensions/TableExtensions.d.ts +14 -0
  170. package/dist/src/types/components/ui/editor/ihub-editor/extensions/ToggleBlock.d.ts +13 -0
  171. package/dist/src/types/components/ui/editor/ihub-editor/extensions/colorUtils.d.ts +14 -0
  172. package/dist/src/types/components/ui/editor/ihub-editor/hooks/useIHubEditor.d.ts +8 -2
  173. package/dist/src/types/components/ui/editor/ihub-editor/hooks/useMediaEmbed.d.ts +2 -1
  174. package/dist/src/types/components/ui/editor/ihub-editor/hooks/useSurfaceClick.d.ts +28 -0
  175. package/dist/src/types/components/ui/editor/ihub-editor/index.d.ts +1 -1
  176. package/dist/src/types/components/ui/editor/ihub-editor/table/TableControls.d.ts +9 -0
  177. package/dist/src/types/components/ui/editor/ihub-editor/table/TableLineMenu.d.ts +25 -0
  178. package/dist/src/types/components/ui/editor/ihub-editor/table/tableOps.d.ts +25 -0
  179. package/dist/src/types/components/ui/editor/ihub-editor/table/useTableHover.d.ts +25 -0
  180. package/dist/src/types/components/ui/editor/ihub-editor/types.d.ts +83 -2
  181. package/dist/src/types/components/ui/editor/ihub-editor/upload/mediaKinds.d.ts +32 -0
  182. package/dist/src/types/components/ui/editor/ihub-editor/upload/s3Direct.d.ts +5 -0
  183. package/dist/src/types/components/ui/editor/ihub-editor/upload/uploadFile.d.ts +19 -0
  184. package/dist/src/types/components/ui/editor/ihub-editor/upload/uploadRegistry.d.ts +15 -0
  185. package/dist/src/types/index.d.ts +1 -1
  186. package/dist/tsconfig.build.tsbuildinfo +1 -1
  187. package/package.json +8 -4
  188. package/dist/src/components/ui/editor/ihub-editor/extensions/ImageWithCaption.js +0 -2
  189. package/dist/src/components/ui/editor/ihub-editor/extensions/ImageWithCaption.js.map +0 -1
  190. package/dist/src/components/ui/editor/ihub-editor/hooks/useImageUpload.js +0 -2
  191. package/dist/src/components/ui/editor/ihub-editor/hooks/useImageUpload.js.map +0 -1
  192. package/dist/src/types/components/ui/editor/ihub-editor/components/ImageBlock.d.ts +0 -12
  193. package/dist/src/types/components/ui/editor/ihub-editor/extensions/ImageWithCaption.d.ts +0 -14
  194. package/dist/src/types/components/ui/editor/ihub-editor/hooks/useImageUpload.d.ts +0 -11
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BlockHandle.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../../../../node_modules/.pnpm/@tiptap_core@2.27.1_@tiptap_pm@2.27.1/node_modules/@tiptap/core/dist/index.js"),r=require("../../../../../../node_modules/.pnpm/prosemirror-state@1.4.4/node_modules/prosemirror-state/dist/index.js"),o=require("../../../../../../node_modules/.pnpm/prosemirror-view@1.41.3/node_modules/prosemirror-view/dist/index.js"),t=require("./blockOps.js"),n=new r.PluginKey("ihubBlockDrag"),i=e.Extension.create({name:"blockKeymap",addKeyboardShortcuts:function(){var e=this,r=function(r){return function(){var o=e.editor,n=o.state,i=o.view,u=t.movableBlockAt(n);if(null===u)return!1;var d=t.moveBlockSibling(n,u,r);return!d||(i.dispatch(d),!0)}};return{"Mod-Shift-ArrowUp":r(-1),"Mod-Shift-ArrowDown":r(1)}},addProseMirrorPlugins:function(){return[new r.Plugin({key:n,state:{init:function(){return null},apply:function(e,r){var o=e.getMeta(n);return void 0!==o?o:null===r?null:e.mapping.map(r)}},props:{decorations:function(e){var r=n.getState(e);if(null==r)return null;var t=e.doc.nodeAt(r);return t?o.DecorationSet.create(e.doc,[o.Decoration.node(r,r+t.nodeSize,{class:"ihub-te-block-dragging"})]):null}}})]}});exports.blockDragKey=n,exports.default=i;
2
+ //# sourceMappingURL=BlockKeymap.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BlockKeymap.js","sources":["../../../../../../../src/components/ui/editor/ihub-editor/blocks/BlockKeymap.ts"],"sourcesContent":["import { Extension } from \"@tiptap/core\";\nimport { Plugin, PluginKey } from \"@tiptap/pm/state\";\nimport { Decoration, DecorationSet } from \"@tiptap/pm/view\";\nimport { moveBlockSibling, movableBlockAt } from \"./blockOps\";\n\n/** Meta: the position of the block being dragged, or null when the drag ends. */\nexport const blockDragKey = new PluginKey<number | null>(\"ihubBlockDrag\");\n\n/**\n * ⌘⇧↑ / ⌘⇧↓ (Ctrl on Windows) move the current block within its parent (the\n * page, or a banner / callout / toggle), as in Notion,\n * and a decoration dims the block while it is being dragged. A decoration is\n * needed because ProseMirror redraws its own DOM and would drop a class added directly.\n */\nconst BlockKeymap = Extension.create({\n name: \"blockKeymap\",\n\n addKeyboardShortcuts() {\n const move = (direction: -1 | 1) => () => {\n const { state, view } = this.editor;\n const pos = movableBlockAt(state);\n if (pos === null) return false;\n const tr = moveBlockSibling(state, pos, direction);\n if (!tr) return true; // already at the edge: swallow so the caret doesn't jump\n view.dispatch(tr);\n return true;\n };\n return {\n \"Mod-Shift-ArrowUp\": move(-1),\n \"Mod-Shift-ArrowDown\": move(1),\n };\n },\n\n addProseMirrorPlugins() {\n return [\n new Plugin<number | null>({\n key: blockDragKey,\n state: {\n init: () => null,\n apply: (tr, value) => {\n const meta = tr.getMeta(blockDragKey);\n if (meta !== undefined) return meta as number | null;\n return value === null ? null : tr.mapping.map(value);\n },\n },\n props: {\n decorations: (state) => {\n const pos = blockDragKey.getState(state);\n if (pos === null || pos === undefined) return null;\n const node = state.doc.nodeAt(pos);\n if (!node) return null;\n return DecorationSet.create(state.doc, [\n Decoration.node(pos, pos + node.nodeSize, { class: \"ihub-te-block-dragging\" }),\n ]);\n },\n },\n }),\n ];\n },\n});\n\nexport default BlockKeymap;\n"],"names":["blockDragKey","PluginKey","BlockKeymap","Extension","create","name","addKeyboardShortcuts","_this","this","move","direction","_this$editor","editor","state","view","pos","movableBlockAt","tr","moveBlockSibling","dispatch","addProseMirrorPlugins","Plugin","key","init","apply","value","meta","getMeta","undefined","mapping","map","props","decorations","getState","node","doc","nodeAt","DecorationSet","Decoration","nodeSize","class"],"mappings":"gdAMaA,EAAe,IAAIC,EAASA,UAAgB,iBAQnDC,EAAcC,EAASA,UAACC,OAAO,CACnCC,KAAM,cAENC,qBAAoB,WAAA,IAAAC,EAAAC,KACZC,EAAO,SAACC,GAAiB,OAAK,WAClC,IAAAC,EAAwBJ,EAAKK,OAArBC,EAAKF,EAALE,MAAOC,EAAIH,EAAJG,KACTC,EAAMC,iBAAeH,GAC3B,GAAY,OAARE,EAAc,OAAO,EACzB,IAAME,EAAKC,EAAgBA,iBAACL,EAAOE,EAAKL,GACxC,OAAKO,IACLH,EAAKK,SAASF,IACP,GACR,EACD,MAAO,CACL,oBAAqBR,GAAM,GAC3B,sBAAuBA,EAAK,GAE/B,EAEDW,sBAAqB,WACnB,MAAO,CACL,IAAIC,EAAAA,OAAsB,CACxBC,IAAKtB,EACLa,MAAO,CACLU,KAAM,WAAF,OAAQ,IAAI,EAChBC,MAAO,SAACP,EAAIQ,GACV,IAAMC,EAAOT,EAAGU,QAAQ3B,GACxB,YAAa4B,IAATF,EAA2BA,EACd,OAAVD,EAAiB,KAAOR,EAAGY,QAAQC,IAAIL,EAChD,GAEFM,MAAO,CACLC,YAAa,SAACnB,GACZ,IAAME,EAAMf,EAAaiC,SAASpB,GAClC,GAAIE,QAAmC,OAAO,KAC9C,IAAMmB,EAAOrB,EAAMsB,IAAIC,OAAOrB,GAC9B,OAAKmB,EACEG,gBAAcjC,OAAOS,EAAMsB,IAAK,CACrCG,aAAWJ,KAAKnB,EAAKA,EAAMmB,EAAKK,SAAU,CAAEC,MAAO,6BAFnC,IAIpB,KAIR"}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("../../../../../../_virtual/_rollupPluginBabelHelpers.js"),e=require("./blockOps.js");function r(t,e){for(var r=0;r<t.length;r+=1)if(e<(t[r].top+t[r].bottom)/2)return r;return t.length}function n(t,e){return t.length?e<=0?t[0].top-4:e>=t.length?t[t.length-1].bottom+4:(t[e-1].bottom+t[e].top)/2:0}function o(t,e,r){var n=[];return e.forEach(function(e,o){if("toggleSummary"!==e.type.name){var u=r+o,l=t.nodeDOM(u);l instanceof HTMLElement&&n.push({pos:u,node:e,el:l,rect:l.getBoundingClientRect()})}}),n}function u(t,e){var r=null,n=1/0;return t.forEach(function(t){var o=t.rect,u=o.top,l=o.bottom,a=e<u?u-e:e>l?e-l:0;a<n&&(n=a,r=t)}),r}function l(t,r,n){var u=r.node;if(!e.CONTAINER_TYPES.has(u.type.name))return null;if("toggleBlock"===u.type.name&&!u.attrs.open)return null;var l=o(t,u,r.pos+1);if(!l.length)return null;var a=l[0].rect.top-6,i=l[l.length-1].rect.bottom+6;return n>=a&&n<=i?l:null}function a(t,e,r){for(var n=o(t,t.state.doc,0);;){var a=u(n,e);if(!a||a.pos===r)return n;var i=l(t,a,e);if(!i)return n;n=i}}exports.blockAt=function(t,e){return u(a(t,e),e)},exports.childBlocks=o,exports.computeDropIndex=r,exports.dropTargetAt=function(o,u,l){var i=o.state.doc.nodeAt(l);if(!i)return null;var p=a(o,u,l);if(!p.length)return null;var c=p.map(function(t){return t.rect}),f=r(c,u),s=f<p.length?p[f].pos:p[p.length-1].pos+p[p.length-1].node.nodeSize,h=l+i.nodeSize;if(s>=l&&s<=h)return null;if(!e.canDropAt(o.state.doc,i,s))return null;var g=Math.min.apply(Math,t.toConsumableArray(c.map(function(t){return t.left}))),m=Math.max.apply(Math,t.toConsumableArray(c.map(function(t){return t.right})));return{pos:s,y:n(c,f),left:g,width:m-g}},exports.indicatorY=n,exports.levelAt=a;
2
+ //# sourceMappingURL=blockLayout.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"blockLayout.js","sources":["../../../../../../../src/components/ui/editor/ihub-editor/blocks/blockLayout.ts"],"sourcesContent":["import type { EditorView } from \"@tiptap/pm/view\";\nimport type { Node as PMNode } from \"@tiptap/pm/model\";\nimport { CONTAINER_TYPES, canDropAt } from \"./blockOps\";\n\nexport interface LaidOutBlock {\n pos: number;\n node: PMNode;\n el: HTMLElement;\n rect: DOMRect;\n}\n\nexport interface Rect {\n top: number;\n bottom: number;\n}\n\n/** Pixels inside a container's first/last child that still count as \"inside\". */\nconst INNER_EDGE = 6;\n\n/** Insertion index for pointer Y: before the first block whose midpoint is below it. */\nexport function computeDropIndex(rects: Rect[], y: number): number {\n for (let i = 0; i < rects.length; i += 1) {\n if (y < (rects[i].top + rects[i].bottom) / 2) return i;\n }\n return rects.length;\n}\n\n/** Y (viewport) of the line between blocks for a drop index. */\nexport function indicatorY(rects: Rect[], index: number): number {\n if (!rects.length) return 0;\n if (index <= 0) return rects[0].top - 4;\n if (index >= rects.length) return rects[rects.length - 1].bottom + 4;\n return (rects[index - 1].bottom + rects[index].top) / 2;\n}\n\n/** Movable child blocks of `parent` (content starting at `start`) with their DOM. */\nexport function childBlocks(view: EditorView, parent: PMNode, start: number): LaidOutBlock[] {\n const out: LaidOutBlock[] = [];\n parent.forEach((node, offset) => {\n if (node.type.name === \"toggleSummary\") return;\n const pos = start + offset;\n const dom = view.nodeDOM(pos);\n if (dom instanceof HTMLElement) out.push({ pos, node, el: dom, rect: dom.getBoundingClientRect() });\n });\n return out;\n}\n\nfunction nearest(blocks: LaidOutBlock[], y: number): LaidOutBlock | null {\n let best: LaidOutBlock | null = null;\n let distance = Infinity;\n blocks.forEach((block) => {\n const { top, bottom } = block.rect;\n const d = y < top ? top - y : y > bottom ? y - bottom : 0;\n if (d < distance) {\n distance = d;\n best = block;\n }\n });\n return best;\n}\n\n/** Children of a container when the pointer is over its inner content, else null. */\nfunction innerLevel(view: EditorView, block: LaidOutBlock, y: number): LaidOutBlock[] | null {\n const { node } = block;\n if (!CONTAINER_TYPES.has(node.type.name)) return null;\n if (node.type.name === \"toggleBlock\" && !node.attrs.open) return null;\n const inner = childBlocks(view, node, block.pos + 1);\n if (!inner.length) return null;\n const top = inner[0].rect.top - INNER_EDGE;\n const bottom = inner[inner.length - 1].rect.bottom + INNER_EDGE;\n return y >= top && y <= bottom ? inner : null;\n}\n\n/**\n * The list of sibling blocks the pointer is at: the page's top-level blocks,\n * or — when the pointer is over a banner / callout / open toggle's content —\n * that container's children (recursively). `skipPos` stops descent into the\n * block being dragged, so it can't be dropped into itself.\n */\nexport function levelAt(view: EditorView, y: number, skipPos?: number): LaidOutBlock[] {\n let level = childBlocks(view, view.state.doc, 0);\n for (;;) {\n const hit = nearest(level, y);\n if (!hit || hit.pos === skipPos) return level;\n const inner = innerLevel(view, hit, y);\n if (!inner) return level;\n level = inner;\n }\n}\n\n/** The block under the pointer at the deepest level (for the hover handle). */\nexport function blockAt(view: EditorView, y: number): LaidOutBlock | null {\n return nearest(levelAt(view, y), y);\n}\n\nexport interface DropTarget {\n /** Gap position the block will be inserted at. */\n pos: number;\n /** Viewport coordinates of the indicator line. */\n y: number;\n left: number;\n width: number;\n}\n\n/** Where a drag of the block at `fromPos` would land for pointer Y, or null for a no-op / invalid drop. */\nexport function dropTargetAt(view: EditorView, y: number, fromPos: number): DropTarget | null {\n const source = view.state.doc.nodeAt(fromPos);\n if (!source) return null;\n const level = levelAt(view, y, fromPos);\n if (!level.length) return null;\n const rects = level.map((b) => b.rect);\n const index = computeDropIndex(rects, y);\n const pos = index < level.length ? level[index].pos : level[level.length - 1].pos + level[level.length - 1].node.nodeSize;\n const end = fromPos + source.nodeSize;\n if (pos >= fromPos && pos <= end) return null;\n if (!canDropAt(view.state.doc, source, pos)) return null;\n const left = Math.min(...rects.map((r) => r.left));\n const right = Math.max(...rects.map((r) => r.right));\n return { pos, y: indicatorY(rects, index), left, width: right - left };\n}\n"],"names":["computeDropIndex","rects","y","i","length","top","bottom","indicatorY","index","childBlocks","view","parent","start","out","forEach","node","offset","type","name","pos","dom","nodeDOM","HTMLElement","push","el","rect","getBoundingClientRect","nearest","blocks","best","distance","Infinity","block","_block$rect","d","innerLevel","CONTAINER_TYPES","has","attrs","open","inner","levelAt","skipPos","level","state","doc","hit","fromPos","source","nodeAt","map","b","nodeSize","end","canDropAt","left","Math","min","apply","_toConsumableArray","r","right","max","width"],"mappings":"wKAoBgB,SAAAA,EAAiBC,EAAeC,GAC9C,IAAK,IAAIC,EAAI,EAAGA,EAAIF,EAAMG,OAAQD,GAAK,EACrC,GAAID,GAAKD,EAAME,GAAGE,IAAMJ,EAAME,GAAGG,QAAU,EAAG,OAAOH,EAEvD,OAAOF,EAAMG,MACf,CAGgB,SAAAG,EAAWN,EAAeO,GACxC,OAAKP,EAAMG,OACPI,GAAS,EAAUP,EAAM,GAAGI,IAAM,EAClCG,GAASP,EAAMG,OAAeH,EAAMA,EAAMG,OAAS,GAAGE,OAAS,GAC3DL,EAAMO,EAAQ,GAAGF,OAASL,EAAMO,GAAOH,KAAO,EAH5B,CAI5B,UAGgBI,EAAYC,EAAkBC,EAAgBC,GAC5D,IAAMC,EAAsB,GAO5B,OANAF,EAAOG,QAAQ,SAACC,EAAMC,GACpB,GAAuB,kBAAnBD,EAAKE,KAAKC,KAAd,CACA,IAAMC,EAAMP,EAAQI,EACdI,EAAMV,EAAKW,QAAQF,GACrBC,aAAeE,aAAaT,EAAIU,KAAK,CAAEJ,IAAAA,EAAKJ,KAAAA,EAAMS,GAAIJ,EAAKK,KAAML,EAAIM,yBAHjC,CAI1C,GACOb,CACT,CAEA,SAASc,EAAQC,EAAwB1B,GACvC,IAAI2B,EAA4B,KAC5BC,EAAWC,IASf,OARAH,EAAOd,QAAQ,SAACkB,GACd,IAAAC,EAAwBD,EAAMP,KAAtBpB,EAAG4B,EAAH5B,IAAKC,EAAM2B,EAAN3B,OACP4B,EAAIhC,EAAIG,EAAM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B,EAAMX,EAAQmC,EAAMvC,OAASuC,EAAMnC,GAAOW,IAAMwB,EAAMA,EAAMvC,OAAS,GAAGe,IAAMwB,EAAMA,EAAMvC,OAAS,GAAGW,KAAKqC,SAC3GC,EAAMN,EAAUC,EAAOI,SAC7B,GAAIjC,GAAO4B,GAAW5B,GAAOkC,EAAK,OAAO,KACzC,IAAKC,EAAAA,UAAU5C,EAAKkC,MAAMC,IAAKG,EAAQ7B,GAAM,OAAO,KACpD,IAAMoC,EAAOC,KAAKC,IAAGC,MAARF,KAAIG,EAAAA,kBAAQ1D,EAAMiD,IAAI,SAACU,GAAC,OAAKA,EAAEL,IAAI,KAC1CM,EAAQL,KAAKM,IAAGJ,MAARF,KAAIG,EAAAA,kBAAQ1D,EAAMiD,IAAI,SAACU,GAAC,OAAKA,EAAEC,KAAK,KAClD,MAAO,CAAE1C,IAAAA,EAAKjB,EAAGK,EAAWN,EAAOO,GAAQ+C,KAAAA,EAAMQ,MAAOF,EAAQN,EAClE"}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../../../../node_modules/.pnpm/prosemirror-model@1.25.4/node_modules/prosemirror-model/dist/index.js"),r=require("../../../../../../node_modules/.pnpm/prosemirror-state@1.4.4/node_modules/prosemirror-state/dist/index.js"),t=new Set(["sectionBanner","callout","toggleBlock"]);function n(e){return"toggleBlock"===e.type.name?1:0}function o(e,t){var n=e.doc.nodeAt(t);return n?n.isTextblock?e.setSelection(r.TextSelection.create(e.doc,t+1)):r.NodeSelection.isSelectable(n)?e.setSelection(r.NodeSelection.create(e.doc,t)):e.setSelection(r.TextSelection.near(e.doc.resolve(t+1))):e}function i(r,t,o){if(o<0||o>r.content.size)return!1;var i=r.resolve(o);return!i.parent.inlineContent&&(!(i.index()<n(i.parent))&&i.parent.canReplace(i.index(),i.index(),e.Fragment.from(t)))}function l(e,r,t){var n=e.doc.nodeAt(r);if(!n)return null;var l=r+n.nodeSize;if(t>=r&&t<=l)return null;if(!i(e.doc,n,t))return null;var c=e.tr.delete(r,l),a=c.mapping.map(t);return c.insert(a,n),o(c,a).scrollIntoView()}exports.CONTAINER_TYPES=t,exports.canDropAt=i,exports.deleteBlock=function(e,t){var n=e.doc.nodeAt(t);if(!n)return null;var o=e.tr.delete(t,t+n.nodeSize);0===o.doc.childCount&&o.insert(0,e.schema.nodes.paragraph.create());var i=o.doc.resolve(Math.min(o.mapping.map(t),o.doc.content.size));return o.setSelection(r.TextSelection.near(i)).scrollIntoView()},exports.duplicateBlock=function(e,r){var t=e.doc.nodeAt(r);if(!t)return null;var n=r+t.nodeSize;return o(e.tr.insert(n,t.copy(t.content)),n).scrollIntoView()},exports.firstMovableIndex=n,exports.insertParagraphAfterBlock=function(e,t){var n=e.doc.nodeAt(t);if(!n)return null;var o=t+n.nodeSize,i=e.tr.insert(o,e.schema.nodes.paragraph.create());return i.setSelection(r.TextSelection.create(i.doc,o+1)).scrollIntoView()},exports.movableBlockAt=function(e){var n=e.selection;if(n instanceof r.NodeSelection)return n.from;for(var o=n.$from,i=o.depth;i>=1;i-=1){var l=o.node(i),c=o.node(i-1);if("toggleSummary"!==l.type.name&&(1===i||t.has(c.type.name)))return o.before(i)}return null},exports.moveBlock=l,exports.moveBlockSibling=function(e,r,t){var o=e.doc.resolve(r),i=o.parent,c=o.index(),a=-1===t?c-1:c+2;return a<n(i)||a>i.childCount?null:l(e,r,o.posAtIndex(a))};
2
+ //# sourceMappingURL=blockOps.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"blockOps.js","sources":["../../../../../../../src/components/ui/editor/ihub-editor/blocks/blockOps.ts"],"sourcesContent":["import { Fragment, type Node as PMNode } from \"@tiptap/pm/model\";\nimport { NodeSelection, TextSelection, type EditorState, type Transaction } from \"@tiptap/pm/state\";\n\n/** Blocks whose children can be dragged in and out (their content is `block+`). */\nexport const CONTAINER_TYPES = new Set([\"sectionBanner\", \"callout\", \"toggleBlock\"]);\n\n/** First child index that can hold a moved block (a toggle's summary stays first). */\nexport function firstMovableIndex(parent: PMNode): number {\n return parent.type.name === \"toggleBlock\" ? 1 : 0;\n}\n\nexport interface TopBlock {\n node: PMNode;\n /** Position directly before the block. */\n pos: number;\n index: number;\n}\n\n/** The top-level block containing `pos`. */\nexport function topBlockAt(doc: PMNode, pos: number): TopBlock | null {\n if (!doc.childCount) return null;\n const clamped = Math.max(0, Math.min(pos, doc.content.size));\n const index = Math.min(doc.resolve(clamped).index(0), doc.childCount - 1);\n return topBlockByIndex(doc, index);\n}\n\n/** The top-level block at child `index`. */\nexport function topBlockByIndex(doc: PMNode, index: number): TopBlock | null {\n if (index < 0 || index >= doc.childCount) return null;\n let offset = 0;\n for (let i = 0; i < index; i += 1) offset += doc.child(i).nodeSize;\n return { node: doc.child(index), pos: offset, index };\n}\n\n/**\n * The innermost block around the selection that can be moved: a top-level block\n * or a direct child of a container (never a toggle's summary line).\n */\nexport function movableBlockAt(state: EditorState): number | null {\n const { selection } = state;\n if (selection instanceof NodeSelection) return selection.from;\n const $from = selection.$from;\n for (let depth = $from.depth; depth >= 1; depth -= 1) {\n const node = $from.node(depth);\n const parent = $from.node(depth - 1);\n if (node.type.name === \"toggleSummary\") continue;\n if (depth === 1 || CONTAINER_TYPES.has(parent.type.name)) return $from.before(depth);\n }\n return null;\n}\n\n/** Put the caret (or a node selection for atoms) inside the block at `pos`. */\nfunction selectBlock(tr: Transaction, pos: number): Transaction {\n const node = tr.doc.nodeAt(pos);\n if (!node) return tr;\n if (node.isTextblock) return tr.setSelection(TextSelection.create(tr.doc, pos + 1));\n if (NodeSelection.isSelectable(node)) return tr.setSelection(NodeSelection.create(tr.doc, pos));\n return tr.setSelection(TextSelection.near(tr.doc.resolve(pos + 1)));\n}\n\n/** Can `node` be placed at the gap `pos` (a position between blocks)? */\nexport function canDropAt(doc: PMNode, node: PMNode, pos: number): boolean {\n if (pos < 0 || pos > doc.content.size) return false;\n const $pos = doc.resolve(pos);\n // Must be a gap between blocks, not a position inside text.\n if ($pos.parent.inlineContent) return false;\n if ($pos.index() < firstMovableIndex($pos.parent)) return false;\n return $pos.parent.canReplace($pos.index(), $pos.index(), Fragment.from(node));\n}\n\n/**\n * Move the block at `fromPos` to the gap at `toPos` (any depth: into or out of\n * banners, callouts and toggles). Returns null for no-op or invalid drops,\n * including dropping a container into itself.\n */\nexport function moveBlock(state: EditorState, fromPos: number, toPos: number): Transaction | null {\n const node = state.doc.nodeAt(fromPos);\n if (!node) return null;\n const end = fromPos + node.nodeSize;\n if (toPos >= fromPos && toPos <= end) return null;\n if (!canDropAt(state.doc, node, toPos)) return null;\n const tr = state.tr.delete(fromPos, end);\n const target = tr.mapping.map(toPos);\n tr.insert(target, node);\n return selectBlock(tr, target).scrollIntoView();\n}\n\n/** Swap a block with its previous (-1) or next (+1) sibling inside the same parent. */\nexport function moveBlockSibling(state: EditorState, pos: number, direction: -1 | 1): Transaction | null {\n const $pos = state.doc.resolve(pos);\n const parent = $pos.parent;\n const index = $pos.index();\n const target = direction === -1 ? index - 1 : index + 2;\n if (target < firstMovableIndex(parent) || target > parent.childCount) return null;\n return moveBlock(state, pos, $pos.posAtIndex(target));\n}\n\nexport function duplicateBlock(state: EditorState, pos: number): Transaction | null {\n const node = state.doc.nodeAt(pos);\n if (!node) return null;\n const at = pos + node.nodeSize;\n const tr = state.tr.insert(at, node.copy(node.content));\n return selectBlock(tr, at).scrollIntoView();\n}\n\nexport function deleteBlock(state: EditorState, pos: number): Transaction | null {\n const node = state.doc.nodeAt(pos);\n if (!node) return null;\n const tr = state.tr.delete(pos, pos + node.nodeSize);\n // Never leave the document empty.\n if (tr.doc.childCount === 0) tr.insert(0, state.schema.nodes.paragraph.create());\n const $at = tr.doc.resolve(Math.min(tr.mapping.map(pos), tr.doc.content.size));\n return tr.setSelection(TextSelection.near($at)).scrollIntoView();\n}\n\n/** Insert an empty paragraph after the block and put the caret in it. */\nexport function insertParagraphAfterBlock(state: EditorState, pos: number): Transaction | null {\n const node = state.doc.nodeAt(pos);\n if (!node) return null;\n const at = pos + node.nodeSize;\n const tr = state.tr.insert(at, state.schema.nodes.paragraph.create());\n return tr.setSelection(TextSelection.create(tr.doc, at + 1)).scrollIntoView();\n}\n\n// ---- Top-level (index-based) wrappers ----\n\n/**\n * Move the top-level block at `from` so it lands before the block currently at\n * `to` (`to === childCount` means the end). Returns null for a no-op drop.\n */\nexport function moveTopBlockTo(state: EditorState, from: number, to: number): Transaction | null {\n const block = topBlockByIndex(state.doc, from);\n if (!block || to < 0 || to > state.doc.childCount) return null;\n const toPos = to === state.doc.childCount ? state.doc.content.size : topBlockByIndex(state.doc, to)!.pos;\n return moveBlock(state, block.pos, toPos);\n}\n\n/** Swap the top-level block at `index` with its neighbour above (-1) or below (+1). */\nexport function moveTopBlock(state: EditorState, index: number, direction: -1 | 1): Transaction | null {\n const block = topBlockByIndex(state.doc, index);\n return block ? moveBlockSibling(state, block.pos, direction) : null;\n}\n\nexport function duplicateTopBlock(state: EditorState, index: number): Transaction | null {\n const block = topBlockByIndex(state.doc, index);\n return block ? duplicateBlock(state, block.pos) : null;\n}\n\nexport function deleteTopBlock(state: EditorState, index: number): Transaction | null {\n const block = topBlockByIndex(state.doc, index);\n return block ? deleteBlock(state, block.pos) : null;\n}\n\nexport function insertParagraphAfter(state: EditorState, index: number): Transaction | null {\n const block = topBlockByIndex(state.doc, index);\n return block ? insertParagraphAfterBlock(state, block.pos) : null;\n}\n"],"names":["CONTAINER_TYPES","Set","firstMovableIndex","parent","type","name","selectBlock","tr","pos","node","doc","nodeAt","isTextblock","setSelection","TextSelection","create","NodeSelection","isSelectable","near","resolve","canDropAt","content","size","$pos","inlineContent","index","canReplace","Fragment","from","moveBlock","state","fromPos","toPos","end","nodeSize","target","mapping","map","insert","scrollIntoView","childCount","schema","nodes","paragraph","$at","Math","min","at","copy","selection","$from","depth","has","before","direction","posAtIndex"],"mappings":"uTAIaA,EAAkB,IAAIC,IAAI,CAAC,gBAAiB,UAAW,gBAG9D,SAAUC,EAAkBC,GAChC,M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O,IACT,wDAuCiCrB,EAAoBtB,EAAa8C,GAChE,IAAM/B,EAAOO,EAAMpB,IAAIS,QAAQX,GACzBL,EAASoB,EAAKpB,OACdsB,EAAQF,EAAKE,QACbU,GAAwB,IAAfmB,EAAmB7B,EAAQ,EAAIA,EAAQ,EACtD,OAAIU,EAASjC,EAAkBC,IAAWgC,EAAShC,EAAOqC,WAAmB,KACtEX,EAAUC,EAAOtB,EAAKe,EAAKgC,WAAWpB,GAC/C"}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../../../../_virtual/_rollupPluginBabelHelpers.js"),t=require("react"),n=require("./blockOps.js"),r=require("./BlockKeymap.js"),o=require("./blockLayout.js"),i=48;exports.computeDropIndex=o.computeDropIndex,exports.indicatorY=o.indicatorY,exports.default=function(a,l){var u=t.useState(null),c=e.slicedToArray(u,2),d=c[0],s=c[1],v=t.useRef(null),f=t.useRef(!1),p=t.useRef(null);t.useEffect(function(){return function(){var e;return null===(e=p.current)||void 0===e?void 0:e.call(p)}},[]);var w=t.useCallback(function(e){a.isDestroyed||a.view.dispatch(a.state.tr.setMeta(r.blockDragKey,e).setMeta("addToHistory",!1))},[a]);return{drag:d,start:t.useCallback(function(t,r,u){if(0===t.button&&a.isEditable){t.preventDefault();var c=l.current;if(c){var d=Math.min(u.offsetWidth,520),m={x:t.clientX,y:t.clientY},y=e.objectSpread2({},m),h=!1,g=null,b=0;f.current=!1;var x=function(){var e=c.getBoundingClientRect();g=o.dropTargetAt(a.view,y.y,r),s({fromPos:r,indicator:g?{top:g.y-e.top+c.scrollTop-1,left:g.left-e.left+c.scrollLeft,width:g.width}:null,ghost:{x:y.x+12,y:y.y-12,width:Math.max(160,Math.min(d,window.innerWidth-y.x-24))}})},L=function(){var e=c.getBoundingClientRect(),t=Math.max(e.top,0),n=Math.min(e.bottom,window.innerHeight),r=0;if(y.y<t+i?r=(t+i-y.y)/i*-18:y.y>n-i&&(r=(y.y-(n-i))/i*18),r){var o=c.scrollTop;c.scrollTop+=r,c.scrollTop===o&&window.scrollBy(0,r),x()}b=requestAnimationFrame(L)},k=function(e){if(y={x:e.clientX,y:e.clientY},!h){if(Math.hypot(y.x-m.x,y.y-m.y)<4)return;!function(){h=!0,f.current=!0;var e=v.current;if(e){var t=u.cloneNode(!0);t.classList.remove("ProseMirror-selectednode","ihub-te-block-dragging"),e.replaceChildren(t)}w(r),document.body.classList.add("ihub-te-body-dragging"),b=requestAnimationFrame(L)}()}x()},E=function(e){var t;cancelAnimationFrame(b),window.removeEventListener("pointermove",k),window.removeEventListener("pointerup",M),window.removeEventListener("pointercancel",q),window.removeEventListener("keydown",D,!0),h&&w(null),document.body.classList.remove("ihub-te-body-dragging"),null===(t=v.current)||void 0===t||t.replaceChildren(),p.current=null,s(null);var o=g;if(e&&h&&o){var i=n.moveBlock(a.state,r,o.pos);i&&a.view.dispatch(i),a.commands.focus()}},M=function(){return E(!0)},q=function(){return E(!1)},D=function(e){"Escape"===e.key&&(e.preventDefault(),E(!1))};window.addEventListener("pointermove",k),window.addEventListener("pointerup",M),window.addEventListener("pointercancel",q),window.addEventListener("keydown",D,!0),p.current=function(){return E(!1)}}}},[a,l,w]),ghostRef:v,didDragRef:f}};
2
+ //# sourceMappingURL=useBlockDrag.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useBlockDrag.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}