@qalma/kit 0.3.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"qalma-kit-headless.mjs","sources":["../../../../libs/ui-kit/headless/src/lib/anchor-to-rect.ts","../../../../libs/ui-kit/headless/src/lib/flip-above-placement.ts","../../../../libs/ui-kit/headless/src/lib/dismissible-overlay.ts","../../../../libs/ui-kit/headless/src/lib/keyboard-navigable-list.ts","../../../../libs/ui-kit/headless/src/lib/suggestion-menu-base.ts","../../../../libs/ui-kit/headless/src/lib/drag-handle-controller.ts","../../../../libs/ui-kit/headless/src/lib/drag-handle-directive.ts","../../../../libs/ui-kit/headless/src/lib/selection-toolbar-controller.ts","../../../../libs/ui-kit/headless/src/lib/selection-toolbar-directive.ts","../../../../libs/ui-kit/headless/src/lib/link-popover.model.ts","../../../../libs/ui-kit/headless/src/lib/link-popover-controller.ts","../../../../libs/ui-kit/headless/src/index.ts","../../../../libs/ui-kit/headless/src/qalma-kit-headless.ts"],"sourcesContent":["export interface AnchorRect {\n readonly top: number;\n readonly bottom: number;\n readonly left: number;\n readonly right: number;\n}\n\nexport interface AnchorSize {\n readonly width: number;\n readonly height: number;\n}\n\nexport type AnchorPlacement = 'top' | 'bottom' | 'left' | 'right';\nexport type AnchorAlign = 'start' | 'center' | 'end';\n\nexport interface AnchorToRectOptions {\n /** Which side of the anchor rect the floating element renders on. */\n readonly placement: AnchorPlacement;\n /** Rect (viewport or scroll surface) the result is clamped within. */\n readonly boundary: AnchorRect;\n /** Size of the floating element being positioned. */\n readonly size: AnchorSize;\n /** Distance between the anchor rect and the floating element. Default 8. */\n readonly gap?: number;\n /** Minimum distance kept from the boundary edges. Default 8. */\n readonly edgeMargin?: number;\n /**\n * Cross-axis alignment relative to the anchor rect. `start` | `center` |\n * `end` align to the anchor rect itself; a number instead pins the\n * floating element's center to that viewport coordinate (clamped within\n * the anchor rect), e.g. to follow a pointer's Y while hovering a tall\n * block. Defaults to `start`.\n */\n readonly align?: AnchorAlign | number;\n}\n\nexport interface AnchorPosition {\n readonly top: number;\n readonly left: number;\n}\n\nconst DEFAULT_GAP = 8;\nconst DEFAULT_EDGE_MARGIN = 8;\n\nexport function anchorToRect(\n anchor: AnchorRect,\n options: AnchorToRectOptions,\n): AnchorPosition {\n const gap = options.gap ?? DEFAULT_GAP;\n const edgeMargin = options.edgeMargin ?? DEFAULT_EDGE_MARGIN;\n const { boundary, size } = options;\n\n if (options.placement === 'left' || options.placement === 'right') {\n const mainAxis =\n options.placement === 'left'\n ? anchor.left - gap - size.width\n : anchor.right + gap;\n const crossAxis = resolveCrossAxis(\n options.align,\n anchor.top,\n anchor.bottom,\n size.height,\n );\n\n return {\n left: clamp(\n mainAxis,\n boundary.left + edgeMargin,\n boundary.right - edgeMargin - size.width,\n ),\n top: clamp(\n crossAxis,\n boundary.top + edgeMargin,\n boundary.bottom - edgeMargin - size.height,\n ),\n };\n }\n\n const mainAxis =\n options.placement === 'bottom'\n ? anchor.bottom + gap\n : anchor.top - gap - size.height;\n const crossAxis = resolveCrossAxis(\n options.align,\n anchor.left,\n anchor.right,\n size.width,\n );\n\n return {\n top: clamp(\n mainAxis,\n boundary.top + edgeMargin,\n boundary.bottom - edgeMargin - size.height,\n ),\n left: clamp(\n crossAxis,\n boundary.left + edgeMargin,\n boundary.right - edgeMargin - size.width,\n ),\n };\n}\n\nfunction resolveCrossAxis(\n align: AnchorAlign | number | undefined,\n start: number,\n end: number,\n size: number,\n): number {\n const span = end - start;\n\n if (size >= span) {\n // The floating element doesn't fit within the anchor (e.g. a\n // single-line block shorter than the button anchored to it). Center it\n // instead of clamping to an arbitrary edge.\n return start + span / 2 - size / 2;\n }\n\n if (typeof align === 'number') {\n return clamp(align - size / 2, start, end - size);\n }\n\n switch (align) {\n case 'end':\n return end - size;\n case 'center':\n return start + (end - start) / 2 - size / 2;\n case 'start':\n default:\n return start;\n }\n}\n\nfunction clamp(value: number, min: number, max: number): number {\n const lo = Math.min(min, max);\n const hi = Math.max(min, max);\n\n return Math.min(Math.max(value, lo), hi);\n}\n","/**\n * Fixed-position coordinates for a suggestion menu anchored to a caret/range\n * rect. Exactly one of `top`/`bottom` is a number (the other is `null`): the\n * menu is pinned below the anchor by `top`, or above it by `bottom`.\n */\nexport interface SuggestionMenuPlacement {\n readonly left: number;\n readonly top: number | null;\n readonly bottom: number | null;\n readonly maxHeight: number;\n}\n\nexport interface FlipAbovePlacementOptions {\n /** Menu width, used to clamp `left` within the viewport. */\n readonly width: number;\n /** Ideal menu height for the current option count. */\n readonly desiredHeight: number;\n /** Floor for the computed `maxHeight` (e.g. one option / a loading row). */\n readonly minHeight: number;\n /** Viewport edge margin (default 12). */\n readonly margin?: number;\n /** Gap between the anchor and the menu (default 8). */\n readonly gap?: number;\n}\n\nconst DEFAULT_MARGIN = 12;\nconst DEFAULT_GAP = 8;\n\n/**\n * Positions a floating list under an anchor rect, flipping it above when there\n * is not enough room below, and clamping its height and horizontal position to\n * the viewport. Shared by the mention and slash-command menus, whose flip\n * behavior `anchorToRect` does not cover (it has no flip / dynamic max-height).\n */\nexport function flipAbovePlacement(\n rect: { readonly top: number; readonly bottom: number; readonly left: number },\n options: FlipAbovePlacementOptions,\n): SuggestionMenuPlacement {\n const {\n width,\n desiredHeight,\n minHeight,\n margin = DEFAULT_MARGIN,\n gap = DEFAULT_GAP,\n } = options;\n\n const availableBelow = window.innerHeight - rect.bottom - margin - gap;\n const availableAbove = rect.top - margin - gap;\n const openAbove =\n availableBelow < desiredHeight && availableAbove > availableBelow;\n const availableHeight = Math.max(\n minHeight,\n openAbove ? availableAbove : availableBelow,\n );\n const maxHeight = Math.min(desiredHeight, availableHeight);\n const leftBoundary = Math.max(margin, window.innerWidth - width - margin);\n\n return {\n left: Math.min(Math.max(rect.left, margin), leftBoundary),\n top: openAbove ? null : rect.bottom + gap,\n bottom: openAbove ? window.innerHeight - rect.top + gap : null,\n maxHeight,\n };\n}\n","import type { DestroyRef } from '@angular/core';\n\nexport interface DismissibleOverlayOptions {\n /** Returns true when the event target is part of the overlay/trigger and should not dismiss it. */\n isInside: (target: EventTarget | null) => boolean;\n onDismiss: () => void;\n}\n\n/**\n * Shared outside-click / Escape dismiss behavior for floating overlays\n * (popovers, contextual menus, autocomplete lists). Generalizes the\n * ad-hoc click-outside/Escape handling that used to be reimplemented\n * separately per feature.\n */\nexport class DismissibleOverlay {\n private readonly pointerDown = (event: PointerEvent): void => {\n if (!this.options.isInside(event.target)) {\n this.options.onDismiss();\n }\n };\n\n private readonly keydown = (event: KeyboardEvent): void => {\n if (event.key === 'Escape') {\n this.options.onDismiss();\n }\n };\n\n constructor(private readonly options: DismissibleOverlayOptions) {}\n\n connect(destroyRef: DestroyRef): void {\n document.addEventListener('pointerdown', this.pointerDown, true);\n document.addEventListener('keydown', this.keydown);\n\n destroyRef.onDestroy(() => {\n document.removeEventListener('pointerdown', this.pointerDown, true);\n document.removeEventListener('keydown', this.keydown);\n });\n }\n}\n","export interface KeyboardNavigableListOptions<T> {\n items: () => readonly T[];\n activeIndex: () => number;\n setActiveIndex: (index: number) => void;\n onSelect: (item: T, index: number) => void;\n}\n\n/**\n * Circular index step: move `index` by `delta` within `[0, length)`, wrapping\n * around both ends; returns `index` unchanged for an empty list. This is the\n * single source of truth for wrap-around list navigation — both\n * `KeyboardNavigableList` (BYO-markup lists) and `QalmaSuggestionMenu` (the\n * shipped mention/slash menus) delegate their arrow-key math to it.\n */\nexport function wrapIndex(index: number, delta: number, length: number): number {\n return length > 0 ? (index + delta + length) % length : index;\n}\n\n/**\n * Arrow-key navigation + Enter-to-select for autocomplete-style popovers\n * (mention menu, slash command menu). Shared so both features stop\n * reimplementing the same wrap-around index math.\n *\n * Takes a plain key string rather than a `KeyboardEvent` — some callers\n * relay keys through a `CustomEvent` (no real `KeyboardEvent` to read),\n * so preventing the default action is left to the caller.\n */\nexport class KeyboardNavigableList<T> {\n constructor(private readonly options: KeyboardNavigableListOptions<T>) {}\n\n /** Returns true when the key was handled (caller should stop further propagation / preventDefault). */\n handleKey(key: string): boolean {\n const items = this.options.items();\n\n if (items.length === 0) {\n return false;\n }\n\n switch (key) {\n case 'ArrowDown':\n this.options.setActiveIndex(\n wrapIndex(this.options.activeIndex(), 1, items.length),\n );\n\n return true;\n case 'ArrowUp':\n this.options.setActiveIndex(\n wrapIndex(this.options.activeIndex(), -1, items.length),\n );\n\n return true;\n case 'Enter': {\n const index = this.options.activeIndex();\n const item = items[index];\n\n if (item === undefined) {\n return false;\n }\n\n this.options.onSelect(item, index);\n\n return true;\n }\n default:\n return false;\n }\n }\n}\n","import {\n Directive,\n ElementRef,\n Signal,\n inject,\n input,\n output,\n} from '@angular/core';\n\nimport { SuggestionMenuPlacement } from './flip-above-placement';\nimport { wrapIndex } from './keyboard-navigable-list';\n\n/** Option buttons carry this attribute so the base can focus/scroll to one by index. */\nexport const SUGGESTION_OPTION_INDEX_ATTR = 'data-suggestion-index';\n/** The scrollable options container carries this attribute (optional). */\nexport const SUGGESTION_OPTIONS_SCROLLER_ATTR = 'data-suggestion-options';\n\n/**\n * Shared behavior for caret-anchored suggestion menus (mention, slash command):\n * flip-above placement input, active-option highlighting, and in-menu keyboard\n * handling (Escape dismisses, Arrow moves + focuses, Enter/Space picks) with\n * wrap-around and optional scroll-into-view. Concrete menus only supply their\n * own item markup and expose their option list via `optionList`.\n */\n@Directive()\nexport abstract class QalmaSuggestionMenu<TOption extends { readonly id: string }> {\n protected readonly elementRef = inject<ElementRef<HTMLElement>>(ElementRef);\n\n readonly placement = input<SuggestionMenuPlacement | null>(null);\n readonly activeIndex = input(0);\n\n readonly activate = output<number>();\n readonly pick = output<TOption>();\n readonly dismiss = output<void>();\n\n /** The rendered options, bound by the concrete menu (`options`/`suggestions`). */\n protected abstract readonly optionList: Signal<readonly TOption[]>;\n\n protected preserveSelection(event: MouseEvent): void {\n event.preventDefault();\n }\n\n protected handleOptionKeydown(\n event: KeyboardEvent,\n option: TOption,\n index: number,\n ): void {\n if (event.key === 'Escape') {\n event.preventDefault();\n this.dismiss.emit();\n\n return;\n }\n\n if (event.key === 'ArrowDown' || event.key === 'ArrowUp') {\n event.preventDefault();\n\n const nextIndex = this.getNextIndex(\n index,\n event.key === 'ArrowDown' ? 1 : -1,\n );\n\n this.activate.emit(nextIndex);\n queueMicrotask(() => this.focusOption(nextIndex));\n\n return;\n }\n\n if (event.key === 'Enter' || event.key === ' ' || event.key === 'Spacebar') {\n event.preventDefault();\n this.pick.emit(option);\n }\n }\n\n protected focusOption(index: number): void {\n this.optionElement(index)?.focus();\n // No-op for menus without a marked scroller (native focus handles scroll).\n this.scrollOptionIntoView(index);\n }\n\n protected scrollOptionIntoView(index: number): void {\n const scroller = this.optionsScroller();\n const option = this.optionElement(index);\n\n if (!scroller || !option) {\n return;\n }\n\n const optionTop = option.offsetTop - scroller.offsetTop;\n const optionBottom = optionTop + option.offsetHeight;\n const visibleTop = scroller.scrollTop;\n const visibleBottom = visibleTop + scroller.clientHeight;\n\n if (optionTop < visibleTop) {\n scroller.scrollTop = optionTop;\n } else if (optionBottom > visibleBottom) {\n scroller.scrollTop = optionBottom - scroller.clientHeight;\n }\n }\n\n private getNextIndex(index: number, delta: number): number {\n return wrapIndex(index, delta, this.optionList().length);\n }\n\n private optionElement(index: number): HTMLElement | null {\n return this.elementRef.nativeElement.querySelector<HTMLElement>(\n `[${SUGGESTION_OPTION_INDEX_ATTR}=\"${index}\"]`,\n );\n }\n\n private optionsScroller(): HTMLElement | null {\n return this.elementRef.nativeElement.querySelector<HTMLElement>(\n `[${SUGGESTION_OPTIONS_SCROLLER_ATTR}]`,\n );\n }\n}\n","import { DestroyRef, signal } from '@angular/core';\nimport {\n DragHandleCommandValue,\n DragHandleMoveCommandValue,\n QalmaEditorController,\n} from '@qalma/editor';\nimport { anchorToRect } from './anchor-to-rect';\n\nconst DRAG_START_DISTANCE = 8;\nconst HANDLE_EDGE_MARGIN = 8;\nconst HANDLE_GAP = 8;\nconst HANDLE_BUTTON_SIZE = 30;\nconst DROP_LINE_EDGE_MARGIN = 8;\n\nexport interface QalmaDragHandleView {\n target: DragHandleCommandValue;\n transform: string;\n blockType: string;\n canMoveUp: boolean;\n canMoveDown: boolean;\n}\n\nexport interface QalmaDragDropIndicator {\n target: DragHandleMoveCommandValue;\n transform: string;\n width: number;\n}\n\nexport interface QalmaDragBlockHighlight {\n transform: string;\n width: number;\n height: number;\n}\n\ninterface QalmaDragSession {\n handle: QalmaDragHandleView;\n sourceBlock: HTMLElement;\n originX: number;\n originY: number;\n dragging: boolean;\n previousBodyCursor: string;\n previousBodyUserSelect: string;\n pointerMove: (event: Event) => void;\n pointerUp: (event: Event) => void;\n pointerCancel: (event: Event) => void;\n}\n\ninterface DragHandleBlockRange extends DragHandleCommandValue {\n to: number;\n}\n\ninterface DragDropCandidate {\n target: DragHandleMoveCommandValue;\n lineX: number;\n lineY: number;\n lineWidth: number;\n}\n\nexport class QalmaDragHandleController {\n private readonly handleState = signal<QalmaDragHandleView | null>(null);\n private readonly dropIndicatorState =\n signal<QalmaDragDropIndicator | null>(null);\n private readonly draggedBlockHighlightState =\n signal<QalmaDragBlockHighlight | null>(null);\n\n readonly handle = this.handleState.asReadonly();\n readonly dropIndicator = this.dropIndicatorState.asReadonly();\n readonly draggedBlockHighlight = this.draggedBlockHighlightState.asReadonly();\n\n private surface: HTMLElement | null = null;\n private currentBlock: HTMLElement | null = null;\n private pendingBlock: HTMLElement | null = null;\n private lastPointerClientY: number | null = null;\n private refreshFrame: number | null = null;\n private handleKey: string | null = null;\n private dragSession: QalmaDragSession | null = null;\n\n constructor(private readonly editor: () => QalmaEditorController) {}\n\n connect(surface: HTMLElement, destroyRef: DestroyRef): void {\n this.surface = surface;\n\n const pointerMove = (event: Event) => this.handlePointerMove(event);\n const pointerLeave = (event: Event) => this.handlePointerLeave(event);\n const scheduleRefresh = () => this.scheduleRefresh();\n\n surface.addEventListener('pointermove', pointerMove, {\n passive: true,\n });\n surface.addEventListener('mouseleave', pointerLeave);\n surface.addEventListener('scroll', scheduleRefresh, {\n passive: true,\n });\n window.addEventListener('scroll', scheduleRefresh, {\n passive: true,\n });\n window.addEventListener('resize', scheduleRefresh, {\n passive: true,\n });\n\n destroyRef.onDestroy(() => {\n this.finishDrag(false);\n this.cancelScheduledRefresh();\n this.surface = null;\n this.currentBlock = null;\n this.pendingBlock = null;\n surface.removeEventListener('pointermove', pointerMove);\n surface.removeEventListener('mouseleave', pointerLeave);\n surface.removeEventListener('scroll', scheduleRefresh);\n window.removeEventListener('scroll', scheduleRefresh);\n window.removeEventListener('resize', scheduleRefresh);\n });\n }\n\n hide(): void {\n this.currentBlock = null;\n this.pendingBlock = null;\n this.lastPointerClientY = null;\n this.cancelScheduledRefresh();\n this.setHandle(null);\n }\n\n startDrag(event: PointerEvent, handle: QalmaDragHandleView): void {\n if (event.button !== 0 || this.dragSession) {\n return;\n }\n\n const surface = this.surface;\n const sourceBlock =\n surface && findDragHandleBlockByPos(surface, handle.target.pos);\n\n if (!surface || !sourceBlock) {\n return;\n }\n\n event.preventDefault();\n\n const session: QalmaDragSession = {\n handle,\n sourceBlock,\n originX: event.clientX,\n originY: event.clientY,\n dragging: false,\n previousBodyCursor: document.body.style.cursor,\n previousBodyUserSelect: document.body.style.userSelect,\n pointerMove: (moveEvent) => this.handleDragPointerMove(moveEvent),\n pointerUp: (upEvent) => this.handleDragPointerUp(upEvent),\n pointerCancel: () => this.finishDrag(false),\n };\n\n this.dragSession = session;\n window.addEventListener('pointermove', session.pointerMove, {\n passive: false,\n });\n window.addEventListener('pointerup', session.pointerUp, {\n passive: false,\n });\n window.addEventListener('pointercancel', session.pointerCancel);\n }\n\n private handlePointerMove(event: Event): void {\n if (this.dragSession?.dragging) {\n return;\n }\n\n const surface = this.surface;\n const target = event.target;\n\n if (!surface || !(target instanceof Element)) {\n return;\n }\n\n const block = findDragHandleBlock(target, surface);\n\n if (!block) {\n return;\n }\n\n if (event instanceof MouseEvent) {\n this.lastPointerClientY = event.clientY;\n }\n\n this.pendingBlock = block;\n this.scheduleRefresh();\n }\n\n private handlePointerLeave(event: Event): void {\n if (this.dragSession?.dragging) {\n return;\n }\n\n const relatedTarget =\n event instanceof MouseEvent ? event.relatedTarget : null;\n\n if (\n relatedTarget instanceof Element &&\n relatedTarget.closest('[data-qalma-drag-handle]')\n ) {\n return;\n }\n\n this.hide();\n }\n\n private handleDragPointerMove(event: Event): void {\n const session = this.dragSession;\n\n if (!session || !(event instanceof MouseEvent)) {\n return;\n }\n\n const distance = Math.hypot(\n event.clientX - session.originX,\n event.clientY - session.originY,\n );\n\n if (!session.dragging && distance < DRAG_START_DISTANCE) {\n return;\n }\n\n event.preventDefault();\n\n if (!session.dragging) {\n this.activateDragSession(session);\n }\n\n this.updateDropIndicator(event.clientY);\n }\n\n private handleDragPointerUp(event: Event): void {\n if (this.dragSession?.dragging && event instanceof MouseEvent) {\n event.preventDefault();\n }\n\n this.finishDrag(true);\n }\n\n private activateDragSession(session: QalmaDragSession): void {\n session.dragging = true;\n this.surface?.setAttribute('data-qalma-drag-active', 'true');\n document.body.style.cursor = 'grabbing';\n document.body.style.userSelect = 'none';\n this.updateDraggedBlockHighlight(session.sourceBlock);\n }\n\n private updateDropIndicator(clientY: number): void {\n const surface = this.surface;\n const session = this.dragSession;\n const candidate =\n surface && session\n ? findDragDropCandidate(surface, session.handle.target.pos, clientY)\n : null;\n\n if (\n !candidate ||\n !this.editor().canExecute('moveBlockTo', candidate.target)\n ) {\n this.setDropIndicator(null);\n\n return;\n }\n\n this.setDropIndicator({\n target: candidate.target,\n transform: `translate3d(${Math.round(candidate.lineX)}px, ${Math.round(candidate.lineY)}px, 0)`,\n width: Math.round(candidate.lineWidth),\n });\n }\n\n private updateDraggedBlockHighlight(block: HTMLElement): void {\n const rect = block.getBoundingClientRect();\n\n this.draggedBlockHighlightState.set({\n transform: `translate3d(${Math.round(rect.left)}px, ${Math.round(rect.top)}px, 0)`,\n width: Math.round(rect.width),\n height: Math.round(rect.height),\n });\n }\n\n private finishDrag(shouldDrop: boolean): void {\n const session = this.dragSession;\n\n if (!session) {\n return;\n }\n\n const dropTarget = this.dropIndicatorState()?.target ?? null;\n\n window.removeEventListener('pointermove', session.pointerMove);\n window.removeEventListener('pointerup', session.pointerUp);\n window.removeEventListener('pointercancel', session.pointerCancel);\n this.surface?.removeAttribute('data-qalma-drag-active');\n document.body.style.cursor = session.previousBodyCursor;\n document.body.style.userSelect = session.previousBodyUserSelect;\n this.dragSession = null;\n this.setDropIndicator(null);\n this.draggedBlockHighlightState.set(null);\n\n if (shouldDrop && session.dragging && dropTarget) {\n this.editor().execute('moveBlockTo', dropTarget);\n this.hide();\n }\n }\n\n private scheduleRefresh(): void {\n if (this.refreshFrame !== null) {\n return;\n }\n\n this.refreshFrame = requestAnimationFrame(() => {\n this.refreshFrame = null;\n this.refresh();\n });\n }\n\n private refresh(): void {\n const block = this.pendingBlock ?? this.currentBlock;\n this.pendingBlock = null;\n\n if (!block) {\n this.hide();\n\n return;\n }\n\n this.updateFromBlock(block);\n }\n\n private updateFromBlock(block: HTMLElement): void {\n const surface = this.surface;\n const target = parseDragHandleTarget(block);\n\n if (!surface || !target) {\n this.hide();\n\n return;\n }\n\n const rect = block.getBoundingClientRect();\n\n if (!isRectVisibleInsideSurface(rect, surface)) {\n this.hide();\n\n return;\n }\n\n const surfaceRect = surface.getBoundingClientRect();\n const position = anchorToRect(rect, {\n placement: 'left',\n boundary: surfaceRect,\n size: { width: HANDLE_BUTTON_SIZE, height: HANDLE_BUTTON_SIZE },\n gap: HANDLE_GAP,\n edgeMargin: HANDLE_EDGE_MARGIN,\n align: this.lastPointerClientY ?? rect.top + rect.height / 2,\n });\n const canMoveUp = this.editor().canExecute('moveBlockUp', target);\n const canMoveDown = this.editor().canExecute('moveBlockDown', target);\n\n this.currentBlock = block;\n this.setHandle({\n target,\n transform: `translate3d(${Math.round(position.left)}px, ${Math.round(position.top)}px, 0)`,\n blockType: block.dataset['qalmaDragHandleType'] ?? 'block',\n canMoveUp,\n canMoveDown,\n });\n }\n\n private cancelScheduledRefresh(): void {\n if (this.refreshFrame === null) {\n return;\n }\n\n cancelAnimationFrame(this.refreshFrame);\n this.refreshFrame = null;\n }\n\n private setHandle(handle: QalmaDragHandleView | null): void {\n const nextKey = handle\n ? [\n handle.target.pos,\n handle.transform,\n handle.blockType,\n handle.canMoveUp,\n handle.canMoveDown,\n ].join(':')\n : null;\n\n if (nextKey === this.handleKey) {\n return;\n }\n\n this.handleKey = nextKey;\n this.handleState.set(handle);\n }\n\n private setDropIndicator(\n indicator: QalmaDragDropIndicator | null,\n ): void {\n this.dropIndicatorState.set(indicator);\n }\n}\n\nfunction findDragDropCandidate(\n surface: HTMLElement,\n sourcePos: number,\n clientY: number,\n): DragDropCandidate | null {\n const blocks = Array.from(\n surface.querySelectorAll<HTMLElement>('[data-qalma-drag-handle-block]'),\n );\n const lineRect = getDropLineRect(surface);\n let lastCandidate: DragDropCandidate | null = null;\n\n for (const block of blocks) {\n const range = parseDragHandleBlockRange(block);\n\n if (!range) {\n continue;\n }\n\n const rect = block.getBoundingClientRect();\n const midpoint = rect.top + rect.height / 2;\n\n if (clientY < midpoint) {\n return {\n target: {\n pos: sourcePos,\n targetPos: range.pos,\n },\n lineX: lineRect.left,\n lineY: rect.top,\n lineWidth: lineRect.width,\n };\n }\n\n lastCandidate = {\n target: {\n pos: sourcePos,\n targetPos: range.to,\n },\n lineX: lineRect.left,\n lineY: rect.bottom,\n lineWidth: lineRect.width,\n };\n }\n\n return lastCandidate;\n}\n\nfunction getDropLineRect(surface: HTMLElement): {\n left: number;\n width: number;\n} {\n const content = surface.querySelector<HTMLElement>('.ProseMirror') ?? surface;\n const rect = content.getBoundingClientRect();\n const width = Math.max(0, rect.width - DROP_LINE_EDGE_MARGIN * 2);\n\n return {\n left: rect.left + DROP_LINE_EDGE_MARGIN,\n width,\n };\n}\n\nfunction findDragHandleBlock(\n target: Element,\n surface: HTMLElement,\n): HTMLElement | null {\n const block = target.closest<HTMLElement>('[data-qalma-drag-handle-block]');\n\n return block && surface.contains(block) ? block : null;\n}\n\nfunction findDragHandleBlockByPos(\n surface: HTMLElement,\n pos: number,\n): HTMLElement | null {\n const blocks = Array.from(\n surface.querySelectorAll<HTMLElement>('[data-qalma-drag-handle-block]'),\n );\n\n return (\n blocks.find((block) => parseDragHandleTarget(block)?.pos === pos) ?? null\n );\n}\n\nfunction parseDragHandleTarget(\n block: HTMLElement,\n): DragHandleCommandValue | null {\n const pos = Number(block.dataset['qalmaDragHandlePos']);\n\n return Number.isInteger(pos) ? { pos } : null;\n}\n\nfunction parseDragHandleBlockRange(\n block: HTMLElement,\n): DragHandleBlockRange | null {\n const target = parseDragHandleTarget(block);\n const to = Number(block.dataset['qalmaDragHandleTo']);\n\n return target && Number.isInteger(to) ? { ...target, to } : null;\n}\n\nfunction isRectVisibleInsideSurface(\n rect: DOMRect,\n surface: HTMLElement,\n): boolean {\n const surfaceRect = surface.getBoundingClientRect();\n\n return (\n rect.bottom > surfaceRect.top &&\n rect.top < surfaceRect.bottom &&\n rect.right > surfaceRect.left &&\n rect.left < surfaceRect.right\n );\n}\n","import {\n Directive,\n DestroyRef,\n ElementRef,\n afterNextRender,\n inject,\n input,\n} from '@angular/core';\nimport { QalmaEditorController } from '@qalma/editor';\n\nimport {\n QalmaDragHandleController,\n QalmaDragHandleView,\n} from './drag-handle-controller';\n\n@Directive({\n exportAs: 'qalmaDragHandle',\n selector: '[qalmaDragHandle]',\n})\nexport class QalmaDragHandleDirective {\n readonly editor = input.required<QalmaEditorController>({\n alias: 'qalmaDragHandle',\n });\n\n private readonly destroyRef = inject(DestroyRef);\n private readonly host = inject<ElementRef<HTMLElement>>(ElementRef);\n private readonly controller = new QalmaDragHandleController(() =>\n this.editor(),\n );\n\n readonly handle = this.controller.handle;\n readonly dropIndicator = this.controller.dropIndicator;\n readonly draggedBlockHighlight = this.controller.draggedBlockHighlight;\n\n constructor() {\n afterNextRender(() => {\n this.controller.connect(this.host.nativeElement, this.destroyRef);\n });\n }\n\n hide(): void {\n this.controller.hide();\n }\n\n startDrag(event: PointerEvent, handle: QalmaDragHandleView): void {\n this.controller.startDrag(event, handle);\n }\n}\n","import { DestroyRef, signal } from '@angular/core';\nimport {\n QalmaEditorController,\n SelectionState,\n} from '@qalma/editor';\n\n/**\n * Fixed-position placement for a selection/contextual toolbar: a ready-to-apply\n * CSS `transform` that pins the toolbar above the current selection rect.\n * Produced by {@link QalmaSelectionToolbarController}; consumed by the styled\n * `QalmaContextualToolbar` (or any custom bubble toolbar).\n */\nexport interface QalmaContextualToolbarPlacement {\n transform: string;\n}\n\nconst TOOLBAR_EDGE_MARGIN = 16;\nconst TOOLBAR_GAP = 8;\n\nexport class QalmaSelectionToolbarController {\n private readonly placementState =\n signal<QalmaContextualToolbarPlacement | null>(null);\n readonly placement = this.placementState.asReadonly();\n\n private surface: HTMLElement | null = null;\n private refreshFrame: number | null = null;\n private placementKey: string | null = null;\n\n constructor(private readonly editor: () => QalmaEditorController) {}\n\n connect(surface: HTMLElement, destroyRef: DestroyRef): void {\n this.surface = surface;\n\n const refresh = () => this.refresh();\n const scheduleRefresh = () => this.scheduleRefresh();\n const handleKeydown = (event: Event) => this.handleKeydown(event);\n\n surface.addEventListener('qalma-selection-update', refresh);\n surface.addEventListener('keydown', handleKeydown);\n surface.addEventListener('keyup', refresh);\n surface.addEventListener('mouseup', refresh);\n surface.addEventListener('scroll', scheduleRefresh, {\n passive: true,\n });\n window.addEventListener('scroll', scheduleRefresh, {\n passive: true,\n });\n window.addEventListener('resize', scheduleRefresh, {\n passive: true,\n });\n\n destroyRef.onDestroy(() => {\n this.cancelScheduledRefresh();\n this.surface = null;\n surface.removeEventListener('qalma-selection-update', refresh);\n surface.removeEventListener('keydown', handleKeydown);\n surface.removeEventListener('keyup', refresh);\n surface.removeEventListener('mouseup', refresh);\n surface.removeEventListener('scroll', scheduleRefresh);\n window.removeEventListener('scroll', scheduleRefresh);\n window.removeEventListener('resize', scheduleRefresh);\n });\n }\n\n refresh(): void {\n const surface = this.surface;\n const selection = this.editor().query<SelectionState>('selection');\n\n if (\n !surface ||\n !selection ||\n selection.empty ||\n selection.text.trim().length === 0\n ) {\n this.hide();\n\n return;\n }\n\n const domSelection = window.getSelection();\n\n if (\n !domSelection ||\n domSelection.rangeCount === 0 ||\n !isSelectionInsideSurface(domSelection, surface)\n ) {\n this.hide();\n\n return;\n }\n\n const rect = getVisibleSelectionRect(domSelection.getRangeAt(0));\n\n if (!rect || !isRectVisibleInsideSurface(rect, surface)) {\n this.hide();\n\n return;\n }\n\n const viewportWidth =\n document.documentElement.clientWidth || window.innerWidth;\n const x = Math.round(\n clamp(\n rect.left + rect.width / 2,\n TOOLBAR_EDGE_MARGIN,\n viewportWidth - TOOLBAR_EDGE_MARGIN,\n ),\n );\n const y = Math.round(Math.max(TOOLBAR_EDGE_MARGIN, rect.top - TOOLBAR_GAP));\n\n this.setPlacement({\n transform: `translate3d(${x}px, ${y}px, 0) translate(-50%, -100%)`,\n });\n }\n\n hide(): void {\n this.setPlacement(null);\n }\n\n handleKeydown(event: Event): void {\n if (\n !(event instanceof KeyboardEvent) ||\n event.key !== 'Escape' ||\n !this.placement()\n ) {\n return;\n }\n\n event.preventDefault();\n this.hide();\n }\n\n private scheduleRefresh(): void {\n if (!this.placement() || this.refreshFrame !== null) {\n return;\n }\n\n this.refreshFrame = requestAnimationFrame(() => {\n this.refreshFrame = null;\n this.refresh();\n });\n }\n\n private cancelScheduledRefresh(): void {\n if (this.refreshFrame === null) {\n return;\n }\n\n cancelAnimationFrame(this.refreshFrame);\n this.refreshFrame = null;\n }\n\n private setPlacement(\n placement: QalmaContextualToolbarPlacement | null,\n ): void {\n const nextKey = placement?.transform ?? null;\n\n if (nextKey === this.placementKey) {\n return;\n }\n\n this.placementKey = nextKey;\n this.placementState.set(placement);\n }\n}\n\nfunction getVisibleSelectionRect(range: Range): DOMRect | null {\n const rect = range.getBoundingClientRect();\n\n if (rect.width > 0 || rect.height > 0) {\n return rect;\n }\n\n for (const clientRect of Array.from(range.getClientRects())) {\n if (clientRect.width > 0 || clientRect.height > 0) {\n return clientRect;\n }\n }\n\n return null;\n}\n\nfunction isSelectionInsideSurface(\n selection: globalThis.Selection,\n surface: HTMLElement,\n): boolean {\n return (\n isNodeInsideSurface(selection.anchorNode, surface) &&\n isNodeInsideSurface(selection.focusNode, surface)\n );\n}\n\nfunction isNodeInsideSurface(node: Node | null, surface: HTMLElement): boolean {\n const element = node instanceof Element ? node : node?.parentElement;\n\n return Boolean(element && surface.contains(element));\n}\n\nfunction isRectVisibleInsideSurface(\n rect: DOMRect,\n surface: HTMLElement,\n): boolean {\n const surfaceRect = surface.getBoundingClientRect();\n\n return (\n rect.bottom > surfaceRect.top &&\n rect.top < surfaceRect.bottom &&\n rect.right > surfaceRect.left &&\n rect.left < surfaceRect.right\n );\n}\n\nfunction clamp(value: number, min: number, max: number): number {\n return Math.min(Math.max(value, min), max);\n}\n","import {\n Directive,\n DestroyRef,\n ElementRef,\n afterNextRender,\n inject,\n input,\n} from '@angular/core';\nimport { QalmaEditorController } from '@qalma/editor';\n\nimport { QalmaSelectionToolbarController } from './selection-toolbar-controller';\n\n@Directive({\n exportAs: 'qalmaSelectionToolbar',\n selector: '[qalmaSelectionToolbar]',\n})\nexport class QalmaSelectionToolbarDirective {\n readonly editor = input.required<QalmaEditorController>({\n alias: 'qalmaSelectionToolbar',\n });\n\n private readonly destroyRef = inject(DestroyRef);\n private readonly host = inject<ElementRef<HTMLElement>>(ElementRef);\n private readonly controller = new QalmaSelectionToolbarController(() =>\n this.editor(),\n );\n\n readonly placement = this.controller.placement;\n\n constructor() {\n afterNextRender(() => {\n this.controller.connect(this.host.nativeElement, this.destroyRef);\n });\n }\n\n refresh(): void {\n this.controller.refresh();\n }\n\n hide(): void {\n this.controller.hide();\n }\n}\n","import { anchorToRect } from './anchor-to-rect';\n\nexport interface LinkPopover extends LinkPopoverPlacement {\n editing: boolean;\n element: HTMLAnchorElement | null;\n href: string;\n rel: string | null;\n target: '_blank' | null;\n text: string;\n}\n\nexport interface LinkPopoverPlacement {\n left: number;\n top: number;\n}\n\nconst LINK_POPOVER_WIDTH = 360;\n// Both the editing and preview rows are a single h-9 (36px) control plus\n// padding/border; this is an estimate since the actual element isn't\n// rendered yet when the placement is computed.\nconst LINK_POPOVER_HEIGHT_ESTIMATE = 56;\n\nexport function createLinkPopoverPlacement(\n element: HTMLElement,\n): LinkPopoverPlacement {\n const rect = element.getBoundingClientRect();\n\n return anchorToRect(rect, {\n placement: 'bottom',\n boundary: {\n top: 0,\n bottom: window.innerHeight,\n left: 0,\n right: window.innerWidth,\n },\n size: { width: LINK_POPOVER_WIDTH, height: LINK_POPOVER_HEIGHT_ESTIMATE },\n gap: 8,\n edgeMargin: 16,\n align: 'start',\n });\n}\n\nexport function findEditorLinkElement(\n target: EventTarget | null,\n): HTMLAnchorElement | null {\n if (!(target instanceof Element)) {\n return null;\n }\n\n const element = target.closest<HTMLAnchorElement>('.ProseMirror a[href]');\n\n return element instanceof HTMLAnchorElement ? element : null;\n}\n","import { signal } from '@angular/core';\nimport { LinkState, QalmaEditorController } from '@qalma/editor';\n\nimport {\n createLinkPopoverPlacement,\n findEditorLinkElement,\n LinkPopover,\n} from './link-popover.model';\n\nexport class LinkPopoverController {\n readonly popover = signal<LinkPopover | null>(null);\n readonly href = signal('');\n\n private hideTimeout: ReturnType<typeof setTimeout> | undefined;\n\n constructor(private readonly editor: QalmaEditorController) {}\n\n showToolbarEditor(event: MouseEvent): void {\n const linkState = this.editor.query<LinkState>('link');\n const target = event.currentTarget;\n\n if (!(target instanceof HTMLElement)) {\n return;\n }\n\n this.keepOpen();\n this.href.set(linkState?.href ?? 'https://');\n this.popover.set({\n ...createLinkPopoverPlacement(target),\n editing: true,\n element: null,\n href: linkState?.href ?? '',\n rel: linkState?.rel ?? null,\n target: linkState?.target ?? null,\n text: linkState?.text ?? '',\n });\n }\n\n showPreview(event: Event): void {\n const element = findEditorLinkElement(event.target);\n\n if (!element) {\n return;\n }\n\n this.keepOpen();\n this.popover.set({\n ...createLinkPopoverPlacement(element),\n editing: false,\n element,\n href: element.href,\n rel: element.rel || null,\n target: element.target === '_blank' ? '_blank' : null,\n text: element.textContent?.trim() ?? '',\n });\n }\n\n scheduleHideFromEvent(event: MouseEvent | FocusEvent): void {\n const nextTarget = event.relatedTarget;\n\n if (\n nextTarget instanceof Element &&\n (findEditorLinkElement(nextTarget) ||\n nextTarget.closest('[data-qalma-link-popover]'))\n ) {\n return;\n }\n\n if (!this.popover()?.editing) {\n this.scheduleHide();\n }\n }\n\n edit(popover: LinkPopover): void {\n this.keepOpen();\n this.selectLink(popover);\n this.href.set(popover.href);\n this.popover.set({\n ...popover,\n editing: true,\n });\n }\n\n save(popover: LinkPopover): void {\n const href = this.href().trim();\n\n if (!href) {\n return;\n }\n\n this.selectLink(popover);\n this.editor.execute('setLink', href);\n this.hide();\n }\n\n remove(popover: LinkPopover): void {\n this.selectLink(popover);\n this.editor.execute('unsetLink');\n this.hide();\n }\n\n hide(): void {\n this.clearHideTimeout();\n this.popover.set(null);\n }\n\n keepOpen(): void {\n this.clearHideTimeout();\n }\n\n scheduleHide(): void {\n this.clearHideTimeout();\n\n if (this.popover()?.editing) {\n return;\n }\n\n this.hideTimeout = setTimeout(() => {\n if (this.popover()?.editing) {\n this.hideTimeout = undefined;\n\n return;\n }\n\n this.popover.set(null);\n this.hideTimeout = undefined;\n }, 160);\n }\n\n private selectLink(popover: LinkPopover): void {\n if (popover.element) {\n this.editor.execute('selectLink', {\n element: popover.element,\n });\n }\n }\n\n private clearHideTimeout(): void {\n if (!this.hideTimeout) {\n return;\n }\n\n clearTimeout(this.hideTimeout);\n this.hideTimeout = undefined;\n }\n}\n","// @qalma/kit/headless — dependency-free behavior for the Qalma editor.\n//\n// Controllers, geometry helpers, dismiss/keyboard primitives and unstyled\n// directives, with zero styling dependencies — no CSS-class or icon libraries.\n// Import from here when you bring your own design system and only want the\n// editor behavior wired up; import from `@qalma/kit` for the styled components.\n\n// Positioning geometry\nexport * from './lib/anchor-to-rect';\nexport * from './lib/flip-above-placement';\n\n// Overlay + list navigation primitives\nexport * from './lib/dismissible-overlay';\nexport * from './lib/keyboard-navigable-list';\nexport * from './lib/suggestion-menu-base';\n\n// Editor-aware controllers + unstyled directives\nexport * from './lib/drag-handle-controller';\nexport * from './lib/drag-handle-directive';\nexport * from './lib/selection-toolbar-controller';\nexport * from './lib/selection-toolbar-directive';\nexport * from './lib/link-popover-controller';\nexport * from './lib/link-popover.model';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["DEFAULT_GAP","clamp","isRectVisibleInsideSurface"],"mappings":";;;AAyCA,MAAMA,aAAW,GAAG,CAAC;AACrB,MAAM,mBAAmB,GAAG,CAAC;AAEvB,SAAU,YAAY,CAC1B,MAAkB,EAClB,OAA4B,EAAA;AAE5B,IAAA,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,IAAIA,aAAW;AACtC,IAAA,MAAM,UAAU,GAAG,OAAO,CAAC,UAAU,IAAI,mBAAmB;AAC5D,IAAA,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,OAAO;AAElC,IAAA,IAAI,OAAO,CAAC,SAAS,KAAK,MAAM,IAAI,OAAO,CAAC,SAAS,KAAK,OAAO,EAAE;AACjE,QAAA,MAAM,QAAQ,GACZ,OAAO,CAAC,SAAS,KAAK;cAClB,MAAM,CAAC,IAAI,GAAG,GAAG,GAAG,IAAI,CAAC;AAC3B,cAAE,MAAM,CAAC,KAAK,GAAG,GAAG;QACxB,MAAM,SAAS,GAAG,gBAAgB,CAChC,OAAO,CAAC,KAAK,EACb,MAAM,CAAC,GAAG,EACV,MAAM,CAAC,MAAM,EACb,IAAI,CAAC,MAAM,CACZ;QAED,OAAO;YACL,IAAI,EAAEC,OAAK,CACT,QAAQ,EACR,QAAQ,CAAC,IAAI,GAAG,UAAU,EAC1B,QAAQ,CAAC,KAAK,GAAG,UAAU,GAAG,IAAI,CA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