ngwr 14.4.0 → 14.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/fesm2022/ngwr-breadcrumbs.mjs +2 -2
- package/fesm2022/ngwr-breadcrumbs.mjs.map +1 -1
- package/fesm2022/ngwr-cascader.mjs +15 -3
- package/fesm2022/ngwr-cascader.mjs.map +1 -1
- package/fesm2022/ngwr-color-picker.mjs +18 -2
- package/fesm2022/ngwr-color-picker.mjs.map +1 -1
- package/fesm2022/ngwr-context-menu.mjs +35 -3
- package/fesm2022/ngwr-context-menu.mjs.map +1 -1
- package/fesm2022/ngwr-date-picker.mjs +30 -2
- package/fesm2022/ngwr-date-picker.mjs.map +1 -1
- package/fesm2022/ngwr-dialog.mjs +12 -1
- package/fesm2022/ngwr-dialog.mjs.map +1 -1
- package/fesm2022/ngwr-drag-drop.mjs +2 -2
- package/fesm2022/ngwr-drag-drop.mjs.map +1 -1
- package/fesm2022/ngwr-drawer.mjs +48 -2
- package/fesm2022/ngwr-drawer.mjs.map +1 -1
- package/fesm2022/ngwr-dropdown.mjs +22 -2
- package/fesm2022/ngwr-dropdown.mjs.map +1 -1
- package/fesm2022/ngwr-graph-testing.mjs +243 -0
- package/fesm2022/ngwr-graph-testing.mjs.map +1 -0
- package/fesm2022/ngwr-graph.mjs +1112 -0
- package/fesm2022/ngwr-graph.mjs.map +1 -0
- package/fesm2022/ngwr-i18n-ar.mjs +5 -0
- package/fesm2022/ngwr-i18n-ar.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-cs.mjs +5 -0
- package/fesm2022/ngwr-i18n-cs.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-de.mjs +5 -0
- package/fesm2022/ngwr-i18n-de.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-en.mjs +9 -0
- package/fesm2022/ngwr-i18n-en.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-es.mjs +5 -0
- package/fesm2022/ngwr-i18n-es.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-fr.mjs +5 -0
- package/fesm2022/ngwr-i18n-fr.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-he.mjs +5 -0
- package/fesm2022/ngwr-i18n-he.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-hi.mjs +5 -0
- package/fesm2022/ngwr-i18n-hi.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-id.mjs +5 -0
- package/fesm2022/ngwr-i18n-id.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-it.mjs +5 -0
- package/fesm2022/ngwr-i18n-it.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-ja.mjs +5 -0
- package/fesm2022/ngwr-i18n-ja.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-ko.mjs +5 -0
- package/fesm2022/ngwr-i18n-ko.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-nl.mjs +5 -0
- package/fesm2022/ngwr-i18n-nl.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-pl.mjs +5 -0
- package/fesm2022/ngwr-i18n-pl.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-pt.mjs +5 -0
- package/fesm2022/ngwr-i18n-pt.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-ru.mjs +5 -0
- package/fesm2022/ngwr-i18n-ru.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-sv.mjs +5 -0
- package/fesm2022/ngwr-i18n-sv.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-tr.mjs +5 -0
- package/fesm2022/ngwr-i18n-tr.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-uk.mjs +5 -0
- package/fesm2022/ngwr-i18n-uk.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-vi.mjs +5 -0
- package/fesm2022/ngwr-i18n-vi.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-zh-TW.mjs +5 -0
- package/fesm2022/ngwr-i18n-zh-TW.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-zh.mjs +5 -0
- package/fesm2022/ngwr-i18n-zh.mjs.map +1 -1
- package/fesm2022/ngwr-lightbox.mjs +25 -4
- package/fesm2022/ngwr-lightbox.mjs.map +1 -1
- package/fesm2022/ngwr-list.mjs +2 -2
- package/fesm2022/ngwr-list.mjs.map +1 -1
- package/fesm2022/ngwr-mention.mjs +18 -2
- package/fesm2022/ngwr-mention.mjs.map +1 -1
- package/fesm2022/ngwr-overlay.mjs +119 -4
- package/fesm2022/ngwr-overlay.mjs.map +1 -1
- package/fesm2022/ngwr-popconfirm.mjs +19 -3
- package/fesm2022/ngwr-popconfirm.mjs.map +1 -1
- package/fesm2022/ngwr-popover-testing.mjs +22 -5
- package/fesm2022/ngwr-popover-testing.mjs.map +1 -1
- package/fesm2022/ngwr-popover.mjs +215 -27
- package/fesm2022/ngwr-popover.mjs.map +1 -1
- package/fesm2022/ngwr-segmented.mjs +34 -1
- package/fesm2022/ngwr-segmented.mjs.map +1 -1
- package/fesm2022/ngwr-select.mjs +15 -1
- package/fesm2022/ngwr-select.mjs.map +1 -1
- package/fesm2022/ngwr-toast.mjs +19 -2
- package/fesm2022/ngwr-toast.mjs.map +1 -1
- package/fesm2022/ngwr-tour.mjs +20 -6
- package/fesm2022/ngwr-tour.mjs.map +1 -1
- package/fesm2022/ngwr-tree.mjs +9 -2
- package/fesm2022/ngwr-tree.mjs.map +1 -1
- package/fesm2022/ngwr-version.mjs +1 -1
- package/fesm2022/ngwr-version.mjs.map +1 -1
- package/fesm2022/ngwr-window.mjs +18 -1
- package/fesm2022/ngwr-window.mjs.map +1 -1
- package/graph/styles/_index.scss +113 -0
- package/i18n/ar.json +5 -0
- package/i18n/cs.json +5 -0
- package/i18n/de.json +5 -0
- package/i18n/en.json +5 -0
- package/i18n/es.json +5 -0
- package/i18n/fr.json +5 -0
- package/i18n/he.json +5 -0
- package/i18n/hi.json +5 -0
- package/i18n/id.json +5 -0
- package/i18n/it.json +5 -0
- package/i18n/ja.json +5 -0
- package/i18n/ko.json +5 -0
- package/i18n/nl.json +5 -0
- package/i18n/pl.json +5 -0
- package/i18n/pt.json +5 -0
- package/i18n/ru.json +5 -0
- package/i18n/sv.json +5 -0
- package/i18n/tr.json +5 -0
- package/i18n/uk.json +5 -0
- package/i18n/vi.json +5 -0
- package/i18n/zh-TW.json +5 -0
- package/i18n/zh.json +5 -0
- package/llms-full.txt +12 -2
- package/llms.txt +8 -6
- package/package.json +10 -1
- package/schematics/use/symbol-map.json +2 -0
- package/segmented/styles/_index.scss +8 -0
- package/skills/ngwr/SKILL.md +1 -1
- package/skills/ngwr/references/catalog.md +2 -0
- package/styles.scss +1 -0
- package/theme/styles/_focus.scss +7 -0
- package/types/ngwr-cascader.d.ts +7 -0
- package/types/ngwr-color-picker.d.ts +8 -0
- package/types/ngwr-context-menu.d.ts +10 -0
- package/types/ngwr-date-picker.d.ts +16 -0
- package/types/ngwr-dialog.d.ts +1 -0
- package/types/ngwr-drawer.d.ts +28 -0
- package/types/ngwr-dropdown.d.ts +9 -0
- package/types/ngwr-graph-testing.d.ts +190 -0
- package/types/ngwr-graph.d.ts +203 -0
- package/types/ngwr-lightbox.d.ts +15 -0
- package/types/ngwr-mention.d.ts +7 -0
- package/types/ngwr-overlay.d.ts +62 -4
- package/types/ngwr-popconfirm.d.ts +1 -0
- package/types/ngwr-popover-testing.d.ts +22 -5
- package/types/ngwr-popover.d.ts +28 -8
- package/types/ngwr-segmented.d.ts +16 -0
- package/types/ngwr-select.d.ts +7 -0
- package/types/ngwr-toast.d.ts +2 -0
- package/types/ngwr-tour.d.ts +6 -0
- package/types/ngwr-tree.d.ts +2 -1
- package/types/ngwr-version.d.ts +1 -1
- package/types/ngwr-window.d.ts +1 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ngwr-mention.mjs","sources":["../../../projects/lib/mention/caret.ts","../../../projects/lib/mention/mention-panel.ts","../../../projects/lib/mention/mention-panel.html","../../../projects/lib/mention/mention.ts","../../../projects/lib/mention/ngwr-mention.ts"],"sourcesContent":["/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\n/**\n * CSS properties whose values must be copied onto the mirror to match layout.\n *\n * `as const satisfies` keeps each name checked against `CSSStyleDeclaration`\n * while narrowing the element type to these string-valued literals — the wider\n * `keyof CSSStyleDeclaration` also spans its methods (`setProperty`, `item`, …),\n * which makes the indexed read below look like an unbound method.\n */\nconst MIRROR_PROPS = [\n 'boxSizing',\n // Without this the mirror inherits `<body>`'s direction, and the two disagree\n // whenever the field carries its own `dir` — measured at 230px of error for a\n // 320px RTL field inside an LTR page, which put the panel outside the field\n // entirely. `textAlign` below is the same story from the other side: an RTL\n // field's computed value is the logical `start`, which only resolves to the\n // right edge once the mirror knows the direction.\n 'direction',\n 'width',\n 'height',\n 'overflowX',\n 'overflowY',\n 'borderTopWidth',\n 'borderRightWidth',\n 'borderBottomWidth',\n 'borderLeftWidth',\n 'paddingTop',\n 'paddingRight',\n 'paddingBottom',\n 'paddingLeft',\n 'fontStyle',\n 'fontVariant',\n 'fontWeight',\n 'fontStretch',\n 'fontSize',\n 'fontSizeAdjust',\n 'lineHeight',\n 'fontFamily',\n 'textAlign',\n 'textTransform',\n 'textIndent',\n 'textDecoration',\n 'letterSpacing',\n 'wordSpacing',\n 'tabSize',\n 'whiteSpace',\n 'wordWrap',\n] as const satisfies readonly (keyof CSSStyleDeclaration)[];\n\n/** A caret has no size, and an environment with no layout has no rects at all. */\nconst NO_RECT = { top: 0, left: 0 } as const;\n\n/**\n * Where the browser would draw the caret this collapsed `range` marks.\n *\n * `getClientRects()` before `getBoundingClientRect()`: a collapsed range at a\n * bidi boundary has TWO candidate positions and reports both, and the bounding\n * box of the pair spans the whole run between them. The first rect is the one\n * the caret is actually painted at.\n *\n * Both are optional-called because jsdom implements NEITHER on `Range` — it lays\n * nothing out, so every element rect in it is already 0×0 and a zero here keeps\n * the function answering what the rest of that environment answers rather than\n * throwing halfway through an unrelated spec.\n */\nfunction caretRectOf(range: Range): { readonly top: number; readonly left: number } {\n const rects = range.getClientRects?.();\n if (rects && rects.length > 0) return rects[0];\n return range.getBoundingClientRect?.() ?? NO_RECT;\n}\n\n/**\n * Compute the viewport coordinates of a textarea / input caret at a given\n * `position`. Uses the \"mirror div\" technique — a hidden div with the same\n * styling holds the field's text, and a COLLAPSED RANGE at `position` reports\n * where the caret would be.\n *\n * Returns viewport-relative `{ top, left }` — pass straight to a CDK\n * Overlay anchored at that point.\n *\n * **A range, not a probe span, and the difference only shows in RTL.** The\n * classic version of this technique puts the text before the caret in the div,\n * the text after it in a `<span>`, and reads the span's LEFT edge. That reads\n * the caret's side of the boundary only while the text runs left to right. Under\n * the Unicode BiDi algorithm the span can be laid out to the LEFT of the run it\n * follows, so the edge that faces the caret is its right one — and which edge\n * that is depends on the bidi level of the text at the caret, not on the field's\n * direction, so there is no side to pick. A collapsed range asks the browser\n * where it would draw the caret and gets the reordering for free. Measured\n * against a `contenteditable` twin of the field, in Chromium: the range agrees\n * to within a pixel for Latin, Arabic and mixed text in both directions, where\n * the span was out by up to 300px in RTL (see the spec next door).\n *\n * The `<input>` branch keeps the field's WIDTH for the same reason. It used to\n * force `width: auto` so a long single line could not wrap; but an RTL field\n * right-aligns its text inside its own box, so a shrink-to-fit mirror throws\n * away the only measurement that decides where the text starts. `overflow:\n * hidden` is what keeps the overflow from painting, and `input.scrollLeft`\n * already accounts for a field scrolled past its box.\n */\nexport function getCaretCoordinates(\n input: HTMLTextAreaElement | HTMLInputElement,\n position: number\n): { top: number; left: number; lineHeight: number } {\n const doc = input.ownerDocument;\n const style = getComputedStyle(input);\n const mirror = doc.createElement('div');\n\n for (const prop of MIRROR_PROPS) {\n mirror.style[prop] = style[prop];\n }\n mirror.style.position = 'absolute';\n mirror.style.visibility = 'hidden';\n mirror.style.top = '0';\n mirror.style.left = '0';\n mirror.style.whiteSpace = 'pre-wrap';\n mirror.style.wordWrap = 'break-word';\n\n // <input> is single-line — force whitespace behaviour so coords are sane.\n if (input.tagName === 'INPUT') {\n mirror.style.whiteSpace = 'pre';\n mirror.style.height = 'auto';\n mirror.style.overflow = 'hidden';\n }\n\n // One text node, so the range can address any offset in it. An empty field\n // still needs a line box to measure, hence the fallback character.\n const text = doc.createTextNode(input.value || '.');\n mirror.appendChild(text);\n\n doc.body.appendChild(mirror);\n const range = doc.createRange();\n range.setStart(text, Math.min(position, text.length));\n range.collapse(true);\n const caretRect = caretRectOf(range);\n const mirrorRect = mirror.getBoundingClientRect();\n const lineHeight = parseFloat(style.lineHeight) || parseFloat(style.fontSize) * 1.2;\n doc.body.removeChild(mirror);\n\n const inputRect = input.getBoundingClientRect();\n return {\n top: inputRect.top + (caretRect.top - mirrorRect.top) - input.scrollTop,\n left: inputRect.left + (caretRect.left - mirrorRect.left) - input.scrollLeft,\n lineHeight,\n };\n}\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { Component, ViewEncapsulation, input, output } from '@angular/core';\n\nimport type { WrMentionItem } from './interfaces';\n\n/**\n * The id of the option at `index`, given the listbox's own id.\n *\n * Lives here, and is used from both sides, because this format is a contract\n * between two files: the panel stamps it onto each `<li>`, and the directive\n * names one of them in `aria-activedescendant`. Written out twice, the two would\n * drift and the reference would silently dangle — and a dangling\n * `aria-activedescendant` is not an error the browser reports, it just stops\n * announcing options.\n *\n * @internal\n */\nexport function wrMentionOptionId(listboxId: string, index: number): string {\n return `${listboxId}-opt-${index}`;\n}\n\n/**\n * Overlay panel rendered by {@link WrMention}. Not intended for\n * direct use — the directive instantiates it via a ComponentPortal.\n *\n * @internal — the same tag its twin `WrPopconfirmPanel` already carried. It says\n * the intent; it does not by itself keep the class out of the generated API\n * tables, because `WrTableFilter` and `WrTableSort` are tagged AND documented —\n * see `EXPORTED_BUT_INTERNAL` in `scripts/lib/extract-api.ts`.\n */\n@Component({\n selector: 'wr-mention-panel',\n templateUrl: './mention-panel.html',\n encapsulation: ViewEncapsulation.None,\n host: { class: 'wr-mention-panel' },\n})\nexport class WrMentionPanel {\n readonly items = input<readonly WrMentionItem[]>([]);\n readonly activeIndex = input(0);\n readonly displayWith = input<(item: WrMentionItem) => string>(item => item.label);\n\n /**\n * Id of the `<ul role=\"listbox\">`, minted by the directive and pointed at by\n * its `aria-controls`. Owned there rather than here because the panel is\n * disposed and rebuilt whenever the caret leaves a mention, while the\n * attribute on the host has to stay put.\n *\n * Plain `input('')`, never `input.required` — a ComponentPortal-created\n * component throws on the first change detection if a required input is unset.\n */\n readonly listboxId = input('');\n\n /** Accessible name for the listbox. ARIA requires one; the directive supplies it from the catalog. */\n readonly listLabel = input('');\n\n protected optionId(index: number): string {\n return wrMentionOptionId(this.listboxId(), index);\n }\n\n /** Emitted when the user picks an item (click). */\n readonly picked = output<WrMentionItem>();\n\n /** Emitted on mouseenter — used by the directive to track hover. */\n readonly hovered = output<number>();\n\n protected onPick(item: WrMentionItem, event: MouseEvent): void {\n // mousedown semantics — keep focus on the input.\n event.preventDefault();\n this.picked.emit(item);\n }\n}\n","<!--\n No empty branch: `activate()` calls `close()` and returns before `open()` when\n nothing matches, so the panel is never rendered with zero items. The \"No\n matches\" `<div>` that used to live here was unreachable — and a hard-coded\n English string besides. The zero-match case is announced through the\n directive's live region instead.\n-->\n<ul class=\"wr-mention-panel__list\" role=\"listbox\" [attr.id]=\"listboxId()\" [attr.aria-label]=\"listLabel()\">\n @for (item of items(); track $index) {\n <li\n class=\"wr-mention-panel__option\"\n role=\"option\"\n [attr.id]=\"optionId($index)\"\n [class.wr-mention-panel__option--active]=\"$index === activeIndex()\"\n [attr.aria-selected]=\"$index === activeIndex()\"\n (mouseenter)=\"hovered.emit($index)\"\n (mousedown)=\"onPick(item, $event)\"\n >\n {{ displayWith()(item) }}\n </li>\n }\n</ul>\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { coerceNumberProperty } from '@angular/cdk/coercion';\nimport {\n type ConnectedPosition,\n type FlexibleConnectedPositionStrategyOrigin,\n type OverlayRef,\n ScrollStrategyOptions,\n} from '@angular/cdk/overlay';\nimport { ComponentPortal } from '@angular/cdk/portal';\nimport { isPlatformBrowser } from '@angular/common';\nimport {\n type ComponentRef,\n DestroyRef,\n Directive,\n ElementRef,\n PLATFORM_ID,\n computed,\n inject,\n input,\n output,\n signal,\n} from '@angular/core';\n\nimport { readI18nText, useI18nFormatter } from 'ngwr/i18n';\nimport { WR_OVERLAY } from 'ngwr/overlay';\nimport { isComposing } from 'ngwr/utils';\n\nimport { getCaretCoordinates } from './caret';\nimport type { WrMentionCommit, WrMentionItem } from './interfaces';\nimport { WrMentionPanel, wrMentionOptionId } from './mention-panel';\n\ninterface ActiveState {\n trigger: string;\n query: string;\n startIndex: number;\n}\n\n/**\n * Deterministic under prerender, unlike `randomId()` — `aria-controls` is a\n * static host binding, so it renders on the server too, and a random value would\n * differ between that render and the hydrated client.\n */\nlet mentionUid = 0;\n\n/** Gap between the caret's line and the panel, on whichever side it opens. */\nconst CARET_GAP = 4;\n\n/**\n * Below the caret's line first, above it when there is no room — the two sides\n * a caret-anchored list can take. There is no horizontal pair: a panel that\n * jumped to the other side of the caret would read as a different widget, so a\n * caret near the inline end is handled by `withPush` sliding the panel back\n * onto the screen instead. `overlayX: 'start'` is the logical corner, so RTL\n * hangs the panel from the caret's other side without a second table.\n */\nconst CARET_POSITIONS: ConnectedPosition[] = [\n { originX: 'start', originY: 'bottom', overlayX: 'start', overlayY: 'top' },\n { originX: 'start', originY: 'top', overlayX: 'start', overlayY: 'bottom' },\n];\n\n/**\n * `@`-style mention picker for `<textarea>` and `<input>`. Listens for\n * trigger characters (default `'@'`); when typed at a word boundary, an\n * overlay panel opens at the caret and shows filtered options. Pick with\n * Enter / Tab / click — the trigger + query is replaced with the inserted\n * value plus a trailing space.\n *\n * @example\n * ```html\n * <textarea\n * wrMention\n * [wrMentionItems]=\"users\"\n * [displayWith]=\"userLabel\"\n * (wrMentionSelected)=\"onMention($event)\"\n * ></textarea>\n * ```\n *\n * @see https://ngwr.dev/reference/components/mention\n */\n@Directive({\n selector: '[wrMention]',\n host: {\n '(input)': 'onInput()',\n '(click)': 'onClick()',\n '(keyup)': 'onCaretMove($event)',\n '(keydown)': 'onKeydown($event)',\n '(blur)': 'onBlur()',\n\n // The IME pair. `isComposing` on a `keydown` answers \"did the input method\n // take this key\", which is a different question from \"is a conversion open\n // right now\" — on the committing keystroke the two disagree by design — and\n // detection runs from `input` and `keyup`, where there is no such flag to\n // read. So the state is tracked here and the detector consults it.\n '(compositionstart)': 'onCompositionStart()',\n '(compositionend)': 'onCompositionEnd()',\n\n // The host keeps its implicit `role=\"textbox\"`. It is NOT a combobox: this\n // field holds prose and the mention is one fragment inside it, not the\n // field's value. `role=\"combobox\"` is also flatly disallowed on `<textarea>`\n // by ARIA in HTML (axe: `aria-allowed-role`), and it would drop\n // `aria-multiline`, which combobox does not support — so a screen reader\n // would stop reporting the field as multi-line for the whole editing\n // session, not just while the popup is open.\n //\n // Static, because `aria-autocomplete` describes a permanent capability of\n // the field; ARIA says authors SHOULD NOT toggle it to signal that\n // suggestions are currently showing. Being static is also what makes the\n // feature discoverable — it is announced on focus, before the user types a\n // trigger char.\n 'aria-autocomplete': 'list',\n // Required alongside `aria-autocomplete=\"list\"`, and must name the popup's\n // role. Measured clean on a textbox with axe-core 4.13.\n 'aria-haspopup': 'listbox',\n // Also static, and deliberately left pointing at an id that only exists\n // while the panel is open: gating it would mean gating `aria-autocomplete`\n // too. An unresolved `aria-controls` is a manual-review note in axe, never a\n // violation — unlike `aria-activedescendant`, which is an author error.\n //\n // This is the attribute that legalises the whole design: for a textbox\n // controlling a popup, `aria-activedescendant` is allowed to name an element\n // owned by the *controlled* element, which is how the reference reaches into\n // the CDK overlay's separate DOM subtree at all.\n '[attr.aria-controls]': 'listboxId',\n '[attr.aria-activedescendant]': 'activeOptionId()',\n\n // No `aria-expanded`. It is not a supported state of `role=\"textbox\"` —\n // axe rates it a *critical* `aria-allowed-attr` violation — so the\n // \"a list appeared\" signal cannot be an ARIA state here. That is what the\n // live region below is for; it is load-bearing, not decoration.\n },\n})\nexport class WrMention<T extends WrMentionItem = WrMentionItem> {\n /** Items to filter against the typed query. */\n readonly wrMentionItems = input<readonly T[]>([]);\n\n /** Trigger characters that open the panel. @default ['@'] */\n readonly triggers = input<readonly string[]>(['@']);\n\n /** Maps an item to its display label. @default `item.label` */\n readonly displayWith = input<(item: T) => string>((item: T) => item.label);\n\n /**\n * Returns the text to insert into the textarea on commit. Receives the\n * picked item and the trigger char. @default `${trigger}${displayWith(item)}`\n */\n readonly valueWith = input<((item: T, trigger: string) => string) | null>(null);\n\n /** Custom filter. @default case-insensitive `includes` over `displayWith(item)`. */\n readonly filterWith = input<((query: string, item: T) => boolean) | null>(null);\n\n /** Maximum number of items shown in the panel. @default 8 */\n readonly maxResults = input(8, { transform: (v: unknown): number => Math.max(1, coerceNumberProperty(v, 8)) });\n\n /** Emits the selected item, trigger, and query whenever the user commits. */\n readonly wrMentionSelected = output<WrMentionCommit<T>>();\n\n private readonly host = inject<ElementRef<HTMLTextAreaElement | HTMLInputElement>>(ElementRef);\n private readonly overlay = inject(WR_OVERLAY);\n private readonly scrollStrategies = inject(ScrollStrategyOptions);\n private readonly destroyRef = inject(DestroyRef);\n private readonly isBrowser = isPlatformBrowser(inject(PLATFORM_ID));\n\n private overlayRef: OverlayRef | null = null;\n private panelRef: ComponentRef<WrMentionPanel> | null = null;\n /**\n * Where the caret sits INSIDE the field — its offset from the field's\n * top-left corner, plus the height of the line it is on. Mutated in place by\n * `open()`, never replaced: `caretAnchor()` closes over this object.\n */\n private readonly caretOffset = { dx: 0, dy: 0, lineHeight: 0 };\n private state: ActiveState | null = null;\n private readonly activeIndex = signal(0);\n private readonly filteredItems = signal<readonly T[]>([]);\n private readonly isOpen = signal(false);\n\n /** @internal — read by the `aria-controls` host binding. */\n protected readonly listboxId = `wr-mention-listbox-${++mentionUid}`;\n\n private readonly listLabel = readI18nText('mention.listbox', 'Mentions');\n private readonly availableText = useI18nFormatter('mention.available', 'Matches available: {{count}}');\n private readonly insertedText = useI18nFormatter('mention.inserted', 'Inserted: {{label}}');\n\n /**\n * `aria-activedescendant`, or `null`.\n *\n * Gated hard on `isOpen()`, which is only set once the panel's options are\n * actually in the DOM. An id that resolves to nothing is an author error, and\n * the failure mode is silent: the browser does not complain, it simply stops\n * firing the event that makes a screen reader speak the option. Same\n * discipline `tree.ts` uses for its virtualized rows.\n */\n protected readonly activeOptionId = computed<string | null>(() => {\n if (!this.isOpen()) return null;\n const index = this.activeIndex();\n return index >= 0 && index < this.filteredItems().length ? wrMentionOptionId(this.listboxId, index) : null;\n });\n\n /**\n * Polite live region, parked on `<body>`.\n *\n * Not inside the panel: `close()` disposes the overlay on every keystroke that\n * leaves a mention, so a region living there would be recreated constantly —\n * and a live region has to be in the DOM *before* its text changes to be\n * announced at all. It also could not announce the two cases that matter most,\n * since in both the panel is already gone: \"nothing matched\" and \"inserted X\".\n *\n * Not a sibling of the host either — that would land inside the consumer's\n * markup and start matching their `+`, `~` and `:nth-child()` selectors.\n */\n private liveRegion: HTMLElement | null = null;\n\n constructor() {\n if (this.isBrowser) {\n const doc = this.host.nativeElement.ownerDocument;\n const region = doc.createElement('div');\n region.className = 'wr-mention__status';\n region.setAttribute('role', 'status');\n doc.body.appendChild(region);\n this.liveRegion = region;\n }\n\n this.destroyRef.onDestroy(() => {\n this.close();\n this.liveRegion?.remove();\n this.liveRegion = null;\n });\n }\n\n private announce(message: string): void {\n if (this.liveRegion) this.liveRegion.textContent = message;\n }\n\n // Host listeners\n\n /**\n * True between `compositionstart` and `compositionend`.\n *\n * Detection must not run on the half-built text an IME leaves in the field:\n * `@やま` is a reading on its way to `@山田`, and matching the reading opens a\n * panel that then eats the Enter meant to accept the conversion. So the field\n * is read once, on `compositionend`, when the text is real.\n */\n private composing = false;\n\n /** @internal */\n protected onCompositionStart(): void {\n this.composing = true;\n // A panel opened before the conversion started would take the arrows and the\n // Enter that now belong to the candidate window.\n this.close();\n }\n\n /** @internal */\n protected onCompositionEnd(): void {\n this.composing = false;\n // The committed text is only in the field now, so this is the first honest\n // read of it.\n this.detect();\n }\n\n /** @internal */\n protected onInput(): void {\n if (this.composing) return;\n this.detect();\n }\n\n /** @internal */\n protected onClick(): void {\n this.detect();\n }\n\n /** @internal */\n protected onCaretMove(event: KeyboardEvent): void {\n if (this.composing || isComposing(event)) return;\n // Every key `onKeydown` already consumed, Escape included: its keyup would\n // re-detect at a caret that is still sitting inside the mention and reopen the\n // panel Escape had just dismissed. A synthetic keydown-only Escape hides that\n // — the real gesture is a pair, and the second half undid the first.\n if (\n event.key === 'ArrowUp' ||\n event.key === 'ArrowDown' ||\n event.key === 'Enter' ||\n event.key === 'Tab' ||\n event.key === 'Escape'\n ) {\n return;\n }\n this.detect();\n }\n\n /** @internal */\n protected onKeydown(event: KeyboardEvent): void {\n // The key is the input method's while a conversion is open — Enter accepts a\n // candidate, Escape cancels the reading, the arrows walk the candidate list.\n // `this.composing` is deliberately not consulted: on Safari's committing\n // keystroke it has already gone false, and `isComposing` covers that case\n // through the 229 sentinel.\n if (isComposing(event)) return;\n if (!this.state) return;\n const list = this.filteredItems();\n switch (event.key) {\n case 'ArrowDown':\n event.preventDefault();\n if (list.length > 0) this.setActive((this.activeIndex() + 1) % list.length);\n break;\n case 'ArrowUp':\n event.preventDefault();\n if (list.length > 0) this.setActive((this.activeIndex() - 1 + list.length) % list.length);\n break;\n case 'Enter':\n case 'Tab': {\n const item = list[this.activeIndex()];\n if (item) {\n event.preventDefault();\n this.commit(item);\n }\n break;\n }\n case 'Escape':\n event.preventDefault();\n // The panel is the innermost thing Escape can dismiss, so it keeps the\n // key: without this, the same press also closed the dialog / drawer /\n // window the field sits in.\n //\n // `preventDefault()` alone buys nothing — every host overlay matches on\n // `event.key` and none of them looks at `defaultPrevented` — and letting\n // CDK's `OverlayKeyboardDispatcher` sort it out does not work either.\n // The dispatcher walks the stack newest-first and stops at the first\n // overlay with a `keydownEvents()` subscriber; this panel has none (it\n // is driven from the field's own handler, which runs at the target\n // before the body-phase dispatcher), so Escape falls straight through to\n // the overlay underneath.\n event.stopPropagation();\n this.close();\n break;\n default:\n break;\n }\n }\n\n /** @internal */\n protected onBlur(): void {\n // Defer so option mousedown lands first.\n setTimeout(() => this.close(), 120);\n }\n\n // Detection\n\n private detect(): void {\n const el = this.host.nativeElement;\n const caret = el.selectionStart ?? 0;\n const text = el.value.substring(0, caret);\n const triggers = this.triggers();\n\n // Walk back from the caret looking for a trigger char with whitespace\n // (or start-of-string) immediately before it. Stop on whitespace.\n let i = caret;\n while (i > 0) {\n const ch = text[i - 1];\n if (triggers.includes(ch)) {\n const before = i - 2 >= 0 ? text[i - 2] : '';\n if (i - 2 < 0 || /\\s/.test(before)) {\n const query = text.substring(i);\n this.activate(ch, query, i - 1);\n return;\n }\n break;\n }\n if (/\\s/.test(ch)) break;\n i--;\n }\n this.close();\n }\n\n private activate(trigger: string, query: string, startIndex: number): void {\n this.state = { trigger, query, startIndex };\n const previousCount = this.filteredItems().length;\n const filtered = this.filter(query).slice(0, this.maxResults());\n this.filteredItems.set(filtered);\n if (filtered.length === 0) {\n // Announce *after* closing: `close()` clears the region, so announcing\n // first would wipe the message before a screen reader reached it.\n this.close();\n this.announce(this.availableText({ count: 0 }));\n return;\n }\n this.setActive(Math.min(this.activeIndex(), filtered.length - 1));\n this.open();\n // Only when the size actually changes. Re-announcing the same count on every\n // keystroke would talk over the per-option speech from activedescendant.\n if (filtered.length !== previousCount) this.announce(this.availableText({ count: filtered.length }));\n }\n\n private filter(query: string): readonly T[] {\n const items = this.wrMentionItems();\n const custom = this.filterWith();\n const display = this.displayWith();\n if (!query) return items;\n if (custom) return items.filter(item => custom(query, item));\n const q = query.toLowerCase();\n return items.filter(item => display(item).toLowerCase().includes(q));\n }\n\n private setActive(i: number): void {\n this.activeIndex.set(i);\n this.panelRef?.setInput('activeIndex', i);\n }\n\n // Overlay\n\n /**\n * The overlay's anchor: the caret's line box, grown by the gap the panel\n * keeps from the text, as a zero-WIDTH virtual origin in viewport\n * coordinates. Inflating the rect rather than passing `offsetY` is what keeps\n * `withPush` honest — CDK applies a position offset as a `transform` AFTER it\n * has clamped, so a pushed panel would land the offset off the screen edge.\n *\n * Live getters, not a snapshot, and that is the whole of the scroll fix.\n * `getCaretCoordinates` answers in viewport coordinates, which a\n * `GlobalPositionStrategy` froze at the instant of the keystroke: the panel\n * then stayed pinned to the screen while the page scrolled out from under it\n * (150px of scroll, 150px of drift, ending up over unrelated content). CDK\n * re-reads a virtual origin on every `apply()`, so pinning it to the FIELD's\n * live rect is what turns `reposition()` into a real re-anchor.\n *\n * Only the caret's offset inside the field is captured up front. Measuring it\n * runs the mirror-div pass in `caret.ts` — a full layout read, far too\n * expensive to repeat per scroll event — and it cannot change without a\n * keystroke, which re-enters `open()` anyway.\n */\n private caretAnchor(): FlexibleConnectedPositionStrategyOrigin {\n const field = this.host.nativeElement;\n const offset = this.caretOffset;\n return {\n width: 0,\n get x(): number {\n return field.getBoundingClientRect().left + offset.dx;\n },\n get y(): number {\n return field.getBoundingClientRect().top + offset.dy - CARET_GAP;\n },\n get height(): number {\n return offset.lineHeight + CARET_GAP * 2;\n },\n };\n }\n\n private open(): void {\n const el = this.host.nativeElement;\n const caret = el.selectionStart ?? 0;\n const { top, left, lineHeight } = getCaretCoordinates(el, caret);\n const field = el.getBoundingClientRect();\n this.caretOffset.dx = left - field.left;\n this.caretOffset.dy = top - field.top;\n this.caretOffset.lineHeight = lineHeight;\n\n if (!this.overlayRef) {\n this.overlayRef = this.overlay.create({\n // Flexible, not global: a global strategy has no anchor and no fallback\n // positions, so the panel was always drawn downward from the caret no\n // matter how little room was left below it — half the list ended up\n // under the fold, unreachable by pointer AND invisible to a sighted\n // keyboard user walking it with `aria-activedescendant` (WCAG 2.4.11).\n positionStrategy: this.overlay\n .position()\n .flexibleConnectedTo(this.caretAnchor())\n // The panel sizes itself (`max-height` on the list); the flip above\n // and `withPush` are the whole answer to a cramped viewport.\n .withFlexibleDimensions(false)\n .withPush(true)\n .withPositions(CARET_POSITIONS),\n scrollStrategy: this.scrollStrategies.reposition(),\n panelClass: 'wr-mention-overlay',\n });\n\n const portal = new ComponentPortal(WrMentionPanel);\n const ref = this.overlayRef.attach(portal);\n this.panelRef = ref;\n ref.setInput('displayWith', this.displayWith());\n ref.setInput('listboxId', this.listboxId);\n // Read once here rather than bound: the panel is created per open, and by\n // then the catalog has long landed.\n ref.setInput('listLabel', this.listLabel());\n ref.instance.picked.subscribe(item => this.commit(item as T));\n ref.instance.hovered.subscribe(i => this.setActive(i));\n }\n // No `else` re-building the strategy: the anchor reads `caretOffset` and the\n // field's live rect, both of which the lines above have already refreshed.\n\n this.panelRef?.setInput('items', this.filteredItems());\n this.panelRef?.setInput('activeIndex', this.activeIndex());\n\n // Render the panel's own view NOW, before `aria-activedescendant` is allowed\n // to name one of its options. `attach()` inserts the host element but leaves\n // it empty — the panel is a separate root view, so on the first open the\n // `<li>` being referenced does not exist anywhere in the document yet.\n // Waiting for the next tick would leave a window where the reference dangles\n // and the announcement is lost with no error anywhere.\n this.panelRef?.changeDetectorRef.detectChanges();\n // Place it only now, with the options rendered: which side of the caret the\n // panel takes is decided by measuring it, and `attach()` defers CDK's own\n // first placement into `afterNextRender` — a frame in which the panel would\n // be painted, full size and fully opaque, at the overlay container's\n // top-left corner.\n this.overlayRef.updatePosition();\n this.isOpen.set(true);\n }\n\n private close(): void {\n if (this.overlayRef) {\n this.overlayRef.dispose();\n this.overlayRef = null;\n this.panelRef = null;\n }\n this.isOpen.set(false);\n this.state = null;\n this.activeIndex.set(0);\n this.filteredItems.set([]);\n this.announce('');\n }\n\n private commit(item: T): void {\n // Snapshot the state up front. `dispatchEvent` below re-enters this directive\n // synchronously: the listener runs `detect()`, and because assigning\n // `el.value` has already parked the caret at the end of the text — past the\n // space this method appends — `detect()` finds no trigger and calls\n // `close()`, which nulls `this.state`. Reading `this.state` after that line\n // threw, so `wrMentionSelected` never fired for anyone.\n const state = this.state;\n if (!state) return;\n\n const el = this.host.nativeElement;\n const value = el.value;\n const caret = el.selectionStart ?? value.length;\n const valueFn = this.valueWith();\n const label = this.displayWith()(item);\n const inserted = valueFn ? valueFn(item, state.trigger) : `${state.trigger}${label}`;\n const replacement = `${inserted} `;\n const before = value.substring(0, state.startIndex);\n const after = value.substring(caret);\n const next = before + replacement + after;\n\n el.value = next;\n el.dispatchEvent(new Event('input', { bubbles: true }));\n const nextCaret = (before + replacement).length;\n el.setSelectionRange(nextCaret, nextCaret);\n this.wrMentionSelected.emit({ item, trigger: state.trigger, query: state.query });\n\n // Announce after `close()`, never before — it clears the live region.\n // Committing is otherwise silent: the panel simply vanishes.\n this.close();\n this.announce(this.insertedText({ label }));\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;;;AAAA;;;;;AAKG;AAEH;;;;;;;AAOG;AACH,MAAM,YAAY,GAAG;IACnB,WAAW;;;;;;;IAOX,WAAW;IACX,OAAO;IACP,QAAQ;IACR,WAAW;IACX,WAAW;IACX,gBAAgB;IAChB,kBAAkB;IAClB,mBAAmB;IACnB,iBAAiB;IACjB,YAAY;IACZ,cAAc;IACd,eAAe;IACf,aAAa;IACb,WAAW;IACX,aAAa;IACb,YAAY;IACZ,aAAa;IACb,UAAU;IACV,gBAAgB;IAChB,YAAY;IACZ,YAAY;IACZ,WAAW;IACX,eAAe;IACf,YAAY;IACZ,gBAAgB;IAChB,eAAe;IACf,aAAa;IACb,SAAS;IACT,YAAY;IACZ,UAAU;CAC+C;AAE3D;AACA,MAAM,OAAO,GAAG,EAAE,GAAG,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAW;AAE5C;;;;;;;;;;;;AAYG;AACH,SAAS,WAAW,CAAC,KAAY,EAAA;AAC/B,I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qB;AAChC,wBAAA,WAAW,EAAE,mBAAmB;AAChC,wBAAA,QAAQ,EAAE,UAAU;;;;;;AAOpB,wBAAA,oBAAoB,EAAE,sBAAsB;AAC5C,wBAAA,kBAAkB,EAAE,oBAAoB;;;;;;;;;;;;;;AAexC,wBAAA,mBAAmB,EAAE,MAAM;;;AAG3B,wBAAA,eAAe,EAAE,SAAS;;;;;;;;;;AAU1B,wBAAA,sBAAsB,EAAE,WAAW;AACnC,wBAAA,8BAA8B,EAAE,kBAAkB;;;;;AAMnD,qBAAA;AACF,iBAAA;;;ACxID;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"ngwr-mention.mjs","sources":["../../../projects/lib/mention/caret.ts","../../../projects/lib/mention/mention-panel.ts","../../../projects/lib/mention/mention-panel.html","../../../projects/lib/mention/mention.ts","../../../projects/lib/mention/ngwr-mention.ts"],"sourcesContent":["/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\n/**\n * CSS properties whose values must be copied onto the mirror to match layout.\n *\n * `as const satisfies` keeps each name checked against `CSSStyleDeclaration`\n * while narrowing the element type to these string-valued literals — the wider\n * `keyof CSSStyleDeclaration` also spans its methods (`setProperty`, `item`, …),\n * which makes the indexed read below look like an unbound method.\n */\nconst MIRROR_PROPS = [\n 'boxSizing',\n // Without this the mirror inherits `<body>`'s direction, and the two disagree\n // whenever the field carries its own `dir` — measured at 230px of error for a\n // 320px RTL field inside an LTR page, which put the panel outside the field\n // entirely. `textAlign` below is the same story from the other side: an RTL\n // field's computed value is the logical `start`, which only resolves to the\n // right edge once the mirror knows the direction.\n 'direction',\n 'width',\n 'height',\n 'overflowX',\n 'overflowY',\n 'borderTopWidth',\n 'borderRightWidth',\n 'borderBottomWidth',\n 'borderLeftWidth',\n 'paddingTop',\n 'paddingRight',\n 'paddingBottom',\n 'paddingLeft',\n 'fontStyle',\n 'fontVariant',\n 'fontWeight',\n 'fontStretch',\n 'fontSize',\n 'fontSizeAdjust',\n 'lineHeight',\n 'fontFamily',\n 'textAlign',\n 'textTransform',\n 'textIndent',\n 'textDecoration',\n 'letterSpacing',\n 'wordSpacing',\n 'tabSize',\n 'whiteSpace',\n 'wordWrap',\n] as const satisfies readonly (keyof CSSStyleDeclaration)[];\n\n/** A caret has no size, and an environment with no layout has no rects at all. */\nconst NO_RECT = { top: 0, left: 0 } as const;\n\n/**\n * Where the browser would draw the caret this collapsed `range` marks.\n *\n * `getClientRects()` before `getBoundingClientRect()`: a collapsed range at a\n * bidi boundary has TWO candidate positions and reports both, and the bounding\n * box of the pair spans the whole run between them. The first rect is the one\n * the caret is actually painted at.\n *\n * Both are optional-called because jsdom implements NEITHER on `Range` — it lays\n * nothing out, so every element rect in it is already 0×0 and a zero here keeps\n * the function answering what the rest of that environment answers rather than\n * throwing halfway through an unrelated spec.\n */\nfunction caretRectOf(range: Range): { readonly top: number; readonly left: number } {\n const rects = range.getClientRects?.();\n if (rects && rects.length > 0) return rects[0];\n return range.getBoundingClientRect?.() ?? NO_RECT;\n}\n\n/**\n * Compute the viewport coordinates of a textarea / input caret at a given\n * `position`. Uses the \"mirror div\" technique — a hidden div with the same\n * styling holds the field's text, and a COLLAPSED RANGE at `position` reports\n * where the caret would be.\n *\n * Returns viewport-relative `{ top, left }` — pass straight to a CDK\n * Overlay anchored at that point.\n *\n * **A range, not a probe span, and the difference only shows in RTL.** The\n * classic version of this technique puts the text before the caret in the div,\n * the text after it in a `<span>`, and reads the span's LEFT edge. That reads\n * the caret's side of the boundary only while the text runs left to right. Under\n * the Unicode BiDi algorithm the span can be laid out to the LEFT of the run it\n * follows, so the edge that faces the caret is its right one — and which edge\n * that is depends on the bidi level of the text at the caret, not on the field's\n * direction, so there is no side to pick. A collapsed range asks the browser\n * where it would draw the caret and gets the reordering for free. Measured\n * against a `contenteditable` twin of the field, in Chromium: the range agrees\n * to within a pixel for Latin, Arabic and mixed text in both directions, where\n * the span was out by up to 300px in RTL (see the spec next door).\n *\n * The `<input>` branch keeps the field's WIDTH for the same reason. It used to\n * force `width: auto` so a long single line could not wrap; but an RTL field\n * right-aligns its text inside its own box, so a shrink-to-fit mirror throws\n * away the only measurement that decides where the text starts. `overflow:\n * hidden` is what keeps the overflow from painting, and `input.scrollLeft`\n * already accounts for a field scrolled past its box.\n */\nexport function getCaretCoordinates(\n input: HTMLTextAreaElement | HTMLInputElement,\n position: number\n): { top: number; left: number; lineHeight: number } {\n const doc = input.ownerDocument;\n const style = getComputedStyle(input);\n const mirror = doc.createElement('div');\n\n for (const prop of MIRROR_PROPS) {\n mirror.style[prop] = style[prop];\n }\n mirror.style.position = 'absolute';\n mirror.style.visibility = 'hidden';\n mirror.style.top = '0';\n mirror.style.left = '0';\n mirror.style.whiteSpace = 'pre-wrap';\n mirror.style.wordWrap = 'break-word';\n\n // <input> is single-line — force whitespace behaviour so coords are sane.\n if (input.tagName === 'INPUT') {\n mirror.style.whiteSpace = 'pre';\n mirror.style.height = 'auto';\n mirror.style.overflow = 'hidden';\n }\n\n // One text node, so the range can address any offset in it. An empty field\n // still needs a line box to measure, hence the fallback character.\n const text = doc.createTextNode(input.value || '.');\n mirror.appendChild(text);\n\n doc.body.appendChild(mirror);\n const range = doc.createRange();\n range.setStart(text, Math.min(position, text.length));\n range.collapse(true);\n const caretRect = caretRectOf(range);\n const mirrorRect = mirror.getBoundingClientRect();\n const lineHeight = parseFloat(style.lineHeight) || parseFloat(style.fontSize) * 1.2;\n doc.body.removeChild(mirror);\n\n const inputRect = input.getBoundingClientRect();\n return {\n top: inputRect.top + (caretRect.top - mirrorRect.top) - input.scrollTop,\n left: inputRect.left + (caretRect.left - mirrorRect.left) - input.scrollLeft,\n lineHeight,\n };\n}\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { Component, ViewEncapsulation, input, output } from '@angular/core';\n\nimport type { WrMentionItem } from './interfaces';\n\n/**\n * The id of the option at `index`, given the listbox's own id.\n *\n * Lives here, and is used from both sides, because this format is a contract\n * between two files: the panel stamps it onto each `<li>`, and the directive\n * names one of them in `aria-activedescendant`. Written out twice, the two would\n * drift and the reference would silently dangle — and a dangling\n * `aria-activedescendant` is not an error the browser reports, it just stops\n * announcing options.\n *\n * @internal\n */\nexport function wrMentionOptionId(listboxId: string, index: number): string {\n return `${listboxId}-opt-${index}`;\n}\n\n/**\n * Overlay panel rendered by {@link WrMention}. Not intended for\n * direct use — the directive instantiates it via a ComponentPortal.\n *\n * @internal — the same tag its twin `WrPopconfirmPanel` already carried. It says\n * the intent; it does not by itself keep the class out of the generated API\n * tables, because `WrTableFilter` and `WrTableSort` are tagged AND documented —\n * see `EXPORTED_BUT_INTERNAL` in `scripts/lib/extract-api.ts`.\n */\n@Component({\n selector: 'wr-mention-panel',\n templateUrl: './mention-panel.html',\n encapsulation: ViewEncapsulation.None,\n host: { class: 'wr-mention-panel' },\n})\nexport class WrMentionPanel {\n readonly items = input<readonly WrMentionItem[]>([]);\n readonly activeIndex = input(0);\n readonly displayWith = input<(item: WrMentionItem) => string>(item => item.label);\n\n /**\n * Id of the `<ul role=\"listbox\">`, minted by the directive and pointed at by\n * its `aria-controls`. Owned there rather than here because the panel is\n * disposed and rebuilt whenever the caret leaves a mention, while the\n * attribute on the host has to stay put.\n *\n * Plain `input('')`, never `input.required` — a ComponentPortal-created\n * component throws on the first change detection if a required input is unset.\n */\n readonly listboxId = input('');\n\n /** Accessible name for the listbox. ARIA requires one; the directive supplies it from the catalog. */\n readonly listLabel = input('');\n\n protected optionId(index: number): string {\n return wrMentionOptionId(this.listboxId(), index);\n }\n\n /** Emitted when the user picks an item (click). */\n readonly picked = output<WrMentionItem>();\n\n /** Emitted on mouseenter — used by the directive to track hover. */\n readonly hovered = output<number>();\n\n protected onPick(item: WrMentionItem, event: MouseEvent): void {\n // mousedown semantics — keep focus on the input.\n event.preventDefault();\n this.picked.emit(item);\n }\n}\n","<!--\n No empty branch: `activate()` calls `close()` and returns before `open()` when\n nothing matches, so the panel is never rendered with zero items. The \"No\n matches\" `<div>` that used to live here was unreachable — and a hard-coded\n English string besides. The zero-match case is announced through the\n directive's live region instead.\n-->\n<ul class=\"wr-mention-panel__list\" role=\"listbox\" [attr.id]=\"listboxId()\" [attr.aria-label]=\"listLabel()\">\n @for (item of items(); track $index) {\n <li\n class=\"wr-mention-panel__option\"\n role=\"option\"\n [attr.id]=\"optionId($index)\"\n [class.wr-mention-panel__option--active]=\"$index === activeIndex()\"\n [attr.aria-selected]=\"$index === activeIndex()\"\n (mouseenter)=\"hovered.emit($index)\"\n (mousedown)=\"onPick(item, $event)\"\n >\n {{ displayWith()(item) }}\n </li>\n }\n</ul>\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { Directionality } from '@angular/cdk/bidi';\nimport { coerceNumberProperty } from '@angular/cdk/coercion';\nimport {\n type ConnectedPosition,\n type FlexibleConnectedPositionStrategyOrigin,\n type OverlayRef,\n ScrollStrategyOptions,\n} from '@angular/cdk/overlay';\nimport { ComponentPortal } from '@angular/cdk/portal';\nimport { isPlatformBrowser } from '@angular/common';\nimport {\n type ComponentRef,\n DestroyRef,\n Directive,\n ElementRef,\n Injector,\n PLATFORM_ID,\n computed,\n inject,\n input,\n output,\n signal,\n} from '@angular/core';\n\nimport { readI18nText, useI18nFormatter } from 'ngwr/i18n';\nimport { WR_OVERLAY, wrFollowDirection } from 'ngwr/overlay';\nimport { isComposing } from 'ngwr/utils';\n\nimport { getCaretCoordinates } from './caret';\nimport type { WrMentionCommit, WrMentionItem } from './interfaces';\nimport { WrMentionPanel, wrMentionOptionId } from './mention-panel';\n\ninterface ActiveState {\n trigger: string;\n query: string;\n startIndex: number;\n}\n\n/**\n * Deterministic under prerender, unlike `randomId()` — `aria-controls` is a\n * static host binding, so it renders on the server too, and a random value would\n * differ between that render and the hydrated client.\n */\nlet mentionUid = 0;\n\n/** Gap between the caret's line and the panel, on whichever side it opens. */\nconst CARET_GAP = 4;\n\n/**\n * Below the caret's line first, above it when there is no room — the two sides\n * a caret-anchored list can take. There is no horizontal pair: a panel that\n * jumped to the other side of the caret would read as a different widget, so a\n * caret near the inline end is handled by `withPush` sliding the panel back\n * onto the screen instead. `overlayX: 'start'` is the logical corner, so RTL\n * hangs the panel from the caret's other side without a second table.\n */\nconst CARET_POSITIONS: ConnectedPosition[] = [\n { originX: 'start', originY: 'bottom', overlayX: 'start', overlayY: 'top' },\n { originX: 'start', originY: 'top', overlayX: 'start', overlayY: 'bottom' },\n];\n\n/**\n * `@`-style mention picker for `<textarea>` and `<input>`. Listens for\n * trigger characters (default `'@'`); when typed at a word boundary, an\n * overlay panel opens at the caret and shows filtered options. Pick with\n * Enter / Tab / click — the trigger + query is replaced with the inserted\n * value plus a trailing space.\n *\n * @example\n * ```html\n * <textarea\n * wrMention\n * [wrMentionItems]=\"users\"\n * [displayWith]=\"userLabel\"\n * (wrMentionSelected)=\"onMention($event)\"\n * ></textarea>\n * ```\n *\n * @see https://ngwr.dev/reference/components/mention\n */\n@Directive({\n selector: '[wrMention]',\n host: {\n '(input)': 'onInput()',\n '(click)': 'onClick()',\n '(keyup)': 'onCaretMove($event)',\n '(keydown)': 'onKeydown($event)',\n '(blur)': 'onBlur()',\n\n // The IME pair. `isComposing` on a `keydown` answers \"did the input method\n // take this key\", which is a different question from \"is a conversion open\n // right now\" — on the committing keystroke the two disagree by design — and\n // detection runs from `input` and `keyup`, where there is no such flag to\n // read. So the state is tracked here and the detector consults it.\n '(compositionstart)': 'onCompositionStart()',\n '(compositionend)': 'onCompositionEnd()',\n\n // The host keeps its implicit `role=\"textbox\"`. It is NOT a combobox: this\n // field holds prose and the mention is one fragment inside it, not the\n // field's value. `role=\"combobox\"` is also flatly disallowed on `<textarea>`\n // by ARIA in HTML (axe: `aria-allowed-role`), and it would drop\n // `aria-multiline`, which combobox does not support — so a screen reader\n // would stop reporting the field as multi-line for the whole editing\n // session, not just while the popup is open.\n //\n // Static, because `aria-autocomplete` describes a permanent capability of\n // the field; ARIA says authors SHOULD NOT toggle it to signal that\n // suggestions are currently showing. Being static is also what makes the\n // feature discoverable — it is announced on focus, before the user types a\n // trigger char.\n 'aria-autocomplete': 'list',\n // Required alongside `aria-autocomplete=\"list\"`, and must name the popup's\n // role. Measured clean on a textbox with axe-core 4.13.\n 'aria-haspopup': 'listbox',\n // Also static, and deliberately left pointing at an id that only exists\n // while the panel is open: gating it would mean gating `aria-autocomplete`\n // too. An unresolved `aria-controls` is a manual-review note in axe, never a\n // violation — unlike `aria-activedescendant`, which is an author error.\n //\n // This is the attribute that legalises the whole design: for a textbox\n // controlling a popup, `aria-activedescendant` is allowed to name an element\n // owned by the *controlled* element, which is how the reference reaches into\n // the CDK overlay's separate DOM subtree at all.\n '[attr.aria-controls]': 'listboxId',\n '[attr.aria-activedescendant]': 'activeOptionId()',\n\n // No `aria-expanded`. It is not a supported state of `role=\"textbox\"` —\n // axe rates it a *critical* `aria-allowed-attr` violation — so the\n // \"a list appeared\" signal cannot be an ARIA state here. That is what the\n // live region below is for; it is load-bearing, not decoration.\n },\n})\nexport class WrMention<T extends WrMentionItem = WrMentionItem> {\n /** Items to filter against the typed query. */\n readonly wrMentionItems = input<readonly T[]>([]);\n\n /** Trigger characters that open the panel. @default ['@'] */\n readonly triggers = input<readonly string[]>(['@']);\n\n /** Maps an item to its display label. @default `item.label` */\n readonly displayWith = input<(item: T) => string>((item: T) => item.label);\n\n /**\n * Returns the text to insert into the textarea on commit. Receives the\n * picked item and the trigger char. @default `${trigger}${displayWith(item)}`\n */\n readonly valueWith = input<((item: T, trigger: string) => string) | null>(null);\n\n /** Custom filter. @default case-insensitive `includes` over `displayWith(item)`. */\n readonly filterWith = input<((query: string, item: T) => boolean) | null>(null);\n\n /** Maximum number of items shown in the panel. @default 8 */\n readonly maxResults = input(8, { transform: (v: unknown): number => Math.max(1, coerceNumberProperty(v, 8)) });\n\n /** Emits the selected item, trigger, and query whenever the user commits. */\n readonly wrMentionSelected = output<WrMentionCommit<T>>();\n\n private readonly host = inject<ElementRef<HTMLTextAreaElement | HTMLInputElement>>(ElementRef);\n private readonly overlay = inject(WR_OVERLAY);\n /**\n * Optional inject: `Directionality` is root-provided, so this is never null in\n * an app — but a bare `TestBed` that provides nothing should still get a\n * directive that works, and defaulting to LTR is the honest fallback.\n */\n private readonly dir = inject(Directionality, { optional: true });\n private readonly scrollStrategies = inject(ScrollStrategyOptions);\n private readonly destroyRef = inject(DestroyRef);\n private readonly injector = inject(Injector);\n private readonly isBrowser = isPlatformBrowser(inject(PLATFORM_ID));\n\n private overlayRef: OverlayRef | null = null;\n private panelRef: ComponentRef<WrMentionPanel> | null = null;\n /**\n * Where the caret sits INSIDE the field — its offset from the field's\n * top-left corner, plus the height of the line it is on. Mutated in place by\n * `open()`, never replaced: `caretAnchor()` closes over this object.\n */\n private readonly caretOffset = { dx: 0, dy: 0, lineHeight: 0 };\n private state: ActiveState | null = null;\n private readonly activeIndex = signal(0);\n private readonly filteredItems = signal<readonly T[]>([]);\n private readonly isOpen = signal(false);\n\n /** @internal — read by the `aria-controls` host binding. */\n protected readonly listboxId = `wr-mention-listbox-${++mentionUid}`;\n\n private readonly listLabel = readI18nText('mention.listbox', 'Mentions');\n private readonly availableText = useI18nFormatter('mention.available', 'Matches available: {{count}}');\n private readonly insertedText = useI18nFormatter('mention.inserted', 'Inserted: {{label}}');\n\n /**\n * `aria-activedescendant`, or `null`.\n *\n * Gated hard on `isOpen()`, which is only set once the panel's options are\n * actually in the DOM. An id that resolves to nothing is an author error, and\n * the failure mode is silent: the browser does not complain, it simply stops\n * firing the event that makes a screen reader speak the option. Same\n * discipline `tree.ts` uses for its virtualized rows.\n */\n protected readonly activeOptionId = computed<string | null>(() => {\n if (!this.isOpen()) return null;\n const index = this.activeIndex();\n return index >= 0 && index < this.filteredItems().length ? wrMentionOptionId(this.listboxId, index) : null;\n });\n\n /**\n * Polite live region, parked on `<body>`.\n *\n * Not inside the panel: `close()` disposes the overlay on every keystroke that\n * leaves a mention, so a region living there would be recreated constantly —\n * and a live region has to be in the DOM *before* its text changes to be\n * announced at all. It also could not announce the two cases that matter most,\n * since in both the panel is already gone: \"nothing matched\" and \"inserted X\".\n *\n * Not a sibling of the host either — that would land inside the consumer's\n * markup and start matching their `+`, `~` and `:nth-child()` selectors.\n */\n private liveRegion: HTMLElement | null = null;\n\n constructor() {\n if (this.isBrowser) {\n const doc = this.host.nativeElement.ownerDocument;\n const region = doc.createElement('div');\n region.className = 'wr-mention__status';\n region.setAttribute('role', 'status');\n doc.body.appendChild(region);\n this.liveRegion = region;\n }\n\n this.destroyRef.onDestroy(() => {\n this.close();\n this.liveRegion?.remove();\n this.liveRegion = null;\n });\n }\n\n private announce(message: string): void {\n if (this.liveRegion) this.liveRegion.textContent = message;\n }\n\n // Host listeners\n\n /**\n * True between `compositionstart` and `compositionend`.\n *\n * Detection must not run on the half-built text an IME leaves in the field:\n * `@やま` is a reading on its way to `@山田`, and matching the reading opens a\n * panel that then eats the Enter meant to accept the conversion. So the field\n * is read once, on `compositionend`, when the text is real.\n */\n private composing = false;\n\n /** @internal */\n protected onCompositionStart(): void {\n this.composing = true;\n // A panel opened before the conversion started would take the arrows and the\n // Enter that now belong to the candidate window.\n this.close();\n }\n\n /** @internal */\n protected onCompositionEnd(): void {\n this.composing = false;\n // The committed text is only in the field now, so this is the first honest\n // read of it.\n this.detect();\n }\n\n /** @internal */\n protected onInput(): void {\n if (this.composing) return;\n this.detect();\n }\n\n /** @internal */\n protected onClick(): void {\n this.detect();\n }\n\n /** @internal */\n protected onCaretMove(event: KeyboardEvent): void {\n if (this.composing || isComposing(event)) return;\n // Every key `onKeydown` already consumed, Escape included: its keyup would\n // re-detect at a caret that is still sitting inside the mention and reopen the\n // panel Escape had just dismissed. A synthetic keydown-only Escape hides that\n // — the real gesture is a pair, and the second half undid the first.\n if (\n event.key === 'ArrowUp' ||\n event.key === 'ArrowDown' ||\n event.key === 'Enter' ||\n event.key === 'Tab' ||\n event.key === 'Escape'\n ) {\n return;\n }\n this.detect();\n }\n\n /** @internal */\n protected onKeydown(event: KeyboardEvent): void {\n // The key is the input method's while a conversion is open — Enter accepts a\n // candidate, Escape cancels the reading, the arrows walk the candidate list.\n // `this.composing` is deliberately not consulted: on Safari's committing\n // keystroke it has already gone false, and `isComposing` covers that case\n // through the 229 sentinel.\n if (isComposing(event)) return;\n if (!this.state) return;\n const list = this.filteredItems();\n switch (event.key) {\n case 'ArrowDown':\n event.preventDefault();\n if (list.length > 0) this.setActive((this.activeIndex() + 1) % list.length);\n break;\n case 'ArrowUp':\n event.preventDefault();\n if (list.length > 0) this.setActive((this.activeIndex() - 1 + list.length) % list.length);\n break;\n case 'Enter':\n case 'Tab': {\n const item = list[this.activeIndex()];\n if (item) {\n event.preventDefault();\n this.commit(item);\n }\n break;\n }\n case 'Escape':\n event.preventDefault();\n // The panel is the innermost thing Escape can dismiss, so it keeps the\n // key: without this, the same press also closed the dialog / drawer /\n // window the field sits in.\n //\n // `preventDefault()` alone buys nothing — every host overlay matches on\n // `event.key` and none of them looks at `defaultPrevented` — and letting\n // CDK's `OverlayKeyboardDispatcher` sort it out does not work either.\n // The dispatcher walks the stack newest-first and stops at the first\n // overlay with a `keydownEvents()` subscriber; this panel has none (it\n // is driven from the field's own handler, which runs at the target\n // before the body-phase dispatcher), so Escape falls straight through to\n // the overlay underneath.\n event.stopPropagation();\n this.close();\n break;\n default:\n break;\n }\n }\n\n /** @internal */\n protected onBlur(): void {\n // Defer so option mousedown lands first.\n setTimeout(() => this.close(), 120);\n }\n\n // Detection\n\n private detect(): void {\n const el = this.host.nativeElement;\n const caret = el.selectionStart ?? 0;\n const text = el.value.substring(0, caret);\n const triggers = this.triggers();\n\n // Walk back from the caret looking for a trigger char with whitespace\n // (or start-of-string) immediately before it. Stop on whitespace.\n let i = caret;\n while (i > 0) {\n const ch = text[i - 1];\n if (triggers.includes(ch)) {\n const before = i - 2 >= 0 ? text[i - 2] : '';\n if (i - 2 < 0 || /\\s/.test(before)) {\n const query = text.substring(i);\n this.activate(ch, query, i - 1);\n return;\n }\n break;\n }\n if (/\\s/.test(ch)) break;\n i--;\n }\n this.close();\n }\n\n private activate(trigger: string, query: string, startIndex: number): void {\n this.state = { trigger, query, startIndex };\n const previousCount = this.filteredItems().length;\n const filtered = this.filter(query).slice(0, this.maxResults());\n this.filteredItems.set(filtered);\n if (filtered.length === 0) {\n // Announce *after* closing: `close()` clears the region, so announcing\n // first would wipe the message before a screen reader reached it.\n this.close();\n this.announce(this.availableText({ count: 0 }));\n return;\n }\n this.setActive(Math.min(this.activeIndex(), filtered.length - 1));\n this.open();\n // Only when the size actually changes. Re-announcing the same count on every\n // keystroke would talk over the per-option speech from activedescendant.\n if (filtered.length !== previousCount) this.announce(this.availableText({ count: filtered.length }));\n }\n\n private filter(query: string): readonly T[] {\n const items = this.wrMentionItems();\n const custom = this.filterWith();\n const display = this.displayWith();\n if (!query) return items;\n if (custom) return items.filter(item => custom(query, item));\n const q = query.toLowerCase();\n return items.filter(item => display(item).toLowerCase().includes(q));\n }\n\n private setActive(i: number): void {\n this.activeIndex.set(i);\n this.panelRef?.setInput('activeIndex', i);\n }\n\n // Overlay\n\n /**\n * The overlay's anchor: the caret's line box, grown by the gap the panel\n * keeps from the text, as a zero-WIDTH virtual origin in viewport\n * coordinates. Inflating the rect rather than passing `offsetY` is what keeps\n * `withPush` honest — CDK applies a position offset as a `transform` AFTER it\n * has clamped, so a pushed panel would land the offset off the screen edge.\n *\n * Live getters, not a snapshot, and that is the whole of the scroll fix.\n * `getCaretCoordinates` answers in viewport coordinates, which a\n * `GlobalPositionStrategy` froze at the instant of the keystroke: the panel\n * then stayed pinned to the screen while the page scrolled out from under it\n * (150px of scroll, 150px of drift, ending up over unrelated content). CDK\n * re-reads a virtual origin on every `apply()`, so pinning it to the FIELD's\n * live rect is what turns `reposition()` into a real re-anchor.\n *\n * Only the caret's offset inside the field is captured up front. Measuring it\n * runs the mirror-div pass in `caret.ts` — a full layout read, far too\n * expensive to repeat per scroll event — and it cannot change without a\n * keystroke, which re-enters `open()` anyway.\n */\n private caretAnchor(): FlexibleConnectedPositionStrategyOrigin {\n const field = this.host.nativeElement;\n const offset = this.caretOffset;\n return {\n width: 0,\n get x(): number {\n return field.getBoundingClientRect().left + offset.dx;\n },\n get y(): number {\n return field.getBoundingClientRect().top + offset.dy - CARET_GAP;\n },\n get height(): number {\n return offset.lineHeight + CARET_GAP * 2;\n },\n };\n }\n\n private open(): void {\n const el = this.host.nativeElement;\n const caret = el.selectionStart ?? 0;\n const { top, left, lineHeight } = getCaretCoordinates(el, caret);\n const field = el.getBoundingClientRect();\n this.caretOffset.dx = left - field.left;\n this.caretOffset.dy = top - field.top;\n this.caretOffset.lineHeight = lineHeight;\n\n if (!this.overlayRef) {\n this.overlayRef = this.overlay.create({\n // Flexible, not global: a global strategy has no anchor and no fallback\n // positions, so the panel was always drawn downward from the caret no\n // matter how little room was left below it — half the list ended up\n // under the fold, unreachable by pointer AND invisible to a sighted\n // keyboard user walking it with `aria-activedescendant` (WCAG 2.4.11).\n positionStrategy: this.overlay\n .position()\n .flexibleConnectedTo(this.caretAnchor())\n // The panel sizes itself (`max-height` on the list); the flip above\n // and `withPush` are the whole answer to a cramped viewport.\n .withFlexibleDimensions(false)\n .withPush(true)\n .withPositions(CARET_POSITIONS),\n scrollStrategy: this.scrollStrategies.reposition(),\n panelClass: 'wr-mention-overlay',\n });\n\n // Once per mention SESSION, which is the same thing as once per ref here:\n // the block this sits in is the only place one is created, and `close()`\n // is the only place one is disposed. No callback — `CARET_POSITIONS`\n // carries no `offsetX` to mirror, by the design noted at the table, so\n // `setDirection` plus the reposition the helper already does is the whole\n // of it: the panel hangs off the caret's other side and the list inside\n // reads the way the page now does.\n wrFollowDirection(this.overlayRef, this.dir, this.injector);\n\n const portal = new ComponentPortal(WrMentionPanel);\n const ref = this.overlayRef.attach(portal);\n this.panelRef = ref;\n ref.setInput('displayWith', this.displayWith());\n ref.setInput('listboxId', this.listboxId);\n // Read once here rather than bound: the panel is created per open, and by\n // then the catalog has long landed.\n ref.setInput('listLabel', this.listLabel());\n ref.instance.picked.subscribe(item => this.commit(item as T));\n ref.instance.hovered.subscribe(i => this.setActive(i));\n }\n // No `else` re-building the strategy: the anchor reads `caretOffset` and the\n // field's live rect, both of which the lines above have already refreshed.\n\n this.panelRef?.setInput('items', this.filteredItems());\n this.panelRef?.setInput('activeIndex', this.activeIndex());\n\n // Render the panel's own view NOW, before `aria-activedescendant` is allowed\n // to name one of its options. `attach()` inserts the host element but leaves\n // it empty — the panel is a separate root view, so on the first open the\n // `<li>` being referenced does not exist anywhere in the document yet.\n // Waiting for the next tick would leave a window where the reference dangles\n // and the announcement is lost with no error anywhere.\n this.panelRef?.changeDetectorRef.detectChanges();\n // Place it only now, with the options rendered: which side of the caret the\n // panel takes is decided by measuring it, and `attach()` defers CDK's own\n // first placement into `afterNextRender` — a frame in which the panel would\n // be painted, full size and fully opaque, at the overlay container's\n // top-left corner.\n this.overlayRef.updatePosition();\n this.isOpen.set(true);\n }\n\n private close(): void {\n if (this.overlayRef) {\n this.overlayRef.dispose();\n this.overlayRef = null;\n this.panelRef = null;\n }\n this.isOpen.set(false);\n this.state = null;\n this.activeIndex.set(0);\n this.filteredItems.set([]);\n this.announce('');\n }\n\n private commit(item: T): void {\n // Snapshot the state up front. `dispatchEvent` below re-enters this directive\n // synchronously: the listener runs `detect()`, and because assigning\n // `el.value` has already parked the caret at the end of the text — past the\n // space this method appends — `detect()` finds no trigger and calls\n // `close()`, which nulls `this.state`. Reading `this.state` after that line\n // threw, so `wrMentionSelected` never fired for anyone.\n const state = this.state;\n if (!state) return;\n\n const el = this.host.nativeElement;\n const value = el.value;\n const caret = el.selectionStart ?? value.length;\n const valueFn = this.valueWith();\n const label = this.displayWith()(item);\n const inserted = valueFn ? valueFn(item, state.trigger) : `${state.trigger}${label}`;\n const replacement = `${inserted} `;\n const before = value.substring(0, state.startIndex);\n const after = value.substring(caret);\n const next = before + replacement + after;\n\n el.value = next;\n el.dispatchEvent(new Event('input', { bubbles: true }));\n const nextCaret = (before + replacement).length;\n el.setSelectionRange(nextCaret, nextCaret);\n this.wrMentionSelected.emit({ item, trigger: state.trigger, query: state.query });\n\n // Announce after `close()`, never before — it clears the live region.\n // Committing is otherwise silent: the panel simply vanishes.\n this.close();\n this.announce(this.insertedText({ label }));\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;;;;AAAA;;;;;AAKG;AAEH;;;;;;;AAOG;AACH,MAAM,YAAY,GAAG;IACnB,WAAW;;;;;;;IAOX,WAAW;IACX,OAAO;IACP,QAAQ;IACR,WAAW;IACX,WAAW;IACX,gBAAgB;IAChB,kBAAkB;IAClB,mBAAmB;IACnB,iBAAiB;IACjB,YAAY;IACZ,cAAc;IACd,eAAe;IACf,aAAa;IACb,WAAW;IACX,aAAa;IACb,YAAY;IACZ,aAAa;IACb,UAAU;IACV,gBAAgB;IAChB,YAAY;IACZ,YAAY;IACZ,WAAW;IACX,eAAe;IACf,YAAY;IACZ,gBAAgB;IAChB,eAAe;IACf,aAAa;IACb,SAAS;IACT,YAAY;IACZ,UAAU;CAC+C;AAE3D;AACA,MAAM,OAAO,GAAG,EAAE,GAAG,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAW;AAE5C;;;;;;;;;;;;AAYG;AACH,SAAS,WAAW,CAAC,KAAY,EAAA;AAC/B,IAAA,MAAM,KAAK,GAAG,KAAK,CAAC,cAAc,IAAI;AACtC,IAAA,IAAI,KAAK,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC;AAAE,QAAA,OAAO,KAAK,CAAC,CAAC,CAAC;AAC9C,IAAA,OAAO,KAAK,CAAC,qBAAqB,IAAI,IAAI,OAAO;AACnD;AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BG;AACG,SAAU,mBA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AW,EAAE,mBAAmB;AAChC,wBAAA,QAAQ,EAAE,UAAU;;;;;;AAOpB,wBAAA,oBAAoB,EAAE,sBAAsB;AAC5C,wBAAA,kBAAkB,EAAE,oBAAoB;;;;;;;;;;;;;;AAexC,wBAAA,mBAAmB,EAAE,MAAM;;;AAG3B,wBAAA,eAAe,EAAE,SAAS;;;;;;;;;;AAU1B,wBAAA,sBAAsB,EAAE,WAAW;AACnC,wBAAA,8BAA8B,EAAE,kBAAkB;;;;;AAMnD,qBAAA;AACF,iBAAA;;;AC1ID;;AAEG;;;;"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { DOCUMENT, isPlatformBrowser } from '@angular/common';
|
|
2
1
|
import * as i0 from '@angular/core';
|
|
3
|
-
import { inject, PLATFORM_ID, Service, InjectionToken, makeEnvironmentProviders, provideEnvironmentInitializer, EnvironmentInjector, Injector } from '@angular/core';
|
|
4
|
-
import { Observable } from 'rxjs';
|
|
2
|
+
import { untracked, effect, inject, PLATFORM_ID, Service, InjectionToken, makeEnvironmentProviders, provideEnvironmentInitializer, EnvironmentInjector, Injector } from '@angular/core';
|
|
3
|
+
import { Subscription, Observable } from 'rxjs';
|
|
4
|
+
import { noop } from 'ngwr/utils';
|
|
5
|
+
import { DOCUMENT, isPlatformBrowser } from '@angular/common';
|
|
5
6
|
import { OverlayContainer, Overlay } from '@angular/cdk/overlay';
|
|
6
7
|
import { WrVisualViewport } from 'ngwr/platform';
|
|
7
8
|
|
|
@@ -76,6 +77,120 @@ function wrAppendOverlayClose(host, className, label, onClose) {
|
|
|
76
77
|
return button;
|
|
77
78
|
}
|
|
78
79
|
|
|
80
|
+
/**
|
|
81
|
+
* @license
|
|
82
|
+
*
|
|
83
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
84
|
+
* found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE
|
|
85
|
+
*/
|
|
86
|
+
/**
|
|
87
|
+
* Keep an OPEN overlay on the application's reading direction.
|
|
88
|
+
*
|
|
89
|
+
* The CDK reads the direction ONCE, as a string, when the overlay is created
|
|
90
|
+
* (`overlayConfig.direction ||= directionality.value`), writes it as the host's
|
|
91
|
+
* `dir` on attach, and never looks at it again — `updatePosition()` does not
|
|
92
|
+
* touch it and `setDirection()` is the only thing that does. So an application
|
|
93
|
+
* that flips direction while a panel is open mirrors the page and leaves the
|
|
94
|
+
* panel behind, still `ltr`, still resolving `start` to the left. This site's
|
|
95
|
+
* own LTR/RTL switch is the demonstration: it lives inside a `wr-dropdown`, and
|
|
96
|
+
* the `wr-segmented` it is built from reads `Directionality` live — so the thumb
|
|
97
|
+
* slides to the other slot while the pane around it still renders `ltr`, and
|
|
98
|
+
* parks under the wrong label.
|
|
99
|
+
*
|
|
100
|
+
* Call it once per `OverlayRef`, right after `overlay.create(...)`. The follower
|
|
101
|
+
* ends itself when that overlay detaches or is disposed, so a reopen — which is
|
|
102
|
+
* always a NEW ref in this library — needs a new call, and the returned teardown
|
|
103
|
+
* is only for stopping early.
|
|
104
|
+
*
|
|
105
|
+
* `onDirectionChange` is for the sites whose position LIST is itself
|
|
106
|
+
* direction-dependent (the four that pass their table through
|
|
107
|
+
* {@link wrMirrorOffsets}): it runs with the new direction already on the ref
|
|
108
|
+
* and before the overlay repositions, so the strategy is carrying the mirrored
|
|
109
|
+
* offsets by the time the CDK re-resolves them.
|
|
110
|
+
*
|
|
111
|
+
* SSR-safe: it touches no browser global of its own, and the CDK's position
|
|
112
|
+
* strategies no-op off the browser, so a flip on the server only rewrites the
|
|
113
|
+
* attribute.
|
|
114
|
+
*
|
|
115
|
+
* @param overlayRef The overlay to keep in step, freshly created.
|
|
116
|
+
* @param dir The `Directionality` the caller injected. `null` — an optional
|
|
117
|
+
* inject with no provider, i.e. a bare `TestBed` — means there is nothing
|
|
118
|
+
* ambient to follow and this does nothing at all.
|
|
119
|
+
* @param injector Owns the `valueSignal` watch; the caller's own is right.
|
|
120
|
+
* @param onDirectionChange Re-applies direction-dependent state, e.g.
|
|
121
|
+
* `strategy.withPositions(wrMirrorOffsets(TABLE, direction === 'rtl'))`.
|
|
122
|
+
* @returns Stops following. Idempotent, and unnecessary in the normal case.
|
|
123
|
+
*
|
|
124
|
+
* @example
|
|
125
|
+
* ```ts
|
|
126
|
+
* this.overlayRef = this.overlay.create({ positionStrategy, ... });
|
|
127
|
+
* wrFollowDirection(this.overlayRef, this.dir, this.injector, direction =>
|
|
128
|
+
* positionStrategy.withPositions(
|
|
129
|
+
* wrMirrorOffsets(WR_POPCONFIRM_POSITIONS[this.position()], direction === 'rtl')
|
|
130
|
+
* )
|
|
131
|
+
* );
|
|
132
|
+
* ```
|
|
133
|
+
*/
|
|
134
|
+
function wrFollowDirection(overlayRef, dir, injector, onDirectionChange) {
|
|
135
|
+
if (!dir)
|
|
136
|
+
return noop;
|
|
137
|
+
const apply = (next) => {
|
|
138
|
+
// Comparing against the REF rather than a direction captured up here does
|
|
139
|
+
// three jobs at once: the watch's mandatory first run is a no-op, a flip
|
|
140
|
+
// that arrives down both channels is applied once, and a same-value write
|
|
141
|
+
// never yanks a panel the user is reading.
|
|
142
|
+
if (next === overlayRef.getDirection())
|
|
143
|
+
return;
|
|
144
|
+
overlayRef.setDirection(next); // rewrites the host's `dir`; it does NOT reposition
|
|
145
|
+
onDirectionChange?.(next); // the caller re-mirrors its position list here
|
|
146
|
+
overlayRef.updatePosition(); // re-resolves start/end against the direction just set
|
|
147
|
+
};
|
|
148
|
+
// Two channels, because they are not the same thing. `valueSignal` is the
|
|
149
|
+
// state — `Directionality.value` is a getter over it, so nothing can change
|
|
150
|
+
// direction without writing it. `change` is an EventEmitter the root instance
|
|
151
|
+
// never emits: it reads the document once at construction and only completes
|
|
152
|
+
// the emitter on destroy, so it belongs to the `[dir]` directive (and to an
|
|
153
|
+
// app, like this site's header, that emits it by hand as a courtesy). Keying
|
|
154
|
+
// on `change` alone would be dead for an app that just writes the signal;
|
|
155
|
+
// keying on the signal alone would ignore the `{ value, change }` test double
|
|
156
|
+
// that a dozen of the library's RTL specs hand their component.
|
|
157
|
+
//
|
|
158
|
+
// `untracked` because of WHERE this is called from: half the call sites open
|
|
159
|
+
// their overlay out of an `effect(() => { if (this.isOpen()) … })`, and
|
|
160
|
+
// `effect()` refuses in dev mode to be created inside a reactive context.
|
|
161
|
+
// Laundering only the CREATION is exactly right — the watch below still
|
|
162
|
+
// depends on `valueSignal` and on nothing else.
|
|
163
|
+
const watch = untracked(() => effect(() => {
|
|
164
|
+
// Read as a plain optional function rather than as a `Signal`, because
|
|
165
|
+
// the case being guarded is a double that has no signal at all: falling
|
|
166
|
+
// back to `value` registers no dependency, so the watch simply never
|
|
167
|
+
// re-runs and `change` carries that case on its own.
|
|
168
|
+
const read = dir.valueSignal;
|
|
169
|
+
apply(read ? read() : dir.value);
|
|
170
|
+
}, { injector }));
|
|
171
|
+
// rxjs owns the teardown, and an `OverlayRef` is why. Open and close happen in
|
|
172
|
+
// an event handler or an effect, never in an injection context, so the idiom
|
|
173
|
+
// that suggests itself — `takeUntilDestroyed(destroyRef)` — would tie this to
|
|
174
|
+
// the DIRECTIVE's lifetime: a menu opened fifty times would leave fifty
|
|
175
|
+
// followers behind, each pinning a disposed ref. (`WrOutsideClick`'s JSDoc
|
|
176
|
+
// records that same mistake, made at ten call sites.) `detachments()` is the
|
|
177
|
+
// overlay's own lifetime and the one channel every dismissal goes through.
|
|
178
|
+
// And it is not hygiene: `setDirection()` writes through the host element
|
|
179
|
+
// `dispose()` nulls, so a watch that outlives its overlay THROWS on the next
|
|
180
|
+
// flip.
|
|
181
|
+
const teardown = new Subscription();
|
|
182
|
+
const stop = () => teardown.unsubscribe();
|
|
183
|
+
teardown.add(() => watch.destroy());
|
|
184
|
+
teardown.add(dir.change.subscribe(apply));
|
|
185
|
+
// Both handlers, for the reason `WrOutsideClick` gives: a live ref arrives
|
|
186
|
+
// through `next`, one already disposed before this call has only `complete`
|
|
187
|
+
// left to give.
|
|
188
|
+
teardown.add(overlayRef.detachments().subscribe({ next: stop, complete: stop }));
|
|
189
|
+
// `Subscription.unsubscribe()` is a no-op once closed, so the caller's copy of
|
|
190
|
+
// this and the automatic one cannot fight, and calling it twice is free.
|
|
191
|
+
return stop;
|
|
192
|
+
}
|
|
193
|
+
|
|
79
194
|
/**
|
|
80
195
|
* @license
|
|
81
196
|
*
|
|
@@ -490,5 +605,5 @@ function provideWrResponsiveOverlays(config) {
|
|
|
490
605
|
* Generated bundle index. Do not edit.
|
|
491
606
|
*/
|
|
492
607
|
|
|
493
|
-
export { WR_OVERLAY, WR_OVERLAY_CONTAINER, WR_RESPONSIVE_OVERLAYS, WrOutsideClick, WrOverlayContainer, provideWrOverlay, provideWrResponsiveOverlays, wrAppendOverlayClose, wrMirrorOffsets, wrPresentAsSheet };
|
|
608
|
+
export { WR_OVERLAY, WR_OVERLAY_CONTAINER, WR_RESPONSIVE_OVERLAYS, WrOutsideClick, WrOverlayContainer, provideWrOverlay, provideWrResponsiveOverlays, wrAppendOverlayClose, wrFollowDirection, wrMirrorOffsets, wrPresentAsSheet };
|
|
494
609
|
//# sourceMappingURL=ngwr-overlay.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ngwr-overlay.mjs","sources":["../../../projects/lib/overlay/wr-overlay-close.ts","../../../projects/lib/overlay/wr-mirror-offsets.ts","../../../projects/lib/overlay/wr-outside-click.ts","../../../projects/lib/overlay/wr-overlay-container.ts","../../../projects/lib/overlay/tokens/wr-overlay.token.ts","../../../projects/lib/overlay/tokens/wr-overlay-container.token.ts","../../../projects/lib/overlay/tokens/wr-responsive-overlays.token.ts","../../../projects/lib/overlay/provide-wr-overlay.ts","../../../projects/lib/overlay/provide-wr-responsive-overlays.ts","../../../projects/lib/overlay/ngwr-overlay.ts"],"sourcesContent":["/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nconst SVG_NS = 'http://www.w3.org/2000/svg';\n\n/** The same 24×24 stroked ✕ the rest of the library's chrome draws (alert, toast, lightbox). */\nconst CLOSE_ICON_ATTRS: readonly (readonly [string, string])[] = [\n ['class', 'wr-icon__svg'],\n ['viewBox', '0 0 24 24'],\n ['fill', 'none'],\n ['stroke', 'currentColor'],\n ['stroke-width', '2'],\n ['stroke-linecap', 'round'],\n ['stroke-linejoin', 'round'],\n ['aria-hidden', 'true'],\n];\nconst CLOSE_ICON_PATHS: readonly string[] = ['M18 6 6 18', 'm6 6 12 12'];\n\n/**\n * Builds the ✕ node by node.\n *\n * It was one `innerHTML = CLOSE_ICON`, and the string was a compile-time\n * constant, so it was never an injection risk — it was an AVAILABILITY one.\n * Under `require-trusted-types-for 'script'` an `innerHTML` write throws\n * `TrustedHTML assignment` whatever the string is, and the throw landed after\n * the overlay was on screen: a modal with no ✕, no backdrop subscription and no\n * Escape handler, over the whole application. `createElementNS` is not a\n * Trusted Types sink, so there is nothing left to police.\n */\nfunction createCloseIcon(doc: Document): SVGSVGElement {\n const svg = doc.createElementNS(SVG_NS, 'svg');\n // `setAttribute`, not `.className` — on an SVG element that property is an\n // `SVGAnimatedString` and assigning a string to it silently does nothing.\n for (const [name, value] of CLOSE_ICON_ATTRS) svg.setAttribute(name, value);\n for (const d of CLOSE_ICON_PATHS) {\n const path = doc.createElementNS(SVG_NS, 'path');\n path.setAttribute('d', d);\n svg.appendChild(path);\n }\n return svg;\n}\n\n/**\n * Appends a dismiss (✕) button to a service-opened overlay panel.\n *\n * `WrDialog` and `WrDrawerManager` build their panel around a component the\n * consumer supplies, so there is no template of their own to put a corner button\n * in — they call this instead. Component-driven overlays (`<wr-drawer>`) render\n * the same markup in their template.\n *\n * Uses `host.ownerDocument` rather than the global `document`, so it carries no\n * hidden browser-only assumption; callers still gate on the platform because\n * they have nothing to append to on the server.\n *\n * @param host Panel element the button is appended to (and positioned against).\n * @param className BEM class for the button, e.g. `wr-dialog__close`.\n * @param label Accessible name — already localized by the caller.\n * @param onClose Invoked on click.\n */\nexport function wrAppendOverlayClose(\n host: HTMLElement,\n className: string,\n label: string,\n onClose: () => void\n): HTMLButtonElement {\n const button = host.ownerDocument.createElement('button');\n button.type = 'button';\n button.className = className;\n button.setAttribute('aria-label', label);\n button.appendChild(createCloseIcon(host.ownerDocument));\n button.addEventListener('click', onClose);\n host.appendChild(button);\n return button;\n}\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport type { ConnectedPosition } from '@angular/cdk/overlay';\n\n/**\n * Mirror the horizontal offsets of a connected-position list for RTL.\n *\n * The CDK mirrors `originX` / `overlayX` under `dir=\"rtl\"` — a `start` anchor\n * resolves to the origin's right edge — but it does NOT mirror `offsetX`, which\n * it adds to the final PHYSICAL x (`_getOffset` returns `position.offsetX`\n * verbatim). So a position that meant \"sit to the inline-start of the trigger,\n * 8px clear of it\" keeps its `-8` under RTL, where the panel is now on the\n * right: the gap becomes an 8px OVERLAP, and the panel sits on top of the thing\n * it is describing.\n *\n * Nothing in the CDK will do this for us, and the amount is per position, so\n * every ngwr overlay that offsets along the inline axis passes its list through\n * here. `offsetY` is untouched: the block axis does not flip.\n *\n * @example\n * ```ts\n * const dir = inject(Directionality, { optional: true });\n *\n * strategy.withPositions(wrMirrorOffsets(WR_POPOVER_POSITIONS[position], dir?.value === 'rtl'));\n * ```\n */\nexport function wrMirrorOffsets(positions: readonly ConnectedPosition[], isRtl: boolean): ConnectedPosition[] {\n // Copied rather than mutated even when there is nothing to do: the position\n // tables are module-level constants shared by every instance, so handing back\n // the same objects invites a caller to write through them.\n if (!isRtl) return positions.map(position => ({ ...position }));\n\n return positions.map(position => ({\n ...position,\n ...(position.offsetX == null ? {} : { offsetX: -position.offsetX }),\n }));\n}\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport type { OverlayRef } from '@angular/cdk/overlay';\nimport { DOCUMENT, isPlatformBrowser } from '@angular/common';\nimport { PLATFORM_ID, Service, inject } from '@angular/core';\n\nimport { Observable, type Subscriber } from 'rxjs';\n\n/** One live subscription to `WrOutsideClick.outsidePointerEvents()`. */\ninterface Watcher {\n readonly overlayRef: OverlayRef;\n readonly subscriber: Subscriber<MouseEvent>;\n}\n\n/**\n * Shadow-piercing `event.target` — `composedPath()[0]` is the real originator\n * when the click started inside a shadow root, where `target` is retargeted to\n * the host.\n */\nfunction eventTarget(event: Event): EventTarget | null {\n if (event.composedPath) {\n try {\n return event.composedPath()[0] ?? event.target;\n } catch {\n /* Detached / synthetic events can throw — fall through to `target`. */\n }\n }\n return event.target;\n}\n\n/** `parent.contains(child)`, but stepping out of shadow roots through their hosts. */\nfunction containsAcrossShadow(parent: Node, child: EventTarget | null): boolean {\n const hasShadowRoot = typeof ShadowRoot !== 'undefined';\n let current = child as Node | null;\n while (current) {\n if (current === parent) return true;\n current = hasShadowRoot && current instanceof ShadowRoot ? current.host : current.parentNode;\n }\n return false;\n}\n\n/**\n * Outside-click source for overlays — a drop-in replacement for\n * `OverlayRef.outsidePointerEvents()`.\n *\n * **Why this exists.** CDK's `OverlayOutsideClickDispatcher` binds its\n * listeners to `document.body`. When page content is shorter than the viewport,\n * a click in the empty space below it targets `<html>` — and `<html>` is\n * `body`'s *parent*, so the event bubbles straight to the document and `body`\n * never sees it. The overlay silently stays open. Listening on the document\n * itself catches both cases, and costs nothing else.\n *\n * Semantics are otherwise identical to the CDK's, deliberately:\n *\n * - Emits on `click` / `auxclick` / `contextmenu`, in the capture phase, and\n * tracks `pointerdown` so a `click` is judged by where the press *started*\n * (a drag that ends outside the pane doesn't count as an outside click).\n * - Walks watchers top-most first and stops at the first one that contains the\n * event, so clicking inside a stacked overlay can't close the ones beneath\n * it (a `wr-select` opened inside a `wr-popover`, say).\n * - Fires for the very click that opened the overlay, which is why every caller\n * also ignores events landing on its own trigger.\n *\n * Registration is per subscription: the document listeners go up with the first\n * watcher and come down with the last, so an app with no open overlay has none.\n * That sentence was aspirational until v11 — see {@link outsidePointerEvents}.\n */\n@Service()\nexport class WrOutsideClick {\n private readonly doc = inject(DOCUMENT);\n private readonly isBrowser = isPlatformBrowser(inject(PLATFORM_ID));\n\n /** In attach order — last is top-most. */\n private readonly watchers: Watcher[] = [];\n private cleanup: (() => void) | null = null;\n private pressOrigin: EventTarget | null = null;\n\n /**\n * Emits every `click` / `auxclick` / `contextmenu` that lands outside the\n * given overlay's pane, for as long as the overlay is attached.\n *\n * **It completes when the overlay detaches, and that is load-bearing.** Every\n * one of the ten call sites subscribes inside its own `openOverlay()` and\n * pipes `takeUntilDestroyed(destroyRef)` — a DIRECTIVE lifetime, not an\n * overlay one — and none of them unsubscribes on close, because the natural\n * reading of that idiom is \"this ends with the component\". Without the\n * completion below the teardown never ran: one watcher accumulated per OPEN\n * for the life of the page, each pinning a disposed `OverlayRef` (and through\n * it a detached pane, its portal outlet and their injectors), the four\n * capture-phase document listeners could never come down because\n * `watchers.length` never reached zero, and every click on the page walked a\n * list that only grew. A `mode=\"tooltip\"` popover made it unbounded — one\n * permanent watcher per hover.\n *\n * Completing here rather than fixing ten call sites is deliberate: the next\n * component to open an overlay would have made the same reasonable mistake.\n * It is also what CDK's own `OverlayRef.outsidePointerEvents()` does.\n */\n outsidePointerEvents(overlayRef: OverlayRef): Observable<MouseEvent> {\n return new Observable<MouseEvent>(subscriber => {\n if (!this.isBrowser) return;\n\n const watcher: Watcher = { overlayRef, subscriber };\n this.watchers.push(watcher);\n if (this.watchers.length === 1) this.listen();\n\n // BOTH handlers, and the second one is not defensive padding. `dispose()`\n // emits a detachment and then completes the subject, so a live overlay\n // arrives through `next` — but a ref that was already disposed before\n // anyone subscribed has nothing left to emit and arrives through\n // `complete` alone. Listening for `next` only left exactly the watcher\n // this whole change exists to remove.\n const ended = (): void => subscriber.complete();\n const detached = overlayRef.detachments().subscribe({ next: ended, complete: ended });\n\n return () => {\n detached.unsubscribe();\n const index = this.watchers.indexOf(watcher);\n if (index > -1) this.watchers.splice(index, 1);\n if (!this.watchers.length) this.unlisten();\n };\n });\n }\n\n private readonly onPointerDown = (event: Event): void => {\n this.pressOrigin = eventTarget(event);\n };\n\n private readonly onClick = (event: Event): void => {\n const target = eventTarget(event);\n // `detail > 0` means the click really came from a pointer press. A click\n // activated by Enter or Space carries `detail: 0` and has no `pointerdown`\n // of its own — so trusting a leftover origin there judged it by a press\n // that belonged to something else entirely. A press inside the pane that\n // never produced a click (a drag released off-window, a node removed under\n // the finger, a cancelled touch) survives in `pressOrigin`, and the next\n // keyboard activation anywhere on the page then read as \"inside\": the panel\n // would not close, for keyboard users only.\n const fromPointer = event.type === 'click' && (event as MouseEvent).detail > 0;\n const origin = fromPointer && this.pressOrigin ? this.pressOrigin : target;\n this.pressOrigin = null;\n\n // Snapshot: a watcher that closes on this event unsubscribes synchronously,\n // mutating `watchers` while we're walking it.\n const watchers = this.watchers.slice();\n for (let i = watchers.length - 1; i > -1; i--) {\n const { overlayRef, subscriber } = watchers[i];\n if (!overlayRef.hasAttached()) continue;\n\n const pane = overlayRef.overlayElement;\n if (containsAcrossShadow(pane, target) || containsAcrossShadow(pane, origin)) break;\n\n subscriber.next(event as MouseEvent);\n }\n };\n\n private listen(): void {\n const options: AddEventListenerOptions = { capture: true };\n const doc = this.doc;\n\n doc.addEventListener('pointerdown', this.onPointerDown, options);\n doc.addEventListener('click', this.onClick, options);\n doc.addEventListener('auxclick', this.onClick, options);\n doc.addEventListener('contextmenu', this.onClick, options);\n\n this.cleanup = () => {\n doc.removeEventListener('pointerdown', this.onPointerDown, options);\n doc.removeEventListener('click', this.onClick, options);\n doc.removeEventListener('auxclick', this.onClick, options);\n doc.removeEventListener('contextmenu', this.onClick, options);\n };\n }\n\n private unlisten(): void {\n this.cleanup?.();\n this.cleanup = null;\n this.pressOrigin = null;\n }\n}\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { OverlayContainer } from '@angular/cdk/overlay';\nimport { Service } from '@angular/core';\n\n/**\n * Custom CDK `OverlayContainer` subclass that tags its DOM element with\n * `.wr-overlay-container` in addition to CDK's own `.cdk-overlay-container`.\n *\n * Why: CDK uses a single overlay container per app — every CDK consumer\n * (this lib, Angular Material, NG-ZORRO, etc.) puts its overlays in the\n * same root element. With this class applied you can scope NGWR-specific\n * overlay styles via the tag, e.g.:\n *\n * ```scss\n * .wr-overlay-container .cdk-overlay-pane { z-index: 1100; }\n * ```\n *\n * It does **not** isolate two libraries that both subclass OverlayContainer\n * — the last provider wins. It does give NGWR overlays a stable CSS hook.\n */\n@Service()\nexport class WrOverlayContainer extends OverlayContainer {\n protected override _createContainer(): void {\n super._createContainer();\n this._containerElement?.classList.add('wr-overlay-container');\n }\n}\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { Overlay } from '@angular/cdk/overlay';\nimport { InjectionToken, inject } from '@angular/core';\n\n/**\n * Injection token for the CDK `Overlay` service NGWR components should\n * use to open panels.\n *\n * Defaults to CDK's root `Overlay` (shared with every other CDK consumer\n * in the app). Call `provideWrOverlay()` to bind it to an isolated\n * `Overlay` instance backed by a separate `OverlayContainer` — that way\n * NGWR overlays don't share the same DOM root with other libraries.\n *\n * @internal — directives/services inside the lib inject this instead of\n * CDK's `Overlay` directly.\n */\nexport const WR_OVERLAY = new InjectionToken<Overlay>('WR_OVERLAY', {\n providedIn: 'root',\n factory: () => inject(Overlay),\n});\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { OverlayContainer } from '@angular/cdk/overlay';\nimport { InjectionToken, inject } from '@angular/core';\n\n/**\n * Injection token for the overlay container NGWR components should use.\n *\n * Defaults to CDK's `OverlayContainer` — i.e. the same root element every\n * CDK consumer shares. Call `provideWrOverlay()` to replace it with an\n * isolated instance so NGWR overlays don't collide with other libraries.\n *\n * @internal\n */\nexport const WR_OVERLAY_CONTAINER = new InjectionToken<OverlayContainer>('WR_OVERLAY_CONTAINER', {\n providedIn: 'root',\n factory: () => inject(OverlayContainer),\n});\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { InjectionToken } from '@angular/core';\n\n/** Configuration for responsive (bottom-sheet) overlay presentation. */\ninterface WrResponsiveOverlaysConfig {\n /**\n * Viewport width (CSS px) at or below which overlays present as a\n * bottom-sheet instead of a floating panel. @default 640\n */\n readonly breakpoint: number;\n}\n\n/**\n * When set, overlay services (dialog, select, dropdown, …) present as a\n * slide-up bottom-sheet on viewports at or below `breakpoint`. `null`\n * (the default) keeps every overlay floating. Configure via\n * {@link provideWrResponsiveOverlays}; override per call with a\n * component's `responsive` option.\n *\n * @internal\n */\nconst WR_RESPONSIVE_OVERLAYS = new InjectionToken<WrResponsiveOverlaysConfig | null>('WR_RESPONSIVE_OVERLAYS', {\n factory: () => null,\n});\n\n/**\n * Decide whether an overlay should present as a bottom-sheet for the\n * current viewport.\n *\n * - `responsive === true` — sheet on small viewports regardless of config.\n * - `responsive === false` — never a sheet.\n * - `responsive === undefined` — follow the global config (sheet when\n * {@link provideWrResponsiveOverlays} is configured).\n *\n * SSR-safe: returns `false` when there's no `window`.\n *\n * @internal\n */\nfunction wrPresentAsSheet(responsive: boolean | undefined, config: WrResponsiveOverlaysConfig | null): boolean {\n const enabled = responsive ?? config !== null;\n if (!enabled || typeof window === 'undefined') return false;\n return window.innerWidth <= (config?.breakpoint ?? 640);\n}\n\nexport { WR_RESPONSIVE_OVERLAYS, wrPresentAsSheet };\nexport type { WrResponsiveOverlaysConfig };\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { Overlay, OverlayContainer } from '@angular/cdk/overlay';\nimport {\n EnvironmentInjector,\n Injector,\n type EnvironmentProviders,\n inject,\n makeEnvironmentProviders,\n provideEnvironmentInitializer,\n} from '@angular/core';\n\nimport { WrVisualViewport } from 'ngwr/platform';\n\nimport { WR_OVERLAY, WR_OVERLAY_CONTAINER } from './tokens';\nimport { WrOverlayContainer } from './wr-overlay-container';\n\n/**\n * Isolates NGWR overlays from other CDK consumers in the app.\n *\n * Without this call, NGWR overlays use CDK's root `Overlay` — they\n * render into the same `.cdk-overlay-container` element as Angular\n * Material, NG-ZORRO, etc. With it, NGWR gets its own `OverlayContainer`\n * (marked `.wr-overlay-container`) **and** its own `Overlay` service\n * instance — so styles, z-index, and lifecycle never collide.\n *\n * It does this by replacing two injection tokens:\n * - `WR_OVERLAY_CONTAINER` → custom `WrOverlayContainer` subclass\n * - `WR_OVERLAY` → a fresh `Overlay` instance built in a child injector\n * that resolves `OverlayContainer` to the custom subclass\n *\n * CDK's own root `Overlay` / `OverlayContainer` are left untouched, so\n * other libraries keep working with their original container.\n *\n * @example\n * ```ts\n * import { provideWrOverlay } from 'ngwr/overlay';\n *\n * bootstrapApplication(AppComponent, {\n * providers: [\n * provideWrOverlay(),\n * ],\n * });\n * ```\n */\nexport function provideWrOverlay(): EnvironmentProviders {\n return makeEnvironmentProviders([\n // Track the visual viewport app-wide so overlay sheets (and the\n // command-palette) can lift above the on-screen keyboard. No-op on the\n // server / in browsers without the API.\n provideEnvironmentInitializer(() => void inject(WrVisualViewport)),\n { provide: WR_OVERLAY_CONTAINER, useClass: WrOverlayContainer },\n {\n provide: WR_OVERLAY,\n useFactory: (): Overlay => {\n const parent = inject(EnvironmentInjector);\n const container = inject(WR_OVERLAY_CONTAINER);\n\n // Child injector resolves `OverlayContainer` to our subclass and\n // creates a fresh `Overlay` instance bound to it. CDK's own root\n // `Overlay` and `OverlayContainer` are untouched in the parent.\n const child = Injector.create({\n parent,\n providers: [\n { provide: OverlayContainer, useValue: container },\n { provide: Overlay, useClass: Overlay },\n ],\n });\n\n return child.get(Overlay);\n },\n },\n ]);\n}\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { type EnvironmentProviders, makeEnvironmentProviders } from '@angular/core';\n\nimport { WR_RESPONSIVE_OVERLAYS, type WrResponsiveOverlaysConfig } from './tokens/wr-responsive-overlays.token';\n\n/**\n * Opt every NGWR overlay into responsive presentation — on viewports at or\n * below `breakpoint`, dialogs / selects / dropdowns and friends slide up as\n * a full-width bottom-sheet instead of a floating panel. Built on the same\n * overlay plumbing, so focus-trap, backdrop and scroll-blocking carry over.\n *\n * Individual components can still opt out (or in) per instance via their\n * `responsive` option.\n *\n * @example\n * ```ts\n * bootstrapApplication(AppComponent, {\n * providers: [provideWrOverlay(), provideWrResponsiveOverlays()],\n * });\n *\n * // Custom breakpoint:\n * provideWrResponsiveOverlays({ breakpoint: 768 });\n * ```\n */\nexport function provideWrResponsiveOverlays(config?: Partial<WrResponsiveOverlaysConfig>): EnvironmentProviders {\n return makeEnvironmentProviders([\n { provide: WR_RESPONSIVE_OVERLAYS, useValue: { breakpoint: config?.breakpoint ?? 640 } },\n ]);\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;AAAA;;;;;AAKG;AAEH,MAAM,MAAM,GAAG,4BAA4B;AAE3C;AACA,MAAM,gBAAgB,GAA2C;IAC/D,CAAC,OAAO,EAAE,cAAc,CAAC;IACzB,CAAC,SAAS,EAAE,WAAW,CAAC;IACxB,CAAC,MAAM,EAAE,MAAM,CAAC;IAChB,CAAC,QAAQ,EAAE,cAAc,CAAC;IAC1B,CAAC,cAAc,EAAE,GAAG,CAAC;IACrB,CAAC,gBAAgB,EAAE,OAAO,CAAC;IAC3B,CAAC,iBAAiB,EAAE,OAAO,CAAC;IAC5B,CAAC,aAAa,EAAE,MAAM,CA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,gBAAgB,EAAE,QAAQ,EAAE,SAAS,EAAE;AAClD,wBAAA,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE;AACxC,qBAAA;AACF,iBAAA,CAAC;AAEF,gBAAA,OAAO,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC;YAC3B,CAAC;AACF,SAAA;AACF,KAAA,CAAC;AACJ;;AC9EA;;;;;AAKG;AAMH;;;;;;;;;;;;;;;;;;AAkBG;AACG,SAAU,2BAA2B,CAAC,MAA4C,EAAA;AACtF,IAAA,OAAO,wBAAwB,CAAC;AAC9B,QAAA,EAAE,OAAO,EAAE,sBAAsB,EAAE,QAAQ,EAAE,EAAE,UAAU,EAAE,MAAM,EAAE,UAAU,IAAI,GAAG,EAAE,EAAE;AACzF,KAAA,CAAC;AACJ;;AClCA;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"ngwr-overlay.mjs","sources":["../../../projects/lib/overlay/wr-overlay-close.ts","../../../projects/lib/overlay/wr-follow-direction.ts","../../../projects/lib/overlay/wr-mirror-offsets.ts","../../../projects/lib/overlay/wr-outside-click.ts","../../../projects/lib/overlay/wr-overlay-container.ts","../../../projects/lib/overlay/tokens/wr-overlay.token.ts","../../../projects/lib/overlay/tokens/wr-overlay-container.token.ts","../../../projects/lib/overlay/tokens/wr-responsive-overlays.token.ts","../../../projects/lib/overlay/provide-wr-overlay.ts","../../../projects/lib/overlay/provide-wr-responsive-overlays.ts","../../../projects/lib/overlay/ngwr-overlay.ts"],"sourcesContent":["/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nconst SVG_NS = 'http://www.w3.org/2000/svg';\n\n/** The same 24×24 stroked ✕ the rest of the library's chrome draws (alert, toast, lightbox). */\nconst CLOSE_ICON_ATTRS: readonly (readonly [string, string])[] = [\n ['class', 'wr-icon__svg'],\n ['viewBox', '0 0 24 24'],\n ['fill', 'none'],\n ['stroke', 'currentColor'],\n ['stroke-width', '2'],\n ['stroke-linecap', 'round'],\n ['stroke-linejoin', 'round'],\n ['aria-hidden', 'true'],\n];\nconst CLOSE_ICON_PATHS: readonly string[] = ['M18 6 6 18', 'm6 6 12 12'];\n\n/**\n * Builds the ✕ node by node.\n *\n * It was one `innerHTML = CLOSE_ICON`, and the string was a compile-time\n * constant, so it was never an injection risk — it was an AVAILABILITY one.\n * Under `require-trusted-types-for 'script'` an `innerHTML` write throws\n * `TrustedHTML assignment` whatever the string is, and the throw landed after\n * the overlay was on screen: a modal with no ✕, no backdrop subscription and no\n * Escape handler, over the whole application. `createElementNS` is not a\n * Trusted Types sink, so there is nothing left to police.\n */\nfunction createCloseIcon(doc: Document): SVGSVGElement {\n const svg = doc.createElementNS(SVG_NS, 'svg');\n // `setAttribute`, not `.className` — on an SVG element that property is an\n // `SVGAnimatedString` and assigning a string to it silently does nothing.\n for (const [name, value] of CLOSE_ICON_ATTRS) svg.setAttribute(name, value);\n for (const d of CLOSE_ICON_PATHS) {\n const path = doc.createElementNS(SVG_NS, 'path');\n path.setAttribute('d', d);\n svg.appendChild(path);\n }\n return svg;\n}\n\n/**\n * Appends a dismiss (✕) button to a service-opened overlay panel.\n *\n * `WrDialog` and `WrDrawerManager` build their panel around a component the\n * consumer supplies, so there is no template of their own to put a corner button\n * in — they call this instead. Component-driven overlays (`<wr-drawer>`) render\n * the same markup in their template.\n *\n * Uses `host.ownerDocument` rather than the global `document`, so it carries no\n * hidden browser-only assumption; callers still gate on the platform because\n * they have nothing to append to on the server.\n *\n * @param host Panel element the button is appended to (and positioned against).\n * @param className BEM class for the button, e.g. `wr-dialog__close`.\n * @param label Accessible name — already localized by the caller.\n * @param onClose Invoked on click.\n */\nexport function wrAppendOverlayClose(\n host: HTMLElement,\n className: string,\n label: string,\n onClose: () => void\n): HTMLButtonElement {\n const button = host.ownerDocument.createElement('button');\n button.type = 'button';\n button.className = className;\n button.setAttribute('aria-label', label);\n button.appendChild(createCloseIcon(host.ownerDocument));\n button.addEventListener('click', onClose);\n host.appendChild(button);\n return button;\n}\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport type { Direction, Directionality } from '@angular/cdk/bidi';\nimport type { OverlayRef } from '@angular/cdk/overlay';\nimport { type Injector, effect, untracked } from '@angular/core';\n\nimport { Subscription } from 'rxjs';\n\nimport { noop } from 'ngwr/utils';\n\n/**\n * Keep an OPEN overlay on the application's reading direction.\n *\n * The CDK reads the direction ONCE, as a string, when the overlay is created\n * (`overlayConfig.direction ||= directionality.value`), writes it as the host's\n * `dir` on attach, and never looks at it again — `updatePosition()` does not\n * touch it and `setDirection()` is the only thing that does. So an application\n * that flips direction while a panel is open mirrors the page and leaves the\n * panel behind, still `ltr`, still resolving `start` to the left. This site's\n * own LTR/RTL switch is the demonstration: it lives inside a `wr-dropdown`, and\n * the `wr-segmented` it is built from reads `Directionality` live — so the thumb\n * slides to the other slot while the pane around it still renders `ltr`, and\n * parks under the wrong label.\n *\n * Call it once per `OverlayRef`, right after `overlay.create(...)`. The follower\n * ends itself when that overlay detaches or is disposed, so a reopen — which is\n * always a NEW ref in this library — needs a new call, and the returned teardown\n * is only for stopping early.\n *\n * `onDirectionChange` is for the sites whose position LIST is itself\n * direction-dependent (the four that pass their table through\n * {@link wrMirrorOffsets}): it runs with the new direction already on the ref\n * and before the overlay repositions, so the strategy is carrying the mirrored\n * offsets by the time the CDK re-resolves them.\n *\n * SSR-safe: it touches no browser global of its own, and the CDK's position\n * strategies no-op off the browser, so a flip on the server only rewrites the\n * attribute.\n *\n * @param overlayRef The overlay to keep in step, freshly created.\n * @param dir The `Directionality` the caller injected. `null` — an optional\n * inject with no provider, i.e. a bare `TestBed` — means there is nothing\n * ambient to follow and this does nothing at all.\n * @param injector Owns the `valueSignal` watch; the caller's own is right.\n * @param onDirectionChange Re-applies direction-dependent state, e.g.\n * `strategy.withPositions(wrMirrorOffsets(TABLE, direction === 'rtl'))`.\n * @returns Stops following. Idempotent, and unnecessary in the normal case.\n *\n * @example\n * ```ts\n * this.overlayRef = this.overlay.create({ positionStrategy, ... });\n * wrFollowDirection(this.overlayRef, this.dir, this.injector, direction =>\n * positionStrategy.withPositions(\n * wrMirrorOffsets(WR_POPCONFIRM_POSITIONS[this.position()], direction === 'rtl')\n * )\n * );\n * ```\n */\nexport function wrFollowDirection(\n overlayRef: OverlayRef,\n dir: Directionality | null,\n injector: Injector,\n onDirectionChange?: (direction: Direction) => void\n): () => void {\n if (!dir) return noop;\n\n const apply = (next: Direction): void => {\n // Comparing against the REF rather than a direction captured up here does\n // three jobs at once: the watch's mandatory first run is a no-op, a flip\n // that arrives down both channels is applied once, and a same-value write\n // never yanks a panel the user is reading.\n if (next === overlayRef.getDirection()) return;\n\n overlayRef.setDirection(next); // rewrites the host's `dir`; it does NOT reposition\n onDirectionChange?.(next); // the caller re-mirrors its position list here\n overlayRef.updatePosition(); // re-resolves start/end against the direction just set\n };\n\n // Two channels, because they are not the same thing. `valueSignal` is the\n // state — `Directionality.value` is a getter over it, so nothing can change\n // direction without writing it. `change` is an EventEmitter the root instance\n // never emits: it reads the document once at construction and only completes\n // the emitter on destroy, so it belongs to the `[dir]` directive (and to an\n // app, like this site's header, that emits it by hand as a courtesy). Keying\n // on `change` alone would be dead for an app that just writes the signal;\n // keying on the signal alone would ignore the `{ value, change }` test double\n // that a dozen of the library's RTL specs hand their component.\n //\n // `untracked` because of WHERE this is called from: half the call sites open\n // their overlay out of an `effect(() => { if (this.isOpen()) … })`, and\n // `effect()` refuses in dev mode to be created inside a reactive context.\n // Laundering only the CREATION is exactly right — the watch below still\n // depends on `valueSignal` and on nothing else.\n const watch = untracked(() =>\n effect(\n () => {\n // Read as a plain optional function rather than as a `Signal`, because\n // the case being guarded is a double that has no signal at all: falling\n // back to `value` registers no dependency, so the watch simply never\n // re-runs and `change` carries that case on its own.\n const read: (() => Direction) | undefined = dir.valueSignal;\n apply(read ? read() : dir.value);\n },\n { injector }\n )\n );\n\n // rxjs owns the teardown, and an `OverlayRef` is why. Open and close happen in\n // an event handler or an effect, never in an injection context, so the idiom\n // that suggests itself — `takeUntilDestroyed(destroyRef)` — would tie this to\n // the DIRECTIVE's lifetime: a menu opened fifty times would leave fifty\n // followers behind, each pinning a disposed ref. (`WrOutsideClick`'s JSDoc\n // records that same mistake, made at ten call sites.) `detachments()` is the\n // overlay's own lifetime and the one channel every dismissal goes through.\n // And it is not hygiene: `setDirection()` writes through the host element\n // `dispose()` nulls, so a watch that outlives its overlay THROWS on the next\n // flip.\n const teardown = new Subscription();\n const stop = (): void => teardown.unsubscribe();\n\n teardown.add(() => watch.destroy());\n teardown.add(dir.change.subscribe(apply));\n // Both handlers, for the reason `WrOutsideClick` gives: a live ref arrives\n // through `next`, one already disposed before this call has only `complete`\n // left to give.\n teardown.add(overlayRef.detachments().subscribe({ next: stop, complete: stop }));\n\n // `Subscription.unsubscribe()` is a no-op once closed, so the caller's copy of\n // this and the automatic one cannot fight, and calling it twice is free.\n return stop;\n}\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport type { ConnectedPosition } from '@angular/cdk/overlay';\n\n/**\n * Mirror the horizontal offsets of a connected-position list for RTL.\n *\n * The CDK mirrors `originX` / `overlayX` under `dir=\"rtl\"` — a `start` anchor\n * resolves to the origin's right edge — but it does NOT mirror `offsetX`, which\n * it adds to the final PHYSICAL x (`_getOffset` returns `position.offsetX`\n * verbatim). So a position that meant \"sit to the inline-start of the trigger,\n * 8px clear of it\" keeps its `-8` under RTL, where the panel is now on the\n * right: the gap becomes an 8px OVERLAP, and the panel sits on top of the thing\n * it is describing.\n *\n * Nothing in the CDK will do this for us, and the amount is per position, so\n * every ngwr overlay that offsets along the inline axis passes its list through\n * here. `offsetY` is untouched: the block axis does not flip.\n *\n * @example\n * ```ts\n * const dir = inject(Directionality, { optional: true });\n *\n * strategy.withPositions(wrMirrorOffsets(WR_POPOVER_POSITIONS[position], dir?.value === 'rtl'));\n * ```\n */\nexport function wrMirrorOffsets(positions: readonly ConnectedPosition[], isRtl: boolean): ConnectedPosition[] {\n // Copied rather than mutated even when there is nothing to do: the position\n // tables are module-level constants shared by every instance, so handing back\n // the same objects invites a caller to write through them.\n if (!isRtl) return positions.map(position => ({ ...position }));\n\n return positions.map(position => ({\n ...position,\n ...(position.offsetX == null ? {} : { offsetX: -position.offsetX }),\n }));\n}\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport type { OverlayRef } from '@angular/cdk/overlay';\nimport { DOCUMENT, isPlatformBrowser } from '@angular/common';\nimport { PLATFORM_ID, Service, inject } from '@angular/core';\n\nimport { Observable, type Subscriber } from 'rxjs';\n\n/** One live subscription to `WrOutsideClick.outsidePointerEvents()`. */\ninterface Watcher {\n readonly overlayRef: OverlayRef;\n readonly subscriber: Subscriber<MouseEvent>;\n}\n\n/**\n * Shadow-piercing `event.target` — `composedPath()[0]` is the real originator\n * when the click started inside a shadow root, where `target` is retargeted to\n * the host.\n */\nfunction eventTarget(event: Event): EventTarget | null {\n if (event.composedPath) {\n try {\n return event.composedPath()[0] ?? event.target;\n } catch {\n /* Detached / synthetic events can throw — fall through to `target`. */\n }\n }\n return event.target;\n}\n\n/** `parent.contains(child)`, but stepping out of shadow roots through their hosts. */\nfunction containsAcrossShadow(parent: Node, child: EventTarget | null): boolean {\n const hasShadowRoot = typeof ShadowRoot !== 'undefined';\n let current = child as Node | null;\n while (current) {\n if (current === parent) return true;\n current = hasShadowRoot && current instanceof ShadowRoot ? current.host : current.parentNode;\n }\n return false;\n}\n\n/**\n * Outside-click source for overlays — a drop-in replacement for\n * `OverlayRef.outsidePointerEvents()`.\n *\n * **Why this exists.** CDK's `OverlayOutsideClickDispatcher` binds its\n * listeners to `document.body`. When page content is shorter than the viewport,\n * a click in the empty space below it targets `<html>` — and `<html>` is\n * `body`'s *parent*, so the event bubbles straight to the document and `body`\n * never sees it. The overlay silently stays open. Listening on the document\n * itself catches both cases, and costs nothing else.\n *\n * Semantics are otherwise identical to the CDK's, deliberately:\n *\n * - Emits on `click` / `auxclick` / `contextmenu`, in the capture phase, and\n * tracks `pointerdown` so a `click` is judged by where the press *started*\n * (a drag that ends outside the pane doesn't count as an outside click).\n * - Walks watchers top-most first and stops at the first one that contains the\n * event, so clicking inside a stacked overlay can't close the ones beneath\n * it (a `wr-select` opened inside a `wr-popover`, say).\n * - Fires for the very click that opened the overlay, which is why every caller\n * also ignores events landing on its own trigger.\n *\n * Registration is per subscription: the document listeners go up with the first\n * watcher and come down with the last, so an app with no open overlay has none.\n * That sentence was aspirational until v11 — see {@link outsidePointerEvents}.\n */\n@Service()\nexport class WrOutsideClick {\n private readonly doc = inject(DOCUMENT);\n private readonly isBrowser = isPlatformBrowser(inject(PLATFORM_ID));\n\n /** In attach order — last is top-most. */\n private readonly watchers: Watcher[] = [];\n private cleanup: (() => void) | null = null;\n private pressOrigin: EventTarget | null = null;\n\n /**\n * Emits every `click` / `auxclick` / `contextmenu` that lands outside the\n * given overlay's pane, for as long as the overlay is attached.\n *\n * **It completes when the overlay detaches, and that is load-bearing.** Every\n * one of the ten call sites subscribes inside its own `openOverlay()` and\n * pipes `takeUntilDestroyed(destroyRef)` — a DIRECTIVE lifetime, not an\n * overlay one — and none of them unsubscribes on close, because the natural\n * reading of that idiom is \"this ends with the component\". Without the\n * completion below the teardown never ran: one watcher accumulated per OPEN\n * for the life of the page, each pinning a disposed `OverlayRef` (and through\n * it a detached pane, its portal outlet and their injectors), the four\n * capture-phase document listeners could never come down because\n * `watchers.length` never reached zero, and every click on the page walked a\n * list that only grew. A `mode=\"tooltip\"` popover made it unbounded — one\n * permanent watcher per hover.\n *\n * Completing here rather than fixing ten call sites is deliberate: the next\n * component to open an overlay would have made the same reasonable mistake.\n * It is also what CDK's own `OverlayRef.outsidePointerEvents()` does.\n */\n outsidePointerEvents(overlayRef: OverlayRef): Observable<MouseEvent> {\n return new Observable<MouseEvent>(subscriber => {\n if (!this.isBrowser) return;\n\n const watcher: Watcher = { overlayRef, subscriber };\n this.watchers.push(watcher);\n if (this.watchers.length === 1) this.listen();\n\n // BOTH handlers, and the second one is not defensive padding. `dispose()`\n // emits a detachment and then completes the subject, so a live overlay\n // arrives through `next` — but a ref that was already disposed before\n // anyone subscribed has nothing left to emit and arrives through\n // `complete` alone. Listening for `next` only left exactly the watcher\n // this whole change exists to remove.\n const ended = (): void => subscriber.complete();\n const detached = overlayRef.detachments().subscribe({ next: ended, complete: ended });\n\n return () => {\n detached.unsubscribe();\n const index = this.watchers.indexOf(watcher);\n if (index > -1) this.watchers.splice(index, 1);\n if (!this.watchers.length) this.unlisten();\n };\n });\n }\n\n private readonly onPointerDown = (event: Event): void => {\n this.pressOrigin = eventTarget(event);\n };\n\n private readonly onClick = (event: Event): void => {\n const target = eventTarget(event);\n // `detail > 0` means the click really came from a pointer press. A click\n // activated by Enter or Space carries `detail: 0` and has no `pointerdown`\n // of its own — so trusting a leftover origin there judged it by a press\n // that belonged to something else entirely. A press inside the pane that\n // never produced a click (a drag released off-window, a node removed under\n // the finger, a cancelled touch) survives in `pressOrigin`, and the next\n // keyboard activation anywhere on the page then read as \"inside\": the panel\n // would not close, for keyboard users only.\n const fromPointer = event.type === 'click' && (event as MouseEvent).detail > 0;\n const origin = fromPointer && this.pressOrigin ? this.pressOrigin : target;\n this.pressOrigin = null;\n\n // Snapshot: a watcher that closes on this event unsubscribes synchronously,\n // mutating `watchers` while we're walking it.\n const watchers = this.watchers.slice();\n for (let i = watchers.length - 1; i > -1; i--) {\n const { overlayRef, subscriber } = watchers[i];\n if (!overlayRef.hasAttached()) continue;\n\n const pane = overlayRef.overlayElement;\n if (containsAcrossShadow(pane, target) || containsAcrossShadow(pane, origin)) break;\n\n subscriber.next(event as MouseEvent);\n }\n };\n\n private listen(): void {\n const options: AddEventListenerOptions = { capture: true };\n const doc = this.doc;\n\n doc.addEventListener('pointerdown', this.onPointerDown, options);\n doc.addEventListener('click', this.onClick, options);\n doc.addEventListener('auxclick', this.onClick, options);\n doc.addEventListener('contextmenu', this.onClick, options);\n\n this.cleanup = () => {\n doc.removeEventListener('pointerdown', this.onPointerDown, options);\n doc.removeEventListener('click', this.onClick, options);\n doc.removeEventListener('auxclick', this.onClick, options);\n doc.removeEventListener('contextmenu', this.onClick, options);\n };\n }\n\n private unlisten(): void {\n this.cleanup?.();\n this.cleanup = null;\n this.pressOrigin = null;\n }\n}\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { OverlayContainer } from '@angular/cdk/overlay';\nimport { Service } from '@angular/core';\n\n/**\n * Custom CDK `OverlayContainer` subclass that tags its DOM element with\n * `.wr-overlay-container` in addition to CDK's own `.cdk-overlay-container`.\n *\n * Why: CDK uses a single overlay container per app — every CDK consumer\n * (this lib, Angular Material, NG-ZORRO, etc.) puts its overlays in the\n * same root element. With this class applied you can scope NGWR-specific\n * overlay styles via the tag, e.g.:\n *\n * ```scss\n * .wr-overlay-container .cdk-overlay-pane { z-index: 1100; }\n * ```\n *\n * It does **not** isolate two libraries that both subclass OverlayContainer\n * — the last provider wins. It does give NGWR overlays a stable CSS hook.\n */\n@Service()\nexport class WrOverlayContainer extends OverlayContainer {\n protected override _createContainer(): void {\n super._createContainer();\n this._containerElement?.classList.add('wr-overlay-container');\n }\n}\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { Overlay } from '@angular/cdk/overlay';\nimport { InjectionToken, inject } from '@angular/core';\n\n/**\n * Injection token for the CDK `Overlay` service NGWR components should\n * use to open panels.\n *\n * Defaults to CDK's root `Overlay` (shared with every other CDK consumer\n * in the app). Call `provideWrOverlay()` to bind it to an isolated\n * `Overlay` instance backed by a separate `OverlayContainer` — that way\n * NGWR overlays don't share the same DOM root with other libraries.\n *\n * @internal — directives/services inside the lib inject this instead of\n * CDK's `Overlay` directly.\n */\nexport const WR_OVERLAY = new InjectionToken<Overlay>('WR_OVERLAY', {\n providedIn: 'root',\n factory: () => inject(Overlay),\n});\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { OverlayContainer } from '@angular/cdk/overlay';\nimport { InjectionToken, inject } from '@angular/core';\n\n/**\n * Injection token for the overlay container NGWR components should use.\n *\n * Defaults to CDK's `OverlayContainer` — i.e. the same root element every\n * CDK consumer shares. Call `provideWrOverlay()` to replace it with an\n * isolated instance so NGWR overlays don't collide with other libraries.\n *\n * @internal\n */\nexport const WR_OVERLAY_CONTAINER = new InjectionToken<OverlayContainer>('WR_OVERLAY_CONTAINER', {\n providedIn: 'root',\n factory: () => inject(OverlayContainer),\n});\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { InjectionToken } from '@angular/core';\n\n/** Configuration for responsive (bottom-sheet) overlay presentation. */\ninterface WrResponsiveOverlaysConfig {\n /**\n * Viewport width (CSS px) at or below which overlays present as a\n * bottom-sheet instead of a floating panel. @default 640\n */\n readonly breakpoint: number;\n}\n\n/**\n * When set, overlay services (dialog, select, dropdown, …) present as a\n * slide-up bottom-sheet on viewports at or below `breakpoint`. `null`\n * (the default) keeps every overlay floating. Configure via\n * {@link provideWrResponsiveOverlays}; override per call with a\n * component's `responsive` option.\n *\n * @internal\n */\nconst WR_RESPONSIVE_OVERLAYS = new InjectionToken<WrResponsiveOverlaysConfig | null>('WR_RESPONSIVE_OVERLAYS', {\n factory: () => null,\n});\n\n/**\n * Decide whether an overlay should present as a bottom-sheet for the\n * current viewport.\n *\n * - `responsive === true` — sheet on small viewports regardless of config.\n * - `responsive === false` — never a sheet.\n * - `responsive === undefined` — follow the global config (sheet when\n * {@link provideWrResponsiveOverlays} is configured).\n *\n * SSR-safe: returns `false` when there's no `window`.\n *\n * @internal\n */\nfunction wrPresentAsSheet(responsive: boolean | undefined, config: WrResponsiveOverlaysConfig | null): boolean {\n const enabled = responsive ?? config !== null;\n if (!enabled || typeof window === 'undefined') return false;\n return window.innerWidth <= (config?.breakpoint ?? 640);\n}\n\nexport { WR_RESPONSIVE_OVERLAYS, wrPresentAsSheet };\nexport type { WrResponsiveOverlaysConfig };\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { Overlay, OverlayContainer } from '@angular/cdk/overlay';\nimport {\n EnvironmentInjector,\n Injector,\n type EnvironmentProviders,\n inject,\n makeEnvironmentProviders,\n provideEnvironmentInitializer,\n} from '@angular/core';\n\nimport { WrVisualViewport } from 'ngwr/platform';\n\nimport { WR_OVERLAY, WR_OVERLAY_CONTAINER } from './tokens';\nimport { WrOverlayContainer } from './wr-overlay-container';\n\n/**\n * Isolates NGWR overlays from other CDK consumers in the app.\n *\n * Without this call, NGWR overlays use CDK's root `Overlay` — they\n * render into the same `.cdk-overlay-container` element as Angular\n * Material, NG-ZORRO, etc. With it, NGWR gets its own `OverlayContainer`\n * (marked `.wr-overlay-container`) **and** its own `Overlay` service\n * instance — so styles, z-index, and lifecycle never collide.\n *\n * It does this by replacing two injection tokens:\n * - `WR_OVERLAY_CONTAINER` → custom `WrOverlayContainer` subclass\n * - `WR_OVERLAY` → a fresh `Overlay` instance built in a child injector\n * that resolves `OverlayContainer` to the custom subclass\n *\n * CDK's own root `Overlay` / `OverlayContainer` are left untouched, so\n * other libraries keep working with their original container.\n *\n * @example\n * ```ts\n * import { provideWrOverlay } from 'ngwr/overlay';\n *\n * bootstrapApplication(AppComponent, {\n * providers: [\n * provideWrOverlay(),\n * ],\n * });\n * ```\n */\nexport function provideWrOverlay(): EnvironmentProviders {\n return makeEnvironmentProviders([\n // Track the visual viewport app-wide so overlay sheets (and the\n // command-palette) can lift above the on-screen keyboard. No-op on the\n // server / in browsers without the API.\n provideEnvironmentInitializer(() => void inject(WrVisualViewport)),\n { provide: WR_OVERLAY_CONTAINER, useClass: WrOverlayContainer },\n {\n provide: WR_OVERLAY,\n useFactory: (): Overlay => {\n const parent = inject(EnvironmentInjector);\n const container = inject(WR_OVERLAY_CONTAINER);\n\n // Child injector resolves `OverlayContainer` to our subclass and\n // creates a fresh `Overlay` instance bound to it. CDK's own root\n // `Overlay` and `OverlayContainer` are untouched in the parent.\n const child = Injector.create({\n parent,\n providers: [\n { provide: OverlayContainer, useValue: container },\n { provide: Overlay, useClass: Overlay },\n ],\n });\n\n return child.get(Overlay);\n },\n },\n ]);\n}\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { type EnvironmentProviders, makeEnvironmentProviders } from '@angular/core';\n\nimport { WR_RESPONSIVE_OVERLAYS, type WrResponsiveOverlaysConfig } from './tokens/wr-responsive-overlays.token';\n\n/**\n * Opt every NGWR overlay into responsive presentation — on viewports at or\n * below `breakpoint`, dialogs / selects / dropdowns and friends slide up as\n * a full-width bottom-sheet instead of a floating panel. Built on the same\n * overlay plumbing, so focus-trap, backdrop and scroll-blocking carry over.\n *\n * Individual components can still opt out (or in) per instance via their\n * `responsive` option.\n *\n * @example\n * ```ts\n * bootstrapApplication(AppComponent, {\n * providers: [provideWrOverlay(), provideWrResponsiveOverlays()],\n * });\n *\n * // Custom breakpoint:\n * provideWrResponsiveOverlays({ breakpoint: 768 });\n * ```\n */\nexport function provideWrResponsiveOverlays(config?: Partial<WrResponsiveOverlaysConfig>): EnvironmentProviders {\n return makeEnvironmentProviders([\n { provide: WR_RESPONSIVE_OVERLAYS, useValue: { breakpoint: config?.bre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