@prosekit/web 0.8.0-beta.5 → 0.8.0-beta.6
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.
- package/dist/{prosekit-web-autocomplete.d.ts → autocomplete.d.ts} +1 -1
- package/dist/autocomplete.d.ts.map +1 -0
- package/dist/{prosekit-web-autocomplete.js → autocomplete.js} +1 -1
- package/dist/autocomplete.js.map +1 -0
- package/dist/{prosekit-web-block-handle.d.ts → block-handle.d.ts} +1 -1
- package/dist/block-handle.d.ts.map +1 -0
- package/dist/{prosekit-web-block-handle.js → block-handle.js} +1 -1
- package/dist/block-handle.js.map +1 -0
- package/dist/{prosekit-web-drop-indicator.d.ts → drop-indicator.d.ts} +1 -1
- package/dist/drop-indicator.d.ts.map +1 -0
- package/dist/{prosekit-web-drop-indicator.js → drop-indicator.js} +1 -1
- package/dist/drop-indicator.js.map +1 -0
- package/dist/{prosekit-web.d.ts → index.d.ts} +1 -1
- package/dist/index.d.ts.map +1 -0
- package/dist/{prosekit-web.js → index.js} +1 -1
- package/dist/index.js.map +1 -0
- package/dist/{prosekit-web-inline-popover.d.ts → inline-popover.d.ts} +1 -1
- package/dist/inline-popover.d.ts.map +1 -0
- package/dist/{prosekit-web-inline-popover.js → inline-popover.js} +1 -1
- package/dist/inline-popover.js.map +1 -0
- package/dist/{prosekit-web-menu.d.ts → menu.d.ts} +1 -1
- package/dist/menu.d.ts.map +1 -0
- package/dist/{prosekit-web-menu.js → menu.js} +1 -1
- package/dist/menu.js.map +1 -0
- package/dist/{prosekit-web-popover.d.ts → popover.d.ts} +1 -1
- package/dist/popover.d.ts.map +1 -0
- package/dist/{prosekit-web-popover.js → popover.js} +1 -1
- package/dist/popover.js.map +1 -0
- package/dist/{prosekit-web-resizable.d.ts → resizable.d.ts} +1 -1
- package/dist/resizable.d.ts.map +1 -0
- package/dist/{prosekit-web-resizable.js → resizable.js} +1 -1
- package/dist/resizable.js.map +1 -0
- package/dist/{prosekit-web-table-handle.d.ts → table-handle.d.ts} +1 -1
- package/dist/table-handle.d.ts.map +1 -0
- package/dist/{prosekit-web-table-handle.js → table-handle.js} +1 -1
- package/dist/table-handle.js.map +1 -0
- package/dist/{prosekit-web-tooltip.d.ts → tooltip.d.ts} +1 -1
- package/dist/tooltip.d.ts.map +1 -0
- package/dist/{prosekit-web-tooltip.js → tooltip.js} +1 -1
- package/dist/tooltip.js.map +1 -0
- package/package.json +39 -56
- package/dist/prosekit-web-autocomplete.d.ts.map +0 -1
- package/dist/prosekit-web-autocomplete.js.map +0 -1
- package/dist/prosekit-web-block-handle.d.ts.map +0 -1
- package/dist/prosekit-web-block-handle.js.map +0 -1
- package/dist/prosekit-web-drop-indicator.d.ts.map +0 -1
- package/dist/prosekit-web-drop-indicator.js.map +0 -1
- package/dist/prosekit-web-inline-popover.d.ts.map +0 -1
- package/dist/prosekit-web-inline-popover.js.map +0 -1
- package/dist/prosekit-web-menu.d.ts.map +0 -1
- package/dist/prosekit-web-menu.js.map +0 -1
- package/dist/prosekit-web-popover.d.ts.map +0 -1
- package/dist/prosekit-web-popover.js.map +0 -1
- package/dist/prosekit-web-resizable.d.ts.map +0 -1
- package/dist/prosekit-web-resizable.js.map +0 -1
- package/dist/prosekit-web-table-handle.d.ts.map +0 -1
- package/dist/prosekit-web-table-handle.js.map +0 -1
- package/dist/prosekit-web-tooltip.d.ts.map +0 -1
- package/dist/prosekit-web-tooltip.js.map +0 -1
- package/dist/prosekit-web.d.ts.map +0 -1
- package/dist/prosekit-web.js.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"prosekit-web-drop-indicator.js","names":[],"sources":["../src/components/drop-indicator/drop-indicator.ts"],"sourcesContent":["import {\n computed,\n createSignal,\n defineCustomElement,\n defineProps,\n registerCustomElement,\n useEffect,\n type HostElement,\n type HostElementConstructor,\n type PropsDeclaration,\n type State,\n} from '@aria-ui/core'\nimport { usePresence } from '@aria-ui/utils'\nimport type { Editor } from '@prosekit/core'\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\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 DropIndicatorPropsDeclaration: PropsDeclaration<DropIndicatorProps> = /* @__PURE__ */ defineProps<DropIndicatorProps>({\n editor: {\n default: null,\n attribute: false,\n type: 'json',\n },\n width: {\n default: 2,\n attribute: 'width',\n type: 'number',\n },\n})\n\n/**\n * @internal\n */\nexport function setupDropIndicator(\n host: HostElement,\n props: State<DropIndicatorProps>,\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, props.editor.get, extension)\n\n const getLine = computed(() => context.get()?.line)\n const getScrolling = useScrolling(host)\n const getPresence = computed(() => !!context.get() && !getScrolling())\n usePresence(host, getPresence)\n\n useEffect(host, () => {\n const lineValue = getLine()\n const lineWidth = props.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\nconst DropIndicatorElementBase: HostElementConstructor<DropIndicatorProps> = defineCustomElement(\n setupDropIndicator,\n DropIndicatorPropsDeclaration,\n)\n\n/**\n * `<prosekit-drop-indicator>` custom element.\n *\n * Properties: {@link DropIndicatorProps}\n */\nexport class DropIndicatorElement extends DropIndicatorElementBase {}\n\n/**\n * @internal\n */\nexport function registerDropIndicatorElement(): void {\n registerCustomElement('prosekit-drop-indicator', DropIndicatorElement)\n}\n"],"mappings":";;;;;;AAsCA,MAAa,gCAAsF,4BAAgC;CACjI,QAAQ;EACN,SAAS;EACT,WAAW;EACX,MAAM;EACP;CACD,OAAO;EACL,SAAS;EACT,WAAW;EACX,MAAM;EACP;CACF,CAAC;;;;AAKF,SAAgB,mBACd,MACA,OACM;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,OAAO,KAAK,UAAU;CAErD,MAAM,UAAU,eAAe,QAAQ,KAAK,EAAE,KAAK;CACnD,MAAM,eAAe,aAAa,KAAK;AAEvC,aAAY,MADQ,eAAe,CAAC,CAAC,QAAQ,KAAK,IAAI,CAAC,cAAc,CAAC,CACxC;AAE9B,WAAU,YAAY;EACpB,MAAM,YAAY,SAAS;EAC3B,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;GACF;;AAGJ,MAAM,2BAAuE,oBAC3E,oBACA,8BACD;;;;;;AAOD,IAAa,uBAAb,cAA0C,yBAAyB;;;;AAKnE,SAAgB,+BAAqC;AACnD,uBAAsB,2BAA2B,qBAAqB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"prosekit-web-inline-popover.d.ts","names":[],"sources":["../src/components/inline-popover/inline-popover-popup.ts","../src/components/inline-popover/inline-popover-positioner.ts","../src/components/inline-popover/inline-popover-root.ts"],"mappings":";;;;;AAkBA;UAAiB,uBAAA,SAAgC,iBAAA;;cAGpC,kCAAA,EAAoC,gBAAA,CAAiB,uBAAA;AAAlE;AAAA,iBAGgB,uBAAA,CACd,IAAA,EAAM,WAAA,EACN,MAAA,EAAQ,KAAA,CAAM,uBAAA;AAAA,cAYV,6BAAA,EAA+B,sBAAA,CAAuB,uBAAA;;;AAd5D;;;;;;;;;cA8Ba,yBAAA,SAAkC,6BAAA;;iBAG/B,iCAAA,CAAA;;;AAvChB;UCFiB,4BAAA,SACf,IAAA,CACE,sBAAA;;;;ADGJ;;ECYE,SAAA,EAAW,sBAAA;EDZoC;;AAGjD;;;ECgBE,MAAA,EAAQ,sBAAA;EDdM;;;;;;ECsBd,IAAA,EAAM,sBAAA;EDtBQ;;;;AAUf;;ECoBC,KAAA;EDlBmC;;AAgBrC;;;;ECUE,OAAA,EAAS,sBAAA;EDPK;;;;;;ECed,MAAA,EAAQ,sBAAA;EAxDoC;;;;;EA+D5C,eAAA,EAAiB,sBAAA;AAAA;;cAIN,uCAAA,EAAyC,gBAAA,CAAiB,4BAAA;;iBAcvD,4BAAA,CACd,IAAA,EAAM,WAAA,EACN,KAAA,EAAO,KAAA,CAAM,4BAAA;AAAA,cAKT,kCAAA,EAAoC,sBAAA,CAAuB,4BAAA;;;;;;;;;;;;;;;;;;AArBjE;;cA6Ca,8BAAA,SAAuC,kCAAA;;iBAGpC,sCAAA,CAAA;ADjHhB;;;AAAA,UEMiB,sBAAA,SAA+B,gBAAA;EFNkB;AAGlE;;;;;EEUE,MAAA,EAAQ,MAAA;EFP6B;;;;;;EEerC,WAAA;EFdM;;;;;;EEsBN,eAAA;AAAA;;cAIW,iCAAA,EAAmC,gBAAA,CAAiB,sBAAA;;;AFGjE;UESiB,uBAAA;;;;EAIf,UAAA,EAAY,iBAAA;AAAA;;iBAIE,sBAAA,CACd,IAAA,EAAM,WAAA,EACN,KAAA,EAAO,KAAA,CAAM,sBAAA;AAAA,cAsCT,4BAAA,EAA8B,sBAAA,CAAuB,sBAAA;;AD/F3D;;;;;;cC2Ga,wBAAA,SAAiC,4BAAA;;iBAG9B,gCAAA,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"prosekit-web-inline-popover.js","names":[],"sources":["../src/components/inline-popover/store.ts","../src/components/inline-popover/inline-popover-popup.ts","../src/components/inline-popover/inline-popover-positioner.ts","../src/hooks/use-editor-focus-event.ts","../src/hooks/use-editor-update-event.ts","../src/hooks/use-keymap.ts","../src/components/inline-popover/virtual-selection-element.ts","../src/components/inline-popover/inline-popover-root.ts"],"sourcesContent":["import { createContext, type Context } from '@aria-ui/core'\nimport type { OverlayStore } from '@aria-ui/elements/overlay'\n\nexport const InlinePopoverStoreContext: Context<OverlayStore> = createContext<OverlayStore>(\n 'prosekit-inline-popover-store',\n)\n","import {\n computed,\n defineCustomElement,\n onMount,\n registerCustomElement,\n type HostElement,\n type HostElementConstructor,\n type PropsDeclaration,\n type State,\n} from '@aria-ui/core'\nimport { OverlayPopupPropsDeclaration, setupOverlayPopup, type OverlayPopupProps } from '@aria-ui/elements/overlay'\nimport { usePresence } from '@aria-ui/utils'\n\nimport { InlinePopoverStoreContext } from './store.ts'\n\n/**\n * @public\n */\nexport interface InlinePopoverPopupProps extends OverlayPopupProps {}\n\n/** @internal */\nexport const InlinePopoverPopupPropsDeclaration: PropsDeclaration<InlinePopoverPopupProps> = OverlayPopupPropsDeclaration\n\n/** @internal */\nexport function setupInlinePopoverPopup(\n host: HostElement,\n _props: State<InlinePopoverPopupProps>,\n): void {\n const getStore = InlinePopoverStoreContext.consume(host)\n setupOverlayPopup(host, getStore)\n const getOpen = computed(() => getStore()?.getIsOpen() ?? false)\n usePresence(host, getOpen)\n\n onMount(host, () => {\n host.role = 'dialog'\n })\n}\n\nconst InlinePopoverPopupElementBase: HostElementConstructor<InlinePopoverPopupProps> = defineCustomElement(\n setupInlinePopoverPopup,\n InlinePopoverPopupPropsDeclaration,\n)\n\n/**\n * `<prosekit-inline-popover-popup>` custom element.\n *\n * Properties: {@link InlinePopoverPopupProps}\n *\n * Data attributes:\n *\n * | Attribute | Description |\n * | --- | --- |\n * | `data-state` | `\"open\"` when the inline popover is visible, `\"closed\"` otherwise |\n */\nexport class InlinePopoverPopupElement extends InlinePopoverPopupElementBase {}\n\n/** @internal */\nexport function registerInlinePopoverPopupElement(): void {\n registerCustomElement('prosekit-inline-popover-popup', InlinePopoverPopupElement)\n}\n","import {\n defineCustomElement,\n defineProps,\n registerCustomElement,\n type HostElement,\n type HostElementConstructor,\n type PropsDeclaration,\n type State,\n} from '@aria-ui/core'\nimport { OverlayPositionerPropsDeclaration, setupOverlayPositioner, type OverlayPositionerProps } from '@aria-ui/elements/overlay'\n\nimport { InlinePopoverStoreContext } from './store.ts'\n\n/**\n * @public\n */\nexport interface InlinePopoverPositionerProps extends\n Omit<\n OverlayPositionerProps,\n | 'placement'\n | 'offset'\n | 'hide'\n | 'hoist'\n | 'overlap'\n | 'inline'\n | 'overflowPadding'\n >\n{\n /**\n * The initial placement of the floating element\n *\n * @default \"top\"\n */\n placement: OverlayPositionerProps['placement']\n\n /**\n * The distance between the reference and floating element.\n *\n * @default 12\n */\n offset: OverlayPositionerProps['offset']\n\n /**\n * Whether to hide the floating element when the reference element or the\n * floating element is fully clipped.\n *\n * @default true\n */\n hide: OverlayPositionerProps['hide']\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 * Whether the floating element can overlap the reference element to keep it\n * in view.\n *\n * @default true\n */\n overlap: OverlayPositionerProps['overlap']\n\n /**\n * Whether to improve positioning for inline reference elements that span over\n * multiple lines.\n *\n * @default true\n */\n inline: OverlayPositionerProps['inline']\n\n /**\n * Describes the virtual padding around the boundary to check for overflow.\n *\n * @default 8\n */\n overflowPadding: OverlayPositionerProps['overflowPadding']\n}\n\n/** @internal */\nexport const InlinePopoverPositionerPropsDeclaration: PropsDeclaration<InlinePopoverPositionerProps> = /* @__PURE__ */ defineProps<\n InlinePopoverPositionerProps\n>({\n ...OverlayPositionerPropsDeclaration,\n placement: { default: 'top', attribute: 'placement', type: 'string' },\n offset: { default: 12, attribute: false, type: 'json' },\n hide: { default: true, attribute: 'hide', type: 'boolean' },\n hoist: { default: false, attribute: 'hoist', type: 'boolean' },\n overlap: { default: true, attribute: 'overlap', type: 'boolean' },\n inline: { default: true, attribute: 'inline', type: 'boolean' },\n overflowPadding: { default: 8, attribute: 'overflow-padding', type: 'number' },\n})\n\n/** @internal */\nexport function setupInlinePopoverPositioner(\n host: HostElement,\n props: State<InlinePopoverPositionerProps>,\n): void {\n setupOverlayPositioner(host, props, InlinePopoverStoreContext.consume(host))\n}\n\nconst InlinePopoverPositionerElementBase: HostElementConstructor<InlinePopoverPositionerProps> = defineCustomElement(\n setupInlinePopoverPositioner,\n InlinePopoverPositionerPropsDeclaration,\n)\n\n/**\n * `<prosekit-inline-popover-positioner>` custom element.\n *\n * Properties: {@link InlinePopoverPositionerProps}\n *\n * Data attributes:\n *\n * | Attribute | Description |\n * | --- | --- |\n * | `data-state` | `\"open\"` when the inline popover is visible, `\"closed\"` otherwise |\n * | `data-side` | The side of the anchor element the positioner is on |\n * | `data-align` | The alignment of the positioner relative to the anchor element |\n *\n * CSS variables:\n *\n * | Variable | Description |\n * | --- | --- |\n * | `--transform-origin` | The coordinates that this element is anchored to. Useful for scale animations. |\n */\nexport class InlinePopoverPositionerElement extends InlinePopoverPositionerElementBase {}\n\n/** @internal */\nexport function registerInlinePopoverPositionerElement(): void {\n registerCustomElement('prosekit-inline-popover-positioner', InlinePopoverPositionerElement)\n}\n","import type { HostElement } 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: HostElement,\n getEditor: () => Editor | null,\n handler: FocusChangeHandler,\n): void {\n const extension = defineFocusChangeHandler(handler)\n useEditorExtension(host, getEditor, extension)\n}\n","import type { HostElement } from '@aria-ui/core'\nimport { defineUpdateHandler, type Editor, type UpdateHandler } from '@prosekit/core'\n\nimport { useEditorExtension } from './use-editor-extension.ts'\n\n/**\n * @internal\n */\nexport function useEditorUpdateEvent(\n host: HostElement,\n getEditor: () => Editor | null,\n handler: UpdateHandler,\n): void {\n const extension = defineUpdateHandler(handler)\n useEditorExtension(host, getEditor, extension)\n}\n","import type { HostElement } 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: HostElement,\n getEditor: () => Editor | null,\n keymap: Keymap,\n): void {\n const extension = defineKeymap(keymap)\n useEditorExtension(host, getEditor, 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 defineCustomElement,\n defineProps,\n registerCustomElement,\n type HostElement,\n type HostElementConstructor,\n type PropsDeclaration,\n type State,\n} from '@aria-ui/core'\nimport type { OpenChangeEvent } from '@aria-ui/elements/overlay'\nimport { OverlayRootPropsDeclaration, useOverlayStore, type OverlayRootProps } from '@aria-ui/elements/overlay'\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 { InlinePopoverStoreContext } from './store.ts'\nimport { getVirtualSelectionElement } from './virtual-selection-element.ts'\n\n/**\n * @public\n */\nexport interface InlinePopoverRootProps extends OverlayRootProps {\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 * @default true\n */\n defaultOpen: 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/** @internal */\nexport const InlinePopoverRootPropsDeclaration: PropsDeclaration<InlinePopoverRootProps> = /* @__PURE__ */ defineProps<\n InlinePopoverRootProps\n>({\n ...OverlayRootPropsDeclaration,\n editor: { default: null, attribute: false, type: 'json' },\n defaultOpen: { default: true, attribute: 'default-open', type: 'boolean' },\n dismissOnEscape: { default: true, attribute: 'dismiss-on-escape', type: 'boolean' },\n})\n\n/**\n * @public\n */\nexport interface InlinePopoverRootEvents {\n /**\n * Emitted when the open state of the popover changes.\n */\n openChange: OpenChangeEvent\n}\n\n/** @internal */\nexport function setupInlinePopoverRoot(\n host: HostElement,\n props: State<InlinePopoverRootProps>,\n): void {\n const store = useOverlayStore(host, props)\n InlinePopoverStoreContext.provide(host, store)\n\n let editorFocused = false\n useEditorFocusChangeEvent(host, props.editor.get, (focus) => {\n editorFocused = focus\n })\n\n let prevSelection: Selection | undefined\n useEditorUpdateEvent(host, props.editor.get, (view) => {\n const isPopoverFocused = !editorFocused && host.contains(host.ownerDocument.activeElement)\n if (isPopoverFocused) return\n\n const { selection } = view.state\n if (prevSelection?.eq(selection)) return\n prevSelection = selection\n\n const reference = getVirtualSelectionElement(view)\n store.setAnchorElement(reference)\n\n if (reference && props.defaultOpen.get()) {\n store.requestOpenChange(true)\n } else if (!reference) {\n store.requestOpenChange(false)\n }\n })\n\n useKeymap(host, props.editor.get, {\n Escape: () => {\n if (!props.dismissOnEscape.get() || !store.getIsOpen()) return false\n store.requestOpenChange(false)\n return true\n },\n })\n}\n\nconst InlinePopoverRootElementBase: HostElementConstructor<InlinePopoverRootProps> = defineCustomElement(\n setupInlinePopoverRoot,\n InlinePopoverRootPropsDeclaration,\n)\n\n/**\n * `<prosekit-inline-popover-root>` custom element.\n *\n * Properties: {@link InlinePopoverRootProps}\n *\n * Events: {@link InlinePopoverRootEvents}\n */\nexport class InlinePopoverRootElement extends InlinePopoverRootElementBase {}\n\n/** @internal */\nexport function registerInlinePopoverRootElement(): void {\n registerCustomElement('prosekit-inline-popover-root', InlinePopoverRootElement)\n}\n"],"mappings":";;;;;AAGA,MAAa,4BAAmD,cAC9D,gCACD;;ACgBD,MAAa,qCAAgF;;AAG7F,SAAgB,wBACd,MACA,QACM;CACN,MAAM,WAAW,0BAA0B,QAAQ,KAAK;AACxD,mBAAkB,MAAM,SAAS;AAEjC,aAAY,MADI,eAAe,UAAU,EAAE,WAAW,IAAI,MAAM,CACtC;AAE1B,SAAQ,YAAY;AAClB,OAAK,OAAO;GACZ;;AAGJ,MAAM,gCAAiF,oBACrF,yBACA,mCACD;;;;;;;;;;;;AAaD,IAAa,4BAAb,cAA+C,8BAA8B;;AAG7E,SAAgB,oCAA0C;AACxD,uBAAsB,iCAAiC,0BAA0B;;;ACyBnF,MAAa,0CAA0G,4BAErH;CACA,GAAG;CACH,WAAW;EAAE,SAAS;EAAO,WAAW;EAAa,MAAM;EAAU;CACrE,QAAQ;EAAE,SAAS;EAAI,WAAW;EAAO,MAAM;EAAQ;CACvD,MAAM;EAAE,SAAS;EAAM,WAAW;EAAQ,MAAM;EAAW;CAC3D,OAAO;EAAE,SAAS;EAAO,WAAW;EAAS,MAAM;EAAW;CAC9D,SAAS;EAAE,SAAS;EAAM,WAAW;EAAW,MAAM;EAAW;CACjE,QAAQ;EAAE,SAAS;EAAM,WAAW;EAAU,MAAM;EAAW;CAC/D,iBAAiB;EAAE,SAAS;EAAG,WAAW;EAAoB,MAAM;EAAU;CAC/E,CAAC;;AAGF,SAAgB,6BACd,MACA,OACM;AACN,wBAAuB,MAAM,OAAO,0BAA0B,QAAQ,KAAK,CAAC;;AAG9E,MAAM,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gC,gBAAA,CAAiB,mBAAA;AAyB9D;AAAA,cAvBa,wBAAA,EAA0B,gBAAA,CAAiB,aAAA;;cAE3C,+BAAA,EAAiC,gBAAA,CAAiB,oBAAA;;cAElD,kCAAA,EAAoC,gBAAA,CAAiB,uBAAA;;cAErD,2BAAA,EAA6B,gBAAA,CAAiB,gBAAA;AAAA,iBAE3C,uBAAA,CAAA;AAAA,iBAGA,0BAAA,CAAA;AAAA,iBAGA,6BAAA,CAAA;AAAA,iBAGA,wBAAA,CAAA;AAAA,iBAGA,uBAAA,CAAA;AAAA,iBAGA,8BAAA,CAAA;AAAA,iBAGA,iCAAA,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"prosekit-web-menu.js","names":[],"sources":["../src/components/menu/index.ts"],"sourcesContent":["/**\n\n@module\n\n## Anatomy\n\n```html\n<prosekit-menu-root>\n <prosekit-menu-trigger>...</prosekit-menu-trigger>\n <prosekit-menu-positioner>\n <prosekit-menu-popup>\n <prosekit-menu-item>...</prosekit-menu-item>\n <prosekit-menu-submenu-root>\n <prosekit-menu-submenu-trigger>...</prosekit-menu-submenu-trigger>\n <prosekit-menu-positioner>\n <prosekit-menu-popup>\n <prosekit-menu-item>...</prosekit-menu-item>\n </prosekit-menu-popup>\n </prosekit-menu-positioner>\n </prosekit-menu-submenu-root>\n </prosekit-menu-popup>\n </prosekit-menu-positioner>\n</prosekit-menu-root>\n```\n*/\n\nimport { registerCustomElement, type PropsDeclaration } from '@aria-ui/core'\nimport * as Base from '@aria-ui/elements/menu'\n\n/**\n * `<prosekit-menu-item>` custom element.\n *\n * Properties: {@link MenuItemProps}\n *\n * Events: {@link MenuItemEvents}\n *\n * Data attributes:\n *\n * | Attribute | Description |\n * | --- | --- |\n * | `data-highlighted` | Present when the item is the currently highlighted option |\n */\nexport class MenuItemElement extends Base.MenuItemElement {}\n\n/**\n * `<prosekit-menu-popup>` custom element.\n *\n * Properties: {@link MenuPopupProps}\n *\n * Data attributes:\n *\n * | Attribute | Description |\n * | --- | --- |\n * | `data-state` | `\"open\"` when the menu is visible, `\"closed\"` otherwise |\n */\nexport class MenuPopupElement extends Base.MenuPopupElement {}\n\n/**\n * `<prosekit-menu-positioner>` custom element.\n *\n * Properties: {@link MenuPositionerProps}\n *\n * Data attributes:\n *\n * | Attribute | Description |\n * | --- | --- |\n * | `data-state` | `\"open\"` when the menu is visible, `\"closed\"` otherwise |\n *\n * CSS variables:\n *\n * | Variable | Description |\n * | --- | --- |\n * | `--transform-origin` | The coordinates that this element is anchored to. Useful for scale animations. |\n */\nexport class MenuPositionerElement extends Base.MenuPositionerElement {}\n\n/**\n * `<prosekit-menu-root>` custom element.\n *\n * Properties: {@link MenuRootProps}\n *\n * Events: {@link MenuRootEvents}\n *\n * Data attributes:\n *\n * | Attribute | Description |\n * | --- | --- |\n * | `data-menu-root` | Always present on the element |\n */\nexport class MenuRootElement extends Base.MenuRootElement {}\n\n/**\n * `<prosekit-menu-submenu-root>` custom element.\n *\n * Properties: {@link MenuSubmenuRootProps}\n *\n * Events: {@link MenuSubmenuRootEvents}\n *\n * Data attributes:\n *\n * | Attribute | Description |\n * | --- | --- |\n * | `data-menu-submenu-root` | Always present on the element |\n */\nexport class MenuSubmenuRootElement extends Base.MenuSubmenuRootElement {}\n\n/**\n * `<prosekit-menu-submenu-trigger>` custom element.\n *\n * Properties: {@link MenuSubmenuTriggerProps}\n *\n * Data attributes:\n *\n * | Attribute | Description |\n * | --- | --- |\n * | `data-highlighted` | Present when the item is the currently highlighted option |\n */\nexport class MenuSubmenuTriggerElement extends Base.MenuSubmenuTriggerElement {}\n\n/**\n * `<prosekit-menu-trigger>` custom element.\n *\n * Properties: {@link MenuTriggerProps}\n *\n * Events: {@link MenuTriggerEvents}\n */\nexport class MenuTriggerElement extends Base.MenuTriggerElement {}\n\nexport interface MenuItemProps extends Base.MenuItemProps {}\nexport interface MenuPopupProps extends Base.MenuPopupProps {}\nexport interface MenuPositionerProps extends Base.MenuPositionerProps {}\nexport interface MenuRootProps extends Base.MenuRootProps {}\nexport interface MenuSubmenuRootProps extends Base.MenuSubmenuRootProps {}\nexport interface MenuSubmenuTriggerProps extends Base.MenuSubmenuTriggerProps {}\nexport interface MenuTriggerProps extends Base.MenuTriggerProps {}\n\nexport interface MenuItemEvents extends Base.MenuItemEvents {}\nexport interface MenuRootEvents extends Base.MenuRootEvents {}\nexport interface MenuSubmenuRootEvents extends Base.MenuSubmenuRootEvents {}\nexport interface MenuTriggerEvents extends Base.MenuTriggerEvents {}\n\n/** @internal */\nexport const MenuItemPropsDeclaration: PropsDeclaration<MenuItemProps> = Base.MenuItemPropsDeclaration\n/** @internal */\nexport const MenuPopupPropsDeclaration: PropsDeclaration<MenuPopupProps> = Base.MenuPopupPropsDeclaration\n/** @internal */\nexport const MenuPositionerPropsDeclaration: PropsDeclaration<MenuPositionerProps> = Base.MenuPositionerPropsDeclaration\n/** @internal */\nexport const MenuRootPropsDeclaration: PropsDeclaration<MenuRootProps> = Base.MenuRootPropsDeclaration\n/** @internal */\nexport const MenuSubmenuRootPropsDeclaration: PropsDeclaration<MenuSubmenuRootProps> = Base.MenuSubmenuRootPropsDeclaration\n/** @internal */\nexport const MenuSubmenuTriggerPropsDeclaration: PropsDeclaration<MenuSubmenuTriggerProps> = Base.MenuSubmenuTriggerPropsDeclaration\n/** @internal */\nexport const MenuTriggerPropsDeclaration: PropsDeclaration<MenuTriggerProps> = Base.MenuTriggerPropsDeclaration\n\nexport function registerMenuRootElement(): void {\n registerCustomElement('prosekit-menu-root', MenuRootElement)\n}\nexport function registerMenuTriggerElement(): void {\n registerCustomElement('prosekit-menu-trigger', MenuTriggerElement)\n}\nexport function registerMenuPositionerElement(): void {\n registerCustomElement('prosekit-menu-positioner', MenuPositionerElement)\n}\nexport function registerMenuPopupElement(): void {\n registerCustomElement('prosekit-menu-popup', MenuPopupElement)\n}\nexport function registerMenuItemElement(): void {\n registerCustomElement('prosekit-menu-item', MenuItemElement)\n}\nexport function registerMenuSubmenuRootElement(): void {\n registerCustomElement('prosekit-menu-submenu-root', MenuSubmenuRootElement)\n}\nexport function registerMenuSubmenuTriggerElement(): void {\n registerCustomElement('prosekit-menu-submenu-trigger', MenuSubmenuTriggerElement)\n}\n\nexport {\n OpenChangeEvent,\n SelectEvent,\n setupMenuItem,\n setupMenuPopup,\n setupMenuPositioner,\n setupMenuRoot,\n setupMenuSubmenuRoot,\n setupMenuSubmenuTrigger,\n setupMenuTrigger,\n} from '@aria-ui/elements/menu'\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0CA,IAAa,kBAAb,cAAqC,KAAK,gBAAgB;;;;;;;;;;;;AAa1D,IAAa,mBAAb,cAAsC,KAAK,iBAAiB;;;;;;;;;;;;;;;;;;AAmB5D,IAAa,wBAAb,cAA2C,KAAK,sBAAsB;;;;;;;;;;;;;;AAetE,IAAa,kBAAb,cAAqC,KAAK,gBAAgB;;;;;;;;;;;;;;AAe1D,IAAa,yBAAb,cAA4C,KAAK,uBAAuB;;;;;;;;;;;;AAaxE,IAAa,4BAAb,cAA+C,KAAK,0BAA0B;;;;;;;;AAS9E,IAAa,qBAAb,cAAwC,KAAK,mBAAmB;;AAgBhE,MAAa,2BAA4D,KAAK;;AAE9E,MAAa,4BAA8D,KAAK;;AAEhF,MAAa,iCAAwE,KAAK;;AAE1F,MAAa,2BAA4D,KAAK;;AAE9E,MAAa,kCAA0E,KAAK;;AAE5F,MAAa,qCAAgF,KAAK;;AAElG,MAAa,8BAAkE,KAAK;AAEpF,SAAgB,0BAAgC;AAC9C,uBAAsB,sBAAsB,gBAAgB;;AAE9D,SAAgB,6BAAmC;AACjD,uBAAsB,yBAAyB,mBAAmB;;AAEpE,SAAgB,gCAAsC;AACpD,uBAAsB,4BAA4B,sBAAsB;;AAE1E,SAAgB,2BAAiC;AAC/C,uBAAsB,uBAAuB,iBAAiB;;AAEhE,SAAgB,0BAAgC;AAC9C,uBAAsB,sBAAsB,gBAAgB;;AAE9D,SAAgB,iCAAuC;AACrD,uBAAsB,8BAA8B,uBAAuB;;AAE7E,SAAgB,oCAA0C;AACxD,uBAAsB,iCAAiC,0BAA0B"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"prosekit-web-popover.d.ts","names":[],"sources":["../src/components/popover/index.ts"],"mappings":";;;;;AAmEA;;;;;AAEA;;;;cAvCa,mBAAA,SAA4B,IAAA,CAAK,mBAAA;;;;;AAyC9C;;;;;AACA;;;;;AAEA;;;cAzBa,wBAAA,SAAiC,IAAA,CAAK,wBAAA;AA0BnD;;;;;AAGA;;AAHA,cAjBa,kBAAA,SAA2B,IAAA,CAAK,kBAAA;;AAsB7C;;;;;AAEA;cAfa,qBAAA,SAA8B,IAAA,CAAK,qBAAA;AAAA,UAE/B,iBAAA,SAA0B,IAAA,CAAK,iBAAA;AAAA,UAC/B,sBAAA,SAA+B,IAAA,CAAK,sBAAA;AAAA,UACpC,gBAAA,SAAyB,IAAA,CAAK,gBAAA;AAAA,UAC9B,mBAAA,SAA4B,IAAA,CAAK,mBAAA;AAAA,UAEjC,iBAAA,SAA0B,IAAA,CAAK,iBAAA;AAAA,UAC/B,oBAAA,SAA6B,IAAA,CAAK,oBAAA;AAcnD;AAAA,cAXa,4BAAA,EAA8B,gBAAA,CAAiB,iBAAA;;cAE/C,iCAAA,EAAmC,gBAAA,CAAiB,sBAAA;;cAEpD,2BAAA,EAA6B,gBAAA,CAAiB,gBAAA;;cAE9C,8BAAA,EAAgC,gBAAA,CAAiB,mBAAA;AAAA,iBAE9C,0BAAA,CAAA;AAAA,iBAGA,6BAAA,CAAA;AAAA,iBAGA,2BAAA,CAAA;AAAA,iBAGA,gCAAA,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"prosekit-web-popover.js","names":[],"sources":["../src/components/popover/index.ts"],"sourcesContent":["/**\n\n@module\n\n## Anatomy\n\n```html\n<prosekit-popover-root>\n <prosekit-popover-trigger>...</prosekit-popover-trigger>\n <prosekit-popover-positioner>\n <prosekit-popover-popup>...</prosekit-popover-popup>\n </prosekit-popover-positioner>\n</prosekit-popover-root>\n```\n*/\n\nimport { registerCustomElement, type PropsDeclaration } from '@aria-ui/core'\nimport * as Base from '@aria-ui/elements/popover'\n\n/**\n * `<prosekit-popover-popup>` custom element.\n *\n * Properties: {@link PopoverPopupProps}\n *\n * Data attributes:\n *\n * | Attribute | Description |\n * | --- | --- |\n * | `data-state` | `\"open\"` when the popover is visible, `\"closed\"` otherwise |\n */\nexport class PopoverPopupElement extends Base.PopoverPopupElement {}\n\n/**\n * `<prosekit-popover-positioner>` custom element.\n *\n * Properties: {@link PopoverPositionerProps}\n *\n * Data attributes:\n *\n * | Attribute | Description |\n * | --- | --- |\n * | `data-state` | `\"open\"` when the popover is visible, `\"closed\"` otherwise |\n *\n * CSS variables:\n *\n * | Variable | Description |\n * | --- | --- |\n * | `--transform-origin` | The coordinates that this element is anchored to. Useful for scale animations. |\n */\nexport class PopoverPositionerElement extends Base.PopoverPositionerElement {}\n\n/**\n * `<prosekit-popover-root>` custom element.\n *\n * Properties: {@link PopoverRootProps}\n *\n * Events: {@link PopoverRootEvents}\n */\nexport class PopoverRootElement extends Base.PopoverRootElement {}\n\n/**\n * `<prosekit-popover-trigger>` custom element.\n *\n * Properties: {@link PopoverTriggerProps}\n *\n * Events: {@link PopoverTriggerEvents}\n */\nexport class PopoverTriggerElement extends Base.PopoverTriggerElement {}\n\nexport interface PopoverPopupProps extends Base.PopoverPopupProps {}\nexport interface PopoverPositionerProps extends Base.PopoverPositionerProps {}\nexport interface PopoverRootProps extends Base.PopoverRootProps {}\nexport interface PopoverTriggerProps extends Base.PopoverTriggerProps {}\n\nexport interface PopoverRootEvents extends Base.PopoverRootEvents {}\nexport interface PopoverTriggerEvents extends Base.PopoverTriggerEvents {}\n\n/** @internal */\nexport const PopoverPopupPropsDeclaration: PropsDeclaration<PopoverPopupProps> = Base.PopoverPopupPropsDeclaration\n/** @internal */\nexport const PopoverPositionerPropsDeclaration: PropsDeclaration<PopoverPositionerProps> = Base.PopoverPositionerPropsDeclaration\n/** @internal */\nexport const PopoverRootPropsDeclaration: PropsDeclaration<PopoverRootProps> = Base.PopoverRootPropsDeclaration\n/** @internal */\nexport const PopoverTriggerPropsDeclaration: PropsDeclaration<PopoverTriggerProps> = Base.PopoverTriggerPropsDeclaration\n\nexport function registerPopoverRootElement(): void {\n registerCustomElement('prosekit-popover-root', PopoverRootElement)\n}\nexport function registerPopoverTriggerElement(): void {\n registerCustomElement('prosekit-popover-trigger', PopoverTriggerElement)\n}\nexport function registerPopoverPopupElement(): void {\n registerCustomElement('prosekit-popover-popup', PopoverPopupElement)\n}\nexport function registerPopoverPositionerElement(): void {\n registerCustomElement('prosekit-popover-positioner', PopoverPositionerElement)\n}\n\nexport {\n OpenChangeEvent,\n setupPopoverPopup,\n setupPopoverPositioner,\n setupPopoverRoot,\n setupPopoverTrigger,\n} from '@aria-ui/elements/popover'\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8BA,IAAa,sBAAb,cAAyC,KAAK,oBAAoB;;;;;;;;;;;;;;;;;;AAmBlE,IAAa,2BAAb,cAA8C,KAAK,yBAAyB;;;;;;;;AAS5E,IAAa,qBAAb,cAAwC,KAAK,mBAAmB;;;;;;;;AAShE,IAAa,wBAAb,cAA2C,KAAK,sBAAsB;;AAWtE,MAAa,+BAAoE,KAAK;;AAEtF,MAAa,oCAA8E,KAAK;;AAEhG,MAAa,8BAAkE,KAAK;;AAEpF,MAAa,iCAAwE,KAAK;AAE1F,SAAgB,6BAAmC;AACjD,uBAAsB,yBAAyB,mBAAmB;;AAEpE,SAAgB,gCAAsC;AACpD,uBAAsB,4BAA4B,sBAAsB;;AAE1E,SAAgB,8BAAoC;AAClD,uBAAsB,0BAA0B,oBAAoB;;AAEtE,SAAgB,mCAAyC;AACvD,uBAAsB,+BAA+B,yBAAyB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"prosekit-web-resizable.d.ts","names":[],"sources":["../src/components/resizable/resizable-root.ts","../src/components/resizable/resizable-handle.ts"],"mappings":";AAkBA;;;AAAA,UAAiB,kBAAA;EAMf;;;;;EAAA,KAAA;EAwBA;;;;AAKF;EAtBE,MAAA;;;;;;EAOA,WAAA;AAAA;;AA8BF;;cAxBa,6BAAA,EAA+B,gBAAA,CAAiB,kBAAA;;;;UAS5C,mBAAA;EAkBJ;;;EAdX,WAAA,EAAa,gBAAA;EAgB4B;;AAS3C;EApBE,SAAA,EAAW,cAAA;AAAA;;;;cAMA,gBAAA,SAAyB,KAAA;EAAA,SAC3B,MAAA;IAAA,SACE,KAAA;IAAA,SACA,MAAA;EAAA;cAEC,KAAA,UAAe,MAAA;AAAA;AAuB7B;;;AAAA,cAda,cAAA,SAAuB,KAAA;EAAA,SACzB,MAAA;IAAA,SACE,KAAA;IAAA,SACA,MAAA;EAAA;cAEC,KAAA,UAAe,MAAA;AAAA;;;;iBASb,kBAAA,CACd,IAAA,EAAM,WAAA,EACN,KAAA,EAAO,KAAA,CAAM,kBAAA;AAAA,cAkET,wBAAA,EAA0B,sBAAA,CAAuB,kBAAA;AAvBtD;;;;;AAyCD;;;;;AAOA;;;AAhDC,cAyCY,oBAAA,SAA6B,wBAAA;;AC5K1C;;iBDmLgB,4BAAA,CAAA;AA3KhB;;;AAAA,UCRiB,oBAAA;EDcf;;;;;ECRA,QAAA;AAAA;;;;cAcW,+BAAA,EAAiC,gBAAA,CAAiB,oBAAA;;;;iBAO/C,oBAAA,CACd,IAAA,EAAM,WAAA,EACN,KAAA,EAAO,KAAA,CAAM,oBAAA;AAAA,cA2ET,0BAAA,EAA4B,sBAAA,CAAuB,oBAAA;;;;;AD9CzD;cCwDa,sBAAA,SAA+B,0BAAA;;;;iBAO5B,8BAAA,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"prosekit-web-resizable.js","names":[],"sources":["../src/utils/is-finite-positive-number.ts","../src/components/resizable/context.ts","../src/components/resizable/resizable-root.ts","../src/components/resizable/calc-resize.ts","../src/components/resizable/resizable-handle.ts"],"sourcesContent":["export function isFinitePositiveNumber(value: unknown): value is number {\n return typeof value === 'number' && Number.isFinite(value) && value > 0\n}\n","import { createContext, type Context } from '@aria-ui/core'\n\n/**\n * @internal\n */\nexport const onResizeContext: Context<OnResize> = createContext<OnResize>(\n 'prosekit/resizable/onResize',\n)\n\n/**\n * @internal\n */\nexport const onResizeStartContext: Context<OnResizeStart> = createContext<OnResizeStart>(\n 'prosekit/resizable/onResizeStart',\n)\n\n/**\n * @internal\n */\nexport const onResizeEndContext: Context<OnResizeEnd> = createContext<OnResizeEnd>(\n 'prosekit/resizable/onResizeEnd',\n)\n\n/**\n * @internal\n */\nexport type OnResize = ((width: number, height: number) => void) | null\n\n/**\n * @internal\n */\nexport type OnResizeStart =\n | (() => readonly [width: number, height: number, aspectRatio: number])\n | null\n\n/**\n * @internal\n */\nexport type OnResizeEnd = (() => void) | null\n","import type { HostElement, HostElementConstructor, PropsDeclaration } from '@aria-ui/core'\nimport { createSignal, defineCustomElement, defineProps, registerCustomElement, useEffect, type State } from '@aria-ui/core'\nimport { useAttribute } from '@aria-ui/utils'\n\nimport { isFinitePositiveNumber } from '../../utils/is-finite-positive-number.ts'\n\nimport {\n onResizeContext,\n onResizeEndContext,\n onResizeStartContext,\n type OnResize,\n type OnResizeEnd,\n type OnResizeStart,\n} from './context.ts'\n\n/**\n * @public\n */\nexport interface ResizableRootProps {\n /**\n * The width of the resizable element.\n *\n * @default null\n */\n width: number | null\n\n /**\n * The height of the resizable element.\n *\n * @default null\n */\n height: number | null\n\n /**\n * The aspect ratio of the resizable element.\n *\n * @default null\n */\n aspectRatio: number | null\n}\n\n/**\n * @internal\n */\nexport const ResizableRootPropsDeclaration: PropsDeclaration<ResizableRootProps> = defineProps<ResizableRootProps>({\n width: { default: null, attribute: 'data-width', type: 'json' },\n height: { default: null, attribute: 'data-height', type: 'json' },\n aspectRatio: { default: null, attribute: 'data-aspect-ratio', type: 'json' },\n})\n\n/**\n * @public\n */\nexport interface ResizableRootEvents {\n /**\n * Emitted when a resize operation starts.\n */\n resizeStart: ResizeStartEvent\n\n /**\n * Emitted when a resize operation ends.\n */\n resizeEnd: ResizeEndEvent\n}\n\n/**\n * @public\n */\nexport class ResizeStartEvent extends Event {\n readonly detail: {\n readonly width: number\n readonly height: number\n }\n constructor(width: number, height: number) {\n super('resizeStart')\n this.detail = { width, height }\n }\n}\n\n/**\n * @public\n */\nexport class ResizeEndEvent extends Event {\n readonly detail: {\n readonly width: number\n readonly height: number\n }\n constructor(width: number, height: number) {\n super('resizeEnd')\n this.detail = { width, height }\n }\n}\n\n/**\n * @internal\n */\nexport function setupResizableRoot(\n host: HostElement,\n props: State<ResizableRootProps>,\n): void {\n const resizing = createSignal(false)\n\n const onResizeStart: OnResizeStart = () => {\n const { width, height } = host.getBoundingClientRect()\n\n let aspectRatio: number = props.aspectRatio.get() ?? width / height\n\n if (!isFinitePositiveNumber(aspectRatio)) {\n aspectRatio = 0\n }\n\n resizing.set(true)\n host.dispatchEvent(new ResizeStartEvent(width, height))\n return [width, height, aspectRatio]\n }\n\n const onResize: OnResize = (width, height) => {\n props.width.set(width)\n props.height.set(height)\n }\n\n const onResizeEnd: OnResizeEnd = () => {\n const { width, height } = host.getBoundingClientRect()\n resizing.set(false)\n host.dispatchEvent(new ResizeEndEvent(width, height))\n }\n\n onResizeStartContext.provide(host, onResizeStart)\n onResizeContext.provide(host, onResize)\n onResizeEndContext.provide(host, onResizeEnd)\n\n useEffect(host, () => {\n updateResizableRootStyles(\n host,\n Math.max(props.width.get() || 0, 1),\n Math.max(props.height.get() || 0, 1),\n props.aspectRatio.get(),\n )\n })\n\n useAttribute(host, 'data-resizing', () => (resizing.get() ? '' : undefined))\n}\n\nfunction updateResizableRootStyles(\n host: HostElement,\n width: number,\n height: number,\n aspectRatio: number | null,\n) {\n host.style.width = isFinitePositiveNumber(width) ? `${width}px` : ''\n\n host.style.height = isFinitePositiveNumber(height) ? `${height}px` : ''\n\n if (isFinitePositiveNumber(aspectRatio)) {\n host.style.aspectRatio = `${aspectRatio}`\n\n if (width && width > 0 && aspectRatio >= 1) {\n host.style.height = 'auto'\n } else if (height && height > 0 && aspectRatio <= 1) {\n host.style.width = 'min-content'\n }\n }\n}\n\nconst ResizableRootElementBase: HostElementConstructor<ResizableRootProps> = defineCustomElement(\n setupResizableRoot,\n ResizableRootPropsDeclaration,\n)\n\n/**\n * `<prosekit-resizable-root>` custom element.\n *\n * Properties: {@link ResizableRootProps}\n *\n * Events: {@link ResizableRootEvents}\n *\n * Data attributes:\n *\n * | Attribute | Description |\n * | --- | --- |\n * | `data-resizing` | Present when the element is being resized |\n */\nexport class ResizableRootElement extends ResizableRootElementBase {}\n\nlet isResizableRootRegistered = false\n\n/**\n * @internal\n */\nexport function registerResizableRootElement(): void {\n if (isResizableRootRegistered) return\n isResizableRootRegistered = true\n registerCustomElement('prosekit-resizable-root', ResizableRootElement)\n}\n","import { isFinitePositiveNumber } from '../../utils/is-finite-positive-number.ts'\n\nexport function calcResize(\n position:\n | 'top'\n | 'right'\n | 'bottom'\n | 'left'\n | 'top-left'\n | 'top-right'\n | 'bottom-left'\n | 'bottom-right',\n w: number,\n h: number,\n dx: number,\n dy: number,\n aspectRatio: number | null | undefined,\n): [w: number, h: number] {\n aspectRatio = aspectRatio ? aspectRatio : w / h\n aspectRatio = isFinitePositiveNumber(aspectRatio) ? aspectRatio : 1\n\n switch (position) {\n case 'bottom-right':\n return clamp(calcBottomRightResize(w, h, dx, dy, aspectRatio))\n case 'bottom-left':\n return clamp(calcBottomLeftResize(w, h, dx, dy, aspectRatio))\n case 'top-right':\n return clamp(calcTopRightResize(w, h, dx, dy, aspectRatio))\n case 'top-left':\n return clamp(calcTopLeftResize(w, h, dx, dy, aspectRatio))\n case 'top':\n return clamp(calcTopResize(w, h, dx, dy, aspectRatio))\n case 'right':\n return clamp(calcRightResize(w, h, dx, dy, aspectRatio))\n case 'bottom':\n return clamp(calcBottomResize(w, h, dx, dy, aspectRatio))\n case 'left':\n return clamp(calcLeftResize(w, h, dx, dy, aspectRatio))\n default:\n throw new RangeError(`Invalid position: ${position}`)\n }\n}\n\ntype CalcResize = (\n w: number,\n h: number,\n dx: number,\n dy: number,\n aspectRatio: number,\n) => [w: number, h: number]\n\nconst calcBottomRightResize: CalcResize = (w, h, dx, dy, r) => {\n w += dx\n h += dy\n\n const sum = w + h\n h = sum / (r + 1)\n w = sum - h\n return [w, h]\n}\n\nconst calcBottomLeftResize: CalcResize = (w, h, dx, dy, r) => {\n w -= dx\n h += dy\n\n const sum = w + h\n h = sum / (r + 1)\n w = sum - h\n return [w, h]\n}\n\nconst calcTopRightResize: CalcResize = (w, h, dx, dy, r) => {\n w += dx\n h -= dy\n\n const sum = w + h\n h = sum / (r + 1)\n w = sum - h\n return [w, h]\n}\n\nconst calcTopLeftResize: CalcResize = (w, h, dx, dy, r) => {\n w -= dx\n h -= dy\n\n const sum = w + h\n h = sum / (r + 1)\n w = sum - h\n return [w, h]\n}\n\nconst calcTopResize: CalcResize = (w, h, dx, dy, r) => {\n h -= dy\n w = h * r\n return [w, h]\n}\n\nconst calcRightResize: CalcResize = (w, h, dx, dy, r) => {\n w += dx\n h = w / r\n return [w, h]\n}\n\nconst calcBottomResize: CalcResize = (w, h, dx, dy, r) => {\n h += dy\n w = h * r\n return [w, h]\n}\n\nconst calcLeftResize: CalcResize = (w, h, dx, dy, r) => {\n w -= dx\n h = w / r\n return [w, h]\n}\n\nfunction clamp([w, h]: [number, number]): [number, number] {\n return [\n Math.max(w, 1),\n Math.max(h, 1),\n ]\n}\n","import type { HostElement, HostElementConstructor, PropsDeclaration } from '@aria-ui/core'\nimport { createSignal, defineCustomElement, defineProps, registerCustomElement, useEffect, type State } from '@aria-ui/core'\nimport { getWindow } from '@ocavue/utils'\n\nimport { calcResize } from './calc-resize.ts'\nimport { onResizeContext, onResizeEndContext, onResizeStartContext } from './context.ts'\n\n/**\n * @public\n */\nexport interface ResizableHandleProps {\n /**\n * The position of the handle.\n *\n * @default \"bottom-right\"\n */\n position:\n | 'top'\n | 'right'\n | 'bottom'\n | 'left'\n | 'top-left'\n | 'top-right'\n | 'bottom-left'\n | 'bottom-right'\n}\n\n/**\n * @internal\n */\nexport const ResizableHandlePropsDeclaration: PropsDeclaration<ResizableHandleProps> = defineProps<ResizableHandleProps>({\n position: { default: 'bottom-right', attribute: 'position', type: 'string' },\n})\n\n/**\n * @internal\n */\nexport function setupResizableHandle(\n host: HostElement,\n props: State<ResizableHandleProps>,\n): void {\n const getOnResize = onResizeContext.consume(host)\n const getOnResizeStart = onResizeStartContext.consume(host)\n const getOnResizeEnd = onResizeEndContext.consume(host)\n\n let startX = 0\n let startY = 0\n let width = 0\n let height = 0\n let aspectRatio = 1\n\n const pointerPressing = createSignal(false)\n\n const handlePointerDown = (event: PointerEvent) => {\n event.preventDefault()\n pointerPressing.set(true)\n\n startX = event.x\n startY = event.y\n\n const size = getOnResizeStart()?.()\n if (size) {\n ;[width, height, aspectRatio] = size\n }\n }\n\n const handlePointerMove = (event: PointerEvent) => {\n event.preventDefault()\n\n const dx = event.x - startX\n const dy = event.y - startY\n\n const [w, h] = calcResize(\n props.position.get(),\n width,\n height,\n dx,\n dy,\n aspectRatio,\n )\n\n getOnResize()?.(w, h)\n }\n\n const handlePointerUp = (event: PointerEvent) => {\n event.preventDefault()\n pointerPressing.set(false)\n\n getOnResizeEnd()?.()\n }\n\n useEffect(host, () => {\n host.addEventListener('pointerdown', handlePointerDown)\n return () => {\n host.removeEventListener('pointerdown', handlePointerDown)\n }\n })\n\n useEffect(host, () => {\n if (!pointerPressing.get()) {\n return\n }\n\n const win = getWindow(host)\n\n win.addEventListener('pointermove', handlePointerMove)\n win.addEventListener('pointerup', handlePointerUp)\n return () => {\n win.removeEventListener('pointermove', handlePointerMove)\n win.removeEventListener('pointerup', handlePointerUp)\n }\n })\n}\n\nconst ResizableHandleElementBase: HostElementConstructor<ResizableHandleProps> = defineCustomElement(\n setupResizableHandle,\n ResizableHandlePropsDeclaration,\n)\n\n/**\n * `<prosekit-resizable-handle>` custom element.\n *\n * Properties: {@link ResizableHandleProps}\n */\nexport class ResizableHandleElement extends ResizableHandleElementBase {}\n\nlet isResizableHandleRegistered = false\n\n/**\n * @internal\n */\nexport function registerResizableHandleElement(): void {\n if (isResizableHandleRegistered) return\n isResizableHandleRegistered = true\n registerCustomElement('prosekit-resizable-handle', ResizableHandleElement)\n}\n"],"mappings":";;;AAAA,SAAgB,uBAAuB,OAAiC;AACtE,QAAO,OAAO,UAAU,YAAY,OAAO,SAAS,MAAM,IAAI,QAAQ;;;;;ACIxE,MAAa,kBAAqC,cAChD,8BACD;;;;AAKD,MAAa,uBAA+C,cAC1D,mCACD;;;;AAKD,MAAa,qBAA2C,cACtD,iCACD;;;;ACuBD,MAAa,gCAAsE,YAAgC;CACjH,OAAO;EAAE,SAAS;EAAM,WAAW;EAAc,MAAM;EAAQ;CAC/D,QAAQ;EAAE,SAAS;EAAM,WAAW;EAAe,MAAM;EAAQ;CACjE,aAAa;EAAE,SAAS;EAAM,WAAW;EAAqB,MAAM;EAAQ;CAC7E,CAAC;;;;AAoBF,IAAa,mBAAb,cAAsC,MAAM;CAK1C,YAAY,OAAe,QAAgB;AACzC,QAAM,cAAc;AACpB,OAAK,SAAS;GAAE;GAAO;GAAQ;;;;;;AAOnC,IAAa,iBAAb,cAAoC,MAAM;CAKxC,YAAY,OAAe,QAAgB;AACzC,QAAM,YAAY;AAClB,OAAK,SAAS;GAAE;GAAO;GAAQ;;;;;;AAOnC,SAAgB,mBACd,MACA,OACM;CACN,MAAM,WAAW,aAAa,MAAM;CAEpC,MAAM,sBAAqC;EACzC,MAAM,EAAE,OAAO,WAAW,KAAK,uBAAuB;EAEtD,IAAI,cAAsB,MAAM,YAAY,KAAK,IAAI,QAAQ;AAE7D,MAAI,CAAC,uBAAuB,YAAY,CACtC,eAAc;AAGhB,WAAS,IAAI,KAAK;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ACf,WAAS,MAAM;EAEf,MAAM,OAAO,kBAAkB,IAAI;AACnC,MAAI,KACD,EAAC,OAAO,QAAQ,eAAe;;CAIpC,MAAM,qBAAqB,UAAwB;AACjD,QAAM,gBAAgB;EAEtB,MAAM,KAAK,MAAM,IAAI;EACrB,MAAM,KAAK,MAAM,IAAI;EAErB,MAAM,CAAC,GAAG,KAAK,WACb,MAAM,SAAS,KAAK,EACpB,OACA,QACA,IACA,IACA,YACD;AAED,eAAa,GAAG,GAAG,EAAE;;CAGvB,MAAM,mBAAmB,UAAwB;AAC/C,QAAM,gBAAgB;AACtB,kBAAgB,IAAI,MAAM;AAE1B,kBAAgB,IAAI;;AAGtB,WAAU,YAAY;AACpB,OAAK,iBAAiB,eAAe,kBAAkB;AACvD,eAAa;AACX,QAAK,oBAAoB,eAAe,kBAAkB;;GAE5D;AAEF,WAAU,YAAY;AACpB,MAAI,CAAC,gBAAgB,KAAK,CACxB;EAGF,MAAM,MAAM,UAAU,KAAK;AAE3B,MAAI,iBAAiB,eAAe,kBAAkB;AACtD,MAAI,iBAAiB,aAAa,gBAAgB;AAClD,eAAa;AACX,OAAI,oBAAoB,eAAe,kBAAkB;AACzD,OAAI,oBAAoB,aAAa,gBAAgB;;GAEvD;;AAGJ,MAAM,6BAA2E,oBAC/E,sBACA,gCACD;;;;;;AAOD,IAAa,yBAAb,cAA4C,2BAA2B;AAEvE,IAAI,8BAA8B;;;;AAKlC,SAAgB,iCAAuC;AACrD,KAAI,4BAA6B;AACjC,+BAA8B;AAC9B,uBAAsB,6BAA6B,uBAAuB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"prosekit-web-table-handle.d.ts","names":[],"sources":["../src/components/table-handle/table-handle-column-popup.ts","../src/components/table-handle/shared.ts","../src/components/table-handle/table-handle-column-positioner.ts","../src/components/table-handle/table-handle-column-menu-root.ts","../src/components/table-handle/table-handle-column-menu-trigger.ts","../src/components/table-handle/table-handle-drag-preview.ts","../src/components/table-handle/table-handle-drop-indicator.ts","../src/components/table-handle/table-handle-root.ts","../src/components/table-handle/table-handle-row-popup.ts","../src/components/table-handle/table-handle-row-positioner.ts","../src/components/table-handle/table-handle-row-menu-root.ts","../src/components/table-handle/table-handle-row-menu-trigger.ts"],"mappings":";;;;;;UAaiB,2BAAA;;cAGJ,sCAAA,EAAwC,gBAAA,CAAiB,2BAAA;;iBAKtD,2BAAA,CACd,IAAA,EAAM,WAAA,EACN,MAAA,EAAQ,KAAA,CAAM,2BAAA;AAAA,cAOV,iCAAA,EAAmC,sBAAA,CAAuB,2BAAA;;;;;AAdhE;;;;;AAKA;;cAyBa,6BAAA,SAAsC,iCAAA;;iBAGnC,qCAAA,CAAA;;;;UC1CC,gCAAA,SAAyC,IAAA,CAAK,sBAAA;EDM9C;;;;;AAGjB;ECFE,MAAA,EAAQ,MAAA;;;;ADOV;;;ECCE,KAAA,EAAO,sBAAA;EDCO;;;;ECKd,IAAA,EAAM,sBAAA;EDNN;;;;ECYA,KAAA,EAAO,sBAAA;EDXmC;AAK3C;;;ECYC,IAAA,EAAM,sBAAA;EDVmF;AAgB3F;;;ECAE,MAAA,EAAQ,sBAAA;AAAA;AAAA,UC3BO,gCAAA,SAAyC,IAAA,CAAK,gCAAA;;;;AFN/D;;EEYE,SAAA,EAAW,SAAA;AAAA;;cAIA,2CAAA,EAA6C,gBAAA,CAAiB,gCAAA;;iBAQ3D,gCAAA,CACd,IAAA,EAAM,WAAA,EACN,KAAA,EAAO,KAAA,CAAM,gCAAA;AAAA,cAcT,sCAAA,EAAwC,sBAAA,CAAuB,gCAAA;;AFhCrE;;;;;;;;;;;;;;;AAOC;;;cEiDY,kCAAA,SAA2C,sCAAA;AF/BxD;AAAA,iBEkCgB,0CAAA,CAAA;AAAA,UClEC,8BAAA,SAAuC,aAAA;;cAG3C,yCAAA,EAA2C,gBAAA,CAAiB,8BAAA;;iBAKzD,8BAAA,CACd,IAAA,EAAM,WAAA,EACN,KAAA,EAAO,KAAA,CAAM,8BAA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A2C,gBAAA,CAAiB,8BAAA;;iBAOzD,8BAAA,CACd,IAAA,EAAM,WAAA,EACN,KAAA,EAAO,KAAA,CAAM,8BAAA;AAAA,cAoDT,oCAAA,EAAsC,sBAAA,CAAuB,8BAAA;;AXtEnE;;;;cWgFa,gCAAA,SAAyC,oCAAA;;;;iBAKtC,wCAAA,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"prosekit-web-table-handle.js","names":[],"sources":["../src/components/table-handle/store.ts","../src/components/table-handle/table-handle-column-popup.ts","../src/utils/use-html-element-at.ts","../src/components/table-handle/shared.ts","../src/components/table-handle/table-handle-column-positioner.ts","../src/components/table-handle/table-handle-column-menu-root.ts","../src/components/table-handle/use-empty-image.ts","../src/components/table-handle/table-handle-column-menu-trigger.ts","../src/components/table-handle/dnd.ts","../src/utils/clone-element.ts","../src/utils/css-feature-detection.ts","../src/utils/fade-color.ts","../src/utils/get-effective-background-color.ts","../src/utils/inject-style.ts","../src/components/table-handle/render-preview.ts","../src/components/table-handle/table-handle-drag-preview.ts","../src/components/table-handle/calc-drag-over.ts","../src/components/table-handle/table-handle-drop-indicator.ts","../src/hooks/use-editor-typing.ts","../src/hooks/use-selecting.ts","../src/components/table-handle/use-drop.ts","../src/components/table-handle/utils.ts","../src/components/table-handle/table-handle-root.ts","../src/components/table-handle/table-handle-row-popup.ts","../src/components/table-handle/table-handle-row-positioner.ts","../src/components/table-handle/table-handle-row-menu-root.ts","../src/components/table-handle/table-handle-row-menu-trigger.ts"],"sourcesContent":["import { computed, createContext, createSignal, type Context, type Signal } from '@aria-ui/core'\nimport type { OpenChangeEvent } from '@aria-ui/elements/overlay'\nimport { createOverlayStore, type OverlayStore } from '@aria-ui/elements/overlay'\n\nimport type { HoveringCellInfo } from './utils.ts'\n\nfunction noop(): void {}\nfunction returnTrue(): boolean {\n return true\n}\nfunction returnFalse(): boolean {\n return false\n}\n\nclass DndStore {\n readonly dragging: Signal<boolean> = createSignal(false)\n readonly direction: Signal<'row' | 'col'> = createSignal<'row' | 'col'>('row')\n readonly draggingIndex: Signal<number> = createSignal(-1)\n readonly droppingIndex: Signal<number> = createSignal(-1)\n readonly x: Signal<number> = createSignal(-1)\n readonly y: Signal<number> = createSignal(-1)\n readonly startX: Signal<number> = createSignal(-1)\n readonly startY: Signal<number> = createSignal(-1)\n}\n\n/**\n * @internal\n */\nexport interface TableHandleStore {\n readonly dndStore: DndStore\n readonly setIsColumnMenuOpen: (open: boolean) => void\n readonly setIsRowMenuOpen: (open: boolean) => void\n readonly columnOverlayStore: OverlayStore\n readonly rowOverlayStore: OverlayStore\n readonly getReferenceCell: () => HoveringCellInfo | undefined\n}\n\n/**\n * @internal\n */\nexport function createTableHandleStore(\n getHoveringCellInfo: () => HoveringCellInfo | undefined,\n getCanShow: () => boolean,\n): TableHandleStore {\n const isColumnMenuOpen = createSignal(false)\n const isRowMenuOpen = createSignal(false)\n\n const getHasMenuOpen = (): boolean => {\n return isColumnMenuOpen.get() || isRowMenuOpen.get()\n }\n\n const setIsRowMenuOpen = (open: boolean): void => {\n isRowMenuOpen.set(open)\n }\n\n const setIsColumnMenuOpen = (open: boolean): void => {\n isColumnMenuOpen.set(open)\n }\n\n const referenceCellInfo = createSignal<HoveringCellInfo | undefined>(undefined)\n\n let prevHoveringCellInfo: HoveringCellInfo | undefined = undefined\n\n const getReferenceCell = computed((): HoveringCellInfo | undefined => {\n if (!getCanShow()) {\n referenceCellInfo.set(undefined)\n return\n }\n\n // Do not toggle/update the menu when hovering another cell if the menu is already open\n if (getHasMenuOpen()) {\n return prevHoveringCellInfo\n }\n\n prevHoveringCellInfo = getHoveringCellInfo()\n return prevHoveringCellInfo\n })\n\n const getOpen = computed((): boolean => {\n return !!getReferenceCell()\n })\n\n const handleOpenChange = (event: OpenChangeEvent) => {\n if (getHasMenuOpen()) {\n event.preventDefault()\n }\n }\n\n const columnOverlayStore = createOverlayStore(\n getOpen,\n noop,\n returnTrue,\n returnFalse,\n handleOpenChange,\n )\n const rowOverlayStore = createOverlayStore(\n getOpen,\n noop,\n returnTrue,\n returnFalse,\n handleOpenChange,\n )\n\n return {\n dndStore: new DndStore(),\n setIsRowMenuOpen,\n setIsColumnMenuOpen,\n columnOverlayStore,\n rowOverlayStore,\n getReferenceCell,\n }\n}\n\n/**\n * @internal\n */\nexport const tableHandleStoreContext: Context<TableHandleStore> = createContext<TableHandleStore>('prosekit-table-handle-store')\n","import {\n defineCustomElement,\n defineProps,\n registerCustomElement,\n type HostElement,\n type HostElementConstructor,\n type PropsDeclaration,\n type State,\n} from '@aria-ui/core'\nimport { setupOverlayPopup } from '@aria-ui/elements/overlay'\n\nimport { tableHandleStoreContext } from './store.ts'\n\nexport interface TableHandleColumnPopupProps {}\n\n/** @internal */\nexport const TableHandleColumnPopupPropsDeclaration: PropsDeclaration<TableHandleColumnPopupProps> = defineProps<\n TableHandleColumnPopupProps\n>({})\n\n/** @internal */\nexport function setupTableHandleColumnPopup(\n host: HostElement,\n _props: State<TableHandleColumnPopupProps>,\n): void {\n const getStore = tableHandleStoreContext.consume(host)\n const getOverlayStore = () => getStore()?.columnOverlayStore\n setupOverlayPopup(host, getOverlayStore)\n}\n\nconst TableHandleColumnPopupElementBase: HostElementConstructor<TableHandleColumnPopupProps> = defineCustomElement(\n setupTableHandleColumnPopup,\n TableHandleColumnPopupPropsDeclaration,\n)\n\n/**\n * `<prosekit-table-handle-column-popup>` custom element.\n *\n * Properties: {@link TableHandleColumnPopupProps}\n *\n * Data attributes:\n *\n * | Attribute | Description |\n * | --- | --- |\n * | `data-state` | `\"open\"` when visible, `\"closed\"` otherwise |\n */\nexport class TableHandleColumnPopupElement extends TableHandleColumnPopupElementBase {}\n\n/** @internal */\nexport function registerTableHandleColumnPopupElement(): void {\n registerCustomElement('prosekit-table-handle-column-popup', TableHandleColumnPopupElement)\n}\n","import { computed } from '@aria-ui/core'\nimport { isHTMLElement } from '@ocavue/utils'\nimport type { Editor } from '@prosekit/core'\n\nexport function useHTMLElementAt(\n getEditor: () => Editor | null | undefined,\n getPos: () => number | null | undefined,\n): () => HTMLElement | undefined {\n return computed(() => {\n const editor = getEditor()\n const pos = getPos()\n if (!editor || !pos) return\n const view = editor.view\n const element = view.nodeDOM(pos)\n if (element && isHTMLElement(element)) return element\n })\n}\n","import { defineProps, type PropsDeclaration } from '@aria-ui/core'\nimport { OverlayPositionerPropsDeclaration, type OverlayPositionerProps } from '@aria-ui/elements/overlay'\nimport type { Editor } from '@prosekit/core'\n\n/**\n * @internal\n */\nexport interface SharedTableHandlePositionerProps extends Omit<OverlayPositionerProps, 'hoist' | 'flip' | 'shift' | 'hide' | 'offset'> {\n /**\n * The ProseKit editor instance.\n *\n * @default null\n * @hidden\n */\n editor: Editor | null\n\n /**\n * Whether to use the browser [Popover API](https://developer.mozilla.org/en-US/docs/Web/API/Popover_API)\n * to place the floating element on top of other page content.\n *\n * @default false\n */\n hoist: OverlayPositionerProps['hoist']\n\n /**\n * @default false\n * @hidden\n */\n flip: OverlayPositionerProps['flip']\n\n /**\n * @default false\n * @hidden\n */\n shift: OverlayPositionerProps['shift']\n\n /**\n * @default true\n * @hidden\n */\n hide: OverlayPositionerProps['hide']\n\n /**\n * @default 0\n * @hidden\n */\n offset: OverlayPositionerProps['offset']\n}\n\n/** @internal */\nexport const SharedTableHandlePositionerPropsDeclaration: PropsDeclaration<SharedTableHandlePositionerProps> = defineProps<\n SharedTableHandlePositionerProps\n>({\n ...OverlayPositionerPropsDeclaration,\n editor: { default: null, attribute: false, type: 'json' },\n hoist: { default: false, attribute: false, type: 'boolean' },\n flip: { default: false, attribute: false, type: 'json' },\n shift: { default: false, attribute: false, type: 'boolean' },\n hide: { default: true, attribute: false, type: 'boolean' },\n offset: { default: 0, attribute: false, type: 'json' },\n})\n","import {\n computed,\n defineCustomElement,\n defineProps,\n registerCustomElement,\n useEffect,\n type HostElement,\n type HostElementConstructor,\n type PropsDeclaration,\n type State,\n} from '@aria-ui/core'\nimport { setupOverlayPositioner } from '@aria-ui/elements/overlay'\nimport type { Placement } from '@floating-ui/dom'\n\nimport { useHTMLElementAt } from '../../utils/use-html-element-at.ts'\n\nimport { SharedTableHandlePositionerPropsDeclaration, type SharedTableHandlePositionerProps } from './shared.ts'\nimport { tableHandleStoreContext } from './store.ts'\n\nexport interface TableHandleColumnPositionerProps extends Omit<SharedTableHandlePositionerProps, 'placement'> {\n /**\n * The placement of the popover, relative to the hovered table cell.\n *\n * @default \"top\"\n */\n placement: Placement\n}\n\n/** @internal */\nexport const TableHandleColumnPositionerPropsDeclaration: PropsDeclaration<TableHandleColumnPositionerProps> = defineProps<\n TableHandleColumnPositionerProps\n>({\n ...SharedTableHandlePositionerPropsDeclaration,\n placement: { default: 'top', attribute: 'placement', type: 'string' },\n})\n\n/** @internal */\nexport function setupTableHandleColumnPositioner(\n host: HostElement,\n props: State<TableHandleColumnPositionerProps>,\n): void {\n const getStore = tableHandleStoreContext.consume(host)\n const getOverlayStore = () => getStore()?.columnOverlayStore\n setupOverlayPositioner(host, props, getOverlayStore)\n\n const getEditor = props.editor.get\n const getColumnFirstCellPos = computed(() => getStore()?.getReferenceCell()?.colFirstCellPos)\n const getReferenceCell = useHTMLElementAt(getEditor, getColumnFirstCellPos)\n useEffect(host, () => {\n getOverlayStore()?.setAnchorElement(getReferenceCell())\n })\n}\n\nconst TableHandleColumnPositionerElementBase: HostElementConstructor<TableHandleColumnPositionerProps> = defineCustomElement(\n setupTableHandleColumnPositioner,\n TableHandleColumnPositionerPropsDeclaration,\n)\n\n/**\n * `<prosekit-table-handle-column-positioner>` custom element.\n *\n * Properties: {@link TableHandleColumnPositionerProps}\n *\n * Data attributes:\n *\n * | Attribute | Description |\n * | --- | --- |\n * | `data-state` | `\"open\"` when visible, `\"closed\"` otherwise |\n * | `data-side` | The side of the anchor element the positioner is on |\n * | `data-align` | The alignment of the positioner relative to the anchor element |\n *\n * CSS variables:\n *\n * | Variable | Description |\n * | --- | --- |\n * | `--transform-origin` | The coordinates that this element is anchored to. Useful for scale animations. |\n */\nexport class TableHandleColumnPositionerElement extends TableHandleColumnPositionerElementBase {}\n\n/** @internal */\nexport function registerTableHandleColumnPositionerElement(): void {\n registerCustomElement('prosekit-table-handle-column-positioner', TableHandleColumnPositionerElement)\n}\n","import {\n defineCustomElement,\n defineProps,\n registerCustomElement,\n useEffect,\n type HostElement,\n type HostElementConstructor,\n type PropsDeclaration,\n type State,\n} from '@aria-ui/core'\nimport { MenuRootPropsDeclaration, setupMenuRoot, type MenuRootProps } from '@aria-ui/elements/menu'\n\nimport { tableHandleStoreContext } from './store.ts'\n\nexport interface TableHandleColumnMenuRootProps extends MenuRootProps {}\n\n/** @internal */\nexport const TableHandleColumnMenuRootPropsDeclaration: PropsDeclaration<TableHandleColumnMenuRootProps> = defineProps<\n TableHandleColumnMenuRootProps\n>(MenuRootPropsDeclaration)\n\n/** @internal */\nexport function setupTableHandleColumnMenuRoot(\n host: HostElement,\n props: State<TableHandleColumnMenuRootProps>,\n): void {\n setupMenuRoot(host, props)\n const getStore = tableHandleStoreContext.consume(host)\n\n useEffect(host, () => {\n const open = props.open.get() || false\n const store = getStore?.()\n if (!store) return\n store.setIsColumnMenuOpen(open)\n })\n}\n\nconst TableHandleColumnMenuRootElementBase: HostElementConstructor<TableHandleColumnMenuRootProps> = defineCustomElement(\n setupTableHandleColumnMenuRoot,\n TableHandleColumnMenuRootPropsDeclaration,\n)\n\n/**\n * `<prosekit-table-handle-column-menu-root>` custom element.\n *\n * Properties: {@link TableHandleColumnMenuRootProps}\n */\nexport class TableHandleColumnMenuRootElement extends TableHandleColumnMenuRootElementBase {}\n\n/** @internal */\nexport function registerTableHandleColumnMenuRootElement(): void {\n registerCustomElement('prosekit-table-handle-column-menu-root', TableHandleColumnMenuRootElement)\n}\n","import { useEffect, type HostElement } from '@aria-ui/core'\n\n/**\n * Returns a function that returns a 1x1 transparent image. This is used to\n * prevent the browser from showing the default drag image. An earth icon in\n * chrome is used as the default drag image. This image must be loaded before\n * the dragStart event triggers.\n *\n * See https://stackoverflow.com/a/40923520\n *\n * @internal\n */\nexport function useEmptyImage(\n host: HostElement,\n): () => HTMLImageElement | undefined {\n let image: HTMLImageElement | undefined\n\n useEffect(host, () => {\n image = new Image(1, 1)\n image.src = 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7'\n\n return () => {\n image?.remove()\n image = undefined\n }\n })\n\n return () => image\n}\n","import {\n createSignal,\n defineCustomElement,\n defineProps,\n onMount,\n registerCustomElement,\n type HostElement,\n type HostElementConstructor,\n type PropsDeclaration,\n type State,\n} from '@aria-ui/core'\nimport { setupMenuTrigger, type MenuTriggerProps } from '@aria-ui/elements/menu'\nimport { useEventListener } from '@aria-ui/utils'\nimport type { Editor } from '@prosekit/core'\nimport { selectTableColumn, type defineTableCommands } from '@prosekit/extensions/table'\n\nimport { tableHandleStoreContext } from './store.ts'\nimport { useEmptyImage } from './use-empty-image.ts'\n\ntype TableCommandsExtension = ReturnType<typeof defineTableCommands>\n\nexport interface TableHandleColumnMenuTriggerProps {\n /**\n * @default null\n * @hidden\n */\n editor: Editor<TableCommandsExtension> | null\n}\n\n/** @internal */\nexport const TableHandleColumnMenuTriggerPropsDeclaration: PropsDeclaration<TableHandleColumnMenuTriggerProps> = defineProps<\n TableHandleColumnMenuTriggerProps\n>({\n editor: { default: null, attribute: false, type: 'json' },\n})\n\n/** @internal */\nexport function setupTableHandleColumnMenuTrigger(\n host: HostElement,\n props: State<TableHandleColumnMenuTriggerProps>,\n): void {\n const getEditor = props.editor.get\n const getStore = tableHandleStoreContext.consume(host)\n\n const triggerProps: State<MenuTriggerProps> = {\n disabled: createSignal(false),\n }\n setupMenuTrigger(host, triggerProps)\n\n useEventListener(host, 'pointerdown', () => {\n const editor = getEditor()\n const cellPos = getStore()?.getReferenceCell()?.cellPos\n if (!editor || !cellPos) return\n editor.exec(selectTableColumn({ head: cellPos }))\n })\n\n onMount(host, () => {\n host.draggable = true\n })\n\n const getEmptyImage = useEmptyImage(host)\n\n useEventListener(host, 'dragstart', (event: DragEvent) => {\n const dataTransfer = event.dataTransfer\n if (dataTransfer) {\n dataTransfer.effectAllowed = 'move'\n const emptyImage = getEmptyImage()\n if (emptyImage) {\n dataTransfer.setDragImage(emptyImage, 0, 0)\n }\n dataTransfer.setData('application/x-prosekit-table-handle-drag', '')\n }\n const store = getStore()\n if (!store) return\n const index = store.getReferenceCell()?.colIndex\n\n if (index == null || index < 0) {\n console.warn('[prosekit] Invalid column index for drag operation:', index)\n event.preventDefault()\n return\n }\n\n const dndStore = store.dndStore\n dndStore.direction.set('col')\n dndStore.dragging.set(true)\n dndStore.draggingIndex.set(index)\n dndStore.startX.set(event.clientX)\n dndStore.startY.set(event.clientY)\n })\n}\n\nconst TableHandleColumnMenuTriggerElementBase: HostElementConstructor<TableHandleColumnMenuTriggerProps> = defineCustomElement(\n setupTableHandleColumnMenuTrigger,\n TableHandleColumnMenuTriggerPropsDeclaration,\n)\n\n/**\n * `<prosekit-table-handle-column-menu-trigger>` custom element.\n *\n * Properties: {@link TableHandleColumnMenuTriggerProps}\n */\nexport class TableHandleColumnMenuTriggerElement extends TableHandleColumnMenuTriggerElementBase {}\n\n/**\n * @internal\n */\nexport function registerTableHandleColumnMenuTriggerElement(): void {\n registerCustomElement('prosekit-table-handle-column-menu-trigger', TableHandleColumnMenuTriggerElement)\n}\n","import { useEffect, type HostElement } from '@aria-ui/core'\nimport { computePosition, offset } from '@floating-ui/dom'\nimport { isHTMLElement } from '@ocavue/utils'\nimport type { Editor } from '@prosekit/core'\nimport type { EditorView } from '@prosekit/pm/view'\n\nimport { assignStyles } from '../../utils/assign-styles.ts'\nimport { getSafeEditorView } from '../../utils/get-safe-editor-view.ts'\n\nimport { tableHandleStoreContext } from './store.ts'\n\nexport type OnInitParams = {\n host: HostElement\n direction: 'row' | 'col'\n dragging: boolean\n draggingIndex: number\n table: HTMLTableElement\n cell: HTMLTableCellElement\n}\n\nexport function useInitDndPosition(\n host: HostElement,\n getEditor: () => Editor | null,\n onInit: (params: OnInitParams) => void,\n): void {\n const getStore = tableHandleStoreContext.consume(host)\n\n useEffect(host, () => {\n const view = getSafeEditorView(getEditor())\n if (!view) return\n\n const store = getStore()\n if (!store) return\n\n const dndStore = store.dndStore\n\n const dragging = dndStore.dragging.get()\n const direction = dndStore.direction.get()\n\n host.dataset.direction = direction\n host.dataset.dragging = dragging.toString()\n\n const draggingIndex = dndStore.draggingIndex.get()\n\n const relatedDOMs = getDndRelatedDOMs(view, store.getReferenceCell()?.cellPos, draggingIndex, direction)\n if (!relatedDOMs) return\n const { table, cell } = relatedDOMs\n\n onInit({\n host,\n direction,\n dragging,\n draggingIndex,\n table,\n cell,\n })\n\n if (!dragging) return\n\n let cancelled = false\n\n void computePosition(cell, host, {\n placement: direction === 'row' ? 'right' : 'bottom',\n middleware: [\n offset(({ rects }) => {\n if (direction === 'col') {\n return -rects.reference.height\n }\n return -rects.reference.width\n }),\n ],\n }).then(({ x, y }) => {\n if (cancelled) return\n assignStyles(host, {\n left: `${x}px`,\n top: `${y}px`,\n })\n })\n\n return () => {\n cancelled = true\n }\n })\n}\n\nfunction getTableDOMByPos(view: EditorView, pos: number): HTMLTableElement | undefined {\n const dom = view.domAtPos(pos).node\n if (!dom) return\n const element = isHTMLElement(dom) ? dom : dom.parentElement\n const table = element?.closest('table')\n return table ?? undefined\n}\n\nfunction getTargetFirstCellDOM(table: HTMLTableElement, index: number, direction: 'row' | 'col'): HTMLTableCellElement | undefined {\n if (direction === 'row') {\n const row = table.querySelectorAll('tr')[index]\n const cell = row?.querySelector<HTMLTableCellElement>('td, th')\n return cell ?? undefined\n } else {\n const row = table.querySelector('tr')\n const cell = row?.querySelectorAll<HTMLTableCellElement>('td, th')[index]\n return cell ?? undefined\n }\n}\n\nexport function getDndRelatedDOMs(\n view: EditorView,\n cellPos: number | undefined,\n draggingIndex: number,\n direction: 'row' | 'col',\n): { table: HTMLTableElement; cell: HTMLTableCellElement } | undefined {\n if (cellPos == null) return\n const table = getTableDOMByPos(view, cellPos)\n if (!table) return\n const cell = getTargetFirstCellDOM(table, draggingIndex, direction)\n if (!cell) return\n return { table, cell }\n}\n","import { getId } from '@ocavue/utils'\n\n/**\n * Creates a deep clone of an Element, including all computed styles so that\n * it looks almost exactly the same as the original element.\n */\nexport function deepCloneElement<T extends Element>(element: T, important = false): [T, string] {\n const clonedElement = element.cloneNode(true) as T\n const style = deepCopyStyles(element, clonedElement, important)\n return [clonedElement, style]\n}\n\n/**\n * Creates a clone of an Element, including all computed styles so that\n * it looks similar enough to the original element.\n */\nexport function cloneElement<T extends Element>(element: T, important = false): [T, string] {\n const clonedElement = element.cloneNode() as T\n const style = copyStyles(element, clonedElement, important)\n return [clonedElement, style]\n}\n\nfunction deepCopyStyles(source: Element, target: Element, important: boolean): string {\n const sources = [source]\n const targets = [target]\n const styles: string[] = []\n\n while (sources.length > 0 && sources.length === targets.length) {\n const source = sources.pop()\n const target = targets.pop()\n\n if (!source || !target) {\n break\n }\n\n const style = copyStyles(source, target, important)\n if (style) {\n styles.push(style)\n }\n\n sources.push(...source.children)\n targets.push(...target.children)\n }\n\n return styles.join('\\n')\n}\n\nfunction copyStyles(source: Element, target: Element, important: boolean): string {\n if (!source || !target) {\n return ''\n }\n\n const view = source.ownerDocument?.defaultView\n if (!view) {\n return ''\n }\n\n // Known issue: pseudo styles are not copied.\n const sourceStyle = view.getComputedStyle(source)\n const targetStyle = (target as HTMLElement | SVGElement | MathMLElement).style\n\n if (!sourceStyle || !targetStyle) {\n return ''\n }\n\n for (const key of sourceStyle) {\n targetStyle.setProperty(\n key,\n sourceStyle.getPropertyValue(key),\n // Enforce important to avoid the style being overridden when the element\n // is connected to the page.\n // See https://github.com/prosekit/prosekit/issues/1185 for more details.\n important ? 'important' : (sourceStyle.getPropertyPriority(key) || ''),\n )\n }\n\n const styles: string[] = []\n for (const pseudoSelector of [':before', ':after']) {\n const sourcePseudoStyle = view.getComputedStyle(source, pseudoSelector)\n const targetPseudoStyle = view.getComputedStyle(target, pseudoSelector)\n\n if (!sourcePseudoStyle) {\n continue\n }\n\n const content = sourcePseudoStyle.getPropertyValue('content')\n const hasPseudoElement = content && content !== 'none' && content !== 'normal'\n\n if (!hasPseudoElement) {\n continue\n }\n\n const cssProps: string[] = []\n for (const property of sourcePseudoStyle) {\n const sourceValue = sourcePseudoStyle.getPropertyValue(property)\n const sourcePriority = sourcePseudoStyle.getPropertyPriority(property)\n const targetValue = targetPseudoStyle.getPropertyValue(property)\n const targetPriority = targetPseudoStyle.getPropertyPriority(property)\n if (sourceValue !== targetValue || sourcePriority !== targetPriority) {\n cssProps.push(`${property}: ${sourceValue}${sourcePriority ? ' !important' : ''};`)\n }\n }\n\n const uniqueClassName = `clone-pseudo-element-${getId()}`\n target.classList.add(uniqueClassName)\n styles.push(`.${uniqueClassName}${pseudoSelector} { ${cssProps.join(' ')} }`)\n }\n\n return styles.join('\\n')\n}\n","import { once } from '@ocavue/utils'\n\nexport const isColorMixSupported: () => boolean = once(() => {\n try {\n return CSS.supports('background-color', 'color-mix(in srgb, red, blue)')\n } catch {\n return false\n }\n})\n","import { isColorMixSupported } from './css-feature-detection.ts'\n\n/**\n * Convert a color to a color with opacity\n * @param color - The color to convert\n * @param opacity - The opacity to apply\n * @returns The converted color if color-mix is supported, otherwise undefined\n */\nexport function fadeColor(color: CSSStyleValue, opacity: number): string | undefined {\n if (isColorMixSupported()) {\n const transparentWeight = (1 - opacity) * 100\n const colorWeight = opacity * 100\n return `color-mix(in srgb, ${color} ${colorWeight}%, transparent ${transparentWeight}%)`\n }\n}\n","export function getEffectiveBackgroundColor(element: HTMLElement): string | undefined {\n let current: HTMLElement | null = element\n\n while (current) {\n const style = current.ownerDocument.defaultView?.getComputedStyle(current)\n const backgroundColor = style?.backgroundColor\n\n if (\n backgroundColor\n && backgroundColor !== 'transparent'\n // Chrome returns `rgba(0, 0, 0, 0)` for transparent colors.\n && backgroundColor !== 'rgba(0, 0, 0, 0)'\n ) {\n return backgroundColor\n }\n\n current = current.parentElement\n }\n\n return undefined\n}\n","import { getDocument } from '@ocavue/utils'\n\nexport function injectStyle(container: HTMLElement, styleText: string): void {\n if (!styleText) {\n return\n }\n const document = getDocument(container)\n const style = document.createElement('style')\n style.textContent = styleText\n container.appendChild(style)\n}\n","import { assignStyles } from '../../utils/assign-styles.ts'\nimport { cloneElement, deepCloneElement } from '../../utils/clone-element.ts'\nimport { fadeColor } from '../../utils/fade-color.ts'\nimport { getEffectiveBackgroundColor } from '../../utils/get-effective-background-color.ts'\nimport { injectStyle } from '../../utils/inject-style.ts'\n\nexport function clearPreviewDOM(previewRoot: HTMLElement): void {\n while (previewRoot.firstChild) {\n previewRoot.removeChild(previewRoot.firstChild)\n }\n}\n\nexport function createPreviewDOM(\n table: HTMLTableElement,\n previewRoot: HTMLElement,\n index: number,\n direction: 'row' | 'col',\n): void {\n clearPreviewDOM(previewRoot)\n\n const [previewTable, previewTableStyle] = cloneElement(table)\n injectStyle(previewRoot, previewTableStyle)\n unsetSize(previewTable)\n\n const tableBody = table.querySelector('tbody')\n const [previewTableBody, previewTableBodyStyle] = tableBody\n ? cloneElement(tableBody)\n : [table.ownerDocument.createElement('tbody'), '']\n injectStyle(previewRoot, previewTableBodyStyle)\n unsetSize(previewTableBody)\n\n // Get effective background color and apply it with some opacity\n const backgroundColor = getEffectiveBackgroundColor(table)\n if (backgroundColor) {\n const backgroundColorWithOpacity = fadeColor(backgroundColor, 0.8)\n if (backgroundColorWithOpacity) {\n assignStyles(previewTable, { backgroundColor: backgroundColorWithOpacity })\n }\n }\n\n previewTable.appendChild(previewTableBody)\n previewRoot.appendChild(previewTable)\n\n const rows = table.querySelectorAll('tr')\n\n if (direction === 'row') {\n const row = rows[index]\n const [previewRow, previewRowStyle] = deepCloneElement(row)\n injectStyle(previewRoot, previewRowStyle)\n previewTableBody.appendChild(previewRow)\n } else {\n rows.forEach((row) => {\n const [previewRow, previewRowStyle] = cloneElement(row)\n injectStyle(previewRoot, previewRowStyle)\n unsetSize(previewRow)\n const cells = row.querySelectorAll('td, th')\n const cell = cells[index]\n if (cell) {\n const [previewCell, previewCellStyle] = deepCloneElement(cell)\n injectStyle(previewRoot, previewCellStyle)\n previewRow.appendChild(previewCell)\n previewTableBody.appendChild(previewRow)\n }\n })\n }\n}\n\nfunction unsetSize(element: HTMLElement) {\n assignStyles(element, {\n width: 'unset',\n height: 'unset',\n minWidth: 'unset',\n minHeight: 'unset',\n maxWidth: 'unset',\n maxHeight: 'unset',\n })\n}\n","import {\n defineCustomElement,\n defineProps,\n registerCustomElement,\n useEffect,\n type HostElement,\n type HostElementConstructor,\n type PropsDeclaration,\n type State,\n} from '@aria-ui/core'\nimport { computePosition, type ReferenceElement } from '@floating-ui/dom'\nimport type { Editor } from '@prosekit/core'\n\nimport { assignStyles } from '../../utils/assign-styles.ts'\nimport { getSafeEditorView } from '../../utils/get-safe-editor-view.ts'\n\nimport { getDndRelatedDOMs, useInitDndPosition, type OnInitParams } from './dnd.ts'\nimport { clearPreviewDOM, createPreviewDOM } from './render-preview.ts'\nimport { tableHandleStoreContext } from './store.ts'\n\nexport interface TableHandleDragPreviewProps {\n /**\n * @default null\n * @hidden\n */\n editor: Editor | null\n}\n\n/** @internal */\nexport const TableHandleDragPreviewPropsDeclaration: PropsDeclaration<TableHandleDragPreviewProps> = defineProps<\n TableHandleDragPreviewProps\n>({\n editor: { default: null, attribute: false, type: 'json' },\n})\n\n/**\n * @internal\n */\nexport function setupTableHandleDragPreview(\n host: HostElement,\n props: State<TableHandleDragPreviewProps>,\n): void {\n const getEditor = props.editor.get\n\n useEffect(host, () => {\n assignStyles(host, {\n position: 'absolute',\n pointerEvents: 'none',\n })\n })\n\n useInitDndPosition(host, getEditor, onInitPreviewPosition)\n\n useUpdatePreviewPosition(host, getEditor)\n}\n\nfunction onInitPreviewPosition({ host, direction, dragging, table, cell, draggingIndex }: OnInitParams): void {\n assignStyles(host, {\n display: dragging ? 'block' : 'none',\n })\n\n if (!dragging) {\n clearPreviewDOM(host)\n return\n }\n\n createPreviewDOM(table, host, draggingIndex, direction)\n\n const tableRect = table.getBoundingClientRect()\n const cellRect = cell.getBoundingClientRect()\n\n if (direction === 'col') {\n assignStyles(host, {\n width: `${cellRect.width}px`,\n height: `${tableRect.height}px`,\n })\n }\n\n if (direction === 'row') {\n assignStyles(host, {\n width: `${tableRect.width}px`,\n height: `${cellRect.height}px`,\n })\n }\n}\n\nfunction useUpdatePreviewPosition(host: HostElement, getEditor: () => Editor | null): void {\n const getStore = tableHandleStoreContext.consume(host)\n\n useEffect(host, () => {\n const view = getSafeEditorView(getEditor())\n if (!view) return\n\n const store = getStore()\n if (!store) return\n const dndStore = store.dndStore\n\n if (!dndStore.dragging.get()) return\n\n const draggingIndex = dndStore.draggingIndex.get()\n const direction = dndStore.direction.get()\n const x = dndStore.x.get()\n const y = dndStore.y.get()\n\n const relatedDOMs = getDndRelatedDOMs(view, store.getReferenceCell()?.cellPos, draggingIndex, direction)\n if (!relatedDOMs) return\n const { cell } = relatedDOMs\n\n let cancelled = false\n\n void computePosition(\n getVirtualElement(cell, x, y),\n host,\n { placement: direction === 'row' ? 'right' : 'bottom' },\n ).then(({ x, y }) => {\n if (cancelled) return\n\n if (direction === 'row') {\n assignStyles(host, { top: `${y}px` })\n return\n }\n\n if (direction === 'col') {\n assignStyles(host, { left: `${x}px` })\n return\n }\n })\n\n return () => {\n cancelled = true\n }\n })\n}\n\nfunction getVirtualElement(cell: HTMLTableCellElement, x: number, y: number): ReferenceElement {\n return {\n contextElement: cell,\n getBoundingClientRect: () => {\n const rect = cell.getBoundingClientRect()\n return {\n width: rect.width,\n height: rect.height,\n right: x + rect.width / 2,\n bottom: y + rect.height / 2,\n top: y - rect.height / 2,\n left: x - rect.width / 2,\n x: x - rect.width / 2,\n y: y - rect.height / 2,\n }\n },\n }\n}\n\nconst TableHandleDragPreviewElementBase: HostElementConstructor<TableHandleDragPreviewProps> = defineCustomElement(\n setupTableHandleDragPreview,\n TableHandleDragPreviewPropsDeclaration,\n)\n\n/**\n * `<prosekit-table-handle-drag-preview>` custom element.\n *\n * Properties: {@link TableHandleDragPreviewProps}\n */\nexport class TableHandleDragPreviewElement extends TableHandleDragPreviewElementBase {}\n\n/**\n * @internal\n */\nexport function registerTableHandleDragPreviewElement(): void {\n registerCustomElement('prosekit-table-handle-drag-preview', TableHandleDragPreviewElement)\n}\n","function findDragOverElement(\n elements: Element[],\n pointer: number,\n axis: 'x' | 'y',\n): [Element, number] | undefined {\n const startProp = axis === 'x' ? 'left' : 'top'\n const endProp = axis === 'x' ? 'right' : 'bottom'\n const lastIndex = elements.length - 1\n\n const index = elements.findIndex((el, index) => {\n const rect = el.getBoundingClientRect()\n const boundaryStart = rect[startProp]\n const boundaryEnd = rect[endProp]\n\n // The pointer is within the boundary of the current element.\n if (boundaryStart <= pointer && pointer <= boundaryEnd) return true\n // The pointer is beyond the last element.\n if (index === lastIndex && pointer > boundaryEnd) return true\n // The pointer is before the first element.\n if (index === 0 && pointer < boundaryStart) return true\n\n return false\n })\n\n return index >= 0 ? [elements[index], index] : undefined\n}\n\nexport function getDragOverColumn(\n table: HTMLTableElement,\n pointerX: number,\n): [element: Element, index: number] | undefined {\n const firstRow = table.querySelector('tr')\n if (!firstRow) return\n const cells = Array.from(firstRow.children)\n return findDragOverElement(cells, pointerX, 'x')\n}\n\nexport function getDragOverRow(\n table: HTMLTableElement,\n pointerY: number,\n): [element: Element, index: number] | undefined {\n const rows = Array.from(table.querySelectorAll('tr'))\n return findDragOverElement(rows, pointerY, 'y')\n}\n","import {\n defineCustomElement,\n defineProps,\n registerCustomElement,\n useEffect,\n type HostElement,\n type HostElementConstructor,\n type PropsDeclaration,\n type State,\n} from '@aria-ui/core'\nimport { computePosition, offset } from '@floating-ui/dom'\nimport type { Editor } from '@prosekit/core'\nimport type { defineTableCommands } from '@prosekit/extensions/table'\n\nimport { assignStyles } from '../../utils/assign-styles.ts'\nimport { getSafeEditorView } from '../../utils/get-safe-editor-view.ts'\n\nimport { getDragOverColumn, getDragOverRow } from './calc-drag-over.ts'\nimport { getDndRelatedDOMs, useInitDndPosition, type OnInitParams } from './dnd.ts'\nimport { tableHandleStoreContext } from './store.ts'\n\ntype TableCommandsExtension = ReturnType<typeof defineTableCommands>\n\nconst HANDLE_WIDTH = 2\n\nexport interface TableHandleDropIndicatorProps {\n /**\n * @default null\n * @hidden\n */\n editor: Editor<TableCommandsExtension> | null\n}\n\n/** @internal */\nexport const TableHandleDropIndicatorPropsDeclaration: PropsDeclaration<TableHandleDropIndicatorProps> = defineProps<\n TableHandleDropIndicatorProps\n>({\n editor: { default: null, attribute: false, type: 'json' },\n})\n\n/**\n * @internal\n */\nexport function setupTableHandleDropIndicator(\n host: HostElement,\n props: State<TableHandleDropIndicatorProps>,\n): void {\n const getEditor = props.editor.get\n\n useEffect(host, () => {\n assignStyles(host, {\n pointerEvents: 'none',\n position: 'absolute',\n })\n })\n\n useInitDndPosition(host, getEditor, onInitIndicatorPosition)\n\n useUpdateIndicatorPosition(host, getEditor, HANDLE_WIDTH)\n}\n\nfunction onInitIndicatorPosition({ host, direction, dragging, table }: OnInitParams): void {\n assignStyles(host, {\n display: dragging ? 'block' : 'none',\n })\n\n const tableRect = table.getBoundingClientRect()\n\n if (direction === 'col') {\n assignStyles(host, {\n width: `${HANDLE_WIDTH}px`,\n height: `${tableRect.height}px`,\n })\n }\n\n if (direction === 'row') {\n assignStyles(host, {\n width: `${tableRect.width}px`,\n height: `${HANDLE_WIDTH}px`,\n })\n }\n}\n\nfunction useUpdateIndicatorPosition(host: HostElement, getEditor: () => Editor | null, handleWidth: number): void {\n const getStore = tableHandleStoreContext.consume(host)\n\n useEffect(host, () => {\n const view = getSafeEditorView(getEditor())\n if (!view) return\n\n const store = getStore()\n if (!store) return\n\n const dndStore = store.dndStore\n if (!dndStore.dragging.get()) return\n\n const draggingIndex = dndStore.draggingIndex.get()\n const direction = dndStore.direction.get()\n const x = dndStore.x.get()\n const y = dndStore.y.get()\n\n const relatedDOMs = getDndRelatedDOMs(view, store.getReferenceCell()?.cellPos, draggingIndex, direction)\n if (!relatedDOMs) return\n const { table } = relatedDOMs\n\n let cancelled = false\n const cleanup = () => {\n cancelled = true\n }\n\n if (direction === 'col') {\n const dir = dndStore.startX.get() > x ? 'left' : 'right'\n const dragOverColumn = getDragOverColumn(table, x)\n\n if (dragOverColumn) {\n const [col, index] = dragOverColumn\n dndStore.droppingIndex.set(index)\n void computePosition(col, host, {\n placement: dir === 'left' ? 'left' : 'right',\n middleware: [offset(dir === 'left' ? -1 * handleWidth : 0)],\n }).then(({ x }) => {\n if (cancelled) return\n assignStyles(host, { left: `${x}px` })\n })\n }\n\n return cleanup\n }\n\n if (direction === 'row') {\n const dir = dndStore.startY.get() > y ? 'up' : 'down'\n const dragOverRow = getDragOverRow(table, y)\n\n if (dragOverRow) {\n const [row, index] = dragOverRow\n dndStore.droppingIndex.set(index)\n void computePosition(row, host, {\n placement: dir === 'up' ? 'top' : 'bottom',\n middleware: [offset(dir === 'up' ? -1 * handleWidth : 0)],\n }).then(({ y }) => {\n if (cancelled) return\n assignStyles(host, { top: `${y}px` })\n })\n }\n\n return cleanup\n }\n })\n}\n\nconst TableHandleDropIndicatorElementBase: HostElementConstructor<TableHandleDropIndicatorProps> = defineCustomElement(\n setupTableHandleDropIndicator,\n TableHandleDropIndicatorPropsDeclaration,\n)\n\n/**\n * `<prosekit-table-handle-drop-indicator>` custom element.\n *\n * Properties: {@link TableHandleDropIndicatorProps}\n */\nexport class TableHandleDropIndicatorElement extends TableHandleDropIndicatorElementBase {}\n\n/**\n * @internal\n */\nexport function registerTableHandleDropIndicatorElement(): void {\n registerCustomElement('prosekit-table-handle-drop-indicator', TableHandleDropIndicatorElement)\n}\n","import { createSignal, type HostElement } from '@aria-ui/core'\nimport { defineDOMEventHandler, union, type Editor } from '@prosekit/core'\n\nimport { useEditorExtension } from './use-editor-extension.ts'\n\nexport function useEditorTyping(\n host: HostElement,\n getEditor: () => Editor | null,\n): () => boolean {\n const typing = createSignal(false)\n\n const extension = union(\n defineDOMEventHandler('keypress', () => {\n typing.set(true)\n }),\n defineDOMEventHandler('pointermove', () => {\n typing.set(false)\n }),\n )\n\n useEditorExtension(host, getEditor, extension)\n\n return typing.get\n}\n","import { createSignal, useEffect, type HostElement } from '@aria-ui/core'\nimport type { Editor } from '@prosekit/core'\n\nimport { getSafeEditorView } from '../utils/get-safe-editor-view.ts'\n\n/**\n * Detect if the user is selecting text inside the editor, in which case some\n * components should be disabled or hidden.\n */\nexport function useSelecting(\n host: HostElement,\n getEditor: () => Editor | null,\n getEnabled: () => boolean,\n): () => boolean {\n const selecting = createSignal(false)\n const isPointerDown = createSignal(false)\n\n useEffect(host, () => {\n if (!getEnabled()) return\n\n const view = getSafeEditorView(getEditor())\n if (!view) return\n\n const { dom, root } = view\n if (!root) return\n\n const handlePointerDown = () => {\n selecting.set(true)\n isPointerDown.set(true)\n }\n const handlePointerUp = () => {\n isPointerDown.set(false)\n }\n const handleMouseMove = () => {\n if (!isPointerDown.get()) {\n selecting.set(false)\n }\n }\n\n dom.addEventListener('pointerdown', handlePointerDown)\n root.addEventListener('pointerup', handlePointerUp)\n root.addEventListener('pointermove', handleMouseMove)\n\n return () => {\n dom.removeEventListener('pointerdown', handlePointerDown)\n root.removeEventListener('pointerup', handlePointerUp)\n root.removeEventListener('pointermove', handleMouseMove)\n }\n })\n\n return selecting.get\n}\n","import { computed, useEffect, type HostElement } from '@aria-ui/core'\nimport type { Editor } from '@prosekit/core'\nimport { moveTableColumn, moveTableRow } from '@prosekit/extensions/table'\n\nimport { getSafeEditorView } from '../../utils/get-safe-editor-view.ts'\n\nimport type { TableHandleStore } from './store.ts'\n\nexport function useDrop(\n host: HostElement,\n getEditor: () => Editor | null,\n store: TableHandleStore,\n): void {\n const getDndStore = () => store.dndStore\n const getDragging = computed(() => getDndStore().dragging.get())\n\n useEffect(host, () => {\n const view = getSafeEditorView(getEditor())\n if (!view || !view.editable) return\n\n const ownerDocument = view.dom?.ownerDocument\n if (!ownerDocument) return\n\n const handleDrop = () => {\n if (!getDragging()) return\n const editor = getEditor()\n if (!editor) return\n\n const dndStore = getDndStore()\n\n const droppingIndex = dndStore.droppingIndex.get()\n const draggingIndex = dndStore.draggingIndex.get()\n const direction = dndStore.direction.get()\n\n if (draggingIndex < 0 || droppingIndex < 0) {\n console.warn('[prosekit] Invalid drag indices:', { draggingIndex, droppingIndex })\n return\n }\n\n if (direction === 'row') {\n editor.exec(moveTableRow({ from: draggingIndex, to: droppingIndex }))\n return\n }\n if (direction === 'col') {\n editor.exec(moveTableColumn({ from: draggingIndex, to: droppingIndex }))\n return\n }\n }\n\n const handleDragOver = (event: DragEvent) => {\n if (!getDragging()) return\n event.preventDefault()\n const dndStore = getDndStore()\n dndStore.dragging.set(true)\n dndStore.x.set(event.clientX)\n dndStore.y.set(event.clientY)\n }\n\n const handleDragEnd = () => {\n if (!getDragging()) return\n const dndStore = getDndStore()\n dndStore.dragging.set(false)\n }\n\n ownerDocument.addEventListener('dragover', handleDragOver)\n ownerDocument.addEventListener('drop', handleDrop)\n ownerDocument.addEventListener('dragend', handleDragEnd)\n return () => {\n ownerDocument.removeEventListener('dragover', handleDragOver)\n ownerDocument.removeEventListener('drop', handleDrop)\n ownerDocument.removeEventListener('dragend', handleDragEnd)\n }\n })\n}\n","import type { EditorView } from '@prosekit/pm/view'\nimport { cellAround, TableMap } from 'prosemirror-tables'\n\nexport interface HoveringCellInfo {\n rowIndex: number\n colIndex: number\n cellPos: number\n rowFirstCellPos: number\n colFirstCellPos: number\n}\n\nexport function isHoveringCellInfoEqual(\n a?: HoveringCellInfo | null,\n b?: HoveringCellInfo | null,\n): boolean {\n if (!a && !b) return true\n if (!a || !b) return false\n return (\n a.rowIndex === b.rowIndex\n && a.colIndex === b.colIndex\n && a.cellPos === b.cellPos\n && a.rowFirstCellPos === b.rowFirstCellPos\n && a.colFirstCellPos === b.colFirstCellPos\n )\n}\n\n/**\n * Copied from https://github.com/ProseMirror/prosemirror-tables/blob/v1.5.0/src/columnresizing.ts#L256\n *\n * @internal\n */\nfunction domCellAround(target: HTMLElement | null): HTMLElement | null {\n while (target && target.nodeName != 'TD' && target.nodeName != 'TH') {\n target = target.classList?.contains('ProseMirror')\n ? null\n : (target.parentNode as HTMLElement | null)\n }\n return target\n}\n\nexport function getHoveringCell(\n view: EditorView,\n event: MouseEvent,\n): HoveringCellInfo | undefined {\n const domCell = domCellAround(event.target as HTMLElement | null)\n if (!domCell) return\n\n const { left, top, width, height } = domCell.getBoundingClientRect()\n const eventPos = view.posAtCoords({\n // Use the center coordinates of the cell to ensure we're within the\n // selected cell. This prevents potential issues when the mouse is on the\n // border of two cells.\n left: left + width / 2,\n top: top + height / 2,\n })\n if (!eventPos) return\n\n const $cellPos = cellAround(view.state.doc.resolve(eventPos.pos))\n if (!$cellPos) return\n\n const map = TableMap.get($cellPos.node(-1))\n const tableStart = $cellPos.start(-1)\n const cellRect = map.findCell($cellPos.pos - tableStart)\n const rowIndex = cellRect.top\n const colIndex = cellRect.left\n\n return {\n rowIndex,\n colIndex,\n cellPos: $cellPos.pos,\n rowFirstCellPos: getCellPos(map, tableStart, rowIndex, 0),\n colFirstCellPos: getCellPos(map, tableStart, 0, colIndex),\n }\n}\n\nfunction getCellPos(\n map: TableMap,\n tableStart: number,\n rowIndex: number,\n colIndex: number,\n) {\n const cellIndex = getCellIndex(map, rowIndex, colIndex)\n const posInTable = map.map[cellIndex]\n return tableStart + posInTable\n}\n\nfunction getCellIndex(\n map: TableMap,\n rowIndex: number,\n colIndex: number,\n): number {\n return map.width * rowIndex + colIndex\n}\n","import {\n computed,\n createSignal,\n defineCustomElement,\n defineProps,\n registerCustomElement,\n type HostElement,\n type HostElementConstructor,\n type PropsDeclaration,\n type State,\n} from '@aria-ui/core'\nimport { defineDOMEventHandler, type Editor } from '@prosekit/core'\nimport type { EditorView } from '@prosekit/pm/view'\n\nimport { useEditorExtension } from '../../hooks/use-editor-extension.ts'\nimport { useEditorTyping } from '../../hooks/use-editor-typing.ts'\nimport { useScrolling } from '../../hooks/use-scrolling.ts'\nimport { useSelecting } from '../../hooks/use-selecting.ts'\n\nimport { createTableHandleStore, tableHandleStoreContext } from './store.ts'\nimport { useDrop } from './use-drop.ts'\nimport { getHoveringCell, isHoveringCellInfoEqual, type HoveringCellInfo } from './utils.ts'\n\nexport interface TableHandleRootProps {\n /**\n * The ProseKit editor instance.\n *\n * @default null\n * @hidden\n */\n editor: Editor | null\n}\n\n/** @internal */\nexport const TableHandleRootPropsDeclaration: PropsDeclaration<TableHandleRootProps> = defineProps<TableHandleRootProps>({\n editor: { default: null, attribute: false, type: 'json' },\n})\n\n/**\n * @internal\n */\nexport function setupTableHandleRoot(\n host: HostElement,\n props: State<TableHandleRootProps>,\n): void {\n const getEditor = props.editor.get\n\n const getHoveringCellInfo = useHoveringCell(host, getEditor)\n const getTyping = useEditorTyping(host, getEditor)\n const getIsInTable = computed(() => !!getHoveringCellInfo())\n const getSelecting = useSelecting(host, getEditor, getIsInTable)\n const getScrolling = useScrolling(host)\n const getCanShow = computed(() => !getTyping() && !getSelecting() && !getScrolling())\n\n const store = createTableHandleStore(getHoveringCellInfo, getCanShow)\n tableHandleStoreContext.provide(host, store)\n\n useDrop(host, getEditor, store)\n}\n\nfunction useHoveringCell(\n host: HostElement,\n getEditor: () => Editor | null,\n): () => HoveringCellInfo | undefined {\n const hoveringCell = createSignal<HoveringCellInfo | undefined>(undefined)\n\n const extension = defineCellHoverHandler((curr: HoveringCellInfo | undefined) => {\n const prev = hoveringCell.get()\n if (isHoveringCellInfoEqual(prev, curr)) return\n hoveringCell.set(curr)\n })\n\n useEditorExtension(host, getEditor, extension)\n\n return hoveringCell.get\n}\n\nfunction defineCellHoverHandler(\n handler: (hoveringCell: HoveringCellInfo | undefined) => void,\n) {\n const pointerHandler = (view: EditorView, event: PointerEvent) => {\n const hoveringCell = getHoveringCell(view, event)\n return handler(hoveringCell)\n }\n return defineDOMEventHandler('pointerover', pointerHandler)\n}\n\nconst TableHandleRootElementBase: HostElementConstructor<TableHandleRootProps> = defineCustomElement(\n setupTableHandleRoot,\n TableHandleRootPropsDeclaration,\n)\n\n/**\n * `<prosekit-table-handle-root>` custom element.\n *\n * Properties: {@link TableHandleRootProps}\n */\nexport class TableHandleRootElement extends TableHandleRootElementBase {}\n\n/**\n * @internal\n */\nexport function registerTableHandleRootElement(): void {\n registerCustomElement('prosekit-table-handle-root', TableHandleRootElement)\n}\n","import {\n defineCustomElement,\n defineProps,\n registerCustomElement,\n type HostElement,\n type HostElementConstructor,\n type PropsDeclaration,\n type State,\n} from '@aria-ui/core'\nimport { setupOverlayPopup } from '@aria-ui/elements/overlay'\n\nimport { tableHandleStoreContext } from './store.ts'\n\nexport interface TableHandleRowPopupProps {}\n\n/** @internal */\nexport const TableHandleRowPopupPropsDeclaration: PropsDeclaration<TableHandleRowPopupProps> = defineProps<TableHandleRowPopupProps>({})\n\n/** @internal */\nexport function setupTableHandleRowPopup(\n host: HostElement,\n _props: State<TableHandleRowPopupProps>,\n): void {\n const getStore = tableHandleStoreContext.consume(host)\n const getOverlayStore = () => getStore()?.rowOverlayStore\n setupOverlayPopup(host, getOverlayStore)\n}\n\nconst TableHandleRowPopupElementBase: HostElementConstructor<TableHandleRowPopupProps> = defineCustomElement(\n setupTableHandleRowPopup,\n TableHandleRowPopupPropsDeclaration,\n)\n\n/**\n * `<prosekit-table-handle-row-popup>` custom element.\n *\n * Properties: {@link TableHandleRowPopupProps}\n *\n * Data attributes:\n *\n * | Attribute | Description |\n * | --- | --- |\n * | `data-state` | `\"open\"` when visible, `\"closed\"` otherwise |\n */\nexport class TableHandleRowPopupElement extends TableHandleRowPopupElementBase {}\n\n/** @internal */\nexport function registerTableHandleRowPopupElement(): void {\n registerCustomElement('prosekit-table-handle-row-popup', TableHandleRowPopupElement)\n}\n","import {\n computed,\n defineCustomElement,\n defineProps,\n registerCustomElement,\n useEffect,\n type HostElement,\n type HostElementConstructor,\n type PropsDeclaration,\n type State,\n} from '@aria-ui/core'\nimport { setupOverlayPositioner } from '@aria-ui/elements/overlay'\nimport type { Placement } from '@floating-ui/dom'\n\nimport { useHTMLElementAt } from '../../utils/use-html-element-at.ts'\n\nimport { SharedTableHandlePositionerPropsDeclaration, type SharedTableHandlePositionerProps } from './shared.ts'\nimport { tableHandleStoreContext } from './store.ts'\n\nexport interface TableHandleRowPositionerProps extends Omit<SharedTableHandlePositionerProps, 'placement'> {\n /**\n * The placement of the popover, relative to the hovered table cell.\n *\n * @default \"left\"\n */\n placement: Placement\n}\n\n/** @internal */\nexport const TableHandleRowPositionerPropsDeclaration: PropsDeclaration<TableHandleRowPositionerProps> = defineProps<\n TableHandleRowPositionerProps\n>({\n ...SharedTableHandlePositionerPropsDeclaration,\n placement: { default: 'left', attribute: 'placement', type: 'string' },\n})\n\n/** @internal */\nexport function setupTableHandleRowPositioner(\n host: HostElement,\n props: State<TableHandleRowPositionerProps>,\n): void {\n const getStore = tableHandleStoreContext.consume(host)\n const getOverlayStore = () => getStore()?.rowOverlayStore\n setupOverlayPositioner(host, props, getOverlayStore)\n\n const getEditor = props.editor.get\n const getRowFirstCellPos = computed(() => getStore()?.getReferenceCell()?.rowFirstCellPos)\n const getReferenceCell = useHTMLElementAt(getEditor, getRowFirstCellPos)\n useEffect(host, () => {\n getOverlayStore()?.setAnchorElement(getReferenceCell())\n })\n}\n\nconst TableHandleRowPositionerElementBase: HostElementConstructor<TableHandleRowPositionerProps> = defineCustomElement(\n setupTableHandleRowPositioner,\n TableHandleRowPositionerPropsDeclaration,\n)\n\n/**\n * `<prosekit-table-handle-row-positioner>` custom element.\n *\n * Properties: {@link TableHandleRowPositionerProps}\n *\n * Data attributes:\n *\n * | Attribute | Description |\n * | --- | --- |\n * | `data-state` | `\"open\"` when visible, `\"closed\"` otherwise |\n * | `data-side` | The side of the anchor element the positioner is on |\n * | `data-align` | The alignment of the positioner relative to the anchor element |\n *\n * CSS variables:\n *\n * | Variable | Description |\n * | --- | --- |\n * | `--transform-origin` | The coordinates that this element is anchored to. Useful for scale animations. |\n */\nexport class TableHandleRowPositionerElement extends TableHandleRowPositionerElementBase {}\n\n/** @internal */\nexport function registerTableHandleRowPositionerElement(): void {\n registerCustomElement('prosekit-table-handle-row-positioner', TableHandleRowPositionerElement)\n}\n","import {\n defineCustomElement,\n defineProps,\n registerCustomElement,\n useEffect,\n type HostElement,\n type HostElementConstructor,\n type PropsDeclaration,\n type State,\n} from '@aria-ui/core'\nimport { MenuRootPropsDeclaration, setupMenuRoot, type MenuRootProps } from '@aria-ui/elements/menu'\n\nimport { tableHandleStoreContext } from './store.ts'\n\nexport interface TableHandleRowMenuRootProps extends MenuRootProps {}\n\n/** @internal */\nexport const TableHandleRowMenuRootPropsDeclaration: PropsDeclaration<TableHandleRowMenuRootProps> = defineProps<\n TableHandleRowMenuRootProps\n>(MenuRootPropsDeclaration)\n\n/** @internal */\nexport function setupTableHandleRowMenuRoot(\n host: HostElement,\n props: State<TableHandleRowMenuRootProps>,\n): void {\n setupMenuRoot(host, props)\n const getStore = tableHandleStoreContext.consume(host)\n\n useEffect(host, () => {\n const open = props.open.get() || false\n const store = getStore?.()\n if (!store) return\n store.setIsRowMenuOpen(open)\n })\n}\n\nconst TableHandleRowMenuRootElementBase: HostElementConstructor<TableHandleRowMenuRootProps> = defineCustomElement(\n setupTableHandleRowMenuRoot,\n TableHandleRowMenuRootPropsDeclaration,\n)\n\n/**\n * `<prosekit-table-handle-row-menu-root>` custom element.\n *\n * Properties: {@link TableHandleRowMenuRootProps}\n */\nexport class TableHandleRowMenuRootElement extends TableHandleRowMenuRootElementBase {}\n\n/** @internal */\nexport function registerTableHandleRowMenuRootElement(): void {\n registerCustomElement('prosekit-table-handle-row-menu-root', TableHandleRowMenuRootElement)\n}\n","import {\n createSignal,\n defineCustomElement,\n defineProps,\n onMount,\n registerCustomElement,\n type HostElement,\n type HostElementConstructor,\n type PropsDeclaration,\n type State,\n} from '@aria-ui/core'\nimport { setupMenuTrigger, type MenuTriggerProps } from '@aria-ui/elements/menu'\nimport { useEventListener } from '@aria-ui/utils'\nimport type { Editor } from '@prosekit/core'\nimport { selectTableRow, type defineTableCommands } from '@prosekit/extensions/table'\n\nimport { tableHandleStoreContext } from './store.ts'\nimport { useEmptyImage } from './use-empty-image.ts'\n\ntype TableCommandsExtension = ReturnType<typeof defineTableCommands>\n\nexport interface TableHandleRowMenuTriggerProps {\n /**\n * @default null\n * @hidden\n */\n editor: Editor<TableCommandsExtension> | null\n}\n\n/** @internal */\nexport const TableHandleRowMenuTriggerPropsDeclaration: PropsDeclaration<TableHandleRowMenuTriggerProps> = defineProps<\n TableHandleRowMenuTriggerProps\n>({\n editor: { default: null, attribute: false, type: 'json' },\n})\n\n/** @internal */\nexport function setupTableHandleRowMenuTrigger(\n host: HostElement,\n props: State<TableHandleRowMenuTriggerProps>,\n): void {\n const getEditor = props.editor.get\n const getStore = tableHandleStoreContext.consume(host)\n\n const triggerProps: State<MenuTriggerProps> = {\n disabled: createSignal(false),\n }\n setupMenuTrigger(host, triggerProps)\n\n useEventListener(host, 'pointerdown', () => {\n const editor = getEditor()\n const cellPos = getStore()?.getReferenceCell()?.cellPos\n if (!editor || !cellPos) return\n editor.exec(selectTableRow({ head: cellPos }))\n })\n\n onMount(host, () => {\n host.draggable = true\n })\n\n const getEmptyImage = useEmptyImage(host)\n\n useEventListener(host, 'dragstart', (event: DragEvent) => {\n const dataTransfer = event.dataTransfer\n if (dataTransfer) {\n dataTransfer.effectAllowed = 'move'\n const emptyImage = getEmptyImage()\n if (emptyImage) {\n dataTransfer.setDragImage(emptyImage, 0, 0)\n }\n }\n const store = getStore()\n if (!store) return\n const index = store.getReferenceCell()?.rowIndex\n\n if (index == null || index < 0) {\n console.warn('[prosekit] Invalid row index for drag operation:', index)\n event.preventDefault()\n return\n }\n\n const dndStore = store.dndStore\n\n dndStore.direction.set('row')\n dndStore.dragging.set(true)\n dndStore.draggingIndex.set(index)\n dndStore.startX.set(event.clientX)\n dndStore.startY.set(event.clientY)\n })\n}\n\nconst TableHandleRowMenuTriggerElementBase: HostElementConstructor<TableHandleRowMenuTriggerProps> = defineCustomElement(\n setupTableHandleRowMenuTrigger,\n TableHandleRowMenuTriggerPropsDeclaration,\n)\n\n/**\n * `<prosekit-table-handle-row-menu-trigger>` custom element.\n *\n * Properties: {@link TableHandleRowMenuTriggerProps}\n */\nexport class TableHandleRowMenuTriggerElement extends TableHandleRowMenuTriggerElementBase {}\n\n/**\n * @internal\n */\nexport function registerTableHandleRowMenuTriggerElement(): void {\n registerCustomElement('prosekit-table-handle-row-menu-trigger', TableHandleRowMenuTriggerElement)\n}\n"],"mappings":";;;;;;;;;;;;AAMA,SAAS,OAAa;AACtB,SAAS,aAAsB;AAC7B,QAAO;;AAET,SAAS,cAAuB;AAC9B,QAAO;;AAGT,IAAM,WAAN,MAAe;;kBACwB,aAAa,MAAM;mBACZ,aAA4B,MAAM;uBACrC,aAAa,GAAG;uBAChB,aAAa,GAAG;WAC5B,aAAa,GAAG;WAChB,aAAa,GAAG;gBACX,aAAa,GAAG;gBAChB,aAAa,GAAG;;;;;;AAkBpD,SAAgB,uBACd,qBACA,YACkB;CAClB,MAAM,mBAAmB,aAAa,MAAM;CAC5C,MAAM,gBAAgB,aAAa,MAAM;CAEzC,MAAM,uBAAgC;AACpC,SAAO,iBAAiB,KAAK,IAAI,cAAc,KAAK;;CAGtD,MAAM,oBAAoB,SAAwB;AAChD,gBAAc,IAAI,KAAK;;CAGzB,MAAM,uBAAuB,SAAwB;AACnD,mBAAiB,IAAI,KAAK;;CAG5B,MAAM,oBAAoB,aAA2C,KAAA,EAAU;CAE/E,IAAI,uBAAqD,KAAA;CAEzD,MAAM,mBAAmB,eAA6C;AACpE,MAAI,CAAC,YAAY,EAAE;AACjB,qBAAkB,IAAI,KAAA,EAAU;AAChC;;AAIF,MAAI,gBAAgB,CAClB,QAAO;AAGT,yBAAuB,qBAAqB;AAC5C,SAAO;GACP;CAEF,MAAM,UAAU,eAAwB;AACtC,SAAO,CAAC,CAAC,kBAAkB;GAC3B;CAEF,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AAA,CAAiB,iBAAA;;cAE/C,iCAAA,EAAmC,gBAAA,CAAiB,sBAAA;AAYjE;AAAA,cAVa,2BAAA,EAA6B,gBAAA,CAAiB,gBAAA;;cAE9C,8BAAA,EAAgC,gBAAA,CAAiB,mBAAA;AAAA,iBAE9C,0BAAA,CAAA;AAAA,iBAGA,6BAAA,CAAA;AAAA,iBAGA,2BAAA,CAAA;AAAA,iBAGA,gCAAA,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"prosekit-web-tooltip.js","names":[],"sources":["../src/components/tooltip/index.ts"],"sourcesContent":["/**\n\n@module\n\n## Anatomy\n\n```html\n<prosekit-tooltip-root>\n <prosekit-tooltip-trigger>...</prosekit-tooltip-trigger>\n <prosekit-tooltip-positioner>\n <prosekit-tooltip-popup>...</prosekit-tooltip-popup>\n </prosekit-tooltip-positioner>\n</prosekit-tooltip-root>\n```\n*/\n\nimport { registerCustomElement, type PropsDeclaration } from '@aria-ui/core'\nimport * as Base from '@aria-ui/elements/tooltip'\n\n/**\n * `<prosekit-tooltip-popup>` custom element.\n *\n * Properties: {@link TooltipPopupProps}\n *\n * Data attributes:\n *\n * | Attribute | Description |\n * | --- | --- |\n * | `data-state` | `\"open\"` when the tooltip is visible, `\"closed\"` otherwise |\n */\nexport class TooltipPopupElement extends Base.TooltipPopupElement {}\n\n/**\n * `<prosekit-tooltip-positioner>` custom element.\n *\n * Properties: {@link TooltipPositionerProps}\n *\n * Data attributes:\n *\n * | Attribute | Description |\n * | --- | --- |\n * | `data-state` | `\"open\"` when the tooltip is visible, `\"closed\"` otherwise |\n *\n * CSS variables:\n *\n * | Variable | Description |\n * | --- | --- |\n * | `--transform-origin` | The coordinates that this element is anchored to. Useful for scale animations. |\n */\nexport class TooltipPositionerElement extends Base.TooltipPositionerElement {}\n\n/**\n * `<prosekit-tooltip-root>` custom element.\n *\n * Properties: {@link TooltipRootProps}\n *\n * Events: {@link TooltipRootEvents}\n */\nexport class TooltipRootElement extends Base.TooltipRootElement {}\n\n/**\n * `<prosekit-tooltip-trigger>` custom element.\n *\n * Properties: {@link TooltipTriggerProps}\n */\nexport class TooltipTriggerElement extends Base.TooltipTriggerElement {}\n\nexport interface TooltipPopupProps extends Base.TooltipPopupProps {}\nexport interface TooltipPositionerProps extends Base.TooltipPositionerProps {}\nexport interface TooltipRootProps extends Base.TooltipRootProps {}\nexport interface TooltipTriggerProps extends Base.TooltipTriggerProps {}\n\nexport interface TooltipRootEvents extends Base.TooltipRootEvents {}\n\n/** @internal */\nexport const TooltipPopupPropsDeclaration: PropsDeclaration<TooltipPopupProps> = Base.TooltipPopupPropsDeclaration\n/** @internal */\nexport const TooltipPositionerPropsDeclaration: PropsDeclaration<TooltipPositionerProps> = Base.TooltipPositionerPropsDeclaration\n/** @internal */\nexport const TooltipRootPropsDeclaration: PropsDeclaration<TooltipRootProps> = Base.TooltipRootPropsDeclaration\n/** @internal */\nexport const TooltipTriggerPropsDeclaration: PropsDeclaration<TooltipTriggerProps> = Base.TooltipTriggerPropsDeclaration\n\nexport function registerTooltipRootElement(): void {\n registerCustomElement('prosekit-tooltip-root', TooltipRootElement)\n}\nexport function registerTooltipTriggerElement(): void {\n registerCustomElement('prosekit-tooltip-trigger', TooltipTriggerElement)\n}\nexport function registerTooltipPopupElement(): void {\n registerCustomElement('prosekit-tooltip-popup', TooltipPopupElement)\n}\nexport function registerTooltipPositionerElement(): void {\n registerCustomElement('prosekit-tooltip-positioner', TooltipPositionerElement)\n}\n\nexport {\n OpenChangeEvent,\n setupTooltipPopup,\n setupTooltipPositioner,\n setupTooltipRoot,\n setupTooltipTrigger,\n} from '@aria-ui/elements/tooltip'\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8BA,IAAa,sBAAb,cAAyC,KAAK,oBAAoB;;;;;;;;;;;;;;;;;;AAmBlE,IAAa,2BAAb,cAA8C,KAAK,yBAAyB;;;;;;;;AAS5E,IAAa,qBAAb,cAAwC,KAAK,mBAAmB;;;;;;AAOhE,IAAa,wBAAb,cAA2C,KAAK,sBAAsB;;AAUtE,MAAa,+BAAoE,KAAK;;AAEtF,MAAa,oCAA8E,KAAK;;AAEhG,MAAa,8BAAkE,KAAK;;AAEpF,MAAa,iCAAwE,KAAK;AAE1F,SAAgB,6BAAmC;AACjD,uBAAsB,yBAAyB,mBAAmB;;AAEpE,SAAgB,gCAAsC;AACpD,uBAAsB,4BAA4B,sBAAsB;;AAE1E,SAAgB,8BAAoC;AAClD,uBAAsB,0BAA0B,oBAAoB;;AAEtE,SAAgB,mCAAyC;AACvD,uBAAsB,+BAA+B,yBAAyB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"prosekit-web.d.ts","names":[],"sources":["../src/queue-extension.ts"],"mappings":";;AA2EA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAAgB,cAAA,CAAe,MAAA,EAAQ,MAAA,EAAQ,SAAA,EAAW,SAAA,GAAY,YAAA"}
|
package/dist/prosekit-web.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"prosekit-web.js","names":[],"sources":["../src/queue-extension.ts"],"sourcesContent":["import type { Editor, Extension } from '@prosekit/core'\n\n/**\n\n @internal\n\n Queues an extension to be added to the editor in the next task. Returns a\n dispose function that can be used to remove the extension in the next task.\n\n Why?\n\n Let's take React as an example.\n\n `editor.use(extension)` is synchronous. If the extension adds a node view that\n is controlled by `@prosemirror-adapter/react`, adding this extension will\n cause `prosemirror-adapter` to set UI state synchronously (e.g. `setState`\n returned by `useState` in React).\n\n ProseMirror is a sync-based framework. When updating node view, ProseMirror\n will first stop DOMObserver, then update the DOM, then resume DOMObserver.\n `prosemirror-adapter` needs to call `React.flushSync()` to update the DOM\n synchronously right after React state is updated, before ProseMirror resumes\n DOMObserver.\n\n If we call `editor.use(extension)` directly in `useEffect`, we eventually are\n doing something like this:\n\n ```ts\n React.useEffect(() => {\n React.flushSync(() => {\n setState(newState)\n })\n }, [])\n ```\n\n This breaks the async nature of React, and causes the following React\n warning:\n\n ```\n flushSync was called from inside a lifecycle method. React cannot flush when\n React is already rendering. Consider moving this call to a scheduler task or\n micro task.\n ```\n\n To fix this, we need to queue the extension addition to the editor in the next\n task or in the next microtask.\n\n ```ts\n // In the next microtask\n React.useEffect(() => {\n queueMicrotask(() => {\n React.flushSync(() => {\n setState(newState)\n })\n })\n }, [])\n\n // In the next task\n React.useEffect(() => {\n setTimeout(() => {\n React.flushSync(() => {\n setState(newState)\n })\n })\n }, [])\n ```\n\n I chose to use `setTimeout` instead of `queueMicrotask` because\n `queueMicrotask` causes another React act warning `An update to %s inside a\n test was not wrapped in act(...)` during testing.\n\n Although the example above is based on React, this is a general pattern for\n any async based UI framework, including Svelte.\n\n */\nexport function queueExtension(editor: Editor, extension: Extension): VoidFunction {\n let canceled = false\n let dispose: VoidFunction | undefined\n const timeout = setTimeout(() => {\n if (canceled) return\n dispose?.()\n dispose = editor.use(extension)\n })\n\n return () => {\n canceled = true\n clearTimeout(timeout)\n setTimeout(() => {\n dispose?.()\n dispose = undefined\n })\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2EA,SAAgB,eAAe,QAAgB,WAAoC;CACjF,IAAI,WAAW;CACf,IAAI;CACJ,MAAM,UAAU,iBAAiB;AAC/B,MAAI,SAAU;AACd,aAAW;AACX,YAAU,OAAO,IAAI,UAAU;GAC/B;AAEF,cAAa;AACX,aAAW;AACX,eAAa,QAAQ;AACrB,mBAAiB;AACf,cAAW;AACX,aAAU,KAAA;IACV"}
|