@prosekit/web 0.7.8 → 0.7.10
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/{get-default-state-Bqluw34o.js → get-default-state-BzBimBWi.js} +1 -1
- package/dist/get-default-state-BzBimBWi.js.map +1 -0
- package/dist/{get-safe-editor-view-DJlcheeV.js → get-safe-editor-view-Dt9Amrcn.js} +1 -1
- package/dist/{get-safe-editor-view-DJlcheeV.js.map → get-safe-editor-view-Dt9Amrcn.js.map} +1 -1
- package/dist/{inject-style-DYQXx-cE.js → inject-style-BaFaVQvj.js} +7 -7
- package/dist/inject-style-BaFaVQvj.js.map +1 -0
- package/dist/prosekit-web-autocomplete.d.ts.map +1 -1
- package/dist/prosekit-web-autocomplete.js +3 -3
- package/dist/prosekit-web-autocomplete.js.map +1 -1
- package/dist/prosekit-web-block-handle.d.ts.map +1 -1
- package/dist/prosekit-web-block-handle.js +4 -4
- package/dist/prosekit-web-block-handle.js.map +1 -1
- package/dist/prosekit-web-drop-indicator.d.ts.map +1 -1
- package/dist/prosekit-web-drop-indicator.js +2 -2
- package/dist/prosekit-web-drop-indicator.js.map +1 -1
- package/dist/prosekit-web-inline-popover.d.ts.map +1 -1
- package/dist/prosekit-web-inline-popover.js +1 -1
- package/dist/prosekit-web-inline-popover.js.map +1 -1
- package/dist/prosekit-web-popover.d.ts.map +1 -1
- package/dist/prosekit-web-popover.js.map +1 -1
- package/dist/prosekit-web-resizable.d.ts.map +1 -1
- package/dist/prosekit-web-resizable.js.map +1 -1
- package/dist/prosekit-web-table-handle.d.ts.map +1 -1
- package/dist/prosekit-web-table-handle.js +25 -25
- package/dist/prosekit-web-table-handle.js.map +1 -1
- package/dist/prosekit-web-tooltip.d.ts.map +1 -1
- package/dist/prosekit-web-tooltip.js.map +1 -1
- package/dist/prosekit-web.d.ts +80 -1
- package/dist/prosekit-web.d.ts.map +1 -0
- package/dist/prosekit-web.js +95 -1
- package/dist/prosekit-web.js.map +1 -0
- package/dist/{use-editor-extension-B_5BbYvf.js → use-editor-extension-B2WuUfnd.js} +1 -1
- package/dist/use-editor-extension-B2WuUfnd.js.map +1 -0
- package/dist/{use-scrolling-BjI3cuLt.js → use-scrolling-BjVzAkiZ.js} +3 -1
- package/dist/use-scrolling-BjVzAkiZ.js.map +1 -0
- package/package.json +10 -10
- package/src/components/autocomplete/autocomplete-empty/types.ts +1 -4
- package/src/components/autocomplete/autocomplete-item/setup.ts +2 -10
- package/src/components/autocomplete/autocomplete-item/types.ts +2 -8
- package/src/components/autocomplete/autocomplete-list/setup.ts +5 -21
- package/src/components/autocomplete/autocomplete-list/types.ts +2 -10
- package/src/components/autocomplete/autocomplete-popover/helpers.spec.ts +1 -5
- package/src/components/autocomplete/autocomplete-popover/setup.ts +4 -20
- package/src/components/autocomplete/autocomplete-popover/types.ts +1 -4
- package/src/components/autocomplete/context.ts +1 -4
- package/src/components/block-handle/block-handle-add/setup.ts +1 -5
- package/src/components/block-handle/block-handle-add/types.ts +1 -4
- package/src/components/block-handle/block-handle-draggable/setup.ts +3 -18
- package/src/components/block-handle/block-handle-draggable/types.ts +1 -4
- package/src/components/block-handle/block-handle-popover/pointer-move.ts +2 -10
- package/src/components/block-handle/block-handle-popover/setup.ts +4 -22
- package/src/components/block-handle/block-handle-popover/types.ts +1 -4
- package/src/components/block-handle/context.ts +1 -4
- package/src/components/drop-indicator/drop-indicator/setup.ts +3 -15
- package/src/components/drop-indicator/drop-indicator/types.ts +1 -4
- package/src/components/inline-popover/inline-popover/setup.ts +1 -4
- package/src/components/inline-popover/inline-popover/types.ts +1 -4
- package/src/components/inline-popover/inline-popover/virtual-selection-element.ts +1 -5
- package/src/components/popover/popover-content/types.ts +2 -8
- package/src/components/popover/popover-root/types.ts +2 -8
- package/src/components/popover/popover-trigger/types.ts +2 -8
- package/src/components/resizable/context.ts +1 -4
- package/src/components/resizable/resizable-handle/calc-resize.spec.ts +1 -4
- package/src/components/resizable/resizable-handle/setup.ts +2 -15
- package/src/components/resizable/resizable-handle/types.ts +1 -4
- package/src/components/resizable/resizable-root/setup.ts +4 -20
- package/src/components/resizable/resizable-root/types.ts +1 -4
- package/src/components/table-handle/context.ts +2 -8
- package/src/components/table-handle/dnd.ts +11 -17
- package/src/components/table-handle/hooks/use-drop.ts +2 -11
- package/src/components/table-handle/table-handle-column-root/setup.ts +2 -13
- package/src/components/table-handle/table-handle-column-root/types.ts +1 -4
- package/src/components/table-handle/table-handle-column-trigger/setup.ts +3 -14
- package/src/components/table-handle/table-handle-column-trigger/types.ts +1 -4
- package/src/components/table-handle/table-handle-drag-preview/render-preview.ts +2 -5
- package/src/components/table-handle/table-handle-drag-preview/setup.ts +3 -13
- package/src/components/table-handle/table-handle-drag-preview/types.ts +1 -4
- package/src/components/table-handle/table-handle-drag-preview/updater.ts +3 -14
- package/src/components/table-handle/table-handle-drop-indicator/setup.ts +6 -10
- package/src/components/table-handle/table-handle-drop-indicator/types.ts +1 -4
- package/src/components/table-handle/table-handle-drop-indicator/updater.ts +5 -19
- package/src/components/table-handle/table-handle-popover-content/setup.ts +2 -9
- package/src/components/table-handle/table-handle-popover-content/types.ts +2 -10
- package/src/components/table-handle/table-handle-popover-item/setup.ts +2 -8
- package/src/components/table-handle/table-handle-popover-item/types.ts +2 -10
- package/src/components/table-handle/table-handle-root/setup.ts +2 -9
- package/src/components/table-handle/table-handle-root/types.ts +1 -4
- package/src/components/table-handle/table-handle-row-root/setup.ts +2 -9
- package/src/components/table-handle/table-handle-row-root/types.ts +2 -9
- package/src/components/table-handle/table-handle-row-trigger/setup.ts +3 -14
- package/src/components/table-handle/table-handle-row-trigger/types.ts +1 -4
- package/src/components/table-handle/utils.ts +1 -4
- package/src/components/tooltip/tooltip-content/types.ts +2 -8
- package/src/components/tooltip/tooltip-root/types.ts +2 -8
- package/src/components/tooltip/tooltip-trigger/types.ts +2 -8
- package/src/hooks/use-editor-extension.ts +2 -9
- package/src/hooks/use-editor-focus-event.ts +2 -9
- package/src/hooks/use-editor-typing.ts +2 -10
- package/src/hooks/use-editor-update-event.ts +2 -9
- package/src/hooks/use-first-rendering.ts +1 -6
- package/src/hooks/use-keymap.ts +2 -9
- package/src/hooks/use-scrolling.ts +3 -6
- package/src/hooks/use-selecting.ts +1 -5
- package/src/index.ts +1 -1
- package/src/queue-extension.ts +93 -0
- package/src/utils/get-default-state.spec.ts +2 -10
- package/src/utils/get-default-state.ts +1 -5
- package/dist/get-default-state-Bqluw34o.js.map +0 -1
- package/dist/inject-style-DYQXx-cE.js.map +0 -1
- package/dist/use-editor-extension-B_5BbYvf.js.map +0 -1
- package/dist/use-scrolling-BjI3cuLt.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prosekit-web-popover.d.ts","names":[],"sources":["../src/components/popover/popover-content/types.ts","../src/components/popover/popover-content/element.gen.ts","../src/components/popover/popover-root/types.ts","../src/components/popover/popover-root/element.gen.ts","../src/components/popover/popover-trigger/types.ts","../src/components/popover/popover-trigger/element.gen.ts"],"
|
|
1
|
+
{"version":3,"file":"prosekit-web-popover.d.ts","names":[],"sources":["../src/components/popover/popover-content/types.ts","../src/components/popover/popover-content/element.gen.ts","../src/components/popover/popover-root/types.ts","../src/components/popover/popover-root/element.gen.ts","../src/components/popover/popover-trigger/types.ts","../src/components/popover/popover-trigger/element.gen.ts"],"mappings":";;;;UAIiB,mBAAA,SAA4B,qBAAA;AAAA,UAC5B,oBAAA,SAA6B,sBAAA;;;cCAxC,yBAAA,EAA2B,sBAAA,CAAuB,mBAAA;AAAA,cAQlD,qBAAA,SAA8B,yBAAA;;;UCTnB,gBAAA,SAAyB,kBAAA;AAAA,UACzB,iBAAA,SAA0B,mBAAA;;;cCArC,sBAAA,EAAwB,sBAAA,CAAuB,gBAAA;AAAA,cAQ/C,kBAAA,SAA2B,sBAAA;;;UCThB,mBAAA,SAA4B,qBAAA;AAAA,UAC5B,oBAAA,SAA6B,sBAAA;;;cCAxC,yBAAA,EAA2B,sBAAA,CAAuB,mBAAA;AAAA,cAQlD,qBAAA,SAA8B,yBAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prosekit-web-popover.js","names":[
|
|
1
|
+
{"version":3,"file":"prosekit-web-popover.js","names":[],"sources":["../src/components/popover/popover-content/element.gen.ts","../src/components/popover/popover-root/element.gen.ts","../src/components/popover/popover-trigger/element.gen.ts"],"sourcesContent":["import { defineCustomElement, registerCustomElement, type BaseElementConstructor } from \"@aria-ui/core\"\n\nimport { usePopoverContent } from \"./setup\"\nimport { popoverContentEvents, popoverContentProps, type PopoverContentEvents, type PopoverContentProps } from \"./types\"\n\nconst PopoverContentElementBase: BaseElementConstructor<PopoverContentProps> = defineCustomElement<\n PopoverContentProps,\n PopoverContentEvents\n>({\n props: popoverContentProps,\n events: popoverContentEvents,\n setup: usePopoverContent,\n})\nclass PopoverContentElement extends PopoverContentElementBase {}\n\nregisterCustomElement('prosekit-popover-content', PopoverContentElement)\n \nexport { PopoverContentElement }\n","import { defineCustomElement, registerCustomElement, type BaseElementConstructor } from \"@aria-ui/core\"\n\nimport { usePopoverRoot } from \"./setup\"\nimport { popoverRootEvents, popoverRootProps, type PopoverRootEvents, type PopoverRootProps } from \"./types\"\n\nconst PopoverRootElementBase: BaseElementConstructor<PopoverRootProps> = defineCustomElement<\n PopoverRootProps,\n PopoverRootEvents\n>({\n props: popoverRootProps,\n events: popoverRootEvents,\n setup: usePopoverRoot,\n})\nclass PopoverRootElement extends PopoverRootElementBase {}\n\nregisterCustomElement('prosekit-popover-root', PopoverRootElement)\n \nexport { PopoverRootElement }\n","import { defineCustomElement, registerCustomElement, type BaseElementConstructor } from \"@aria-ui/core\"\n\nimport { usePopoverTrigger } from \"./setup\"\nimport { popoverTriggerEvents, popoverTriggerProps, type PopoverTriggerEvents, type PopoverTriggerProps } from \"./types\"\n\nconst PopoverTriggerElementBase: BaseElementConstructor<PopoverTriggerProps> = defineCustomElement<\n PopoverTriggerProps,\n PopoverTriggerEvents\n>({\n props: popoverTriggerProps,\n events: popoverTriggerEvents,\n setup: usePopoverTrigger,\n})\nclass PopoverTriggerElement extends PopoverTriggerElementBase {}\n\nregisterCustomElement('prosekit-popover-trigger', PopoverTriggerElement)\n \nexport { PopoverTriggerElement }\n"],"mappings":";;;;AAKA,MAAM,4BAAyE,oBAG7E;CACA,OAAO;CACP,QAAQ;CACR,OAAO;CACR,CAAC;AACF,IAAM,wBAAN,cAAoC,0BAA0B;AAE9D,sBAAsB,4BAA4B,sBAAsB;;;;ACVxE,MAAM,yBAAmE,oBAGvE;CACA,OAAO;CACP,QAAQ;CACR,OAAO;CACR,CAAC;AACF,IAAM,qBAAN,cAAiC,uBAAuB;AAExD,sBAAsB,yBAAyB,mBAAmB;;;;ACVlE,MAAM,4BAAyE,oBAG7E;CACA,OAAO;CACP,QAAQ;CACR,OAAO;CACR,CAAC;AACF,IAAM,wBAAN,cAAoC,0BAA0B;AAE9D,sBAAsB,4BAA4B,sBAAsB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prosekit-web-resizable.d.ts","names":[],"sources":["../src/components/resizable/resizable-handle/types.ts","../src/components/resizable/resizable-handle/element.gen.ts","../src/components/resizable/resizable-handle/setup.ts","../src/components/resizable/resizable-root/types.ts","../src/components/resizable/resizable-root/element.gen.ts","../src/components/resizable/resizable-root/setup.ts"],"
|
|
1
|
+
{"version":3,"file":"prosekit-web-resizable.d.ts","names":[],"sources":["../src/components/resizable/resizable-handle/types.ts","../src/components/resizable/resizable-handle/element.gen.ts","../src/components/resizable/resizable-handle/setup.ts","../src/components/resizable/resizable-root/types.ts","../src/components/resizable/resizable-root/element.gen.ts","../src/components/resizable/resizable-root/setup.ts"],"mappings":";;;UAEiB,oBAAA;;AAAjB;;;;EAME,QAAA;AAAA;;cAYW,oBAAA,EAAsB,gBAAA,CAAiB,oBAAA;;UAKnC,qBAAA;;cAGJ,qBAAA,EAAuB,iBAAA,CAAkB,qBAAA;;;cCvBhD,0BAAA,EAA4B,sBAAA,CAAuB,oBAAA;AAAA,cAQnD,sBAAA,SAA+B,0BAAA;;;;ADXrC;;iBESgB,kBAAA,CACd,IAAA,EAAM,kBAAA;EACJ;AAAA;EAAW,KAAA,EAAO,WAAA,CAAY,oBAAA;AAAA;;;UCXjB,kBAAA;EACf,KAAA;EACA,MAAA;EACA,WAAA;AAAA;;cAIW,kBAAA,EAAoB,gBAAA,CAAiB,kBAAA;AAAA,UAMjC,mBAAA;EACf,WAAA,EAAa,WAAA;IAAc,KAAA;IAAe,MAAA;EAAA;EAC1C,SAAA,EAAW,WAAA;IAAc,KAAA;IAAe,MAAA;EAAA;AAAA;AHW1C;AAAA,cGPa,mBAAA,EAAqB,iBAAA,CAAkB,mBAAA;;;cChB9C,wBAAA,EAA0B,sBAAA,CAAuB,kBAAA;AAAA,cAQjD,oBAAA,SAA6B,wBAAA;;;;AJXnC;;iBKQgB,gBAAA,CACd,IAAA,EAAM,kBAAA;EACJ,KAAA;EAAO;AAAA,GAAQ,YAAA,CAAa,kBAAA,EAAoB,mBAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prosekit-web-resizable.js","names":["onResizeContext: Context<OnResize>","onResizeStartContext: Context<OnResizeStart>","onResizeEndContext: Context<OnResizeEnd>","calcBottomRightResize: CalcResize","calcBottomLeftResize: CalcResize","calcTopRightResize: CalcResize","calcTopLeftResize: CalcResize","calcTopResize: CalcResize","calcRightResize: CalcResize","calcBottomResize: CalcResize","calcLeftResize: CalcResize","resizableHandleProps: PropDeclarations<ResizableHandleProps>","resizableHandleEvents: EventDeclarations<ResizableHandleEvents>","ResizableHandleElementBase: BaseElementConstructor<ResizableHandleProps>","onResizeStart: OnResizeStart","aspectRatio: number","onResize: OnResize","onResizeEnd: OnResizeEnd","resizableRootProps: PropDeclarations<ResizableRootProps>","resizableRootEvents: EventDeclarations<ResizableRootEvents>","ResizableRootElementBase: BaseElementConstructor<ResizableRootProps>"],"sources":["../src/components/resizable/context.ts","../src/utils/is-finite-positive-number.ts","../src/components/resizable/resizable-handle/calc-resize.ts","../src/components/resizable/resizable-handle/setup.ts","../src/components/resizable/resizable-handle/types.ts","../src/components/resizable/resizable-handle/element.gen.ts","../src/components/resizable/resizable-root/setup.ts","../src/components/resizable/resizable-root/types.ts","../src/components/resizable/resizable-root/element.gen.ts"],"sourcesContent":["import {\n createContext,\n type Context,\n} from '@aria-ui/core'\n\n/**\n * @internal\n */\nexport const onResizeContext: Context<OnResize> = createContext(\n 'prosekit/resizable/onResize',\n null,\n)\n\n/**\n * @internal\n */\nexport const onResizeStartContext: Context<OnResizeStart> = createContext(\n 'prosekit/resizable/onResizeStart',\n null,\n)\n\n/**\n * @internal\n */\nexport const onResizeEndContext: Context<OnResizeEnd> = createContext(\n 'prosekit/resizable/onResizeEnd',\n null,\n)\n\n/**\n * @internal\n */\nexport type OnResize = ((width: number, height: number) => void) | null\n\n/**\n * @internal\n */\nexport type OnResizeStart =\n | (() => readonly [width: number, height: number, aspectRatio: number])\n | null\n\n/**\n * @internal\n */\nexport type OnResizeEnd = (() => void) | null\n","export function isFinitePositiveNumber(value: unknown): value is number {\n return typeof value === 'number' && Number.isFinite(value) && value > 0\n}\n","import { isFinitePositiveNumber } from '../../../utils/is-finite-positive-number'\n\nexport function calcResize(\n position:\n | 'top'\n | 'right'\n | 'bottom'\n | 'left'\n | 'top-left'\n | 'top-right'\n | 'bottom-left'\n | 'bottom-right',\n w: number,\n h: number,\n dx: number,\n dy: number,\n aspectRatio: number | null | undefined,\n): [w: number, h: number] {\n aspectRatio = aspectRatio ? aspectRatio : w / h\n aspectRatio = isFinitePositiveNumber(aspectRatio) ? aspectRatio : 1\n\n switch (position) {\n case 'bottom-right':\n return clamp(calcBottomRightResize(w, h, dx, dy, aspectRatio))\n case 'bottom-left':\n return clamp(calcBottomLeftResize(w, h, dx, dy, aspectRatio))\n case 'top-right':\n return clamp(calcTopRightResize(w, h, dx, dy, aspectRatio))\n case 'top-left':\n return clamp(calcTopLeftResize(w, h, dx, dy, aspectRatio))\n case 'top':\n return clamp(calcTopResize(w, h, dx, dy, aspectRatio))\n case 'right':\n return clamp(calcRightResize(w, h, dx, dy, aspectRatio))\n case 'bottom':\n return clamp(calcBottomResize(w, h, dx, dy, aspectRatio))\n case 'left':\n return clamp(calcLeftResize(w, h, dx, dy, aspectRatio))\n default:\n throw new RangeError(`Invalid position: ${position}`)\n }\n}\n\ntype CalcResize = (\n w: number,\n h: number,\n dx: number,\n dy: number,\n aspectRatio: number,\n) => [w: number, h: number]\n\nconst calcBottomRightResize: CalcResize = (w, h, dx, dy, r) => {\n w += dx\n h += dy\n\n const sum = w + h\n h = sum / (r + 1)\n w = sum - h\n return [w, h]\n}\n\nconst calcBottomLeftResize: CalcResize = (w, h, dx, dy, r) => {\n w -= dx\n h += dy\n\n const sum = w + h\n h = sum / (r + 1)\n w = sum - h\n return [w, h]\n}\n\nconst calcTopRightResize: CalcResize = (w, h, dx, dy, r) => {\n w += dx\n h -= dy\n\n const sum = w + h\n h = sum / (r + 1)\n w = sum - h\n return [w, h]\n}\n\nconst calcTopLeftResize: CalcResize = (w, h, dx, dy, r) => {\n w -= dx\n h -= dy\n\n const sum = w + h\n h = sum / (r + 1)\n w = sum - h\n return [w, h]\n}\n\nconst calcTopResize: CalcResize = (w, h, dx, dy, r) => {\n h -= dy\n w = h * r\n return [w, h]\n}\n\nconst calcRightResize: CalcResize = (w, h, dx, dy, r) => {\n w += dx\n h = w / r\n return [w, h]\n}\n\nconst calcBottomResize: CalcResize = (w, h, dx, dy, r) => {\n h += dy\n w = h * r\n return [w, h]\n}\n\nconst calcLeftResize: CalcResize = (w, h, dx, dy, r) => {\n w -= dx\n h = w / r\n return [w, h]\n}\n\nfunction clamp([w, h]: [number, number]): [number, number] {\n return [\n Math.max(w, 1),\n Math.max(h, 1),\n ]\n}\n","import {\n createSignal,\n useEffect,\n type ConnectableElement,\n type ReadonlySignal,\n type SignalState,\n} from '@aria-ui/core'\nimport { getWindow } from '@ocavue/utils'\n\nimport {\n onResizeContext,\n onResizeEndContext,\n onResizeStartContext,\n type OnResize,\n type OnResizeEnd,\n type OnResizeStart,\n} from '../context'\n\nimport { calcResize } from './calc-resize'\nimport type { ResizableHandleProps } from './types'\n\n/**\n * @internal\n */\nexport function useResizableHandle(\n host: ConnectableElement,\n { state }: { state: SignalState<ResizableHandleProps> },\n): void {\n const onResize = onResizeContext.consume(host)\n const onResizeStart = onResizeStartContext.consume(host)\n const onResizeEnd = onResizeEndContext.consume(host)\n\n useResizableHandleState(host, state, { onResize, onResizeStart, onResizeEnd })\n}\n\nfunction useResizableHandleState(\n host: ConnectableElement,\n state: SignalState<ResizableHandleProps>,\n context: {\n onResizeStart: ReadonlySignal<OnResizeStart>\n onResize: ReadonlySignal<OnResize>\n onResizeEnd: ReadonlySignal<OnResizeEnd>\n },\n) {\n let startX = 0\n let startY = 0\n let width = 0\n let height = 0\n let aspectRatio = 1\n\n const pointerPressing = createSignal(false)\n\n const handlePointerDown = (event: PointerEvent) => {\n event.preventDefault()\n pointerPressing.set(true)\n\n startX = event.x\n startY = event.y\n\n const size = context.onResizeStart.get()?.()\n if (size) {\n ;[width, height, aspectRatio] = size\n }\n }\n\n const handlePointerMove = (event: PointerEvent) => {\n event.preventDefault()\n\n const dx = event.x - startX\n const dy = event.y - startY\n\n const [w, h] = calcResize(\n state.position.peek(),\n width,\n height,\n dx,\n dy,\n aspectRatio,\n )\n\n context.onResize.get()?.(w, h)\n }\n\n const handlePointerUp = (event: PointerEvent) => {\n event.preventDefault()\n pointerPressing.set(false)\n\n context.onResizeEnd.get()?.()\n }\n\n useEffect(host, () => {\n host.addEventListener('pointerdown', handlePointerDown)\n return () => {\n host.removeEventListener('pointerdown', handlePointerDown)\n }\n })\n\n useEffect(host, () => {\n if (!pointerPressing.get()) {\n return\n }\n\n const win = getWindow(host)\n\n win.addEventListener('pointermove', handlePointerMove)\n win.addEventListener('pointerup', handlePointerUp)\n return () => {\n win.removeEventListener('pointermove', handlePointerMove)\n win.removeEventListener('pointerup', handlePointerUp)\n }\n })\n}\n","import type {\n EventDeclarations,\n PropDeclarations,\n} from '@aria-ui/core'\n\nexport interface ResizableHandleProps {\n /**\n * The position of the handle.\n *\n * @default \"bottom-right\"\n */\n position:\n | 'top'\n | 'right'\n | 'bottom'\n | 'left'\n | 'top-left'\n | 'top-right'\n | 'bottom-left'\n | 'bottom-right'\n}\n\n/** @internal */\nexport const resizableHandleProps: PropDeclarations<ResizableHandleProps> = {\n position: { default: 'bottom-right' },\n}\n\n/** @internal */\nexport interface ResizableHandleEvents {}\n\n/** @internal */\nexport const resizableHandleEvents: EventDeclarations<ResizableHandleEvents> = {}\n","import { defineCustomElement, registerCustomElement, type BaseElementConstructor } from \"@aria-ui/core\"\n\nimport { useResizableHandle } from \"./setup\"\nimport { resizableHandleEvents, resizableHandleProps, type ResizableHandleEvents, type ResizableHandleProps } from \"./types\"\n\nconst ResizableHandleElementBase: BaseElementConstructor<ResizableHandleProps> = defineCustomElement<\n ResizableHandleProps,\n ResizableHandleEvents\n>({\n props: resizableHandleProps,\n events: resizableHandleEvents,\n setup: useResizableHandle,\n})\nclass ResizableHandleElement extends ResizableHandleElementBase {}\n\nregisterCustomElement('prosekit-resizable-handle', ResizableHandleElement)\n \nexport { ResizableHandleElement }\n","import {\n createSignal,\n useAttribute,\n useEffect,\n type ConnectableElement,\n type SetupOptions,\n} from '@aria-ui/core'\n\nimport { isFinitePositiveNumber } from '../../../utils/is-finite-positive-number'\nimport {\n onResizeContext,\n onResizeEndContext,\n onResizeStartContext,\n type OnResize,\n type OnResizeEnd,\n type OnResizeStart,\n} from '../context'\n\nimport type {\n ResizableRootEvents,\n ResizableRootProps,\n} from './types'\n\n/**\n * @internal\n */\nexport function useResizableRoot(\n host: ConnectableElement,\n { state, emit }: SetupOptions<ResizableRootProps, ResizableRootEvents>,\n): void {\n const resizing = createSignal(false)\n\n const onResizeStart: OnResizeStart = () => {\n const { width, height } = host.getBoundingClientRect()\n\n let aspectRatio: number = state.aspectRatio.peek() ?? width / height\n\n if (!isFinitePositiveNumber(aspectRatio)) {\n aspectRatio = 0\n }\n\n emit('resizeStart', { width, height })\n resizing.set(true)\n return [width, height, aspectRatio]\n }\n\n const onResize: OnResize = (width, height) => {\n state.width.set(width)\n state.height.set(height)\n }\n\n const onResizeEnd: OnResizeEnd = () => {\n const { width, height } = host.getBoundingClientRect()\n emit('resizeEnd', { width, height })\n resizing.set(false)\n }\n\n onResizeStartContext.provide(host, createSignal(onResizeStart))\n onResizeContext.provide(host, createSignal(onResize))\n onResizeEndContext.provide(host, createSignal(onResizeEnd))\n\n useEffect(host, () => {\n updateResizableRootStyles(\n host,\n Math.max(state.width.get() || 0, 1),\n Math.max(state.height.get() || 0, 1),\n state.aspectRatio.get(),\n )\n })\n\n useAttribute(host, 'data-resizing', () => (resizing.get() ? '' : undefined))\n}\n\nfunction updateResizableRootStyles(\n host: ConnectableElement,\n width: number,\n height: number,\n aspectRatio: number | null,\n) {\n host.style.width = isFinitePositiveNumber(width) ? `${width}px` : ''\n\n host.style.height = isFinitePositiveNumber(height) ? `${height}px` : ''\n\n if (isFinitePositiveNumber(aspectRatio)) {\n host.style.aspectRatio = `${aspectRatio}`\n\n if (width && width > 0 && aspectRatio >= 1) {\n host.style.height = 'auto'\n } else if (height && height > 0 && aspectRatio <= 1) {\n host.style.width = 'min-content'\n }\n }\n}\n","import type {\n EventDeclarations,\n PropDeclarations,\n} from '@aria-ui/core'\n\nexport interface ResizableRootProps {\n width: number | null\n height: number | null\n aspectRatio: number | null\n}\n\n/** @internal */\nexport const resizableRootProps: PropDeclarations<ResizableRootProps> = {\n width: { default: null },\n height: { default: null },\n aspectRatio: { default: null },\n}\n\nexport interface ResizableRootEvents {\n resizeStart: CustomEvent<{ width: number; height: number }>\n resizeEnd: CustomEvent<{ width: number; height: number }>\n}\n\n/** @internal */\nexport const resizableRootEvents: EventDeclarations<ResizableRootEvents> = {\n resizeStart: {},\n resizeEnd: {},\n}\n","import { defineCustomElement, registerCustomElement, type BaseElementConstructor } from \"@aria-ui/core\"\n\nimport { useResizableRoot } from \"./setup\"\nimport { resizableRootEvents, resizableRootProps, type ResizableRootEvents, type ResizableRootProps } from \"./types\"\n\nconst ResizableRootElementBase: BaseElementConstructor<ResizableRootProps> = defineCustomElement<\n ResizableRootProps,\n ResizableRootEvents\n>({\n props: resizableRootProps,\n events: resizableRootEvents,\n setup: useResizableRoot,\n})\nclass ResizableRootElement extends ResizableRootElementBase {}\n\nregisterCustomElement('prosekit-resizable-root', ResizableRootElement)\n \nexport { ResizableRootElement }\n"],"mappings":";;;;;;;AAQA,MAAaA,kBAAqC,cAChD,+BACA,KACD;;;;AAKD,MAAaC,uBAA+C,cAC1D,oCACA,KACD;;;;AAKD,MAAaC,qBAA2C,cACtD,kCACA,KACD;;;;AC3BD,SAAgB,uBAAuB,OAAiC;AACtE,QAAO,OAAO,UAAU,YAAY,OAAO,SAAS,MAAM,IAAI,QAAQ;;;;;ACCxE,SAAgB,WACd,UASA,GACA,GACA,IACA,IACA,aACwB;AACxB,eAAc,cAAc,cAAc,IAAI;AAC9C,eAAc,uBAAuB,YAAY,GAAG,cAAc;AAElE,SAAQ,UAAR;EACE,KAAK,eACH,QAAO,MAAM,sBAAsB,GAAG,GAAG,IAAI,IAAI,YAAY,CAAC;EAChE,KAAK,cACH,QAAO,MAAM,qBAAqB,GAAG,GAAG,IAAI,IAAI,YAAY,CAAC;EAC/D,KAAK,YACH,QAAO,MAAM,mBAAmB,GAAG,GAAG,IAAI,IAAI,YAAY,CAAC;EAC7D,KAAK,WACH,QAAO,MAAM,kBAAkB,GAAG,GAAG,IAAI,IAAI,YAAY,CAAC;EAC5D,KAAK,MACH,QAAO,MAAM,cAAc,GAAG,GAAG,IAAI,IAAI,YAAY,CAAC;EACxD,KAAK,QACH,QAAO,MAAM,gBAAgB,GAAG,GAAG,IAAI,IAAI,YAAY,CAAC;EAC1D,KAAK,SACH,QAAO,MAAM,iBAAiB,GAAG,GAAG,IAAI,IAAI,YAAY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AK,IAAI,GAAG,EAAE,EACpC,MAAM,YAAY,KAAK,CACxB;GACD;AAEF,cAAa,MAAM,uBAAwB,SAAS,KAAK,GAAG,KAAK,OAAW;;AAG9E,SAAS,0BACP,MACA,OACA,QACA,aACA;AACA,MAAK,MAAM,QAAQ,uBAAuB,MAAM,GAAG,GAAG,MAAM,MAAM;AAElE,MAAK,MAAM,SAAS,uBAAuB,OAAO,GAAG,GAAG,OAAO,MAAM;AAErE,KAAI,uBAAuB,YAAY,EAAE;AACvC,OAAK,MAAM,cAAc,GAAG;AAE5B,MAAI,SAAS,QAAQ,KAAK,eAAe,EACvC,MAAK,MAAM,SAAS;WACX,UAAU,SAAS,KAAK,eAAe,EAChD,MAAK,MAAM,QAAQ;;;;;;;AC7EzB,MAAaC,qBAA2D;CACtE,OAAO,EAAE,SAAS,MAAM;CACxB,QAAQ,EAAE,SAAS,MAAM;CACzB,aAAa,EAAE,SAAS,MAAM;CAC/B;;AAQD,MAAaC,sBAA8D;CACzE,aAAa,EAAE;CACf,WAAW,EAAE;CACd;;;;ACtBD,MAAMC,2BAAuE,oBAG3E;CACA,OAAO;CACP,QAAQ;CACR,OAAO;CACR,CAAC;AACF,IAAM,uBAAN,cAAmC,yBAAyB;AAE5D,sBAAsB,2BAA2B,qBAAqB"}
|
|
1
|
+
{"version":3,"file":"prosekit-web-resizable.js","names":[],"sources":["../src/components/resizable/context.ts","../src/utils/is-finite-positive-number.ts","../src/components/resizable/resizable-handle/calc-resize.ts","../src/components/resizable/resizable-handle/setup.ts","../src/components/resizable/resizable-handle/types.ts","../src/components/resizable/resizable-handle/element.gen.ts","../src/components/resizable/resizable-root/setup.ts","../src/components/resizable/resizable-root/types.ts","../src/components/resizable/resizable-root/element.gen.ts"],"sourcesContent":["import { createContext, type Context } from '@aria-ui/core'\n\n/**\n * @internal\n */\nexport const onResizeContext: Context<OnResize> = createContext(\n 'prosekit/resizable/onResize',\n null,\n)\n\n/**\n * @internal\n */\nexport const onResizeStartContext: Context<OnResizeStart> = createContext(\n 'prosekit/resizable/onResizeStart',\n null,\n)\n\n/**\n * @internal\n */\nexport const onResizeEndContext: Context<OnResizeEnd> = createContext(\n 'prosekit/resizable/onResizeEnd',\n null,\n)\n\n/**\n * @internal\n */\nexport type OnResize = ((width: number, height: number) => void) | null\n\n/**\n * @internal\n */\nexport type OnResizeStart =\n | (() => readonly [width: number, height: number, aspectRatio: number])\n | null\n\n/**\n * @internal\n */\nexport type OnResizeEnd = (() => void) | null\n","export function isFinitePositiveNumber(value: unknown): value is number {\n return typeof value === 'number' && Number.isFinite(value) && value > 0\n}\n","import { isFinitePositiveNumber } from '../../../utils/is-finite-positive-number'\n\nexport function calcResize(\n position:\n | 'top'\n | 'right'\n | 'bottom'\n | 'left'\n | 'top-left'\n | 'top-right'\n | 'bottom-left'\n | 'bottom-right',\n w: number,\n h: number,\n dx: number,\n dy: number,\n aspectRatio: number | null | undefined,\n): [w: number, h: number] {\n aspectRatio = aspectRatio ? aspectRatio : w / h\n aspectRatio = isFinitePositiveNumber(aspectRatio) ? aspectRatio : 1\n\n switch (position) {\n case 'bottom-right':\n return clamp(calcBottomRightResize(w, h, dx, dy, aspectRatio))\n case 'bottom-left':\n return clamp(calcBottomLeftResize(w, h, dx, dy, aspectRatio))\n case 'top-right':\n return clamp(calcTopRightResize(w, h, dx, dy, aspectRatio))\n case 'top-left':\n return clamp(calcTopLeftResize(w, h, dx, dy, aspectRatio))\n case 'top':\n return clamp(calcTopResize(w, h, dx, dy, aspectRatio))\n case 'right':\n return clamp(calcRightResize(w, h, dx, dy, aspectRatio))\n case 'bottom':\n return clamp(calcBottomResize(w, h, dx, dy, aspectRatio))\n case 'left':\n return clamp(calcLeftResize(w, h, dx, dy, aspectRatio))\n default:\n throw new RangeError(`Invalid position: ${position}`)\n }\n}\n\ntype CalcResize = (\n w: number,\n h: number,\n dx: number,\n dy: number,\n aspectRatio: number,\n) => [w: number, h: number]\n\nconst calcBottomRightResize: CalcResize = (w, h, dx, dy, r) => {\n w += dx\n h += dy\n\n const sum = w + h\n h = sum / (r + 1)\n w = sum - h\n return [w, h]\n}\n\nconst calcBottomLeftResize: CalcResize = (w, h, dx, dy, r) => {\n w -= dx\n h += dy\n\n const sum = w + h\n h = sum / (r + 1)\n w = sum - h\n return [w, h]\n}\n\nconst calcTopRightResize: CalcResize = (w, h, dx, dy, r) => {\n w += dx\n h -= dy\n\n const sum = w + h\n h = sum / (r + 1)\n w = sum - h\n return [w, h]\n}\n\nconst calcTopLeftResize: CalcResize = (w, h, dx, dy, r) => {\n w -= dx\n h -= dy\n\n const sum = w + h\n h = sum / (r + 1)\n w = sum - h\n return [w, h]\n}\n\nconst calcTopResize: CalcResize = (w, h, dx, dy, r) => {\n h -= dy\n w = h * r\n return [w, h]\n}\n\nconst calcRightResize: CalcResize = (w, h, dx, dy, r) => {\n w += dx\n h = w / r\n return [w, h]\n}\n\nconst calcBottomResize: CalcResize = (w, h, dx, dy, r) => {\n h += dy\n w = h * r\n return [w, h]\n}\n\nconst calcLeftResize: CalcResize = (w, h, dx, dy, r) => {\n w -= dx\n h = w / r\n return [w, h]\n}\n\nfunction clamp([w, h]: [number, number]): [number, number] {\n return [\n Math.max(w, 1),\n Math.max(h, 1),\n ]\n}\n","import { createSignal, useEffect, type ConnectableElement, type ReadonlySignal, type SignalState } from '@aria-ui/core'\nimport { getWindow } from '@ocavue/utils'\n\nimport { onResizeContext, onResizeEndContext, onResizeStartContext, type OnResize, type OnResizeEnd, type OnResizeStart } from '../context'\n\nimport { calcResize } from './calc-resize'\nimport type { ResizableHandleProps } from './types'\n\n/**\n * @internal\n */\nexport function useResizableHandle(\n host: ConnectableElement,\n { state }: { state: SignalState<ResizableHandleProps> },\n): void {\n const onResize = onResizeContext.consume(host)\n const onResizeStart = onResizeStartContext.consume(host)\n const onResizeEnd = onResizeEndContext.consume(host)\n\n useResizableHandleState(host, state, { onResize, onResizeStart, onResizeEnd })\n}\n\nfunction useResizableHandleState(\n host: ConnectableElement,\n state: SignalState<ResizableHandleProps>,\n context: {\n onResizeStart: ReadonlySignal<OnResizeStart>\n onResize: ReadonlySignal<OnResize>\n onResizeEnd: ReadonlySignal<OnResizeEnd>\n },\n) {\n let startX = 0\n let startY = 0\n let width = 0\n let height = 0\n let aspectRatio = 1\n\n const pointerPressing = createSignal(false)\n\n const handlePointerDown = (event: PointerEvent) => {\n event.preventDefault()\n pointerPressing.set(true)\n\n startX = event.x\n startY = event.y\n\n const size = context.onResizeStart.get()?.()\n if (size) {\n ;[width, height, aspectRatio] = size\n }\n }\n\n const handlePointerMove = (event: PointerEvent) => {\n event.preventDefault()\n\n const dx = event.x - startX\n const dy = event.y - startY\n\n const [w, h] = calcResize(\n state.position.peek(),\n width,\n height,\n dx,\n dy,\n aspectRatio,\n )\n\n context.onResize.get()?.(w, h)\n }\n\n const handlePointerUp = (event: PointerEvent) => {\n event.preventDefault()\n pointerPressing.set(false)\n\n context.onResizeEnd.get()?.()\n }\n\n useEffect(host, () => {\n host.addEventListener('pointerdown', handlePointerDown)\n return () => {\n host.removeEventListener('pointerdown', handlePointerDown)\n }\n })\n\n useEffect(host, () => {\n if (!pointerPressing.get()) {\n return\n }\n\n const win = getWindow(host)\n\n win.addEventListener('pointermove', handlePointerMove)\n win.addEventListener('pointerup', handlePointerUp)\n return () => {\n win.removeEventListener('pointermove', handlePointerMove)\n win.removeEventListener('pointerup', handlePointerUp)\n }\n })\n}\n","import type { EventDeclarations, PropDeclarations } from '@aria-ui/core'\n\nexport interface ResizableHandleProps {\n /**\n * The position of the handle.\n *\n * @default \"bottom-right\"\n */\n position:\n | 'top'\n | 'right'\n | 'bottom'\n | 'left'\n | 'top-left'\n | 'top-right'\n | 'bottom-left'\n | 'bottom-right'\n}\n\n/** @internal */\nexport const resizableHandleProps: PropDeclarations<ResizableHandleProps> = {\n position: { default: 'bottom-right' },\n}\n\n/** @internal */\nexport interface ResizableHandleEvents {}\n\n/** @internal */\nexport const resizableHandleEvents: EventDeclarations<ResizableHandleEvents> = {}\n","import { defineCustomElement, registerCustomElement, type BaseElementConstructor } from \"@aria-ui/core\"\n\nimport { useResizableHandle } from \"./setup\"\nimport { resizableHandleEvents, resizableHandleProps, type ResizableHandleEvents, type ResizableHandleProps } from \"./types\"\n\nconst ResizableHandleElementBase: BaseElementConstructor<ResizableHandleProps> = defineCustomElement<\n ResizableHandleProps,\n ResizableHandleEvents\n>({\n props: resizableHandleProps,\n events: resizableHandleEvents,\n setup: useResizableHandle,\n})\nclass ResizableHandleElement extends ResizableHandleElementBase {}\n\nregisterCustomElement('prosekit-resizable-handle', ResizableHandleElement)\n \nexport { ResizableHandleElement }\n","import { createSignal, useAttribute, useEffect, type ConnectableElement, type SetupOptions } from '@aria-ui/core'\n\nimport { isFinitePositiveNumber } from '../../../utils/is-finite-positive-number'\nimport { onResizeContext, onResizeEndContext, onResizeStartContext, type OnResize, type OnResizeEnd, type OnResizeStart } from '../context'\n\nimport type { ResizableRootEvents, ResizableRootProps } from './types'\n\n/**\n * @internal\n */\nexport function useResizableRoot(\n host: ConnectableElement,\n { state, emit }: SetupOptions<ResizableRootProps, ResizableRootEvents>,\n): void {\n const resizing = createSignal(false)\n\n const onResizeStart: OnResizeStart = () => {\n const { width, height } = host.getBoundingClientRect()\n\n let aspectRatio: number = state.aspectRatio.peek() ?? width / height\n\n if (!isFinitePositiveNumber(aspectRatio)) {\n aspectRatio = 0\n }\n\n emit('resizeStart', { width, height })\n resizing.set(true)\n return [width, height, aspectRatio]\n }\n\n const onResize: OnResize = (width, height) => {\n state.width.set(width)\n state.height.set(height)\n }\n\n const onResizeEnd: OnResizeEnd = () => {\n const { width, height } = host.getBoundingClientRect()\n emit('resizeEnd', { width, height })\n resizing.set(false)\n }\n\n onResizeStartContext.provide(host, createSignal(onResizeStart))\n onResizeContext.provide(host, createSignal(onResize))\n onResizeEndContext.provide(host, createSignal(onResizeEnd))\n\n useEffect(host, () => {\n updateResizableRootStyles(\n host,\n Math.max(state.width.get() || 0, 1),\n Math.max(state.height.get() || 0, 1),\n state.aspectRatio.get(),\n )\n })\n\n useAttribute(host, 'data-resizing', () => (resizing.get() ? '' : undefined))\n}\n\nfunction updateResizableRootStyles(\n host: ConnectableElement,\n width: number,\n height: number,\n aspectRatio: number | null,\n) {\n host.style.width = isFinitePositiveNumber(width) ? `${width}px` : ''\n\n host.style.height = isFinitePositiveNumber(height) ? `${height}px` : ''\n\n if (isFinitePositiveNumber(aspectRatio)) {\n host.style.aspectRatio = `${aspectRatio}`\n\n if (width && width > 0 && aspectRatio >= 1) {\n host.style.height = 'auto'\n } else if (height && height > 0 && aspectRatio <= 1) {\n host.style.width = 'min-content'\n }\n }\n}\n","import type { EventDeclarations, PropDeclarations } from '@aria-ui/core'\n\nexport interface ResizableRootProps {\n width: number | null\n height: number | null\n aspectRatio: number | null\n}\n\n/** @internal */\nexport const resizableRootProps: PropDeclarations<ResizableRootProps> = {\n width: { default: null },\n height: { default: null },\n aspectRatio: { default: null },\n}\n\nexport interface ResizableRootEvents {\n resizeStart: CustomEvent<{ width: number; height: number }>\n resizeEnd: CustomEvent<{ width: number; height: number }>\n}\n\n/** @internal */\nexport const resizableRootEvents: EventDeclarations<ResizableRootEvents> = {\n resizeStart: {},\n resizeEnd: {},\n}\n","import { defineCustomElement, registerCustomElement, type BaseElementConstructor } from \"@aria-ui/core\"\n\nimport { useResizableRoot } from \"./setup\"\nimport { resizableRootEvents, resizableRootProps, type ResizableRootEvents, type ResizableRootProps } from \"./types\"\n\nconst ResizableRootElementBase: BaseElementConstructor<ResizableRootProps> = defineCustomElement<\n ResizableRootProps,\n ResizableRootEvents\n>({\n props: resizableRootProps,\n events: resizableRootEvents,\n setup: useResizableRoot,\n})\nclass ResizableRootElement extends ResizableRootElementBase {}\n\nregisterCustomElement('prosekit-resizable-root', ResizableRootElement)\n \nexport { ResizableRootElement }\n"],"mappings":";;;;;;;AAKA,MAAa,kBAAqC,cAChD,+BACA,KACD;;;;AAKD,MAAa,uBAA+C,cAC1D,oCACA,KACD;;;;AAKD,MAAa,q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AA2D;CACtE,OAAO,EAAE,SAAS,MAAM;CACxB,QAAQ,EAAE,SAAS,MAAM;CACzB,aAAa,EAAE,SAAS,MAAM;CAC/B;;AAQD,MAAa,sBAA8D;CACzE,aAAa,EAAE;CACf,WAAW,EAAE;CACd;;;;ACnBD,MAAM,2BAAuE,oBAG3E;CACA,OAAO;CACP,QAAQ;CACR,OAAO;CACR,CAAC;AACF,IAAM,uBAAN,cAAmC,yBAAyB;AAE5D,sBAAsB,2BAA2B,qBAAqB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prosekit-web-table-handle.d.ts","names":[],"sources":["../src/components/table-handle/table-handle-column-root/types.ts","../src/components/table-handle/table-handle-column-root/element.gen.ts","../src/components/table-handle/table-handle-column-root/setup.ts","../src/components/table-handle/table-handle-column-trigger/types.ts","../src/components/table-handle/table-handle-column-trigger/element.gen.ts","../src/components/table-handle/table-handle-column-trigger/setup.ts","../src/components/table-handle/table-handle-drag-preview/types.ts","../src/components/table-handle/table-handle-drag-preview/element.gen.ts","../src/components/table-handle/table-handle-drag-preview/setup.ts","../src/components/table-handle/table-handle-drop-indicator/types.ts","../src/components/table-handle/table-handle-drop-indicator/element.gen.ts","../src/components/table-handle/table-handle-drop-indicator/setup.ts","../src/components/table-handle/table-handle-popover-content/types.ts","../src/components/table-handle/table-handle-popover-content/element.gen.ts","../src/components/table-handle/table-handle-popover-content/setup.ts","../src/components/table-handle/table-handle-popover-item/types.ts","../src/components/table-handle/table-handle-popover-item/element.gen.ts","../src/components/table-handle/table-handle-popover-item/setup.ts","../src/components/table-handle/table-handle-root/types.ts","../src/components/table-handle/table-handle-root/element.gen.ts","../src/components/table-handle/table-handle-root/setup.ts","../src/components/table-handle/table-handle-row-root/types.ts","../src/components/table-handle/table-handle-row-root/element.gen.ts","../src/components/table-handle/table-handle-row-root/setup.ts","../src/components/table-handle/table-handle-row-trigger/types.ts","../src/components/table-handle/table-handle-row-trigger/element.gen.ts","../src/components/table-handle/table-handle-row-trigger/setup.ts"],"
|
|
1
|
+
{"version":3,"file":"prosekit-web-table-handle.d.ts","names":[],"sources":["../src/components/table-handle/table-handle-column-root/types.ts","../src/components/table-handle/table-handle-column-root/element.gen.ts","../src/components/table-handle/table-handle-column-root/setup.ts","../src/components/table-handle/table-handle-column-trigger/types.ts","../src/components/table-handle/table-handle-column-trigger/element.gen.ts","../src/components/table-handle/table-handle-column-trigger/setup.ts","../src/components/table-handle/table-handle-drag-preview/types.ts","../src/components/table-handle/table-handle-drag-preview/element.gen.ts","../src/components/table-handle/table-handle-drag-preview/setup.ts","../src/components/table-handle/table-handle-drop-indicator/types.ts","../src/components/table-handle/table-handle-drop-indicator/element.gen.ts","../src/components/table-handle/table-handle-drop-indicator/setup.ts","../src/components/table-handle/table-handle-popover-content/types.ts","../src/components/table-handle/table-handle-popover-content/element.gen.ts","../src/components/table-handle/table-handle-popover-content/setup.ts","../src/components/table-handle/table-handle-popover-item/types.ts","../src/components/table-handle/table-handle-popover-item/element.gen.ts","../src/components/table-handle/table-handle-popover-item/setup.ts","../src/components/table-handle/table-handle-root/types.ts","../src/components/table-handle/table-handle-root/element.gen.ts","../src/components/table-handle/table-handle-root/setup.ts","../src/components/table-handle/table-handle-row-root/types.ts","../src/components/table-handle/table-handle-row-root/element.gen.ts","../src/components/table-handle/table-handle-row-root/setup.ts","../src/components/table-handle/table-handle-row-trigger/types.ts","../src/components/table-handle/table-handle-row-trigger/element.gen.ts","../src/components/table-handle/table-handle-row-trigger/setup.ts"],"mappings":";;;;;;;;;UAUiB,0BAAA,SAAmC,IAAA,CAAK,sBAAA;;;;;AAAzD;;EAOE,MAAA,EAAQ,MAAA;EAP+C;;;;;EAcvD,SAAA,EAAW,SAAA;EAduC;;;;;;EAsBlD,KAAA;EAMA;;;;EAAA,IAAA;EAgBW;;;;EAVX,KAAA;EAyBe;;;;EAnBf,IAAA;AAAA;;cAIW,0BAAA,EAA4B,gBAAA,CAAiB,0BAAA;;UAezC,2BAAA,SAAoC,uBA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CAAY,oBAAA;AAAA;;;UC5BjB,uBAAA,SAAgC,IAAA,CAAK,sBAAA;;;;;ArBKtD;;EqBEE,MAAA,EAAQ,MAAA;ErBF+C;;;;;EqBSvD,SAAA,EAAW,SAAA;ErBTuC;;;;;;EqBiBlD,KAAA;ErBWA;;;;EqBLA,IAAA;ErBqBW;;;;EqBfX,KAAA;ErB8Be;;;;EqBxBf,IAAA;AAAA;;cAIW,uBAAA,EAAyB,gBAAA,CAAiB,uBAAA;;UAetC,wBAAA,SAAiC,uBAAA;;cAGrC,wBAAA,EAA0B,iBAAA,CAAkB,wBAAA;;;cC9DnD,6BAAA,EAA+B,sBAAA,CAAuB,uBAAA;AAAA,cAQtD,yBAAA,SAAkC,6BAAA;;;;;;iBCSxB,qBAAA,CACd,IAAA,EAAM,kBAAA;EACJ;AAAA,GAAS,YAAA,CAAa,uBAAA,EAAyB,wBAAA;;;KCpB9C,wBAAA,GAAyB,UAAA,QAAkB,mBAAA;AAAA,UAE/B,0BAAA;EACf,MAAA,EAAQ,MAAA,CAAO,wBAAA;AAAA;;cAIJ,0BAAA,EAA4B,gBAAA,CAAiB,0BAAA;AAAA,UAIzC,2BAAA;EACf,MAAA,EAAQ,WAAA;AAAA;;cAIG,2BAAA,EAA6B,iBAAA,CAAkB,2BAAA;;;cCftD,gCAAA,EAAkC,sBAAA,CAAuB,0BAAA;AAAA,cAQzD,4BAAA,SAAqC,gCAAA;;;;;;iBCD3B,wBAAA,CACd,IAAA,EAAM,kBAAA;EACJ;AAAA,GAAS,YAAA,CAAa,0BAAA,EAA4B,2BAAA"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { t as getStateWithDefaults } from "./get-default-state-
|
|
2
|
-
import { t as useEditorExtension } from "./use-editor-extension-
|
|
3
|
-
import { t as getSafeEditorView } from "./get-safe-editor-view-
|
|
4
|
-
import { n as assignStyles, t as useScrolling } from "./use-scrolling-
|
|
5
|
-
import { n as cloneElement, r as deepCloneElement, t as injectStyle } from "./inject-style-
|
|
1
|
+
import { t as getStateWithDefaults } from "./get-default-state-BzBimBWi.js";
|
|
2
|
+
import { t as useEditorExtension } from "./use-editor-extension-B2WuUfnd.js";
|
|
3
|
+
import { t as getSafeEditorView } from "./get-safe-editor-view-Dt9Amrcn.js";
|
|
4
|
+
import { n as assignStyles, t as useScrolling } from "./use-scrolling-BjVzAkiZ.js";
|
|
5
|
+
import { n as cloneElement, r as deepCloneElement, t as injectStyle } from "./inject-style-BaFaVQvj.js";
|
|
6
6
|
import { createComputed, createContext, createSignal, defineCustomElement, defineEmit, registerCustomElement, useAttribute, useEffect, useEventListener } from "@aria-ui/core";
|
|
7
7
|
import { defineDOMEventHandler, union } from "@prosekit/core";
|
|
8
8
|
import { useOverlayPositionerState } from "@aria-ui/overlay/elements";
|
|
@@ -241,8 +241,8 @@ function getTableDOMByPos(view, pos) {
|
|
|
241
241
|
return (isHTMLElement(dom) ? dom : dom.parentElement)?.closest("table") ?? void 0;
|
|
242
242
|
}
|
|
243
243
|
function getTargetFirstCellDOM(table, index, direction) {
|
|
244
|
-
if (direction === "row") return table.querySelectorAll("tr")[index]?.querySelector("td") ?? void 0;
|
|
245
|
-
else return table.querySelector("tr")?.querySelectorAll("td")[index] ?? void 0;
|
|
244
|
+
if (direction === "row") return table.querySelectorAll("tr")[index]?.querySelector("td, th") ?? void 0;
|
|
245
|
+
else return table.querySelector("tr")?.querySelectorAll("td, th")[index] ?? void 0;
|
|
246
246
|
}
|
|
247
247
|
function getDndRelatedDOMs(view, cellPos, draggingIndex, direction) {
|
|
248
248
|
if (cellPos == null) return;
|
|
@@ -323,7 +323,7 @@ function createPreviewDOM(table, previewRoot, index, direction) {
|
|
|
323
323
|
const [previewRow, previewRowStyle] = cloneElement(row);
|
|
324
324
|
injectStyle(previewRoot, previewRowStyle);
|
|
325
325
|
unsetSize(previewRow);
|
|
326
|
-
const cell = row.querySelectorAll("td")[index];
|
|
326
|
+
const cell = row.querySelectorAll("td, th")[index];
|
|
327
327
|
if (cell) {
|
|
328
328
|
const [previewCell, previewCellStyle] = deepCloneElement(cell);
|
|
329
329
|
injectStyle(previewRoot, previewCellStyle);
|
|
@@ -368,14 +368,14 @@ function useUpdatePreviewPosition(host, editor) {
|
|
|
368
368
|
if (!relatedDOMs) return;
|
|
369
369
|
const { cell } = relatedDOMs;
|
|
370
370
|
let cancelled = false;
|
|
371
|
-
computePosition(getVirtualElement(cell, x, y), host, { placement: direction === "row" ? "right" : "bottom" }).then(({ x
|
|
371
|
+
computePosition(getVirtualElement(cell, x, y), host, { placement: direction === "row" ? "right" : "bottom" }).then(({ x, y }) => {
|
|
372
372
|
if (cancelled) return;
|
|
373
373
|
if (direction === "row") {
|
|
374
|
-
assignStyles(host, { top: `${y
|
|
374
|
+
assignStyles(host, { top: `${y}px` });
|
|
375
375
|
return;
|
|
376
376
|
}
|
|
377
377
|
if (direction === "col") {
|
|
378
|
-
assignStyles(host, { left: `${x
|
|
378
|
+
assignStyles(host, { left: `${x}px` });
|
|
379
379
|
return;
|
|
380
380
|
}
|
|
381
381
|
});
|
|
@@ -459,13 +459,13 @@ function findDragOverElement(elements, pointer, axis) {
|
|
|
459
459
|
const startProp = axis === "x" ? "left" : "top";
|
|
460
460
|
const endProp = axis === "x" ? "right" : "bottom";
|
|
461
461
|
const lastIndex = elements.length - 1;
|
|
462
|
-
const index = elements.findIndex((el, index
|
|
462
|
+
const index = elements.findIndex((el, index) => {
|
|
463
463
|
const rect = el.getBoundingClientRect();
|
|
464
464
|
const boundaryStart = rect[startProp];
|
|
465
465
|
const boundaryEnd = rect[endProp];
|
|
466
466
|
if (boundaryStart <= pointer && pointer <= boundaryEnd) return true;
|
|
467
|
-
if (index
|
|
468
|
-
if (index
|
|
467
|
+
if (index === lastIndex && pointer > boundaryEnd) return true;
|
|
468
|
+
if (index === 0 && pointer < boundaryStart) return true;
|
|
469
469
|
return false;
|
|
470
470
|
});
|
|
471
471
|
return index >= 0 ? [elements[index], index] : void 0;
|
|
@@ -510,11 +510,11 @@ function useUpdateIndicatorPosition(host, editor, handleWidth) {
|
|
|
510
510
|
if (!relatedDOMs) return;
|
|
511
511
|
const { table } = relatedDOMs;
|
|
512
512
|
let cancelled = false;
|
|
513
|
-
|
|
513
|
+
const cleanup = () => {
|
|
514
514
|
cancelled = true;
|
|
515
515
|
};
|
|
516
516
|
if (direction === "col") {
|
|
517
|
-
const direction
|
|
517
|
+
const direction = startXSignal.get() > x ? "left" : "right";
|
|
518
518
|
const dragOverColumn = getDragOverColumn(table, x);
|
|
519
519
|
if (dragOverColumn) {
|
|
520
520
|
const [col, index] = dragOverColumn;
|
|
@@ -523,17 +523,17 @@ function useUpdateIndicatorPosition(host, editor, handleWidth) {
|
|
|
523
523
|
droppingIndex: index
|
|
524
524
|
});
|
|
525
525
|
computePosition(col, host, {
|
|
526
|
-
placement: direction
|
|
527
|
-
middleware: [offset(direction
|
|
528
|
-
}).then(({ x
|
|
526
|
+
placement: direction === "left" ? "left" : "right",
|
|
527
|
+
middleware: [offset(direction === "left" ? -1 * handleWidth : 0)]
|
|
528
|
+
}).then(({ x }) => {
|
|
529
529
|
if (cancelled) return;
|
|
530
|
-
assignStyles(host, { left: `${x
|
|
530
|
+
assignStyles(host, { left: `${x}px` });
|
|
531
531
|
});
|
|
532
532
|
}
|
|
533
533
|
return cleanup;
|
|
534
534
|
}
|
|
535
535
|
if (direction === "row") {
|
|
536
|
-
const direction
|
|
536
|
+
const direction = startYSignal.get() > y ? "up" : "down";
|
|
537
537
|
const dragOverRow = getDragOverRow(table, y);
|
|
538
538
|
if (dragOverRow) {
|
|
539
539
|
const [row, index] = dragOverRow;
|
|
@@ -542,11 +542,11 @@ function useUpdateIndicatorPosition(host, editor, handleWidth) {
|
|
|
542
542
|
droppingIndex: index
|
|
543
543
|
});
|
|
544
544
|
computePosition(row, host, {
|
|
545
|
-
placement: direction
|
|
546
|
-
middleware: [offset(direction
|
|
547
|
-
}).then(({ y
|
|
545
|
+
placement: direction === "up" ? "top" : "bottom",
|
|
546
|
+
middleware: [offset(direction === "up" ? -1 * handleWidth : 0)]
|
|
547
|
+
}).then(({ y }) => {
|
|
548
548
|
if (cancelled) return;
|
|
549
|
-
assignStyles(host, { top: `${y
|
|
549
|
+
assignStyles(host, { top: `${y}px` });
|
|
550
550
|
});
|
|
551
551
|
}
|
|
552
552
|
return cleanup;
|