@prosekit/web 0.8.0 → 0.8.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/dist/autocomplete.d.ts +10 -15
  2. package/dist/autocomplete.d.ts.map +1 -1
  3. package/dist/autocomplete.js +16 -9
  4. package/dist/autocomplete.js.map +1 -1
  5. package/dist/block-handle.d.ts +0 -12
  6. package/dist/block-handle.d.ts.map +1 -1
  7. package/dist/block-handle.js +0 -3
  8. package/dist/block-handle.js.map +1 -1
  9. package/dist/drop-indicator.d.ts.map +1 -1
  10. package/dist/drop-indicator.js.map +1 -1
  11. package/dist/get-safe-editor-view.js.map +1 -1
  12. package/dist/index.d.ts.map +1 -1
  13. package/dist/index.js.map +1 -1
  14. package/dist/inline-popover.d.ts +0 -12
  15. package/dist/inline-popover.d.ts.map +1 -1
  16. package/dist/inline-popover.js.map +1 -1
  17. package/dist/menu.d.ts.map +1 -1
  18. package/dist/menu.js.map +1 -1
  19. package/dist/popover.d.ts.map +1 -1
  20. package/dist/popover.js.map +1 -1
  21. package/dist/resizable.d.ts +0 -15
  22. package/dist/resizable.d.ts.map +1 -1
  23. package/dist/resizable.js +0 -6
  24. package/dist/resizable.js.map +1 -1
  25. package/dist/table-handle.d.ts.map +1 -1
  26. package/dist/table-handle.js.map +1 -1
  27. package/dist/tooltip.d.ts.map +1 -1
  28. package/dist/tooltip.js.map +1 -1
  29. package/dist/use-editor-extension.js.map +1 -1
  30. package/dist/use-editor-update-event.js.map +1 -1
  31. package/dist/use-scrolling.js.map +1 -1
  32. package/package.json +11 -11
  33. package/src/components/autocomplete/autocomplete-popup.ts +0 -6
  34. package/src/components/autocomplete/autocomplete-positioner.ts +1 -4
  35. package/src/components/autocomplete/autocomplete-root.ts +33 -16
  36. package/src/components/block-handle/block-handle-popup.ts +0 -3
  37. package/src/components/block-handle/block-handle-positioner.ts +0 -3
  38. package/src/components/block-handle/block-handle-root.ts +0 -6
  39. package/src/components/inline-popover/inline-popover-popup.ts +0 -3
  40. package/src/components/inline-popover/inline-popover-positioner.ts +0 -3
  41. package/src/components/inline-popover/inline-popover-root.ts +0 -6
  42. package/src/components/resizable/resizable-handle.ts +0 -3
  43. package/src/components/resizable/resizable-root.ts +0 -12
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../src/queue-extension.ts"],"mappings":";;AA2EA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAAgB,cAAA,CAAe,MAAA,EAAQ,MAAA,EAAQ,SAAA,EAAW,SAAA,GAAY,YAAA"}
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../src/queue-extension.ts"],"mappings":";;AA2EA;;;;;;;;;;;;;;AAAkF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAAlE,cAAA,CAAe,MAAA,EAAQ,MAAA,EAAQ,SAAA,EAAW,SAAA,GAAY,YAAA"}
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../src/queue-extension.ts"],"sourcesContent":["import type { Editor, Extension } from '@prosekit/core'\n\n/**\n\n @internal\n\n Queues an extension to be added to the editor in the next task. Returns a\n dispose function that can be used to remove the extension in the next task.\n\n Why?\n\n Let's take React as an example.\n\n `editor.use(extension)` is synchronous. If the extension adds a node view that\n is controlled by `@prosemirror-adapter/react`, adding this extension will\n cause `prosemirror-adapter` to set UI state synchronously (e.g. `setState`\n returned by `useState` in React).\n\n ProseMirror is a sync-based framework. When updating node view, ProseMirror\n will first stop DOMObserver, then update the DOM, then resume DOMObserver.\n `prosemirror-adapter` needs to call `React.flushSync()` to update the DOM\n synchronously right after React state is updated, before ProseMirror resumes\n DOMObserver.\n\n If we call `editor.use(extension)` directly in `useEffect`, we eventually are\n doing something like this:\n\n ```ts\n React.useEffect(() => {\n React.flushSync(() => {\n setState(newState)\n })\n }, [])\n ```\n\n This breaks the async nature of React, and causes the following React\n warning:\n\n ```\n flushSync was called from inside a lifecycle method. React cannot flush when\n React is already rendering. Consider moving this call to a scheduler task or\n micro task.\n ```\n\n To fix this, we need to queue the extension addition to the editor in the next\n task or in the next microtask.\n\n ```ts\n // In the next microtask\n React.useEffect(() => {\n queueMicrotask(() => {\n React.flushSync(() => {\n setState(newState)\n })\n })\n }, [])\n\n // In the next task\n React.useEffect(() => {\n setTimeout(() => {\n React.flushSync(() => {\n setState(newState)\n })\n })\n }, [])\n ```\n\n I chose to use `setTimeout` instead of `queueMicrotask` because\n `queueMicrotask` causes another React act warning `An update to %s inside a\n test was not wrapped in act(...)` during testing.\n\n Although the example above is based on React, this is a general pattern for\n any async based UI framework, including Svelte.\n\n */\nexport function queueExtension(editor: Editor, extension: Extension): VoidFunction {\n let canceled = false\n let dispose: VoidFunction | undefined\n const timeout = setTimeout(() => {\n if (canceled) return\n dispose?.()\n dispose = editor.use(extension)\n })\n\n return () => {\n canceled = true\n clearTimeout(timeout)\n setTimeout(() => {\n dispose?.()\n dispose = undefined\n })\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2EA,SAAgB,eAAe,QAAgB,WAAoC;CACjF,IAAI,WAAW;CACf,IAAI;CACJ,MAAM,UAAU,iBAAiB;AAC/B,MAAI,SAAU;AACd,aAAW;AACX,YAAU,OAAO,IAAI,UAAU;GAC/B;AAEF,cAAa;AACX,aAAW;AACX,eAAa,QAAQ;AACrB,mBAAiB;AACf,cAAW;AACX,aAAU,KAAA;IACV"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../src/queue-extension.ts"],"sourcesContent":["import type { Editor, Extension } from '@prosekit/core'\n\n/**\n\n @internal\n\n Queues an extension to be added to the editor in the next task. Returns a\n dispose function that can be used to remove the extension in the next task.\n\n Why?\n\n Let's take React as an example.\n\n `editor.use(extension)` is synchronous. If the extension adds a node view that\n is controlled by `@prosemirror-adapter/react`, adding this extension will\n cause `prosemirror-adapter` to set UI state synchronously (e.g. `setState`\n returned by `useState` in React).\n\n ProseMirror is a sync-based framework. When updating node view, ProseMirror\n will first stop DOMObserver, then update the DOM, then resume DOMObserver.\n `prosemirror-adapter` needs to call `React.flushSync()` to update the DOM\n synchronously right after React state is updated, before ProseMirror resumes\n DOMObserver.\n\n If we call `editor.use(extension)` directly in `useEffect`, we eventually are\n doing something like this:\n\n ```ts\n React.useEffect(() => {\n React.flushSync(() => {\n setState(newState)\n })\n }, [])\n ```\n\n This breaks the async nature of React, and causes the following React\n warning:\n\n ```\n flushSync was called from inside a lifecycle method. React cannot flush when\n React is already rendering. Consider moving this call to a scheduler task or\n micro task.\n ```\n\n To fix this, we need to queue the extension addition to the editor in the next\n task or in the next microtask.\n\n ```ts\n // In the next microtask\n React.useEffect(() => {\n queueMicrotask(() => {\n React.flushSync(() => {\n setState(newState)\n })\n })\n }, [])\n\n // In the next task\n React.useEffect(() => {\n setTimeout(() => {\n React.flushSync(() => {\n setState(newState)\n })\n })\n }, [])\n ```\n\n I chose to use `setTimeout` instead of `queueMicrotask` because\n `queueMicrotask` causes another React act warning `An update to %s inside a\n test was not wrapped in act(...)` during testing.\n\n Although the example above is based on React, this is a general pattern for\n any async based UI framework, including Svelte.\n\n */\nexport function queueExtension(editor: Editor, extension: Extension): VoidFunction {\n let canceled = false\n let dispose: VoidFunction | undefined\n const timeout = setTimeout(() => {\n if (canceled) return\n dispose?.()\n dispose = editor.use(extension)\n })\n\n return () => {\n canceled = true\n clearTimeout(timeout)\n setTimeout(() => {\n dispose?.()\n dispose = undefined\n })\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2EA,SAAgB,eAAe,QAAgB,WAAoC;CACjF,IAAI,WAAW;CACf,IAAI;CACJ,MAAM,UAAU,iBAAiB;EAC/B,IAAI,UAAU;EACd,UAAU;EACV,UAAU,OAAO,IAAI,SAAS;CAChC,CAAC;CAED,aAAa;EACX,WAAW;EACX,aAAa,OAAO;EACpB,iBAAiB;GACf,UAAU;GACV,UAAU,KAAA;EACZ,CAAC;CACH;AACF"}
@@ -1,9 +1,6 @@
1
1
  import { HostElement, HostElementConstructor, PropsDeclaration, State } from "@aria-ui/core";
2
2
  import { OpenChangeEvent, OpenChangeEvent as OpenChangeEvent$1, OverlayPopupProps, OverlayPositionerProps, OverlayRootProps } from "@aria-ui/elements/overlay";
3
3
  import { Editor } from "@prosekit/core";
4
- /**
5
- * @public
6
- */
7
4
  interface InlinePopoverPopupProps extends OverlayPopupProps {}
8
5
  /** @internal */
9
6
  declare const InlinePopoverPopupPropsDeclaration: PropsDeclaration<InlinePopoverPopupProps>;
@@ -24,9 +21,6 @@ declare const InlinePopoverPopupElementBase: HostElementConstructor<InlinePopove
24
21
  declare class InlinePopoverPopupElement extends InlinePopoverPopupElementBase {}
25
22
  /** @internal */
26
23
  declare function registerInlinePopoverPopupElement(): void;
27
- /**
28
- * @public
29
- */
30
24
  interface InlinePopoverPositionerProps extends Omit<OverlayPositionerProps, 'placement' | 'offset' | 'hide' | 'hoist' | 'overlap' | 'inline' | 'overflowPadding'> {
31
25
  /**
32
26
  * The initial placement of the floating element
@@ -102,9 +96,6 @@ declare const InlinePopoverPositionerElementBase: HostElementConstructor<InlineP
102
96
  declare class InlinePopoverPositionerElement extends InlinePopoverPositionerElementBase {}
103
97
  /** @internal */
104
98
  declare function registerInlinePopoverPositionerElement(): void;
105
- /**
106
- * @public
107
- */
108
99
  interface InlinePopoverRootProps extends OverlayRootProps {
109
100
  /**
110
101
  * The ProseKit editor instance.
@@ -130,9 +121,6 @@ interface InlinePopoverRootProps extends OverlayRootProps {
130
121
  }
131
122
  /** @internal */
132
123
  declare const InlinePopoverRootPropsDeclaration: PropsDeclaration<InlinePopoverRootProps>;
133
- /**
134
- * @public
135
- */
136
124
  interface InlinePopoverRootEvents {
137
125
  /**
138
126
  * Emitted when the open state of the popover changes.
@@ -1 +1 @@
1
- {"version":3,"file":"inline-popover.d.ts","names":[],"sources":["../src/components/inline-popover/inline-popover-popup.ts","../src/components/inline-popover/inline-popover-positioner.ts","../src/components/inline-popover/inline-popover-root.ts"],"mappings":";;;;;AAkBA;UAAiB,uBAAA,SAAgC,iBAAA;;cAGpC,kCAAA,EAAoC,gBAAA,CAAiB,uBAAA;AAAlE;AAAA,iBAGgB,uBAAA,CACd,IAAA,EAAM,WAAA,EACN,MAAA,EAAQ,KAAA,CAAM,uBAAA;AAAA,cAYV,6BAAA,EAA+B,sBAAA,CAAuB,uBAAA;;;AAd5D;;;;;;;;;cA8Ba,yBAAA,SAAkC,6BAAA;;iBAG/B,iCAAA,CAAA;;;AAvChB;UCFiB,4BAAA,SACf,IAAA,CACE,sBAAA;;;;ADGJ;;ECYE,SAAA,EAAW,sBAAA;EDZoC;;AAGjD;;;ECgBE,MAAA,EAAQ,sBAAA;EDdM;;;;;;ECsBd,IAAA,EAAM,sBAAA;EDtBQ;;;;AAUf;;ECoBC,KAAA;EDlBmC;;AAgBrC;;;;ECUE,OAAA,EAAS,sBAAA;EDPK;;;;;;ECed,MAAA,EAAQ,sBAAA;EAxDoC;;;;;EA+D5C,eAAA,EAAiB,sBAAA;AAAA;;cAIN,uCAAA,EAAyC,gBAAA,CAAiB,4BAAA;;iBAcvD,4BAAA,CACd,IAAA,EAAM,WAAA,EACN,KAAA,EAAO,KAAA,CAAM,4BAAA;AAAA,cAKT,kCAAA,EAAoC,sBAAA,CAAuB,4BAAA;;;;;;;;;;;;;;;;;;AArBjE;;cA6Ca,8BAAA,SAAuC,kCAAA;;iBAGpC,sCAAA,CAAA;ADjHhB;;;AAAA,UEMiB,sBAAA,SAA+B,gBAAA;EFNkB;AAGlE;;;;;EEUE,MAAA,EAAQ,MAAA;EFP6B;;;;;;EEerC,WAAA;EFdM;;;;;;EEsBN,eAAA;AAAA;;cAIW,iCAAA,EAAmC,gBAAA,CAAiB,sBAAA;;;AFGjE;UESiB,uBAAA;;;;EAIf,UAAA,EAAY,iBAAA;AAAA;;iBAIE,sBAAA,CACd,IAAA,EAAM,WAAA,EACN,KAAA,EAAO,KAAA,CAAM,sBAAA;AAAA,cAsCT,4BAAA,EAA8B,sBAAA,CAAuB,sBAAA;;AD/F3D;;;;;;cC2Ga,wBAAA,SAAiC,4BAAA;;iBAG9B,gCAAA,CAAA"}
1
+ {"version":3,"file":"inline-popover.d.ts","names":[],"sources":["../src/components/inline-popover/inline-popover-popup.ts","../src/components/inline-popover/inline-popover-positioner.ts","../src/components/inline-popover/inline-popover-root.ts"],"mappings":";;;UAeiB,uBAAA,SAAgC,iBAAiB;AAAlE;AAAA,cAGa,kCAAA,EAAoC,gBAAgB,CAAC,uBAAA;;iBAGlD,uBAAA,CACd,IAAA,EAAM,WAAA,EACN,MAAA,EAAQ,KAAA,CAAM,uBAAA;AAAA,cAYV,6BAAA,EAA+B,sBAAsB,CAAC,uBAAA;AAjB5D;;;;AAAyF;AAGzF;;;;;;AAHA,cAiCa,yBAAA,SAAkC,6BAA6B;;iBAG5D,iCAAA,CAAA;AAAA,UCzCC,4BAAA,SACf,IAAA,CACE,sBAAA;;ADAJ;;;;ECeE,SAAA,EAAW,sBAAA;EDZA;;;;AAA4E;ECmBvF,MAAA,EAAQ,sBAAA;EDhB6B;;;;;;ECwBrC,IAAA,EAAM,sBAAA;EDvBA;;;;;;EC+BN,KAAA;EDlBI;;;;AAA6E;AAgBnF;ECUE,OAAA,EAAS,sBAAA;;;ADViE;AAG5E;;;ECeE,MAAA,EAAQ,sBAAA;EDfuC;;ACzCjD;;;EA+DE,eAAA,EAAiB,sBAAA;AAAA;;cAIN,uCAAA,EAAyC,gBAAgB,CAAC,4BAAA;;iBAcvD,4BAAA,CACd,IAAA,EAAM,WAAA,EACN,KAAA,EAAO,KAAA,CAAM,4BAAA;AAAA,cAKT,kCAAA,EAAoC,sBAAsB,CAAC,4BAAA;;;;;;;;;;;;;;;;;;;;cAwBpD,8BAAA,SAAuC,kCAAkC;;iBAGtE,sCAAA,CAAA;AAAA,UC3GC,sBAAA,SAA+B,gBAAgB;EFNvB;;;AAAyB;AAGlE;;EEUE,MAAA,EAAQ,MAAA;EFVuC;AAAwC;AAGzF;;;;EEeE,WAAA;EFbQ;;;;;;EEqBR,eAAA;AAAA;;cAIW,iCAAA,EAAmC,gBAAgB,CAAC,sBAAA;AAAA,UAShD,uBAAA;EFnBhB;;;EEuBC,UAAA,EAAY,iBAAe;AAAA;;iBAIb,sBAAA,CACd,IAAA,EAAM,WAAA,EACN,KAAA,EAAO,KAAA,CAAM,sBAAA;AAAA,cAsCT,4BAAA,EAA8B,sBAAsB,CAAC,sBAAA;AFtDiB;AAG5E;;;;AAAiD;;AAH2B,cEkE/D,wBAAA,SAAiC,4BAA4B;;iBAG1D,gCAAA,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"inline-popover.js","names":[],"sources":["../src/components/inline-popover/store.ts","../src/components/inline-popover/inline-popover-popup.ts","../src/components/inline-popover/inline-popover-positioner.ts","../src/hooks/use-editor-focus-event.ts","../src/hooks/use-keymap.ts","../src/components/inline-popover/virtual-selection-element.ts","../src/components/inline-popover/inline-popover-root.ts"],"sourcesContent":["import { createContext, type Context } from '@aria-ui/core'\nimport type { OverlayStore } from '@aria-ui/elements/overlay'\n\nexport const InlinePopoverStoreContext: Context<OverlayStore> = createContext<OverlayStore>(\n 'prosekit-inline-popover-store',\n)\n","import {\n computed,\n defineCustomElement,\n onMount,\n registerCustomElement,\n type HostElement,\n type HostElementConstructor,\n type PropsDeclaration,\n type State,\n} from '@aria-ui/core'\nimport { OverlayPopupPropsDeclaration, setupOverlayPopup, type OverlayPopupProps } from '@aria-ui/elements/overlay'\nimport { usePresence } from '@aria-ui/utils'\n\nimport { InlinePopoverStoreContext } from './store.ts'\n\n/**\n * @public\n */\nexport interface InlinePopoverPopupProps extends OverlayPopupProps {}\n\n/** @internal */\nexport const InlinePopoverPopupPropsDeclaration: PropsDeclaration<InlinePopoverPopupProps> = OverlayPopupPropsDeclaration\n\n/** @internal */\nexport function setupInlinePopoverPopup(\n host: HostElement,\n _props: State<InlinePopoverPopupProps>,\n): void {\n const getStore = InlinePopoverStoreContext.consume(host)\n setupOverlayPopup(host, getStore)\n const getOpen = computed(() => getStore()?.getIsOpen() ?? false)\n usePresence(host, getOpen)\n\n onMount(host, () => {\n host.role = 'dialog'\n })\n}\n\nconst InlinePopoverPopupElementBase: HostElementConstructor<InlinePopoverPopupProps> = defineCustomElement(\n setupInlinePopoverPopup,\n InlinePopoverPopupPropsDeclaration,\n)\n\n/**\n * `<prosekit-inline-popover-popup>` custom element.\n *\n * Properties: {@link InlinePopoverPopupProps}\n *\n * Data attributes:\n *\n * | Attribute | Description |\n * | --- | --- |\n * | `data-state` | `\"open\"` when the inline popover is visible, `\"closed\"` otherwise |\n */\nexport class InlinePopoverPopupElement extends InlinePopoverPopupElementBase {}\n\n/** @internal */\nexport function registerInlinePopoverPopupElement(): void {\n registerCustomElement('prosekit-inline-popover-popup', InlinePopoverPopupElement)\n}\n","import {\n defineCustomElement,\n defineProps,\n registerCustomElement,\n type HostElement,\n type HostElementConstructor,\n type PropsDeclaration,\n type State,\n} from '@aria-ui/core'\nimport { OverlayPositionerPropsDeclaration, setupOverlayPositioner, type OverlayPositionerProps } from '@aria-ui/elements/overlay'\n\nimport { InlinePopoverStoreContext } from './store.ts'\n\n/**\n * @public\n */\nexport interface InlinePopoverPositionerProps extends\n Omit<\n OverlayPositionerProps,\n | 'placement'\n | 'offset'\n | 'hide'\n | 'hoist'\n | 'overlap'\n | 'inline'\n | 'overflowPadding'\n >\n{\n /**\n * The initial placement of the floating element\n *\n * @default \"top\"\n */\n placement: OverlayPositionerProps['placement']\n\n /**\n * The distance between the reference and floating element.\n *\n * @default 12\n */\n offset: OverlayPositionerProps['offset']\n\n /**\n * Whether to hide the floating element when the reference element or the\n * floating element is fully clipped.\n *\n * @default true\n */\n hide: OverlayPositionerProps['hide']\n\n /**\n * Whether to use the browser [Popover API](https://developer.mozilla.org/en-US/docs/Web/API/Popover_API)\n * to place the floating element on top of other page content.\n *\n * @default false\n */\n hoist: boolean\n\n /**\n * Whether the floating element can overlap the reference element to keep it\n * in view.\n *\n * @default true\n */\n overlap: OverlayPositionerProps['overlap']\n\n /**\n * Whether to improve positioning for inline reference elements that span over\n * multiple lines.\n *\n * @default true\n */\n inline: OverlayPositionerProps['inline']\n\n /**\n * Describes the virtual padding around the boundary to check for overflow.\n *\n * @default 8\n */\n overflowPadding: OverlayPositionerProps['overflowPadding']\n}\n\n/** @internal */\nexport const InlinePopoverPositionerPropsDeclaration: PropsDeclaration<InlinePopoverPositionerProps> = /* @__PURE__ */ defineProps<\n InlinePopoverPositionerProps\n>({\n ...OverlayPositionerPropsDeclaration,\n placement: { default: 'top', attribute: 'placement', type: 'string' },\n offset: { default: 12, attribute: false },\n hide: { default: true, attribute: 'hide', type: 'boolean' },\n hoist: { default: false, attribute: 'hoist', type: 'boolean' },\n overlap: { default: true, attribute: 'overlap', type: 'boolean' },\n inline: { default: true, attribute: 'inline', type: 'boolean' },\n overflowPadding: { default: 8, attribute: 'overflow-padding', type: 'number' },\n})\n\n/** @internal */\nexport function setupInlinePopoverPositioner(\n host: HostElement,\n props: State<InlinePopoverPositionerProps>,\n): void {\n setupOverlayPositioner(host, props, InlinePopoverStoreContext.consume(host))\n}\n\nconst InlinePopoverPositionerElementBase: HostElementConstructor<InlinePopoverPositionerProps> = defineCustomElement(\n setupInlinePopoverPositioner,\n InlinePopoverPositionerPropsDeclaration,\n)\n\n/**\n * `<prosekit-inline-popover-positioner>` custom element.\n *\n * Properties: {@link InlinePopoverPositionerProps}\n *\n * Data attributes:\n *\n * | Attribute | Description |\n * | --- | --- |\n * | `data-state` | `\"open\"` when the inline popover is visible, `\"closed\"` otherwise |\n * | `data-side` | The side of the anchor element the positioner is on |\n * | `data-align` | The alignment of the positioner relative to the anchor element |\n *\n * CSS variables:\n *\n * | Variable | Description |\n * | --- | --- |\n * | `--transform-origin` | The coordinates that this element is anchored to. Useful for scale animations. |\n */\nexport class InlinePopoverPositionerElement extends InlinePopoverPositionerElementBase {}\n\n/** @internal */\nexport function registerInlinePopoverPositionerElement(): void {\n registerCustomElement('prosekit-inline-popover-positioner', InlinePopoverPositionerElement)\n}\n","import type { HostElement } from '@aria-ui/core'\nimport { defineFocusChangeHandler, type Editor, type FocusChangeHandler } from '@prosekit/core'\n\nimport { useEditorExtension } from './use-editor-extension.ts'\n\n/**\n * @internal\n */\nexport function useEditorFocusChangeEvent(\n host: HostElement,\n getEditor: () => Editor | null,\n handler: FocusChangeHandler,\n): void {\n const extension = defineFocusChangeHandler(handler)\n useEditorExtension(host, getEditor, extension)\n}\n","import type { HostElement } from '@aria-ui/core'\nimport { defineKeymap, type Editor, type Keymap } from '@prosekit/core'\n\nimport { useEditorExtension } from './use-editor-extension.ts'\n\nexport function useKeymap(\n host: HostElement,\n getEditor: () => Editor | null,\n keymap: Keymap,\n): void {\n const extension = defineKeymap(keymap)\n useEditorExtension(host, getEditor, extension)\n}\n","import type { ReferenceElement } from '@floating-ui/dom'\nimport { containsInlineNode, isInCodeBlock, isTextSelection } from '@prosekit/core'\nimport type { EditorView } from '@prosekit/pm/view'\n\nexport function getVirtualSelectionElement(\n view: EditorView,\n): ReferenceElement | undefined {\n if (typeof window === 'undefined' || view.isDestroyed) {\n return\n }\n\n const selection = view.state.selection\n\n if (\n !selection.empty\n && !isInCodeBlock(selection)\n && isTextSelection(selection)\n && containsInlineNode(view.state.doc, selection.from, selection.to)\n ) {\n return getDomDecoration(view) || getInlineDecoration(view)\n }\n}\n\nfunction getDomDecoration(view: EditorView): ReferenceElement | undefined {\n const range = getDomRange(view)\n if (range) {\n // To get it work properly in Safari, we cannot return the range directly.\n // We have to return a contextElement.\n return {\n contextElement: view.dom,\n getBoundingClientRect: () => range.getBoundingClientRect(),\n getClientRects: () => range.getClientRects(),\n }\n }\n}\n\nfunction getDomRange(view: EditorView): Range | undefined {\n const win = view.dom.ownerDocument.defaultView\n const selection = win?.getSelection()\n if (!selection || selection.isCollapsed) {\n return\n }\n\n const range = typeof selection.rangeCount === 'number'\n && selection.rangeCount > 0\n && selection.getRangeAt(0)\n\n if (!range) {\n return\n }\n\n return range\n}\n\nfunction getInlineDecoration(view: EditorView): ReferenceElement | undefined {\n const match = view.dom.querySelectorAll('.prosekit-virtual-selection')\n\n if (match.length === 0) {\n return\n }\n if (match.length === 1) {\n return match[0]\n }\n\n const items = Array.from(match)\n return {\n contextElement: items[0],\n getBoundingClientRect: () => items[0].getBoundingClientRect(),\n getClientRects: () => items.map((item) => item.getBoundingClientRect()),\n }\n}\n","import {\n defineCustomElement,\n defineProps,\n registerCustomElement,\n type HostElement,\n type HostElementConstructor,\n type PropsDeclaration,\n type State,\n} from '@aria-ui/core'\nimport type { OpenChangeEvent } from '@aria-ui/elements/overlay'\nimport { OverlayRootPropsDeclaration, useOverlayStore, type OverlayRootProps } from '@aria-ui/elements/overlay'\nimport type { Editor } from '@prosekit/core'\nimport type { Selection } from '@prosekit/pm/state'\n\nimport { useEditorFocusChangeEvent } from '../../hooks/use-editor-focus-event.ts'\nimport { useEditorUpdateEvent } from '../../hooks/use-editor-update-event.ts'\nimport { useKeymap } from '../../hooks/use-keymap.ts'\n\nimport { InlinePopoverStoreContext } from './store.ts'\nimport { getVirtualSelectionElement } from './virtual-selection-element.ts'\n\n/**\n * @public\n */\nexport interface InlinePopoverRootProps extends OverlayRootProps {\n /**\n * The ProseKit editor instance.\n *\n * @default null\n * @hidden\n */\n editor: Editor | null\n\n /**\n * Whether the popover is open by default when some inline content is\n * selected.\n *\n * @default true\n */\n defaultOpen: boolean\n\n /**\n * Whether the inline popover should be dismissed when the editor receives an\n * Escape key press.\n *\n * @default true\n */\n dismissOnEscape: boolean\n}\n\n/** @internal */\nexport const InlinePopoverRootPropsDeclaration: PropsDeclaration<InlinePopoverRootProps> = /* @__PURE__ */ defineProps<\n InlinePopoverRootProps\n>({\n ...OverlayRootPropsDeclaration,\n editor: { default: null, attribute: false },\n defaultOpen: { default: true, attribute: 'default-open', type: 'boolean' },\n dismissOnEscape: { default: true, attribute: 'dismiss-on-escape', type: 'boolean' },\n})\n\n/**\n * @public\n */\nexport interface InlinePopoverRootEvents {\n /**\n * Emitted when the open state of the popover changes.\n */\n openChange: OpenChangeEvent\n}\n\n/** @internal */\nexport function setupInlinePopoverRoot(\n host: HostElement,\n props: State<InlinePopoverRootProps>,\n): void {\n const store = useOverlayStore(host, props)\n InlinePopoverStoreContext.provide(host, store)\n\n let editorFocused = false\n useEditorFocusChangeEvent(host, props.editor.get, (focus) => {\n editorFocused = focus\n })\n\n let prevSelection: Selection | undefined\n useEditorUpdateEvent(host, props.editor.get, (view) => {\n const isPopoverFocused = !editorFocused && host.contains(host.ownerDocument.activeElement)\n if (isPopoverFocused) return\n\n const { selection } = view.state\n if (prevSelection?.eq(selection)) return\n prevSelection = selection\n\n const reference = getVirtualSelectionElement(view)\n store.setAnchorElement(reference)\n\n if (reference && props.defaultOpen.get()) {\n store.requestOpenChange(true)\n } else if (!reference) {\n store.requestOpenChange(false)\n }\n })\n\n useKeymap(host, props.editor.get, {\n Escape: () => {\n if (!props.dismissOnEscape.get() || !store.getIsOpen()) return false\n store.requestOpenChange(false)\n return true\n },\n })\n}\n\nconst InlinePopoverRootElementBase: HostElementConstructor<InlinePopoverRootProps> = defineCustomElement(\n setupInlinePopoverRoot,\n InlinePopoverRootPropsDeclaration,\n)\n\n/**\n * `<prosekit-inline-popover-root>` custom element.\n *\n * Properties: {@link InlinePopoverRootProps}\n *\n * Events: {@link InlinePopoverRootEvents}\n */\nexport class InlinePopoverRootElement extends InlinePopoverRootElementBase {}\n\n/** @internal */\nexport function registerInlinePopoverRootElement(): void {\n registerCustomElement('prosekit-inline-popover-root', InlinePopoverRootElement)\n}\n"],"mappings":";;;;;;AAGA,MAAa,4BAAmD,cAC9D,gCACD;;ACg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,MAAM;AAC1C,2BAA0B,QAAQ,MAAM,MAAM;CAE9C,IAAI,gBAAgB;AACpB,2BAA0B,MAAM,MAAM,OAAO,MAAM,UAAU;AAC3D,kBAAgB;GAChB;CAEF,IAAI;AACJ,sBAAqB,MAAM,MAAM,OAAO,MAAM,SAAS;AAErD,MADyB,CAAC,iBAAiB,KAAK,SAAS,KAAK,cAAc,cAAc,CACpE;EAEtB,MAAM,EAAE,cAAc,KAAK;AAC3B,MAAI,eAAe,GAAG,UAAU,CAAE;AAClC,kBAAgB;EAEhB,MAAM,YAAY,2BAA2B,KAAK;AAClD,QAAM,iBAAiB,UAAU;AAEjC,MAAI,aAAa,MAAM,YAAY,KAAK,CACtC,OAAM,kBAAkB,KAAK;WACpB,CAAC,UACV,OAAM,kBAAkB,MAAM;GAEhC;AAEF,WAAU,MAAM,MAAM,OAAO,KAAK,EAChC,cAAc;AACZ,MAAI,CAAC,MAAM,gBAAgB,KAAK,IAAI,CAAC,MAAM,WAAW,CAAE,QAAO;AAC/D,QAAM,kBAAkB,MAAM;AAC9B,SAAO;IAEV,CAAC;;AAGJ,MAAM,+BAA+E,oBACnF,wBACA,kCACD;;;;;;;;AASD,IAAa,2BAAb,cAA8C,6BAA6B;;AAG3E,SAAgB,mCAAyC;AACvD,uBAAsB,gCAAgC,yBAAyB"}
1
+ {"version":3,"file":"inline-popover.js","names":[],"sources":["../src/components/inline-popover/store.ts","../src/components/inline-popover/inline-popover-popup.ts","../src/components/inline-popover/inline-popover-positioner.ts","../src/hooks/use-editor-focus-event.ts","../src/hooks/use-keymap.ts","../src/components/inline-popover/virtual-selection-element.ts","../src/components/inline-popover/inline-popover-root.ts"],"sourcesContent":["import { createContext, type Context } from '@aria-ui/core'\nimport type { OverlayStore } from '@aria-ui/elements/overlay'\n\nexport const InlinePopoverStoreContext: Context<OverlayStore> = createContext<OverlayStore>(\n 'prosekit-inline-popover-store',\n)\n","import {\n computed,\n defineCustomElement,\n onMount,\n registerCustomElement,\n type HostElement,\n type HostElementConstructor,\n type PropsDeclaration,\n type State,\n} from '@aria-ui/core'\nimport { OverlayPopupPropsDeclaration, setupOverlayPopup, type OverlayPopupProps } from '@aria-ui/elements/overlay'\nimport { usePresence } from '@aria-ui/utils'\n\nimport { InlinePopoverStoreContext } from './store.ts'\n\nexport interface InlinePopoverPopupProps extends OverlayPopupProps {}\n\n/** @internal */\nexport const InlinePopoverPopupPropsDeclaration: PropsDeclaration<InlinePopoverPopupProps> = OverlayPopupPropsDeclaration\n\n/** @internal */\nexport function setupInlinePopoverPopup(\n host: HostElement,\n _props: State<InlinePopoverPopupProps>,\n): void {\n const getStore = InlinePopoverStoreContext.consume(host)\n setupOverlayPopup(host, getStore)\n const getOpen = computed(() => getStore()?.getIsOpen() ?? false)\n usePresence(host, getOpen)\n\n onMount(host, () => {\n host.role = 'dialog'\n })\n}\n\nconst InlinePopoverPopupElementBase: HostElementConstructor<InlinePopoverPopupProps> = defineCustomElement(\n setupInlinePopoverPopup,\n InlinePopoverPopupPropsDeclaration,\n)\n\n/**\n * `<prosekit-inline-popover-popup>` custom element.\n *\n * Properties: {@link InlinePopoverPopupProps}\n *\n * Data attributes:\n *\n * | Attribute | Description |\n * | --- | --- |\n * | `data-state` | `\"open\"` when the inline popover is visible, `\"closed\"` otherwise |\n */\nexport class InlinePopoverPopupElement extends InlinePopoverPopupElementBase {}\n\n/** @internal */\nexport function registerInlinePopoverPopupElement(): void {\n registerCustomElement('prosekit-inline-popover-popup', InlinePopoverPopupElement)\n}\n","import {\n defineCustomElement,\n defineProps,\n registerCustomElement,\n type HostElement,\n type HostElementConstructor,\n type PropsDeclaration,\n type State,\n} from '@aria-ui/core'\nimport { OverlayPositionerPropsDeclaration, setupOverlayPositioner, type OverlayPositionerProps } from '@aria-ui/elements/overlay'\n\nimport { InlinePopoverStoreContext } from './store.ts'\n\nexport interface InlinePopoverPositionerProps extends\n Omit<\n OverlayPositionerProps,\n | 'placement'\n | 'offset'\n | 'hide'\n | 'hoist'\n | 'overlap'\n | 'inline'\n | 'overflowPadding'\n >\n{\n /**\n * The initial placement of the floating element\n *\n * @default \"top\"\n */\n placement: OverlayPositionerProps['placement']\n\n /**\n * The distance between the reference and floating element.\n *\n * @default 12\n */\n offset: OverlayPositionerProps['offset']\n\n /**\n * Whether to hide the floating element when the reference element or the\n * floating element is fully clipped.\n *\n * @default true\n */\n hide: OverlayPositionerProps['hide']\n\n /**\n * Whether to use the browser [Popover API](https://developer.mozilla.org/en-US/docs/Web/API/Popover_API)\n * to place the floating element on top of other page content.\n *\n * @default false\n */\n hoist: boolean\n\n /**\n * Whether the floating element can overlap the reference element to keep it\n * in view.\n *\n * @default true\n */\n overlap: OverlayPositionerProps['overlap']\n\n /**\n * Whether to improve positioning for inline reference elements that span over\n * multiple lines.\n *\n * @default true\n */\n inline: OverlayPositionerProps['inline']\n\n /**\n * Describes the virtual padding around the boundary to check for overflow.\n *\n * @default 8\n */\n overflowPadding: OverlayPositionerProps['overflowPadding']\n}\n\n/** @internal */\nexport const InlinePopoverPositionerPropsDeclaration: PropsDeclaration<InlinePopoverPositionerProps> = /* @__PURE__ */ defineProps<\n InlinePopoverPositionerProps\n>({\n ...OverlayPositionerPropsDeclaration,\n placement: { default: 'top', attribute: 'placement', type: 'string' },\n offset: { default: 12, attribute: false },\n hide: { default: true, attribute: 'hide', type: 'boolean' },\n hoist: { default: false, attribute: 'hoist', type: 'boolean' },\n overlap: { default: true, attribute: 'overlap', type: 'boolean' },\n inline: { default: true, attribute: 'inline', type: 'boolean' },\n overflowPadding: { default: 8, attribute: 'overflow-padding', type: 'number' },\n})\n\n/** @internal */\nexport function setupInlinePopoverPositioner(\n host: HostElement,\n props: State<InlinePopoverPositionerProps>,\n): void {\n setupOverlayPositioner(host, props, InlinePopoverStoreContext.consume(host))\n}\n\nconst InlinePopoverPositionerElementBase: HostElementConstructor<InlinePopoverPositionerProps> = defineCustomElement(\n setupInlinePopoverPositioner,\n InlinePopoverPositionerPropsDeclaration,\n)\n\n/**\n * `<prosekit-inline-popover-positioner>` custom element.\n *\n * Properties: {@link InlinePopoverPositionerProps}\n *\n * Data attributes:\n *\n * | Attribute | Description |\n * | --- | --- |\n * | `data-state` | `\"open\"` when the inline popover is visible, `\"closed\"` otherwise |\n * | `data-side` | The side of the anchor element the positioner is on |\n * | `data-align` | The alignment of the positioner relative to the anchor element |\n *\n * CSS variables:\n *\n * | Variable | Description |\n * | --- | --- |\n * | `--transform-origin` | The coordinates that this element is anchored to. Useful for scale animations. |\n */\nexport class InlinePopoverPositionerElement extends InlinePopoverPositionerElementBase {}\n\n/** @internal */\nexport function registerInlinePopoverPositionerElement(): void {\n registerCustomElement('prosekit-inline-popover-positioner', InlinePopoverPositionerElement)\n}\n","import type { HostElement } from '@aria-ui/core'\nimport { defineFocusChangeHandler, type Editor, type FocusChangeHandler } from '@prosekit/core'\n\nimport { useEditorExtension } from './use-editor-extension.ts'\n\n/**\n * @internal\n */\nexport function useEditorFocusChangeEvent(\n host: HostElement,\n getEditor: () => Editor | null,\n handler: FocusChangeHandler,\n): void {\n const extension = defineFocusChangeHandler(handler)\n useEditorExtension(host, getEditor, extension)\n}\n","import type { HostElement } from '@aria-ui/core'\nimport { defineKeymap, type Editor, type Keymap } from '@prosekit/core'\n\nimport { useEditorExtension } from './use-editor-extension.ts'\n\nexport function useKeymap(\n host: HostElement,\n getEditor: () => Editor | null,\n keymap: Keymap,\n): void {\n const extension = defineKeymap(keymap)\n useEditorExtension(host, getEditor, extension)\n}\n","import type { ReferenceElement } from '@floating-ui/dom'\nimport { containsInlineNode, isInCodeBlock, isTextSelection } from '@prosekit/core'\nimport type { EditorView } from '@prosekit/pm/view'\n\nexport function getVirtualSelectionElement(\n view: EditorView,\n): ReferenceElement | undefined {\n if (typeof window === 'undefined' || view.isDestroyed) {\n return\n }\n\n const selection = view.state.selection\n\n if (\n !selection.empty\n && !isInCodeBlock(selection)\n && isTextSelection(selection)\n && containsInlineNode(view.state.doc, selection.from, selection.to)\n ) {\n return getDomDecoration(view) || getInlineDecoration(view)\n }\n}\n\nfunction getDomDecoration(view: EditorView): ReferenceElement | undefined {\n const range = getDomRange(view)\n if (range) {\n // To get it work properly in Safari, we cannot return the range directly.\n // We have to return a contextElement.\n return {\n contextElement: view.dom,\n getBoundingClientRect: () => range.getBoundingClientRect(),\n getClientRects: () => range.getClientRects(),\n }\n }\n}\n\nfunction getDomRange(view: EditorView): Range | undefined {\n const win = view.dom.ownerDocument.defaultView\n const selection = win?.getSelection()\n if (!selection || selection.isCollapsed) {\n return\n }\n\n const range = typeof selection.rangeCount === 'number'\n && selection.rangeCount > 0\n && selection.getRangeAt(0)\n\n if (!range) {\n return\n }\n\n return range\n}\n\nfunction getInlineDecoration(view: EditorView): ReferenceElement | undefined {\n const match = view.dom.querySelectorAll('.prosekit-virtual-selection')\n\n if (match.length === 0) {\n return\n }\n if (match.length === 1) {\n return match[0]\n }\n\n const items = Array.from(match)\n return {\n contextElement: items[0],\n getBoundingClientRect: () => items[0].getBoundingClientRect(),\n getClientRects: () => items.map((item) => item.getBoundingClientRect()),\n }\n}\n","import {\n defineCustomElement,\n defineProps,\n registerCustomElement,\n type HostElement,\n type HostElementConstructor,\n type PropsDeclaration,\n type State,\n} from '@aria-ui/core'\nimport type { OpenChangeEvent } from '@aria-ui/elements/overlay'\nimport { OverlayRootPropsDeclaration, useOverlayStore, type OverlayRootProps } from '@aria-ui/elements/overlay'\nimport type { Editor } from '@prosekit/core'\nimport type { Selection } from '@prosekit/pm/state'\n\nimport { useEditorFocusChangeEvent } from '../../hooks/use-editor-focus-event.ts'\nimport { useEditorUpdateEvent } from '../../hooks/use-editor-update-event.ts'\nimport { useKeymap } from '../../hooks/use-keymap.ts'\n\nimport { InlinePopoverStoreContext } from './store.ts'\nimport { getVirtualSelectionElement } from './virtual-selection-element.ts'\n\nexport interface InlinePopoverRootProps extends OverlayRootProps {\n /**\n * The ProseKit editor instance.\n *\n * @default null\n * @hidden\n */\n editor: Editor | null\n\n /**\n * Whether the popover is open by default when some inline content is\n * selected.\n *\n * @default true\n */\n defaultOpen: boolean\n\n /**\n * Whether the inline popover should be dismissed when the editor receives an\n * Escape key press.\n *\n * @default true\n */\n dismissOnEscape: boolean\n}\n\n/** @internal */\nexport const InlinePopoverRootPropsDeclaration: PropsDeclaration<InlinePopoverRootProps> = /* @__PURE__ */ defineProps<\n InlinePopoverRootProps\n>({\n ...OverlayRootPropsDeclaration,\n editor: { default: null, attribute: false },\n defaultOpen: { default: true, attribute: 'default-open', type: 'boolean' },\n dismissOnEscape: { default: true, attribute: 'dismiss-on-escape', type: 'boolean' },\n})\n\nexport interface InlinePopoverRootEvents {\n /**\n * Emitted when the open state of the popover changes.\n */\n openChange: OpenChangeEvent\n}\n\n/** @internal */\nexport function setupInlinePopoverRoot(\n host: HostElement,\n props: State<InlinePopoverRootProps>,\n): void {\n const store = useOverlayStore(host, props)\n InlinePopoverStoreContext.provide(host, store)\n\n let editorFocused = false\n useEditorFocusChangeEvent(host, props.editor.get, (focus) => {\n editorFocused = focus\n })\n\n let prevSelection: Selection | undefined\n useEditorUpdateEvent(host, props.editor.get, (view) => {\n const isPopoverFocused = !editorFocused && host.contains(host.ownerDocument.activeElement)\n if (isPopoverFocused) return\n\n const { selection } = view.state\n if (prevSelection?.eq(selection)) return\n prevSelection = selection\n\n const reference = getVirtualSelectionElement(view)\n store.setAnchorElement(reference)\n\n if (reference && props.defaultOpen.get()) {\n store.requestOpenChange(true)\n } else if (!reference) {\n store.requestOpenChange(false)\n }\n })\n\n useKeymap(host, props.editor.get, {\n Escape: () => {\n if (!props.dismissOnEscape.get() || !store.getIsOpen()) return false\n store.requestOpenChange(false)\n return true\n },\n })\n}\n\nconst InlinePopoverRootElementBase: HostElementConstructor<InlinePopoverRootProps> = defineCustomElement(\n setupInlinePopoverRoot,\n InlinePopoverRootPropsDeclaration,\n)\n\n/**\n * `<prosekit-inline-popover-root>` custom element.\n *\n * Properties: {@link InlinePopoverRootProps}\n *\n * Events: {@link InlinePopoverRootEvents}\n */\nexport class InlinePopoverRootElement extends InlinePopoverRootElementBase {}\n\n/** @internal */\nexport function registerInlinePopoverRootElement(): void {\n registerCustomElement('prosekit-inline-popover-root', InlinePopoverRootElement)\n}\n"],"mappings":";;;;;;AAGA,MAAa,4BAAmD,cAC9D,+BACF;;ACaA,MAAa,qCAAgF;;AAG7F,SAAgB,wBACd,MACA,QACM;CACN,MAAM,WAAW,0BAA0B,QAAQ,IAAI;CACvD,kBAAkB,MAAM,QAAQ;CAEhC,YAAY,MADI,eAAe,SAAS,GAAG,UAAU,KAAK,KAClC,CAAC;CAEzB,QAAQ,YAAY;EAClB,KAAK,OAAO;CACd,CAAC;AACH;AAEA,MAAM,gCAAiF,oBACrF,yBACA,kCACF;;;;;;;;;;;;AAaA,IAAa,4BAAb,cAA+C,8BAA8B,CAAC;;AAG9E,SAAgB,oCAA0C;CACxD,sBAAsB,iCAAiC,yBAAyB;AAClF;;ACwBA,MAAa,0CAA0G,4BAErH;CACA,GAAG;CACH,WAAW;EAAE,SAAS;EAAO,WAAW;EAAa,MAAM;CAAS;CACpE,QAAQ;EAAE,SAAS;EAAI,WAAW;CAAM;CACxC,MAAM;EAAE,SAAS;EAAM,WAAW;EAAQ,MAAM;CAAU;CAC1D,OAAO;EAAE,SAAS;EAAO,WAAW;EAAS,MAAM;CAAU;CAC7D,SAAS;EAAE,SAAS;EAAM,WAAW;EAAW,MAAM;CAAU;CAChE,QAAQ;EAAE,SAAS;EAAM,WAAW;EAAU,MAAM;CAAU;CAC9D,iBAAiB;EAAE,SAAS;EAAG,WAAW;EAAoB,MAAM;CAAS;AAC/E,CAAC;;AAGD,SAAgB,6BACd,MACA,OACM;CACN,uBAAuB,MAAM,OAAO,0BAA0B,QAAQ,IAAI,CAAC;AAC7E;AAEA,MAAM,qCAA2F,oBAC/F,8BACA,uCACF;;;;;;;;;;;;;;;;;;;;AAqBA,IAAa,iCAAb,cAAoD,mCAAmC,CAAC;;AAGxF,SAAgB,yCAA+C;CAC7D,sBAAsB,sCAAsC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AAK,cAAc;AAAA,UAC1C,cAAA,SAAuB,IAAA,CAAK,cAAc;AAAA,UAC1C,qBAAA,SAA8B,IAAA,CAAK,qBAAqB;AAAA,UACxD,iBAAA,SAA0B,IAAA,CAAK,iBAAiB;AA0BzB;AAAA,cAvB3B,wBAAA,EAA0B,gBAAgB,CAAC,aAAA;;cAE3C,yBAAA,EAA2B,gBAAgB,CAAC,cAAA;;cAE5C,8BAAA,EAAgC,gBAAgB,CAAC,mBAAA;AAyB9D;AAAA,cAvBa,wBAAA,EAA0B,gBAAgB,CAAC,aAAA;;cAE3C,+BAAA,EAAiC,gBAAgB,CAAC,oBAAA;AAqBjB;AAAA,cAnBjC,kCAAA,EAAoC,gBAAgB,CAAC,uBAAA;;cAErD,2BAAA,EAA6B,gBAAgB,CAAC,gBAAA;AAAA,iBAE3C,uBAAA,CAAA;AAAA,iBAGA,0BAAA,CAAA;AAAA,iBAGA,6BAAA,CAAA;AAAA,iBAGA,wBAAA,CAAA;AAAA,iBAGA,uBAAA,CAAA;AAAA,iBAGA,8BAAA,CAAA;AAAA,iBAGA,iCAAA,CAAA"}
package/dist/menu.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"menu.js","names":[],"sources":["../src/components/menu/index.ts"],"sourcesContent":["/**\n\n@module\n\n## Anatomy\n\n```html\n<prosekit-menu-root>\n <prosekit-menu-trigger>...</prosekit-menu-trigger>\n <prosekit-menu-positioner>\n <prosekit-menu-popup>\n <prosekit-menu-item>...</prosekit-menu-item>\n <prosekit-menu-submenu-root>\n <prosekit-menu-submenu-trigger>...</prosekit-menu-submenu-trigger>\n <prosekit-menu-positioner>\n <prosekit-menu-popup>\n <prosekit-menu-item>...</prosekit-menu-item>\n </prosekit-menu-popup>\n </prosekit-menu-positioner>\n </prosekit-menu-submenu-root>\n </prosekit-menu-popup>\n </prosekit-menu-positioner>\n</prosekit-menu-root>\n```\n*/\n\nimport { registerCustomElement, type PropsDeclaration } from '@aria-ui/core'\nimport * as Base from '@aria-ui/elements/menu'\n\n/**\n * `<prosekit-menu-item>` custom element.\n *\n * Properties: {@link MenuItemProps}\n *\n * Events: {@link MenuItemEvents}\n *\n * Data attributes:\n *\n * | Attribute | Description |\n * | --- | --- |\n * | `data-highlighted` | Present when the item is the currently highlighted option |\n */\nexport class MenuItemElement extends Base.MenuItemElement {}\n\n/**\n * `<prosekit-menu-popup>` custom element.\n *\n * Properties: {@link MenuPopupProps}\n *\n * Data attributes:\n *\n * | Attribute | Description |\n * | --- | --- |\n * | `data-state` | `\"open\"` when the menu is visible, `\"closed\"` otherwise |\n */\nexport class MenuPopupElement extends Base.MenuPopupElement {}\n\n/**\n * `<prosekit-menu-positioner>` custom element.\n *\n * Properties: {@link MenuPositionerProps}\n *\n * Data attributes:\n *\n * | Attribute | Description |\n * | --- | --- |\n * | `data-state` | `\"open\"` when the menu is visible, `\"closed\"` otherwise |\n *\n * CSS variables:\n *\n * | Variable | Description |\n * | --- | --- |\n * | `--transform-origin` | The coordinates that this element is anchored to. Useful for scale animations. |\n */\nexport class MenuPositionerElement extends Base.MenuPositionerElement {}\n\n/**\n * `<prosekit-menu-root>` custom element.\n *\n * Properties: {@link MenuRootProps}\n *\n * Events: {@link MenuRootEvents}\n *\n * Data attributes:\n *\n * | Attribute | Description |\n * | --- | --- |\n * | `data-menu-root` | Always present on the element |\n */\nexport class MenuRootElement extends Base.MenuRootElement {}\n\n/**\n * `<prosekit-menu-submenu-root>` custom element.\n *\n * Properties: {@link MenuSubmenuRootProps}\n *\n * Events: {@link MenuSubmenuRootEvents}\n *\n * Data attributes:\n *\n * | Attribute | Description |\n * | --- | --- |\n * | `data-menu-submenu-root` | Always present on the element |\n */\nexport class MenuSubmenuRootElement extends Base.MenuSubmenuRootElement {}\n\n/**\n * `<prosekit-menu-submenu-trigger>` custom element.\n *\n * Properties: {@link MenuSubmenuTriggerProps}\n *\n * Data attributes:\n *\n * | Attribute | Description |\n * | --- | --- |\n * | `data-highlighted` | Present when the item is the currently highlighted option |\n */\nexport class MenuSubmenuTriggerElement extends Base.MenuSubmenuTriggerElement {}\n\n/**\n * `<prosekit-menu-trigger>` custom element.\n *\n * Properties: {@link MenuTriggerProps}\n *\n * Events: {@link MenuTriggerEvents}\n */\nexport class MenuTriggerElement extends Base.MenuTriggerElement {}\n\nexport interface MenuItemProps extends Base.MenuItemProps {}\nexport interface MenuPopupProps extends Base.MenuPopupProps {}\nexport interface MenuPositionerProps extends Base.MenuPositionerProps {}\nexport interface MenuRootProps extends Base.MenuRootProps {}\nexport interface MenuSubmenuRootProps extends Base.MenuSubmenuRootProps {}\nexport interface MenuSubmenuTriggerProps extends Base.MenuSubmenuTriggerProps {}\nexport interface MenuTriggerProps extends Base.MenuTriggerProps {}\n\nexport interface MenuItemEvents extends Base.MenuItemEvents {}\nexport interface MenuRootEvents extends Base.MenuRootEvents {}\nexport interface MenuSubmenuRootEvents extends Base.MenuSubmenuRootEvents {}\nexport interface MenuTriggerEvents extends Base.MenuTriggerEvents {}\n\n/** @internal */\nexport const MenuItemPropsDeclaration: PropsDeclaration<MenuItemProps> = Base.MenuItemPropsDeclaration\n/** @internal */\nexport const MenuPopupPropsDeclaration: PropsDeclaration<MenuPopupProps> = Base.MenuPopupPropsDeclaration\n/** @internal */\nexport const MenuPositionerPropsDeclaration: PropsDeclaration<MenuPositionerProps> = Base.MenuPositionerPropsDeclaration\n/** @internal */\nexport const MenuRootPropsDeclaration: PropsDeclaration<MenuRootProps> = Base.MenuRootPropsDeclaration\n/** @internal */\nexport const MenuSubmenuRootPropsDeclaration: PropsDeclaration<MenuSubmenuRootProps> = Base.MenuSubmenuRootPropsDeclaration\n/** @internal */\nexport const MenuSubmenuTriggerPropsDeclaration: PropsDeclaration<MenuSubmenuTriggerProps> = Base.MenuSubmenuTriggerPropsDeclaration\n/** @internal */\nexport const MenuTriggerPropsDeclaration: PropsDeclaration<MenuTriggerProps> = Base.MenuTriggerPropsDeclaration\n\nexport function registerMenuRootElement(): void {\n registerCustomElement('prosekit-menu-root', MenuRootElement)\n}\nexport function registerMenuTriggerElement(): void {\n registerCustomElement('prosekit-menu-trigger', MenuTriggerElement)\n}\nexport function registerMenuPositionerElement(): void {\n registerCustomElement('prosekit-menu-positioner', MenuPositionerElement)\n}\nexport function registerMenuPopupElement(): void {\n registerCustomElement('prosekit-menu-popup', MenuPopupElement)\n}\nexport function registerMenuItemElement(): void {\n registerCustomElement('prosekit-menu-item', MenuItemElement)\n}\nexport function registerMenuSubmenuRootElement(): void {\n registerCustomElement('prosekit-menu-submenu-root', MenuSubmenuRootElement)\n}\nexport function registerMenuSubmenuTriggerElement(): void {\n registerCustomElement('prosekit-menu-submenu-trigger', MenuSubmenuTriggerElement)\n}\n\nexport {\n OpenChangeEvent,\n SelectEvent,\n setupMenuItem,\n setupMenuPopup,\n setupMenuPositioner,\n setupMenuRoot,\n setupMenuSubmenuRoot,\n setupMenuSubmenuTrigger,\n setupMenuTrigger,\n} from '@aria-ui/elements/menu'\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0CA,IAAa,kBAAb,cAAqC,KAAK,gBAAgB;;;;;;;;;;;;AAa1D,IAAa,mBAAb,cAAsC,KAAK,iBAAiB;;;;;;;;;;;;;;;;;;AAmB5D,IAAa,wBAAb,cAA2C,KAAK,sBAAsB;;;;;;;;;;;;;;AAetE,IAAa,kBAAb,cAAqC,KAAK,gBAAgB;;;;;;;;;;;;;;AAe1D,IAAa,yBAAb,cAA4C,KAAK,uBAAuB;;;;;;;;;;;;AAaxE,IAAa,4BAAb,cAA+C,KAAK,0BAA0B;;;;;;;;AAS9E,IAAa,qBAAb,cAAwC,KAAK,mBAAmB;;AAgBhE,MAAa,2BAA4D,KAAK;;AAE9E,MAAa,4BAA8D,KAAK;;AAEhF,MAAa,iCAAwE,KAAK;;AAE1F,MAAa,2BAA4D,KAAK;;AAE9E,MAAa,kCAA0E,KAAK;;AAE5F,MAAa,qCAAgF,KAAK;;AAElG,MAAa,8BAAkE,KAAK;AAEpF,SAAgB,0BAAgC;AAC9C,uBAAsB,sBAAsB,gBAAgB;;AAE9D,SAAgB,6BAAmC;AACjD,uBAAsB,yBAAyB,mBAAmB;;AAEpE,SAAgB,gCAAsC;AACpD,uBAAsB,4BAA4B,sBAAsB;;AAE1E,SAAgB,2BAAiC;AAC/C,uBAAsB,uBAAuB,iBAAiB;;AAEhE,SAAgB,0BAAgC;AAC9C,uBAAsB,sBAAsB,gBAAgB;;AAE9D,SAAgB,iCAAuC;AACrD,uBAAsB,8BAA8B,uBAAuB;;AAE7E,SAAgB,oCAA0C;AACxD,uBAAsB,iCAAiC,0BAA0B"}
1
+ {"version":3,"file":"menu.js","names":[],"sources":["../src/components/menu/index.ts"],"sourcesContent":["/**\n\n@module\n\n## Anatomy\n\n```html\n<prosekit-menu-root>\n <prosekit-menu-trigger>...</prosekit-menu-trigger>\n <prosekit-menu-positioner>\n <prosekit-menu-popup>\n <prosekit-menu-item>...</prosekit-menu-item>\n <prosekit-menu-submenu-root>\n <prosekit-menu-submenu-trigger>...</prosekit-menu-submenu-trigger>\n <prosekit-menu-positioner>\n <prosekit-menu-popup>\n <prosekit-menu-item>...</prosekit-menu-item>\n </prosekit-menu-popup>\n </prosekit-menu-positioner>\n </prosekit-menu-submenu-root>\n </prosekit-menu-popup>\n </prosekit-menu-positioner>\n</prosekit-menu-root>\n```\n*/\n\nimport { registerCustomElement, type PropsDeclaration } from '@aria-ui/core'\nimport * as Base from '@aria-ui/elements/menu'\n\n/**\n * `<prosekit-menu-item>` custom element.\n *\n * Properties: {@link MenuItemProps}\n *\n * Events: {@link MenuItemEvents}\n *\n * Data attributes:\n *\n * | Attribute | Description |\n * | --- | --- |\n * | `data-highlighted` | Present when the item is the currently highlighted option |\n */\nexport class MenuItemElement extends Base.MenuItemElement {}\n\n/**\n * `<prosekit-menu-popup>` custom element.\n *\n * Properties: {@link MenuPopupProps}\n *\n * Data attributes:\n *\n * | Attribute | Description |\n * | --- | --- |\n * | `data-state` | `\"open\"` when the menu is visible, `\"closed\"` otherwise |\n */\nexport class MenuPopupElement extends Base.MenuPopupElement {}\n\n/**\n * `<prosekit-menu-positioner>` custom element.\n *\n * Properties: {@link MenuPositionerProps}\n *\n * Data attributes:\n *\n * | Attribute | Description |\n * | --- | --- |\n * | `data-state` | `\"open\"` when the menu is visible, `\"closed\"` otherwise |\n *\n * CSS variables:\n *\n * | Variable | Description |\n * | --- | --- |\n * | `--transform-origin` | The coordinates that this element is anchored to. Useful for scale animations. |\n */\nexport class MenuPositionerElement extends Base.MenuPositionerElement {}\n\n/**\n * `<prosekit-menu-root>` custom element.\n *\n * Properties: {@link MenuRootProps}\n *\n * Events: {@link MenuRootEvents}\n *\n * Data attributes:\n *\n * | Attribute | Description |\n * | --- | --- |\n * | `data-menu-root` | Always present on the element |\n */\nexport class MenuRootElement extends Base.MenuRootElement {}\n\n/**\n * `<prosekit-menu-submenu-root>` custom element.\n *\n * Properties: {@link MenuSubmenuRootProps}\n *\n * Events: {@link MenuSubmenuRootEvents}\n *\n * Data attributes:\n *\n * | Attribute | Description |\n * | --- | --- |\n * | `data-menu-submenu-root` | Always present on the element |\n */\nexport class MenuSubmenuRootElement extends Base.MenuSubmenuRootElement {}\n\n/**\n * `<prosekit-menu-submenu-trigger>` custom element.\n *\n * Properties: {@link MenuSubmenuTriggerProps}\n *\n * Data attributes:\n *\n * | Attribute | Description |\n * | --- | --- |\n * | `data-highlighted` | Present when the item is the currently highlighted option |\n */\nexport class MenuSubmenuTriggerElement extends Base.MenuSubmenuTriggerElement {}\n\n/**\n * `<prosekit-menu-trigger>` custom element.\n *\n * Properties: {@link MenuTriggerProps}\n *\n * Events: {@link MenuTriggerEvents}\n */\nexport class MenuTriggerElement extends Base.MenuTriggerElement {}\n\nexport interface MenuItemProps extends Base.MenuItemProps {}\nexport interface MenuPopupProps extends Base.MenuPopupProps {}\nexport interface MenuPositionerProps extends Base.MenuPositionerProps {}\nexport interface MenuRootProps extends Base.MenuRootProps {}\nexport interface MenuSubmenuRootProps extends Base.MenuSubmenuRootProps {}\nexport interface MenuSubmenuTriggerProps extends Base.MenuSubmenuTriggerProps {}\nexport interface MenuTriggerProps extends Base.MenuTriggerProps {}\n\nexport interface MenuItemEvents extends Base.MenuItemEvents {}\nexport interface MenuRootEvents extends Base.MenuRootEvents {}\nexport interface MenuSubmenuRootEvents extends Base.MenuSubmenuRootEvents {}\nexport interface MenuTriggerEvents extends Base.MenuTriggerEvents {}\n\n/** @internal */\nexport const MenuItemPropsDeclaration: PropsDeclaration<MenuItemProps> = Base.MenuItemPropsDeclaration\n/** @internal */\nexport const MenuPopupPropsDeclaration: PropsDeclaration<MenuPopupProps> = Base.MenuPopupPropsDeclaration\n/** @internal */\nexport const MenuPositionerPropsDeclaration: PropsDeclaration<MenuPositionerProps> = Base.MenuPositionerPropsDeclaration\n/** @internal */\nexport const MenuRootPropsDeclaration: PropsDeclaration<MenuRootProps> = Base.MenuRootPropsDeclaration\n/** @internal */\nexport const MenuSubmenuRootPropsDeclaration: PropsDeclaration<MenuSubmenuRootProps> = Base.MenuSubmenuRootPropsDeclaration\n/** @internal */\nexport const MenuSubmenuTriggerPropsDeclaration: PropsDeclaration<MenuSubmenuTriggerProps> = Base.MenuSubmenuTriggerPropsDeclaration\n/** @internal */\nexport const MenuTriggerPropsDeclaration: PropsDeclaration<MenuTriggerProps> = Base.MenuTriggerPropsDeclaration\n\nexport function registerMenuRootElement(): void {\n registerCustomElement('prosekit-menu-root', MenuRootElement)\n}\nexport function registerMenuTriggerElement(): void {\n registerCustomElement('prosekit-menu-trigger', MenuTriggerElement)\n}\nexport function registerMenuPositionerElement(): void {\n registerCustomElement('prosekit-menu-positioner', MenuPositionerElement)\n}\nexport function registerMenuPopupElement(): void {\n registerCustomElement('prosekit-menu-popup', MenuPopupElement)\n}\nexport function registerMenuItemElement(): void {\n registerCustomElement('prosekit-menu-item', MenuItemElement)\n}\nexport function registerMenuSubmenuRootElement(): void {\n registerCustomElement('prosekit-menu-submenu-root', MenuSubmenuRootElement)\n}\nexport function registerMenuSubmenuTriggerElement(): void {\n registerCustomElement('prosekit-menu-submenu-trigger', MenuSubmenuTriggerElement)\n}\n\nexport {\n OpenChangeEvent,\n SelectEvent,\n setupMenuItem,\n setupMenuPopup,\n setupMenuPositioner,\n setupMenuRoot,\n setupMenuSubmenuRoot,\n setupMenuSubmenuTrigger,\n setupMenuTrigger,\n} from '@aria-ui/elements/menu'\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0CA,IAAa,kBAAb,cAAqC,KAAK,gBAAgB,CAAC;;;;;;;;;;;;AAa3D,IAAa,mBAAb,cAAsC,KAAK,iBAAiB,CAAC;;;;;;;;;;;;;;;;;;AAmB7D,IAAa,wBAAb,cAA2C,KAAK,sBAAsB,CAAC;;;;;;;;;;;;;;AAevE,IAAa,kBAAb,cAAqC,KAAK,gBAAgB,CAAC;;;;;;;;;;;;;;AAe3D,IAAa,yBAAb,cAA4C,KAAK,uBAAuB,CAAC;;;;;;;;;;;;AAazE,IAAa,4BAAb,cAA+C,KAAK,0BAA0B,CAAC;;;;;;;;AAS/E,IAAa,qBAAb,cAAwC,KAAK,mBAAmB,CAAC;;AAgBjE,MAAa,2BAA4D,KAAK;;AAE9E,MAAa,4BAA8D,KAAK;;AAEhF,MAAa,iCAAwE,KAAK;;AAE1F,MAAa,2BAA4D,KAAK;;AAE9E,MAAa,kCAA0E,KAAK;;AAE5F,MAAa,qCAAgF,KAAK;;AAElG,MAAa,8BAAkE,KAAK;AAEpF,SAAgB,0BAAgC;CAC9C,sBAAsB,sBAAsB,eAAe;AAC7D;AACA,SAAgB,6BAAmC;CACjD,sBAAsB,yBAAyB,kBAAkB;AACnE;AACA,SAAgB,gCAAsC;CACpD,sBAAsB,4BAA4B,qBAAqB;AACzE;AACA,SAAgB,2BAAiC;CAC/C,sBAAsB,uBAAuB,gBAAgB;AAC/D;AACA,SAAgB,0BAAgC;CAC9C,sBAAsB,sBAAsB,eAAe;AAC7D;AACA,SAAgB,iCAAuC;CACrD,sBAAsB,8BAA8B,sBAAsB;AAC5E;AACA,SAAgB,oCAA0C;CACxD,sBAAsB,iCAAiC,yBAAyB;AAClF"}
@@ -1 +1 @@
1
- {"version":3,"file":"popover.d.ts","names":[],"sources":["../src/components/popover/index.ts"],"mappings":";;;;;AAmEA;;;;;AAEA;;;;cAvCa,mBAAA,SAA4B,IAAA,CAAK,mBAAA;;;;;AAyC9C;;;;;AACA;;;;;AAEA;;;cAzBa,wBAAA,SAAiC,IAAA,CAAK,wBAAA;AA0BnD;;;;;AAGA;;AAHA,cAjBa,kBAAA,SAA2B,IAAA,CAAK,kBAAA;;AAsB7C;;;;;AAEA;cAfa,qBAAA,SAA8B,IAAA,CAAK,qBAAA;AAAA,UAE/B,iBAAA,SAA0B,IAAA,CAAK,iBAAA;AAAA,UAC/B,sBAAA,SAA+B,IAAA,CAAK,sBAAA;AAAA,UACpC,gBAAA,SAAyB,IAAA,CAAK,gBAAA;AAAA,UAC9B,mBAAA,SAA4B,IAAA,CAAK,mBAAA;AAAA,UAEjC,iBAAA,SAA0B,IAAA,CAAK,iBAAA;AAAA,UAC/B,oBAAA,SAA6B,IAAA,CAAK,oBAAA;AAcnD;AAAA,cAXa,4BAAA,EAA8B,gBAAA,CAAiB,iBAAA;;cAE/C,iCAAA,EAAmC,gBAAA,CAAiB,sBAAA;;cAEpD,2BAAA,EAA6B,gBAAA,CAAiB,gBAAA;;cAE9C,8BAAA,EAAgC,gBAAA,CAAiB,mBAAA;AAAA,iBAE9C,0BAAA,CAAA;AAAA,iBAGA,6BAAA,CAAA;AAAA,iBAGA,2BAAA,CAAA;AAAA,iBAGA,gCAAA,CAAA"}
1
+ {"version":3,"file":"popover.d.ts","names":[],"sources":["../src/components/popover/index.ts"],"mappings":";;;;AA0D+D;AAS/D;;;;AAAqE;AAErE;;;;cAvCa,mBAAA,SAA4B,IAAA,CAAK,mBAAmB;;;;AAwCU;AAC3E;;;;AAA+D;AAC/D;;;;AAAqE;AAErE;;;cAzBa,wBAAA,SAAiC,IAAA,CAAK,wBAAwB;AA0B3E;;;;AAAuE;AAGvE;;AAHA,cAjBa,kBAAA,SAA2B,IAAA,CAAK,kBAAkB;AAoBc;AAE7E;;;;AAAuF;AAEvF;AAJ6E,cAXhE,qBAAA,SAA8B,IAAA,CAAK,qBAAqB;AAAA,UAEpD,iBAAA,SAA0B,IAAA,CAAK,iBAAiB;AAAA,UAChD,sBAAA,SAA+B,IAAA,CAAK,sBAAsB;AAAA,UAC1D,gBAAA,SAAyB,IAAA,CAAK,gBAAgB;AAAA,UAC9C,mBAAA,SAA4B,IAAA,CAAK,mBAAmB;AAAA,UAEpD,iBAAA,SAA0B,IAAA,CAAK,iBAAiB;AAAA,UAChD,oBAAA,SAA6B,IAAA,CAAK,oBAAoB;AAcvE;AAAA,cAXa,4BAAA,EAA8B,gBAAgB,CAAC,iBAAA;;cAE/C,iCAAA,EAAmC,gBAAgB,CAAC,sBAAA;AASpB;AAAA,cAPhC,2BAAA,EAA6B,gBAAgB,CAAC,gBAAA;;cAE9C,8BAAA,EAAgC,gBAAgB,CAAC,mBAAA;AAAA,iBAE9C,0BAAA,CAAA;AAAA,iBAGA,6BAAA,CAAA;AAAA,iBAGA,2BAAA,CAAA;AAAA,iBAGA,gCAAA,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"popover.js","names":[],"sources":["../src/components/popover/index.ts"],"sourcesContent":["/**\n\n@module\n\n## Anatomy\n\n```html\n<prosekit-popover-root>\n <prosekit-popover-trigger>...</prosekit-popover-trigger>\n <prosekit-popover-positioner>\n <prosekit-popover-popup>...</prosekit-popover-popup>\n </prosekit-popover-positioner>\n</prosekit-popover-root>\n```\n*/\n\nimport { registerCustomElement, type PropsDeclaration } from '@aria-ui/core'\nimport * as Base from '@aria-ui/elements/popover'\n\n/**\n * `<prosekit-popover-popup>` custom element.\n *\n * Properties: {@link PopoverPopupProps}\n *\n * Data attributes:\n *\n * | Attribute | Description |\n * | --- | --- |\n * | `data-state` | `\"open\"` when the popover is visible, `\"closed\"` otherwise |\n */\nexport class PopoverPopupElement extends Base.PopoverPopupElement {}\n\n/**\n * `<prosekit-popover-positioner>` custom element.\n *\n * Properties: {@link PopoverPositionerProps}\n *\n * Data attributes:\n *\n * | Attribute | Description |\n * | --- | --- |\n * | `data-state` | `\"open\"` when the popover is visible, `\"closed\"` otherwise |\n *\n * CSS variables:\n *\n * | Variable | Description |\n * | --- | --- |\n * | `--transform-origin` | The coordinates that this element is anchored to. Useful for scale animations. |\n */\nexport class PopoverPositionerElement extends Base.PopoverPositionerElement {}\n\n/**\n * `<prosekit-popover-root>` custom element.\n *\n * Properties: {@link PopoverRootProps}\n *\n * Events: {@link PopoverRootEvents}\n */\nexport class PopoverRootElement extends Base.PopoverRootElement {}\n\n/**\n * `<prosekit-popover-trigger>` custom element.\n *\n * Properties: {@link PopoverTriggerProps}\n *\n * Events: {@link PopoverTriggerEvents}\n */\nexport class PopoverTriggerElement extends Base.PopoverTriggerElement {}\n\nexport interface PopoverPopupProps extends Base.PopoverPopupProps {}\nexport interface PopoverPositionerProps extends Base.PopoverPositionerProps {}\nexport interface PopoverRootProps extends Base.PopoverRootProps {}\nexport interface PopoverTriggerProps extends Base.PopoverTriggerProps {}\n\nexport interface PopoverRootEvents extends Base.PopoverRootEvents {}\nexport interface PopoverTriggerEvents extends Base.PopoverTriggerEvents {}\n\n/** @internal */\nexport const PopoverPopupPropsDeclaration: PropsDeclaration<PopoverPopupProps> = Base.PopoverPopupPropsDeclaration\n/** @internal */\nexport const PopoverPositionerPropsDeclaration: PropsDeclaration<PopoverPositionerProps> = Base.PopoverPositionerPropsDeclaration\n/** @internal */\nexport const PopoverRootPropsDeclaration: PropsDeclaration<PopoverRootProps> = Base.PopoverRootPropsDeclaration\n/** @internal */\nexport const PopoverTriggerPropsDeclaration: PropsDeclaration<PopoverTriggerProps> = Base.PopoverTriggerPropsDeclaration\n\nexport function registerPopoverRootElement(): void {\n registerCustomElement('prosekit-popover-root', PopoverRootElement)\n}\nexport function registerPopoverTriggerElement(): void {\n registerCustomElement('prosekit-popover-trigger', PopoverTriggerElement)\n}\nexport function registerPopoverPopupElement(): void {\n registerCustomElement('prosekit-popover-popup', PopoverPopupElement)\n}\nexport function registerPopoverPositionerElement(): void {\n registerCustomElement('prosekit-popover-positioner', PopoverPositionerElement)\n}\n\nexport {\n OpenChangeEvent,\n setupPopoverPopup,\n setupPopoverPositioner,\n setupPopoverRoot,\n setupPopoverTrigger,\n} from '@aria-ui/elements/popover'\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8BA,IAAa,sBAAb,cAAyC,KAAK,oBAAoB;;;;;;;;;;;;;;;;;;AAmBlE,IAAa,2BAAb,cAA8C,KAAK,yBAAyB;;;;;;;;AAS5E,IAAa,qBAAb,cAAwC,KAAK,mBAAmB;;;;;;;;AAShE,IAAa,wBAAb,cAA2C,KAAK,sBAAsB;;AAWtE,MAAa,+BAAoE,KAAK;;AAEtF,MAAa,oCAA8E,KAAK;;AAEhG,MAAa,8BAAkE,KAAK;;AAEpF,MAAa,iCAAwE,KAAK;AAE1F,SAAgB,6BAAmC;AACjD,uBAAsB,yBAAyB,mBAAmB;;AAEpE,SAAgB,gCAAsC;AACpD,uBAAsB,4BAA4B,sBAAsB;;AAE1E,SAAgB,8BAAoC;AAClD,uBAAsB,0BAA0B,oBAAoB;;AAEtE,SAAgB,mCAAyC;AACvD,uBAAsB,+BAA+B,yBAAyB"}
1
+ {"version":3,"file":"popover.js","names":[],"sources":["../src/components/popover/index.ts"],"sourcesContent":["/**\n\n@module\n\n## Anatomy\n\n```html\n<prosekit-popover-root>\n <prosekit-popover-trigger>...</prosekit-popover-trigger>\n <prosekit-popover-positioner>\n <prosekit-popover-popup>...</prosekit-popover-popup>\n </prosekit-popover-positioner>\n</prosekit-popover-root>\n```\n*/\n\nimport { registerCustomElement, type PropsDeclaration } from '@aria-ui/core'\nimport * as Base from '@aria-ui/elements/popover'\n\n/**\n * `<prosekit-popover-popup>` custom element.\n *\n * Properties: {@link PopoverPopupProps}\n *\n * Data attributes:\n *\n * | Attribute | Description |\n * | --- | --- |\n * | `data-state` | `\"open\"` when the popover is visible, `\"closed\"` otherwise |\n */\nexport class PopoverPopupElement extends Base.PopoverPopupElement {}\n\n/**\n * `<prosekit-popover-positioner>` custom element.\n *\n * Properties: {@link PopoverPositionerProps}\n *\n * Data attributes:\n *\n * | Attribute | Description |\n * | --- | --- |\n * | `data-state` | `\"open\"` when the popover is visible, `\"closed\"` otherwise |\n *\n * CSS variables:\n *\n * | Variable | Description |\n * | --- | --- |\n * | `--transform-origin` | The coordinates that this element is anchored to. Useful for scale animations. |\n */\nexport class PopoverPositionerElement extends Base.PopoverPositionerElement {}\n\n/**\n * `<prosekit-popover-root>` custom element.\n *\n * Properties: {@link PopoverRootProps}\n *\n * Events: {@link PopoverRootEvents}\n */\nexport class PopoverRootElement extends Base.PopoverRootElement {}\n\n/**\n * `<prosekit-popover-trigger>` custom element.\n *\n * Properties: {@link PopoverTriggerProps}\n *\n * Events: {@link PopoverTriggerEvents}\n */\nexport class PopoverTriggerElement extends Base.PopoverTriggerElement {}\n\nexport interface PopoverPopupProps extends Base.PopoverPopupProps {}\nexport interface PopoverPositionerProps extends Base.PopoverPositionerProps {}\nexport interface PopoverRootProps extends Base.PopoverRootProps {}\nexport interface PopoverTriggerProps extends Base.PopoverTriggerProps {}\n\nexport interface PopoverRootEvents extends Base.PopoverRootEvents {}\nexport interface PopoverTriggerEvents extends Base.PopoverTriggerEvents {}\n\n/** @internal */\nexport const PopoverPopupPropsDeclaration: PropsDeclaration<PopoverPopupProps> = Base.PopoverPopupPropsDeclaration\n/** @internal */\nexport const PopoverPositionerPropsDeclaration: PropsDeclaration<PopoverPositionerProps> = Base.PopoverPositionerPropsDeclaration\n/** @internal */\nexport const PopoverRootPropsDeclaration: PropsDeclaration<PopoverRootProps> = Base.PopoverRootPropsDeclaration\n/** @internal */\nexport const PopoverTriggerPropsDeclaration: PropsDeclaration<PopoverTriggerProps> = Base.PopoverTriggerPropsDeclaration\n\nexport function registerPopoverRootElement(): void {\n registerCustomElement('prosekit-popover-root', PopoverRootElement)\n}\nexport function registerPopoverTriggerElement(): void {\n registerCustomElement('prosekit-popover-trigger', PopoverTriggerElement)\n}\nexport function registerPopoverPopupElement(): void {\n registerCustomElement('prosekit-popover-popup', PopoverPopupElement)\n}\nexport function registerPopoverPositionerElement(): void {\n registerCustomElement('prosekit-popover-positioner', PopoverPositionerElement)\n}\n\nexport {\n OpenChangeEvent,\n setupPopoverPopup,\n setupPopoverPositioner,\n setupPopoverRoot,\n setupPopoverTrigger,\n} from '@aria-ui/elements/popover'\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8BA,IAAa,sBAAb,cAAyC,KAAK,oBAAoB,CAAC;;;;;;;;;;;;;;;;;;AAmBnE,IAAa,2BAAb,cAA8C,KAAK,yBAAyB,CAAC;;;;;;;;AAS7E,IAAa,qBAAb,cAAwC,KAAK,mBAAmB,CAAC;;;;;;;;AASjE,IAAa,wBAAb,cAA2C,KAAK,sBAAsB,CAAC;;AAWvE,MAAa,+BAAoE,KAAK;;AAEtF,MAAa,oCAA8E,KAAK;;AAEhG,MAAa,8BAAkE,KAAK;;AAEpF,MAAa,iCAAwE,KAAK;AAE1F,SAAgB,6BAAmC;CACjD,sBAAsB,yBAAyB,kBAAkB;AACnE;AACA,SAAgB,gCAAsC;CACpD,sBAAsB,4BAA4B,qBAAqB;AACzE;AACA,SAAgB,8BAAoC;CAClD,sBAAsB,0BAA0B,mBAAmB;AACrE;AACA,SAAgB,mCAAyC;CACvD,sBAAsB,+BAA+B,wBAAwB;AAC/E"}
@@ -1,7 +1,4 @@
1
1
  import { HostElement, HostElementConstructor, PropsDeclaration, State } from "@aria-ui/core";
2
- /**
3
- * @public
4
- */
5
2
  interface ResizableRootProps {
6
3
  /**
7
4
  * The width of the resizable element.
@@ -26,9 +23,6 @@ interface ResizableRootProps {
26
23
  * @internal
27
24
  */
28
25
  declare const ResizableRootPropsDeclaration: PropsDeclaration<ResizableRootProps>;
29
- /**
30
- * @public
31
- */
32
26
  interface ResizableRootEvents {
33
27
  /**
34
28
  * Emitted when a resize operation starts.
@@ -39,9 +33,6 @@ interface ResizableRootEvents {
39
33
  */
40
34
  resizeEnd: ResizeEndEvent;
41
35
  }
42
- /**
43
- * @public
44
- */
45
36
  declare class ResizeStartEvent extends Event {
46
37
  readonly detail: {
47
38
  readonly width: number;
@@ -49,9 +40,6 @@ declare class ResizeStartEvent extends Event {
49
40
  };
50
41
  constructor(width: number, height: number);
51
42
  }
52
- /**
53
- * @public
54
- */
55
43
  declare class ResizeEndEvent extends Event {
56
44
  readonly detail: {
57
45
  readonly width: number;
@@ -82,9 +70,6 @@ declare class ResizableRootElement extends ResizableRootElementBase {}
82
70
  * @internal
83
71
  */
84
72
  declare function registerResizableRootElement(): void;
85
- /**
86
- * @public
87
- */
88
73
  interface ResizableHandleProps {
89
74
  /**
90
75
  * The position of the handle.
@@ -1 +1 @@
1
- {"version":3,"file":"resizable.d.ts","names":[],"sources":["../src/components/resizable/resizable-root.ts","../src/components/resizable/resizable-handle.ts"],"mappings":";AAkBA;;;AAAA,UAAiB,kBAAA;EAMf;;;;;EAAA,KAAA;EAwBA;;;;AAKF;EAtBE,MAAA;;;;;;EAOA,WAAA;AAAA;;AA8BF;;cAxBa,6BAAA,EAA+B,gBAAA,CAAiB,kBAAA;;;;UAS5C,mBAAA;EAkBJ;;;EAdX,WAAA,EAAa,gBAAA;EAgB4B;;AAS3C;EApBE,SAAA,EAAW,cAAA;AAAA;;;;cAMA,gBAAA,SAAyB,KAAA;EAAA,SAC3B,MAAA;IAAA,SACE,KAAA;IAAA,SACA,MAAA;EAAA;cAEC,KAAA,UAAe,MAAA;AAAA;AAuB7B;;;AAAA,cAda,cAAA,SAAuB,KAAA;EAAA,SACzB,MAAA;IAAA,SACE,KAAA;IAAA,SACA,MAAA;EAAA;cAEC,KAAA,UAAe,MAAA;AAAA;;;;iBASb,kBAAA,CACd,IAAA,EAAM,WAAA,EACN,KAAA,EAAO,KAAA,CAAM,kBAAA;AAAA,cAkET,wBAAA,EAA0B,sBAAA,CAAuB,kBAAA;AAvBtD;;;;;AAyCD;;;;;AAOA;;;AAhDC,cAyCY,oBAAA,SAA6B,wBAAA;;AC5K1C;;iBDmLgB,4BAAA,CAAA;AA3KhB;;;AAAA,UCRiB,oBAAA;EDcf;;;;;ECRA,QAAA;AAAA;;;;cAcW,+BAAA,EAAiC,gBAAA,CAAiB,oBAAA;;;;iBAO/C,oBAAA,CACd,IAAA,EAAM,WAAA,EACN,KAAA,EAAO,KAAA,CAAM,oBAAA;AAAA,cA2ET,0BAAA,EAA4B,sBAAA,CAAuB,oBAAA;;;;;AD9CzD;cCwDa,sBAAA,SAA+B,0BAAA;;;;iBAO5B,8BAAA,CAAA"}
1
+ {"version":3,"file":"resizable.d.ts","names":[],"sources":["../src/components/resizable/resizable-root.ts","../src/components/resizable/resizable-handle.ts"],"mappings":";UAeiB,kBAAA;EAAkB;;;;;EAMjC,KAAA;EAcW;AAAA;AAMb;;;EAbE,MAAA;EAa6E;AAM/E;;;;EAZE,WAAA;AAAA;;;;cAMW,6BAAA,EAA+B,gBAAgB,CAAC,kBAAA;AAAA,UAM5C,mBAAA;EAYa;;;EAR5B,WAAA,EAAa,gBAAA;EASJ;;;EAJT,SAAA,EAAW,cAAc;AAAA;AAAA,cAGd,gBAAA,SAAyB,KAAK;EAAA,SAChC,MAAA;IAAA,SACE,KAAA;IAAA,SACA,MAAA;EAAA;cAEC,KAAA,UAAe,MAAA;AAAA;AAAA,cAMhB,cAAA,SAAuB,KAAK;EAAA,SAC9B,MAAA;IAAA,SACE,KAAA;IAAA,SACA,MAAA;EAAA;cAEC,KAAA,UAAe,MAAA;AAAA;;AAAc;AAS3C;iBAAgB,kBAAA,CACd,IAAA,EAAM,WAAA,EACN,KAAA,EAAO,KAAA,CAAM,kBAAA;AAAA,cAkET,wBAAA,EAA0B,sBAAsB,CAAC,kBAAA;;;;;;;;;;;;AAlErB;AA2CjC;cAyCY,oBAAA,SAA6B,wBAAwB;;AAlBO;AAkBzE;iBAOgB,4BAAA,CAAA;AAAA,UC1KC,oBAAA;EDQkB;;;;;ECFjC,QAAQ;AAAA;ADsBG;AAMb;;AANa,cCRA,+BAAA,EAAiC,gBAAgB,CAAC,oBAAA;;ADcgB;AAM/E;iBCbgB,oBAAA,CACd,IAAA,EAAM,WAAA,EACN,KAAA,EAAO,KAAA,CAAM,oBAAA;AAAA,cA2ET,0BAAA,EAA4B,sBAAsB,CAAC,oBAAA;;;;;;cAU5C,sBAAA,SAA+B,0BAA0B;AD9DtE;;;AAAA,iBCqEgB,8BAAA,CAAA"}
package/dist/resizable.js CHANGED
@@ -36,9 +36,6 @@ const ResizableRootPropsDeclaration = defineProps({
36
36
  type: "json"
37
37
  }
38
38
  });
39
- /**
40
- * @public
41
- */
42
39
  var ResizeStartEvent = class extends Event {
43
40
  constructor(width, height) {
44
41
  super("resizeStart");
@@ -48,9 +45,6 @@ var ResizeStartEvent = class extends Event {
48
45
  };
49
46
  }
50
47
  };
51
- /**
52
- * @public
53
- */
54
48
  var ResizeEndEvent = class extends Event {
55
49
  constructor(width, height) {
56
50
  super("resizeEnd");
@@ -1 +1 @@
1
- {"version":3,"file":"resizable.js","names":[],"sources":["../src/utils/is-finite-positive-number.ts","../src/components/resizable/context.ts","../src/components/resizable/resizable-root.ts","../src/components/resizable/calc-resize.ts","../src/components/resizable/resizable-handle.ts"],"sourcesContent":["export function isFinitePositiveNumber(value: unknown): value is number {\n return typeof value === 'number' && Number.isFinite(value) && value > 0\n}\n","import { createContext, type Context } from '@aria-ui/core'\n\n/**\n * @internal\n */\nexport const onResizeContext: Context<OnResize> = createContext<OnResize>(\n 'prosekit/resizable/onResize',\n)\n\n/**\n * @internal\n */\nexport const onResizeStartContext: Context<OnResizeStart> = createContext<OnResizeStart>(\n 'prosekit/resizable/onResizeStart',\n)\n\n/**\n * @internal\n */\nexport const onResizeEndContext: Context<OnResizeEnd> = createContext<OnResizeEnd>(\n 'prosekit/resizable/onResizeEnd',\n)\n\n/**\n * @internal\n */\nexport type OnResize = ((width: number, height: number) => void) | null\n\n/**\n * @internal\n */\nexport type OnResizeStart =\n | (() => readonly [width: number, height: number, aspectRatio: number])\n | null\n\n/**\n * @internal\n */\nexport type OnResizeEnd = (() => void) | null\n","import type { HostElement, HostElementConstructor, PropsDeclaration } from '@aria-ui/core'\nimport { createSignal, defineCustomElement, defineProps, registerCustomElement, useEffect, type State } from '@aria-ui/core'\nimport { useAttribute } from '@aria-ui/utils'\n\nimport { isFinitePositiveNumber } from '../../utils/is-finite-positive-number.ts'\n\nimport {\n onResizeContext,\n onResizeEndContext,\n onResizeStartContext,\n type OnResize,\n type OnResizeEnd,\n type OnResizeStart,\n} from './context.ts'\n\n/**\n * @public\n */\nexport interface ResizableRootProps {\n /**\n * The width of the resizable element.\n *\n * @default null\n */\n width: number | null\n\n /**\n * The height of the resizable element.\n *\n * @default null\n */\n height: number | null\n\n /**\n * The aspect ratio of the resizable element.\n *\n * @default null\n */\n aspectRatio: number | null\n}\n\n/**\n * @internal\n */\nexport const ResizableRootPropsDeclaration: PropsDeclaration<ResizableRootProps> = defineProps<ResizableRootProps>({\n width: { default: null, attribute: 'data-width', type: 'json' },\n height: { default: null, attribute: 'data-height', type: 'json' },\n aspectRatio: { default: null, attribute: 'data-aspect-ratio', type: 'json' },\n})\n\n/**\n * @public\n */\nexport interface ResizableRootEvents {\n /**\n * Emitted when a resize operation starts.\n */\n resizeStart: ResizeStartEvent\n\n /**\n * Emitted when a resize operation ends.\n */\n resizeEnd: ResizeEndEvent\n}\n\n/**\n * @public\n */\nexport class ResizeStartEvent extends Event {\n readonly detail: {\n readonly width: number\n readonly height: number\n }\n constructor(width: number, height: number) {\n super('resizeStart')\n this.detail = { width, height }\n }\n}\n\n/**\n * @public\n */\nexport class ResizeEndEvent extends Event {\n readonly detail: {\n readonly width: number\n readonly height: number\n }\n constructor(width: number, height: number) {\n super('resizeEnd')\n this.detail = { width, height }\n }\n}\n\n/**\n * @internal\n */\nexport function setupResizableRoot(\n host: HostElement,\n props: State<ResizableRootProps>,\n): void {\n const resizing = createSignal(false)\n\n const onResizeStart: OnResizeStart = () => {\n const { width, height } = host.getBoundingClientRect()\n\n let aspectRatio: number = props.aspectRatio.get() ?? width / height\n\n if (!isFinitePositiveNumber(aspectRatio)) {\n aspectRatio = 0\n }\n\n resizing.set(true)\n host.dispatchEvent(new ResizeStartEvent(width, height))\n return [width, height, aspectRatio]\n }\n\n const onResize: OnResize = (width, height) => {\n props.width.set(width)\n props.height.set(height)\n }\n\n const onResizeEnd: OnResizeEnd = () => {\n const { width, height } = host.getBoundingClientRect()\n resizing.set(false)\n host.dispatchEvent(new ResizeEndEvent(width, height))\n }\n\n onResizeStartContext.provide(host, onResizeStart)\n onResizeContext.provide(host, onResize)\n onResizeEndContext.provide(host, onResizeEnd)\n\n useEffect(host, () => {\n updateResizableRootStyles(\n host,\n Math.max(props.width.get() || 0, 1),\n Math.max(props.height.get() || 0, 1),\n props.aspectRatio.get(),\n )\n })\n\n useAttribute(host, 'data-resizing', () => (resizing.get() ? '' : undefined))\n}\n\nfunction updateResizableRootStyles(\n host: HostElement,\n width: number,\n height: number,\n aspectRatio: number | null,\n) {\n host.style.width = isFinitePositiveNumber(width) ? `${width}px` : ''\n\n host.style.height = isFinitePositiveNumber(height) ? `${height}px` : ''\n\n if (isFinitePositiveNumber(aspectRatio)) {\n host.style.aspectRatio = `${aspectRatio}`\n\n if (width && width > 0 && aspectRatio >= 1) {\n host.style.height = 'auto'\n } else if (height && height > 0 && aspectRatio <= 1) {\n host.style.width = 'min-content'\n }\n }\n}\n\nconst ResizableRootElementBase: HostElementConstructor<ResizableRootProps> = defineCustomElement(\n setupResizableRoot,\n ResizableRootPropsDeclaration,\n)\n\n/**\n * `<prosekit-resizable-root>` custom element.\n *\n * Properties: {@link ResizableRootProps}\n *\n * Events: {@link ResizableRootEvents}\n *\n * Data attributes:\n *\n * | Attribute | Description |\n * | --- | --- |\n * | `data-resizing` | Present when the element is being resized |\n */\nexport class ResizableRootElement extends ResizableRootElementBase {}\n\nlet isResizableRootRegistered = false\n\n/**\n * @internal\n */\nexport function registerResizableRootElement(): void {\n if (isResizableRootRegistered) return\n isResizableRootRegistered = true\n registerCustomElement('prosekit-resizable-root', ResizableRootElement)\n}\n","import { isFinitePositiveNumber } from '../../utils/is-finite-positive-number.ts'\n\nexport function calcResize(\n position:\n | 'top'\n | 'right'\n | 'bottom'\n | 'left'\n | 'top-left'\n | 'top-right'\n | 'bottom-left'\n | 'bottom-right',\n w: number,\n h: number,\n dx: number,\n dy: number,\n aspectRatio: number | null | undefined,\n): [w: number, h: number] {\n aspectRatio = aspectRatio ? aspectRatio : w / h\n aspectRatio = isFinitePositiveNumber(aspectRatio) ? aspectRatio : 1\n\n switch (position) {\n case 'bottom-right':\n return clamp(calcBottomRightResize(w, h, dx, dy, aspectRatio))\n case 'bottom-left':\n return clamp(calcBottomLeftResize(w, h, dx, dy, aspectRatio))\n case 'top-right':\n return clamp(calcTopRightResize(w, h, dx, dy, aspectRatio))\n case 'top-left':\n return clamp(calcTopLeftResize(w, h, dx, dy, aspectRatio))\n case 'top':\n return clamp(calcTopResize(w, h, dx, dy, aspectRatio))\n case 'right':\n return clamp(calcRightResize(w, h, dx, dy, aspectRatio))\n case 'bottom':\n return clamp(calcBottomResize(w, h, dx, dy, aspectRatio))\n case 'left':\n return clamp(calcLeftResize(w, h, dx, dy, aspectRatio))\n default:\n throw new RangeError(`Invalid position: ${position}`)\n }\n}\n\ntype CalcResize = (\n w: number,\n h: number,\n dx: number,\n dy: number,\n aspectRatio: number,\n) => [w: number, h: number]\n\nconst calcBottomRightResize: CalcResize = (w, h, dx, dy, r) => {\n w += dx\n h += dy\n\n const sum = w + h\n h = sum / (r + 1)\n w = sum - h\n return [w, h]\n}\n\nconst calcBottomLeftResize: CalcResize = (w, h, dx, dy, r) => {\n w -= dx\n h += dy\n\n const sum = w + h\n h = sum / (r + 1)\n w = sum - h\n return [w, h]\n}\n\nconst calcTopRightResize: CalcResize = (w, h, dx, dy, r) => {\n w += dx\n h -= dy\n\n const sum = w + h\n h = sum / (r + 1)\n w = sum - h\n return [w, h]\n}\n\nconst calcTopLeftResize: CalcResize = (w, h, dx, dy, r) => {\n w -= dx\n h -= dy\n\n const sum = w + h\n h = sum / (r + 1)\n w = sum - h\n return [w, h]\n}\n\nconst calcTopResize: CalcResize = (w, h, dx, dy, r) => {\n h -= dy\n w = h * r\n return [w, h]\n}\n\nconst calcRightResize: CalcResize = (w, h, dx, dy, r) => {\n w += dx\n h = w / r\n return [w, h]\n}\n\nconst calcBottomResize: CalcResize = (w, h, dx, dy, r) => {\n h += dy\n w = h * r\n return [w, h]\n}\n\nconst calcLeftResize: CalcResize = (w, h, dx, dy, r) => {\n w -= dx\n h = w / r\n return [w, h]\n}\n\nfunction clamp([w, h]: [number, number]): [number, number] {\n return [\n Math.max(w, 1),\n Math.max(h, 1),\n ]\n}\n","import type { HostElement, HostElementConstructor, PropsDeclaration } from '@aria-ui/core'\nimport { createSignal, defineCustomElement, defineProps, registerCustomElement, useEffect, type State } from '@aria-ui/core'\nimport { getWindow } from '@ocavue/utils'\n\nimport { calcResize } from './calc-resize.ts'\nimport { onResizeContext, onResizeEndContext, onResizeStartContext } from './context.ts'\n\n/**\n * @public\n */\nexport interface ResizableHandleProps {\n /**\n * The position of the handle.\n *\n * @default \"bottom-right\"\n */\n position:\n | 'top'\n | 'right'\n | 'bottom'\n | 'left'\n | 'top-left'\n | 'top-right'\n | 'bottom-left'\n | 'bottom-right'\n}\n\n/**\n * @internal\n */\nexport const ResizableHandlePropsDeclaration: PropsDeclaration<ResizableHandleProps> = defineProps<ResizableHandleProps>({\n position: { default: 'bottom-right', attribute: 'position', type: 'string' },\n})\n\n/**\n * @internal\n */\nexport function setupResizableHandle(\n host: HostElement,\n props: State<ResizableHandleProps>,\n): void {\n const getOnResize = onResizeContext.consume(host)\n const getOnResizeStart = onResizeStartContext.consume(host)\n const getOnResizeEnd = onResizeEndContext.consume(host)\n\n let startX = 0\n let startY = 0\n let width = 0\n let height = 0\n let aspectRatio = 1\n\n const pointerPressing = createSignal(false)\n\n const handlePointerDown = (event: PointerEvent) => {\n event.preventDefault()\n pointerPressing.set(true)\n\n startX = event.x\n startY = event.y\n\n const size = getOnResizeStart()?.()\n if (size) {\n ;[width, height, aspectRatio] = size\n }\n }\n\n const handlePointerMove = (event: PointerEvent) => {\n event.preventDefault()\n\n const dx = event.x - startX\n const dy = event.y - startY\n\n const [w, h] = calcResize(\n props.position.get(),\n width,\n height,\n dx,\n dy,\n aspectRatio,\n )\n\n getOnResize()?.(w, h)\n }\n\n const handlePointerUp = (event: PointerEvent) => {\n event.preventDefault()\n pointerPressing.set(false)\n\n getOnResizeEnd()?.()\n }\n\n useEffect(host, () => {\n host.addEventListener('pointerdown', handlePointerDown)\n return () => {\n host.removeEventListener('pointerdown', handlePointerDown)\n }\n })\n\n useEffect(host, () => {\n if (!pointerPressing.get()) {\n return\n }\n\n const win = getWindow(host)\n\n win.addEventListener('pointermove', handlePointerMove)\n win.addEventListener('pointerup', handlePointerUp)\n return () => {\n win.removeEventListener('pointermove', handlePointerMove)\n win.removeEventListener('pointerup', handlePointerUp)\n }\n })\n}\n\nconst ResizableHandleElementBase: HostElementConstructor<ResizableHandleProps> = defineCustomElement(\n setupResizableHandle,\n ResizableHandlePropsDeclaration,\n)\n\n/**\n * `<prosekit-resizable-handle>` custom element.\n *\n * Properties: {@link ResizableHandleProps}\n */\nexport class ResizableHandleElement extends ResizableHandleElementBase {}\n\nlet isResizableHandleRegistered = false\n\n/**\n * @internal\n */\nexport function registerResizableHandleElement(): void {\n if (isResizableHandleRegistered) return\n isResizableHandleRegistered = true\n registerCustomElement('prosekit-resizable-handle', ResizableHandleElement)\n}\n"],"mappings":";;;AAAA,SAAgB,uBAAuB,OAAiC;AACtE,QAAO,OAAO,UAAU,Y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AAgB,IAAI,MAAM;AAE1B,kBAAgB,IAAI;;AAGtB,WAAU,YAAY;AACpB,OAAK,iBAAiB,eAAe,kBAAkB;AACvD,eAAa;AACX,QAAK,oBAAoB,eAAe,kBAAkB;;GAE5D;AAEF,WAAU,YAAY;AACpB,MAAI,CAAC,gBAAgB,KAAK,CACxB;EAGF,MAAM,MAAM,UAAU,KAAK;AAE3B,MAAI,iBAAiB,eAAe,kBAAkB;AACtD,MAAI,iBAAiB,aAAa,gBAAgB;AAClD,eAAa;AACX,OAAI,oBAAoB,eAAe,kBAAkB;AACzD,OAAI,oBAAoB,aAAa,gBAAgB;;GAEvD;;AAGJ,MAAM,6BAA2E,oBAC/E,sBACA,gCACD;;;;;;AAOD,IAAa,yBAAb,cAA4C,2BAA2B;AAEvE,IAAI,8BAA8B;;;;AAKlC,SAAgB,iCAAuC;AACrD,KAAI,4BAA6B;AACjC,+BAA8B;AAC9B,uBAAsB,6BAA6B,uBAAuB"}
1
+ {"version":3,"file":"resizable.js","names":[],"sources":["../src/utils/is-finite-positive-number.ts","../src/components/resizable/context.ts","../src/components/resizable/resizable-root.ts","../src/components/resizable/calc-resize.ts","../src/components/resizable/resizable-handle.ts"],"sourcesContent":["export function isFinitePositiveNumber(value: unknown): value is number {\n return typeof value === 'number' && Number.isFinite(value) && value > 0\n}\n","import { createContext, type Context } from '@aria-ui/core'\n\n/**\n * @internal\n */\nexport const onResizeContext: Context<OnResize> = createContext<OnResize>(\n 'prosekit/resizable/onResize',\n)\n\n/**\n * @internal\n */\nexport const onResizeStartContext: Context<OnResizeStart> = createContext<OnResizeStart>(\n 'prosekit/resizable/onResizeStart',\n)\n\n/**\n * @internal\n */\nexport const onResizeEndContext: Context<OnResizeEnd> = createContext<OnResizeEnd>(\n 'prosekit/resizable/onResizeEnd',\n)\n\n/**\n * @internal\n */\nexport type OnResize = ((width: number, height: number) => void) | null\n\n/**\n * @internal\n */\nexport type OnResizeStart =\n | (() => readonly [width: number, height: number, aspectRatio: number])\n | null\n\n/**\n * @internal\n */\nexport type OnResizeEnd = (() => void) | null\n","import type { HostElement, HostElementConstructor, PropsDeclaration } from '@aria-ui/core'\nimport { createSignal, defineCustomElement, defineProps, registerCustomElement, useEffect, type State } from '@aria-ui/core'\nimport { useAttribute } from '@aria-ui/utils'\n\nimport { isFinitePositiveNumber } from '../../utils/is-finite-positive-number.ts'\n\nimport {\n onResizeContext,\n onResizeEndContext,\n onResizeStartContext,\n type OnResize,\n type OnResizeEnd,\n type OnResizeStart,\n} from './context.ts'\n\nexport interface ResizableRootProps {\n /**\n * The width of the resizable element.\n *\n * @default null\n */\n width: number | null\n\n /**\n * The height of the resizable element.\n *\n * @default null\n */\n height: number | null\n\n /**\n * The aspect ratio of the resizable element.\n *\n * @default null\n */\n aspectRatio: number | null\n}\n\n/**\n * @internal\n */\nexport const ResizableRootPropsDeclaration: PropsDeclaration<ResizableRootProps> = defineProps<ResizableRootProps>({\n width: { default: null, attribute: 'data-width', type: 'json' },\n height: { default: null, attribute: 'data-height', type: 'json' },\n aspectRatio: { default: null, attribute: 'data-aspect-ratio', type: 'json' },\n})\n\nexport interface ResizableRootEvents {\n /**\n * Emitted when a resize operation starts.\n */\n resizeStart: ResizeStartEvent\n\n /**\n * Emitted when a resize operation ends.\n */\n resizeEnd: ResizeEndEvent\n}\n\nexport class ResizeStartEvent extends Event {\n readonly detail: {\n readonly width: number\n readonly height: number\n }\n constructor(width: number, height: number) {\n super('resizeStart')\n this.detail = { width, height }\n }\n}\n\nexport class ResizeEndEvent extends Event {\n readonly detail: {\n readonly width: number\n readonly height: number\n }\n constructor(width: number, height: number) {\n super('resizeEnd')\n this.detail = { width, height }\n }\n}\n\n/**\n * @internal\n */\nexport function setupResizableRoot(\n host: HostElement,\n props: State<ResizableRootProps>,\n): void {\n const resizing = createSignal(false)\n\n const onResizeStart: OnResizeStart = () => {\n const { width, height } = host.getBoundingClientRect()\n\n let aspectRatio: number = props.aspectRatio.get() ?? width / height\n\n if (!isFinitePositiveNumber(aspectRatio)) {\n aspectRatio = 0\n }\n\n resizing.set(true)\n host.dispatchEvent(new ResizeStartEvent(width, height))\n return [width, height, aspectRatio]\n }\n\n const onResize: OnResize = (width, height) => {\n props.width.set(width)\n props.height.set(height)\n }\n\n const onResizeEnd: OnResizeEnd = () => {\n const { width, height } = host.getBoundingClientRect()\n resizing.set(false)\n host.dispatchEvent(new ResizeEndEvent(width, height))\n }\n\n onResizeStartContext.provide(host, onResizeStart)\n onResizeContext.provide(host, onResize)\n onResizeEndContext.provide(host, onResizeEnd)\n\n useEffect(host, () => {\n updateResizableRootStyles(\n host,\n Math.max(props.width.get() || 0, 1),\n Math.max(props.height.get() || 0, 1),\n props.aspectRatio.get(),\n )\n })\n\n useAttribute(host, 'data-resizing', () => (resizing.get() ? '' : undefined))\n}\n\nfunction updateResizableRootStyles(\n host: HostElement,\n width: number,\n height: number,\n aspectRatio: number | null,\n) {\n host.style.width = isFinitePositiveNumber(width) ? `${width}px` : ''\n\n host.style.height = isFinitePositiveNumber(height) ? `${height}px` : ''\n\n if (isFinitePositiveNumber(aspectRatio)) {\n host.style.aspectRatio = `${aspectRatio}`\n\n if (width && width > 0 && aspectRatio >= 1) {\n host.style.height = 'auto'\n } else if (height && height > 0 && aspectRatio <= 1) {\n host.style.width = 'min-content'\n }\n }\n}\n\nconst ResizableRootElementBase: HostElementConstructor<ResizableRootProps> = defineCustomElement(\n setupResizableRoot,\n ResizableRootPropsDeclaration,\n)\n\n/**\n * `<prosekit-resizable-root>` custom element.\n *\n * Properties: {@link ResizableRootProps}\n *\n * Events: {@link ResizableRootEvents}\n *\n * Data attributes:\n *\n * | Attribute | Description |\n * | --- | --- |\n * | `data-resizing` | Present when the element is being resized |\n */\nexport class ResizableRootElement extends ResizableRootElementBase {}\n\nlet isResizableRootRegistered = false\n\n/**\n * @internal\n */\nexport function registerResizableRootElement(): void {\n if (isResizableRootRegistered) return\n isResizableRootRegistered = true\n registerCustomElement('prosekit-resizable-root', ResizableRootElement)\n}\n","import { isFinitePositiveNumber } from '../../utils/is-finite-positive-number.ts'\n\nexport function calcResize(\n position:\n | 'top'\n | 'right'\n | 'bottom'\n | 'left'\n | 'top-left'\n | 'top-right'\n | 'bottom-left'\n | 'bottom-right',\n w: number,\n h: number,\n dx: number,\n dy: number,\n aspectRatio: number | null | undefined,\n): [w: number, h: number] {\n aspectRatio = aspectRatio ? aspectRatio : w / h\n aspectRatio = isFinitePositiveNumber(aspectRatio) ? aspectRatio : 1\n\n switch (position) {\n case 'bottom-right':\n return clamp(calcBottomRightResize(w, h, dx, dy, aspectRatio))\n case 'bottom-left':\n return clamp(calcBottomLeftResize(w, h, dx, dy, aspectRatio))\n case 'top-right':\n return clamp(calcTopRightResize(w, h, dx, dy, aspectRatio))\n case 'top-left':\n return clamp(calcTopLeftResize(w, h, dx, dy, aspectRatio))\n case 'top':\n return clamp(calcTopResize(w, h, dx, dy, aspectRatio))\n case 'right':\n return clamp(calcRightResize(w, h, dx, dy, aspectRatio))\n case 'bottom':\n return clamp(calcBottomResize(w, h, dx, dy, aspectRatio))\n case 'left':\n return clamp(calcLeftResize(w, h, dx, dy, aspectRatio))\n default:\n throw new RangeError(`Invalid position: ${position}`)\n }\n}\n\ntype CalcResize = (\n w: number,\n h: number,\n dx: number,\n dy: number,\n aspectRatio: number,\n) => [w: number, h: number]\n\nconst calcBottomRightResize: CalcResize = (w, h, dx, dy, r) => {\n w += dx\n h += dy\n\n const sum = w + h\n h = sum / (r + 1)\n w = sum - h\n return [w, h]\n}\n\nconst calcBottomLeftResize: CalcResize = (w, h, dx, dy, r) => {\n w -= dx\n h += dy\n\n const sum = w + h\n h = sum / (r + 1)\n w = sum - h\n return [w, h]\n}\n\nconst calcTopRightResize: CalcResize = (w, h, dx, dy, r) => {\n w += dx\n h -= dy\n\n const sum = w + h\n h = sum / (r + 1)\n w = sum - h\n return [w, h]\n}\n\nconst calcTopLeftResize: CalcResize = (w, h, dx, dy, r) => {\n w -= dx\n h -= dy\n\n const sum = w + h\n h = sum / (r + 1)\n w = sum - h\n return [w, h]\n}\n\nconst calcTopResize: CalcResize = (w, h, dx, dy, r) => {\n h -= dy\n w = h * r\n return [w, h]\n}\n\nconst calcRightResize: CalcResize = (w, h, dx, dy, r) => {\n w += dx\n h = w / r\n return [w, h]\n}\n\nconst calcBottomResize: CalcResize = (w, h, dx, dy, r) => {\n h += dy\n w = h * r\n return [w, h]\n}\n\nconst calcLeftResize: CalcResize = (w, h, dx, dy, r) => {\n w -= dx\n h = w / r\n return [w, h]\n}\n\nfunction clamp([w, h]: [number, number]): [number, number] {\n return [\n Math.max(w, 1),\n Math.max(h, 1),\n ]\n}\n","import type { HostElement, HostElementConstructor, PropsDeclaration } from '@aria-ui/core'\nimport { createSignal, defineCustomElement, defineProps, registerCustomElement, useEffect, type State } from '@aria-ui/core'\nimport { getWindow } from '@ocavue/utils'\n\nimport { calcResize } from './calc-resize.ts'\nimport { onResizeContext, onResizeEndContext, onResizeStartContext } from './context.ts'\n\nexport interface ResizableHandleProps {\n /**\n * The position of the handle.\n *\n * @default \"bottom-right\"\n */\n position:\n | 'top'\n | 'right'\n | 'bottom'\n | 'left'\n | 'top-left'\n | 'top-right'\n | 'bottom-left'\n | 'bottom-right'\n}\n\n/**\n * @internal\n */\nexport const ResizableHandlePropsDeclaration: PropsDeclaration<ResizableHandleProps> = defineProps<ResizableHandleProps>({\n position: { default: 'bottom-right', attribute: 'position', type: 'string' },\n})\n\n/**\n * @internal\n */\nexport function setupResizableHandle(\n host: HostElement,\n props: State<ResizableHandleProps>,\n): void {\n const getOnResize = onResizeContext.consume(host)\n const getOnResizeStart = onResizeStartContext.consume(host)\n const getOnResizeEnd = onResizeEndContext.consume(host)\n\n let startX = 0\n let startY = 0\n let width = 0\n let height = 0\n let aspectRatio = 1\n\n const pointerPressing = createSignal(false)\n\n const handlePointerDown = (event: PointerEvent) => {\n event.preventDefault()\n pointerPressing.set(true)\n\n startX = event.x\n startY = event.y\n\n const size = getOnResizeStart()?.()\n if (size) {\n ;[width, height, aspectRatio] = size\n }\n }\n\n const handlePointerMove = (event: PointerEvent) => {\n event.preventDefault()\n\n const dx = event.x - startX\n const dy = event.y - startY\n\n const [w, h] = calcResize(\n props.position.get(),\n width,\n height,\n dx,\n dy,\n aspectRatio,\n )\n\n getOnResize()?.(w, h)\n }\n\n const handlePointerUp = (event: PointerEvent) => {\n event.preventDefault()\n pointerPressing.set(false)\n\n getOnResizeEnd()?.()\n }\n\n useEffect(host, () => {\n host.addEventListener('pointerdown', handlePointerDown)\n return () => {\n host.removeEventListener('pointerdown', handlePointerDown)\n }\n })\n\n useEffect(host, () => {\n if (!pointerPressing.get()) {\n return\n }\n\n const win = getWindow(host)\n\n win.addEventListener('pointermove', handlePointerMove)\n win.addEventListener('pointerup', handlePointerUp)\n return () => {\n win.removeEventListener('pointermove', handlePointerMove)\n win.removeEventListener('pointerup', handlePointerUp)\n }\n })\n}\n\nconst ResizableHandleElementBase: HostElementConstructor<ResizableHandleProps> = defineCustomElement(\n setupResizableHandle,\n ResizableHandlePropsDeclaration,\n)\n\n/**\n * `<prosekit-resizable-handle>` custom element.\n *\n * Properties: {@link ResizableHandleProps}\n */\nexport class ResizableHandleElement extends ResizableHandleElementBase {}\n\nlet isResizableHandleRegistered = false\n\n/**\n * @internal\n */\nexport function registerResizableHandleElement(): void {\n if (isResizableHandleRegistered) return\n isResizableHandleRegistered = true\n registerCustomElement('prosekit-resizable-handle', ResizableHandleElement)\n}\n"],"mappings":";;;AAAA,SAAgB,uBAAuB,OAAiC;CACtE,OAAO,OAAO,UAAU,YAAY,OAAO,SAAS,KAAK,KAAK,QAAQ;AACxE;;;;ACGA,MAAa,kBAAqC,cAChD,6BACF;;;;AAKA,MAAa,uBAA+C,cAC1D,kCACF;;;;AAKA,MAAa,qBAA2C,cACtD,gCACF;;;;ACoBA,MAAa,gCAAsE,YAAgC;CACjH,OAAO;EAAE,SAAS;EAAM,WAAW;EAAc,MAAM;CAAO;CAC9D,QAAQ;EAAE,SAAS;EAAM,W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IAAI,CAAC,gBAAgB,IAAI,GACvB;EAGF,MAAM,MAAM,UAAU,IAAI;EAE1B,IAAI,iBAAiB,eAAe,iBAAiB;EACrD,IAAI,iBAAiB,aAAa,eAAe;EACjD,aAAa;GACX,IAAI,oBAAoB,eAAe,iBAAiB;GACxD,IAAI,oBAAoB,aAAa,eAAe;EACtD;CACF,CAAC;AACH;AAEA,MAAM,6BAA2E,oBAC/E,sBACA,+BACF;;;;;;AAOA,IAAa,yBAAb,cAA4C,2BAA2B,CAAC;AAExE,IAAI,8BAA8B;;;;AAKlC,SAAgB,iCAAuC;CACrD,IAAI,6BAA6B;CACjC,8BAA8B;CAC9B,sBAAsB,6BAA6B,sBAAsB;AAC3E"}
@@ -1 +1 @@
1
- {"version":3,"file":"table-handle.d.ts","names":[],"sources":["../src/components/table-handle/table-handle-column-popup.ts","../src/components/table-handle/shared.ts","../src/components/table-handle/table-handle-column-positioner.ts","../src/components/table-handle/table-handle-column-menu-root.ts","../src/components/table-handle/table-handle-column-menu-trigger.ts","../src/components/table-handle/table-handle-drag-preview.ts","../src/components/table-handle/table-handle-drop-indicator.ts","../src/components/table-handle/table-handle-root.ts","../src/components/table-handle/table-handle-row-popup.ts","../src/components/table-handle/table-handle-row-positioner.ts","../src/components/table-handle/table-handle-row-menu-root.ts","../src/components/table-handle/table-handle-row-menu-trigger.ts"],"mappings":";;;;;;UAaiB,2BAAA;;cAGJ,sCAAA,EAAwC,gBAAA,CAAiB,2BAAA;;iBAKtD,2BAAA,CACd,IAAA,EAAM,WAAA,EACN,MAAA,EAAQ,KAAA,CAAM,2BAAA;AAAA,cAOV,iCAAA,EAAmC,sBAAA,CAAuB,2BAAA;;;;;AAdhE;;;;;AAKA;;cAyBa,6BAAA,SAAsC,iCAAA;;iBAGnC,qCAAA,CAAA;;;;UC1CC,gCAAA,SAAyC,IAAA,CAAK,sBAAA;EDM9C;;;;;AAGjB;ECFE,MAAA,EAAQ,MAAA;;;;ADOV;;;ECCE,KAAA,EAAO,sB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;;cAIA,wCAAA,EAA0C,gBAAA,CAAiB,6BAAA;;iBAQxD,6BAAA,CACd,IAAA,EAAM,WAAA,EACN,KAAA,EAAO,KAAA,CAAM,6BAAA;AAAA,cAcT,mCAAA,EAAqC,sBAAA,CAAuB,6BAAA;;AThClE;;;;;;;;;;;;;;;AAOC;;;cSiDY,+BAAA,SAAwC,mCAAA;AT/BrD;AAAA,iBSkCgB,uCAAA,CAAA;AAAA,UClEC,2BAAA,SAAoC,aAAA;;cAGxC,sCAAA,EAAwC,gBAAA,CAAiB,2BAAA;;iBAKtD,2BAAA,CACd,IAAA,EAAM,WAAA,EACN,KAAA,EAAO,KAAA,CAAM,2BAAA;AAAA,cAaT,iCAAA,EAAmC,sBAAA,CAAuB,2BAAA;;;;AVrBhE;;cU+Ba,6BAAA,SAAsC,iCAAA;;iBAGnC,qCAAA,CAAA;AAAA,KC/BX,sBAAA,GAAyB,UAAA,QAAkB,mBAAA;AAAA,UAE/B,8BAAA;;;AXRjB;;EWaE,MAAA,EAAQ,MAAA,CAAO,sBAAA;AAAA;;cAIJ,yCAAA,EAA2C,gBAAA,CAAiB,8BAAA;;iBAOzD,8BAAA,CACd,IAAA,EAAM,WAAA,EACN,KAAA,EAAO,KAAA,CAAM,8BAAA;AAAA,cAoDT,oCAAA,EAAsC,sBAAA,CAAuB,8BAAA;;AXtEnE;;;;cWgFa,gCAAA,SAAyC,oCAAA;;;;iBAKtC,wCAAA,CAAA"}
1
+ {"version":3,"file":"table-handle.d.ts","names":[],"sources":["../src/components/table-handle/table-handle-column-popup.ts","../src/components/table-handle/shared.ts","../src/components/table-handle/table-handle-column-positioner.ts","../src/components/table-handle/table-handle-column-menu-root.ts","../src/components/table-handle/table-handle-column-menu-trigger.ts","../src/components/table-handle/table-handle-drag-preview.ts","../src/components/table-handle/table-handle-drop-indicator.ts","../src/components/table-handle/table-handle-root.ts","../src/components/table-handle/table-handle-row-popup.ts","../src/components/table-handle/table-handle-row-positioner.ts","../src/components/table-handle/table-handle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