@prosekit/web 0.8.0-beta.5 → 0.8.0-beta.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. package/dist/{prosekit-web-autocomplete.d.ts → autocomplete.d.ts} +1 -1
  2. package/dist/autocomplete.d.ts.map +1 -0
  3. package/dist/{prosekit-web-autocomplete.js → autocomplete.js} +1 -1
  4. package/dist/autocomplete.js.map +1 -0
  5. package/dist/{prosekit-web-block-handle.d.ts → block-handle.d.ts} +1 -1
  6. package/dist/block-handle.d.ts.map +1 -0
  7. package/dist/{prosekit-web-block-handle.js → block-handle.js} +1 -1
  8. package/dist/block-handle.js.map +1 -0
  9. package/dist/{prosekit-web-drop-indicator.d.ts → drop-indicator.d.ts} +1 -1
  10. package/dist/drop-indicator.d.ts.map +1 -0
  11. package/dist/{prosekit-web-drop-indicator.js → drop-indicator.js} +1 -1
  12. package/dist/drop-indicator.js.map +1 -0
  13. package/dist/{prosekit-web.d.ts → index.d.ts} +1 -1
  14. package/dist/index.d.ts.map +1 -0
  15. package/dist/{prosekit-web.js → index.js} +1 -1
  16. package/dist/index.js.map +1 -0
  17. package/dist/{prosekit-web-inline-popover.d.ts → inline-popover.d.ts} +1 -1
  18. package/dist/inline-popover.d.ts.map +1 -0
  19. package/dist/{prosekit-web-inline-popover.js → inline-popover.js} +1 -1
  20. package/dist/inline-popover.js.map +1 -0
  21. package/dist/{prosekit-web-menu.d.ts → menu.d.ts} +1 -1
  22. package/dist/menu.d.ts.map +1 -0
  23. package/dist/{prosekit-web-menu.js → menu.js} +1 -1
  24. package/dist/menu.js.map +1 -0
  25. package/dist/{prosekit-web-popover.d.ts → popover.d.ts} +1 -1
  26. package/dist/popover.d.ts.map +1 -0
  27. package/dist/{prosekit-web-popover.js → popover.js} +1 -1
  28. package/dist/popover.js.map +1 -0
  29. package/dist/{prosekit-web-resizable.d.ts → resizable.d.ts} +1 -1
  30. package/dist/resizable.d.ts.map +1 -0
  31. package/dist/{prosekit-web-resizable.js → resizable.js} +1 -1
  32. package/dist/resizable.js.map +1 -0
  33. package/dist/{prosekit-web-table-handle.d.ts → table-handle.d.ts} +1 -1
  34. package/dist/table-handle.d.ts.map +1 -0
  35. package/dist/{prosekit-web-table-handle.js → table-handle.js} +1 -1
  36. package/dist/table-handle.js.map +1 -0
  37. package/dist/{prosekit-web-tooltip.d.ts → tooltip.d.ts} +1 -1
  38. package/dist/tooltip.d.ts.map +1 -0
  39. package/dist/{prosekit-web-tooltip.js → tooltip.js} +1 -1
  40. package/dist/tooltip.js.map +1 -0
  41. package/package.json +39 -56
  42. package/dist/prosekit-web-autocomplete.d.ts.map +0 -1
  43. package/dist/prosekit-web-autocomplete.js.map +0 -1
  44. package/dist/prosekit-web-block-handle.d.ts.map +0 -1
  45. package/dist/prosekit-web-block-handle.js.map +0 -1
  46. package/dist/prosekit-web-drop-indicator.d.ts.map +0 -1
  47. package/dist/prosekit-web-drop-indicator.js.map +0 -1
  48. package/dist/prosekit-web-inline-popover.d.ts.map +0 -1
  49. package/dist/prosekit-web-inline-popover.js.map +0 -1
  50. package/dist/prosekit-web-menu.d.ts.map +0 -1
  51. package/dist/prosekit-web-menu.js.map +0 -1
  52. package/dist/prosekit-web-popover.d.ts.map +0 -1
  53. package/dist/prosekit-web-popover.js.map +0 -1
  54. package/dist/prosekit-web-resizable.d.ts.map +0 -1
  55. package/dist/prosekit-web-resizable.js.map +0 -1
  56. package/dist/prosekit-web-table-handle.d.ts.map +0 -1
  57. package/dist/prosekit-web-table-handle.js.map +0 -1
  58. package/dist/prosekit-web-tooltip.d.ts.map +0 -1
  59. package/dist/prosekit-web-tooltip.js.map +0 -1
  60. package/dist/prosekit-web.d.ts.map +0 -1
  61. package/dist/prosekit-web.js.map +0 -1
@@ -208,4 +208,4 @@ declare class AutocompleteRootElement extends AutocompleteRootElementBase {}
208
208
  /** @internal */
209
209
  declare function registerAutocompleteRootElement(): void;
210
210
  export { AutocompleteEmptyElement, type AutocompleteEmptyProps, AutocompleteEmptyPropsDeclaration, AutocompleteItemElement, type AutocompleteItemEvents, type AutocompleteItemProps, AutocompleteItemPropsDeclaration, AutocompletePopupElement, type AutocompletePopupEvents, type AutocompletePopupProps, AutocompletePopupPropsDeclaration, AutocompletePositionerElement, type AutocompletePositionerProps, AutocompletePositionerPropsDeclaration, AutocompleteRootElement, type AutocompleteRootEvents, type AutocompleteRootProps, AutocompleteRootPropsDeclaration, OpenChangeEvent, QueryChangeEvent, SelectEvent, ValueChangeEvent, ValuesChangeEvent, registerAutocompleteEmptyElement, registerAutocompleteItemElement, registerAutocompletePopupElement, registerAutocompletePositionerElement, registerAutocompleteRootElement, setupAutocompleteEmpty, setupAutocompleteItem, setupAutocompletePopup, setupAutocompletePositioner, setupAutocompleteRoot };
211
- //# sourceMappingURL=prosekit-web-autocomplete.d.ts.map
211
+ //# sourceMappingURL=autocomplete.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"autocomplete.d.ts","names":[],"sources":["../src/components/autocomplete/autocomplete-empty.ts","../src/components/autocomplete/autocomplete-item.ts","../src/components/autocomplete/autocomplete-popup.ts","../src/components/autocomplete/autocomplete-positioner.ts","../src/components/autocomplete/autocomplete-root.ts"],"mappings":";;;;UAWiB,sBAAA,SAA+B,iBAAA;;cAGnC,iCAAA,EAAmC,gBAAA,CAAiB,sBAAA;;;;iBAOjD,sBAAA,CACd,IAAA,EAAM,WAAA,EACN,KAAA,EAAO,KAAA,CAAM,sBAAA;AAAA,cAKT,4BAAA,EAA8B,sBAAA,CAAuB,sBAAA;;;;;AAP3D;cAiBa,wBAAA,SAAiC,4BAAA;;iBAG9B,gCAAA,CAAA;AAAA,UCzBC,qBAAA,SAA8B,gBAAA;;ADL/C;;;;;AAGA;ECUE,KAAA;AAAA;;cAIW,gCAAA,EAAkC,gBAAA,CAAiB,qBAAA;AAAA,UAO/C,sBAAA,SAA+B,iBAAA;;;;iBAKhC,qBAAA,CACd,IAAA,EAAM,WAAA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gCAAA,EAAkC,gBAAA,CAAiB,qBAAA;;AJ3B/D;;cIsCY,gBAAA,SAAyB,KAAA;EJpCF;;AAUpC;EAVoC,SIwCzB,MAAA;cAEG,KAAA;AAAA;;AJ7Bd;;UIsCiB,sBAAA,SAA+B,iBAAA;EJtCA;;;EI0C9C,UAAA,EAAY,eAAA;EHnEyB;;;EGwErC,WAAA,EAAa,gBAAA;AAAA;;;;iBAkBC,qBAAA,CACd,IAAA,EAAM,WAAA,EACN,KAAA,EAAO,KAAA,CAAM,qBAAA;AAAA,cA8JT,2BAAA,EAA6B,sBAAA,CAAuB,qBAAA;;;;;AHlO1D;;;cG8Oa,uBAAA,SAAgC,2BAAA;;iBAG7B,+BAAA,CAAA"}
@@ -372,4 +372,4 @@ function registerAutocompleteRootElement() {
372
372
  }
373
373
  export { AutocompleteEmptyElement, AutocompleteEmptyPropsDeclaration, AutocompleteItemElement, AutocompleteItemPropsDeclaration, AutocompletePopupElement, AutocompletePopupPropsDeclaration, AutocompletePositionerElement, AutocompletePositionerPropsDeclaration, AutocompleteRootElement, AutocompleteRootPropsDeclaration, OpenChangeEvent, QueryChangeEvent, SelectEvent, ValueChangeEvent, ValuesChangeEvent, registerAutocompleteEmptyElement, registerAutocompleteItemElement, registerAutocompletePopupElement, registerAutocompletePositionerElement, registerAutocompleteRootElement, setupAutocompleteEmpty, setupAutocompleteItem, setupAutocompletePopup, setupAutocompletePositioner, setupAutocompleteRoot };
374
374
 
375
- //# sourceMappingURL=prosekit-web-autocomplete.js.map
375
+ //# sourceMappingURL=autocomplete.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"autocomplete.js","names":[],"sources":["../src/components/autocomplete/autocomplete-empty.ts","../src/utils/prevent-default.ts","../src/components/autocomplete/autocomplete-item.ts","../src/utils/lazy-signal.ts","../src/utils/use-no-focus.ts","../src/components/autocomplete/context.ts","../src/components/autocomplete/autocomplete-popup.ts","../src/components/autocomplete/autocomplete-positioner.ts","../src/utils/event.ts","../src/components/autocomplete/helpers.ts","../src/components/autocomplete/autocomplete-root.ts"],"sourcesContent":["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 { setupListboxEmpty, type ListboxEmptyProps } from '@aria-ui/elements/listbox'\n\nexport interface AutocompleteEmptyProps extends ListboxEmptyProps {}\n\n/** @internal */\nexport const AutocompleteEmptyPropsDeclaration: PropsDeclaration<AutocompleteEmptyProps> = /* @__PURE__ */ defineProps<\n AutocompleteEmptyProps\n>({})\n\n/**\n * @internal\n */\nexport function setupAutocompleteEmpty(\n host: HostElement,\n props: State<AutocompleteEmptyProps>,\n): void {\n setupListboxEmpty(host, props)\n}\n\nconst AutocompleteEmptyElementBase: HostElementConstructor<AutocompleteEmptyProps> = defineCustomElement(\n setupAutocompleteEmpty,\n AutocompleteEmptyPropsDeclaration,\n)\n\n/**\n * `<prosekit-autocomplete-empty>` custom element.\n *\n * Properties: {@link AutocompleteEmptyProps}\n */\nexport class AutocompleteEmptyElement extends AutocompleteEmptyElementBase {}\n\n/** @internal */\nexport function registerAutocompleteEmptyElement(): void {\n registerCustomElement('prosekit-autocomplete-empty', AutocompleteEmptyElement)\n}\n","export function preventDefault(event: Event): void {\n event.preventDefault()\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 { SelectEvent, setupListboxItem, type ListboxItemEvents, type ListboxItemProps } from '@aria-ui/elements/listbox'\nimport { useEventListener } from '@aria-ui/utils'\n\nimport { preventDefault } from '../../utils/prevent-default.ts'\n\nexport { SelectEvent }\n\nexport interface AutocompleteItemProps extends ListboxItemProps {\n /**\n * The value of the item, which will be matched against the query.\n *\n * If not provided, the value is the item's text content.\n *\n * @default \"\"\n */\n value: string\n}\n\n/** @internal */\nexport const AutocompleteItemPropsDeclaration: PropsDeclaration<AutocompleteItemProps> = /* @__PURE__ */ defineProps<AutocompleteItemProps>(\n {\n value: { default: '', attribute: 'value', type: 'string' },\n disabled: { default: false, attribute: 'disabled', type: 'boolean' },\n },\n)\n\nexport interface AutocompleteItemEvents extends ListboxItemEvents {}\n\n/**\n * @internal\n */\nexport function setupAutocompleteItem(\n host: HostElement,\n props: State<AutocompleteItemProps>,\n): void {\n setupListboxItem(host, props)\n\n // Prevent the editor from losing focus\n useEventListener(host, 'pointerdown', preventDefault)\n useEventListener(host, 'mousedown', preventDefault)\n}\n\nconst AutocompleteItemElementBase: HostElementConstructor<AutocompleteItemProps> = defineCustomElement(\n setupAutocompleteItem,\n AutocompleteItemPropsDeclaration,\n)\n\n/**\n * `<prosekit-autocomplete-item>` custom element.\n *\n * Properties: {@link AutocompleteItemProps}\n *\n * Events: {@link AutocompleteItemEvents}\n *\n * Data attributes:\n *\n * | Attribute | Description |\n * | --- | --- |\n * | `data-highlighted` | Present when the item is the currently highlighted option |\n */\nexport class AutocompleteItemElement extends AutocompleteItemElementBase {}\n\n/** @internal */\nexport function registerAutocompleteItemElement(): void {\n registerCustomElement('prosekit-autocomplete-item', AutocompleteItemElement)\n}\n","import type { Signal } from '@aria-ui/core'\n\nexport function createLazySignal<T>(\n getRemote: () => Signal<T> | undefined,\n fallback: T,\n): Signal<T> {\n return {\n get: (): T => {\n const remote = getRemote()\n return remote ? remote.get() : fallback\n },\n set: (value: T): void => {\n const remote = getRemote()\n if (remote) remote.set(value)\n },\n }\n}\n","import { onMount, type HostElement } from '@aria-ui/core'\n\nexport function useNoFocus(host: HostElement): void {\n onMount(host, () => {\n host.tabIndex = -1\n })\n}\n","import { createContext, type Context, type Signal } from '@aria-ui/core'\nimport type { ItemFilter } from '@aria-ui/elements/listbox'\nimport type { OverlayStore } from '@aria-ui/elements/overlay'\n\n/**\n * @internal\n */\nexport interface AutocompleteStore {\n overlayStore: OverlayStore\n query: Signal<string>\n eventTarget: Signal<EventTarget | null>\n filter: Signal<ItemFilter | null>\n}\n\n/**\n * @internal\n */\nexport const autocompleteStoreContext: Context<AutocompleteStore> = createContext<AutocompleteStore>('prosekit-autocomplete-store')\n","import {\n createSignal,\n defineCustomElement,\n defineProps,\n registerCustomElement,\n type HostElement,\n type HostElementConstructor,\n type PropsDeclaration,\n type Signal,\n type State,\n} from '@aria-ui/core'\nimport {\n defaultItemFilter,\n setupListboxRoot,\n type ItemFilter,\n type ListboxRootEvents,\n type ListboxRootProps,\n} from '@aria-ui/elements/listbox'\nimport { OverlayPopupPropsDeclaration, setupOverlayPopup, type OverlayPopupProps } from '@aria-ui/elements/overlay'\n\nimport { createLazySignal } from '../../utils/lazy-signal.ts'\nimport { useNoFocus } from '../../utils/use-no-focus.ts'\n\nimport { autocompleteStoreContext } from './context.ts'\n\n/**\n * @public\n */\nexport interface AutocompletePopupProps extends OverlayPopupProps {}\n\n/**\n * @public\n */\nexport interface AutocompletePopupEvents extends ListboxRootEvents {}\n\n/** @internal */\nexport const AutocompletePopupPropsDeclaration: PropsDeclaration<AutocompletePopupProps> = /* @__PURE__ */ defineProps<\n AutocompletePopupProps\n>(OverlayPopupPropsDeclaration)\n\n/** @internal */\nexport function setupAutocompletePopup(\n host: HostElement,\n _props: State<AutocompletePopupProps>,\n): void {\n const getStore = autocompleteStoreContext.consume(host)\n const getOverlayStore = () => getStore()?.overlayStore\n\n setupOverlayPopup(host, getOverlayStore)\n\n const query = createLazySignal<string>(() => getStore()?.query, ' ')\n const eventTarget = createLazySignal<EventTarget | null>(() => getStore()?.eventTarget, null)\n const filter = createLazySignal<ItemFilter | null>(() => getStore()?.filter, defaultItemFilter)\n const getDisabled = () => (!(getOverlayStore()?.getIsOpen?.()))\n const disabled: Signal<boolean> = { get: getDisabled, set: () => {} }\n const listboxProps = createPopupListboxProps(filter, query, eventTarget, disabled)\n\n setupListboxRoot(host, listboxProps)\n useNoFocus(host)\n}\n\nfunction createPopupListboxProps(\n filter: Signal<ItemFilter | null>,\n query: Signal<string>,\n eventTarget: Signal<EventTarget | null>,\n disabled: Signal<boolean>,\n): State<ListboxRootProps> {\n return {\n value: createSignal(''),\n values: createSignal<string[]>([]),\n multiple: createSignal(false),\n disabled,\n orientation: createSignal<'vertical' | 'horizontal'>('vertical'),\n loop: createSignal(false),\n autoHighlight: createSignal(true),\n query,\n eventTarget,\n filter,\n }\n}\n\nconst AutocompletePopupElementBase: HostElementConstructor<AutocompletePopupProps> = defineCustomElement(\n setupAutocompletePopup,\n AutocompletePopupPropsDeclaration,\n)\n\n/**\n * `<prosekit-autocomplete-popup>` custom element.\n *\n * Properties: {@link AutocompletePopupProps}\n *\n * Events: {@link AutocompletePopupEvents}\n *\n * Data attributes:\n *\n * | Attribute | Description |\n * | --- | --- |\n * | `data-state` | `\"open\"` when the autocomplete is visible, `\"closed\"` otherwise |\n */\nexport class AutocompletePopupElement extends AutocompletePopupElementBase {}\n\n/** @internal */\nexport function registerAutocompletePopupElement(): void {\n registerCustomElement('prosekit-autocomplete-popup', AutocompletePopupElement)\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 { autocompleteStoreContext } from './context.ts'\n\nconst body = typeof document !== 'undefined' && document.querySelector('body')\nconst defaultBoundary = body || 'clippingAncestors'\n\n/**\n * @public\n */\nexport interface AutocompletePositionerProps extends OverlayPositionerProps {\n /**\n * The placement of the popover, relative to the text cursor.\n *\n * @default \"bottom-start\"\n */\n placement: OverlayPositionerProps['placement']\n\n /**\n * The distance between the popover and the hovered block.\n *\n * @default 4\n */\n offset: OverlayPositionerProps['offset']\n\n /**\n * @default true\n */\n inline: OverlayPositionerProps['inline']\n\n /**\n * @default true\n */\n hoist: OverlayPositionerProps['hoist']\n\n /**\n * @default true\n */\n fitViewport: OverlayPositionerProps['fitViewport']\n\n /**\n * @default \"The body element\"\n */\n boundary: OverlayPositionerProps['boundary']\n\n /**\n * @default 8\n */\n overflowPadding: OverlayPositionerProps['overflowPadding']\n}\n\n/** @internal */\nexport const AutocompletePositionerPropsDeclaration: PropsDeclaration<AutocompletePositionerProps> = /* @__PURE__ */ defineProps<\n AutocompletePositionerProps\n>({\n ...OverlayPositionerPropsDeclaration,\n placement: { default: 'bottom-start', attribute: 'placement', type: 'string' },\n offset: { default: 4, attribute: false, type: 'json' },\n inline: { default: true, attribute: 'inline', type: 'boolean' },\n hoist: { default: true, attribute: 'hoist', type: 'boolean' },\n fitViewport: { default: true, attribute: 'fit-viewport', type: 'boolean' },\n boundary: { default: defaultBoundary, attribute: false, type: 'json' },\n overflowPadding: { default: 8, attribute: 'overflow-padding', type: 'number' },\n})\n\n/** @internal */\nexport function setupAutocompletePositioner(\n host: HostElement,\n props: State<AutocompletePositionerProps>,\n): void {\n const getStore = autocompleteStoreContext.consume(host)\n const getOverlayStore = () => getStore()?.overlayStore\n setupOverlayPositioner(host, props as unknown as State<OverlayPositionerProps>, getOverlayStore)\n}\n\nconst AutocompletePositionerElementBase: HostElementConstructor<AutocompletePositionerProps> = defineCustomElement(\n setupAutocompletePositioner,\n AutocompletePositionerPropsDeclaration,\n)\n\n/**\n * `<prosekit-autocomplete-positioner>` custom element.\n *\n * Properties: {@link AutocompletePositionerProps}\n *\n * Data attributes:\n *\n * | Attribute | Description |\n * | --- | --- |\n * | `data-state` | `\"open\"` when the autocomplete 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 AutocompletePositionerElement extends AutocompletePositionerElementBase {}\n\n/** @internal */\nexport function registerAutocompletePositionerElement(): void {\n registerCustomElement('prosekit-autocomplete-positioner', AutocompletePositionerElement)\n}\n","function cloneKeyboardEvent(source: KeyboardEvent): KeyboardEvent {\n return new KeyboardEvent(source.type, {\n code: source.code,\n key: source.key,\n location: source.location,\n repeat: source.repeat,\n altKey: source.altKey,\n ctrlKey: source.ctrlKey,\n metaKey: source.metaKey,\n shiftKey: source.shiftKey,\n\n view: source.view,\n // internal bridge target; events don't need to bubble\"\n bubbles: false,\n cancelable: true,\n })\n}\n\nexport class KeyboardEventTarget extends EventTarget {\n override dispatchEvent(event: KeyboardEvent): boolean {\n const newEvent = cloneKeyboardEvent(event)\n const result: boolean = super.dispatchEvent(newEvent)\n if (newEvent.defaultPrevented) {\n event.preventDefault()\n }\n return result\n }\n}\n","export function defaultQueryBuilder(match: RegExpExecArray): string {\n return match[0]\n .toLowerCase()\n .replaceAll(/[!\"#$%&'()*+,-./:;<=>?@[\\\\\\]^_`{|}~]/g, '')\n .replaceAll(/\\s\\s+/g, ' ')\n .trim()\n}\n","import {\n createSignal,\n defineCustomElement,\n defineProps,\n registerCustomElement,\n useEffect,\n type HostElement,\n type HostElementConstructor,\n type PropsDeclaration,\n type Signal,\n type State,\n} from '@aria-ui/core'\nimport { defaultItemFilter, type ItemFilter, type ListboxRootEvents } from '@aria-ui/elements/listbox'\nimport { createOverlayStore, OpenChangeEvent, type OverlayStore } from '@aria-ui/elements/overlay'\nimport { useEventListener } from '@aria-ui/utils'\nimport { defineDOMEventHandler, defineKeymap, withPriority, type Editor, type Extension, type Priority } from '@prosekit/core'\nimport { AutocompleteRule, defineAutocomplete, type MatchHandler } from '@prosekit/extensions/autocomplete'\n\nimport { useEditorExtension } from '../../hooks/use-editor-extension.ts'\nimport { KeyboardEventTarget } from '../../utils/event.ts'\nimport { getSafeEditorView } from '../../utils/get-safe-editor-view.ts'\n\nimport { autocompleteStoreContext, type AutocompleteStore } from './context.ts'\nimport { defaultQueryBuilder } from './helpers.ts'\n\nexport { OpenChangeEvent }\n\nexport interface AutocompleteRootProps {\n /**\n * The ProseKit editor instance.\n *\n * @default null\n * @hidden\n */\n editor: Editor | null\n\n /**\n * The regular expression to match the query text to autocomplete.\n *\n * @default null\n */\n regex: RegExp | null\n\n /**\n * The filter function to determine if an item should be shown in the\n * listbox.\n *\n * @default defaultItemFilter\n */\n filter: ItemFilter | null\n}\n\n/** @internal */\nexport const AutocompleteRootPropsDeclaration: PropsDeclaration<AutocompleteRootProps> = /* @__PURE__ */ defineProps<\n AutocompleteRootProps\n>({\n editor: { default: null, attribute: false, type: 'json' },\n regex: { default: null, attribute: false, type: 'json' },\n filter: { default: defaultItemFilter, attribute: false, type: 'json' },\n})\n\n/**\n * @public\n */\nexport class QueryChangeEvent extends Event {\n /**\n * The current query string.\n */\n readonly detail: string\n\n constructor(query: string) {\n super('queryChange', { bubbles: true })\n this.detail = query\n }\n}\n\n/**\n * @public\n */\nexport interface AutocompleteRootEvents extends ListboxRootEvents {\n /**\n * Fired when the open state changes.\n */\n openChange: OpenChangeEvent\n\n /**\n * Fired when the query changes.\n */\n queryChange: QueryChangeEvent\n}\n\ninterface RuleHandlers {\n submit?: VoidFunction\n dismiss?: VoidFunction\n}\n\ninterface AutocompleteRuleDeps {\n reference: Signal<Element | undefined>\n handlers: RuleHandlers\n setQuery: (next: string) => void\n requestOpenChange: (open: boolean) => void\n}\n\n/**\n * @internal\n */\nexport function setupAutocompleteRoot(\n host: HostElement,\n props: State<AutocompleteRootProps>,\n): void {\n const getEditor = props.editor.get\n\n const reference = createSignal<Element | undefined>(undefined)\n const open = createSignal(false)\n const query = createSignal('')\n const keyboardTarget = new KeyboardEventTarget()\n const eventTarget = createSignal<EventTarget | null>(keyboardTarget)\n const handlers: RuleHandlers = {}\n\n // Create overlay store for positioning. The open state is managed by the\n // overlay store via requestOpenChange(), which dispatches OpenChangeEvent and\n // updates the open signal.\n const overlayStore: OverlayStore = createOverlayStore(\n open.get,\n open.set,\n () => false,\n () => false,\n (event) => host.dispatchEvent(event),\n )\n\n useEffect(host, () => {\n overlayStore.setAnchorElement(reference.get())\n })\n\n const autocompleteStore: AutocompleteStore = {\n overlayStore,\n query,\n eventTarget,\n filter: props.filter,\n }\n\n autocompleteStoreContext.provide(host, autocompleteStore)\n\n useEventListener(host, 'valueChange', () => {\n handlers.submit?.()\n })\n\n useKeyboardBridge(host, getEditor, open.get, keyboardTarget)\n\n useEscapeKeydown(host, getEditor, () => {\n if (!open.get() || !handlers.dismiss) return false\n handlers.dismiss()\n return true\n })\n\n const setQuery = (next: string): void => {\n if (query.get() === next) return\n query.set(next)\n host.dispatchEvent(new QueryChangeEvent(next))\n }\n\n useAutocompleteExtension(host, getEditor, props.regex.get, {\n reference,\n handlers,\n setQuery,\n requestOpenChange: (open) => overlayStore.requestOpenChange(open),\n })\n}\n\nconst EVENT_KEYS = [\n 'ArrowDown',\n 'ArrowRight',\n 'ArrowUp',\n 'ArrowLeft',\n 'Home',\n 'End',\n 'Enter',\n] as const\n\nfunction useKeyboardBridge(\n host: HostElement,\n getEditor: () => Editor | null,\n getOpen: () => boolean,\n target: EventTarget,\n): void {\n const extension: Extension = defineDOMEventHandler('keydown', (view, event): boolean => {\n if (\n view.composing\n || event.defaultPrevented\n || !getOpen()\n || !EVENT_KEYS.includes(event.key as (typeof EVENT_KEYS)[number])\n ) {\n return false\n }\n target.dispatchEvent(event)\n return event.defaultPrevented\n })\n useEditorExtension(host, getEditor, withPriority(extension, 4 satisfies typeof Priority.highest))\n}\n\nfunction useAutocompleteExtension(\n host: HostElement,\n getEditor: () => Editor | null,\n getRegex: () => RegExp | null,\n deps: AutocompleteRuleDeps,\n) {\n useEffect(host, () => {\n const editor = getEditor()\n const regex = getRegex()\n\n if (!editor || !regex) {\n return\n }\n\n const rule = createAutocompleteRule(editor, regex, deps)\n const extension = defineAutocomplete(rule)\n return editor.use(extension)\n })\n}\n\nfunction createAutocompleteRule(\n editor: Editor,\n regex: RegExp,\n deps: AutocompleteRuleDeps,\n) {\n const { reference, handlers, setQuery, requestOpenChange } = deps\n\n const handleEnter: MatchHandler = (options) => {\n const view = getSafeEditorView(editor)\n const span = view?.dom.querySelector('.prosekit-autocomplete-match')\n\n if (span) {\n reference.set(span)\n }\n\n handlers.submit = options.deleteMatch\n handlers.dismiss = options.ignoreMatch\n setQuery(defaultQueryBuilder(options.match))\n requestOpenChange(true)\n }\n\n const handleLeave = () => {\n reference.set(undefined)\n setQuery('')\n handlers.submit = undefined\n handlers.dismiss = undefined\n requestOpenChange(false)\n }\n\n return new AutocompleteRule({\n regex,\n onEnter: handleEnter,\n onLeave: handleLeave,\n })\n}\n\nfunction useEscapeKeydown(\n host: HostElement,\n getEditor: () => Editor | null,\n handler: () => boolean,\n): void {\n const keymap = { Escape: handler }\n const extension = withPriority(defineKeymap(keymap), 4 satisfies typeof Priority.highest)\n useEditorExtension(host, getEditor, extension)\n}\n\nconst AutocompleteRootElementBase: HostElementConstructor<AutocompleteRootProps> = defineCustomElement(\n setupAutocompleteRoot,\n AutocompleteRootPropsDeclaration,\n)\n\n/**\n * `<prosekit-autocomplete-root>` custom element.\n *\n * Properties: {@link AutocompleteRootProps}\n *\n * Events: {@link AutocompleteRootEvents}\n */\nexport class AutocompleteRootElement extends AutocompleteRootElementBase {}\n\n/** @internal */\nexport function registerAutocompleteRootElement(): void {\n registerCustomElement('prosekit-autocomplete-root', AutocompleteRootElement)\n}\n"],"mappings":";;;;;;;;;AAcA,MAAa,oCAA8F,4BAEzG,EAAE,CAAC;;;;AAKL,SAAgB,uBACd,MACA,OACM;AACN,mBAAkB,MAAM,MAAM;;AAGhC,MAAM,+BAA+E,oBACnF,wBACA,kCACD;;;;;;AAOD,IAAa,2BAAb,cAA8C,6BAA6B;;AAG3E,SAAgB,mCAAyC;AACvD,uBAAsB,+BAA+B,yBAAyB;;AC1ChF,SAAgB,eAAe,OAAoB;AACjD,OAAM,gBAAgB;;;AC2BxB,MAAa,mCAA4F,4BACvG;CACE,OAAO;EAAE,SAAS;EAAI,WAAW;EAAS,MAAM;EAAU;CAC1D,UAAU;EAAE,SAAS;EAAO,WAAW;EAAY,MAAM;EAAW;CACrE,CACF;;;;AAOD,SAAgB,sBACd,MACA,O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WAAS,oBAAoB,QAAQ,MAAM,CAAC;AAC5C,oBAAkB,KAAK;;CAGzB,MAAM,oBAAoB;AACxB,YAAU,IAAI,KAAA,EAAU;AACxB,WAAS,GAAG;AACZ,WAAS,SAAS,KAAA;AAClB,WAAS,UAAU,KAAA;AACnB,oBAAkB,MAAM;;AAG1B,QAAO,IAAI,iBAAiB;EAC1B;EACA,SAAS;EACT,SAAS;EACV,CAAC;;AAGJ,SAAS,iBACP,MACA,WACA,SACM;AAGN,oBAAmB,MAAM,WADP,aAAa,aADhB,EAAE,QAAQ,SAAS,CACiB,EAAE,EAAoC,CAC3C;;AAGhD,MAAM,8BAA6E,oBACjF,uBACA,iCACD;;;;;;;;AASD,IAAa,0BAAb,cAA6C,4BAA4B;;AAGzE,SAAgB,kCAAwC;AACtD,uBAAsB,8BAA8B,wBAAwB"}
@@ -192,4 +192,4 @@ declare class BlockHandleRootElement extends BlockHandleRootElementBase {}
192
192
  /** @internal */
193
193
  declare function registerBlockHandleRootElement(): void;
194
194
  export { BlockHandleAddElement, type BlockHandleAddProps, BlockHandleAddPropsDeclaration, BlockHandleDraggableElement, type BlockHandleDraggableProps, BlockHandleDraggablePropsDeclaration, BlockHandlePopupElement, type BlockHandlePopupProps, BlockHandlePopupPropsDeclaration, BlockHandlePositionerElement, type BlockHandlePositionerProps, BlockHandlePositionerPropsDeclaration, BlockHandleRootElement, type BlockHandleRootEvents, type BlockHandleRootProps, BlockHandleRootPropsDeclaration, BlockHandleStateChangeEvent, registerBlockHandleAddElement, registerBlockHandleDraggableElement, registerBlockHandlePopupElement, registerBlockHandlePositionerElement, registerBlockHandleRootElement, setupBlockHandleAdd, setupBlockHandleDraggable, setupBlockHandlePopup, setupBlockHandlePositioner, setupBlockHandleRoot };
195
- //# sourceMappingURL=prosekit-web-block-handle.d.ts.map
195
+ //# sourceMappingURL=block-handle.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"block-handle.d.ts","names":[],"sources":["../src/components/block-handle/block-handle-add.ts","../src/components/block-handle/block-handle-draggable.ts","../src/components/block-handle/block-handle-popup.ts","../src/components/block-handle/block-handle-positioner.ts","../src/components/block-handle/block-handle-root.ts"],"mappings":";;;;;UAciB,mBAAA;;;;AAAjB;;;EAOE,MAAA,EAAQ,MAAA;AAAA;AAIV;AAAA,cAAa,8BAAA,EAAgC,gBAAA,CAAiB,mBAAA;;;;iBAO9C,mBAAA,CACd,IAAA,EAAM,WAAA,EACN,KAAA,EAAO,KAAA,CAAM,mBAAA;AAAA,cAuBT,yBAAA,EAA2B,sBAAA,CAAuB,mBAAA;;;;;;cAU3C,qBAAA,SAA8B,yBAAA;;iBAG3B,6BAAA,CAAA;AAAA,UC7CC,yBAAA;;;;ADXjB;;;ECkBE,MAAA,EAAQ,MAAA;AAAA;ADPV;AAAA,cCWa,oCAAA,EAAsC,gBAAA,CAAiB,yBAAA;;;;iBASpD,yBAAA,CACd,IAAA,EAAM,WAAA,EACN,KAAA,EAAO,KAAA,CAAM,yBAAA;AAAA,cAgGT,+BAAA,EAAiC,sBAAA,CAAuB,yBAAA;;;;;;;;;;;;cAgBjD,2BAAA,SAAoC,+BAAA;ADxGhD;AAAA,iBC2Ge,mCAAA,CAAA;;;;UCnJC,qBAAA,SAA8B,iBAAA;;cAGlC,gCAAA,EAAkC,gBAAA,CAAiB,qBAAA;;iBAGhD,qBAAA,CACd,IAAA,EAAM,WAAA,EACN,MAAA,EAAQ,KAAA,CAAM,qBAAA;AAAA,cAMV,2BAAA,EAA6B,sBAAA,CAAuB,qBAAA;;;;;AFG1D;;;;;;;cEaa,uBAAA,SAAgC,2BAAA;;iBAG7B,+BAAA,CAAA;;;;UC/BC,0BAAA,SAAmC,IAAA,CAAK,sBAAA;EHHrB;;;;AAWpC;EGFE,SAAA,EAAW,SAAA;;;;AHSb;;;EGDE,KAAA;EHGa;;;;EGGb,IAAA;EHJA;;;;EGUA,KAAA;EHTiC;AAqBlC;;;EGNC,IAAA;AAAA;AHkBF;AAAA,cGda,qCAAA,EAAuC,gBAAA,CAAiB,0BAAA;;iBAcrD,0BAAA,CACd,IAAA,EAAM,WAAA,EACN,KAAA,EAAO,KAAA,CAAM,0BAAA;AAAA,cAMT,gCAAA,EAAkC,sBAAA,CAAuB,0BAAA;AHL/D;;;;;;AC7CA;;;;;AAWA;;;;;AASA;;;ADyBA,cG6Ba,4BAAA,SAAqC,gCAAA;;iBAGlC,oCAAA,CAAA;AAAA,UChFC,oBAAA;;;AJRjB;;;;EIeE,MAAA,EAAQ,MAAA;AAAA;;cAIG,+BAAA,EAAiC,gBAAA,CAAiB,oBAAA;;;AJD/D;cIUa,2BAAA,SAAoC,KAAA;;;;EAI/C,MAAA;IAAU,IAAA,EAAM,eAAA;IAAiB,GAAA;EAAA;cACrB,KAAA;IAAS,IAAA,EAAM,eAAA;IAAiB,GAAA;EAAA;AAAA;;AJQ7C;;UICgB,qBAAA;EJCgB;;AAUjC;EIPE,WAAA,EAAa,2BAAA;AAAA;;;AJUf;iBIJgB,oBAAA,CACd,IAAA,EAAM,WAAA,EACN,KAAA,EAAO,KAAA,CAAM,oBAAA;AAAA,cAkCT,0BAAA,EAA4B,sBAAA,CAAuB,oBAAA;;;;AH7EzD;;;;cGyFa,sBAAA,SAA+B,0BAAA;;iBAG5B,8BAAA,CAAA"}
@@ -587,4 +587,4 @@ function registerBlockHandleRootElement() {
587
587
  }
588
588
  export { BlockHandleAddElement, BlockHandleAddPropsDeclaration, BlockHandleDraggableElement, BlockHandleDraggablePropsDeclaration, BlockHandlePopupElement, BlockHandlePopupPropsDeclaration, BlockHandlePositionerElement, BlockHandlePositionerPropsDeclaration, BlockHandleRootElement, BlockHandleRootPropsDeclaration, BlockHandleStateChangeEvent, registerBlockHandleAddElement, registerBlockHandleDraggableElement, registerBlockHandlePopupElement, registerBlockHandlePositionerElement, registerBlockHandleRootElement, setupBlockHandleAdd, setupBlockHandleDraggable, setupBlockHandlePopup, setupBlockHandlePositioner, setupBlockHandleRoot };
589
589
 
590
- //# sourceMappingURL=prosekit-web-block-handle.js.map
590
+ //# sourceMappingURL=block-handle.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"block-handle.js","names":[],"sources":["../src/components/block-handle/context.ts","../src/components/block-handle/block-handle-add.ts","../src/constants.ts","../src/utils/get-client-rect.ts","../src/utils/max-z-index.ts","../src/components/block-handle/set-drag-preview.ts","../src/components/block-handle/block-handle-draggable.ts","../src/components/block-handle/block-handle-popup.ts","../src/components/block-handle/block-handle-positioner.ts","../src/utils/prefers-reduced-motion.ts","../src/components/block-handle/hover-state.ts","../src/components/block-handle/pointer-move.ts","../src/components/block-handle/use-hover-extension.ts","../src/components/block-handle/block-handle-root.ts"],"sourcesContent":["import { createContext, createSignal, type Context, type Signal } from '@aria-ui/core'\nimport type { OverlayStore } from '@aria-ui/elements/overlay'\n\nimport type { HoverState } from './hover-state.ts'\n\n/**\n * @internal\n */\nexport class BlockHandleStore {\n readonly hoverState: Signal<HoverState | undefined> = createSignal<HoverState | undefined>(undefined)\n readonly dragging: Signal<boolean> = createSignal(false)\n}\n\n/**\n * @internal\n */\nexport const blockHandleStoreContext: Context<BlockHandleStore> = createContext<BlockHandleStore>('prosekit-block-handle-store')\n\n/**\n * @internal\n */\nexport const blockHandleOverlayStoreContext: Context<OverlayStore> = createContext<OverlayStore>('prosekit-block-handle-overlay-store')\n","import {\n defineCustomElement,\n defineProps,\n registerCustomElement,\n type HostElement,\n type HostElementConstructor,\n type PropsDeclaration,\n type State,\n} from '@aria-ui/core'\nimport { useEventListener } from '@aria-ui/utils'\nimport { insertDefaultBlock, type Editor } from '@prosekit/core'\n\nimport { blockHandleStoreContext } from './context.ts'\n\nexport interface BlockHandleAddProps {\n /**\n * The ProseKit editor instance.\n *\n * @default null\n * @hidden\n */\n editor: Editor | null\n}\n\n/** @internal */\nexport const BlockHandleAddPropsDeclaration: PropsDeclaration<BlockHandleAddProps> = /* @__PURE__ */ defineProps<BlockHandleAddProps>({\n editor: { default: null, attribute: false, type: 'json' },\n})\n\n/**\n * @internal\n */\nexport function setupBlockHandleAdd(\n host: HostElement,\n props: State<BlockHandleAddProps>,\n): void {\n const getStore = blockHandleStoreContext.consume(host)\n\n useEventListener(host, 'pointerdown', (event) => {\n event.preventDefault()\n\n const store = getStore()\n const editor = props.editor.get()\n const hoverState = store?.hoverState.get()\n if (!editor || !hoverState) {\n return\n }\n\n const { node, pos } = hoverState\n editor.exec(insertDefaultBlock({ pos: pos + node.nodeSize }))\n editor.focus()\n\n // Hide the drag handle\n store?.hoverState.set(undefined)\n })\n}\n\nconst BlockHandleAddElementBase: HostElementConstructor<BlockHandleAddProps> = defineCustomElement(\n setupBlockHandleAdd,\n BlockHandleAddPropsDeclaration,\n)\n\n/**\n * `<prosekit-block-handle-add>` custom element.\n *\n * Properties: {@link BlockHandleAddProps}\n */\nexport class BlockHandleAddElement extends BlockHandleAddElementBase {}\n\n/** @internal */\nexport function registerBlockHandleAddElement(): void {\n registerCustomElement('prosekit-block-handle-add', BlockHandleAddElement)\n}\n","export const DRAGGING_CLASS_NAME = 'prosekit-dragging'\n","interface Rect {\n top: number\n bottom: number\n right: number\n left: number\n}\n\ninterface IncludeExtraOptions {\n top?: boolean\n bottom?: boolean\n right?: boolean\n left?: boolean\n}\n\n/**\n * Similar to `element.getBoundingClientRect`, but handles `display: contents` CSS\n * property and optionally includes margins and outlines.\n */\nexport function getClientRect(element: Element, includeExtra?: IncludeExtraOptions | false): Rect {\n const rect = element.getBoundingClientRect()\n if (rect.width === 0 && rect.height === 0 && rect.x === 0 && rect.y === 0) {\n // Suspiciously rect, probably an element with `display: contents`, in\n // which case `element.getClientRects()` will return an empty array.\n if (element.getClientRects().length === 0) {\n const children = [...element.children]\n const rects = children.map(child => getClientRect(child, includeExtra))\n if (rects.length === 0) {\n return rect\n }\n if (rects.length === 1) {\n return rects[0]\n }\n let { top, bottom, left, right } = rects[0]\n for (let i = 1; i < rects.length; i++) {\n const r = rects[i]\n if (r.top < top) top = r.top\n if (r.bottom > bottom) bottom = r.bottom\n if (r.left < left) left = r.left\n if (r.right > right) right = r.right\n }\n return { top, bottom, left, right }\n }\n }\n return includeExtra ? addExtra(element, rect, includeExtra) : rect\n}\n\nfunction addExtra(element: Element, rect: Rect, options: IncludeExtraOptions): Rect {\n const view = element.ownerDocument?.defaultView\n if (!view) {\n return rect\n }\n\n const style = view.getComputedStyle(element)\n const marginTop = options.top ? Number.parseFloat(style.marginTop) || 0 : 0\n const marginBottom = options.bottom ? Number.parseFloat(style.marginBottom) || 0 : 0\n const marginRight = options.right ? Number.parseFloat(style.marginRight) || 0 : 0\n const marginLeft = options.left ? Number.parseFloat(style.marginLeft) || 0 : 0\n\n const outlineWidth = Number.parseFloat(style.outlineWidth) || 0\n const outlineOffset = Number.parseFloat(style.outlineOffset) || 0\n const outline = Math.max(outlineWidth + outlineOffset, 0)\n const outlineTop = options.top ? outline : 0\n const outlineBottom = options.bottom ? outline : 0\n const outlineRight = options.right ? outline : 0\n const outlineLeft = options.left ? outline : 0\n\n return {\n top: rect.top - Math.max(marginTop, outlineTop),\n bottom: rect.bottom + Math.max(marginBottom, outlineBottom),\n right: rect.right + Math.max(marginRight, outlineRight),\n left: rect.left - Math.max(marginLeft, outlineLeft),\n }\n}\n","// Maximum possible z-index\n// https://stackoverflow.com/questions/491052/minimum-and-maximum-value-of-z-index\nexport const maxZIndex = '2147483647'\n","import { DRAGGING_CLASS_NAME } from '../../constants.ts'\nimport { assignStyles } from '../../utils/assign-styles.ts'\nimport { getClientRect } from '../../utils/get-client-rect.ts'\nimport { maxZIndex } from '../../utils/max-z-index.ts'\n\n/**\n * Sets a drag preview image for the given element and ensures the preview position\n * relative to the pointer is correct.\n *\n * This function does the following:\n *\n * - Creates a temporary container element.\n * - Puts the container at the end of the document body.\n * - Sets event's drag image.\n * - Removes the container from the document body after the next frame.\n */\nexport function setDragPreview(event: DragEvent, element: HTMLElement): void {\n const { top, bottom, left, right } = getClientRect(element, { left: true, right: true, top: true, bottom: true })\n const width = right - left\n const height = bottom - top\n const elementX = left\n const elementY = top\n\n const { clientX, clientY } = event\n\n const document = element.ownerDocument\n\n const container = document.createElement('div')\n\n // Add some class names so that all styles applied to\n // given class names can also be applied to the drag preview.\n container.classList.add('ProseMirror', DRAGGING_CLASS_NAME)\n\n // If outsideX is positive, the point is at the left side of the element.\n const outsideX = Math.round(elementX - clientX)\n // If outsideY is positive, the point is above the element.\n const outsideY = Math.round(elementY - clientY)\n\n const borderX = Math.max(outsideX, 0)\n const borderY = Math.max(outsideY, 0)\n assignStyles(container, {\n // Ensuring we don't cause reflow when adding the element to the page using\n // `position:fixed` rather than `position:absolute` so we are positioned on\n // the current viewport. `position:fixed` also creates a new stacking\n // context, so we don't need to do that here.\n // https://github.com/atlassian/pragmatic-drag-and-drop/blob/56276552/packages/core/src/public-utils/element/custom-native-drag-preview/set-custom-native-drag-preview.ts#L60\n position: 'fixed',\n\n // The element is positioned off-screen to avoid capturing the content of\n // the page on Safari when the dragging element has a transparent background\n // on Safari. See https://github.com/prosekit/prosekit/issues/1153 for more\n // details.\n top: '-1000vh',\n left: '-1000vw',\n\n // The element should not be interactive.\n pointerEvents: 'none',\n\n zIndex: maxZIndex,\n\n // Only reliable cross browser technique found to push a drag preview away\n // from the cursor is to use transparent borders on the container.\n // https://github.com/atlassian/pragmatic-drag-and-drop/blob/56276552/packages/core/src/public-utils/element/custom-native-drag-preview/pointer-outside-of-preview.ts#L13-L18\n borderLeft: `${borderX}px solid transparent`,\n borderTop: `${borderY}px solid transparent`,\n\n boxSizing: 'border-box',\n width: `${width + borderX}px`,\n height: `${height + borderY}px`,\n })\n\n const clonedElement = element.cloneNode(true) as HTMLElement\n\n // A hardcoded opacity.\n clonedElement.style.setProperty('opacity', '0.8', 'important')\n // Hide the outline of the cloned element.\n clonedElement.style.setProperty('outline-color', 'transparent', 'important')\n\n container.appendChild(clonedElement)\n document.body.appendChild(container)\n\n event.dataTransfer?.setDragImage(container, Math.max(-outsideX, 0), Math.max(-outsideY, 0))\n\n requestAnimationFrame(() => {\n container.remove()\n })\n}\n","import {\n defineCustomElement,\n defineProps,\n onMount,\n registerCustomElement,\n type HostElement,\n type HostElementConstructor,\n type PropsDeclaration,\n type State,\n} from '@aria-ui/core'\nimport { useAttribute, useEventListener } from '@aria-ui/utils'\nimport { isHTMLElement } from '@ocavue/utils'\nimport type { Editor } from '@prosekit/core'\nimport type { ViewDragging } from '@prosekit/extensions/drop-indicator'\nimport { Fragment, Slice } from '@prosekit/pm/model'\nimport { NodeSelection } from '@prosekit/pm/state'\nimport type { EditorView } from '@prosekit/pm/view'\n\nimport { DRAGGING_CLASS_NAME } from '../../constants.ts'\nimport { getSafeEditorView } from '../../utils/get-safe-editor-view.ts'\n\nimport { blockHandleStoreContext } from './context.ts'\nimport type { HoverState } from './hover-state.ts'\nimport { setDragPreview } from './set-drag-preview.ts'\n\nexport interface BlockHandleDraggableProps {\n /**\n * The ProseKit editor instance.\n *\n * @default null\n * @hidden\n */\n editor: Editor | null\n}\n\n/** @internal */\nexport const BlockHandleDraggablePropsDeclaration: PropsDeclaration<BlockHandleDraggableProps> = /* @__PURE__ */ defineProps<\n BlockHandleDraggableProps\n>({\n editor: { default: null, attribute: false, type: 'json' },\n})\n\n/**\n * @internal\n */\nexport function setupBlockHandleDraggable(\n host: HostElement,\n props: State<BlockHandleDraggableProps>,\n): void {\n const getStore = blockHandleStoreContext.consume(host)\n\n onMount(host, () => {\n host.draggable = true\n })\n\n usePointerDownHandler(host, () => getStore()?.hoverState.get() ?? null, props.editor.get)\n\n useEventListener(host, 'dragstart', (event) => {\n const store = getStore()\n store?.dragging.set(true)\n\n const view = getSafeEditorView(props.editor.get())\n const hoverState = store?.hoverState.get()\n\n if (view && hoverState) {\n view.dom.classList.add(DRAGGING_CLASS_NAME)\n createDraggingPreview(view, hoverState, event)\n setViewDragging(view, hoverState)\n }\n })\n\n useEventListener(host, 'dragend', () => {\n const store = getStore()\n store?.dragging.set(false)\n\n const view = getSafeEditorView(props.editor.get())\n if (view) {\n view.dom.classList.remove(DRAGGING_CLASS_NAME)\n }\n })\n\n useAttribute(host, 'data-dragging', () => (getStore()?.dragging.get() ? '' : undefined))\n}\n\nfunction usePointerDownHandler(\n host: HostElement,\n getHoverState: () => HoverState | null,\n getEditor: () => Editor | null,\n) {\n useEventListener(host, 'pointerdown', () => {\n const hoverState = getHoverState()\n const editor = getEditor()\n\n if (hoverState?.pos == null || !editor?.view) {\n return\n }\n\n const { view } = editor\n view.dispatch(\n view.state.tr.setSelection(NodeSelection.create(view.state.doc, hoverState.pos)),\n )\n\n // Clicking the handle will blur the editor, so we need to focus it again.\n // We cannot call `event.preventDefault()` here to prevent the blur\n // because it will prevent the drag event from firing.\n requestAnimationFrame(() => {\n view.focus()\n })\n })\n}\n\nfunction createDraggingPreview(view: EditorView, hoverState: HoverState, event: DragEvent): void {\n if (!event.dataTransfer) {\n return\n }\n\n const { pos } = hoverState\n\n const element = view.nodeDOM(pos)\n if (!element || !isHTMLElement(element)) {\n return\n }\n\n event.dataTransfer.clearData()\n event.dataTransfer.setData('text/html', element.outerHTML)\n event.dataTransfer.effectAllowed = 'copyMove'\n setDragPreview(event, element)\n\n return\n}\n\nfunction setViewDragging(view: EditorView, hoverState: HoverState): void {\n const { node, pos } = hoverState\n\n const dragging: ViewDragging = {\n slice: new Slice(Fragment.from(node), 0, 0),\n move: true,\n node: NodeSelection.create(view.state.doc, pos),\n }\n\n view.dragging = dragging\n}\n\nconst BlockHandleDraggableElementBase: HostElementConstructor<BlockHandleDraggableProps> = defineCustomElement(\n setupBlockHandleDraggable,\n BlockHandleDraggablePropsDeclaration,\n)\n\n/**\n * `<prosekit-block-handle-draggable>` custom element.\n *\n * Properties: {@link BlockHandleDraggableProps}\n *\n * Data attributes:\n *\n * | Attribute | Description |\n * | --- | --- |\n * | `data-dragging` | Present when the element is being dragged |\n */\nexport class BlockHandleDraggableElement extends BlockHandleDraggableElementBase {}\n\n/** @internal */\nexport function registerBlockHandleDraggableElement(): void {\n registerCustomElement('prosekit-block-handle-draggable', BlockHandleDraggableElement)\n}\n","import {\n defineCustomElement,\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'\n\nimport { blockHandleOverlayStoreContext } from './context.ts'\n\n/**\n * @public\n */\nexport interface BlockHandlePopupProps extends OverlayPopupProps {}\n\n/** @internal */\nexport const BlockHandlePopupPropsDeclaration: PropsDeclaration<BlockHandlePopupProps> = OverlayPopupPropsDeclaration\n\n/** @internal */\nexport function setupBlockHandlePopup(\n host: HostElement,\n _props: State<BlockHandlePopupProps>,\n): void {\n const getOverlayStore = blockHandleOverlayStoreContext.consume(host)\n setupOverlayPopup(host, getOverlayStore)\n}\n\nconst BlockHandlePopupElementBase: HostElementConstructor<BlockHandlePopupProps> = defineCustomElement(\n setupBlockHandlePopup,\n BlockHandlePopupPropsDeclaration,\n)\n\n/**\n * `<prosekit-block-handle-popup>` custom element.\n *\n * Properties: {@link BlockHandlePopupProps}\n *\n * Data attributes:\n *\n * | Attribute | Description |\n * | --- | --- |\n * | `data-state` | `\"open\"` when the block handle is visible, `\"closed\"` otherwise |\n */\nexport class BlockHandlePopupElement extends BlockHandlePopupElementBase {}\n\n/** @internal */\nexport function registerBlockHandlePopupElement(): void {\n registerCustomElement('prosekit-block-handle-popup', BlockHandlePopupElement)\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'\nimport type { Placement } from '@floating-ui/dom'\n\nimport { blockHandleOverlayStoreContext } from './context.ts'\n\n/**\n * @public\n */\nexport interface BlockHandlePositionerProps extends Omit<OverlayPositionerProps, 'placement' | 'hoist' | 'flip' | 'shift' | 'hide'> {\n /**\n * The placement of the popover, relative to the hovered block.\n *\n * @default \"left\"\n */\n placement: Placement\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 * @default false\n * @hidden\n */\n flip: boolean\n\n /**\n * @default false\n * @hidden\n */\n shift: boolean\n\n /**\n * @default true\n * @hidden\n */\n hide: boolean\n}\n\n/** @internal */\nexport const BlockHandlePositionerPropsDeclaration: PropsDeclaration<BlockHandlePositionerProps> = /* @__PURE__ */ defineProps<\n BlockHandlePositionerProps\n>({\n ...OverlayPositionerPropsDeclaration,\n placement: { default: 'left', attribute: 'placement', type: 'string' },\n // Enabling `hoist` will cause the popover to have a small delay when\n // scrolling the page.\n hoist: { default: false, attribute: 'hoist', type: 'boolean' },\n flip: { default: false, attribute: false, type: 'json' },\n shift: { default: false, attribute: 'shift', type: 'boolean' },\n hide: { default: true, attribute: 'hide', type: 'boolean' },\n})\n\n/** @internal */\nexport function setupBlockHandlePositioner(\n host: HostElement,\n props: State<BlockHandlePositionerProps>,\n): void {\n const getOverlayStore = blockHandleOverlayStoreContext.consume(host)\n setupOverlayPositioner(host, props as unknown as State<OverlayPositionerProps>, getOverlayStore)\n}\n\nconst BlockHandlePositionerElementBase: HostElementConstructor<BlockHandlePositionerProps> = defineCustomElement(\n setupBlockHandlePositioner,\n BlockHandlePositionerPropsDeclaration,\n)\n\n/**\n * `<prosekit-block-handle-positioner>` custom element.\n *\n * Properties: {@link BlockHandlePositionerProps}\n *\n * Data attributes:\n *\n * | Attribute | Description |\n * | --- | --- |\n * | `data-state` | `\"open\"` when the block handle 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 BlockHandlePositionerElement extends BlockHandlePositionerElementBase {}\n\n/** @internal */\nexport function registerBlockHandlePositionerElement(): void {\n registerCustomElement('prosekit-block-handle-positioner', BlockHandlePositionerElement)\n}\n","export function prefersReducedMotion(): boolean {\n if (typeof window === 'undefined') {\n return false\n }\n return window.matchMedia('(prefers-reduced-motion: reduce)').matches\n}\n","import type { ProseMirrorNode } from '@prosekit/pm/model'\n\n/**\n * @internal\n */\nexport interface HoverState {\n node: ProseMirrorNode\n pos: number\n}\n\n/**\n * @internal\n */\nexport function isHoverStateEqual(a: HoverState, b: HoverState): boolean {\n return a.pos === b.pos && a.node.eq(b.node)\n}\n","import type { VirtualElement } from '@floating-ui/dom'\nimport { isElement, isHTMLElement, isTextNode, throttle } from '@ocavue/utils'\nimport { defineDOMEventHandler, union, type PlainExtension } from '@prosekit/core'\nimport type { ProseMirrorNode } from '@prosekit/pm/model'\nimport type { EditorView } from '@prosekit/pm/view'\n\nimport { getClientRect } from '../../utils/get-client-rect.ts'\n\nimport type { HoverState } from './hover-state.ts'\n\nexport type ElementHoverHandler = (\n reference?: VirtualElement,\n hoverState?: HoverState,\n) => void\n\nexport function defineElementHoverHandler(handler: ElementHoverHandler): PlainExtension {\n const handleElement = (\n node: ProseMirrorNode,\n pos: number,\n element: HTMLElement,\n parentElement?: Node | null,\n ) => {\n const reference: VirtualElement = {\n contextElement: element,\n\n getBoundingClientRect: () => {\n const rect = findFirstLineRect(parentElement, element)\n return rect ? fulfillRect(rect) : fallbackRect\n },\n }\n\n handler(reference, { node, pos })\n }\n\n let lastX = -1\n let lastY = -1\n let lastTime = -1\n\n const handlePointerEvent = (view: EditorView, event: PointerEvent) => {\n const { x, y } = event\n\n // Simple performance optimization. If the pointer is not moving, we don't\n // want to recalculate the block handle position within a short period of\n // time window.\n if (lastX === x && lastY === y) {\n const now = Date.now()\n if (now - lastTime < 100) {\n return\n }\n lastTime = now\n }\n lastX = x\n lastY = y\n\n const block = findBlockByCoords(view, x, y)\n if (!block) {\n handler()\n return\n }\n\n const { node, pos } = block\n const element = view.nodeDOM(pos)\n if (!element || !isHTMLElement(element)) {\n handler()\n return\n }\n\n // If `node` is the first child of another non-doc block node, for example a\n // list node or a blockquote node, we want to put the block handle agains\n // the parent node.\n const $pos = view.state.doc.resolve(pos)\n if ($pos.depth > 0 && $pos.index($pos.depth) === 0) {\n const parentPos = $pos.before($pos.depth)\n const parentNode = $pos.parent\n const parentElement = view.nodeDOM(parentPos)\n handleElement(parentNode, parentPos, element, parentElement)\n } else {\n handleElement(node, pos, element)\n }\n }\n\n return union(\n defineDOMEventHandler('pointermove', throttle(handlePointerEvent, 200)),\n defineDOMEventHandler('pointerenter', handlePointerEvent),\n defineDOMEventHandler('pointerout', handlePointerEvent),\n defineDOMEventHandler('keypress', () => handler()),\n )\n}\n\nfunction findBlockByCoords(view: EditorView, x: number, y: number): { node: ProseMirrorNode; pos: number } | undefined {\n const rect = getClientRect(view.dom)\n if (!isWithinRect(rect, x, y)) {\n return\n }\n\n let parent: ProseMirrorNode | undefined = view.state.doc\n let pos = -1\n\n while (parent) {\n if (parent.isBlock && (parent.isTextblock || parent.isAtom || parent.type.spec.isolating)) {\n return { node: parent, pos }\n }\n\n // Collect all children and their positions\n const children: ProseMirrorNode[] = []\n const positions: number[] = []\n parent.forEach((child, offset) => {\n children.push(child)\n positions.push(offset + pos + 1)\n })\n\n let lo = 0\n let hi = children.length - 1\n\n while (lo <= hi) {\n const i = hi - ((hi - lo) >> 1)\n const childDOM = view.nodeDOM(positions[i])\n const childRect = getNodeRect(childDOM)\n if (!childRect) {\n console.warn(`[prosekit] Unable to get rect at position: ${positions[i]}`)\n return\n }\n if (childRect.top > y) {\n hi = i - 1\n } else if (childRect.bottom < y) {\n lo = i + 1\n } else {\n lo = i\n break\n }\n }\n\n if (lo > hi) {\n return\n }\n\n parent = children[lo]\n pos = positions[lo]\n }\n}\n\nfunction getNodeRect(node: Node | null | undefined): Rect | undefined {\n if (node && isElement(node) && node.isConnected) {\n return getClientRect(node)\n }\n}\n\nfunction isWithinRect(rect: Rect, x: number, y: number) {\n return x >= rect.left && x <= rect.right && y >= rect.top && y <= rect.bottom\n}\n\ninterface Rect {\n top: number\n right: number\n bottom: number\n left: number\n}\n\nfunction findFirstLineRect(outer?: Node | null, inner?: Node | null): Rect | undefined {\n if (outer && !outer.isConnected) {\n return\n }\n if (inner && !inner.isConnected) {\n return\n }\n\n if (outer && inner) {\n const outerRect = findOuterRect(outer)\n const innerRect = findFirstLineRectInNode(inner)\n if (outerRect && innerRect) {\n const { top, bottom } = innerRect\n const { left, right } = outerRect\n return { top, bottom, left, right }\n } else {\n return outerRect || innerRect\n }\n } else if (outer) {\n return findFirstLineRectInNode(outer)\n } else if (inner) {\n return findFirstLineRectInNode(inner)\n }\n}\n\nfunction findOuterRect(node: Node): Rect | undefined {\n if (!isElement(node)) {\n return\n }\n\n return getClientRect(node, { left: true, right: true })\n}\n\nfunction findFirstLineRectInNode(node: Node): Rect | undefined {\n if (isElement(node)) {\n return findFirstLineRectInElement(node)\n } else if (isTextNode(node)) {\n return findFirstLineRectInTextNode(node)\n }\n}\n\nfunction findFirstLineRectInTextNode(node: Text): Rect | undefined {\n const ownerDocument = node.ownerDocument\n if (!ownerDocument) {\n return\n }\n const range = ownerDocument.createRange()\n range.setStart(node, 0)\n range.setEnd(node, 0)\n const rects = range.getClientRects()\n return rects[0]\n}\n\nfunction findFirstLineRectInElement(element: Element): Rect | undefined {\n if (element.nodeName === 'BR') {\n return element.getBoundingClientRect()\n }\n\n const rect = getClientRect(element)\n const style = element.ownerDocument.defaultView?.getComputedStyle(element)\n const marginLeft = style && Number.parseInt(style.marginLeft, 10) || 0\n const marginRight = style && Number.parseInt(style.marginRight, 10) || 0\n const left = rect.left - marginLeft\n const right = rect.right + marginRight\n\n const lineHeight = style && Number.parseInt(style.lineHeight, 10) || 24\n const paddingTop = style && Number.parseInt(style.paddingTop, 10) || 0\n const borderTop = style && Number.parseInt(style.borderTopWidth, 10) || 0\n const top = rect.top + paddingTop + borderTop\n const bottom = top + lineHeight\n\n return { top, bottom, left, right }\n}\n\nfunction fulfillRect({ top, right, bottom, left }: Rect) {\n return { top, right, bottom, left, width: right - left, height: bottom - top, x: left, y: top }\n}\n\n// A fallback rect that is far away from the screen. It should not be used through.\nconst fallbackRect = Object.freeze({\n top: -9999,\n right: -9999,\n bottom: -9999,\n left: -9999,\n width: 0,\n height: 0,\n x: -9999,\n y: -9999,\n})\n","import type { HostElement } from '@aria-ui/core'\nimport type { Editor } from '@prosekit/core'\n\nimport { useEditorExtension } from '../../hooks/use-editor-extension.ts'\nimport { prefersReducedMotion } from '../../utils/prefers-reduced-motion.ts'\n\nimport { isHoverStateEqual, type HoverState } from './hover-state.ts'\nimport { defineElementHoverHandler, type ElementHoverHandler } from './pointer-move.ts'\n\nexport function useHoverExtension(\n host: HostElement,\n getEditor: () => Editor | null,\n handler: ElementHoverHandler,\n): void {\n const invalidTimeoutMs = prefersReducedMotion() ? 0 : 180\n\n let invalidTimeoutId: ReturnType<typeof setTimeout> | undefined\n\n let prevHoverState: HoverState | undefined\n\n const callHandler: ElementHoverHandler = (reference, hoverState) => {\n prevHoverState = hoverState\n handler(reference, hoverState)\n }\n\n const extension = defineElementHoverHandler((reference, hoverState) => {\n if (hoverState && invalidTimeoutId != null) {\n clearTimeout(invalidTimeoutId)\n invalidTimeoutId = undefined\n }\n\n if (prevHoverState && hoverState) {\n if (isHoverStateEqual(prevHoverState, hoverState)) {\n return\n }\n callHandler(reference, hoverState)\n return\n }\n\n if (!prevHoverState && !hoverState) {\n return\n }\n\n if (!prevHoverState && hoverState) {\n callHandler(reference, hoverState)\n return\n }\n\n if (prevHoverState && !hoverState) {\n if (invalidTimeoutId != null) {\n return\n }\n\n // Wait for a short period of time before invalidating the hover state.\n // This ensures smoother animation when the pointer moves between two\n // blocks with a small gap.\n invalidTimeoutId = setTimeout(() => {\n callHandler(reference, undefined)\n invalidTimeoutId = undefined\n }, invalidTimeoutMs)\n }\n })\n\n useEditorExtension(host, getEditor, extension)\n}\n","import {\n computed,\n createSignal,\n defineCustomElement,\n defineProps,\n registerCustomElement,\n useEffect,\n type HostElement,\n type HostElementConstructor,\n type PropsDeclaration,\n type State,\n} from '@aria-ui/core'\nimport { createOverlayStore } from '@aria-ui/elements/overlay'\nimport type { VirtualElement } from '@floating-ui/dom'\nimport type { Editor } from '@prosekit/core'\nimport type { ProseMirrorNode } from '@prosekit/pm/model'\n\nimport { useScrolling } from '../../hooks/use-scrolling.ts'\n\nimport { blockHandleOverlayStoreContext, BlockHandleStore, blockHandleStoreContext } from './context.ts'\nimport { useHoverExtension } from './use-hover-extension.ts'\n\nexport interface BlockHandleRootProps {\n /**\n * The ProseKit editor instance.\n *\n * @default null\n * @hidden\n */\n editor: Editor | null\n}\n\n/** @internal */\nexport const BlockHandleRootPropsDeclaration: PropsDeclaration<BlockHandleRootProps> = /* @__PURE__ */ defineProps<\n BlockHandleRootProps\n>({\n editor: { default: null, attribute: false, type: 'json' },\n})\n\n/**\n * @public\n */\nexport class BlockHandleStateChangeEvent extends Event {\n /**\n * The currently hovered block's node and position, or `null` if no block is hovered.\n */\n detail: { node: ProseMirrorNode; pos: number } | null\n constructor(state: { node: ProseMirrorNode; pos: number } | null) {\n super('stateChange', { bubbles: true })\n this.detail = state\n }\n}\n\n/**\n * @public\n */\nexport interface BlockHandleRootEvents {\n /**\n * Fired when the hovered block changes.\n */\n stateChange: BlockHandleStateChangeEvent\n}\n\n/**\n * @internal\n */\nexport function setupBlockHandleRoot(\n host: HostElement,\n props: State<BlockHandleRootProps>,\n): void {\n const getEditor = props.editor.get\n\n const store = new BlockHandleStore()\n blockHandleStoreContext.provide(host, store)\n\n const reference = createSignal<VirtualElement | undefined>(undefined)\n const getScrolling = useScrolling(host)\n\n const getOpen = computed(() => !!store.hoverState.get() && !getScrolling())\n\n const overlayStore = createOverlayStore(\n getOpen,\n () => {},\n () => true,\n () => false,\n (event) => host.dispatchEvent(event),\n )\n\n useHoverExtension(host, getEditor, (ref, hoverState) => {\n reference.set(ref ?? undefined)\n store.hoverState.set(hoverState)\n const state = hoverState ? { node: hoverState.node, pos: hoverState.pos } : null\n host.dispatchEvent(new BlockHandleStateChangeEvent(state))\n })\n\n useEffect(host, () => {\n overlayStore.setAnchorElement(reference.get())\n })\n\n blockHandleOverlayStoreContext.provide(host, overlayStore)\n}\n\nconst BlockHandleRootElementBase: HostElementConstructor<BlockHandleRootProps> = defineCustomElement(\n setupBlockHandleRoot,\n BlockHandleRootPropsDeclaration,\n)\n\n/**\n * `<prosekit-block-handle-root>` custom element.\n *\n * Properties: {@link BlockHandleRootProps}\n *\n * Events: {@link BlockHandleRootEvents}\n */\nexport class BlockHandleRootElement extends BlockHandleRootElementBase {}\n\n/** @internal */\nexport function registerBlockHandleRootElement(): void {\n registerCustomElement('prosekit-block-handle-root', BlockHandleRootElement)\n}\n"],"mappings":";;;;;;;;;;;;;AAQA,IAAa,mBAAb,MAA8B;;oBAC0B,aAAqC,KAAA,EAAU;kBAChE,aAAa,MAAM;;;;;;AAM1D,MAAa,0BAAqD,cAAgC,8BAA8B;;;;AAKhI,MAAa,iCAAwD,cAA4B,sCAAsC;;ACIvI,MAAa,iCAAwF,4BAAiC,EACpI,QAAQ;CAAE,SAAS;CAAM,WAAW;CAAO,MAAM;CAAQ,EAC1D,CAAC;;;;AAKF,SAAgB,oBACd,MACA,OACM;CACN,MAAM,WAAW,wBAAwB,QAAQ,KAAK;AAEtD,kBAAiB,MAAM,gBAAgB,UAAU;AAC/C,QAAM,gBAAgB;EAEtB,MAAM,QAAQ,UAAU;EACxB,MAAM,SAAS,MAAM,OAAO,KAAK;EACjC,MAAM,aAAa,OAAO,WAAW,KAAK;AAC1C,MAAI,CAAC,UAAU,CAAC,WACd;EAGF,MAAM,EAAE,MAAM,QAAQ;AACtB,SAAO,KAAK,mBAAmB,EAAE,KAAK,MAAM,KAAK,UAAU,CAAC,CAAC;AAC7D,SAAO,OAAO;AAGd,SAAO,WAAW,IAAI,KAAA,EAAU;GAChC;;AAGJ,MAAM,4BAAyE,o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YAAU,IAAI,OAAO,KAAA,EAAU;AAC/B,QAAM,WAAW,IAAI,WAAW;EAChC,MAAM,QAAQ,aAAa;GAAE,MAAM,WAAW;GAAM,KAAK,WAAW;GAAK,GAAG;AAC5E,OAAK,cAAc,IAAI,4BAA4B,MAAM,CAAC;GAC1D;AAEF,WAAU,YAAY;AACpB,eAAa,iBAAiB,UAAU,KAAK,CAAC;GAC9C;AAEF,gCAA+B,QAAQ,MAAM,aAAa;;AAG5D,MAAM,6BAA2E,oBAC/E,sBACA,gCACD;;;;;;;;AASD,IAAa,yBAAb,cAA4C,2BAA2B;;AAGvE,SAAgB,iCAAuC;AACrD,uBAAsB,8BAA8B,uBAAuB"}
@@ -33,4 +33,4 @@ declare class DropIndicatorElement extends DropIndicatorElementBase {}
33
33
  */
34
34
  declare function registerDropIndicatorElement(): void;
35
35
  export { DropIndicatorElement, type DropIndicatorProps, DropIndicatorPropsDeclaration, registerDropIndicatorElement, setupDropIndicator };
36
- //# sourceMappingURL=prosekit-web-drop-indicator.d.ts.map
36
+ //# sourceMappingURL=drop-indicator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"drop-indicator.d.ts","names":[],"sources":["../src/components/drop-indicator/drop-indicator.ts"],"mappings":";;UAoBiB,kBAAA;EAAA;;;;;;EAOf,MAAA,EAAQ,MAAA;EAOH;;AAIP;;;EAJE,KAAA;AAAA;AAoBF;AAAA,cAhBa,6BAAA,EAA+B,gBAAA,CAAiB,kBAAA;;;;iBAgB7C,kBAAA,CACd,IAAA,EAAM,WAAA,EACN,KAAA,EAAO,KAAA,CAAM,kBAAA;AAAA,cAwDT,wBAAA,EAA0B,sBAAA,CAAuB,kBAAA;;;;;;cAU1C,oBAAA,SAA6B,wBAAA;;AAZzC;;iBAiBe,4BAAA,CAAA"}
@@ -76,4 +76,4 @@ function registerDropIndicatorElement() {
76
76
  }
77
77
  export { DropIndicatorElement, DropIndicatorPropsDeclaration, registerDropIndicatorElement, setupDropIndicator };
78
78
 
79
- //# sourceMappingURL=prosekit-web-drop-indicator.js.map
79
+ //# sourceMappingURL=drop-indicator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"drop-indicator.js","names":[],"sources":["../src/components/drop-indicator/drop-indicator.ts"],"sourcesContent":["import {\n computed,\n createSignal,\n defineCustomElement,\n defineProps,\n registerCustomElement,\n useEffect,\n type HostElement,\n type HostElementConstructor,\n type PropsDeclaration,\n type State,\n} from '@aria-ui/core'\nimport { usePresence } from '@aria-ui/utils'\nimport type { Editor } from '@prosekit/core'\nimport { defineDropIndicator, type ShowHandlerOptions } from '@prosekit/extensions/drop-indicator'\n\nimport { useEditorExtension } from '../../hooks/use-editor-extension.ts'\nimport { useScrolling } from '../../hooks/use-scrolling.ts'\nimport { assignStyles } from '../../utils/assign-styles.ts'\n\nexport interface DropIndicatorProps {\n /**\n * The ProseKit editor instance.\n *\n * @default null\n * @hidden\n */\n editor: Editor | null\n\n /**\n * The line width in pixels.\n *\n * @default 2\n */\n width: number\n}\n\n/** @internal */\nexport const DropIndicatorPropsDeclaration: PropsDeclaration<DropIndicatorProps> = /* @__PURE__ */ defineProps<DropIndicatorProps>({\n editor: {\n default: null,\n attribute: false,\n type: 'json',\n },\n width: {\n default: 2,\n attribute: 'width',\n type: 'number',\n },\n})\n\n/**\n * @internal\n */\nexport function setupDropIndicator(\n host: HostElement,\n props: State<DropIndicatorProps>,\n): void {\n type DropIndicatorContext = ShowHandlerOptions | null\n const context = createSignal<DropIndicatorContext>(null)\n\n const extension = defineDropIndicator({\n onShow: (options) => context.set(options),\n onHide: () => context.set(null),\n })\n\n useEditorExtension(host, props.editor.get, extension)\n\n const getLine = computed(() => context.get()?.line)\n const getScrolling = useScrolling(host)\n const getPresence = computed(() => !!context.get() && !getScrolling())\n usePresence(host, getPresence)\n\n useEffect(host, () => {\n const lineValue = getLine()\n const lineWidth = props.width.get()\n\n if (!lineValue) return\n\n const { p1: { x: x1, y: y1 }, p2: { x: x2, y: y2 } } = lineValue\n const horizontal = y1 === y2\n\n let width: number\n let height: number\n let top: number = y1\n let left: number = x1\n\n if (horizontal) {\n width = x2 - x1\n height = lineWidth\n top -= lineWidth / 2\n } else {\n width = lineWidth\n height = y2 - y1\n left -= lineWidth / 2\n }\n\n top = Math.round(top)\n left = Math.round(left)\n\n assignStyles(host, {\n position: 'fixed',\n pointerEvents: 'none',\n width: `${width}px`,\n height: `${height}px`,\n transform: `translate(${left}px, ${top}px)`,\n left: '0px',\n top: '0px',\n })\n })\n}\n\nconst DropIndicatorElementBase: HostElementConstructor<DropIndicatorProps> = defineCustomElement(\n setupDropIndicator,\n DropIndicatorPropsDeclaration,\n)\n\n/**\n * `<prosekit-drop-indicator>` custom element.\n *\n * Properties: {@link DropIndicatorProps}\n */\nexport class DropIndicatorElement extends DropIndicatorElementBase {}\n\n/**\n * @internal\n */\nexport function registerDropIndicatorElement(): void {\n registerCustomElement('prosekit-drop-indicator', DropIndicatorElement)\n}\n"],"mappings":";;;;;;AAsCA,MAAa,gCAAsF,4BAAgC;CACjI,QAAQ;EACN,SAAS;EACT,WAAW;EACX,MAAM;EACP;CACD,OAAO;EACL,SAAS;EACT,WAAW;EACX,MAAM;EACP;CACF,CAAC;;;;AAKF,SAAgB,mBACd,MACA,OACM;CAEN,MAAM,UAAU,aAAmC,KAAK;CAExD,MAAM,YAAY,oBAAoB;EACpC,SAAS,YAAY,QAAQ,IAAI,QAAQ;EACzC,cAAc,QAAQ,IAAI,KAAK;EAChC,CAAC;AAEF,oBAAmB,MAAM,MAAM,OAAO,KAAK,UAAU;CAErD,MAAM,UAAU,eAAe,QAAQ,KAAK,EAAE,KAAK;CACnD,MAAM,eAAe,aAAa,KAAK;AAEvC,aAAY,MADQ,eAAe,CAAC,CAAC,QAAQ,KAAK,IAAI,CAAC,cAAc,CAAC,CACxC;AAE9B,WAAU,YAAY;EACpB,MAAM,YAAY,SAAS;EAC3B,MAAM,YAAY,MAAM,MAAM,KAAK;AAEnC,MAAI,CAAC,UAAW;EAEhB,MAAM,EAAE,IAAI,EAAE,GAAG,IAAI,GAAG,MAAM,IAAI,EAAE,GAAG,IAAI,GAAG,SAAS;EACvD,MAAM,aAAa,OAAO;EAE1B,IAAI;EACJ,IAAI;EACJ,IAAI,MAAc;EAClB,IAAI,OAAe;AAEnB,MAAI,YAAY;AACd,WAAQ,KAAK;AACb,YAAS;AACT,UAAO,YAAY;SACd;AACL,WAAQ;AACR,YAAS,KAAK;AACd,WAAQ,YAAY;;AAGtB,QAAM,KAAK,MAAM,IAAI;AACrB,SAAO,KAAK,MAAM,KAAK;AAEvB,eAAa,MAAM;GACjB,UAAU;GACV,eAAe;GACf,OAAO,GAAG,MAAM;GAChB,QAAQ,GAAG,OAAO;GAClB,WAAW,aAAa,KAAK,MAAM,IAAI;GACvC,MAAM;GACN,KAAK;GACN,CAAC;GACF;;AAGJ,MAAM,2BAAuE,oBAC3E,oBACA,8BACD;;;;;;AAOD,IAAa,uBAAb,cAA0C,yBAAyB;;;;AAKnE,SAAgB,+BAAqC;AACnD,uBAAsB,2BAA2B,qBAAqB"}
@@ -74,4 +74,4 @@ import { Editor, Extension } from "@prosekit/core";
74
74
  */
75
75
  declare function queueExtension(editor: Editor, extension: Extension): VoidFunction;
76
76
  export { queueExtension };
77
- //# sourceMappingURL=prosekit-web.d.ts.map
77
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +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"}
@@ -90,4 +90,4 @@ function queueExtension(editor, extension) {
90
90
  }
91
91
  export { queueExtension };
92
92
 
93
- //# sourceMappingURL=prosekit-web.js.map
93
+ //# sourceMappingURL=index.js.map
@@ -0,0 +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"}
@@ -153,4 +153,4 @@ declare class InlinePopoverRootElement extends InlinePopoverRootElementBase {}
153
153
  /** @internal */
154
154
  declare function registerInlinePopoverRootElement(): void;
155
155
  export { InlinePopoverPopupElement, type InlinePopoverPopupProps, InlinePopoverPopupPropsDeclaration, InlinePopoverPositionerElement, type InlinePopoverPositionerProps, InlinePopoverPositionerPropsDeclaration, InlinePopoverRootElement, type InlinePopoverRootEvents, type InlinePopoverRootProps, InlinePopoverRootPropsDeclaration, OpenChangeEvent, registerInlinePopoverPopupElement, registerInlinePopoverPositionerElement, registerInlinePopoverRootElement, setupInlinePopoverPopup, setupInlinePopoverPositioner, setupInlinePopoverRoot };
156
- //# sourceMappingURL=prosekit-web-inline-popover.d.ts.map
156
+ //# sourceMappingURL=inline-popover.d.ts.map
@@ -0,0 +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"}
@@ -205,4 +205,4 @@ function registerInlinePopoverRootElement() {
205
205
  }
206
206
  export { InlinePopoverPopupElement, InlinePopoverPopupPropsDeclaration, InlinePopoverPositionerElement, InlinePopoverPositionerPropsDeclaration, InlinePopoverRootElement, InlinePopoverRootPropsDeclaration, OpenChangeEvent, registerInlinePopoverPopupElement, registerInlinePopoverPositionerElement, registerInlinePopoverRootElement, setupInlinePopoverPopup, setupInlinePopoverPositioner, setupInlinePopoverRoot };
207
207
 
208
- //# sourceMappingURL=prosekit-web-inline-popover.js.map
208
+ //# sourceMappingURL=inline-popover.js.map
@@ -0,0 +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-editor-update-event.ts","../src/hooks/use-keymap.ts","../src/components/inline-popover/virtual-selection-element.ts","../src/components/inline-popover/inline-popover-root.ts"],"sourcesContent":["import { createContext, type Context } from '@aria-ui/core'\nimport type { OverlayStore } from '@aria-ui/elements/overlay'\n\nexport const InlinePopoverStoreContext: Context<OverlayStore> = createContext<OverlayStore>(\n 'prosekit-inline-popover-store',\n)\n","import {\n computed,\n defineCustomElement,\n onMount,\n registerCustomElement,\n type HostElement,\n type HostElementConstructor,\n type PropsDeclaration,\n type State,\n} from '@aria-ui/core'\nimport { OverlayPopupPropsDeclaration, setupOverlayPopup, type OverlayPopupProps } from '@aria-ui/elements/overlay'\nimport { usePresence } from '@aria-ui/utils'\n\nimport { InlinePopoverStoreContext } from './store.ts'\n\n/**\n * @public\n */\nexport interface InlinePopoverPopupProps extends OverlayPopupProps {}\n\n/** @internal */\nexport const InlinePopoverPopupPropsDeclaration: PropsDeclaration<InlinePopoverPopupProps> = OverlayPopupPropsDeclaration\n\n/** @internal */\nexport function setupInlinePopoverPopup(\n host: HostElement,\n _props: State<InlinePopoverPopupProps>,\n): void {\n const getStore = InlinePopoverStoreContext.consume(host)\n setupOverlayPopup(host, getStore)\n const getOpen = computed(() => getStore()?.getIsOpen() ?? false)\n usePresence(host, getOpen)\n\n onMount(host, () => {\n host.role = 'dialog'\n })\n}\n\nconst InlinePopoverPopupElementBase: HostElementConstructor<InlinePopoverPopupProps> = defineCustomElement(\n setupInlinePopoverPopup,\n InlinePopoverPopupPropsDeclaration,\n)\n\n/**\n * `<prosekit-inline-popover-popup>` custom element.\n *\n * Properties: {@link InlinePopoverPopupProps}\n *\n * Data attributes:\n *\n * | Attribute | Description |\n * | --- | --- |\n * | `data-state` | `\"open\"` when the inline popover is visible, `\"closed\"` otherwise |\n */\nexport class InlinePopoverPopupElement extends InlinePopoverPopupElementBase {}\n\n/** @internal */\nexport function registerInlinePopoverPopupElement(): void {\n registerCustomElement('prosekit-inline-popover-popup', InlinePopoverPopupElement)\n}\n","import {\n defineCustomElement,\n defineProps,\n registerCustomElement,\n type HostElement,\n type HostElementConstructor,\n type PropsDeclaration,\n type State,\n} from '@aria-ui/core'\nimport { OverlayPositionerPropsDeclaration, setupOverlayPositioner, type OverlayPositionerProps } from '@aria-ui/elements/overlay'\n\nimport { InlinePopoverStoreContext } from './store.ts'\n\n/**\n * @public\n */\nexport interface InlinePopoverPositionerProps extends\n Omit<\n OverlayPositionerProps,\n | 'placement'\n | 'offset'\n | 'hide'\n | 'hoist'\n | 'overlap'\n | 'inline'\n | 'overflowPadding'\n >\n{\n /**\n * The initial placement of the floating element\n *\n * @default \"top\"\n */\n placement: OverlayPositionerProps['placement']\n\n /**\n * The distance between the reference and floating element.\n *\n * @default 12\n */\n offset: OverlayPositionerProps['offset']\n\n /**\n * Whether to hide the floating element when the reference element or the\n * floating element is fully clipped.\n *\n * @default true\n */\n hide: OverlayPositionerProps['hide']\n\n /**\n * Whether to use the browser [Popover API](https://developer.mozilla.org/en-US/docs/Web/API/Popover_API)\n * to place the floating element on top of other page content.\n *\n * @default false\n */\n hoist: boolean\n\n /**\n * Whether the floating element can overlap the reference element to keep it\n * in view.\n *\n * @default true\n */\n overlap: OverlayPositionerProps['overlap']\n\n /**\n * Whether to improve positioning for inline reference elements that span over\n * multiple lines.\n *\n * @default true\n */\n inline: OverlayPositionerProps['inline']\n\n /**\n * Describes the virtual padding around the boundary to check for overflow.\n *\n * @default 8\n */\n overflowPadding: OverlayPositionerProps['overflowPadding']\n}\n\n/** @internal */\nexport const InlinePopoverPositionerPropsDeclaration: PropsDeclaration<InlinePopoverPositionerProps> = /* @__PURE__ */ defineProps<\n InlinePopoverPositionerProps\n>({\n ...OverlayPositionerPropsDeclaration,\n placement: { default: 'top', attribute: 'placement', type: 'string' },\n offset: { default: 12, attribute: false, type: 'json' },\n hide: { default: true, attribute: 'hide', type: 'boolean' },\n hoist: { default: false, attribute: 'hoist', type: 'boolean' },\n overlap: { default: true, attribute: 'overlap', type: 'boolean' },\n inline: { default: true, attribute: 'inline', type: 'boolean' },\n overflowPadding: { default: 8, attribute: 'overflow-padding', type: 'number' },\n})\n\n/** @internal */\nexport function setupInlinePopoverPositioner(\n host: HostElement,\n props: State<InlinePopoverPositionerProps>,\n): void {\n setupOverlayPositioner(host, props, InlinePopoverStoreContext.consume(host))\n}\n\nconst InlinePopoverPositionerElementBase: HostElementConstructor<InlinePopoverPositionerProps> = defineCustomElement(\n setupInlinePopoverPositioner,\n InlinePopoverPositionerPropsDeclaration,\n)\n\n/**\n * `<prosekit-inline-popover-positioner>` custom element.\n *\n * Properties: {@link InlinePopoverPositionerProps}\n *\n * Data attributes:\n *\n * | Attribute | Description |\n * | --- | --- |\n * | `data-state` | `\"open\"` when the inline popover is visible, `\"closed\"` otherwise |\n * | `data-side` | The side of the anchor element the positioner is on |\n * | `data-align` | The alignment of the positioner relative to the anchor element |\n *\n * CSS variables:\n *\n * | Variable | Description |\n * | --- | --- |\n * | `--transform-origin` | The coordinates that this element is anchored to. Useful for scale animations. |\n */\nexport class InlinePopoverPositionerElement extends InlinePopoverPositionerElementBase {}\n\n/** @internal */\nexport function registerInlinePopoverPositionerElement(): void {\n registerCustomElement('prosekit-inline-popover-positioner', InlinePopoverPositionerElement)\n}\n","import type { HostElement } from '@aria-ui/core'\nimport { defineFocusChangeHandler, type Editor, type FocusChangeHandler } from '@prosekit/core'\n\nimport { useEditorExtension } from './use-editor-extension.ts'\n\n/**\n * @internal\n */\nexport function useEditorFocusChangeEvent(\n host: HostElement,\n getEditor: () => Editor | null,\n handler: FocusChangeHandler,\n): void {\n const extension = defineFocusChangeHandler(handler)\n useEditorExtension(host, getEditor, extension)\n}\n","import type { HostElement } from '@aria-ui/core'\nimport { defineUpdateHandler, type Editor, type UpdateHandler } from '@prosekit/core'\n\nimport { useEditorExtension } from './use-editor-extension.ts'\n\n/**\n * @internal\n */\nexport function useEditorUpdateEvent(\n host: HostElement,\n getEditor: () => Editor | null,\n handler: UpdateHandler,\n): void {\n const extension = defineUpdateHandler(handler)\n useEditorExtension(host, getEditor, extension)\n}\n","import type { HostElement } from '@aria-ui/core'\nimport { defineKeymap, type Editor, type Keymap } from '@prosekit/core'\n\nimport { useEditorExtension } from './use-editor-extension.ts'\n\nexport function useKeymap(\n host: HostElement,\n getEditor: () => Editor | null,\n keymap: Keymap,\n): void {\n const extension = defineKeymap(keymap)\n useEditorExtension(host, getEditor, extension)\n}\n","import type { ReferenceElement } from '@floating-ui/dom'\nimport { containsInlineNode, isInCodeBlock, isTextSelection } from '@prosekit/core'\nimport type { EditorView } from '@prosekit/pm/view'\n\nexport function getVirtualSelectionElement(\n view: EditorView,\n): ReferenceElement | undefined {\n if (typeof window === 'undefined' || view.isDestroyed) {\n return\n }\n\n const selection = view.state.selection\n\n if (\n !selection.empty\n && !isInCodeBlock(selection)\n && isTextSelection(selection)\n && containsInlineNode(view.state.doc, selection.from, selection.to)\n ) {\n return getDomDecoration(view) || getInlineDecoration(view)\n }\n}\n\nfunction getDomDecoration(view: EditorView): ReferenceElement | undefined {\n const range = getDomRange(view)\n if (range) {\n // To get it work properly in Safari, we cannot return the range directly.\n // We have to return a contextElement.\n return {\n contextElement: view.dom,\n getBoundingClientRect: () => range.getBoundingClientRect(),\n getClientRects: () => range.getClientRects(),\n }\n }\n}\n\nfunction getDomRange(view: EditorView): Range | undefined {\n const win = view.dom.ownerDocument.defaultView\n const selection = win?.getSelection()\n if (!selection || selection.isCollapsed) {\n return\n }\n\n const range = typeof selection.rangeCount === 'number'\n && selection.rangeCount > 0\n && selection.getRangeAt(0)\n\n if (!range) {\n return\n }\n\n return range\n}\n\nfunction getInlineDecoration(view: EditorView): ReferenceElement | undefined {\n const match = view.dom.querySelectorAll('.prosekit-virtual-selection')\n\n if (match.length === 0) {\n return\n }\n if (match.length === 1) {\n return match[0]\n }\n\n const items = Array.from(match)\n return {\n contextElement: items[0],\n getBoundingClientRect: () => items[0].getBoundingClientRect(),\n getClientRects: () => items.map((item) => item.getBoundingClientRect()),\n }\n}\n","import {\n defineCustomElement,\n defineProps,\n registerCustomElement,\n type HostElement,\n type HostElementConstructor,\n type PropsDeclaration,\n type State,\n} from '@aria-ui/core'\nimport type { OpenChangeEvent } from '@aria-ui/elements/overlay'\nimport { OverlayRootPropsDeclaration, useOverlayStore, type OverlayRootProps } from '@aria-ui/elements/overlay'\nimport type { Editor } from '@prosekit/core'\nimport type { Selection } from '@prosekit/pm/state'\n\nimport { useEditorFocusChangeEvent } from '../../hooks/use-editor-focus-event.ts'\nimport { useEditorUpdateEvent } from '../../hooks/use-editor-update-event.ts'\nimport { useKeymap } from '../../hooks/use-keymap.ts'\n\nimport { InlinePopoverStoreContext } from './store.ts'\nimport { getVirtualSelectionElement } from './virtual-selection-element.ts'\n\n/**\n * @public\n */\nexport interface InlinePopoverRootProps extends OverlayRootProps {\n /**\n * The ProseKit editor instance.\n *\n * @default null\n * @hidden\n */\n editor: Editor | null\n\n /**\n * Whether the popover is open by default when some inline content is\n * selected.\n *\n * @default true\n */\n defaultOpen: boolean\n\n /**\n * Whether the inline popover should be dismissed when the editor receives an\n * Escape key press.\n *\n * @default true\n */\n dismissOnEscape: boolean\n}\n\n/** @internal */\nexport const InlinePopoverRootPropsDeclaration: PropsDeclaration<InlinePopoverRootProps> = /* @__PURE__ */ defineProps<\n InlinePopoverRootProps\n>({\n ...OverlayRootPropsDeclaration,\n editor: { default: null, attribute: false, type: 'json' },\n defaultOpen: { default: true, attribute: 'default-open', type: 'boolean' },\n dismissOnEscape: { default: true, attribute: 'dismiss-on-escape', type: 'boolean' },\n})\n\n/**\n * @public\n */\nexport interface InlinePopoverRootEvents {\n /**\n * Emitted when the open state of the popover changes.\n */\n openChange: OpenChangeEvent\n}\n\n/** @internal */\nexport function setupInlinePopoverRoot(\n host: HostElement,\n props: State<InlinePopoverRootProps>,\n): void {\n const store = useOverlayStore(host, props)\n InlinePopoverStoreContext.provide(host, store)\n\n let editorFocused = false\n useEditorFocusChangeEvent(host, props.editor.get, (focus) => {\n editorFocused = focus\n })\n\n let prevSelection: Selection | undefined\n useEditorUpdateEvent(host, props.editor.get, (view) => {\n const isPopoverFocused = !editorFocused && host.contains(host.ownerDocument.activeElement)\n if (isPopoverFocused) return\n\n const { selection } = view.state\n if (prevSelection?.eq(selection)) return\n prevSelection = selection\n\n const reference = getVirtualSelectionElement(view)\n store.setAnchorElement(reference)\n\n if (reference && props.defaultOpen.get()) {\n store.requestOpenChange(true)\n } else if (!reference) {\n store.requestOpenChange(false)\n }\n })\n\n useKeymap(host, props.editor.get, {\n Escape: () => {\n if (!props.dismissOnEscape.get() || !store.getIsOpen()) return false\n store.requestOpenChange(false)\n return true\n },\n })\n}\n\nconst InlinePopoverRootElementBase: HostElementConstructor<InlinePopoverRootProps> = defineCustomElement(\n setupInlinePopoverRoot,\n InlinePopoverRootPropsDeclaration,\n)\n\n/**\n * `<prosekit-inline-popover-root>` custom element.\n *\n * Properties: {@link InlinePopoverRootProps}\n *\n * Events: {@link InlinePopoverRootEvents}\n */\nexport class InlinePopoverRootElement extends InlinePopoverRootElementBase {}\n\n/** @internal */\nexport function registerInlinePopoverRootElement(): void {\n registerCustomElement('prosekit-inline-popover-root', InlinePopoverRootElement)\n}\n"],"mappings":";;;;;AAGA,MAAa,4BAAmD,cAC9D,gCACD;;ACgBD,MAAa,qCAAgF;;AAG7F,SAAgB,wBACd,MACA,QACM;CACN,MAAM,WAAW,0BAA0B,QAAQ,KAAK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MAAM,QAAQ,gBAAgB,MAAM,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"}
@@ -126,4 +126,4 @@ declare function registerMenuItemElement(): void;
126
126
  declare function registerMenuSubmenuRootElement(): void;
127
127
  declare function registerMenuSubmenuTriggerElement(): void;
128
128
  export { MenuItemElement, MenuItemEvents, MenuItemProps, MenuItemPropsDeclaration, MenuPopupElement, MenuPopupProps, MenuPopupPropsDeclaration, MenuPositionerElement, MenuPositionerProps, MenuPositionerPropsDeclaration, MenuRootElement, MenuRootEvents, MenuRootProps, MenuRootPropsDeclaration, MenuSubmenuRootElement, MenuSubmenuRootEvents, MenuSubmenuRootProps, MenuSubmenuRootPropsDeclaration, MenuSubmenuTriggerElement, MenuSubmenuTriggerProps, MenuSubmenuTriggerPropsDeclaration, MenuTriggerElement, MenuTriggerEvents, MenuTriggerProps, MenuTriggerPropsDeclaration, OpenChangeEvent, SelectEvent, registerMenuItemElement, registerMenuPopupElement, registerMenuPositionerElement, registerMenuRootElement, registerMenuSubmenuRootElement, registerMenuSubmenuTriggerElement, registerMenuTriggerElement, setupMenuItem, setupMenuPopup, setupMenuPositioner, setupMenuRoot, setupMenuSubmenuRoot, setupMenuSubmenuTrigger, setupMenuTrigger };
129
- //# sourceMappingURL=prosekit-web-menu.d.ts.map
129
+ //# sourceMappingURL=menu.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"menu.d.ts","names":[],"sources":["../src/components/menu/index.ts"],"mappings":";;;;;AAqHA;;;;;AASA;;;;;AAEA;cAtFa,eAAA,SAAwB,IAAA,CAAK,eAAA;;;AAuF1C;;;;;AACA;;;;cA3Ea,gBAAA,SAAyB,IAAA,CAAK,gBAAA;;;;;AA6E3C;;;;;AACA;;;;;AACA;;;cA5Da,qBAAA,SAA8B,IAAA,CAAK,qBAAA;AA8DhD;;;;;AACA;;;;;AACA;;;AAFA,cA/Ca,eAAA,SAAwB,IAAA,CAAK,eAAA;AAkD1C;;;;;AAGA;;;;;AAEA;;;AALA,cAnCa,sBAAA,SAA+B,IAAA,CAAK,sBAAA;AA0CjD;;;;;AAEA;;;;;AAEA;AAJA,cA7Ba,yBAAA,SAAkC,IAAA,CAAK,yBAAA;;;AAmCpD;;;;;cA1Ba,kBAAA,SAA2B,IAAA,CAAK,kBAAA;AAAA,UAE5B,aAAA,SAAsB,IAAA,CAAK,aAAA;AAAA,UAC3B,cAAA,SAAuB,IAAA,CAAK,cAAA;AAAA,UAC5B,mBAAA,SAA4B,IAAA,CAAK,mBAAA;AAAA,UACjC,aAAA,SAAsB,IAAA,CAAK,aAAA;AAAA,UAC3B,oBAAA,SAA6B,IAAA,CAAK,oBAAA;AAAA,UAClC,uBAAA,SAAgC,IAAA,CAAK,uBAAA;AAAA,UACrC,gBAAA,SAAyB,IAAA,CAAK,gBAAA;AAAA,UAE9B,cAAA,SAAuB,IAAA,CAAK,cAAA;AAAA,UAC5B,cAAA,SAAuB,IAAA,CAAK,cAAA;AAAA,UAC5B,qBAAA,SAA8B,IAAA,CAAK,qBAAA;AAAA,UACnC,iBAAA,SAA0B,IAAA,CAAK,iBAAA;;cAGnC,wBAAA,EAA0B,gBAAA,CAAiB,aAAA;;cAE3C,yBAAA,EAA2B,gBAAA,CAAiB,cAAA;;cAE5C,8BAAA,EAAgC,gBAAA,CAAiB,mBAAA;AAyB9D;AAAA,cAvBa,wBAAA,EAA0B,gBAAA,CAAiB,aAAA;;cAE3C,+BAAA,EAAiC,gBAAA,CAAiB,oBAAA;;cAElD,kCAAA,EAAoC,gBAAA,CAAiB,uBAAA;;cAErD,2BAAA,EAA6B,gBAAA,CAAiB,gBAAA;AAAA,iBAE3C,uBAAA,CAAA;AAAA,iBAGA,0BAAA,CAAA;AAAA,iBAGA,6BAAA,CAAA;AAAA,iBAGA,wBAAA,CAAA;AAAA,iBAGA,uBAAA,CAAA;AAAA,iBAGA,8BAAA,CAAA;AAAA,iBAGA,iCAAA,CAAA"}
@@ -155,4 +155,4 @@ function registerMenuSubmenuTriggerElement() {
155
155
  }
156
156
  export { MenuItemElement, MenuItemPropsDeclaration, MenuPopupElement, MenuPopupPropsDeclaration, MenuPositionerElement, MenuPositionerPropsDeclaration, MenuRootElement, MenuRootPropsDeclaration, MenuSubmenuRootElement, MenuSubmenuRootPropsDeclaration, MenuSubmenuTriggerElement, MenuSubmenuTriggerPropsDeclaration, MenuTriggerElement, MenuTriggerPropsDeclaration, OpenChangeEvent, SelectEvent, registerMenuItemElement, registerMenuPopupElement, registerMenuPositionerElement, registerMenuRootElement, registerMenuSubmenuRootElement, registerMenuSubmenuTriggerElement, registerMenuTriggerElement, setupMenuItem, setupMenuPopup, setupMenuPositioner, setupMenuRoot, setupMenuSubmenuRoot, setupMenuSubmenuTrigger, setupMenuTrigger };
157
157
 
158
- //# sourceMappingURL=prosekit-web-menu.js.map
158
+ //# sourceMappingURL=menu.js.map
@@ -0,0 +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"}
@@ -66,4 +66,4 @@ declare function registerPopoverTriggerElement(): void;
66
66
  declare function registerPopoverPopupElement(): void;
67
67
  declare function registerPopoverPositionerElement(): void;
68
68
  export { OpenChangeEvent, PopoverPopupElement, PopoverPopupProps, PopoverPopupPropsDeclaration, PopoverPositionerElement, PopoverPositionerProps, PopoverPositionerPropsDeclaration, PopoverRootElement, PopoverRootEvents, PopoverRootProps, PopoverRootPropsDeclaration, PopoverTriggerElement, PopoverTriggerEvents, PopoverTriggerProps, PopoverTriggerPropsDeclaration, registerPopoverPopupElement, registerPopoverPositionerElement, registerPopoverRootElement, registerPopoverTriggerElement, setupPopoverPopup, setupPopoverPositioner, setupPopoverRoot, setupPopoverTrigger };
69
- //# sourceMappingURL=prosekit-web-popover.d.ts.map
69
+ //# sourceMappingURL=popover.d.ts.map
@@ -0,0 +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"}
@@ -84,4 +84,4 @@ function registerPopoverPositionerElement() {
84
84
  }
85
85
  export { OpenChangeEvent, PopoverPopupElement, PopoverPopupPropsDeclaration, PopoverPositionerElement, PopoverPositionerPropsDeclaration, PopoverRootElement, PopoverRootPropsDeclaration, PopoverTriggerElement, PopoverTriggerPropsDeclaration, registerPopoverPopupElement, registerPopoverPositionerElement, registerPopoverRootElement, registerPopoverTriggerElement, setupPopoverPopup, setupPopoverPositioner, setupPopoverRoot, setupPopoverTrigger };
86
86
 
87
- //# sourceMappingURL=prosekit-web-popover.js.map
87
+ //# sourceMappingURL=popover.js.map
@@ -0,0 +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"}
@@ -113,4 +113,4 @@ declare class ResizableHandleElement extends ResizableHandleElementBase {}
113
113
  */
114
114
  declare function registerResizableHandleElement(): void;
115
115
  export { ResizableHandleElement, type ResizableHandleProps, ResizableHandlePropsDeclaration, ResizableRootElement, type ResizableRootEvents, type ResizableRootProps, ResizableRootPropsDeclaration, ResizeEndEvent, ResizeStartEvent, registerResizableHandleElement, registerResizableRootElement, setupResizableHandle, setupResizableRoot };
116
- //# sourceMappingURL=prosekit-web-resizable.d.ts.map
116
+ //# sourceMappingURL=resizable.d.ts.map
@@ -0,0 +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"}
@@ -273,4 +273,4 @@ function registerResizableHandleElement() {
273
273
  }
274
274
  export { ResizableHandleElement, ResizableHandlePropsDeclaration, ResizableRootElement, ResizableRootPropsDeclaration, ResizeEndEvent, ResizeStartEvent, registerResizableHandleElement, registerResizableRootElement, setupResizableHandle, setupResizableRoot };
275
275
 
276
- //# sourceMappingURL=prosekit-web-resizable.js.map
276
+ //# sourceMappingURL=resizable.js.map
@@ -0,0 +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,YAAY,OAAO,SAAS,MAAM,IAAI,QAAQ;;;;;ACIxE,MAAa,kBAAqC,cAChD,8BACD;;;;AAKD,MAAa,uBAA+C,cAC1D,mCACD;;;;AAKD,MAAa,qBAA2C,cACtD,iCACD;;;;ACuBD,MAAa,gCAAsE,YAAgC;CACjH,OAAO;EAAE,SAAS;EAAM,WAAW;EAAc,MAAM;EAAQ;CAC/D,QAAQ;EAAE,SAAS;EAAM,WAAW;EAAe,MAAM;EAAQ;CACjE,aAAa;EAAE,SAAS;EAAM,WAAW;EAAqB,MAAM;EAAQ;CAC7E,CAAC;;;;AAoBF,IAAa,mBAAb,cAAsC,MAAM;CAK1C,YAAY,OAAe,QAAgB;AACzC,QAAM,cAAc;AACpB,OAAK,SAAS;GAAE;GAAO;GAAQ;;;;;;AAOnC,IAAa,iBAAb,cAAoC,MAAM;CAKxC,YAAY,OAAe,QAAgB;AACzC,QAAM,YAAY;AAClB,OAAK,SAAS;GAAE;GAAO;GAAQ;;;;;;AAOnC,SAAgB,mBACd,MACA,OACM;CACN,MAAM,WAAW,aAAa,MAAM;CAEpC,MAAM,sBAAqC;EACzC,MAAM,EAAE,OAAO,WAAW,KAAK,uBAAuB;EAEtD,IAAI,cAAsB,MAAM,YAAY,KAAK,IAAI,QAAQ;AAE7D,MAAI,CAAC,uBAAuB,YAAY,CACtC,eAAc;AAGhB,WAAS,IAAI,KAAK;AAClB,OAAK,cAAc,IAAI,iBAAiB,OAAO,OAAO,CAAC;AACvD,SAAO;GAAC;GAAO;GAAQ;GAAY;;CAGrC,MAAM,YAAsB,OAAO,WAAW;AAC5C,QAAM,MAAM,IAAI,MAAM;AACtB,QAAM,OAAO,IAAI,OAAO;;CAG1B,MAAM,oBAAiC;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B,MAAM,CAAC,GAAG,KAAK,WACb,MAAM,SAAS,KAAK,EACpB,OACA,QACA,IACA,IACA,YACD;AAED,eAAa,GAAG,GAAG,EAAE;;CAGvB,MAAM,mBAAmB,UAAwB;AAC/C,QAAM,gBAAgB;AACtB,kBAAgB,IAAI,MAAM;AAE1B,kBAAgB,IAAI;;AAGtB,WAAU,YAAY;AACpB,OAAK,iBAAiB,eAAe,kBAAkB;AACvD,eAAa;AACX,QAAK,oBAAoB,eAAe,kBAAkB;;GAE5D;AAEF,WAAU,YAAY;AACpB,MAAI,CAAC,gBAAgB,KAAK,CACxB;EAGF,MAAM,MAAM,UAAU,KAAK;AAE3B,MAAI,iBAAiB,eAAe,kBAAkB;AACtD,MAAI,iBAAiB,aAAa,gBAAgB;AAClD,eAAa;AACX,OAAI,oBAAoB,eAAe,kBAAkB;AACzD,OAAI,oBAAoB,aAAa,gBAAgB;;GAEvD;;AAGJ,MAAM,6BAA2E,oBAC/E,sBACA,gCACD;;;;;;AAOD,IAAa,yBAAb,cAA4C,2BAA2B;AAEvE,IAAI,8BAA8B;;;;AAKlC,SAAgB,iCAAuC;AACrD,KAAI,4BAA6B;AACjC,+BAA8B;AAC9B,uBAAsB,6BAA6B,uBAAuB"}
@@ -303,4 +303,4 @@ declare class TableHandleRowMenuTriggerElement extends TableHandleRowMenuTrigger
303
303
  */
304
304
  declare function registerTableHandleRowMenuTriggerElement(): void;
305
305
  export { TableHandleColumnMenuRootElement, type TableHandleColumnMenuRootProps, TableHandleColumnMenuRootPropsDeclaration, TableHandleColumnMenuTriggerElement, type TableHandleColumnMenuTriggerProps, TableHandleColumnMenuTriggerPropsDeclaration, TableHandleColumnPopupElement, type TableHandleColumnPopupProps, TableHandleColumnPopupPropsDeclaration, TableHandleColumnPositionerElement, type TableHandleColumnPositionerProps, TableHandleColumnPositionerPropsDeclaration, TableHandleDragPreviewElement, type TableHandleDragPreviewProps, TableHandleDragPreviewPropsDeclaration, TableHandleDropIndicatorElement, type TableHandleDropIndicatorProps, TableHandleDropIndicatorPropsDeclaration, TableHandleRootElement, type TableHandleRootProps, TableHandleRootPropsDeclaration, TableHandleRowMenuRootElement, type TableHandleRowMenuRootProps, TableHandleRowMenuRootPropsDeclaration, TableHandleRowMenuTriggerElement, type TableHandleRowMenuTriggerProps, TableHandleRowMenuTriggerPropsDeclaration, TableHandleRowPopupElement, type TableHandleRowPopupProps, TableHandleRowPopupPropsDeclaration, TableHandleRowPositionerElement, type TableHandleRowPositionerProps, TableHandleRowPositionerPropsDeclaration, registerTableHandleColumnMenuRootElement, registerTableHandleColumnMenuTriggerElement, registerTableHandleColumnPopupElement, registerTableHandleColumnPositionerElement, registerTableHandleDragPreviewElement, registerTableHandleDropIndicatorElement, registerTableHandleRootElement, registerTableHandleRowMenuRootElement, registerTableHandleRowMenuTriggerElement, registerTableHandleRowPopupElement, registerTableHandleRowPositionerElement, setupTableHandleColumnMenuRoot, setupTableHandleColumnMenuTrigger, setupTableHandleColumnPopup, setupTableHandleColumnPositioner, setupTableHandleDragPreview, setupTableHandleDropIndicator, setupTableHandleRoot, setupTableHandleRowMenuRoot, setupTableHandleRowMenuTrigger, setupTableHandleRowPopup, setupTableHandleRowPositioner };
306
- //# sourceMappingURL=prosekit-web-table-handle.d.ts.map
306
+ //# sourceMappingURL=table-handle.d.ts.map
@@ -0,0 +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,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AyC,oCAAA;;;;iBAKtC,wCAAA,CAAA"}
@@ -1070,4 +1070,4 @@ function registerTableHandleRowMenuTriggerElement() {
1070
1070
  }
1071
1071
  export { TableHandleColumnMenuRootElement, TableHandleColumnMenuRootPropsDeclaration, TableHandleColumnMenuTriggerElement, TableHandleColumnMenuTriggerPropsDeclaration, TableHandleColumnPopupElement, TableHandleColumnPopupPropsDeclaration, TableHandleColumnPositionerElement, TableHandleColumnPositionerPropsDeclaration, TableHandleDragPreviewElement, TableHandleDragPreviewPropsDeclaration, TableHandleDropIndicatorElement, TableHandleDropIndicatorPropsDeclaration, TableHandleRootElement, TableHandleRootPropsDeclaration, TableHandleRowMenuRootElement, TableHandleRowMenuRootPropsDeclaration, TableHandleRowMenuTriggerElement, TableHandleRowMenuTriggerPropsDeclaration, TableHandleRowPopupElement, TableHandleRowPopupPropsDeclaration, TableHandleRowPositionerElement, TableHandleRowPositionerPropsDeclaration, registerTableHandleColumnMenuRootElement, registerTableHandleColumnMenuTriggerElement, registerTableHandleColumnPopupElement, registerTableHandleColumnPositionerElement, registerTableHandleDragPreviewElement, registerTableHandleDropIndicatorElement, registerTableHandleRootElement, registerTableHandleRowMenuRootElement, registerTableHandleRowMenuTriggerElement, registerTableHandleRowPopupElement, registerTableHandleRowPositionerElement, setupTableHandleColumnMenuRoot, setupTableHandleColumnMenuTrigger, setupTableHandleColumnPopup, setupTableHandleColumnPositioner, setupTableHandleDragPreview, setupTableHandleDropIndicator, setupTableHandleRoot, setupTableHandleRowMenuRoot, setupTableHandleRowMenuTrigger, setupTableHandleRowPopup, setupTableHandleRowPositioner };
1072
1072
 
1073
- //# sourceMappingURL=prosekit-web-table-handle.js.map
1073
+ //# sourceMappingURL=table-handle.js.map