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.
Files changed (149) hide show
  1. package/README.md +3 -3
  2. package/fesm2022/ngwr-breadcrumbs.mjs +2 -2
  3. package/fesm2022/ngwr-breadcrumbs.mjs.map +1 -1
  4. package/fesm2022/ngwr-cascader.mjs +15 -3
  5. package/fesm2022/ngwr-cascader.mjs.map +1 -1
  6. package/fesm2022/ngwr-color-picker.mjs +18 -2
  7. package/fesm2022/ngwr-color-picker.mjs.map +1 -1
  8. package/fesm2022/ngwr-context-menu.mjs +35 -3
  9. package/fesm2022/ngwr-context-menu.mjs.map +1 -1
  10. package/fesm2022/ngwr-date-picker.mjs +30 -2
  11. package/fesm2022/ngwr-date-picker.mjs.map +1 -1
  12. package/fesm2022/ngwr-dialog.mjs +12 -1
  13. package/fesm2022/ngwr-dialog.mjs.map +1 -1
  14. package/fesm2022/ngwr-drag-drop.mjs +2 -2
  15. package/fesm2022/ngwr-drag-drop.mjs.map +1 -1
  16. package/fesm2022/ngwr-drawer.mjs +48 -2
  17. package/fesm2022/ngwr-drawer.mjs.map +1 -1
  18. package/fesm2022/ngwr-dropdown.mjs +22 -2
  19. package/fesm2022/ngwr-dropdown.mjs.map +1 -1
  20. package/fesm2022/ngwr-graph-testing.mjs +243 -0
  21. package/fesm2022/ngwr-graph-testing.mjs.map +1 -0
  22. package/fesm2022/ngwr-graph.mjs +1112 -0
  23. package/fesm2022/ngwr-graph.mjs.map +1 -0
  24. package/fesm2022/ngwr-i18n-ar.mjs +5 -0
  25. package/fesm2022/ngwr-i18n-ar.mjs.map +1 -1
  26. package/fesm2022/ngwr-i18n-cs.mjs +5 -0
  27. package/fesm2022/ngwr-i18n-cs.mjs.map +1 -1
  28. package/fesm2022/ngwr-i18n-de.mjs +5 -0
  29. package/fesm2022/ngwr-i18n-de.mjs.map +1 -1
  30. package/fesm2022/ngwr-i18n-en.mjs +9 -0
  31. package/fesm2022/ngwr-i18n-en.mjs.map +1 -1
  32. package/fesm2022/ngwr-i18n-es.mjs +5 -0
  33. package/fesm2022/ngwr-i18n-es.mjs.map +1 -1
  34. package/fesm2022/ngwr-i18n-fr.mjs +5 -0
  35. package/fesm2022/ngwr-i18n-fr.mjs.map +1 -1
  36. package/fesm2022/ngwr-i18n-he.mjs +5 -0
  37. package/fesm2022/ngwr-i18n-he.mjs.map +1 -1
  38. package/fesm2022/ngwr-i18n-hi.mjs +5 -0
  39. package/fesm2022/ngwr-i18n-hi.mjs.map +1 -1
  40. package/fesm2022/ngwr-i18n-id.mjs +5 -0
  41. package/fesm2022/ngwr-i18n-id.mjs.map +1 -1
  42. package/fesm2022/ngwr-i18n-it.mjs +5 -0
  43. package/fesm2022/ngwr-i18n-it.mjs.map +1 -1
  44. package/fesm2022/ngwr-i18n-ja.mjs +5 -0
  45. package/fesm2022/ngwr-i18n-ja.mjs.map +1 -1
  46. package/fesm2022/ngwr-i18n-ko.mjs +5 -0
  47. package/fesm2022/ngwr-i18n-ko.mjs.map +1 -1
  48. package/fesm2022/ngwr-i18n-nl.mjs +5 -0
  49. package/fesm2022/ngwr-i18n-nl.mjs.map +1 -1
  50. package/fesm2022/ngwr-i18n-pl.mjs +5 -0
  51. package/fesm2022/ngwr-i18n-pl.mjs.map +1 -1
  52. package/fesm2022/ngwr-i18n-pt.mjs +5 -0
  53. package/fesm2022/ngwr-i18n-pt.mjs.map +1 -1
  54. package/fesm2022/ngwr-i18n-ru.mjs +5 -0
  55. package/fesm2022/ngwr-i18n-ru.mjs.map +1 -1
  56. package/fesm2022/ngwr-i18n-sv.mjs +5 -0
  57. package/fesm2022/ngwr-i18n-sv.mjs.map +1 -1
  58. package/fesm2022/ngwr-i18n-tr.mjs +5 -0
  59. package/fesm2022/ngwr-i18n-tr.mjs.map +1 -1
  60. package/fesm2022/ngwr-i18n-uk.mjs +5 -0
  61. package/fesm2022/ngwr-i18n-uk.mjs.map +1 -1
  62. package/fesm2022/ngwr-i18n-vi.mjs +5 -0
  63. package/fesm2022/ngwr-i18n-vi.mjs.map +1 -1
  64. package/fesm2022/ngwr-i18n-zh-TW.mjs +5 -0
  65. package/fesm2022/ngwr-i18n-zh-TW.mjs.map +1 -1
  66. package/fesm2022/ngwr-i18n-zh.mjs +5 -0
  67. package/fesm2022/ngwr-i18n-zh.mjs.map +1 -1
  68. package/fesm2022/ngwr-lightbox.mjs +25 -4
  69. package/fesm2022/ngwr-lightbox.mjs.map +1 -1
  70. package/fesm2022/ngwr-list.mjs +2 -2
  71. package/fesm2022/ngwr-list.mjs.map +1 -1
  72. package/fesm2022/ngwr-mention.mjs +18 -2
  73. package/fesm2022/ngwr-mention.mjs.map +1 -1
  74. package/fesm2022/ngwr-overlay.mjs +119 -4
  75. package/fesm2022/ngwr-overlay.mjs.map +1 -1
  76. package/fesm2022/ngwr-popconfirm.mjs +19 -3
  77. package/fesm2022/ngwr-popconfirm.mjs.map +1 -1
  78. package/fesm2022/ngwr-popover-testing.mjs +22 -5
  79. package/fesm2022/ngwr-popover-testing.mjs.map +1 -1
  80. package/fesm2022/ngwr-popover.mjs +215 -27
  81. package/fesm2022/ngwr-popover.mjs.map +1 -1
  82. package/fesm2022/ngwr-segmented.mjs +34 -1
  83. package/fesm2022/ngwr-segmented.mjs.map +1 -1
  84. package/fesm2022/ngwr-select.mjs +15 -1
  85. package/fesm2022/ngwr-select.mjs.map +1 -1
  86. package/fesm2022/ngwr-toast.mjs +19 -2
  87. package/fesm2022/ngwr-toast.mjs.map +1 -1
  88. package/fesm2022/ngwr-tour.mjs +20 -6
  89. package/fesm2022/ngwr-tour.mjs.map +1 -1
  90. package/fesm2022/ngwr-tree.mjs +9 -2
  91. package/fesm2022/ngwr-tree.mjs.map +1 -1
  92. package/fesm2022/ngwr-version.mjs +1 -1
  93. package/fesm2022/ngwr-version.mjs.map +1 -1
  94. package/fesm2022/ngwr-window.mjs +18 -1
  95. package/fesm2022/ngwr-window.mjs.map +1 -1
  96. package/graph/styles/_index.scss +113 -0
  97. package/i18n/ar.json +5 -0
  98. package/i18n/cs.json +5 -0
  99. package/i18n/de.json +5 -0
  100. package/i18n/en.json +5 -0
  101. package/i18n/es.json +5 -0
  102. package/i18n/fr.json +5 -0
  103. package/i18n/he.json +5 -0
  104. package/i18n/hi.json +5 -0
  105. package/i18n/id.json +5 -0
  106. package/i18n/it.json +5 -0
  107. package/i18n/ja.json +5 -0
  108. package/i18n/ko.json +5 -0
  109. package/i18n/nl.json +5 -0
  110. package/i18n/pl.json +5 -0
  111. package/i18n/pt.json +5 -0
  112. package/i18n/ru.json +5 -0
  113. package/i18n/sv.json +5 -0
  114. package/i18n/tr.json +5 -0
  115. package/i18n/uk.json +5 -0
  116. package/i18n/vi.json +5 -0
  117. package/i18n/zh-TW.json +5 -0
  118. package/i18n/zh.json +5 -0
  119. package/llms-full.txt +12 -2
  120. package/llms.txt +8 -6
  121. package/package.json +10 -1
  122. package/schematics/use/symbol-map.json +2 -0
  123. package/segmented/styles/_index.scss +8 -0
  124. package/skills/ngwr/SKILL.md +1 -1
  125. package/skills/ngwr/references/catalog.md +2 -0
  126. package/styles.scss +1 -0
  127. package/theme/styles/_focus.scss +7 -0
  128. package/types/ngwr-cascader.d.ts +7 -0
  129. package/types/ngwr-color-picker.d.ts +8 -0
  130. package/types/ngwr-context-menu.d.ts +10 -0
  131. package/types/ngwr-date-picker.d.ts +16 -0
  132. package/types/ngwr-dialog.d.ts +1 -0
  133. package/types/ngwr-drawer.d.ts +28 -0
  134. package/types/ngwr-dropdown.d.ts +9 -0
  135. package/types/ngwr-graph-testing.d.ts +190 -0
  136. package/types/ngwr-graph.d.ts +203 -0
  137. package/types/ngwr-lightbox.d.ts +15 -0
  138. package/types/ngwr-mention.d.ts +7 -0
  139. package/types/ngwr-overlay.d.ts +62 -4
  140. package/types/ngwr-popconfirm.d.ts +1 -0
  141. package/types/ngwr-popover-testing.d.ts +22 -5
  142. package/types/ngwr-popover.d.ts +28 -8
  143. package/types/ngwr-segmented.d.ts +16 -0
  144. package/types/ngwr-select.d.ts +7 -0
  145. package/types/ngwr-toast.d.ts +2 -0
  146. package/types/ngwr-tour.d.ts +6 -0
  147. package/types/ngwr-tree.d.ts +2 -1
  148. package/types/ngwr-version.d.ts +1 -1
  149. package/types/ngwr-window.d.ts +1 -0
@@ -1,13 +1,15 @@
1
+ import { FocusMonitor } from '@angular/cdk/a11y';
1
2
  import { Directionality } from '@angular/cdk/bidi';
2
3
  import { coerceBooleanProperty } from '@angular/cdk/coercion';
3
4
  import { ScrollStrategyOptions } from '@angular/cdk/overlay';
4
5
  import { ComponentPortal, TemplatePortal } from '@angular/cdk/portal';
5
6
  import * as i0 from '@angular/core';
6
- import { input, ViewEncapsulation, Component, output, inject, ElementRef, ViewContainerRef, DestroyRef, signal, computed, effect, Directive } from '@angular/core';
7
+ import { inject, DestroyRef, PLATFORM_ID, Service, input, ViewEncapsulation, Component, output, ElementRef, ViewContainerRef, Injector, signal, computed, effect, afterNextRender, Directive } from '@angular/core';
7
8
  import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
8
9
  import { useI18nText } from 'ngwr/i18n';
9
- import { WR_OVERLAY, WrOutsideClick, WR_RESPONSIVE_OVERLAYS, wrPresentAsSheet, wrMirrorOffsets } from 'ngwr/overlay';
10
- import { numAttr } from 'ngwr/utils';
10
+ import { WR_OVERLAY, WrOutsideClick, WR_RESPONSIVE_OVERLAYS, wrPresentAsSheet, wrMirrorOffsets, wrFollowDirection } from 'ngwr/overlay';
11
+ import { KEYS, numAttr } from 'ngwr/utils';
12
+ import { DOCUMENT, isPlatformBrowser } from '@angular/common';
11
13
 
12
14
  /**
13
15
  * @license
@@ -98,6 +100,83 @@ function wrPopoverPositions(position, paneClass) {
98
100
  }));
99
101
  }
100
102
 
103
+ /**
104
+ * @license
105
+ *
106
+ * Use of this source code is governed by an MIT-style license that can be
107
+ * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE
108
+ */
109
+ /** `FocusMonitor._setOrigin`'s own window — see the class docs for why it matches. */
110
+ const KEYSTROKE_WINDOW_MS = 1;
111
+ /**
112
+ * The key of the keystroke being handled RIGHT NOW — `null` between them.
113
+ *
114
+ * `FocusMonitor` answers "the most recent input modality was a keyboard", which
115
+ * is a weaker statement than "the user's own key put focus here", and the gap
116
+ * between the two is exactly where a tooltip goes wrong. The origin is whatever
117
+ * was pressed within the last millisecond (`_setOrigin` clears it on a 1ms
118
+ * timer), and an overlay dismissed with Escape hands focus BACK to its trigger
119
+ * synchronously, inside that same keystroke — CDK's keyboard dispatcher listens
120
+ * on `<body>` in the bubble phase, the modality detector on `document` in
121
+ * capture, so the modality is always already `keyboard` by the time the drawer
122
+ * runs. Same for a ✕ activated with Enter. So the CDK reports `keyboard` for a
123
+ * hand-back and a tooltip reading the origin alone still shows itself unbidden,
124
+ * which is the whole failure it was meant to stop.
125
+ *
126
+ * The KEY separates them: `Tab` and the arrows are how a user moves focus,
127
+ * `Escape` and `Enter` dismiss and activate. A focus that lands during one of
128
+ * those was moved by a script.
129
+ *
130
+ * One passive capture listener for the whole app, constructed with the first
131
+ * `[wrPopover]` and never before it — beside the three `InputModalityDetector`
132
+ * already installs.
133
+ *
134
+ * The key expires on the CDK's own 1ms window rather than on a bare macrotask,
135
+ * and matching it is the point: the key is only ever read to EXPLAIN a keyboard
136
+ * origin, so it must not run out while the origin it explains is still live. A
137
+ * `setTimeout(0)` close would land in exactly that gap — key already forgotten,
138
+ * origin still `keyboard` — and read as a Tab. Everything a keystroke does
139
+ * synchronously, its default action and the click Enter dispatches included,
140
+ * happens long before either timer; anything that waits past them is judged
141
+ * `program` by the CDK and never reaches this question.
142
+ *
143
+ * Popover-local on purpose; no other component in the catalog asks this yet.
144
+ */
145
+ class WrCurrentKeystroke {
146
+ doc = inject(DOCUMENT);
147
+ destroyRef = inject(DestroyRef);
148
+ isBrowser = isPlatformBrowser(inject(PLATFORM_ID));
149
+ current = null;
150
+ clearTimer = null;
151
+ /** `KeyboardEvent.key` for the keystroke in flight, `null` outside one. */
152
+ get key() {
153
+ return this.current;
154
+ }
155
+ constructor() {
156
+ if (!this.isBrowser)
157
+ return;
158
+ const record = (event) => {
159
+ this.current = event.key;
160
+ if (this.clearTimer)
161
+ clearTimeout(this.clearTimer);
162
+ this.clearTimer = setTimeout(() => (this.current = null), KEYSTROKE_WINDOW_MS);
163
+ };
164
+ // Capture, so the key is on record before any handler deeper in the tree
165
+ // gets to move focus with it.
166
+ this.doc.addEventListener('keydown', record, { capture: true, passive: true });
167
+ this.destroyRef.onDestroy(() => {
168
+ if (this.clearTimer)
169
+ clearTimeout(this.clearTimer);
170
+ this.doc.removeEventListener('keydown', record, { capture: true });
171
+ });
172
+ }
173
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.6", ngImport: i0, type: WrCurrentKeystroke, deps: [], target: i0.ɵɵFactoryTarget.Service });
174
+ static ɵprov = i0.ɵɵngDeclareService({ minVersion: "22.0.0", version: "22.1.6", ngImport: i0, type: WrCurrentKeystroke });
175
+ }
176
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.6", ngImport: i0, type: WrCurrentKeystroke, decorators: [{
177
+ type: Service
178
+ }], ctorParameters: () => [] });
179
+
101
180
  /**
102
181
  * @license
103
182
  *
@@ -136,6 +215,27 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.6", ngImpor
136
215
  * Use of this source code is governed by an MIT-style license that can be
137
216
  * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE
138
217
  */
218
+ /**
219
+ * Keys the USER moves focus with: Tab through the page, the arrows / Home /
220
+ * End through a composite that roves its own tabindex.
221
+ *
222
+ * A roving arrow move is a script `.focus()` call too — the difference from a
223
+ * dismissal is not who called `focus()` but whether the keystroke was a
224
+ * NAVIGATION or an action. Anything absent from this list (Escape, Enter,
225
+ * Space, a character) does something else for a living, so focus that lands
226
+ * during one of them was placed by a script and a tooltip stays shut.
227
+ */
228
+ const NAVIGATION_KEYS = new Set([
229
+ KEYS.TAB,
230
+ KEYS.ARROW_UP,
231
+ KEYS.ARROW_DOWN,
232
+ KEYS.ARROW_LEFT,
233
+ KEYS.ARROW_RIGHT,
234
+ KEYS.HOME,
235
+ KEYS.END,
236
+ KEYS.PAGE_UP,
237
+ KEYS.PAGE_DOWN,
238
+ ]);
139
239
  /**
140
240
  * Anchored content panel. The same directive covers two shapes:
141
241
  *
@@ -144,9 +244,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.6", ngImpor
144
244
  * forms, summaries, menus.
145
245
  *
146
246
  * - **Tooltip** (`mode="tooltip"`) — `[wrPopover]` takes a plain string.
147
- * Shown on hover and focus, dismissed on blur / pointer-leave / Escape.
148
- * Uses `aria-describedby` instead of `aria-haspopup` and is rendered into
149
- * a small dark text panel.
247
+ * Shown on hover and when the KEYBOARD puts focus on the trigger — never for
248
+ * a `.focus()` call, which is what a dialog or drawer does when it hands
249
+ * focus back. Dismissed when focus leaves / on pointer-leave / Escape. Uses
250
+ * `aria-describedby` instead of `aria-haspopup` and is rendered into a small
251
+ * dark text panel.
150
252
  *
151
253
  * Built on CDK Overlay so it auto-flips, closes on outside-click and Escape.
152
254
  *
@@ -179,14 +281,14 @@ class WrPopover {
179
281
  *
180
282
  * - `'popover'` (default) — template content, click trigger, dialog
181
283
  * semantics.
182
- * - `'tooltip'` — text content, hover+focus trigger, `role="tooltip"`,
183
- * `aria-describedby` on the host.
284
+ * - `'tooltip'` — text content, hover / keyboard-focus trigger,
285
+ * `role="tooltip"`, `aria-describedby` on the host.
184
286
  */
185
287
  mode = input('popover', /* @ts-ignore */
186
288
  ...(ngDevMode ? [{ debugName: "mode" }] : /* istanbul ignore next */ []));
187
289
  /**
188
- * How the popover opens. Ignored in tooltip mode — tooltips are always
189
- * hover+focus. @default 'click'
290
+ * How the popover opens. Ignored in tooltip mode — a tooltip is always hover
291
+ * plus keyboard focus. @default 'click'
190
292
  */
191
293
  trigger = input('click', /* @ts-ignore */
192
294
  ...(ngDevMode ? [{ debugName: "trigger" }] : /* istanbul ignore next */ []));
@@ -217,6 +319,8 @@ class WrPopover {
217
319
  /** Fires after the panel closes. */
218
320
  closed = output();
219
321
  host = inject(ElementRef);
322
+ focusMonitor = inject(FocusMonitor);
323
+ keystroke = inject(WrCurrentKeystroke);
220
324
  overlay = inject(WR_OVERLAY);
221
325
  dir = inject(Directionality, { optional: true });
222
326
  outsideClick = inject(WrOutsideClick);
@@ -224,6 +328,7 @@ class WrPopover {
224
328
  vcr = inject(ViewContainerRef);
225
329
  scrollStrategies = inject(ScrollStrategyOptions);
226
330
  destroyRef = inject(DestroyRef);
331
+ injector = inject(Injector);
227
332
  /** @internal */
228
333
  isOpen = signal(false, /* @ts-ignore */
229
334
  ...(ngDevMode ? [{ debugName: "isOpen" }] : /* istanbul ignore next */ []));
@@ -237,6 +342,8 @@ class WrPopover {
237
342
  ...(ngDevMode ? [{ debugName: "resolvedPosition" }] : /* istanbul ignore next */ []));
238
343
  overlayRef = null;
239
344
  textPanelRef = null;
345
+ /** Whether the HOST itself holds focus — not a descendant of it. */
346
+ hostFocused = false;
240
347
  hoverCloseTimer = null;
241
348
  showTimer = null;
242
349
  hideTimer = null;
@@ -259,9 +366,66 @@ class WrPopover {
259
366
  const content = this.content();
260
367
  this.textPanelRef?.setInput('text', typeof content === 'string' ? content : '');
261
368
  });
369
+ // A tooltip answers the USER'S KEYBOARD, not every focus there is.
370
+ //
371
+ // `(focus)` fired for a programmatic one too, and something hands focus back
372
+ // to a trigger constantly: `WrDrawer` and `WrDialog` restore the element that
373
+ // was active when they opened, this directive does the same for its own
374
+ // popover, and any app may call `.focus()`. So closing a drawer opened from a
375
+ // button with a tooltip re-showed that tooltip with NOTHING left to dismiss
376
+ // it — the pointer is elsewhere, so no `mouseleave`, and focus stays on the
377
+ // button, so no blur. A pane stranded under the trigger, reported from a real
378
+ // app. The event alone cannot tell those apart; `FocusMonitor` is the CDK's
379
+ // answer to where a focus came from, and it is what Material's tooltip reads
380
+ // for the same reason. Mouse and touch origins are deliberately ignored:
381
+ // hover already drives both, and acting on them would show the tooltip twice
382
+ // over.
383
+ //
384
+ // The origin alone is NOT enough, though, and reading it as if it were leaves
385
+ // the reported bug half open: the CDK's `keyboard` means "a key went down
386
+ // within the last millisecond", and the dismissal that hands focus back is
387
+ // itself a keystroke — Escape on a drawer, Enter on its ✕. See
388
+ // `WrCurrentKeystroke` for the key that tells a navigation from a dismissal.
389
+ //
390
+ // Monitored in EVERY mode rather than only under `mode="tooltip"` — the mode
391
+ // is an input and may flip after this runs, and a subscription that only
392
+ // half-exists is the failure this fix is about. The handler asks instead. The
393
+ // cost is the CDK's own `cdk-*-focused` classes on the host, which nothing in
394
+ // ngwr styles.
395
+ //
396
+ // `afterNextRender` because monitoring binds document listeners: there is no
397
+ // DOM to bind them to on the server.
398
+ afterNextRender(() => {
399
+ this.focusMonitor
400
+ .monitor(this.host)
401
+ .pipe(takeUntilDestroyed(this.destroyRef))
402
+ .subscribe(origin => {
403
+ if (origin) {
404
+ this.hostFocused = true;
405
+ if (this.isTooltip() && origin === 'keyboard' && this.fromNavigationKey())
406
+ this.scheduleShow();
407
+ return;
408
+ }
409
+ // A null origin is a blur, and the CDK reports one for a DESCENDANT
410
+ // too: `_onFocus` bails when the event target is not the monitored
411
+ // element, `_onBlur` has no such guard. The old `(blur)` binding never
412
+ // bubbled, so hiding on one is new — hover a wrapper, click the button
413
+ // inside it, tab away, and the tooltip the POINTER opened vanished
414
+ // while the pointer never moved. Only the host's own focus counts.
415
+ if (!this.hostFocused)
416
+ return;
417
+ this.hostFocused = false;
418
+ if (this.isTooltip())
419
+ this.scheduleHide();
420
+ });
421
+ });
262
422
  this.destroyRef.onDestroy(() => {
263
423
  this.clearTimers();
264
424
  this.closeOverlay(false);
425
+ // Completes the subject `monitor()` handed out and drops the global
426
+ // listeners it registered for this element; the pipe above unsubscribes
427
+ // either way, but the CDK's own bookkeeping only clears from here.
428
+ this.focusMonitor.stopMonitoring(this.host);
265
429
  });
266
430
  }
267
431
  open() {
@@ -314,24 +478,34 @@ class WrPopover {
314
478
  this.scheduleHoverClose();
315
479
  }
316
480
  /** @internal */
317
- onFocus() {
318
- if (!this.isTooltip())
319
- return;
320
- this.scheduleShow();
321
- }
322
- /** @internal */
323
- onBlur() {
324
- if (!this.isTooltip())
325
- return;
326
- this.scheduleHide();
327
- }
328
- /** @internal */
329
481
  onEscape() {
330
482
  if (!this.isTooltip())
331
483
  return;
332
484
  this.clearTimers();
333
485
  this.isOpen.set(false);
334
486
  }
487
+ /**
488
+ * Whether the keystroke in flight is one the user moves focus with.
489
+ *
490
+ * Asked only of a `keyboard` origin, which the CDK grants to any focus landing
491
+ * within a millisecond of a keydown — including the hand-back a drawer
492
+ * performs while Escape is still being handled. That is the reported bug's
493
+ * keyboard half, and the origin cannot see it.
494
+ *
495
+ * NO key on record answers `true`, and that polarity is chosen rather than
496
+ * inherited: a keyboard modality with no keystroke behind it is a screen
497
+ * reader's virtual cursor (the CDK reads its synthetic mousedown as
498
+ * `keyboard`) or a deliberate `focusVia(el, 'keyboard')`, and both are the
499
+ * user. Refusing wants positive evidence of a key that does something other
500
+ * than navigate — silence must not cost an AT user the hint. The two windows
501
+ * are aligned so that "keyboard origin, no key" cannot mean "the key just
502
+ * expired"; what it does still admit is a `FocusMonitorDetectionMode.EVENTUAL`
503
+ * app, where the CDK never expires an origin at all.
504
+ */
505
+ fromNavigationKey() {
506
+ const key = this.keystroke.key;
507
+ return key === null || NAVIGATION_KEYS.has(key);
508
+ }
335
509
  // Tooltip timers
336
510
  scheduleShow() {
337
511
  if (this.isOpen()) {
@@ -369,13 +543,17 @@ class WrPopover {
369
543
  // from the trigger and slide the panel up from the bottom edge.
370
544
  const asSheet = !tooltip && wrPresentAsSheet(this.responsive(), this.responsiveConfig);
371
545
  const paneClass = tooltip ? 'wr-tooltip-overlay' : 'wr-popover-overlay';
372
- const positionStrategy = asSheet
373
- ? this.overlay.position().global().centerHorizontally().bottom('0')
546
+ // Kept as its own binding rather than inlined into the ternary: it is the
547
+ // half a direction flip has to rebuild, and a sheet — anchored to nothing —
548
+ // has no list at all, which is what `null` says here.
549
+ const connected = asSheet
550
+ ? null
374
551
  : this.overlay
375
552
  .position()
376
553
  .flexibleConnectedTo(this.host)
377
554
  .withPositions(wrMirrorOffsets(wrPopoverPositions(position, paneClass), this.isRtl()))
378
555
  .withPush(true);
556
+ const positionStrategy = connected ?? this.overlay.position().global().centerHorizontally().bottom('0');
379
557
  // The `--<placement>` half is no longer set here: each fallback position
380
558
  // carries its own, so the pane names the placement it landed on instead of
381
559
  // the one that was requested, and the arrow follows a flip. A sheet has no
@@ -389,6 +567,15 @@ class WrPopover {
389
567
  backdropClass: asSheet ? 'wr-overlay-backdrop' : undefined,
390
568
  panelClass: overlayClass,
391
569
  });
570
+ // The CDK read the direction once, just now, and will never look again — so
571
+ // an app that flips while this panel is up mirrors the page around a pane
572
+ // still rendering `ltr`, with `wr-segmented` and friends inside it already
573
+ // laying themselves out the other way. Rebuilding the list matters as much
574
+ // as the attribute: `wrMirrorOffsets` turned the 8px gap around at open, and
575
+ // an unmirrored offset puts a side-placed panel back on top of its trigger.
576
+ // A sheet has no list, and `connected?.` is what says so — the arguments are
577
+ // never evaluated for one.
578
+ wrFollowDirection(this.overlayRef, this.dir, this.injector, direction => connected?.withPositions(wrMirrorOffsets(wrPopoverPositions(position, paneClass), direction === 'rtl')));
392
579
  if (asSheet) {
393
580
  this.overlayRef
394
581
  .backdropClick()
@@ -555,7 +742,7 @@ class WrPopover {
555
742
  return this.dir?.value === 'rtl';
556
743
  }
557
744
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.6", ngImport: i0, type: WrPopover, deps: [], target: i0.ɵɵFactoryTarget.Directive });
558
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.1.6", type: WrPopover, isStandalone: true, selector: "[wrPopover]", inputs: { content: { classPropertyName: "content", publicName: "wrPopover", isSignal: true, isRequired: true, transformFunction: null }, mode: { classPropertyName: "mode", publicName: "mode", isSignal: true, isRequired: false, transformFunction: null }, trigger: { classPropertyName: "trigger", publicName: "trigger", isSignal: true, isRequired: false, transformFunction: null }, position: { classPropertyName: "position", publicName: "position", isSignal: true, isRequired: false, transformFunction: null }, showDelay: { classPropertyName: "showDelay", publicName: "showDelay", isSignal: true, isRequired: false, transformFunction: null }, hideDelay: { classPropertyName: "hideDelay", publicName: "hideDelay", isSignal: true, isRequired: false, transformFunction: null }, responsive: { classPropertyName: "responsive", publicName: "responsive", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "ariaLabel", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { opened: "opened", closed: "closed" }, host: { listeners: { "click": "onClick($event)", "mouseenter": "onMouseEnter()", "mouseleave": "onMouseLeave($event)", "focus": "onFocus()", "blur": "onBlur()", "keydown.escape": "onEscape()" }, properties: { "attr.aria-haspopup": "isTooltip() ? null : \"dialog\"", "attr.aria-expanded": "isTooltip() ? null : isOpen()", "attr.aria-controls": "!isTooltip() && isOpen() ? panelId : null", "attr.aria-describedby": "isTooltip() && isOpen() ? panelId : null" }, classAttribute: "wr-popover-trigger" }, exportAs: ["wrPopover"], ngImport: i0 });
745
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.1.6", type: WrPopover, isStandalone: true, selector: "[wrPopover]", inputs: { content: { classPropertyName: "content", publicName: "wrPopover", isSignal: true, isRequired: true, transformFunction: null }, mode: { classPropertyName: "mode", publicName: "mode", isSignal: true, isRequired: false, transformFunction: null }, trigger: { classPropertyName: "trigger", publicName: "trigger", isSignal: true, isRequired: false, transformFunction: null }, position: { classPropertyName: "position", publicName: "position", isSignal: true, isRequired: false, transformFunction: null }, showDelay: { classPropertyName: "showDelay", publicName: "showDelay", isSignal: true, isRequired: false, transformFunction: null }, hideDelay: { classPropertyName: "hideDelay", publicName: "hideDelay", isSignal: true, isRequired: false, transformFunction: null }, responsive: { classPropertyName: "responsive", publicName: "responsive", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "ariaLabel", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { opened: "opened", closed: "closed" }, host: { listeners: { "click": "onClick($event)", "mouseenter": "onMouseEnter()", "mouseleave": "onMouseLeave($event)", "keydown.escape": "onEscape()" }, properties: { "attr.aria-haspopup": "isTooltip() ? null : \"dialog\"", "attr.aria-expanded": "isTooltip() ? null : isOpen()", "attr.aria-controls": "!isTooltip() && isOpen() ? panelId : null", "attr.aria-describedby": "isTooltip() && isOpen() ? panelId : null" }, classAttribute: "wr-popover-trigger" }, exportAs: ["wrPopover"], ngImport: i0 });
559
746
  }
560
747
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.6", ngImport: i0, type: WrPopover, decorators: [{
561
748
  type: Directive,
@@ -576,8 +763,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.6", ngImpor
576
763
  '(click)': 'onClick($event)',
577
764
  '(mouseenter)': 'onMouseEnter()',
578
765
  '(mouseleave)': 'onMouseLeave($event)',
579
- '(focus)': 'onFocus()',
580
- '(blur)': 'onBlur()',
766
+ // No `(focus)` / `(blur)` here: a tooltip answers the KEYBOARD, and a plain
767
+ // focus event cannot say where the focus came from. `FocusMonitor` can — see
768
+ // the constructor.
581
769
  '(keydown.escape)': 'onEscape()',
582
770
  },
583
771
  }]
@@ -1 +1 @@
1
- {"version":3,"file":"ngwr-popover.mjs","sources":["../../../projects/lib/popover/interfaces/popover-position.ts","../../../projects/lib/popover/internal/text-panel.ts","../../../projects/lib/popover/popover.ts","../../../projects/lib/popover/ngwr-popover.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\nimport type { ConnectedPosition } from '@angular/cdk/overlay';\n\nexport type WrPopoverPosition =\n | 'top'\n | 'top-start'\n | 'top-end'\n | 'bottom'\n | 'bottom-start'\n | 'bottom-end'\n | 'left'\n | 'left-start'\n | 'left-end'\n | 'right'\n | 'right-start'\n | 'right-end';\n\n/**\n * The CDK geometry for each placement — one position, no fallbacks.\n *\n * The 8px offset is the gap between the trigger and the panel, and it is the\n * reason a flip list matters rather than being a nicety: the flexible strategy\n * emits `offsetX` as a `transform` on the pane, AFTER `withPush` has already\n * decided the coordinate. Push therefore parks a right-anchored panel flush\n * against the viewport edge and the offset then shoves it 8px back out, so a\n * side placement that does not fit loses its border and corner off-screen no\n * matter how hard push works. Flipping to a placement that fits is the only\n * recovery, which is what `WR_POPOVER_FALLBACKS` is for.\n *\n * @internal\n */\nexport const WR_POPOVER_POSITIONS: Record<WrPopoverPosition, ConnectedPosition> = {\n top: { originX: 'center', originY: 'top', overlayX: 'center', overlayY: 'bottom', offsetY: -8 },\n 'top-start': { originX: 'start', originY: 'top', overlayX: 'start', overlayY: 'bottom', offsetY: -8 },\n 'top-end': { originX: 'end', originY: 'top', overlayX: 'end', overlayY: 'bottom', offsetY: -8 },\n bottom: { originX: 'center', originY: 'bottom', overlayX: 'center', overlayY: 'top', offsetY: 8 },\n 'bottom-start': { originX: 'start', originY: 'bottom', overlayX: 'start', overlayY: 'top', offsetY: 8 },\n 'bottom-end': { originX: 'end', originY: 'bottom', overlayX: 'end', overlayY: 'top', offsetY: 8 },\n left: { originX: 'start', originY: 'center', overlayX: 'end', overlayY: 'center', offsetX: -8 },\n 'left-start': { originX: 'start', originY: 'top', overlayX: 'end', overlayY: 'top', offsetX: -8 },\n 'left-end': { originX: 'start', originY: 'bottom', overlayX: 'end', overlayY: 'bottom', offsetX: -8 },\n right: { originX: 'end', originY: 'center', overlayX: 'start', overlayY: 'center', offsetX: 8 },\n 'right-start': { originX: 'end', originY: 'top', overlayX: 'start', overlayY: 'top', offsetX: 8 },\n 'right-end': { originX: 'end', originY: 'bottom', overlayX: 'start', overlayY: 'bottom', offsetX: 8 },\n};\n\n/**\n * What each placement is allowed to flip to when it does not fit, best first.\n * The requested placement always leads, so a panel that fits never moves.\n *\n * Alignment is preserved down the whole chain — a `-start` popover stays\n * `-start` — because the alignment is the author's answer to \"which end of the\n * trigger does this belong to\", and a flip is about the side, not about that.\n *\n * The two axes are deliberately NOT symmetric. A block-axis placement (`top*` /\n * `bottom*`) flips only to its opposite, the classic behaviour, so a dropdown-ish\n * panel can never surprise anyone by appearing beside its trigger. An inline-axis\n * one (`left*` / `right*`) also gets the two block-axis sides, because on a phone\n * NEITHER side fits: at 375px a 233px panel beside a mid-page trigger overflows\n * by 109px to the right and 97px to the left, and only below/above has room.\n *\n * @internal\n */\nexport const WR_POPOVER_FALLBACKS: Record<WrPopoverPosition, readonly WrPopoverPosition[]> = {\n top: ['top', 'bottom'],\n 'top-start': ['top-start', 'bottom-start'],\n 'top-end': ['top-end', 'bottom-end'],\n bottom: ['bottom', 'top'],\n 'bottom-start': ['bottom-start', 'top-start'],\n 'bottom-end': ['bottom-end', 'top-end'],\n left: ['left', 'right', 'bottom', 'top'],\n 'left-start': ['left-start', 'right-start', 'bottom-start', 'top-start'],\n 'left-end': ['left-end', 'right-end', 'bottom-end', 'top-end'],\n right: ['right', 'left', 'bottom', 'top'],\n 'right-start': ['right-start', 'left-start', 'bottom-start', 'top-start'],\n 'right-end': ['right-end', 'left-end', 'bottom-end', 'top-end'],\n};\n\n/**\n * The list `withPositions()` wants, with every link tagged so the pane names the\n * placement it ACTUALLY took rather than the one that was asked for.\n *\n * The tag is what keeps the arrow honest. It is drawn by\n * `.wr-popover-overlay--<placement> > *::after`, so a panel that flipped while\n * the class stayed put would point at a side it no longer sits on. CDK applies a\n * position's own `panelClass` in `_applyPosition` and clears it again on the next\n * one, which is exactly the bookkeeping this needs — hence the class rather than\n * a `positionChanges` subscription.\n *\n * @param paneClass The pane's base class: `wr-popover-overlay` or\n * `wr-tooltip-overlay`. The two modes key their arrows off different\n * selectors, so the prefix cannot live in the table.\n *\n * @internal\n */\nexport function wrPopoverPositions(position: WrPopoverPosition, paneClass: string): ConnectedPosition[] {\n return WR_POPOVER_FALLBACKS[position].map(name => ({\n ...WR_POPOVER_POSITIONS[name],\n panelClass: `${paneClass}--${name}`,\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 } from '@angular/core';\n\n/**\n * Internal floating label rendered when `<… [wrPopover]=\"'…'\" mode=\"tooltip\">`\n * receives a string instead of a template. Not part of the public template\n * API — use the `WrPopover` directive in tooltip mode instead.\n *\n * @internal\n */\n@Component({\n selector: 'wr-popover-text',\n template: '{{ text() }}',\n encapsulation: ViewEncapsulation.None,\n // No `role=\"tooltip\"` here on purpose: the overlay pane this is attached to\n // is the element `aria-describedby` resolves to, and it carries the role.\n // Setting it here too nested one tooltip inside another.\n host: { class: 'wr-tooltip' },\n})\nexport class WrPopoverTextPanel {\n readonly text = input.required<string>();\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 { Directionality } from '@angular/cdk/bidi';\nimport { type BooleanInput, coerceBooleanProperty } from '@angular/cdk/coercion';\nimport { type OverlayRef, ScrollStrategyOptions } from '@angular/cdk/overlay';\nimport { ComponentPortal, TemplatePortal } from '@angular/cdk/portal';\nimport type { ComponentRef, TemplateRef } from '@angular/core';\nimport {\n DestroyRef,\n Directive,\n ElementRef,\n ViewContainerRef,\n computed,\n effect,\n inject,\n input,\n output,\n signal,\n} from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\n\nimport { useI18nText } from 'ngwr/i18n';\nimport { WR_OVERLAY, WR_RESPONSIVE_OVERLAYS, WrOutsideClick, wrMirrorOffsets, wrPresentAsSheet } from 'ngwr/overlay';\nimport { numAttr } from 'ngwr/utils';\n\nimport { type WrPopoverPosition, wrPopoverPositions } from './interfaces';\nimport { WrPopoverTextPanel } from './internal/text-panel';\n\n/**\n * Anchored content panel. The same directive covers two shapes:\n *\n * - **Popover** (default, `mode=\"popover\"`) — `[wrPopover]` takes a\n * `TemplateRef`. Opens on click or hover. Use for rich anchored content:\n * forms, summaries, menus.\n *\n * - **Tooltip** (`mode=\"tooltip\"`) — `[wrPopover]` takes a plain string.\n * Shown on hover and focus, dismissed on blur / pointer-leave / Escape.\n * Uses `aria-describedby` instead of `aria-haspopup` and is rendered into\n * a small dark text panel.\n *\n * Built on CDK Overlay so it auto-flips, closes on outside-click and Escape.\n *\n * @example\n * ```html\n * <!-- Popover with template content -->\n * <button wr-btn [wrPopover]=\"info\">Details</button>\n * <ng-template #info>\n * <div style=\"padding: 1rem; max-width: 18rem\">Anything you can render.</div>\n * </ng-template>\n *\n * <!-- Tooltip with plain text -->\n * <button wr-btn [wrPopover]=\"'Save changes'\" mode=\"tooltip\" position=\"top\">\n * Save\n * </button>\n * ```\n *\n * @see https://ngwr.dev/reference/components/popover\n */\nlet popoverUid = 0;\n\n@Directive({\n selector: '[wrPopover]',\n exportAs: 'wrPopover',\n host: {\n // Marks the trigger the way `[wrDropdown]` marks its own. Popover-mode\n // content is a `TemplateRef`, so it is always bound as `[wrPopover]=\"…\"`,\n // which leaves no attribute in the DOM at all, and a closed tooltip\n // publishes no ARIA either — so without this there is nothing to find a\n // trigger by. (Only the static string form, `wrPopover=\"text\"`, would be.)\n class: 'wr-popover-trigger',\n '[attr.aria-haspopup]': 'isTooltip() ? null : \"dialog\"',\n '[attr.aria-expanded]': 'isTooltip() ? null : isOpen()',\n '[attr.aria-controls]': '!isTooltip() && isOpen() ? panelId : null',\n '[attr.aria-describedby]': 'isTooltip() && isOpen() ? panelId : null',\n '(click)': 'onClick($event)',\n '(mouseenter)': 'onMouseEnter()',\n '(mouseleave)': 'onMouseLeave($event)',\n '(focus)': 'onFocus()',\n '(blur)': 'onBlur()',\n '(keydown.escape)': 'onEscape()',\n },\n})\nexport class WrPopover {\n /**\n * Content to render inside the panel.\n * - In **popover** mode (default): pass a `TemplateRef`.\n * - In **tooltip** mode: pass a plain string.\n */\n readonly content = input.required<TemplateRef<unknown> | string>({ alias: 'wrPopover' });\n\n /**\n * Shape preset.\n *\n * - `'popover'` (default) — template content, click trigger, dialog\n * semantics.\n * - `'tooltip'` — text content, hover+focus trigger, `role=\"tooltip\"`,\n * `aria-describedby` on the host.\n */\n readonly mode = input<'popover' | 'tooltip'>('popover');\n\n /**\n * How the popover opens. Ignored in tooltip mode — tooltips are always\n * hover+focus. @default 'click'\n */\n readonly trigger = input<'click' | 'hover'>('click');\n\n /** Anchor side. @default 'bottom' for popover, 'top' for tooltip */\n readonly position = input<WrPopoverPosition | null>(null);\n\n /** Tooltip only — delay before showing, in ms. @default 120 */\n readonly showDelay = input(120, { transform: numAttr(120) });\n\n /** Tooltip only — delay before hiding, in ms. @default 60 */\n readonly hideDelay = input(60, { transform: numAttr(60) });\n\n /**\n * Popover mode only — present the panel as a full-width bottom-sheet on\n * small viewports instead of an anchored panel. `undefined` follows the\n * app-wide `provideWrResponsiveOverlays()` setting; `true`/`false`\n * overrides it. Tooltips never become sheets. @default undefined\n */\n readonly responsive = input<boolean | undefined, BooleanInput>(undefined, {\n transform: (v: BooleanInput): boolean | undefined => (v == null ? undefined : coerceBooleanProperty(v)),\n });\n\n /**\n * Popover mode only — accessible name of the panel. `role=\"dialog\"` with no\n * name announces as a bare \"dialog\", so the catalog's `popover.label` is used\n * when nothing is given. A popover has no universal name; whenever the panel\n * has a heading or a purpose, pass it.\n */\n readonly ariaLabel = input<string | null>(null);\n\n /** Fires after the panel opens. */\n readonly opened = output<void>();\n\n /** Fires after the panel closes. */\n readonly closed = output<void>();\n\n private readonly host = inject<ElementRef<HTMLElement>>(ElementRef);\n private readonly overlay = inject(WR_OVERLAY);\n private readonly dir = inject(Directionality, { optional: true });\n private readonly outsideClick = inject(WrOutsideClick);\n private readonly responsiveConfig = inject(WR_RESPONSIVE_OVERLAYS);\n private readonly vcr = inject(ViewContainerRef);\n private readonly scrollStrategies = inject(ScrollStrategyOptions);\n private readonly destroyRef = inject(DestroyRef);\n\n /** @internal */\n readonly isOpen = signal(false);\n\n /** @internal */\n protected readonly isTooltip = computed(() => this.mode() === 'tooltip');\n\n /** Auto-generated id for `aria-controls` / `aria-describedby`. */\n protected readonly panelId = `wr-popover-${++popoverUid}`;\n\n private readonly resolvedAriaLabel = useI18nText(this.ariaLabel, 'popover.label', 'Popover');\n\n private readonly resolvedPosition = computed<WrPopoverPosition>(\n () => this.position() ?? (this.isTooltip() ? 'top' : 'bottom')\n );\n\n private overlayRef: OverlayRef | null = null;\n private textPanelRef: ComponentRef<WrPopoverTextPanel> | null = null;\n private hoverCloseTimer: ReturnType<typeof setTimeout> | null = null;\n private showTimer: ReturnType<typeof setTimeout> | null = null;\n private hideTimer: ReturnType<typeof setTimeout> | null = null;\n\n constructor() {\n effect(() => {\n if (this.isOpen()) {\n this.openOverlay();\n } else {\n this.closeOverlay();\n }\n });\n // The tooltip string is pushed into the panel when the panel is created, and\n // `openOverlay()` returns early while one is already up — so a `content()`\n // change with the tooltip on screen never reached it and the label stayed on\n // the string it opened with (hover a Copy button, click it, it still reads\n // \"Copy\"). Keeping the ref and pushing from an effect is how `wr-date-picker`\n // feeds its own panel refs.\n effect(() => {\n const content = this.content();\n this.textPanelRef?.setInput('text', typeof content === 'string' ? content : '');\n });\n this.destroyRef.onDestroy(() => {\n this.clearTimers();\n this.closeOverlay(false);\n });\n }\n\n open(): void {\n this.isOpen.set(true);\n }\n\n close(): void {\n this.isOpen.set(false);\n }\n\n toggle(): void {\n this.isOpen.update(v => !v);\n }\n\n // Host listeners\n\n /** @internal */\n protected onClick(event: MouseEvent): void {\n if (this.isTooltip() || this.trigger() !== 'click') return;\n event.stopPropagation();\n this.toggle();\n }\n\n /** @internal */\n protected onMouseEnter(): void {\n if (this.isTooltip()) {\n this.scheduleShow();\n return;\n }\n if (this.trigger() !== 'hover') return;\n this.clearHoverClose();\n this.isOpen.set(true);\n }\n\n /** @internal */\n protected onMouseLeave(event: MouseEvent): void {\n const related = event.relatedTarget as Node | null;\n if (this.isTooltip()) {\n // Crossing straight from the trigger onto the panel does not even arm the\n // hide, the same bail-out the popover arm below has had. The panel's own\n // `mouseenter` would cancel it a moment later anyway; not arming it is\n // what removes the race.\n if (related && this.overlayRef?.overlayElement.contains(related)) return;\n this.scheduleHide();\n return;\n }\n if (this.trigger() !== 'hover') return;\n if (related && this.overlayRef?.overlayElement.contains(related)) return;\n // Delay so the pointer can cross the gap between trigger and panel —\n // entering the panel cancels the close (see attach listeners).\n this.scheduleHoverClose();\n }\n\n /** @internal */\n protected onFocus(): void {\n if (!this.isTooltip()) return;\n this.scheduleShow();\n }\n\n /** @internal */\n protected onBlur(): void {\n if (!this.isTooltip()) return;\n this.scheduleHide();\n }\n\n /** @internal */\n protected onEscape(): void {\n if (!this.isTooltip()) return;\n this.clearTimers();\n this.isOpen.set(false);\n }\n\n // Tooltip timers\n\n private scheduleShow(): void {\n if (this.isOpen()) {\n this.clearTimers();\n return;\n }\n const text = this.content();\n if (typeof text === 'string' && !text) return;\n this.clearTimers();\n this.showTimer = setTimeout(() => this.isOpen.set(true), this.showDelay());\n }\n\n private scheduleHide(): void {\n this.clearTimers();\n this.hideTimer = setTimeout(() => this.isOpen.set(false), this.hideDelay());\n }\n\n private clearTimers(): void {\n if (this.showTimer) {\n clearTimeout(this.showTimer);\n this.showTimer = null;\n }\n if (this.hideTimer) {\n clearTimeout(this.hideTimer);\n this.hideTimer = null;\n }\n }\n\n // Overlay\n\n private openOverlay(): void {\n if (this.overlayRef) return;\n\n const tooltip = this.isTooltip();\n const position = this.resolvedPosition();\n\n // Sheet presentation is popover-only — tooltips are transient labels and\n // never dock to the bottom. On small viewports (when opted in) detach\n // from the trigger and slide the panel up from the bottom edge.\n const asSheet = !tooltip && wrPresentAsSheet(this.responsive(), this.responsiveConfig);\n const paneClass = tooltip ? 'wr-tooltip-overlay' : 'wr-popover-overlay';\n\n const positionStrategy = asSheet\n ? this.overlay.position().global().centerHorizontally().bottom('0')\n : this.overlay\n .position()\n .flexibleConnectedTo(this.host)\n .withPositions(wrMirrorOffsets(wrPopoverPositions(position, paneClass), this.isRtl()))\n .withPush(true);\n\n // The `--<placement>` half is no longer set here: each fallback position\n // carries its own, so the pane names the placement it landed on instead of\n // the one that was requested, and the arrow follows a flip. A sheet has no\n // anchor and so no placement class at all.\n const overlayClass = asSheet ? [paneClass, 'wr-overlay-sheet'] : [paneClass];\n\n this.overlayRef = this.overlay.create({\n positionStrategy,\n scrollStrategy: asSheet ? this.scrollStrategies.block() : this.scrollStrategies.reposition(),\n width: asSheet ? '100%' : undefined,\n hasBackdrop: asSheet,\n backdropClass: asSheet ? 'wr-overlay-backdrop' : undefined,\n panelClass: overlayClass,\n });\n\n if (asSheet) {\n this.overlayRef\n .backdropClick()\n .pipe(takeUntilDestroyed(this.destroyRef))\n .subscribe(() => this.isOpen.set(false));\n }\n\n const content = this.content();\n\n if (tooltip) {\n // Text content rendered via the internal text panel — accepts a\n // string and wraps it in the `.wr-tooltip` shell.\n const text = typeof content === 'string' ? content : '';\n const ref = this.overlayRef.attach(new ComponentPortal(WrPopoverTextPanel, this.vcr));\n ref.setInput('text', text);\n this.textPanelRef = ref;\n // The pane is the element `aria-describedby` points at (it carries\n // `panelId`), so this is the role that has to be `tooltip` — the inner\n // `wr-popover-text` host deliberately carries none, or the description\n // would be a tooltip nested inside a tooltip.\n this.overlayRef.overlayElement.setAttribute('role', 'tooltip');\n } else if (typeof content !== 'string') {\n const view = this.overlayRef.attach(new TemplatePortal(content, this.vcr));\n const pane = this.overlayRef.overlayElement;\n // Popover mode is a non-modal dialog: the docstring promised dialog\n // semantics but nothing ever set a role, so a screen reader met an\n // unnamed generic container. `aria-modal=\"false\"` is explicit — focus is\n // deliberately NOT trapped, the panel closes on outside click / Escape.\n pane.setAttribute('role', 'dialog');\n pane.setAttribute('aria-modal', 'false');\n // A named dialog: `role=\"dialog\"` with no name announces as a bare\n // \"dialog\" and trips axe's `aria-dialog-name`.\n pane.setAttribute('aria-label', this.resolvedAriaLabel());\n\n if (this.trigger() === 'click') {\n // Render the projected content before focus moves, the way\n // `wr-popconfirm` does — a reader announcing the dialog reads what is in\n // it, and on an empty pane that is nothing.\n view.detectChanges();\n // Focus has to ENTER the panel. The overlay container sits at the end of\n // `<body>`, so Tab from the trigger went to the next control on the page\n // and left the dialog stranded behind it (WCAG F85). The pane takes it\n // rather than the first control inside: a popover's content is\n // arbitrary, and landing on a text field would raise the on-screen\n // keyboard and skip whatever the panel says above it. Tab from the pane\n // reaches that first control anyway, since the pane precedes its own\n // content in document order.\n //\n // Click-triggered only — a hover popover must not pull the caret out of\n // what the user is typing in, and `scheduleHoverClose()` would then\n // dispose the pane out from under the focused element.\n pane.tabIndex = -1;\n pane.focus();\n }\n }\n this.overlayRef.overlayElement.id = this.panelId;\n\n this.outsideClick\n .outsidePointerEvents(this.overlayRef)\n .pipe(takeUntilDestroyed(this.destroyRef))\n .subscribe(event => {\n if (this.host.nativeElement.contains(event.target as Node)) return;\n this.isOpen.set(false);\n });\n\n this.overlayRef\n .keydownEvents()\n .pipe(takeUntilDestroyed(this.destroyRef))\n .subscribe(event => {\n if (event.key === 'Escape') {\n event.preventDefault();\n this.isOpen.set(false);\n }\n });\n\n // Both hover shapes keep the panel up while the pointer is on it: for a\n // popover so the pointer can cross the gap, for a tooltip because WCAG\n // 1.4.13 requires it (Hoverable).\n if (tooltip || this.trigger() === 'hover') {\n this.overlayRef.overlayElement.addEventListener('mouseenter', this.onOverlayEnter);\n this.overlayRef.overlayElement.addEventListener('mouseleave', this.onOverlayLeave);\n }\n\n this.opened.emit();\n }\n\n /**\n * Tear the overlay down, and tell the host — unless the host is going away\n * with it.\n *\n * `notify: false` is the DESTROY path, and it is not a nicety. An `output()`\n * belongs to the view that declares it, so emitting from `onDestroy` is\n * refused: Angular logs `NG0953: Unexpected emit for destroyed OutputRef` and\n * the listener never runs. Measured — a `(closed)` handler on a dropdown whose\n * host view is removed while the menu is open fired zero times and left a\n * console error behind. There is nobody to notify at that point, because the\n * consumer's own view is being torn down in the same pass; `wr-popconfirm`\n * already disposes without emitting, and this brings the other two into line.\n *\n * The focus hand-back is skipped for the same reason — the host element is on\n * its way out of the document.\n */\n private closeOverlay(notify = true): void {\n if (!this.overlayRef) return;\n if (this.isTooltip() || this.trigger() === 'hover') {\n this.overlayRef.overlayElement.removeEventListener('mouseenter', this.onOverlayEnter);\n this.overlayRef.overlayElement.removeEventListener('mouseleave', this.onOverlayLeave);\n }\n this.clearHoverClose();\n // Take the focus back before the pane goes, and only if it was in there.\n //\n // A popover is not a tooltip: it attaches a `TemplatePortal` under\n // `role=\"dialog\"`, so a form or a menu inside it is the point, and Escape\n // arrives through the overlay's `keydownEvents()` no matter where the caret\n // is. Disposing with focus inside dropped it on `<body>`, and the next Tab\n // restarted from the top of the document. `wr-date-picker` and\n // `wr-popconfirm` already guard it exactly this way; leaving focus alone\n // when it had already moved is what stops the close from fighting the user\n // for the caret.\n const pane = this.overlayRef.overlayElement;\n const focusWasInside = pane.contains(this.host.nativeElement.ownerDocument.activeElement);\n this.overlayRef.dispose();\n this.overlayRef = null;\n // Disposing destroys the panel component; a retained ref would pin its view.\n this.textPanelRef = null;\n if (notify) {\n if (focusWasInside) this.host.nativeElement.focus();\n this.closed.emit();\n }\n }\n\n private readonly onOverlayLeave = (event: MouseEvent): void => {\n const related = event.relatedTarget as Node | null;\n if (related && this.host.nativeElement.contains(related)) return;\n // A tooltip leaves on its own `hideDelay`, the same one the trigger uses; a\n // hover popover has the longer grace period for crossing the gap back.\n if (this.isTooltip()) this.scheduleHide();\n else this.scheduleHoverClose();\n };\n\n private readonly onOverlayEnter = (): void => {\n // Two different timers can be in flight: `hideTimer`, armed by the trigger's\n // own `mouseleave` in tooltip mode, and `hoverCloseTimer` in popover mode.\n // Cancelling only the second would leave a tooltip disappearing `hideDelay`\n // after the pointer arrived on it.\n this.clearTimers();\n this.clearHoverClose();\n };\n\n private scheduleHoverClose(): void {\n this.clearHoverClose();\n this.hoverCloseTimer = setTimeout(() => this.isOpen.set(false), 120);\n }\n\n private clearHoverClose(): void {\n if (this.hoverCloseTimer) {\n clearTimeout(this.hoverCloseTimer);\n this.hoverCloseTimer = null;\n }\n }\n\n /**\n * Whether the app reads right-to-left.\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 * component that works, and defaulting to LTR is the honest fallback.\n */\n private isRtl(): boolean {\n return this.dir?.value === 'rtl';\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;;;;AAAA;;;;;AAKG;AAkBH;;;;;;;;;;;;;AAaG;AACI,MAAM,oBAAoB,GAAiD;IAChF,GAAG,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC,CAAC,EAAE;IAC/F,WAAW,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC,CAAC,EAAE;IACrG,SAAS,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC,CAAC,EAAE;IAC/F,MAAM,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,EAAE;IACjG,cAAc,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,OA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["../../../projects/lib/popover/interfaces/popover-position.ts","../../../projects/lib/popover/internal/keystroke.ts","../../../projects/lib/popover/internal/text-panel.ts","../../../projects/lib/popover/popover.ts","../../../projects/lib/popover/ngwr-popover.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\nimport type { ConnectedPosition } from '@angular/cdk/overlay';\n\nexport type WrPopoverPosition =\n | 'top'\n | 'top-start'\n | 'top-end'\n | 'bottom'\n | 'bottom-start'\n | 'bottom-end'\n | 'left'\n | 'left-start'\n | 'left-end'\n | 'right'\n | 'right-start'\n | 'right-end';\n\n/**\n * The CDK geometry for each placement — one position, no fallbacks.\n *\n * The 8px offset is the gap between the trigger and the panel, and it is the\n * reason a flip list matters rather than being a nicety: the flexible strategy\n * emits `offsetX` as a `transform` on the pane, AFTER `withPush` has already\n * decided the coordinate. Push therefore parks a right-anchored panel flush\n * against the viewport edge and the offset then shoves it 8px back out, so a\n * side placement that does not fit loses its border and corner off-screen no\n * matter how hard push works. Flipping to a placement that fits is the only\n * recovery, which is what `WR_POPOVER_FALLBACKS` is for.\n *\n * @internal\n */\nexport const WR_POPOVER_POSITIONS: Record<WrPopoverPosition, ConnectedPosition> = {\n top: { originX: 'center', originY: 'top', overlayX: 'center', overlayY: 'bottom', offsetY: -8 },\n 'top-start': { originX: 'start', originY: 'top', overlayX: 'start', overlayY: 'bottom', offsetY: -8 },\n 'top-end': { originX: 'end', originY: 'top', overlayX: 'end', overlayY: 'bottom', offsetY: -8 },\n bottom: { originX: 'center', originY: 'bottom', overlayX: 'center', overlayY: 'top', offsetY: 8 },\n 'bottom-start': { originX: 'start', originY: 'bottom', overlayX: 'start', overlayY: 'top', offsetY: 8 },\n 'bottom-end': { originX: 'end', originY: 'bottom', overlayX: 'end', overlayY: 'top', offsetY: 8 },\n left: { originX: 'start', originY: 'center', overlayX: 'end', overlayY: 'center', offsetX: -8 },\n 'left-start': { originX: 'start', originY: 'top', overlayX: 'end', overlayY: 'top', offsetX: -8 },\n 'left-end': { originX: 'start', originY: 'bottom', overlayX: 'end', overlayY: 'bottom', offsetX: -8 },\n right: { originX: 'end', originY: 'center', overlayX: 'start', overlayY: 'center', offsetX: 8 },\n 'right-start': { originX: 'end', originY: 'top', overlayX: 'start', overlayY: 'top', offsetX: 8 },\n 'right-end': { originX: 'end', originY: 'bottom', overlayX: 'start', overlayY: 'bottom', offsetX: 8 },\n};\n\n/**\n * What each placement is allowed to flip to when it does not fit, best first.\n * The requested placement always leads, so a panel that fits never moves.\n *\n * Alignment is preserved down the whole chain — a `-start` popover stays\n * `-start` — because the alignment is the author's answer to \"which end of the\n * trigger does this belong to\", and a flip is about the side, not about that.\n *\n * The two axes are deliberately NOT symmetric. A block-axis placement (`top*` /\n * `bottom*`) flips only to its opposite, the classic behaviour, so a dropdown-ish\n * panel can never surprise anyone by appearing beside its trigger. An inline-axis\n * one (`left*` / `right*`) also gets the two block-axis sides, because on a phone\n * NEITHER side fits: at 375px a 233px panel beside a mid-page trigger overflows\n * by 109px to the right and 97px to the left, and only below/above has room.\n *\n * @internal\n */\nexport const WR_POPOVER_FALLBACKS: Record<WrPopoverPosition, readonly WrPopoverPosition[]> = {\n top: ['top', 'bottom'],\n 'top-start': ['top-start', 'bottom-start'],\n 'top-end': ['top-end', 'bottom-end'],\n bottom: ['bottom', 'top'],\n 'bottom-start': ['bottom-start', 'top-start'],\n 'bottom-end': ['bottom-end', 'top-end'],\n left: ['left', 'right', 'bottom', 'top'],\n 'left-start': ['left-start', 'right-start', 'bottom-start', 'top-start'],\n 'left-end': ['left-end', 'right-end', 'bottom-end', 'top-end'],\n right: ['right', 'left', 'bottom', 'top'],\n 'right-start': ['right-start', 'left-start', 'bottom-start', 'top-start'],\n 'right-end': ['right-end', 'left-end', 'bottom-end', 'top-end'],\n};\n\n/**\n * The list `withPositions()` wants, with every link tagged so the pane names the\n * placement it ACTUALLY took rather than the one that was asked for.\n *\n * The tag is what keeps the arrow honest. It is drawn by\n * `.wr-popover-overlay--<placement> > *::after`, so a panel that flipped while\n * the class stayed put would point at a side it no longer sits on. CDK applies a\n * position's own `panelClass` in `_applyPosition` and clears it again on the next\n * one, which is exactly the bookkeeping this needs — hence the class rather than\n * a `positionChanges` subscription.\n *\n * @param paneClass The pane's base class: `wr-popover-overlay` or\n * `wr-tooltip-overlay`. The two modes key their arrows off different\n * selectors, so the prefix cannot live in the table.\n *\n * @internal\n */\nexport function wrPopoverPositions(position: WrPopoverPosition, paneClass: string): ConnectedPosition[] {\n return WR_POPOVER_FALLBACKS[position].map(name => ({\n ...WR_POPOVER_POSITIONS[name],\n panelClass: `${paneClass}--${name}`,\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 { DOCUMENT, isPlatformBrowser } from '@angular/common';\nimport { DestroyRef, PLATFORM_ID, Service, inject } from '@angular/core';\n\n/** `FocusMonitor._setOrigin`'s own window — see the class docs for why it matches. */\nconst KEYSTROKE_WINDOW_MS = 1;\n\n/**\n * The key of the keystroke being handled RIGHT NOW — `null` between them.\n *\n * `FocusMonitor` answers \"the most recent input modality was a keyboard\", which\n * is a weaker statement than \"the user's own key put focus here\", and the gap\n * between the two is exactly where a tooltip goes wrong. The origin is whatever\n * was pressed within the last millisecond (`_setOrigin` clears it on a 1ms\n * timer), and an overlay dismissed with Escape hands focus BACK to its trigger\n * synchronously, inside that same keystroke — CDK's keyboard dispatcher listens\n * on `<body>` in the bubble phase, the modality detector on `document` in\n * capture, so the modality is always already `keyboard` by the time the drawer\n * runs. Same for a ✕ activated with Enter. So the CDK reports `keyboard` for a\n * hand-back and a tooltip reading the origin alone still shows itself unbidden,\n * which is the whole failure it was meant to stop.\n *\n * The KEY separates them: `Tab` and the arrows are how a user moves focus,\n * `Escape` and `Enter` dismiss and activate. A focus that lands during one of\n * those was moved by a script.\n *\n * One passive capture listener for the whole app, constructed with the first\n * `[wrPopover]` and never before it — beside the three `InputModalityDetector`\n * already installs.\n *\n * The key expires on the CDK's own 1ms window rather than on a bare macrotask,\n * and matching it is the point: the key is only ever read to EXPLAIN a keyboard\n * origin, so it must not run out while the origin it explains is still live. A\n * `setTimeout(0)` close would land in exactly that gap — key already forgotten,\n * origin still `keyboard` — and read as a Tab. Everything a keystroke does\n * synchronously, its default action and the click Enter dispatches included,\n * happens long before either timer; anything that waits past them is judged\n * `program` by the CDK and never reaches this question.\n *\n * Popover-local on purpose; no other component in the catalog asks this yet.\n */\n@Service()\nexport class WrCurrentKeystroke {\n private readonly doc = inject(DOCUMENT);\n private readonly destroyRef = inject(DestroyRef);\n private readonly isBrowser = isPlatformBrowser(inject(PLATFORM_ID));\n\n private current: string | null = null;\n private clearTimer: ReturnType<typeof setTimeout> | null = null;\n\n /** `KeyboardEvent.key` for the keystroke in flight, `null` outside one. */\n get key(): string | null {\n return this.current;\n }\n\n constructor() {\n if (!this.isBrowser) return;\n\n const record = (event: KeyboardEvent): void => {\n this.current = event.key;\n if (this.clearTimer) clearTimeout(this.clearTimer);\n this.clearTimer = setTimeout(() => (this.current = null), KEYSTROKE_WINDOW_MS);\n };\n\n // Capture, so the key is on record before any handler deeper in the tree\n // gets to move focus with it.\n this.doc.addEventListener('keydown', record, { capture: true, passive: true });\n this.destroyRef.onDestroy(() => {\n if (this.clearTimer) clearTimeout(this.clearTimer);\n this.doc.removeEventListener('keydown', record, { capture: true });\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 { Component, ViewEncapsulation, input } from '@angular/core';\n\n/**\n * Internal floating label rendered when `<… [wrPopover]=\"'…'\" mode=\"tooltip\">`\n * receives a string instead of a template. Not part of the public template\n * API — use the `WrPopover` directive in tooltip mode instead.\n *\n * @internal\n */\n@Component({\n selector: 'wr-popover-text',\n template: '{{ text() }}',\n encapsulation: ViewEncapsulation.None,\n // No `role=\"tooltip\"` here on purpose: the overlay pane this is attached to\n // is the element `aria-describedby` resolves to, and it carries the role.\n // Setting it here too nested one tooltip inside another.\n host: { class: 'wr-tooltip' },\n})\nexport class WrPopoverTextPanel {\n readonly text = input.required<string>();\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 { FocusMonitor } from '@angular/cdk/a11y';\nimport { Directionality } from '@angular/cdk/bidi';\nimport { type BooleanInput, coerceBooleanProperty } from '@angular/cdk/coercion';\nimport { type OverlayRef, ScrollStrategyOptions } from '@angular/cdk/overlay';\nimport { ComponentPortal, TemplatePortal } from '@angular/cdk/portal';\nimport type { ComponentRef, TemplateRef } from '@angular/core';\nimport {\n DestroyRef,\n Directive,\n ElementRef,\n Injector,\n ViewContainerRef,\n afterNextRender,\n computed,\n effect,\n inject,\n input,\n output,\n signal,\n} from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\n\nimport { useI18nText } from 'ngwr/i18n';\nimport {\n WR_OVERLAY,\n WR_RESPONSIVE_OVERLAYS,\n WrOutsideClick,\n wrFollowDirection,\n wrMirrorOffsets,\n wrPresentAsSheet,\n} from 'ngwr/overlay';\nimport { KEYS, numAttr } from 'ngwr/utils';\n\nimport { type WrPopoverPosition, wrPopoverPositions } from './interfaces';\nimport { WrCurrentKeystroke } from './internal/keystroke';\nimport { WrPopoverTextPanel } from './internal/text-panel';\n\n/**\n * Keys the USER moves focus with: Tab through the page, the arrows / Home /\n * End through a composite that roves its own tabindex.\n *\n * A roving arrow move is a script `.focus()` call too — the difference from a\n * dismissal is not who called `focus()` but whether the keystroke was a\n * NAVIGATION or an action. Anything absent from this list (Escape, Enter,\n * Space, a character) does something else for a living, so focus that lands\n * during one of them was placed by a script and a tooltip stays shut.\n */\nconst NAVIGATION_KEYS = new Set<string>([\n KEYS.TAB,\n KEYS.ARROW_UP,\n KEYS.ARROW_DOWN,\n KEYS.ARROW_LEFT,\n KEYS.ARROW_RIGHT,\n KEYS.HOME,\n KEYS.END,\n KEYS.PAGE_UP,\n KEYS.PAGE_DOWN,\n]);\n\n/**\n * Anchored content panel. The same directive covers two shapes:\n *\n * - **Popover** (default, `mode=\"popover\"`) — `[wrPopover]` takes a\n * `TemplateRef`. Opens on click or hover. Use for rich anchored content:\n * forms, summaries, menus.\n *\n * - **Tooltip** (`mode=\"tooltip\"`) — `[wrPopover]` takes a plain string.\n * Shown on hover and when the KEYBOARD puts focus on the trigger — never for\n * a `.focus()` call, which is what a dialog or drawer does when it hands\n * focus back. Dismissed when focus leaves / on pointer-leave / Escape. Uses\n * `aria-describedby` instead of `aria-haspopup` and is rendered into a small\n * dark text panel.\n *\n * Built on CDK Overlay so it auto-flips, closes on outside-click and Escape.\n *\n * @example\n * ```html\n * <!-- Popover with template content -->\n * <button wr-btn [wrPopover]=\"info\">Details</button>\n * <ng-template #info>\n * <div style=\"padding: 1rem; max-width: 18rem\">Anything you can render.</div>\n * </ng-template>\n *\n * <!-- Tooltip with plain text -->\n * <button wr-btn [wrPopover]=\"'Save changes'\" mode=\"tooltip\" position=\"top\">\n * Save\n * </button>\n * ```\n *\n * @see https://ngwr.dev/reference/components/popover\n */\nlet popoverUid = 0;\n\n@Directive({\n selector: '[wrPopover]',\n exportAs: 'wrPopover',\n host: {\n // Marks the trigger the way `[wrDropdown]` marks its own. Popover-mode\n // content is a `TemplateRef`, so it is always bound as `[wrPopover]=\"…\"`,\n // which leaves no attribute in the DOM at all, and a closed tooltip\n // publishes no ARIA either — so without this there is nothing to find a\n // trigger by. (Only the static string form, `wrPopover=\"text\"`, would be.)\n class: 'wr-popover-trigger',\n '[attr.aria-haspopup]': 'isTooltip() ? null : \"dialog\"',\n '[attr.aria-expanded]': 'isTooltip() ? null : isOpen()',\n '[attr.aria-controls]': '!isTooltip() && isOpen() ? panelId : null',\n '[attr.aria-describedby]': 'isTooltip() && isOpen() ? panelId : null',\n '(click)': 'onClick($event)',\n '(mouseenter)': 'onMouseEnter()',\n '(mouseleave)': 'onMouseLeave($event)',\n // No `(focus)` / `(blur)` here: a tooltip answers the KEYBOARD, and a plain\n // focus event cannot say where the focus came from. `FocusMonitor` can — see\n // the constructor.\n '(keydown.escape)': 'onEscape()',\n },\n})\nexport class WrPopover {\n /**\n * Content to render inside the panel.\n * - In **popover** mode (default): pass a `TemplateRef`.\n * - In **tooltip** mode: pass a plain string.\n */\n readonly content = input.required<TemplateRef<unknown> | string>({ alias: 'wrPopover' });\n\n /**\n * Shape preset.\n *\n * - `'popover'` (default) — template content, click trigger, dialog\n * semantics.\n * - `'tooltip'` — text content, hover / keyboard-focus trigger,\n * `role=\"tooltip\"`, `aria-describedby` on the host.\n */\n readonly mode = input<'popover' | 'tooltip'>('popover');\n\n /**\n * How the popover opens. Ignored in tooltip mode — a tooltip is always hover\n * plus keyboard focus. @default 'click'\n */\n readonly trigger = input<'click' | 'hover'>('click');\n\n /** Anchor side. @default 'bottom' for popover, 'top' for tooltip */\n readonly position = input<WrPopoverPosition | null>(null);\n\n /** Tooltip only — delay before showing, in ms. @default 120 */\n readonly showDelay = input(120, { transform: numAttr(120) });\n\n /** Tooltip only — delay before hiding, in ms. @default 60 */\n readonly hideDelay = input(60, { transform: numAttr(60) });\n\n /**\n * Popover mode only — present the panel as a full-width bottom-sheet on\n * small viewports instead of an anchored panel. `undefined` follows the\n * app-wide `provideWrResponsiveOverlays()` setting; `true`/`false`\n * overrides it. Tooltips never become sheets. @default undefined\n */\n readonly responsive = input<boolean | undefined, BooleanInput>(undefined, {\n transform: (v: BooleanInput): boolean | undefined => (v == null ? undefined : coerceBooleanProperty(v)),\n });\n\n /**\n * Popover mode only — accessible name of the panel. `role=\"dialog\"` with no\n * name announces as a bare \"dialog\", so the catalog's `popover.label` is used\n * when nothing is given. A popover has no universal name; whenever the panel\n * has a heading or a purpose, pass it.\n */\n readonly ariaLabel = input<string | null>(null);\n\n /** Fires after the panel opens. */\n readonly opened = output<void>();\n\n /** Fires after the panel closes. */\n readonly closed = output<void>();\n\n private readonly host = inject<ElementRef<HTMLElement>>(ElementRef);\n private readonly focusMonitor = inject(FocusMonitor);\n private readonly keystroke = inject(WrCurrentKeystroke);\n private readonly overlay = inject(WR_OVERLAY);\n private readonly dir = inject(Directionality, { optional: true });\n private readonly outsideClick = inject(WrOutsideClick);\n private readonly responsiveConfig = inject(WR_RESPONSIVE_OVERLAYS);\n private readonly vcr = inject(ViewContainerRef);\n private readonly scrollStrategies = inject(ScrollStrategyOptions);\n private readonly destroyRef = inject(DestroyRef);\n private readonly injector = inject(Injector);\n\n /** @internal */\n readonly isOpen = signal(false);\n\n /** @internal */\n protected readonly isTooltip = computed(() => this.mode() === 'tooltip');\n\n /** Auto-generated id for `aria-controls` / `aria-describedby`. */\n protected readonly panelId = `wr-popover-${++popoverUid}`;\n\n private readonly resolvedAriaLabel = useI18nText(this.ariaLabel, 'popover.label', 'Popover');\n\n private readonly resolvedPosition = computed<WrPopoverPosition>(\n () => this.position() ?? (this.isTooltip() ? 'top' : 'bottom')\n );\n\n private overlayRef: OverlayRef | null = null;\n private textPanelRef: ComponentRef<WrPopoverTextPanel> | null = null;\n /** Whether the HOST itself holds focus — not a descendant of it. */\n private hostFocused = false;\n private hoverCloseTimer: ReturnType<typeof setTimeout> | null = null;\n private showTimer: ReturnType<typeof setTimeout> | null = null;\n private hideTimer: ReturnType<typeof setTimeout> | null = null;\n\n constructor() {\n effect(() => {\n if (this.isOpen()) {\n this.openOverlay();\n } else {\n this.closeOverlay();\n }\n });\n // The tooltip string is pushed into the panel when the panel is created, and\n // `openOverlay()` returns early while one is already up — so a `content()`\n // change with the tooltip on screen never reached it and the label stayed on\n // the string it opened with (hover a Copy button, click it, it still reads\n // \"Copy\"). Keeping the ref and pushing from an effect is how `wr-date-picker`\n // feeds its own panel refs.\n effect(() => {\n const content = this.content();\n this.textPanelRef?.setInput('text', typeof content === 'string' ? content : '');\n });\n // A tooltip answers the USER'S KEYBOARD, not every focus there is.\n //\n // `(focus)` fired for a programmatic one too, and something hands focus back\n // to a trigger constantly: `WrDrawer` and `WrDialog` restore the element that\n // was active when they opened, this directive does the same for its own\n // popover, and any app may call `.focus()`. So closing a drawer opened from a\n // button with a tooltip re-showed that tooltip with NOTHING left to dismiss\n // it — the pointer is elsewhere, so no `mouseleave`, and focus stays on the\n // button, so no blur. A pane stranded under the trigger, reported from a real\n // app. The event alone cannot tell those apart; `FocusMonitor` is the CDK's\n // answer to where a focus came from, and it is what Material's tooltip reads\n // for the same reason. Mouse and touch origins are deliberately ignored:\n // hover already drives both, and acting on them would show the tooltip twice\n // over.\n //\n // The origin alone is NOT enough, though, and reading it as if it were leaves\n // the reported bug half open: the CDK's `keyboard` means \"a key went down\n // within the last millisecond\", and the dismissal that hands focus back is\n // itself a keystroke — Escape on a drawer, Enter on its ✕. See\n // `WrCurrentKeystroke` for the key that tells a navigation from a dismissal.\n //\n // Monitored in EVERY mode rather than only under `mode=\"tooltip\"` — the mode\n // is an input and may flip after this runs, and a subscription that only\n // half-exists is the failure this fix is about. The handler asks instead. The\n // cost is the CDK's own `cdk-*-focused` classes on the host, which nothing in\n // ngwr styles.\n //\n // `afterNextRender` because monitoring binds document listeners: there is no\n // DOM to bind them to on the server.\n afterNextRender(() => {\n this.focusMonitor\n .monitor(this.host)\n .pipe(takeUntilDestroyed(this.destroyRef))\n .subscribe(origin => {\n if (origin) {\n this.hostFocused = true;\n if (this.isTooltip() && origin === 'keyboard' && this.fromNavigationKey()) this.scheduleShow();\n return;\n }\n // A null origin is a blur, and the CDK reports one for a DESCENDANT\n // too: `_onFocus` bails when the event target is not the monitored\n // element, `_onBlur` has no such guard. The old `(blur)` binding never\n // bubbled, so hiding on one is new — hover a wrapper, click the button\n // inside it, tab away, and the tooltip the POINTER opened vanished\n // while the pointer never moved. Only the host's own focus counts.\n if (!this.hostFocused) return;\n this.hostFocused = false;\n if (this.isTooltip()) this.scheduleHide();\n });\n });\n this.destroyRef.onDestroy(() => {\n this.clearTimers();\n this.closeOverlay(false);\n // Completes the subject `monitor()` handed out and drops the global\n // listeners it registered for this element; the pipe above unsubscribes\n // either way, but the CDK's own bookkeeping only clears from here.\n this.focusMonitor.stopMonitoring(this.host);\n });\n }\n\n open(): void {\n this.isOpen.set(true);\n }\n\n close(): void {\n this.isOpen.set(false);\n }\n\n toggle(): void {\n this.isOpen.update(v => !v);\n }\n\n // Host listeners\n\n /** @internal */\n protected onClick(event: MouseEvent): void {\n if (this.isTooltip() || this.trigger() !== 'click') return;\n event.stopPropagation();\n this.toggle();\n }\n\n /** @internal */\n protected onMouseEnter(): void {\n if (this.isTooltip()) {\n this.scheduleShow();\n return;\n }\n if (this.trigger() !== 'hover') return;\n this.clearHoverClose();\n this.isOpen.set(true);\n }\n\n /** @internal */\n protected onMouseLeave(event: MouseEvent): void {\n const related = event.relatedTarget as Node | null;\n if (this.isTooltip()) {\n // Crossing straight from the trigger onto the panel does not even arm the\n // hide, the same bail-out the popover arm below has had. The panel's own\n // `mouseenter` would cancel it a moment later anyway; not arming it is\n // what removes the race.\n if (related && this.overlayRef?.overlayElement.contains(related)) return;\n this.scheduleHide();\n return;\n }\n if (this.trigger() !== 'hover') return;\n if (related && this.overlayRef?.overlayElement.contains(related)) return;\n // Delay so the pointer can cross the gap between trigger and panel —\n // entering the panel cancels the close (see attach listeners).\n this.scheduleHoverClose();\n }\n\n /** @internal */\n protected onEscape(): void {\n if (!this.isTooltip()) return;\n this.clearTimers();\n this.isOpen.set(false);\n }\n\n /**\n * Whether the keystroke in flight is one the user moves focus with.\n *\n * Asked only of a `keyboard` origin, which the CDK grants to any focus landing\n * within a millisecond of a keydown — including the hand-back a drawer\n * performs while Escape is still being handled. That is the reported bug's\n * keyboard half, and the origin cannot see it.\n *\n * NO key on record answers `true`, and that polarity is chosen rather than\n * inherited: a keyboard modality with no keystroke behind it is a screen\n * reader's virtual cursor (the CDK reads its synthetic mousedown as\n * `keyboard`) or a deliberate `focusVia(el, 'keyboard')`, and both are the\n * user. Refusing wants positive evidence of a key that does something other\n * than navigate — silence must not cost an AT user the hint. The two windows\n * are aligned so that \"keyboard origin, no key\" cannot mean \"the key just\n * expired\"; what it does still admit is a `FocusMonitorDetectionMode.EVENTUAL`\n * app, where the CDK never expires an origin at all.\n */\n private fromNavigationKey(): boolean {\n const key = this.keystroke.key;\n return key === null || NAVIGATION_KEYS.has(key);\n }\n\n // Tooltip timers\n\n private scheduleShow(): void {\n if (this.isOpen()) {\n this.clearTimers();\n return;\n }\n const text = this.content();\n if (typeof text === 'string' && !text) return;\n this.clearTimers();\n this.showTimer = setTimeout(() => this.isOpen.set(true), this.showDelay());\n }\n\n private scheduleHide(): void {\n this.clearTimers();\n this.hideTimer = setTimeout(() => this.isOpen.set(false), this.hideDelay());\n }\n\n private clearTimers(): void {\n if (this.showTimer) {\n clearTimeout(this.showTimer);\n this.showTimer = null;\n }\n if (this.hideTimer) {\n clearTimeout(this.hideTimer);\n this.hideTimer = null;\n }\n }\n\n // Overlay\n\n private openOverlay(): void {\n if (this.overlayRef) return;\n\n const tooltip = this.isTooltip();\n const position = this.resolvedPosition();\n\n // Sheet presentation is popover-only — tooltips are transient labels and\n // never dock to the bottom. On small viewports (when opted in) detach\n // from the trigger and slide the panel up from the bottom edge.\n const asSheet = !tooltip && wrPresentAsSheet(this.responsive(), this.responsiveConfig);\n const paneClass = tooltip ? 'wr-tooltip-overlay' : 'wr-popover-overlay';\n\n // Kept as its own binding rather than inlined into the ternary: it is the\n // half a direction flip has to rebuild, and a sheet — anchored to nothing —\n // has no list at all, which is what `null` says here.\n const connected = asSheet\n ? null\n : this.overlay\n .position()\n .flexibleConnectedTo(this.host)\n .withPositions(wrMirrorOffsets(wrPopoverPositions(position, paneClass), this.isRtl()))\n .withPush(true);\n\n const positionStrategy = connected ?? this.overlay.position().global().centerHorizontally().bottom('0');\n\n // The `--<placement>` half is no longer set here: each fallback position\n // carries its own, so the pane names the placement it landed on instead of\n // the one that was requested, and the arrow follows a flip. A sheet has no\n // anchor and so no placement class at all.\n const overlayClass = asSheet ? [paneClass, 'wr-overlay-sheet'] : [paneClass];\n\n this.overlayRef = this.overlay.create({\n positionStrategy,\n scrollStrategy: asSheet ? this.scrollStrategies.block() : this.scrollStrategies.reposition(),\n width: asSheet ? '100%' : undefined,\n hasBackdrop: asSheet,\n backdropClass: asSheet ? 'wr-overlay-backdrop' : undefined,\n panelClass: overlayClass,\n });\n\n // The CDK read the direction once, just now, and will never look again — so\n // an app that flips while this panel is up mirrors the page around a pane\n // still rendering `ltr`, with `wr-segmented` and friends inside it already\n // laying themselves out the other way. Rebuilding the list matters as much\n // as the attribute: `wrMirrorOffsets` turned the 8px gap around at open, and\n // an unmirrored offset puts a side-placed panel back on top of its trigger.\n // A sheet has no list, and `connected?.` is what says so — the arguments are\n // never evaluated for one.\n wrFollowDirection(this.overlayRef, this.dir, this.injector, direction =>\n connected?.withPositions(wrMirrorOffsets(wrPopoverPositions(position, paneClass), direction === 'rtl'))\n );\n\n if (asSheet) {\n this.overlayRef\n .backdropClick()\n .pipe(takeUntilDestroyed(this.destroyRef))\n .subscribe(() => this.isOpen.set(false));\n }\n\n const content = this.content();\n\n if (tooltip) {\n // Text content rendered via the internal text panel — accepts a\n // string and wraps it in the `.wr-tooltip` shell.\n const text = typeof content === 'string' ? content : '';\n const ref = this.overlayRef.attach(new ComponentPortal(WrPopoverTextPanel, this.vcr));\n ref.setInput('text', text);\n this.textPanelRef = ref;\n // The pane is the element `aria-describedby` points at (it carries\n // `panelId`), so this is the role that has to be `tooltip` — the inner\n // `wr-popover-text` host deliberately carries none, or the description\n // would be a tooltip nested inside a tooltip.\n this.overlayRef.overlayElement.setAttribute('role', 'tooltip');\n } else if (typeof content !== 'string') {\n const view = this.overlayRef.attach(new TemplatePortal(content, this.vcr));\n const pane = this.overlayRef.overlayElement;\n // Popover mode is a non-modal dialog: the docstring promised dialog\n // semantics but nothing ever set a role, so a screen reader met an\n // unnamed generic container. `aria-modal=\"false\"` is explicit — focus is\n // deliberately NOT trapped, the panel closes on outside click / Escape.\n pane.setAttribute('role', 'dialog');\n pane.setAttribute('aria-modal', 'false');\n // A named dialog: `role=\"dialog\"` with no name announces as a bare\n // \"dialog\" and trips axe's `aria-dialog-name`.\n pane.setAttribute('aria-label', this.resolvedAriaLabel());\n\n if (this.trigger() === 'click') {\n // Render the projected content before focus moves, the way\n // `wr-popconfirm` does — a reader announcing the dialog reads what is in\n // it, and on an empty pane that is nothing.\n view.detectChanges();\n // Focus has to ENTER the panel. The overlay container sits at the end of\n // `<body>`, so Tab from the trigger went to the next control on the page\n // and left the dialog stranded behind it (WCAG F85). The pane takes it\n // rather than the first control inside: a popover's content is\n // arbitrary, and landing on a text field would raise the on-screen\n // keyboard and skip whatever the panel says above it. Tab from the pane\n // reaches that first control anyway, since the pane precedes its own\n // content in document order.\n //\n // Click-triggered only — a hover popover must not pull the caret out of\n // what the user is typing in, and `scheduleHoverClose()` would then\n // dispose the pane out from under the focused element.\n pane.tabIndex = -1;\n pane.focus();\n }\n }\n this.overlayRef.overlayElement.id = this.panelId;\n\n this.outsideClick\n .outsidePointerEvents(this.overlayRef)\n .pipe(takeUntilDestroyed(this.destroyRef))\n .subscribe(event => {\n if (this.host.nativeElement.contains(event.target as Node)) return;\n this.isOpen.set(false);\n });\n\n this.overlayRef\n .keydownEvents()\n .pipe(takeUntilDestroyed(this.destroyRef))\n .subscribe(event => {\n if (event.key === 'Escape') {\n event.preventDefault();\n this.isOpen.set(false);\n }\n });\n\n // Both hover shapes keep the panel up while the pointer is on it: for a\n // popover so the pointer can cross the gap, for a tooltip because WCAG\n // 1.4.13 requires it (Hoverable).\n if (tooltip || this.trigger() === 'hover') {\n this.overlayRef.overlayElement.addEventListener('mouseenter', this.onOverlayEnter);\n this.overlayRef.overlayElement.addEventListener('mouseleave', this.onOverlayLeave);\n }\n\n this.opened.emit();\n }\n\n /**\n * Tear the overlay down, and tell the host — unless the host is going away\n * with it.\n *\n * `notify: false` is the DESTROY path, and it is not a nicety. An `output()`\n * belongs to the view that declares it, so emitting from `onDestroy` is\n * refused: Angular logs `NG0953: Unexpected emit for destroyed OutputRef` and\n * the listener never runs. Measured — a `(closed)` handler on a dropdown whose\n * host view is removed while the menu is open fired zero times and left a\n * console error behind. There is nobody to notify at that point, because the\n * consumer's own view is being torn down in the same pass; `wr-popconfirm`\n * already disposes without emitting, and this brings the other two into line.\n *\n * The focus hand-back is skipped for the same reason — the host element is on\n * its way out of the document.\n */\n private closeOverlay(notify = true): void {\n if (!this.overlayRef) return;\n if (this.isTooltip() || this.trigger() === 'hover') {\n this.overlayRef.overlayElement.removeEventListener('mouseenter', this.onOverlayEnter);\n this.overlayRef.overlayElement.removeEventListener('mouseleave', this.onOverlayLeave);\n }\n this.clearHoverClose();\n // Take the focus back before the pane goes, and only if it was in there.\n //\n // A popover is not a tooltip: it attaches a `TemplatePortal` under\n // `role=\"dialog\"`, so a form or a menu inside it is the point, and Escape\n // arrives through the overlay's `keydownEvents()` no matter where the caret\n // is. Disposing with focus inside dropped it on `<body>`, and the next Tab\n // restarted from the top of the document. `wr-date-picker` and\n // `wr-popconfirm` already guard it exactly this way; leaving focus alone\n // when it had already moved is what stops the close from fighting the user\n // for the caret.\n const pane = this.overlayRef.overlayElement;\n const focusWasInside = pane.contains(this.host.nativeElement.ownerDocument.activeElement);\n this.overlayRef.dispose();\n this.overlayRef = null;\n // Disposing destroys the panel component; a retained ref would pin its view.\n this.textPanelRef = null;\n if (notify) {\n if (focusWasInside) this.host.nativeElement.focus();\n this.closed.emit();\n }\n }\n\n private readonly onOverlayLeave = (event: MouseEvent): void => {\n const related = event.relatedTarget as Node | null;\n if (related && this.host.nativeElement.contains(related)) return;\n // A tooltip leaves on its own `hideDelay`, the same one the trigger uses; a\n // hover popover has the longer grace period for crossing the gap back.\n if (this.isTooltip()) this.scheduleHide();\n else this.scheduleHoverClose();\n };\n\n private readonly onOverlayEnter = (): void => {\n // Two different timers can be in flight: `hideTimer`, armed by the trigger's\n // own `mouseleave` in tooltip mode, and `hoverCloseTimer` in popover mode.\n // Cancelling only the second would leave a tooltip disappearing `hideDelay`\n // after the pointer arrived on it.\n this.clearTimers();\n this.clearHoverClose();\n };\n\n private scheduleHoverClose(): void {\n this.clearHoverClose();\n this.hoverCloseTimer = setTimeout(() => this.isOpen.set(false), 120);\n }\n\n private clearHoverClose(): void {\n if (this.hoverCloseTimer) {\n clearTimeout(this.hoverCloseTimer);\n this.hoverCloseTimer = null;\n }\n }\n\n /**\n * Whether the app reads right-to-left.\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 * component that works, and defaulting to LTR is the honest fallback.\n */\n private isRtl(): boolean {\n return this.dir?.value === 'rtl';\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;;;;;;AAAA;;;;;AAKG;AAkBH;;;;;;;;;;;;;AAaG;AACI,MAAM,oBAAoB,GAAiD;IAChF,GAAG,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC,CAAC,EAAE;IAC/F,WAAW,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC,CAAC,EAAE;IACrG,SAAS,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC,CAAC,EAAE;IAC/F,MAAM,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,O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