@cocoar/ui-overlay 0.1.0-beta.72 → 0.1.0-beta.79
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.
|
@@ -588,7 +588,16 @@ class CoarOverlayService {
|
|
|
588
588
|
const template = content.template;
|
|
589
589
|
if (!template)
|
|
590
590
|
throw new Error('Template overlay requires a template');
|
|
591
|
-
|
|
591
|
+
// For templates: automatically add $implicit so templates can use let-variable without property name
|
|
592
|
+
// This allows both: let-context (uses $implicit) and let-prop="prop" (uses specific property)
|
|
593
|
+
let templateContext = inputs;
|
|
594
|
+
if (inputs != null && typeof inputs === 'object' && !('$implicit' in inputs)) {
|
|
595
|
+
templateContext = {
|
|
596
|
+
...inputs,
|
|
597
|
+
$implicit: inputs,
|
|
598
|
+
};
|
|
599
|
+
}
|
|
600
|
+
const viewRef = template.createEmbeddedView(templateContext);
|
|
592
601
|
this.appRef.attachView(viewRef);
|
|
593
602
|
viewRef.detectChanges();
|
|
594
603
|
for (const node of viewRef.rootNodes) {
|
|
@@ -929,10 +938,6 @@ class CoarOverlayRef {
|
|
|
929
938
|
}
|
|
930
939
|
}
|
|
931
940
|
close(result) {
|
|
932
|
-
console.log('[OverlayRef] close() called', {
|
|
933
|
-
closed: this.closed,
|
|
934
|
-
result,
|
|
935
|
-
});
|
|
936
941
|
if (this.closed)
|
|
937
942
|
return;
|
|
938
943
|
this.closed = true;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cocoar-ui-overlay.mjs","sources":["../../../../libs/ui-overlay/src/lib/overlay/content-builder.ts","../../../../libs/ui-overlay/src/lib/overlay/deep-freeze.ts","../../../../libs/ui-overlay/src/lib/overlay/overlay-builder.ts","../../../../libs/ui-overlay/src/lib/overlay/overlay.ts","../../../../libs/ui-overlay/src/lib/overlay/overlay-spec.ts","../../../../libs/ui-overlay/src/lib/overlay/overlay-position.ts","../../../../libs/ui-overlay/src/lib/overlay/overlay-context.ts","../../../../libs/ui-overlay/src/lib/overlay/overlay-service.ts","../../../../libs/ui-overlay/src/lib/overlay/presets.ts","../../../../libs/ui-overlay/src/cocoar-ui-overlay.ts"],"sourcesContent":["import { TemplateRef, Type } from '@angular/core';\nimport { type ContentSpec } from './overlay-spec';\n\nexport class ContentBuilder {\n fromComponent<C>(component: Type<C>): ContentSpec<Partial<C>> {\n return { kind: 'component', component };\n }\n\n fromTemplate<TCtx>(template: TemplateRef<TCtx>): ContentSpec<TCtx> {\n return { kind: 'template', template };\n }\n\n fromText(): ContentSpec<{ text: string }> {\n return { kind: 'text' };\n }\n}\n","export function deepFreeze<T>(value: T): T {\n if (value == null) return value;\n\n if (typeof value !== 'object') return value;\n\n // Only freeze plain JSON-like objects/arrays.\n // Framework objects (e.g. Angular TemplateRef) can have internal mutable state.\n const proto = Object.getPrototypeOf(value);\n const isPlainObject = proto === Object.prototype || proto === null;\n\n if (!isPlainObject && !Array.isArray(value)) {\n return value;\n }\n\n if (Object.isFrozen(value)) return value;\n\n Object.freeze(value);\n\n if (Array.isArray(value)) {\n for (const entry of value) {\n deepFreeze(entry);\n }\n\n return value;\n }\n\n for (const key of Object.keys(value as Record<string, unknown>)) {\n deepFreeze((value as Record<string, unknown>)[key]);\n }\n\n return value;\n}\n","import {\n type A11ySpec,\n type AnchorSpec,\n type AttachmentSpec,\n type BackdropSpec,\n type ContentSpec,\n type DismissSpec,\n type FocusSpec,\n type OverlaySpec,\n type PositionSpec,\n type ScrollSpec,\n type SizeSpec,\n} from './overlay-spec';\nimport { ContentBuilder } from './content-builder';\nimport { deepFreeze } from './deep-freeze';\n\nexport class OverlayBuilder {\n private readonly draft: OverlaySpec<unknown>;\n\n constructor(seed?: OverlaySpec<unknown>) {\n this.draft = { ...(seed ?? {}) };\n }\n\n backdrop(cfg?: BackdropSpec | 'none' | 'modal'): this {\n if (cfg === 'none') {\n this.draft.backdrop = { kind: 'none' };\n return this;\n }\n\n if (cfg === 'modal') {\n this.draft.backdrop = { kind: 'modal', closeOnBackdropClick: true };\n return this;\n }\n\n this.draft.backdrop = cfg;\n return this;\n }\n\n anchor(cfg: AnchorSpec): this {\n this.draft.anchor = cfg;\n return this;\n }\n\n position(cfg: PositionSpec): this {\n this.draft.position = cfg;\n return this;\n }\n\n size(cfg: SizeSpec): this {\n this.draft.size = cfg;\n return this;\n }\n\n scroll(cfg: ScrollSpec): this {\n this.draft.scroll = cfg;\n return this;\n }\n\n dismiss(cfg: DismissSpec): this {\n this.draft.dismiss = cfg;\n return this;\n }\n\n focus(cfg: FocusSpec): this {\n this.draft.focus = cfg;\n return this;\n }\n\n a11y(cfg: A11ySpec): this {\n this.draft.a11y = cfg;\n return this;\n }\n\n attachment(cfg: AttachmentSpec): this {\n this.draft.attachment = cfg;\n return this;\n }\n\n content(fn: (c: ContentBuilder) => ContentSpec<unknown>): this {\n const contentBuilder = new ContentBuilder();\n this.draft.content = fn(contentBuilder);\n return this;\n }\n\n freeze<TInputs = void>(): OverlaySpec<TInputs> {\n return deepFreeze({ ...this.draft }) as OverlaySpec<TInputs>;\n }\n}\n","import { OverlayBuilder } from './overlay-builder';\nimport { type OverlaySpec } from './overlay-spec';\nimport { type OverlayPreset } from './presets';\n\nexport class CoarOverlay {\n static define<TInputs = void>(\n fn: (b: OverlayBuilder) => void,\n ...presets: readonly OverlayPreset[]\n ): OverlaySpec<TInputs> {\n const builder = new OverlayBuilder();\n\n for (const preset of presets) {\n preset(builder);\n }\n\n fn(builder);\n return builder.freeze<TInputs>();\n }\n\n static fork<TInputs>(base: OverlaySpec<TInputs>, fn: (b: OverlayBuilder) => void): OverlaySpec<TInputs> {\n const builder = new OverlayBuilder(base as OverlaySpec<unknown>);\n fn(builder);\n return builder.freeze<TInputs>();\n }\n}\n\n/** Alias kept for spec parity (`Overlay.define(...)`). */\nexport const Overlay = CoarOverlay;\n","import { InjectionToken, TemplateRef, Type } from '@angular/core';\n\nexport interface OverlaySpec<TInputs = void> {\n content?: ContentSpec<TInputs>;\n anchor?: AnchorSpec;\n position?: PositionSpec;\n size?: SizeSpec;\n backdrop?: BackdropSpec;\n scroll?: ScrollSpec;\n dismiss?: DismissSpec;\n focus?: FocusSpec;\n a11y?: A11ySpec;\n attachment?: AttachmentSpec;\n}\n\n/**\n * Optional application-level hook to apply global overlay defaults/policies.\n *\n * Resolvers should be pure functions and must not override explicit caller configuration\n * unless the application intentionally chooses to.\n */\nexport type OverlaySpecResolver = (spec: OverlaySpec<unknown>) => OverlaySpec<unknown>;\n\n/**\n * Multi-provider token. Resolvers are applied in registration order.\n */\nexport const COAR_OVERLAY_SPEC_RESOLVERS = new InjectionToken<readonly OverlaySpecResolver[]>(\n 'COAR_OVERLAY_SPEC_RESOLVERS'\n);\n\nexport type Placement =\n | 'top'\n | 'top-start'\n | 'top-end'\n | 'bottom'\n | 'bottom-start'\n | 'bottom-end'\n | 'left'\n | 'left-start'\n | 'left-end'\n | 'right'\n | 'right-start'\n | 'right-end'\n | 'center';\n\nexport interface ContentSpec<TInputs> {\n kind: 'component' | 'template' | 'text';\n component?: Type<unknown>;\n template?: TemplateRef<unknown>;\n\n /**\n * Optional default inputs.\n * Runtime inputs provided at open() time are merged on top.\n */\n defaults?: Partial<TInputs>;\n}\n\nexport type AnchorSpec =\n | { kind: 'element'; element: Element }\n | { kind: 'point'; x: number; y: number }\n | { kind: 'virtual'; placement: 'center' | 'top' | 'bottom' };\n\nexport interface PositionSpec {\n placement: Placement | readonly Placement[];\n offset?: number;\n flip?: boolean;\n shift?: boolean;\n}\n\nexport interface SizeSpec {\n mode: 'content' | 'content-clamped' | 'fixed';\n minWidth?: number | 'anchor';\n minHeight?: number | 'anchor';\n maxWidth?: number | 'viewport';\n maxHeight?: number | 'viewport';\n}\n\nexport type BackdropSpec =\n | { kind: 'none' }\n | {\n kind: 'modal';\n closeOnBackdropClick?: boolean;\n };\n\nexport interface ScrollSpec {\n strategy: 'noop' | 'reposition' | 'close';\n}\n\nexport interface DismissSpec {\n outsideClick?: boolean;\n escapeKey?: boolean;\n /**\n * Optional pointer-based dismissal for menu-like overlays.\n *\n * When enabled, the overlay closes after the pointer leaves the overlay *tree*\n * (the overlay itself and any child overlays opened via openChild()).\n * Entering any child overlay cancels the parent's close timer.\n */\n hoverTree?: {\n enabled?: boolean;\n delayMs?: number;\n };\n}\n\nexport interface FocusSpec {\n trap?: boolean;\n restore?: boolean;\n}\n\nexport interface A11ySpec {\n role?: 'dialog' | 'menu' | 'tooltip' | 'listbox';\n label?: string;\n labelledBy?: string;\n describedBy?: string;\n}\n\n/**\n * Defines where the overlay element is attached in the DOM and what boundaries\n * are used for clamping/fallback calculations.\n *\n * - 'body': Attach to document.body (portal pattern), use viewport boundaries\n * - 'parent': Attach to a specific container element, use that container's boundaries\n */\nexport type AttachmentSpec = { strategy: 'body' } | { strategy: 'parent'; container: HTMLElement };\n\nexport const COAR_OVERLAY_DEFAULTS = {\n anchor: { kind: 'virtual', placement: 'center' } as const satisfies AnchorSpec,\n position: {\n placement: ['top', 'bottom', 'left', 'right'] as const,\n offset: 8,\n flip: true,\n shift: true,\n } as const satisfies PositionSpec,\n backdrop: { kind: 'none' } as const satisfies BackdropSpec,\n scroll: { strategy: 'reposition' } as const satisfies ScrollSpec,\n dismiss: { outsideClick: true, escapeKey: true } as const satisfies DismissSpec,\n focus: { trap: false, restore: true } as const satisfies FocusSpec,\n a11y: {} as const satisfies A11ySpec,\n attachment: { strategy: 'body' } as const satisfies AttachmentSpec,\n} as const;\n\nexport type ResolvedOverlaySpec<TInputs> = Required<Omit<OverlaySpec<TInputs>, 'content'>> &\n Pick<Required<OverlaySpec<TInputs>>, 'content'>;\n","import { type AnchorSpec, type Placement, type PositionSpec } from './overlay-spec';\n\nexport interface ViewportRect {\n readonly width: number;\n readonly height: number;\n}\n\nexport interface Rect {\n readonly left: number;\n readonly top: number;\n readonly right: number;\n readonly bottom: number;\n readonly width: number;\n readonly height: number;\n}\n\nexport interface Point {\n readonly x: number;\n readonly y: number;\n}\n\nexport interface OverlaySize {\n readonly width: number;\n readonly height: number;\n}\n\nexport interface OverlayCoordinates {\n readonly left: number;\n readonly top: number;\n readonly placement: Placement;\n}\n\nexport function getViewportRect(): ViewportRect {\n const docEl = document.documentElement;\n const width = docEl?.clientWidth || window.innerWidth;\n const height = docEl?.clientHeight || window.innerHeight;\n return { width, height };\n}\n\nexport function getContainerRect(container: HTMLElement): Rect {\n return rectFromDom(container.getBoundingClientRect());\n}\n\nexport function rectFromDom(domRect: DOMRect): Rect {\n return {\n left: domRect.left,\n top: domRect.top,\n right: domRect.right,\n bottom: domRect.bottom,\n width: domRect.width,\n height: domRect.height,\n };\n}\n\nexport function getAnchorRect(anchor: AnchorSpec, viewport: ViewportRect): Rect {\n switch (anchor.kind) {\n case 'element':\n return rectFromDom(anchor.element.getBoundingClientRect());\n case 'point':\n return rectFromPoint(anchor, 0, 0);\n case 'virtual':\n return rectFromVirtual(anchor, viewport);\n }\n}\n\nexport function rectFromPoint(point: Point, width: number, height: number): Rect {\n const left = point.x;\n const top = point.y;\n return {\n left,\n top,\n right: left + width,\n bottom: top + height,\n width,\n height,\n };\n}\n\nexport function rectFromVirtual(\n spec: Extract<AnchorSpec, { kind: 'virtual' }>,\n viewport: ViewportRect\n): Rect {\n if (spec.placement === 'center') {\n const x = viewport.width / 2;\n const y = viewport.height / 2;\n return rectFromPoint({ x, y }, 0, 0);\n }\n\n if (spec.placement === 'top') {\n const x = viewport.width / 2;\n const y = 0;\n return rectFromPoint({ x, y }, 0, 0);\n }\n\n const x = viewport.width / 2;\n const y = viewport.height;\n return rectFromPoint({ x, y }, 0, 0);\n}\n\nexport function getScrollParents(element: Element): Array<Element | Window> {\n const result: Array<Element | Window> = [];\n\n let current: Element | null = element;\n while (current && current.parentElement) {\n current = current.parentElement;\n const style = getComputedStyle(current);\n const overflowY = style.overflowY;\n const overflowX = style.overflowX;\n\n const scrollable =\n overflowY === 'auto' ||\n overflowY === 'scroll' ||\n overflowX === 'auto' ||\n overflowX === 'scroll';\n\n if (scrollable) {\n result.push(current);\n }\n }\n\n result.push(window);\n return result;\n}\n\nexport function computeOverlayCoordinates(\n anchorRect: Rect,\n overlaySize: OverlaySize,\n position: PositionSpec,\n viewport: ViewportRect,\n boundaryRect?: Rect\n): OverlayCoordinates {\n const placements: readonly Placement[] = Array.isArray(position.placement)\n ? position.placement\n : [position.placement];\n\n const offset = position.offset ?? 0;\n const allowFlip = position.flip ?? false;\n const allowShift = position.shift ?? false;\n\n // Use container boundaries if provided, otherwise use viewport\n const boundary = boundaryRect ?? { left: 0, top: 0, right: viewport.width, bottom: viewport.height, width: viewport.width, height: viewport.height };\n\n const candidates = placements.map((placement) => ({\n placement,\n coords: coordsForPlacement(anchorRect, overlaySize, placement, offset),\n }));\n\n if (allowFlip) {\n for (const candidate of candidates) {\n const fits = fitsInBoundary(candidate.coords, overlaySize, boundary);\n if (fits) {\n return allowShift\n ? { ...shiftIntoBoundary(candidate.coords, overlaySize, boundary), placement: candidate.placement }\n : { ...candidate.coords, placement: candidate.placement };\n }\n }\n }\n\n // Choose the candidate with the smallest total overflow.\n let best = candidates[0];\n let bestOverflow = Number.POSITIVE_INFINITY;\n\n for (const candidate of candidates) {\n const overflow = totalOverflowFromBoundary(candidate.coords, overlaySize, boundary);\n if (overflow < bestOverflow) {\n best = candidate;\n bestOverflow = overflow;\n }\n }\n\n const chosen =\n best?.coords ??\n coordsForPlacement(anchorRect, overlaySize, placements[0] ?? 'bottom', offset);\n\n const shifted = allowShift ? shiftIntoBoundary(chosen, overlaySize, boundary) : chosen;\n return { ...shifted, placement: best?.placement ?? (placements[0] ?? 'bottom') };\n}\n\nfunction coordsForPlacement(\n anchorRect: Rect,\n overlaySize: OverlaySize,\n placement: Placement,\n offset: number\n): { left: number; top: number } {\n const anchorCenterX = anchorRect.left + anchorRect.width / 2;\n const anchorCenterY = anchorRect.top + anchorRect.height / 2;\n\n switch (placement) {\n case 'center':\n return {\n left: anchorCenterX - overlaySize.width / 2,\n top: anchorCenterY - overlaySize.height / 2,\n };\n\n case 'top':\n return {\n left: anchorCenterX - overlaySize.width / 2,\n top: anchorRect.top - overlaySize.height - offset,\n };\n case 'top-start':\n return {\n left: anchorRect.left,\n top: anchorRect.top - overlaySize.height - offset,\n };\n case 'top-end':\n return {\n left: anchorRect.right - overlaySize.width,\n top: anchorRect.top - overlaySize.height - offset,\n };\n\n case 'bottom':\n return {\n left: anchorCenterX - overlaySize.width / 2,\n top: anchorRect.bottom + offset,\n };\n case 'bottom-start':\n return {\n left: anchorRect.left,\n top: anchorRect.bottom + offset,\n };\n case 'bottom-end':\n return {\n left: anchorRect.right - overlaySize.width,\n top: anchorRect.bottom + offset,\n };\n\n case 'left':\n return {\n left: anchorRect.left - overlaySize.width - offset,\n top: anchorCenterY - overlaySize.height / 2,\n };\n case 'left-start':\n return {\n left: anchorRect.left - overlaySize.width - offset,\n top: anchorRect.top,\n };\n case 'left-end':\n return {\n left: anchorRect.left - overlaySize.width - offset,\n top: anchorRect.bottom - overlaySize.height,\n };\n\n case 'right':\n return {\n left: anchorRect.right + offset,\n top: anchorCenterY - overlaySize.height / 2,\n };\n case 'right-start':\n return {\n left: anchorRect.right + offset,\n top: anchorRect.top,\n };\n case 'right-end':\n return {\n left: anchorRect.right + offset,\n top: anchorRect.bottom - overlaySize.height,\n };\n }\n}\n\nfunction fitsInBoundary(\n coords: { left: number; top: number },\n overlaySize: OverlaySize,\n boundary: Rect\n): boolean {\n return (\n coords.left >= boundary.left &&\n coords.top >= boundary.top &&\n coords.left + overlaySize.width <= boundary.right &&\n coords.top + overlaySize.height <= boundary.bottom\n );\n}\n\nfunction shiftIntoBoundary(\n coords: { left: number; top: number },\n overlaySize: OverlaySize,\n boundary: Rect\n): { left: number; top: number } {\n const maxLeft = Math.max(boundary.left, boundary.right - overlaySize.width);\n const maxTop = Math.max(boundary.top, boundary.bottom - overlaySize.height);\n\n return {\n left: clamp(coords.left, boundary.left, maxLeft),\n top: clamp(coords.top, boundary.top, maxTop),\n };\n}\n\nfunction totalOverflowFromBoundary(\n coords: { left: number; top: number },\n overlaySize: OverlaySize,\n boundary: Rect\n): number {\n const leftOverflow = Math.max(0, boundary.left - coords.left);\n const topOverflow = Math.max(0, boundary.top - coords.top);\n const rightOverflow = Math.max(0, coords.left + overlaySize.width - boundary.right);\n const bottomOverflow = Math.max(0, coords.top + overlaySize.height - boundary.bottom);\n\n return leftOverflow + topOverflow + rightOverflow + bottomOverflow;\n}\n\nfunction clamp(value: number, min: number, max: number): number {\n if (value < min) return min;\n if (value > max) return max;\n return value;\n}\n","import { InjectionToken } from '@angular/core';\nimport { type OverlayRef } from './overlay-ref';\n\n/**\n * The OverlayRef for the overlay currently rendering this content.\n *\n * Provided automatically by CoarOverlayService for overlay content so components\n * can open true child overlays without DOM lookups.\n */\nexport const COAR_OVERLAY_REF = new InjectionToken<OverlayRef>('COAR_OVERLAY_REF');\n\n/**\n * Parent overlay reference for menu hierarchies.\n * Each overlay provides this token pointing to itself, enabling child menu items\n * to close siblings by calling parent.closeChildren().\n */\nexport const COAR_MENU_PARENT = new InjectionToken<OverlayRef | null>('COAR_MENU_PARENT');\n","import {\n ApplicationRef,\n EnvironmentInjector,\n Injectable,\n Injector,\n TemplateRef,\n Type,\n createComponent,\n createEnvironmentInjector,\n inject,\n} from '@angular/core';\nimport { Subject } from 'rxjs';\nimport {\n COAR_OVERLAY_DEFAULTS,\n COAR_OVERLAY_SPEC_RESOLVERS,\n type ContentSpec,\n type OverlaySpec,\n type OverlaySpecResolver,\n type ResolvedOverlaySpec,\n} from './overlay-spec';\nimport { type OverlayRef } from './overlay-ref';\nimport {\n computeOverlayCoordinates,\n getAnchorRect,\n getContainerRect,\n getScrollParents,\n getViewportRect,\n} from './overlay-position';\nimport { COAR_OVERLAY_REF, COAR_MENU_PARENT } from './overlay-context';\n\nexport interface OverlayOpenOptions {\n /**\n * Optional parent overlay. Used for menus/submenus so the service can keep trees consistent\n * (e.g. closing a parent closes its children).\n */\n parent?: OverlayRef;\n\n /**\n * If true, closes all sibling overlays (other children of the same parent) when this overlay opens.\n * Useful for menus where only one submenu should be visible at a time.\n */\n closeSiblings?: boolean;\n}\n\n@Injectable({ providedIn: 'root' })\nexport class CoarOverlayService {\n private readonly appRef = inject(ApplicationRef);\n private readonly environmentInjector = inject(EnvironmentInjector);\n\n private readonly specResolvers =\n inject(COAR_OVERLAY_SPEC_RESOLVERS, { optional: true }) ??\n ([] as const satisfies readonly OverlaySpecResolver[]);\n\n private readonly openOverlays = new Set<CoarOverlayRef>();\n\n private globalListenersInstalled = false;\n\n private readonly onDocumentPointerDown = (event: PointerEvent) => {\n const overlays = this.getOpenOverlaysInOrder();\n if (overlays.length === 0) return;\n\n const target = event.target;\n const topmostContaining = this.getTopmostOverlayContainingTarget(target);\n if (topmostContaining) {\n // When interacting with an overlay, close any child overlays (submenus) that may be open.\n topmostContaining.closeChildren();\n return;\n }\n\n const topmost = this.getTopmostDismissableOverlay('outsideClick');\n if (!topmost) return;\n\n // For overlay trees (e.g. menus + submenus), outside-click should close the entire tree.\n const root = topmost.getRoot();\n if (root !== topmost && root.isDismissable('outsideClick')) {\n root.close();\n return;\n }\n\n topmost.close();\n };\n\n private readonly onDocumentKeyDown = (event: KeyboardEvent) => {\n if (event.key === 'Escape') {\n const topmost = this.getTopmostDismissableOverlay('escapeKey');\n if (!topmost) return;\n\n event.preventDefault();\n event.stopPropagation();\n topmost.close();\n return;\n }\n\n if (event.key === 'Tab') {\n const topmost = this.getTopmostFocusTrappingOverlay();\n if (!topmost) return;\n\n if (topmost.handleTabKey(event)) {\n event.preventDefault();\n }\n }\n };\n\n open<TInputs>(\n spec: OverlaySpec<TInputs>,\n inputs: TInputs,\n options?: OverlayOpenOptions\n ): OverlayRef {\n const resolved = this.resolveSpec(spec);\n return this.attach(resolved, inputs, options);\n }\n\n openChild<TInputs>(\n parent: OverlayRef,\n spec: OverlaySpec<TInputs>,\n inputs: TInputs,\n options?: { closeSiblings?: boolean }\n ): OverlayRef {\n return this.open(spec, inputs, { parent, closeSiblings: options?.closeSiblings });\n }\n\n closeAll(): void {\n for (const ref of Array.from(this.openOverlays)) {\n ref.close();\n }\n }\n\n private resolveSpec<TInputs>(spec: OverlaySpec<TInputs>): ResolvedOverlaySpec<TInputs> {\n const resolvedSpec = this.applySpecResolvers(spec);\n\n const content = resolvedSpec.content;\n if (!content) {\n throw new Error('OverlaySpec missing content');\n }\n\n return {\n content,\n anchor: resolvedSpec.anchor ?? COAR_OVERLAY_DEFAULTS.anchor,\n position: resolvedSpec.position ?? COAR_OVERLAY_DEFAULTS.position,\n size: resolvedSpec.size ?? { mode: 'content' },\n backdrop: resolvedSpec.backdrop ?? COAR_OVERLAY_DEFAULTS.backdrop,\n scroll: resolvedSpec.scroll ?? COAR_OVERLAY_DEFAULTS.scroll,\n dismiss: resolvedSpec.dismiss ?? COAR_OVERLAY_DEFAULTS.dismiss,\n focus: resolvedSpec.focus ?? COAR_OVERLAY_DEFAULTS.focus,\n a11y: resolvedSpec.a11y ?? COAR_OVERLAY_DEFAULTS.a11y,\n attachment: resolvedSpec.attachment ?? COAR_OVERLAY_DEFAULTS.attachment,\n };\n }\n\n private applySpecResolvers<TInputs>(spec: OverlaySpec<TInputs>): OverlaySpec<TInputs> {\n if (this.specResolvers.length === 0) return spec;\n\n let current = spec as unknown as OverlaySpec<unknown>;\n for (const resolver of this.specResolvers) {\n const next = resolver(current);\n current = (next ?? current) as OverlaySpec<unknown>;\n }\n\n return current as unknown as OverlaySpec<TInputs>;\n }\n\n private attach<TInputs>(\n spec: ResolvedOverlaySpec<TInputs>,\n inputs: TInputs,\n options?: OverlayOpenOptions\n ): OverlayRef {\n const parent = this.getInternalRefOrNull(options?.parent);\n\n // Close sibling overlays if requested (close all existing children of parent)\n if (options?.closeSiblings && parent) {\n parent.closeChildren();\n }\n\n const stackIndex = this.openOverlays.size;\n\n const effectiveSpec = this.inheritDismissFromParent(spec, parent);\n\n const ref = new CoarOverlayRef(\n this.appRef,\n this.environmentInjector,\n effectiveSpec,\n this.mergeInputs(spec.content, inputs),\n stackIndex,\n parent,\n () => {\n this.openOverlays.delete(ref);\n this.uninstallGlobalListenersIfIdle();\n }\n );\n\n this.openOverlays.add(ref);\n this.installGlobalListenersIfNeeded();\n ref.open();\n return ref;\n }\n\n private inheritDismissFromParent<TInputs>(\n spec: ResolvedOverlaySpec<TInputs>,\n parent: CoarOverlayRef | null\n ): ResolvedOverlaySpec<TInputs> {\n if (!parent) return spec;\n\n const parentHoverTree = parent.getHoverTreeDismissConfig();\n if (!parentHoverTree?.enabled) return spec;\n\n const childHoverTree = spec.dismiss.hoverTree;\n\n // Explicit disable in child wins.\n if (childHoverTree?.enabled === false) return spec;\n\n let mergedHoverTree: typeof childHoverTree;\n if (!childHoverTree) {\n mergedHoverTree = { ...parentHoverTree };\n } else {\n mergedHoverTree = {\n enabled: true,\n delayMs: childHoverTree.delayMs ?? parentHoverTree.delayMs,\n };\n }\n\n // No change.\n if (mergedHoverTree === childHoverTree) return spec;\n\n return {\n ...(spec as unknown as object),\n dismiss: {\n ...(spec.dismiss as object),\n hoverTree: mergedHoverTree,\n },\n } as ResolvedOverlaySpec<TInputs>;\n }\n\n private getInternalRefOrNull(ref: OverlayRef | undefined): CoarOverlayRef | null {\n if (!ref) return null;\n if (ref instanceof CoarOverlayRef) return ref;\n return null;\n }\n\n private installGlobalListenersIfNeeded(): void {\n if (this.globalListenersInstalled) return;\n if (typeof document === 'undefined') return;\n\n document.addEventListener('pointerdown', this.onDocumentPointerDown, { capture: true });\n document.addEventListener('keydown', this.onDocumentKeyDown, { capture: true });\n this.globalListenersInstalled = true;\n }\n\n private uninstallGlobalListenersIfIdle(): void {\n if (!this.globalListenersInstalled) return;\n if (this.openOverlays.size > 0) return;\n if (typeof document === 'undefined') return;\n\n document.removeEventListener('pointerdown', this.onDocumentPointerDown, { capture: true });\n document.removeEventListener('keydown', this.onDocumentKeyDown, { capture: true });\n this.globalListenersInstalled = false;\n }\n\n private getOpenOverlaysInOrder(): CoarOverlayRef[] {\n return Array.from(this.openOverlays);\n }\n\n private getTopmostOverlayContainingTarget(target: EventTarget | null): CoarOverlayRef | null {\n const overlays = this.getOpenOverlaysInOrder();\n\n for (let i = overlays.length - 1; i >= 0; i -= 1) {\n const overlay = overlays[i];\n if (overlay.containsEventTarget(target)) return overlay;\n }\n\n return null;\n }\n\n private getTopmostDismissableOverlay(kind: 'outsideClick' | 'escapeKey'): CoarOverlayRef | null {\n const overlays = this.getOpenOverlaysInOrder();\n\n for (let i = overlays.length - 1; i >= 0; i -= 1) {\n const overlay = overlays[i];\n if (overlay.isDismissable(kind)) {\n return overlay;\n }\n }\n\n return null;\n }\n\n private getTopmostFocusTrappingOverlay(): CoarOverlayRef | null {\n const overlays = this.getOpenOverlaysInOrder();\n\n for (let i = overlays.length - 1; i >= 0; i -= 1) {\n const overlay = overlays[i];\n if (overlay.hasFocusTrap()) {\n return overlay;\n }\n }\n\n return null;\n }\n\n private mergeInputs<TInputs>(content: ContentSpec<TInputs>, inputs: TInputs): TInputs {\n if (!content.defaults) return inputs;\n\n if (inputs == null || typeof inputs !== 'object') {\n return { ...(content.defaults as object) } as TInputs;\n }\n\n return {\n ...(content.defaults as object),\n ...(inputs as object),\n } as TInputs;\n }\n\n private renderContent<TInputs>(\n content: ContentSpec<TInputs>,\n host: HTMLElement,\n inputs: TInputs\n ): () => void {\n switch (content.kind) {\n case 'text': {\n const text = (inputs as { text: string } | null | undefined)?.text;\n if (typeof text !== 'string') {\n throw new Error('Text overlay requires inputs: { text: string }');\n }\n host.textContent = text;\n return () => {\n host.textContent = '';\n };\n }\n case 'template': {\n const template = content.template as TemplateRef<unknown> | undefined;\n if (!template) throw new Error('Template overlay requires a template');\n const viewRef = template.createEmbeddedView(inputs as unknown as object);\n this.appRef.attachView(viewRef);\n viewRef.detectChanges();\n\n for (const node of viewRef.rootNodes) {\n host.appendChild(node);\n }\n\n return () => {\n this.appRef.detachView(viewRef);\n viewRef.destroy();\n };\n }\n case 'component': {\n const component = content.component as Type<unknown> | undefined;\n if (!component) throw new Error('Component overlay requires a component');\n\n const componentRef = createComponent(component, {\n environmentInjector: this.environmentInjector,\n hostElement: host,\n });\n\n if (inputs && typeof inputs === 'object') {\n for (const [key, value] of Object.entries(inputs as object)) {\n componentRef.setInput(key, value);\n }\n }\n\n this.appRef.attachView(componentRef.hostView);\n componentRef.changeDetectorRef.detectChanges();\n\n return () => {\n this.appRef.detachView(componentRef.hostView);\n componentRef.destroy();\n };\n }\n }\n }\n}\n\nclass CoarOverlayRef implements OverlayRef {\n private readonly afterClosedSubject = new Subject<unknown>();\n readonly afterClosed$ = this.afterClosedSubject.asObservable();\n\n get isClosed(): boolean {\n return this.closed;\n }\n\n private readonly host: HTMLElement;\n private readonly panel: HTMLElement;\n private backdropElement: HTMLElement | null = null;\n private destroyContent: (() => void) | null = null;\n private resizeObserver: ResizeObserver | null = null;\n private cleanupFns: Array<() => void> = [];\n private closed = false;\n private lastResult: unknown;\n private rafPending = false;\n private presented = false;\n private closeFinalized = false;\n private readonly restoreFocusTarget: Element | null;\n private readonly children = new Set<CoarOverlayRef>();\n private hoverCloseTimer: ReturnType<typeof setTimeout> | null = null;\n private readonly contentInjector: Injector;\n private readonly contentEnvironmentInjector: EnvironmentInjector;\n private readonly shouldAnimateMenu: boolean;\n\n constructor(\n private readonly appRef: ApplicationRef,\n private readonly environmentInjector: EnvironmentInjector,\n private readonly spec: ResolvedOverlaySpec<unknown>,\n private readonly inputs: unknown,\n private readonly stackIndex: number,\n private readonly parent: CoarOverlayRef | null,\n private readonly onClosed: () => void\n ) {\n this.host = document.createElement('div');\n this.host.className = 'coar-overlay-host';\n\n this.panel = document.createElement('div');\n this.panel.className = 'coar-overlay-panel';\n this.host.appendChild(this.panel);\n\n this.shouldAnimateMenu = this.spec.a11y.role === 'menu';\n\n this.contentInjector = Injector.create({\n providers: [\n { provide: COAR_OVERLAY_REF, useValue: this },\n { provide: COAR_MENU_PARENT, useValue: this },\n ],\n parent: this.environmentInjector,\n });\n\n this.contentEnvironmentInjector = createEnvironmentInjector(\n [\n { provide: COAR_OVERLAY_REF, useValue: this },\n { provide: COAR_MENU_PARENT, useValue: this },\n ],\n this.environmentInjector\n );\n\n Object.assign(this.host.style, {\n position: 'fixed',\n top: '0px',\n left: '0px',\n transform: 'translate3d(0px, 0px, 0px)',\n zIndex: `calc(var(--coar-z-overlay, 1000) + ${this.stackIndex * 2})`,\n opacity: '1',\n pointerEvents: 'none',\n } satisfies Partial<CSSStyleDeclaration>);\n\n if (this.shouldAnimateMenu) {\n Object.assign(this.panel.style, {\n opacity: '0',\n transition: 'opacity var(--coar-duration-slower) var(--coar-ease-out)',\n willChange: 'opacity',\n } satisfies Partial<CSSStyleDeclaration>);\n }\n\n this.restoreFocusTarget =\n (typeof document !== 'undefined' ? document.activeElement : null) ?? null;\n\n if (this.parent) {\n this.parent.children.add(this);\n }\n }\n\n getHoverTreeDismissConfig(): { enabled?: boolean; delayMs?: number } | undefined {\n return this.spec.dismiss.hoverTree;\n }\n\n getPanelElement(): HTMLElement {\n return this.panel;\n }\n\n getRoot(): CoarOverlayRef {\n return this.parent?.getRoot() ?? this;\n }\n\n closeChildren(exclude?: CoarOverlayRef): void {\n for (const child of Array.from(this.children)) {\n if (child !== exclude) {\n // Recursively close descendants first (depth-first)\n child.closeChildren();\n // Then close this child\n child.close();\n }\n }\n }\n\n /**\n * Close all sibling overlays (other children of the same parent).\n * Used when opening a new child overlay with closeSiblings option.\n */\n closeSiblings(): void {\n if (this.parent) {\n for (const sibling of Array.from(this.parent.children)) {\n if (sibling !== this) {\n sibling.close();\n }\n }\n }\n }\n\n open(): void {\n const backdrop = this.spec.backdrop;\n if (backdrop.kind === 'modal') {\n const backdropEl = document.createElement('div');\n backdropEl.className = 'coar-overlay-backdrop';\n\n Object.assign(backdropEl.style, {\n position: 'fixed',\n top: '0px',\n left: '0px',\n right: '0px',\n bottom: '0px',\n background: 'color-mix(in srgb, var(--coar-color-black) 40%, transparent)',\n zIndex: `calc(var(--coar-z-overlay-backdrop, 999) + ${this.stackIndex * 2})`,\n } satisfies Partial<CSSStyleDeclaration>);\n\n document.body.appendChild(backdropEl);\n this.backdropElement = backdropEl;\n\n if (backdrop.closeOnBackdropClick !== false) {\n const onClick = (e: MouseEvent) => {\n if (e.target === backdropEl) {\n this.close();\n }\n };\n\n backdropEl.addEventListener('click', onClick);\n this.cleanupFns.push(() => backdropEl.removeEventListener('click', onClick));\n }\n }\n\n // Attach overlay to the appropriate parent based on attachment strategy\n const attachment = this.spec.attachment;\n const attachmentParent =\n attachment.strategy === 'parent' ? attachment.container : document.body;\n attachmentParent.appendChild(this.host);\n\n this.installHoverTreeDismissIfEnabled();\n\n this.applyA11y();\n\n this.destroyContent = this.renderContent(this.spec.content, this.panel, this.inputs);\n\n this.applySize();\n\n if (this.spec.focus.trap) {\n this.installFocusTrap();\n }\n\n this.installRepositionTriggers();\n this.updatePosition();\n }\n\n private installHoverTreeDismissIfEnabled(): void {\n const hoverTree = this.spec.dismiss.hoverTree;\n if (!hoverTree?.enabled) return;\n\n const delayMs = typeof hoverTree.delayMs === 'number' ? hoverTree.delayMs : 300;\n\n const onEnter = () => {\n this.cancelHoverCloseUpTree();\n };\n\n const onHostLeave = () => {\n this.scheduleHoverCloseUpTree(delayMs);\n };\n\n // Important: an overlay's anchor element can be *inside* its parent overlay (submenu items).\n // Leaving that anchor while still hovering the parent overlay should not schedule closing\n // the parent/grandparent overlays; only this (leaf) overlay should be eligible to close.\n const onAnchorLeave = () => {\n this.scheduleHoverClose(delayMs);\n };\n\n this.host.addEventListener('pointerenter', onEnter);\n this.host.addEventListener('pointerleave', onHostLeave);\n this.cleanupFns.push(() => {\n this.host.removeEventListener('pointerenter', onEnter);\n this.host.removeEventListener('pointerleave', onHostLeave);\n this.cancelHoverClose();\n });\n\n if (this.spec.anchor.kind === 'element') {\n const el = this.spec.anchor.element;\n el.addEventListener('pointerenter', onEnter);\n el.addEventListener('pointerleave', onAnchorLeave);\n this.cleanupFns.push(() => {\n el.removeEventListener('pointerenter', onEnter);\n el.removeEventListener('pointerleave', onAnchorLeave);\n });\n }\n }\n\n private cancelHoverClose(): void {\n if (!this.hoverCloseTimer) return;\n clearTimeout(this.hoverCloseTimer);\n this.hoverCloseTimer = null;\n }\n\n private cancelHoverCloseUpTree(): void {\n this.cancelHoverClose();\n this.parent?.cancelHoverCloseUpTree();\n }\n\n private scheduleHoverClose(delayMs: number): void {\n const hoverTree = this.spec.dismiss.hoverTree;\n if (!hoverTree?.enabled) return;\n\n this.cancelHoverClose();\n this.hoverCloseTimer = setTimeout(() => {\n this.hoverCloseTimer = null;\n this.close();\n }, delayMs);\n }\n\n private scheduleHoverCloseUpTree(delayMs: number): void {\n this.scheduleHoverClose(delayMs);\n this.parent?.scheduleHoverCloseUpTree(delayMs);\n }\n\n hasFocusTrap(): boolean {\n return this.spec.focus.trap === true;\n }\n\n isDismissable(kind: 'outsideClick' | 'escapeKey'): boolean {\n if (kind === 'outsideClick') {\n return this.spec.dismiss.outsideClick !== false;\n }\n\n return this.spec.dismiss.escapeKey !== false;\n }\n\n containsEventTarget(target: EventTarget | null): boolean {\n if (!(target instanceof Node)) return false;\n if (this.host.contains(target)) return true;\n if (this.backdropElement?.contains(target)) return true;\n\n // Also check if click is on the anchor element (e.g., select trigger)\n // to prevent closing when clicking the trigger that opened the overlay\n if (this.spec.anchor.kind === 'element') {\n if (this.spec.anchor.element.contains(target)) return true;\n }\n\n return false;\n }\n\n handleTabKey(event: KeyboardEvent): boolean {\n if (!this.spec.focus.trap) return false;\n\n const focusables = this.getFocusableElements();\n if (focusables.length === 0) {\n this.focusElement(this.host);\n return true;\n }\n\n const first = focusables[0];\n const last = focusables[focusables.length - 1];\n\n const active = document.activeElement;\n const isActiveInside =\n active instanceof Node && (this.host.contains(active) || active === this.host);\n\n // If focus is outside, bring it inside.\n if (!isActiveInside) {\n this.focusElement(event.shiftKey ? last : first);\n return true;\n }\n\n if (event.shiftKey) {\n if (active === first || active === this.host) {\n this.focusElement(last);\n return true;\n }\n return false;\n }\n\n if (active === last) {\n this.focusElement(first);\n return true;\n }\n\n return false;\n }\n\n updatePosition(): void {\n if (this.closed) return;\n if (this.rafPending) return;\n this.rafPending = true;\n\n this.schedule(() => {\n this.rafPending = false;\n if (this.closed) return;\n\n const viewport = getViewportRect();\n const anchorRect = getAnchorRect(this.spec.anchor, viewport);\n\n const rect = this.host.getBoundingClientRect();\n const overlaySize = {\n width: rect.width,\n height: rect.height,\n };\n\n // For parent-attached overlays, use container boundaries instead of viewport\n const attachment = this.spec.attachment;\n const boundaryRect =\n attachment.strategy === 'parent' ? getContainerRect(attachment.container) : undefined;\n\n const coords = computeOverlayCoordinates(\n anchorRect,\n overlaySize,\n this.spec.position,\n viewport,\n boundaryRect\n );\n this.host.style.transform = `translate3d(${Math.round(coords.left)}px, ${Math.round(\n coords.top\n )}px, 0px)`;\n this.present();\n });\n }\n\n private present(): void {\n if (this.presented) return;\n this.presented = true;\n\n if (this.shouldAnimateMenu) {\n // Ensure the initial opacity=0 is committed before we flip to 1,\n // otherwise some browsers skip the transition on first paint.\n void this.panel.getBoundingClientRect();\n }\n\n this.host.style.pointerEvents = 'auto';\n\n if (this.shouldAnimateMenu) {\n this.panel.style.opacity = '1';\n }\n }\n\n close(result?: unknown): void {\n console.log('[OverlayRef] close() called', {\n closed: this.closed,\n result,\n });\n\n if (this.closed) return;\n this.closed = true;\n this.lastResult = result;\n\n this.cancelHoverClose();\n\n // Ensure overlay trees (menus/submenus) close consistently.\n this.closeChildren();\n\n for (const cleanup of this.cleanupFns) {\n cleanup();\n }\n this.cleanupFns = [];\n\n this.resizeObserver?.disconnect();\n this.resizeObserver = null;\n\n // Begin visual close (menu overlays only). We keep the host in the DOM\n // briefly so opacity can transition to 0, then tear down.\n if (this.shouldAnimateMenu && this.presented) {\n this.host.style.pointerEvents = 'none';\n this.panel.style.opacity = '0';\n\n const finalizeOnce = () => {\n this.finalizeClose();\n };\n\n let fallbackTimer: ReturnType<typeof setTimeout> | null = null;\n\n const onEnd = (e: TransitionEvent) => {\n if (e.target === this.panel && e.propertyName === 'opacity') {\n this.host.removeEventListener('transitionend', onEnd);\n if (fallbackTimer) {\n clearTimeout(fallbackTimer);\n fallbackTimer = null;\n }\n finalizeOnce();\n }\n };\n\n this.host.addEventListener('transitionend', onEnd);\n\n const fallbackMs = this.getMaxTransitionTimeMs();\n if (fallbackMs === 0) {\n this.host.removeEventListener('transitionend', onEnd);\n finalizeOnce();\n } else {\n fallbackTimer = setTimeout(() => {\n this.host.removeEventListener('transitionend', onEnd);\n finalizeOnce();\n }, fallbackMs);\n }\n\n return;\n }\n\n this.finalizeClose();\n }\n\n private finalizeClose(): void {\n if (this.closeFinalized) return;\n this.closeFinalized = true;\n\n this.destroyContent?.();\n this.destroyContent = null;\n this.host.remove();\n this.backdropElement?.remove();\n this.backdropElement = null;\n\n if (this.spec.focus.restore !== false) {\n const el = this.restoreFocusTarget as HTMLElement | null;\n if (el && typeof el.focus === 'function') {\n try {\n el.focus({ preventScroll: true });\n } catch {\n try {\n el.focus();\n } catch {\n // noop\n }\n }\n }\n }\n\n this.afterClosedSubject.next(this.lastResult);\n this.afterClosedSubject.complete();\n\n this.parent?.children.delete(this);\n this.onClosed();\n }\n\n private getMaxTransitionTimeMs(): number {\n if (typeof getComputedStyle === 'undefined') return 0;\n\n const style = getComputedStyle(this.panel);\n const durations = style.transitionDuration.split(',').map((v) => v.trim());\n const delays = style.transitionDelay.split(',').map((v) => v.trim());\n const entries = Math.max(durations.length, delays.length);\n\n let maxMs = 0;\n for (let i = 0; i < entries; i++) {\n const duration = durations[i] ?? durations[durations.length - 1] ?? '0ms';\n const delay = delays[i] ?? delays[delays.length - 1] ?? '0ms';\n const ms = this.parseCssTimeToMs(duration) + this.parseCssTimeToMs(delay);\n maxMs = Math.max(maxMs, ms);\n }\n\n return maxMs;\n }\n\n private parseCssTimeToMs(value: string): number {\n const v = value.trim();\n if (!v) return 0;\n if (v.endsWith('ms')) {\n const n = Number(v.slice(0, -2));\n return Number.isFinite(n) ? n : 0;\n }\n if (v.endsWith('s')) {\n const n = Number(v.slice(0, -1));\n return Number.isFinite(n) ? n * 1000 : 0;\n }\n const n = Number(v);\n return Number.isFinite(n) ? n : 0;\n }\n\n private installFocusTrap(): void {\n // Ensure the host can receive programmatic focus as a fallback.\n this.host.tabIndex = -1;\n\n // Move focus into the overlay on open (best-effort).\n this.schedule(() => {\n if (this.closed) return;\n const focusables = this.getFocusableElements();\n this.focusElement(focusables[0] ?? this.host);\n });\n }\n\n private applySize(): void {\n const size = this.spec.size;\n if (!size) return;\n\n const viewport = getViewportRect();\n\n const resolveMin = (\n value: number | 'anchor' | undefined,\n anchorSize: number\n ): number | null => {\n if (value === 'anchor') return anchorSize;\n if (typeof value === 'number') return value;\n return null;\n };\n\n const resolveMax = (\n value: number | 'viewport' | undefined,\n viewportSize: number\n ): number | null => {\n if (value === 'viewport') return viewportSize;\n if (typeof value === 'number') return value;\n return null;\n };\n\n const anchorRect = getAnchorRect(this.spec.anchor, viewport);\n const minWidthPx = resolveMin(size.minWidth, anchorRect.width);\n const minHeightPx = resolveMin(size.minHeight, anchorRect.height);\n\n const maxWidthPx = resolveMax(size.maxWidth, viewport.width);\n const maxHeightPx = resolveMax(size.maxHeight, viewport.height);\n\n // Reset in case an overlay host is re-used in the future.\n this.host.style.width = '';\n this.host.style.height = '';\n this.host.style.minWidth = '';\n this.host.style.minHeight = '';\n this.host.style.maxWidth = '';\n this.host.style.maxHeight = '';\n this.host.style.overflow = '';\n\n if (minWidthPx != null && minWidthPx > 0) this.host.style.minWidth = `${minWidthPx}px`;\n if (minHeightPx != null && minHeightPx > 0) this.host.style.minHeight = `${minHeightPx}px`;\n\n if (size.mode === 'content') {\n return;\n }\n\n if (size.mode === 'content-clamped') {\n if (maxWidthPx != null) this.host.style.maxWidth = `${maxWidthPx}px`;\n if (maxHeightPx != null) this.host.style.maxHeight = `${maxHeightPx}px`;\n this.host.style.overflow = 'auto';\n return;\n }\n\n // mode: 'fixed'\n if (maxWidthPx != null) this.host.style.width = `${maxWidthPx}px`;\n if (maxHeightPx != null) this.host.style.height = `${maxHeightPx}px`;\n this.host.style.overflow = 'auto';\n }\n\n private applyA11y(): void {\n const a11y = this.spec.a11y;\n if (!a11y) return;\n\n if (a11y.role) {\n this.host.setAttribute('role', a11y.role);\n }\n\n this.setAttrIfDefined('aria-label', a11y.label);\n this.setAttrIfDefined('aria-labelledby', a11y.labelledBy);\n this.setAttrIfDefined('aria-describedby', a11y.describedBy);\n\n if (a11y.role === 'dialog' && this.spec.backdrop.kind === 'modal') {\n this.host.setAttribute('aria-modal', 'true');\n }\n }\n\n private setAttrIfDefined(name: string, value: string | undefined): void {\n if (typeof value === 'string' && value.length > 0) {\n this.host.setAttribute(name, value);\n return;\n }\n\n this.host.removeAttribute(name);\n }\n\n private focusElement(el: HTMLElement): void {\n try {\n el.focus({ preventScroll: true });\n } catch {\n try {\n el.focus();\n } catch {\n // noop\n }\n }\n }\n\n private getFocusableElements(): HTMLElement[] {\n const candidates = Array.from(\n this.host.querySelectorAll<HTMLElement>(\n 'a[href],button:not([disabled]),input:not([disabled]),select:not([disabled]),textarea:not([disabled]),[tabindex]:not([tabindex=\"-1\"]),[contenteditable=\"true\"]'\n )\n );\n\n return candidates.filter((el) => !this.isHidden(el));\n }\n\n private isHidden(el: HTMLElement): boolean {\n // Avoid using offsetParent as it behaves poorly in some environments (e.g. JSDOM).\n if (el.hasAttribute('hidden')) return true;\n if (el.getAttribute('aria-hidden') === 'true') return true;\n const style = el.style;\n if (style.display === 'none' || style.visibility === 'hidden') return true;\n return false;\n }\n\n private installRepositionTriggers(): void {\n const strategy = this.spec.scroll.strategy;\n if (strategy === 'noop') return;\n\n const scrollParents =\n this.spec.anchor.kind === 'element' ? getScrollParents(this.spec.anchor.element) : [window];\n\n if (strategy === 'reposition') {\n const onScroll = () => this.updatePosition();\n const onResize = () => this.updatePosition();\n\n for (const parent of scrollParents) {\n if (parent === window) {\n window.addEventListener('scroll', onScroll, { passive: true });\n this.cleanupFns.push(() => window.removeEventListener('scroll', onScroll));\n continue;\n }\n\n parent.addEventListener('scroll', onScroll, { passive: true });\n this.cleanupFns.push(() => parent.removeEventListener('scroll', onScroll));\n }\n\n window.addEventListener('resize', onResize, { passive: true });\n this.cleanupFns.push(() => window.removeEventListener('resize', onResize));\n\n if (typeof ResizeObserver !== 'undefined') {\n const ro = new ResizeObserver(() => this.updatePosition());\n ro.observe(this.host);\n this.resizeObserver = ro;\n }\n\n return;\n }\n\n if (strategy === 'close') {\n const onScroll = (e: Event) => {\n const target = e.target;\n if (target instanceof Node && this.host.contains(target)) return;\n this.close();\n };\n\n if (typeof document !== 'undefined') {\n document.addEventListener('scroll', onScroll, { passive: true, capture: true });\n this.cleanupFns.push(() =>\n document.removeEventListener('scroll', onScroll, { capture: true })\n );\n }\n\n // Fallback for environments where scroll is only observed on window.\n window.addEventListener('scroll', onScroll, { passive: true });\n this.cleanupFns.push(() => window.removeEventListener('scroll', onScroll));\n\n // Also attach to explicit scroll parents for element anchors (helps non-standard event targets).\n for (const parent of scrollParents) {\n if (parent === window) continue;\n parent.addEventListener('scroll', onScroll, { passive: true });\n this.cleanupFns.push(() => parent.removeEventListener('scroll', onScroll));\n }\n\n // Still reposition on size changes while open.\n if (typeof ResizeObserver !== 'undefined') {\n const ro = new ResizeObserver(() => this.updatePosition());\n ro.observe(this.host);\n this.resizeObserver = ro;\n }\n }\n }\n\n private schedule(fn: () => void): void {\n if (typeof requestAnimationFrame !== 'undefined') {\n requestAnimationFrame(() => fn());\n return;\n }\n\n setTimeout(() => fn(), 0);\n }\n\n private renderContent<TInputs>(\n content: ContentSpec<TInputs>,\n host: HTMLElement,\n inputs: TInputs\n ): () => void {\n switch (content.kind) {\n case 'text': {\n const text = (inputs as { text: string } | null | undefined)?.text;\n if (typeof text !== 'string') {\n throw new Error('Text overlay requires inputs: { text: string }');\n }\n host.textContent = text;\n return () => {\n host.textContent = '';\n };\n }\n case 'template': {\n const template = content.template as TemplateRef<unknown> | undefined;\n if (!template) throw new Error('Template overlay requires a template');\n\n const viewRef = template.createEmbeddedView(\n inputs as unknown as object,\n this.contentInjector\n );\n this.appRef.attachView(viewRef);\n viewRef.detectChanges();\n\n for (const node of viewRef.rootNodes) {\n host.appendChild(node);\n }\n\n return () => {\n this.appRef.detachView(viewRef);\n viewRef.destroy();\n };\n }\n case 'component': {\n const component = content.component as Type<unknown> | undefined;\n if (!component) throw new Error('Component overlay requires a component');\n\n const componentRef = createComponent(component, {\n environmentInjector: this.contentEnvironmentInjector,\n hostElement: host,\n });\n\n if (inputs && typeof inputs === 'object') {\n for (const [key, value] of Object.entries(inputs as object)) {\n componentRef.setInput(key, value);\n }\n }\n\n this.appRef.attachView(componentRef.hostView);\n componentRef.changeDetectorRef.detectChanges();\n\n return () => {\n this.appRef.detachView(componentRef.hostView);\n componentRef.destroy();\n };\n }\n }\n }\n}\n","import { type OverlayBuilder } from './overlay-builder';\n\nexport type OverlayPreset = (b: OverlayBuilder) => void;\n\nexport const coarTooltipPreset: OverlayPreset = (b) => {\n b.backdrop('none');\n b.scroll({ strategy: 'noop' });\n b.dismiss({ outsideClick: false, escapeKey: false });\n b.a11y({ role: 'tooltip' });\n b.position({\n placement: ['top', 'bottom', 'left', 'right'],\n offset: 8,\n flip: true,\n shift: true,\n });\n b.attachment({ strategy: 'body' });\n};\n\nexport const coarModalPreset: OverlayPreset = (b) => {\n b.backdrop('modal');\n b.anchor({ kind: 'virtual', placement: 'center' });\n b.focus({ trap: true, restore: true });\n b.size({ mode: 'content-clamped', maxWidth: 'viewport', maxHeight: 'viewport' });\n b.position({ placement: 'center', offset: 0, flip: false, shift: true });\n b.a11y({ role: 'dialog' });\n b.attachment({ strategy: 'body' });\n};\n\nexport const coarMenuPreset: OverlayPreset = (b) => {\n b.backdrop('none');\n b.scroll({ strategy: 'close' });\n b.dismiss({ outsideClick: true, escapeKey: true });\n b.focus({ trap: false, restore: true });\n b.a11y({ role: 'menu' });\n // Provide fallback placements so the overlay can choose a side that fits.\n // Start/end variants help when the anchor is near the viewport edges.\n b.position({\n placement: ['bottom-start', 'bottom-end', 'top-start', 'top-end'],\n offset: 4,\n flip: true,\n shift: true,\n });\n};\n\n/**\n * Menu preset for hover-driven menus (context menus, cascading flyouts).\n *\n * Enables hoverTree dismissal so a parent overlay stays open while the pointer\n * is inside any child overlay opened via openChild().\n */\nexport const coarHoverMenuPreset: OverlayPreset = (b) => {\n coarMenuPreset(b);\n b.dismiss({\n outsideClick: true,\n escapeKey: true,\n hoverTree: { enabled: true, delayMs: 300 },\n });\n};\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;MAGa,cAAc,CAAA;AACzB,IAAA,aAAa,CAAI,SAAkB,EAAA;AACjC,QAAA,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,SAAS,EAAE;IACzC;AAEA,IAAA,YAAY,CAAO,QAA2B,EAAA;AAC5C,QAAA,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE;IACvC;IAEA,QAAQ,GAAA;AACN,QAAA,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE;IACzB;AACD;;ACfK,SAAU,UAAU,CAAI,KAAQ,EAAA;IACpC,IAAI,KAAK,IAAI,IAAI;AAAE,QAAA,OAAO,KAAK;IAE/B,IAAI,OAAO,KAAK,KAAK,QAAQ;AAAE,QAAA,OAAO,KAAK;;;IAI3C,MAAM,KAAK,GAAG,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC;IAC1C,MAAM,aAAa,GAAG,KAAK,KAAK,MAAM,CAAC,SAAS,IAAI,KAAK,KAAK,IAAI;IAElE,IAAI,CAAC,aAAa,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;AAC3C,QAAA,OAAO,KAAK;IACd;AAEA,IAAA,IAAI,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC;AAAE,QAAA,OAAO,KAAK;AAExC,IAAA,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC;AAEpB,IAAA,IAAI,KAAK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C,cAAc,EAAE,YAAY,EAAE,WAAW,EAAE,SAAS,CAAC;AACjE,QAAA,MAAM,EAAE,CAAC;AACT,QAAA,IAAI,EAAE,IAAI;AACV,QAAA,KAAK,EAAE,IAAI;AACZ,KAAA,CAAC;AACJ;AAEA;;;;;AAKG;AACI,MAAM,mBAAmB,GAAkB,CAAC,CAAC,KAAI;IACtD,cAAc,CAAC,CAAC,CAAC;IACjB,CAAC,CAAC,OAAO,CAAC;AACR,QAAA,YAAY,EAAE,IAAI;AAClB,QAAA,SAAS,EAAE,IAAI;QACf,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE;AAC3C,KAAA,CAAC;AACJ;;ACzDA;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"cocoar-ui-overlay.mjs","sources":["../../../../libs/ui-overlay/src/lib/overlay/content-builder.ts","../../../../libs/ui-overlay/src/lib/overlay/deep-freeze.ts","../../../../libs/ui-overlay/src/lib/overlay/overlay-builder.ts","../../../../libs/ui-overlay/src/lib/overlay/overlay.ts","../../../../libs/ui-overlay/src/lib/overlay/overlay-spec.ts","../../../../libs/ui-overlay/src/lib/overlay/overlay-position.ts","../../../../libs/ui-overlay/src/lib/overlay/overlay-context.ts","../../../../libs/ui-overlay/src/lib/overlay/overlay-service.ts","../../../../libs/ui-overlay/src/lib/overlay/presets.ts","../../../../libs/ui-overlay/src/cocoar-ui-overlay.ts"],"sourcesContent":["import { TemplateRef, Type } from '@angular/core';\nimport { type ContentSpec } from './overlay-spec';\n\nexport class ContentBuilder {\n fromComponent<C>(component: Type<C>): ContentSpec<Partial<C>> {\n return { kind: 'component', component };\n }\n\n fromTemplate<TCtx>(template: TemplateRef<TCtx>): ContentSpec<TCtx> {\n return { kind: 'template', template };\n }\n\n fromText(): ContentSpec<{ text: string }> {\n return { kind: 'text' };\n }\n}\n","export function deepFreeze<T>(value: T): T {\n if (value == null) return value;\n\n if (typeof value !== 'object') return value;\n\n // Only freeze plain JSON-like objects/arrays.\n // Framework objects (e.g. Angular TemplateRef) can have internal mutable state.\n const proto = Object.getPrototypeOf(value);\n const isPlainObject = proto === Object.prototype || proto === null;\n\n if (!isPlainObject && !Array.isArray(value)) {\n return value;\n }\n\n if (Object.isFrozen(value)) return value;\n\n Object.freeze(value);\n\n if (Array.isArray(value)) {\n for (const entry of value) {\n deepFreeze(entry);\n }\n\n return value;\n }\n\n for (const key of Object.keys(value as Record<string, unknown>)) {\n deepFreeze((value as Record<string, unknown>)[key]);\n }\n\n return value;\n}\n","import {\n type A11ySpec,\n type AnchorSpec,\n type AttachmentSpec,\n type BackdropSpec,\n type ContentSpec,\n type DismissSpec,\n type FocusSpec,\n type OverlaySpec,\n type PositionSpec,\n type ScrollSpec,\n type SizeSpec,\n} from './overlay-spec';\nimport { ContentBuilder } from './content-builder';\nimport { deepFreeze } from './deep-freeze';\n\nexport class OverlayBuilder {\n private readonly draft: OverlaySpec<unknown>;\n\n constructor(seed?: OverlaySpec<unknown>) {\n this.draft = { ...(seed ?? {}) };\n }\n\n backdrop(cfg?: BackdropSpec | 'none' | 'modal'): this {\n if (cfg === 'none') {\n this.draft.backdrop = { kind: 'none' };\n return this;\n }\n\n if (cfg === 'modal') {\n this.draft.backdrop = { kind: 'modal', closeOnBackdropClick: true };\n return this;\n }\n\n this.draft.backdrop = cfg;\n return this;\n }\n\n anchor(cfg: AnchorSpec): this {\n this.draft.anchor = cfg;\n return this;\n }\n\n position(cfg: PositionSpec): this {\n this.draft.position = cfg;\n return this;\n }\n\n size(cfg: SizeSpec): this {\n this.draft.size = cfg;\n return this;\n }\n\n scroll(cfg: ScrollSpec): this {\n this.draft.scroll = cfg;\n return this;\n }\n\n dismiss(cfg: DismissSpec): this {\n this.draft.dismiss = cfg;\n return this;\n }\n\n focus(cfg: FocusSpec): this {\n this.draft.focus = cfg;\n return this;\n }\n\n a11y(cfg: A11ySpec): this {\n this.draft.a11y = cfg;\n return this;\n }\n\n attachment(cfg: AttachmentSpec): this {\n this.draft.attachment = cfg;\n return this;\n }\n\n content(fn: (c: ContentBuilder) => ContentSpec<unknown>): this {\n const contentBuilder = new ContentBuilder();\n this.draft.content = fn(contentBuilder);\n return this;\n }\n\n freeze<TInputs = void>(): OverlaySpec<TInputs> {\n return deepFreeze({ ...this.draft }) as OverlaySpec<TInputs>;\n }\n}\n","import { OverlayBuilder } from './overlay-builder';\nimport { type OverlaySpec } from './overlay-spec';\nimport { type OverlayPreset } from './presets';\n\nexport class CoarOverlay {\n static define<TInputs = void>(\n fn: (b: OverlayBuilder) => void,\n ...presets: readonly OverlayPreset[]\n ): OverlaySpec<TInputs> {\n const builder = new OverlayBuilder();\n\n for (const preset of presets) {\n preset(builder);\n }\n\n fn(builder);\n return builder.freeze<TInputs>();\n }\n\n static fork<TInputs>(base: OverlaySpec<TInputs>, fn: (b: OverlayBuilder) => void): OverlaySpec<TInputs> {\n const builder = new OverlayBuilder(base as OverlaySpec<unknown>);\n fn(builder);\n return builder.freeze<TInputs>();\n }\n}\n\n/** Alias kept for spec parity (`Overlay.define(...)`). */\nexport const Overlay = CoarOverlay;\n","import { InjectionToken, TemplateRef, Type } from '@angular/core';\n\nexport interface OverlaySpec<TInputs = void> {\n content?: ContentSpec<TInputs>;\n anchor?: AnchorSpec;\n position?: PositionSpec;\n size?: SizeSpec;\n backdrop?: BackdropSpec;\n scroll?: ScrollSpec;\n dismiss?: DismissSpec;\n focus?: FocusSpec;\n a11y?: A11ySpec;\n attachment?: AttachmentSpec;\n}\n\n/**\n * Optional application-level hook to apply global overlay defaults/policies.\n *\n * Resolvers should be pure functions and must not override explicit caller configuration\n * unless the application intentionally chooses to.\n */\nexport type OverlaySpecResolver = (spec: OverlaySpec<unknown>) => OverlaySpec<unknown>;\n\n/**\n * Multi-provider token. Resolvers are applied in registration order.\n */\nexport const COAR_OVERLAY_SPEC_RESOLVERS = new InjectionToken<readonly OverlaySpecResolver[]>(\n 'COAR_OVERLAY_SPEC_RESOLVERS'\n);\n\nexport type Placement =\n | 'top'\n | 'top-start'\n | 'top-end'\n | 'bottom'\n | 'bottom-start'\n | 'bottom-end'\n | 'left'\n | 'left-start'\n | 'left-end'\n | 'right'\n | 'right-start'\n | 'right-end'\n | 'center';\n\nexport interface ContentSpec<TInputs> {\n kind: 'component' | 'template' | 'text';\n component?: Type<unknown>;\n template?: TemplateRef<unknown>;\n\n /**\n * Optional default inputs.\n * Runtime inputs provided at open() time are merged on top.\n */\n defaults?: Partial<TInputs>;\n}\n\nexport type AnchorSpec =\n | { kind: 'element'; element: Element }\n | { kind: 'point'; x: number; y: number }\n | { kind: 'virtual'; placement: 'center' | 'top' | 'bottom' };\n\nexport interface PositionSpec {\n placement: Placement | readonly Placement[];\n offset?: number;\n flip?: boolean;\n shift?: boolean;\n}\n\nexport interface SizeSpec {\n mode: 'content' | 'content-clamped' | 'fixed';\n minWidth?: number | 'anchor';\n minHeight?: number | 'anchor';\n maxWidth?: number | 'viewport';\n maxHeight?: number | 'viewport';\n}\n\nexport type BackdropSpec =\n | { kind: 'none' }\n | {\n kind: 'modal';\n closeOnBackdropClick?: boolean;\n };\n\nexport interface ScrollSpec {\n strategy: 'noop' | 'reposition' | 'close';\n}\n\nexport interface DismissSpec {\n outsideClick?: boolean;\n escapeKey?: boolean;\n /**\n * Optional pointer-based dismissal for menu-like overlays.\n *\n * When enabled, the overlay closes after the pointer leaves the overlay *tree*\n * (the overlay itself and any child overlays opened via openChild()).\n * Entering any child overlay cancels the parent's close timer.\n */\n hoverTree?: {\n enabled?: boolean;\n delayMs?: number;\n };\n}\n\nexport interface FocusSpec {\n trap?: boolean;\n restore?: boolean;\n}\n\nexport interface A11ySpec {\n role?: 'dialog' | 'menu' | 'tooltip' | 'listbox';\n label?: string;\n labelledBy?: string;\n describedBy?: string;\n}\n\n/**\n * Defines where the overlay element is attached in the DOM and what boundaries\n * are used for clamping/fallback calculations.\n *\n * - 'body': Attach to document.body (portal pattern), use viewport boundaries\n * - 'parent': Attach to a specific container element, use that container's boundaries\n */\nexport type AttachmentSpec = { strategy: 'body' } | { strategy: 'parent'; container: HTMLElement };\n\nexport const COAR_OVERLAY_DEFAULTS = {\n anchor: { kind: 'virtual', placement: 'center' } as const satisfies AnchorSpec,\n position: {\n placement: ['top', 'bottom', 'left', 'right'] as const,\n offset: 8,\n flip: true,\n shift: true,\n } as const satisfies PositionSpec,\n backdrop: { kind: 'none' } as const satisfies BackdropSpec,\n scroll: { strategy: 'reposition' } as const satisfies ScrollSpec,\n dismiss: { outsideClick: true, escapeKey: true } as const satisfies DismissSpec,\n focus: { trap: false, restore: true } as const satisfies FocusSpec,\n a11y: {} as const satisfies A11ySpec,\n attachment: { strategy: 'body' } as const satisfies AttachmentSpec,\n} as const;\n\nexport type ResolvedOverlaySpec<TInputs> = Required<Omit<OverlaySpec<TInputs>, 'content'>> &\n Pick<Required<OverlaySpec<TInputs>>, 'content'>;\n","import { type AnchorSpec, type Placement, type PositionSpec } from './overlay-spec';\n\nexport interface ViewportRect {\n readonly width: number;\n readonly height: number;\n}\n\nexport interface Rect {\n readonly left: number;\n readonly top: number;\n readonly right: number;\n readonly bottom: number;\n readonly width: number;\n readonly height: number;\n}\n\nexport interface Point {\n readonly x: number;\n readonly y: number;\n}\n\nexport interface OverlaySize {\n readonly width: number;\n readonly height: number;\n}\n\nexport interface OverlayCoordinates {\n readonly left: number;\n readonly top: number;\n readonly placement: Placement;\n}\n\nexport function getViewportRect(): ViewportRect {\n const docEl = document.documentElement;\n const width = docEl?.clientWidth || window.innerWidth;\n const height = docEl?.clientHeight || window.innerHeight;\n return { width, height };\n}\n\nexport function getContainerRect(container: HTMLElement): Rect {\n return rectFromDom(container.getBoundingClientRect());\n}\n\nexport function rectFromDom(domRect: DOMRect): Rect {\n return {\n left: domRect.left,\n top: domRect.top,\n right: domRect.right,\n bottom: domRect.bottom,\n width: domRect.width,\n height: domRect.height,\n };\n}\n\nexport function getAnchorRect(anchor: AnchorSpec, viewport: ViewportRect): Rect {\n switch (anchor.kind) {\n case 'element':\n return rectFromDom(anchor.element.getBoundingClientRect());\n case 'point':\n return rectFromPoint(anchor, 0, 0);\n case 'virtual':\n return rectFromVirtual(anchor, viewport);\n }\n}\n\nexport function rectFromPoint(point: Point, width: number, height: number): Rect {\n const left = point.x;\n const top = point.y;\n return {\n left,\n top,\n right: left + width,\n bottom: top + height,\n width,\n height,\n };\n}\n\nexport function rectFromVirtual(\n spec: Extract<AnchorSpec, { kind: 'virtual' }>,\n viewport: ViewportRect\n): Rect {\n if (spec.placement === 'center') {\n const x = viewport.width / 2;\n const y = viewport.height / 2;\n return rectFromPoint({ x, y }, 0, 0);\n }\n\n if (spec.placement === 'top') {\n const x = viewport.width / 2;\n const y = 0;\n return rectFromPoint({ x, y }, 0, 0);\n }\n\n const x = viewport.width / 2;\n const y = viewport.height;\n return rectFromPoint({ x, y }, 0, 0);\n}\n\nexport function getScrollParents(element: Element): Array<Element | Window> {\n const result: Array<Element | Window> = [];\n\n let current: Element | null = element;\n while (current && current.parentElement) {\n current = current.parentElement;\n const style = getComputedStyle(current);\n const overflowY = style.overflowY;\n const overflowX = style.overflowX;\n\n const scrollable =\n overflowY === 'auto' ||\n overflowY === 'scroll' ||\n overflowX === 'auto' ||\n overflowX === 'scroll';\n\n if (scrollable) {\n result.push(current);\n }\n }\n\n result.push(window);\n return result;\n}\n\nexport function computeOverlayCoordinates(\n anchorRect: Rect,\n overlaySize: OverlaySize,\n position: PositionSpec,\n viewport: ViewportRect,\n boundaryRect?: Rect\n): OverlayCoordinates {\n const placements: readonly Placement[] = Array.isArray(position.placement)\n ? position.placement\n : [position.placement];\n\n const offset = position.offset ?? 0;\n const allowFlip = position.flip ?? false;\n const allowShift = position.shift ?? false;\n\n // Use container boundaries if provided, otherwise use viewport\n const boundary = boundaryRect ?? { left: 0, top: 0, right: viewport.width, bottom: viewport.height, width: viewport.width, height: viewport.height };\n\n const candidates = placements.map((placement) => ({\n placement,\n coords: coordsForPlacement(anchorRect, overlaySize, placement, offset),\n }));\n\n if (allowFlip) {\n for (const candidate of candidates) {\n const fits = fitsInBoundary(candidate.coords, overlaySize, boundary);\n if (fits) {\n return allowShift\n ? { ...shiftIntoBoundary(candidate.coords, overlaySize, boundary), placement: candidate.placement }\n : { ...candidate.coords, placement: candidate.placement };\n }\n }\n }\n\n // Choose the candidate with the smallest total overflow.\n let best = candidates[0];\n let bestOverflow = Number.POSITIVE_INFINITY;\n\n for (const candidate of candidates) {\n const overflow = totalOverflowFromBoundary(candidate.coords, overlaySize, boundary);\n if (overflow < bestOverflow) {\n best = candidate;\n bestOverflow = overflow;\n }\n }\n\n const chosen =\n best?.coords ??\n coordsForPlacement(anchorRect, overlaySize, placements[0] ?? 'bottom', offset);\n\n const shifted = allowShift ? shiftIntoBoundary(chosen, overlaySize, boundary) : chosen;\n return { ...shifted, placement: best?.placement ?? (placements[0] ?? 'bottom') };\n}\n\nfunction coordsForPlacement(\n anchorRect: Rect,\n overlaySize: OverlaySize,\n placement: Placement,\n offset: number\n): { left: number; top: number } {\n const anchorCenterX = anchorRect.left + anchorRect.width / 2;\n const anchorCenterY = anchorRect.top + anchorRect.height / 2;\n\n switch (placement) {\n case 'center':\n return {\n left: anchorCenterX - overlaySize.width / 2,\n top: anchorCenterY - overlaySize.height / 2,\n };\n\n case 'top':\n return {\n left: anchorCenterX - overlaySize.width / 2,\n top: anchorRect.top - overlaySize.height - offset,\n };\n case 'top-start':\n return {\n left: anchorRect.left,\n top: anchorRect.top - overlaySize.height - offset,\n };\n case 'top-end':\n return {\n left: anchorRect.right - overlaySize.width,\n top: anchorRect.top - overlaySize.height - offset,\n };\n\n case 'bottom':\n return {\n left: anchorCenterX - overlaySize.width / 2,\n top: anchorRect.bottom + offset,\n };\n case 'bottom-start':\n return {\n left: anchorRect.left,\n top: anchorRect.bottom + offset,\n };\n case 'bottom-end':\n return {\n left: anchorRect.right - overlaySize.width,\n top: anchorRect.bottom + offset,\n };\n\n case 'left':\n return {\n left: anchorRect.left - overlaySize.width - offset,\n top: anchorCenterY - overlaySize.height / 2,\n };\n case 'left-start':\n return {\n left: anchorRect.left - overlaySize.width - offset,\n top: anchorRect.top,\n };\n case 'left-end':\n return {\n left: anchorRect.left - overlaySize.width - offset,\n top: anchorRect.bottom - overlaySize.height,\n };\n\n case 'right':\n return {\n left: anchorRect.right + offset,\n top: anchorCenterY - overlaySize.height / 2,\n };\n case 'right-start':\n return {\n left: anchorRect.right + offset,\n top: anchorRect.top,\n };\n case 'right-end':\n return {\n left: anchorRect.right + offset,\n top: anchorRect.bottom - overlaySize.height,\n };\n }\n}\n\nfunction fitsInBoundary(\n coords: { left: number; top: number },\n overlaySize: OverlaySize,\n boundary: Rect\n): boolean {\n return (\n coords.left >= boundary.left &&\n coords.top >= boundary.top &&\n coords.left + overlaySize.width <= boundary.right &&\n coords.top + overlaySize.height <= boundary.bottom\n );\n}\n\nfunction shiftIntoBoundary(\n coords: { left: number; top: number },\n overlaySize: OverlaySize,\n boundary: Rect\n): { left: number; top: number } {\n const maxLeft = Math.max(boundary.left, boundary.right - overlaySize.width);\n const maxTop = Math.max(boundary.top, boundary.bottom - overlaySize.height);\n\n return {\n left: clamp(coords.left, boundary.left, maxLeft),\n top: clamp(coords.top, boundary.top, maxTop),\n };\n}\n\nfunction totalOverflowFromBoundary(\n coords: { left: number; top: number },\n overlaySize: OverlaySize,\n boundary: Rect\n): number {\n const leftOverflow = Math.max(0, boundary.left - coords.left);\n const topOverflow = Math.max(0, boundary.top - coords.top);\n const rightOverflow = Math.max(0, coords.left + overlaySize.width - boundary.right);\n const bottomOverflow = Math.max(0, coords.top + overlaySize.height - boundary.bottom);\n\n return leftOverflow + topOverflow + rightOverflow + bottomOverflow;\n}\n\nfunction clamp(value: number, min: number, max: number): number {\n if (value < min) return min;\n if (value > max) return max;\n return value;\n}\n","import { InjectionToken } from '@angular/core';\nimport { type OverlayRef } from './overlay-ref';\n\n/**\n * The OverlayRef for the overlay currently rendering this content.\n *\n * Provided automatically by CoarOverlayService for overlay content so components\n * can open true child overlays without DOM lookups.\n */\nexport const COAR_OVERLAY_REF = new InjectionToken<OverlayRef>('COAR_OVERLAY_REF');\n\n/**\n * Parent overlay reference for menu hierarchies.\n * Each overlay provides this token pointing to itself, enabling child menu items\n * to close siblings by calling parent.closeChildren().\n */\nexport const COAR_MENU_PARENT = new InjectionToken<OverlayRef | null>('COAR_MENU_PARENT');\n","import {\n ApplicationRef,\n EnvironmentInjector,\n Injectable,\n Injector,\n TemplateRef,\n Type,\n createComponent,\n createEnvironmentInjector,\n inject,\n} from '@angular/core';\nimport { Subject } from 'rxjs';\nimport {\n COAR_OVERLAY_DEFAULTS,\n COAR_OVERLAY_SPEC_RESOLVERS,\n type ContentSpec,\n type OverlaySpec,\n type OverlaySpecResolver,\n type ResolvedOverlaySpec,\n} from './overlay-spec';\nimport { type OverlayRef } from './overlay-ref';\nimport {\n computeOverlayCoordinates,\n getAnchorRect,\n getContainerRect,\n getScrollParents,\n getViewportRect,\n} from './overlay-position';\nimport { COAR_OVERLAY_REF, COAR_MENU_PARENT } from './overlay-context';\n\nexport interface OverlayOpenOptions {\n /**\n * Optional parent overlay. Used for menus/submenus so the service can keep trees consistent\n * (e.g. closing a parent closes its children).\n */\n parent?: OverlayRef;\n\n /**\n * If true, closes all sibling overlays (other children of the same parent) when this overlay opens.\n * Useful for menus where only one submenu should be visible at a time.\n */\n closeSiblings?: boolean;\n}\n\n@Injectable({ providedIn: 'root' })\nexport class CoarOverlayService {\n private readonly appRef = inject(ApplicationRef);\n private readonly environmentInjector = inject(EnvironmentInjector);\n\n private readonly specResolvers =\n inject(COAR_OVERLAY_SPEC_RESOLVERS, { optional: true }) ??\n ([] as const satisfies readonly OverlaySpecResolver[]);\n\n private readonly openOverlays = new Set<CoarOverlayRef>();\n\n private globalListenersInstalled = false;\n\n private readonly onDocumentPointerDown = (event: PointerEvent) => {\n const overlays = this.getOpenOverlaysInOrder();\n if (overlays.length === 0) return;\n\n const target = event.target;\n const topmostContaining = this.getTopmostOverlayContainingTarget(target);\n if (topmostContaining) {\n // When interacting with an overlay, close any child overlays (submenus) that may be open.\n topmostContaining.closeChildren();\n return;\n }\n\n const topmost = this.getTopmostDismissableOverlay('outsideClick');\n if (!topmost) return;\n\n // For overlay trees (e.g. menus + submenus), outside-click should close the entire tree.\n const root = topmost.getRoot();\n if (root !== topmost && root.isDismissable('outsideClick')) {\n root.close();\n return;\n }\n\n topmost.close();\n };\n\n private readonly onDocumentKeyDown = (event: KeyboardEvent) => {\n if (event.key === 'Escape') {\n const topmost = this.getTopmostDismissableOverlay('escapeKey');\n if (!topmost) return;\n\n event.preventDefault();\n event.stopPropagation();\n topmost.close();\n return;\n }\n\n if (event.key === 'Tab') {\n const topmost = this.getTopmostFocusTrappingOverlay();\n if (!topmost) return;\n\n if (topmost.handleTabKey(event)) {\n event.preventDefault();\n }\n }\n };\n\n open<TInputs>(\n spec: OverlaySpec<TInputs>,\n inputs: TInputs,\n options?: OverlayOpenOptions\n ): OverlayRef {\n const resolved = this.resolveSpec(spec);\n return this.attach(resolved, inputs, options);\n }\n\n openChild<TInputs>(\n parent: OverlayRef,\n spec: OverlaySpec<TInputs>,\n inputs: TInputs,\n options?: { closeSiblings?: boolean }\n ): OverlayRef {\n return this.open(spec, inputs, { parent, closeSiblings: options?.closeSiblings });\n }\n\n closeAll(): void {\n for (const ref of Array.from(this.openOverlays)) {\n ref.close();\n }\n }\n\n private resolveSpec<TInputs>(spec: OverlaySpec<TInputs>): ResolvedOverlaySpec<TInputs> {\n const resolvedSpec = this.applySpecResolvers(spec);\n\n const content = resolvedSpec.content;\n if (!content) {\n throw new Error('OverlaySpec missing content');\n }\n\n return {\n content,\n anchor: resolvedSpec.anchor ?? COAR_OVERLAY_DEFAULTS.anchor,\n position: resolvedSpec.position ?? COAR_OVERLAY_DEFAULTS.position,\n size: resolvedSpec.size ?? { mode: 'content' },\n backdrop: resolvedSpec.backdrop ?? COAR_OVERLAY_DEFAULTS.backdrop,\n scroll: resolvedSpec.scroll ?? COAR_OVERLAY_DEFAULTS.scroll,\n dismiss: resolvedSpec.dismiss ?? COAR_OVERLAY_DEFAULTS.dismiss,\n focus: resolvedSpec.focus ?? COAR_OVERLAY_DEFAULTS.focus,\n a11y: resolvedSpec.a11y ?? COAR_OVERLAY_DEFAULTS.a11y,\n attachment: resolvedSpec.attachment ?? COAR_OVERLAY_DEFAULTS.attachment,\n };\n }\n\n private applySpecResolvers<TInputs>(spec: OverlaySpec<TInputs>): OverlaySpec<TInputs> {\n if (this.specResolvers.length === 0) return spec;\n\n let current = spec as unknown as OverlaySpec<unknown>;\n for (const resolver of this.specResolvers) {\n const next = resolver(current);\n current = (next ?? current) as OverlaySpec<unknown>;\n }\n\n return current as unknown as OverlaySpec<TInputs>;\n }\n\n private attach<TInputs>(\n spec: ResolvedOverlaySpec<TInputs>,\n inputs: TInputs,\n options?: OverlayOpenOptions\n ): OverlayRef {\n const parent = this.getInternalRefOrNull(options?.parent);\n\n // Close sibling overlays if requested (close all existing children of parent)\n if (options?.closeSiblings && parent) {\n parent.closeChildren();\n }\n\n const stackIndex = this.openOverlays.size;\n\n const effectiveSpec = this.inheritDismissFromParent(spec, parent);\n\n const ref = new CoarOverlayRef(\n this.appRef,\n this.environmentInjector,\n effectiveSpec,\n this.mergeInputs(spec.content, inputs),\n stackIndex,\n parent,\n () => {\n this.openOverlays.delete(ref);\n this.uninstallGlobalListenersIfIdle();\n }\n );\n\n this.openOverlays.add(ref);\n this.installGlobalListenersIfNeeded();\n ref.open();\n return ref;\n }\n\n private inheritDismissFromParent<TInputs>(\n spec: ResolvedOverlaySpec<TInputs>,\n parent: CoarOverlayRef | null\n ): ResolvedOverlaySpec<TInputs> {\n if (!parent) return spec;\n\n const parentHoverTree = parent.getHoverTreeDismissConfig();\n if (!parentHoverTree?.enabled) return spec;\n\n const childHoverTree = spec.dismiss.hoverTree;\n\n // Explicit disable in child wins.\n if (childHoverTree?.enabled === false) return spec;\n\n let mergedHoverTree: typeof childHoverTree;\n if (!childHoverTree) {\n mergedHoverTree = { ...parentHoverTree };\n } else {\n mergedHoverTree = {\n enabled: true,\n delayMs: childHoverTree.delayMs ?? parentHoverTree.delayMs,\n };\n }\n\n // No change.\n if (mergedHoverTree === childHoverTree) return spec;\n\n return {\n ...(spec as unknown as object),\n dismiss: {\n ...(spec.dismiss as object),\n hoverTree: mergedHoverTree,\n },\n } as ResolvedOverlaySpec<TInputs>;\n }\n\n private getInternalRefOrNull(ref: OverlayRef | undefined): CoarOverlayRef | null {\n if (!ref) return null;\n if (ref instanceof CoarOverlayRef) return ref;\n return null;\n }\n\n private installGlobalListenersIfNeeded(): void {\n if (this.globalListenersInstalled) return;\n if (typeof document === 'undefined') return;\n\n document.addEventListener('pointerdown', this.onDocumentPointerDown, { capture: true });\n document.addEventListener('keydown', this.onDocumentKeyDown, { capture: true });\n this.globalListenersInstalled = true;\n }\n\n private uninstallGlobalListenersIfIdle(): void {\n if (!this.globalListenersInstalled) return;\n if (this.openOverlays.size > 0) return;\n if (typeof document === 'undefined') return;\n\n document.removeEventListener('pointerdown', this.onDocumentPointerDown, { capture: true });\n document.removeEventListener('keydown', this.onDocumentKeyDown, { capture: true });\n this.globalListenersInstalled = false;\n }\n\n private getOpenOverlaysInOrder(): CoarOverlayRef[] {\n return Array.from(this.openOverlays);\n }\n\n private getTopmostOverlayContainingTarget(target: EventTarget | null): CoarOverlayRef | null {\n const overlays = this.getOpenOverlaysInOrder();\n\n for (let i = overlays.length - 1; i >= 0; i -= 1) {\n const overlay = overlays[i];\n if (overlay.containsEventTarget(target)) return overlay;\n }\n\n return null;\n }\n\n private getTopmostDismissableOverlay(kind: 'outsideClick' | 'escapeKey'): CoarOverlayRef | null {\n const overlays = this.getOpenOverlaysInOrder();\n\n for (let i = overlays.length - 1; i >= 0; i -= 1) {\n const overlay = overlays[i];\n if (overlay.isDismissable(kind)) {\n return overlay;\n }\n }\n\n return null;\n }\n\n private getTopmostFocusTrappingOverlay(): CoarOverlayRef | null {\n const overlays = this.getOpenOverlaysInOrder();\n\n for (let i = overlays.length - 1; i >= 0; i -= 1) {\n const overlay = overlays[i];\n if (overlay.hasFocusTrap()) {\n return overlay;\n }\n }\n\n return null;\n }\n\n private mergeInputs<TInputs>(content: ContentSpec<TInputs>, inputs: TInputs): TInputs {\n if (!content.defaults) return inputs;\n\n if (inputs == null || typeof inputs !== 'object') {\n return { ...(content.defaults as object) } as TInputs;\n }\n\n return {\n ...(content.defaults as object),\n ...(inputs as object),\n } as TInputs;\n }\n\n private renderContent<TInputs>(\n content: ContentSpec<TInputs>,\n host: HTMLElement,\n inputs: TInputs\n ): () => void {\n switch (content.kind) {\n case 'text': {\n const text = (inputs as { text: string } | null | undefined)?.text;\n if (typeof text !== 'string') {\n throw new Error('Text overlay requires inputs: { text: string }');\n }\n host.textContent = text;\n return () => {\n host.textContent = '';\n };\n }\n case 'template': {\n const template = content.template as TemplateRef<unknown> | undefined;\n if (!template) throw new Error('Template overlay requires a template');\n\n // For templates: automatically add $implicit so templates can use let-variable without property name\n // This allows both: let-context (uses $implicit) and let-prop=\"prop\" (uses specific property)\n let templateContext = inputs as unknown as object;\n if (inputs != null && typeof inputs === 'object' && !('$implicit' in (inputs as object))) {\n templateContext = {\n ...(inputs as object),\n $implicit: inputs,\n };\n }\n\n const viewRef = template.createEmbeddedView(templateContext);\n this.appRef.attachView(viewRef);\n viewRef.detectChanges();\n\n for (const node of viewRef.rootNodes) {\n host.appendChild(node);\n }\n\n return () => {\n this.appRef.detachView(viewRef);\n viewRef.destroy();\n };\n }\n case 'component': {\n const component = content.component as Type<unknown> | undefined;\n if (!component) throw new Error('Component overlay requires a component');\n\n const componentRef = createComponent(component, {\n environmentInjector: this.environmentInjector,\n hostElement: host,\n });\n\n if (inputs && typeof inputs === 'object') {\n for (const [key, value] of Object.entries(inputs as object)) {\n componentRef.setInput(key, value);\n }\n }\n\n this.appRef.attachView(componentRef.hostView);\n componentRef.changeDetectorRef.detectChanges();\n\n return () => {\n this.appRef.detachView(componentRef.hostView);\n componentRef.destroy();\n };\n }\n }\n }\n}\n\nclass CoarOverlayRef implements OverlayRef {\n private readonly afterClosedSubject = new Subject<unknown>();\n readonly afterClosed$ = this.afterClosedSubject.asObservable();\n\n get isClosed(): boolean {\n return this.closed;\n }\n\n private readonly host: HTMLElement;\n private readonly panel: HTMLElement;\n private backdropElement: HTMLElement | null = null;\n private destroyContent: (() => void) | null = null;\n private resizeObserver: ResizeObserver | null = null;\n private cleanupFns: Array<() => void> = [];\n private closed = false;\n private lastResult: unknown;\n private rafPending = false;\n private presented = false;\n private closeFinalized = false;\n private readonly restoreFocusTarget: Element | null;\n private readonly children = new Set<CoarOverlayRef>();\n private hoverCloseTimer: ReturnType<typeof setTimeout> | null = null;\n private readonly contentInjector: Injector;\n private readonly contentEnvironmentInjector: EnvironmentInjector;\n private readonly shouldAnimateMenu: boolean;\n\n constructor(\n private readonly appRef: ApplicationRef,\n private readonly environmentInjector: EnvironmentInjector,\n private readonly spec: ResolvedOverlaySpec<unknown>,\n private readonly inputs: unknown,\n private readonly stackIndex: number,\n private readonly parent: CoarOverlayRef | null,\n private readonly onClosed: () => void\n ) {\n this.host = document.createElement('div');\n this.host.className = 'coar-overlay-host';\n\n this.panel = document.createElement('div');\n this.panel.className = 'coar-overlay-panel';\n this.host.appendChild(this.panel);\n\n this.shouldAnimateMenu = this.spec.a11y.role === 'menu';\n\n this.contentInjector = Injector.create({\n providers: [\n { provide: COAR_OVERLAY_REF, useValue: this },\n { provide: COAR_MENU_PARENT, useValue: this },\n ],\n parent: this.environmentInjector,\n });\n\n this.contentEnvironmentInjector = createEnvironmentInjector(\n [\n { provide: COAR_OVERLAY_REF, useValue: this },\n { provide: COAR_MENU_PARENT, useValue: this },\n ],\n this.environmentInjector\n );\n\n Object.assign(this.host.style, {\n position: 'fixed',\n top: '0px',\n left: '0px',\n transform: 'translate3d(0px, 0px, 0px)',\n zIndex: `calc(var(--coar-z-overlay, 1000) + ${this.stackIndex * 2})`,\n opacity: '1',\n pointerEvents: 'none',\n } satisfies Partial<CSSStyleDeclaration>);\n\n if (this.shouldAnimateMenu) {\n Object.assign(this.panel.style, {\n opacity: '0',\n transition: 'opacity var(--coar-duration-slower) var(--coar-ease-out)',\n willChange: 'opacity',\n } satisfies Partial<CSSStyleDeclaration>);\n }\n\n this.restoreFocusTarget =\n (typeof document !== 'undefined' ? document.activeElement : null) ?? null;\n\n if (this.parent) {\n this.parent.children.add(this);\n }\n }\n\n getHoverTreeDismissConfig(): { enabled?: boolean; delayMs?: number } | undefined {\n return this.spec.dismiss.hoverTree;\n }\n\n getPanelElement(): HTMLElement {\n return this.panel;\n }\n\n getRoot(): CoarOverlayRef {\n return this.parent?.getRoot() ?? this;\n }\n\n closeChildren(exclude?: CoarOverlayRef): void {\n for (const child of Array.from(this.children)) {\n if (child !== exclude) {\n // Recursively close descendants first (depth-first)\n child.closeChildren();\n // Then close this child\n child.close();\n }\n }\n }\n\n /**\n * Close all sibling overlays (other children of the same parent).\n * Used when opening a new child overlay with closeSiblings option.\n */\n closeSiblings(): void {\n if (this.parent) {\n for (const sibling of Array.from(this.parent.children)) {\n if (sibling !== this) {\n sibling.close();\n }\n }\n }\n }\n\n open(): void {\n const backdrop = this.spec.backdrop;\n if (backdrop.kind === 'modal') {\n const backdropEl = document.createElement('div');\n backdropEl.className = 'coar-overlay-backdrop';\n\n Object.assign(backdropEl.style, {\n position: 'fixed',\n top: '0px',\n left: '0px',\n right: '0px',\n bottom: '0px',\n background: 'color-mix(in srgb, var(--coar-color-black) 40%, transparent)',\n zIndex: `calc(var(--coar-z-overlay-backdrop, 999) + ${this.stackIndex * 2})`,\n } satisfies Partial<CSSStyleDeclaration>);\n\n document.body.appendChild(backdropEl);\n this.backdropElement = backdropEl;\n\n if (backdrop.closeOnBackdropClick !== false) {\n const onClick = (e: MouseEvent) => {\n if (e.target === backdropEl) {\n this.close();\n }\n };\n\n backdropEl.addEventListener('click', onClick);\n this.cleanupFns.push(() => backdropEl.removeEventListener('click', onClick));\n }\n }\n\n // Attach overlay to the appropriate parent based on attachment strategy\n const attachment = this.spec.attachment;\n const attachmentParent =\n attachment.strategy === 'parent' ? attachment.container : document.body;\n attachmentParent.appendChild(this.host);\n\n this.installHoverTreeDismissIfEnabled();\n\n this.applyA11y();\n\n this.destroyContent = this.renderContent(this.spec.content, this.panel, this.inputs);\n\n this.applySize();\n\n if (this.spec.focus.trap) {\n this.installFocusTrap();\n }\n\n this.installRepositionTriggers();\n this.updatePosition();\n }\n\n private installHoverTreeDismissIfEnabled(): void {\n const hoverTree = this.spec.dismiss.hoverTree;\n if (!hoverTree?.enabled) return;\n\n const delayMs = typeof hoverTree.delayMs === 'number' ? hoverTree.delayMs : 300;\n\n const onEnter = () => {\n this.cancelHoverCloseUpTree();\n };\n\n const onHostLeave = () => {\n this.scheduleHoverCloseUpTree(delayMs);\n };\n\n // Important: an overlay's anchor element can be *inside* its parent overlay (submenu items).\n // Leaving that anchor while still hovering the parent overlay should not schedule closing\n // the parent/grandparent overlays; only this (leaf) overlay should be eligible to close.\n const onAnchorLeave = () => {\n this.scheduleHoverClose(delayMs);\n };\n\n this.host.addEventListener('pointerenter', onEnter);\n this.host.addEventListener('pointerleave', onHostLeave);\n this.cleanupFns.push(() => {\n this.host.removeEventListener('pointerenter', onEnter);\n this.host.removeEventListener('pointerleave', onHostLeave);\n this.cancelHoverClose();\n });\n\n if (this.spec.anchor.kind === 'element') {\n const el = this.spec.anchor.element;\n el.addEventListener('pointerenter', onEnter);\n el.addEventListener('pointerleave', onAnchorLeave);\n this.cleanupFns.push(() => {\n el.removeEventListener('pointerenter', onEnter);\n el.removeEventListener('pointerleave', onAnchorLeave);\n });\n }\n }\n\n private cancelHoverClose(): void {\n if (!this.hoverCloseTimer) return;\n clearTimeout(this.hoverCloseTimer);\n this.hoverCloseTimer = null;\n }\n\n private cancelHoverCloseUpTree(): void {\n this.cancelHoverClose();\n this.parent?.cancelHoverCloseUpTree();\n }\n\n private scheduleHoverClose(delayMs: number): void {\n const hoverTree = this.spec.dismiss.hoverTree;\n if (!hoverTree?.enabled) return;\n\n this.cancelHoverClose();\n this.hoverCloseTimer = setTimeout(() => {\n this.hoverCloseTimer = null;\n this.close();\n }, delayMs);\n }\n\n private scheduleHoverCloseUpTree(delayMs: number): void {\n this.scheduleHoverClose(delayMs);\n this.parent?.scheduleHoverCloseUpTree(delayMs);\n }\n\n hasFocusTrap(): boolean {\n return this.spec.focus.trap === true;\n }\n\n isDismissable(kind: 'outsideClick' | 'escapeKey'): boolean {\n if (kind === 'outsideClick') {\n return this.spec.dismiss.outsideClick !== false;\n }\n\n return this.spec.dismiss.escapeKey !== false;\n }\n\n containsEventTarget(target: EventTarget | null): boolean {\n if (!(target instanceof Node)) return false;\n if (this.host.contains(target)) return true;\n if (this.backdropElement?.contains(target)) return true;\n\n // Also check if click is on the anchor element (e.g., select trigger)\n // to prevent closing when clicking the trigger that opened the overlay\n if (this.spec.anchor.kind === 'element') {\n if (this.spec.anchor.element.contains(target)) return true;\n }\n\n return false;\n }\n\n handleTabKey(event: KeyboardEvent): boolean {\n if (!this.spec.focus.trap) return false;\n\n const focusables = this.getFocusableElements();\n if (focusables.length === 0) {\n this.focusElement(this.host);\n return true;\n }\n\n const first = focusables[0];\n const last = focusables[focusables.length - 1];\n\n const active = document.activeElement;\n const isActiveInside =\n active instanceof Node && (this.host.contains(active) || active === this.host);\n\n // If focus is outside, bring it inside.\n if (!isActiveInside) {\n this.focusElement(event.shiftKey ? last : first);\n return true;\n }\n\n if (event.shiftKey) {\n if (active === first || active === this.host) {\n this.focusElement(last);\n return true;\n }\n return false;\n }\n\n if (active === last) {\n this.focusElement(first);\n return true;\n }\n\n return false;\n }\n\n updatePosition(): void {\n if (this.closed) return;\n if (this.rafPending) return;\n this.rafPending = true;\n\n this.schedule(() => {\n this.rafPending = false;\n if (this.closed) return;\n\n const viewport = getViewportRect();\n const anchorRect = getAnchorRect(this.spec.anchor, viewport);\n\n const rect = this.host.getBoundingClientRect();\n const overlaySize = {\n width: rect.width,\n height: rect.height,\n };\n\n // For parent-attached overlays, use container boundaries instead of viewport\n const attachment = this.spec.attachment;\n const boundaryRect =\n attachment.strategy === 'parent' ? getContainerRect(attachment.container) : undefined;\n\n const coords = computeOverlayCoordinates(\n anchorRect,\n overlaySize,\n this.spec.position,\n viewport,\n boundaryRect\n );\n this.host.style.transform = `translate3d(${Math.round(coords.left)}px, ${Math.round(\n coords.top\n )}px, 0px)`;\n this.present();\n });\n }\n\n private present(): void {\n if (this.presented) return;\n this.presented = true;\n\n if (this.shouldAnimateMenu) {\n // Ensure the initial opacity=0 is committed before we flip to 1,\n // otherwise some browsers skip the transition on first paint.\n void this.panel.getBoundingClientRect();\n }\n\n this.host.style.pointerEvents = 'auto';\n\n if (this.shouldAnimateMenu) {\n this.panel.style.opacity = '1';\n }\n }\n\n close(result?: unknown): void {\n if (this.closed) return;\n this.closed = true;\n this.lastResult = result;\n\n this.cancelHoverClose();\n\n // Ensure overlay trees (menus/submenus) close consistently.\n this.closeChildren();\n\n for (const cleanup of this.cleanupFns) {\n cleanup();\n }\n this.cleanupFns = [];\n\n this.resizeObserver?.disconnect();\n this.resizeObserver = null;\n\n // Begin visual close (menu overlays only). We keep the host in the DOM\n // briefly so opacity can transition to 0, then tear down.\n if (this.shouldAnimateMenu && this.presented) {\n this.host.style.pointerEvents = 'none';\n this.panel.style.opacity = '0';\n\n const finalizeOnce = () => {\n this.finalizeClose();\n };\n\n let fallbackTimer: ReturnType<typeof setTimeout> | null = null;\n\n const onEnd = (e: TransitionEvent) => {\n if (e.target === this.panel && e.propertyName === 'opacity') {\n this.host.removeEventListener('transitionend', onEnd);\n if (fallbackTimer) {\n clearTimeout(fallbackTimer);\n fallbackTimer = null;\n }\n finalizeOnce();\n }\n };\n\n this.host.addEventListener('transitionend', onEnd);\n\n const fallbackMs = this.getMaxTransitionTimeMs();\n if (fallbackMs === 0) {\n this.host.removeEventListener('transitionend', onEnd);\n finalizeOnce();\n } else {\n fallbackTimer = setTimeout(() => {\n this.host.removeEventListener('transitionend', onEnd);\n finalizeOnce();\n }, fallbackMs);\n }\n\n return;\n }\n\n this.finalizeClose();\n }\n\n private finalizeClose(): void {\n if (this.closeFinalized) return;\n this.closeFinalized = true;\n\n this.destroyContent?.();\n this.destroyContent = null;\n this.host.remove();\n this.backdropElement?.remove();\n this.backdropElement = null;\n\n if (this.spec.focus.restore !== false) {\n const el = this.restoreFocusTarget as HTMLElement | null;\n if (el && typeof el.focus === 'function') {\n try {\n el.focus({ preventScroll: true });\n } catch {\n try {\n el.focus();\n } catch {\n // noop\n }\n }\n }\n }\n\n this.afterClosedSubject.next(this.lastResult);\n this.afterClosedSubject.complete();\n\n this.parent?.children.delete(this);\n this.onClosed();\n }\n\n private getMaxTransitionTimeMs(): number {\n if (typeof getComputedStyle === 'undefined') return 0;\n\n const style = getComputedStyle(this.panel);\n const durations = style.transitionDuration.split(',').map((v) => v.trim());\n const delays = style.transitionDelay.split(',').map((v) => v.trim());\n const entries = Math.max(durations.length, delays.length);\n\n let maxMs = 0;\n for (let i = 0; i < entries; i++) {\n const duration = durations[i] ?? durations[durations.length - 1] ?? '0ms';\n const delay = delays[i] ?? delays[delays.length - 1] ?? '0ms';\n const ms = this.parseCssTimeToMs(duration) + this.parseCssTimeToMs(delay);\n maxMs = Math.max(maxMs, ms);\n }\n\n return maxMs;\n }\n\n private parseCssTimeToMs(value: string): number {\n const v = value.trim();\n if (!v) return 0;\n if (v.endsWith('ms')) {\n const n = Number(v.slice(0, -2));\n return Number.isFinite(n) ? n : 0;\n }\n if (v.endsWith('s')) {\n const n = Number(v.slice(0, -1));\n return Number.isFinite(n) ? n * 1000 : 0;\n }\n const n = Number(v);\n return Number.isFinite(n) ? n : 0;\n }\n\n private installFocusTrap(): void {\n // Ensure the host can receive programmatic focus as a fallback.\n this.host.tabIndex = -1;\n\n // Move focus into the overlay on open (best-effort).\n this.schedule(() => {\n if (this.closed) return;\n const focusables = this.getFocusableElements();\n this.focusElement(focusables[0] ?? this.host);\n });\n }\n\n private applySize(): void {\n const size = this.spec.size;\n if (!size) return;\n\n const viewport = getViewportRect();\n\n const resolveMin = (\n value: number | 'anchor' | undefined,\n anchorSize: number\n ): number | null => {\n if (value === 'anchor') return anchorSize;\n if (typeof value === 'number') return value;\n return null;\n };\n\n const resolveMax = (\n value: number | 'viewport' | undefined,\n viewportSize: number\n ): number | null => {\n if (value === 'viewport') return viewportSize;\n if (typeof value === 'number') return value;\n return null;\n };\n\n const anchorRect = getAnchorRect(this.spec.anchor, viewport);\n const minWidthPx = resolveMin(size.minWidth, anchorRect.width);\n const minHeightPx = resolveMin(size.minHeight, anchorRect.height);\n\n const maxWidthPx = resolveMax(size.maxWidth, viewport.width);\n const maxHeightPx = resolveMax(size.maxHeight, viewport.height);\n\n // Reset in case an overlay host is re-used in the future.\n this.host.style.width = '';\n this.host.style.height = '';\n this.host.style.minWidth = '';\n this.host.style.minHeight = '';\n this.host.style.maxWidth = '';\n this.host.style.maxHeight = '';\n this.host.style.overflow = '';\n\n if (minWidthPx != null && minWidthPx > 0) this.host.style.minWidth = `${minWidthPx}px`;\n if (minHeightPx != null && minHeightPx > 0) this.host.style.minHeight = `${minHeightPx}px`;\n\n if (size.mode === 'content') {\n return;\n }\n\n if (size.mode === 'content-clamped') {\n if (maxWidthPx != null) this.host.style.maxWidth = `${maxWidthPx}px`;\n if (maxHeightPx != null) this.host.style.maxHeight = `${maxHeightPx}px`;\n this.host.style.overflow = 'auto';\n return;\n }\n\n // mode: 'fixed'\n if (maxWidthPx != null) this.host.style.width = `${maxWidthPx}px`;\n if (maxHeightPx != null) this.host.style.height = `${maxHeightPx}px`;\n this.host.style.overflow = 'auto';\n }\n\n private applyA11y(): void {\n const a11y = this.spec.a11y;\n if (!a11y) return;\n\n if (a11y.role) {\n this.host.setAttribute('role', a11y.role);\n }\n\n this.setAttrIfDefined('aria-label', a11y.label);\n this.setAttrIfDefined('aria-labelledby', a11y.labelledBy);\n this.setAttrIfDefined('aria-describedby', a11y.describedBy);\n\n if (a11y.role === 'dialog' && this.spec.backdrop.kind === 'modal') {\n this.host.setAttribute('aria-modal', 'true');\n }\n }\n\n private setAttrIfDefined(name: string, value: string | undefined): void {\n if (typeof value === 'string' && value.length > 0) {\n this.host.setAttribute(name, value);\n return;\n }\n\n this.host.removeAttribute(name);\n }\n\n private focusElement(el: HTMLElement): void {\n try {\n el.focus({ preventScroll: true });\n } catch {\n try {\n el.focus();\n } catch {\n // noop\n }\n }\n }\n\n private getFocusableElements(): HTMLElement[] {\n const candidates = Array.from(\n this.host.querySelectorAll<HTMLElement>(\n 'a[href],button:not([disabled]),input:not([disabled]),select:not([disabled]),textarea:not([disabled]),[tabindex]:not([tabindex=\"-1\"]),[contenteditable=\"true\"]'\n )\n );\n\n return candidates.filter((el) => !this.isHidden(el));\n }\n\n private isHidden(el: HTMLElement): boolean {\n // Avoid using offsetParent as it behaves poorly in some environments (e.g. JSDOM).\n if (el.hasAttribute('hidden')) return true;\n if (el.getAttribute('aria-hidden') === 'true') return true;\n const style = el.style;\n if (style.display === 'none' || style.visibility === 'hidden') return true;\n return false;\n }\n\n private installRepositionTriggers(): void {\n const strategy = this.spec.scroll.strategy;\n if (strategy === 'noop') return;\n\n const scrollParents =\n this.spec.anchor.kind === 'element' ? getScrollParents(this.spec.anchor.element) : [window];\n\n if (strategy === 'reposition') {\n const onScroll = () => this.updatePosition();\n const onResize = () => this.updatePosition();\n\n for (const parent of scrollParents) {\n if (parent === window) {\n window.addEventListener('scroll', onScroll, { passive: true });\n this.cleanupFns.push(() => window.removeEventListener('scroll', onScroll));\n continue;\n }\n\n parent.addEventListener('scroll', onScroll, { passive: true });\n this.cleanupFns.push(() => parent.removeEventListener('scroll', onScroll));\n }\n\n window.addEventListener('resize', onResize, { passive: true });\n this.cleanupFns.push(() => window.removeEventListener('resize', onResize));\n\n if (typeof ResizeObserver !== 'undefined') {\n const ro = new ResizeObserver(() => this.updatePosition());\n ro.observe(this.host);\n this.resizeObserver = ro;\n }\n\n return;\n }\n\n if (strategy === 'close') {\n const onScroll = (e: Event) => {\n const target = e.target;\n if (target instanceof Node && this.host.contains(target)) return;\n this.close();\n };\n\n if (typeof document !== 'undefined') {\n document.addEventListener('scroll', onScroll, { passive: true, capture: true });\n this.cleanupFns.push(() =>\n document.removeEventListener('scroll', onScroll, { capture: true })\n );\n }\n\n // Fallback for environments where scroll is only observed on window.\n window.addEventListener('scroll', onScroll, { passive: true });\n this.cleanupFns.push(() => window.removeEventListener('scroll', onScroll));\n\n // Also attach to explicit scroll parents for element anchors (helps non-standard event targets).\n for (const parent of scrollParents) {\n if (parent === window) continue;\n parent.addEventListener('scroll', onScroll, { passive: true });\n this.cleanupFns.push(() => parent.removeEventListener('scroll', onScroll));\n }\n\n // Still reposition on size changes while open.\n if (typeof ResizeObserver !== 'undefined') {\n const ro = new ResizeObserver(() => this.updatePosition());\n ro.observe(this.host);\n this.resizeObserver = ro;\n }\n }\n }\n\n private schedule(fn: () => void): void {\n if (typeof requestAnimationFrame !== 'undefined') {\n requestAnimationFrame(() => fn());\n return;\n }\n\n setTimeout(() => fn(), 0);\n }\n\n private renderContent<TInputs>(\n content: ContentSpec<TInputs>,\n host: HTMLElement,\n inputs: TInputs\n ): () => void {\n switch (content.kind) {\n case 'text': {\n const text = (inputs as { text: string } | null | undefined)?.text;\n if (typeof text !== 'string') {\n throw new Error('Text overlay requires inputs: { text: string }');\n }\n host.textContent = text;\n return () => {\n host.textContent = '';\n };\n }\n case 'template': {\n const template = content.template as TemplateRef<unknown> | undefined;\n if (!template) throw new Error('Template overlay requires a template');\n\n const viewRef = template.createEmbeddedView(\n inputs as unknown as object,\n this.contentInjector\n );\n this.appRef.attachView(viewRef);\n viewRef.detectChanges();\n\n for (const node of viewRef.rootNodes) {\n host.appendChild(node);\n }\n\n return () => {\n this.appRef.detachView(viewRef);\n viewRef.destroy();\n };\n }\n case 'component': {\n const component = content.component as Type<unknown> | undefined;\n if (!component) throw new Error('Component overlay requires a component');\n\n const componentRef = createComponent(component, {\n environmentInjector: this.contentEnvironmentInjector,\n hostElement: host,\n });\n\n if (inputs && typeof inputs === 'object') {\n for (const [key, value] of Object.entries(inputs as object)) {\n componentRef.setInput(key, value);\n }\n }\n\n this.appRef.attachView(componentRef.hostView);\n componentRef.changeDetectorRef.detectChanges();\n\n return () => {\n this.appRef.detachView(componentRef.hostView);\n componentRef.destroy();\n };\n }\n }\n }\n}\n","import { type OverlayBuilder } from './overlay-builder';\n\nexport type OverlayPreset = (b: OverlayBuilder) => void;\n\nexport const coarTooltipPreset: OverlayPreset = (b) => {\n b.backdrop('none');\n b.scroll({ strategy: 'noop' });\n b.dismiss({ outsideClick: false, escapeKey: false });\n b.a11y({ role: 'tooltip' });\n b.position({\n placement: ['top', 'bottom', 'left', 'right'],\n offset: 8,\n flip: true,\n shift: true,\n });\n b.attachment({ strategy: 'body' });\n};\n\nexport const coarModalPreset: OverlayPreset = (b) => {\n b.backdrop('modal');\n b.anchor({ kind: 'virtual', placement: 'center' });\n b.focus({ trap: true, restore: true });\n b.size({ mode: 'content-clamped', maxWidth: 'viewport', maxHeight: 'viewport' });\n b.position({ placement: 'center', offset: 0, flip: false, shift: true });\n b.a11y({ role: 'dialog' });\n b.attachment({ strategy: 'body' });\n};\n\nexport const coarMenuPreset: OverlayPreset = (b) => {\n b.backdrop('none');\n b.scroll({ strategy: 'close' });\n b.dismiss({ outsideClick: true, escapeKey: true });\n b.focus({ trap: false, restore: true });\n b.a11y({ role: 'menu' });\n // Provide fallback placements so the overlay can choose a side that fits.\n // Start/end variants help when the anchor is near the viewport edges.\n b.position({\n placement: ['bottom-start', 'bottom-end', 'top-start', 'top-end'],\n offset: 4,\n flip: true,\n shift: true,\n });\n};\n\n/**\n * Menu preset for hover-driven menus (context menus, cascading flyouts).\n *\n * Enables hoverTree dismissal so a parent overlay stays open while the pointer\n * is inside any child overlay opened via openChild().\n */\nexport const coarHoverMenuPreset: OverlayPreset = (b) => {\n coarMenuPreset(b);\n b.dismiss({\n outsideClick: true,\n escapeKey: true,\n hoverTree: { enabled: true, delayMs: 300 },\n });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