@prosekit/web 0.7.2 → 0.7.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 (173) hide show
  1. package/dist/get-default-state-CIEy7xrl.js +2 -1
  2. package/dist/get-default-state-CIEy7xrl.js.map +1 -0
  3. package/dist/get-safe-editor-view-DENm4avv.js +2 -1
  4. package/dist/get-safe-editor-view-DENm4avv.js.map +1 -0
  5. package/dist/{inject-style-RwRNoINh.js → inject-style-BJQNFufI.js} +12 -13
  6. package/dist/inject-style-BJQNFufI.js.map +1 -0
  7. package/dist/prosekit-web-autocomplete.d.ts +2 -1
  8. package/dist/prosekit-web-autocomplete.d.ts.map +1 -0
  9. package/dist/prosekit-web-autocomplete.js +5 -7
  10. package/dist/prosekit-web-autocomplete.js.map +1 -0
  11. package/dist/prosekit-web-block-handle.d.ts +2 -1
  12. package/dist/prosekit-web-block-handle.d.ts.map +1 -0
  13. package/dist/prosekit-web-block-handle.js +33 -20
  14. package/dist/prosekit-web-block-handle.js.map +1 -0
  15. package/dist/prosekit-web-drop-indicator.d.ts +2 -1
  16. package/dist/prosekit-web-drop-indicator.d.ts.map +1 -0
  17. package/dist/prosekit-web-drop-indicator.js +2 -1
  18. package/dist/prosekit-web-drop-indicator.js.map +1 -0
  19. package/dist/prosekit-web-inline-popover.d.ts +2 -1
  20. package/dist/prosekit-web-inline-popover.d.ts.map +1 -0
  21. package/dist/prosekit-web-inline-popover.js +4 -5
  22. package/dist/prosekit-web-inline-popover.js.map +1 -0
  23. package/dist/prosekit-web-popover.d.ts +2 -1
  24. package/dist/prosekit-web-popover.d.ts.map +1 -0
  25. package/dist/prosekit-web-popover.js +2 -1
  26. package/dist/prosekit-web-popover.js.map +1 -0
  27. package/dist/prosekit-web-resizable.d.ts +2 -1
  28. package/dist/prosekit-web-resizable.d.ts.map +1 -0
  29. package/dist/prosekit-web-resizable.js +2 -1
  30. package/dist/prosekit-web-resizable.js.map +1 -0
  31. package/dist/prosekit-web-table-handle.d.ts +2 -1
  32. package/dist/prosekit-web-table-handle.d.ts.map +1 -0
  33. package/dist/prosekit-web-table-handle.js +38 -75
  34. package/dist/prosekit-web-table-handle.js.map +1 -0
  35. package/dist/prosekit-web-tooltip.d.ts +2 -1
  36. package/dist/prosekit-web-tooltip.d.ts.map +1 -0
  37. package/dist/prosekit-web-tooltip.js +2 -1
  38. package/dist/prosekit-web-tooltip.js.map +1 -0
  39. package/dist/prosekit-web.d.ts +1 -1
  40. package/dist/prosekit-web.js +1 -0
  41. package/dist/use-editor-extension-Cc7ZG7uj.js +2 -1
  42. package/dist/use-editor-extension-Cc7ZG7uj.js.map +1 -0
  43. package/dist/use-scrolling-BNfsQs3S.js +2 -1
  44. package/dist/use-scrolling-BNfsQs3S.js.map +1 -0
  45. package/package.json +21 -20
  46. package/src/components/autocomplete/autocomplete-empty/element.gen.ts +18 -0
  47. package/src/components/autocomplete/autocomplete-empty/setup.ts +6 -0
  48. package/src/components/autocomplete/autocomplete-empty/types.ts +16 -0
  49. package/src/components/autocomplete/autocomplete-item/element.gen.ts +18 -0
  50. package/src/components/autocomplete/autocomplete-item/setup.ts +38 -0
  51. package/src/components/autocomplete/autocomplete-item/types.ts +31 -0
  52. package/src/components/autocomplete/autocomplete-list/element.gen.ts +18 -0
  53. package/src/components/autocomplete/autocomplete-list/setup.ts +140 -0
  54. package/src/components/autocomplete/autocomplete-list/types.ts +30 -0
  55. package/src/components/autocomplete/autocomplete-popover/element.gen.ts +18 -0
  56. package/src/components/autocomplete/autocomplete-popover/helpers.spec.ts +21 -0
  57. package/src/components/autocomplete/autocomplete-popover/helpers.ts +7 -0
  58. package/src/components/autocomplete/autocomplete-popover/setup.ts +185 -0
  59. package/src/components/autocomplete/autocomplete-popover/types.ts +103 -0
  60. package/src/components/autocomplete/context.ts +19 -0
  61. package/src/components/autocomplete/index.gen.ts +17 -0
  62. package/src/components/block-handle/block-handle-add/element.gen.ts +18 -0
  63. package/src/components/block-handle/block-handle-add/setup.ts +37 -0
  64. package/src/components/block-handle/block-handle-add/types.ts +26 -0
  65. package/src/components/block-handle/block-handle-draggable/element.gen.ts +18 -0
  66. package/src/components/block-handle/block-handle-draggable/set-drag-preview.ts +88 -0
  67. package/src/components/block-handle/block-handle-draggable/setup.ts +133 -0
  68. package/src/components/block-handle/block-handle-draggable/types.ts +26 -0
  69. package/src/components/block-handle/block-handle-popover/element.gen.ts +18 -0
  70. package/src/components/block-handle/block-handle-popover/pointer-move.ts +243 -0
  71. package/src/components/block-handle/block-handle-popover/setup.ts +88 -0
  72. package/src/components/block-handle/block-handle-popover/types.ts +84 -0
  73. package/src/components/block-handle/context.ts +34 -0
  74. package/src/components/block-handle/index.gen.ts +13 -0
  75. package/src/components/drop-indicator/drop-indicator/element.gen.ts +18 -0
  76. package/src/components/drop-indicator/drop-indicator/setup.ts +87 -0
  77. package/src/components/drop-indicator/drop-indicator/types.ts +34 -0
  78. package/src/components/drop-indicator/index.gen.ts +5 -0
  79. package/src/components/inline-popover/index.gen.ts +5 -0
  80. package/src/components/inline-popover/inline-popover/element.gen.ts +18 -0
  81. package/src/components/inline-popover/inline-popover/setup.ts +97 -0
  82. package/src/components/inline-popover/inline-popover/types.ts +115 -0
  83. package/src/components/inline-popover/inline-popover/virtual-selection-element.ts +75 -0
  84. package/src/components/popover/index.gen.ts +13 -0
  85. package/src/components/popover/popover-content/element.gen.ts +18 -0
  86. package/src/components/popover/popover-content/setup.ts +1 -0
  87. package/src/components/popover/popover-content/types.ts +12 -0
  88. package/src/components/popover/popover-root/element.gen.ts +18 -0
  89. package/src/components/popover/popover-root/setup.ts +1 -0
  90. package/src/components/popover/popover-root/types.ts +12 -0
  91. package/src/components/popover/popover-trigger/element.gen.ts +18 -0
  92. package/src/components/popover/popover-trigger/setup.ts +1 -0
  93. package/src/components/popover/popover-trigger/types.ts +12 -0
  94. package/src/components/resizable/context.ts +45 -0
  95. package/src/components/resizable/index.gen.ts +9 -0
  96. package/src/components/resizable/resizable-handle/calc-resize.spec.ts +280 -0
  97. package/src/components/resizable/resizable-handle/calc-resize.ts +121 -0
  98. package/src/components/resizable/resizable-handle/element.gen.ts +18 -0
  99. package/src/components/resizable/resizable-handle/setup.ts +112 -0
  100. package/src/components/resizable/resizable-handle/types.ts +32 -0
  101. package/src/components/resizable/resizable-root/element.gen.ts +18 -0
  102. package/src/components/resizable/resizable-root/setup.ts +93 -0
  103. package/src/components/resizable/resizable-root/types.ts +28 -0
  104. package/src/components/table-handle/context.ts +49 -0
  105. package/src/components/table-handle/dnd.ts +135 -0
  106. package/src/components/table-handle/hooks/use-drop.ts +94 -0
  107. package/src/components/table-handle/hooks/use-empty-image.ts +30 -0
  108. package/src/components/table-handle/index.gen.ts +37 -0
  109. package/src/components/table-handle/table-handle-column-root/element.gen.ts +18 -0
  110. package/src/components/table-handle/table-handle-column-root/setup.ts +71 -0
  111. package/src/components/table-handle/table-handle-column-root/types.ts +76 -0
  112. package/src/components/table-handle/table-handle-column-trigger/element.gen.ts +18 -0
  113. package/src/components/table-handle/table-handle-column-trigger/setup.ts +75 -0
  114. package/src/components/table-handle/table-handle-column-trigger/types.ts +23 -0
  115. package/src/components/table-handle/table-handle-drag-preview/element.gen.ts +18 -0
  116. package/src/components/table-handle/table-handle-drag-preview/render-preview.ts +80 -0
  117. package/src/components/table-handle/table-handle-drag-preview/setup.ts +67 -0
  118. package/src/components/table-handle/table-handle-drag-preview/types.ts +17 -0
  119. package/src/components/table-handle/table-handle-drag-preview/updater.ts +101 -0
  120. package/src/components/table-handle/table-handle-drop-indicator/calc-drag-over.ts +44 -0
  121. package/src/components/table-handle/table-handle-drop-indicator/element.gen.ts +18 -0
  122. package/src/components/table-handle/table-handle-drop-indicator/setup.ts +56 -0
  123. package/src/components/table-handle/table-handle-drop-indicator/types.ts +18 -0
  124. package/src/components/table-handle/table-handle-drop-indicator/updater.ts +110 -0
  125. package/src/components/table-handle/table-handle-popover-content/element.gen.ts +18 -0
  126. package/src/components/table-handle/table-handle-popover-content/setup.ts +90 -0
  127. package/src/components/table-handle/table-handle-popover-content/types.ts +40 -0
  128. package/src/components/table-handle/table-handle-popover-item/element.gen.ts +18 -0
  129. package/src/components/table-handle/table-handle-popover-item/setup.ts +23 -0
  130. package/src/components/table-handle/table-handle-popover-item/types.ts +24 -0
  131. package/src/components/table-handle/table-handle-root/element.gen.ts +18 -0
  132. package/src/components/table-handle/table-handle-root/setup.ts +93 -0
  133. package/src/components/table-handle/table-handle-root/types.ts +26 -0
  134. package/src/components/table-handle/table-handle-row-root/element.gen.ts +18 -0
  135. package/src/components/table-handle/table-handle-row-root/setup.ts +77 -0
  136. package/src/components/table-handle/table-handle-row-root/types.ts +75 -0
  137. package/src/components/table-handle/table-handle-row-trigger/element.gen.ts +18 -0
  138. package/src/components/table-handle/table-handle-row-trigger/setup.ts +74 -0
  139. package/src/components/table-handle/table-handle-row-trigger/types.ts +26 -0
  140. package/src/components/table-handle/utils.ts +107 -0
  141. package/src/components/tooltip/index.gen.ts +13 -0
  142. package/src/components/tooltip/tooltip-content/element.gen.ts +18 -0
  143. package/src/components/tooltip/tooltip-content/setup.ts +1 -0
  144. package/src/components/tooltip/tooltip-content/types.ts +12 -0
  145. package/src/components/tooltip/tooltip-root/element.gen.ts +18 -0
  146. package/src/components/tooltip/tooltip-root/setup.ts +1 -0
  147. package/src/components/tooltip/tooltip-root/types.ts +12 -0
  148. package/src/components/tooltip/tooltip-trigger/element.gen.ts +18 -0
  149. package/src/components/tooltip/tooltip-trigger/setup.ts +1 -0
  150. package/src/components/tooltip/tooltip-trigger/types.ts +12 -0
  151. package/src/hooks/use-editor-extension.ts +19 -0
  152. package/src/hooks/use-editor-focus-event.ts +23 -0
  153. package/src/hooks/use-editor-typing.ts +36 -0
  154. package/src/hooks/use-editor-update-event.ts +23 -0
  155. package/src/hooks/use-first-rendering.ts +20 -0
  156. package/src/hooks/use-keymap.ts +20 -0
  157. package/src/hooks/use-scrolling.ts +33 -0
  158. package/src/hooks/use-selecting.ts +63 -0
  159. package/src/index.ts +1 -0
  160. package/src/utils/assign-styles.ts +14 -0
  161. package/src/utils/clone-element.ts +110 -0
  162. package/src/utils/css-feature-detection.ts +9 -0
  163. package/src/utils/fade-color.ts +15 -0
  164. package/src/utils/get-box-element.ts +20 -0
  165. package/src/utils/get-client-rect.ts +35 -0
  166. package/src/utils/get-default-state.spec.ts +50 -0
  167. package/src/utils/get-default-state.ts +22 -0
  168. package/src/utils/get-effective-background-color.ts +21 -0
  169. package/src/utils/get-safe-editor-view.ts +10 -0
  170. package/src/utils/inject-style.ts +11 -0
  171. package/src/utils/is-finite-positive-number.ts +3 -0
  172. package/src/utils/max-z-index.ts +3 -0
  173. package/src/utils/throttle.ts +17 -0
@@ -31,4 +31,5 @@ var PopoverTriggerElement = class extends PopoverTriggerElementBase {};
31
31
  registerCustomElement("prosekit-popover-trigger", PopoverTriggerElement);
32
32
 
33
33
  //#endregion
34
- export { PopoverContentElement, PopoverRootElement, PopoverTriggerElement, popoverContentEvents, popoverContentProps, popoverRootEvents, popoverRootProps, popoverTriggerEvents, popoverTriggerProps, usePopoverContent, usePopoverRoot, usePopoverTrigger };
34
+ export { PopoverContentElement, PopoverRootElement, PopoverTriggerElement, popoverContentEvents, popoverContentProps, popoverRootEvents, popoverRootProps, popoverTriggerEvents, popoverTriggerProps, usePopoverContent, usePopoverRoot, usePopoverTrigger };
35
+ //# sourceMappingURL=prosekit-web-popover.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prosekit-web-popover.js","names":["PopoverContentElementBase: BaseElementConstructor<PopoverContentProps>","PopoverRootElementBase: BaseElementConstructor<PopoverRootProps>","PopoverTriggerElementBase: BaseElementConstructor<PopoverTriggerProps>"],"sources":["../src/components/popover/popover-content/element.gen.ts","../src/components/popover/popover-root/element.gen.ts","../src/components/popover/popover-trigger/element.gen.ts"],"sourcesContent":["import { defineCustomElement, registerCustomElement, type BaseElementConstructor } from \"@aria-ui/core\"\n\nimport { usePopoverContent } from \"./setup\"\nimport { popoverContentEvents, popoverContentProps, type PopoverContentEvents, type PopoverContentProps } from \"./types\"\n\nconst PopoverContentElementBase: BaseElementConstructor<PopoverContentProps> = defineCustomElement<\n PopoverContentProps,\n PopoverContentEvents\n>({\n props: popoverContentProps,\n events: popoverContentEvents,\n setup: usePopoverContent,\n})\nclass PopoverContentElement extends PopoverContentElementBase {}\n\nregisterCustomElement('prosekit-popover-content', PopoverContentElement)\n \nexport { PopoverContentElement }\n","import { defineCustomElement, registerCustomElement, type BaseElementConstructor } from \"@aria-ui/core\"\n\nimport { usePopoverRoot } from \"./setup\"\nimport { popoverRootEvents, popoverRootProps, type PopoverRootEvents, type PopoverRootProps } from \"./types\"\n\nconst PopoverRootElementBase: BaseElementConstructor<PopoverRootProps> = defineCustomElement<\n PopoverRootProps,\n PopoverRootEvents\n>({\n props: popoverRootProps,\n events: popoverRootEvents,\n setup: usePopoverRoot,\n})\nclass PopoverRootElement extends PopoverRootElementBase {}\n\nregisterCustomElement('prosekit-popover-root', PopoverRootElement)\n \nexport { PopoverRootElement }\n","import { defineCustomElement, registerCustomElement, type BaseElementConstructor } from \"@aria-ui/core\"\n\nimport { usePopoverTrigger } from \"./setup\"\nimport { popoverTriggerEvents, popoverTriggerProps, type PopoverTriggerEvents, type PopoverTriggerProps } from \"./types\"\n\nconst PopoverTriggerElementBase: BaseElementConstructor<PopoverTriggerProps> = defineCustomElement<\n PopoverTriggerProps,\n PopoverTriggerEvents\n>({\n props: popoverTriggerProps,\n events: popoverTriggerEvents,\n setup: usePopoverTrigger,\n})\nclass PopoverTriggerElement extends PopoverTriggerElementBase {}\n\nregisterCustomElement('prosekit-popover-trigger', PopoverTriggerElement)\n \nexport { PopoverTriggerElement }\n"],"mappings":";;;;AAKA,MAAMA,4BAAyE,oBAG7E;CACA,OAAO;CACP,QAAQ;CACR,OAAO;CACR,CAAC;AACF,IAAM,wBAAN,cAAoC,0BAA0B;AAE9D,sBAAsB,4BAA4B,sBAAsB;;;;ACVxE,MAAMC,yBAAmE,oBAGvE;CACA,OAAO;CACP,QAAQ;CACR,OAAO;CACR,CAAC;AACF,IAAM,qBAAN,cAAiC,uBAAuB;AAExD,sBAAsB,yBAAyB,mBAAmB;;;;ACVlE,MAAMC,4BAAyE,oBAG7E;CACA,OAAO;CACP,QAAQ;CACR,OAAO;CACR,CAAC;AACF,IAAM,wBAAN,cAAoC,0BAA0B;AAE9D,sBAAsB,4BAA4B,sBAAsB"}
@@ -64,4 +64,5 @@ declare function useResizableRoot(host: ConnectableElement, {
64
64
  emit
65
65
  }: SetupOptions<ResizableRootProps, ResizableRootEvents>): void;
66
66
  //#endregion
67
- export { ResizableHandleElement, type ResizableHandleEvents, type ResizableHandleProps, ResizableRootElement, type ResizableRootEvents, type ResizableRootProps, resizableHandleEvents, resizableHandleProps, resizableRootEvents, resizableRootProps, useResizableHandle, useResizableRoot };
67
+ export { ResizableHandleElement, type ResizableHandleEvents, type ResizableHandleProps, ResizableRootElement, type ResizableRootEvents, type ResizableRootProps, resizableHandleEvents, resizableHandleProps, resizableRootEvents, resizableRootProps, useResizableHandle, useResizableRoot };
68
+ //# sourceMappingURL=prosekit-web-resizable.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prosekit-web-resizable.d.ts","names":[],"sources":["../src/components/resizable/resizable-handle/types.ts","../src/components/resizable/resizable-handle/element.gen.ts","../src/components/resizable/resizable-handle/setup.ts","../src/components/resizable/resizable-root/types.ts","../src/components/resizable/resizable-root/element.gen.ts","../src/components/resizable/resizable-root/setup.ts"],"sourcesContent":[],"mappings":";;;UAKiB,oBAAA;;AAAjB;AAkBA;;;UAAmC,EAAA,KAAA,GAAA,OAAA,GAAA,QAAA,GAAA,MAAA,GAAA,UAAA,GAAA,WAAA,GAAA,aAAA,GAAA,cAAA;;AAKnC;AAGa,cARA,oBAQoE,EAR9C,gBAQ8C,CAR7B,oBAQ6B,CAAA;;AAA3B,UAHrC,qBAAA,CAGqC;;cAAzC,uBAAuB,kBAAkB;;;cC1BhD,4BAA4B,uBAAuB;ADAzD,cCQM,sBAAA,SAA+B,0BAAA,CDRA;;;;AAArC;AAkBA;AAEC,iBEDe,kBAAA,CFCf,IAAA,EEAO,kBFAP,EAAA;EAAA;CAAA,EAAA;OAFmD,EEG9B,WFH8B,CEGlB,oBFHkB,CAAA;QAAjB;;;UGlBlB,kBAAA;;EHAA,MAAA,EAAA,MAAA,GAAA,IAAA;EAkBJ,WAAA,EAAA,MAAA,GAAA,IAEZ;;;AAFkC,cGXtB,kBHWsB,EGXF,gBHWE,CGXe,kBHWf,CAAA;AAAgB,UGLlC,mBAAA,CHKkC;EAKlC,WAAA,EGTF,WHSuB,CAAA;IAGzB,KAAA,EAAA,MAAA;IAAoE,MAAA,EAAA,MAAA;;WAA7C,EGXvB,WHWuB,CAAA;IAAiB,KAAA,EAAA,MAAA;;;;AC5BuE;AAS1H,cEYW,mBFZX,EEYgC,iBFZhC,CEYkD,mBFZlD,CAAA;;;cGPI,0BAA0B,uBAAuB;AJAvD,cIQM,oBAAA,SAA6B,wBAAA,CJRE;;;;AAArC;AAkBA;AAEC,iBKCe,gBAAA,CLDf,IAAA,EKEO,kBLFP,EAAA;EAAA,KAAA;EAAA;AAAA,CAAA,EKGkB,YLHlB,CKG+B,kBLH/B,EKGmD,mBLHnD,CAAA,CAAA,EAAA,IAAA"}
@@ -248,4 +248,5 @@ var ResizableRootElement = class extends ResizableRootElementBase {};
248
248
  registerCustomElement("prosekit-resizable-root", ResizableRootElement);
249
249
 
250
250
  //#endregion
251
- export { ResizableHandleElement, ResizableRootElement, resizableHandleEvents, resizableHandleProps, resizableRootEvents, resizableRootProps, useResizableHandle, useResizableRoot };
251
+ export { ResizableHandleElement, ResizableRootElement, resizableHandleEvents, resizableHandleProps, resizableRootEvents, resizableRootProps, useResizableHandle, useResizableRoot };
252
+ //# sourceMappingURL=prosekit-web-resizable.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prosekit-web-resizable.js","names":["onResizeContext: Context<OnResize>","onResizeStartContext: Context<OnResizeStart>","onResizeEndContext: Context<OnResizeEnd>","calcBottomRightResize: CalcResize","calcBottomLeftResize: CalcResize","calcTopRightResize: CalcResize","calcTopLeftResize: CalcResize","calcTopResize: CalcResize","calcRightResize: CalcResize","calcBottomResize: CalcResize","calcLeftResize: CalcResize","resizableHandleProps: PropDeclarations<ResizableHandleProps>","resizableHandleEvents: EventDeclarations<ResizableHandleEvents>","ResizableHandleElementBase: BaseElementConstructor<ResizableHandleProps>","onResizeStart: OnResizeStart","aspectRatio: number","onResize: OnResize","onResizeEnd: OnResizeEnd","resizableRootProps: PropDeclarations<ResizableRootProps>","resizableRootEvents: EventDeclarations<ResizableRootEvents>","ResizableRootElementBase: BaseElementConstructor<ResizableRootProps>"],"sources":["../src/components/resizable/context.ts","../src/utils/is-finite-positive-number.ts","../src/components/resizable/resizable-handle/calc-resize.ts","../src/components/resizable/resizable-handle/setup.ts","../src/components/resizable/resizable-handle/types.ts","../src/components/resizable/resizable-handle/element.gen.ts","../src/components/resizable/resizable-root/setup.ts","../src/components/resizable/resizable-root/types.ts","../src/components/resizable/resizable-root/element.gen.ts"],"sourcesContent":["import {\n createContext,\n type Context,\n} from '@aria-ui/core'\n\n/**\n * @internal\n */\nexport const onResizeContext: Context<OnResize> = createContext(\n 'prosekit/resizable/onResize',\n null,\n)\n\n/**\n * @internal\n */\nexport const onResizeStartContext: Context<OnResizeStart> = createContext(\n 'prosekit/resizable/onResizeStart',\n null,\n)\n\n/**\n * @internal\n */\nexport const onResizeEndContext: Context<OnResizeEnd> = createContext(\n 'prosekit/resizable/onResizeEnd',\n null,\n)\n\n/**\n * @internal\n */\nexport type OnResize = ((width: number, height: number) => void) | null\n\n/**\n * @internal\n */\nexport type OnResizeStart =\n | (() => readonly [width: number, height: number, aspectRatio: number])\n | null\n\n/**\n * @internal\n */\nexport type OnResizeEnd = (() => void) | null\n","export function isFinitePositiveNumber(value: unknown): value is number {\n return typeof value === 'number' && Number.isFinite(value) && value > 0\n}\n","import { isFinitePositiveNumber } from '../../../utils/is-finite-positive-number'\n\nexport function calcResize(\n position:\n | 'top'\n | 'right'\n | 'bottom'\n | 'left'\n | 'top-left'\n | 'top-right'\n | 'bottom-left'\n | 'bottom-right',\n w: number,\n h: number,\n dx: number,\n dy: number,\n aspectRatio: number | null | undefined,\n): [w: number, h: number] {\n aspectRatio = aspectRatio ? aspectRatio : w / h\n aspectRatio = isFinitePositiveNumber(aspectRatio) ? aspectRatio : 1\n\n switch (position) {\n case 'bottom-right':\n return clamp(calcBottomRightResize(w, h, dx, dy, aspectRatio))\n case 'bottom-left':\n return clamp(calcBottomLeftResize(w, h, dx, dy, aspectRatio))\n case 'top-right':\n return clamp(calcTopRightResize(w, h, dx, dy, aspectRatio))\n case 'top-left':\n return clamp(calcTopLeftResize(w, h, dx, dy, aspectRatio))\n case 'top':\n return clamp(calcTopResize(w, h, dx, dy, aspectRatio))\n case 'right':\n return clamp(calcRightResize(w, h, dx, dy, aspectRatio))\n case 'bottom':\n return clamp(calcBottomResize(w, h, dx, dy, aspectRatio))\n case 'left':\n return clamp(calcLeftResize(w, h, dx, dy, aspectRatio))\n default:\n throw new RangeError(`Invalid position: ${position}`)\n }\n}\n\ntype CalcResize = (\n w: number,\n h: number,\n dx: number,\n dy: number,\n aspectRatio: number,\n) => [w: number, h: number]\n\nconst calcBottomRightResize: CalcResize = (w, h, dx, dy, r) => {\n w += dx\n h += dy\n\n const sum = w + h\n h = sum / (r + 1)\n w = sum - h\n return [w, h]\n}\n\nconst calcBottomLeftResize: CalcResize = (w, h, dx, dy, r) => {\n w -= dx\n h += dy\n\n const sum = w + h\n h = sum / (r + 1)\n w = sum - h\n return [w, h]\n}\n\nconst calcTopRightResize: CalcResize = (w, h, dx, dy, r) => {\n w += dx\n h -= dy\n\n const sum = w + h\n h = sum / (r + 1)\n w = sum - h\n return [w, h]\n}\n\nconst calcTopLeftResize: CalcResize = (w, h, dx, dy, r) => {\n w -= dx\n h -= dy\n\n const sum = w + h\n h = sum / (r + 1)\n w = sum - h\n return [w, h]\n}\n\nconst calcTopResize: CalcResize = (w, h, dx, dy, r) => {\n h -= dy\n w = h * r\n return [w, h]\n}\n\nconst calcRightResize: CalcResize = (w, h, dx, dy, r) => {\n w += dx\n h = w / r\n return [w, h]\n}\n\nconst calcBottomResize: CalcResize = (w, h, dx, dy, r) => {\n h += dy\n w = h * r\n return [w, h]\n}\n\nconst calcLeftResize: CalcResize = (w, h, dx, dy, r) => {\n w -= dx\n h = w / r\n return [w, h]\n}\n\nfunction clamp([w, h]: [number, number]): [number, number] {\n return [\n Math.max(w, 1),\n Math.max(h, 1),\n ]\n}\n","import {\n createSignal,\n useEffect,\n type ConnectableElement,\n type ReadonlySignal,\n type SignalState,\n} from '@aria-ui/core'\nimport { getWindow } from '@ocavue/utils'\n\nimport {\n onResizeContext,\n onResizeEndContext,\n onResizeStartContext,\n type OnResize,\n type OnResizeEnd,\n type OnResizeStart,\n} from '../context'\n\nimport { calcResize } from './calc-resize'\nimport type { ResizableHandleProps } from './types'\n\n/**\n * @internal\n */\nexport function useResizableHandle(\n host: ConnectableElement,\n { state }: { state: SignalState<ResizableHandleProps> },\n): void {\n const onResize = onResizeContext.consume(host)\n const onResizeStart = onResizeStartContext.consume(host)\n const onResizeEnd = onResizeEndContext.consume(host)\n\n useResizableHandleState(host, state, { onResize, onResizeStart, onResizeEnd })\n}\n\nfunction useResizableHandleState(\n host: ConnectableElement,\n state: SignalState<ResizableHandleProps>,\n context: {\n onResizeStart: ReadonlySignal<OnResizeStart>\n onResize: ReadonlySignal<OnResize>\n onResizeEnd: ReadonlySignal<OnResizeEnd>\n },\n) {\n let startX = 0\n let startY = 0\n let width = 0\n let height = 0\n let aspectRatio = 1\n\n const pointerPressing = createSignal(false)\n\n const handlePointerDown = (event: PointerEvent) => {\n event.preventDefault()\n pointerPressing.set(true)\n\n startX = event.x\n startY = event.y\n\n const size = context.onResizeStart.get()?.()\n if (size) {\n ;[width, height, aspectRatio] = size\n }\n }\n\n const handlePointerMove = (event: PointerEvent) => {\n event.preventDefault()\n\n const dx = event.x - startX\n const dy = event.y - startY\n\n const [w, h] = calcResize(\n state.position.peek(),\n width,\n height,\n dx,\n dy,\n aspectRatio,\n )\n\n context.onResize.get()?.(w, h)\n }\n\n const handlePointerUp = (event: PointerEvent) => {\n event.preventDefault()\n pointerPressing.set(false)\n\n context.onResizeEnd.get()?.()\n }\n\n useEffect(host, () => {\n host.addEventListener('pointerdown', handlePointerDown)\n return () => {\n host.removeEventListener('pointerdown', handlePointerDown)\n }\n })\n\n useEffect(host, () => {\n if (!pointerPressing.get()) {\n return\n }\n\n const win = getWindow(host)\n\n win.addEventListener('pointermove', handlePointerMove)\n win.addEventListener('pointerup', handlePointerUp)\n return () => {\n win.removeEventListener('pointermove', handlePointerMove)\n win.removeEventListener('pointerup', handlePointerUp)\n }\n })\n}\n","import type {\n EventDeclarations,\n PropDeclarations,\n} from '@aria-ui/core'\n\nexport interface ResizableHandleProps {\n /**\n * The position of the handle.\n *\n * @default \"bottom-right\"\n */\n position:\n | 'top'\n | 'right'\n | 'bottom'\n | 'left'\n | 'top-left'\n | 'top-right'\n | 'bottom-left'\n | 'bottom-right'\n}\n\n/** @internal */\nexport const resizableHandleProps: PropDeclarations<ResizableHandleProps> = {\n position: { default: 'bottom-right' },\n}\n\n/** @internal */\nexport interface ResizableHandleEvents {}\n\n/** @internal */\nexport const resizableHandleEvents: EventDeclarations<ResizableHandleEvents> = {}\n","import { defineCustomElement, registerCustomElement, type BaseElementConstructor } from \"@aria-ui/core\"\n\nimport { useResizableHandle } from \"./setup\"\nimport { resizableHandleEvents, resizableHandleProps, type ResizableHandleEvents, type ResizableHandleProps } from \"./types\"\n\nconst ResizableHandleElementBase: BaseElementConstructor<ResizableHandleProps> = defineCustomElement<\n ResizableHandleProps,\n ResizableHandleEvents\n>({\n props: resizableHandleProps,\n events: resizableHandleEvents,\n setup: useResizableHandle,\n})\nclass ResizableHandleElement extends ResizableHandleElementBase {}\n\nregisterCustomElement('prosekit-resizable-handle', ResizableHandleElement)\n \nexport { ResizableHandleElement }\n","import {\n createSignal,\n useAttribute,\n useEffect,\n type ConnectableElement,\n type SetupOptions,\n} from '@aria-ui/core'\n\nimport { isFinitePositiveNumber } from '../../../utils/is-finite-positive-number'\nimport {\n onResizeContext,\n onResizeEndContext,\n onResizeStartContext,\n type OnResize,\n type OnResizeEnd,\n type OnResizeStart,\n} from '../context'\n\nimport type {\n ResizableRootEvents,\n ResizableRootProps,\n} from './types'\n\n/**\n * @internal\n */\nexport function useResizableRoot(\n host: ConnectableElement,\n { state, emit }: SetupOptions<ResizableRootProps, ResizableRootEvents>,\n): void {\n const resizing = createSignal(false)\n\n const onResizeStart: OnResizeStart = () => {\n const { width, height } = host.getBoundingClientRect()\n\n let aspectRatio: number = state.aspectRatio.peek() ?? width / height\n\n if (!isFinitePositiveNumber(aspectRatio)) {\n aspectRatio = 0\n }\n\n emit('resizeStart', { width, height })\n resizing.set(true)\n return [width, height, aspectRatio]\n }\n\n const onResize: OnResize = (width, height) => {\n state.width.set(width)\n state.height.set(height)\n }\n\n const onResizeEnd: OnResizeEnd = () => {\n const { width, height } = host.getBoundingClientRect()\n emit('resizeEnd', { width, height })\n resizing.set(false)\n }\n\n onResizeStartContext.provide(host, createSignal(onResizeStart))\n onResizeContext.provide(host, createSignal(onResize))\n onResizeEndContext.provide(host, createSignal(onResizeEnd))\n\n useEffect(host, () => {\n updateResizableRootStyles(\n host,\n Math.max(state.width.get() || 0, 1),\n Math.max(state.height.get() || 0, 1),\n state.aspectRatio.get(),\n )\n })\n\n useAttribute(host, 'data-resizing', () => (resizing.get() ? '' : undefined))\n}\n\nfunction updateResizableRootStyles(\n host: ConnectableElement,\n width: number,\n height: number,\n aspectRatio: number | null,\n) {\n host.style.width = isFinitePositiveNumber(width) ? `${width}px` : ''\n\n host.style.height = isFinitePositiveNumber(height) ? `${height}px` : ''\n\n if (isFinitePositiveNumber(aspectRatio)) {\n host.style.aspectRatio = `${aspectRatio}`\n\n if (width && width > 0 && aspectRatio >= 1) {\n host.style.height = 'auto'\n } else if (height && height > 0 && aspectRatio <= 1) {\n host.style.width = 'min-content'\n }\n }\n}\n","import type {\n EventDeclarations,\n PropDeclarations,\n} from '@aria-ui/core'\n\nexport interface ResizableRootProps {\n width: number | null\n height: number | null\n aspectRatio: number | null\n}\n\n/** @internal */\nexport const resizableRootProps: PropDeclarations<ResizableRootProps> = {\n width: { default: null },\n height: { default: null },\n aspectRatio: { default: null },\n}\n\nexport interface ResizableRootEvents {\n resizeStart: CustomEvent<{ width: number; height: number }>\n resizeEnd: CustomEvent<{ width: number; height: number }>\n}\n\n/** @internal */\nexport const resizableRootEvents: EventDeclarations<ResizableRootEvents> = {\n resizeStart: {},\n resizeEnd: {},\n}\n","import { defineCustomElement, registerCustomElement, type BaseElementConstructor } from \"@aria-ui/core\"\n\nimport { useResizableRoot } from \"./setup\"\nimport { resizableRootEvents, resizableRootProps, type ResizableRootEvents, type ResizableRootProps } from \"./types\"\n\nconst ResizableRootElementBase: BaseElementConstructor<ResizableRootProps> = defineCustomElement<\n ResizableRootProps,\n ResizableRootEvents\n>({\n props: resizableRootProps,\n events: resizableRootEvents,\n setup: useResizableRoot,\n})\nclass ResizableRootElement extends ResizableRootElementBase {}\n\nregisterCustomElement('prosekit-resizable-root', ResizableRootElement)\n \nexport { ResizableRootElement }\n"],"mappings":";;;;;;;AAQA,MAAaA,kBAAqC,cAChD,+BACA,KACD;;;;AAKD,MAAaC,uBAA+C,cAC1D,oCACA,KACD;;;;AAKD,MAAaC,qBAA2C,cACtD,kCACA,KACD;;;;AC3BD,SAAgB,uBAAuB,OAAiC;AACtE,QAAO,OAAO,UAAU,YAAY,OAAO,SAAS,MAAM,IAAI,QAAQ;;;;;ACCxE,SAAgB,WACd,UASA,GACA,GACA,IACA,IACA,aACwB;AACxB,eAAc,cAAc,cAAc,IAAI;AAC9C,eAAc,uBAAuB,YAAY,GAAG,cAAc;AAElE,SAAQ,UAAR;EACE,KAAK,eACH,QAAO,MA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AO;CACR,CAAC;AACF,IAAM,uBAAN,cAAmC,yBAAyB;AAE5D,sBAAsB,2BAA2B,qBAAqB"}
@@ -298,4 +298,5 @@ declare function useTableHandleRowTrigger(host: ConnectableElement, {
298
298
  state
299
299
  }: SetupOptions<TableHandleRowTriggerProps, TableHandleRowTriggerEvents>): void;
300
300
  //#endregion
301
- export { TableHandleColumnRootElement, type TableHandleColumnRootEvents, type TableHandleColumnRootProps, TableHandleColumnTriggerElement, type TableHandleColumnTriggerEvents, type TableHandleColumnTriggerProps, TableHandleDragPreviewElement, type TableHandleDragPreviewEvents, type TableHandleDragPreviewProps, TableHandleDropIndicatorElement, type TableHandleDropIndicatorEvents, type TableHandleDropIndicatorProps, TableHandlePopoverContentElement, type TableHandlePopoverContentEvents, type TableHandlePopoverContentProps, TableHandlePopoverItemElement, type TableHandlePopoverItemEvents, type TableHandlePopoverItemProps, TableHandleRootElement, type TableHandleRootEvents, type TableHandleRootProps, TableHandleRowRootElement, type TableHandleRowRootEvents, type TableHandleRowRootProps, TableHandleRowTriggerElement, type TableHandleRowTriggerEvents, type TableHandleRowTriggerProps, tableHandleColumnRootEvents, tableHandleColumnRootProps, tableHandleColumnTriggerEvents, tableHandleColumnTriggerProps, tableHandleDragPreviewEvents, tableHandleDragPreviewProps, tableHandleDropIndicatorEvents, tableHandleDropIndicatorProps, tableHandlePopoverContentEvents, tableHandlePopoverContentProps, tableHandlePopoverItemEvents, tableHandlePopoverItemProps, tableHandleRootEvents, tableHandleRootProps, tableHandleRowRootEvents, tableHandleRowRootProps, tableHandleRowTriggerEvents, tableHandleRowTriggerProps, useTableHandleColumnRoot, useTableHandleColumnTrigger, useTableHandleDragPreview, useTableHandleDropIndicator, useTableHandlePopoverContent, useTableHandlePopoverItem, useTableHandleRoot, useTableHandleRowRoot, useTableHandleRowTrigger };
301
+ export { TableHandleColumnRootElement, type TableHandleColumnRootEvents, type TableHandleColumnRootProps, TableHandleColumnTriggerElement, type TableHandleColumnTriggerEvents, type TableHandleColumnTriggerProps, TableHandleDragPreviewElement, type TableHandleDragPreviewEvents, type TableHandleDragPreviewProps, TableHandleDropIndicatorElement, type TableHandleDropIndicatorEvents, type TableHandleDropIndicatorProps, TableHandlePopoverContentElement, type TableHandlePopoverContentEvents, type TableHandlePopoverContentProps, TableHandlePopoverItemElement, type TableHandlePopoverItemEvents, type TableHandlePopoverItemProps, TableHandleRootElement, type TableHandleRootEvents, type TableHandleRootProps, TableHandleRowRootElement, type TableHandleRowRootEvents, type TableHandleRowRootProps, TableHandleRowTriggerElement, type TableHandleRowTriggerEvents, type TableHandleRowTriggerProps, tableHandleColumnRootEvents, tableHandleColumnRootProps, tableHandleColumnTriggerEvents, tableHandleColumnTriggerProps, tableHandleDragPreviewEvents, tableHandleDragPreviewProps, tableHandleDropIndicatorEvents, tableHandleDropIndicatorProps, tableHandlePopoverContentEvents, tableHandlePopoverContentProps, tableHandlePopoverItemEvents, tableHandlePopoverItemProps, tableHandleRootEvents, tableHandleRootProps, tableHandleRowRootEvents, tableHandleRowRootProps, tableHandleRowTriggerEvents, tableHandleRowTriggerProps, useTableHandleColumnRoot, useTableHandleColumnTrigger, useTableHandleDragPreview, useTableHandleDropIndicator, useTableHandlePopoverContent, useTableHandlePopoverItem, useTableHandleRoot, useTableHandleRowRoot, useTableHandleRowTrigger };
302
+ //# sourceMappingURL=prosekit-web-table-handle.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prosekit-web-table-handle.d.ts","names":[],"sources":["../src/components/table-handle/table-handle-column-root/types.ts","../src/components/table-handle/table-handle-column-root/element.gen.ts","../src/components/table-handle/table-handle-column-root/setup.ts","../src/components/table-handle/table-handle-column-trigger/types.ts","../src/components/table-handle/table-handle-column-trigger/element.gen.ts","../src/components/table-handle/table-handle-column-trigger/setup.ts","../src/components/table-handle/table-handle-drag-preview/types.ts","../src/components/table-handle/table-handle-drag-preview/element.gen.ts","../src/components/table-handle/table-handle-drag-preview/setup.ts","../src/components/table-handle/table-handle-drop-indicator/types.ts","../src/components/table-handle/table-handle-drop-indicator/element.gen.ts","../src/components/table-handle/table-handle-drop-indicator/setup.ts","../src/components/table-handle/table-handle-popover-content/types.ts","../src/components/table-handle/table-handle-popover-content/element.gen.ts","../src/components/table-handle/table-handle-popover-content/setup.ts","../src/components/table-handle/table-handle-popover-item/types.ts","../src/components/table-handle/table-handle-popover-item/element.gen.ts","../src/components/table-handle/table-handle-popover-item/setup.ts","../src/components/table-handle/table-handle-root/types.ts","../src/components/table-handle/table-handle-root/element.gen.ts","../src/components/table-handle/table-handle-root/setup.ts","../src/components/table-handle/table-handle-row-root/types.ts","../src/components/table-handle/table-handle-row-root/element.gen.ts","../src/components/table-handle/table-handle-row-root/setup.ts","../src/components/table-handle/table-handle-row-trigger/types.ts","../src/components/table-handle/table-handle-row-trigger/element.gen.ts","../src/components/table-handle/table-handle-row-trigger/setup.ts"],"sourcesContent":[],"mappings":";;;;;;;;;UAaiB,0BAAA,SAAmC,KAAK;;;;;AAAzD;;QAAyD,EAO/C,MAP+C,GAAA,IAAA;;;;;AA4CzD;EAYE,SAAA,EA1CW,SA0CX;;;;AAGF;AAGA;;OAA4D,EAAA,OAAA;;;;;;ECtEtD;;;;EAAwD,KAAA,EAAA,OAAA;EAQxD;;;;ECYU,IAAA,EAAA,OAAA;;;AAEZ,cF8BS,0BE9BT,EF8BqC,gBE9BrC,CF8BsD,0BE9BtD,CAAA;;AAAkB,UF6CL,2BAAA,SAAoC,uBE7C/B,CAAA;;cFgDT,6BAA6B,kBAAkB;;;cCtEtD,kCAAkC,uBAAuB;cAQzD,4BAAA,SAAqC,gCAAA;;;;;;iBCY3B,wBAAA,OACR;;;SACc,YAAY;;;;KCpB7B,wBAAA,GAAyB,kBAAkB;UAE/B,6BAAA;UACP,OAAO;;;cAIJ,+BAA+B,iBAAiB;AHD7D;AAA4C,UGM3B,8BAAA,CHN2B;;AAc/B,cGLA,8BHKA,EGLgC,iBHKhC,CGLkD,8BHKlD,CAAA;;;cItBP,qCAAqC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zB,CkBH0C,oBlBG1C,CAAA;;AAP0C,UkBSnC,qBAAA,ClBTmC;AA4CpD;AAYE,ckB5CW,qBlB4CX,EkB5CkC,iBlB4ClC,CkB5CoD,qBlB4CpD,CAAA;;;cmBhEI,4BAA4B,uBAAuB;cAQnD,sBAAA,SAA+B,0BAAA;;;;;;iBCyBrB,kBAAA,OACR;;;SACc,YAAY;;;;UC5BjB,uBAAA,SAAgC,KAAK;;;;;ArBCtD;;QAAyD,EqBM/C,MrBN+C,GAAA,IAAA;;;;;AA4CzD;EAYE,SAAA,EqB3CW,SrB2CX;;;;AAGF;AAGA;;OAA4D,EAAA,OAAA;;;;;;ECtEtD;;;;EAAwD,KAAA,EAAA,OAAA;EAQxD;;;;ECYU,IAAA,EAAA,OAAA;;;AAEZ,cmB6BS,uBnB7BT,EmB6BkC,gBnB7BlC,CmB6BmD,uBnB7BnD,CAAA;;AAAkB,UmB4CL,wBAAA,SAAiC,uBnB5C5B,CAAA;;cmB+CT,0BAA0B,kBAAkB;;;cCrEnD,+BAA+B,uBAAuB;cAQtD,yBAAA,SAAkC,6BAAA;;;;;;iBCgBxB,qBAAA,OACR;;GACK,aAAa,yBAAyB;;;KCxB9C,wBAAA,GAAyB,kBAAkB;UAE/B,0BAAA;UACP,OAAO;;;cAIJ,4BAA4B,iBAAiB;AxBDzC,UwBKA,2BAAA,CxBL2B;EAAA,MAAA,EwBMlC,WxBNkC,CAAA,IAAA,CAAA;;;AAc/B,cwBJA,2BxBIA,EwBJ6B,iBxBI7B,CwBJ+C,2BxBI/C,CAAA;;;cyBtBP,kCAAkC,uBAAuB;cAQzD,4BAAA,SAAqC,gCAAA;;;;;;iBCU3B,wBAAA,OACR;;GACK,aAAa,4BAA4B"}
@@ -2,7 +2,7 @@ import { getStateWithDefaults } from "./get-default-state-CIEy7xrl.js";
2
2
  import { useEditorExtension } from "./use-editor-extension-Cc7ZG7uj.js";
3
3
  import { getSafeEditorView } from "./get-safe-editor-view-DENm4avv.js";
4
4
  import { assignStyles, useScrolling } from "./use-scrolling-BNfsQs3S.js";
5
- import { cloneElement, deepCloneElement, injectStyle } from "./inject-style-RwRNoINh.js";
5
+ import { cloneElement, deepCloneElement, injectStyle } from "./inject-style-BJQNFufI.js";
6
6
  import { createComputed, createContext, createSignal, defineCustomElement, defineEmit, registerCustomElement, useAttribute, useEffect, useEventListener } from "@aria-ui/core";
7
7
  import { defineDOMEventHandler, union } from "@prosekit/core";
8
8
  import { useOverlayPositionerState } from "@aria-ui/overlay/elements";
@@ -146,6 +146,7 @@ function useTableHandleColumnTrigger(host, { state }) {
146
146
  dataTransfer.effectAllowed = "move";
147
147
  const emptyImage = getEmptyImage();
148
148
  if (emptyImage) dataTransfer.setDragImage(emptyImage, 0, 0);
149
+ dataTransfer.setData("application/x-prosekit-table-handle-drag", "");
149
150
  }
150
151
  const prev = dndContext.peek();
151
152
  const index = context.peek()?.colIndex;
@@ -163,24 +164,6 @@ function useTableHandleColumnTrigger(host, { state }) {
163
164
  startY: event.clientY
164
165
  });
165
166
  });
166
- useEventListener(host, "drag", (event) => {
167
- const prev = dndContext.peek();
168
- if (event.clientX === 0 && event.clientY === 0) return;
169
- dndContext.set({
170
- ...prev,
171
- direction: "col",
172
- dragging: true,
173
- x: event.clientX,
174
- y: event.clientY
175
- });
176
- });
177
- useEventListener(host, "dragend", () => {
178
- const prev = dndContext.peek();
179
- dndContext.set({
180
- ...prev,
181
- dragging: false
182
- });
183
- });
184
167
  }
185
168
 
186
169
  //#endregion
@@ -206,16 +189,13 @@ function useInitDndPosition(host, editor, onInit) {
206
189
  const dndContext = tableHandleDndContext.consume(host);
207
190
  const rootContext = tableHandleRootContext.consume(host);
208
191
  const draggingSignal = createComputed(() => {
209
- const context = dndContext.get();
210
- return context.dragging;
192
+ return dndContext.get().dragging;
211
193
  });
212
194
  const directionSignal = createComputed(() => {
213
- const context = dndContext.get();
214
- return context.direction;
195
+ return dndContext.get().direction;
215
196
  });
216
197
  const draggingIndexSignal = createComputed(() => {
217
- const context = dndContext.get();
218
- return context.draggingIndex;
198
+ return dndContext.get().draggingIndex;
219
199
  });
220
200
  useEffect(host, () => {
221
201
  const view = getSafeEditorView(editor.get());
@@ -259,20 +239,11 @@ function useInitDndPosition(host, editor, onInit) {
259
239
  function getTableDOMByPos(view, pos) {
260
240
  const dom = view.domAtPos(pos).node;
261
241
  if (!dom) return;
262
- const element = isHTMLElement(dom) ? dom : dom.parentElement;
263
- const table = element?.closest("table");
264
- return table ?? void 0;
242
+ return (isHTMLElement(dom) ? dom : dom.parentElement)?.closest("table") ?? void 0;
265
243
  }
266
244
  function getTargetFirstCellDOM(table, index, direction) {
267
- if (direction === "row") {
268
- const row = table.querySelectorAll("tr")[index];
269
- const cell = row?.querySelector("td");
270
- return cell ?? void 0;
271
- } else {
272
- const row = table.querySelector("tr");
273
- const cell = row?.querySelectorAll("td")[index];
274
- return cell ?? void 0;
275
- }
245
+ if (direction === "row") return table.querySelectorAll("tr")[index]?.querySelector("td") ?? void 0;
246
+ else return table.querySelector("tr")?.querySelectorAll("td")[index] ?? void 0;
276
247
  }
277
248
  function getDndRelatedDOMs(view, cellPos, draggingIndex, direction) {
278
249
  if (cellPos == null) return;
@@ -317,12 +288,10 @@ function fadeColor(color, opacity) {
317
288
  function getEffectiveBackgroundColor(element) {
318
289
  let current = element;
319
290
  while (current) {
320
- const style = current.ownerDocument.defaultView?.getComputedStyle(current);
321
- const backgroundColor = style?.backgroundColor;
291
+ const backgroundColor = (current.ownerDocument.defaultView?.getComputedStyle(current))?.backgroundColor;
322
292
  if (backgroundColor && backgroundColor !== "transparent" && backgroundColor !== "rgba(0, 0, 0, 0)") return backgroundColor;
323
293
  current = current.parentElement;
324
294
  }
325
- return void 0;
326
295
  }
327
296
 
328
297
  //#endregion
@@ -356,8 +325,7 @@ function createPreviewDOM(table, previewRoot, index, direction) {
356
325
  const [previewRow, previewRowStyle] = cloneElement(row);
357
326
  injectStyle(previewRoot, previewRowStyle);
358
327
  unsetSize(previewRow);
359
- const cells = row.querySelectorAll("td");
360
- const cell = cells[index];
328
+ const cell = row.querySelectorAll("td")[index];
361
329
  if (cell) {
362
330
  const [previewCell, previewCellStyle] = deepCloneElement(cell);
363
331
  injectStyle(previewRoot, previewCellStyle);
@@ -383,16 +351,13 @@ function useUpdatePreviewPosition(host, editor) {
383
351
  const dndContext = tableHandleDndContext.consume(host);
384
352
  const rootContext = tableHandleRootContext.consume(host);
385
353
  const draggingSignal = createComputed(() => {
386
- const context = dndContext.get();
387
- return context.dragging;
354
+ return dndContext.get().dragging;
388
355
  });
389
356
  const clientXSignal = createComputed(() => {
390
- const context = dndContext.get();
391
- return context.x;
357
+ return dndContext.get().x;
392
358
  });
393
359
  const clientYSignal = createComputed(() => {
394
- const context = dndContext.get();
395
- return context.y;
360
+ return dndContext.get().y;
396
361
  });
397
362
  useEffect(host, () => {
398
363
  const view = getSafeEditorView(editor.get());
@@ -524,16 +489,13 @@ function useUpdateIndicatorPosition(host, editor, handleWidth) {
524
489
  const dndContext = tableHandleDndContext.consume(host);
525
490
  const rootContext = tableHandleRootContext.consume(host);
526
491
  const draggingSignal = createComputed(() => {
527
- const context = dndContext.get();
528
- return context.dragging;
492
+ return dndContext.get().dragging;
529
493
  });
530
494
  const clientXSignal = createComputed(() => {
531
- const context = dndContext.get();
532
- return context.x;
495
+ return dndContext.get().x;
533
496
  });
534
497
  const clientYSignal = createComputed(() => {
535
- const context = dndContext.get();
536
- return context.y;
498
+ return dndContext.get().y;
537
499
  });
538
500
  const startXSignal = createComputed(() => {
539
501
  return dndContext.get().startX;
@@ -796,12 +758,12 @@ function useSelecting(host, editor, enabled) {
796
758
  function useDrop(host, editor, dndContext) {
797
759
  const dragging = createComputed(() => dndContext.get().dragging);
798
760
  useEffect(host, () => {
799
- if (!dragging.get()) return;
800
- const view = getSafeEditorView(editor.peek());
761
+ const view = getSafeEditorView(editor.get());
801
762
  if (!view || !view.editable) return;
802
763
  const ownerDocument = view.dom?.ownerDocument;
803
764
  if (!ownerDocument) return;
804
765
  const handleDrop = () => {
766
+ if (!dragging.peek()) return;
805
767
  const editorValue = editor.peek();
806
768
  if (!editorValue) return;
807
769
  const { droppingIndex, draggingIndex, direction } = dndContext.peek();
@@ -828,13 +790,31 @@ function useDrop(host, editor, dndContext) {
828
790
  }
829
791
  };
830
792
  const handleDragOver = (event) => {
793
+ if (!dragging.peek()) return;
831
794
  event.preventDefault();
795
+ const prev = dndContext.peek();
796
+ dndContext.set({
797
+ ...prev,
798
+ dragging: true,
799
+ x: event.clientX,
800
+ y: event.clientY
801
+ });
802
+ };
803
+ const handleDragEnd = () => {
804
+ if (!dragging.peek()) return;
805
+ const prev = dndContext.peek();
806
+ dndContext.set({
807
+ ...prev,
808
+ dragging: false
809
+ });
832
810
  };
833
811
  ownerDocument.addEventListener("dragover", handleDragOver);
834
812
  ownerDocument.addEventListener("drop", handleDrop);
813
+ ownerDocument.addEventListener("dragend", handleDragEnd);
835
814
  return () => {
836
815
  ownerDocument.removeEventListener("dragover", handleDragOver);
837
816
  ownerDocument.removeEventListener("drop", handleDrop);
817
+ ownerDocument.removeEventListener("dragend", handleDragEnd);
838
818
  };
839
819
  });
840
820
  }
@@ -1046,24 +1026,6 @@ function useTableHandleRowTrigger(host, { state }) {
1046
1026
  startY: event.clientY
1047
1027
  });
1048
1028
  });
1049
- useEventListener(host, "drag", (event) => {
1050
- const prev = dndContext.peek();
1051
- if (event.clientX === 0 && event.clientY === 0) return;
1052
- dndContext.set({
1053
- ...prev,
1054
- direction: "row",
1055
- dragging: true,
1056
- x: event.clientX,
1057
- y: event.clientY
1058
- });
1059
- });
1060
- useEventListener(host, "dragend", () => {
1061
- const prev = dndContext.peek();
1062
- dndContext.set({
1063
- ...prev,
1064
- dragging: false
1065
- });
1066
- });
1067
1029
  }
1068
1030
 
1069
1031
  //#endregion
@@ -1084,4 +1046,5 @@ var TableHandleRowTriggerElement = class extends TableHandleRowTriggerElementBas
1084
1046
  registerCustomElement("prosekit-table-handle-row-trigger", TableHandleRowTriggerElement);
1085
1047
 
1086
1048
  //#endregion
1087
- export { TableHandleColumnRootElement, TableHandleColumnTriggerElement, TableHandleDragPreviewElement, TableHandleDropIndicatorElement, TableHandlePopoverContentElement, TableHandlePopoverItemElement, TableHandleRootElement, TableHandleRowRootElement, TableHandleRowTriggerElement, tableHandleColumnRootEvents, tableHandleColumnRootProps, tableHandleColumnTriggerEvents, tableHandleColumnTriggerProps, tableHandleDragPreviewEvents, tableHandleDragPreviewProps, tableHandleDropIndicatorEvents, tableHandleDropIndicatorProps, tableHandlePopoverContentEvents, tableHandlePopoverContentProps, tableHandlePopoverItemEvents, tableHandlePopoverItemProps, tableHandleRootEvents, tableHandleRootProps, tableHandleRowRootEvents, tableHandleRowRootProps, tableHandleRowTriggerEvents, tableHandleRowTriggerProps, useTableHandleColumnRoot, useTableHandleColumnTrigger, useTableHandleDragPreview, useTableHandleDropIndicator, useTableHandlePopoverContent, useTableHandlePopoverItem, useTableHandleRoot, useTableHandleRowRoot, useTableHandleRowTrigger };
1049
+ export { TableHandleColumnRootElement, TableHandleColumnTriggerElement, TableHandleDragPreviewElement, TableHandleDropIndicatorElement, TableHandlePopoverContentElement, TableHandlePopoverItemElement, TableHandleRootElement, TableHandleRowRootElement, TableHandleRowTriggerElement, tableHandleColumnRootEvents, tableHandleColumnRootProps, tableHandleColumnTriggerEvents, tableHandleColumnTriggerProps, tableHandleDragPreviewEvents, tableHandleDragPreviewProps, tableHandleDropIndicatorEvents, tableHandleDropIndicatorProps, tableHandlePopoverContentEvents, tableHandlePopoverContentProps, tableHandlePopoverItemEvents, tableHandlePopoverItemProps, tableHandleRootEvents, tableHandleRootProps, tableHandleRowRootEvents, tableHandleRowRootProps, tableHandleRowTriggerEvents, tableHandleRowTriggerProps, useTableHandleColumnRoot, useTableHandleColumnTrigger, useTableHandleDragPreview, useTableHandleDropIndicator, useTableHandlePopoverContent, useTableHandlePopoverItem, useTableHandleRoot, useTableHandleRowRoot, useTableHandleRowTrigger };
1050
+ //# sourceMappingURL=prosekit-web-table-handle.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prosekit-web-table-handle.js","names":["tableHandleRootContext: Context<TableHandleRootContext>","defaultTableHandleDndContext: TableHandleDndContext","tableHandleDndContext: Context<TableHandleDndContext>","menuRootState: SignalState<MenuRootProps>","tableHandleColumnRootProps: PropDeclarations<TableHandleColumnRootProps>","overlayPositionerProps","tableHandleColumnRootEvents: EventDeclarations<TableHandleColumnRootEvents>","overlayPositionerEvents","TableHandleColumnRootElementBase: BaseElementConstructor<TableHandleColumnRootProps>","image: HTMLImageElement | undefined","tableHandleColumnTriggerProps: PropDeclarations<TableHandleColumnTriggerProps>","tableHandleColumnTriggerEvents: EventDeclarations<TableHandleColumnTriggerEvents>","TableHandleColumnTriggerElementBase: BaseElementConstructor<TableHandleColumnTriggerProps>","isColorMixSupported: () => boolean","current: HTMLElement | null","y","x","tableHandleDragPreviewProps: PropDeclarations<TableHandleDragPreviewProps>","tableHandleDragPreviewEvents: EventDeclarations<TableHandleDragPreviewEvents>","TableHandleDragPreviewElementBase: BaseElementConstructor<TableHandleDragPreviewProps>","index","direction","x","y","tableHandleDropIndicatorProps: PropDeclarations<TableHandleDropIndicatorProps>","tableHandleDropIndicatorEvents: EventDeclarations<TableHandleDropIndicatorEvents>","TableHandleDropIndicatorElementBase: BaseElementConstructor<TableHandleDropIndicatorProps>","menuContentState: SignalState<MenuContentProps>","keydownHandlers: Array<(event: KeyboardEvent) => void>","tableHandlePopoverContentProps: PropDeclarations<TableHandlePopoverContentProps>","tableHandlePopoverContentEvents: EventDeclarations<TableHandlePopoverContentEvents>","TableHandlePopoverContentElementBase: BaseElementConstructor<TableHandlePopoverContentProps>","tableHandlePopoverItemProps: PropDeclarations<TableHandlePopoverItemProps>","tableHandlePopoverItemEvents: EventDeclarations<TableHandlePopoverItemEvents>","TableHandlePopoverItemElementBase: BaseElementConstructor<TableHandlePopoverItemProps>","tableHandleRootProps: PropDeclarations<TableHandleRootProps>","tableHandleRootEvents: EventDeclarations<TableHandleRootEvents>","TableHandleRootElementBase: BaseElementConstructor<TableHandleRootProps>","tableHandleRowRootProps: PropDeclarations<TableHandleRowRootProps>","overlayPositionerProps","tableHandleRowRootEvents: EventDeclarations<TableHandleRowRootEvents>","TableHandleRowRootElementBase: BaseElementConstructor<TableHandleRowRootProps>","tableHandleRowTriggerProps: PropDeclarations<TableHandleRowTriggerProps>","tableHandleRowTriggerEvents: EventDeclarations<TableHandleRowTriggerEvents>","TableHandleRowTriggerElementBase: BaseElementConstructor<TableHandleRowTriggerProps>"],"sources":["../src/components/table-handle/context.ts","../src/components/table-handle/table-handle-column-root/setup.ts","../src/components/table-handle/table-handle-column-root/types.ts","../src/components/table-handle/table-handle-column-root/element.gen.ts","../src/components/table-handle/hooks/use-empty-image.ts","../src/components/table-handle/table-handle-column-trigger/setup.ts","../src/components/table-handle/table-handle-column-trigger/types.ts","../src/components/table-handle/table-handle-column-trigger/element.gen.ts","../src/components/table-handle/dnd.ts","../src/utils/css-feature-detection.ts","../src/utils/fade-color.ts","../src/utils/get-effective-background-color.ts","../src/components/table-handle/table-handle-drag-preview/render-preview.ts","../src/components/table-handle/table-handle-drag-preview/updater.ts","../src/components/table-handle/table-handle-drag-preview/setup.ts","../src/components/table-handle/table-handle-drag-preview/types.ts","../src/components/table-handle/table-handle-drag-preview/element.gen.ts","../src/components/table-handle/table-handle-drop-indicator/calc-drag-over.ts","../src/components/table-handle/table-handle-drop-indicator/updater.ts","../src/components/table-handle/table-handle-drop-indicator/setup.ts","../src/components/table-handle/table-handle-drop-indicator/types.ts","../src/components/table-handle/table-handle-drop-indicator/element.gen.ts","../src/components/table-handle/table-handle-popover-content/setup.ts","../src/components/table-handle/table-handle-popover-content/types.ts","../src/components/table-handle/table-handle-popover-content/element.gen.ts","../src/components/table-handle/table-handle-popover-item/setup.ts","../src/components/table-handle/table-handle-popover-item/types.ts","../src/components/table-handle/table-handle-popover-item/element.gen.ts","../src/hooks/use-editor-typing.ts","../src/hooks/use-selecting.ts","../src/components/table-handle/hooks/use-drop.ts","../src/components/table-handle/utils.ts","../src/components/table-handle/table-handle-root/setup.ts","../src/components/table-handle/table-handle-root/types.ts","../src/components/table-handle/table-handle-root/element.gen.ts","../src/components/table-handle/table-handle-row-root/setup.ts","../src/components/table-handle/table-handle-row-root/types.ts","../src/components/table-handle/table-handle-row-root/element.gen.ts","../src/components/table-handle/table-handle-row-trigger/setup.ts","../src/components/table-handle/table-handle-row-trigger/types.ts","../src/components/table-handle/table-handle-row-trigger/element.gen.ts"],"sourcesContent":["import {\n createContext,\n type Context,\n} from '@aria-ui/core'\n\nimport type {\n DndInfo,\n HoveringCellInfo,\n} from './utils'\n\n/**\n * @internal\n */\nexport type TableHandleRootContext = HoveringCellInfo | null\n\n/**\n * @internal\n */\nexport const tableHandleRootContext: Context<TableHandleRootContext> = createContext(\n 'prosekit-table-handle-root-context',\n null,\n)\n\n/**\n * @internal\n */\nexport type TableHandleDndContext = DndInfo\n\n/**\n * @internal\n */\nexport const defaultTableHandleDndContext: TableHandleDndContext = {\n dragging: false,\n direction: 'row',\n draggingIndex: -1,\n droppingIndex: -1,\n x: -1,\n y: -1,\n startX: -1,\n startY: -1,\n}\n\n/**\n * @internal\n */\nexport const tableHandleDndContext: Context<TableHandleDndContext> = createContext(\n 'prosekit-table-handle-dnd-context',\n defaultTableHandleDndContext,\n)\n","import {\n createComputed,\n createSignal,\n useAttribute,\n useEffect,\n type ConnectableElement,\n type SignalState,\n} from '@aria-ui/core'\nimport {\n menuRootProps,\n useMenuRoot,\n type MenuRootProps,\n} from '@aria-ui/menu/elements'\nimport { useOverlayPositionerState } from '@aria-ui/overlay/elements'\nimport { usePresence } from '@aria-ui/presence'\n\nimport { getStateWithDefaults } from '../../../utils/get-default-state'\nimport { getSafeEditorView } from '../../../utils/get-safe-editor-view'\nimport { tableHandleRootContext } from '../context'\n\nimport type { TableHandleColumnRootProps } from './types'\n\n/**\n * @internal\n */\nexport function useTableHandleColumnRoot(\n host: ConnectableElement,\n { state }: { state: SignalState<TableHandleColumnRootProps> },\n): void {\n const { editor, ...overlayState } = state\n\n const rootContext = tableHandleRootContext.consume(host)\n\n const colFirstCellPos = createComputed<number | undefined>(() => {\n return rootContext.get()?.colFirstCellPos\n })\n\n const referenceCell = createComputed<HTMLElement | null>(() => {\n const pos = colFirstCellPos.get()\n const view = getSafeEditorView(editor.get())\n if (!pos || !view) return null\n return view.nodeDOM(pos) as HTMLElement | null\n })\n\n const contentOpen = createSignal(false)\n\n // Close the menu when the hovering element is changed\n // TODO: add a delay\n useEffect(host, () => {\n colFirstCellPos.get()\n contentOpen.set(false)\n })\n\n useOverlayPositionerState(host, overlayState, {\n reference: referenceCell,\n })\n\n const presence = createComputed(() => !!referenceCell.get())\n useAttribute(host, 'data-state', () => (presence.get() ? 'open' : 'closed'))\n usePresence(host, presence)\n\n const menuRootState: SignalState<MenuRootProps> = getStateWithDefaults(\n { open: contentOpen },\n menuRootProps,\n )\n\n useMenuRoot(host, {\n state: menuRootState,\n emit: () => void 0,\n })\n}\n","import type {\n EventDeclarations,\n PropDeclarations,\n} from '@aria-ui/core'\nimport {\n overlayPositionerEvents,\n overlayPositionerProps,\n type OverlayPositionerEvents,\n type OverlayPositionerProps,\n} from '@aria-ui/overlay'\nimport type { Placement } from '@floating-ui/dom'\nimport type { Editor } from '@prosekit/core'\n\nexport interface TableHandleColumnRootProps extends Omit<OverlayPositionerProps, 'placement' | 'hoist' | 'flip' | 'shift' | 'hide'> {\n /**\n * The ProseKit editor instance.\n *\n * @default null\n * @hidden\n */\n editor: Editor | null\n\n /**\n * The placement of the popover, relative to the hovered table cell.\n *\n * @default \"top\"\n */\n placement: Placement\n\n /**\n * Whether to use the browser [Popover API](https://developer.mozilla.org/en-US/docs/Web/API/Popover_API)\n * to place the floating element on top of other page content.\n *\n * @default false\n */\n hoist: boolean\n\n /**\n * @default false\n * @hidden\n */\n flip: boolean\n\n /**\n * @default false\n * @hidden\n */\n shift: boolean\n\n /**\n * @default true\n * @hidden\n */\n hide: boolean\n}\n\n/** @internal */\nexport const tableHandleColumnRootProps: PropDeclarations<TableHandleColumnRootProps> = Object.freeze({\n ...overlayPositionerProps,\n editor: { default: null },\n placement: { default: 'top' },\n\n // Enabling `hoist` will cause the popover to have a small delay when\n // scrolling the page.\n hoist: { default: false },\n\n flip: { default: false },\n shift: { default: false },\n hide: { default: true },\n})\n\n/** @internal */\nexport interface TableHandleColumnRootEvents extends OverlayPositionerEvents {}\n\n/** @internal */\nexport const tableHandleColumnRootEvents: EventDeclarations<TableHandleColumnRootEvents> = overlayPositionerEvents\n","import { defineCustomElement, registerCustomElement, type BaseElementConstructor } from \"@aria-ui/core\"\n\nimport { useTableHandleColumnRoot } from \"./setup\"\nimport { tableHandleColumnRootEvents, tableHandleColumnRootProps, type TableHandleColumnRootEvents, type TableHandleColumnRootProps } from \"./types\"\n\nconst TableHandleColumnRootElementBase: BaseElementConstructor<TableHandleColumnRootProps> = defineCustomElement<\n TableHandleColumnRootProps,\n TableHandleColumnRootEvents\n>({\n props: tableHandleColumnRootProps,\n events: tableHandleColumnRootEvents,\n setup: useTableHandleColumnRoot,\n})\nclass TableHandleColumnRootElement extends TableHandleColumnRootElementBase {}\n\nregisterCustomElement('prosekit-table-handle-column-root', TableHandleColumnRootElement)\n \nexport { TableHandleColumnRootElement }\n","import type { ConnectableElement } from '@aria-ui/core'\nimport { useEffect } from '@aria-ui/core'\n\n/**\n * Returns a function that returns a 1x1 transparent image. This is used to\n * prevent the browser from showing the default drag image. An earth icon in\n * chrome is used as the default drag image. This image must be loaded before\n * the dragStart event triggers.\n *\n * See https://stackoverflow.com/a/40923520\n *\n * @internal\n */\nexport function useEmptyImage(\n host: ConnectableElement,\n): () => HTMLImageElement | undefined {\n let image: HTMLImageElement | undefined\n\n useEffect(host, () => {\n image = new Image(1, 1)\n image.src = 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7'\n\n return () => {\n image?.remove()\n image = undefined\n }\n })\n\n return () => image\n}\n","import {\n useEffect,\n useEventListener,\n type ConnectableElement,\n type SetupOptions,\n} from '@aria-ui/core'\nimport { useMenuTrigger } from '@aria-ui/menu/elements'\nimport { selectTableColumn } from '@prosekit/extensions/table'\n\nimport {\n tableHandleDndContext,\n tableHandleRootContext,\n} from '../context'\nimport { useEmptyImage } from '../hooks/use-empty-image'\n\nimport type {\n TableHandleColumnTriggerEvents,\n TableHandleColumnTriggerProps,\n} from './types'\n\n/**\n * @internal\n */\nexport function useTableHandleColumnTrigger(\n host: ConnectableElement,\n { state }: SetupOptions<TableHandleColumnTriggerProps, TableHandleColumnTriggerEvents>,\n): void {\n useMenuTrigger(host)\n\n const context = tableHandleRootContext.consume(host)\n\n const dndContext = tableHandleDndContext.consume(host)\n\n useEventListener(host, 'pointerdown', () => {\n const editor = state.editor.peek()\n const cellPos = context.peek()?.cellPos\n if (!editor || !cellPos) return\n editor.exec(selectTableColumn({ head: cellPos }))\n })\n\n useEffect(host, () => {\n host.draggable = true\n })\n\n const getEmptyImage = useEmptyImage(host)\n\n useEventListener(host, 'dragstart', (event: DragEvent) => {\n const dataTransfer = event.dataTransfer\n if (dataTransfer) {\n dataTransfer.effectAllowed = 'move'\n const emptyImage = getEmptyImage()\n if (emptyImage) {\n dataTransfer.setDragImage(emptyImage, 0, 0)\n }\n dataTransfer.setData('application/x-prosekit-table-handle-drag', '')\n }\n const prev = dndContext.peek()\n const index = context.peek()?.colIndex\n\n if (index == null || index < 0) {\n console.warn('[prosekit] Invalid column index for drag operation:', index)\n event.preventDefault()\n return\n }\n\n dndContext.set({\n ...prev,\n direction: 'col',\n dragging: true,\n draggingIndex: index,\n startX: event.clientX,\n startY: event.clientY,\n })\n })\n}\n","import type {\n EventDeclarations,\n PropDeclarations,\n} from '@aria-ui/core'\nimport type { Editor } from '@prosekit/core'\nimport type { defineTableCommands } from '@prosekit/extensions/table'\n\ntype TableCommandsExtension = ReturnType<typeof defineTableCommands>\n\nexport interface TableHandleColumnTriggerProps {\n editor: Editor<TableCommandsExtension> | null\n}\n\n/** @internal */\nexport const tableHandleColumnTriggerProps: PropDeclarations<TableHandleColumnTriggerProps> = {\n editor: { default: null },\n}\n\n/** @internal */\nexport interface TableHandleColumnTriggerEvents {}\n\n/** @internal */\nexport const tableHandleColumnTriggerEvents: EventDeclarations<TableHandleColumnTriggerEvents> = {}\n","import { defineCustomElement, registerCustomElement, type BaseElementConstructor } from \"@aria-ui/core\"\n\nimport { useTableHandleColumnTrigger } from \"./setup\"\nimport { tableHandleColumnTriggerEvents, tableHandleColumnTriggerProps, type TableHandleColumnTriggerEvents, type TableHandleColumnTriggerProps } from \"./types\"\n\nconst TableHandleColumnTriggerElementBase: BaseElementConstructor<TableHandleColumnTriggerProps> = defineCustomElement<\n TableHandleColumnTriggerProps,\n TableHandleColumnTriggerEvents\n>({\n props: tableHandleColumnTriggerProps,\n events: tableHandleColumnTriggerEvents,\n setup: useTableHandleColumnTrigger,\n})\nclass TableHandleColumnTriggerElement extends TableHandleColumnTriggerElementBase {}\n\nregisterCustomElement('prosekit-table-handle-column-trigger', TableHandleColumnTriggerElement)\n \nexport { TableHandleColumnTriggerElement }\n","import {\n createComputed,\n useEffect,\n type ConnectableElement,\n type ReadonlySignal,\n} from '@aria-ui/core'\nimport {\n computePosition,\n offset,\n} from '@floating-ui/dom'\nimport { isHTMLElement } from '@ocavue/utils'\nimport type { Editor } from '@prosekit/core'\nimport type { EditorView } from '@prosekit/pm/view'\n\nimport { assignStyles } from '../../utils/assign-styles'\nimport { getSafeEditorView } from '../../utils/get-safe-editor-view'\n\nimport {\n tableHandleDndContext,\n tableHandleRootContext,\n} from './context'\n\nexport type OnInitParams = {\n host: ConnectableElement\n direction: 'row' | 'col'\n dragging: boolean\n draggingIndex: number\n table: HTMLTableElement\n cell: HTMLTableCellElement\n}\n\nexport function useInitDndPosition(\n host: ConnectableElement,\n editor: ReadonlySignal<Editor | null>,\n onInit: (params: OnInitParams) => void,\n): void {\n const dndContext = tableHandleDndContext.consume(host)\n const rootContext = tableHandleRootContext.consume(host)\n\n const draggingSignal = createComputed(() => {\n const context = dndContext.get()\n return context.dragging\n })\n\n const directionSignal = createComputed(() => {\n const context = dndContext.get()\n return context.direction\n })\n\n const draggingIndexSignal = createComputed(() => {\n const context = dndContext.get()\n return context.draggingIndex\n })\n\n useEffect(host, () => {\n const view = getSafeEditorView(editor.get())\n if (!view) return\n\n const dragging = draggingSignal.get()\n const direction = directionSignal.get()\n\n host.dataset.direction = direction\n host.dataset.dragging = dragging.toString()\n\n const draggingIndex = draggingIndexSignal.get()\n\n const relatedDOMs = getDndRelatedDOMs(view, rootContext.peek()?.cellPos, draggingIndex, direction)\n if (!relatedDOMs) return\n const { table, cell } = relatedDOMs\n\n onInit({\n host,\n direction,\n dragging,\n draggingIndex,\n table,\n cell,\n })\n\n if (!dragging) return\n\n let cancelled = false\n\n void computePosition(cell, host, {\n placement: direction === 'row' ? 'right' : 'bottom',\n middleware: [\n offset(({ rects }) => {\n if (direction === 'col') {\n return -rects.reference.height\n }\n return -rects.reference.width\n }),\n ],\n }).then(({ x, y }) => {\n if (cancelled) return\n assignStyles(host, {\n left: `${x}px`,\n top: `${y}px`,\n })\n })\n\n return () => {\n cancelled = true\n }\n })\n}\n\nfunction getTableDOMByPos(view: EditorView, pos: number): HTMLTableElement | undefined {\n const dom = view.domAtPos(pos).node\n if (!dom) return\n const element = isHTMLElement(dom) ? dom : dom.parentElement\n const table = element?.closest('table')\n return table ?? undefined\n}\n\nfunction getTargetFirstCellDOM(table: HTMLTableElement, index: number, direction: 'row' | 'col'): HTMLTableCellElement | undefined {\n if (direction === 'row') {\n const row = table.querySelectorAll('tr')[index]\n const cell = row?.querySelector('td')\n return cell ?? undefined\n } else {\n const row = table.querySelector('tr')\n const cell = row?.querySelectorAll('td')[index]\n return cell ?? undefined\n }\n}\n\nexport function getDndRelatedDOMs(view: EditorView, cellPos: number | undefined, draggingIndex: number, direction: 'row' | 'col'): { table: HTMLTableElement; cell: HTMLTableCellElement } | undefined {\n if (cellPos == null) return\n const table = getTableDOMByPos(view, cellPos)\n if (!table) return\n const cell = getTargetFirstCellDOM(table, draggingIndex, direction)\n if (!cell) return\n return { table, cell }\n}\n","import { once } from '@ocavue/utils'\n\nexport const isColorMixSupported: () => boolean = once(() => {\n try {\n return CSS.supports('background-color', 'color-mix(in srgb, red, blue)')\n } catch {\n return false\n }\n})\n","import { isColorMixSupported } from './css-feature-detection'\n\n/**\n * Convert a color to a color with opacity\n * @param color - The color to convert\n * @param opacity - The opacity to apply\n * @returns The converted color if color-mix is supported, otherwise undefined\n */\nexport function fadeColor(color: CSSStyleValue, opacity: number): string | undefined {\n if (isColorMixSupported()) {\n const transparentWeight = (1 - opacity) * 100\n const colorWeight = opacity * 100\n return `color-mix(in srgb, ${color} ${colorWeight}%, transparent ${transparentWeight}%)`\n }\n}\n","export function getEffectiveBackgroundColor(element: HTMLElement): string | undefined {\n let current: HTMLElement | null = element\n\n while (current) {\n const style = current.ownerDocument.defaultView?.getComputedStyle(current)\n const backgroundColor = style?.backgroundColor\n\n if (\n backgroundColor\n && backgroundColor !== 'transparent'\n // Chrome returns `rgba(0, 0, 0, 0)` for transparent colors.\n && backgroundColor !== 'rgba(0, 0, 0, 0)'\n ) {\n return backgroundColor\n }\n\n current = current.parentElement\n }\n\n return undefined\n}\n","import { assignStyles } from '../../../utils/assign-styles'\nimport {\n cloneElement,\n deepCloneElement,\n} from '../../../utils/clone-element'\nimport { fadeColor } from '../../../utils/fade-color'\nimport { getEffectiveBackgroundColor } from '../../../utils/get-effective-background-color'\nimport { injectStyle } from '../../../utils/inject-style'\n\nexport function clearPreviewDOM(previewRoot: HTMLElement): void {\n while (previewRoot.firstChild) {\n previewRoot.removeChild(previewRoot.firstChild)\n }\n}\n\nexport function createPreviewDOM(\n table: HTMLTableElement,\n previewRoot: HTMLElement,\n index: number,\n direction: 'row' | 'col',\n): void {\n clearPreviewDOM(previewRoot)\n\n const [previewTable, previewTableStyle] = cloneElement(table)\n injectStyle(previewRoot, previewTableStyle)\n unsetSize(previewTable)\n\n const tableBody = table.querySelector('tbody')\n const [previewTableBody, previewTableBodyStyle] = tableBody\n ? cloneElement(tableBody)\n : [table.ownerDocument.createElement('tbody'), '']\n injectStyle(previewRoot, previewTableBodyStyle)\n unsetSize(previewTableBody)\n\n // Get effective background color and apply it with some opacity\n const backgroundColor = getEffectiveBackgroundColor(table)\n if (backgroundColor) {\n const backgroundColorWithOpacity = fadeColor(backgroundColor, 0.8)\n if (backgroundColorWithOpacity) {\n assignStyles(previewTable, { backgroundColor: backgroundColorWithOpacity })\n }\n }\n\n previewTable.appendChild(previewTableBody)\n previewRoot.appendChild(previewTable)\n\n const rows = table.querySelectorAll('tr')\n\n if (direction === 'row') {\n const row = rows[index]\n const [previewRow, previewRowStyle] = deepCloneElement(row)\n injectStyle(previewRoot, previewRowStyle)\n previewTableBody.appendChild(previewRow)\n } else {\n rows.forEach((row) => {\n const [previewRow, previewRowStyle] = cloneElement(row)\n injectStyle(previewRoot, previewRowStyle)\n unsetSize(previewRow)\n const cells = row.querySelectorAll('td')\n const cell = cells[index]\n if (cell) {\n const [previewCell, previewCellStyle] = deepCloneElement(cell)\n injectStyle(previewRoot, previewCellStyle)\n previewRow.appendChild(previewCell)\n previewTableBody.appendChild(previewRow)\n }\n })\n }\n}\n\nfunction unsetSize(element: HTMLElement) {\n assignStyles(element, {\n width: 'unset',\n height: 'unset',\n minWidth: 'unset',\n minHeight: 'unset',\n maxWidth: 'unset',\n maxHeight: 'unset',\n })\n}\n","import {\n createComputed,\n useEffect,\n type ConnectableElement,\n type ReadonlySignal,\n} from '@aria-ui/core'\nimport {\n computePosition,\n type ReferenceElement,\n} from '@floating-ui/dom'\nimport type { Editor } from '@prosekit/core'\n\nimport { assignStyles } from '../../../utils/assign-styles'\nimport { getSafeEditorView } from '../../../utils/get-safe-editor-view'\nimport {\n tableHandleDndContext,\n tableHandleRootContext,\n} from '../context'\nimport { getDndRelatedDOMs } from '../dnd'\n\nexport function useUpdatePreviewPosition(host: ConnectableElement, editor: ReadonlySignal<Editor | null>): void {\n const dndContext = tableHandleDndContext.consume(host)\n const rootContext = tableHandleRootContext.consume(host)\n\n const draggingSignal = createComputed(() => {\n const context = dndContext.get()\n return context.dragging\n })\n\n const clientXSignal = createComputed(() => {\n const context = dndContext.get()\n return context.x\n })\n\n const clientYSignal = createComputed(() => {\n const context = dndContext.get()\n return context.y\n })\n\n useEffect(host, () => {\n const view = getSafeEditorView(editor.get())\n if (!view) return\n\n if (!draggingSignal.get()) return\n\n const { draggingIndex, direction } = dndContext.peek()\n const x = clientXSignal.get()\n const y = clientYSignal.get()\n\n const relatedDOMs = getDndRelatedDOMs(view, rootContext.peek()?.cellPos, draggingIndex, direction)\n if (!relatedDOMs) return\n const { cell } = relatedDOMs\n\n let cancelled = false\n\n void computePosition(\n getVirtualElement(cell, x, y),\n host,\n { placement: direction === 'row' ? 'right' : 'bottom' },\n ).then(({ x, y }) => {\n if (cancelled) return\n\n if (direction === 'row') {\n assignStyles(host, {\n top: `${y}px`,\n })\n return\n }\n\n if (direction === 'col') {\n assignStyles(host, {\n left: `${x}px`,\n })\n return\n }\n })\n\n return () => {\n cancelled = true\n }\n })\n}\n\nfunction getVirtualElement(cell: HTMLTableCellElement, x: number, y: number): ReferenceElement {\n return {\n contextElement: cell,\n getBoundingClientRect: () => {\n const rect = cell.getBoundingClientRect()\n return {\n width: rect.width,\n height: rect.height,\n right: x + rect.width / 2,\n bottom: y + rect.height / 2,\n top: y - rect.height / 2,\n left: x - rect.width / 2,\n x: x - rect.width / 2,\n y: y - rect.height / 2,\n }\n },\n }\n}\n","import {\n useEffect,\n type ConnectableElement,\n type SignalState,\n} from '@aria-ui/core'\n\nimport { assignStyles } from '../../../utils/assign-styles'\nimport {\n useInitDndPosition,\n type OnInitParams,\n} from '../dnd'\n\nimport {\n clearPreviewDOM,\n createPreviewDOM,\n} from './render-preview'\nimport type { TableHandleDragPreviewProps } from './types'\nimport { useUpdatePreviewPosition } from './updater'\n\n/**\n * @internal\n */\nexport function useTableHandleDragPreview(host: ConnectableElement, { state }: { state: SignalState<TableHandleDragPreviewProps> }): void {\n const { editor } = state\n\n useEffect(host, () => {\n assignStyles(host, {\n position: 'absolute',\n // Make sure drop on preview will trigger drop event on the host\n pointerEvents: 'none',\n })\n })\n\n useInitDndPosition(host, editor, onInitPreviewPosition)\n\n useUpdatePreviewPosition(host, editor)\n}\n\nfunction onInitPreviewPosition({ host, direction, dragging, table, cell, draggingIndex }: OnInitParams): void {\n assignStyles(host, {\n display: dragging ? 'block' : 'none',\n })\n\n if (!dragging) {\n clearPreviewDOM(host)\n return\n }\n\n createPreviewDOM(table, host, draggingIndex, direction)\n\n const tableRect = table.getBoundingClientRect()\n const cellRect = cell.getBoundingClientRect()\n\n if (direction === 'col') {\n assignStyles(host, {\n width: `${cellRect.width}px`,\n height: `${tableRect.height}px`,\n })\n }\n\n if (direction === 'row') {\n assignStyles(host, {\n width: `${tableRect.width}px`,\n height: `${cellRect.height}px`,\n })\n }\n}\n","import type {\n EventDeclarations,\n PropDeclarations,\n} from '@aria-ui/core'\nimport type { Editor } from '@prosekit/core'\n\nexport interface TableHandleDragPreviewProps {\n editor: Editor | null\n}\n\nexport const tableHandleDragPreviewProps: PropDeclarations<TableHandleDragPreviewProps> = {\n editor: { default: null },\n}\n\nexport interface TableHandleDragPreviewEvents {}\n\nexport const tableHandleDragPreviewEvents: EventDeclarations<TableHandleDragPreviewEvents> = {}\n","import { defineCustomElement, registerCustomElement, type BaseElementConstructor } from \"@aria-ui/core\"\n\nimport { useTableHandleDragPreview } from \"./setup\"\nimport { tableHandleDragPreviewEvents, tableHandleDragPreviewProps, type TableHandleDragPreviewEvents, type TableHandleDragPreviewProps } from \"./types\"\n\nconst TableHandleDragPreviewElementBase: BaseElementConstructor<TableHandleDragPreviewProps> = defineCustomElement<\n TableHandleDragPreviewProps,\n TableHandleDragPreviewEvents\n>({\n props: tableHandleDragPreviewProps,\n events: tableHandleDragPreviewEvents,\n setup: useTableHandleDragPreview,\n})\nclass TableHandleDragPreviewElement extends TableHandleDragPreviewElementBase {}\n\nregisterCustomElement('prosekit-table-handle-drag-preview', TableHandleDragPreviewElement)\n \nexport { TableHandleDragPreviewElement }\n","function findDragOverElement(\n elements: Element[],\n pointer: number,\n axis: 'x' | 'y',\n): [Element, number] | undefined {\n const startProp = axis === 'x' ? 'left' : 'top'\n const endProp = axis === 'x' ? 'right' : 'bottom'\n const lastIndex = elements.length - 1\n\n const index = elements.findIndex((el, index) => {\n const rect = el.getBoundingClientRect()\n const boundaryStart = rect[startProp]\n const boundaryEnd = rect[endProp]\n\n // The pointer is within the boundary of the current element.\n if (boundaryStart <= pointer && pointer <= boundaryEnd) return true\n // The pointer is beyond the last element.\n if (index === lastIndex && pointer > boundaryEnd) return true\n // The pointer is before the first element.\n if (index === 0 && pointer < boundaryStart) return true\n\n return false\n })\n\n return index >= 0 ? [elements[index], index] : undefined\n}\n\nexport function getDragOverColumn(\n table: HTMLTableElement,\n pointerX: number,\n): [element: Element, index: number] | undefined {\n const firstRow = table.querySelector('tr')\n if (!firstRow) return\n const cells = Array.from(firstRow.children)\n return findDragOverElement(cells, pointerX, 'x')\n}\n\nexport function getDragOverRow(\n table: HTMLTableElement,\n pointerY: number,\n): [element: Element, index: number] | undefined {\n const rows = Array.from(table.querySelectorAll('tr'))\n return findDragOverElement(rows, pointerY, 'y')\n}\n","import {\n createComputed,\n useEffect,\n type ConnectableElement,\n type ReadonlySignal,\n} from '@aria-ui/core'\nimport {\n computePosition,\n offset,\n} from '@floating-ui/dom'\nimport type { Editor } from '@prosekit/core'\n\nimport { assignStyles } from '../../../utils/assign-styles'\nimport { getSafeEditorView } from '../../../utils/get-safe-editor-view'\nimport {\n tableHandleDndContext,\n tableHandleRootContext,\n} from '../context'\nimport { getDndRelatedDOMs } from '../dnd'\n\nimport {\n getDragOverColumn,\n getDragOverRow,\n} from './calc-drag-over'\n\nexport function useUpdateIndicatorPosition(host: ConnectableElement, editor: ReadonlySignal<Editor | null>, handleWidth: number): void {\n const dndContext = tableHandleDndContext.consume(host)\n const rootContext = tableHandleRootContext.consume(host)\n\n const draggingSignal = createComputed(() => {\n const context = dndContext.get()\n return context.dragging\n })\n\n const clientXSignal = createComputed(() => {\n const context = dndContext.get()\n return context.x\n })\n\n const clientYSignal = createComputed(() => {\n const context = dndContext.get()\n return context.y\n })\n\n const startXSignal = createComputed(() => {\n return dndContext.get().startX\n })\n\n const startYSignal = createComputed(() => {\n return dndContext.get().startY\n })\n\n useEffect(host, () => {\n const view = getSafeEditorView(editor.get())\n if (!view) return\n\n if (!draggingSignal.get()) return\n\n const { draggingIndex, direction } = dndContext.peek()\n const x = clientXSignal.get()\n const y = clientYSignal.get()\n\n const relatedDOMs = getDndRelatedDOMs(view, rootContext.peek()?.cellPos, draggingIndex, direction)\n if (!relatedDOMs) return\n const { table } = relatedDOMs\n\n let cancelled = false\n let cleanup = () => {\n cancelled = true\n }\n\n if (direction === 'col') {\n const direction = startXSignal.get() > x ? 'left' : 'right'\n const dragOverColumn = getDragOverColumn(table, x)\n\n if (dragOverColumn) {\n const [col, index] = dragOverColumn\n dndContext.set({ ...dndContext.peek(), droppingIndex: index })\n void computePosition(col, host, {\n placement: direction === 'left' ? 'left' : 'right',\n middleware: [offset(direction === 'left' ? -1 * handleWidth : 0)],\n }).then(({ x }) => {\n if (cancelled) return\n assignStyles(host, { left: `${x}px` })\n })\n }\n\n return cleanup\n }\n\n if (direction === 'row') {\n const direction = startYSignal.get() > y ? 'up' : 'down'\n const dragOverRow = getDragOverRow(table, y)\n\n if (dragOverRow) {\n const [row, index] = dragOverRow\n dndContext.set({ ...dndContext.peek(), droppingIndex: index })\n void computePosition(row, host, {\n placement: direction === 'up' ? 'top' : 'bottom',\n middleware: [offset(direction === 'up' ? -1 * handleWidth : 0)],\n }).then(({ y }) => {\n if (cancelled) return\n assignStyles(host, { top: `${y}px` })\n })\n }\n\n return cleanup\n }\n })\n}\n","import {\n useEffect,\n type ConnectableElement,\n type SignalState,\n} from '@aria-ui/core'\n\nimport { assignStyles } from '../../../utils/assign-styles'\nimport {\n useInitDndPosition,\n type OnInitParams,\n} from '../dnd'\n\nimport type { TableHandleDropIndicatorProps } from './types'\nimport { useUpdateIndicatorPosition } from './updater'\n\nconst HANDLE_WIDTH = 2\n\n/**\n * @internal\n */\nexport function useTableHandleDropIndicator(host: ConnectableElement, { state }: { state: SignalState<TableHandleDropIndicatorProps> }): void {\n const { editor } = state\n\n useEffect(host, () => {\n assignStyles(host, {\n pointerEvents: 'none',\n position: 'absolute',\n })\n })\n\n useInitDndPosition(host, editor, onInitIndicatorPosition)\n\n useUpdateIndicatorPosition(host, editor, HANDLE_WIDTH)\n}\n\nfunction onInitIndicatorPosition({ host, direction, dragging, table }: OnInitParams): void {\n assignStyles(host, {\n display: dragging ? 'block' : 'none',\n })\n\n const tableRect = table.getBoundingClientRect()\n\n if (direction === 'col') {\n assignStyles(host, {\n width: `${HANDLE_WIDTH}px`,\n height: `${tableRect.height}px`,\n })\n }\n\n if (direction === 'row') {\n assignStyles(host, {\n width: `${tableRect.width}px`,\n height: `${HANDLE_WIDTH}px`,\n })\n }\n}\n","import type {\n EventDeclarations,\n PropDeclarations,\n} from '@aria-ui/core'\nimport type { Editor } from '@prosekit/core'\nimport type { TableCommandsExtension } from '@prosekit/extensions/table'\n\nexport interface TableHandleDropIndicatorProps {\n editor: Editor<TableCommandsExtension> | null\n}\n\nexport const tableHandleDropIndicatorProps: PropDeclarations<TableHandleDropIndicatorProps> = {\n editor: { default: null },\n}\n\nexport interface TableHandleDropIndicatorEvents {}\n\nexport const tableHandleDropIndicatorEvents: EventDeclarations<TableHandleDropIndicatorEvents> = {}\n","import { defineCustomElement, registerCustomElement, type BaseElementConstructor } from \"@aria-ui/core\"\n\nimport { useTableHandleDropIndicator } from \"./setup\"\nimport { tableHandleDropIndicatorEvents, tableHandleDropIndicatorProps, type TableHandleDropIndicatorEvents, type TableHandleDropIndicatorProps } from \"./types\"\n\nconst TableHandleDropIndicatorElementBase: BaseElementConstructor<TableHandleDropIndicatorProps> = defineCustomElement<\n TableHandleDropIndicatorProps,\n TableHandleDropIndicatorEvents\n>({\n props: tableHandleDropIndicatorProps,\n events: tableHandleDropIndicatorEvents,\n setup: useTableHandleDropIndicator,\n})\nclass TableHandleDropIndicatorElement extends TableHandleDropIndicatorElementBase {}\n\nregisterCustomElement('prosekit-table-handle-drop-indicator', TableHandleDropIndicatorElement)\n \nexport { TableHandleDropIndicatorElement }\n","import {\n createComputed,\n createSignal,\n useEffect,\n type ConnectableElement,\n type ReadonlySignal,\n type SetupOptions,\n type SignalState,\n type TypedEventTarget,\n} from '@aria-ui/core'\nimport {\n menuContentProps,\n useMenuContent,\n type MenuContentProps,\n} from '@aria-ui/menu/elements'\n\nimport { getStateWithDefaults } from '../../../utils/get-default-state'\nimport { tableHandleRootContext } from '../context'\n\nimport type {\n TableHandlePopoverContentEvents,\n TableHandlePopoverContentProps,\n} from './types'\n\n/**\n * @internal\n */\nexport function useTableHandlePopoverContent(\n host: ConnectableElement,\n {\n state,\n emit,\n }: SetupOptions<\n TableHandlePopoverContentProps,\n TableHandlePopoverContentEvents\n >,\n): void {\n const rootContext = tableHandleRootContext.consume(host)\n const open = createComputed(() => !!rootContext.get())\n const keyDownTarget = useKeyDownTarget(host, open)\n\n const menuContentState: SignalState<MenuContentProps> = getStateWithDefaults(\n {\n placement: state.placement,\n offset: state.offset,\n eventTarget: createSignal(keyDownTarget),\n },\n menuContentProps,\n )\n\n useMenuContent(host, { state: menuContentState, emit })\n}\n\nfunction useKeyDownTarget(\n element: ConnectableElement,\n open: ReadonlySignal<boolean>,\n): TypedEventTarget<'keydown'> {\n const keydownHandlers: Array<(event: KeyboardEvent) => void> = []\n\n useEffect(element, () => {\n const handleKeydown = (event: KeyboardEvent) => {\n if (event.isComposing || event.defaultPrevented || !open.get()) {\n return false\n }\n keydownHandlers.forEach((handler) => handler(event))\n }\n\n document.addEventListener('keydown', handleKeydown)\n\n return () => {\n document.removeEventListener('keydown', handleKeydown)\n }\n })\n\n return {\n addEventListener: (type, listener) => {\n if (type === 'keydown') {\n keydownHandlers.push(listener)\n }\n },\n removeEventListener: (type, listener) => {\n if (type === 'keydown') {\n const index = keydownHandlers.indexOf(listener)\n if (index !== -1) {\n keydownHandlers.splice(index, 1)\n }\n }\n },\n }\n}\n","import type {\n EventDeclarations,\n PropDeclarations,\n} from '@aria-ui/core'\nimport {\n menuContentEvents,\n menuContentProps,\n type MenuContentEvents,\n type MenuContentProps,\n} from '@aria-ui/menu/elements'\nimport type { Editor } from '@prosekit/core'\n\nexport interface TableHandlePopoverContentProps extends Omit<MenuContentProps, 'placement' | 'offset'> {\n /**\n * @default 'bottom-start'\n */\n placement: MenuContentProps['placement']\n\n /**\n * @default {mainAxis: -4, crossAxis: 4}\n */\n offset: MenuContentProps['offset']\n\n editor: Editor | null\n}\n\n/** @internal */\nexport const tableHandlePopoverContentProps: PropDeclarations<TableHandlePopoverContentProps> = Object.freeze({\n ...menuContentProps,\n placement: { default: 'right-start' },\n offset: { default: { mainAxis: -4, crossAxis: 4 } },\n editor: { default: null },\n})\n\nexport interface TableHandlePopoverContentEvents extends MenuContentEvents {}\n\n/** @internal */\nexport const tableHandlePopoverContentEvents: EventDeclarations<TableHandlePopoverContentEvents> = Object.freeze({\n ...menuContentEvents,\n})\n","import { defineCustomElement, registerCustomElement, type BaseElementConstructor } from \"@aria-ui/core\"\n\nimport { useTableHandlePopoverContent } from \"./setup\"\nimport { tableHandlePopoverContentEvents, tableHandlePopoverContentProps, type TableHandlePopoverContentEvents, type TableHandlePopoverContentProps } from \"./types\"\n\nconst TableHandlePopoverContentElementBase: BaseElementConstructor<TableHandlePopoverContentProps> = defineCustomElement<\n TableHandlePopoverContentProps,\n TableHandlePopoverContentEvents\n>({\n props: tableHandlePopoverContentProps,\n events: tableHandlePopoverContentEvents,\n setup: useTableHandlePopoverContent,\n})\nclass TableHandlePopoverContentElement extends TableHandlePopoverContentElementBase {}\n\nregisterCustomElement('prosekit-table-handle-popover-content', TableHandlePopoverContentElement)\n \nexport { TableHandlePopoverContentElement }\n","import type {\n ConnectableElement,\n SetupOptions,\n} from '@aria-ui/core'\nimport { useMenuItem } from '@aria-ui/menu/elements'\n\nimport type {\n TableHandlePopoverItemEvents,\n TableHandlePopoverItemProps,\n} from './types'\n\n/**\n * @internal\n */\nexport function useTableHandlePopoverItem(\n element: ConnectableElement,\n {\n state,\n emit,\n }: SetupOptions<TableHandlePopoverItemProps, TableHandlePopoverItemEvents>,\n): void {\n useMenuItem(element, { state, emit })\n}\n","import type {\n EventDeclarations,\n PropDeclarations,\n} from '@aria-ui/core'\nimport {\n menuItemEvents,\n menuItemProps,\n type MenuItemEvents,\n type MenuItemProps,\n} from '@aria-ui/menu'\n\nexport interface TableHandlePopoverItemProps extends MenuItemProps {}\n\n/** @internal */\nexport const tableHandlePopoverItemProps: PropDeclarations<TableHandlePopoverItemProps> = {\n ...menuItemProps,\n}\n\nexport interface TableHandlePopoverItemEvents extends MenuItemEvents {}\n\n/** @internal */\nexport const tableHandlePopoverItemEvents: EventDeclarations<TableHandlePopoverItemEvents> = {\n ...menuItemEvents,\n}\n","import { defineCustomElement, registerCustomElement, type BaseElementConstructor } from \"@aria-ui/core\"\n\nimport { useTableHandlePopoverItem } from \"./setup\"\nimport { tableHandlePopoverItemEvents, tableHandlePopoverItemProps, type TableHandlePopoverItemEvents, type TableHandlePopoverItemProps } from \"./types\"\n\nconst TableHandlePopoverItemElementBase: BaseElementConstructor<TableHandlePopoverItemProps> = defineCustomElement<\n TableHandlePopoverItemProps,\n TableHandlePopoverItemEvents\n>({\n props: tableHandlePopoverItemProps,\n events: tableHandlePopoverItemEvents,\n setup: useTableHandlePopoverItem,\n})\nclass TableHandlePopoverItemElement extends TableHandlePopoverItemElementBase {}\n\nregisterCustomElement('prosekit-table-handle-popover-item', TableHandlePopoverItemElement)\n \nexport { TableHandlePopoverItemElement }\n","import {\n createSignal,\n type ConnectableElement,\n type ReadonlySignal,\n} from '@aria-ui/core'\nimport {\n defineDOMEventHandler,\n union,\n type Editor,\n} from '@prosekit/core'\n\nimport { useEditorExtension } from './use-editor-extension'\n\nexport function useEditorTyping(\n host: ConnectableElement,\n editor: ReadonlySignal<Editor | null>,\n): ReadonlySignal<boolean> {\n const typing = createSignal(false)\n\n const handleKeypress = () => {\n typing.set(true)\n }\n\n const handlePointerMove = () => {\n typing.set(false)\n }\n\n const extension = union(\n defineDOMEventHandler('keypress', handleKeypress),\n defineDOMEventHandler('pointermove', handlePointerMove),\n )\n\n useEditorExtension(host, editor, extension)\n\n return typing\n}\n","import type { ReadonlySignal } from '@aria-ui/core'\nimport {\n createSignal,\n useEffect,\n type ConnectableElement,\n} from '@aria-ui/core'\nimport type { Editor } from '@prosekit/core'\n\nimport { getSafeEditorView } from '../utils/get-safe-editor-view'\n\n/**\n * Detect if the user is selecting text inside the editor, in which case some\n * components should be disabled or hidden.\n */\nexport function useSelecting(\n host: ConnectableElement,\n editor: ReadonlySignal<Editor | null>,\n enabled: ReadonlySignal<boolean>,\n): ReadonlySignal<boolean> {\n const selecting = createSignal(false)\n const isPointerDown = createSignal(false)\n\n useEffect(host, () => {\n if (!enabled.get()) {\n return\n }\n\n const view = getSafeEditorView(editor.peek())\n if (!view) return\n\n const { dom, root } = view\n if (!root) return\n\n // When the user starts selecting text, we set the selecting signal to true.\n const handlePointerDown = () => {\n selecting.set(true)\n isPointerDown.set(true)\n }\n const handlePointerUp = () => {\n isPointerDown.set(false)\n }\n // When the user moves the pointer and the pointer is not down, we set the\n // selecting signal to false again.\n const handleMouseMove = () => {\n if (!isPointerDown.get()) {\n selecting.set(false)\n }\n }\n\n // Only listen to pointer down events on the editor\n dom.addEventListener('pointerdown', handlePointerDown)\n root.addEventListener('pointerup', handlePointerUp)\n root.addEventListener('pointermove', handleMouseMove)\n\n return () => {\n dom.removeEventListener('pointerdown', handlePointerDown)\n root.removeEventListener('pointerup', handlePointerUp)\n root.removeEventListener('pointermove', handleMouseMove)\n }\n })\n\n return selecting\n}\n","import {\n createComputed,\n useEffect,\n type ConnectableElement,\n type ReadonlySignal,\n type Signal,\n} from '@aria-ui/core'\nimport type { Editor } from '@prosekit/core'\nimport {\n moveTableColumn,\n moveTableRow,\n} from '@prosekit/extensions/table'\n\nimport { getSafeEditorView } from '../../../utils/get-safe-editor-view'\nimport type { TableHandleDndContext } from '../context'\n\nexport function useDrop(\n host: ConnectableElement,\n editor: ReadonlySignal<Editor | null>,\n dndContext: Signal<TableHandleDndContext>,\n): void {\n const dragging = createComputed(() => dndContext.get().dragging)\n\n useEffect(host, () => {\n const view = getSafeEditorView(editor.get())\n if (!view || !view.editable) return\n\n const ownerDocument = view.dom?.ownerDocument\n if (!ownerDocument) return\n\n const handleDrop = () => {\n if (!dragging.peek()) return\n const editorValue = editor.peek()\n if (!editorValue) return\n const { droppingIndex, draggingIndex, direction } = dndContext.peek()\n\n // Validate indices\n if (draggingIndex < 0 || droppingIndex < 0) {\n console.warn('[prosekit] Invalid drag indices:', { draggingIndex, droppingIndex })\n return\n }\n\n if (direction === 'row') {\n editorValue.exec(moveTableRow({\n from: draggingIndex,\n to: droppingIndex,\n }))\n return\n }\n if (direction === 'col') {\n editorValue.exec(moveTableColumn({\n from: draggingIndex,\n to: droppingIndex,\n }))\n return\n }\n }\n\n // To make `drop` event work, we need to prevent the default behavior of the\n // `dragover` event for drop zone. Here we set the whole document as the\n // drop zone so that even the mouse moves outside the editor, the `drop`\n // event will still be triggered.\n const handleDragOver = (event: DragEvent) => {\n if (!dragging.peek()) return\n event.preventDefault()\n const prev = dndContext.peek()\n\n dndContext.set({\n ...prev,\n dragging: true,\n x: event.clientX,\n y: event.clientY,\n })\n }\n\n const handleDragEnd = () => {\n if (!dragging.peek()) return\n const prev = dndContext.peek()\n dndContext.set({\n ...prev,\n dragging: false,\n })\n }\n\n ownerDocument.addEventListener('dragover', handleDragOver)\n ownerDocument.addEventListener('drop', handleDrop)\n ownerDocument.addEventListener('dragend', handleDragEnd)\n return () => {\n ownerDocument.removeEventListener('dragover', handleDragOver)\n ownerDocument.removeEventListener('drop', handleDrop)\n ownerDocument.removeEventListener('dragend', handleDragEnd)\n }\n })\n}\n","import type { EditorView } from '@prosekit/pm/view'\nimport {\n cellAround,\n TableMap,\n} from 'prosemirror-tables'\n\nexport interface HoveringCellInfo {\n rowIndex: number\n colIndex: number\n cellPos: number\n rowFirstCellPos: number\n colFirstCellPos: number\n}\n\nexport interface DndInfo {\n dragging: boolean\n direction: 'row' | 'col'\n draggingIndex: number\n droppingIndex: number\n x: number\n y: number\n startX: number\n startY: number\n}\n\nexport function isHoveringCellInfoEqual(\n a?: HoveringCellInfo | null,\n b?: HoveringCellInfo | null,\n): boolean {\n if (!a && !b) return true\n if (!a || !b) return false\n return (\n a.rowIndex === b.rowIndex\n && a.colIndex === b.colIndex\n && a.cellPos === b.cellPos\n && a.rowFirstCellPos === b.rowFirstCellPos\n && a.colFirstCellPos === b.colFirstCellPos\n )\n}\n\n/**\n * Copied from https://github.com/ProseMirror/prosemirror-tables/blob/v1.5.0/src/columnresizing.ts#L256\n *\n * @internal\n */\nfunction domCellAround(target: HTMLElement | null): HTMLElement | null {\n while (target && target.nodeName != 'TD' && target.nodeName != 'TH') {\n target = target.classList?.contains('ProseMirror')\n ? null\n : (target.parentNode as HTMLElement | null)\n }\n return target\n}\n\nexport function getHoveringCell(\n view: EditorView,\n event: MouseEvent,\n): HoveringCellInfo | undefined {\n const domCell = domCellAround(event.target as HTMLElement | null)\n if (!domCell) return\n\n const { left, top, width, height } = domCell.getBoundingClientRect()\n const eventPos = view.posAtCoords({\n // Use the center coordinates of the cell to ensure we're within the\n // selected cell. This prevents potential issues when the mouse is on the\n // border of two cells.\n left: left + width / 2,\n top: top + height / 2,\n })\n if (!eventPos) return\n\n const $cellPos = cellAround(view.state.doc.resolve(eventPos.pos))\n if (!$cellPos) return\n\n const map = TableMap.get($cellPos.node(-1))\n const tableStart = $cellPos.start(-1)\n const cellRect = map.findCell($cellPos.pos - tableStart)\n const rowIndex = cellRect.top\n const colIndex = cellRect.left\n\n return {\n rowIndex,\n colIndex,\n cellPos: $cellPos.pos,\n rowFirstCellPos: getCellPos(map, tableStart, rowIndex, 0),\n colFirstCellPos: getCellPos(map, tableStart, 0, colIndex),\n }\n}\n\nfunction getCellPos(\n map: TableMap,\n tableStart: number,\n rowIndex: number,\n colIndex: number,\n) {\n const cellIndex = getCellIndex(map, rowIndex, colIndex)\n const posInTable = map.map[cellIndex]\n return tableStart + posInTable\n}\n\nfunction getCellIndex(\n map: TableMap,\n rowIndex: number,\n colIndex: number,\n): number {\n return map.width * rowIndex + colIndex\n}\n","import {\n createComputed,\n createSignal,\n useEffect,\n type ConnectableElement,\n type ReadonlySignal,\n type Signal,\n type SignalState,\n} from '@aria-ui/core'\nimport {\n defineDOMEventHandler,\n type Editor,\n} from '@prosekit/core'\nimport type { EditorView } from '@prosekit/pm/view'\n\nimport { useEditorExtension } from '../../../hooks/use-editor-extension'\nimport { useEditorTyping } from '../../../hooks/use-editor-typing'\nimport { useScrolling } from '../../../hooks/use-scrolling'\nimport { useSelecting } from '../../../hooks/use-selecting'\nimport {\n defaultTableHandleDndContext,\n tableHandleDndContext,\n tableHandleRootContext,\n type TableHandleDndContext,\n type TableHandleRootContext,\n} from '../context'\nimport { useDrop } from '../hooks/use-drop'\nimport {\n getHoveringCell,\n isHoveringCellInfoEqual,\n type HoveringCellInfo,\n} from '../utils'\n\nimport type { TableHandleRootProps } from './types'\n\n/**\n * @internal\n */\nexport function useTableHandleRoot(\n host: ConnectableElement,\n { state }: { state: SignalState<TableHandleRootProps> },\n): void {\n const { editor } = state\n\n const context = createSignal<TableHandleRootContext>(null)\n const dndContext = createSignal<TableHandleDndContext>(defaultTableHandleDndContext)\n\n const hoveringCell = useHoveringCell(host, editor)\n const typing = useEditorTyping(host, editor)\n const isInTable = createComputed(() => !!hoveringCell.get())\n const selecting = useSelecting(host, editor, isInTable)\n const scrolling = useScrolling(host)\n const canShow = createComputed(() => {\n return !typing.get() && !selecting.get() && !scrolling.get()\n })\n\n useEffect(host, () => {\n context.set(canShow.get() ? hoveringCell.get() : null)\n })\n\n tableHandleRootContext.provide(host, context)\n tableHandleDndContext.provide(host, dndContext)\n\n useDrop(host, editor, dndContext)\n}\n\nfunction useHoveringCell(\n host: ConnectableElement,\n editor: ReadonlySignal<Editor | null>,\n): Signal<HoveringCellInfo | null> {\n const hoveringCell = createSignal<HoveringCellInfo | null>(null)\n\n const extension = defineCellHoverHandler((curr: HoveringCellInfo | null) => {\n const prev = hoveringCell.peek()\n if (!isHoveringCellInfoEqual(prev, curr)) {\n hoveringCell.set(curr)\n }\n })\n\n useEditorExtension(host, editor, extension)\n\n return hoveringCell\n}\n\nfunction defineCellHoverHandler(\n handler: (hoveringCell: HoveringCellInfo | null) => void,\n) {\n const pointerHandler = (view: EditorView, event: PointerEvent) => {\n const hoveringCell = getHoveringCell(view, event)\n return handler(hoveringCell ?? null)\n }\n return defineDOMEventHandler('pointerover', pointerHandler)\n}\n","import type {\n EventDeclarations,\n PropDeclarations,\n} from '@aria-ui/core'\nimport type { Editor } from '@prosekit/core'\n\nexport interface TableHandleRootProps {\n /**\n * The ProseKit editor instance.\n *\n * @default null\n * @hidden\n */\n editor: Editor | null\n}\n\n/** @internal */\nexport const tableHandleRootProps: PropDeclarations<TableHandleRootProps> = {\n editor: { default: null },\n}\n\n/** @internal */\nexport interface TableHandleRootEvents {}\n\n/** @internal */\nexport const tableHandleRootEvents: EventDeclarations<TableHandleRootEvents> = {}\n","import { defineCustomElement, registerCustomElement, type BaseElementConstructor } from \"@aria-ui/core\"\n\nimport { useTableHandleRoot } from \"./setup\"\nimport { tableHandleRootEvents, tableHandleRootProps, type TableHandleRootEvents, type TableHandleRootProps } from \"./types\"\n\nconst TableHandleRootElementBase: BaseElementConstructor<TableHandleRootProps> = defineCustomElement<\n TableHandleRootProps,\n TableHandleRootEvents\n>({\n props: tableHandleRootProps,\n events: tableHandleRootEvents,\n setup: useTableHandleRoot,\n})\nclass TableHandleRootElement extends TableHandleRootElementBase {}\n\nregisterCustomElement('prosekit-table-handle-root', TableHandleRootElement)\n \nexport { TableHandleRootElement }\n","import {\n createComputed,\n createSignal,\n defineEmit,\n useAttribute,\n useEffect,\n type ConnectableElement,\n type SetupOptions,\n} from '@aria-ui/core'\nimport {\n menuRootEvents,\n menuRootProps,\n useMenuRoot,\n} from '@aria-ui/menu/elements'\nimport { useOverlayPositionerState } from '@aria-ui/overlay/elements'\nimport { usePresence } from '@aria-ui/presence'\n\nimport { getStateWithDefaults } from '../../../utils/get-default-state'\nimport { getSafeEditorView } from '../../../utils/get-safe-editor-view'\nimport { tableHandleRootContext } from '../context'\n\nimport type {\n TableHandleRowRootEvents,\n TableHandleRowRootProps,\n} from './types'\n\n/**\n * @internal\n */\nexport function useTableHandleRowRoot(\n host: ConnectableElement,\n { state }: SetupOptions<TableHandleRowRootProps, TableHandleRowRootEvents>,\n): void {\n const { editor, ...overlayState } = state\n\n const rootContext = tableHandleRootContext.consume(host)\n\n const rowFirstCellPos = createComputed<number | undefined>(() => {\n return rootContext.get()?.rowFirstCellPos\n })\n\n const referenceCell = createComputed<HTMLElement | null>(() => {\n const pos = rowFirstCellPos.get()\n const view = getSafeEditorView(editor.get())\n if (!pos || !view) return null\n return view.nodeDOM(pos) as HTMLElement | null\n })\n\n const contentOpen = createSignal(false)\n\n // Close the menu when the hovering element is changed\n // TODO: add a delay\n useEffect(host, () => {\n rowFirstCellPos.get()\n contentOpen.set(false)\n })\n\n useOverlayPositionerState(host, overlayState, {\n reference: referenceCell,\n })\n\n const presence = createComputed(() => !!referenceCell.get())\n useAttribute(host, 'data-state', () => (presence.get() ? 'open' : 'closed'))\n usePresence(host, presence)\n\n const menuRootState = getStateWithDefaults(\n {\n open: contentOpen,\n },\n menuRootProps,\n )\n\n useMenuRoot(host, {\n state: menuRootState,\n emit: defineEmit(host, menuRootEvents),\n })\n}\n","import type {\n EventDeclarations,\n PropDeclarations,\n} from '@aria-ui/core'\nimport {\n overlayPositionerProps,\n type OverlayPositionerEvents,\n type OverlayPositionerProps,\n} from '@aria-ui/overlay'\nimport type { Placement } from '@floating-ui/dom'\nimport type { Editor } from '@prosekit/core'\n\nexport interface TableHandleRowRootProps extends Omit<OverlayPositionerProps, 'placement' | 'hoist' | 'flip' | 'shift' | 'hide'> {\n /**\n * The ProseKit editor instance.\n *\n * @default null\n * @hidden\n */\n editor: Editor | null\n\n /**\n * The placement of the popover, relative to the hovered table cell.\n *\n * @default \"left\"\n */\n placement: Placement\n\n /**\n * Whether to use the browser [Popover API](https://developer.mozilla.org/en-US/docs/Web/API/Popover_API)\n * to place the floating element on top of other page content.\n *\n * @default false\n */\n hoist: boolean\n\n /**\n * @default false\n * @hidden\n */\n flip: boolean\n\n /**\n * @default false\n * @hidden\n */\n shift: boolean\n\n /**\n * @default true\n * @hidden\n */\n hide: boolean\n}\n\n/** @internal */\nexport const tableHandleRowRootProps: PropDeclarations<TableHandleRowRootProps> = {\n ...overlayPositionerProps,\n editor: { default: null },\n placement: { default: 'left' },\n\n // Enabling `hoist` will cause the popover to have a small delay when\n // scrolling the page.\n hoist: { default: false },\n\n flip: { default: false },\n shift: { default: false },\n hide: { default: true },\n}\n\n/** @internal */\nexport interface TableHandleRowRootEvents extends OverlayPositionerEvents {}\n\n/** @internal */\nexport const tableHandleRowRootEvents: EventDeclarations<TableHandleRowRootEvents> = {}\n","import { defineCustomElement, registerCustomElement, type BaseElementConstructor } from \"@aria-ui/core\"\n\nimport { useTableHandleRowRoot } from \"./setup\"\nimport { tableHandleRowRootEvents, tableHandleRowRootProps, type TableHandleRowRootEvents, type TableHandleRowRootProps } from \"./types\"\n\nconst TableHandleRowRootElementBase: BaseElementConstructor<TableHandleRowRootProps> = defineCustomElement<\n TableHandleRowRootProps,\n TableHandleRowRootEvents\n>({\n props: tableHandleRowRootProps,\n events: tableHandleRowRootEvents,\n setup: useTableHandleRowRoot,\n})\nclass TableHandleRowRootElement extends TableHandleRowRootElementBase {}\n\nregisterCustomElement('prosekit-table-handle-row-root', TableHandleRowRootElement)\n \nexport { TableHandleRowRootElement }\n","import {\n useEffect,\n useEventListener,\n type ConnectableElement,\n type SetupOptions,\n} from '@aria-ui/core'\nimport { useMenuTrigger } from '@aria-ui/menu/elements'\nimport { selectTableRow } from '@prosekit/extensions/table'\n\nimport {\n tableHandleDndContext,\n tableHandleRootContext,\n} from '../context'\nimport { useEmptyImage } from '../hooks/use-empty-image'\n\nimport type {\n TableHandleRowTriggerEvents,\n TableHandleRowTriggerProps,\n} from './types'\n\n/**\n * @internal\n */\nexport function useTableHandleRowTrigger(\n host: ConnectableElement,\n { state }: SetupOptions<TableHandleRowTriggerProps, TableHandleRowTriggerEvents>,\n): void {\n useMenuTrigger(host)\n\n const context = tableHandleRootContext.consume(host)\n\n const dndContext = tableHandleDndContext.consume(host)\n\n useEventListener(host, 'pointerdown', () => {\n const editor = state.editor.peek()\n const cellPos = context.peek()?.cellPos\n if (!editor || !cellPos) return\n editor.exec(selectTableRow({ head: cellPos }))\n })\n\n useEffect(host, () => {\n host.draggable = true\n })\n\n const getEmptyImage = useEmptyImage(host)\n\n useEventListener(host, 'dragstart', (event: DragEvent) => {\n const dataTransfer = event.dataTransfer\n if (dataTransfer) {\n dataTransfer.effectAllowed = 'move'\n const emptyImage = getEmptyImage()\n if (emptyImage) {\n dataTransfer.setDragImage(emptyImage, 0, 0)\n }\n }\n const prev = dndContext.peek()\n const index = context.peek()?.rowIndex\n\n if (index == null || index < 0) {\n console.warn('[prosekit] Invalid row index for drag operation:', index)\n event.preventDefault()\n return\n }\n\n dndContext.set({\n ...prev,\n direction: 'row',\n dragging: true,\n draggingIndex: index,\n startX: event.clientX,\n startY: event.clientY,\n })\n })\n}\n","import type {\n EventDeclarations,\n PropDeclarations,\n} from '@aria-ui/core'\nimport type { Editor } from '@prosekit/core'\nimport type { defineTableCommands } from '@prosekit/extensions/table'\n\ntype TableCommandsExtension = ReturnType<typeof defineTableCommands>\n\nexport interface TableHandleRowTriggerProps {\n editor: Editor<TableCommandsExtension> | null\n}\n\n/** @internal */\nexport const tableHandleRowTriggerProps: PropDeclarations<TableHandleRowTriggerProps> = {\n editor: { default: null },\n}\n\nexport interface TableHandleRowTriggerEvents {\n select: CustomEvent<void>\n}\n\n/** @internal */\nexport const tableHandleRowTriggerEvents: EventDeclarations<TableHandleRowTriggerEvents> = {\n select: {},\n}\n","import { defineCustomElement, registerCustomElement, type BaseElementConstructor } from \"@aria-ui/core\"\n\nimport { useTableHandleRowTrigger } from \"./setup\"\nimport { tableHandleRowTriggerEvents, tableHandleRowTriggerProps, type TableHandleRowTriggerEvents, type TableHandleRowTriggerProps } from \"./types\"\n\nconst TableHandleRowTriggerElementBase: BaseElementConstructor<TableHandleRowTriggerProps> = defineCustomElement<\n TableHandleRowTriggerProps,\n TableHandleRowTriggerEvents\n>({\n props: tableHandleRowTriggerProps,\n events: tableHandleRowTriggerEvents,\n setup: useTableHandleRowTrigger,\n})\nclass TableHandleRowTriggerElement extends TableHandleRowTriggerElementBase {}\n\nregisterCustomElement('prosekit-table-handle-row-trigger', TableHandleRowTriggerElement)\n \nexport { TableHandleRowTriggerElement }\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAkBA,MAAaA,yBAA0D,cACrE,sCACA,KACD;;;;AAUD,MAAaC,+BAAsD;CACjE,UAAU;CACV,WAAW;CACX,eAAe;CACf,eAAe;CACf,GAAG;CACH,GAAG;CACH,QAAQ;CACR,QAAQ;CACT;;;;AAKD,MAAaC,wBAAwD,cACnE,qCACA,6BACD;;;;;;;ACvBD,SAAgB,yBACd,MACA,EAAE,SACI;CACN,MAAM,EAAE,OAAQ,GAAG,iBAAiB;CAEpC,MAAM,cAAc,uBAAuB,QAAQ,KAAK;CAExD,MAAM,kBAAkB,qBAAyC;AAC/D,SAAO,YAAY,KAAK,EAAE;GAC1B;CAEF,MAAM,gBAAgB,qBAAyC;EAC7D,MAAM,MAAM,gBAAgB,KAAK;EACjC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AK,YAAY;GACjB;CAEF,MAAM,gBAAgB,cAAc,KAAK;AAEzC,kBAAiB,MAAM,cAAc,UAAqB;EACxD,MAAM,eAAe,MAAM;AAC3B,MAAI,cAAc;AAChB,gBAAa,gBAAgB;GAC7B,MAAM,aAAa,eAAe;AAClC,OAAI,WACF,cAAa,aAAa,YAAY,GAAG,EAAE;;EAG/C,MAAM,OAAO,WAAW,MAAM;EAC9B,MAAM,QAAQ,QAAQ,MAAM,EAAE;AAE9B,MAAI,SAAS,QAAQ,QAAQ,GAAG;AAC9B,WAAQ,KAAK,oDAAoD,MAAM;AACvE,SAAM,gBAAgB;AACtB;;AAGF,aAAW,IAAI;GACb,GAAG;GACH,WAAW;GACX,UAAU;GACV,eAAe;GACf,QAAQ,MAAM;GACd,QAAQ,MAAM;GACf,CAAC;GACF;;;;;;AC1DJ,MAAaC,6BAA2E,EACtF,QAAQ,EAAE,SAAS,MAAM,EAC1B;;AAOD,MAAaC,8BAA8E,EACzF,QAAQ,EAAE,EACX;;;;ACpBD,MAAMC,mCAAuF,oBAG3F;CACA,OAAO;CACP,QAAQ;CACR,OAAO;CACR,CAAC;AACF,IAAM,+BAAN,cAA2C,iCAAiC;AAE5E,sBAAsB,qCAAqC,6BAA6B"}
@@ -25,4 +25,5 @@ interface TooltipTriggerEvents extends TooltipTriggerEvents$1 {}
25
25
  declare const TooltipTriggerElementBase: BaseElementConstructor<TooltipTriggerProps>;
26
26
  declare class TooltipTriggerElement extends TooltipTriggerElementBase {}
27
27
  //#endregion
28
- export { TooltipContentElement, type TooltipContentEvents, type TooltipContentProps, TooltipRootElement, type TooltipRootEvents, type TooltipRootProps, TooltipTriggerElement, type TooltipTriggerEvents, type TooltipTriggerProps, tooltipContentEvents, tooltipContentProps, tooltipRootEvents, tooltipRootProps, tooltipTriggerEvents, tooltipTriggerProps, useTooltipContent, useTooltipRoot, useTooltipTrigger };
28
+ export { TooltipContentElement, type TooltipContentEvents, type TooltipContentProps, TooltipRootElement, type TooltipRootEvents, type TooltipRootProps, TooltipTriggerElement, type TooltipTriggerEvents, type TooltipTriggerProps, tooltipContentEvents, tooltipContentProps, tooltipRootEvents, tooltipRootProps, tooltipTriggerEvents, tooltipTriggerProps, useTooltipContent, useTooltipRoot, useTooltipTrigger };
29
+ //# sourceMappingURL=prosekit-web-tooltip.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prosekit-web-tooltip.d.ts","names":[],"sources":["../src/components/tooltip/tooltip-content/types.ts","../src/components/tooltip/tooltip-content/element.gen.ts","../src/components/tooltip/tooltip-root/types.ts","../src/components/tooltip/tooltip-root/element.gen.ts","../src/components/tooltip/tooltip-trigger/types.ts","../src/components/tooltip/tooltip-trigger/element.gen.ts"],"sourcesContent":[],"mappings":";;;;UAUiB,mBAAA,SAA4B;AAA5B,UACA,oBAAA,SAA6B,sBADD,CAAA,CAC7C;;;cCNM,2BAA2B,uBAAuB;cAQlD,qBAAA,SAA8B,yBAAA;;;UCHnB,gBAAA,SAAyB;AFAzB,UECA,iBAAA,SAA0B,mBFDE,CAAA,CAC7C;;;cGNM,wBAAwB,uBAAuB;cAQ/C,kBAAA,SAA2B,sBAAA;;;UCHhB,mBAAA,SAA4B;AJA5B,UICA,oBAAA,SAA6B,sBJDD,CAAA,CAC7C;;;cKNM,2BAA2B,uBAAuB;cAQlD,qBAAA,SAA8B,yBAAA"}
@@ -31,4 +31,5 @@ var TooltipTriggerElement = class extends TooltipTriggerElementBase {};
31
31
  registerCustomElement("prosekit-tooltip-trigger", TooltipTriggerElement);
32
32
 
33
33
  //#endregion
34
- export { TooltipContentElement, TooltipRootElement, TooltipTriggerElement, tooltipContentEvents, tooltipContentProps, tooltipRootEvents, tooltipRootProps, tooltipTriggerEvents, tooltipTriggerProps, useTooltipContent, useTooltipRoot, useTooltipTrigger };
34
+ export { TooltipContentElement, TooltipRootElement, TooltipTriggerElement, tooltipContentEvents, tooltipContentProps, tooltipRootEvents, tooltipRootProps, tooltipTriggerEvents, tooltipTriggerProps, useTooltipContent, useTooltipRoot, useTooltipTrigger };
35
+ //# sourceMappingURL=prosekit-web-tooltip.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prosekit-web-tooltip.js","names":["TooltipContentElementBase: BaseElementConstructor<TooltipContentProps>","TooltipRootElementBase: BaseElementConstructor<TooltipRootProps>","TooltipTriggerElementBase: BaseElementConstructor<TooltipTriggerProps>"],"sources":["../src/components/tooltip/tooltip-content/element.gen.ts","../src/components/tooltip/tooltip-root/element.gen.ts","../src/components/tooltip/tooltip-trigger/element.gen.ts"],"sourcesContent":["import { defineCustomElement, registerCustomElement, type BaseElementConstructor } from \"@aria-ui/core\"\n\nimport { useTooltipContent } from \"./setup\"\nimport { tooltipContentEvents, tooltipContentProps, type TooltipContentEvents, type TooltipContentProps } from \"./types\"\n\nconst TooltipContentElementBase: BaseElementConstructor<TooltipContentProps> = defineCustomElement<\n TooltipContentProps,\n TooltipContentEvents\n>({\n props: tooltipContentProps,\n events: tooltipContentEvents,\n setup: useTooltipContent,\n})\nclass TooltipContentElement extends TooltipContentElementBase {}\n\nregisterCustomElement('prosekit-tooltip-content', TooltipContentElement)\n \nexport { TooltipContentElement }\n","import { defineCustomElement, registerCustomElement, type BaseElementConstructor } from \"@aria-ui/core\"\n\nimport { useTooltipRoot } from \"./setup\"\nimport { tooltipRootEvents, tooltipRootProps, type TooltipRootEvents, type TooltipRootProps } from \"./types\"\n\nconst TooltipRootElementBase: BaseElementConstructor<TooltipRootProps> = defineCustomElement<\n TooltipRootProps,\n TooltipRootEvents\n>({\n props: tooltipRootProps,\n events: tooltipRootEvents,\n setup: useTooltipRoot,\n})\nclass TooltipRootElement extends TooltipRootElementBase {}\n\nregisterCustomElement('prosekit-tooltip-root', TooltipRootElement)\n \nexport { TooltipRootElement }\n","import { defineCustomElement, registerCustomElement, type BaseElementConstructor } from \"@aria-ui/core\"\n\nimport { useTooltipTrigger } from \"./setup\"\nimport { tooltipTriggerEvents, tooltipTriggerProps, type TooltipTriggerEvents, type TooltipTriggerProps } from \"./types\"\n\nconst TooltipTriggerElementBase: BaseElementConstructor<TooltipTriggerProps> = defineCustomElement<\n TooltipTriggerProps,\n TooltipTriggerEvents\n>({\n props: tooltipTriggerProps,\n events: tooltipTriggerEvents,\n setup: useTooltipTrigger,\n})\nclass TooltipTriggerElement extends TooltipTriggerElementBase {}\n\nregisterCustomElement('prosekit-tooltip-trigger', TooltipTriggerElement)\n \nexport { TooltipTriggerElement }\n"],"mappings":";;;;AAKA,MAAMA,4BAAyE,oBAG7E;CACA,OAAO;CACP,QAAQ;CACR,OAAO;CACR,CAAC;AACF,IAAM,wBAAN,cAAoC,0BAA0B;AAE9D,sBAAsB,4BAA4B,sBAAsB;;;;ACVxE,MAAMC,yBAAmE,oBAGvE;CACA,OAAO;CACP,QAAQ;CACR,OAAO;CACR,CAAC;AACF,IAAM,qBAAN,cAAiC,uBAAuB;AAExD,sBAAsB,yBAAyB,mBAAmB;;;;ACVlE,MAAMC,4BAAyE,oBAG7E;CACA,OAAO;CACP,QAAQ;CACR,OAAO;CACR,CAAC;AACF,IAAM,wBAAN,cAAoC,0BAA0B;AAE9D,sBAAsB,4BAA4B,sBAAsB"}
@@ -1 +1 @@
1
- export { };
1
+ export {};
@@ -0,0 +1 @@
1
+ export { };
@@ -8,4 +8,5 @@ function useEditorExtension(host, editor, extension) {
8
8
  }
9
9
 
10
10
  //#endregion
11
- export { useEditorExtension };
11
+ export { useEditorExtension };
12
+ //# sourceMappingURL=use-editor-extension-Cc7ZG7uj.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-editor-extension-Cc7ZG7uj.js","names":[],"sources":["../src/hooks/use-editor-extension.ts"],"sourcesContent":["import {\n useEffect,\n type ConnectableElement,\n type ReadonlySignal,\n} from '@aria-ui/core'\nimport type {\n Editor,\n Extension,\n} from '@prosekit/core'\n\nexport function useEditorExtension(\n host: ConnectableElement,\n editor: ReadonlySignal<Editor | null>,\n extension: Extension,\n): void {\n useEffect(host, () => {\n return editor.get()?.use(extension)\n })\n}\n"],"mappings":";;;AAUA,SAAgB,mBACd,MACA,QACA,WACM;AACN,WAAU,YAAY;AACpB,SAAO,OAAO,KAAK,EAAE,IAAI,UAAU;GACnC"}
@@ -32,4 +32,5 @@ function useScrolling(host) {
32
32
  }
33
33
 
34
34
  //#endregion
35
- export { assignStyles, useScrolling };
35
+ export { assignStyles, useScrolling };
36
+ //# sourceMappingURL=use-scrolling-BNfsQs3S.js.map