@raqm/ui 0.1.2 → 0.2.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.
Files changed (96) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/README.md +87 -126
  3. package/fesm2022/raqm-ui-badge.mjs +3 -1
  4. package/fesm2022/raqm-ui-badge.mjs.map +1 -1
  5. package/fesm2022/raqm-ui-calendar.mjs +79 -12
  6. package/fesm2022/raqm-ui-calendar.mjs.map +1 -1
  7. package/fesm2022/raqm-ui-combobox.mjs +47 -23
  8. package/fesm2022/raqm-ui-combobox.mjs.map +1 -1
  9. package/fesm2022/raqm-ui-command.mjs +60 -12
  10. package/fesm2022/raqm-ui-command.mjs.map +1 -1
  11. package/fesm2022/raqm-ui-dialog.mjs +1 -3
  12. package/fesm2022/raqm-ui-dialog.mjs.map +1 -1
  13. package/fesm2022/raqm-ui-icon.mjs +160 -0
  14. package/fesm2022/raqm-ui-icon.mjs.map +1 -0
  15. package/fesm2022/raqm-ui-input-otp.mjs +7 -4
  16. package/fesm2022/raqm-ui-input-otp.mjs.map +1 -1
  17. package/fesm2022/raqm-ui-overlay-internal.mjs +15 -5
  18. package/fesm2022/raqm-ui-overlay-internal.mjs.map +1 -1
  19. package/fesm2022/raqm-ui-popover.mjs +51 -19
  20. package/fesm2022/raqm-ui-popover.mjs.map +1 -1
  21. package/fesm2022/raqm-ui-resizable.mjs +14 -4
  22. package/fesm2022/raqm-ui-resizable.mjs.map +1 -1
  23. package/fesm2022/raqm-ui-scroll-area.mjs +85 -29
  24. package/fesm2022/raqm-ui-scroll-area.mjs.map +1 -1
  25. package/fesm2022/raqm-ui-select.mjs +46 -19
  26. package/fesm2022/raqm-ui-select.mjs.map +1 -1
  27. package/fesm2022/raqm-ui-sidebar.mjs +13 -3
  28. package/fesm2022/raqm-ui-sidebar.mjs.map +1 -1
  29. package/fesm2022/raqm-ui-slider.mjs +59 -12
  30. package/fesm2022/raqm-ui-slider.mjs.map +1 -1
  31. package/fesm2022/raqm-ui-toast.mjs +60 -20
  32. package/fesm2022/raqm-ui-toast.mjs.map +1 -1
  33. package/fesm2022/raqm-ui-tooltip.mjs +28 -3
  34. package/fesm2022/raqm-ui-tooltip.mjs.map +1 -1
  35. package/fesm2022/raqm-ui.mjs +1 -0
  36. package/package.json +52 -18
  37. package/styles/accordion.css +1 -0
  38. package/styles/alert-dialog.css +1 -0
  39. package/styles/alert.css +1 -0
  40. package/styles/attachment.css +1 -0
  41. package/styles/avatar.css +1 -0
  42. package/styles/badge.css +1 -0
  43. package/styles/base.css +1 -0
  44. package/styles/button-group.css +1 -0
  45. package/styles/button.css +1 -0
  46. package/styles/checkbox.css +1 -0
  47. package/styles/combobox.css +1 -0
  48. package/styles/command.css +1 -0
  49. package/styles/common.css +17 -0
  50. package/styles/context-menu.css +1 -0
  51. package/styles/dialog.css +1 -0
  52. package/styles/drawer.css +1 -0
  53. package/styles/dropdown-menu.css +1 -0
  54. package/styles/empty.css +1 -0
  55. package/styles/field-parts.css +1 -0
  56. package/styles/field-relationships.css +1 -0
  57. package/styles/input-group-button.css +1 -0
  58. package/styles/input-group-relationships.css +1 -0
  59. package/styles/input-otp.css +1 -0
  60. package/styles/input.css +1 -0
  61. package/styles/item.css +1 -0
  62. package/styles/kbd.css +1 -0
  63. package/styles/menubar.css +1 -0
  64. package/styles/native-select.css +1 -0
  65. package/styles/navigation-menu.css +1 -0
  66. package/styles/overlay.css +1 -0
  67. package/styles/pagination.css +1 -0
  68. package/styles/popover.css +1 -0
  69. package/styles/questionnaire.css +1 -0
  70. package/styles/radio-group.css +1 -0
  71. package/styles/resizable.css +1 -0
  72. package/styles/sheet.css +1 -0
  73. package/styles/sidebar.css +1 -0
  74. package/styles/spinner.css +1 -0
  75. package/styles/switch.css +1 -0
  76. package/styles/table.css +1 -0
  77. package/styles/tabs.css +1 -0
  78. package/styles/textarea.css +1 -0
  79. package/styles/theme.css +50 -4324
  80. package/styles/toggle-group.css +1 -0
  81. package/styles/toggle.css +1 -0
  82. package/styles/tooltip.css +1 -0
  83. package/types/raqm-ui-calendar.d.ts +1 -0
  84. package/types/raqm-ui-combobox.d.ts +8 -4
  85. package/types/raqm-ui-command.d.ts +4 -0
  86. package/types/raqm-ui-dialog.d.ts +7 -1
  87. package/types/raqm-ui-icon.d.ts +65 -0
  88. package/types/raqm-ui-input-otp.d.ts +1 -0
  89. package/types/raqm-ui-resizable.d.ts +4 -0
  90. package/types/raqm-ui-scroll-area.d.ts +11 -0
  91. package/types/raqm-ui-slider.d.ts +1 -1
  92. package/types/raqm-ui-toast.d.ts +6 -0
  93. package/types/raqm-ui.d.ts +1 -0
  94. package/fesm2022/raqm-ui-carousel.mjs +0 -410
  95. package/fesm2022/raqm-ui-carousel.mjs.map +0 -1
  96. package/types/raqm-ui-carousel.d.ts +0 -81
@@ -1 +1 @@
1
- {"version":3,"file":"raqm-ui-popover.mjs","names":[],"sources":["../../../projects/ui/popover/popover-context.ts","../../../projects/ui/popover/popover-dismiss.ts","../../../projects/ui/popover/popover-effects.ts","../../../projects/ui/popover/popover-model.ts","../../../projects/ui/popover/popover-keyboard.ts","../../../projects/ui/popover/popover-overlay.ts","../../../projects/ui/popover/popover-position.ts","../../../projects/ui/popover/popover-registration.ts","../../../projects/ui/popover/popover-sizing.ts","../../../projects/ui/popover/popover-view-state.ts","../../../projects/ui/popover/popover.ts","../../../projects/ui/popover/popover.component.html","../../../projects/ui/popover/popover.directive.ts","../../../projects/ui/popover/public-api.ts"],"sourcesContent":["import { InjectionToken, Signal, TemplateRef } from '@angular/core';\r\n\r\nexport interface RaqmPopoverTriggerRef {\r\n /** The native `<button>` the root anchors the overlay to and restores focus to. */\r\n readonly element: HTMLButtonElement;\r\n /** Live native disabled state, read by the root's open policy at event time. */\r\n readonly disabled: boolean;\r\n /** Focuses the trigger; used to restore focus on Escape. */\r\n focus(): void;\r\n}\r\n\r\nexport interface RaqmPopoverContext {\r\n /** Whether the popup is currently open (an enabled `open` model). */\r\n readonly open: Signal<boolean>;\r\n /** The id of the live popup element (the `aria-controls` target), or `null`. */\r\n readonly panelId: Signal<string | null>;\r\n /** Registers the single trigger; called once per root. */\r\n registerTrigger(ref: RaqmPopoverTriggerRef): void;\r\n /** Unregisters the trigger on destroy; never changes open state. */\r\n unregisterTrigger(ref: RaqmPopoverTriggerRef): void;\r\n /** Registers the single content template; called once per root. */\r\n registerContent(template: TemplateRef<unknown>): void;\r\n /** Unregisters the content template on destroy. */\r\n unregisterContent(template: TemplateRef<unknown>): void;\r\n /** Registers a popped title element so the root can point `aria-labelledby` at it. */\r\n registerTitle(element: HTMLElement): void;\r\n /** Removes a popped title element on destroy. */\r\n unregisterTitle(element: HTMLElement): void;\r\n /** Registers a popped description element so the root can point `aria-describedby` at it. */\r\n registerDescription(element: HTMLElement): void;\r\n /** Removes a popped description element on destroy. */\r\n unregisterDescription(element: HTMLElement): void;\r\n /** Toggles the popup from a trigger activation (never opens a disabled root). */\r\n toggleFromTrigger(ref: RaqmPopoverTriggerRef): void;\r\n /** Closes the popup as a user action (outside press / Escape / trigger toggle). */\r\n closeFromUser(): void;\r\n /** Moves focus to the first focusable control inside the open popup, else the popup itself. */\r\n focusFirstInPanel(): void;\r\n /** Routes Tab on the trigger into the open popup's first control. */\r\n onTriggerTab(event: KeyboardEvent): void;\r\n}\r\n\r\nexport const RAQM_POPOVER = new InjectionToken<RaqmPopoverContext>('RaqmPopover');\r\n","// Popover dismissal: the focus-out close policy and the root/pane containment test the\r\n// outside-press and focus paths share.\r\n\r\nimport { containsOwnedOverlay } from '@raqm/ui/overlay-internal';\r\n\r\nexport interface RaqmPopoverDismissalHost {\r\n root: HTMLElement;\r\n open(): boolean;\r\n openValue(): boolean;\r\n disabled(): boolean;\r\n canOpen(): boolean;\r\n pane(): HTMLElement | undefined;\r\n generation(): number;\r\n setOpen(value: boolean): void;\r\n}\r\n\r\nexport class RaqmPopoverDismissal {\r\n constructor(private readonly host: RaqmPopoverDismissalHost) {}\r\n\r\n maybeCloseOnFocusOut(event: FocusEvent): void {\r\n const next = event.relatedTarget as Node | null;\r\n if (this.isInsideRootOrOverlay(next)) {\r\n return;\r\n }\r\n if (!this.host.open()) {\r\n return;\r\n }\r\n const target = event.target as Node | null;\r\n const targetInPanel = !!target && this.host.pane()?.contains(target) === true;\r\n // A content swap blurs the discarded node; defer one microtask and re-check the open\r\n // contract, so only a still-valid departure closes.\r\n const generation = this.host.generation();\r\n const overlay = this.host.pane();\r\n queueMicrotask(() => {\r\n if (\r\n generation !== this.host.generation() ||\r\n this.host.pane() !== overlay ||\r\n !this.host.openValue() ||\r\n this.host.disabled() ||\r\n !this.host.canOpen()\r\n ) {\r\n return;\r\n }\r\n if (targetInPanel && target && !target.isConnected) {\r\n return;\r\n }\r\n if (this.isInsideRootOrOverlay(document.activeElement)) {\r\n return;\r\n }\r\n this.setClosed();\r\n });\r\n }\r\n\r\n isInsideRootOrOverlay(node: Node | null): boolean {\r\n if (!node) {\r\n return false;\r\n }\r\n const overlay = this.host.pane();\r\n return (\r\n containsOwnedOverlay(this.host.root, node) ||\r\n (overlay !== undefined && containsOwnedOverlay(overlay, node))\r\n );\r\n }\r\n\r\n setClosed(): void {\r\n if (this.host.openValue()) {\r\n this.host.setOpen(false);\r\n }\r\n }\r\n}\r\n","// Popover effects: the open policy, placement inputs, panel labelling and panel class,\r\n// registered from the component constructor.\r\n\r\nimport { effect, untracked } from '@angular/core';\r\n\r\nimport { RaqmPopoverAlign, RaqmPopoverSide } from './popover-model';\r\n\r\nexport interface RaqmPopoverEffectsHost {\r\n openValue(): boolean;\r\n disabled(): boolean;\r\n canOpen(): boolean;\r\n side(): RaqmPopoverSide;\r\n align(): RaqmPopoverAlign;\r\n sideOffset(): number;\r\n alignOffset(): number;\r\n dir(): 'ltr' | 'rtl' | undefined;\r\n label(): string | undefined;\r\n panelClass(): string | undefined;\r\n syncOpen(next: boolean): void;\r\n applyPositionInputs(): void;\r\n syncPanelAria(): void;\r\n applyPanelClass(panelClass: string | undefined): void;\r\n}\r\n\r\nexport function connectPopoverEffects(host: RaqmPopoverEffectsHost): void {\r\n // Reacts to open + enabled + content present, so a late registration still opens.\r\n // Never reads `attached`, so the open path cannot re-enter its own effect.\r\n effect(() => {\r\n const next = host.openValue() && !host.disabled() && host.canOpen();\r\n untracked(() => host.syncOpen(next));\r\n });\r\n\r\n effect(() => {\r\n host.side();\r\n host.align();\r\n host.sideOffset();\r\n host.alignOffset();\r\n host.dir();\r\n untracked(() => host.applyPositionInputs());\r\n });\r\n\r\n effect(() => {\r\n host.label();\r\n untracked(() => host.syncPanelAria());\r\n });\r\n\r\n effect(() => {\r\n const panelClass = host.panelClass();\r\n untracked(() => host.applyPanelClass(panelClass));\r\n });\r\n}\r\n","// Popover model: the input value types, their defaults, the shared constants and the\r\n// small pure helpers every popover file reads.\r\n\r\nimport { numberAttribute } from '@angular/core';\r\nimport { Directionality } from '@angular/cdk/bidi';\r\n\r\n/** Side values, plus the two direction-resolved logical sides. */\r\nexport type RaqmPopoverSide = 'top' | 'bottom' | 'left' | 'right' | 'inline-start' | 'inline-end';\r\n\r\nexport type RaqmPopoverAlign = 'start' | 'center' | 'end';\r\n\r\n// A side after logical resolution; pane and motion key on this, so RTL needs no separate rule.\r\nexport type RaqmPopoverPhysicalSide = 'top' | 'bottom' | 'left' | 'right';\r\n\r\nconst SIDES: readonly RaqmPopoverSide[] = [\r\n 'top',\r\n 'bottom',\r\n 'left',\r\n 'right',\r\n 'inline-start',\r\n 'inline-end',\r\n];\r\nconst ALIGNS: readonly RaqmPopoverAlign[] = ['start', 'center', 'end'];\r\n\r\nexport const DEFAULT_SIDE: RaqmPopoverSide = 'bottom';\r\nexport const DEFAULT_ALIGN: RaqmPopoverAlign = 'center';\r\nexport const DEFAULT_SIDE_OFFSET = 4;\r\nexport const DEFAULT_ALIGN_OFFSET = 0;\r\nexport const DEFAULT_WIDTH = '18rem';\r\n\r\nexport const VIEWPORT_MARGIN = 5;\r\n\r\n// Content exit duration: equals `--raqm-duration-fast` (100ms) used by the SCSS exit transition.\r\nexport const EXIT_ANIMATION_MS = 100;\r\n\r\n// The connected overlay pane class (a CDK-owned element); the surface is\r\n// `.raqm-popover-content`.\r\nexport const PANE_CLASS = 'raqm-popover-overlay-pane';\r\n\r\n// Candidates for the focus scans; the CDK `InteractivityChecker` decides actual\r\n// focusability/tabbability (native state, visibility, inert ancestors).\r\nexport const FOCUSABLE_SELECTOR =\r\n 'a[href], button, input, select, textarea, [tabindex], [contenteditable=\"true\"]';\r\n\r\nexport interface PopoverBoxSize {\r\n width: number;\r\n height: number;\r\n}\r\n\r\n// Equal within sub-pixel tolerance, so rounding never looks like a real change.\r\nexport function sameBoxSize(a: PopoverBoxSize | undefined, b: PopoverBoxSize | undefined): boolean {\r\n return (\r\n a !== undefined &&\r\n b !== undefined &&\r\n Math.abs(a.width - b.width) <= 1 &&\r\n Math.abs(a.height - b.height) <= 1\r\n );\r\n}\r\n\r\n// Read at each animation decision so no stale value is cached; every teardown has a fallback.\r\nexport function prefersReducedMotion(): boolean {\r\n return typeof matchMedia === 'function' && matchMedia('(prefers-reduced-motion: reduce)').matches;\r\n}\r\n\r\nexport function toSide(value: unknown): RaqmPopoverSide {\r\n return SIDES.includes(value as RaqmPopoverSide) ? (value as RaqmPopoverSide) : DEFAULT_SIDE;\r\n}\r\n\r\nexport function toAlign(value: unknown): RaqmPopoverAlign {\r\n return ALIGNS.includes(value as RaqmPopoverAlign) ? (value as RaqmPopoverAlign) : DEFAULT_ALIGN;\r\n}\r\n\r\nexport function toDir(value: unknown): 'ltr' | 'rtl' | undefined {\r\n return value === 'ltr' || value === 'rtl' ? value : undefined;\r\n}\r\n\r\nexport function toOffset(fallback: number): (value: unknown) => number {\r\n return (value: unknown): number => {\r\n const parsed = numberAttribute(value, fallback);\r\n return Number.isFinite(parsed) ? parsed : fallback;\r\n };\r\n}\r\n\r\n// Explicit input, then the nearest computed direction, then the CDK Bidi value. Reading\r\n// `getComputedStyle` at call time (not in a cached `computed`) keeps an RTL ancestor\r\n// from being frozen to LTR before attachment.\r\nexport function resolvePopoverDirection(\r\n dir: 'ltr' | 'rtl' | undefined,\r\n element: HTMLElement,\r\n directionality: Directionality | null,\r\n): 'ltr' | 'rtl' {\r\n const explicit = dir;\r\n if (explicit === 'ltr' || explicit === 'rtl') {\r\n return explicit;\r\n }\r\n const computedStyle = getComputedStyle(element).direction;\r\n if (computedStyle === 'rtl') {\r\n return 'rtl';\r\n }\r\n if (computedStyle === 'ltr') {\r\n return 'ltr';\r\n }\r\n return directionality?.value ?? 'ltr';\r\n}\r\n","// Popover focus and keyboard: initial focus placement, the open panel's Tab order and the\r\n// panel's Escape handling.\r\n\r\nimport { InteractivityChecker } from '@angular/cdk/a11y';\r\nimport { OverlayRef } from '@angular/cdk/overlay';\r\nimport { containsOwnedOverlay } from '@raqm/ui/overlay-internal';\r\n\r\nimport { RaqmPopoverTriggerRef } from './popover-context';\r\nimport { FOCUSABLE_SELECTOR } from './popover-model';\r\n\r\nexport interface RaqmPopoverKeyboardHost {\r\n root: HTMLElement;\r\n open(): boolean;\r\n openValue(): boolean;\r\n disabled(): boolean;\r\n canOpen(): boolean;\r\n trigger(): RaqmPopoverTriggerRef | null;\r\n pane(): HTMLElement | undefined;\r\n content(): HTMLElement | null;\r\n overlayRef(): OverlayRef | undefined;\r\n generation(): number;\r\n closeFromUser(): void;\r\n}\r\n\r\nexport class RaqmPopoverKeyboard {\r\n constructor(\r\n private readonly checker: InteractivityChecker,\r\n private readonly host: RaqmPopoverKeyboardHost,\r\n ) {}\r\n\r\n focusFirstInPanel(): void {\r\n const content = this.host.content();\r\n if (!content) {\r\n return;\r\n }\r\n const focusable = this.firstFocusable(content);\r\n (focusable ?? content).focus();\r\n }\r\n\r\n onTriggerTab(event: KeyboardEvent): void {\r\n if (event.shiftKey || !this.host.open()) {\r\n return;\r\n }\r\n event.preventDefault();\r\n this.focusFirstInPanel();\r\n }\r\n\r\n onPanelKeydown(event: KeyboardEvent): void {\r\n if (event.key === 'Escape') {\r\n // Consume only when this popup handles it, so an enclosing overlay stays open.\r\n if (this.host.open()) {\r\n event.preventDefault();\r\n event.stopPropagation();\r\n this.host.closeFromUser();\r\n this.host.trigger()?.focus();\r\n }\r\n return;\r\n }\r\n if (event.key === 'Tab') {\r\n this.handlePanelTab(event);\r\n }\r\n }\r\n\r\n // Focuses the first focusable control, else the popup (`tabindex=\"-1\"`), with one bounded\r\n // microtask retry that re-checks the open contract so a superseded popup cannot steal focus.\r\n focusInitial(overlayRef: OverlayRef, generation: number): void {\r\n if (this.host.overlayRef() !== overlayRef) {\r\n return;\r\n }\r\n this.focusFirstInPanel();\r\n if (!overlayRef.overlayElement.contains(document.activeElement)) {\r\n queueMicrotask(() => {\r\n if (\r\n generation !== this.host.generation() ||\r\n this.host.overlayRef() !== overlayRef ||\r\n !this.host.openValue() ||\r\n this.host.disabled() ||\r\n !this.host.canOpen()\r\n ) {\r\n return;\r\n }\r\n this.focusFirstInPanel();\r\n });\r\n }\r\n }\r\n\r\n private firstFocusable(root: HTMLElement): HTMLElement | null {\r\n const candidates = root.querySelectorAll<HTMLElement>(FOCUSABLE_SELECTOR);\r\n for (const candidate of Array.from(candidates)) {\r\n if (this.checker.isFocusable(candidate)) {\r\n return candidate;\r\n }\r\n }\r\n return null;\r\n }\r\n\r\n private panelTabbables(): HTMLElement[] {\r\n const content = this.host.content();\r\n if (!content) {\r\n return [];\r\n }\r\n return Array.from(content.querySelectorAll<HTMLElement>(FOCUSABLE_SELECTOR)).filter((element) =>\r\n this.checker.isTabbable(element),\r\n );\r\n }\r\n\r\n // Never focus-trapped: forward Tab from the last control goes to the next document control\r\n // after the root (else the browser exits), backward Tab returns to the trigger. The portal\r\n // sits at the end of `<body>`, where natural Tab order would jump past it.\r\n private handlePanelTab(event: KeyboardEvent): void {\r\n const content = this.host.content();\r\n if (!content) {\r\n return;\r\n }\r\n const tabbables = this.panelTabbables();\r\n const active = document.activeElement as HTMLElement | null;\r\n if (event.shiftKey) {\r\n const atStart = tabbables.length > 0 ? active === tabbables[0] : active === content;\r\n const trigger = this.host.trigger();\r\n if (atStart && trigger) {\r\n event.preventDefault();\r\n trigger.focus();\r\n }\r\n return;\r\n }\r\n const atEnd =\r\n tabbables.length > 0 ? active === tabbables[tabbables.length - 1] : active === content;\r\n if (!atEnd) {\r\n return;\r\n }\r\n const next = this.nextTabbableAfterRoot();\r\n if (next) {\r\n event.preventDefault();\r\n next.focus();\r\n }\r\n }\r\n\r\n private nextTabbableAfterRoot(): HTMLElement | null {\r\n const root = this.host.root;\r\n const overlay = this.host.pane();\r\n const candidates = Array.from(\r\n document.querySelectorAll<HTMLElement>(FOCUSABLE_SELECTOR),\r\n ).filter(\r\n (element) =>\r\n this.checker.isTabbable(element) &&\r\n element.closest('[inert]') === null &&\r\n (!overlay || !containsOwnedOverlay(overlay, element)),\r\n );\r\n for (const candidate of candidates) {\r\n const position = root.compareDocumentPosition(candidate);\r\n // Only a control genuinely after the root counts; the root's own descendants\r\n // (the trigger) also report FOLLOWING and must be excluded.\r\n if (\r\n position & Node.DOCUMENT_POSITION_FOLLOWING &&\r\n !(position & Node.DOCUMENT_POSITION_CONTAINED_BY)\r\n ) {\r\n return candidate;\r\n }\r\n }\r\n return null;\r\n }\r\n}\r\n","// Popover pane lifecycle: creation, reveal, the close animation, teardown and the\r\n// subscriptions that keep an open pane anchored.\r\n\r\nimport {\r\n AfterRenderRef,\r\n Injector,\r\n TemplateRef,\r\n ViewContainerRef,\r\n afterNextRender,\r\n} from '@angular/core';\r\n\r\nimport { Overlay, OverlayConfig, OverlayRef } from '@angular/cdk/overlay';\r\nimport { TemplatePortal } from '@angular/cdk/portal';\r\nimport { ScrollDispatcher, ViewportRuler } from '@angular/cdk/scrolling';\r\nimport { containsOwnedOverlay, registerOverlayOwnership } from '@raqm/ui/overlay-internal';\r\n\r\nimport { RaqmPopoverTriggerRef } from './popover-context';\r\nimport {\r\n EXIT_ANIMATION_MS,\r\n PANE_CLASS,\r\n RaqmPopoverAlign,\r\n RaqmPopoverSide,\r\n prefersReducedMotion,\r\n} from './popover-model';\r\nimport { RaqmPopoverPosition } from './popover-position';\r\nimport { RaqmPopoverSizing } from './popover-sizing';\r\nimport { RaqmPopoverState } from './popover-view-state';\r\n\r\nexport interface RaqmPopoverOverlayHost {\r\n /** The root host element; its document is where the owned focusout listener lives. */\r\n root: HTMLElement;\r\n /** The owned id of the live panel. */\r\n readonly panelRootId: string;\r\n trigger(): RaqmPopoverTriggerRef | null;\r\n contentTemplate(): TemplateRef<unknown> | null;\r\n panelTemplate(): TemplateRef<unknown> | undefined;\r\n side(): RaqmPopoverSide;\r\n align(): RaqmPopoverAlign;\r\n panelClass(): string | undefined;\r\n direction(): 'ltr' | 'rtl';\r\n isInsideRootOrOverlay(node: Node | null): boolean;\r\n closeFromUser(): void;\r\n maybeCloseOnFocusOut(event: FocusEvent): void;\r\n syncPanelAria(): void;\r\n focusInitial(overlayRef: OverlayRef, generation: number): void;\r\n setClosed(): void;\r\n}\r\n\r\nexport class RaqmPopoverOverlay {\r\n private overlayRef: OverlayRef | undefined;\r\n\r\n private outsideSubscription: { unsubscribe(): void } | undefined;\r\n private detachSubscription: { unsubscribe(): void } | undefined;\r\n private viewportSubscription: { unsubscribe(): void } | undefined;\r\n private scrollSubscription: { unsubscribe(): void } | undefined;\r\n\r\n // Portaled children are outside the panel DOM, so their focusout cannot bubble to\r\n // the panel handler.\r\n private readonly ownedFocusOut = (event: FocusEvent): void => {\r\n const target = event.target as Node | null;\r\n const pane = this.overlayRef?.overlayElement;\r\n if (pane && target && !pane.contains(target) && containsOwnedOverlay(pane, target)) {\r\n this.host.maybeCloseOnFocusOut(event);\r\n }\r\n };\r\n\r\n private renderTransaction: AfterRenderRef | undefined;\r\n\r\n private disposeTimer: ReturnType<typeof setTimeout> | undefined;\r\n\r\n private pendingDisposeOverlay: OverlayRef | undefined;\r\n\r\n private appliedPanelClass: string | undefined;\r\n\r\n constructor(\r\n private readonly overlay: Overlay,\r\n private readonly scrollDispatcher: ScrollDispatcher,\r\n private readonly viewportRuler: ViewportRuler,\r\n private readonly viewContainerRef: ViewContainerRef,\r\n private readonly injector: Injector,\r\n private readonly state: RaqmPopoverState,\r\n private readonly position: RaqmPopoverPosition,\r\n private readonly sizing: RaqmPopoverSizing,\r\n private readonly host: RaqmPopoverOverlayHost,\r\n ) {}\r\n\r\n get element(): HTMLElement | undefined {\r\n return this.overlayRef?.overlayElement;\r\n }\r\n\r\n get ref(): OverlayRef | undefined {\r\n return this.overlayRef;\r\n }\r\n\r\n contentElement(): HTMLElement | null {\r\n return (\r\n this.overlayRef?.overlayElement.querySelector<HTMLElement>('.raqm-popover-content') ?? null\r\n );\r\n }\r\n\r\n updatePosition(): void {\r\n this.overlayRef?.updatePosition();\r\n }\r\n\r\n setDirection(dir: 'ltr' | 'rtl'): void {\r\n this.overlayRef?.setDirection(dir);\r\n }\r\n\r\n // The single reaction to the derived open state.\r\n syncOpen(next: boolean): void {\r\n if (next === this.state.currentOpen) {\r\n return;\r\n }\r\n if (next) {\r\n this.state.currentOpen = true;\r\n this.beginOpen();\r\n return;\r\n }\r\n this.state.currentOpen = false;\r\n this.beginClose();\r\n }\r\n\r\n private beginOpen(): void {\r\n const trigger = this.host.trigger();\r\n const template = this.host.contentTemplate();\r\n const panelTemplate = this.host.panelTemplate();\r\n if (!trigger || !template || !panelTemplate) {\r\n // Defensive: the open effect already gates on all three being present.\r\n this.state.currentOpen = false;\r\n return;\r\n }\r\n // A rapid reopen cancels a dispose still in flight and a superseded placement pass.\r\n this.flushPendingDispose();\r\n this.cancelRenderTransaction();\r\n const generation = ++this.state.openGeneration;\r\n this.state.closing.set(false);\r\n this.state.attached.set(false);\r\n this.state.panelId.set(this.host.panelRootId);\r\n // Fresh size tracking: previous measurements must never look self-induced.\r\n this.sizing.naturalContentSize = undefined;\r\n this.sizing.expectedContentSize = undefined;\r\n\r\n // Resolve the direction before positions and overlay creation, so CDK resolution and\r\n // our direction-aware tokens agree.\r\n const dir = this.host.direction();\r\n this.state.currentDir = dir;\r\n this.state.panelDir.set(dir);\r\n const preferredSide = this.position.resolvePhysicalSide(this.host.side());\r\n this.state.resolvedSide.set(preferredSide);\r\n this.state.transformOrigin.set(\r\n this.position.computeTransformOrigin(preferredSide, this.host.align()),\r\n );\r\n\r\n const strategy = this.position.buildStrategy(trigger.element);\r\n const config: OverlayConfig = {\r\n positionStrategy: strategy,\r\n hasBackdrop: false,\r\n // One scroll engine only: the `ScrollDispatcher` subscription below drives the\r\n // bounded measure -> cap -> settle refresh.\r\n scrollStrategy: this.overlay.scrollStrategies.noop(),\r\n panelClass: this.panelClasses(),\r\n disposeOnNavigation: true,\r\n direction: dir,\r\n };\r\n const overlayRef = this.overlay.create(config);\r\n registerOverlayOwnership(trigger.element, overlayRef);\r\n this.overlayRef = overlayRef;\r\n this.appliedPanelClass = this.host.panelClass();\r\n this.position.watchSide(strategy);\r\n // Outside press closes without moving focus; a press on the trigger is inside the\r\n // root host and is left to its own toggle.\r\n this.outsideSubscription = overlayRef.outsidePointerEvents().subscribe((event) => {\r\n const target = event.target as Node | null;\r\n if (this.host.isInsideRootOrOverlay(target)) {\r\n return;\r\n }\r\n this.host.closeFromUser();\r\n });\r\n this.detachSubscription = overlayRef.detachments().subscribe(() => this.handleDetached());\r\n this.host.root.ownerDocument.addEventListener('focusout', this.ownedFocusOut, true);\r\n this.viewportSubscription = this.viewportRuler.change(0).subscribe(() => {\r\n this.position.reposition();\r\n });\r\n // Scroll changes the popup's viewport position without resizing the anchor; reuse the\r\n // CDK scroll stream, timer-free (`0` audit time).\r\n this.scrollSubscription = this.scrollDispatcher\r\n .ancestorScrolled(trigger.element, 0)\r\n .subscribe(() => this.position.reposition());\r\n overlayRef.attach(new TemplatePortal(panelTemplate, this.viewContainerRef));\r\n // `attach` positions only in `afterNextRender`, so keep the surface hidden and\r\n // non-interactive until the placement pass has measured, capped and settled it.\r\n overlayRef.overlayElement.style.visibility = 'hidden';\r\n overlayRef.overlayElement.style.pointerEvents = 'none';\r\n this.state.attached.set(true);\r\n this.sizing.attachResizeObserver(trigger.element);\r\n this.startPlacementTransaction(overlayRef, generation);\r\n }\r\n\r\n // One bounded post-render transaction per open, cancellable: the open generation and\r\n // the overlay identity stop a superseded transaction from touching a newer popup.\r\n private startPlacementTransaction(overlayRef: OverlayRef, generation: number): void {\r\n this.renderTransaction = afterNextRender(\r\n () => {\r\n this.renderTransaction = undefined;\r\n if (generation !== this.state.openGeneration || this.overlayRef !== overlayRef) {\r\n return;\r\n }\r\n this.position.reposition();\r\n this.revealAndFocus(overlayRef, generation);\r\n },\r\n { injector: this.injector },\r\n );\r\n }\r\n\r\n private revealAndFocus(overlayRef: OverlayRef, generation: number): void {\r\n const pane = overlayRef.overlayElement;\r\n const content = pane.querySelector<HTMLElement>('.raqm-popover-content');\r\n if (!content || this.overlayRef !== overlayRef) {\r\n return;\r\n }\r\n this.host.syncPanelAria();\r\n content.classList.add('raqm-popover-content--entering');\r\n pane.style.pointerEvents = '';\r\n pane.style.visibility = '';\r\n this.host.focusInitial(overlayRef, generation);\r\n }\r\n\r\n private beginClose(): void {\r\n this.host.root.ownerDocument.removeEventListener('focusout', this.ownedFocusOut, true);\r\n this.state.panelId.set(null);\r\n this.state.closing.set(false);\r\n this.cancelRenderTransaction();\r\n this.state.attached.set(false);\r\n\r\n const overlayRef = this.overlayRef;\r\n this.overlayRef = undefined;\r\n this.position.clearStrategy();\r\n this.position.releaseSideWatch();\r\n this.outsideSubscription?.unsubscribe();\r\n this.outsideSubscription = undefined;\r\n this.detachSubscription?.unsubscribe();\r\n this.detachSubscription = undefined;\r\n this.viewportSubscription?.unsubscribe();\r\n this.viewportSubscription = undefined;\r\n this.scrollSubscription?.unsubscribe();\r\n this.scrollSubscription = undefined;\r\n this.sizing.releaseResizeObserver();\r\n this.appliedPanelClass = undefined;\r\n\r\n if (!overlayRef) {\r\n return;\r\n }\r\n // `inert` first (it empties the accessibility subtree and drops focus), so\r\n // `aria-hidden` never marks an ancestor of a focused element.\r\n overlayRef.overlayElement.setAttribute('inert', '');\r\n overlayRef.overlayElement.setAttribute('aria-hidden', 'true');\r\n\r\n if (prefersReducedMotion()) {\r\n overlayRef.dispose();\r\n return;\r\n }\r\n const content = overlayRef.overlayElement.querySelector<HTMLElement>('.raqm-popover-content');\r\n content?.classList.remove('raqm-popover-content--entering');\r\n content?.classList.add('raqm-popover-content--closing');\r\n this.state.closing.set(true);\r\n this.pendingDisposeOverlay = overlayRef;\r\n this.disposeTimer = setTimeout(() => {\r\n this.disposeTimer = undefined;\r\n this.pendingDisposeOverlay = undefined;\r\n this.state.closing.set(false);\r\n overlayRef.dispose();\r\n }, EXIT_ANIMATION_MS);\r\n }\r\n\r\n private flushPendingDispose(): void {\r\n if (this.disposeTimer !== undefined) {\r\n clearTimeout(this.disposeTimer);\r\n this.disposeTimer = undefined;\r\n }\r\n const overlayRef = this.pendingDisposeOverlay;\r\n this.pendingDisposeOverlay = undefined;\r\n this.state.closing.set(false);\r\n overlayRef?.dispose();\r\n }\r\n\r\n private cancelRenderTransaction(): void {\r\n this.renderTransaction?.destroy();\r\n this.renderTransaction = undefined;\r\n }\r\n\r\n private handleDetached(): void {\r\n this.host.root.ownerDocument.removeEventListener('focusout', this.ownedFocusOut, true);\r\n this.position.releaseSideWatch();\r\n this.outsideSubscription?.unsubscribe();\r\n this.outsideSubscription = undefined;\r\n this.detachSubscription?.unsubscribe();\r\n this.detachSubscription = undefined;\r\n this.viewportSubscription?.unsubscribe();\r\n this.viewportSubscription = undefined;\r\n this.scrollSubscription?.unsubscribe();\r\n this.scrollSubscription = undefined;\r\n this.sizing.releaseResizeObserver();\r\n this.overlayRef = undefined;\r\n this.position.clearStrategy();\r\n this.state.panelId.set(null);\r\n this.state.closing.set(false);\r\n this.state.currentOpen = false;\r\n this.appliedPanelClass = undefined;\r\n this.cancelRenderTransaction();\r\n this.state.attached.set(false);\r\n // A detached popup is gone; reflect it in the model without moving focus.\r\n this.host.setClosed();\r\n }\r\n\r\n destroy(): void {\r\n this.host.root.ownerDocument.removeEventListener('focusout', this.ownedFocusOut, true);\r\n this.state.openGeneration += 1;\r\n this.position.releaseSideWatch();\r\n this.outsideSubscription?.unsubscribe();\r\n this.outsideSubscription = undefined;\r\n this.detachSubscription?.unsubscribe();\r\n this.detachSubscription = undefined;\r\n this.viewportSubscription?.unsubscribe();\r\n this.viewportSubscription = undefined;\r\n this.scrollSubscription?.unsubscribe();\r\n this.scrollSubscription = undefined;\r\n this.sizing.releaseResizeObserver();\r\n this.cancelRenderTransaction();\r\n this.state.attached.set(false);\r\n const overlayRef = this.overlayRef;\r\n this.overlayRef = undefined;\r\n this.position.clearStrategy();\r\n this.appliedPanelClass = undefined;\r\n overlayRef?.dispose();\r\n this.flushPendingDispose();\r\n }\r\n\r\n private panelClasses(): string[] {\r\n const panelClass = this.host.panelClass();\r\n return panelClass ? [PANE_CLASS, panelClass] : [PANE_CLASS];\r\n }\r\n\r\n applyPanelClass(panelClass: string | undefined): void {\r\n const pane = this.overlayRef?.overlayElement;\r\n if (!pane) {\r\n return;\r\n }\r\n if (this.appliedPanelClass && this.appliedPanelClass !== panelClass) {\r\n pane.classList.remove(this.appliedPanelClass);\r\n }\r\n if (panelClass) {\r\n pane.classList.add(panelClass);\r\n }\r\n this.appliedPanelClass = panelClass;\r\n }\r\n}\r\n","// Popover placement: the connected position strategy, its per-side geometry, the side\r\n// watch, and the direction-aware placement pass.\r\n\r\nimport {\r\n ConnectedPosition,\r\n FlexibleConnectedPositionStrategy,\r\n Overlay,\r\n} from '@angular/cdk/overlay';\r\nimport { ViewportRuler } from '@angular/cdk/scrolling';\r\n\r\nimport { RaqmPopoverTriggerRef } from './popover-context';\r\nimport {\r\n RaqmPopoverAlign,\r\n RaqmPopoverPhysicalSide,\r\n RaqmPopoverSide,\r\n VIEWPORT_MARGIN,\r\n} from './popover-model';\r\nimport { RaqmPopoverSizing } from './popover-sizing';\r\nimport { RaqmPopoverState } from './popover-view-state';\r\n\r\nexport interface RaqmPopoverPositionHost {\r\n side(): RaqmPopoverSide;\r\n align(): RaqmPopoverAlign;\r\n direction(): 'ltr' | 'rtl';\r\n trigger(): RaqmPopoverTriggerRef | null;\r\n pane(): HTMLElement | undefined;\r\n updatePosition(): void;\r\n setDirection(dir: 'ltr' | 'rtl'): void;\r\n}\r\n\r\nexport class RaqmPopoverPosition {\r\n private positionStrategy: FlexibleConnectedPositionStrategy | undefined;\r\n\r\n private currentPositions: ConnectedPosition[] = [];\r\n private currentPositionSides: RaqmPopoverPhysicalSide[] = [];\r\n\r\n private sideSubscription: { unsubscribe(): void } | undefined;\r\n\r\n constructor(\r\n private readonly overlay: Overlay,\r\n private readonly viewportRuler: ViewportRuler,\r\n private readonly state: RaqmPopoverState,\r\n private readonly sizing: RaqmPopoverSizing,\r\n private readonly host: RaqmPopoverPositionHost,\r\n ) {}\r\n\r\n buildStrategy(origin: HTMLElement): FlexibleConnectedPositionStrategy {\r\n const strategy = this.overlay.position().flexibleConnectedTo(origin);\r\n strategy\r\n .withFlexibleDimensions(false)\r\n .withGrowAfterOpen(false)\r\n .withPush(true)\r\n .withViewportMargin(VIEWPORT_MARGIN);\r\n const preferred = this.resolvePhysicalSide(this.host.side());\r\n this.currentPositionSides = [preferred, this.oppositeSide(preferred)];\r\n this.currentPositions = this.currentPositionSides.map((side) => this.buildPositionFor(side));\r\n strategy.withPositions(this.currentPositions);\r\n this.positionStrategy = strategy;\r\n return strategy;\r\n }\r\n\r\n private setPositions(sides: readonly RaqmPopoverPhysicalSide[]): void {\r\n const strategy = this.positionStrategy;\r\n if (!strategy) {\r\n return;\r\n }\r\n const positions = sides.map((side) => this.buildPositionFor(side));\r\n strategy.withPositions(positions);\r\n this.currentPositions = positions;\r\n this.currentPositionSides = [...sides];\r\n }\r\n\r\n // The single position for one physical side. The CDK's `originX`/`overlayX` are logical,\r\n // so left/right placements stay direction-correct while top/bottom are physical.\r\n private buildPositionFor(side: RaqmPopoverPhysicalSide): ConnectedPosition {\r\n const align = this.host.align();\r\n const anchorRect = this.host.trigger()?.element?.getBoundingClientRect();\r\n const viewport = this.viewportRuler.getViewportSize();\r\n const x = align;\r\n const y = this.toVerticalAlign(align);\r\n const mainOffset = this.sizing.effectiveSideOffset(side);\r\n const alignX = this.sizing.crossAxisGeometry('x', anchorRect, viewport.width).offset;\r\n const alignY = this.sizing.crossAxisGeometry('y', anchorRect, viewport.height).offset;\r\n switch (side) {\r\n case 'bottom':\r\n return {\r\n originX: x,\r\n originY: 'bottom',\r\n overlayX: x,\r\n overlayY: 'top',\r\n offsetX: alignX,\r\n offsetY: mainOffset,\r\n };\r\n case 'top':\r\n return {\r\n originX: x,\r\n originY: 'top',\r\n overlayX: x,\r\n overlayY: 'bottom',\r\n offsetX: alignX,\r\n offsetY: mainOffset,\r\n };\r\n case 'right':\r\n return this.horizontalPosition('right', y, mainOffset, alignY);\r\n case 'left':\r\n default:\r\n return this.horizontalPosition('left', y, mainOffset, alignY);\r\n }\r\n }\r\n\r\n private horizontalPosition(\r\n side: 'left' | 'right',\r\n alignY: 'top' | 'center' | 'bottom',\r\n offsetX: number,\r\n alignYOffset: number,\r\n ): ConnectedPosition {\r\n const rtl = this.state.currentDir === 'rtl';\r\n const originX = side === 'right' ? (rtl ? 'start' : 'end') : rtl ? 'end' : 'start';\r\n const overlayX = side === 'right' ? (rtl ? 'end' : 'start') : rtl ? 'start' : 'end';\r\n return {\r\n originX,\r\n originY: alignY,\r\n overlayX,\r\n overlayY: alignY,\r\n // Both offsets are already collision-corrected by the caller.\r\n offsetX,\r\n offsetY: alignYOffset,\r\n };\r\n }\r\n\r\n private oppositeSide(side: RaqmPopoverPhysicalSide): RaqmPopoverPhysicalSide {\r\n switch (side) {\r\n case 'top':\r\n return 'bottom';\r\n case 'bottom':\r\n return 'top';\r\n case 'left':\r\n return 'right';\r\n default:\r\n return 'left';\r\n }\r\n }\r\n\r\n watchSide(strategy: FlexibleConnectedPositionStrategy): void {\r\n this.sideSubscription = strategy.positionChanges.subscribe((change) => {\r\n const index = this.currentPositions.indexOf(change.connectionPair);\r\n const applied = this.currentPositionSides[index] ?? this.currentPositionSides[0] ?? 'bottom';\r\n this.state.resolvedSide.set(applied);\r\n this.state.transformOrigin.set(this.computeTransformOrigin(applied, this.host.align()));\r\n });\r\n }\r\n\r\n resolvePhysicalSide(side: RaqmPopoverSide): RaqmPopoverPhysicalSide {\r\n switch (side) {\r\n case 'inline-start':\r\n return this.state.currentDir === 'rtl' ? 'right' : 'left';\r\n case 'inline-end':\r\n return this.state.currentDir === 'rtl' ? 'left' : 'right';\r\n default:\r\n return side;\r\n }\r\n }\r\n\r\n computeTransformOrigin(side: RaqmPopoverPhysicalSide, align: RaqmPopoverAlign): string {\r\n const rtl = this.state.currentDir === 'rtl';\r\n const x =\r\n side === 'left'\r\n ? 'right'\r\n : side === 'right'\r\n ? 'left'\r\n : align === 'start'\r\n ? rtl\r\n ? 'right'\r\n : 'left'\r\n : align === 'end'\r\n ? rtl\r\n ? 'left'\r\n : 'right'\r\n : 'center';\r\n const y = side === 'top' ? 'bottom' : side === 'bottom' ? 'top' : this.toVerticalAlign(align);\r\n return `${x} ${y}`;\r\n }\r\n\r\n private toVerticalAlign(align: RaqmPopoverAlign): 'top' | 'center' | 'bottom' {\r\n return align === 'start' ? 'top' : align === 'end' ? 'bottom' : 'center';\r\n }\r\n\r\n // Bounded placement, fixed step order: refresh direction, restore natural order and clear\r\n // caps to measure the unclamped size, `updatePosition()` picks the side, cap that side from\r\n // its own room, settle on that single position (so the cap cannot re-select the other\r\n // side), then record the capped box for the self-induced guard. Two placements per refresh,\r\n // no timers or observer re-entry.\r\n reposition(): void {\r\n const pane = this.host.pane();\r\n const strategy = this.positionStrategy;\r\n if (!pane || !strategy) {\r\n return;\r\n }\r\n const dir = this.host.direction();\r\n if (dir !== this.state.currentDir) {\r\n this.state.currentDir = dir;\r\n this.state.panelDir.set(dir);\r\n this.host.setDirection(dir);\r\n }\r\n const preferred = this.resolvePhysicalSide(this.host.side());\r\n this.setPositions([preferred, this.oppositeSide(preferred)]);\r\n this.sizing.resetAvailableSize();\r\n this.sizing.naturalContentSize = this.sizing.contentBoxSize();\r\n this.host.updatePosition();\r\n const applied = this.state.resolvedSide();\r\n this.sizing.applyAvailableSize();\r\n this.setPositions([applied]);\r\n this.host.updatePosition();\r\n this.sizing.expectedContentSize = this.sizing.contentBoxSize();\r\n }\r\n\r\n applyPositionInputs(): void {\r\n this.reposition();\r\n }\r\n\r\n releaseSideWatch(): void {\r\n this.sideSubscription?.unsubscribe();\r\n this.sideSubscription = undefined;\r\n }\r\n\r\n clearStrategy(): void {\r\n this.positionStrategy = undefined;\r\n }\r\n}\r\n","// Popover registration: the single trigger, content template, title and description the\r\n// projected slots hand to the root, and the panel's labelling.\r\n\r\nimport { TemplateRef, isDevMode, signal } from '@angular/core';\r\n\r\nimport { RaqmPopoverTriggerRef } from './popover-context';\r\n\r\nlet nextPopoverId = 0;\r\n\r\nexport interface RaqmPopoverRegistrationHost {\r\n /** The live pane's content surface, or `null` while no pane is attached. */\r\n content(): HTMLElement | null;\r\n /** An explicit accessible name used when no title slot is registered. */\r\n label(): string | undefined;\r\n}\r\n\r\nexport class RaqmPopoverRegistration {\r\n readonly triggerRef = signal<RaqmPopoverTriggerRef | null>(null);\r\n readonly contentTemplate = signal<TemplateRef<unknown> | null>(null);\r\n\r\n private readonly titleElement = signal<HTMLElement | null>(null);\r\n private readonly descriptionElement = signal<HTMLElement | null>(null);\r\n\r\n private readonly rootId = ++nextPopoverId;\r\n\r\n readonly panelRootId = `raqm-popover-panel-${this.rootId}`;\r\n private readonly titleRootId = `raqm-popover-title-${this.rootId}`;\r\n private readonly descriptionRootId = `raqm-popover-description-${this.rootId}`;\r\n\r\n constructor(private readonly host: RaqmPopoverRegistrationHost) {}\r\n\r\n registerTrigger(ref: RaqmPopoverTriggerRef): void {\r\n const current = this.triggerRef();\r\n if (current !== null && current !== ref) {\r\n if (isDevMode()) {\r\n console.error(\r\n '[raqm-popover] Only one `button[raqm-popover-trigger]` is supported per <raqm-popover>; the extra trigger is ignored.',\r\n );\r\n }\r\n return;\r\n }\r\n this.triggerRef.set(ref);\r\n }\r\n\r\n unregisterTrigger(ref: RaqmPopoverTriggerRef): void {\r\n if (this.triggerRef() === ref) {\r\n this.triggerRef.set(null);\r\n }\r\n }\r\n\r\n registerContent(template: TemplateRef<unknown>): void {\r\n const current = this.contentTemplate();\r\n if (current !== null && current !== template) {\r\n if (isDevMode()) {\r\n console.error(\r\n '[raqm-popover] Only one `ng-template[raqm-popover-content]` is supported per <raqm-popover>; the extra template is ignored.',\r\n );\r\n }\r\n return;\r\n }\r\n this.contentTemplate.set(template);\r\n }\r\n\r\n unregisterContent(template: TemplateRef<unknown>): void {\r\n if (this.contentTemplate() === template) {\r\n this.contentTemplate.set(null);\r\n }\r\n }\r\n\r\n /** Registers a title element, assigning the owned id only when it has none. */\r\n registerTitle(element: HTMLElement): void {\r\n if (isDevMode() && this.titleElement() !== null && this.titleElement() !== element) {\r\n console.error(\r\n '[raqm-popover] Only one `[raqm-popover-title]` is expected per <raqm-popover>; the latest registration wins.',\r\n );\r\n }\r\n if (!element.id) {\r\n element.id = this.titleRootId;\r\n }\r\n this.titleElement.set(element);\r\n this.syncPanelAria();\r\n }\r\n\r\n unregisterTitle(element: HTMLElement): void {\r\n if (this.titleElement() === element) {\r\n this.titleElement.set(null);\r\n this.syncPanelAria();\r\n }\r\n }\r\n\r\n registerDescription(element: HTMLElement): void {\r\n if (\r\n isDevMode() &&\r\n this.descriptionElement() !== null &&\r\n this.descriptionElement() !== element\r\n ) {\r\n console.error(\r\n '[raqm-popover] Only one `[raqm-popover-description]` is expected per <raqm-popover>; the latest registration wins.',\r\n );\r\n }\r\n if (!element.id) {\r\n element.id = this.descriptionRootId;\r\n }\r\n this.descriptionElement.set(element);\r\n this.syncPanelAria();\r\n }\r\n\r\n unregisterDescription(element: HTMLElement): void {\r\n if (this.descriptionElement() === element) {\r\n this.descriptionElement.set(null);\r\n this.syncPanelAria();\r\n }\r\n }\r\n\r\n // Points labelling at the registered title/description or explicit `label`,\r\n // removing whichever attribute does not apply.\r\n syncPanelAria(): void {\r\n const content = this.host.content();\r\n if (!content) {\r\n return;\r\n }\r\n const title = this.titleElement();\r\n const description = this.descriptionElement();\r\n if (title) {\r\n content.setAttribute('aria-labelledby', title.id);\r\n } else {\r\n content.removeAttribute('aria-labelledby');\r\n }\r\n if (description) {\r\n content.setAttribute('aria-describedby', description.id);\r\n } else {\r\n content.removeAttribute('aria-describedby');\r\n }\r\n const label = this.host.label();\r\n if (!title && label) {\r\n content.setAttribute('aria-label', label);\r\n } else {\r\n content.removeAttribute('aria-label');\r\n }\r\n }\r\n}\r\n","// Popover sizing: the available-size caps published to the pane, the collision-corrected\r\n// geometry those caps are measured from, and the anchor/content resize observer.\r\n\r\nimport { ViewportRuler } from '@angular/cdk/scrolling';\r\n\r\nimport { RaqmPopoverTriggerRef } from './popover-context';\r\nimport {\r\n PopoverBoxSize,\r\n RaqmPopoverAlign,\r\n RaqmPopoverPhysicalSide,\r\n VIEWPORT_MARGIN,\r\n sameBoxSize,\r\n} from './popover-model';\r\nimport { RaqmPopoverState } from './popover-view-state';\r\n\r\nexport interface RaqmPopoverSizingHost {\r\n align(): RaqmPopoverAlign;\r\n alignOffset(): number;\r\n sideOffset(): number;\r\n trigger(): RaqmPopoverTriggerRef | null;\r\n pane(): HTMLElement | undefined;\r\n content(): HTMLElement | null;\r\n reposition(): void;\r\n}\r\n\r\nexport class RaqmPopoverSizing {\r\n // Natural and capped content sizes: the only two sizes this component writes, so a\r\n // resize report matching either is self-induced and ignored (prevents a\r\n // size <-> reposition loop); any other size is a genuine content change.\r\n naturalContentSize: PopoverBoxSize | undefined;\r\n expectedContentSize: PopoverBoxSize | undefined;\r\n\r\n private resizeObserver: ResizeObserver | undefined;\r\n\r\n constructor(\r\n private readonly viewportRuler: ViewportRuler,\r\n private readonly state: RaqmPopoverState,\r\n private readonly host: RaqmPopoverSizingHost,\r\n ) {}\r\n\r\n // Whole-viewport bound a cap may reach, keeping the pane inside the viewport at an edge.\r\n private viewportCap(viewportDimension: number): number {\r\n return Math.max(viewportDimension - VIEWPORT_MARGIN * 2, 0);\r\n }\r\n\r\n // Layout box, never `getBoundingClientRect()`: the latter is transformed, so the enter\r\n // animation's scale would skew the size. `ResizeObserver` also reports layout boxes.\r\n contentBoxSize(): PopoverBoxSize | undefined {\r\n const content = this.host.content();\r\n if (!content) {\r\n return undefined;\r\n }\r\n return { width: content.offsetWidth, height: content.offsetHeight };\r\n }\r\n\r\n private isSelfInducedContentSize(size: PopoverBoxSize): boolean {\r\n return (\r\n sameBoxSize(size, this.naturalContentSize) || sameBoxSize(size, this.expectedContentSize)\r\n );\r\n }\r\n\r\n resetAvailableSize(): void {\r\n const pane = this.host.pane();\r\n if (!pane) {\r\n return;\r\n }\r\n pane.style.removeProperty('--raqm-popover-available-width');\r\n pane.style.removeProperty('--raqm-popover-available-height');\r\n }\r\n\r\n attachResizeObserver(anchor: HTMLElement): void {\r\n this.releaseResizeObserver();\r\n if (typeof ResizeObserver === 'undefined') {\r\n return;\r\n }\r\n this.resizeObserver = new ResizeObserver((entries) => {\r\n const content = this.host.content();\r\n for (const entry of entries) {\r\n // The anchor is never sized by this component, so any anchor change is real.\r\n if (entry.target !== content) {\r\n this.host.reposition();\r\n return;\r\n }\r\n // Cleared and re-applied caps change the content box as a direct consequence of\r\n // `reposition`; those sizes must not re-enter it (a size <-> reposition loop).\r\n const size = this.contentBoxSize();\r\n if (size && !this.isSelfInducedContentSize(size)) {\r\n this.host.reposition();\r\n return;\r\n }\r\n }\r\n });\r\n this.resizeObserver.observe(anchor);\r\n const content = this.host.content();\r\n if (content) {\r\n this.resizeObserver.observe(content);\r\n }\r\n }\r\n\r\n releaseResizeObserver(): void {\r\n this.resizeObserver?.disconnect();\r\n this.resizeObserver = undefined;\r\n }\r\n\r\n // Publishes the resolved side's real room as CSS custom properties so the SCSS can clamp\r\n // the surface. Both axes are capped so the offset-applied surface fits the strategy's\r\n // narrowed viewport: `_pushOverlayOnScreen` runs on both axes as soon as either\r\n // overflows and would displace the authored alignment offset.\r\n applyAvailableSize(): void {\r\n const pane = this.host.pane();\r\n const anchor = this.host.trigger()?.element;\r\n if (!pane || !anchor) {\r\n return;\r\n }\r\n const anchorRect = anchor.getBoundingClientRect();\r\n const viewport = this.viewportRuler.getViewportSize();\r\n const sideOffset = this.host.sideOffset();\r\n const side = this.state.resolvedSide();\r\n const capacityWidth = this.viewportCap(viewport.width);\r\n const capacityHeight = this.viewportCap(viewport.height);\r\n // `capacity` is the client size less the 5px margin per side, the strategy's own fit\r\n // boundary. Reaching only the client margin would set `_isPushed` and let\r\n // `_pushOverlayOnScreen` move the un-offset base, displacing the authored offset.\r\n const below = capacityHeight - anchorRect.bottom - sideOffset;\r\n const above = anchorRect.top - sideOffset - VIEWPORT_MARGIN;\r\n const after = capacityWidth - anchorRect.right - sideOffset;\r\n const before = anchorRect.left - sideOffset - VIEWPORT_MARGIN;\r\n // A non-positive own room means a push on this axis is unavoidable, so the cross\r\n // axis must use its conservative (un-offset) room.\r\n const ownRoom =\r\n side === 'top' ? above : side === 'left' ? before : side === 'bottom' ? below : after;\r\n const crossConservative = ownRoom <= 0;\r\n // The cross axis is bounded from the offset-applied aligned edge, the edge the\r\n // strategy actually lands on, and applied as measured (never widened back).\r\n const crossWidth = this.crossAxisGeometry(\r\n 'x',\r\n anchorRect,\r\n viewport.width,\r\n crossConservative,\r\n ).room;\r\n const crossHeight = this.crossAxisGeometry(\r\n 'y',\r\n anchorRect,\r\n viewport.height,\r\n crossConservative,\r\n ).room;\r\n let width: number;\r\n let height: number;\r\n let widthIsCross = false;\r\n let heightIsCross = false;\r\n switch (side) {\r\n case 'top':\r\n height = above;\r\n width = crossWidth;\r\n widthIsCross = true;\r\n break;\r\n case 'left':\r\n width = before;\r\n height = crossHeight;\r\n heightIsCross = true;\r\n break;\r\n case 'right':\r\n width = after;\r\n height = crossHeight;\r\n heightIsCross = true;\r\n break;\r\n case 'bottom':\r\n default:\r\n height = below;\r\n width = crossWidth;\r\n widthIsCross = true;\r\n break;\r\n }\r\n // Cross room is applied as measured; a zero/negative own room falls back to the\r\n // whole-viewport cap so the axis stays clamped.\r\n this.applyAvailableDimension(\r\n pane,\r\n '--raqm-popover-available-width',\r\n widthIsCross || width > 0 ? Math.min(width, capacityWidth) : capacityWidth,\r\n );\r\n this.applyAvailableDimension(\r\n pane,\r\n '--raqm-popover-available-height',\r\n heightIsCross || height > 0 ? Math.min(height, capacityHeight) : capacityHeight,\r\n );\r\n }\r\n\r\n effectiveSideOffset(side: RaqmPopoverPhysicalSide): number {\r\n const authored =\r\n side === 'bottom' || side === 'right' ? this.host.sideOffset() : -this.host.sideOffset();\r\n const anchor = this.host.trigger()?.element;\r\n const pane = this.host.pane();\r\n if (!anchor || !pane) {\r\n return authored;\r\n }\r\n const horizontal = side === 'left' || side === 'right';\r\n const viewport = this.viewportRuler.getViewportSize();\r\n const client = horizontal ? viewport.width : viewport.height;\r\n const size = horizontal\r\n ? pane.getBoundingClientRect().width\r\n : pane.getBoundingClientRect().height;\r\n const capacity = this.viewportCap(client);\r\n // Not measurable, or already wider/taller than the narrowed viewport, where no\r\n // offset can fit (the cap prevents the latter).\r\n if (size <= 0 || size > capacity) {\r\n return authored;\r\n }\r\n const anchorRect = anchor.getBoundingClientRect();\r\n // The un-offset base edge: the anchor's far edge for bottom/right, one pane-length\r\n // before its near edge for top/left.\r\n const base = horizontal\r\n ? side === 'right'\r\n ? anchorRect.right\r\n : anchorRect.left - size\r\n : side === 'bottom'\r\n ? anchorRect.bottom\r\n : anchorRect.top - size;\r\n // Near overflow wins, otherwise the far overflow is undone, so a saturated push\r\n // lands the base box on `VIEWPORT_MARGIN`/`capacity`.\r\n const overflowNear = Math.max(VIEWPORT_MARGIN - base, 0);\r\n const overflowFar = Math.max(base + size - capacity, 0);\r\n const pushedBase = base + (overflowNear || -overflowFar);\r\n // The final box must stay inside the client margins; with `size <= capacity` this\r\n // interval is never empty.\r\n return Math.min(\r\n Math.max(authored, VIEWPORT_MARGIN - pushedBase),\r\n client - VIEWPORT_MARGIN - pushedBase - size,\r\n );\r\n }\r\n\r\n private authoredCrossOffset(axis: 'x' | 'y'): number {\r\n const alignOffset = this.host.alignOffset();\r\n return axis === 'x' && this.state.currentDir === 'rtl' ? -alignOffset : alignOffset;\r\n }\r\n\r\n // The position's collision-corrected cross offset and the room the surface may occupy,\r\n // measured from the offset-applied aligned edge out to the strategy's fit boundary.\r\n // `conservative` (the caller's other axis will be pushed) measures from the un-offset\r\n // origin instead, the only width that push cannot displace.\r\n crossAxisGeometry(\r\n axis: 'x' | 'y',\r\n anchorRect: DOMRectReadOnly | undefined,\r\n viewportDimension: number,\r\n conservative = false,\r\n ): { offset: number; room: number } {\r\n const authored = this.authoredCrossOffset(axis);\r\n const capacity = this.viewportCap(viewportDimension);\r\n if (!authored || !anchorRect) {\r\n return { offset: authored, room: capacity };\r\n }\r\n const rtl = this.state.currentDir === 'rtl';\r\n // Alignment stays logical; the origin edge resolves per axis like the strategy's\r\n // own origin point (X against the direction, Y as top/bottom).\r\n const align = this.host.align();\r\n const axisStart = axis === 'x' ? anchorRect.left : anchorRect.top;\r\n const axisSize = axis === 'x' ? anchorRect.width : anchorRect.height;\r\n const startEdge = axis === 'x' && rtl ? axisStart + axisSize : axisStart;\r\n const endEdge = axis === 'x' && rtl ? axisStart : axisStart + axisSize;\r\n const origin =\r\n align === 'start' ? startEdge : align === 'end' ? endEdge : axisStart + axisSize / 2;\r\n // The offset may not carry the aligned edge out of the margin or past the fit\r\n // boundary, so neither room below is negative.\r\n const offset = Math.min(Math.max(authored, VIEWPORT_MARGIN - origin), capacity - origin);\r\n // Measure from where the corrected offset lands the surface; conservative mode uses\r\n // the un-offset origin, since the other axis's push moves that base.\r\n const roomEdge = conservative ? origin : origin + offset;\r\n const beforeRoom = Math.max(roomEdge - VIEWPORT_MARGIN, 0);\r\n const afterRoom = Math.max(capacity - roomEdge, 0);\r\n if (align === 'center') {\r\n // Centered: the smaller half-room bounds it, else the larger one, still capped.\r\n const half = Math.min(beforeRoom, afterRoom);\r\n return {\r\n offset,\r\n room: Math.min((half || Math.max(beforeRoom, afterRoom)) * 2, capacity),\r\n };\r\n }\r\n // Growth direction: logical `start` grows toward the viewport end in LTR and its\r\n // start in RTL; the vertical axis never mirrors.\r\n const growsAfter = axis === 'y' ? align === 'start' : align === 'start' ? !rtl : rtl;\r\n const growth = growsAfter ? afterRoom : beforeRoom;\r\n // Zero growth means the anchor sits at that edge: keep the opposite room, still\r\n // bounded, never the whole-viewport cap.\r\n return { offset, room: growth || (growsAfter ? beforeRoom : afterRoom) };\r\n }\r\n\r\n // Writes one size cap only when it changes. Floored, so the published cap can never\r\n // exceed the measured room by a sub-pixel and re-cross the fit boundary (which would\r\n // re-trigger a push); never cleared.\r\n private applyAvailableDimension(pane: HTMLElement, property: string, value: number): void {\r\n const next = `${Math.max(Math.floor(value), 0)}px`;\r\n if (pane.style.getPropertyValue(property) !== next) {\r\n pane.style.setProperty(property, next);\r\n }\r\n }\r\n}\r\n","// Popover pane state: the writable signals the pane lifecycle writes and the template\r\n// reads, plus the open bookkeeping shared by the close paths.\r\n\r\nimport { signal } from '@angular/core';\r\n\r\nimport { RaqmPopoverPhysicalSide } from './popover-model';\r\n\r\nexport class RaqmPopoverState {\r\n readonly attached = signal(false);\r\n\r\n readonly panelId = signal<string | null>(null);\r\n\r\n readonly resolvedSide = signal<RaqmPopoverPhysicalSide>('bottom');\r\n readonly transformOrigin = signal('center top');\r\n\r\n readonly closing = signal(false);\r\n\r\n readonly panelDir = signal<'ltr' | 'rtl'>('ltr');\r\n\r\n currentDir: 'ltr' | 'rtl' = 'ltr';\r\n\r\n currentOpen = false;\r\n\r\n openGeneration = 0;\r\n}\r\n","import {\r\n ChangeDetectionStrategy,\r\n Component,\r\n ElementRef,\r\n Injector,\r\n OnDestroy,\r\n TemplateRef,\r\n ViewContainerRef,\r\n booleanAttribute,\r\n computed,\r\n inject,\r\n input,\r\n model,\r\n viewChild,\r\n} from '@angular/core';\r\nimport { NgTemplateOutlet } from '@angular/common';\r\n\r\nimport { InteractivityChecker } from '@angular/cdk/a11y';\r\nimport { Directionality } from '@angular/cdk/bidi';\r\nimport { Overlay } from '@angular/cdk/overlay';\r\nimport { ScrollDispatcher, ViewportRuler } from '@angular/cdk/scrolling';\r\n\r\nimport { RAQM_POPOVER, RaqmPopoverContext, RaqmPopoverTriggerRef } from './popover-context';\r\nimport { RaqmPopoverDismissal } from './popover-dismiss';\r\nimport { connectPopoverEffects } from './popover-effects';\r\nimport { RaqmPopoverKeyboard } from './popover-keyboard';\r\nimport {\r\n DEFAULT_ALIGN,\r\n DEFAULT_ALIGN_OFFSET,\r\n DEFAULT_SIDE,\r\n DEFAULT_SIDE_OFFSET,\r\n DEFAULT_WIDTH,\r\n RaqmPopoverAlign,\r\n RaqmPopoverSide,\r\n resolvePopoverDirection,\r\n toAlign,\r\n toDir,\r\n toOffset,\r\n toSide,\r\n} from './popover-model';\r\nimport { RaqmPopoverOverlay } from './popover-overlay';\r\nimport { RaqmPopoverPosition } from './popover-position';\r\nimport { RaqmPopoverRegistration } from './popover-registration';\r\nimport { RaqmPopoverSizing } from './popover-sizing';\r\nimport { RaqmPopoverState } from './popover-view-state';\r\n\r\nexport type { RaqmPopoverAlign, RaqmPopoverSide } from './popover-model';\r\n\r\n@Component({\r\n selector: 'raqm-popover',\r\n imports: [NgTemplateOutlet],\r\n templateUrl: './popover.component.html',\r\n styleUrl: './popover.component.scss',\r\n changeDetection: ChangeDetectionStrategy.OnPush,\r\n exportAs: 'raqmPopover',\r\n providers: [{ provide: RAQM_POPOVER, useExisting: RaqmPopoverComponent }],\r\n host: {\r\n // Focus-out closes only when focus leaves BOTH the root and its overlay.\r\n '(focusout)': 'onFocusOut($event)',\r\n },\r\n})\r\nexport class RaqmPopoverComponent implements RaqmPopoverContext, OnDestroy {\r\n // The host renders no box (`display: contents`), so the projected trigger takes part in parent layout.\r\n private readonly host = inject<ElementRef<HTMLElement>>(ElementRef);\r\n\r\n private readonly overlay = inject(Overlay);\r\n\r\n private readonly viewContainerRef = inject(ViewContainerRef);\r\n\r\n private readonly injector = inject(Injector);\r\n\r\n // Optional; `resolvePopoverDirection` prefers the live computed direction, which also\r\n // covers a CSS-only `dir` ancestor.\r\n private readonly directionality = inject(Directionality, { optional: true });\r\n\r\n private readonly viewportRuler = inject(ViewportRuler);\r\n\r\n private readonly scrollDispatcher = inject(ScrollDispatcher);\r\n\r\n private readonly checker = inject(InteractivityChecker);\r\n\r\n // Optional query (never `required`) so a programmatic initial `open` cannot throw\r\n // NG0951 before the view resolves; `canOpen` waits for it.\r\n private readonly panelTemplate = viewChild('panel', { read: TemplateRef });\r\n\r\n readonly openValue = model(false, { alias: 'open' });\r\n\r\n readonly disabled = input(false, { transform: booleanAttribute });\r\n\r\n /** The preferred side of the trigger; logical sides resolve against `dir`. */\r\n readonly side = input<RaqmPopoverSide>(DEFAULT_SIDE, { transform: toSide });\r\n\r\n readonly align = input<RaqmPopoverAlign>(DEFAULT_ALIGN, {\r\n transform: toAlign,\r\n });\r\n\r\n readonly sideOffset = input(DEFAULT_SIDE_OFFSET, {\r\n transform: toOffset(DEFAULT_SIDE_OFFSET),\r\n });\r\n\r\n readonly alignOffset = input(DEFAULT_ALIGN_OFFSET, {\r\n transform: toOffset(DEFAULT_ALIGN_OFFSET),\r\n });\r\n\r\n readonly dir = input<'ltr' | 'rtl' | undefined>(undefined, {\r\n transform: toDir,\r\n });\r\n\r\n readonly width = input(DEFAULT_WIDTH);\r\n\r\n readonly panelClass = input<string | undefined>(undefined);\r\n\r\n /** An explicit accessible name used when no title slot is registered. */\r\n readonly label = input<string | undefined>(undefined);\r\n\r\n private readonly state: RaqmPopoverState = new RaqmPopoverState();\r\n\r\n private readonly registration: RaqmPopoverRegistration = new RaqmPopoverRegistration({\r\n content: () => this.layer.contentElement(),\r\n label: () => this.label(),\r\n });\r\n\r\n private readonly canOpen = computed(\r\n () =>\r\n this.registration.triggerRef() !== null &&\r\n this.registration.contentTemplate() !== null &&\r\n this.panelTemplate() !== undefined,\r\n );\r\n\r\n /** Open AND enabled AND actually attached; the trigger's `aria-expanded` source. */\r\n readonly open = computed(() => this.openValue() && !this.disabled() && this.state.attached());\r\n\r\n readonly panelId = this.state.panelId;\r\n\r\n readonly resolvedSide = this.state.resolvedSide;\r\n readonly transformOrigin = this.state.transformOrigin;\r\n\r\n readonly closing = this.state.closing;\r\n\r\n protected readonly panelDir = this.state.panelDir;\r\n\r\n protected readonly contentTemplate = this.registration.contentTemplate;\r\n\r\n private readonly sizing: RaqmPopoverSizing = new RaqmPopoverSizing(\r\n this.viewportRuler,\r\n this.state,\r\n {\r\n align: () => this.align(),\r\n alignOffset: () => this.alignOffset(),\r\n sideOffset: () => this.sideOffset(),\r\n trigger: () => this.registration.triggerRef(),\r\n pane: () => this.layer.element,\r\n content: () => this.layer.contentElement(),\r\n reposition: () => this.position.reposition(),\r\n },\r\n );\r\n\r\n private readonly position: RaqmPopoverPosition = new RaqmPopoverPosition(\r\n this.overlay,\r\n this.viewportRuler,\r\n this.state,\r\n this.sizing,\r\n {\r\n side: () => this.side(),\r\n align: () => this.align(),\r\n direction: () =>\r\n resolvePopoverDirection(this.dir(), this.host.nativeElement, this.directionality),\r\n trigger: () => this.registration.triggerRef(),\r\n pane: () => this.layer.element,\r\n updatePosition: () => this.layer.updatePosition(),\r\n setDirection: (dir) => this.layer.setDirection(dir),\r\n },\r\n );\r\n\r\n private readonly layer: RaqmPopoverOverlay = new RaqmPopoverOverlay(\r\n this.overlay,\r\n this.scrollDispatcher,\r\n this.viewportRuler,\r\n this.viewContainerRef,\r\n this.injector,\r\n this.state,\r\n this.position,\r\n this.sizing,\r\n {\r\n root: this.host.nativeElement,\r\n panelRootId: this.registration.panelRootId,\r\n trigger: () => this.registration.triggerRef(),\r\n contentTemplate: () => this.registration.contentTemplate(),\r\n panelTemplate: () => this.panelTemplate(),\r\n side: () => this.side(),\r\n align: () => this.align(),\r\n panelClass: () => this.panelClass(),\r\n direction: () =>\r\n resolvePopoverDirection(this.dir(), this.host.nativeElement, this.directionality),\r\n isInsideRootOrOverlay: (node) => this.dismissal.isInsideRootOrOverlay(node),\r\n closeFromUser: () => this.closeFromUser(),\r\n maybeCloseOnFocusOut: (event) => this.dismissal.maybeCloseOnFocusOut(event),\r\n syncPanelAria: () => this.registration.syncPanelAria(),\r\n focusInitial: (overlayRef, generation) => this.keyboard.focusInitial(overlayRef, generation),\r\n setClosed: () => this.dismissal.setClosed(),\r\n },\r\n );\r\n\r\n private readonly keyboard: RaqmPopoverKeyboard = new RaqmPopoverKeyboard(this.checker, {\r\n root: this.host.nativeElement,\r\n open: () => this.open(),\r\n openValue: () => this.openValue(),\r\n disabled: () => this.disabled(),\r\n canOpen: () => this.canOpen(),\r\n trigger: () => this.registration.triggerRef(),\r\n pane: () => this.layer.element,\r\n content: () => this.layer.contentElement(),\r\n overlayRef: () => this.layer.ref,\r\n generation: () => this.state.openGeneration,\r\n closeFromUser: () => this.closeFromUser(),\r\n });\r\n\r\n private readonly dismissal: RaqmPopoverDismissal = new RaqmPopoverDismissal({\r\n root: this.host.nativeElement,\r\n open: () => this.open(),\r\n openValue: () => this.openValue(),\r\n disabled: () => this.disabled(),\r\n canOpen: () => this.canOpen(),\r\n pane: () => this.layer.element,\r\n generation: () => this.state.openGeneration,\r\n setOpen: (value) => this.openValue.set(value),\r\n });\r\n\r\n constructor() {\r\n connectPopoverEffects({\r\n openValue: () => this.openValue(),\r\n disabled: () => this.disabled(),\r\n canOpen: () => this.canOpen(),\r\n side: () => this.side(),\r\n align: () => this.align(),\r\n sideOffset: () => this.sideOffset(),\r\n alignOffset: () => this.alignOffset(),\r\n dir: () => this.dir(),\r\n label: () => this.label(),\r\n panelClass: () => this.panelClass(),\r\n syncOpen: (next) => this.layer.syncOpen(next),\r\n applyPositionInputs: () => this.position.applyPositionInputs(),\r\n syncPanelAria: () => this.registration.syncPanelAria(),\r\n applyPanelClass: (panelClass) => this.layer.applyPanelClass(panelClass),\r\n });\r\n }\r\n\r\n ngOnDestroy(): void {\r\n this.layer.destroy();\r\n }\r\n\r\n registerTrigger(ref: RaqmPopoverTriggerRef): void {\r\n this.registration.registerTrigger(ref);\r\n }\r\n\r\n unregisterTrigger(ref: RaqmPopoverTriggerRef): void {\r\n this.registration.unregisterTrigger(ref);\r\n }\r\n\r\n registerContent(template: TemplateRef<unknown>): void {\r\n this.registration.registerContent(template);\r\n }\r\n\r\n unregisterContent(template: TemplateRef<unknown>): void {\r\n this.registration.unregisterContent(template);\r\n }\r\n\r\n registerTitle(element: HTMLElement): void {\r\n this.registration.registerTitle(element);\r\n }\r\n\r\n unregisterTitle(element: HTMLElement): void {\r\n this.registration.unregisterTitle(element);\r\n }\r\n\r\n registerDescription(element: HTMLElement): void {\r\n this.registration.registerDescription(element);\r\n }\r\n\r\n unregisterDescription(element: HTMLElement): void {\r\n this.registration.unregisterDescription(element);\r\n }\r\n\r\n toggleFromTrigger(ref: RaqmPopoverTriggerRef): void {\r\n if (ref !== this.registration.triggerRef() || this.disabled() || ref.disabled) {\r\n return;\r\n }\r\n if (this.open()) {\r\n this.closeFromUser();\r\n return;\r\n }\r\n this.openValue.set(true);\r\n }\r\n\r\n closeFromUser(): void {\r\n if (!this.open()) {\r\n return;\r\n }\r\n this.dismissal.setClosed();\r\n }\r\n\r\n /** Dismisses on application navigation; clears `open` even when disabled. */\r\n close(): void {\r\n this.dismissal.setClosed();\r\n }\r\n\r\n focusFirstInPanel(): void {\r\n this.keyboard.focusFirstInPanel();\r\n }\r\n\r\n onTriggerTab(event: KeyboardEvent): void {\r\n this.keyboard.onTriggerTab(event);\r\n }\r\n\r\n protected onFocusOut(event: FocusEvent): void {\r\n this.dismissal.maybeCloseOnFocusOut(event);\r\n }\r\n\r\n protected onPanelFocusOut(event: FocusEvent): void {\r\n this.dismissal.maybeCloseOnFocusOut(event);\r\n }\r\n\r\n protected onPanelKeydown(event: KeyboardEvent): void {\r\n this.keyboard.onPanelKeydown(event);\r\n }\r\n}\r\n","<ng-content />\r\n\r\n<!-- The one panel template, instantiated into a CDK overlay when the popup opens.\r\n Its wrapper nodes are created by this component's view (so this component's\r\n own external stylesheet applies to them) while the projected template\r\n children stay application-owned and are styled by the shipped relationship\r\n partial. `NgTemplateOutlet` renders the registered content template. -->\r\n<ng-template #panel>\r\n <div\r\n class=\"raqm-popover-content\"\r\n tabindex=\"-1\"\r\n [attr.id]=\"panelId()\"\r\n [attr.dir]=\"panelDir()\"\r\n [attr.data-raqm-side]=\"resolvedSide()\"\r\n [class.raqm-popover-content--closing]=\"closing()\"\r\n [style.width]=\"width()\"\r\n [style.transform-origin]=\"transformOrigin()\"\r\n (focusout)=\"onPanelFocusOut($event)\"\r\n (keydown)=\"onPanelKeydown($event)\"\r\n >\r\n <ng-container [ngTemplateOutlet]=\"contentTemplate()\" />\r\n </div>\r\n</ng-template>\r\n","import {\r\n Directive,\r\n DestroyRef,\r\n ElementRef,\r\n OnInit,\r\n TemplateRef,\r\n computed,\r\n inject,\r\n isDevMode,\r\n} from '@angular/core';\r\n\r\nimport { RAQM_POPOVER, RaqmPopoverContext, RaqmPopoverTriggerRef } from './popover-context';\r\n\r\n/**\r\n * Popover trigger: the one native `<button>` that opens the popup.\r\n *\r\n * @remarks\r\n * No `aria-haspopup`, because the nonmodal surface has no dialog role. Escape closes and\r\n * leaves focus on the trigger; Tab enters the popup's first control.\r\n */\r\n@Directive({\r\n selector: 'button[raqm-popover-trigger]',\r\n host: {\r\n class: 'raqm-popover-trigger',\r\n // No `aria-haspopup` (nonmodal, no dialog role); the pair is expanded + controls.\r\n '[attr.aria-expanded]': 'open() ? \"true\" : \"false\"',\r\n '[attr.aria-controls]': 'open() ? panelId() : null',\r\n '(click)': 'onClick()',\r\n '(keydown)': 'onKeydown($event)',\r\n },\r\n})\r\nexport class RaqmPopoverTriggerDirective implements OnInit {\r\n private readonly host = inject(ElementRef<HTMLButtonElement>);\r\n\r\n // Optional, so a misplaced trigger reports a development error instead of crashing.\r\n private readonly popover = inject<RaqmPopoverContext | null>(RAQM_POPOVER, {\r\n optional: true,\r\n });\r\n\r\n private readonly destroyRef = inject(DestroyRef);\r\n\r\n // Derived from the shared context so `aria-expanded` tracks the real popup state.\r\n readonly open = computed(() => this.popover?.open() ?? false);\r\n\r\n // The root owns the id, so `aria-controls` always points at the real popup.\r\n readonly panelId = computed(() => this.popover?.panelId() ?? null);\r\n\r\n // Getters read live state for the trigger's lifetime.\r\n private readonly ref: RaqmPopoverTriggerRef = (() => {\r\n const self = this;\r\n return {\r\n get element(): HTMLButtonElement {\r\n return self.host.nativeElement;\r\n },\r\n get disabled(): boolean {\r\n return self.host.nativeElement.disabled;\r\n },\r\n focus(): void {\r\n self.host.nativeElement.focus();\r\n },\r\n };\r\n })();\r\n\r\n constructor() {\r\n // Default to `type=\"button\"` for a non-submit disclosure, preserving an authored type.\r\n const element = this.host.nativeElement;\r\n if (!element.hasAttribute('type')) {\r\n element.setAttribute('type', 'button');\r\n }\r\n\r\n if (isDevMode() && this.popover === null) {\r\n console.error(\r\n '[raqm-popover-trigger] No parent <raqm-popover> found; the trigger cannot open a popup.',\r\n );\r\n }\r\n\r\n // Registration waits for `ngOnInit`, so the trigger is fully initialized first.\r\n this.destroyRef.onDestroy(() => this.popover?.unregisterTrigger(this.ref));\r\n }\r\n\r\n ngOnInit(): void {\r\n this.popover?.registerTrigger(this.ref);\r\n }\r\n\r\n /** Toggles on a native click (pointer, Enter or Space); disabled is a no-op. */\r\n protected onClick(): void {\r\n if (this.host.nativeElement.disabled) {\r\n return;\r\n }\r\n this.popover?.toggleFromTrigger(this.ref);\r\n }\r\n\r\n /** Routes Escape to close and Tab into the open popup's logical order. */\r\n protected onKeydown(event: KeyboardEvent): void {\r\n if (this.host.nativeElement.disabled) {\r\n return;\r\n }\r\n if (event.key === 'Escape') {\r\n if (this.popover?.open()) {\r\n event.preventDefault();\r\n // Consume only when this popup handles it, so an enclosing overlay stays open.\r\n event.stopPropagation();\r\n this.popover.closeFromUser();\r\n }\r\n return;\r\n }\r\n if (event.key === 'Tab') {\r\n this.popover?.onTriggerTab(event);\r\n }\r\n }\r\n}\r\n\r\n@Directive({\r\n selector: 'ng-template[raqm-popover-content]',\r\n exportAs: 'raqmPopoverContent',\r\n})\r\nexport class RaqmPopoverContentDirective implements OnInit {\r\n // The template itself — the content identity the root renders.\r\n private readonly template = inject<TemplateRef<unknown>>(TemplateRef);\r\n\r\n // Optional, so a misplaced template reports instead of crashing.\r\n private readonly popover = inject<RaqmPopoverContext | null>(RAQM_POPOVER, {\r\n optional: true,\r\n });\r\n\r\n private readonly destroyRef = inject(DestroyRef);\r\n\r\n constructor() {\r\n if (isDevMode() && this.popover === null) {\r\n console.error(\r\n '[raqm-popover-content] No parent <raqm-popover> found; the template is never rendered.',\r\n );\r\n }\r\n this.destroyRef.onDestroy(() => this.popover?.unregisterContent(this.template));\r\n }\r\n\r\n ngOnInit(): void {\r\n this.popover?.registerContent(this.template);\r\n }\r\n}\r\n\r\n@Directive({\r\n selector: '[raqm-popover-header]',\r\n host: {\r\n class: 'raqm-popover-header',\r\n },\r\n})\r\nexport class RaqmPopoverHeaderDirective {}\r\n\r\n@Directive({\r\n selector: '[raqm-popover-title]',\r\n host: {\r\n class: 'raqm-popover-title',\r\n },\r\n})\r\nexport class RaqmPopoverTitleDirective implements OnInit {\r\n // Native host element; registered with the root for `aria-labelledby`.\r\n private readonly host = inject(ElementRef<HTMLElement>);\r\n\r\n // Optional, so a misplaced title still renders.\r\n private readonly popover = inject<RaqmPopoverContext | null>(RAQM_POPOVER, {\r\n optional: true,\r\n });\r\n\r\n private readonly destroyRef = inject(DestroyRef);\r\n\r\n constructor() {\r\n if (isDevMode() && this.popover === null) {\r\n console.error(\r\n '[raqm-popover-title] No parent <raqm-popover> found; the title cannot be associated with a popup.',\r\n );\r\n }\r\n this.destroyRef.onDestroy(() => this.popover?.unregisterTitle(this.host.nativeElement));\r\n }\r\n\r\n ngOnInit(): void {\r\n this.popover?.registerTitle(this.host.nativeElement);\r\n }\r\n}\r\n\r\n@Directive({\r\n selector: '[raqm-popover-description]',\r\n host: {\r\n class: 'raqm-popover-description',\r\n },\r\n})\r\nexport class RaqmPopoverDescriptionDirective implements OnInit {\r\n // Native host element; registered with the root for `aria-describedby`.\r\n private readonly host = inject(ElementRef<HTMLElement>);\r\n\r\n // Optional, so a misplaced description still renders.\r\n private readonly popover = inject<RaqmPopoverContext | null>(RAQM_POPOVER, {\r\n optional: true,\r\n });\r\n\r\n private readonly destroyRef = inject(DestroyRef);\r\n\r\n constructor() {\r\n if (isDevMode() && this.popover === null) {\r\n console.error(\r\n '[raqm-popover-description] No parent <raqm-popover> found; the description cannot be associated with a popup.',\r\n );\r\n }\r\n this.destroyRef.onDestroy(() => this.popover?.unregisterDescription(this.host.nativeElement));\r\n }\r\n\r\n ngOnInit(): void {\r\n this.popover?.registerDescription(this.host.nativeElement);\r\n }\r\n}\r\n","import { RaqmPopoverComponent } from './popover';\r\nimport {\r\n RaqmPopoverTriggerDirective,\r\n RaqmPopoverContentDirective,\r\n RaqmPopoverHeaderDirective,\r\n RaqmPopoverTitleDirective,\r\n RaqmPopoverDescriptionDirective,\r\n} from './popover.directive';\r\n\r\nexport { RaqmPopoverComponent };\r\nexport {\r\n RaqmPopoverTriggerDirective,\r\n RaqmPopoverContentDirective,\r\n RaqmPopoverHeaderDirective,\r\n RaqmPopoverTitleDirective,\r\n RaqmPopoverDescriptionDirective,\r\n};\r\n\r\nexport const RaqmPopover = [\r\n RaqmPopoverComponent,\r\n RaqmPopoverTriggerDirective,\r\n RaqmPopoverContentDirective,\r\n RaqmPopoverHeaderDirective,\r\n RaqmPopoverTitleDirective,\r\n RaqmPopoverDescriptionDirective,\r\n] as const;\r\n"],"mappings":";;;;;;;;;AA0CA,MAAa,eAAe,IAAI,eAAmC,aAAa;AC1BhF,IAAa,uBAAb,MAAiC;CACF;CAA7B,YAA6B,MAA8B;EAA9B,KAAA,OAAA;CAAiC;CAE9D,qBAAqB,OAAiB;EAC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AAa,gCAA+B;CAEzB,OAAO,OAAO,UAAuB;CAGrC,UAAU,OAAkC,cAAc,EACzE,UAAU,KACX,CAAA;CAEgB,aAAa,OAAO,UAAU;CAE/C,cAAA;EACE,IAAI,UAAS,KAAM,KAAK,YAAY,MAClC,QAAQ,MACN,+GAA+G;EAGnH,KAAK,WAAW,gBAAgB,KAAK,SAAS,sBAAsB,KAAK,KAAK,aAAa,CAAC;CAC9F;CAEA,WAAQ;EACN,KAAK,SAAS,oBAAoB,KAAK,KAAK,aAAa;CAC3D;CAtBW,OAAA,OAAA,GAAA,mBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,UAAA;EAAA,MAAA;EAA+B,MAAA,CAAA;EAAA,QAAA,GAAA,gBAAA;CAAA,CAAA;CAA/B,OAAA,OAAA,GAAA,qBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,MAAA;EAA+B,cAAA;EAAA,UAAA;EAAA,MAAA,EAAA,gBAAA,2BAAA;EAAA,UAAA;CAAA,CAAA;;AAA/B,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAA+B,YAAA,CAAA;EAN3C,MAAA;EAAU,MAAA,CAAA;GACT,UAAU;GACV,MAAM,EACJ,OAAO,2BACR;EACF,CAAA;;;;ACvKD,MAAa,cAAc;CACzB;CACA;CACA;CACA;CACA;CACA;AACQ"}
1
+ {"version":3,"file":"raqm-ui-popover.mjs","names":[],"sources":["../../../projects/ui/popover/popover-context.ts","../../../projects/ui/popover/popover-dismiss.ts","../../../projects/ui/popover/popover-effects.ts","../../../projects/ui/popover/popover-model.ts","../../../projects/ui/popover/popover-keyboard.ts","../../../projects/ui/popover/popover-overlay.ts","../../../projects/ui/popover/popover-position.ts","../../../projects/ui/popover/popover-registration.ts","../../../projects/ui/popover/popover-sizing.ts","../../../projects/ui/popover/popover-view-state.ts","../../../projects/ui/popover/popover.ts","../../../projects/ui/popover/popover.component.html","../../../projects/ui/popover/popover.directive.ts","../../../projects/ui/popover/public-api.ts"],"sourcesContent":["import { InjectionToken, Signal, TemplateRef } from '@angular/core';\r\n\r\nexport interface RaqmPopoverTriggerRef {\r\n /** The native `<button>` the root anchors the overlay to and restores focus to. */\r\n readonly element: HTMLButtonElement;\r\n /** Live native disabled state, read by the root's open policy at event time. */\r\n readonly disabled: boolean;\r\n /** Focuses the trigger; used to restore focus on Escape. */\r\n focus(): void;\r\n}\r\n\r\nexport interface RaqmPopoverContext {\r\n /** Whether the popup is currently open (an enabled `open` model). */\r\n readonly open: Signal<boolean>;\r\n /** The id of the live popup element (the `aria-controls` target), or `null`. */\r\n readonly panelId: Signal<string | null>;\r\n /** Registers the single trigger; called once per root. */\r\n registerTrigger(ref: RaqmPopoverTriggerRef): void;\r\n /** Unregisters the trigger on destroy; never changes open state. */\r\n unregisterTrigger(ref: RaqmPopoverTriggerRef): void;\r\n /** Registers the single content template; called once per root. */\r\n registerContent(template: TemplateRef<unknown>): void;\r\n /** Unregisters the content template on destroy. */\r\n unregisterContent(template: TemplateRef<unknown>): void;\r\n /** Registers a popped title element so the root can point `aria-labelledby` at it. */\r\n registerTitle(element: HTMLElement): void;\r\n /** Removes a popped title element on destroy. */\r\n unregisterTitle(element: HTMLElement): void;\r\n /** Registers a popped description element so the root can point `aria-describedby` at it. */\r\n registerDescription(element: HTMLElement): void;\r\n /** Removes a popped description element on destroy. */\r\n unregisterDescription(element: HTMLElement): void;\r\n /** Toggles the popup from a trigger activation (never opens a disabled root). */\r\n toggleFromTrigger(ref: RaqmPopoverTriggerRef): void;\r\n /** Closes the popup as a user action (outside press / Escape / trigger toggle). */\r\n closeFromUser(): void;\r\n /** Moves focus to the first focusable control inside the open popup, else the popup itself. */\r\n focusFirstInPanel(): void;\r\n /** Routes Tab on the trigger into the open popup's first control. */\r\n onTriggerTab(event: KeyboardEvent): void;\r\n}\r\n\r\nexport const RAQM_POPOVER = new InjectionToken<RaqmPopoverContext>('RaqmPopover');\r\n","// Popover dismissal: the focus-out close policy and the root/pane containment test the\r\n// outside-press and focus paths share.\r\n\r\nimport { containsOwnedOverlay } from '@raqm/ui/overlay-internal';\r\n\r\nexport interface RaqmPopoverDismissalHost {\r\n root: HTMLElement;\r\n open(): boolean;\r\n openValue(): boolean;\r\n disabled(): boolean;\r\n canOpen(): boolean;\r\n pane(): HTMLElement | undefined;\r\n generation(): number;\r\n setOpen(value: boolean): void;\r\n}\r\n\r\nexport class RaqmPopoverDismissal {\r\n constructor(private readonly host: RaqmPopoverDismissalHost) {}\r\n\r\n maybeCloseOnFocusOut(event: FocusEvent): void {\r\n const next = event.relatedTarget as Node | null;\r\n if (this.isInsideRootOrOverlay(next)) {\r\n return;\r\n }\r\n if (!this.host.open()) {\r\n return;\r\n }\r\n const target = event.target as Node | null;\r\n const targetInPanel = !!target && this.host.pane()?.contains(target) === true;\r\n // A content swap blurs the discarded node; defer one microtask and re-check the open\r\n // contract, so only a still-valid departure closes.\r\n const generation = this.host.generation();\r\n const overlay = this.host.pane();\r\n queueMicrotask(() => {\r\n if (\r\n generation !== this.host.generation() ||\r\n this.host.pane() !== overlay ||\r\n !this.host.openValue() ||\r\n this.host.disabled() ||\r\n !this.host.canOpen()\r\n ) {\r\n return;\r\n }\r\n if (targetInPanel && target && !target.isConnected) {\r\n return;\r\n }\r\n if (this.isInsideRootOrOverlay(document.activeElement)) {\r\n return;\r\n }\r\n this.setClosed();\r\n });\r\n }\r\n\r\n isInsideRootOrOverlay(node: Node | null): boolean {\r\n if (!node) {\r\n return false;\r\n }\r\n const overlay = this.host.pane();\r\n return (\r\n containsOwnedOverlay(this.host.root, node) ||\r\n (overlay !== undefined && containsOwnedOverlay(overlay, node))\r\n );\r\n }\r\n\r\n setClosed(): void {\r\n if (this.host.openValue()) {\r\n this.host.setOpen(false);\r\n }\r\n }\r\n}\r\n","// Popover effects: the open policy, placement inputs, panel labelling and panel class,\r\n// registered from the component constructor.\r\n\r\nimport { effect, untracked } from '@angular/core';\r\n\r\nimport { RaqmPopoverAlign, RaqmPopoverSide } from './popover-model';\r\n\r\nexport interface RaqmPopoverEffectsHost {\r\n openValue(): boolean;\r\n disabled(): boolean;\r\n canOpen(): boolean;\r\n side(): RaqmPopoverSide;\r\n align(): RaqmPopoverAlign;\r\n sideOffset(): number;\r\n alignOffset(): number;\r\n dir(): 'ltr' | 'rtl' | undefined;\r\n label(): string | undefined;\r\n panelClass(): string | undefined;\r\n syncOpen(next: boolean): void;\r\n applyPositionInputs(): void;\r\n syncPanelAria(): void;\r\n applyPanelClass(panelClass: string | undefined): void;\r\n}\r\n\r\nexport function connectPopoverEffects(host: RaqmPopoverEffectsHost): void {\r\n // Reacts to open + enabled + content present, so a late registration still opens.\r\n // Never reads `attached`, so the open path cannot re-enter its own effect.\r\n effect(() => {\r\n const next = host.openValue() && !host.disabled() && host.canOpen();\r\n untracked(() => host.syncOpen(next));\r\n });\r\n\r\n effect(() => {\r\n host.side();\r\n host.align();\r\n host.sideOffset();\r\n host.alignOffset();\r\n host.dir();\r\n untracked(() => host.applyPositionInputs());\r\n });\r\n\r\n effect(() => {\r\n host.label();\r\n untracked(() => host.syncPanelAria());\r\n });\r\n\r\n effect(() => {\r\n const panelClass = host.panelClass();\r\n untracked(() => host.applyPanelClass(panelClass));\r\n });\r\n}\r\n","// Popover model: the input value types, their defaults, the shared constants and the\r\n// small pure helpers every popover file reads.\r\n\r\nimport { numberAttribute } from '@angular/core';\r\nimport { Directionality } from '@angular/cdk/bidi';\r\n\r\n/** Side values, plus the two direction-resolved logical sides. */\r\nexport type RaqmPopoverSide = 'top' | 'bottom' | 'left' | 'right' | 'inline-start' | 'inline-end';\r\n\r\nexport type RaqmPopoverAlign = 'start' | 'center' | 'end';\r\n\r\n// A side after logical resolution; pane and motion key on this, so RTL needs no separate rule.\r\nexport type RaqmPopoverPhysicalSide = 'top' | 'bottom' | 'left' | 'right';\r\n\r\nconst SIDES: readonly RaqmPopoverSide[] = [\r\n 'top',\r\n 'bottom',\r\n 'left',\r\n 'right',\r\n 'inline-start',\r\n 'inline-end',\r\n];\r\nconst ALIGNS: readonly RaqmPopoverAlign[] = ['start', 'center', 'end'];\r\n\r\nexport const DEFAULT_SIDE: RaqmPopoverSide = 'bottom';\r\nexport const DEFAULT_ALIGN: RaqmPopoverAlign = 'center';\r\nexport const DEFAULT_SIDE_OFFSET = 4;\r\nexport const DEFAULT_ALIGN_OFFSET = 0;\r\nexport const DEFAULT_WIDTH = '18rem';\r\n\r\nexport const VIEWPORT_MARGIN = 5;\r\n\r\n// Content exit duration: equals `--raqm-duration-fast` (100ms) used by the SCSS exit transition.\r\nexport const EXIT_ANIMATION_MS = 100;\r\n\r\n// The connected overlay pane class (a CDK-owned element); the surface is\r\n// `.raqm-popover-content`.\r\nexport const PANE_CLASS = 'raqm-popover-overlay-pane';\r\n\r\n// Candidates for the focus scans; the CDK `InteractivityChecker` decides actual\r\n// focusability/tabbability (native state, visibility, inert ancestors).\r\nexport const FOCUSABLE_SELECTOR =\r\n 'a[href], button, input, select, textarea, [tabindex], [contenteditable=\"true\"]';\r\n\r\nexport interface PopoverBoxSize {\r\n width: number;\r\n height: number;\r\n}\r\n\r\n// Equal within sub-pixel tolerance, so rounding never looks like a real change.\r\nexport function sameBoxSize(a: PopoverBoxSize | undefined, b: PopoverBoxSize | undefined): boolean {\r\n return (\r\n a !== undefined &&\r\n b !== undefined &&\r\n Math.abs(a.width - b.width) <= 1 &&\r\n Math.abs(a.height - b.height) <= 1\r\n );\r\n}\r\n\r\n// Read at each animation decision so no stale value is cached; every teardown has a fallback.\r\nexport function prefersReducedMotion(): boolean {\r\n return typeof matchMedia === 'function' && matchMedia('(prefers-reduced-motion: reduce)').matches;\r\n}\r\n\r\nexport function toSide(value: unknown): RaqmPopoverSide {\r\n return SIDES.includes(value as RaqmPopoverSide) ? (value as RaqmPopoverSide) : DEFAULT_SIDE;\r\n}\r\n\r\nexport function toAlign(value: unknown): RaqmPopoverAlign {\r\n return ALIGNS.includes(value as RaqmPopoverAlign) ? (value as RaqmPopoverAlign) : DEFAULT_ALIGN;\r\n}\r\n\r\nexport function toDir(value: unknown): 'ltr' | 'rtl' | undefined {\r\n return value === 'ltr' || value === 'rtl' ? value : undefined;\r\n}\r\n\r\nexport function toOffset(fallback: number): (value: unknown) => number {\r\n return (value: unknown): number => {\r\n const parsed = numberAttribute(value, fallback);\r\n return Number.isFinite(parsed) ? parsed : fallback;\r\n };\r\n}\r\n\r\n// Explicit input, then the nearest computed direction, then the CDK Bidi value. Reading\r\n// `getComputedStyle` at call time (not in a cached `computed`) keeps an RTL ancestor\r\n// from being frozen to LTR before attachment.\r\nexport function resolvePopoverDirection(\r\n dir: 'ltr' | 'rtl' | undefined,\r\n element: HTMLElement,\r\n directionality: Directionality | null,\r\n): 'ltr' | 'rtl' {\r\n const explicit = dir;\r\n if (explicit === 'ltr' || explicit === 'rtl') {\r\n return explicit;\r\n }\r\n const computedStyle = getComputedStyle(element).direction;\r\n if (computedStyle === 'rtl') {\r\n return 'rtl';\r\n }\r\n if (computedStyle === 'ltr') {\r\n return 'ltr';\r\n }\r\n return directionality?.value ?? 'ltr';\r\n}\r\n","// Popover focus and keyboard: initial focus placement, the open panel's Tab order and the\r\n// panel's Escape handling.\r\n\r\nimport { InteractivityChecker } from '@angular/cdk/a11y';\r\nimport { OverlayRef } from '@angular/cdk/overlay';\r\nimport { containsOwnedOverlay } from '@raqm/ui/overlay-internal';\r\n\r\nimport { RaqmPopoverTriggerRef } from './popover-context';\r\nimport { FOCUSABLE_SELECTOR } from './popover-model';\r\n\r\nexport interface RaqmPopoverKeyboardHost {\r\n root: HTMLElement;\r\n open(): boolean;\r\n openValue(): boolean;\r\n disabled(): boolean;\r\n canOpen(): boolean;\r\n trigger(): RaqmPopoverTriggerRef | null;\r\n pane(): HTMLElement | undefined;\r\n content(): HTMLElement | null;\r\n overlayRef(): OverlayRef | undefined;\r\n generation(): number;\r\n closeFromUser(): void;\r\n}\r\n\r\nexport class RaqmPopoverKeyboard {\r\n constructor(\r\n private readonly checker: InteractivityChecker,\r\n private readonly host: RaqmPopoverKeyboardHost,\r\n ) {}\r\n\r\n focusFirstInPanel(): void {\r\n const content = this.host.content();\r\n if (!content) {\r\n return;\r\n }\r\n const focusable = this.firstFocusable(content);\r\n (focusable ?? content).focus();\r\n }\r\n\r\n onTriggerTab(event: KeyboardEvent): void {\r\n if (event.shiftKey || !this.host.open()) {\r\n return;\r\n }\r\n event.preventDefault();\r\n this.focusFirstInPanel();\r\n }\r\n\r\n onPanelKeydown(event: KeyboardEvent): void {\r\n if (event.key === 'Escape') {\r\n // Consume only when this popup handles it, so an enclosing overlay stays open.\r\n if (this.host.open()) {\r\n event.preventDefault();\r\n event.stopPropagation();\r\n this.host.closeFromUser();\r\n this.host.trigger()?.focus();\r\n }\r\n return;\r\n }\r\n if (event.key === 'Tab') {\r\n this.handlePanelTab(event);\r\n }\r\n }\r\n\r\n // Focuses the first focusable control, else the popup (`tabindex=\"-1\"`), with one bounded\r\n // microtask retry that re-checks the open contract so a superseded popup cannot steal focus.\r\n focusInitial(overlayRef: OverlayRef, generation: number): void {\r\n if (this.host.overlayRef() !== overlayRef) {\r\n return;\r\n }\r\n this.focusFirstInPanel();\r\n if (!overlayRef.overlayElement.contains(document.activeElement)) {\r\n queueMicrotask(() => {\r\n if (\r\n generation !== this.host.generation() ||\r\n this.host.overlayRef() !== overlayRef ||\r\n !this.host.openValue() ||\r\n this.host.disabled() ||\r\n !this.host.canOpen()\r\n ) {\r\n return;\r\n }\r\n this.focusFirstInPanel();\r\n });\r\n }\r\n }\r\n\r\n private firstFocusable(root: HTMLElement): HTMLElement | null {\r\n const candidates = root.querySelectorAll<HTMLElement>(FOCUSABLE_SELECTOR);\r\n for (const candidate of Array.from(candidates)) {\r\n if (this.checker.isFocusable(candidate)) {\r\n return candidate;\r\n }\r\n }\r\n return null;\r\n }\r\n\r\n private panelTabbables(): HTMLElement[] {\r\n const content = this.host.content();\r\n if (!content) {\r\n return [];\r\n }\r\n return Array.from(content.querySelectorAll<HTMLElement>(FOCUSABLE_SELECTOR)).filter((element) =>\r\n this.checker.isTabbable(element),\r\n );\r\n }\r\n\r\n // Never focus-trapped: forward Tab from the last control goes to the next document control\r\n // after the root (else the browser exits), backward Tab returns to the trigger. The portal\r\n // sits at the end of `<body>`, where natural Tab order would jump past it.\r\n private handlePanelTab(event: KeyboardEvent): void {\r\n const content = this.host.content();\r\n if (!content) {\r\n return;\r\n }\r\n const tabbables = this.panelTabbables();\r\n const active = document.activeElement as HTMLElement | null;\r\n if (event.shiftKey) {\r\n const atStart = tabbables.length > 0 ? active === tabbables[0] : active === content;\r\n const trigger = this.host.trigger();\r\n if (atStart && trigger) {\r\n event.preventDefault();\r\n trigger.focus();\r\n }\r\n return;\r\n }\r\n const atEnd =\r\n tabbables.length > 0 ? active === tabbables[tabbables.length - 1] : active === content;\r\n if (!atEnd) {\r\n return;\r\n }\r\n const next = this.nextTabbableAfterRoot();\r\n if (next) {\r\n event.preventDefault();\r\n next.focus();\r\n }\r\n }\r\n\r\n private nextTabbableAfterRoot(): HTMLElement | null {\r\n const root = this.host.root;\r\n const overlay = this.host.pane();\r\n const candidates = Array.from(\r\n document.querySelectorAll<HTMLElement>(FOCUSABLE_SELECTOR),\r\n ).filter(\r\n (element) =>\r\n this.checker.isTabbable(element) &&\r\n element.closest('[inert]') === null &&\r\n (!overlay || !containsOwnedOverlay(overlay, element)),\r\n );\r\n for (const candidate of candidates) {\r\n const position = root.compareDocumentPosition(candidate);\r\n // Only a control genuinely after the root counts; the root's own descendants\r\n // (the trigger) also report FOLLOWING and must be excluded.\r\n if (\r\n position & Node.DOCUMENT_POSITION_FOLLOWING &&\r\n !(position & Node.DOCUMENT_POSITION_CONTAINED_BY)\r\n ) {\r\n return candidate;\r\n }\r\n }\r\n return null;\r\n }\r\n}\r\n","// Popover pane lifecycle: creation, reveal, the close animation, teardown and the\r\n// subscriptions that keep an open pane anchored.\r\n\r\nimport {\r\n AfterRenderRef,\r\n Injector,\r\n TemplateRef,\r\n ViewContainerRef,\r\n afterNextRender,\r\n} from '@angular/core';\r\n\r\nimport { Overlay, OverlayConfig, OverlayRef } from '@angular/cdk/overlay';\r\nimport { TemplatePortal } from '@angular/cdk/portal';\r\nimport { ScrollDispatcher, ViewportRuler } from '@angular/cdk/scrolling';\r\nimport { containsOwnedOverlay, registerOverlayOwnership } from '@raqm/ui/overlay-internal';\r\n\r\nimport { RaqmPopoverTriggerRef } from './popover-context';\r\nimport {\r\n EXIT_ANIMATION_MS,\r\n PANE_CLASS,\r\n RaqmPopoverAlign,\r\n RaqmPopoverSide,\r\n prefersReducedMotion,\r\n} from './popover-model';\r\nimport { RaqmPopoverPosition } from './popover-position';\r\nimport { RaqmPopoverSizing } from './popover-sizing';\r\nimport { RaqmPopoverState } from './popover-view-state';\r\n\r\nexport interface RaqmPopoverOverlayHost {\r\n /** The root host element; its document is where the owned focusout listener lives. */\r\n root: HTMLElement;\r\n /** The owned id of the live panel. */\r\n readonly panelRootId: string;\r\n trigger(): RaqmPopoverTriggerRef | null;\r\n contentTemplate(): TemplateRef<unknown> | null;\r\n panelTemplate(): TemplateRef<unknown> | undefined;\r\n side(): RaqmPopoverSide;\r\n align(): RaqmPopoverAlign;\r\n panelClass(): string | undefined;\r\n direction(): 'ltr' | 'rtl';\r\n isInsideRootOrOverlay(node: Node | null): boolean;\r\n closeFromUser(): void;\r\n maybeCloseOnFocusOut(event: FocusEvent): void;\r\n syncPanelAria(): void;\r\n focusInitial(overlayRef: OverlayRef, generation: number): void;\r\n setClosed(): void;\r\n}\r\n\r\nexport class RaqmPopoverOverlay {\r\n private overlayRef: OverlayRef | undefined;\r\n\r\n private outsideSubscription: { unsubscribe(): void } | undefined;\r\n private detachSubscription: { unsubscribe(): void } | undefined;\r\n private viewportSubscription: { unsubscribe(): void } | undefined;\r\n private scrollSubscription: { unsubscribe(): void } | undefined;\r\n\r\n // Portaled children are outside the panel DOM, so their focusout cannot bubble to\r\n // the panel handler.\r\n private readonly ownedFocusOut = (event: FocusEvent): void => {\r\n const target = event.target as Node | null;\r\n const pane = this.overlayRef?.overlayElement;\r\n if (pane && target && !pane.contains(target) && containsOwnedOverlay(pane, target)) {\r\n this.host.maybeCloseOnFocusOut(event);\r\n }\r\n };\r\n\r\n private renderTransaction: AfterRenderRef | undefined;\r\n\r\n private disposeTimer: ReturnType<typeof setTimeout> | undefined;\r\n\r\n private pendingDisposeOverlay: OverlayRef | undefined;\r\n\r\n private appliedPanelClass: string | undefined;\r\n\r\n constructor(\r\n private readonly overlay: Overlay,\r\n private readonly scrollDispatcher: ScrollDispatcher,\r\n private readonly viewportRuler: ViewportRuler,\r\n private readonly viewContainerRef: ViewContainerRef,\r\n private readonly injector: Injector,\r\n private readonly state: RaqmPopoverState,\r\n private readonly position: RaqmPopoverPosition,\r\n private readonly sizing: RaqmPopoverSizing,\r\n private readonly host: RaqmPopoverOverlayHost,\r\n ) {}\r\n\r\n get element(): HTMLElement | undefined {\r\n return this.overlayRef?.overlayElement;\r\n }\r\n\r\n get ref(): OverlayRef | undefined {\r\n return this.overlayRef;\r\n }\r\n\r\n contentElement(): HTMLElement | null {\r\n return (\r\n this.overlayRef?.overlayElement.querySelector<HTMLElement>('.raqm-popover-content') ?? null\r\n );\r\n }\r\n\r\n updatePosition(): void {\r\n this.overlayRef?.updatePosition();\r\n }\r\n\r\n setDirection(dir: 'ltr' | 'rtl'): void {\r\n this.overlayRef?.setDirection(dir);\r\n }\r\n\r\n // The single reaction to the derived open state.\r\n syncOpen(next: boolean): void {\r\n if (next === this.state.currentOpen) {\r\n return;\r\n }\r\n if (next) {\r\n this.state.currentOpen = true;\r\n this.beginOpen();\r\n return;\r\n }\r\n this.state.currentOpen = false;\r\n this.beginClose();\r\n }\r\n\r\n private beginOpen(): void {\r\n const trigger = this.host.trigger();\r\n const template = this.host.contentTemplate();\r\n const panelTemplate = this.host.panelTemplate();\r\n if (!trigger || !template || !panelTemplate) {\r\n // Defensive: the open effect already gates on all three being present.\r\n this.state.currentOpen = false;\r\n return;\r\n }\r\n // A rapid reopen cancels a dispose still in flight and a superseded placement pass.\r\n this.flushPendingDispose();\r\n this.cancelRenderTransaction();\r\n const generation = ++this.state.openGeneration;\r\n this.state.closing.set(false);\r\n this.state.attached.set(false);\r\n this.state.panelId.set(this.host.panelRootId);\r\n // Fresh size tracking: previous measurements must never look self-induced.\r\n this.sizing.naturalContentSize = undefined;\r\n this.sizing.expectedContentSize = undefined;\r\n\r\n // Resolve the direction before positions and overlay creation, so CDK resolution and\r\n // our direction-aware tokens agree.\r\n const dir = this.host.direction();\r\n this.state.currentDir = dir;\r\n this.state.panelDir.set(dir);\r\n const preferredSide = this.position.resolvePhysicalSide(this.host.side());\r\n this.state.resolvedSide.set(preferredSide);\r\n this.state.transformOrigin.set(\r\n this.position.computeTransformOrigin(preferredSide, this.host.align()),\r\n );\r\n\r\n const strategy = this.position.buildStrategy(trigger.element);\r\n const config: OverlayConfig = {\r\n positionStrategy: strategy,\r\n hasBackdrop: false,\r\n // One scroll engine only: the `ScrollDispatcher` subscription below drives the\r\n // bounded measure -> cap -> settle refresh.\r\n scrollStrategy: this.overlay.scrollStrategies.noop(),\r\n panelClass: this.panelClasses(),\r\n disposeOnNavigation: true,\r\n direction: dir,\r\n };\r\n const overlayRef = this.overlay.create(config);\r\n registerOverlayOwnership(trigger.element, overlayRef);\r\n this.overlayRef = overlayRef;\r\n this.appliedPanelClass = this.host.panelClass();\r\n this.position.watchSide(strategy);\r\n // Outside press closes without moving focus; a press on the trigger is inside the\r\n // root host and is left to its own toggle.\r\n this.outsideSubscription = overlayRef.outsidePointerEvents().subscribe((event) => {\r\n const target = event.target as Node | null;\r\n if (this.host.isInsideRootOrOverlay(target)) {\r\n return;\r\n }\r\n this.host.closeFromUser();\r\n });\r\n this.detachSubscription = overlayRef.detachments().subscribe(() => this.handleDetached());\r\n this.host.root.ownerDocument.addEventListener('focusout', this.ownedFocusOut, true);\r\n // The position collapses burst notifications into one placement pass per frame.\r\n this.viewportSubscription = this.viewportRuler.change(0).subscribe(() => {\r\n this.position.scheduleReposition();\r\n });\r\n // Scroll changes the popup's viewport position without resizing the anchor; reuse the\r\n // CDK scroll stream, timer-free (`0` audit time).\r\n this.scrollSubscription = this.scrollDispatcher\r\n .ancestorScrolled(trigger.element, 0)\r\n .subscribe(() => this.position.scheduleReposition());\r\n overlayRef.attach(new TemplatePortal(panelTemplate, this.viewContainerRef));\r\n // `attach` positions only in `afterNextRender`, so keep the surface hidden and\r\n // non-interactive until the placement pass has measured, capped and settled it.\r\n overlayRef.overlayElement.style.visibility = 'hidden';\r\n overlayRef.overlayElement.style.pointerEvents = 'none';\r\n this.state.attached.set(true);\r\n this.sizing.attachResizeObserver(trigger.element);\r\n this.startPlacementTransaction(overlayRef, generation);\r\n }\r\n\r\n // One bounded post-render transaction per open, cancellable: the open generation and\r\n // the overlay identity stop a superseded transaction from touching a newer popup.\r\n private startPlacementTransaction(overlayRef: OverlayRef, generation: number): void {\r\n this.renderTransaction = afterNextRender(\r\n () => {\r\n this.renderTransaction = undefined;\r\n if (generation !== this.state.openGeneration || this.overlayRef !== overlayRef) {\r\n return;\r\n }\r\n this.position.reposition();\r\n this.revealAndFocus(overlayRef, generation);\r\n },\r\n { injector: this.injector },\r\n );\r\n }\r\n\r\n private revealAndFocus(overlayRef: OverlayRef, generation: number): void {\r\n const pane = overlayRef.overlayElement;\r\n const content = pane.querySelector<HTMLElement>('.raqm-popover-content');\r\n if (!content || this.overlayRef !== overlayRef) {\r\n return;\r\n }\r\n this.host.syncPanelAria();\r\n content.classList.add('raqm-popover-content--entering');\r\n pane.style.pointerEvents = '';\r\n pane.style.visibility = '';\r\n this.host.focusInitial(overlayRef, generation);\r\n }\r\n\r\n private beginClose(): void {\r\n this.host.root.ownerDocument.removeEventListener('focusout', this.ownedFocusOut, true);\r\n this.state.panelId.set(null);\r\n this.state.closing.set(false);\r\n this.cancelRenderTransaction();\r\n this.state.attached.set(false);\r\n\r\n const overlayRef = this.overlayRef;\r\n this.overlayRef = undefined;\r\n this.position.clearStrategy();\r\n this.position.releaseSideWatch();\r\n this.outsideSubscription?.unsubscribe();\r\n this.outsideSubscription = undefined;\r\n this.detachSubscription?.unsubscribe();\r\n this.detachSubscription = undefined;\r\n this.viewportSubscription?.unsubscribe();\r\n this.viewportSubscription = undefined;\r\n this.scrollSubscription?.unsubscribe();\r\n this.scrollSubscription = undefined;\r\n this.sizing.releaseResizeObserver();\r\n this.appliedPanelClass = undefined;\r\n\r\n if (!overlayRef) {\r\n return;\r\n }\r\n // `inert` first (it empties the accessibility subtree and drops focus), so\r\n // `aria-hidden` never marks an ancestor of a focused element.\r\n overlayRef.overlayElement.setAttribute('inert', '');\r\n overlayRef.overlayElement.setAttribute('aria-hidden', 'true');\r\n\r\n if (prefersReducedMotion()) {\r\n overlayRef.dispose();\r\n return;\r\n }\r\n const content = overlayRef.overlayElement.querySelector<HTMLElement>('.raqm-popover-content');\r\n content?.classList.remove('raqm-popover-content--entering');\r\n content?.classList.add('raqm-popover-content--closing');\r\n this.state.closing.set(true);\r\n this.pendingDisposeOverlay = overlayRef;\r\n this.disposeTimer = setTimeout(() => {\r\n this.disposeTimer = undefined;\r\n this.pendingDisposeOverlay = undefined;\r\n this.state.closing.set(false);\r\n overlayRef.dispose();\r\n }, EXIT_ANIMATION_MS);\r\n }\r\n\r\n private flushPendingDispose(): void {\r\n if (this.disposeTimer !== undefined) {\r\n clearTimeout(this.disposeTimer);\r\n this.disposeTimer = undefined;\r\n }\r\n const overlayRef = this.pendingDisposeOverlay;\r\n this.pendingDisposeOverlay = undefined;\r\n this.state.closing.set(false);\r\n overlayRef?.dispose();\r\n }\r\n\r\n private cancelRenderTransaction(): void {\r\n this.renderTransaction?.destroy();\r\n this.renderTransaction = undefined;\r\n }\r\n\r\n private handleDetached(): void {\r\n this.host.root.ownerDocument.removeEventListener('focusout', this.ownedFocusOut, true);\r\n this.position.releaseSideWatch();\r\n this.outsideSubscription?.unsubscribe();\r\n this.outsideSubscription = undefined;\r\n this.detachSubscription?.unsubscribe();\r\n this.detachSubscription = undefined;\r\n this.viewportSubscription?.unsubscribe();\r\n this.viewportSubscription = undefined;\r\n this.scrollSubscription?.unsubscribe();\r\n this.scrollSubscription = undefined;\r\n this.sizing.releaseResizeObserver();\r\n this.overlayRef = undefined;\r\n this.position.clearStrategy();\r\n this.state.panelId.set(null);\r\n this.state.closing.set(false);\r\n this.state.currentOpen = false;\r\n this.appliedPanelClass = undefined;\r\n this.cancelRenderTransaction();\r\n this.state.attached.set(false);\r\n // A detached popup is gone; reflect it in the model without moving focus.\r\n this.host.setClosed();\r\n }\r\n\r\n destroy(): void {\r\n this.host.root.ownerDocument.removeEventListener('focusout', this.ownedFocusOut, true);\r\n this.state.openGeneration += 1;\r\n this.position.releaseSideWatch();\r\n this.outsideSubscription?.unsubscribe();\r\n this.outsideSubscription = undefined;\r\n this.detachSubscription?.unsubscribe();\r\n this.detachSubscription = undefined;\r\n this.viewportSubscription?.unsubscribe();\r\n this.viewportSubscription = undefined;\r\n this.scrollSubscription?.unsubscribe();\r\n this.scrollSubscription = undefined;\r\n this.sizing.releaseResizeObserver();\r\n this.cancelRenderTransaction();\r\n this.state.attached.set(false);\r\n const overlayRef = this.overlayRef;\r\n this.overlayRef = undefined;\r\n this.position.clearStrategy();\r\n this.appliedPanelClass = undefined;\r\n overlayRef?.dispose();\r\n this.flushPendingDispose();\r\n }\r\n\r\n private panelClasses(): string[] {\r\n const panelClass = this.host.panelClass();\r\n return panelClass ? [PANE_CLASS, panelClass] : [PANE_CLASS];\r\n }\r\n\r\n applyPanelClass(panelClass: string | undefined): void {\r\n const pane = this.overlayRef?.overlayElement;\r\n if (!pane) {\r\n return;\r\n }\r\n if (this.appliedPanelClass && this.appliedPanelClass !== panelClass) {\r\n pane.classList.remove(this.appliedPanelClass);\r\n }\r\n if (panelClass) {\r\n pane.classList.add(panelClass);\r\n }\r\n this.appliedPanelClass = panelClass;\r\n }\r\n}\r\n","// Popover placement: the connected position strategy, its per-side geometry, the side\r\n// watch, and the direction-aware placement pass.\r\n\r\nimport {\r\n ConnectedPosition,\r\n FlexibleConnectedPositionStrategy,\r\n Overlay,\r\n} from '@angular/cdk/overlay';\r\nimport { ViewportRuler } from '@angular/cdk/scrolling';\r\n\r\nimport { RaqmPopoverTriggerRef } from './popover-context';\r\nimport {\r\n RaqmPopoverAlign,\r\n RaqmPopoverPhysicalSide,\r\n RaqmPopoverSide,\r\n VIEWPORT_MARGIN,\r\n} from './popover-model';\r\nimport { RaqmPopoverSizing } from './popover-sizing';\r\nimport { RaqmPopoverState } from './popover-view-state';\r\n\r\n// One positioning pass reuses these, so its sides see one anchor rect and viewport.\r\ninterface PlacementMeasurement {\r\n readonly anchorRect: DOMRectReadOnly | undefined;\r\n readonly viewport: { width: number; height: number };\r\n}\r\n\r\nexport interface RaqmPopoverPositionHost {\r\n side(): RaqmPopoverSide;\r\n align(): RaqmPopoverAlign;\r\n direction(): 'ltr' | 'rtl';\r\n trigger(): RaqmPopoverTriggerRef | null;\r\n pane(): HTMLElement | undefined;\r\n updatePosition(): void;\r\n setDirection(dir: 'ltr' | 'rtl'): void;\r\n}\r\n\r\nexport class RaqmPopoverPosition {\r\n private positionStrategy: FlexibleConnectedPositionStrategy | undefined;\r\n\r\n private currentPositions: ConnectedPosition[] = [];\r\n private currentPositionSides: RaqmPopoverPhysicalSide[] = [];\r\n\r\n private sideSubscription: { unsubscribe(): void } | undefined;\r\n\r\n private frame = 0;\r\n private frameView: Window | undefined;\r\n\r\n constructor(\r\n private readonly overlay: Overlay,\r\n private readonly viewportRuler: ViewportRuler,\r\n private readonly state: RaqmPopoverState,\r\n private readonly sizing: RaqmPopoverSizing,\r\n private readonly host: RaqmPopoverPositionHost,\r\n ) {}\r\n\r\n buildStrategy(origin: HTMLElement): FlexibleConnectedPositionStrategy {\r\n const strategy = this.overlay.position().flexibleConnectedTo(origin);\r\n strategy\r\n .withFlexibleDimensions(false)\r\n .withGrowAfterOpen(false)\r\n .withPush(true)\r\n .withViewportMargin(VIEWPORT_MARGIN);\r\n const preferred = this.resolvePhysicalSide(this.host.side());\r\n this.currentPositionSides = [preferred, this.oppositeSide(preferred)];\r\n const measurement = this.measure();\r\n this.currentPositions = this.currentPositionSides.map((side) =>\r\n this.buildPositionFor(side, measurement),\r\n );\r\n strategy.withPositions(this.currentPositions);\r\n this.positionStrategy = strategy;\r\n return strategy;\r\n }\r\n\r\n private measure(): PlacementMeasurement {\r\n return {\r\n anchorRect: this.host.trigger()?.element?.getBoundingClientRect(),\r\n viewport: this.viewportRuler.getViewportSize(),\r\n };\r\n }\r\n\r\n private setPositions(\r\n sides: readonly RaqmPopoverPhysicalSide[],\r\n measurement: PlacementMeasurement = this.measure(),\r\n ): void {\r\n const strategy = this.positionStrategy;\r\n if (!strategy) {\r\n return;\r\n }\r\n const positions = sides.map((side) => this.buildPositionFor(side, measurement));\r\n strategy.withPositions(positions);\r\n this.currentPositions = positions;\r\n this.currentPositionSides = [...sides];\r\n }\r\n\r\n // The single position for one physical side. The CDK's `originX`/`overlayX` are logical,\r\n // so left/right placements stay direction-correct while top/bottom are physical.\r\n private buildPositionFor(\r\n side: RaqmPopoverPhysicalSide,\r\n measurement: PlacementMeasurement,\r\n ): ConnectedPosition {\r\n const align = this.host.align();\r\n const anchorRect = measurement.anchorRect;\r\n const viewport = measurement.viewport;\r\n const x = align;\r\n const y = this.toVerticalAlign(align);\r\n const mainOffset = this.sizing.effectiveSideOffset(side, anchorRect, viewport);\r\n const alignX = this.sizing.crossAxisGeometry('x', anchorRect, viewport.width).offset;\r\n const alignY = this.sizing.crossAxisGeometry('y', anchorRect, viewport.height).offset;\r\n switch (side) {\r\n case 'bottom':\r\n return {\r\n originX: x,\r\n originY: 'bottom',\r\n overlayX: x,\r\n overlayY: 'top',\r\n offsetX: alignX,\r\n offsetY: mainOffset,\r\n };\r\n case 'top':\r\n return {\r\n originX: x,\r\n originY: 'top',\r\n overlayX: x,\r\n overlayY: 'bottom',\r\n offsetX: alignX,\r\n offsetY: mainOffset,\r\n };\r\n case 'right':\r\n return this.horizontalPosition('right', y, mainOffset, alignY);\r\n case 'left':\r\n default:\r\n return this.horizontalPosition('left', y, mainOffset, alignY);\r\n }\r\n }\r\n\r\n private horizontalPosition(\r\n side: 'left' | 'right',\r\n alignY: 'top' | 'center' | 'bottom',\r\n offsetX: number,\r\n alignYOffset: number,\r\n ): ConnectedPosition {\r\n const rtl = this.state.currentDir === 'rtl';\r\n const originX = side === 'right' ? (rtl ? 'start' : 'end') : rtl ? 'end' : 'start';\r\n const overlayX = side === 'right' ? (rtl ? 'end' : 'start') : rtl ? 'start' : 'end';\r\n return {\r\n originX,\r\n originY: alignY,\r\n overlayX,\r\n overlayY: alignY,\r\n // Both offsets are already collision-corrected by the caller.\r\n offsetX,\r\n offsetY: alignYOffset,\r\n };\r\n }\r\n\r\n private oppositeSide(side: RaqmPopoverPhysicalSide): RaqmPopoverPhysicalSide {\r\n switch (side) {\r\n case 'top':\r\n return 'bottom';\r\n case 'bottom':\r\n return 'top';\r\n case 'left':\r\n return 'right';\r\n default:\r\n return 'left';\r\n }\r\n }\r\n\r\n watchSide(strategy: FlexibleConnectedPositionStrategy): void {\r\n this.sideSubscription = strategy.positionChanges.subscribe((change) => {\r\n const index = this.currentPositions.indexOf(change.connectionPair);\r\n const applied = this.currentPositionSides[index] ?? this.currentPositionSides[0] ?? 'bottom';\r\n this.state.resolvedSide.set(applied);\r\n this.state.transformOrigin.set(this.computeTransformOrigin(applied, this.host.align()));\r\n });\r\n }\r\n\r\n resolvePhysicalSide(side: RaqmPopoverSide): RaqmPopoverPhysicalSide {\r\n switch (side) {\r\n case 'inline-start':\r\n return this.state.currentDir === 'rtl' ? 'right' : 'left';\r\n case 'inline-end':\r\n return this.state.currentDir === 'rtl' ? 'left' : 'right';\r\n default:\r\n return side;\r\n }\r\n }\r\n\r\n computeTransformOrigin(side: RaqmPopoverPhysicalSide, align: RaqmPopoverAlign): string {\r\n const rtl = this.state.currentDir === 'rtl';\r\n const x =\r\n side === 'left'\r\n ? 'right'\r\n : side === 'right'\r\n ? 'left'\r\n : align === 'start'\r\n ? rtl\r\n ? 'right'\r\n : 'left'\r\n : align === 'end'\r\n ? rtl\r\n ? 'left'\r\n : 'right'\r\n : 'center';\r\n const y = side === 'top' ? 'bottom' : side === 'bottom' ? 'top' : this.toVerticalAlign(align);\r\n return `${x} ${y}`;\r\n }\r\n\r\n private toVerticalAlign(align: RaqmPopoverAlign): 'top' | 'center' | 'bottom' {\r\n return align === 'start' ? 'top' : align === 'end' ? 'bottom' : 'center';\r\n }\r\n\r\n // Bounded placement, fixed step order: refresh direction, restore natural order and clear\r\n // caps to measure the unclamped size, `updatePosition()` picks the side, cap that side from\r\n // its own room, settle on that single position (so the cap cannot re-select the other\r\n // side), then record the capped box for the self-induced guard. Two placements per refresh,\r\n // no timers or observer re-entry.\r\n reposition(): void {\r\n this.cancelScheduledReposition();\r\n const pane = this.host.pane();\r\n const strategy = this.positionStrategy;\r\n if (!pane || !strategy) {\r\n return;\r\n }\r\n const dir = this.host.direction();\r\n if (dir !== this.state.currentDir) {\r\n this.state.currentDir = dir;\r\n this.state.panelDir.set(dir);\r\n this.host.setDirection(dir);\r\n }\r\n const measurement = this.measure();\r\n const preferred = this.resolvePhysicalSide(this.host.side());\r\n this.setPositions([preferred, this.oppositeSide(preferred)], measurement);\r\n this.sizing.resetAvailableSize();\r\n this.sizing.naturalContentSize = this.sizing.contentBoxSize();\r\n this.host.updatePosition();\r\n const applied = this.state.resolvedSide();\r\n this.sizing.applyAvailableSize(measurement.anchorRect, measurement.viewport);\r\n this.setPositions([applied], measurement);\r\n this.host.updatePosition();\r\n this.sizing.expectedContentSize = this.sizing.contentBoxSize();\r\n }\r\n\r\n // Scroll and resize notifications can burst within one frame; the final pass is the one\r\n // that matters, so collapse them instead of re-measuring for every event.\r\n scheduleReposition(): void {\r\n if (!this.positionStrategy || this.frame) {\r\n return;\r\n }\r\n const view = this.host.trigger()?.element?.ownerDocument.defaultView;\r\n if (!view || typeof view.requestAnimationFrame !== 'function') {\r\n this.reposition();\r\n return;\r\n }\r\n this.frameView = view;\r\n this.frame = view.requestAnimationFrame(() => {\r\n this.frame = 0;\r\n this.frameView = undefined;\r\n this.reposition();\r\n });\r\n }\r\n\r\n applyPositionInputs(): void {\r\n this.reposition();\r\n }\r\n\r\n releaseSideWatch(): void {\r\n this.sideSubscription?.unsubscribe();\r\n this.sideSubscription = undefined;\r\n }\r\n\r\n clearStrategy(): void {\r\n this.cancelScheduledReposition();\r\n this.positionStrategy = undefined;\r\n }\r\n\r\n private cancelScheduledReposition(): void {\r\n if (!this.frame) {\r\n return;\r\n }\r\n this.frameView?.cancelAnimationFrame(this.frame);\r\n this.frame = 0;\r\n this.frameView = undefined;\r\n }\r\n}\r\n","// Popover registration: the single trigger, content template, title and description the\r\n// projected slots hand to the root, and the panel's labelling.\r\n\r\nimport { TemplateRef, isDevMode, signal } from '@angular/core';\r\n\r\nimport { RaqmPopoverTriggerRef } from './popover-context';\r\n\r\nlet nextPopoverId = 0;\r\n\r\nexport interface RaqmPopoverRegistrationHost {\r\n /** The live pane's content surface, or `null` while no pane is attached. */\r\n content(): HTMLElement | null;\r\n /** An explicit accessible name used when no title slot is registered. */\r\n label(): string | undefined;\r\n}\r\n\r\nexport class RaqmPopoverRegistration {\r\n readonly triggerRef = signal<RaqmPopoverTriggerRef | null>(null);\r\n readonly contentTemplate = signal<TemplateRef<unknown> | null>(null);\r\n\r\n private readonly titleElement = signal<HTMLElement | null>(null);\r\n private readonly descriptionElement = signal<HTMLElement | null>(null);\r\n\r\n private readonly rootId = ++nextPopoverId;\r\n\r\n readonly panelRootId = `raqm-popover-panel-${this.rootId}`;\r\n private readonly titleRootId = `raqm-popover-title-${this.rootId}`;\r\n private readonly descriptionRootId = `raqm-popover-description-${this.rootId}`;\r\n\r\n constructor(private readonly host: RaqmPopoverRegistrationHost) {}\r\n\r\n registerTrigger(ref: RaqmPopoverTriggerRef): void {\r\n const current = this.triggerRef();\r\n if (current !== null && current !== ref) {\r\n if (isDevMode()) {\r\n console.error(\r\n '[raqm-popover] Only one `button[raqm-popover-trigger]` is supported per <raqm-popover>; the extra trigger is ignored.',\r\n );\r\n }\r\n return;\r\n }\r\n this.triggerRef.set(ref);\r\n }\r\n\r\n unregisterTrigger(ref: RaqmPopoverTriggerRef): void {\r\n if (this.triggerRef() === ref) {\r\n this.triggerRef.set(null);\r\n }\r\n }\r\n\r\n registerContent(template: TemplateRef<unknown>): void {\r\n const current = this.contentTemplate();\r\n if (current !== null && current !== template) {\r\n if (isDevMode()) {\r\n console.error(\r\n '[raqm-popover] Only one `ng-template[raqm-popover-content]` is supported per <raqm-popover>; the extra template is ignored.',\r\n );\r\n }\r\n return;\r\n }\r\n this.contentTemplate.set(template);\r\n }\r\n\r\n unregisterContent(template: TemplateRef<unknown>): void {\r\n if (this.contentTemplate() === template) {\r\n this.contentTemplate.set(null);\r\n }\r\n }\r\n\r\n /** Registers a title element, assigning the owned id only when it has none. */\r\n registerTitle(element: HTMLElement): void {\r\n if (isDevMode() && this.titleElement() !== null && this.titleElement() !== element) {\r\n console.error(\r\n '[raqm-popover] Only one `[raqm-popover-title]` is expected per <raqm-popover>; the latest registration wins.',\r\n );\r\n }\r\n if (!element.id) {\r\n element.id = this.titleRootId;\r\n }\r\n this.titleElement.set(element);\r\n this.syncPanelAria();\r\n }\r\n\r\n unregisterTitle(element: HTMLElement): void {\r\n if (this.titleElement() === element) {\r\n this.titleElement.set(null);\r\n this.syncPanelAria();\r\n }\r\n }\r\n\r\n registerDescription(element: HTMLElement): void {\r\n if (\r\n isDevMode() &&\r\n this.descriptionElement() !== null &&\r\n this.descriptionElement() !== element\r\n ) {\r\n console.error(\r\n '[raqm-popover] Only one `[raqm-popover-description]` is expected per <raqm-popover>; the latest registration wins.',\r\n );\r\n }\r\n if (!element.id) {\r\n element.id = this.descriptionRootId;\r\n }\r\n this.descriptionElement.set(element);\r\n this.syncPanelAria();\r\n }\r\n\r\n unregisterDescription(element: HTMLElement): void {\r\n if (this.descriptionElement() === element) {\r\n this.descriptionElement.set(null);\r\n this.syncPanelAria();\r\n }\r\n }\r\n\r\n // Points labelling at the registered title/description or explicit `label`,\r\n // removing whichever attribute does not apply.\r\n syncPanelAria(): void {\r\n const content = this.host.content();\r\n if (!content) {\r\n return;\r\n }\r\n const title = this.titleElement();\r\n const description = this.descriptionElement();\r\n if (title) {\r\n content.setAttribute('aria-labelledby', title.id);\r\n } else {\r\n content.removeAttribute('aria-labelledby');\r\n }\r\n if (description) {\r\n content.setAttribute('aria-describedby', description.id);\r\n } else {\r\n content.removeAttribute('aria-describedby');\r\n }\r\n const label = this.host.label();\r\n if (!title && label) {\r\n content.setAttribute('aria-label', label);\r\n } else {\r\n content.removeAttribute('aria-label');\r\n }\r\n }\r\n}\r\n","// Popover sizing: the available-size caps published to the pane, the collision-corrected\r\n// geometry those caps are measured from, and the anchor/content resize observer.\r\n\r\nimport { ViewportRuler } from '@angular/cdk/scrolling';\r\n\r\nimport { RaqmPopoverTriggerRef } from './popover-context';\r\nimport {\r\n PopoverBoxSize,\r\n RaqmPopoverAlign,\r\n RaqmPopoverPhysicalSide,\r\n VIEWPORT_MARGIN,\r\n sameBoxSize,\r\n} from './popover-model';\r\nimport { RaqmPopoverState } from './popover-view-state';\r\n\r\nexport interface RaqmPopoverSizingHost {\r\n align(): RaqmPopoverAlign;\r\n alignOffset(): number;\r\n sideOffset(): number;\r\n trigger(): RaqmPopoverTriggerRef | null;\r\n pane(): HTMLElement | undefined;\r\n content(): HTMLElement | null;\r\n reposition(): void;\r\n}\r\n\r\nexport class RaqmPopoverSizing {\r\n // Natural and capped content sizes: the only two sizes this component writes, so a\r\n // resize report matching either is self-induced and ignored (prevents a\r\n // size <-> reposition loop); any other size is a genuine content change.\r\n naturalContentSize: PopoverBoxSize | undefined;\r\n expectedContentSize: PopoverBoxSize | undefined;\r\n\r\n private resizeObserver: ResizeObserver | undefined;\r\n\r\n constructor(\r\n private readonly viewportRuler: ViewportRuler,\r\n private readonly state: RaqmPopoverState,\r\n private readonly host: RaqmPopoverSizingHost,\r\n ) {}\r\n\r\n // Whole-viewport bound a cap may reach, keeping the pane inside the viewport at an edge.\r\n private viewportCap(viewportDimension: number): number {\r\n return Math.max(viewportDimension - VIEWPORT_MARGIN * 2, 0);\r\n }\r\n\r\n // Layout box, never `getBoundingClientRect()`: the latter is transformed, so the enter\r\n // animation's scale would skew the size. `ResizeObserver` also reports layout boxes.\r\n contentBoxSize(): PopoverBoxSize | undefined {\r\n const content = this.host.content();\r\n if (!content) {\r\n return undefined;\r\n }\r\n return { width: content.offsetWidth, height: content.offsetHeight };\r\n }\r\n\r\n private isSelfInducedContentSize(size: PopoverBoxSize): boolean {\r\n return (\r\n sameBoxSize(size, this.naturalContentSize) || sameBoxSize(size, this.expectedContentSize)\r\n );\r\n }\r\n\r\n resetAvailableSize(): void {\r\n const pane = this.host.pane();\r\n if (!pane) {\r\n return;\r\n }\r\n pane.style.removeProperty('--raqm-popover-available-width');\r\n pane.style.removeProperty('--raqm-popover-available-height');\r\n }\r\n\r\n attachResizeObserver(anchor: HTMLElement): void {\r\n this.releaseResizeObserver();\r\n if (typeof ResizeObserver === 'undefined') {\r\n return;\r\n }\r\n this.resizeObserver = new ResizeObserver((entries) => {\r\n const content = this.host.content();\r\n for (const entry of entries) {\r\n // The anchor is never sized by this component, so any anchor change is real.\r\n if (entry.target !== content) {\r\n this.host.reposition();\r\n return;\r\n }\r\n // Cleared and re-applied caps change the content box as a direct consequence of\r\n // `reposition`; those sizes must not re-enter it (a size <-> reposition loop).\r\n const size = this.contentBoxSize();\r\n if (size && !this.isSelfInducedContentSize(size)) {\r\n this.host.reposition();\r\n return;\r\n }\r\n }\r\n });\r\n this.resizeObserver.observe(anchor);\r\n const content = this.host.content();\r\n if (content) {\r\n this.resizeObserver.observe(content);\r\n }\r\n }\r\n\r\n releaseResizeObserver(): void {\r\n this.resizeObserver?.disconnect();\r\n this.resizeObserver = undefined;\r\n }\r\n\r\n // Publishes the resolved side's real room as CSS custom properties so the SCSS can clamp\r\n // the surface. Both axes are capped so the offset-applied surface fits the strategy's\r\n // narrowed viewport: `_pushOverlayOnScreen` runs on both axes as soon as either\r\n // overflows and would displace the authored alignment offset.\r\n applyAvailableSize(\r\n measuredRect?: DOMRectReadOnly,\r\n measuredViewport?: { width: number; height: number },\r\n ): void {\r\n const pane = this.host.pane();\r\n const anchor = this.host.trigger()?.element;\r\n if (!pane || !anchor) {\r\n return;\r\n }\r\n const anchorRect = measuredRect ?? anchor.getBoundingClientRect();\r\n const viewport = measuredViewport ?? this.viewportRuler.getViewportSize();\r\n const sideOffset = this.host.sideOffset();\r\n const side = this.state.resolvedSide();\r\n const capacityWidth = this.viewportCap(viewport.width);\r\n const capacityHeight = this.viewportCap(viewport.height);\r\n // `capacity` is the client size less the 5px margin per side, the strategy's own fit\r\n // boundary. Reaching only the client margin would set `_isPushed` and let\r\n // `_pushOverlayOnScreen` move the un-offset base, displacing the authored offset.\r\n const below = capacityHeight - anchorRect.bottom - sideOffset;\r\n const above = anchorRect.top - sideOffset - VIEWPORT_MARGIN;\r\n const after = capacityWidth - anchorRect.right - sideOffset;\r\n const before = anchorRect.left - sideOffset - VIEWPORT_MARGIN;\r\n // A non-positive own room means a push on this axis is unavoidable, so the cross\r\n // axis must use its conservative (un-offset) room.\r\n const ownRoom =\r\n side === 'top' ? above : side === 'left' ? before : side === 'bottom' ? below : after;\r\n const crossConservative = ownRoom <= 0;\r\n // The cross axis is bounded from the offset-applied aligned edge, the edge the\r\n // strategy actually lands on, and applied as measured (never widened back).\r\n const crossWidth = this.crossAxisGeometry(\r\n 'x',\r\n anchorRect,\r\n viewport.width,\r\n crossConservative,\r\n ).room;\r\n const crossHeight = this.crossAxisGeometry(\r\n 'y',\r\n anchorRect,\r\n viewport.height,\r\n crossConservative,\r\n ).room;\r\n let width: number;\r\n let height: number;\r\n let widthIsCross = false;\r\n let heightIsCross = false;\r\n switch (side) {\r\n case 'top':\r\n height = above;\r\n width = crossWidth;\r\n widthIsCross = true;\r\n break;\r\n case 'left':\r\n width = before;\r\n height = crossHeight;\r\n heightIsCross = true;\r\n break;\r\n case 'right':\r\n width = after;\r\n height = crossHeight;\r\n heightIsCross = true;\r\n break;\r\n case 'bottom':\r\n default:\r\n height = below;\r\n width = crossWidth;\r\n widthIsCross = true;\r\n break;\r\n }\r\n // Cross room is applied as measured; a zero/negative own room falls back to the\r\n // whole-viewport cap so the axis stays clamped.\r\n this.applyAvailableDimension(\r\n pane,\r\n '--raqm-popover-available-width',\r\n widthIsCross || width > 0 ? Math.min(width, capacityWidth) : capacityWidth,\r\n );\r\n this.applyAvailableDimension(\r\n pane,\r\n '--raqm-popover-available-height',\r\n heightIsCross || height > 0 ? Math.min(height, capacityHeight) : capacityHeight,\r\n );\r\n }\r\n\r\n effectiveSideOffset(\r\n side: RaqmPopoverPhysicalSide,\r\n measuredRect?: DOMRectReadOnly,\r\n measuredViewport?: { width: number; height: number },\r\n ): number {\r\n const authored =\r\n side === 'bottom' || side === 'right' ? this.host.sideOffset() : -this.host.sideOffset();\r\n const anchor = this.host.trigger()?.element;\r\n const pane = this.host.pane();\r\n if (!anchor || !pane) {\r\n return authored;\r\n }\r\n const horizontal = side === 'left' || side === 'right';\r\n const viewport = measuredViewport ?? this.viewportRuler.getViewportSize();\r\n const client = horizontal ? viewport.width : viewport.height;\r\n const size = horizontal\r\n ? pane.getBoundingClientRect().width\r\n : pane.getBoundingClientRect().height;\r\n const capacity = this.viewportCap(client);\r\n // Not measurable, or already wider/taller than the narrowed viewport, where no\r\n // offset can fit (the cap prevents the latter).\r\n if (size <= 0 || size > capacity) {\r\n return authored;\r\n }\r\n const anchorRect = measuredRect ?? anchor.getBoundingClientRect();\r\n // The un-offset base edge: the anchor's far edge for bottom/right, one pane-length\r\n // before its near edge for top/left.\r\n const base = horizontal\r\n ? side === 'right'\r\n ? anchorRect.right\r\n : anchorRect.left - size\r\n : side === 'bottom'\r\n ? anchorRect.bottom\r\n : anchorRect.top - size;\r\n // Near overflow wins, otherwise the far overflow is undone, so a saturated push\r\n // lands the base box on `VIEWPORT_MARGIN`/`capacity`.\r\n const overflowNear = Math.max(VIEWPORT_MARGIN - base, 0);\r\n const overflowFar = Math.max(base + size - capacity, 0);\r\n const pushedBase = base + (overflowNear || -overflowFar);\r\n // The final box must stay inside the client margins; with `size <= capacity` this\r\n // interval is never empty.\r\n return Math.min(\r\n Math.max(authored, VIEWPORT_MARGIN - pushedBase),\r\n client - VIEWPORT_MARGIN - pushedBase - size,\r\n );\r\n }\r\n\r\n private authoredCrossOffset(axis: 'x' | 'y'): number {\r\n const alignOffset = this.host.alignOffset();\r\n return axis === 'x' && this.state.currentDir === 'rtl' ? -alignOffset : alignOffset;\r\n }\r\n\r\n // The position's collision-corrected cross offset and the room the surface may occupy,\r\n // measured from the offset-applied aligned edge out to the strategy's fit boundary.\r\n // `conservative` (the caller's other axis will be pushed) measures from the un-offset\r\n // origin instead, the only width that push cannot displace.\r\n crossAxisGeometry(\r\n axis: 'x' | 'y',\r\n anchorRect: DOMRectReadOnly | undefined,\r\n viewportDimension: number,\r\n conservative = false,\r\n ): { offset: number; room: number } {\r\n const authored = this.authoredCrossOffset(axis);\r\n const capacity = this.viewportCap(viewportDimension);\r\n if (!authored || !anchorRect) {\r\n return { offset: authored, room: capacity };\r\n }\r\n const rtl = this.state.currentDir === 'rtl';\r\n // Alignment stays logical; the origin edge resolves per axis like the strategy's\r\n // own origin point (X against the direction, Y as top/bottom).\r\n const align = this.host.align();\r\n const axisStart = axis === 'x' ? anchorRect.left : anchorRect.top;\r\n const axisSize = axis === 'x' ? anchorRect.width : anchorRect.height;\r\n const startEdge = axis === 'x' && rtl ? axisStart + axisSize : axisStart;\r\n const endEdge = axis === 'x' && rtl ? axisStart : axisStart + axisSize;\r\n const origin =\r\n align === 'start' ? startEdge : align === 'end' ? endEdge : axisStart + axisSize / 2;\r\n // The offset may not carry the aligned edge out of the margin or past the fit\r\n // boundary, so neither room below is negative.\r\n const offset = Math.min(Math.max(authored, VIEWPORT_MARGIN - origin), capacity - origin);\r\n // Measure from where the corrected offset lands the surface; conservative mode uses\r\n // the un-offset origin, since the other axis's push moves that base.\r\n const roomEdge = conservative ? origin : origin + offset;\r\n const beforeRoom = Math.max(roomEdge - VIEWPORT_MARGIN, 0);\r\n const afterRoom = Math.max(capacity - roomEdge, 0);\r\n if (align === 'center') {\r\n // Centered: the smaller half-room bounds it, else the larger one, still capped.\r\n const half = Math.min(beforeRoom, afterRoom);\r\n return {\r\n offset,\r\n room: Math.min((half || Math.max(beforeRoom, afterRoom)) * 2, capacity),\r\n };\r\n }\r\n // Growth direction: logical `start` grows toward the viewport end in LTR and its\r\n // start in RTL; the vertical axis never mirrors.\r\n const growsAfter = axis === 'y' ? align === 'start' : align === 'start' ? !rtl : rtl;\r\n const growth = growsAfter ? afterRoom : beforeRoom;\r\n // Zero growth means the anchor sits at that edge: keep the opposite room, still\r\n // bounded, never the whole-viewport cap.\r\n return { offset, room: growth || (growsAfter ? beforeRoom : afterRoom) };\r\n }\r\n\r\n // Writes one size cap only when it changes. Floored, so the published cap can never\r\n // exceed the measured room by a sub-pixel and re-cross the fit boundary (which would\r\n // re-trigger a push); never cleared.\r\n private applyAvailableDimension(pane: HTMLElement, property: string, value: number): void {\r\n const next = `${Math.max(Math.floor(value), 0)}px`;\r\n if (pane.style.getPropertyValue(property) !== next) {\r\n pane.style.setProperty(property, next);\r\n }\r\n }\r\n}\r\n","// Popover pane state: the writable signals the pane lifecycle writes and the template\r\n// reads, plus the open bookkeeping shared by the close paths.\r\n\r\nimport { signal } from '@angular/core';\r\n\r\nimport { RaqmPopoverPhysicalSide } from './popover-model';\r\n\r\nexport class RaqmPopoverState {\r\n readonly attached = signal(false);\r\n\r\n readonly panelId = signal<string | null>(null);\r\n\r\n readonly resolvedSide = signal<RaqmPopoverPhysicalSide>('bottom');\r\n readonly transformOrigin = signal('center top');\r\n\r\n readonly closing = signal(false);\r\n\r\n readonly panelDir = signal<'ltr' | 'rtl'>('ltr');\r\n\r\n currentDir: 'ltr' | 'rtl' = 'ltr';\r\n\r\n currentOpen = false;\r\n\r\n openGeneration = 0;\r\n}\r\n","import {\r\n ChangeDetectionStrategy,\r\n Component,\r\n ElementRef,\r\n Injector,\r\n OnDestroy,\r\n TemplateRef,\r\n ViewContainerRef,\r\n booleanAttribute,\r\n computed,\r\n inject,\r\n input,\r\n model,\r\n viewChild,\r\n} from '@angular/core';\r\nimport { NgTemplateOutlet } from '@angular/common';\r\n\r\nimport { InteractivityChecker } from '@angular/cdk/a11y';\r\nimport { Directionality } from '@angular/cdk/bidi';\r\nimport { Overlay } from '@angular/cdk/overlay';\r\nimport { ScrollDispatcher, ViewportRuler } from '@angular/cdk/scrolling';\r\n\r\nimport { RAQM_POPOVER, RaqmPopoverContext, RaqmPopoverTriggerRef } from './popover-context';\r\nimport { RaqmPopoverDismissal } from './popover-dismiss';\r\nimport { connectPopoverEffects } from './popover-effects';\r\nimport { RaqmPopoverKeyboard } from './popover-keyboard';\r\nimport {\r\n DEFAULT_ALIGN,\r\n DEFAULT_ALIGN_OFFSET,\r\n DEFAULT_SIDE,\r\n DEFAULT_SIDE_OFFSET,\r\n DEFAULT_WIDTH,\r\n RaqmPopoverAlign,\r\n RaqmPopoverSide,\r\n resolvePopoverDirection,\r\n toAlign,\r\n toDir,\r\n toOffset,\r\n toSide,\r\n} from './popover-model';\r\nimport { RaqmPopoverOverlay } from './popover-overlay';\r\nimport { RaqmPopoverPosition } from './popover-position';\r\nimport { RaqmPopoverRegistration } from './popover-registration';\r\nimport { RaqmPopoverSizing } from './popover-sizing';\r\nimport { RaqmPopoverState } from './popover-view-state';\r\n\r\nexport type { RaqmPopoverAlign, RaqmPopoverSide } from './popover-model';\r\n\r\n@Component({\r\n selector: 'raqm-popover',\r\n imports: [NgTemplateOutlet],\r\n templateUrl: './popover.component.html',\r\n styleUrl: './popover.component.scss',\r\n changeDetection: ChangeDetectionStrategy.OnPush,\r\n exportAs: 'raqmPopover',\r\n providers: [{ provide: RAQM_POPOVER, useExisting: RaqmPopoverComponent }],\r\n host: {\r\n // Focus-out closes only when focus leaves BOTH the root and its overlay.\r\n '(focusout)': 'onFocusOut($event)',\r\n },\r\n})\r\nexport class RaqmPopoverComponent implements RaqmPopoverContext, OnDestroy {\r\n // The host renders no box (`display: contents`), so the projected trigger takes part in parent layout.\r\n private readonly host = inject<ElementRef<HTMLElement>>(ElementRef);\r\n\r\n private readonly overlay = inject(Overlay);\r\n\r\n private readonly viewContainerRef = inject(ViewContainerRef);\r\n\r\n private readonly injector = inject(Injector);\r\n\r\n // Optional; `resolvePopoverDirection` prefers the live computed direction, which also\r\n // covers a CSS-only `dir` ancestor.\r\n private readonly directionality = inject(Directionality, { optional: true });\r\n\r\n private readonly viewportRuler = inject(ViewportRuler);\r\n\r\n private readonly scrollDispatcher = inject(ScrollDispatcher);\r\n\r\n private readonly checker = inject(InteractivityChecker);\r\n\r\n // Optional query (never `required`) so a programmatic initial `open` cannot throw\r\n // NG0951 before the view resolves; `canOpen` waits for it.\r\n private readonly panelTemplate = viewChild('panel', { read: TemplateRef });\r\n\r\n readonly openValue = model(false, { alias: 'open' });\r\n\r\n readonly disabled = input(false, { transform: booleanAttribute });\r\n\r\n /** The preferred side of the trigger; logical sides resolve against `dir`. */\r\n readonly side = input<RaqmPopoverSide>(DEFAULT_SIDE, { transform: toSide });\r\n\r\n readonly align = input<RaqmPopoverAlign>(DEFAULT_ALIGN, {\r\n transform: toAlign,\r\n });\r\n\r\n readonly sideOffset = input(DEFAULT_SIDE_OFFSET, {\r\n transform: toOffset(DEFAULT_SIDE_OFFSET),\r\n });\r\n\r\n readonly alignOffset = input(DEFAULT_ALIGN_OFFSET, {\r\n transform: toOffset(DEFAULT_ALIGN_OFFSET),\r\n });\r\n\r\n readonly dir = input<'ltr' | 'rtl' | undefined>(undefined, {\r\n transform: toDir,\r\n });\r\n\r\n readonly width = input(DEFAULT_WIDTH);\r\n\r\n readonly panelClass = input<string | undefined>(undefined);\r\n\r\n /** An explicit accessible name used when no title slot is registered. */\r\n readonly label = input<string | undefined>(undefined);\r\n\r\n private readonly state: RaqmPopoverState = new RaqmPopoverState();\r\n\r\n private readonly registration: RaqmPopoverRegistration = new RaqmPopoverRegistration({\r\n content: () => this.layer.contentElement(),\r\n label: () => this.label(),\r\n });\r\n\r\n private readonly canOpen = computed(\r\n () =>\r\n this.registration.triggerRef() !== null &&\r\n this.registration.contentTemplate() !== null &&\r\n this.panelTemplate() !== undefined,\r\n );\r\n\r\n /** Open AND enabled AND actually attached; the trigger's `aria-expanded` source. */\r\n readonly open = computed(() => this.openValue() && !this.disabled() && this.state.attached());\r\n\r\n readonly panelId = this.state.panelId;\r\n\r\n readonly resolvedSide = this.state.resolvedSide;\r\n readonly transformOrigin = this.state.transformOrigin;\r\n\r\n readonly closing = this.state.closing;\r\n\r\n protected readonly panelDir = this.state.panelDir;\r\n\r\n protected readonly contentTemplate = this.registration.contentTemplate;\r\n\r\n private readonly sizing: RaqmPopoverSizing = new RaqmPopoverSizing(\r\n this.viewportRuler,\r\n this.state,\r\n {\r\n align: () => this.align(),\r\n alignOffset: () => this.alignOffset(),\r\n sideOffset: () => this.sideOffset(),\r\n trigger: () => this.registration.triggerRef(),\r\n pane: () => this.layer.element,\r\n content: () => this.layer.contentElement(),\r\n reposition: () => this.position.scheduleReposition(),\r\n },\r\n );\r\n\r\n private readonly position: RaqmPopoverPosition = new RaqmPopoverPosition(\r\n this.overlay,\r\n this.viewportRuler,\r\n this.state,\r\n this.sizing,\r\n {\r\n side: () => this.side(),\r\n align: () => this.align(),\r\n direction: () =>\r\n resolvePopoverDirection(this.dir(), this.host.nativeElement, this.directionality),\r\n trigger: () => this.registration.triggerRef(),\r\n pane: () => this.layer.element,\r\n updatePosition: () => this.layer.updatePosition(),\r\n setDirection: (dir) => this.layer.setDirection(dir),\r\n },\r\n );\r\n\r\n private readonly layer: RaqmPopoverOverlay = new RaqmPopoverOverlay(\r\n this.overlay,\r\n this.scrollDispatcher,\r\n this.viewportRuler,\r\n this.viewContainerRef,\r\n this.injector,\r\n this.state,\r\n this.position,\r\n this.sizing,\r\n {\r\n root: this.host.nativeElement,\r\n panelRootId: this.registration.panelRootId,\r\n trigger: () => this.registration.triggerRef(),\r\n contentTemplate: () => this.registration.contentTemplate(),\r\n panelTemplate: () => this.panelTemplate(),\r\n side: () => this.side(),\r\n align: () => this.align(),\r\n panelClass: () => this.panelClass(),\r\n direction: () =>\r\n resolvePopoverDirection(this.dir(), this.host.nativeElement, this.directionality),\r\n isInsideRootOrOverlay: (node) => this.dismissal.isInsideRootOrOverlay(node),\r\n closeFromUser: () => this.closeFromUser(),\r\n maybeCloseOnFocusOut: (event) => this.dismissal.maybeCloseOnFocusOut(event),\r\n syncPanelAria: () => this.registration.syncPanelAria(),\r\n focusInitial: (overlayRef, generation) => this.keyboard.focusInitial(overlayRef, generation),\r\n setClosed: () => this.dismissal.setClosed(),\r\n },\r\n );\r\n\r\n private readonly keyboard: RaqmPopoverKeyboard = new RaqmPopoverKeyboard(this.checker, {\r\n root: this.host.nativeElement,\r\n open: () => this.open(),\r\n openValue: () => this.openValue(),\r\n disabled: () => this.disabled(),\r\n canOpen: () => this.canOpen(),\r\n trigger: () => this.registration.triggerRef(),\r\n pane: () => this.layer.element,\r\n content: () => this.layer.contentElement(),\r\n overlayRef: () => this.layer.ref,\r\n generation: () => this.state.openGeneration,\r\n closeFromUser: () => this.closeFromUser(),\r\n });\r\n\r\n private readonly dismissal: RaqmPopoverDismissal = new RaqmPopoverDismissal({\r\n root: this.host.nativeElement,\r\n open: () => this.open(),\r\n openValue: () => this.openValue(),\r\n disabled: () => this.disabled(),\r\n canOpen: () => this.canOpen(),\r\n pane: () => this.layer.element,\r\n generation: () => this.state.openGeneration,\r\n setOpen: (value) => this.openValue.set(value),\r\n });\r\n\r\n constructor() {\r\n connectPopoverEffects({\r\n openValue: () => this.openValue(),\r\n disabled: () => this.disabled(),\r\n canOpen: () => this.canOpen(),\r\n side: () => this.side(),\r\n align: () => this.align(),\r\n sideOffset: () => this.sideOffset(),\r\n alignOffset: () => this.alignOffset(),\r\n dir: () => this.dir(),\r\n label: () => this.label(),\r\n panelClass: () => this.panelClass(),\r\n syncOpen: (next) => this.layer.syncOpen(next),\r\n applyPositionInputs: () => this.position.applyPositionInputs(),\r\n syncPanelAria: () => this.registration.syncPanelAria(),\r\n applyPanelClass: (panelClass) => this.layer.applyPanelClass(panelClass),\r\n });\r\n }\r\n\r\n ngOnDestroy(): void {\r\n this.layer.destroy();\r\n }\r\n\r\n registerTrigger(ref: RaqmPopoverTriggerRef): void {\r\n this.registration.registerTrigger(ref);\r\n }\r\n\r\n unregisterTrigger(ref: RaqmPopoverTriggerRef): void {\r\n this.registration.unregisterTrigger(ref);\r\n }\r\n\r\n registerContent(template: TemplateRef<unknown>): void {\r\n this.registration.registerContent(template);\r\n }\r\n\r\n unregisterContent(template: TemplateRef<unknown>): void {\r\n this.registration.unregisterContent(template);\r\n }\r\n\r\n registerTitle(element: HTMLElement): void {\r\n this.registration.registerTitle(element);\r\n }\r\n\r\n unregisterTitle(element: HTMLElement): void {\r\n this.registration.unregisterTitle(element);\r\n }\r\n\r\n registerDescription(element: HTMLElement): void {\r\n this.registration.registerDescription(element);\r\n }\r\n\r\n unregisterDescription(element: HTMLElement): void {\r\n this.registration.unregisterDescription(element);\r\n }\r\n\r\n toggleFromTrigger(ref: RaqmPopoverTriggerRef): void {\r\n if (ref !== this.registration.triggerRef() || this.disabled() || ref.disabled) {\r\n return;\r\n }\r\n if (this.open()) {\r\n this.closeFromUser();\r\n return;\r\n }\r\n this.openValue.set(true);\r\n }\r\n\r\n closeFromUser(): void {\r\n if (!this.open()) {\r\n return;\r\n }\r\n this.dismissal.setClosed();\r\n }\r\n\r\n /** Dismisses on application navigation; clears `open` even when disabled. */\r\n close(): void {\r\n this.dismissal.setClosed();\r\n }\r\n\r\n focusFirstInPanel(): void {\r\n this.keyboard.focusFirstInPanel();\r\n }\r\n\r\n onTriggerTab(event: KeyboardEvent): void {\r\n this.keyboard.onTriggerTab(event);\r\n }\r\n\r\n protected onFocusOut(event: FocusEvent): void {\r\n this.dismissal.maybeCloseOnFocusOut(event);\r\n }\r\n\r\n protected onPanelFocusOut(event: FocusEvent): void {\r\n this.dismissal.maybeCloseOnFocusOut(event);\r\n }\r\n\r\n protected onPanelKeydown(event: KeyboardEvent): void {\r\n this.keyboard.onPanelKeydown(event);\r\n }\r\n}\r\n","<ng-content />\r\n\r\n<!-- The one panel template, instantiated into a CDK overlay when the popup opens.\r\n Its wrapper nodes are created by this component's view (so this component's\r\n own external stylesheet applies to them) while the projected template\r\n children stay application-owned and are styled by the shipped relationship\r\n partial. `NgTemplateOutlet` renders the registered content template. -->\r\n<ng-template #panel>\r\n <div\r\n class=\"raqm-popover-content\"\r\n tabindex=\"-1\"\r\n [attr.id]=\"panelId()\"\r\n [attr.dir]=\"panelDir()\"\r\n [attr.data-raqm-side]=\"resolvedSide()\"\r\n [class.raqm-popover-content--closing]=\"closing()\"\r\n [style.width]=\"width()\"\r\n [style.transform-origin]=\"transformOrigin()\"\r\n (focusout)=\"onPanelFocusOut($event)\"\r\n (keydown)=\"onPanelKeydown($event)\"\r\n >\r\n <ng-container [ngTemplateOutlet]=\"contentTemplate()\" />\r\n </div>\r\n</ng-template>\r\n","import {\r\n Directive,\r\n DestroyRef,\r\n ElementRef,\r\n OnInit,\r\n TemplateRef,\r\n computed,\r\n inject,\r\n isDevMode,\r\n} from '@angular/core';\r\n\r\nimport { RAQM_POPOVER, RaqmPopoverContext, RaqmPopoverTriggerRef } from './popover-context';\r\n\r\n/**\r\n * Popover trigger: the one native `<button>` that opens the popup.\r\n *\r\n * @remarks\r\n * No `aria-haspopup`, because the nonmodal surface has no dialog role. Escape closes and\r\n * leaves focus on the trigger; Tab enters the popup's first control.\r\n */\r\n@Directive({\r\n selector: 'button[raqm-popover-trigger]',\r\n host: {\r\n class: 'raqm-popover-trigger',\r\n // No `aria-haspopup` (nonmodal, no dialog role); the pair is expanded + controls.\r\n '[attr.aria-expanded]': 'open() ? \"true\" : \"false\"',\r\n '[attr.aria-controls]': 'open() ? panelId() : null',\r\n '(click)': 'onClick()',\r\n '(keydown)': 'onKeydown($event)',\r\n },\r\n})\r\nexport class RaqmPopoverTriggerDirective implements OnInit {\r\n private readonly host = inject(ElementRef<HTMLButtonElement>);\r\n\r\n // Optional, so a misplaced trigger reports a development error instead of crashing.\r\n private readonly popover = inject<RaqmPopoverContext | null>(RAQM_POPOVER, {\r\n optional: true,\r\n });\r\n\r\n private readonly destroyRef = inject(DestroyRef);\r\n\r\n // Derived from the shared context so `aria-expanded` tracks the real popup state.\r\n readonly open = computed(() => this.popover?.open() ?? false);\r\n\r\n // The root owns the id, so `aria-controls` always points at the real popup.\r\n readonly panelId = computed(() => this.popover?.panelId() ?? null);\r\n\r\n // Getters read live state for the trigger's lifetime.\r\n private readonly ref: RaqmPopoverTriggerRef = (() => {\r\n const self = this;\r\n return {\r\n get element(): HTMLButtonElement {\r\n return self.host.nativeElement;\r\n },\r\n get disabled(): boolean {\r\n return self.host.nativeElement.disabled;\r\n },\r\n focus(): void {\r\n self.host.nativeElement.focus();\r\n },\r\n };\r\n })();\r\n\r\n constructor() {\r\n // Default to `type=\"button\"` for a non-submit disclosure, preserving an authored type.\r\n const element = this.host.nativeElement;\r\n if (!element.hasAttribute('type')) {\r\n element.setAttribute('type', 'button');\r\n }\r\n\r\n if (isDevMode() && this.popover === null) {\r\n console.error(\r\n '[raqm-popover-trigger] No parent <raqm-popover> found; the trigger cannot open a popup.',\r\n );\r\n }\r\n\r\n // Registration waits for `ngOnInit`, so the trigger is fully initialized first.\r\n this.destroyRef.onDestroy(() => this.popover?.unregisterTrigger(this.ref));\r\n }\r\n\r\n ngOnInit(): void {\r\n this.popover?.registerTrigger(this.ref);\r\n }\r\n\r\n /** Toggles on a native click (pointer, Enter or Space); disabled is a no-op. */\r\n protected onClick(): void {\r\n if (this.host.nativeElement.disabled) {\r\n return;\r\n }\r\n this.popover?.toggleFromTrigger(this.ref);\r\n }\r\n\r\n /** Routes Escape to close and Tab into the open popup's logical order. */\r\n protected onKeydown(event: KeyboardEvent): void {\r\n if (this.host.nativeElement.disabled) {\r\n return;\r\n }\r\n if (event.key === 'Escape') {\r\n if (this.popover?.open()) {\r\n event.preventDefault();\r\n // Consume only when this popup handles it, so an enclosing overlay stays open.\r\n event.stopPropagation();\r\n this.popover.closeFromUser();\r\n }\r\n return;\r\n }\r\n if (event.key === 'Tab') {\r\n this.popover?.onTriggerTab(event);\r\n }\r\n }\r\n}\r\n\r\n@Directive({\r\n selector: 'ng-template[raqm-popover-content]',\r\n exportAs: 'raqmPopoverContent',\r\n})\r\nexport class RaqmPopoverContentDirective implements OnInit {\r\n // The template itself — the content identity the root renders.\r\n private readonly template = inject<TemplateRef<unknown>>(TemplateRef);\r\n\r\n // Optional, so a misplaced template reports instead of crashing.\r\n private readonly popover = inject<RaqmPopoverContext | null>(RAQM_POPOVER, {\r\n optional: true,\r\n });\r\n\r\n private readonly destroyRef = inject(DestroyRef);\r\n\r\n constructor() {\r\n if (isDevMode() && this.popover === null) {\r\n console.error(\r\n '[raqm-popover-content] No parent <raqm-popover> found; the template is never rendered.',\r\n );\r\n }\r\n this.destroyRef.onDestroy(() => this.popover?.unregisterContent(this.template));\r\n }\r\n\r\n ngOnInit(): void {\r\n this.popover?.registerContent(this.template);\r\n }\r\n}\r\n\r\n@Directive({\r\n selector: '[raqm-popover-header]',\r\n host: {\r\n class: 'raqm-popover-header',\r\n },\r\n})\r\nexport class RaqmPopoverHeaderDirective {}\r\n\r\n@Directive({\r\n selector: '[raqm-popover-title]',\r\n host: {\r\n class: 'raqm-popover-title',\r\n },\r\n})\r\nexport class RaqmPopoverTitleDirective implements OnInit {\r\n // Native host element; registered with the root for `aria-labelledby`.\r\n private readonly host = inject(ElementRef<HTMLElement>);\r\n\r\n // Optional, so a misplaced title still renders.\r\n private readonly popover = inject<RaqmPopoverContext | null>(RAQM_POPOVER, {\r\n optional: true,\r\n });\r\n\r\n private readonly destroyRef = inject(DestroyRef);\r\n\r\n constructor() {\r\n if (isDevMode() && this.popover === null) {\r\n console.error(\r\n '[raqm-popover-title] No parent <raqm-popover> found; the title cannot be associated with a popup.',\r\n );\r\n }\r\n this.destroyRef.onDestroy(() => this.popover?.unregisterTitle(this.host.nativeElement));\r\n }\r\n\r\n ngOnInit(): void {\r\n this.popover?.registerTitle(this.host.nativeElement);\r\n }\r\n}\r\n\r\n@Directive({\r\n selector: '[raqm-popover-description]',\r\n host: {\r\n class: 'raqm-popover-description',\r\n },\r\n})\r\nexport class RaqmPopoverDescriptionDirective implements OnInit {\r\n // Native host element; registered with the root for `aria-describedby`.\r\n private readonly host = inject(ElementRef<HTMLElement>);\r\n\r\n // Optional, so a misplaced description still renders.\r\n private readonly popover = inject<RaqmPopoverContext | null>(RAQM_POPOVER, {\r\n optional: true,\r\n });\r\n\r\n private readonly destroyRef = inject(DestroyRef);\r\n\r\n constructor() {\r\n if (isDevMode() && this.popover === null) {\r\n console.error(\r\n '[raqm-popover-description] No parent <raqm-popover> found; the description cannot be associated with a popup.',\r\n );\r\n }\r\n this.destroyRef.onDestroy(() => this.popover?.unregisterDescription(this.host.nativeElement));\r\n }\r\n\r\n ngOnInit(): void {\r\n this.popover?.registerDescription(this.host.nativeElement);\r\n }\r\n}\r\n","import { RaqmPopoverComponent } from './popover';\r\nimport {\r\n RaqmPopoverTriggerDirective,\r\n RaqmPopoverContentDirective,\r\n RaqmPopoverHeaderDirective,\r\n RaqmPopoverTitleDirective,\r\n RaqmPopoverDescriptionDirective,\r\n} from './popover.directive';\r\n\r\nexport { RaqmPopoverComponent };\r\nexport {\r\n RaqmPopoverTriggerDirective,\r\n RaqmPopoverContentDirective,\r\n RaqmPopoverHeaderDirective,\r\n RaqmPopoverTitleDirective,\r\n RaqmPopoverDescriptionDirective,\r\n};\r\n\r\nexport const RaqmPopover = [\r\n RaqmPopoverComponent,\r\n RaqmPopoverTriggerDirective,\r\n RaqmPopoverContentDirective,\r\n RaqmPopoverHeaderDirective,\r\n Ra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,SAAS,sBAAsB,KAAK,KAAK,aAAa,CAAC;CAC9F;CAEA,WAAQ;EACN,KAAK,SAAS,oBAAoB,KAAK,KAAK,aAAa;CAC3D;CAtBW,OAAA,OAAA,GAAA,mBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,UAAA;EAAA,MAAA;EAA+B,MAAA,CAAA;EAAA,QAAA,GAAA,gBAAA;CAAA,CAAA;CAA/B,OAAA,OAAA,GAAA,qBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,MAAA;EAA+B,cAAA;EAAA,UAAA;EAAA,MAAA,EAAA,gBAAA,2BAAA;EAAA,UAAA;CAAA,CAAA;;AAA/B,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAA+B,YAAA,CAAA;EAN3C,MAAA;EAAU,MAAA,CAAA;GACT,UAAU;GACV,MAAM,EACJ,OAAO,2BACR;EACF,CAAA;;;;ACvKD,MAAa,cAAc;CACzB;CACA;CACA;CACA;CACA;CACA;AACQ"}
@@ -12,6 +12,8 @@ var RaqmResizablePanelGroupComponent = class RaqmResizablePanelGroupComponent {
12
12
  element = inject(ElementRef);
13
13
  panels = contentChildren(RaqmResizablePanelDirective, ...ngDevMode ? [{ debugName: "panels" }] : /* istanbul ignore next */ []);
14
14
  handles = contentChildren(RaqmResizableHandleDirective, ...ngDevMode ? [{ debugName: "handles" }] : /* istanbul ignore next */ []);
15
+ panelIndices = computed(() => this.indexByPanel(), ...ngDevMode ? [{ debugName: "panelIndices" }] : /* istanbul ignore next */ []);
16
+ handleIndices = computed(() => this.indexByHandle(), ...ngDevMode ? [{ debugName: "handleIndices" }] : /* istanbul ignore next */ []);
15
17
  changed = signal(/* @__PURE__ */ new Map(), ...ngDevMode ? [{ debugName: "changed" }] : /* istanbul ignore next */ []);
16
18
  sizes = computed(() => {
17
19
  const panels = this.panels();
@@ -34,11 +36,17 @@ var RaqmResizablePanelGroupComponent = class RaqmResizablePanelGroupComponent {
34
36
  }
35
37
  return values;
36
38
  }, ...ngDevMode ? [{ debugName: "sizes" }] : /* istanbul ignore next */ []);
39
+ indexByPanel() {
40
+ return new Map(this.panels().map((panel, index) => [panel, index]));
41
+ }
42
+ indexByHandle() {
43
+ return new Map(this.handles().map((handle, index) => [handle, index]));
44
+ }
37
45
  panelIndex(panel) {
38
- return this.panels().indexOf(panel);
46
+ return this.panelIndices().get(panel) ?? -1;
39
47
  }
40
48
  handleIndex(handle) {
41
- return this.handles().indexOf(handle);
49
+ return this.handleIndices().get(handle) ?? -1;
42
50
  }
43
51
  bounds(index) {
44
52
  const panels = this.panels(), sizes = this.sizes(), left = panels[index], right = panels[index + 1];
@@ -61,10 +69,12 @@ var RaqmResizablePanelGroupComponent = class RaqmResizablePanelGroupComponent {
61
69
  const panels = this.panels(), sizes = this.sizes(), bounds = this.bounds(index);
62
70
  if (!panels[index] || !panels[index + 1] || bounds.min > bounds.max || !Number.isFinite(value)) return;
63
71
  const next = Math.min(bounds.max, Math.max(bounds.min, value));
64
- const total = sizes[index] + sizes[index + 1];
72
+ const right = sizes[index] + sizes[index + 1] - next;
73
+ const changes = this.changed();
74
+ if (next === sizes[index] && right === sizes[index + 1] && changes.size === panels.length && panels.every((panel, i) => changes.get(panel) === sizes[i])) return;
65
75
  const values = new Map(panels.map((panel, i) => [panel, sizes[i]]));
66
76
  values.set(panels[index], next);
67
- values.set(panels[index + 1], total - next);
77
+ values.set(panels[index + 1], right);
68
78
  this.changed.set(values);
69
79
  }
70
80
  static ɵfac = i0.ɵɵngDeclareFactory({