@prosekit/web 0.8.0-beta.5 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. package/dist/{prosekit-web-autocomplete.d.ts → autocomplete.d.ts} +10 -3
  2. package/dist/autocomplete.d.ts.map +1 -0
  3. package/dist/{prosekit-web-autocomplete.js → autocomplete.js} +15 -12
  4. package/dist/autocomplete.js.map +1 -0
  5. package/dist/{prosekit-web-block-handle.d.ts → block-handle.d.ts} +1 -1
  6. package/dist/block-handle.d.ts.map +1 -0
  7. package/dist/{prosekit-web-block-handle.js → block-handle.js} +17 -11
  8. package/dist/block-handle.js.map +1 -0
  9. package/dist/{prosekit-web-drop-indicator.d.ts → drop-indicator.d.ts} +1 -1
  10. package/dist/drop-indicator.d.ts.map +1 -0
  11. package/dist/{prosekit-web-drop-indicator.js → drop-indicator.js} +1 -1
  12. package/dist/drop-indicator.js.map +1 -0
  13. package/dist/{prosekit-web.d.ts → index.d.ts} +1 -1
  14. package/dist/index.d.ts.map +1 -0
  15. package/dist/{prosekit-web.js → index.js} +1 -1
  16. package/dist/index.js.map +1 -0
  17. package/dist/{prosekit-web-inline-popover.d.ts → inline-popover.d.ts} +1 -1
  18. package/dist/inline-popover.d.ts.map +1 -0
  19. package/dist/{prosekit-web-inline-popover.js → inline-popover.js} +5 -12
  20. package/dist/inline-popover.js.map +1 -0
  21. package/dist/{prosekit-web-menu.d.ts → menu.d.ts} +1 -1
  22. package/dist/menu.d.ts.map +1 -0
  23. package/dist/{prosekit-web-menu.js → menu.js} +1 -1
  24. package/dist/menu.js.map +1 -0
  25. package/dist/{prosekit-web-popover.d.ts → popover.d.ts} +1 -1
  26. package/dist/popover.d.ts.map +1 -0
  27. package/dist/{prosekit-web-popover.js → popover.js} +1 -1
  28. package/dist/popover.js.map +1 -0
  29. package/dist/{prosekit-web-resizable.d.ts → resizable.d.ts} +1 -1
  30. package/dist/resizable.d.ts.map +1 -0
  31. package/dist/{prosekit-web-resizable.js → resizable.js} +1 -1
  32. package/dist/resizable.js.map +1 -0
  33. package/dist/{prosekit-web-table-handle.d.ts → table-handle.d.ts} +1 -1
  34. package/dist/table-handle.d.ts.map +1 -0
  35. package/dist/{prosekit-web-table-handle.js → table-handle.js} +12 -23
  36. package/dist/table-handle.js.map +1 -0
  37. package/dist/{prosekit-web-tooltip.d.ts → tooltip.d.ts} +1 -1
  38. package/dist/tooltip.d.ts.map +1 -0
  39. package/dist/{prosekit-web-tooltip.js → tooltip.js} +1 -1
  40. package/dist/tooltip.js.map +1 -0
  41. package/dist/use-editor-update-event.js +11 -0
  42. package/dist/use-editor-update-event.js.map +1 -0
  43. package/package.json +44 -61
  44. package/src/components/autocomplete/autocomplete-positioner.ts +13 -4
  45. package/src/components/autocomplete/autocomplete-root.ts +3 -3
  46. package/src/components/block-handle/block-handle-add.ts +1 -1
  47. package/src/components/block-handle/block-handle-draggable.ts +1 -1
  48. package/src/components/block-handle/block-handle-positioner.ts +1 -1
  49. package/src/components/block-handle/block-handle-root.ts +5 -2
  50. package/src/components/block-handle/use-has-text-selection.ts +13 -0
  51. package/src/components/inline-popover/inline-popover-positioner.ts +1 -1
  52. package/src/components/inline-popover/inline-popover-root.ts +1 -1
  53. package/src/components/table-handle/shared.ts +6 -6
  54. package/src/components/table-handle/table-handle-column-menu-trigger.ts +1 -1
  55. package/src/components/table-handle/table-handle-drag-preview.ts +1 -1
  56. package/src/components/table-handle/table-handle-drop-indicator.ts +1 -1
  57. package/src/components/table-handle/table-handle-root.ts +1 -1
  58. package/src/components/table-handle/table-handle-row-menu-trigger.ts +1 -1
  59. package/dist/prosekit-web-autocomplete.d.ts.map +0 -1
  60. package/dist/prosekit-web-autocomplete.js.map +0 -1
  61. package/dist/prosekit-web-block-handle.d.ts.map +0 -1
  62. package/dist/prosekit-web-block-handle.js.map +0 -1
  63. package/dist/prosekit-web-drop-indicator.d.ts.map +0 -1
  64. package/dist/prosekit-web-drop-indicator.js.map +0 -1
  65. package/dist/prosekit-web-inline-popover.d.ts.map +0 -1
  66. package/dist/prosekit-web-inline-popover.js.map +0 -1
  67. package/dist/prosekit-web-menu.d.ts.map +0 -1
  68. package/dist/prosekit-web-menu.js.map +0 -1
  69. package/dist/prosekit-web-popover.d.ts.map +0 -1
  70. package/dist/prosekit-web-popover.js.map +0 -1
  71. package/dist/prosekit-web-resizable.d.ts.map +0 -1
  72. package/dist/prosekit-web-resizable.js.map +0 -1
  73. package/dist/prosekit-web-table-handle.d.ts.map +0 -1
  74. package/dist/prosekit-web-table-handle.js.map +0 -1
  75. package/dist/prosekit-web-tooltip.d.ts.map +0 -1
  76. package/dist/prosekit-web-tooltip.js.map +0 -1
  77. package/dist/prosekit-web.d.ts.map +0 -1
  78. package/dist/prosekit-web.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"popover.js","names":[],"sources":["../src/components/popover/index.ts"],"sourcesContent":["/**\n\n@module\n\n## Anatomy\n\n```html\n<prosekit-popover-root>\n <prosekit-popover-trigger>...</prosekit-popover-trigger>\n <prosekit-popover-positioner>\n <prosekit-popover-popup>...</prosekit-popover-popup>\n </prosekit-popover-positioner>\n</prosekit-popover-root>\n```\n*/\n\nimport { registerCustomElement, type PropsDeclaration } from '@aria-ui/core'\nimport * as Base from '@aria-ui/elements/popover'\n\n/**\n * `<prosekit-popover-popup>` custom element.\n *\n * Properties: {@link PopoverPopupProps}\n *\n * Data attributes:\n *\n * | Attribute | Description |\n * | --- | --- |\n * | `data-state` | `\"open\"` when the popover is visible, `\"closed\"` otherwise |\n */\nexport class PopoverPopupElement extends Base.PopoverPopupElement {}\n\n/**\n * `<prosekit-popover-positioner>` custom element.\n *\n * Properties: {@link PopoverPositionerProps}\n *\n * Data attributes:\n *\n * | Attribute | Description |\n * | --- | --- |\n * | `data-state` | `\"open\"` when the popover is visible, `\"closed\"` otherwise |\n *\n * CSS variables:\n *\n * | Variable | Description |\n * | --- | --- |\n * | `--transform-origin` | The coordinates that this element is anchored to. Useful for scale animations. |\n */\nexport class PopoverPositionerElement extends Base.PopoverPositionerElement {}\n\n/**\n * `<prosekit-popover-root>` custom element.\n *\n * Properties: {@link PopoverRootProps}\n *\n * Events: {@link PopoverRootEvents}\n */\nexport class PopoverRootElement extends Base.PopoverRootElement {}\n\n/**\n * `<prosekit-popover-trigger>` custom element.\n *\n * Properties: {@link PopoverTriggerProps}\n *\n * Events: {@link PopoverTriggerEvents}\n */\nexport class PopoverTriggerElement extends Base.PopoverTriggerElement {}\n\nexport interface PopoverPopupProps extends Base.PopoverPopupProps {}\nexport interface PopoverPositionerProps extends Base.PopoverPositionerProps {}\nexport interface PopoverRootProps extends Base.PopoverRootProps {}\nexport interface PopoverTriggerProps extends Base.PopoverTriggerProps {}\n\nexport interface PopoverRootEvents extends Base.PopoverRootEvents {}\nexport interface PopoverTriggerEvents extends Base.PopoverTriggerEvents {}\n\n/** @internal */\nexport const PopoverPopupPropsDeclaration: PropsDeclaration<PopoverPopupProps> = Base.PopoverPopupPropsDeclaration\n/** @internal */\nexport const PopoverPositionerPropsDeclaration: PropsDeclaration<PopoverPositionerProps> = Base.PopoverPositionerPropsDeclaration\n/** @internal */\nexport const PopoverRootPropsDeclaration: PropsDeclaration<PopoverRootProps> = Base.PopoverRootPropsDeclaration\n/** @internal */\nexport const PopoverTriggerPropsDeclaration: PropsDeclaration<PopoverTriggerProps> = Base.PopoverTriggerPropsDeclaration\n\nexport function registerPopoverRootElement(): void {\n registerCustomElement('prosekit-popover-root', PopoverRootElement)\n}\nexport function registerPopoverTriggerElement(): void {\n registerCustomElement('prosekit-popover-trigger', PopoverTriggerElement)\n}\nexport function registerPopoverPopupElement(): void {\n registerCustomElement('prosekit-popover-popup', PopoverPopupElement)\n}\nexport function registerPopoverPositionerElement(): void {\n registerCustomElement('prosekit-popover-positioner', PopoverPositionerElement)\n}\n\nexport {\n OpenChangeEvent,\n setupPopoverPopup,\n setupPopoverPositioner,\n setupPopoverRoot,\n setupPopoverTrigger,\n} from '@aria-ui/elements/popover'\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8BA,IAAa,sBAAb,cAAyC,KAAK,oBAAoB;;;;;;;;;;;;;;;;;;AAmBlE,IAAa,2BAAb,cAA8C,KAAK,yBAAyB;;;;;;;;AAS5E,IAAa,qBAAb,cAAwC,KAAK,mBAAmB;;;;;;;;AAShE,IAAa,wBAAb,cAA2C,KAAK,sBAAsB;;AAWtE,MAAa,+BAAoE,KAAK;;AAEtF,MAAa,oCAA8E,KAAK;;AAEhG,MAAa,8BAAkE,KAAK;;AAEpF,MAAa,iCAAwE,KAAK;AAE1F,SAAgB,6BAAmC;AACjD,uBAAsB,yBAAyB,mBAAmB;;AAEpE,SAAgB,gCAAsC;AACpD,uBAAsB,4BAA4B,sBAAsB;;AAE1E,SAAgB,8BAAoC;AAClD,uBAAsB,0BAA0B,oBAAoB;;AAEtE,SAAgB,mCAAyC;AACvD,uBAAsB,+BAA+B,yBAAyB"}
@@ -113,4 +113,4 @@ declare class ResizableHandleElement extends ResizableHandleElementBase {}
113
113
  */
114
114
  declare function registerResizableHandleElement(): void;
115
115
  export { ResizableHandleElement, type ResizableHandleProps, ResizableHandlePropsDeclaration, ResizableRootElement, type ResizableRootEvents, type ResizableRootProps, ResizableRootPropsDeclaration, ResizeEndEvent, ResizeStartEvent, registerResizableHandleElement, registerResizableRootElement, setupResizableHandle, setupResizableRoot };
116
- //# sourceMappingURL=prosekit-web-resizable.d.ts.map
116
+ //# sourceMappingURL=resizable.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resizable.d.ts","names":[],"sources":["../src/components/resizable/resizable-root.ts","../src/components/resizable/resizable-handle.ts"],"mappings":";AAkBA;;;AAAA,UAAiB,kBAAA;EAMf;;;;;EAAA,KAAA;EAwBA;;;;AAKF;EAtBE,MAAA;;;;;;EAOA,WAAA;AAAA;;AA8BF;;cAxBa,6BAAA,EAA+B,gBAAA,CAAiB,kBAAA;;;;UAS5C,mBAAA;EAkBJ;;;EAdX,WAAA,EAAa,gBAAA;EAgB4B;;AAS3C;EApBE,SAAA,EAAW,cAAA;AAAA;;;;cAMA,gBAAA,SAAyB,KAAA;EAAA,SAC3B,MAAA;IAAA,SACE,KAAA;IAAA,SACA,MAAA;EAAA;cAEC,KAAA,UAAe,MAAA;AAAA;AAuB7B;;;AAAA,cAda,cAAA,SAAuB,KAAA;EAAA,SACzB,MAAA;IAAA,SACE,KAAA;IAAA,SACA,MAAA;EAAA;cAEC,KAAA,UAAe,MAAA;AAAA;;;;iBASb,kBAAA,CACd,IAAA,EAAM,WAAA,EACN,KAAA,EAAO,KAAA,CAAM,kBAAA;AAAA,cAkET,wBAAA,EAA0B,sBAAA,CAAuB,kBAAA;AAvBtD;;;;;AAyCD;;;;;AAOA;;;AAhDC,cAyCY,oBAAA,SAA6B,wBAAA;;AC5K1C;;iBDmLgB,4BAAA,CAAA;AA3KhB;;;AAAA,UCRiB,oBAAA;EDcf;;;;;ECRA,QAAA;AAAA;;;;cAcW,+BAAA,EAAiC,gBAAA,CAAiB,oBAAA;;;;iBAO/C,oBAAA,CACd,IAAA,EAAM,WAAA,EACN,KAAA,EAAO,KAAA,CAAM,oBAAA;AAAA,cA2ET,0BAAA,EAA4B,sBAAA,CAAuB,oBAAA;;;;;AD9CzD;cCwDa,sBAAA,SAA+B,0BAAA;;;;iBAO5B,8BAAA,CAAA"}
@@ -273,4 +273,4 @@ function registerResizableHandleElement() {
273
273
  }
274
274
  export { ResizableHandleElement, ResizableHandlePropsDeclaration, ResizableRootElement, ResizableRootPropsDeclaration, ResizeEndEvent, ResizeStartEvent, registerResizableHandleElement, registerResizableRootElement, setupResizableHandle, setupResizableRoot };
275
275
 
276
- //# sourceMappingURL=prosekit-web-resizable.js.map
276
+ //# sourceMappingURL=resizable.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resizable.js","names":[],"sources":["../src/utils/is-finite-positive-number.ts","../src/components/resizable/context.ts","../src/components/resizable/resizable-root.ts","../src/components/resizable/calc-resize.ts","../src/components/resizable/resizable-handle.ts"],"sourcesContent":["export function isFinitePositiveNumber(value: unknown): value is number {\n return typeof value === 'number' && Number.isFinite(value) && value > 0\n}\n","import { createContext, type Context } from '@aria-ui/core'\n\n/**\n * @internal\n */\nexport const onResizeContext: Context<OnResize> = createContext<OnResize>(\n 'prosekit/resizable/onResize',\n)\n\n/**\n * @internal\n */\nexport const onResizeStartContext: Context<OnResizeStart> = createContext<OnResizeStart>(\n 'prosekit/resizable/onResizeStart',\n)\n\n/**\n * @internal\n */\nexport const onResizeEndContext: Context<OnResizeEnd> = createContext<OnResizeEnd>(\n 'prosekit/resizable/onResizeEnd',\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","import type { HostElement, HostElementConstructor, PropsDeclaration } from '@aria-ui/core'\nimport { createSignal, defineCustomElement, defineProps, registerCustomElement, useEffect, type State } from '@aria-ui/core'\nimport { useAttribute } from '@aria-ui/utils'\n\nimport { isFinitePositiveNumber } from '../../utils/is-finite-positive-number.ts'\n\nimport {\n onResizeContext,\n onResizeEndContext,\n onResizeStartContext,\n type OnResize,\n type OnResizeEnd,\n type OnResizeStart,\n} from './context.ts'\n\n/**\n * @public\n */\nexport interface ResizableRootProps {\n /**\n * The width of the resizable element.\n *\n * @default null\n */\n width: number | null\n\n /**\n * The height of the resizable element.\n *\n * @default null\n */\n height: number | null\n\n /**\n * The aspect ratio of the resizable element.\n *\n * @default null\n */\n aspectRatio: number | null\n}\n\n/**\n * @internal\n */\nexport const ResizableRootPropsDeclaration: PropsDeclaration<ResizableRootProps> = defineProps<ResizableRootProps>({\n width: { default: null, attribute: 'data-width', type: 'json' },\n height: { default: null, attribute: 'data-height', type: 'json' },\n aspectRatio: { default: null, attribute: 'data-aspect-ratio', type: 'json' },\n})\n\n/**\n * @public\n */\nexport interface ResizableRootEvents {\n /**\n * Emitted when a resize operation starts.\n */\n resizeStart: ResizeStartEvent\n\n /**\n * Emitted when a resize operation ends.\n */\n resizeEnd: ResizeEndEvent\n}\n\n/**\n * @public\n */\nexport class ResizeStartEvent extends Event {\n readonly detail: {\n readonly width: number\n readonly height: number\n }\n constructor(width: number, height: number) {\n super('resizeStart')\n this.detail = { width, height }\n }\n}\n\n/**\n * @public\n */\nexport class ResizeEndEvent extends Event {\n readonly detail: {\n readonly width: number\n readonly height: number\n }\n constructor(width: number, height: number) {\n super('resizeEnd')\n this.detail = { width, height }\n }\n}\n\n/**\n * @internal\n */\nexport function setupResizableRoot(\n host: HostElement,\n props: State<ResizableRootProps>,\n): void {\n const resizing = createSignal(false)\n\n const onResizeStart: OnResizeStart = () => {\n const { width, height } = host.getBoundingClientRect()\n\n let aspectRatio: number = props.aspectRatio.get() ?? width / height\n\n if (!isFinitePositiveNumber(aspectRatio)) {\n aspectRatio = 0\n }\n\n resizing.set(true)\n host.dispatchEvent(new ResizeStartEvent(width, height))\n return [width, height, aspectRatio]\n }\n\n const onResize: OnResize = (width, height) => {\n props.width.set(width)\n props.height.set(height)\n }\n\n const onResizeEnd: OnResizeEnd = () => {\n const { width, height } = host.getBoundingClientRect()\n resizing.set(false)\n host.dispatchEvent(new ResizeEndEvent(width, height))\n }\n\n onResizeStartContext.provide(host, onResizeStart)\n onResizeContext.provide(host, onResize)\n onResizeEndContext.provide(host, onResizeEnd)\n\n useEffect(host, () => {\n updateResizableRootStyles(\n host,\n Math.max(props.width.get() || 0, 1),\n Math.max(props.height.get() || 0, 1),\n props.aspectRatio.get(),\n )\n })\n\n useAttribute(host, 'data-resizing', () => (resizing.get() ? '' : undefined))\n}\n\nfunction updateResizableRootStyles(\n host: HostElement,\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\nconst ResizableRootElementBase: HostElementConstructor<ResizableRootProps> = defineCustomElement(\n setupResizableRoot,\n ResizableRootPropsDeclaration,\n)\n\n/**\n * `<prosekit-resizable-root>` custom element.\n *\n * Properties: {@link ResizableRootProps}\n *\n * Events: {@link ResizableRootEvents}\n *\n * Data attributes:\n *\n * | Attribute | Description |\n * | --- | --- |\n * | `data-resizing` | Present when the element is being resized |\n */\nexport class ResizableRootElement extends ResizableRootElementBase {}\n\nlet isResizableRootRegistered = false\n\n/**\n * @internal\n */\nexport function registerResizableRootElement(): void {\n if (isResizableRootRegistered) return\n isResizableRootRegistered = true\n registerCustomElement('prosekit-resizable-root', ResizableRootElement)\n}\n","import { isFinitePositiveNumber } from '../../utils/is-finite-positive-number.ts'\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 type { HostElement, HostElementConstructor, PropsDeclaration } from '@aria-ui/core'\nimport { createSignal, defineCustomElement, defineProps, registerCustomElement, useEffect, type State } from '@aria-ui/core'\nimport { getWindow } from '@ocavue/utils'\n\nimport { calcResize } from './calc-resize.ts'\nimport { onResizeContext, onResizeEndContext, onResizeStartContext } from './context.ts'\n\n/**\n * @public\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/**\n * @internal\n */\nexport const ResizableHandlePropsDeclaration: PropsDeclaration<ResizableHandleProps> = defineProps<ResizableHandleProps>({\n position: { default: 'bottom-right', attribute: 'position', type: 'string' },\n})\n\n/**\n * @internal\n */\nexport function setupResizableHandle(\n host: HostElement,\n props: State<ResizableHandleProps>,\n): void {\n const getOnResize = onResizeContext.consume(host)\n const getOnResizeStart = onResizeStartContext.consume(host)\n const getOnResizeEnd = onResizeEndContext.consume(host)\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 = getOnResizeStart()?.()\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 props.position.get(),\n width,\n height,\n dx,\n dy,\n aspectRatio,\n )\n\n getOnResize()?.(w, h)\n }\n\n const handlePointerUp = (event: PointerEvent) => {\n event.preventDefault()\n pointerPressing.set(false)\n\n getOnResizeEnd()?.()\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\nconst ResizableHandleElementBase: HostElementConstructor<ResizableHandleProps> = defineCustomElement(\n setupResizableHandle,\n ResizableHandlePropsDeclaration,\n)\n\n/**\n * `<prosekit-resizable-handle>` custom element.\n *\n * Properties: {@link ResizableHandleProps}\n */\nexport class ResizableHandleElement extends ResizableHandleElementBase {}\n\nlet isResizableHandleRegistered = false\n\n/**\n * @internal\n */\nexport function registerResizableHandleElement(): void {\n if (isResizableHandleRegistered) return\n isResizableHandleRegistered = true\n registerCustomElement('prosekit-resizable-handle', ResizableHandleElement)\n}\n"],"mappings":";;;AAAA,SAAgB,uBAAuB,OAAiC;AACtE,QAAO,OAAO,UAAU,YAAY,OAAO,SAAS,MAAM,IAAI,QAAQ;;;;;ACIxE,MAAa,kBAAqC,cAChD,8BACD;;;;AAKD,MAAa,uBAA+C,cAC1D,mCACD;;;;AAKD,MAAa,qBAA2C,cACtD,iCACD;;;;ACuBD,MAAa,gCAAsE,YAAgC;CACjH,OAAO;EAAE,SAAS;EAAM,WAAW;EAAc,MAAM;EAAQ;CAC/D,QAAQ;EAAE,SAAS;EAAM,WAAW;EAAe,MAAM;EAAQ;CACjE,aAAa;EAAE,SAAS;EAAM,WAAW;EAAqB,MAAM;EAAQ;CAC7E,CAAC;;;;AAoBF,IAAa,mBAAb,cAAsC,MAAM;CAK1C,YAAY,OAAe,QAAgB;AACzC,QAAM,cAAc;AACpB,OAAK,SAAS;GAAE;GAAO;GAAQ;;;;;;AAOnC,IAAa,iBAAb,cAAoC,MAAM;CAKxC,YAAY,OAAe,QAAgB;AACzC,QAAM,YAAY;AAClB,OAAK,SAAS;GAAE;GAAO;GAAQ;;;;;;AAOnC,SAAgB,mBACd,MACA,OACM;CACN,MAAM,WAAW,aAAa,MAAM;CAEpC,MAAM,sBAAqC;EACzC,MAAM,EAAE,OAAO,WAAW,KAAK,uBAAuB;EAEtD,IAAI,cAAsB,MAAM,YAAY,KAAK,IAAI,QAAQ;AAE7D,MAAI,CAAC,uBAAuB,YAAY,CACtC,eAAc;AAGhB,WAAS,IAAI,KAAK;AAClB,OAAK,cAAc,IAAI,iBAAiB,OAAO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AkB,IAAI;AACnC,MAAI,KACD,EAAC,OAAO,QAAQ,eAAe;;CAIpC,MAAM,qBAAqB,UAAwB;AACjD,QAAM,gBAAgB;EAEtB,MAAM,KAAK,MAAM,IAAI;EACrB,MAAM,KAAK,MAAM,IAAI;EAErB,MAAM,CAAC,GAAG,KAAK,WACb,MAAM,SAAS,KAAK,EACpB,OACA,QACA,IACA,IACA,YACD;AAED,eAAa,GAAG,GAAG,EAAE;;CAGvB,MAAM,mBAAmB,UAAwB;AAC/C,QAAM,gBAAgB;AACtB,kBAAgB,IAAI,MAAM;AAE1B,kBAAgB,IAAI;;AAGtB,WAAU,YAAY;AACpB,OAAK,iBAAiB,eAAe,kBAAkB;AACvD,eAAa;AACX,QAAK,oBAAoB,eAAe,kBAAkB;;GAE5D;AAEF,WAAU,YAAY;AACpB,MAAI,CAAC,gBAAgB,KAAK,CACxB;EAGF,MAAM,MAAM,UAAU,KAAK;AAE3B,MAAI,iBAAiB,eAAe,kBAAkB;AACtD,MAAI,iBAAiB,aAAa,gBAAgB;AAClD,eAAa;AACX,OAAI,oBAAoB,eAAe,kBAAkB;AACzD,OAAI,oBAAoB,aAAa,gBAAgB;;GAEvD;;AAGJ,MAAM,6BAA2E,oBAC/E,sBACA,gCACD;;;;;;AAOD,IAAa,yBAAb,cAA4C,2BAA2B;AAEvE,IAAI,8BAA8B;;;;AAKlC,SAAgB,iCAAuC;AACrD,KAAI,4BAA6B;AACjC,+BAA8B;AAC9B,uBAAsB,6BAA6B,uBAAuB"}
@@ -303,4 +303,4 @@ declare class TableHandleRowMenuTriggerElement extends TableHandleRowMenuTrigger
303
303
  */
304
304
  declare function registerTableHandleRowMenuTriggerElement(): void;
305
305
  export { TableHandleColumnMenuRootElement, type TableHandleColumnMenuRootProps, TableHandleColumnMenuRootPropsDeclaration, TableHandleColumnMenuTriggerElement, type TableHandleColumnMenuTriggerProps, TableHandleColumnMenuTriggerPropsDeclaration, TableHandleColumnPopupElement, type TableHandleColumnPopupProps, TableHandleColumnPopupPropsDeclaration, TableHandleColumnPositionerElement, type TableHandleColumnPositionerProps, TableHandleColumnPositionerPropsDeclaration, TableHandleDragPreviewElement, type TableHandleDragPreviewProps, TableHandleDragPreviewPropsDeclaration, TableHandleDropIndicatorElement, type TableHandleDropIndicatorProps, TableHandleDropIndicatorPropsDeclaration, TableHandleRootElement, type TableHandleRootProps, TableHandleRootPropsDeclaration, TableHandleRowMenuRootElement, type TableHandleRowMenuRootProps, TableHandleRowMenuRootPropsDeclaration, TableHandleRowMenuTriggerElement, type TableHandleRowMenuTriggerProps, TableHandleRowMenuTriggerPropsDeclaration, TableHandleRowPopupElement, type TableHandleRowPopupProps, TableHandleRowPopupPropsDeclaration, TableHandleRowPositionerElement, type TableHandleRowPositionerProps, TableHandleRowPositionerPropsDeclaration, registerTableHandleColumnMenuRootElement, registerTableHandleColumnMenuTriggerElement, registerTableHandleColumnPopupElement, registerTableHandleColumnPositionerElement, registerTableHandleDragPreviewElement, registerTableHandleDropIndicatorElement, registerTableHandleRootElement, registerTableHandleRowMenuRootElement, registerTableHandleRowMenuTriggerElement, registerTableHandleRowPopupElement, registerTableHandleRowPositionerElement, setupTableHandleColumnMenuRoot, setupTableHandleColumnMenuTrigger, setupTableHandleColumnPopup, setupTableHandleColumnPositioner, setupTableHandleDragPreview, setupTableHandleDropIndicator, setupTableHandleRoot, setupTableHandleRowMenuRoot, setupTableHandleRowMenuTrigger, setupTableHandleRowPopup, setupTableHandleRowPositioner };
306
- //# sourceMappingURL=prosekit-web-table-handle.d.ts.map
306
+ //# sourceMappingURL=table-handle.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"table-handle.d.ts","names":[],"sources":["../src/components/table-handle/table-handle-column-popup.ts","../src/components/table-handle/shared.ts","../src/components/table-handle/table-handle-column-positioner.ts","../src/components/table-handle/table-handle-column-menu-root.ts","../src/components/table-handle/table-handle-column-menu-trigger.ts","../src/components/table-handle/table-handle-drag-preview.ts","../src/components/table-handle/table-handle-drop-indicator.ts","../src/components/table-handle/table-handle-root.ts","../src/components/table-handle/table-handle-row-popup.ts","../src/components/table-handle/table-handle-row-positioner.ts","../src/components/table-handle/table-handle-row-menu-root.ts","../src/components/table-handle/table-handle-row-menu-trigger.ts"],"mappings":";;;;;;UAaiB,2BAAA;;cAGJ,sCAAA,EAAwC,gBAAA,CAAiB,2BAAA;;iBAKtD,2BAAA,CACd,IAAA,EAAM,WAAA,EACN,MAAA,EAAQ,KAAA,CAAM,2BAAA;AAAA,cAOV,iCAAA,EAAmC,sBAAA,CAAuB,2BAAA;;;;;AAdhE;;;;;AAKA;;cAyBa,6BAAA,SAAsC,iCAAA;;iBAGnC,qCAAA,CAAA;;;;UC1CC,gCAAA,SAAyC,IAAA,CAAK,sBAAA;EDM9C;;;;;AAGjB;ECFE,MAAA,EAAQ,MAAA;;;;ADOV;;;ECCE,KAAA,EAAO,sBAAA;EDCO;;;;ECKd,IAAA,EAAM,sBAAA;EDNN;;;;ECYA,KAAA,EAAO,sBAAA;EDXmC;AAK3C;;;ECYC,IAAA,EAAM,sBAAA;EDVmF;AAgB3F;;;ECAE,MAAA,EAAQ,sBAAA;AAAA;AAAA,UC3BO,gCAAA,SAAyC,IAAA,CAAK,gCAAA;;;;AFN/D;;EEYE,SAAA,EAAW,SAAA;AAAA;;cAIA,2CAAA,EAA6C,gBAAA,CAAiB,gCAAA;;iBAQ3D,gCAAA,CACd,IAAA,EAAM,WAAA,EACN,KAAA,EAAO,KAAA,CAAM,gCAAA;AAAA,cAcT,sCAAA,EAAwC,sBAAA,CAAuB,gCAAA;;AFhCrE;;;;;;;;;;;;;;;AAOC;;;cEiDY,kCAAA,SAA2C,sCAAA;AF/BxD;AAAA,iBEkCgB,0CAAA,CAAA;AAAA,UClEC,8BAAA,SAAuC,aAAA;;cAG3C,yCAAA,EAA2C,gBAAA,CAAiB,8BAAA;;iBAKzD,8BAAA,CACd,IAAA,EAAM,WAAA,EACN,KAAA,EAAO,KAAA,CAAM,8BAAA;AAAA,cAaT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AAiB,8BAAA;;iBAOzD,8BAAA,CACd,IAAA,EAAM,WAAA,EACN,KAAA,EAAO,KAAA,CAAM,8BAAA;AAAA,cAoDT,oCAAA,EAAsC,sBAAA,CAAuB,8BAAA;;AXtEnE;;;;cWgFa,gCAAA,SAAyC,oCAAA;;;;iBAKtC,wCAAA,CAAA"}
@@ -115,33 +115,27 @@ const SharedTableHandlePositionerPropsDeclaration = defineProps({
115
115
  ...OverlayPositionerPropsDeclaration,
116
116
  editor: {
117
117
  default: null,
118
- attribute: false,
119
- type: "json"
118
+ attribute: false
120
119
  },
121
120
  hoist: {
122
121
  default: false,
123
- attribute: false,
124
- type: "boolean"
122
+ attribute: false
125
123
  },
126
124
  flip: {
127
125
  default: false,
128
- attribute: false,
129
- type: "json"
126
+ attribute: false
130
127
  },
131
128
  shift: {
132
129
  default: false,
133
- attribute: false,
134
- type: "boolean"
130
+ attribute: false
135
131
  },
136
132
  hide: {
137
133
  default: true,
138
- attribute: false,
139
- type: "boolean"
134
+ attribute: false
140
135
  },
141
136
  offset: {
142
137
  default: 0,
143
- attribute: false,
144
- type: "json"
138
+ attribute: false
145
139
  }
146
140
  });
147
141
  /** @internal */
@@ -238,8 +232,7 @@ function useEmptyImage(host) {
238
232
  /** @internal */
239
233
  const TableHandleColumnMenuTriggerPropsDeclaration = defineProps({ editor: {
240
234
  default: null,
241
- attribute: false,
242
- type: "json"
235
+ attribute: false
243
236
  } });
244
237
  /** @internal */
245
238
  function setupTableHandleColumnMenuTrigger(host, props) {
@@ -501,8 +494,7 @@ function unsetSize(element) {
501
494
  /** @internal */
502
495
  const TableHandleDragPreviewPropsDeclaration = defineProps({ editor: {
503
496
  default: null,
504
- attribute: false,
505
- type: "json"
497
+ attribute: false
506
498
  } });
507
499
  /**
508
500
  * @internal
@@ -627,8 +619,7 @@ const HANDLE_WIDTH = 2;
627
619
  /** @internal */
628
620
  const TableHandleDropIndicatorPropsDeclaration = defineProps({ editor: {
629
621
  default: null,
630
- attribute: false,
631
- type: "json"
622
+ attribute: false
632
623
  } });
633
624
  /**
634
625
  * @internal
@@ -874,8 +865,7 @@ function getCellIndex(map, rowIndex, colIndex) {
874
865
  /** @internal */
875
866
  const TableHandleRootPropsDeclaration = defineProps({ editor: {
876
867
  default: null,
877
- attribute: false,
878
- type: "json"
868
+ attribute: false
879
869
  } });
880
870
  /**
881
871
  * @internal
@@ -1014,8 +1004,7 @@ function registerTableHandleRowMenuRootElement() {
1014
1004
  /** @internal */
1015
1005
  const TableHandleRowMenuTriggerPropsDeclaration = defineProps({ editor: {
1016
1006
  default: null,
1017
- attribute: false,
1018
- type: "json"
1007
+ attribute: false
1019
1008
  } });
1020
1009
  /** @internal */
1021
1010
  function setupTableHandleRowMenuTrigger(host, props) {
@@ -1070,4 +1059,4 @@ function registerTableHandleRowMenuTriggerElement() {
1070
1059
  }
1071
1060
  export { TableHandleColumnMenuRootElement, TableHandleColumnMenuRootPropsDeclaration, TableHandleColumnMenuTriggerElement, TableHandleColumnMenuTriggerPropsDeclaration, TableHandleColumnPopupElement, TableHandleColumnPopupPropsDeclaration, TableHandleColumnPositionerElement, TableHandleColumnPositionerPropsDeclaration, TableHandleDragPreviewElement, TableHandleDragPreviewPropsDeclaration, TableHandleDropIndicatorElement, TableHandleDropIndicatorPropsDeclaration, TableHandleRootElement, TableHandleRootPropsDeclaration, TableHandleRowMenuRootElement, TableHandleRowMenuRootPropsDeclaration, TableHandleRowMenuTriggerElement, TableHandleRowMenuTriggerPropsDeclaration, TableHandleRowPopupElement, TableHandleRowPopupPropsDeclaration, TableHandleRowPositionerElement, TableHandleRowPositionerPropsDeclaration, registerTableHandleColumnMenuRootElement, registerTableHandleColumnMenuTriggerElement, registerTableHandleColumnPopupElement, registerTableHandleColumnPositionerElement, registerTableHandleDragPreviewElement, registerTableHandleDropIndicatorElement, registerTableHandleRootElement, registerTableHandleRowMenuRootElement, registerTableHandleRowMenuTriggerElement, registerTableHandleRowPopupElement, registerTableHandleRowPositionerElement, setupTableHandleColumnMenuRoot, setupTableHandleColumnMenuTrigger, setupTableHandleColumnPopup, setupTableHandleColumnPositioner, setupTableHandleDragPreview, setupTableHandleDropIndicator, setupTableHandleRoot, setupTableHandleRowMenuRoot, setupTableHandleRowMenuTrigger, setupTableHandleRowPopup, setupTableHandleRowPositioner };
1072
1061
 
1073
- //# sourceMappingURL=prosekit-web-table-handle.js.map
1062
+ //# sourceMappingURL=table-handle.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"table-handle.js","names":[],"sources":["../src/components/table-handle/store.ts","../src/components/table-handle/table-handle-column-popup.ts","../src/utils/use-html-element-at.ts","../src/components/table-handle/shared.ts","../src/components/table-handle/table-handle-column-positioner.ts","../src/components/table-handle/table-handle-column-menu-root.ts","../src/components/table-handle/use-empty-image.ts","../src/components/table-handle/table-handle-column-menu-trigger.ts","../src/components/table-handle/dnd.ts","../src/utils/clone-element.ts","../src/utils/css-feature-detection.ts","../src/utils/fade-color.ts","../src/utils/get-effective-background-color.ts","../src/utils/inject-style.ts","../src/components/table-handle/render-preview.ts","../src/components/table-handle/table-handle-drag-preview.ts","../src/components/table-handle/calc-drag-over.ts","../src/components/table-handle/table-handle-drop-indicator.ts","../src/hooks/use-editor-typing.ts","../src/hooks/use-selecting.ts","../src/components/table-handle/use-drop.ts","../src/components/table-handle/utils.ts","../src/components/table-handle/table-handle-root.ts","../src/components/table-handle/table-handle-row-popup.ts","../src/components/table-handle/table-handle-row-positioner.ts","../src/components/table-handle/table-handle-row-menu-root.ts","../src/components/table-handle/table-handle-row-menu-trigger.ts"],"sourcesContent":["import { computed, createContext, createSignal, type Context, type Signal } from '@aria-ui/core'\nimport type { OpenChangeEvent } from '@aria-ui/elements/overlay'\nimport { createOverlayStore, type OverlayStore } from '@aria-ui/elements/overlay'\n\nimport type { HoveringCellInfo } from './utils.ts'\n\nfunction noop(): void {}\nfunction returnTrue(): boolean {\n return true\n}\nfunction returnFalse(): boolean {\n return false\n}\n\nclass DndStore {\n readonly dragging: Signal<boolean> = createSignal(false)\n readonly direction: Signal<'row' | 'col'> = createSignal<'row' | 'col'>('row')\n readonly draggingIndex: Signal<number> = createSignal(-1)\n readonly droppingIndex: Signal<number> = createSignal(-1)\n readonly x: Signal<number> = createSignal(-1)\n readonly y: Signal<number> = createSignal(-1)\n readonly startX: Signal<number> = createSignal(-1)\n readonly startY: Signal<number> = createSignal(-1)\n}\n\n/**\n * @internal\n */\nexport interface TableHandleStore {\n readonly dndStore: DndStore\n readonly setIsColumnMenuOpen: (open: boolean) => void\n readonly setIsRowMenuOpen: (open: boolean) => void\n readonly columnOverlayStore: OverlayStore\n readonly rowOverlayStore: OverlayStore\n readonly getReferenceCell: () => HoveringCellInfo | undefined\n}\n\n/**\n * @internal\n */\nexport function createTableHandleStore(\n getHoveringCellInfo: () => HoveringCellInfo | undefined,\n getCanShow: () => boolean,\n): TableHandleStore {\n const isColumnMenuOpen = createSignal(false)\n const isRowMenuOpen = createSignal(false)\n\n const getHasMenuOpen = (): boolean => {\n return isColumnMenuOpen.get() || isRowMenuOpen.get()\n }\n\n const setIsRowMenuOpen = (open: boolean): void => {\n isRowMenuOpen.set(open)\n }\n\n const setIsColumnMenuOpen = (open: boolean): void => {\n isColumnMenuOpen.set(open)\n }\n\n const referenceCellInfo = createSignal<HoveringCellInfo | undefined>(undefined)\n\n let prevHoveringCellInfo: HoveringCellInfo | undefined = undefined\n\n const getReferenceCell = computed((): HoveringCellInfo | undefined => {\n if (!getCanShow()) {\n referenceCellInfo.set(undefined)\n return\n }\n\n // Do not toggle/update the menu when hovering another cell if the menu is already open\n if (getHasMenuOpen()) {\n return prevHoveringCellInfo\n }\n\n prevHoveringCellInfo = getHoveringCellInfo()\n return prevHoveringCellInfo\n })\n\n const getOpen = computed((): boolean => {\n return !!getReferenceCell()\n })\n\n const handleOpenChange = (event: OpenChangeEvent) => {\n if (getHasMenuOpen()) {\n event.preventDefault()\n }\n }\n\n const columnOverlayStore = createOverlayStore(\n getOpen,\n noop,\n returnTrue,\n returnFalse,\n handleOpenChange,\n )\n const rowOverlayStore = createOverlayStore(\n getOpen,\n noop,\n returnTrue,\n returnFalse,\n handleOpenChange,\n )\n\n return {\n dndStore: new DndStore(),\n setIsRowMenuOpen,\n setIsColumnMenuOpen,\n columnOverlayStore,\n rowOverlayStore,\n getReferenceCell,\n }\n}\n\n/**\n * @internal\n */\nexport const tableHandleStoreContext: Context<TableHandleStore> = createContext<TableHandleStore>('prosekit-table-handle-store')\n","import {\n defineCustomElement,\n defineProps,\n registerCustomElement,\n type HostElement,\n type HostElementConstructor,\n type PropsDeclaration,\n type State,\n} from '@aria-ui/core'\nimport { setupOverlayPopup } from '@aria-ui/elements/overlay'\n\nimport { tableHandleStoreContext } from './store.ts'\n\nexport interface TableHandleColumnPopupProps {}\n\n/** @internal */\nexport const TableHandleColumnPopupPropsDeclaration: PropsDeclaration<TableHandleColumnPopupProps> = defineProps<\n TableHandleColumnPopupProps\n>({})\n\n/** @internal */\nexport function setupTableHandleColumnPopup(\n host: HostElement,\n _props: State<TableHandleColumnPopupProps>,\n): void {\n const getStore = tableHandleStoreContext.consume(host)\n const getOverlayStore = () => getStore()?.columnOverlayStore\n setupOverlayPopup(host, getOverlayStore)\n}\n\nconst TableHandleColumnPopupElementBase: HostElementConstructor<TableHandleColumnPopupProps> = defineCustomElement(\n setupTableHandleColumnPopup,\n TableHandleColumnPopupPropsDeclaration,\n)\n\n/**\n * `<prosekit-table-handle-column-popup>` custom element.\n *\n * Properties: {@link TableHandleColumnPopupProps}\n *\n * Data attributes:\n *\n * | Attribute | Description |\n * | --- | --- |\n * | `data-state` | `\"open\"` when visible, `\"closed\"` otherwise |\n */\nexport class TableHandleColumnPopupElement extends TableHandleColumnPopupElementBase {}\n\n/** @internal */\nexport function registerTableHandleColumnPopupElement(): void {\n registerCustomElement('prosekit-table-handle-column-popup', TableHandleColumnPopupElement)\n}\n","import { computed } from '@aria-ui/core'\nimport { isHTMLElement } from '@ocavue/utils'\nimport type { Editor } from '@prosekit/core'\n\nexport function useHTMLElementAt(\n getEditor: () => Editor | null | undefined,\n getPos: () => number | null | undefined,\n): () => HTMLElement | undefined {\n return computed(() => {\n const editor = getEditor()\n const pos = getPos()\n if (!editor || !pos) return\n const view = editor.view\n const element = view.nodeDOM(pos)\n if (element && isHTMLElement(element)) return element\n })\n}\n","import { defineProps, type PropsDeclaration } from '@aria-ui/core'\nimport { OverlayPositionerPropsDeclaration, type OverlayPositionerProps } from '@aria-ui/elements/overlay'\nimport type { Editor } from '@prosekit/core'\n\n/**\n * @internal\n */\nexport interface SharedTableHandlePositionerProps extends Omit<OverlayPositionerProps, 'hoist' | 'flip' | 'shift' | 'hide' | 'offset'> {\n /**\n * The ProseKit editor instance.\n *\n * @default null\n * @hidden\n */\n editor: Editor | null\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: OverlayPositionerProps['hoist']\n\n /**\n * @default false\n * @hidden\n */\n flip: OverlayPositionerProps['flip']\n\n /**\n * @default false\n * @hidden\n */\n shift: OverlayPositionerProps['shift']\n\n /**\n * @default true\n * @hidden\n */\n hide: OverlayPositionerProps['hide']\n\n /**\n * @default 0\n * @hidden\n */\n offset: OverlayPositionerProps['offset']\n}\n\n/** @internal */\nexport const SharedTableHandlePositionerPropsDeclaration: PropsDeclaration<SharedTableHandlePositionerProps> = defineProps<\n SharedTableHandlePositionerProps\n>({\n ...OverlayPositionerPropsDeclaration,\n editor: { default: null, attribute: false },\n hoist: { default: false, attribute: false },\n flip: { default: false, attribute: false },\n shift: { default: false, attribute: false },\n hide: { default: true, attribute: false },\n offset: { default: 0, attribute: false },\n})\n","import {\n computed,\n defineCustomElement,\n defineProps,\n registerCustomElement,\n useEffect,\n type HostElement,\n type HostElementConstructor,\n type PropsDeclaration,\n type State,\n} from '@aria-ui/core'\nimport { setupOverlayPositioner } from '@aria-ui/elements/overlay'\nimport type { Placement } from '@floating-ui/dom'\n\nimport { useHTMLElementAt } from '../../utils/use-html-element-at.ts'\n\nimport { SharedTableHandlePositionerPropsDeclaration, type SharedTableHandlePositionerProps } from './shared.ts'\nimport { tableHandleStoreContext } from './store.ts'\n\nexport interface TableHandleColumnPositionerProps extends Omit<SharedTableHandlePositionerProps, 'placement'> {\n /**\n * The placement of the popover, relative to the hovered table cell.\n *\n * @default \"top\"\n */\n placement: Placement\n}\n\n/** @internal */\nexport const TableHandleColumnPositionerPropsDeclaration: PropsDeclaration<TableHandleColumnPositionerProps> = defineProps<\n TableHandleColumnPositionerProps\n>({\n ...SharedTableHandlePositionerPropsDeclaration,\n placement: { default: 'top', attribute: 'placement', type: 'string' },\n})\n\n/** @internal */\nexport function setupTableHandleColumnPositioner(\n host: HostElement,\n props: State<TableHandleColumnPositionerProps>,\n): void {\n const getStore = tableHandleStoreContext.consume(host)\n const getOverlayStore = () => getStore()?.columnOverlayStore\n setupOverlayPositioner(host, props, getOverlayStore)\n\n const getEditor = props.editor.get\n const getColumnFirstCellPos = computed(() => getStore()?.getReferenceCell()?.colFirstCellPos)\n const getReferenceCell = useHTMLElementAt(getEditor, getColumnFirstCellPos)\n useEffect(host, () => {\n getOverlayStore()?.setAnchorElement(getReferenceCell())\n })\n}\n\nconst TableHandleColumnPositionerElementBase: HostElementConstructor<TableHandleColumnPositionerProps> = defineCustomElement(\n setupTableHandleColumnPositioner,\n TableHandleColumnPositionerPropsDeclaration,\n)\n\n/**\n * `<prosekit-table-handle-column-positioner>` custom element.\n *\n * Properties: {@link TableHandleColumnPositionerProps}\n *\n * Data attributes:\n *\n * | Attribute | Description |\n * | --- | --- |\n * | `data-state` | `\"open\"` when visible, `\"closed\"` otherwise |\n * | `data-side` | The side of the anchor element the positioner is on |\n * | `data-align` | The alignment of the positioner relative to the anchor element |\n *\n * CSS variables:\n *\n * | Variable | Description |\n * | --- | --- |\n * | `--transform-origin` | The coordinates that this element is anchored to. Useful for scale animations. |\n */\nexport class TableHandleColumnPositionerElement extends TableHandleColumnPositionerElementBase {}\n\n/** @internal */\nexport function registerTableHandleColumnPositionerElement(): void {\n registerCustomElement('prosekit-table-handle-column-positioner', TableHandleColumnPositionerElement)\n}\n","import {\n defineCustomElement,\n defineProps,\n registerCustomElement,\n useEffect,\n type HostElement,\n type HostElementConstructor,\n type PropsDeclaration,\n type State,\n} from '@aria-ui/core'\nimport { MenuRootPropsDeclaration, setupMenuRoot, type MenuRootProps } from '@aria-ui/elements/menu'\n\nimport { tableHandleStoreContext } from './store.ts'\n\nexport interface TableHandleColumnMenuRootProps extends MenuRootProps {}\n\n/** @internal */\nexport const TableHandleColumnMenuRootPropsDeclaration: PropsDeclaration<TableHandleColumnMenuRootProps> = defineProps<\n TableHandleColumnMenuRootProps\n>(MenuRootPropsDeclaration)\n\n/** @internal */\nexport function setupTableHandleColumnMenuRoot(\n host: HostElement,\n props: State<TableHandleColumnMenuRootProps>,\n): void {\n setupMenuRoot(host, props)\n const getStore = tableHandleStoreContext.consume(host)\n\n useEffect(host, () => {\n const open = props.open.get() || false\n const store = getStore?.()\n if (!store) return\n store.setIsColumnMenuOpen(open)\n })\n}\n\nconst TableHandleColumnMenuRootElementBase: HostElementConstructor<TableHandleColumnMenuRootProps> = defineCustomElement(\n setupTableHandleColumnMenuRoot,\n TableHandleColumnMenuRootPropsDeclaration,\n)\n\n/**\n * `<prosekit-table-handle-column-menu-root>` custom element.\n *\n * Properties: {@link TableHandleColumnMenuRootProps}\n */\nexport class TableHandleColumnMenuRootElement extends TableHandleColumnMenuRootElementBase {}\n\n/** @internal */\nexport function registerTableHandleColumnMenuRootElement(): void {\n registerCustomElement('prosekit-table-handle-column-menu-root', TableHandleColumnMenuRootElement)\n}\n","import { useEffect, type HostElement } 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: HostElement,\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 createSignal,\n defineCustomElement,\n defineProps,\n onMount,\n registerCustomElement,\n type HostElement,\n type HostElementConstructor,\n type PropsDeclaration,\n type State,\n} from '@aria-ui/core'\nimport { setupMenuTrigger, type MenuTriggerProps } from '@aria-ui/elements/menu'\nimport { useEventListener } from '@aria-ui/utils'\nimport type { Editor } from '@prosekit/core'\nimport { selectTableColumn, type defineTableCommands } from '@prosekit/extensions/table'\n\nimport { tableHandleStoreContext } from './store.ts'\nimport { useEmptyImage } from './use-empty-image.ts'\n\ntype TableCommandsExtension = ReturnType<typeof defineTableCommands>\n\nexport interface TableHandleColumnMenuTriggerProps {\n /**\n * @default null\n * @hidden\n */\n editor: Editor<TableCommandsExtension> | null\n}\n\n/** @internal */\nexport const TableHandleColumnMenuTriggerPropsDeclaration: PropsDeclaration<TableHandleColumnMenuTriggerProps> = defineProps<\n TableHandleColumnMenuTriggerProps\n>({\n editor: { default: null, attribute: false },\n})\n\n/** @internal */\nexport function setupTableHandleColumnMenuTrigger(\n host: HostElement,\n props: State<TableHandleColumnMenuTriggerProps>,\n): void {\n const getEditor = props.editor.get\n const getStore = tableHandleStoreContext.consume(host)\n\n const triggerProps: State<MenuTriggerProps> = {\n disabled: createSignal(false),\n }\n setupMenuTrigger(host, triggerProps)\n\n useEventListener(host, 'pointerdown', () => {\n const editor = getEditor()\n const cellPos = getStore()?.getReferenceCell()?.cellPos\n if (!editor || !cellPos) return\n editor.exec(selectTableColumn({ head: cellPos }))\n })\n\n onMount(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 store = getStore()\n if (!store) return\n const index = store.getReferenceCell()?.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 const dndStore = store.dndStore\n dndStore.direction.set('col')\n dndStore.dragging.set(true)\n dndStore.draggingIndex.set(index)\n dndStore.startX.set(event.clientX)\n dndStore.startY.set(event.clientY)\n })\n}\n\nconst TableHandleColumnMenuTriggerElementBase: HostElementConstructor<TableHandleColumnMenuTriggerProps> = defineCustomElement(\n setupTableHandleColumnMenuTrigger,\n TableHandleColumnMenuTriggerPropsDeclaration,\n)\n\n/**\n * `<prosekit-table-handle-column-menu-trigger>` custom element.\n *\n * Properties: {@link TableHandleColumnMenuTriggerProps}\n */\nexport class TableHandleColumnMenuTriggerElement extends TableHandleColumnMenuTriggerElementBase {}\n\n/**\n * @internal\n */\nexport function registerTableHandleColumnMenuTriggerElement(): void {\n registerCustomElement('prosekit-table-handle-column-menu-trigger', TableHandleColumnMenuTriggerElement)\n}\n","import { useEffect, type HostElement } from '@aria-ui/core'\nimport { computePosition, offset } 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.ts'\nimport { getSafeEditorView } from '../../utils/get-safe-editor-view.ts'\n\nimport { tableHandleStoreContext } from './store.ts'\n\nexport type OnInitParams = {\n host: HostElement\n direction: 'row' | 'col'\n dragging: boolean\n draggingIndex: number\n table: HTMLTableElement\n cell: HTMLTableCellElement\n}\n\nexport function useInitDndPosition(\n host: HostElement,\n getEditor: () => Editor | null,\n onInit: (params: OnInitParams) => void,\n): void {\n const getStore = tableHandleStoreContext.consume(host)\n\n useEffect(host, () => {\n const view = getSafeEditorView(getEditor())\n if (!view) return\n\n const store = getStore()\n if (!store) return\n\n const dndStore = store.dndStore\n\n const dragging = dndStore.dragging.get()\n const direction = dndStore.direction.get()\n\n host.dataset.direction = direction\n host.dataset.dragging = dragging.toString()\n\n const draggingIndex = dndStore.draggingIndex.get()\n\n const relatedDOMs = getDndRelatedDOMs(view, store.getReferenceCell()?.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<HTMLTableCellElement>('td, th')\n return cell ?? undefined\n } else {\n const row = table.querySelector('tr')\n const cell = row?.querySelectorAll<HTMLTableCellElement>('td, th')[index]\n return cell ?? undefined\n }\n}\n\nexport function getDndRelatedDOMs(\n view: EditorView,\n cellPos: number | undefined,\n draggingIndex: number,\n direction: 'row' | 'col',\n): { 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 { getId } from '@ocavue/utils'\n\n/**\n * Creates a deep clone of an Element, including all computed styles so that\n * it looks almost exactly the same as the original element.\n */\nexport function deepCloneElement<T extends Element>(element: T, important = false): [T, string] {\n const clonedElement = element.cloneNode(true) as T\n const style = deepCopyStyles(element, clonedElement, important)\n return [clonedElement, style]\n}\n\n/**\n * Creates a clone of an Element, including all computed styles so that\n * it looks similar enough to the original element.\n */\nexport function cloneElement<T extends Element>(element: T, important = false): [T, string] {\n const clonedElement = element.cloneNode() as T\n const style = copyStyles(element, clonedElement, important)\n return [clonedElement, style]\n}\n\nfunction deepCopyStyles(source: Element, target: Element, important: boolean): string {\n const sources = [source]\n const targets = [target]\n const styles: string[] = []\n\n while (sources.length > 0 && sources.length === targets.length) {\n const source = sources.pop()\n const target = targets.pop()\n\n if (!source || !target) {\n break\n }\n\n const style = copyStyles(source, target, important)\n if (style) {\n styles.push(style)\n }\n\n sources.push(...source.children)\n targets.push(...target.children)\n }\n\n return styles.join('\\n')\n}\n\nfunction copyStyles(source: Element, target: Element, important: boolean): string {\n if (!source || !target) {\n return ''\n }\n\n const view = source.ownerDocument?.defaultView\n if (!view) {\n return ''\n }\n\n // Known issue: pseudo styles are not copied.\n const sourceStyle = view.getComputedStyle(source)\n const targetStyle = (target as HTMLElement | SVGElement | MathMLElement).style\n\n if (!sourceStyle || !targetStyle) {\n return ''\n }\n\n for (const key of sourceStyle) {\n targetStyle.setProperty(\n key,\n sourceStyle.getPropertyValue(key),\n // Enforce important to avoid the style being overridden when the element\n // is connected to the page.\n // See https://github.com/prosekit/prosekit/issues/1185 for more details.\n important ? 'important' : (sourceStyle.getPropertyPriority(key) || ''),\n )\n }\n\n const styles: string[] = []\n for (const pseudoSelector of [':before', ':after']) {\n const sourcePseudoStyle = view.getComputedStyle(source, pseudoSelector)\n const targetPseudoStyle = view.getComputedStyle(target, pseudoSelector)\n\n if (!sourcePseudoStyle) {\n continue\n }\n\n const content = sourcePseudoStyle.getPropertyValue('content')\n const hasPseudoElement = content && content !== 'none' && content !== 'normal'\n\n if (!hasPseudoElement) {\n continue\n }\n\n const cssProps: string[] = []\n for (const property of sourcePseudoStyle) {\n const sourceValue = sourcePseudoStyle.getPropertyValue(property)\n const sourcePriority = sourcePseudoStyle.getPropertyPriority(property)\n const targetValue = targetPseudoStyle.getPropertyValue(property)\n const targetPriority = targetPseudoStyle.getPropertyPriority(property)\n if (sourceValue !== targetValue || sourcePriority !== targetPriority) {\n cssProps.push(`${property}: ${sourceValue}${sourcePriority ? ' !important' : ''};`)\n }\n }\n\n const uniqueClassName = `clone-pseudo-element-${getId()}`\n target.classList.add(uniqueClassName)\n styles.push(`.${uniqueClassName}${pseudoSelector} { ${cssProps.join(' ')} }`)\n }\n\n return styles.join('\\n')\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.ts'\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 { getDocument } from '@ocavue/utils'\n\nexport function injectStyle(container: HTMLElement, styleText: string): void {\n if (!styleText) {\n return\n }\n const document = getDocument(container)\n const style = document.createElement('style')\n style.textContent = styleText\n container.appendChild(style)\n}\n","import { assignStyles } from '../../utils/assign-styles.ts'\nimport { cloneElement, deepCloneElement } from '../../utils/clone-element.ts'\nimport { fadeColor } from '../../utils/fade-color.ts'\nimport { getEffectiveBackgroundColor } from '../../utils/get-effective-background-color.ts'\nimport { injectStyle } from '../../utils/inject-style.ts'\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, th')\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 defineCustomElement,\n defineProps,\n registerCustomElement,\n useEffect,\n type HostElement,\n type HostElementConstructor,\n type PropsDeclaration,\n type State,\n} from '@aria-ui/core'\nimport { computePosition, type ReferenceElement } from '@floating-ui/dom'\nimport type { Editor } from '@prosekit/core'\n\nimport { assignStyles } from '../../utils/assign-styles.ts'\nimport { getSafeEditorView } from '../../utils/get-safe-editor-view.ts'\n\nimport { getDndRelatedDOMs, useInitDndPosition, type OnInitParams } from './dnd.ts'\nimport { clearPreviewDOM, createPreviewDOM } from './render-preview.ts'\nimport { tableHandleStoreContext } from './store.ts'\n\nexport interface TableHandleDragPreviewProps {\n /**\n * @default null\n * @hidden\n */\n editor: Editor | null\n}\n\n/** @internal */\nexport const TableHandleDragPreviewPropsDeclaration: PropsDeclaration<TableHandleDragPreviewProps> = defineProps<\n TableHandleDragPreviewProps\n>({\n editor: { default: null, attribute: false },\n})\n\n/**\n * @internal\n */\nexport function setupTableHandleDragPreview(\n host: HostElement,\n props: State<TableHandleDragPreviewProps>,\n): void {\n const getEditor = props.editor.get\n\n useEffect(host, () => {\n assignStyles(host, {\n position: 'absolute',\n pointerEvents: 'none',\n })\n })\n\n useInitDndPosition(host, getEditor, onInitPreviewPosition)\n\n useUpdatePreviewPosition(host, getEditor)\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\nfunction useUpdatePreviewPosition(host: HostElement, getEditor: () => Editor | null): void {\n const getStore = tableHandleStoreContext.consume(host)\n\n useEffect(host, () => {\n const view = getSafeEditorView(getEditor())\n if (!view) return\n\n const store = getStore()\n if (!store) return\n const dndStore = store.dndStore\n\n if (!dndStore.dragging.get()) return\n\n const draggingIndex = dndStore.draggingIndex.get()\n const direction = dndStore.direction.get()\n const x = dndStore.x.get()\n const y = dndStore.y.get()\n\n const relatedDOMs = getDndRelatedDOMs(view, store.getReferenceCell()?.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, { top: `${y}px` })\n return\n }\n\n if (direction === 'col') {\n assignStyles(host, { left: `${x}px` })\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\nconst TableHandleDragPreviewElementBase: HostElementConstructor<TableHandleDragPreviewProps> = defineCustomElement(\n setupTableHandleDragPreview,\n TableHandleDragPreviewPropsDeclaration,\n)\n\n/**\n * `<prosekit-table-handle-drag-preview>` custom element.\n *\n * Properties: {@link TableHandleDragPreviewProps}\n */\nexport class TableHandleDragPreviewElement extends TableHandleDragPreviewElementBase {}\n\n/**\n * @internal\n */\nexport function registerTableHandleDragPreviewElement(): void {\n registerCustomElement('prosekit-table-handle-drag-preview', TableHandleDragPreviewElement)\n}\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 defineCustomElement,\n defineProps,\n registerCustomElement,\n useEffect,\n type HostElement,\n type HostElementConstructor,\n type PropsDeclaration,\n type State,\n} from '@aria-ui/core'\nimport { computePosition, offset } from '@floating-ui/dom'\nimport type { Editor } from '@prosekit/core'\nimport type { defineTableCommands } from '@prosekit/extensions/table'\n\nimport { assignStyles } from '../../utils/assign-styles.ts'\nimport { getSafeEditorView } from '../../utils/get-safe-editor-view.ts'\n\nimport { getDragOverColumn, getDragOverRow } from './calc-drag-over.ts'\nimport { getDndRelatedDOMs, useInitDndPosition, type OnInitParams } from './dnd.ts'\nimport { tableHandleStoreContext } from './store.ts'\n\ntype TableCommandsExtension = ReturnType<typeof defineTableCommands>\n\nconst HANDLE_WIDTH = 2\n\nexport interface TableHandleDropIndicatorProps {\n /**\n * @default null\n * @hidden\n */\n editor: Editor<TableCommandsExtension> | null\n}\n\n/** @internal */\nexport const TableHandleDropIndicatorPropsDeclaration: PropsDeclaration<TableHandleDropIndicatorProps> = defineProps<\n TableHandleDropIndicatorProps\n>({\n editor: { default: null, attribute: false },\n})\n\n/**\n * @internal\n */\nexport function setupTableHandleDropIndicator(\n host: HostElement,\n props: State<TableHandleDropIndicatorProps>,\n): void {\n const getEditor = props.editor.get\n\n useEffect(host, () => {\n assignStyles(host, {\n pointerEvents: 'none',\n position: 'absolute',\n })\n })\n\n useInitDndPosition(host, getEditor, onInitIndicatorPosition)\n\n useUpdateIndicatorPosition(host, getEditor, 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\nfunction useUpdateIndicatorPosition(host: HostElement, getEditor: () => Editor | null, handleWidth: number): void {\n const getStore = tableHandleStoreContext.consume(host)\n\n useEffect(host, () => {\n const view = getSafeEditorView(getEditor())\n if (!view) return\n\n const store = getStore()\n if (!store) return\n\n const dndStore = store.dndStore\n if (!dndStore.dragging.get()) return\n\n const draggingIndex = dndStore.draggingIndex.get()\n const direction = dndStore.direction.get()\n const x = dndStore.x.get()\n const y = dndStore.y.get()\n\n const relatedDOMs = getDndRelatedDOMs(view, store.getReferenceCell()?.cellPos, draggingIndex, direction)\n if (!relatedDOMs) return\n const { table } = relatedDOMs\n\n let cancelled = false\n const cleanup = () => {\n cancelled = true\n }\n\n if (direction === 'col') {\n const dir = dndStore.startX.get() > x ? 'left' : 'right'\n const dragOverColumn = getDragOverColumn(table, x)\n\n if (dragOverColumn) {\n const [col, index] = dragOverColumn\n dndStore.droppingIndex.set(index)\n void computePosition(col, host, {\n placement: dir === 'left' ? 'left' : 'right',\n middleware: [offset(dir === '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 dir = dndStore.startY.get() > y ? 'up' : 'down'\n const dragOverRow = getDragOverRow(table, y)\n\n if (dragOverRow) {\n const [row, index] = dragOverRow\n dndStore.droppingIndex.set(index)\n void computePosition(row, host, {\n placement: dir === 'up' ? 'top' : 'bottom',\n middleware: [offset(dir === '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\nconst TableHandleDropIndicatorElementBase: HostElementConstructor<TableHandleDropIndicatorProps> = defineCustomElement(\n setupTableHandleDropIndicator,\n TableHandleDropIndicatorPropsDeclaration,\n)\n\n/**\n * `<prosekit-table-handle-drop-indicator>` custom element.\n *\n * Properties: {@link TableHandleDropIndicatorProps}\n */\nexport class TableHandleDropIndicatorElement extends TableHandleDropIndicatorElementBase {}\n\n/**\n * @internal\n */\nexport function registerTableHandleDropIndicatorElement(): void {\n registerCustomElement('prosekit-table-handle-drop-indicator', TableHandleDropIndicatorElement)\n}\n","import { createSignal, type HostElement } from '@aria-ui/core'\nimport { defineDOMEventHandler, union, type Editor } from '@prosekit/core'\n\nimport { useEditorExtension } from './use-editor-extension.ts'\n\nexport function useEditorTyping(\n host: HostElement,\n getEditor: () => Editor | null,\n): () => boolean {\n const typing = createSignal(false)\n\n const extension = union(\n defineDOMEventHandler('keypress', () => {\n typing.set(true)\n }),\n defineDOMEventHandler('pointermove', () => {\n typing.set(false)\n }),\n )\n\n useEditorExtension(host, getEditor, extension)\n\n return typing.get\n}\n","import { createSignal, useEffect, type HostElement } from '@aria-ui/core'\nimport type { Editor } from '@prosekit/core'\n\nimport { getSafeEditorView } from '../utils/get-safe-editor-view.ts'\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: HostElement,\n getEditor: () => Editor | null,\n getEnabled: () => boolean,\n): () => boolean {\n const selecting = createSignal(false)\n const isPointerDown = createSignal(false)\n\n useEffect(host, () => {\n if (!getEnabled()) return\n\n const view = getSafeEditorView(getEditor())\n if (!view) return\n\n const { dom, root } = view\n if (!root) return\n\n const handlePointerDown = () => {\n selecting.set(true)\n isPointerDown.set(true)\n }\n const handlePointerUp = () => {\n isPointerDown.set(false)\n }\n const handleMouseMove = () => {\n if (!isPointerDown.get()) {\n selecting.set(false)\n }\n }\n\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.get\n}\n","import { computed, useEffect, type HostElement } from '@aria-ui/core'\nimport type { Editor } from '@prosekit/core'\nimport { moveTableColumn, moveTableRow } from '@prosekit/extensions/table'\n\nimport { getSafeEditorView } from '../../utils/get-safe-editor-view.ts'\n\nimport type { TableHandleStore } from './store.ts'\n\nexport function useDrop(\n host: HostElement,\n getEditor: () => Editor | null,\n store: TableHandleStore,\n): void {\n const getDndStore = () => store.dndStore\n const getDragging = computed(() => getDndStore().dragging.get())\n\n useEffect(host, () => {\n const view = getSafeEditorView(getEditor())\n if (!view || !view.editable) return\n\n const ownerDocument = view.dom?.ownerDocument\n if (!ownerDocument) return\n\n const handleDrop = () => {\n if (!getDragging()) return\n const editor = getEditor()\n if (!editor) return\n\n const dndStore = getDndStore()\n\n const droppingIndex = dndStore.droppingIndex.get()\n const draggingIndex = dndStore.draggingIndex.get()\n const direction = dndStore.direction.get()\n\n if (draggingIndex < 0 || droppingIndex < 0) {\n console.warn('[prosekit] Invalid drag indices:', { draggingIndex, droppingIndex })\n return\n }\n\n if (direction === 'row') {\n editor.exec(moveTableRow({ from: draggingIndex, to: droppingIndex }))\n return\n }\n if (direction === 'col') {\n editor.exec(moveTableColumn({ from: draggingIndex, to: droppingIndex }))\n return\n }\n }\n\n const handleDragOver = (event: DragEvent) => {\n if (!getDragging()) return\n event.preventDefault()\n const dndStore = getDndStore()\n dndStore.dragging.set(true)\n dndStore.x.set(event.clientX)\n dndStore.y.set(event.clientY)\n }\n\n const handleDragEnd = () => {\n if (!getDragging()) return\n const dndStore = getDndStore()\n dndStore.dragging.set(false)\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 { cellAround, TableMap } 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 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 computed,\n createSignal,\n defineCustomElement,\n defineProps,\n registerCustomElement,\n type HostElement,\n type HostElementConstructor,\n type PropsDeclaration,\n type State,\n} from '@aria-ui/core'\nimport { defineDOMEventHandler, type Editor } from '@prosekit/core'\nimport type { EditorView } from '@prosekit/pm/view'\n\nimport { useEditorExtension } from '../../hooks/use-editor-extension.ts'\nimport { useEditorTyping } from '../../hooks/use-editor-typing.ts'\nimport { useScrolling } from '../../hooks/use-scrolling.ts'\nimport { useSelecting } from '../../hooks/use-selecting.ts'\n\nimport { createTableHandleStore, tableHandleStoreContext } from './store.ts'\nimport { useDrop } from './use-drop.ts'\nimport { getHoveringCell, isHoveringCellInfoEqual, type HoveringCellInfo } from './utils.ts'\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 TableHandleRootPropsDeclaration: PropsDeclaration<TableHandleRootProps> = defineProps<TableHandleRootProps>({\n editor: { default: null, attribute: false },\n})\n\n/**\n * @internal\n */\nexport function setupTableHandleRoot(\n host: HostElement,\n props: State<TableHandleRootProps>,\n): void {\n const getEditor = props.editor.get\n\n const getHoveringCellInfo = useHoveringCell(host, getEditor)\n const getTyping = useEditorTyping(host, getEditor)\n const getIsInTable = computed(() => !!getHoveringCellInfo())\n const getSelecting = useSelecting(host, getEditor, getIsInTable)\n const getScrolling = useScrolling(host)\n const getCanShow = computed(() => !getTyping() && !getSelecting() && !getScrolling())\n\n const store = createTableHandleStore(getHoveringCellInfo, getCanShow)\n tableHandleStoreContext.provide(host, store)\n\n useDrop(host, getEditor, store)\n}\n\nfunction useHoveringCell(\n host: HostElement,\n getEditor: () => Editor | null,\n): () => HoveringCellInfo | undefined {\n const hoveringCell = createSignal<HoveringCellInfo | undefined>(undefined)\n\n const extension = defineCellHoverHandler((curr: HoveringCellInfo | undefined) => {\n const prev = hoveringCell.get()\n if (isHoveringCellInfoEqual(prev, curr)) return\n hoveringCell.set(curr)\n })\n\n useEditorExtension(host, getEditor, extension)\n\n return hoveringCell.get\n}\n\nfunction defineCellHoverHandler(\n handler: (hoveringCell: HoveringCellInfo | undefined) => void,\n) {\n const pointerHandler = (view: EditorView, event: PointerEvent) => {\n const hoveringCell = getHoveringCell(view, event)\n return handler(hoveringCell)\n }\n return defineDOMEventHandler('pointerover', pointerHandler)\n}\n\nconst TableHandleRootElementBase: HostElementConstructor<TableHandleRootProps> = defineCustomElement(\n setupTableHandleRoot,\n TableHandleRootPropsDeclaration,\n)\n\n/**\n * `<prosekit-table-handle-root>` custom element.\n *\n * Properties: {@link TableHandleRootProps}\n */\nexport class TableHandleRootElement extends TableHandleRootElementBase {}\n\n/**\n * @internal\n */\nexport function registerTableHandleRootElement(): void {\n registerCustomElement('prosekit-table-handle-root', TableHandleRootElement)\n}\n","import {\n defineCustomElement,\n defineProps,\n registerCustomElement,\n type HostElement,\n type HostElementConstructor,\n type PropsDeclaration,\n type State,\n} from '@aria-ui/core'\nimport { setupOverlayPopup } from '@aria-ui/elements/overlay'\n\nimport { tableHandleStoreContext } from './store.ts'\n\nexport interface TableHandleRowPopupProps {}\n\n/** @internal */\nexport const TableHandleRowPopupPropsDeclaration: PropsDeclaration<TableHandleRowPopupProps> = defineProps<TableHandleRowPopupProps>({})\n\n/** @internal */\nexport function setupTableHandleRowPopup(\n host: HostElement,\n _props: State<TableHandleRowPopupProps>,\n): void {\n const getStore = tableHandleStoreContext.consume(host)\n const getOverlayStore = () => getStore()?.rowOverlayStore\n setupOverlayPopup(host, getOverlayStore)\n}\n\nconst TableHandleRowPopupElementBase: HostElementConstructor<TableHandleRowPopupProps> = defineCustomElement(\n setupTableHandleRowPopup,\n TableHandleRowPopupPropsDeclaration,\n)\n\n/**\n * `<prosekit-table-handle-row-popup>` custom element.\n *\n * Properties: {@link TableHandleRowPopupProps}\n *\n * Data attributes:\n *\n * | Attribute | Description |\n * | --- | --- |\n * | `data-state` | `\"open\"` when visible, `\"closed\"` otherwise |\n */\nexport class TableHandleRowPopupElement extends TableHandleRowPopupElementBase {}\n\n/** @internal */\nexport function registerTableHandleRowPopupElement(): void {\n registerCustomElement('prosekit-table-handle-row-popup', TableHandleRowPopupElement)\n}\n","import {\n computed,\n defineCustomElement,\n defineProps,\n registerCustomElement,\n useEffect,\n type HostElement,\n type HostElementConstructor,\n type PropsDeclaration,\n type State,\n} from '@aria-ui/core'\nimport { setupOverlayPositioner } from '@aria-ui/elements/overlay'\nimport type { Placement } from '@floating-ui/dom'\n\nimport { useHTMLElementAt } from '../../utils/use-html-element-at.ts'\n\nimport { SharedTableHandlePositionerPropsDeclaration, type SharedTableHandlePositionerProps } from './shared.ts'\nimport { tableHandleStoreContext } from './store.ts'\n\nexport interface TableHandleRowPositionerProps extends Omit<SharedTableHandlePositionerProps, 'placement'> {\n /**\n * The placement of the popover, relative to the hovered table cell.\n *\n * @default \"left\"\n */\n placement: Placement\n}\n\n/** @internal */\nexport const TableHandleRowPositionerPropsDeclaration: PropsDeclaration<TableHandleRowPositionerProps> = defineProps<\n TableHandleRowPositionerProps\n>({\n ...SharedTableHandlePositionerPropsDeclaration,\n placement: { default: 'left', attribute: 'placement', type: 'string' },\n})\n\n/** @internal */\nexport function setupTableHandleRowPositioner(\n host: HostElement,\n props: State<TableHandleRowPositionerProps>,\n): void {\n const getStore = tableHandleStoreContext.consume(host)\n const getOverlayStore = () => getStore()?.rowOverlayStore\n setupOverlayPositioner(host, props, getOverlayStore)\n\n const getEditor = props.editor.get\n const getRowFirstCellPos = computed(() => getStore()?.getReferenceCell()?.rowFirstCellPos)\n const getReferenceCell = useHTMLElementAt(getEditor, getRowFirstCellPos)\n useEffect(host, () => {\n getOverlayStore()?.setAnchorElement(getReferenceCell())\n })\n}\n\nconst TableHandleRowPositionerElementBase: HostElementConstructor<TableHandleRowPositionerProps> = defineCustomElement(\n setupTableHandleRowPositioner,\n TableHandleRowPositionerPropsDeclaration,\n)\n\n/**\n * `<prosekit-table-handle-row-positioner>` custom element.\n *\n * Properties: {@link TableHandleRowPositionerProps}\n *\n * Data attributes:\n *\n * | Attribute | Description |\n * | --- | --- |\n * | `data-state` | `\"open\"` when visible, `\"closed\"` otherwise |\n * | `data-side` | The side of the anchor element the positioner is on |\n * | `data-align` | The alignment of the positioner relative to the anchor element |\n *\n * CSS variables:\n *\n * | Variable | Description |\n * | --- | --- |\n * | `--transform-origin` | The coordinates that this element is anchored to. Useful for scale animations. |\n */\nexport class TableHandleRowPositionerElement extends TableHandleRowPositionerElementBase {}\n\n/** @internal */\nexport function registerTableHandleRowPositionerElement(): void {\n registerCustomElement('prosekit-table-handle-row-positioner', TableHandleRowPositionerElement)\n}\n","import {\n defineCustomElement,\n defineProps,\n registerCustomElement,\n useEffect,\n type HostElement,\n type HostElementConstructor,\n type PropsDeclaration,\n type State,\n} from '@aria-ui/core'\nimport { MenuRootPropsDeclaration, setupMenuRoot, type MenuRootProps } from '@aria-ui/elements/menu'\n\nimport { tableHandleStoreContext } from './store.ts'\n\nexport interface TableHandleRowMenuRootProps extends MenuRootProps {}\n\n/** @internal */\nexport const TableHandleRowMenuRootPropsDeclaration: PropsDeclaration<TableHandleRowMenuRootProps> = defineProps<\n TableHandleRowMenuRootProps\n>(MenuRootPropsDeclaration)\n\n/** @internal */\nexport function setupTableHandleRowMenuRoot(\n host: HostElement,\n props: State<TableHandleRowMenuRootProps>,\n): void {\n setupMenuRoot(host, props)\n const getStore = tableHandleStoreContext.consume(host)\n\n useEffect(host, () => {\n const open = props.open.get() || false\n const store = getStore?.()\n if (!store) return\n store.setIsRowMenuOpen(open)\n })\n}\n\nconst TableHandleRowMenuRootElementBase: HostElementConstructor<TableHandleRowMenuRootProps> = defineCustomElement(\n setupTableHandleRowMenuRoot,\n TableHandleRowMenuRootPropsDeclaration,\n)\n\n/**\n * `<prosekit-table-handle-row-menu-root>` custom element.\n *\n * Properties: {@link TableHandleRowMenuRootProps}\n */\nexport class TableHandleRowMenuRootElement extends TableHandleRowMenuRootElementBase {}\n\n/** @internal */\nexport function registerTableHandleRowMenuRootElement(): void {\n registerCustomElement('prosekit-table-handle-row-menu-root', TableHandleRowMenuRootElement)\n}\n","import {\n createSignal,\n defineCustomElement,\n defineProps,\n onMount,\n registerCustomElement,\n type HostElement,\n type HostElementConstructor,\n type PropsDeclaration,\n type State,\n} from '@aria-ui/core'\nimport { setupMenuTrigger, type MenuTriggerProps } from '@aria-ui/elements/menu'\nimport { useEventListener } from '@aria-ui/utils'\nimport type { Editor } from '@prosekit/core'\nimport { selectTableRow, type defineTableCommands } from '@prosekit/extensions/table'\n\nimport { tableHandleStoreContext } from './store.ts'\nimport { useEmptyImage } from './use-empty-image.ts'\n\ntype TableCommandsExtension = ReturnType<typeof defineTableCommands>\n\nexport interface TableHandleRowMenuTriggerProps {\n /**\n * @default null\n * @hidden\n */\n editor: Editor<TableCommandsExtension> | null\n}\n\n/** @internal */\nexport const TableHandleRowMenuTriggerPropsDeclaration: PropsDeclaration<TableHandleRowMenuTriggerProps> = defineProps<\n TableHandleRowMenuTriggerProps\n>({\n editor: { default: null, attribute: false },\n})\n\n/** @internal */\nexport function setupTableHandleRowMenuTrigger(\n host: HostElement,\n props: State<TableHandleRowMenuTriggerProps>,\n): void {\n const getEditor = props.editor.get\n const getStore = tableHandleStoreContext.consume(host)\n\n const triggerProps: State<MenuTriggerProps> = {\n disabled: createSignal(false),\n }\n setupMenuTrigger(host, triggerProps)\n\n useEventListener(host, 'pointerdown', () => {\n const editor = getEditor()\n const cellPos = getStore()?.getReferenceCell()?.cellPos\n if (!editor || !cellPos) return\n editor.exec(selectTableRow({ head: cellPos }))\n })\n\n onMount(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 store = getStore()\n if (!store) return\n const index = store.getReferenceCell()?.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 const dndStore = store.dndStore\n\n dndStore.direction.set('row')\n dndStore.dragging.set(true)\n dndStore.draggingIndex.set(index)\n dndStore.startX.set(event.clientX)\n dndStore.startY.set(event.clientY)\n })\n}\n\nconst TableHandleRowMenuTriggerElementBase: HostElementConstructor<TableHandleRowMenuTriggerProps> = defineCustomElement(\n setupTableHandleRowMenuTrigger,\n TableHandleRowMenuTriggerPropsDeclaration,\n)\n\n/**\n * `<prosekit-table-handle-row-menu-trigger>` custom element.\n *\n * Properties: {@link TableHandleRowMenuTriggerProps}\n */\nexport class TableHandleRowMenuTriggerElement extends TableHandleRowMenuTriggerElementBase {}\n\n/**\n * @internal\n */\nexport function registerTableHandleRowMenuTriggerElement(): void {\n registerCustomElement('prosekit-table-handle-row-menu-trigger', TableHandleRowMenuTriggerElement)\n}\n"],"mappings":";;;;;;;;;;;;AAMA,SAAS,OAAa;AACtB,SAAS,aAAsB;AAC7B,QAAO;;AAET,SAAS,cAAuB;AAC9B,QAAO;;AAGT,IAAM,WAAN,MAAe;;kBACwB,aAAa,MAAM;mBACZ,aAA4B,MAAM;uBACrC,aAAa,GAAG;uBAChB,aAAa,GAAG;WAC5B,aAAa,GAAG;WAChB,aAAa,GAAG;gBACX,aAAa,GAAG;gBAChB,aAAa,GAAG;;;;;;AAkBpD,SAAgB,uBACd,qBACA,YACkB;CAClB,MAAM,mBAAmB,aAAa,MAAM;CAC5C,MAAM,gBAAgB,aAAa,MAAM;CAEzC,MAAM,uBAAgC;AACpC,SAAO,iBAAiB,KAAK,IAAI,cAAc,KAAK;;CAGtD,MAAM,oBAAoB,SAAwB;AAChD,gBAAc,IAAI,KAAK;;CAGzB,MAAM,uBAAuB,SAAwB;AACnD,mBAAiB,IAAI,KAAK;;CAG5B,MAAM,oBAAoB,aAA2C,KAAA,EAAU;CAE/E,IAAI,uBAAqD,KAAA;CAEzD,MAAM,mBAAmB,eAA6C;AACpE,MAAI,CAAC,YAAY,EAAE;AACjB,qBAAkB,IAAI,KAAA,EAAU;AAChC;;AAIF,MAAI,gBAAgB,CAClB,QAAO;AAGT,yBAAuB,qBAAqB;AAC5C,SAAO;GACP;CAEF,MAAM,UAAU,eAAwB;AACtC,SAAO,CAAC,CAAC,kBAAkB;GAC3B;CAEF,MAAM,oBAAoB,UAA2B;AACnD,MAAI,gBAAgB,CAClB,OAAM,gBAAgB;;CAI1B,MAAM,qBAAqB,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E,SAAM,gBAAgB;AACtB;;EAGF,MAAM,WAAW,MAAM;AAEvB,WAAS,UAAU,IAAI,MAAM;AAC7B,WAAS,SAAS,IAAI,KAAK;AAC3B,WAAS,cAAc,IAAI,MAAM;AACjC,WAAS,OAAO,IAAI,MAAM,QAAQ;AAClC,WAAS,OAAO,IAAI,MAAM,QAAQ;GAClC;;AAGJ,MAAM,uCAA+F,oBACnG,gCACA,0CACD;;;;;;AAOD,IAAa,mCAAb,cAAsD,qCAAqC;;;;AAK3F,SAAgB,2CAAiD;AAC/D,uBAAsB,0CAA0C,iCAAiC"}
@@ -63,4 +63,4 @@ declare function registerTooltipTriggerElement(): void;
63
63
  declare function registerTooltipPopupElement(): void;
64
64
  declare function registerTooltipPositionerElement(): void;
65
65
  export { OpenChangeEvent, TooltipPopupElement, TooltipPopupProps, TooltipPopupPropsDeclaration, TooltipPositionerElement, TooltipPositionerProps, TooltipPositionerPropsDeclaration, TooltipRootElement, TooltipRootEvents, TooltipRootProps, TooltipRootPropsDeclaration, TooltipTriggerElement, TooltipTriggerProps, TooltipTriggerPropsDeclaration, registerTooltipPopupElement, registerTooltipPositionerElement, registerTooltipRootElement, registerTooltipTriggerElement, setupTooltipPopup, setupTooltipPositioner, setupTooltipRoot, setupTooltipTrigger };
66
- //# sourceMappingURL=prosekit-web-tooltip.d.ts.map
66
+ //# sourceMappingURL=tooltip.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tooltip.d.ts","names":[],"sources":["../src/components/tooltip/index.ts"],"mappings":";;;;;AAiEA;;;;;AAEA;;;;cArCa,mBAAA,SAA4B,IAAA,CAAK,mBAAA;;;;;AAuC9C;;;;;AACA;;;;;AAEA;;;cAvBa,wBAAA,SAAiC,IAAA,CAAK,wBAAA;AA0BnD;;;;;AAEA;;AAFA,cAjBa,kBAAA,SAA2B,IAAA,CAAK,kBAAA;;AAqB7C;;;;cAda,qBAAA,SAA8B,IAAA,CAAK,qBAAA;AAAA,UAE/B,iBAAA,SAA0B,IAAA,CAAK,iBAAA;AAAA,UAC/B,sBAAA,SAA+B,IAAA,CAAK,sBAAA;AAAA,UACpC,gBAAA,SAAyB,IAAA,CAAK,gBAAA;AAAA,UAC9B,mBAAA,SAA4B,IAAA,CAAK,mBAAA;AAAA,UAEjC,iBAAA,SAA0B,IAAA,CAAK,iBAAA;;cAGnC,4BAAA,EAA8B,gBAAA,CAAiB,iBAAA;;cAE/C,iCAAA,EAAmC,gBAAA,CAAiB,sBAAA;AAYjE;AAAA,cAVa,2BAAA,EAA6B,gBAAA,CAAiB,gBAAA;;cAE9C,8BAAA,EAAgC,gBAAA,CAAiB,mBAAA;AAAA,iBAE9C,0BAAA,CAAA;AAAA,iBAGA,6BAAA,CAAA;AAAA,iBAGA,2BAAA,CAAA;AAAA,iBAGA,gCAAA,CAAA"}
@@ -82,4 +82,4 @@ function registerTooltipPositionerElement() {
82
82
  }
83
83
  export { OpenChangeEvent, TooltipPopupElement, TooltipPopupPropsDeclaration, TooltipPositionerElement, TooltipPositionerPropsDeclaration, TooltipRootElement, TooltipRootPropsDeclaration, TooltipTriggerElement, TooltipTriggerPropsDeclaration, registerTooltipPopupElement, registerTooltipPositionerElement, registerTooltipRootElement, registerTooltipTriggerElement, setupTooltipPopup, setupTooltipPositioner, setupTooltipRoot, setupTooltipTrigger };
84
84
 
85
- //# sourceMappingURL=prosekit-web-tooltip.js.map
85
+ //# sourceMappingURL=tooltip.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tooltip.js","names":[],"sources":["../src/components/tooltip/index.ts"],"sourcesContent":["/**\n\n@module\n\n## Anatomy\n\n```html\n<prosekit-tooltip-root>\n <prosekit-tooltip-trigger>...</prosekit-tooltip-trigger>\n <prosekit-tooltip-positioner>\n <prosekit-tooltip-popup>...</prosekit-tooltip-popup>\n </prosekit-tooltip-positioner>\n</prosekit-tooltip-root>\n```\n*/\n\nimport { registerCustomElement, type PropsDeclaration } from '@aria-ui/core'\nimport * as Base from '@aria-ui/elements/tooltip'\n\n/**\n * `<prosekit-tooltip-popup>` custom element.\n *\n * Properties: {@link TooltipPopupProps}\n *\n * Data attributes:\n *\n * | Attribute | Description |\n * | --- | --- |\n * | `data-state` | `\"open\"` when the tooltip is visible, `\"closed\"` otherwise |\n */\nexport class TooltipPopupElement extends Base.TooltipPopupElement {}\n\n/**\n * `<prosekit-tooltip-positioner>` custom element.\n *\n * Properties: {@link TooltipPositionerProps}\n *\n * Data attributes:\n *\n * | Attribute | Description |\n * | --- | --- |\n * | `data-state` | `\"open\"` when the tooltip is visible, `\"closed\"` otherwise |\n *\n * CSS variables:\n *\n * | Variable | Description |\n * | --- | --- |\n * | `--transform-origin` | The coordinates that this element is anchored to. Useful for scale animations. |\n */\nexport class TooltipPositionerElement extends Base.TooltipPositionerElement {}\n\n/**\n * `<prosekit-tooltip-root>` custom element.\n *\n * Properties: {@link TooltipRootProps}\n *\n * Events: {@link TooltipRootEvents}\n */\nexport class TooltipRootElement extends Base.TooltipRootElement {}\n\n/**\n * `<prosekit-tooltip-trigger>` custom element.\n *\n * Properties: {@link TooltipTriggerProps}\n */\nexport class TooltipTriggerElement extends Base.TooltipTriggerElement {}\n\nexport interface TooltipPopupProps extends Base.TooltipPopupProps {}\nexport interface TooltipPositionerProps extends Base.TooltipPositionerProps {}\nexport interface TooltipRootProps extends Base.TooltipRootProps {}\nexport interface TooltipTriggerProps extends Base.TooltipTriggerProps {}\n\nexport interface TooltipRootEvents extends Base.TooltipRootEvents {}\n\n/** @internal */\nexport const TooltipPopupPropsDeclaration: PropsDeclaration<TooltipPopupProps> = Base.TooltipPopupPropsDeclaration\n/** @internal */\nexport const TooltipPositionerPropsDeclaration: PropsDeclaration<TooltipPositionerProps> = Base.TooltipPositionerPropsDeclaration\n/** @internal */\nexport const TooltipRootPropsDeclaration: PropsDeclaration<TooltipRootProps> = Base.TooltipRootPropsDeclaration\n/** @internal */\nexport const TooltipTriggerPropsDeclaration: PropsDeclaration<TooltipTriggerProps> = Base.TooltipTriggerPropsDeclaration\n\nexport function registerTooltipRootElement(): void {\n registerCustomElement('prosekit-tooltip-root', TooltipRootElement)\n}\nexport function registerTooltipTriggerElement(): void {\n registerCustomElement('prosekit-tooltip-trigger', TooltipTriggerElement)\n}\nexport function registerTooltipPopupElement(): void {\n registerCustomElement('prosekit-tooltip-popup', TooltipPopupElement)\n}\nexport function registerTooltipPositionerElement(): void {\n registerCustomElement('prosekit-tooltip-positioner', TooltipPositionerElement)\n}\n\nexport {\n OpenChangeEvent,\n setupTooltipPopup,\n setupTooltipPositioner,\n setupTooltipRoot,\n setupTooltipTrigger,\n} from '@aria-ui/elements/tooltip'\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8BA,IAAa,sBAAb,cAAyC,KAAK,oBAAoB;;;;;;;;;;;;;;;;;;AAmBlE,IAAa,2BAAb,cAA8C,KAAK,yBAAyB;;;;;;;;AAS5E,IAAa,qBAAb,cAAwC,KAAK,mBAAmB;;;;;;AAOhE,IAAa,wBAAb,cAA2C,KAAK,sBAAsB;;AAUtE,MAAa,+BAAoE,KAAK;;AAEtF,MAAa,oCAA8E,KAAK;;AAEhG,MAAa,8BAAkE,KAAK;;AAEpF,MAAa,iCAAwE,KAAK;AAE1F,SAAgB,6BAAmC;AACjD,uBAAsB,yBAAyB,mBAAmB;;AAEpE,SAAgB,gCAAsC;AACpD,uBAAsB,4BAA4B,sBAAsB;;AAE1E,SAAgB,8BAAoC;AAClD,uBAAsB,0BAA0B,oBAAoB;;AAEtE,SAAgB,mCAAyC;AACvD,uBAAsB,+BAA+B,yBAAyB"}
@@ -0,0 +1,11 @@
1
+ import { t as useEditorExtension } from "./use-editor-extension.js";
2
+ import { defineUpdateHandler } from "@prosekit/core";
3
+ /**
4
+ * @internal
5
+ */
6
+ function useEditorUpdateEvent(host, getEditor, handler) {
7
+ useEditorExtension(host, getEditor, defineUpdateHandler(handler));
8
+ }
9
+ export { useEditorUpdateEvent as t };
10
+
11
+ //# sourceMappingURL=use-editor-update-event.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-editor-update-event.js","names":[],"sources":["../src/hooks/use-editor-update-event.ts"],"sourcesContent":["import type { HostElement } from '@aria-ui/core'\nimport { defineUpdateHandler, type Editor, type UpdateHandler } from '@prosekit/core'\n\nimport { useEditorExtension } from './use-editor-extension.ts'\n\n/**\n * @internal\n */\nexport function useEditorUpdateEvent(\n host: HostElement,\n getEditor: () => Editor | null,\n handler: UpdateHandler,\n): void {\n const extension = defineUpdateHandler(handler)\n useEditorExtension(host, getEditor, extension)\n}\n"],"mappings":";;;;;AAQA,SAAgB,qBACd,MACA,WACA,SACM;AAEN,oBAAmB,MAAM,WADP,oBAAoB,QACO,CAAC"}