@prosekit/web 0.7.12 → 0.8.0-beta.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 (46) hide show
  1. package/dist/{get-default-state-BzBimBWi.js → get-default-state.js} +2 -3
  2. package/dist/get-default-state.js.map +1 -0
  3. package/dist/{get-safe-editor-view-Dt9Amrcn.js → get-safe-editor-view.js} +2 -2
  4. package/dist/get-safe-editor-view.js.map +1 -0
  5. package/dist/prosekit-web-autocomplete.d.ts.map +1 -1
  6. package/dist/prosekit-web-autocomplete.js +7 -22
  7. package/dist/prosekit-web-autocomplete.js.map +1 -1
  8. package/dist/prosekit-web-block-handle.js +53 -80
  9. package/dist/prosekit-web-block-handle.js.map +1 -1
  10. package/dist/prosekit-web-drop-indicator.js +3 -6
  11. package/dist/prosekit-web-drop-indicator.js.map +1 -1
  12. package/dist/prosekit-web-inline-popover.js +2 -9
  13. package/dist/prosekit-web-inline-popover.js.map +1 -1
  14. package/dist/prosekit-web-popover.js +1 -4
  15. package/dist/prosekit-web-popover.js.map +1 -1
  16. package/dist/prosekit-web-resizable.d.ts.map +1 -1
  17. package/dist/prosekit-web-resizable.js +30 -13
  18. package/dist/prosekit-web-resizable.js.map +1 -1
  19. package/dist/prosekit-web-table-handle.js +76 -48
  20. package/dist/prosekit-web-table-handle.js.map +1 -1
  21. package/dist/prosekit-web-tooltip.js +1 -4
  22. package/dist/prosekit-web-tooltip.js.map +1 -1
  23. package/dist/prosekit-web.js +1 -1
  24. package/dist/prosekit-web.js.map +1 -1
  25. package/dist/{use-editor-extension-B2WuUfnd.js → use-editor-extension.js} +2 -3
  26. package/dist/use-editor-extension.js.map +1 -0
  27. package/dist/{use-scrolling-BjVzAkiZ.js → use-scrolling.js} +2 -4
  28. package/dist/use-scrolling.js.map +1 -0
  29. package/package.json +11 -11
  30. package/src/components/autocomplete/autocomplete-list/setup.ts +3 -2
  31. package/src/components/autocomplete/autocomplete-popover/setup.ts +2 -2
  32. package/src/components/block-handle/block-handle-draggable/set-drag-preview.ts +9 -10
  33. package/src/components/block-handle/block-handle-draggable/setup.ts +5 -10
  34. package/src/components/block-handle/block-handle-popover/pointer-move.ts +2 -10
  35. package/src/components/block-handle/block-handle-popover/setup.ts +1 -3
  36. package/src/components/resizable/resizable-root/types.ts +37 -3
  37. package/src/constants.ts +1 -0
  38. package/src/utils/get-client-rect.ts +47 -9
  39. package/dist/get-default-state-BzBimBWi.js.map +0 -1
  40. package/dist/get-safe-editor-view-Dt9Amrcn.js.map +0 -1
  41. package/dist/inject-style-BaFaVQvj.js +0 -76
  42. package/dist/inject-style-BaFaVQvj.js.map +0 -1
  43. package/dist/use-editor-extension-B2WuUfnd.js.map +0 -1
  44. package/dist/use-scrolling-BjVzAkiZ.js.map +0 -1
  45. package/src/utils/get-box-element.ts +0 -20
  46. package/src/utils/throttle.ts +0 -17
@@ -1 +1 @@
1
- {"version":3,"file":"prosekit-web-block-handle.js","names":[],"sources":["../src/components/block-handle/context.ts","../src/components/block-handle/block-handle-add/setup.ts","../src/components/block-handle/block-handle-add/types.ts","../src/components/block-handle/block-handle-add/element.gen.ts","../src/utils/get-box-element.ts","../src/utils/get-client-rect.ts","../src/utils/max-z-index.ts","../src/components/block-handle/block-handle-draggable/set-drag-preview.ts","../src/components/block-handle/block-handle-draggable/setup.ts","../src/components/block-handle/block-handle-draggable/types.ts","../src/components/block-handle/block-handle-draggable/element.gen.ts","../src/utils/throttle.ts","../src/components/block-handle/block-handle-popover/pointer-move.ts","../src/components/block-handle/block-handle-popover/setup.ts","../src/components/block-handle/block-handle-popover/types.ts","../src/components/block-handle/block-handle-popover/element.gen.ts"],"sourcesContent":["import { createContext, type Context } from '@aria-ui/core'\nimport type { ProseMirrorNode } from '@prosekit/pm/model'\n\n/**\n * @internal\n */\nexport interface HoverState {\n node: ProseMirrorNode\n pos: number\n}\n\n/**\n * @internal\n */\nexport type BlockPopoverContext = HoverState | null\n\n/**\n * @internal\n */\nexport const blockPopoverContext: Context<BlockPopoverContext> = createContext(\n 'prosekit-block-popover-context',\n null,\n)\n\n/**\n * @internal\n */\nexport const draggingContext: Context<boolean> = createContext(\n 'prosekit-block-handle-dragging-context',\n false,\n)\n","import { useEventListener, type ConnectableElement, type SignalState } from '@aria-ui/core'\nimport { insertDefaultBlock } from '@prosekit/core'\n\nimport { blockPopoverContext } from '../context.ts'\n\nimport type { BlockHandleAddProps } from './types.ts'\n\n/**\n * @internal\n */\nexport function useBlockHandleAdd(\n host: ConnectableElement,\n { state }: { state: SignalState<BlockHandleAddProps> },\n): void {\n const context = blockPopoverContext.consume(host)\n\n useEventListener(host, 'pointerdown', (event) => {\n event.preventDefault()\n\n const editor = state.editor.get()\n const hoverState = context.get()\n if (!editor || !hoverState) {\n return\n }\n\n const { node, pos } = hoverState\n editor.exec(insertDefaultBlock({ pos: pos + node.nodeSize }))\n editor.focus()\n\n // Hide the drag handle\n context.set(null)\n })\n}\n","import type { EventDeclarations, PropDeclarations } from '@aria-ui/core'\nimport type { Editor } from '@prosekit/core'\n\nexport interface BlockHandleAddProps {\n /**\n * The ProseKit editor instance.\n *\n * @default null\n * @hidden\n */\n editor: Editor | null\n}\n\n/** @internal */\nexport const blockHandleAddProps: PropDeclarations<BlockHandleAddProps> = {\n editor: { default: null },\n}\n\n/** @internal */\nexport interface BlockHandleAddEvents {}\n\n/** @internal */\nexport const blockHandleAddEvents: EventDeclarations<BlockHandleAddEvents> = {}\n","import { defineCustomElement, registerCustomElement, type BaseElementConstructor } from \"@aria-ui/core\"\n\nimport { useBlockHandleAdd } from \"./setup.ts\"\nimport { blockHandleAddEvents, blockHandleAddProps, type BlockHandleAddEvents, type BlockHandleAddProps } from \"./types.ts\"\n\nconst BlockHandleAddElementBase: BaseElementConstructor<BlockHandleAddProps> = defineCustomElement<\n BlockHandleAddProps,\n BlockHandleAddEvents\n>({\n props: blockHandleAddProps,\n events: blockHandleAddEvents,\n setup: useBlockHandleAdd,\n})\nclass BlockHandleAddElement extends BlockHandleAddElementBase {}\n\nregisterCustomElement('prosekit-block-handle-add', BlockHandleAddElement)\n \nexport { BlockHandleAddElement }\n","/**\n * Returns the element that has a box.\n */\nexport function getBoxElement(element: Element): Element | null | undefined {\n const window = element.ownerDocument.defaultView\n if (!window) {\n return\n }\n\n const style = window.getComputedStyle(element)\n const display = style.display\n\n if (display === 'contents' && element.childElementCount === 1) {\n return element.firstElementChild\n } else if (display === 'none') {\n return\n }\n\n return element\n}\n","/**\n * Similar to `element.getBoundingClientRect`, but handles `display: contents` elements.\n */\nexport function getClientRect(element: Element): {\n top: number\n right: number\n bottom: number\n left: number\n} {\n const rect = element.getBoundingClientRect()\n if (rect.width === 0 && rect.height === 0 && rect.x === 0 && rect.y === 0) {\n // Suspiciously rect, probably an element with `display: contents`, in\n // which case `element.getClientRects()` will return an empty array.\n if (element.getClientRects().length === 0) {\n const children = Array.from(element.children)\n const rects = children.map(child => getClientRect(child))\n if (rects.length === 0) {\n return rect\n }\n if (rects.length === 1) {\n return rects[0]\n }\n let { top, bottom, left, right } = rects[0]\n for (let i = 1; i < rects.length; i++) {\n const r = rects[i]\n if (r.top < top) top = r.top\n if (r.bottom > bottom) bottom = r.bottom\n if (r.left < left) left = r.left\n if (r.right > right) right = r.right\n }\n return { top, bottom, left, right }\n }\n }\n return rect\n}\n","// Maximum possible z-index\n// https://stackoverflow.com/questions/491052/minimum-and-maximum-value-of-z-index\nexport const maxZIndex = '2147483647'\n","import { assignStyles } from '../../../utils/assign-styles.ts'\nimport { deepCloneElement } from '../../../utils/clone-element.ts'\nimport { getClientRect } from '../../../utils/get-client-rect.ts'\nimport { injectStyle } from '../../../utils/inject-style.ts'\nimport { maxZIndex } from '../../../utils/max-z-index.ts'\n\n/**\n * Sets a drag preview image for the given element and ensures the preview position\n * relative to the pointer is correct.\n *\n * This function does the following:\n *\n * - Creates a temporary container element.\n * - Puts the container at the end of the document body.\n * - Sets event's drag image.\n * - Removes the container from the document body after the next frame.\n */\nexport function setDragPreview(event: DragEvent, element: HTMLElement): void {\n const { top, bottom, left, right } = getClientRect(element)\n const width = right - left\n const height = bottom - top\n const elementX = left\n const elementY = top\n\n const { clientX, clientY } = event\n\n const document = element.ownerDocument\n\n const container = document.createElement('div')\n\n // If outsideX is positive, the point is at the left side of the element.\n const outsideX = Math.round(elementX - clientX)\n // If outsideY is positive, the point is above the element.\n const outsideY = Math.round(elementY - clientY)\n\n const borderX = Math.max(outsideX, 0)\n const borderY = Math.max(outsideY, 0)\n assignStyles(container, {\n // Ensuring we don't cause reflow when adding the element to the page using\n // `position:fixed` rather than `position:absolute` so we are positioned on\n // the current viewport. `position:fixed` also creates a new stacking\n // context, so we don't need to do that here.\n // https://github.com/atlassian/pragmatic-drag-and-drop/blob/56276552/packages/core/src/public-utils/element/custom-native-drag-preview/set-custom-native-drag-preview.ts#L60\n position: 'fixed',\n\n // The element is positioned off-screen to avoid capturing the content of\n // the page on Safari when the dragging element has a transparent background\n // on Safari. See https://github.com/prosekit/prosekit/issues/1153 for more\n // details.\n top: '-1000vh',\n left: '-1000vw',\n\n // The element should not be interactive.\n pointerEvents: 'none',\n\n zIndex: maxZIndex,\n\n // Only reliable cross browser technique found to push a drag preview away\n // from the cursor is to use transparent borders on the container.\n // https://github.com/atlassian/pragmatic-drag-and-drop/blob/56276552/packages/core/src/public-utils/element/custom-native-drag-preview/pointer-outside-of-preview.ts#L13-L18\n borderLeft: `${borderX}px solid transparent`,\n borderTop: `${borderY}px solid transparent`,\n\n boxSizing: 'border-box',\n width: `${width + borderX}px`,\n height: `${height + borderY}px`,\n })\n\n const [clonedElement, styleText] = deepCloneElement(element, true)\n\n // A hardcoded opacity.\n clonedElement.style.setProperty('opacity', '0.5', 'important')\n // The bounding client rect doesn't include the margin, so we need to remove\n // the margin too from the cloned element so that it can fit the container.\n clonedElement.style.setProperty('margin', '0', 'important')\n // Hide the outline of the cloned element.\n clonedElement.style.setProperty('outline-color', 'transparent', 'important')\n\n document.body.appendChild(container)\n container.appendChild(clonedElement)\n injectStyle(container, styleText)\n\n event.dataTransfer?.setDragImage(container, Math.max(-outsideX, 0), Math.max(-outsideY, 0))\n\n requestAnimationFrame(() => {\n container.remove()\n })\n}\n","import { useAttribute, useEffect, useEventListener, type ConnectableElement, type ReadonlySignal, type SignalState } from '@aria-ui/core'\nimport { isHTMLElement } from '@ocavue/utils'\nimport type { Editor } from '@prosekit/core'\nimport type { ViewDragging } from '@prosekit/extensions/drop-indicator'\nimport { Fragment, Slice } from '@prosekit/pm/model'\nimport { NodeSelection } from '@prosekit/pm/state'\nimport type { EditorView } from '@prosekit/pm/view'\n\nimport { getBoxElement } from '../../../utils/get-box-element.ts'\nimport { getSafeEditorView } from '../../../utils/get-safe-editor-view.ts'\nimport { blockPopoverContext, draggingContext, type BlockPopoverContext, type HoverState } from '../context.ts'\n\nimport { setDragPreview } from './set-drag-preview.ts'\nimport type { BlockHandleDraggableProps } from './types.ts'\n\n/**\n * @internal\n */\nexport function useBlockHandleDraggable(\n host: ConnectableElement,\n { state }: { state: SignalState<BlockHandleDraggableProps> },\n): void {\n const context = blockPopoverContext.consume(host)\n const dragging = draggingContext.consume(host)\n\n useEffect(host, () => {\n host.draggable = true\n })\n\n usePointerDownHandler(host, context, state.editor)\n\n useEventListener(host, 'dragstart', (event) => {\n dragging.set(true)\n\n const view = getSafeEditorView(state.editor.get())\n const hoverState = context.get()\n\n if (view && hoverState) {\n view.dom.classList.add('prosekit-dragging')\n createDraggingPreview(view, hoverState, event)\n setViewDragging(view, hoverState)\n }\n })\n\n useEventListener(host, 'dragend', () => {\n dragging.set(false)\n\n const view = getSafeEditorView(state.editor.get())\n if (view) {\n view.dom.classList.remove('prosekit-dragging')\n }\n })\n\n useAttribute(host, 'data-dragging', () => (dragging.get() ? '' : undefined))\n}\n\nfunction usePointerDownHandler(\n host: ConnectableElement,\n context: ReadonlySignal<BlockPopoverContext>,\n editor: ReadonlySignal<Editor | null>,\n) {\n useEventListener(host, 'pointerdown', () => {\n const { pos } = context.get() ?? {}\n const { view } = editor.get() ?? {}\n\n if (pos == null || view == null) {\n return\n }\n\n view.dispatch(\n view.state.tr.setSelection(NodeSelection.create(view.state.doc, pos)),\n )\n\n // Clicking the handle will blur the editor, so we need to focus it again.\n // We cannot call `event.preventDefault()` here to prevent the blur\n // because it will prevent the drag event from firing.\n requestAnimationFrame(() => {\n view.focus()\n })\n })\n}\n\nfunction createDraggingPreview(view: EditorView, hoverState: HoverState, event: DragEvent): void {\n if (!event.dataTransfer) {\n return\n }\n\n const { pos } = hoverState\n\n const element = view.nodeDOM(pos)\n if (!element || !isHTMLElement(element)) {\n return\n }\n\n const boxElement = getBoxElement(element)\n if (!boxElement || !isHTMLElement(boxElement)) {\n return\n }\n\n event.dataTransfer.clearData()\n event.dataTransfer.setData('text/html', boxElement.outerHTML)\n event.dataTransfer.effectAllowed = 'copyMove'\n setDragPreview(event, boxElement)\n\n return\n}\n\nfunction setViewDragging(view: EditorView, hoverState: HoverState): void {\n const { node, pos } = hoverState\n\n const dragging: ViewDragging = {\n slice: new Slice(Fragment.from(node), 0, 0),\n move: true,\n node: NodeSelection.create(view.state.doc, pos),\n }\n\n view.dragging = dragging\n}\n","import type { EventDeclarations, PropDeclarations } from '@aria-ui/core'\nimport type { Editor } from '@prosekit/core'\n\nexport interface BlockHandleDraggableProps {\n /**\n * The ProseKit editor instance.\n *\n * @default null\n * @hidden\n */\n editor: Editor | null\n}\n\n/** @internal */\nexport const blockHandleDraggableProps: PropDeclarations<BlockHandleDraggableProps> = {\n editor: { default: null },\n}\n\n/** @internal */\nexport interface BlockHandleDraggableEvents {}\n\n/** @internal */\nexport const blockHandleDraggableEvents: EventDeclarations<BlockHandleDraggableEvents> = {}\n","import { defineCustomElement, registerCustomElement, type BaseElementConstructor } from \"@aria-ui/core\"\n\nimport { useBlockHandleDraggable } from \"./setup.ts\"\nimport { blockHandleDraggableEvents, blockHandleDraggableProps, type BlockHandleDraggableEvents, type BlockHandleDraggableProps } from \"./types.ts\"\n\nconst BlockHandleDraggableElementBase: BaseElementConstructor<BlockHandleDraggableProps> = defineCustomElement<\n BlockHandleDraggableProps,\n BlockHandleDraggableEvents\n>({\n props: blockHandleDraggableProps,\n events: blockHandleDraggableEvents,\n setup: useBlockHandleDraggable,\n})\nclass BlockHandleDraggableElement extends BlockHandleDraggableElementBase {}\n\nregisterCustomElement('prosekit-block-handle-draggable', BlockHandleDraggableElement)\n \nexport { BlockHandleDraggableElement }\n","/**\n * @internal\n */\nexport function throttle<Args extends any[]>(\n callback: (...args: Args) => void,\n wait: number,\n): (...args: Args) => void {\n let lastTime = 0\n\n return (...args: Args) => {\n const now = Date.now()\n if (now - lastTime >= wait) {\n callback(...args)\n lastTime = now\n }\n }\n}\n","import type { VirtualElement } from '@floating-ui/dom'\nimport { isElement, isHTMLElement, isTextNode } from '@ocavue/utils'\nimport { defineDOMEventHandler, union, type PlainExtension } from '@prosekit/core'\nimport type { ProseMirrorNode } from '@prosekit/pm/model'\nimport type { EditorView } from '@prosekit/pm/view'\n\nimport { getClientRect } from '../../../utils/get-client-rect.ts'\nimport { throttle } from '../../../utils/throttle.ts'\nimport type { HoverState } from '../context.ts'\n\nexport type ElementHoverHandler = (\n reference: VirtualElement | null,\n hoverState: HoverState | null,\n) => void\n\nexport function defineElementHoverHandler(handler: ElementHoverHandler): PlainExtension {\n const handleElement = (\n node: ProseMirrorNode,\n pos: number,\n element: HTMLElement,\n parentElement?: Node | null,\n ) => {\n const reference: VirtualElement = {\n contextElement: element,\n\n getBoundingClientRect: () => {\n const rect = findFirstLineRect(parentElement, element)\n return rect ? fulfillRect(rect) : fallbackRect\n },\n }\n\n handler(reference, { node, pos })\n }\n\n let lastX = -1\n let lastY = -1\n let lastTime = -1\n\n const handlePointerEvent = (view: EditorView, event: PointerEvent) => {\n const { x, y } = event\n\n // Simple performance optimization. If the pointer is not moving, we don't\n // want to recalculate the block handle position within a short period of\n // time window.\n if (lastX === x && lastY === y) {\n const now = Date.now()\n if (now - lastTime < 100) {\n return\n }\n lastTime = now\n }\n lastX = x\n lastY = y\n\n const block = findBlockByCoords(view, x, y)\n if (!block) {\n handler(null, null)\n return\n }\n\n const { node, pos } = block\n const element = view.nodeDOM(pos)\n if (!element || !isHTMLElement(element)) {\n handler(null, null)\n return\n }\n\n // If `node` is the first child of another non-doc block node, for example a\n // list node or a blockquote node, we want to put the block handle agains\n // the parent node.\n const $pos = view.state.doc.resolve(pos)\n if ($pos.depth > 0 && $pos.index($pos.depth) === 0) {\n const parentPos = $pos.before($pos.depth)\n const parentNode = $pos.parent\n const parentElement = view.nodeDOM(parentPos)\n handleElement(parentNode, parentPos, element, parentElement)\n } else {\n handleElement(node, pos, element)\n }\n }\n\n return union(\n defineDOMEventHandler('pointermove', throttle(handlePointerEvent, 200)),\n defineDOMEventHandler('pointerenter', handlePointerEvent),\n defineDOMEventHandler('pointerout', handlePointerEvent),\n defineDOMEventHandler('keypress', () => handler(null, null)),\n )\n}\n\nfunction findBlockByCoords(view: EditorView, x: number, y: number): { node: ProseMirrorNode; pos: number } | undefined {\n const rect = getClientRect(view.dom)\n if (!isWithinRect(rect, x, y)) {\n return\n }\n\n let parent: ProseMirrorNode | undefined = view.state.doc\n let pos = -1\n\n while (parent) {\n if (parent.isBlock && (parent.isTextblock || parent.isAtom || parent.type.spec.isolating)) {\n return { node: parent, pos }\n }\n\n // Collect all children and their positions\n const children: ProseMirrorNode[] = []\n const positions: number[] = []\n parent.forEach((child, offset) => {\n children.push(child)\n positions.push(offset + pos + 1)\n })\n\n let lo = 0\n let hi = children.length - 1\n\n while (lo <= hi) {\n const i = hi - ((hi - lo) >> 1)\n const childDOM = view.nodeDOM(positions[i])\n const childRect = getNodeRect(childDOM)\n if (!childRect) {\n console.warn(`[prosekit] Unable to get rect at position: ${positions[i]}`)\n return\n }\n if (childRect.top > y) {\n hi = i - 1\n } else if (childRect.bottom < y) {\n lo = i + 1\n } else {\n lo = i\n break\n }\n }\n\n if (lo > hi) {\n return\n }\n\n parent = children[lo]\n pos = positions[lo]\n }\n}\n\nfunction getNodeRect(node: Node | null | undefined): Rect | undefined {\n if (node && isElement(node) && node.isConnected) {\n return getClientRect(node)\n }\n}\n\nfunction isWithinRect(rect: Rect, x: number, y: number) {\n return x >= rect.left && x <= rect.right && y >= rect.top && y <= rect.bottom\n}\n\ninterface Rect {\n top: number\n right: number\n bottom: number\n left: number\n}\n\nfunction findFirstLineRect(outer?: Node | null, inner?: Node | null): Rect | undefined {\n if (outer && !outer.isConnected) {\n return\n }\n if (inner && !inner.isConnected) {\n return\n }\n\n if (outer && inner) {\n const outerRect = findOuterRect(outer)\n const innerRect = findFirstLineRectInNode(inner)\n if (outerRect && innerRect) {\n const { top, bottom } = innerRect\n const { left, right } = outerRect\n return { top, bottom, left, right }\n } else {\n return outerRect || innerRect\n }\n } else if (outer) {\n return findFirstLineRectInNode(outer)\n } else if (inner) {\n return findFirstLineRectInNode(inner)\n }\n}\n\nfunction findOuterRect(node: Node): Rect | undefined {\n if (!isElement(node)) {\n return\n }\n\n const rect = getClientRect(node)\n const style = node.ownerDocument.defaultView?.getComputedStyle(node)\n const marginLeft = style && Number.parseInt(style.marginLeft, 10) || 0\n const marginRight = style && Number.parseInt(style.marginRight, 10) || 0\n const left = rect.left - marginLeft\n const right = rect.right + marginRight\n\n return { top: rect.top, bottom: rect.bottom, left, right }\n}\n\nfunction findFirstLineRectInNode(node: Node): Rect | undefined {\n if (isElement(node)) {\n return findFirstLineRectInElement(node)\n } else if (isTextNode(node)) {\n return findFirstLineRectInTextNode(node)\n }\n}\n\nfunction findFirstLineRectInTextNode(node: Text): Rect | undefined {\n const ownerDocument = node.ownerDocument\n if (!ownerDocument) {\n return\n }\n const range = ownerDocument.createRange()\n range.setStart(node, 0)\n range.setEnd(node, 0)\n const rects = range.getClientRects()\n return rects[0]\n}\n\nfunction findFirstLineRectInElement(element: Element): Rect | undefined {\n if (element.nodeName === 'BR') {\n return element.getBoundingClientRect()\n }\n\n const rect = getClientRect(element)\n const style = element.ownerDocument.defaultView?.getComputedStyle(element)\n const marginLeft = style && Number.parseInt(style.marginLeft, 10) || 0\n const marginRight = style && Number.parseInt(style.marginRight, 10) || 0\n const left = rect.left - marginLeft\n const right = rect.right + marginRight\n\n const lineHeight = style && Number.parseInt(style.lineHeight, 10) || 24\n const paddingTop = style && Number.parseInt(style.paddingTop, 10) || 0\n const borderTop = style && Number.parseInt(style.borderTopWidth, 10) || 0\n const top = rect.top + paddingTop + borderTop\n const bottom = top + lineHeight\n\n return { top, bottom, left, right }\n}\n\nfunction fulfillRect({ top, right, bottom, left }: Rect) {\n return { top, right, bottom, left, width: right - left, height: bottom - top, x: left, y: top }\n}\n\n// A fallback rect that is far away from the screen. It should not be used through.\nconst fallbackRect = Object.freeze({\n top: -9999,\n right: -9999,\n bottom: -9999,\n left: -9999,\n width: 0,\n height: 0,\n x: -9999,\n y: -9999,\n})\n","import { createComputed, createSignal, useAttribute, type ConnectableElement, type ReadonlySignal, type SetupOptions } from '@aria-ui/core'\nimport { useOverlayPositionerState } from '@aria-ui/overlay/elements'\nimport { usePresence } from '@aria-ui/presence'\nimport type { VirtualElement } from '@floating-ui/dom'\nimport type { Editor } from '@prosekit/core'\n\nimport { useEditorExtension } from '../../../hooks/use-editor-extension.ts'\nimport { useScrolling } from '../../../hooks/use-scrolling.ts'\nimport { blockPopoverContext, draggingContext, type BlockPopoverContext, type HoverState } from '../context.ts'\n\nimport { defineElementHoverHandler, type ElementHoverHandler } from './pointer-move.ts'\nimport type { BlockHandlePopoverEvents, BlockHandlePopoverProps } from './types.ts'\n\n/**\n * @internal\n */\nexport function useBlockHandlePopover(\n host: ConnectableElement,\n { state, emit }: SetupOptions<BlockHandlePopoverProps, BlockHandlePopoverEvents>,\n): void {\n const { editor, ...overlayState } = state\n const reference = createSignal<VirtualElement | null>(null)\n useOverlayPositionerState(host, overlayState, { reference })\n\n const context = createSignal<BlockPopoverContext>(null)\n blockPopoverContext.provide(host, context)\n\n const dragging = createSignal(false)\n draggingContext.provide(host, dragging)\n\n const scrolling = useScrolling(host)\n const open = createComputed(() => {\n return !!context.get() && !scrolling.get()\n })\n\n useHoverExtension(host, editor, (referenceValue, hoverState) => {\n reference.set(referenceValue)\n context.set(hoverState)\n const stateChangeDetails = hoverState ? { node: hoverState.node, pos: hoverState.pos } : null\n emit('stateChange', stateChangeDetails)\n })\n\n useAttribute(host, 'data-state', () => (open.get() ? 'open' : 'closed'))\n usePresence(host, open)\n}\n\nfunction useHoverExtension(\n host: ConnectableElement,\n editor: ReadonlySignal<Editor | null>,\n handler: ElementHoverHandler,\n) {\n let prevHoverState: HoverState | null = null\n\n const extension = defineElementHoverHandler((reference, hoverState) => {\n if (isHoverStateEqual(prevHoverState, hoverState)) {\n return\n }\n\n prevHoverState = hoverState\n handler(reference, hoverState)\n })\n\n useEditorExtension(host, editor, extension)\n}\n\nfunction isHoverStateEqual(a: HoverState | null, b: HoverState | null) {\n if (!a && !b) return true\n if (!a || !b) return false\n return a.pos === b.pos && a.node.eq(b.node)\n}\n","import type { EventDeclarations, PropDeclarations } from '@aria-ui/core'\nimport {\n overlayPositionerEvents,\n overlayPositionerProps,\n type OverlayPositionerEvents,\n type OverlayPositionerProps,\n} from '@aria-ui/overlay/elements'\nimport type { Placement } from '@floating-ui/dom'\nimport type { Editor } from '@prosekit/core'\nimport type { ProseMirrorNode } from '@prosekit/pm/model'\n\nexport interface BlockHandlePopoverProps extends Omit<OverlayPositionerProps, 'placement' | 'hoist' | 'flip' | 'shift' | 'hide'> {\n /**\n * The ProseKit editor instance.\n *\n * @default null\n * @hidden\n */\n editor: Editor | null\n\n /**\n * The placement of the popover, relative to the hovered block.\n *\n * @default \"left\"\n */\n placement: Placement\n\n /**\n * Whether to use the browser [Popover API](https://developer.mozilla.org/en-US/docs/Web/API/Popover_API)\n * to place the floating element on top of other page content.\n *\n * @default false\n */\n hoist: boolean\n\n /**\n * @default false\n * @hidden\n */\n flip: boolean\n\n /**\n * @default false\n * @hidden\n */\n shift: boolean\n\n /**\n * @default true\n * @hidden\n */\n hide: boolean\n}\n\n/** @internal */\nexport const blockHandlePopoverProps: PropDeclarations<BlockHandlePopoverProps> = {\n ...overlayPositionerProps,\n editor: { default: null },\n placement: { default: 'left' },\n\n // Enabling `hoist` will cause the popover to have a small delay when\n // scrolling the page.\n hoist: { default: false },\n\n flip: { default: false },\n shift: { default: false },\n hide: { default: true },\n}\n\nexport interface BlockHandlePopoverEvents extends OverlayPositionerEvents {\n /**\n * Fired when the hovered block changes.\n */\n stateChange: CustomEvent<{ node: ProseMirrorNode; pos: number } | null>\n}\n\n/** @internal */\nexport const blockHandlePopoverEvents: EventDeclarations<BlockHandlePopoverEvents> = {\n ...overlayPositionerEvents,\n stateChange: {},\n}\n","import { defineCustomElement, registerCustomElement, type BaseElementConstructor } from \"@aria-ui/core\"\n\nimport { useBlockHandlePopover } from \"./setup.ts\"\nimport { blockHandlePopoverEvents, blockHandlePopoverProps, type BlockHandlePopoverEvents, type BlockHandlePopoverProps } from \"./types.ts\"\n\nconst BlockHandlePopoverElementBase: BaseElementConstructor<BlockHandlePopoverProps> = defineCustomElement<\n BlockHandlePopoverProps,\n BlockHandlePopoverEvents\n>({\n props: blockHandlePopoverProps,\n events: blockHandlePopoverEvents,\n setup: useBlockHandlePopover,\n})\nclass BlockHandlePopoverElement extends BlockHandlePopoverElementBase {}\n\nregisterCustomElement('prosekit-block-handle-popover', BlockHandlePopoverElement)\n \nexport { BlockHandlePopoverElement }\n"],"mappings":";;;;;;;;;;;;;;;;AAmBA,MAAa,sBAAoD,cAC/D,kCACA,KACD;;;;AAKD,MAAa,kBAAoC,cAC/C,0CACA,MACD;;;;;;;ACpBD,SAAgB,kBACd,MACA,EAAE,SACI;CACN,MAAM,UAAU,oBAAoB,QAAQ,KAAK;AAEjD,kBAAiB,MAAM,gBAAgB,UAAU;AAC/C,QAAM,gBAAgB;EAEtB,MAAM,SAAS,MAAM,OAAO,KAAK;EACjC,MAAM,aAAa,QAAQ,KAAK;AAChC,MAAI,CAAC,UAAU,CAAC,WACd;EAGF,MAA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;;;;;ACb7C,MAAa,0BAAqE;CAChF,GAAG;CACH,QAAQ,EAAE,SAAS,MAAM;CACzB,WAAW,EAAE,SAAS,QAAQ;CAI9B,OAAO,EAAE,SAAS,OAAO;CAEzB,MAAM,EAAE,SAAS,OAAO;CACxB,OAAO,EAAE,SAAS,OAAO;CACzB,MAAM,EAAE,SAAS,MAAM;CACxB;;AAUD,MAAa,2BAAwE;CACnF,GAAG;CACH,aAAa,EAAE;CAChB;;;;AC3ED,MAAM,gCAAiF,oBAGrF;CACA,OAAO;CACP,QAAQ;CACR,OAAO;CACR,CAAC;AACF,IAAM,4BAAN,cAAwC,8BAA8B;AAEtE,sBAAsB,iCAAiC,0BAA0B"}
1
+ {"version":3,"file":"prosekit-web-block-handle.js","names":[],"sources":["../src/components/block-handle/context.ts","../src/components/block-handle/block-handle-add/setup.ts","../src/components/block-handle/block-handle-add/types.ts","../src/components/block-handle/block-handle-add/element.gen.ts","../src/constants.ts","../src/utils/get-client-rect.ts","../src/utils/max-z-index.ts","../src/components/block-handle/block-handle-draggable/set-drag-preview.ts","../src/components/block-handle/block-handle-draggable/setup.ts","../src/components/block-handle/block-handle-draggable/types.ts","../src/components/block-handle/block-handle-draggable/element.gen.ts","../src/components/block-handle/block-handle-popover/pointer-move.ts","../src/components/block-handle/block-handle-popover/setup.ts","../src/components/block-handle/block-handle-popover/types.ts","../src/components/block-handle/block-handle-popover/element.gen.ts"],"sourcesContent":["import { createContext, type Context } from '@aria-ui/core'\nimport type { ProseMirrorNode } from '@prosekit/pm/model'\n\n/**\n * @internal\n */\nexport interface HoverState {\n node: ProseMirrorNode\n pos: number\n}\n\n/**\n * @internal\n */\nexport type BlockPopoverContext = HoverState | null\n\n/**\n * @internal\n */\nexport const blockPopoverContext: Context<BlockPopoverContext> = createContext(\n 'prosekit-block-popover-context',\n null,\n)\n\n/**\n * @internal\n */\nexport const draggingContext: Context<boolean> = createContext(\n 'prosekit-block-handle-dragging-context',\n false,\n)\n","import { useEventListener, type ConnectableElement, type SignalState } from '@aria-ui/core'\nimport { insertDefaultBlock } from '@prosekit/core'\n\nimport { blockPopoverContext } from '../context.ts'\n\nimport type { BlockHandleAddProps } from './types.ts'\n\n/**\n * @internal\n */\nexport function useBlockHandleAdd(\n host: ConnectableElement,\n { state }: { state: SignalState<BlockHandleAddProps> },\n): void {\n const context = blockPopoverContext.consume(host)\n\n useEventListener(host, 'pointerdown', (event) => {\n event.preventDefault()\n\n const editor = state.editor.get()\n const hoverState = context.get()\n if (!editor || !hoverState) {\n return\n }\n\n const { node, pos } = hoverState\n editor.exec(insertDefaultBlock({ pos: pos + node.nodeSize }))\n editor.focus()\n\n // Hide the drag handle\n context.set(null)\n })\n}\n","import type { EventDeclarations, PropDeclarations } from '@aria-ui/core'\nimport type { Editor } from '@prosekit/core'\n\nexport interface BlockHandleAddProps {\n /**\n * The ProseKit editor instance.\n *\n * @default null\n * @hidden\n */\n editor: Editor | null\n}\n\n/** @internal */\nexport const blockHandleAddProps: PropDeclarations<BlockHandleAddProps> = {\n editor: { default: null },\n}\n\n/** @internal */\nexport interface BlockHandleAddEvents {}\n\n/** @internal */\nexport const blockHandleAddEvents: EventDeclarations<BlockHandleAddEvents> = {}\n","import { defineCustomElement, registerCustomElement, type BaseElementConstructor } from \"@aria-ui/core\"\n\nimport { useBlockHandleAdd } from \"./setup.ts\"\nimport { blockHandleAddEvents, blockHandleAddProps, type BlockHandleAddEvents, type BlockHandleAddProps } from \"./types.ts\"\n\nconst BlockHandleAddElementBase: BaseElementConstructor<BlockHandleAddProps> = defineCustomElement<\n BlockHandleAddProps,\n BlockHandleAddEvents\n>({\n props: blockHandleAddProps,\n events: blockHandleAddEvents,\n setup: useBlockHandleAdd,\n})\nclass BlockHandleAddElement extends BlockHandleAddElementBase {}\n\nregisterCustomElement('prosekit-block-handle-add', BlockHandleAddElement)\n \nexport { BlockHandleAddElement }\n","export const DRAGGING_CLASS_NAME = 'prosekit-dragging'\n","interface Rect {\n top: number\n bottom: number\n right: number\n left: number\n}\n\ninterface IncludeExtraOptions {\n top?: boolean\n bottom?: boolean\n right?: boolean\n left?: boolean\n}\n\n/**\n * Similar to `element.getBoundingClientRect`, but handles `display: contents` CSS\n * property and optionally includes margins and outlines.\n */\nexport function getClientRect(element: Element, includeExtra?: IncludeExtraOptions | false): Rect {\n const rect = element.getBoundingClientRect()\n if (rect.width === 0 && rect.height === 0 && rect.x === 0 && rect.y === 0) {\n // Suspiciously rect, probably an element with `display: contents`, in\n // which case `element.getClientRects()` will return an empty array.\n if (element.getClientRects().length === 0) {\n const children = [...element.children]\n const rects = children.map(child => getClientRect(child, includeExtra))\n if (rects.length === 0) {\n return rect\n }\n if (rects.length === 1) {\n return rects[0]\n }\n let { top, bottom, left, right } = rects[0]\n for (let i = 1; i < rects.length; i++) {\n const r = rects[i]\n if (r.top < top) top = r.top\n if (r.bottom > bottom) bottom = r.bottom\n if (r.left < left) left = r.left\n if (r.right > right) right = r.right\n }\n return { top, bottom, left, right }\n }\n }\n return includeExtra ? addExtra(element, rect, includeExtra) : rect\n}\n\nfunction addExtra(element: Element, rect: Rect, options: IncludeExtraOptions): Rect {\n const view = element.ownerDocument?.defaultView\n if (!view) {\n return rect\n }\n\n const style = view.getComputedStyle(element)\n const marginTop = options.top ? Number.parseFloat(style.marginTop) || 0 : 0\n const marginBottom = options.bottom ? Number.parseFloat(style.marginBottom) || 0 : 0\n const marginRight = options.right ? Number.parseFloat(style.marginRight) || 0 : 0\n const marginLeft = options.left ? Number.parseFloat(style.marginLeft) || 0 : 0\n\n const outlineWidth = Number.parseFloat(style.outlineWidth) || 0\n const outlineOffset = Number.parseFloat(style.outlineOffset) || 0\n const outline = Math.max(outlineWidth + outlineOffset, 0)\n const outlineTop = options.top ? outline : 0\n const outlineBottom = options.bottom ? outline : 0\n const outlineRight = options.right ? outline : 0\n const outlineLeft = options.left ? outline : 0\n\n return {\n top: rect.top - Math.max(marginTop, outlineTop),\n bottom: rect.bottom + Math.max(marginBottom, outlineBottom),\n right: rect.right + Math.max(marginRight, outlineRight),\n left: rect.left - Math.max(marginLeft, outlineLeft),\n }\n}\n","// Maximum possible z-index\n// https://stackoverflow.com/questions/491052/minimum-and-maximum-value-of-z-index\nexport const maxZIndex = '2147483647'\n","import { DRAGGING_CLASS_NAME } from '../../../constants.ts'\nimport { assignStyles } from '../../../utils/assign-styles.ts'\nimport { getClientRect } from '../../../utils/get-client-rect.ts'\nimport { maxZIndex } from '../../../utils/max-z-index.ts'\n\n/**\n * Sets a drag preview image for the given element and ensures the preview position\n * relative to the pointer is correct.\n *\n * This function does the following:\n *\n * - Creates a temporary container element.\n * - Puts the container at the end of the document body.\n * - Sets event's drag image.\n * - Removes the container from the document body after the next frame.\n */\nexport function setDragPreview(event: DragEvent, element: HTMLElement): void {\n const { top, bottom, left, right } = getClientRect(element, { left: true, right: true, top: true, bottom: true })\n const width = right - left\n const height = bottom - top\n const elementX = left\n const elementY = top\n\n const { clientX, clientY } = event\n\n const document = element.ownerDocument\n\n const container = document.createElement('div')\n\n // Add some class names so that all styles applied to\n // given class names can also be applied to the drag preview.\n container.classList.add('ProseMirror', DRAGGING_CLASS_NAME)\n\n // If outsideX is positive, the point is at the left side of the element.\n const outsideX = Math.round(elementX - clientX)\n // If outsideY is positive, the point is above the element.\n const outsideY = Math.round(elementY - clientY)\n\n const borderX = Math.max(outsideX, 0)\n const borderY = Math.max(outsideY, 0)\n assignStyles(container, {\n // Ensuring we don't cause reflow when adding the element to the page using\n // `position:fixed` rather than `position:absolute` so we are positioned on\n // the current viewport. `position:fixed` also creates a new stacking\n // context, so we don't need to do that here.\n // https://github.com/atlassian/pragmatic-drag-and-drop/blob/56276552/packages/core/src/public-utils/element/custom-native-drag-preview/set-custom-native-drag-preview.ts#L60\n position: 'fixed',\n\n // The element is positioned off-screen to avoid capturing the content of\n // the page on Safari when the dragging element has a transparent background\n // on Safari. See https://github.com/prosekit/prosekit/issues/1153 for more\n // details.\n top: '-1000vh',\n left: '-1000vw',\n\n // The element should not be interactive.\n pointerEvents: 'none',\n\n zIndex: maxZIndex,\n\n // Only reliable cross browser technique found to push a drag preview away\n // from the cursor is to use transparent borders on the container.\n // https://github.com/atlassian/pragmatic-drag-and-drop/blob/56276552/packages/core/src/public-utils/element/custom-native-drag-preview/pointer-outside-of-preview.ts#L13-L18\n borderLeft: `${borderX}px solid transparent`,\n borderTop: `${borderY}px solid transparent`,\n\n boxSizing: 'border-box',\n width: `${width + borderX}px`,\n height: `${height + borderY}px`,\n })\n\n const clonedElement = element.cloneNode(true) as HTMLElement\n\n // A hardcoded opacity.\n clonedElement.style.setProperty('opacity', '0.8', 'important')\n // Hide the outline of the cloned element.\n clonedElement.style.setProperty('outline-color', 'transparent', 'important')\n\n container.appendChild(clonedElement)\n document.body.appendChild(container)\n\n event.dataTransfer?.setDragImage(container, Math.max(-outsideX, 0), Math.max(-outsideY, 0))\n\n requestAnimationFrame(() => {\n container.remove()\n })\n}\n","import { useAttribute, useEffect, useEventListener, type ConnectableElement, type ReadonlySignal, type SignalState } from '@aria-ui/core'\nimport { isHTMLElement } from '@ocavue/utils'\nimport type { Editor } from '@prosekit/core'\nimport type { ViewDragging } from '@prosekit/extensions/drop-indicator'\nimport { Fragment, Slice } from '@prosekit/pm/model'\nimport { NodeSelection } from '@prosekit/pm/state'\nimport type { EditorView } from '@prosekit/pm/view'\n\nimport { DRAGGING_CLASS_NAME } from '../../../constants.ts'\nimport { getSafeEditorView } from '../../../utils/get-safe-editor-view.ts'\nimport { blockPopoverContext, draggingContext, type BlockPopoverContext, type HoverState } from '../context.ts'\n\nimport { setDragPreview } from './set-drag-preview.ts'\nimport type { BlockHandleDraggableProps } from './types.ts'\n\n/**\n * @internal\n */\nexport function useBlockHandleDraggable(\n host: ConnectableElement,\n { state }: { state: SignalState<BlockHandleDraggableProps> },\n): void {\n const context = blockPopoverContext.consume(host)\n const dragging = draggingContext.consume(host)\n\n useEffect(host, () => {\n host.draggable = true\n })\n\n usePointerDownHandler(host, context, state.editor)\n\n useEventListener(host, 'dragstart', (event) => {\n dragging.set(true)\n\n const view = getSafeEditorView(state.editor.get())\n const hoverState = context.get()\n\n if (view && hoverState) {\n view.dom.classList.add(DRAGGING_CLASS_NAME)\n createDraggingPreview(view, hoverState, event)\n setViewDragging(view, hoverState)\n }\n })\n\n useEventListener(host, 'dragend', () => {\n dragging.set(false)\n\n const view = getSafeEditorView(state.editor.get())\n if (view) {\n view.dom.classList.remove(DRAGGING_CLASS_NAME)\n }\n })\n\n useAttribute(host, 'data-dragging', () => (dragging.get() ? '' : undefined))\n}\n\nfunction usePointerDownHandler(\n host: ConnectableElement,\n context: ReadonlySignal<BlockPopoverContext>,\n editor: ReadonlySignal<Editor | null>,\n) {\n useEventListener(host, 'pointerdown', () => {\n const { pos } = context.get() ?? {}\n const { view } = editor.get() ?? {}\n\n if (pos == null || view == null) {\n return\n }\n\n view.dispatch(\n view.state.tr.setSelection(NodeSelection.create(view.state.doc, pos)),\n )\n\n // Clicking the handle will blur the editor, so we need to focus it again.\n // We cannot call `event.preventDefault()` here to prevent the blur\n // because it will prevent the drag event from firing.\n requestAnimationFrame(() => {\n view.focus()\n })\n })\n}\n\nfunction createDraggingPreview(view: EditorView, hoverState: HoverState, event: DragEvent): void {\n if (!event.dataTransfer) {\n return\n }\n\n const { pos } = hoverState\n\n const element = view.nodeDOM(pos)\n if (!element || !isHTMLElement(element)) {\n return\n }\n\n event.dataTransfer.clearData()\n event.dataTransfer.setData('text/html', element.outerHTML)\n event.dataTransfer.effectAllowed = 'copyMove'\n setDragPreview(event, element)\n\n return\n}\n\nfunction setViewDragging(view: EditorView, hoverState: HoverState): void {\n const { node, pos } = hoverState\n\n const dragging: ViewDragging = {\n slice: new Slice(Fragment.from(node), 0, 0),\n move: true,\n node: NodeSelection.create(view.state.doc, pos),\n }\n\n view.dragging = dragging\n}\n","import type { EventDeclarations, PropDeclarations } from '@aria-ui/core'\nimport type { Editor } from '@prosekit/core'\n\nexport interface BlockHandleDraggableProps {\n /**\n * The ProseKit editor instance.\n *\n * @default null\n * @hidden\n */\n editor: Editor | null\n}\n\n/** @internal */\nexport const blockHandleDraggableProps: PropDeclarations<BlockHandleDraggableProps> = {\n editor: { default: null },\n}\n\n/** @internal */\nexport interface BlockHandleDraggableEvents {}\n\n/** @internal */\nexport const blockHandleDraggableEvents: EventDeclarations<BlockHandleDraggableEvents> = {}\n","import { defineCustomElement, registerCustomElement, type BaseElementConstructor } from \"@aria-ui/core\"\n\nimport { useBlockHandleDraggable } from \"./setup.ts\"\nimport { blockHandleDraggableEvents, blockHandleDraggableProps, type BlockHandleDraggableEvents, type BlockHandleDraggableProps } from \"./types.ts\"\n\nconst BlockHandleDraggableElementBase: BaseElementConstructor<BlockHandleDraggableProps> = defineCustomElement<\n BlockHandleDraggableProps,\n BlockHandleDraggableEvents\n>({\n props: blockHandleDraggableProps,\n events: blockHandleDraggableEvents,\n setup: useBlockHandleDraggable,\n})\nclass BlockHandleDraggableElement extends BlockHandleDraggableElementBase {}\n\nregisterCustomElement('prosekit-block-handle-draggable', BlockHandleDraggableElement)\n \nexport { BlockHandleDraggableElement }\n","import type { VirtualElement } from '@floating-ui/dom'\nimport { isElement, isHTMLElement, isTextNode, throttle } from '@ocavue/utils'\nimport { defineDOMEventHandler, union, type PlainExtension } from '@prosekit/core'\nimport type { ProseMirrorNode } from '@prosekit/pm/model'\nimport type { EditorView } from '@prosekit/pm/view'\n\nimport { getClientRect } from '../../../utils/get-client-rect.ts'\nimport type { HoverState } from '../context.ts'\n\nexport type ElementHoverHandler = (\n reference: VirtualElement | null,\n hoverState: HoverState | null,\n) => void\n\nexport function defineElementHoverHandler(handler: ElementHoverHandler): PlainExtension {\n const handleElement = (\n node: ProseMirrorNode,\n pos: number,\n element: HTMLElement,\n parentElement?: Node | null,\n ) => {\n const reference: VirtualElement = {\n contextElement: element,\n\n getBoundingClientRect: () => {\n const rect = findFirstLineRect(parentElement, element)\n return rect ? fulfillRect(rect) : fallbackRect\n },\n }\n\n handler(reference, { node, pos })\n }\n\n let lastX = -1\n let lastY = -1\n let lastTime = -1\n\n const handlePointerEvent = (view: EditorView, event: PointerEvent) => {\n const { x, y } = event\n\n // Simple performance optimization. If the pointer is not moving, we don't\n // want to recalculate the block handle position within a short period of\n // time window.\n if (lastX === x && lastY === y) {\n const now = Date.now()\n if (now - lastTime < 100) {\n return\n }\n lastTime = now\n }\n lastX = x\n lastY = y\n\n const block = findBlockByCoords(view, x, y)\n if (!block) {\n handler(null, null)\n return\n }\n\n const { node, pos } = block\n const element = view.nodeDOM(pos)\n if (!element || !isHTMLElement(element)) {\n handler(null, null)\n return\n }\n\n // If `node` is the first child of another non-doc block node, for example a\n // list node or a blockquote node, we want to put the block handle agains\n // the parent node.\n const $pos = view.state.doc.resolve(pos)\n if ($pos.depth > 0 && $pos.index($pos.depth) === 0) {\n const parentPos = $pos.before($pos.depth)\n const parentNode = $pos.parent\n const parentElement = view.nodeDOM(parentPos)\n handleElement(parentNode, parentPos, element, parentElement)\n } else {\n handleElement(node, pos, element)\n }\n }\n\n return union(\n defineDOMEventHandler('pointermove', throttle(handlePointerEvent, 200)),\n defineDOMEventHandler('pointerenter', handlePointerEvent),\n defineDOMEventHandler('pointerout', handlePointerEvent),\n defineDOMEventHandler('keypress', () => handler(null, null)),\n )\n}\n\nfunction findBlockByCoords(view: EditorView, x: number, y: number): { node: ProseMirrorNode; pos: number } | undefined {\n const rect = getClientRect(view.dom)\n if (!isWithinRect(rect, x, y)) {\n return\n }\n\n let parent: ProseMirrorNode | undefined = view.state.doc\n let pos = -1\n\n while (parent) {\n if (parent.isBlock && (parent.isTextblock || parent.isAtom || parent.type.spec.isolating)) {\n return { node: parent, pos }\n }\n\n // Collect all children and their positions\n const children: ProseMirrorNode[] = []\n const positions: number[] = []\n parent.forEach((child, offset) => {\n children.push(child)\n positions.push(offset + pos + 1)\n })\n\n let lo = 0\n let hi = children.length - 1\n\n while (lo <= hi) {\n const i = hi - ((hi - lo) >> 1)\n const childDOM = view.nodeDOM(positions[i])\n const childRect = getNodeRect(childDOM)\n if (!childRect) {\n console.warn(`[prosekit] Unable to get rect at position: ${positions[i]}`)\n return\n }\n if (childRect.top > y) {\n hi = i - 1\n } else if (childRect.bottom < y) {\n lo = i + 1\n } else {\n lo = i\n break\n }\n }\n\n if (lo > hi) {\n return\n }\n\n parent = children[lo]\n pos = positions[lo]\n }\n}\n\nfunction getNodeRect(node: Node | null | undefined): Rect | undefined {\n if (node && isElement(node) && node.isConnected) {\n return getClientRect(node)\n }\n}\n\nfunction isWithinRect(rect: Rect, x: number, y: number) {\n return x >= rect.left && x <= rect.right && y >= rect.top && y <= rect.bottom\n}\n\ninterface Rect {\n top: number\n right: number\n bottom: number\n left: number\n}\n\nfunction findFirstLineRect(outer?: Node | null, inner?: Node | null): Rect | undefined {\n if (outer && !outer.isConnected) {\n return\n }\n if (inner && !inner.isConnected) {\n return\n }\n\n if (outer && inner) {\n const outerRect = findOuterRect(outer)\n const innerRect = findFirstLineRectInNode(inner)\n if (outerRect && innerRect) {\n const { top, bottom } = innerRect\n const { left, right } = outerRect\n return { top, bottom, left, right }\n } else {\n return outerRect || innerRect\n }\n } else if (outer) {\n return findFirstLineRectInNode(outer)\n } else if (inner) {\n return findFirstLineRectInNode(inner)\n }\n}\n\nfunction findOuterRect(node: Node): Rect | undefined {\n if (!isElement(node)) {\n return\n }\n\n return getClientRect(node, { left: true, right: true })\n}\n\nfunction findFirstLineRectInNode(node: Node): Rect | undefined {\n if (isElement(node)) {\n return findFirstLineRectInElement(node)\n } else if (isTextNode(node)) {\n return findFirstLineRectInTextNode(node)\n }\n}\n\nfunction findFirstLineRectInTextNode(node: Text): Rect | undefined {\n const ownerDocument = node.ownerDocument\n if (!ownerDocument) {\n return\n }\n const range = ownerDocument.createRange()\n range.setStart(node, 0)\n range.setEnd(node, 0)\n const rects = range.getClientRects()\n return rects[0]\n}\n\nfunction findFirstLineRectInElement(element: Element): Rect | undefined {\n if (element.nodeName === 'BR') {\n return element.getBoundingClientRect()\n }\n\n const rect = getClientRect(element)\n const style = element.ownerDocument.defaultView?.getComputedStyle(element)\n const marginLeft = style && Number.parseInt(style.marginLeft, 10) || 0\n const marginRight = style && Number.parseInt(style.marginRight, 10) || 0\n const left = rect.left - marginLeft\n const right = rect.right + marginRight\n\n const lineHeight = style && Number.parseInt(style.lineHeight, 10) || 24\n const paddingTop = style && Number.parseInt(style.paddingTop, 10) || 0\n const borderTop = style && Number.parseInt(style.borderTopWidth, 10) || 0\n const top = rect.top + paddingTop + borderTop\n const bottom = top + lineHeight\n\n return { top, bottom, left, right }\n}\n\nfunction fulfillRect({ top, right, bottom, left }: Rect) {\n return { top, right, bottom, left, width: right - left, height: bottom - top, x: left, y: top }\n}\n\n// A fallback rect that is far away from the screen. It should not be used through.\nconst fallbackRect = Object.freeze({\n top: -9999,\n right: -9999,\n bottom: -9999,\n left: -9999,\n width: 0,\n height: 0,\n x: -9999,\n y: -9999,\n})\n","import { createComputed, createSignal, useAttribute, type ConnectableElement, type ReadonlySignal, type SetupOptions } from '@aria-ui/core'\nimport { useOverlayPositionerState } from '@aria-ui/overlay/elements'\nimport { usePresence } from '@aria-ui/presence'\nimport type { VirtualElement } from '@floating-ui/dom'\nimport type { Editor } from '@prosekit/core'\n\nimport { useEditorExtension } from '../../../hooks/use-editor-extension.ts'\nimport { useScrolling } from '../../../hooks/use-scrolling.ts'\nimport { blockPopoverContext, draggingContext, type BlockPopoverContext, type HoverState } from '../context.ts'\n\nimport { defineElementHoverHandler, type ElementHoverHandler } from './pointer-move.ts'\nimport type { BlockHandlePopoverEvents, BlockHandlePopoverProps } from './types.ts'\n\n/**\n * @internal\n */\nexport function useBlockHandlePopover(\n host: ConnectableElement,\n { state, emit }: SetupOptions<BlockHandlePopoverProps, BlockHandlePopoverEvents>,\n): void {\n const { editor, ...overlayState } = state\n const reference = createSignal<VirtualElement | null>(null)\n useOverlayPositionerState(host, overlayState, { reference })\n\n const context = createSignal<BlockPopoverContext>(null)\n blockPopoverContext.provide(host, context)\n\n const dragging = createSignal(false)\n draggingContext.provide(host, dragging)\n\n const scrolling = useScrolling(host)\n const open = createComputed(() => {\n return !!context.get() && !scrolling.get()\n })\n\n useHoverExtension(host, editor, (referenceValue, hoverState) => {\n reference.set(referenceValue)\n context.set(hoverState)\n const stateChangeDetails = hoverState ? { node: hoverState.node, pos: hoverState.pos } : null\n emit('stateChange', stateChangeDetails)\n })\n\n useAttribute(host, 'data-state', () => (open.get() ? 'open' : 'closed'))\n usePresence(host, open)\n}\n\nfunction useHoverExtension(\n host: ConnectableElement,\n editor: ReadonlySignal<Editor | null>,\n handler: ElementHoverHandler,\n) {\n let prevHoverState: HoverState | null = null\n\n const extension = defineElementHoverHandler((reference, hoverState) => {\n if (isHoverStateEqual(prevHoverState, hoverState)) {\n return\n }\n\n prevHoverState = hoverState\n handler(reference, hoverState)\n })\n\n useEditorExtension(host, editor, extension)\n}\n\nfunction isHoverStateEqual(a: HoverState | null, b: HoverState | null) {\n return (!a && !b) || (a && b && a.pos === b.pos && a.node.eq(b.node))\n}\n","import type { EventDeclarations, PropDeclarations } from '@aria-ui/core'\nimport {\n overlayPositionerEvents,\n overlayPositionerProps,\n type OverlayPositionerEvents,\n type OverlayPositionerProps,\n} from '@aria-ui/overlay/elements'\nimport type { Placement } from '@floating-ui/dom'\nimport type { Editor } from '@prosekit/core'\nimport type { ProseMirrorNode } from '@prosekit/pm/model'\n\nexport interface BlockHandlePopoverProps extends Omit<OverlayPositionerProps, 'placement' | 'hoist' | 'flip' | 'shift' | 'hide'> {\n /**\n * The ProseKit editor instance.\n *\n * @default null\n * @hidden\n */\n editor: Editor | null\n\n /**\n * The placement of the popover, relative to the hovered block.\n *\n * @default \"left\"\n */\n placement: Placement\n\n /**\n * Whether to use the browser [Popover API](https://developer.mozilla.org/en-US/docs/Web/API/Popover_API)\n * to place the floating element on top of other page content.\n *\n * @default false\n */\n hoist: boolean\n\n /**\n * @default false\n * @hidden\n */\n flip: boolean\n\n /**\n * @default false\n * @hidden\n */\n shift: boolean\n\n /**\n * @default true\n * @hidden\n */\n hide: boolean\n}\n\n/** @internal */\nexport const blockHandlePopoverProps: PropDeclarations<BlockHandlePopoverProps> = {\n ...overlayPositionerProps,\n editor: { default: null },\n placement: { default: 'left' },\n\n // Enabling `hoist` will cause the popover to have a small delay when\n // scrolling the page.\n hoist: { default: false },\n\n flip: { default: false },\n shift: { default: false },\n hide: { default: true },\n}\n\nexport interface BlockHandlePopoverEvents extends OverlayPositionerEvents {\n /**\n * Fired when the hovered block changes.\n */\n stateChange: CustomEvent<{ node: ProseMirrorNode; pos: number } | null>\n}\n\n/** @internal */\nexport const blockHandlePopoverEvents: EventDeclarations<BlockHandlePopoverEvents> = {\n ...overlayPositionerEvents,\n stateChange: {},\n}\n","import { defineCustomElement, registerCustomElement, type BaseElementConstructor } from \"@aria-ui/core\"\n\nimport { useBlockHandlePopover } from \"./setup.ts\"\nimport { blockHandlePopoverEvents, blockHandlePopoverProps, type BlockHandlePopoverEvents, type BlockHandlePopoverProps } from \"./types.ts\"\n\nconst BlockHandlePopoverElementBase: BaseElementConstructor<BlockHandlePopoverProps> = defineCustomElement<\n BlockHandlePopoverProps,\n BlockHandlePopoverEvents\n>({\n props: blockHandlePopoverProps,\n events: blockHandlePopoverEvents,\n setup: useBlockHandlePopover,\n})\nclass BlockHandlePopoverElement extends BlockHandlePopoverElementBase {}\n\nregisterCustomElement('prosekit-block-handle-popover', BlockHandlePopoverElement)\n \nexport { BlockHandlePopoverElement }\n"],"mappings":";;;;;;;;;;;;;;AAmBA,MAAa,sBAAoD,cAC/D,kCACA,KACD;;;;AAKD,MAAa,kBAAoC,cAC/C,0CACA,MACD;;;;;;ACpBD,SAAgB,kBACd,MACA,EAAE,SACI;CACN,MAAM,UAAU,oBAAoB,QAAQ,KAAK;AAEjD,kBAAiB,MAAM,gBAAgB,UAAU;AAC/C,QAAM,gBAAgB;EAEtB,MAAM,SAAS,MAAM,OAAO,KAAK;EACjC,MAAM,aAAa,QAAQ,KAAK;AAChC,MAAI,CAAC,UAAU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,MAAI,kBAAkB,gBAAgB,WAAW,CAC/C;AAGF,mBAAiB;AACjB,UAAQ,WAAW,WAAW;GAC9B,CAEyC;;AAG7C,SAAS,kBAAkB,GAAsB,GAAsB;AACrE,QAAQ,CAAC,KAAK,CAAC,KAAO,KAAK,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,KAAK,GAAG,EAAE,KAAK;;;;;ACXtE,MAAa,0BAAqE;CAChF,GAAG;CACH,QAAQ,EAAE,SAAS,MAAM;CACzB,WAAW,EAAE,SAAS,QAAQ;CAI9B,OAAO,EAAE,SAAS,OAAO;CAEzB,MAAM,EAAE,SAAS,OAAO;CACxB,OAAO,EAAE,SAAS,OAAO;CACzB,MAAM,EAAE,SAAS,MAAM;CACxB;;AAUD,MAAa,2BAAwE;CACnF,GAAG;CACH,aAAa,EAAE;CAChB;;;AC3ED,MAAM,gCAAiF,oBAGrF;CACA,OAAO;CACP,QAAQ;CACR,OAAO;CACR,CAAC;AACF,IAAM,4BAAN,cAAwC,8BAA8B;AAEtE,sBAAsB,iCAAiC,0BAA0B"}
@@ -1,9 +1,8 @@
1
- import { t as useEditorExtension } from "./use-editor-extension-B2WuUfnd.js";
2
- import { n as assignStyles, t as useScrolling } from "./use-scrolling-BjVzAkiZ.js";
1
+ import { t as useEditorExtension } from "./use-editor-extension.js";
2
+ import { n as assignStyles, t as useScrolling } from "./use-scrolling.js";
3
3
  import { createComputed, createSignal, defineCustomElement, registerCustomElement, useEffect } from "@aria-ui/core";
4
4
  import { usePresence } from "@aria-ui/presence";
5
5
  import { defineDropIndicator } from "@prosekit/extensions/drop-indicator";
6
-
7
6
  //#region src/components/drop-indicator/drop-indicator/setup.ts
8
7
  /**
9
8
  * @internal
@@ -52,7 +51,6 @@ function useDropIndicator(host, { state }) {
52
51
  });
53
52
  });
54
53
  }
55
-
56
54
  //#endregion
57
55
  //#region src/components/drop-indicator/drop-indicator/types.ts
58
56
  /** @internal */
@@ -62,7 +60,6 @@ const dropIndicatorProps = Object.freeze({
62
60
  });
63
61
  /** @internal */
64
62
  const dropIndicatorEvents = {};
65
-
66
63
  //#endregion
67
64
  //#region src/components/drop-indicator/drop-indicator/element.gen.ts
68
65
  const DropIndicatorElementBase = defineCustomElement({
@@ -72,7 +69,7 @@ const DropIndicatorElementBase = defineCustomElement({
72
69
  });
73
70
  var DropIndicatorElement = class extends DropIndicatorElementBase {};
74
71
  registerCustomElement("prosekit-drop-indicator", DropIndicatorElement);
75
-
76
72
  //#endregion
77
73
  export { DropIndicatorElement, dropIndicatorEvents, dropIndicatorProps, useDropIndicator };
74
+
78
75
  //# sourceMappingURL=prosekit-web-drop-indicator.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"prosekit-web-drop-indicator.js","names":[],"sources":["../src/components/drop-indicator/drop-indicator/setup.ts","../src/components/drop-indicator/drop-indicator/types.ts","../src/components/drop-indicator/drop-indicator/element.gen.ts"],"sourcesContent":["import { createComputed, createSignal, useEffect, type ConnectableElement, type SetupOptions } from '@aria-ui/core'\nimport { usePresence } from '@aria-ui/presence'\nimport { defineDropIndicator, type ShowHandlerOptions } from '@prosekit/extensions/drop-indicator'\n\nimport { useEditorExtension } from '../../../hooks/use-editor-extension.ts'\nimport { useScrolling } from '../../../hooks/use-scrolling.ts'\nimport { assignStyles } from '../../../utils/assign-styles.ts'\n\nimport type { DropIndicatorEvents, DropIndicatorProps } from './types.ts'\n\n/**\n * @internal\n */\nexport function useDropIndicator(\n host: ConnectableElement,\n { state }: SetupOptions<DropIndicatorProps, DropIndicatorEvents>,\n): void {\n type DropIndicatorContext = ShowHandlerOptions | null\n const context = createSignal<DropIndicatorContext>(null)\n\n const extension = defineDropIndicator({\n onShow: (options) => context.set(options),\n onHide: () => context.set(null),\n })\n\n useEditorExtension(host, state.editor, extension)\n\n const line = createComputed(() => context.get()?.line)\n const scrolling = useScrolling(host)\n const presence = createComputed(() => {\n return !!context.get() && !scrolling.get()\n })\n usePresence(host, presence)\n\n useEffect(\n host,\n () => {\n const lineValue = line.get()\n const lineWidth = state.width.get()\n\n if (!lineValue) return\n\n const { p1: { x: x1, y: y1 }, p2: { x: x2, y: y2 } } = lineValue\n const horizontal = y1 === y2\n\n let width: number\n let height: number\n let top: number = y1\n let left: number = x1\n\n if (horizontal) {\n width = x2 - x1\n height = lineWidth\n top -= lineWidth / 2\n } else {\n width = lineWidth\n height = y2 - y1\n left -= lineWidth / 2\n }\n\n top = Math.round(top)\n left = Math.round(left)\n\n assignStyles(host, {\n position: 'fixed',\n pointerEvents: 'none',\n width: `${width}px`,\n height: `${height}px`,\n transform: `translate(${left}px, ${top}px)`,\n left: '0px',\n top: '0px',\n })\n },\n )\n}\n","import type { EventDeclarations, PropDeclarations } from '@aria-ui/core'\nimport type { Editor } from '@prosekit/core'\n\nexport interface DropIndicatorProps {\n /**\n * The ProseKit editor instance.\n *\n * @default null\n * @hidden\n */\n editor: Editor | null\n\n /**\n * The line width in pixels.\n *\n * @default 2\n */\n width: number\n}\n\n/** @internal */\nexport const dropIndicatorProps: PropDeclarations<DropIndicatorProps> = Object.freeze({\n editor: { default: null },\n width: { default: 2 },\n})\n\nexport interface DropIndicatorEvents {\n}\n\n/** @internal */\nexport const dropIndicatorEvents: EventDeclarations<DropIndicatorEvents> = {}\n","import { defineCustomElement, registerCustomElement, type BaseElementConstructor } from \"@aria-ui/core\"\n\nimport { useDropIndicator } from \"./setup.ts\"\nimport { dropIndicatorEvents, dropIndicatorProps, type DropIndicatorEvents, type DropIndicatorProps } from \"./types.ts\"\n\nconst DropIndicatorElementBase: BaseElementConstructor<DropIndicatorProps> = defineCustomElement<\n DropIndicatorProps,\n DropIndicatorEvents\n>({\n props: dropIndicatorProps,\n events: dropIndicatorEvents,\n setup: useDropIndicator,\n})\nclass DropIndicatorElement extends DropIndicatorElementBase {}\n\nregisterCustomElement('prosekit-drop-indicator', DropIndicatorElement)\n \nexport { DropIndicatorElement }\n"],"mappings":";;;;;;;;;;AAaA,SAAgB,iBACd,MACA,EAAE,SACI;CAEN,MAAM,UA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yB;AAE5D,sBAAsB,2BAA2B,qBAAqB"}
1
+ {"version":3,"file":"prosekit-web-drop-indicator.js","names":[],"sources":["../src/components/drop-indicator/drop-indicator/setup.ts","../src/components/drop-indicator/drop-indicator/types.ts","../src/components/drop-indicator/drop-indicator/element.gen.ts"],"sourcesContent":["import { createComputed, createSignal, useEffect, type ConnectableElement, type SetupOptions } from '@aria-ui/core'\nimport { usePresence } from '@aria-ui/presence'\nimport { defineDropIndicator, type ShowHandlerOptions } from '@prosekit/extensions/drop-indicator'\n\nimport { useEditorExtension } from '../../../hooks/use-editor-extension.ts'\nimport { useScrolling } from '../../../hooks/use-scrolling.ts'\nimport { assignStyles } from '../../../utils/assign-styles.ts'\n\nimport type { DropIndicatorEvents, DropIndicatorProps } from './types.ts'\n\n/**\n * @internal\n */\nexport function useDropIndicator(\n host: ConnectableElement,\n { state }: SetupOptions<DropIndicatorProps, DropIndicatorEvents>,\n): void {\n type DropIndicatorContext = ShowHandlerOptions | null\n const context = createSignal<DropIndicatorContext>(null)\n\n const extension = defineDropIndicator({\n onShow: (options) => context.set(options),\n onHide: () => context.set(null),\n })\n\n useEditorExtension(host, state.editor, extension)\n\n const line = createComputed(() => context.get()?.line)\n const scrolling = useScrolling(host)\n const presence = createComputed(() => {\n return !!context.get() && !scrolling.get()\n })\n usePresence(host, presence)\n\n useEffect(\n host,\n () => {\n const lineValue = line.get()\n const lineWidth = state.width.get()\n\n if (!lineValue) return\n\n const { p1: { x: x1, y: y1 }, p2: { x: x2, y: y2 } } = lineValue\n const horizontal = y1 === y2\n\n let width: number\n let height: number\n let top: number = y1\n let left: number = x1\n\n if (horizontal) {\n width = x2 - x1\n height = lineWidth\n top -= lineWidth / 2\n } else {\n width = lineWidth\n height = y2 - y1\n left -= lineWidth / 2\n }\n\n top = Math.round(top)\n left = Math.round(left)\n\n assignStyles(host, {\n position: 'fixed',\n pointerEvents: 'none',\n width: `${width}px`,\n height: `${height}px`,\n transform: `translate(${left}px, ${top}px)`,\n left: '0px',\n top: '0px',\n })\n },\n )\n}\n","import type { EventDeclarations, PropDeclarations } from '@aria-ui/core'\nimport type { Editor } from '@prosekit/core'\n\nexport interface DropIndicatorProps {\n /**\n * The ProseKit editor instance.\n *\n * @default null\n * @hidden\n */\n editor: Editor | null\n\n /**\n * The line width in pixels.\n *\n * @default 2\n */\n width: number\n}\n\n/** @internal */\nexport const dropIndicatorProps: PropDeclarations<DropIndicatorProps> = Object.freeze({\n editor: { default: null },\n width: { default: 2 },\n})\n\nexport interface DropIndicatorEvents {\n}\n\n/** @internal */\nexport const dropIndicatorEvents: EventDeclarations<DropIndicatorEvents> = {}\n","import { defineCustomElement, registerCustomElement, type BaseElementConstructor } from \"@aria-ui/core\"\n\nimport { useDropIndicator } from \"./setup.ts\"\nimport { dropIndicatorEvents, dropIndicatorProps, type DropIndicatorEvents, type DropIndicatorProps } from \"./types.ts\"\n\nconst DropIndicatorElementBase: BaseElementConstructor<DropIndicatorProps> = defineCustomElement<\n DropIndicatorProps,\n DropIndicatorEvents\n>({\n props: dropIndicatorProps,\n events: dropIndicatorEvents,\n setup: useDropIndicator,\n})\nclass DropIndicatorElement extends DropIndicatorElementBase {}\n\nregisterCustomElement('prosekit-drop-indicator', DropIndicatorElement)\n \nexport { DropIndicatorElement }\n"],"mappings":";;;;;;;;;AAaA,SAAgB,iBACd,MACA,EAAE,SACI;CAEN,MAAM,UAAU,aAAmC,KAAK;CAExD,MAAM,YAAY,oBAAoB;EACpC,SAAS,YAAY,QAAQ,IAAI,QAAQ;EACzC,cAAc,QAAQ,IAAI,KAAK;EAChC,CAAC;AAEF,oBAAmB,MAAM,MAAM,QAAQ,UAAU;CAEjD,MAAM,OAAO,qBAAqB,QAAQ,KAAK,EAAE,KAAK;CACtD,MAAM,YAAY,aAAa,KAAK;AAIpC,aAAY,MAHK,qBAAqB;AACpC,SAAO,CAAC,CAAC,QAAQ,KAAK,IAAI,CAAC,UAAU,KAAK;GAC1C,CACyB;AAE3B,WACE,YACM;EACJ,MAAM,YAAY,KAAK,KAAK;EAC5B,MAAM,YAAY,MAAM,MAAM,KAAK;AAEnC,MAAI,CAAC,UAAW;EAEhB,MAAM,EAAE,IAAI,EAAE,GAAG,IAAI,GAAG,MAAM,IAAI,EAAE,GAAG,IAAI,GAAG,SAAS;EACvD,MAAM,aAAa,OAAO;EAE1B,IAAI;EACJ,IAAI;EACJ,IAAI,MAAc;EAClB,IAAI,OAAe;AAEnB,MAAI,YAAY;AACd,WAAQ,KAAK;AACb,YAAS;AACT,UAAO,YAAY;SACd;AACL,WAAQ;AACR,YAAS,KAAK;AACd,WAAQ,YAAY;;AAGtB,QAAM,KAAK,MAAM,IAAI;AACrB,SAAO,KAAK,MAAM,KAAK;AAEvB,eAAa,MAAM;GACjB,UAAU;GACV,eAAe;GACf,OAAO,GAAG,MAAM;GAChB,QAAQ,GAAG,OAAO;GAClB,WAAW,aAAa,KAAK,MAAM,IAAI;GACvC,MAAM;GACN,KAAK;GACN,CAAC;GAEL;;;;;ACpDH,MAAa,qBAA2D,OAAO,OAAO;CACpF,QAAQ,EAAE,SAAS,MAAM;CACzB,OAAO,EAAE,SAAS,GAAG;CACtB,CAAC;;AAMF,MAAa,sBAA8D,EAAE;;;ACzB7E,MAAM,2BAAuE,oBAG3E;CACA,OAAO;CACP,QAAQ;CACR,OAAO;CACR,CAAC;AACF,IAAM,uBAAN,cAAmC,yBAAyB;AAE5D,sBAAsB,2BAA2B,qBAAqB"}
@@ -1,10 +1,9 @@
1
- import { t as useEditorExtension } from "./use-editor-extension-B2WuUfnd.js";
1
+ import { t as useEditorExtension } from "./use-editor-extension.js";
2
2
  import { createComputed, createSignal, defineCustomElement, registerCustomElement, useAttribute, useEffect } from "@aria-ui/core";
3
3
  import { containsInlineNode, defineFocusChangeHandler, defineKeymap, defineUpdateHandler, isInCodeBlock, isTextSelection } from "@prosekit/core";
4
4
  import { useOverlayPositionerState } from "@aria-ui/overlay/elements";
5
5
  import { usePresence } from "@aria-ui/presence";
6
6
  import { overlayPositionerEvents as overlayPositionerEvents$1, overlayPositionerProps as overlayPositionerProps$1 } from "@aria-ui/overlay";
7
-
8
7
  //#region src/hooks/use-editor-focus-event.ts
9
8
  /**
10
9
  * @internal
@@ -12,7 +11,6 @@ import { overlayPositionerEvents as overlayPositionerEvents$1, overlayPositioner
12
11
  function useEditorFocusChangeEvent(host, editor, handler) {
13
12
  useEditorExtension(host, editor, defineFocusChangeHandler(handler));
14
13
  }
15
-
16
14
  //#endregion
17
15
  //#region src/hooks/use-editor-update-event.ts
18
16
  /**
@@ -21,13 +19,11 @@ function useEditorFocusChangeEvent(host, editor, handler) {
21
19
  function useEditorUpdateEvent(host, editor, handler) {
22
20
  useEditorExtension(host, editor, defineUpdateHandler(handler));
23
21
  }
24
-
25
22
  //#endregion
26
23
  //#region src/hooks/use-keymap.ts
27
24
  function useKeymap(host, editor, keymap) {
28
25
  useEditorExtension(host, editor, defineKeymap(keymap));
29
26
  }
30
-
31
27
  //#endregion
32
28
  //#region src/components/inline-popover/inline-popover/virtual-selection-element.ts
33
29
  function getVirtualSelectionElement(view) {
@@ -61,7 +57,6 @@ function getInlineDecoration(view) {
61
57
  getClientRects: () => items.map((item) => item.getBoundingClientRect())
62
58
  };
63
59
  }
64
-
65
60
  //#endregion
66
61
  //#region src/components/inline-popover/inline-popover/setup.ts
67
62
  /**
@@ -110,7 +105,6 @@ function useInlinePopoverReference(host, editor) {
110
105
  });
111
106
  return reference;
112
107
  }
113
-
114
108
  //#endregion
115
109
  //#region src/components/inline-popover/inline-popover/types.ts
116
110
  /** @internal */
@@ -132,7 +126,6 @@ const inlinePopoverEvents = {
132
126
  ...overlayPositionerEvents$1,
133
127
  openChange: {}
134
128
  };
135
-
136
129
  //#endregion
137
130
  //#region src/components/inline-popover/inline-popover/element.gen.ts
138
131
  const InlinePopoverElementBase = defineCustomElement({
@@ -142,7 +135,7 @@ const InlinePopoverElementBase = defineCustomElement({
142
135
  });
143
136
  var InlinePopoverElement = class extends InlinePopoverElementBase {};
144
137
  registerCustomElement("prosekit-inline-popover", InlinePopoverElement);
145
-
146
138
  //#endregion
147
139
  export { InlinePopoverElement, inlinePopoverEvents, inlinePopoverProps, useInlinePopover };
140
+
148
141
  //# sourceMappingURL=prosekit-web-inline-popover.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"prosekit-web-inline-popover.js","names":["overlayPositionerProps","overlayPositionerEvents"],"sources":["../src/hooks/use-editor-focus-event.ts","../src/hooks/use-editor-update-event.ts","../src/hooks/use-keymap.ts","../src/components/inline-popover/inline-popover/virtual-selection-element.ts","../src/components/inline-popover/inline-popover/setup.ts","../src/components/inline-popover/inline-popover/types.ts","../src/components/inline-popover/inline-popover/element.gen.ts"],"sourcesContent":["import type { ConnectableElement, ReadonlySignal } from '@aria-ui/core'\nimport { defineFocusChangeHandler, type Editor, type FocusChangeHandler } from '@prosekit/core'\n\nimport { useEditorExtension } from './use-editor-extension.ts'\n\n/**\n * @internal\n */\nexport function useEditorFocusChangeEvent(\n host: ConnectableElement,\n editor: ReadonlySignal<Editor | null>,\n handler: FocusChangeHandler,\n): void {\n const extension = defineFocusChangeHandler(handler)\n useEditorExtension(host, editor, extension)\n}\n","import type { ConnectableElement, ReadonlySignal } 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: ConnectableElement,\n editor: ReadonlySignal<Editor | null>,\n handler: UpdateHandler,\n): void {\n const extension = defineUpdateHandler(handler)\n useEditorExtension(host, editor, extension)\n}\n","import type { ConnectableElement, ReadonlySignal } from '@aria-ui/core'\nimport { defineKeymap, type Editor, type Keymap } from '@prosekit/core'\n\nimport { useEditorExtension } from './use-editor-extension.ts'\n\nexport function useKeymap(\n host: ConnectableElement,\n editor: ReadonlySignal<Editor | null>,\n keymap: Keymap,\n): void {\n const extension = defineKeymap(keymap)\n useEditorExtension(host, editor, extension)\n}\n","import type { ReferenceElement } from '@floating-ui/dom'\nimport { containsInlineNode, isInCodeBlock, isTextSelection } from '@prosekit/core'\nimport type { EditorView } from '@prosekit/pm/view'\n\nexport function getVirtualSelectionElement(\n view: EditorView,\n): ReferenceElement | undefined {\n if (typeof window === 'undefined' || view.isDestroyed) {\n return\n }\n\n const selection = view.state.selection\n\n if (\n !selection.empty\n && !isInCodeBlock(selection)\n && isTextSelection(selection)\n && containsInlineNode(view.state.doc, selection.from, selection.to)\n ) {\n return getDomDecoration(view) || getInlineDecoration(view)\n }\n}\n\nfunction getDomDecoration(view: EditorView): ReferenceElement | undefined {\n const range = getDomRange(view)\n if (range) {\n // To get it work properly in Safari, we cannot return the range directly.\n // We have to return a contextElement.\n return {\n contextElement: view.dom,\n getBoundingClientRect: () => range.getBoundingClientRect(),\n getClientRects: () => range.getClientRects(),\n }\n }\n}\n\nfunction getDomRange(view: EditorView): Range | undefined {\n const win = view.dom.ownerDocument.defaultView\n const selection = win?.getSelection()\n if (!selection || selection.isCollapsed) {\n return\n }\n\n const range = typeof selection.rangeCount === 'number'\n && selection.rangeCount > 0\n && selection.getRangeAt(0)\n\n if (!range) {\n return\n }\n\n return range\n}\n\nfunction getInlineDecoration(view: EditorView): ReferenceElement | undefined {\n const match = view.dom.querySelectorAll('.prosekit-virtual-selection')\n\n if (match.length === 0) {\n return\n }\n if (match.length === 1) {\n return match[0]\n }\n\n const items = Array.from(match)\n return {\n contextElement: items[0],\n getBoundingClientRect: () => items[0].getBoundingClientRect(),\n getClientRects: () => items.map((item) => item.getBoundingClientRect()),\n }\n}\n","import {\n createComputed,\n createSignal,\n useAttribute,\n useEffect,\n type ConnectableElement,\n type ReadonlySignal,\n type SetupOptions,\n} from '@aria-ui/core'\nimport { useOverlayPositionerState } from '@aria-ui/overlay/elements'\nimport { usePresence } from '@aria-ui/presence'\nimport type { ReferenceElement } from '@floating-ui/dom'\nimport type { Editor } from '@prosekit/core'\nimport type { Selection } from '@prosekit/pm/state'\n\nimport { useEditorFocusChangeEvent } from '../../../hooks/use-editor-focus-event.ts'\nimport { useEditorUpdateEvent } from '../../../hooks/use-editor-update-event.ts'\nimport { useKeymap } from '../../../hooks/use-keymap.ts'\n\nimport type { InlinePopoverEvents, InlinePopoverProps } from './types.ts'\nimport { getVirtualSelectionElement } from './virtual-selection-element.ts'\n\n/**\n * @internal\n */\nexport function useInlinePopover(\n host: ConnectableElement,\n { state, emit }: SetupOptions<InlinePopoverProps, InlinePopoverEvents>,\n): void {\n const { editor, defaultOpen, open, ...overlayState } = state\n\n const reference = useInlinePopoverReference(host, editor)\n const hasReference = createComputed(() => !!reference.get())\n\n useEffect(host, () => {\n const hasReferenceValue = hasReference.get()\n const defaultOpenValue = defaultOpen.peek()\n const openValue = open.peek()\n\n if (defaultOpenValue || openValue) {\n emit('openChange', hasReferenceValue)\n }\n })\n\n useEffect(host, () => {\n const hasReferenceValue = hasReference.get()\n const defaultOpenValue = defaultOpen.peek()\n\n if (hasReferenceValue && defaultOpenValue) {\n open.set(true)\n } else if (!hasReferenceValue) {\n open.set(false)\n }\n })\n\n useKeymap(host, editor, {\n Escape: () => {\n if (!state.dismissOnEscape.peek() || !open.peek()) {\n return false\n }\n open.set(false)\n emit('openChange', false)\n return true\n },\n })\n\n useOverlayPositionerState(host, overlayState, { reference })\n\n useAttribute(host, 'data-state', () => (open.get() ? 'open' : 'closed'))\n usePresence(host, open)\n}\n\nfunction useInlinePopoverReference(\n host: ConnectableElement,\n editor: ReadonlySignal<Editor | null>,\n) {\n const reference = createSignal<ReferenceElement | null>(null)\n let editorFocused = false\n\n useEditorFocusChangeEvent(host, editor, (focus) => {\n editorFocused = focus\n })\n\n let prevSelection: Selection | undefined\n\n useEditorUpdateEvent(host, editor, (view) => {\n const isPopoverFocused = !editorFocused && host.contains(host.ownerDocument.activeElement)\n\n if (isPopoverFocused) {\n return\n }\n\n const { selection } = view.state\n const selectionUnchanged = prevSelection?.eq(selection)\n prevSelection = selection\n\n // Skip reference update if only the document content has changed, not the\n // selection itself.\n //\n // Example: If the user selects text and then applies mark bold using the\n // popover, the selection may widen, but we don't want to reposition the\n // popover.\n if (selectionUnchanged) {\n return\n }\n\n reference.set(getVirtualSelectionElement(view) || null)\n })\n\n return reference\n}\n","import type { EventDeclarations, PropDeclarations } from '@aria-ui/core'\nimport {\n overlayPositionerEvents,\n overlayPositionerProps,\n type OverlayPositionerEvents,\n type OverlayPositionerProps,\n} from '@aria-ui/overlay'\nimport type { Editor } from '@prosekit/core'\n\nexport interface InlinePopoverProps extends\n Omit<\n OverlayPositionerProps,\n 'placement' | 'offset' | 'hide' | 'overlap' | 'inline' | 'overflowPadding'\n >\n{\n /**\n * The ProseKit editor instance.\n *\n * @default null\n * @hidden\n */\n editor: Editor | null\n\n /**\n * Whether the popover is open by default when some inline content is\n * selected.\n *\n * When `defaultOpen` is true, the popover will open or close based on the\n * inline selection. When `defaultOpen` is false, the popover will never be\n * opened unless the `open` prop is true.\n *\n * @default true\n */\n defaultOpen: boolean\n\n /**\n * Whether the popover is open.\n *\n * Notice that the popover will be always hidden if the inline selection is\n * empty.\n *\n * @default false\n */\n open: boolean\n\n /**\n * Whether the inline popover should be dismissed when the editor receives an\n * Escape key press.\n *\n * @default true\n */\n dismissOnEscape: boolean\n\n /**\n * @default \"top\"\n */\n placement: OverlayPositionerProps['placement']\n\n /**\n * @default 12\n */\n offset: OverlayPositionerProps['offset']\n\n /**\n * @default true\n */\n hide: OverlayPositionerProps['hide']\n\n /**\n * @default true\n */\n overlap: OverlayPositionerProps['overlap']\n\n /**\n * @default true\n */\n inline: OverlayPositionerProps['inline']\n\n /**\n * @default 8\n */\n overflowPadding: OverlayPositionerProps['overflowPadding']\n}\n\n/** @internal */\nexport const inlinePopoverProps: PropDeclarations<InlinePopoverProps> = Object.freeze({\n ...overlayPositionerProps,\n editor: { default: null },\n defaultOpen: { default: true },\n open: { default: false },\n dismissOnEscape: { default: true },\n\n placement: { default: 'top' },\n offset: { default: 12 },\n hide: { default: true },\n overlap: { default: true },\n inline: { default: true },\n overflowPadding: { default: 8 },\n})\n\nexport interface InlinePopoverEvents extends OverlayPositionerEvents {\n /**\n * Fired when the open state changes.\n */\n openChange: CustomEvent<boolean>\n}\n\n/** @internal */\nexport const inlinePopoverEvents: EventDeclarations<InlinePopoverEvents> = {\n ...overlayPositionerEvents,\n openChange: {},\n}\n","import { defineCustomElement, registerCustomElement, type BaseElementConstructor } from \"@aria-ui/core\"\n\nimport { useInlinePopover } from \"./setup.ts\"\nimport { inlinePopoverEvents, inlinePopoverProps, type InlinePopoverEvents, type InlinePopoverProps } from \"./types.ts\"\n\nconst InlinePopoverElementBase: BaseElementConstructor<InlinePopoverProps> = defineCustomElement<\n InlinePopoverProps,\n InlinePopoverEvents\n>({\n props: inlinePopoverProps,\n events: inlinePopoverEvents,\n setup: useInlinePopover,\n})\nclass InlinePopoverElement extends InlinePopoverElementBase {}\n\nregisterCustomElement('prosekit-inline-popover', InlinePopoverElement)\n \nexport { InlinePopoverElement }\n"],"mappings":";;;;;;;;;;;AAQA,SAAgB,0BACd,MACA,QACA,SACM;AAEN,oBAAmB,MAAM,QADP,yBAAyB,QAAQ,CACR;;;;;;;;ACN7C,SAAgB,qBACd,MACA,QACA,SACM;AAEN,oBAAmB,MAAM,QADP,oBAAoB,QAAQ,CACH;;;;;ACT7C,SAAgB,UACd,MACA,QACA,QACM;AAEN,oBAAmB,MAAM,QADP,aAAa,OAAO,CACK;;;;;ACP7C,SAAgB,2BACd,MAC8B;AAC9B,KAAI,OAAO,WAAW,eAAe,KAAK,YACxC;CAGF,MAAM,YAAY,KAAK,MAAM;AAE7B,KACE,CAAC,UAAU,SACR,CAAC,cAAc,UAAU,IACzB,gBAAgB,UAAU,IAC1B,mBAAmB,KAAK,MAAM,KAAK,UAAU,MAAM,UAAU,GAAG,CAEnE,QAAO,iBAAiB,KAAK,IAAI,oBAAoB,KAAK;;AAI9D,SAAS,iBAAiB,MAAgD;CACxE,MAAM,QAAQ,YAAY,KAAK;AAC/B,KAAI,MAGF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AA2B,qBAAqB"}
1
+ {"version":3,"file":"prosekit-web-inline-popover.js","names":["overlayPositionerProps","overlayPositionerEvents"],"sources":["../src/hooks/use-editor-focus-event.ts","../src/hooks/use-editor-update-event.ts","../src/hooks/use-keymap.ts","../src/components/inline-popover/inline-popover/virtual-selection-element.ts","../src/components/inline-popover/inline-popover/setup.ts","../src/components/inline-popover/inline-popover/types.ts","../src/components/inline-popover/inline-popover/element.gen.ts"],"sourcesContent":["import type { ConnectableElement, ReadonlySignal } from '@aria-ui/core'\nimport { defineFocusChangeHandler, type Editor, type FocusChangeHandler } from '@prosekit/core'\n\nimport { useEditorExtension } from './use-editor-extension.ts'\n\n/**\n * @internal\n */\nexport function useEditorFocusChangeEvent(\n host: ConnectableElement,\n editor: ReadonlySignal<Editor | null>,\n handler: FocusChangeHandler,\n): void {\n const extension = defineFocusChangeHandler(handler)\n useEditorExtension(host, editor, extension)\n}\n","import type { ConnectableElement, ReadonlySignal } 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: ConnectableElement,\n editor: ReadonlySignal<Editor | null>,\n handler: UpdateHandler,\n): void {\n const extension = defineUpdateHandler(handler)\n useEditorExtension(host, editor, extension)\n}\n","import type { ConnectableElement, ReadonlySignal } from '@aria-ui/core'\nimport { defineKeymap, type Editor, type Keymap } from '@prosekit/core'\n\nimport { useEditorExtension } from './use-editor-extension.ts'\n\nexport function useKeymap(\n host: ConnectableElement,\n editor: ReadonlySignal<Editor | null>,\n keymap: Keymap,\n): void {\n const extension = defineKeymap(keymap)\n useEditorExtension(host, editor, extension)\n}\n","import type { ReferenceElement } from '@floating-ui/dom'\nimport { containsInlineNode, isInCodeBlock, isTextSelection } from '@prosekit/core'\nimport type { EditorView } from '@prosekit/pm/view'\n\nexport function getVirtualSelectionElement(\n view: EditorView,\n): ReferenceElement | undefined {\n if (typeof window === 'undefined' || view.isDestroyed) {\n return\n }\n\n const selection = view.state.selection\n\n if (\n !selection.empty\n && !isInCodeBlock(selection)\n && isTextSelection(selection)\n && containsInlineNode(view.state.doc, selection.from, selection.to)\n ) {\n return getDomDecoration(view) || getInlineDecoration(view)\n }\n}\n\nfunction getDomDecoration(view: EditorView): ReferenceElement | undefined {\n const range = getDomRange(view)\n if (range) {\n // To get it work properly in Safari, we cannot return the range directly.\n // We have to return a contextElement.\n return {\n contextElement: view.dom,\n getBoundingClientRect: () => range.getBoundingClientRect(),\n getClientRects: () => range.getClientRects(),\n }\n }\n}\n\nfunction getDomRange(view: EditorView): Range | undefined {\n const win = view.dom.ownerDocument.defaultView\n const selection = win?.getSelection()\n if (!selection || selection.isCollapsed) {\n return\n }\n\n const range = typeof selection.rangeCount === 'number'\n && selection.rangeCount > 0\n && selection.getRangeAt(0)\n\n if (!range) {\n return\n }\n\n return range\n}\n\nfunction getInlineDecoration(view: EditorView): ReferenceElement | undefined {\n const match = view.dom.querySelectorAll('.prosekit-virtual-selection')\n\n if (match.length === 0) {\n return\n }\n if (match.length === 1) {\n return match[0]\n }\n\n const items = Array.from(match)\n return {\n contextElement: items[0],\n getBoundingClientRect: () => items[0].getBoundingClientRect(),\n getClientRects: () => items.map((item) => item.getBoundingClientRect()),\n }\n}\n","import {\n createComputed,\n createSignal,\n useAttribute,\n useEffect,\n type ConnectableElement,\n type ReadonlySignal,\n type SetupOptions,\n} from '@aria-ui/core'\nimport { useOverlayPositionerState } from '@aria-ui/overlay/elements'\nimport { usePresence } from '@aria-ui/presence'\nimport type { ReferenceElement } from '@floating-ui/dom'\nimport type { Editor } from '@prosekit/core'\nimport type { Selection } from '@prosekit/pm/state'\n\nimport { useEditorFocusChangeEvent } from '../../../hooks/use-editor-focus-event.ts'\nimport { useEditorUpdateEvent } from '../../../hooks/use-editor-update-event.ts'\nimport { useKeymap } from '../../../hooks/use-keymap.ts'\n\nimport type { InlinePopoverEvents, InlinePopoverProps } from './types.ts'\nimport { getVirtualSelectionElement } from './virtual-selection-element.ts'\n\n/**\n * @internal\n */\nexport function useInlinePopover(\n host: ConnectableElement,\n { state, emit }: SetupOptions<InlinePopoverProps, InlinePopoverEvents>,\n): void {\n const { editor, defaultOpen, open, ...overlayState } = state\n\n const reference = useInlinePopoverReference(host, editor)\n const hasReference = createComputed(() => !!reference.get())\n\n useEffect(host, () => {\n const hasReferenceValue = hasReference.get()\n const defaultOpenValue = defaultOpen.peek()\n const openValue = open.peek()\n\n if (defaultOpenValue || openValue) {\n emit('openChange', hasReferenceValue)\n }\n })\n\n useEffect(host, () => {\n const hasReferenceValue = hasReference.get()\n const defaultOpenValue = defaultOpen.peek()\n\n if (hasReferenceValue && defaultOpenValue) {\n open.set(true)\n } else if (!hasReferenceValue) {\n open.set(false)\n }\n })\n\n useKeymap(host, editor, {\n Escape: () => {\n if (!state.dismissOnEscape.peek() || !open.peek()) {\n return false\n }\n open.set(false)\n emit('openChange', false)\n return true\n },\n })\n\n useOverlayPositionerState(host, overlayState, { reference })\n\n useAttribute(host, 'data-state', () => (open.get() ? 'open' : 'closed'))\n usePresence(host, open)\n}\n\nfunction useInlinePopoverReference(\n host: ConnectableElement,\n editor: ReadonlySignal<Editor | null>,\n) {\n const reference = createSignal<ReferenceElement | null>(null)\n let editorFocused = false\n\n useEditorFocusChangeEvent(host, editor, (focus) => {\n editorFocused = focus\n })\n\n let prevSelection: Selection | undefined\n\n useEditorUpdateEvent(host, editor, (view) => {\n const isPopoverFocused = !editorFocused && host.contains(host.ownerDocument.activeElement)\n\n if (isPopoverFocused) {\n return\n }\n\n const { selection } = view.state\n const selectionUnchanged = prevSelection?.eq(selection)\n prevSelection = selection\n\n // Skip reference update if only the document content has changed, not the\n // selection itself.\n //\n // Example: If the user selects text and then applies mark bold using the\n // popover, the selection may widen, but we don't want to reposition the\n // popover.\n if (selectionUnchanged) {\n return\n }\n\n reference.set(getVirtualSelectionElement(view) || null)\n })\n\n return reference\n}\n","import type { EventDeclarations, PropDeclarations } from '@aria-ui/core'\nimport {\n overlayPositionerEvents,\n overlayPositionerProps,\n type OverlayPositionerEvents,\n type OverlayPositionerProps,\n} from '@aria-ui/overlay'\nimport type { Editor } from '@prosekit/core'\n\nexport interface InlinePopoverProps extends\n Omit<\n OverlayPositionerProps,\n 'placement' | 'offset' | 'hide' | 'overlap' | 'inline' | 'overflowPadding'\n >\n{\n /**\n * The ProseKit editor instance.\n *\n * @default null\n * @hidden\n */\n editor: Editor | null\n\n /**\n * Whether the popover is open by default when some inline content is\n * selected.\n *\n * When `defaultOpen` is true, the popover will open or close based on the\n * inline selection. When `defaultOpen` is false, the popover will never be\n * opened unless the `open` prop is true.\n *\n * @default true\n */\n defaultOpen: boolean\n\n /**\n * Whether the popover is open.\n *\n * Notice that the popover will be always hidden if the inline selection is\n * empty.\n *\n * @default false\n */\n open: boolean\n\n /**\n * Whether the inline popover should be dismissed when the editor receives an\n * Escape key press.\n *\n * @default true\n */\n dismissOnEscape: boolean\n\n /**\n * @default \"top\"\n */\n placement: OverlayPositionerProps['placement']\n\n /**\n * @default 12\n */\n offset: OverlayPositionerProps['offset']\n\n /**\n * @default true\n */\n hide: OverlayPositionerProps['hide']\n\n /**\n * @default true\n */\n overlap: OverlayPositionerProps['overlap']\n\n /**\n * @default true\n */\n inline: OverlayPositionerProps['inline']\n\n /**\n * @default 8\n */\n overflowPadding: OverlayPositionerProps['overflowPadding']\n}\n\n/** @internal */\nexport const inlinePopoverProps: PropDeclarations<InlinePopoverProps> = Object.freeze({\n ...overlayPositionerProps,\n editor: { default: null },\n defaultOpen: { default: true },\n open: { default: false },\n dismissOnEscape: { default: true },\n\n placement: { default: 'top' },\n offset: { default: 12 },\n hide: { default: true },\n overlap: { default: true },\n inline: { default: true },\n overflowPadding: { default: 8 },\n})\n\nexport interface InlinePopoverEvents extends OverlayPositionerEvents {\n /**\n * Fired when the open state changes.\n */\n openChange: CustomEvent<boolean>\n}\n\n/** @internal */\nexport const inlinePopoverEvents: EventDeclarations<InlinePopoverEvents> = {\n ...overlayPositionerEvents,\n openChange: {},\n}\n","import { defineCustomElement, registerCustomElement, type BaseElementConstructor } from \"@aria-ui/core\"\n\nimport { useInlinePopover } from \"./setup.ts\"\nimport { inlinePopoverEvents, inlinePopoverProps, type InlinePopoverEvents, type InlinePopoverProps } from \"./types.ts\"\n\nconst InlinePopoverElementBase: BaseElementConstructor<InlinePopoverProps> = defineCustomElement<\n InlinePopoverProps,\n InlinePopoverEvents\n>({\n props: inlinePopoverProps,\n events: inlinePopoverEvents,\n setup: useInlinePopover,\n})\nclass InlinePopoverElement extends InlinePopoverElementBase {}\n\nregisterCustomElement('prosekit-inline-popover', InlinePopoverElement)\n \nexport { InlinePopoverElement }\n"],"mappings":";;;;;;;;;;AAQA,SAAgB,0BACd,MACA,QACA,SACM;AAEN,oBAAmB,MAAM,QADP,yBAAyB,QAAQ,CACR;;;;;;;ACN7C,SAAgB,qBACd,MACA,QACA,SACM;AAEN,oBAAmB,MAAM,QADP,oBAAoB,QAAQ,CACH;;;;ACT7C,SAAgB,UACd,MACA,QACA,QACM;AAEN,oBAAmB,MAAM,QADP,aAAa,OAAO,CACK;;;;ACP7C,SAAgB,2BACd,MAC8B;AAC9B,KAAI,OAAO,WAAW,eAAe,KAAK,YACxC;CAGF,MAAM,YAAY,KAAK,MAAM;AAE7B,KACE,CAAC,UAAU,SACR,CAAC,cAAc,UAAU,IACzB,gBAAgB,UAAU,IAC1B,mBAAmB,KAAK,MAAM,KAAK,UAAU,MAAM,UAAU,GAAG,CAEnE,QAAO,iBAAiB,KAAK,IAAI,oBAAoB,KAAK;;AAI9D,SAAS,iBAAiB,MAAgD;CACxE,MAAM,QAAQ,YAAY,KAAK;AAC/B,KAAI,MAGF,QAAO;EACL,gBAAgB,KAAK;EACrB,6BAA6B,MAAM,uBAAuB;EAC1D,sBAAsB,MAAM,gBAAgB;EAC7C;;AAIL,SAAS,YAAY,MAAqC;CAExD,MAAM,YADM,KAAK,IAAI,cAAc,aACZ,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WAAW,CAAC;AAE5D,cAAa,MAAM,oBAAqB,KAAK,KAAK,GAAG,SAAS,SAAU;AACxE,aAAY,MAAM,KAAK;;AAGzB,SAAS,0BACP,MACA,QACA;CACA,MAAM,YAAY,aAAsC,KAAK;CAC7D,IAAI,gBAAgB;AAEpB,2BAA0B,MAAM,SAAS,UAAU;AACjD,kBAAgB;GAChB;CAEF,IAAI;AAEJ,sBAAqB,MAAM,SAAS,SAAS;AAG3C,MAFyB,CAAC,iBAAiB,KAAK,SAAS,KAAK,cAAc,cAAc,CAGxF;EAGF,MAAM,EAAE,cAAc,KAAK;EAC3B,MAAM,qBAAqB,eAAe,GAAG,UAAU;AACvD,kBAAgB;AAQhB,MAAI,mBACF;AAGF,YAAU,IAAI,2BAA2B,KAAK,IAAI,KAAK;GACvD;AAEF,QAAO;;;;;ACxBT,MAAa,qBAA2D,OAAO,OAAO;CACpF,GAAGA;CACH,QAAQ,EAAE,SAAS,MAAM;CACzB,aAAa,EAAE,SAAS,MAAM;CAC9B,MAAM,EAAE,SAAS,OAAO;CACxB,iBAAiB,EAAE,SAAS,MAAM;CAElC,WAAW,EAAE,SAAS,OAAO;CAC7B,QAAQ,EAAE,SAAS,IAAI;CACvB,MAAM,EAAE,SAAS,MAAM;CACvB,SAAS,EAAE,SAAS,MAAM;CAC1B,QAAQ,EAAE,SAAS,MAAM;CACzB,iBAAiB,EAAE,SAAS,GAAG;CAChC,CAAC;;AAUF,MAAa,sBAA8D;CACzE,GAAGC;CACH,YAAY,EAAE;CACf;;;AC1GD,MAAM,2BAAuE,oBAG3E;CACA,OAAO;CACP,QAAQ;CACR,OAAO;CACR,CAAC;AACF,IAAM,uBAAN,cAAmC,yBAAyB;AAE5D,sBAAsB,2BAA2B,qBAAqB"}
@@ -1,6 +1,5 @@
1
1
  import { defineCustomElement, registerCustomElement } from "@aria-ui/core";
2
2
  import { popoverContentEvents, popoverContentProps, popoverRootEvents, popoverRootProps, popoverTriggerEvents, popoverTriggerProps, usePopoverContent, usePopoverRoot, usePopoverTrigger } from "@aria-ui/popover/elements";
3
-
4
3
  //#region src/components/popover/popover-content/element.gen.ts
5
4
  const PopoverContentElementBase = defineCustomElement({
6
5
  props: popoverContentProps,
@@ -9,7 +8,6 @@ const PopoverContentElementBase = defineCustomElement({
9
8
  });
10
9
  var PopoverContentElement = class extends PopoverContentElementBase {};
11
10
  registerCustomElement("prosekit-popover-content", PopoverContentElement);
12
-
13
11
  //#endregion
14
12
  //#region src/components/popover/popover-root/element.gen.ts
15
13
  const PopoverRootElementBase = defineCustomElement({
@@ -19,7 +17,6 @@ const PopoverRootElementBase = defineCustomElement({
19
17
  });
20
18
  var PopoverRootElement = class extends PopoverRootElementBase {};
21
19
  registerCustomElement("prosekit-popover-root", PopoverRootElement);
22
-
23
20
  //#endregion
24
21
  //#region src/components/popover/popover-trigger/element.gen.ts
25
22
  const PopoverTriggerElementBase = defineCustomElement({
@@ -29,7 +26,7 @@ const PopoverTriggerElementBase = defineCustomElement({
29
26
  });
30
27
  var PopoverTriggerElement = class extends PopoverTriggerElementBase {};
31
28
  registerCustomElement("prosekit-popover-trigger", PopoverTriggerElement);
32
-
33
29
  //#endregion
34
30
  export { PopoverContentElement, PopoverRootElement, PopoverTriggerElement, popoverContentEvents, popoverContentProps, popoverRootEvents, popoverRootProps, popoverTriggerEvents, popoverTriggerProps, usePopoverContent, usePopoverRoot, usePopoverTrigger };
31
+
35
32
  //# sourceMappingURL=prosekit-web-popover.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"prosekit-web-popover.js","names":[],"sources":["../src/components/popover/popover-content/element.gen.ts","../src/components/popover/popover-root/element.gen.ts","../src/components/popover/popover-trigger/element.gen.ts"],"sourcesContent":["import { defineCustomElement, registerCustomElement, type BaseElementConstructor } from \"@aria-ui/core\"\n\nimport { usePopoverContent } from \"./setup.ts\"\nimport { popoverContentEvents, popoverContentProps, type PopoverContentEvents, type PopoverContentProps } from \"./types.ts\"\n\nconst PopoverContentElementBase: BaseElementConstructor<PopoverContentProps> = defineCustomElement<\n PopoverContentProps,\n PopoverContentEvents\n>({\n props: popoverContentProps,\n events: popoverContentEvents,\n setup: usePopoverContent,\n})\nclass PopoverContentElement extends PopoverContentElementBase {}\n\nregisterCustomElement('prosekit-popover-content', PopoverContentElement)\n \nexport { PopoverContentElement }\n","import { defineCustomElement, registerCustomElement, type BaseElementConstructor } from \"@aria-ui/core\"\n\nimport { usePopoverRoot } from \"./setup.ts\"\nimport { popoverRootEvents, popoverRootProps, type PopoverRootEvents, type PopoverRootProps } from \"./types.ts\"\n\nconst PopoverRootElementBase: BaseElementConstructor<PopoverRootProps> = defineCustomElement<\n PopoverRootProps,\n PopoverRootEvents\n>({\n props: popoverRootProps,\n events: popoverRootEvents,\n setup: usePopoverRoot,\n})\nclass PopoverRootElement extends PopoverRootElementBase {}\n\nregisterCustomElement('prosekit-popover-root', PopoverRootElement)\n \nexport { PopoverRootElement }\n","import { defineCustomElement, registerCustomElement, type BaseElementConstructor } from \"@aria-ui/core\"\n\nimport { usePopoverTrigger } from \"./setup.ts\"\nimport { popoverTriggerEvents, popoverTriggerProps, type PopoverTriggerEvents, type PopoverTriggerProps } from \"./types.ts\"\n\nconst PopoverTriggerElementBase: BaseElementConstructor<PopoverTriggerProps> = defineCustomElement<\n PopoverTriggerProps,\n PopoverTriggerEvents\n>({\n props: popoverTriggerProps,\n events: popoverTriggerEvents,\n setup: usePopoverTrigger,\n})\nclass PopoverTriggerElement extends PopoverTriggerElementBase {}\n\nregisterCustomElement('prosekit-popover-trigger', PopoverTriggerElement)\n \nexport { PopoverTriggerElement }\n"],"mappings":";;;;AAKA,MAAM,4BAAyE,oBAG7E;CACA,OAAO;CACP,QAAQ;CACR,OAAO;CACR,CAAC;AACF,IAAM,wBAAN,cAAoC,0BAA0B;AAE9D,sBAAsB,4BAA4B,sBAAsB;;;;ACVxE,MAAM,yBAAmE,oBAGvE;CACA,OAAO;CACP,QAAQ;CACR,OAAO;CACR,CAAC;AACF,IAAM,qBAAN,cAAiC,uBAAuB;AAExD,sBAAsB,yBAAyB,mBAAmB;;;;ACVlE,MAAM,4BAAyE,oBAG7E;CACA,OAAO;CACP,QAAQ;CACR,OAAO;CACR,CAAC;AACF,IAAM,wBAAN,cAAoC,0BAA0B;AAE9D,sBAAsB,4BAA4B,sBAAsB"}
1
+ {"version":3,"file":"prosekit-web-popover.js","names":[],"sources":["../src/components/popover/popover-content/element.gen.ts","../src/components/popover/popover-root/element.gen.ts","../src/components/popover/popover-trigger/element.gen.ts"],"sourcesContent":["import { defineCustomElement, registerCustomElement, type BaseElementConstructor } from \"@aria-ui/core\"\n\nimport { usePopoverContent } from \"./setup.ts\"\nimport { popoverContentEvents, popoverContentProps, type PopoverContentEvents, type PopoverContentProps } from \"./types.ts\"\n\nconst PopoverContentElementBase: BaseElementConstructor<PopoverContentProps> = defineCustomElement<\n PopoverContentProps,\n PopoverContentEvents\n>({\n props: popoverContentProps,\n events: popoverContentEvents,\n setup: usePopoverContent,\n})\nclass PopoverContentElement extends PopoverContentElementBase {}\n\nregisterCustomElement('prosekit-popover-content', PopoverContentElement)\n \nexport { PopoverContentElement }\n","import { defineCustomElement, registerCustomElement, type BaseElementConstructor } from \"@aria-ui/core\"\n\nimport { usePopoverRoot } from \"./setup.ts\"\nimport { popoverRootEvents, popoverRootProps, type PopoverRootEvents, type PopoverRootProps } from \"./types.ts\"\n\nconst PopoverRootElementBase: BaseElementConstructor<PopoverRootProps> = defineCustomElement<\n PopoverRootProps,\n PopoverRootEvents\n>({\n props: popoverRootProps,\n events: popoverRootEvents,\n setup: usePopoverRoot,\n})\nclass PopoverRootElement extends PopoverRootElementBase {}\n\nregisterCustomElement('prosekit-popover-root', PopoverRootElement)\n \nexport { PopoverRootElement }\n","import { defineCustomElement, registerCustomElement, type BaseElementConstructor } from \"@aria-ui/core\"\n\nimport { usePopoverTrigger } from \"./setup.ts\"\nimport { popoverTriggerEvents, popoverTriggerProps, type PopoverTriggerEvents, type PopoverTriggerProps } from \"./types.ts\"\n\nconst PopoverTriggerElementBase: BaseElementConstructor<PopoverTriggerProps> = defineCustomElement<\n PopoverTriggerProps,\n PopoverTriggerEvents\n>({\n props: popoverTriggerProps,\n events: popoverTriggerEvents,\n setup: usePopoverTrigger,\n})\nclass PopoverTriggerElement extends PopoverTriggerElementBase {}\n\nregisterCustomElement('prosekit-popover-trigger', PopoverTriggerElement)\n \nexport { PopoverTriggerElement }\n"],"mappings":";;;AAKA,MAAM,4BAAyE,oBAG7E;CACA,OAAO;CACP,QAAQ;CACR,OAAO;CACR,CAAC;AACF,IAAM,wBAAN,cAAoC,0BAA0B;AAE9D,sBAAsB,4BAA4B,sBAAsB;;;ACVxE,MAAM,yBAAmE,oBAGvE;CACA,OAAO;CACP,QAAQ;CACR,OAAO;CACR,CAAC;AACF,IAAM,qBAAN,cAAiC,uBAAuB;AAExD,sBAAsB,yBAAyB,mBAAmB;;;ACVlE,MAAM,4BAAyE,oBAG7E;CACA,OAAO;CACP,QAAQ;CACR,OAAO;CACR,CAAC;AACF,IAAM,wBAAN,cAAoC,0BAA0B;AAE9D,sBAAsB,4BAA4B,sBAAsB"}
@@ -1 +1 @@
1
- {"version":3,"file":"prosekit-web-resizable.d.ts","names":[],"sources":["../src/components/resizable/resizable-handle/types.ts","../src/components/resizable/resizable-handle/element.gen.ts","../src/components/resizable/resizable-handle/setup.ts","../src/components/resizable/resizable-root/types.ts","../src/components/resizable/resizable-root/element.gen.ts","../src/components/resizable/resizable-root/setup.ts"],"mappings":";;;UAEiB,oBAAA;;AAAjB;;;;EAME,QAAA;AAAA;;cAYW,oBAAA,EAAsB,gBAAA,CAAiB,oBAAA;;UAKnC,qBAAA;;cAGJ,qBAAA,EAAuB,iBAAA,CAAkB,qBAAA;;;cCvBhD,0BAAA,EAA4B,sBAAA,CAAuB,oBAAA;AAAA,cAQnD,sBAAA,SAA+B,0BAAA;;;;ADXrC;;iBEgBgB,kBAAA,CACd,IAAA,EAAM,kBAAA;EACJ;AAAA;EAAW,KAAA,EAAO,WAAA,CAAY,oBAAA;AAAA;;;UClBjB,kBAAA;EACf,KAAA;EACA,MAAA;EACA,WAAA;AAAA;;cAIW,kBAAA,EAAoB,gBAAA,CAAiB,kBAAA;AAAA,UAMjC,mBAAA;EACf,WAAA,EAAa,WAAA;IAAc,KAAA;IAAe,MAAA;EAAA;EAC1C,SAAA,EAAW,WAAA;IAAc,KAAA;IAAe,MAAA;EAAA;AAAA;AHW1C;AAAA,cGPa,mBAAA,EAAqB,iBAAA,CAAkB,mBAAA;;;cChB9C,wBAAA,EAA0B,sBAAA,CAAuB,kBAAA;AAAA,cAQjD,oBAAA,SAA6B,wBAAA;;;;AJXnC;;iBKegB,gBAAA,CACd,IAAA,EAAM,kBAAA;EACJ,KAAA;EAAO;AAAA,GAAQ,YAAA,CAAa,kBAAA,EAAoB,mBAAA"}
1
+ {"version":3,"file":"prosekit-web-resizable.d.ts","names":[],"sources":["../src/components/resizable/resizable-handle/types.ts","../src/components/resizable/resizable-handle/element.gen.ts","../src/components/resizable/resizable-handle/setup.ts","../src/components/resizable/resizable-root/types.ts","../src/components/resizable/resizable-root/element.gen.ts","../src/components/resizable/resizable-root/setup.ts"],"mappings":";;;UAEiB,oBAAA;;AAAjB;;;;EAME,QAAA;AAAA;;cAYW,oBAAA,EAAsB,gBAAA,CAAiB,oBAAA;;UAKnC,qBAAA;;cAGJ,qBAAA,EAAuB,iBAAA,CAAkB,qBAAA;;;cCvBhD,0BAAA,EAA4B,sBAAA,CAAuB,oBAAA;AAAA,cAQnD,sBAAA,SAA+B,0BAAA;;;;ADXrC;;iBEgBgB,kBAAA,CACd,IAAA,EAAM,kBAAA;EACJ;AAAA;EAAW,KAAA,EAAO,WAAA,CAAY,oBAAA;AAAA;;;UChBjB,kBAAA;EACf,KAAA;EACA,MAAA;EACA,WAAA;AAAA;;cAqBW,kBAAA,EAAoB,gBAAA,CAAiB,kBAAA;AAAA,UAqBjC,mBAAA;EACf,WAAA,EAAa,WAAA;IAAc,KAAA;IAAe,MAAA;EAAA;EAC1C,SAAA,EAAW,WAAA;IAAc,KAAA;IAAe,MAAA;EAAA;AAAA;AHvB1C;AAAA,cG2Ba,mBAAA,EAAqB,iBAAA,CAAkB,mBAAA;;;cClD9C,wBAAA,EAA0B,sBAAA,CAAuB,kBAAA;AAAA,cAQjD,oBAAA,SAA6B,wBAAA;;;;AJXnC;;iBKegB,gBAAA,CACd,IAAA,EAAM,kBAAA;EACJ,KAAA;EAAO;AAAA,GAAQ,YAAA,CAAa,kBAAA,EAAoB,mBAAA"}
@@ -1,6 +1,5 @@
1
1
  import { createContext, createSignal, defineCustomElement, registerCustomElement, useAttribute, useEffect } from "@aria-ui/core";
2
2
  import { getWindow } from "@ocavue/utils";
3
-
4
3
  //#region src/components/resizable/context.ts
5
4
  /**
6
5
  * @internal
@@ -14,13 +13,11 @@ const onResizeStartContext = createContext("prosekit/resizable/onResizeStart", n
14
13
  * @internal
15
14
  */
16
15
  const onResizeEndContext = createContext("prosekit/resizable/onResizeEnd", null);
17
-
18
16
  //#endregion
19
17
  //#region src/utils/is-finite-positive-number.ts
20
18
  function isFinitePositiveNumber(value) {
21
19
  return typeof value === "number" && Number.isFinite(value) && value > 0;
22
20
  }
23
-
24
21
  //#endregion
25
22
  //#region src/components/resizable/resizable-handle/calc-resize.ts
26
23
  function calcResize(position, w, h, dx, dy, aspectRatio) {
@@ -93,7 +90,6 @@ const calcLeftResize = (w, h, dx, dy, r) => {
93
90
  function clamp([w, h]) {
94
91
  return [Math.max(w, 1), Math.max(h, 1)];
95
92
  }
96
-
97
93
  //#endregion
98
94
  //#region src/components/resizable/resizable-handle/setup.ts
99
95
  /**
@@ -150,14 +146,12 @@ function useResizableHandleState(host, state, context) {
150
146
  };
151
147
  });
152
148
  }
153
-
154
149
  //#endregion
155
150
  //#region src/components/resizable/resizable-handle/types.ts
156
151
  /** @internal */
157
152
  const resizableHandleProps = { position: { default: "bottom-right" } };
158
153
  /** @internal */
159
154
  const resizableHandleEvents = {};
160
-
161
155
  //#endregion
162
156
  //#region src/components/resizable/resizable-handle/element.gen.ts
163
157
  const ResizableHandleElementBase = defineCustomElement({
@@ -167,7 +161,6 @@ const ResizableHandleElementBase = defineCustomElement({
167
161
  });
168
162
  var ResizableHandleElement = class extends ResizableHandleElementBase {};
169
163
  registerCustomElement("prosekit-resizable-handle", ResizableHandleElement);
170
-
171
164
  //#endregion
172
165
  //#region src/components/resizable/resizable-root/setup.ts
173
166
  /**
@@ -219,21 +212,45 @@ function updateResizableRootStyles(host, width, height, aspectRatio) {
219
212
  else if (height && height > 0 && aspectRatio <= 1) host.style.width = "min-content";
220
213
  }
221
214
  }
222
-
223
215
  //#endregion
224
216
  //#region src/components/resizable/resizable-root/types.ts
217
+ function fromNumberAttribute(value) {
218
+ if (typeof value === "string") {
219
+ const number = Number.parseFloat(value);
220
+ if (isFinitePositiveNumber(number)) return number;
221
+ }
222
+ return null;
223
+ }
224
+ function toNumberAttribute(value) {
225
+ if (typeof value === "number") return `${value}`;
226
+ return null;
227
+ }
225
228
  /** @internal */
226
229
  const resizableRootProps = {
227
- width: { default: null },
228
- height: { default: null },
229
- aspectRatio: { default: null }
230
+ width: {
231
+ default: null,
232
+ attribute: "data-width",
233
+ fromAttribute: fromNumberAttribute,
234
+ toAttribute: toNumberAttribute
235
+ },
236
+ height: {
237
+ default: null,
238
+ attribute: "data-height",
239
+ fromAttribute: fromNumberAttribute,
240
+ toAttribute: toNumberAttribute
241
+ },
242
+ aspectRatio: {
243
+ default: null,
244
+ attribute: "data-aspect-ratio",
245
+ fromAttribute: fromNumberAttribute,
246
+ toAttribute: toNumberAttribute
247
+ }
230
248
  };
231
249
  /** @internal */
232
250
  const resizableRootEvents = {
233
251
  resizeStart: {},
234
252
  resizeEnd: {}
235
253
  };
236
-
237
254
  //#endregion
238
255
  //#region src/components/resizable/resizable-root/element.gen.ts
239
256
  const ResizableRootElementBase = defineCustomElement({
@@ -243,7 +260,7 @@ const ResizableRootElementBase = defineCustomElement({
243
260
  });
244
261
  var ResizableRootElement = class extends ResizableRootElementBase {};
245
262
  registerCustomElement("prosekit-resizable-root", ResizableRootElement);
246
-
247
263
  //#endregion
248
264
  export { ResizableHandleElement, ResizableRootElement, resizableHandleEvents, resizableHandleProps, resizableRootEvents, resizableRootProps, useResizableHandle, useResizableRoot };
265
+
249
266
  //# sourceMappingURL=prosekit-web-resizable.js.map