@prosekit/web 0.8.0-beta.0 → 0.8.0-beta.1
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 +112 -90
- package/dist/prosekit-web-autocomplete.d.ts.map +1 -1
- package/dist/prosekit-web-autocomplete.js +292 -217
- package/dist/prosekit-web-autocomplete.js.map +1 -1
- package/dist/prosekit-web-block-handle.d.ts +95 -62
- package/dist/prosekit-web-block-handle.d.ts.map +1 -1
- package/dist/prosekit-web-block-handle.js +219 -114
- package/dist/prosekit-web-block-handle.js.map +1 -1
- package/dist/prosekit-web-drop-indicator.d.ts +13 -15
- package/dist/prosekit-web-drop-indicator.d.ts.map +1 -1
- package/dist/prosekit-web-drop-indicator.js +34 -30
- package/dist/prosekit-web-drop-indicator.js.map +1 -1
- package/dist/prosekit-web-inline-popover.d.ts +88 -54
- package/dist/prosekit-web-inline-popover.d.ts.map +1 -1
- package/dist/prosekit-web-inline-popover.js +129 -79
- package/dist/prosekit-web-inline-popover.js.map +1 -1
- package/dist/prosekit-web-menu.d.ts +13 -0
- package/dist/prosekit-web-menu.d.ts.map +1 -0
- package/dist/prosekit-web-menu.js +53 -0
- package/dist/prosekit-web-menu.js.map +1 -0
- package/dist/prosekit-web-popover.d.ts +7 -26
- package/dist/prosekit-web-popover.d.ts.map +1 -1
- package/dist/prosekit-web-popover.js +31 -29
- package/dist/prosekit-web-popover.js.map +1 -1
- package/dist/prosekit-web-resizable.d.ts +92 -51
- package/dist/prosekit-web-resizable.d.ts.map +1 -1
- package/dist/prosekit-web-resizable.js +139 -131
- package/dist/prosekit-web-resizable.js.map +1 -1
- package/dist/prosekit-web-table-handle.d.ts +166 -199
- package/dist/prosekit-web-table-handle.d.ts.map +1 -1
- package/dist/prosekit-web-table-handle.js +495 -496
- package/dist/prosekit-web-table-handle.js.map +1 -1
- package/dist/prosekit-web-tooltip.d.ts +7 -26
- package/dist/prosekit-web-tooltip.d.ts.map +1 -1
- package/dist/prosekit-web-tooltip.js +31 -29
- package/dist/prosekit-web-tooltip.js.map +1 -1
- package/dist/use-editor-extension.js +2 -2
- package/dist/use-editor-extension.js.map +1 -1
- package/dist/use-scrolling.js +17 -8
- package/dist/use-scrolling.js.map +1 -1
- package/package.json +28 -23
- package/src/components/autocomplete/autocomplete-empty.ts +45 -0
- package/src/components/autocomplete/autocomplete-item.ts +65 -0
- package/src/components/autocomplete/autocomplete-popup.ts +95 -0
- package/src/components/autocomplete/autocomplete-positioner.ts +98 -0
- package/src/components/autocomplete/autocomplete-root.ts +280 -0
- package/src/components/autocomplete/context.ts +16 -14
- package/src/components/autocomplete/index.ts +65 -0
- package/src/components/block-handle/block-handle-add.ts +71 -0
- package/src/components/block-handle/block-handle-draggable.ts +158 -0
- package/src/components/block-handle/block-handle-popup.ts +43 -0
- package/src/components/block-handle/block-handle-positioner.ts +89 -0
- package/src/components/block-handle/block-handle-root.ts +116 -0
- package/src/components/block-handle/context.ts +9 -18
- package/src/components/block-handle/hover-state.ts +16 -0
- package/src/components/block-handle/index.ts +59 -0
- package/src/components/block-handle/{block-handle-popover/pointer-move.ts → pointer-move.ts} +8 -7
- package/src/components/block-handle/{block-handle-draggable/set-drag-preview.ts → set-drag-preview.ts} +4 -4
- package/src/components/block-handle/use-hover-extension.ts +65 -0
- package/src/components/drop-indicator/drop-indicator.ts +128 -0
- package/src/components/drop-indicator/index.ts +18 -0
- package/src/components/inline-popover/index.ts +41 -0
- package/src/components/inline-popover/inline-popover-popup.ts +52 -0
- package/src/components/inline-popover/inline-popover-positioner.ts +98 -0
- package/src/components/inline-popover/inline-popover-root.ts +122 -0
- package/src/components/inline-popover/store.ts +6 -0
- package/src/components/menu/index.ts +92 -0
- package/src/components/popover/index.ts +53 -0
- package/src/components/resizable/{resizable-handle/calc-resize.ts → calc-resize.ts} +1 -1
- package/src/components/resizable/context.ts +3 -6
- package/src/components/resizable/index.ts +32 -0
- package/src/components/resizable/resizable-handle.ts +134 -0
- package/src/components/resizable/resizable-root.ts +184 -0
- package/src/components/table-handle/dnd.ts +16 -27
- package/src/components/table-handle/index.ts +125 -0
- package/src/components/table-handle/{table-handle-drag-preview/render-preview.ts → render-preview.ts} +5 -5
- package/src/components/table-handle/shared.ts +61 -0
- package/src/components/table-handle/store.ts +117 -0
- package/src/components/table-handle/table-handle-column-menu-root.ts +51 -0
- package/src/components/table-handle/table-handle-column-menu-trigger.ts +107 -0
- package/src/components/table-handle/table-handle-column-popup.ts +44 -0
- package/src/components/table-handle/table-handle-column-positioner.ts +67 -0
- package/src/components/table-handle/table-handle-drag-preview.ts +169 -0
- package/src/components/table-handle/table-handle-drop-indicator.ts +166 -0
- package/src/components/table-handle/table-handle-root.ts +103 -0
- package/src/components/table-handle/table-handle-row-menu-root.ts +51 -0
- package/src/components/table-handle/table-handle-row-menu-trigger.ts +107 -0
- package/src/components/table-handle/table-handle-row-popup.ts +42 -0
- package/src/components/table-handle/table-handle-row-positioner.ts +67 -0
- package/src/components/table-handle/use-drop.ts +74 -0
- package/src/components/table-handle/{hooks/use-empty-image.ts → use-empty-image.ts} +2 -3
- package/src/components/table-handle/utils.ts +0 -11
- package/src/components/tooltip/index.ts +52 -0
- package/src/hooks/use-editor-extension.ts +4 -4
- package/src/hooks/use-editor-focus-event.ts +4 -4
- package/src/hooks/use-editor-typing.ts +12 -16
- package/src/hooks/use-editor-update-event.ts +4 -4
- package/src/hooks/use-keymap.ts +4 -4
- package/src/hooks/use-scrolling.ts +11 -10
- package/src/hooks/use-selecting.ts +8 -15
- package/src/utils/event.ts +28 -0
- package/src/utils/lazy-signal.spec.ts +68 -0
- package/src/utils/lazy-signal.ts +17 -0
- package/src/utils/prefers-reduced-motion.ts +6 -0
- package/src/utils/prevent-default.ts +3 -0
- package/src/utils/use-html-element-at.ts +17 -0
- package/src/utils/use-no-focus.ts +7 -0
- package/dist/get-default-state.js +0 -11
- package/dist/get-default-state.js.map +0 -1
- package/src/components/autocomplete/autocomplete-empty/element.gen.ts +0 -18
- package/src/components/autocomplete/autocomplete-empty/setup.ts +0 -6
- package/src/components/autocomplete/autocomplete-empty/types.ts +0 -13
- package/src/components/autocomplete/autocomplete-item/element.gen.ts +0 -18
- package/src/components/autocomplete/autocomplete-item/setup.ts +0 -30
- package/src/components/autocomplete/autocomplete-item/types.ts +0 -25
- package/src/components/autocomplete/autocomplete-list/element.gen.ts +0 -18
- package/src/components/autocomplete/autocomplete-list/setup.ts +0 -125
- package/src/components/autocomplete/autocomplete-list/types.ts +0 -22
- package/src/components/autocomplete/autocomplete-popover/element.gen.ts +0 -18
- package/src/components/autocomplete/autocomplete-popover/setup.ts +0 -169
- package/src/components/autocomplete/autocomplete-popover/types.ts +0 -100
- package/src/components/autocomplete/index.gen.ts +0 -17
- package/src/components/block-handle/block-handle-add/element.gen.ts +0 -18
- package/src/components/block-handle/block-handle-add/setup.ts +0 -33
- package/src/components/block-handle/block-handle-add/types.ts +0 -23
- package/src/components/block-handle/block-handle-draggable/element.gen.ts +0 -18
- package/src/components/block-handle/block-handle-draggable/setup.ts +0 -113
- package/src/components/block-handle/block-handle-draggable/types.ts +0 -23
- package/src/components/block-handle/block-handle-popover/element.gen.ts +0 -18
- package/src/components/block-handle/block-handle-popover/setup.ts +0 -68
- package/src/components/block-handle/block-handle-popover/types.ts +0 -81
- package/src/components/block-handle/index.gen.ts +0 -13
- package/src/components/drop-indicator/drop-indicator/element.gen.ts +0 -18
- package/src/components/drop-indicator/drop-indicator/setup.ts +0 -75
- package/src/components/drop-indicator/drop-indicator/types.ts +0 -31
- package/src/components/drop-indicator/index.gen.ts +0 -5
- package/src/components/inline-popover/index.gen.ts +0 -5
- package/src/components/inline-popover/inline-popover/element.gen.ts +0 -18
- package/src/components/inline-popover/inline-popover/setup.ts +0 -111
- package/src/components/inline-popover/inline-popover/types.ts +0 -112
- package/src/components/popover/index.gen.ts +0 -13
- package/src/components/popover/popover-content/element.gen.ts +0 -18
- package/src/components/popover/popover-content/setup.ts +0 -1
- package/src/components/popover/popover-content/types.ts +0 -6
- package/src/components/popover/popover-root/element.gen.ts +0 -18
- package/src/components/popover/popover-root/setup.ts +0 -1
- package/src/components/popover/popover-root/types.ts +0 -6
- package/src/components/popover/popover-trigger/element.gen.ts +0 -18
- package/src/components/popover/popover-trigger/setup.ts +0 -1
- package/src/components/popover/popover-trigger/types.ts +0 -6
- package/src/components/resizable/index.gen.ts +0 -9
- package/src/components/resizable/resizable-handle/element.gen.ts +0 -18
- package/src/components/resizable/resizable-handle/setup.ts +0 -106
- package/src/components/resizable/resizable-handle/types.ts +0 -29
- package/src/components/resizable/resizable-root/element.gen.ts +0 -18
- package/src/components/resizable/resizable-root/setup.ts +0 -84
- package/src/components/resizable/resizable-root/types.ts +0 -59
- package/src/components/table-handle/context.ts +0 -43
- package/src/components/table-handle/hooks/use-drop.ts +0 -85
- package/src/components/table-handle/index.gen.ts +0 -37
- package/src/components/table-handle/table-handle-column-root/element.gen.ts +0 -18
- package/src/components/table-handle/table-handle-column-root/setup.ts +0 -60
- package/src/components/table-handle/table-handle-column-root/types.ts +0 -73
- package/src/components/table-handle/table-handle-column-trigger/element.gen.ts +0 -18
- package/src/components/table-handle/table-handle-column-trigger/setup.ts +0 -64
- package/src/components/table-handle/table-handle-column-trigger/types.ts +0 -20
- package/src/components/table-handle/table-handle-drag-preview/element.gen.ts +0 -18
- package/src/components/table-handle/table-handle-drag-preview/setup.ts +0 -57
- package/src/components/table-handle/table-handle-drag-preview/types.ts +0 -14
- package/src/components/table-handle/table-handle-drag-preview/updater.ts +0 -90
- package/src/components/table-handle/table-handle-drop-indicator/element.gen.ts +0 -18
- package/src/components/table-handle/table-handle-drop-indicator/setup.ts +0 -52
- package/src/components/table-handle/table-handle-drop-indicator/types.ts +0 -15
- package/src/components/table-handle/table-handle-drop-indicator/updater.ts +0 -96
- package/src/components/table-handle/table-handle-popover-content/element.gen.ts +0 -18
- package/src/components/table-handle/table-handle-popover-content/setup.ts +0 -83
- package/src/components/table-handle/table-handle-popover-content/types.ts +0 -32
- package/src/components/table-handle/table-handle-popover-item/element.gen.ts +0 -18
- package/src/components/table-handle/table-handle-popover-item/setup.ts +0 -17
- package/src/components/table-handle/table-handle-popover-item/types.ts +0 -16
- package/src/components/table-handle/table-handle-root/element.gen.ts +0 -18
- package/src/components/table-handle/table-handle-root/setup.ts +0 -86
- package/src/components/table-handle/table-handle-root/types.ts +0 -23
- package/src/components/table-handle/table-handle-row-root/element.gen.ts +0 -18
- package/src/components/table-handle/table-handle-row-root/setup.ts +0 -70
- package/src/components/table-handle/table-handle-row-root/types.ts +0 -68
- package/src/components/table-handle/table-handle-row-trigger/element.gen.ts +0 -18
- package/src/components/table-handle/table-handle-row-trigger/setup.ts +0 -63
- package/src/components/table-handle/table-handle-row-trigger/types.ts +0 -23
- package/src/components/tooltip/index.gen.ts +0 -13
- package/src/components/tooltip/tooltip-content/element.gen.ts +0 -18
- package/src/components/tooltip/tooltip-content/setup.ts +0 -1
- package/src/components/tooltip/tooltip-content/types.ts +0 -6
- package/src/components/tooltip/tooltip-root/element.gen.ts +0 -18
- package/src/components/tooltip/tooltip-root/setup.ts +0 -1
- package/src/components/tooltip/tooltip-root/types.ts +0 -6
- package/src/components/tooltip/tooltip-trigger/element.gen.ts +0 -18
- package/src/components/tooltip/tooltip-trigger/setup.ts +0 -1
- package/src/components/tooltip/tooltip-trigger/types.ts +0 -6
- package/src/hooks/use-first-rendering.ts +0 -15
- package/src/utils/get-default-state.spec.ts +0 -42
- package/src/utils/get-default-state.ts +0 -18
- /package/src/components/autocomplete/{autocomplete-popover/helpers.spec.ts → helpers.spec.ts} +0 -0
- /package/src/components/autocomplete/{autocomplete-popover/helpers.ts → helpers.ts} +0 -0
- /package/src/components/inline-popover/{inline-popover/virtual-selection-element.ts → virtual-selection-element.ts} +0 -0
- /package/src/components/resizable/{resizable-handle/calc-resize.spec.ts → calc-resize.spec.ts} +0 -0
- /package/src/components/table-handle/{table-handle-drop-indicator/calc-drag-over.ts → calc-drag-over.ts} +0 -0
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import { useEffect, useEventListener, type ConnectableElement, type SetupOptions } from '@aria-ui/core'
|
|
2
|
-
import { useMenuTrigger } from '@aria-ui/menu/elements'
|
|
3
|
-
import { selectTableColumn } from '@prosekit/extensions/table'
|
|
4
|
-
|
|
5
|
-
import { tableHandleDndContext, tableHandleRootContext } from '../context.ts'
|
|
6
|
-
import { useEmptyImage } from '../hooks/use-empty-image.ts'
|
|
7
|
-
|
|
8
|
-
import type { TableHandleColumnTriggerEvents, TableHandleColumnTriggerProps } from './types.ts'
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* @internal
|
|
12
|
-
*/
|
|
13
|
-
export function useTableHandleColumnTrigger(
|
|
14
|
-
host: ConnectableElement,
|
|
15
|
-
{ state }: SetupOptions<TableHandleColumnTriggerProps, TableHandleColumnTriggerEvents>,
|
|
16
|
-
): void {
|
|
17
|
-
useMenuTrigger(host)
|
|
18
|
-
|
|
19
|
-
const context = tableHandleRootContext.consume(host)
|
|
20
|
-
|
|
21
|
-
const dndContext = tableHandleDndContext.consume(host)
|
|
22
|
-
|
|
23
|
-
useEventListener(host, 'pointerdown', () => {
|
|
24
|
-
const editor = state.editor.peek()
|
|
25
|
-
const cellPos = context.peek()?.cellPos
|
|
26
|
-
if (!editor || !cellPos) return
|
|
27
|
-
editor.exec(selectTableColumn({ head: cellPos }))
|
|
28
|
-
})
|
|
29
|
-
|
|
30
|
-
useEffect(host, () => {
|
|
31
|
-
host.draggable = true
|
|
32
|
-
})
|
|
33
|
-
|
|
34
|
-
const getEmptyImage = useEmptyImage(host)
|
|
35
|
-
|
|
36
|
-
useEventListener(host, 'dragstart', (event: DragEvent) => {
|
|
37
|
-
const dataTransfer = event.dataTransfer
|
|
38
|
-
if (dataTransfer) {
|
|
39
|
-
dataTransfer.effectAllowed = 'move'
|
|
40
|
-
const emptyImage = getEmptyImage()
|
|
41
|
-
if (emptyImage) {
|
|
42
|
-
dataTransfer.setDragImage(emptyImage, 0, 0)
|
|
43
|
-
}
|
|
44
|
-
dataTransfer.setData('application/x-prosekit-table-handle-drag', '')
|
|
45
|
-
}
|
|
46
|
-
const prev = dndContext.peek()
|
|
47
|
-
const index = context.peek()?.colIndex
|
|
48
|
-
|
|
49
|
-
if (index == null || index < 0) {
|
|
50
|
-
console.warn('[prosekit] Invalid column index for drag operation:', index)
|
|
51
|
-
event.preventDefault()
|
|
52
|
-
return
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
dndContext.set({
|
|
56
|
-
...prev,
|
|
57
|
-
direction: 'col',
|
|
58
|
-
dragging: true,
|
|
59
|
-
draggingIndex: index,
|
|
60
|
-
startX: event.clientX,
|
|
61
|
-
startY: event.clientY,
|
|
62
|
-
})
|
|
63
|
-
})
|
|
64
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import type { EventDeclarations, PropDeclarations } from '@aria-ui/core'
|
|
2
|
-
import type { Editor } from '@prosekit/core'
|
|
3
|
-
import type { defineTableCommands } from '@prosekit/extensions/table'
|
|
4
|
-
|
|
5
|
-
type TableCommandsExtension = ReturnType<typeof defineTableCommands>
|
|
6
|
-
|
|
7
|
-
export interface TableHandleColumnTriggerProps {
|
|
8
|
-
editor: Editor<TableCommandsExtension> | null
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
/** @internal */
|
|
12
|
-
export const tableHandleColumnTriggerProps: PropDeclarations<TableHandleColumnTriggerProps> = {
|
|
13
|
-
editor: { default: null },
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
/** @internal */
|
|
17
|
-
export interface TableHandleColumnTriggerEvents {}
|
|
18
|
-
|
|
19
|
-
/** @internal */
|
|
20
|
-
export const tableHandleColumnTriggerEvents: EventDeclarations<TableHandleColumnTriggerEvents> = {}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { defineCustomElement, registerCustomElement, type BaseElementConstructor } from "@aria-ui/core"
|
|
2
|
-
|
|
3
|
-
import { useTableHandleDragPreview } from "./setup.ts"
|
|
4
|
-
import { tableHandleDragPreviewEvents, tableHandleDragPreviewProps, type TableHandleDragPreviewEvents, type TableHandleDragPreviewProps } from "./types.ts"
|
|
5
|
-
|
|
6
|
-
const TableHandleDragPreviewElementBase: BaseElementConstructor<TableHandleDragPreviewProps> = defineCustomElement<
|
|
7
|
-
TableHandleDragPreviewProps,
|
|
8
|
-
TableHandleDragPreviewEvents
|
|
9
|
-
>({
|
|
10
|
-
props: tableHandleDragPreviewProps,
|
|
11
|
-
events: tableHandleDragPreviewEvents,
|
|
12
|
-
setup: useTableHandleDragPreview,
|
|
13
|
-
})
|
|
14
|
-
class TableHandleDragPreviewElement extends TableHandleDragPreviewElementBase {}
|
|
15
|
-
|
|
16
|
-
registerCustomElement('prosekit-table-handle-drag-preview', TableHandleDragPreviewElement)
|
|
17
|
-
|
|
18
|
-
export { TableHandleDragPreviewElement }
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import { useEffect, type ConnectableElement, type SignalState } from '@aria-ui/core'
|
|
2
|
-
|
|
3
|
-
import { assignStyles } from '../../../utils/assign-styles.ts'
|
|
4
|
-
import { useInitDndPosition, type OnInitParams } from '../dnd.ts'
|
|
5
|
-
|
|
6
|
-
import { clearPreviewDOM, createPreviewDOM } from './render-preview.ts'
|
|
7
|
-
import type { TableHandleDragPreviewProps } from './types.ts'
|
|
8
|
-
import { useUpdatePreviewPosition } from './updater.ts'
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* @internal
|
|
12
|
-
*/
|
|
13
|
-
export function useTableHandleDragPreview(host: ConnectableElement, { state }: { state: SignalState<TableHandleDragPreviewProps> }): void {
|
|
14
|
-
const { editor } = state
|
|
15
|
-
|
|
16
|
-
useEffect(host, () => {
|
|
17
|
-
assignStyles(host, {
|
|
18
|
-
position: 'absolute',
|
|
19
|
-
// Make sure drop on preview will trigger drop event on the host
|
|
20
|
-
pointerEvents: 'none',
|
|
21
|
-
})
|
|
22
|
-
})
|
|
23
|
-
|
|
24
|
-
useInitDndPosition(host, editor, onInitPreviewPosition)
|
|
25
|
-
|
|
26
|
-
useUpdatePreviewPosition(host, editor)
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
function onInitPreviewPosition({ host, direction, dragging, table, cell, draggingIndex }: OnInitParams): void {
|
|
30
|
-
assignStyles(host, {
|
|
31
|
-
display: dragging ? 'block' : 'none',
|
|
32
|
-
})
|
|
33
|
-
|
|
34
|
-
if (!dragging) {
|
|
35
|
-
clearPreviewDOM(host)
|
|
36
|
-
return
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
createPreviewDOM(table, host, draggingIndex, direction)
|
|
40
|
-
|
|
41
|
-
const tableRect = table.getBoundingClientRect()
|
|
42
|
-
const cellRect = cell.getBoundingClientRect()
|
|
43
|
-
|
|
44
|
-
if (direction === 'col') {
|
|
45
|
-
assignStyles(host, {
|
|
46
|
-
width: `${cellRect.width}px`,
|
|
47
|
-
height: `${tableRect.height}px`,
|
|
48
|
-
})
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
if (direction === 'row') {
|
|
52
|
-
assignStyles(host, {
|
|
53
|
-
width: `${tableRect.width}px`,
|
|
54
|
-
height: `${cellRect.height}px`,
|
|
55
|
-
})
|
|
56
|
-
}
|
|
57
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { EventDeclarations, PropDeclarations } from '@aria-ui/core'
|
|
2
|
-
import type { Editor } from '@prosekit/core'
|
|
3
|
-
|
|
4
|
-
export interface TableHandleDragPreviewProps {
|
|
5
|
-
editor: Editor | null
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export const tableHandleDragPreviewProps: PropDeclarations<TableHandleDragPreviewProps> = {
|
|
9
|
-
editor: { default: null },
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export interface TableHandleDragPreviewEvents {}
|
|
13
|
-
|
|
14
|
-
export const tableHandleDragPreviewEvents: EventDeclarations<TableHandleDragPreviewEvents> = {}
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
import { createComputed, useEffect, type ConnectableElement, type ReadonlySignal } from '@aria-ui/core'
|
|
2
|
-
import { computePosition, type ReferenceElement } from '@floating-ui/dom'
|
|
3
|
-
import type { Editor } from '@prosekit/core'
|
|
4
|
-
|
|
5
|
-
import { assignStyles } from '../../../utils/assign-styles.ts'
|
|
6
|
-
import { getSafeEditorView } from '../../../utils/get-safe-editor-view.ts'
|
|
7
|
-
import { tableHandleDndContext, tableHandleRootContext } from '../context.ts'
|
|
8
|
-
import { getDndRelatedDOMs } from '../dnd.ts'
|
|
9
|
-
|
|
10
|
-
export function useUpdatePreviewPosition(host: ConnectableElement, editor: ReadonlySignal<Editor | null>): void {
|
|
11
|
-
const dndContext = tableHandleDndContext.consume(host)
|
|
12
|
-
const rootContext = tableHandleRootContext.consume(host)
|
|
13
|
-
|
|
14
|
-
const draggingSignal = createComputed(() => {
|
|
15
|
-
const context = dndContext.get()
|
|
16
|
-
return context.dragging
|
|
17
|
-
})
|
|
18
|
-
|
|
19
|
-
const clientXSignal = createComputed(() => {
|
|
20
|
-
const context = dndContext.get()
|
|
21
|
-
return context.x
|
|
22
|
-
})
|
|
23
|
-
|
|
24
|
-
const clientYSignal = createComputed(() => {
|
|
25
|
-
const context = dndContext.get()
|
|
26
|
-
return context.y
|
|
27
|
-
})
|
|
28
|
-
|
|
29
|
-
useEffect(host, () => {
|
|
30
|
-
const view = getSafeEditorView(editor.get())
|
|
31
|
-
if (!view) return
|
|
32
|
-
|
|
33
|
-
if (!draggingSignal.get()) return
|
|
34
|
-
|
|
35
|
-
const { draggingIndex, direction } = dndContext.peek()
|
|
36
|
-
const x = clientXSignal.get()
|
|
37
|
-
const y = clientYSignal.get()
|
|
38
|
-
|
|
39
|
-
const relatedDOMs = getDndRelatedDOMs(view, rootContext.peek()?.cellPos, draggingIndex, direction)
|
|
40
|
-
if (!relatedDOMs) return
|
|
41
|
-
const { cell } = relatedDOMs
|
|
42
|
-
|
|
43
|
-
let cancelled = false
|
|
44
|
-
|
|
45
|
-
void computePosition(
|
|
46
|
-
getVirtualElement(cell, x, y),
|
|
47
|
-
host,
|
|
48
|
-
{ placement: direction === 'row' ? 'right' : 'bottom' },
|
|
49
|
-
).then(({ x, y }) => {
|
|
50
|
-
if (cancelled) return
|
|
51
|
-
|
|
52
|
-
if (direction === 'row') {
|
|
53
|
-
assignStyles(host, {
|
|
54
|
-
top: `${y}px`,
|
|
55
|
-
})
|
|
56
|
-
return
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
if (direction === 'col') {
|
|
60
|
-
assignStyles(host, {
|
|
61
|
-
left: `${x}px`,
|
|
62
|
-
})
|
|
63
|
-
return
|
|
64
|
-
}
|
|
65
|
-
})
|
|
66
|
-
|
|
67
|
-
return () => {
|
|
68
|
-
cancelled = true
|
|
69
|
-
}
|
|
70
|
-
})
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
function getVirtualElement(cell: HTMLTableCellElement, x: number, y: number): ReferenceElement {
|
|
74
|
-
return {
|
|
75
|
-
contextElement: cell,
|
|
76
|
-
getBoundingClientRect: () => {
|
|
77
|
-
const rect = cell.getBoundingClientRect()
|
|
78
|
-
return {
|
|
79
|
-
width: rect.width,
|
|
80
|
-
height: rect.height,
|
|
81
|
-
right: x + rect.width / 2,
|
|
82
|
-
bottom: y + rect.height / 2,
|
|
83
|
-
top: y - rect.height / 2,
|
|
84
|
-
left: x - rect.width / 2,
|
|
85
|
-
x: x - rect.width / 2,
|
|
86
|
-
y: y - rect.height / 2,
|
|
87
|
-
}
|
|
88
|
-
},
|
|
89
|
-
}
|
|
90
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { defineCustomElement, registerCustomElement, type BaseElementConstructor } from "@aria-ui/core"
|
|
2
|
-
|
|
3
|
-
import { useTableHandleDropIndicator } from "./setup.ts"
|
|
4
|
-
import { tableHandleDropIndicatorEvents, tableHandleDropIndicatorProps, type TableHandleDropIndicatorEvents, type TableHandleDropIndicatorProps } from "./types.ts"
|
|
5
|
-
|
|
6
|
-
const TableHandleDropIndicatorElementBase: BaseElementConstructor<TableHandleDropIndicatorProps> = defineCustomElement<
|
|
7
|
-
TableHandleDropIndicatorProps,
|
|
8
|
-
TableHandleDropIndicatorEvents
|
|
9
|
-
>({
|
|
10
|
-
props: tableHandleDropIndicatorProps,
|
|
11
|
-
events: tableHandleDropIndicatorEvents,
|
|
12
|
-
setup: useTableHandleDropIndicator,
|
|
13
|
-
})
|
|
14
|
-
class TableHandleDropIndicatorElement extends TableHandleDropIndicatorElementBase {}
|
|
15
|
-
|
|
16
|
-
registerCustomElement('prosekit-table-handle-drop-indicator', TableHandleDropIndicatorElement)
|
|
17
|
-
|
|
18
|
-
export { TableHandleDropIndicatorElement }
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { useEffect, type ConnectableElement, type SignalState } from '@aria-ui/core'
|
|
2
|
-
|
|
3
|
-
import { assignStyles } from '../../../utils/assign-styles.ts'
|
|
4
|
-
import { useInitDndPosition, type OnInitParams } from '../dnd.ts'
|
|
5
|
-
|
|
6
|
-
import type { TableHandleDropIndicatorProps } from './types.ts'
|
|
7
|
-
import { useUpdateIndicatorPosition } from './updater.ts'
|
|
8
|
-
|
|
9
|
-
const HANDLE_WIDTH = 2
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* @internal
|
|
13
|
-
*/
|
|
14
|
-
export function useTableHandleDropIndicator(
|
|
15
|
-
host: ConnectableElement,
|
|
16
|
-
{ state }: { state: SignalState<TableHandleDropIndicatorProps> },
|
|
17
|
-
): void {
|
|
18
|
-
const { editor } = state
|
|
19
|
-
|
|
20
|
-
useEffect(host, () => {
|
|
21
|
-
assignStyles(host, {
|
|
22
|
-
pointerEvents: 'none',
|
|
23
|
-
position: 'absolute',
|
|
24
|
-
})
|
|
25
|
-
})
|
|
26
|
-
|
|
27
|
-
useInitDndPosition(host, editor, onInitIndicatorPosition)
|
|
28
|
-
|
|
29
|
-
useUpdateIndicatorPosition(host, editor, HANDLE_WIDTH)
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
function onInitIndicatorPosition({ host, direction, dragging, table }: OnInitParams): void {
|
|
33
|
-
assignStyles(host, {
|
|
34
|
-
display: dragging ? 'block' : 'none',
|
|
35
|
-
})
|
|
36
|
-
|
|
37
|
-
const tableRect = table.getBoundingClientRect()
|
|
38
|
-
|
|
39
|
-
if (direction === 'col') {
|
|
40
|
-
assignStyles(host, {
|
|
41
|
-
width: `${HANDLE_WIDTH}px`,
|
|
42
|
-
height: `${tableRect.height}px`,
|
|
43
|
-
})
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
if (direction === 'row') {
|
|
47
|
-
assignStyles(host, {
|
|
48
|
-
width: `${tableRect.width}px`,
|
|
49
|
-
height: `${HANDLE_WIDTH}px`,
|
|
50
|
-
})
|
|
51
|
-
}
|
|
52
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { EventDeclarations, PropDeclarations } from '@aria-ui/core'
|
|
2
|
-
import type { Editor } from '@prosekit/core'
|
|
3
|
-
import type { TableCommandsExtension } from '@prosekit/extensions/table'
|
|
4
|
-
|
|
5
|
-
export interface TableHandleDropIndicatorProps {
|
|
6
|
-
editor: Editor<TableCommandsExtension> | null
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export const tableHandleDropIndicatorProps: PropDeclarations<TableHandleDropIndicatorProps> = {
|
|
10
|
-
editor: { default: null },
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export interface TableHandleDropIndicatorEvents {}
|
|
14
|
-
|
|
15
|
-
export const tableHandleDropIndicatorEvents: EventDeclarations<TableHandleDropIndicatorEvents> = {}
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
import { createComputed, useEffect, type ConnectableElement, type ReadonlySignal } from '@aria-ui/core'
|
|
2
|
-
import { computePosition, offset } from '@floating-ui/dom'
|
|
3
|
-
import type { Editor } from '@prosekit/core'
|
|
4
|
-
|
|
5
|
-
import { assignStyles } from '../../../utils/assign-styles.ts'
|
|
6
|
-
import { getSafeEditorView } from '../../../utils/get-safe-editor-view.ts'
|
|
7
|
-
import { tableHandleDndContext, tableHandleRootContext } from '../context.ts'
|
|
8
|
-
import { getDndRelatedDOMs } from '../dnd.ts'
|
|
9
|
-
|
|
10
|
-
import { getDragOverColumn, getDragOverRow } from './calc-drag-over.ts'
|
|
11
|
-
|
|
12
|
-
export function useUpdateIndicatorPosition(host: ConnectableElement, editor: ReadonlySignal<Editor | null>, handleWidth: number): void {
|
|
13
|
-
const dndContext = tableHandleDndContext.consume(host)
|
|
14
|
-
const rootContext = tableHandleRootContext.consume(host)
|
|
15
|
-
|
|
16
|
-
const draggingSignal = createComputed(() => {
|
|
17
|
-
const context = dndContext.get()
|
|
18
|
-
return context.dragging
|
|
19
|
-
})
|
|
20
|
-
|
|
21
|
-
const clientXSignal = createComputed(() => {
|
|
22
|
-
const context = dndContext.get()
|
|
23
|
-
return context.x
|
|
24
|
-
})
|
|
25
|
-
|
|
26
|
-
const clientYSignal = createComputed(() => {
|
|
27
|
-
const context = dndContext.get()
|
|
28
|
-
return context.y
|
|
29
|
-
})
|
|
30
|
-
|
|
31
|
-
const startXSignal = createComputed(() => {
|
|
32
|
-
return dndContext.get().startX
|
|
33
|
-
})
|
|
34
|
-
|
|
35
|
-
const startYSignal = createComputed(() => {
|
|
36
|
-
return dndContext.get().startY
|
|
37
|
-
})
|
|
38
|
-
|
|
39
|
-
useEffect(host, () => {
|
|
40
|
-
const view = getSafeEditorView(editor.get())
|
|
41
|
-
if (!view) return
|
|
42
|
-
|
|
43
|
-
if (!draggingSignal.get()) return
|
|
44
|
-
|
|
45
|
-
const { draggingIndex, direction } = dndContext.peek()
|
|
46
|
-
const x = clientXSignal.get()
|
|
47
|
-
const y = clientYSignal.get()
|
|
48
|
-
|
|
49
|
-
const relatedDOMs = getDndRelatedDOMs(view, rootContext.peek()?.cellPos, draggingIndex, direction)
|
|
50
|
-
if (!relatedDOMs) return
|
|
51
|
-
const { table } = relatedDOMs
|
|
52
|
-
|
|
53
|
-
let cancelled = false
|
|
54
|
-
const cleanup = () => {
|
|
55
|
-
cancelled = true
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
if (direction === 'col') {
|
|
59
|
-
const direction = startXSignal.get() > x ? 'left' : 'right'
|
|
60
|
-
const dragOverColumn = getDragOverColumn(table, x)
|
|
61
|
-
|
|
62
|
-
if (dragOverColumn) {
|
|
63
|
-
const [col, index] = dragOverColumn
|
|
64
|
-
dndContext.set({ ...dndContext.peek(), droppingIndex: index })
|
|
65
|
-
void computePosition(col, host, {
|
|
66
|
-
placement: direction === 'left' ? 'left' : 'right',
|
|
67
|
-
middleware: [offset(direction === 'left' ? -1 * handleWidth : 0)],
|
|
68
|
-
}).then(({ x }) => {
|
|
69
|
-
if (cancelled) return
|
|
70
|
-
assignStyles(host, { left: `${x}px` })
|
|
71
|
-
})
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
return cleanup
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
if (direction === 'row') {
|
|
78
|
-
const direction = startYSignal.get() > y ? 'up' : 'down'
|
|
79
|
-
const dragOverRow = getDragOverRow(table, y)
|
|
80
|
-
|
|
81
|
-
if (dragOverRow) {
|
|
82
|
-
const [row, index] = dragOverRow
|
|
83
|
-
dndContext.set({ ...dndContext.peek(), droppingIndex: index })
|
|
84
|
-
void computePosition(row, host, {
|
|
85
|
-
placement: direction === 'up' ? 'top' : 'bottom',
|
|
86
|
-
middleware: [offset(direction === 'up' ? -1 * handleWidth : 0)],
|
|
87
|
-
}).then(({ y }) => {
|
|
88
|
-
if (cancelled) return
|
|
89
|
-
assignStyles(host, { top: `${y}px` })
|
|
90
|
-
})
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
return cleanup
|
|
94
|
-
}
|
|
95
|
-
})
|
|
96
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { defineCustomElement, registerCustomElement, type BaseElementConstructor } from "@aria-ui/core"
|
|
2
|
-
|
|
3
|
-
import { useTableHandlePopoverContent } from "./setup.ts"
|
|
4
|
-
import { tableHandlePopoverContentEvents, tableHandlePopoverContentProps, type TableHandlePopoverContentEvents, type TableHandlePopoverContentProps } from "./types.ts"
|
|
5
|
-
|
|
6
|
-
const TableHandlePopoverContentElementBase: BaseElementConstructor<TableHandlePopoverContentProps> = defineCustomElement<
|
|
7
|
-
TableHandlePopoverContentProps,
|
|
8
|
-
TableHandlePopoverContentEvents
|
|
9
|
-
>({
|
|
10
|
-
props: tableHandlePopoverContentProps,
|
|
11
|
-
events: tableHandlePopoverContentEvents,
|
|
12
|
-
setup: useTableHandlePopoverContent,
|
|
13
|
-
})
|
|
14
|
-
class TableHandlePopoverContentElement extends TableHandlePopoverContentElementBase {}
|
|
15
|
-
|
|
16
|
-
registerCustomElement('prosekit-table-handle-popover-content', TableHandlePopoverContentElement)
|
|
17
|
-
|
|
18
|
-
export { TableHandlePopoverContentElement }
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
createComputed,
|
|
3
|
-
createSignal,
|
|
4
|
-
useEffect,
|
|
5
|
-
type ConnectableElement,
|
|
6
|
-
type ReadonlySignal,
|
|
7
|
-
type SetupOptions,
|
|
8
|
-
type SignalState,
|
|
9
|
-
type TypedEventTarget,
|
|
10
|
-
} from '@aria-ui/core'
|
|
11
|
-
import { menuContentProps, useMenuContent, type MenuContentProps } from '@aria-ui/menu/elements'
|
|
12
|
-
|
|
13
|
-
import { getStateWithDefaults } from '../../../utils/get-default-state.ts'
|
|
14
|
-
import { tableHandleRootContext } from '../context.ts'
|
|
15
|
-
|
|
16
|
-
import type { TableHandlePopoverContentEvents, TableHandlePopoverContentProps } from './types.ts'
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* @internal
|
|
20
|
-
*/
|
|
21
|
-
export function useTableHandlePopoverContent(
|
|
22
|
-
host: ConnectableElement,
|
|
23
|
-
{
|
|
24
|
-
state,
|
|
25
|
-
emit,
|
|
26
|
-
}: SetupOptions<
|
|
27
|
-
TableHandlePopoverContentProps,
|
|
28
|
-
TableHandlePopoverContentEvents
|
|
29
|
-
>,
|
|
30
|
-
): void {
|
|
31
|
-
const rootContext = tableHandleRootContext.consume(host)
|
|
32
|
-
const open = createComputed(() => !!rootContext.get())
|
|
33
|
-
const keyDownTarget = useKeyDownTarget(host, open)
|
|
34
|
-
|
|
35
|
-
const menuContentState: SignalState<MenuContentProps> = getStateWithDefaults(
|
|
36
|
-
{
|
|
37
|
-
placement: state.placement,
|
|
38
|
-
offset: state.offset,
|
|
39
|
-
eventTarget: createSignal(keyDownTarget),
|
|
40
|
-
},
|
|
41
|
-
menuContentProps,
|
|
42
|
-
)
|
|
43
|
-
|
|
44
|
-
useMenuContent(host, { state: menuContentState, emit })
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
function useKeyDownTarget(
|
|
48
|
-
element: ConnectableElement,
|
|
49
|
-
open: ReadonlySignal<boolean>,
|
|
50
|
-
): TypedEventTarget<'keydown'> {
|
|
51
|
-
const keydownHandlers: Array<(event: KeyboardEvent) => void> = []
|
|
52
|
-
|
|
53
|
-
useEffect(element, () => {
|
|
54
|
-
const handleKeydown = (event: KeyboardEvent) => {
|
|
55
|
-
if (event.isComposing || event.defaultPrevented || !open.get()) {
|
|
56
|
-
return false
|
|
57
|
-
}
|
|
58
|
-
keydownHandlers.forEach((handler) => handler(event))
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
document.addEventListener('keydown', handleKeydown)
|
|
62
|
-
|
|
63
|
-
return () => {
|
|
64
|
-
document.removeEventListener('keydown', handleKeydown)
|
|
65
|
-
}
|
|
66
|
-
})
|
|
67
|
-
|
|
68
|
-
return {
|
|
69
|
-
addEventListener: (type, listener) => {
|
|
70
|
-
if (type === 'keydown') {
|
|
71
|
-
keydownHandlers.push(listener)
|
|
72
|
-
}
|
|
73
|
-
},
|
|
74
|
-
removeEventListener: (type, listener) => {
|
|
75
|
-
if (type === 'keydown') {
|
|
76
|
-
const index = keydownHandlers.indexOf(listener)
|
|
77
|
-
if (index !== -1) {
|
|
78
|
-
keydownHandlers.splice(index, 1)
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
},
|
|
82
|
-
}
|
|
83
|
-
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import type { EventDeclarations, PropDeclarations } from '@aria-ui/core'
|
|
2
|
-
import { menuContentEvents, menuContentProps, type MenuContentEvents, type MenuContentProps } from '@aria-ui/menu/elements'
|
|
3
|
-
import type { Editor } from '@prosekit/core'
|
|
4
|
-
|
|
5
|
-
export interface TableHandlePopoverContentProps extends Omit<MenuContentProps, 'placement' | 'offset'> {
|
|
6
|
-
/**
|
|
7
|
-
* @default 'bottom-start'
|
|
8
|
-
*/
|
|
9
|
-
placement: MenuContentProps['placement']
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* @default {mainAxis: -4, crossAxis: 4}
|
|
13
|
-
*/
|
|
14
|
-
offset: MenuContentProps['offset']
|
|
15
|
-
|
|
16
|
-
editor: Editor | null
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
/** @internal */
|
|
20
|
-
export const tableHandlePopoverContentProps: PropDeclarations<TableHandlePopoverContentProps> = Object.freeze({
|
|
21
|
-
...menuContentProps,
|
|
22
|
-
placement: { default: 'right-start' },
|
|
23
|
-
offset: { default: { mainAxis: -4, crossAxis: 4 } },
|
|
24
|
-
editor: { default: null },
|
|
25
|
-
})
|
|
26
|
-
|
|
27
|
-
export interface TableHandlePopoverContentEvents extends MenuContentEvents {}
|
|
28
|
-
|
|
29
|
-
/** @internal */
|
|
30
|
-
export const tableHandlePopoverContentEvents: EventDeclarations<TableHandlePopoverContentEvents> = Object.freeze({
|
|
31
|
-
...menuContentEvents,
|
|
32
|
-
})
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { defineCustomElement, registerCustomElement, type BaseElementConstructor } from "@aria-ui/core"
|
|
2
|
-
|
|
3
|
-
import { useTableHandlePopoverItem } from "./setup.ts"
|
|
4
|
-
import { tableHandlePopoverItemEvents, tableHandlePopoverItemProps, type TableHandlePopoverItemEvents, type TableHandlePopoverItemProps } from "./types.ts"
|
|
5
|
-
|
|
6
|
-
const TableHandlePopoverItemElementBase: BaseElementConstructor<TableHandlePopoverItemProps> = defineCustomElement<
|
|
7
|
-
TableHandlePopoverItemProps,
|
|
8
|
-
TableHandlePopoverItemEvents
|
|
9
|
-
>({
|
|
10
|
-
props: tableHandlePopoverItemProps,
|
|
11
|
-
events: tableHandlePopoverItemEvents,
|
|
12
|
-
setup: useTableHandlePopoverItem,
|
|
13
|
-
})
|
|
14
|
-
class TableHandlePopoverItemElement extends TableHandlePopoverItemElementBase {}
|
|
15
|
-
|
|
16
|
-
registerCustomElement('prosekit-table-handle-popover-item', TableHandlePopoverItemElement)
|
|
17
|
-
|
|
18
|
-
export { TableHandlePopoverItemElement }
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import type { ConnectableElement, SetupOptions } from '@aria-ui/core'
|
|
2
|
-
import { useMenuItem } from '@aria-ui/menu/elements'
|
|
3
|
-
|
|
4
|
-
import type { TableHandlePopoverItemEvents, TableHandlePopoverItemProps } from './types.ts'
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* @internal
|
|
8
|
-
*/
|
|
9
|
-
export function useTableHandlePopoverItem(
|
|
10
|
-
element: ConnectableElement,
|
|
11
|
-
{
|
|
12
|
-
state,
|
|
13
|
-
emit,
|
|
14
|
-
}: SetupOptions<TableHandlePopoverItemProps, TableHandlePopoverItemEvents>,
|
|
15
|
-
): void {
|
|
16
|
-
useMenuItem(element, { state, emit })
|
|
17
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { EventDeclarations, PropDeclarations } from '@aria-ui/core'
|
|
2
|
-
import { menuItemEvents, menuItemProps, type MenuItemEvents, type MenuItemProps } from '@aria-ui/menu'
|
|
3
|
-
|
|
4
|
-
export interface TableHandlePopoverItemProps extends MenuItemProps {}
|
|
5
|
-
|
|
6
|
-
/** @internal */
|
|
7
|
-
export const tableHandlePopoverItemProps: PropDeclarations<TableHandlePopoverItemProps> = {
|
|
8
|
-
...menuItemProps,
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export interface TableHandlePopoverItemEvents extends MenuItemEvents {}
|
|
12
|
-
|
|
13
|
-
/** @internal */
|
|
14
|
-
export const tableHandlePopoverItemEvents: EventDeclarations<TableHandlePopoverItemEvents> = {
|
|
15
|
-
...menuItemEvents,
|
|
16
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { defineCustomElement, registerCustomElement, type BaseElementConstructor } from "@aria-ui/core"
|
|
2
|
-
|
|
3
|
-
import { useTableHandleRoot } from "./setup.ts"
|
|
4
|
-
import { tableHandleRootEvents, tableHandleRootProps, type TableHandleRootEvents, type TableHandleRootProps } from "./types.ts"
|
|
5
|
-
|
|
6
|
-
const TableHandleRootElementBase: BaseElementConstructor<TableHandleRootProps> = defineCustomElement<
|
|
7
|
-
TableHandleRootProps,
|
|
8
|
-
TableHandleRootEvents
|
|
9
|
-
>({
|
|
10
|
-
props: tableHandleRootProps,
|
|
11
|
-
events: tableHandleRootEvents,
|
|
12
|
-
setup: useTableHandleRoot,
|
|
13
|
-
})
|
|
14
|
-
class TableHandleRootElement extends TableHandleRootElementBase {}
|
|
15
|
-
|
|
16
|
-
registerCustomElement('prosekit-table-handle-root', TableHandleRootElement)
|
|
17
|
-
|
|
18
|
-
export { TableHandleRootElement }
|