@prosekit/web 0.7.12 → 0.8.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{get-default-state-BzBimBWi.js → get-default-state.js} +2 -3
- package/dist/get-default-state.js.map +1 -0
- package/dist/{get-safe-editor-view-Dt9Amrcn.js → get-safe-editor-view.js} +2 -2
- package/dist/get-safe-editor-view.js.map +1 -0
- package/dist/prosekit-web-autocomplete.d.ts.map +1 -1
- package/dist/prosekit-web-autocomplete.js +7 -22
- package/dist/prosekit-web-autocomplete.js.map +1 -1
- package/dist/prosekit-web-block-handle.js +53 -80
- package/dist/prosekit-web-block-handle.js.map +1 -1
- package/dist/prosekit-web-drop-indicator.js +3 -6
- package/dist/prosekit-web-drop-indicator.js.map +1 -1
- package/dist/prosekit-web-inline-popover.js +2 -9
- package/dist/prosekit-web-inline-popover.js.map +1 -1
- package/dist/prosekit-web-popover.js +1 -4
- 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 +30 -13
- package/dist/prosekit-web-resizable.js.map +1 -1
- package/dist/prosekit-web-table-handle.js +76 -48
- package/dist/prosekit-web-table-handle.js.map +1 -1
- package/dist/prosekit-web-tooltip.js +1 -4
- package/dist/prosekit-web-tooltip.js.map +1 -1
- package/dist/prosekit-web.js +1 -1
- package/dist/prosekit-web.js.map +1 -1
- package/dist/{use-editor-extension-B2WuUfnd.js → use-editor-extension.js} +2 -3
- package/dist/use-editor-extension.js.map +1 -0
- package/dist/{use-scrolling-BjVzAkiZ.js → use-scrolling.js} +2 -4
- package/dist/use-scrolling.js.map +1 -0
- package/package.json +11 -11
- package/src/components/autocomplete/autocomplete-list/setup.ts +3 -2
- package/src/components/autocomplete/autocomplete-popover/setup.ts +2 -2
- package/src/components/block-handle/block-handle-draggable/set-drag-preview.ts +9 -10
- package/src/components/block-handle/block-handle-draggable/setup.ts +5 -10
- package/src/components/block-handle/block-handle-popover/pointer-move.ts +2 -10
- package/src/components/block-handle/block-handle-popover/setup.ts +1 -3
- package/src/components/resizable/resizable-root/types.ts +37 -3
- package/src/constants.ts +1 -0
- package/src/utils/get-client-rect.ts +47 -9
- package/dist/get-default-state-BzBimBWi.js.map +0 -1
- package/dist/get-safe-editor-view-Dt9Amrcn.js.map +0 -1
- package/dist/inject-style-BaFaVQvj.js +0 -76
- package/dist/inject-style-BaFaVQvj.js.map +0 -1
- package/dist/use-editor-extension-B2WuUfnd.js.map +0 -1
- package/dist/use-scrolling-BjVzAkiZ.js.map +0 -1
- package/src/utils/get-box-element.ts +0 -20
- package/src/utils/throttle.ts +0 -17
|
@@ -1 +1 @@
|
|
|
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.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 { createSignal, useEffect, type ConnectableElement, type ReadonlySignal, type SignalState } 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.ts'\n\nimport { calcResize } from './calc-resize.ts'\nimport type { ResizableHandleProps } from './types.ts'\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.ts\"\nimport { resizableHandleEvents, resizableHandleProps, type ResizableHandleEvents, type ResizableHandleProps } from \"./types.ts\"\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.ts'\nimport {\n onResizeContext,\n onResizeEndContext,\n onResizeStartContext,\n type OnResize,\n type OnResizeEnd,\n type OnResizeStart,\n} from '../context.ts'\n\nimport type { ResizableRootEvents, ResizableRootProps } from './types.ts'\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.ts\"\nimport { resizableRootEvents, resizableRootProps, type ResizableRootEvents, type ResizableRootProps } from \"./types.ts\"\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,qBAA2C,cACtD,kCACA,KACD;;;;ACxBD,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,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;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.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 { createSignal, useEffect, type ConnectableElement, type ReadonlySignal, type SignalState } 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.ts'\n\nimport { calcResize } from './calc-resize.ts'\nimport type { ResizableHandleProps } from './types.ts'\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.ts\"\nimport { resizableHandleEvents, resizableHandleProps, type ResizableHandleEvents, type ResizableHandleProps } from \"./types.ts\"\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.ts'\nimport {\n onResizeContext,\n onResizeEndContext,\n onResizeStartContext,\n type OnResize,\n type OnResizeEnd,\n type OnResizeStart,\n} from '../context.ts'\n\nimport type { ResizableRootEvents, ResizableRootProps } from './types.ts'\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\nimport { isFinitePositiveNumber } from '../../../utils/is-finite-positive-number.ts'\n\nexport interface ResizableRootProps {\n width: number | null\n height: number | null\n aspectRatio: number | null\n}\n\nfunction fromNumberAttribute(value: string | null): number | null {\n if (typeof value === 'string') {\n const number = Number.parseFloat(value)\n if (isFinitePositiveNumber(number)) {\n return number\n }\n }\n return null\n}\n\nfunction toNumberAttribute(value: number | null): string | null {\n if (typeof value === 'number') {\n return `${value}`\n }\n return null\n}\n\n/** @internal */\nexport const resizableRootProps: PropDeclarations<ResizableRootProps> = {\n width: {\n default: null,\n attribute: 'data-width',\n fromAttribute: fromNumberAttribute,\n toAttribute: toNumberAttribute,\n },\n height: {\n default: null,\n attribute: 'data-height',\n fromAttribute: fromNumberAttribute,\n toAttribute: toNumberAttribute,\n },\n aspectRatio: {\n default: null,\n attribute: 'data-aspect-ratio',\n fromAttribute: fromNumberAttribute,\n toAttribute: toNumberAttribute,\n },\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.ts\"\nimport { resizableRootEvents, resizableRootProps, type ResizableRootEvents, type ResizableRootProps } from \"./types.ts\"\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,qBAA2C,cACtD,kCACA,KACD;;;ACxBD,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,UAA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AS;EACT,WAAW;EACX,eAAe;EACf,aAAa;EACd;CACD,QAAQ;EACN,SAAS;EACT,WAAW;EACX,eAAe;EACf,aAAa;EACd;CACD,aAAa;EACX,SAAS;EACT,WAAW;EACX,eAAe;EACf,aAAa;EACd;CACF;;AAQD,MAAa,sBAA8D;CACzE,aAAa,EAAE;CACf,WAAW,EAAE;CACd;;;ACrDD,MAAM,2BAAuE,oBAG3E;CACA,OAAO;CACP,QAAQ;CACR,OAAO;CACR,CAAC;AACF,IAAM,uBAAN,cAAmC,yBAAyB;AAE5D,sBAAsB,2BAA2B,qBAAqB"}
|
|
@@ -1,20 +1,18 @@
|
|
|
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-BaFaVQvj.js";
|
|
1
|
+
import { t as getStateWithDefaults } from "./get-default-state.js";
|
|
2
|
+
import { t as useEditorExtension } from "./use-editor-extension.js";
|
|
3
|
+
import { t as getSafeEditorView } from "./get-safe-editor-view.js";
|
|
4
|
+
import { n as assignStyles, t as useScrolling } from "./use-scrolling.js";
|
|
6
5
|
import { createComputed, createContext, createSignal, defineCustomElement, defineEmit, registerCustomElement, useAttribute, useEffect, useEventListener } from "@aria-ui/core";
|
|
7
6
|
import { defineDOMEventHandler, union } from "@prosekit/core";
|
|
8
7
|
import { useOverlayPositionerState } from "@aria-ui/overlay/elements";
|
|
9
8
|
import { usePresence } from "@aria-ui/presence";
|
|
10
|
-
import { isHTMLElement, once } from "@ocavue/utils";
|
|
9
|
+
import { getDocument, getId, isHTMLElement, once } from "@ocavue/utils";
|
|
11
10
|
import { overlayPositionerEvents as overlayPositionerEvents$1, overlayPositionerProps as overlayPositionerProps$1 } from "@aria-ui/overlay";
|
|
12
11
|
import { menuContentEvents, menuContentProps, menuRootEvents, menuRootProps, useMenuContent, useMenuItem, useMenuRoot, useMenuTrigger } from "@aria-ui/menu/elements";
|
|
13
12
|
import { moveTableColumn, moveTableRow, selectTableColumn, selectTableRow } from "@prosekit/extensions/table";
|
|
14
13
|
import { computePosition, offset } from "@floating-ui/dom";
|
|
15
14
|
import { menuItemEvents, menuItemProps } from "@aria-ui/menu";
|
|
16
15
|
import { TableMap, cellAround } from "prosemirror-tables";
|
|
17
|
-
|
|
18
16
|
//#region src/components/table-handle/context.ts
|
|
19
17
|
/**
|
|
20
18
|
* @internal
|
|
@@ -37,7 +35,6 @@ const defaultTableHandleDndContext = {
|
|
|
37
35
|
* @internal
|
|
38
36
|
*/
|
|
39
37
|
const tableHandleDndContext = createContext("prosekit-table-handle-dnd-context", defaultTableHandleDndContext);
|
|
40
|
-
|
|
41
38
|
//#endregion
|
|
42
39
|
//#region src/components/table-handle/table-handle-column-root/setup.ts
|
|
43
40
|
/**
|
|
@@ -69,7 +66,6 @@ function useTableHandleColumnRoot(host, { state }) {
|
|
|
69
66
|
emit: () => void 0
|
|
70
67
|
});
|
|
71
68
|
}
|
|
72
|
-
|
|
73
69
|
//#endregion
|
|
74
70
|
//#region src/components/table-handle/table-handle-column-root/types.ts
|
|
75
71
|
/** @internal */
|
|
@@ -84,7 +80,6 @@ const tableHandleColumnRootProps = Object.freeze({
|
|
|
84
80
|
});
|
|
85
81
|
/** @internal */
|
|
86
82
|
const tableHandleColumnRootEvents = overlayPositionerEvents$1;
|
|
87
|
-
|
|
88
83
|
//#endregion
|
|
89
84
|
//#region src/components/table-handle/table-handle-column-root/element.gen.ts
|
|
90
85
|
const TableHandleColumnRootElementBase = defineCustomElement({
|
|
@@ -94,7 +89,6 @@ const TableHandleColumnRootElementBase = defineCustomElement({
|
|
|
94
89
|
});
|
|
95
90
|
var TableHandleColumnRootElement = class extends TableHandleColumnRootElementBase {};
|
|
96
91
|
registerCustomElement("prosekit-table-handle-column-root", TableHandleColumnRootElement);
|
|
97
|
-
|
|
98
92
|
//#endregion
|
|
99
93
|
//#region src/components/table-handle/hooks/use-empty-image.ts
|
|
100
94
|
/**
|
|
@@ -119,7 +113,6 @@ function useEmptyImage(host) {
|
|
|
119
113
|
});
|
|
120
114
|
return () => image;
|
|
121
115
|
}
|
|
122
|
-
|
|
123
116
|
//#endregion
|
|
124
117
|
//#region src/components/table-handle/table-handle-column-trigger/setup.ts
|
|
125
118
|
/**
|
|
@@ -164,14 +157,12 @@ function useTableHandleColumnTrigger(host, { state }) {
|
|
|
164
157
|
});
|
|
165
158
|
});
|
|
166
159
|
}
|
|
167
|
-
|
|
168
160
|
//#endregion
|
|
169
161
|
//#region src/components/table-handle/table-handle-column-trigger/types.ts
|
|
170
162
|
/** @internal */
|
|
171
163
|
const tableHandleColumnTriggerProps = { editor: { default: null } };
|
|
172
164
|
/** @internal */
|
|
173
165
|
const tableHandleColumnTriggerEvents = {};
|
|
174
|
-
|
|
175
166
|
//#endregion
|
|
176
167
|
//#region src/components/table-handle/table-handle-column-trigger/element.gen.ts
|
|
177
168
|
const TableHandleColumnTriggerElementBase = defineCustomElement({
|
|
@@ -181,7 +172,6 @@ const TableHandleColumnTriggerElementBase = defineCustomElement({
|
|
|
181
172
|
});
|
|
182
173
|
var TableHandleColumnTriggerElement = class extends TableHandleColumnTriggerElementBase {};
|
|
183
174
|
registerCustomElement("prosekit-table-handle-column-trigger", TableHandleColumnTriggerElement);
|
|
184
|
-
|
|
185
175
|
//#endregion
|
|
186
176
|
//#region src/components/table-handle/dnd.ts
|
|
187
177
|
function useInitDndPosition(host, editor, onInit) {
|
|
@@ -255,7 +245,68 @@ function getDndRelatedDOMs(view, cellPos, draggingIndex, direction) {
|
|
|
255
245
|
cell
|
|
256
246
|
};
|
|
257
247
|
}
|
|
258
|
-
|
|
248
|
+
//#endregion
|
|
249
|
+
//#region src/utils/clone-element.ts
|
|
250
|
+
/**
|
|
251
|
+
* Creates a deep clone of an Element, including all computed styles so that
|
|
252
|
+
* it looks almost exactly the same as the original element.
|
|
253
|
+
*/
|
|
254
|
+
function deepCloneElement(element, important = false) {
|
|
255
|
+
const clonedElement = element.cloneNode(true);
|
|
256
|
+
return [clonedElement, deepCopyStyles(element, clonedElement, important)];
|
|
257
|
+
}
|
|
258
|
+
/**
|
|
259
|
+
* Creates a clone of an Element, including all computed styles so that
|
|
260
|
+
* it looks similar enough to the original element.
|
|
261
|
+
*/
|
|
262
|
+
function cloneElement(element, important = false) {
|
|
263
|
+
const clonedElement = element.cloneNode();
|
|
264
|
+
return [clonedElement, copyStyles(element, clonedElement, important)];
|
|
265
|
+
}
|
|
266
|
+
function deepCopyStyles(source, target, important) {
|
|
267
|
+
const sources = [source];
|
|
268
|
+
const targets = [target];
|
|
269
|
+
const styles = [];
|
|
270
|
+
while (sources.length > 0 && sources.length === targets.length) {
|
|
271
|
+
const source = sources.pop();
|
|
272
|
+
const target = targets.pop();
|
|
273
|
+
if (!source || !target) break;
|
|
274
|
+
const style = copyStyles(source, target, important);
|
|
275
|
+
if (style) styles.push(style);
|
|
276
|
+
sources.push(...source.children);
|
|
277
|
+
targets.push(...target.children);
|
|
278
|
+
}
|
|
279
|
+
return styles.join("\n");
|
|
280
|
+
}
|
|
281
|
+
function copyStyles(source, target, important) {
|
|
282
|
+
if (!source || !target) return "";
|
|
283
|
+
const view = source.ownerDocument?.defaultView;
|
|
284
|
+
if (!view) return "";
|
|
285
|
+
const sourceStyle = view.getComputedStyle(source);
|
|
286
|
+
const targetStyle = target.style;
|
|
287
|
+
if (!sourceStyle || !targetStyle) return "";
|
|
288
|
+
for (const key of sourceStyle) targetStyle.setProperty(key, sourceStyle.getPropertyValue(key), important ? "important" : sourceStyle.getPropertyPriority(key) || "");
|
|
289
|
+
const styles = [];
|
|
290
|
+
for (const pseudoSelector of [":before", ":after"]) {
|
|
291
|
+
const sourcePseudoStyle = view.getComputedStyle(source, pseudoSelector);
|
|
292
|
+
const targetPseudoStyle = view.getComputedStyle(target, pseudoSelector);
|
|
293
|
+
if (!sourcePseudoStyle) continue;
|
|
294
|
+
const content = sourcePseudoStyle.getPropertyValue("content");
|
|
295
|
+
if (!(content && content !== "none" && content !== "normal")) continue;
|
|
296
|
+
const cssProps = [];
|
|
297
|
+
for (const property of sourcePseudoStyle) {
|
|
298
|
+
const sourceValue = sourcePseudoStyle.getPropertyValue(property);
|
|
299
|
+
const sourcePriority = sourcePseudoStyle.getPropertyPriority(property);
|
|
300
|
+
const targetValue = targetPseudoStyle.getPropertyValue(property);
|
|
301
|
+
const targetPriority = targetPseudoStyle.getPropertyPriority(property);
|
|
302
|
+
if (sourceValue !== targetValue || sourcePriority !== targetPriority) cssProps.push(`${property}: ${sourceValue}${sourcePriority ? " !important" : ""};`);
|
|
303
|
+
}
|
|
304
|
+
const uniqueClassName = `clone-pseudo-element-${getId()}`;
|
|
305
|
+
target.classList.add(uniqueClassName);
|
|
306
|
+
styles.push(`.${uniqueClassName}${pseudoSelector} { ${cssProps.join(" ")} }`);
|
|
307
|
+
}
|
|
308
|
+
return styles.join("\n");
|
|
309
|
+
}
|
|
259
310
|
//#endregion
|
|
260
311
|
//#region src/utils/css-feature-detection.ts
|
|
261
312
|
const isColorMixSupported = once(() => {
|
|
@@ -265,7 +316,6 @@ const isColorMixSupported = once(() => {
|
|
|
265
316
|
return false;
|
|
266
317
|
}
|
|
267
318
|
});
|
|
268
|
-
|
|
269
319
|
//#endregion
|
|
270
320
|
//#region src/utils/fade-color.ts
|
|
271
321
|
/**
|
|
@@ -280,7 +330,6 @@ function fadeColor(color, opacity) {
|
|
|
280
330
|
return `color-mix(in srgb, ${color} ${opacity * 100}%, transparent ${transparentWeight}%)`;
|
|
281
331
|
}
|
|
282
332
|
}
|
|
283
|
-
|
|
284
333
|
//#endregion
|
|
285
334
|
//#region src/utils/get-effective-background-color.ts
|
|
286
335
|
function getEffectiveBackgroundColor(element) {
|
|
@@ -291,7 +340,14 @@ function getEffectiveBackgroundColor(element) {
|
|
|
291
340
|
current = current.parentElement;
|
|
292
341
|
}
|
|
293
342
|
}
|
|
294
|
-
|
|
343
|
+
//#endregion
|
|
344
|
+
//#region src/utils/inject-style.ts
|
|
345
|
+
function injectStyle(container, styleText) {
|
|
346
|
+
if (!styleText) return;
|
|
347
|
+
const style = getDocument(container).createElement("style");
|
|
348
|
+
style.textContent = styleText;
|
|
349
|
+
container.appendChild(style);
|
|
350
|
+
}
|
|
295
351
|
//#endregion
|
|
296
352
|
//#region src/components/table-handle/table-handle-drag-preview/render-preview.ts
|
|
297
353
|
function clearPreviewDOM(previewRoot) {
|
|
@@ -342,7 +398,6 @@ function unsetSize(element) {
|
|
|
342
398
|
maxHeight: "unset"
|
|
343
399
|
});
|
|
344
400
|
}
|
|
345
|
-
|
|
346
401
|
//#endregion
|
|
347
402
|
//#region src/components/table-handle/table-handle-drag-preview/updater.ts
|
|
348
403
|
function useUpdatePreviewPosition(host, editor) {
|
|
@@ -402,7 +457,6 @@ function getVirtualElement(cell, x, y) {
|
|
|
402
457
|
}
|
|
403
458
|
};
|
|
404
459
|
}
|
|
405
|
-
|
|
406
460
|
//#endregion
|
|
407
461
|
//#region src/components/table-handle/table-handle-drag-preview/setup.ts
|
|
408
462
|
/**
|
|
@@ -437,12 +491,10 @@ function onInitPreviewPosition({ host, direction, dragging, table, cell, draggin
|
|
|
437
491
|
height: `${cellRect.height}px`
|
|
438
492
|
});
|
|
439
493
|
}
|
|
440
|
-
|
|
441
494
|
//#endregion
|
|
442
495
|
//#region src/components/table-handle/table-handle-drag-preview/types.ts
|
|
443
496
|
const tableHandleDragPreviewProps = { editor: { default: null } };
|
|
444
497
|
const tableHandleDragPreviewEvents = {};
|
|
445
|
-
|
|
446
498
|
//#endregion
|
|
447
499
|
//#region src/components/table-handle/table-handle-drag-preview/element.gen.ts
|
|
448
500
|
const TableHandleDragPreviewElementBase = defineCustomElement({
|
|
@@ -452,7 +504,6 @@ const TableHandleDragPreviewElementBase = defineCustomElement({
|
|
|
452
504
|
});
|
|
453
505
|
var TableHandleDragPreviewElement = class extends TableHandleDragPreviewElementBase {};
|
|
454
506
|
registerCustomElement("prosekit-table-handle-drag-preview", TableHandleDragPreviewElement);
|
|
455
|
-
|
|
456
507
|
//#endregion
|
|
457
508
|
//#region src/components/table-handle/table-handle-drop-indicator/calc-drag-over.ts
|
|
458
509
|
function findDragOverElement(elements, pointer, axis) {
|
|
@@ -478,7 +529,6 @@ function getDragOverColumn(table, pointerX) {
|
|
|
478
529
|
function getDragOverRow(table, pointerY) {
|
|
479
530
|
return findDragOverElement(Array.from(table.querySelectorAll("tr")), pointerY, "y");
|
|
480
531
|
}
|
|
481
|
-
|
|
482
532
|
//#endregion
|
|
483
533
|
//#region src/components/table-handle/table-handle-drop-indicator/updater.ts
|
|
484
534
|
function useUpdateIndicatorPosition(host, editor, handleWidth) {
|
|
@@ -553,7 +603,6 @@ function useUpdateIndicatorPosition(host, editor, handleWidth) {
|
|
|
553
603
|
}
|
|
554
604
|
});
|
|
555
605
|
}
|
|
556
|
-
|
|
557
606
|
//#endregion
|
|
558
607
|
//#region src/components/table-handle/table-handle-drop-indicator/setup.ts
|
|
559
608
|
const HANDLE_WIDTH = 2;
|
|
@@ -583,12 +632,10 @@ function onInitIndicatorPosition({ host, direction, dragging, table }) {
|
|
|
583
632
|
height: `${HANDLE_WIDTH}px`
|
|
584
633
|
});
|
|
585
634
|
}
|
|
586
|
-
|
|
587
635
|
//#endregion
|
|
588
636
|
//#region src/components/table-handle/table-handle-drop-indicator/types.ts
|
|
589
637
|
const tableHandleDropIndicatorProps = { editor: { default: null } };
|
|
590
638
|
const tableHandleDropIndicatorEvents = {};
|
|
591
|
-
|
|
592
639
|
//#endregion
|
|
593
640
|
//#region src/components/table-handle/table-handle-drop-indicator/element.gen.ts
|
|
594
641
|
const TableHandleDropIndicatorElementBase = defineCustomElement({
|
|
@@ -598,7 +645,6 @@ const TableHandleDropIndicatorElementBase = defineCustomElement({
|
|
|
598
645
|
});
|
|
599
646
|
var TableHandleDropIndicatorElement = class extends TableHandleDropIndicatorElementBase {};
|
|
600
647
|
registerCustomElement("prosekit-table-handle-drop-indicator", TableHandleDropIndicatorElement);
|
|
601
|
-
|
|
602
648
|
//#endregion
|
|
603
649
|
//#region src/components/table-handle/table-handle-popover-content/setup.ts
|
|
604
650
|
/**
|
|
@@ -640,7 +686,6 @@ function useKeyDownTarget(element, open) {
|
|
|
640
686
|
}
|
|
641
687
|
};
|
|
642
688
|
}
|
|
643
|
-
|
|
644
689
|
//#endregion
|
|
645
690
|
//#region src/components/table-handle/table-handle-popover-content/types.ts
|
|
646
691
|
/** @internal */
|
|
@@ -655,7 +700,6 @@ const tableHandlePopoverContentProps = Object.freeze({
|
|
|
655
700
|
});
|
|
656
701
|
/** @internal */
|
|
657
702
|
const tableHandlePopoverContentEvents = Object.freeze({ ...menuContentEvents });
|
|
658
|
-
|
|
659
703
|
//#endregion
|
|
660
704
|
//#region src/components/table-handle/table-handle-popover-content/element.gen.ts
|
|
661
705
|
const TableHandlePopoverContentElementBase = defineCustomElement({
|
|
@@ -665,7 +709,6 @@ const TableHandlePopoverContentElementBase = defineCustomElement({
|
|
|
665
709
|
});
|
|
666
710
|
var TableHandlePopoverContentElement = class extends TableHandlePopoverContentElementBase {};
|
|
667
711
|
registerCustomElement("prosekit-table-handle-popover-content", TableHandlePopoverContentElement);
|
|
668
|
-
|
|
669
712
|
//#endregion
|
|
670
713
|
//#region src/components/table-handle/table-handle-popover-item/setup.ts
|
|
671
714
|
/**
|
|
@@ -677,14 +720,12 @@ function useTableHandlePopoverItem(element, { state, emit }) {
|
|
|
677
720
|
emit
|
|
678
721
|
});
|
|
679
722
|
}
|
|
680
|
-
|
|
681
723
|
//#endregion
|
|
682
724
|
//#region src/components/table-handle/table-handle-popover-item/types.ts
|
|
683
725
|
/** @internal */
|
|
684
726
|
const tableHandlePopoverItemProps = { ...menuItemProps };
|
|
685
727
|
/** @internal */
|
|
686
728
|
const tableHandlePopoverItemEvents = { ...menuItemEvents };
|
|
687
|
-
|
|
688
729
|
//#endregion
|
|
689
730
|
//#region src/components/table-handle/table-handle-popover-item/element.gen.ts
|
|
690
731
|
const TableHandlePopoverItemElementBase = defineCustomElement({
|
|
@@ -694,7 +735,6 @@ const TableHandlePopoverItemElementBase = defineCustomElement({
|
|
|
694
735
|
});
|
|
695
736
|
var TableHandlePopoverItemElement = class extends TableHandlePopoverItemElementBase {};
|
|
696
737
|
registerCustomElement("prosekit-table-handle-popover-item", TableHandlePopoverItemElement);
|
|
697
|
-
|
|
698
738
|
//#endregion
|
|
699
739
|
//#region src/hooks/use-editor-typing.ts
|
|
700
740
|
function useEditorTyping(host, editor) {
|
|
@@ -708,7 +748,6 @@ function useEditorTyping(host, editor) {
|
|
|
708
748
|
useEditorExtension(host, editor, union(defineDOMEventHandler("keypress", handleKeypress), defineDOMEventHandler("pointermove", handlePointerMove)));
|
|
709
749
|
return typing;
|
|
710
750
|
}
|
|
711
|
-
|
|
712
751
|
//#endregion
|
|
713
752
|
//#region src/hooks/use-selecting.ts
|
|
714
753
|
/**
|
|
@@ -745,7 +784,6 @@ function useSelecting(host, editor, enabled) {
|
|
|
745
784
|
});
|
|
746
785
|
return selecting;
|
|
747
786
|
}
|
|
748
|
-
|
|
749
787
|
//#endregion
|
|
750
788
|
//#region src/components/table-handle/hooks/use-drop.ts
|
|
751
789
|
function useDrop(host, editor, dndContext) {
|
|
@@ -811,7 +849,6 @@ function useDrop(host, editor, dndContext) {
|
|
|
811
849
|
};
|
|
812
850
|
});
|
|
813
851
|
}
|
|
814
|
-
|
|
815
852
|
//#endregion
|
|
816
853
|
//#region src/components/table-handle/utils.ts
|
|
817
854
|
function isHoveringCellInfoEqual(a, b) {
|
|
@@ -859,7 +896,6 @@ function getCellPos(map, tableStart, rowIndex, colIndex) {
|
|
|
859
896
|
function getCellIndex(map, rowIndex, colIndex) {
|
|
860
897
|
return map.width * rowIndex + colIndex;
|
|
861
898
|
}
|
|
862
|
-
|
|
863
899
|
//#endregion
|
|
864
900
|
//#region src/components/table-handle/table-handle-root/setup.ts
|
|
865
901
|
/**
|
|
@@ -896,14 +932,12 @@ function defineCellHoverHandler(handler) {
|
|
|
896
932
|
};
|
|
897
933
|
return defineDOMEventHandler("pointerover", pointerHandler);
|
|
898
934
|
}
|
|
899
|
-
|
|
900
935
|
//#endregion
|
|
901
936
|
//#region src/components/table-handle/table-handle-root/types.ts
|
|
902
937
|
/** @internal */
|
|
903
938
|
const tableHandleRootProps = { editor: { default: null } };
|
|
904
939
|
/** @internal */
|
|
905
940
|
const tableHandleRootEvents = {};
|
|
906
|
-
|
|
907
941
|
//#endregion
|
|
908
942
|
//#region src/components/table-handle/table-handle-root/element.gen.ts
|
|
909
943
|
const TableHandleRootElementBase = defineCustomElement({
|
|
@@ -913,7 +947,6 @@ const TableHandleRootElementBase = defineCustomElement({
|
|
|
913
947
|
});
|
|
914
948
|
var TableHandleRootElement = class extends TableHandleRootElementBase {};
|
|
915
949
|
registerCustomElement("prosekit-table-handle-root", TableHandleRootElement);
|
|
916
|
-
|
|
917
950
|
//#endregion
|
|
918
951
|
//#region src/components/table-handle/table-handle-row-root/setup.ts
|
|
919
952
|
/**
|
|
@@ -945,7 +978,6 @@ function useTableHandleRowRoot(host, { state }) {
|
|
|
945
978
|
emit: defineEmit(host, menuRootEvents)
|
|
946
979
|
});
|
|
947
980
|
}
|
|
948
|
-
|
|
949
981
|
//#endregion
|
|
950
982
|
//#region src/components/table-handle/table-handle-row-root/types.ts
|
|
951
983
|
/** @internal */
|
|
@@ -960,7 +992,6 @@ const tableHandleRowRootProps = {
|
|
|
960
992
|
};
|
|
961
993
|
/** @internal */
|
|
962
994
|
const tableHandleRowRootEvents = {};
|
|
963
|
-
|
|
964
995
|
//#endregion
|
|
965
996
|
//#region src/components/table-handle/table-handle-row-root/element.gen.ts
|
|
966
997
|
const TableHandleRowRootElementBase = defineCustomElement({
|
|
@@ -970,7 +1001,6 @@ const TableHandleRowRootElementBase = defineCustomElement({
|
|
|
970
1001
|
});
|
|
971
1002
|
var TableHandleRowRootElement = class extends TableHandleRowRootElementBase {};
|
|
972
1003
|
registerCustomElement("prosekit-table-handle-row-root", TableHandleRowRootElement);
|
|
973
|
-
|
|
974
1004
|
//#endregion
|
|
975
1005
|
//#region src/components/table-handle/table-handle-row-trigger/setup.ts
|
|
976
1006
|
/**
|
|
@@ -1014,14 +1044,12 @@ function useTableHandleRowTrigger(host, { state }) {
|
|
|
1014
1044
|
});
|
|
1015
1045
|
});
|
|
1016
1046
|
}
|
|
1017
|
-
|
|
1018
1047
|
//#endregion
|
|
1019
1048
|
//#region src/components/table-handle/table-handle-row-trigger/types.ts
|
|
1020
1049
|
/** @internal */
|
|
1021
1050
|
const tableHandleRowTriggerProps = { editor: { default: null } };
|
|
1022
1051
|
/** @internal */
|
|
1023
1052
|
const tableHandleRowTriggerEvents = { select: {} };
|
|
1024
|
-
|
|
1025
1053
|
//#endregion
|
|
1026
1054
|
//#region src/components/table-handle/table-handle-row-trigger/element.gen.ts
|
|
1027
1055
|
const TableHandleRowTriggerElementBase = defineCustomElement({
|
|
@@ -1031,7 +1059,7 @@ const TableHandleRowTriggerElementBase = defineCustomElement({
|
|
|
1031
1059
|
});
|
|
1032
1060
|
var TableHandleRowTriggerElement = class extends TableHandleRowTriggerElementBase {};
|
|
1033
1061
|
registerCustomElement("prosekit-table-handle-row-trigger", TableHandleRowTriggerElement);
|
|
1034
|
-
|
|
1035
1062
|
//#endregion
|
|
1036
1063
|
export { TableHandleColumnRootElement, TableHandleColumnTriggerElement, TableHandleDragPreviewElement, TableHandleDropIndicatorElement, TableHandlePopoverContentElement, TableHandlePopoverItemElement, TableHandleRootElement, TableHandleRowRootElement, TableHandleRowTriggerElement, tableHandleColumnRootEvents, tableHandleColumnRootProps, tableHandleColumnTriggerEvents, tableHandleColumnTriggerProps, tableHandleDragPreviewEvents, tableHandleDragPreviewProps, tableHandleDropIndicatorEvents, tableHandleDropIndicatorProps, tableHandlePopoverContentEvents, tableHandlePopoverContentProps, tableHandlePopoverItemEvents, tableHandlePopoverItemProps, tableHandleRootEvents, tableHandleRootProps, tableHandleRowRootEvents, tableHandleRowRootProps, tableHandleRowTriggerEvents, tableHandleRowTriggerProps, useTableHandleColumnRoot, useTableHandleColumnTrigger, useTableHandleDragPreview, useTableHandleDropIndicator, useTableHandlePopoverContent, useTableHandlePopoverItem, useTableHandleRoot, useTableHandleRowRoot, useTableHandleRowTrigger };
|
|
1064
|
+
|
|
1037
1065
|
//# sourceMappingURL=prosekit-web-table-handle.js.map
|