ngwr 16.7.0 → 16.8.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 (167) hide show
  1. package/charts/donut-chart/styles/_index.scss +9 -3
  2. package/charts/meter-group/styles/_index.scss +8 -1
  3. package/charts/sparkline/styles/_index.scss +6 -3
  4. package/checkbox/styles/_index.scss +4 -0
  5. package/command-palette/styles/_index.scss +10 -0
  6. package/fesm2022/ngwr-charts-calendar-heatmap.mjs +3 -1
  7. package/fesm2022/ngwr-charts-calendar-heatmap.mjs.map +1 -1
  8. package/fesm2022/ngwr-charts-core.mjs +17 -0
  9. package/fesm2022/ngwr-charts-core.mjs.map +1 -1
  10. package/fesm2022/ngwr-charts-donut-chart-testing.mjs +27 -0
  11. package/fesm2022/ngwr-charts-donut-chart-testing.mjs.map +1 -1
  12. package/fesm2022/ngwr-charts-donut-chart.mjs +54 -6
  13. package/fesm2022/ngwr-charts-donut-chart.mjs.map +1 -1
  14. package/fesm2022/ngwr-charts-meter-group-testing.mjs +27 -0
  15. package/fesm2022/ngwr-charts-meter-group-testing.mjs.map +1 -1
  16. package/fesm2022/ngwr-charts-meter-group.mjs +54 -6
  17. package/fesm2022/ngwr-charts-meter-group.mjs.map +1 -1
  18. package/fesm2022/ngwr-charts-sparkline-testing.mjs +27 -0
  19. package/fesm2022/ngwr-charts-sparkline-testing.mjs.map +1 -1
  20. package/fesm2022/ngwr-charts-sparkline.mjs +45 -4
  21. package/fesm2022/ngwr-charts-sparkline.mjs.map +1 -1
  22. package/fesm2022/ngwr-checkbox.mjs +38 -3
  23. package/fesm2022/ngwr-checkbox.mjs.map +1 -1
  24. package/fesm2022/ngwr-color-picker-testing.mjs.map +1 -1
  25. package/fesm2022/ngwr-color-picker.mjs +4 -3
  26. package/fesm2022/ngwr-color-picker.mjs.map +1 -1
  27. package/fesm2022/ngwr-command-palette.mjs +39 -19
  28. package/fesm2022/ngwr-command-palette.mjs.map +1 -1
  29. package/fesm2022/ngwr-context-menu.mjs +7 -2
  30. package/fesm2022/ngwr-context-menu.mjs.map +1 -1
  31. package/fesm2022/ngwr-date-picker.mjs +1 -0
  32. package/fesm2022/ngwr-date-picker.mjs.map +1 -1
  33. package/fesm2022/ngwr-dialog.mjs +10 -7
  34. package/fesm2022/ngwr-dialog.mjs.map +1 -1
  35. package/fesm2022/ngwr-drawer.mjs +14 -8
  36. package/fesm2022/ngwr-drawer.mjs.map +1 -1
  37. package/fesm2022/ngwr-file-upload.mjs +2 -2
  38. package/fesm2022/ngwr-file-upload.mjs.map +1 -1
  39. package/fesm2022/ngwr-i18n-ar.mjs +9 -2
  40. package/fesm2022/ngwr-i18n-ar.mjs.map +1 -1
  41. package/fesm2022/ngwr-i18n-cs.mjs +9 -2
  42. package/fesm2022/ngwr-i18n-cs.mjs.map +1 -1
  43. package/fesm2022/ngwr-i18n-de.mjs +9 -2
  44. package/fesm2022/ngwr-i18n-de.mjs.map +1 -1
  45. package/fesm2022/ngwr-i18n-en.mjs +9 -2
  46. package/fesm2022/ngwr-i18n-en.mjs.map +1 -1
  47. package/fesm2022/ngwr-i18n-es.mjs +9 -2
  48. package/fesm2022/ngwr-i18n-es.mjs.map +1 -1
  49. package/fesm2022/ngwr-i18n-fr.mjs +9 -2
  50. package/fesm2022/ngwr-i18n-fr.mjs.map +1 -1
  51. package/fesm2022/ngwr-i18n-he.mjs +9 -2
  52. package/fesm2022/ngwr-i18n-he.mjs.map +1 -1
  53. package/fesm2022/ngwr-i18n-hi.mjs +9 -2
  54. package/fesm2022/ngwr-i18n-hi.mjs.map +1 -1
  55. package/fesm2022/ngwr-i18n-id.mjs +9 -2
  56. package/fesm2022/ngwr-i18n-id.mjs.map +1 -1
  57. package/fesm2022/ngwr-i18n-it.mjs +9 -2
  58. package/fesm2022/ngwr-i18n-it.mjs.map +1 -1
  59. package/fesm2022/ngwr-i18n-ja.mjs +9 -2
  60. package/fesm2022/ngwr-i18n-ja.mjs.map +1 -1
  61. package/fesm2022/ngwr-i18n-kk.mjs +9 -2
  62. package/fesm2022/ngwr-i18n-kk.mjs.map +1 -1
  63. package/fesm2022/ngwr-i18n-ko.mjs +9 -2
  64. package/fesm2022/ngwr-i18n-ko.mjs.map +1 -1
  65. package/fesm2022/ngwr-i18n-nl.mjs +9 -2
  66. package/fesm2022/ngwr-i18n-nl.mjs.map +1 -1
  67. package/fesm2022/ngwr-i18n-pl.mjs +9 -2
  68. package/fesm2022/ngwr-i18n-pl.mjs.map +1 -1
  69. package/fesm2022/ngwr-i18n-pt.mjs +9 -2
  70. package/fesm2022/ngwr-i18n-pt.mjs.map +1 -1
  71. package/fesm2022/ngwr-i18n-ru.mjs +9 -2
  72. package/fesm2022/ngwr-i18n-ru.mjs.map +1 -1
  73. package/fesm2022/ngwr-i18n-sv.mjs +9 -2
  74. package/fesm2022/ngwr-i18n-sv.mjs.map +1 -1
  75. package/fesm2022/ngwr-i18n-tr.mjs +9 -2
  76. package/fesm2022/ngwr-i18n-tr.mjs.map +1 -1
  77. package/fesm2022/ngwr-i18n-uk.mjs +9 -2
  78. package/fesm2022/ngwr-i18n-uk.mjs.map +1 -1
  79. package/fesm2022/ngwr-i18n-vi.mjs +9 -2
  80. package/fesm2022/ngwr-i18n-vi.mjs.map +1 -1
  81. package/fesm2022/ngwr-i18n-zh-tw.mjs +9 -2
  82. package/fesm2022/ngwr-i18n-zh-tw.mjs.map +1 -1
  83. package/fesm2022/ngwr-i18n-zh.mjs +9 -2
  84. package/fesm2022/ngwr-i18n-zh.mjs.map +1 -1
  85. package/fesm2022/ngwr-input-number.mjs +33 -10
  86. package/fesm2022/ngwr-input-number.mjs.map +1 -1
  87. package/fesm2022/ngwr-input-otp.mjs +24 -10
  88. package/fesm2022/ngwr-input-otp.mjs.map +1 -1
  89. package/fesm2022/ngwr-input.mjs +2 -2
  90. package/fesm2022/ngwr-input.mjs.map +1 -1
  91. package/fesm2022/ngwr-lightbox.mjs +5 -3
  92. package/fesm2022/ngwr-lightbox.mjs.map +1 -1
  93. package/fesm2022/ngwr-overlay.mjs +51 -2
  94. package/fesm2022/ngwr-overlay.mjs.map +1 -1
  95. package/fesm2022/ngwr-popconfirm.mjs +2 -2
  96. package/fesm2022/ngwr-popconfirm.mjs.map +1 -1
  97. package/fesm2022/ngwr-popover.mjs +11 -1
  98. package/fesm2022/ngwr-popover.mjs.map +1 -1
  99. package/fesm2022/ngwr-scroll.mjs +39 -16
  100. package/fesm2022/ngwr-scroll.mjs.map +1 -1
  101. package/fesm2022/ngwr-slider.mjs +22 -17
  102. package/fesm2022/ngwr-slider.mjs.map +1 -1
  103. package/fesm2022/ngwr-switch.mjs +33 -3
  104. package/fesm2022/ngwr-switch.mjs.map +1 -1
  105. package/fesm2022/ngwr-table.mjs +17 -4
  106. package/fesm2022/ngwr-table.mjs.map +1 -1
  107. package/fesm2022/ngwr-tabs-router.mjs +3 -3
  108. package/fesm2022/ngwr-tabs-router.mjs.map +1 -1
  109. package/fesm2022/ngwr-tour.mjs +8 -3
  110. package/fesm2022/ngwr-tour.mjs.map +1 -1
  111. package/fesm2022/ngwr-version.mjs +1 -1
  112. package/fesm2022/ngwr-version.mjs.map +1 -1
  113. package/i18n/ar.json +9 -2
  114. package/i18n/cs.json +9 -2
  115. package/i18n/de.json +9 -2
  116. package/i18n/en.json +9 -2
  117. package/i18n/es.json +9 -2
  118. package/i18n/fr.json +9 -2
  119. package/i18n/he.json +9 -2
  120. package/i18n/hi.json +9 -2
  121. package/i18n/id.json +9 -2
  122. package/i18n/it.json +9 -2
  123. package/i18n/ja.json +9 -2
  124. package/i18n/kk.json +9 -2
  125. package/i18n/ko.json +9 -2
  126. package/i18n/nl.json +9 -2
  127. package/i18n/pl.json +9 -2
  128. package/i18n/pt.json +9 -2
  129. package/i18n/ru.json +9 -2
  130. package/i18n/sv.json +9 -2
  131. package/i18n/tr.json +9 -2
  132. package/i18n/uk.json +9 -2
  133. package/i18n/vi.json +9 -2
  134. package/i18n/zh-TW.json +9 -2
  135. package/i18n/zh.json +9 -2
  136. package/llms-full.txt +4 -4
  137. package/package.json +1 -1
  138. package/radio/styles/_index.scss +4 -0
  139. package/schematics/use/rule.js +1 -0
  140. package/schematics/use/symbol-map.json +1 -0
  141. package/switch/styles/_index.scss +4 -0
  142. package/table/styles/_index.scss +7 -0
  143. package/tour/styles/_index.scss +11 -7
  144. package/types/ngwr-charts-donut-chart-testing.d.ts +32 -3
  145. package/types/ngwr-charts-donut-chart.d.ts +45 -6
  146. package/types/ngwr-charts-meter-group-testing.d.ts +29 -1
  147. package/types/ngwr-charts-meter-group.d.ts +43 -4
  148. package/types/ngwr-charts-sparkline-testing.d.ts +32 -2
  149. package/types/ngwr-charts-sparkline.d.ts +42 -3
  150. package/types/ngwr-checkbox.d.ts +14 -0
  151. package/types/ngwr-color-picker-testing.d.ts +1 -1
  152. package/types/ngwr-command-palette.d.ts +2 -1
  153. package/types/ngwr-date-picker.d.ts +8 -2
  154. package/types/ngwr-dialog.d.ts +11 -6
  155. package/types/ngwr-drawer.d.ts +12 -4
  156. package/types/ngwr-file-upload.d.ts +1 -1
  157. package/types/ngwr-input-number.d.ts +14 -2
  158. package/types/ngwr-input-otp.d.ts +2 -0
  159. package/types/ngwr-lightbox.d.ts +1 -0
  160. package/types/ngwr-overlay.d.ts +20 -1
  161. package/types/ngwr-popover.d.ts +3 -3
  162. package/types/ngwr-scroll.d.ts +11 -2
  163. package/types/ngwr-slider.d.ts +3 -1
  164. package/types/ngwr-switch.d.ts +13 -0
  165. package/types/ngwr-table.d.ts +1 -0
  166. package/types/ngwr-tabs-router.d.ts +3 -4
  167. package/types/ngwr-version.d.ts +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"ngwr-overlay.mjs","names":["DOCUMENT"],"sources":["../../../projects/lib/overlay/wr-anchored-positions.ts","../../../projects/lib/overlay/wr-overlay-close.ts","../../../projects/lib/overlay/wr-focus-overlay.ts","../../../projects/lib/overlay/wr-follow-direction.ts","../../../projects/lib/overlay/wr-follow-size.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/wr-overlay-order.ts","../../../projects/lib/overlay/tokens/wr-overlay-container.token.ts","../../../projects/lib/overlay/tokens/wr-overlay.token.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\n/**\n * Where an anchored panel sits relative to its trigger: a side, optionally\n * aligned to the trigger's start or end edge. The one set `wr-popover`,\n * `wr-dropdown` and `wr-popconfirm` take as `position`.\n *\n * `left` / `right` and `-start` / `-end` are logical: under `dir=\"rtl\"` they\n * mirror, the name staying as written.\n */\nexport type WrAnchoredPosition =\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 gap and no fallbacks.\n *\n * Everything anchors on `start` / `end` or `center`, which the CDK resolves\n * against the direction, so the table itself needs no mirroring. A gap added by\n * `wrAnchoredPositions` is an offset in physical pixels and does: see\n * `wrMirrorOffsets`.\n *\n * @internal\n */\nexport const WR_ANCHORED_POSITIONS: Record<WrAnchoredPosition, ConnectedPosition> = {\n top: { originX: 'center', originY: 'top', overlayX: 'center', overlayY: 'bottom' },\n 'top-start': { originX: 'start', originY: 'top', overlayX: 'start', overlayY: 'bottom' },\n 'top-end': { originX: 'end', originY: 'top', overlayX: 'end', overlayY: 'bottom' },\n bottom: { originX: 'center', originY: 'bottom', overlayX: 'center', overlayY: 'top' },\n 'bottom-start': { originX: 'start', originY: 'bottom', overlayX: 'start', overlayY: 'top' },\n 'bottom-end': { originX: 'end', originY: 'bottom', overlayX: 'end', overlayY: 'top' },\n left: { originX: 'start', originY: 'center', overlayX: 'end', overlayY: 'center' },\n 'left-start': { originX: 'start', originY: 'top', overlayX: 'end', overlayY: 'top' },\n 'left-end': { originX: 'start', originY: 'bottom', overlayX: 'end', overlayY: 'bottom' },\n right: { originX: 'end', originY: 'center', overlayX: 'start', overlayY: 'center' },\n 'right-start': { originX: 'end', originY: 'top', overlayX: 'start', overlayY: 'top' },\n 'right-end': { originX: 'end', originY: 'bottom', overlayX: 'start', overlayY: 'bottom' },\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` panel 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_ANCHORED_FALLBACKS: Record<WrAnchoredPosition, readonly WrAnchoredPosition[]> = {\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/** How a host dresses the links `wrAnchoredPositions` returns. @internal */\nexport interface WrAnchoredPositionsOptions {\n /**\n * Distance between the trigger and the panel, in px, as a CDK offset pointing\n * away from the trigger. Left out by a host whose gap is padding on the pane.\n *\n * It is the reason a flip list matters rather than being a nicety: the\n * flexible strategy emits `offsetX` as a `transform` on the pane, AFTER\n * `withPush` has already decided the coordinate. Push therefore parks a\n * right-anchored panel flush against the viewport edge and the offset then\n * shoves it back out, so a side placement that does not fit loses its border\n * and corner off-screen no matter how hard push works.\n */\n readonly gap?: number;\n /**\n * The pane's base class. Each link is tagged `<paneClass>--<placement>`, so\n * the pane names the placement it ACTUALLY took: the CDK applies a position's\n * own `panelClass` when it lands on it and clears it on the next one. Left\n * out by a host that writes the class itself.\n */\n readonly paneClass?: string;\n}\n\n/**\n * The list `withPositions()` wants for a placement: its fallback chain in\n * order, as fresh objects, so a caller may also tell which link the CDK landed\n * on by the identity of the position it reports back.\n *\n * @internal\n */\nexport function wrAnchoredPositions(\n position: WrAnchoredPosition,\n options: WrAnchoredPositionsOptions = {}\n): ConnectedPosition[] {\n const { gap, paneClass } = options;\n return WR_ANCHORED_FALLBACKS[position].map(name => {\n const link: ConnectedPosition = { ...WR_ANCHORED_POSITIONS[name] };\n if (gap) {\n if (name.startsWith('top')) link.offsetY = -gap;\n else if (name.startsWith('bottom')) link.offsetY = gap;\n else if (name.startsWith('left')) link.offsetX = -gap;\n else link.offsetX = gap;\n }\n if (paneClass) link.panelClass = `${paneClass}--${name}`;\n return link;\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\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 { FocusTrap } from '@angular/cdk/a11y';\nimport { type Injector, afterNextRender } from '@angular/core';\n\nconst INITIAL = '[cdkFocusInitial], [cdk-focus-initial]';\n\n/**\n * Moves focus into a freshly opened modal overlay the way its `autoFocus`\n * option asks. An element marked `cdkFocusInitial` wins in every mode.\n *\n * `'first-tabbable'` is the focus trap's own initial focus. `'dialog'` focuses\n * the panel (made programmatically focusable with `tabindex=\"-1\"`), `false`\n * leaves focus where it is. Both wait for the next render, because the content\n * is not in the DOM before that.\n *\n * @internal\n */\nexport function wrFocusOverlay(host: HTMLElement, trap: FocusTrap, mode: WrOverlayAutoFocus, injector: Injector): void {\n if (mode === 'first-tabbable') {\n void trap.focusInitialElementWhenReady();\n return;\n }\n if (mode === 'dialog') host.setAttribute('tabindex', '-1');\n afterNextRender(\n () => {\n if (!host.isConnected) return;\n if (host.querySelector(INITIAL)) trap.focusInitialElement();\n else if (mode === 'dialog') host.focus({ preventScroll: true });\n },\n { injector }\n );\n}\n\n/** What a dialog or drawer does with focus when it opens. */\nexport type WrOverlayAutoFocus = 'first-tabbable' | 'dialog' | false;\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 { wrNoop } 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(wrPopconfirmPositions(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 wrNoop;\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 { OverlayRef } from '@angular/cdk/overlay';\n\nimport { wrNoop } from 'ngwr/utils';\n\n/**\n * Keep an OPEN overlay positioned as its content changes size.\n *\n * The CDK positions a pane once, when it attaches, and again on scroll or\n * resize of the window. A panel whose content renders after that, or grows later\n * (a time row that appears, a calendar that gains a sixth week), is measured at\n * its first, smaller size: flipped above the origin at that height, it then\n * grows downward over the field it belongs to. This watches the pane with a\n * `ResizeObserver` and calls `updatePosition()` on every change, so the flip\n * decision always uses the size the panel has now.\n *\n * Call it once per `OverlayRef`, right after `attach(...)`. It ends itself when\n * the overlay detaches or is disposed. No-op where `ResizeObserver` does not\n * exist (SSR, old engines).\n *\n * @param overlayRef The overlay to keep in place.\n * @returns Stops observing. Idempotent, and unnecessary in the normal case.\n */\nexport function wrFollowSize(overlayRef: OverlayRef): () => void {\n if (typeof ResizeObserver === 'undefined') return wrNoop;\n\n const observer = new ResizeObserver(() => overlayRef.updatePosition());\n observer.observe(overlayRef.overlayElement);\n\n const stop = (): void => {\n observer.disconnect();\n subscription.unsubscribe();\n };\n // Both handlers: a live ref arrives through `next`, a disposed one only completes.\n const subscription = overlayRef.detachments().subscribe({ next: stop, complete: stop });\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(wrAnchoredPositions(position, { gap: 8 }), 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 { _isTestEnvironment } from '@angular/cdk/platform';\nimport { Service } from '@angular/core';\n\nconst CONTAINER_CLASS = 'wr-overlay-container';\nconst PLATFORM_ATTR = 'data-wr-platform';\n\n/**\n * The overlay container every NGWR overlay renders into — a CDK\n * `OverlayContainer` subclass that tags its element with\n * `.wr-overlay-container` in addition to CDK's own `.cdk-overlay-container`.\n *\n * It is what `WR_OVERLAY_CONTAINER` resolves to by default, and it is never\n * provided as CDK's root `OverlayContainer`: that one stays the element\n * Angular Material, NG-ZORRO and every other CDK consumer share, so NGWR's\n * overlays sit in an element of their own. The class is the stable hook for\n * styling them, e.g.:\n *\n * ```scss\n * .wr-overlay-container .cdk-overlay-pane { font-size: var(--wr-text-sm); }\n * ```\n *\n * Not a z-index: CDK 22 promotes overlays into the top layer, which no\n * z-index reaches.\n */\n@Service()\nexport class WrOverlayContainer extends OverlayContainer {\n // Not `super._createContainer()`: CDK stamps its element `platform=\"test\"`\n // (or `\"server\"`) and, creating one, removes every `.cdk-overlay-container`\n // carrying either — so under Karma, Jasmine, Jest or Mocha the root container\n // and this one would detach each other. Same conditions, own attribute, and\n // only its own leftovers swept; CDK's class stays for the structural styles.\n protected override _createContainer(): void {\n const testing = _isTestEnvironment();\n\n if (this._platform.isBrowser || testing) {\n this._document\n .querySelectorAll(\n `.${CONTAINER_CLASS}[${PLATFORM_ATTR}=\"server\"], .${CONTAINER_CLASS}[${PLATFORM_ATTR}=\"test\"]`\n )\n .forEach(stale => stale.remove());\n }\n\n const container = this._document.createElement('div');\n container.classList.add('cdk-overlay-container', CONTAINER_CLASS);\n if (testing) container.setAttribute(PLATFORM_ATTR, 'test');\n else if (!this._platform.isBrowser) container.setAttribute(PLATFORM_ATTR, 'server');\n\n this._document.body.appendChild(container);\n this._containerElement = 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 { Service } from '@angular/core';\n\ninterface Layer {\n readonly host: HTMLElement;\n readonly coversToasts: boolean;\n}\n\n/**\n * Move a popover host to the end of the top layer. Both calls run in one\n * task, so no frame shows it hidden. A host that is not a popover (jsdom,\n * `usePopover: false`) has no place in the top layer to change.\n */\nfunction reshow(host: Element): void {\n if (!host.isConnected || !host.hasAttribute('popover')) return;\n try {\n (host as HTMLElement).hidePopover();\n (host as HTMLElement).showPopover();\n } catch {\n // `hidePopover` throws on a host that is not showing: nothing to move.\n }\n}\n\n/**\n * Keeps the global toast host under the overlays opened with\n * `toasts: 'below'`, and above every other one.\n *\n * The top layer is ordered by the moment of promotion and by nothing else, so\n * the only way to put the toast host under an overlay is to promote that\n * overlay again after it. The toast host therefore belongs right under the\n * trailing run of covering overlays: the ones opened after the last overlay\n * that wants toasts above it. A covering overlay under such an overlay cannot\n * be moved over the toasts without also moving over the modal above it, so the\n * newer overlay's rule wins until it closes.\n *\n * @internal\n */\n@Service()\nexport class WrOverlayOrder {\n /** Open overlays in the order they were promoted. */\n private readonly layers: Layer[] = [];\n private toasts: HTMLElement | null = null;\n /** How many of `layers` sit under the toast host. */\n private under = 0;\n /** Something may have joined the top layer since the toast host was last raised. */\n private stale = true;\n private placing = false;\n\n // Neither event bubbles out of a shadow tree, so a popover shown inside one\n // goes unseen until an overlay joins the container.\n private readonly onBeforeToggle = (event: Event): void => {\n if (this.placing || event.target === this.toasts) return;\n if ((event as ToggleEvent).newState === 'open') this.stale = true;\n };\n private readonly onFullscreenChange = (): void => {\n this.stale = true;\n };\n\n /**\n * Register an overlay right after it is attached, which is when the CDK\n * promotes it. Returns the function that takes it off the list.\n */\n add(host: HTMLElement, toasts: 'above' | 'below' = 'above'): () => void {\n const layer: Layer = { host, coversToasts: toasts === 'below' };\n this.layers.push(layer);\n this.stale = true;\n return () => {\n const at = this.layers.indexOf(layer);\n if (at < 0) return;\n this.layers.splice(at, 1);\n if (at < this.under) this.under--;\n // The overlay that goes may have been the one deciding for those under it.\n this.place(false);\n };\n }\n\n /**\n * Put the toast host on top, then every overlay that covers toasts over it.\n * Returns whether anything had to move.\n */\n raiseToasts(host: HTMLElement): boolean {\n if (host !== this.toasts) {\n this.dropToasts();\n this.toasts = host;\n this.under = this.layers.length;\n this.stale = true;\n // `beforetoggle` does not bubble, so it is caught on the way down.\n host.ownerDocument.addEventListener('beforetoggle', this.onBeforeToggle, true);\n host.ownerDocument.addEventListener('fullscreenchange', this.onFullscreenChange);\n }\n return this.place(true);\n }\n\n /** An overlay that is not on the list was promoted. */\n joined(): void {\n this.stale = true;\n }\n\n dropToasts(): void {\n const doc = this.toasts?.ownerDocument;\n doc?.removeEventListener('beforetoggle', this.onBeforeToggle, true);\n doc?.removeEventListener('fullscreenchange', this.onFullscreenChange);\n this.toasts = null;\n }\n\n /**\n * @param raise with no covering overlay open, raise the host even where the\n * list says it is on top, if a popover this list does not know may have joined.\n */\n private place(raise: boolean): boolean {\n const toasts = this.toasts;\n if (!toasts) return false;\n\n let start = this.layers.length;\n while (start > 0 && this.layers[start - 1].coversToasts) start--;\n const covering = this.layers.slice(start);\n // Already right under the covering overlays: moving anything would only\n // put the toasts over them for the length of this call.\n if (this.under === start && (covering.length > 0 || !raise || !this.stale)) return false;\n\n const doc = toasts.ownerDocument;\n const focused = doc.activeElement as HTMLElement | null;\n\n this.placing = true;\n reshow(toasts);\n this.under = start;\n this.stale = false;\n\n if (covering.length > 0) {\n // Whatever was attached after the first covering overlay sits above it\n // (a select panel inside the dialog), and has to stay there. Hosts are\n // appended on attach, so the siblings after it are those, in order.\n const above = new Set<Element>();\n for (let el: Element | null = covering[0].host; el; el = el.nextElementSibling) above.add(el);\n for (const layer of covering) above.add(layer.host);\n above.delete(toasts);\n above.forEach(reshow);\n }\n this.placing = false;\n\n // Showing a popover runs its focusing steps, which move focus to an\n // `autofocus` descendant.\n if (focused?.isConnected && doc.activeElement !== focused) focused.focus({ preventScroll: true });\n return true;\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 { OverlayContainer } from '@angular/cdk/overlay';\nimport { InjectionToken, inject } from '@angular/core';\n\nimport { WrOverlayContainer } from '../wr-overlay-container';\n\n/**\n * Injection token for the overlay container NGWR components render into.\n *\n * Isolated by default: a `WrOverlayContainer`, tagged `.wr-overlay-container`,\n * and never CDK's root `OverlayContainer`. Every CDK consumer that shares the\n * root one (Angular Material, NG-ZORRO) shares its element too, and with it\n * the z-index stacking, the `.cdk-overlay-pane` rules and the lifecycle — so\n * one library's overlays end up under, restyled by or torn down with\n * another's. CDK's root container is left untouched for them.\n *\n * @internal\n */\nexport const WR_OVERLAY_CONTAINER = new InjectionToken<OverlayContainer>('WR_OVERLAY_CONTAINER', {\n providedIn: 'root',\n factory: () => inject(WrOverlayContainer),\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, OverlayContainer, OverlayPositionBuilder } from '@angular/cdk/overlay';\nimport { EnvironmentInjector, InjectionToken, Injector, inject } from '@angular/core';\n\nimport { WR_OVERLAY_CONTAINER } from './wr-overlay-container.token';\n\n/**\n * Injection token for the CDK `Overlay` service NGWR components should\n * use to open panels.\n *\n * Isolated by default: a fresh `Overlay` bound to `WR_OVERLAY_CONTAINER`\n * rather than CDK's root one, so NGWR overlays never share a DOM root — and\n * with it z-index, styles and lifecycle — with Angular Material, NG-ZORRO or\n * any other CDK consumer. CDK's root `Overlay` and `OverlayContainer` are\n * left untouched, so those libraries keep theirs.\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: (): Overlay => {\n const parent = inject(EnvironmentInjector);\n const container = inject(WR_OVERLAY_CONTAINER);\n\n // `Overlay` reads `OverlayContainer` from its own injector, so a child that\n // answers with ours gets a fresh instance bound to it. Providing either in\n // the root instead would move every other CDK consumer into it as well.\n // The position builder comes along because a connected position strategy\n // measures the container it reads from its builder's injector: left in the\n // root, the first dropdown created CDK's own container just to measure it.\n const child = Injector.create({\n parent,\n providers: [\n { provide: OverlayContainer, useValue: container },\n { provide: OverlayPositionBuilder, useClass: OverlayPositionBuilder },\n { provide: Overlay, useClass: Overlay },\n ],\n });\n\n return child.get(Overlay);\n },\n});\n"],"mappings":";;;;;;;;;;;;;AAyCA,MAAa,wBAAuE;CAClF,KAAK;EAAE,SAAS;EAAU,SAAS;EAAO,UAAU;EAAU,UAAU;CAAQ;CAChF,aAAa;EAAE,SAAS;EAAS,SAAS;EAAO,UAAU;EAA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AS,OAAO,mBAAmB;EACzC,MAAM,YAAY,OAAO,oBAAoB;EAiB7C,OATc,SAAS,OAAO;GAC5B;GACA,WAAW;IACT;KAAE,SAAS;KAAkB,UAAU;IAAS;IAChD;KAAE,SAAS;KAAwB,UAAU;IAAsB;IACnE;KAAE,SAAS;KAAS,UAAU;IAAO;GACtC;EACF,CAEM,CAAA,CAAM,IAAI,OAAO;CAC1B;AACD,CAAA"}
1
+ {"version":3,"file":"ngwr-overlay.mjs","names":["DOCUMENT"],"sources":["../../../projects/lib/overlay/wr-anchored-positions.ts","../../../projects/lib/overlay/wr-overlay-close.ts","../../../projects/lib/overlay/wr-focus-overlay.ts","../../../projects/lib/overlay/wr-follow-direction.ts","../../../projects/lib/overlay/wr-follow-size.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/wr-overlay-order.ts","../../../projects/lib/overlay/wr-scroll-block.ts","../../../projects/lib/overlay/tokens/wr-overlay-container.token.ts","../../../projects/lib/overlay/tokens/wr-overlay.token.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\n/**\n * Where an anchored panel sits relative to its trigger: a side, optionally\n * aligned to the trigger's start or end edge. The one set `wr-popover`,\n * `wr-dropdown` and `wr-popconfirm` take as `position`.\n *\n * `left` / `right` and `-start` / `-end` are logical: under `dir=\"rtl\"` they\n * mirror, the name staying as written.\n */\nexport type WrAnchoredPosition =\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 gap and no fallbacks.\n *\n * Everything anchors on `start` / `end` or `center`, which the CDK resolves\n * against the direction, so the table itself needs no mirroring. A gap added by\n * `wrAnchoredPositions` is an offset in physical pixels and does: see\n * `wrMirrorOffsets`.\n *\n * @internal\n */\nexport const WR_ANCHORED_POSITIONS: Record<WrAnchoredPosition, ConnectedPosition> = {\n top: { originX: 'center', originY: 'top', overlayX: 'center', overlayY: 'bottom' },\n 'top-start': { originX: 'start', originY: 'top', overlayX: 'start', overlayY: 'bottom' },\n 'top-end': { originX: 'end', originY: 'top', overlayX: 'end', overlayY: 'bottom' },\n bottom: { originX: 'center', originY: 'bottom', overlayX: 'center', overlayY: 'top' },\n 'bottom-start': { originX: 'start', originY: 'bottom', overlayX: 'start', overlayY: 'top' },\n 'bottom-end': { originX: 'end', originY: 'bottom', overlayX: 'end', overlayY: 'top' },\n left: { originX: 'start', originY: 'center', overlayX: 'end', overlayY: 'center' },\n 'left-start': { originX: 'start', originY: 'top', overlayX: 'end', overlayY: 'top' },\n 'left-end': { originX: 'start', originY: 'bottom', overlayX: 'end', overlayY: 'bottom' },\n right: { originX: 'end', originY: 'center', overlayX: 'start', overlayY: 'center' },\n 'right-start': { originX: 'end', originY: 'top', overlayX: 'start', overlayY: 'top' },\n 'right-end': { originX: 'end', originY: 'bottom', overlayX: 'start', overlayY: 'bottom' },\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` panel 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_ANCHORED_FALLBACKS: Record<WrAnchoredPosition, readonly WrAnchoredPosition[]> = {\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/** How a host dresses the links `wrAnchoredPositions` returns. @internal */\nexport interface WrAnchoredPositionsOptions {\n /**\n * Distance between the trigger and the panel, in px, as a CDK offset pointing\n * away from the trigger. Left out by a host whose gap is padding on the pane.\n *\n * It is the reason a flip list matters rather than being a nicety: the\n * flexible strategy emits `offsetX` as a `transform` on the pane, AFTER\n * `withPush` has already decided the coordinate. Push therefore parks a\n * right-anchored panel flush against the viewport edge and the offset then\n * shoves it back out, so a side placement that does not fit loses its border\n * and corner off-screen no matter how hard push works.\n */\n readonly gap?: number;\n /**\n * The pane's base class. Each link is tagged `<paneClass>--<placement>`, so\n * the pane names the placement it ACTUALLY took: the CDK applies a position's\n * own `panelClass` when it lands on it and clears it on the next one. Left\n * out by a host that writes the class itself.\n */\n readonly paneClass?: string;\n}\n\n/**\n * The list `withPositions()` wants for a placement: its fallback chain in\n * order, as fresh objects, so a caller may also tell which link the CDK landed\n * on by the identity of the position it reports back.\n *\n * @internal\n */\nexport function wrAnchoredPositions(\n position: WrAnchoredPosition,\n options: WrAnchoredPositionsOptions = {}\n): ConnectedPosition[] {\n const { gap, paneClass } = options;\n return WR_ANCHORED_FALLBACKS[position].map(name => {\n const link: ConnectedPosition = { ...WR_ANCHORED_POSITIONS[name] };\n if (gap) {\n if (name.startsWith('top')) link.offsetY = -gap;\n else if (name.startsWith('bottom')) link.offsetY = gap;\n else if (name.startsWith('left')) link.offsetX = -gap;\n else link.offsetX = gap;\n }\n if (paneClass) link.panelClass = `${paneClass}--${name}`;\n return link;\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\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 { FocusTrap } from '@angular/cdk/a11y';\nimport { type Injector, afterNextRender } from '@angular/core';\n\nconst INITIAL = '[cdkFocusInitial], [cdk-focus-initial]';\n\n/**\n * Moves focus into a freshly opened modal overlay the way its `autoFocus`\n * option asks. An element marked `cdkFocusInitial` wins in every mode.\n *\n * `'first-tabbable'` is the focus trap's own initial focus. `'dialog'` focuses\n * the panel (made programmatically focusable with `tabindex=\"-1\"`), `false`\n * leaves focus where it is. Both wait for the next render, because the content\n * is not in the DOM before that.\n *\n * @internal\n */\nexport function wrFocusOverlay(host: HTMLElement, trap: FocusTrap, mode: WrOverlayAutoFocus, injector: Injector): void {\n if (mode === 'first-tabbable') {\n void trap.focusInitialElementWhenReady();\n return;\n }\n if (mode === 'dialog') host.setAttribute('tabindex', '-1');\n afterNextRender(\n () => {\n if (!host.isConnected) return;\n if (host.querySelector(INITIAL)) trap.focusInitialElement();\n else if (mode === 'dialog') host.focus({ preventScroll: true });\n },\n { injector }\n );\n}\n\n/** What a dialog or drawer does with focus when it opens. */\nexport type WrOverlayAutoFocus = 'first-tabbable' | 'dialog' | false;\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 { wrNoop } 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(wrPopconfirmPositions(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 wrNoop;\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 { OverlayRef } from '@angular/cdk/overlay';\n\nimport { wrNoop } from 'ngwr/utils';\n\n/**\n * Keep an OPEN overlay positioned as its content changes size.\n *\n * The CDK positions a pane once, when it attaches, and again on scroll or\n * resize of the window. A panel whose content renders after that, or grows later\n * (a time row that appears, a calendar that gains a sixth week), is measured at\n * its first, smaller size: flipped above the origin at that height, it then\n * grows downward over the field it belongs to. This watches the pane with a\n * `ResizeObserver` and calls `updatePosition()` on every change, so the flip\n * decision always uses the size the panel has now.\n *\n * Call it once per `OverlayRef`, right after `attach(...)`. It ends itself when\n * the overlay detaches or is disposed. No-op where `ResizeObserver` does not\n * exist (SSR, old engines).\n *\n * @param overlayRef The overlay to keep in place.\n * @returns Stops observing. Idempotent, and unnecessary in the normal case.\n */\nexport function wrFollowSize(overlayRef: OverlayRef): () => void {\n if (typeof ResizeObserver === 'undefined') return wrNoop;\n\n const observer = new ResizeObserver(() => overlayRef.updatePosition());\n observer.observe(overlayRef.overlayElement);\n\n const stop = (): void => {\n observer.disconnect();\n subscription.unsubscribe();\n };\n // Both handlers: a live ref arrives through `next`, a disposed one only completes.\n const subscription = overlayRef.detachments().subscribe({ next: stop, complete: stop });\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(wrAnchoredPositions(position, { gap: 8 }), 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 { _isTestEnvironment } from '@angular/cdk/platform';\nimport { Service } from '@angular/core';\n\nconst CONTAINER_CLASS = 'wr-overlay-container';\nconst PLATFORM_ATTR = 'data-wr-platform';\n\n/**\n * The overlay container every NGWR overlay renders into — a CDK\n * `OverlayContainer` subclass that tags its element with\n * `.wr-overlay-container` in addition to CDK's own `.cdk-overlay-container`.\n *\n * It is what `WR_OVERLAY_CONTAINER` resolves to by default, and it is never\n * provided as CDK's root `OverlayContainer`: that one stays the element\n * Angular Material, NG-ZORRO and every other CDK consumer share, so NGWR's\n * overlays sit in an element of their own. The class is the stable hook for\n * styling them, e.g.:\n *\n * ```scss\n * .wr-overlay-container .cdk-overlay-pane { font-size: var(--wr-text-sm); }\n * ```\n *\n * Not a z-index: CDK 22 promotes overlays into the top layer, which no\n * z-index reaches.\n */\n@Service()\nexport class WrOverlayContainer extends OverlayContainer {\n // Not `super._createContainer()`: CDK stamps its element `platform=\"test\"`\n // (or `\"server\"`) and, creating one, removes every `.cdk-overlay-container`\n // carrying either — so under Karma, Jasmine, Jest or Mocha the root container\n // and this one would detach each other. Same conditions, own attribute, and\n // only its own leftovers swept; CDK's class stays for the structural styles.\n protected override _createContainer(): void {\n const testing = _isTestEnvironment();\n\n if (this._platform.isBrowser || testing) {\n this._document\n .querySelectorAll(\n `.${CONTAINER_CLASS}[${PLATFORM_ATTR}=\"server\"], .${CONTAINER_CLASS}[${PLATFORM_ATTR}=\"test\"]`\n )\n .forEach(stale => stale.remove());\n }\n\n const container = this._document.createElement('div');\n container.classList.add('cdk-overlay-container', CONTAINER_CLASS);\n if (testing) container.setAttribute(PLATFORM_ATTR, 'test');\n else if (!this._platform.isBrowser) container.setAttribute(PLATFORM_ATTR, 'server');\n\n this._document.body.appendChild(container);\n this._containerElement = 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 { Service } from '@angular/core';\n\ninterface Layer {\n readonly host: HTMLElement;\n readonly coversToasts: boolean;\n}\n\n/**\n * Move a popover host to the end of the top layer. Both calls run in one\n * task, so no frame shows it hidden. A host that is not a popover (jsdom,\n * `usePopover: false`) has no place in the top layer to change.\n */\nfunction reshow(host: Element): void {\n if (!host.isConnected || !host.hasAttribute('popover')) return;\n try {\n (host as HTMLElement).hidePopover();\n (host as HTMLElement).showPopover();\n } catch {\n // `hidePopover` throws on a host that is not showing: nothing to move.\n }\n}\n\n/**\n * Keeps the global toast host under the overlays opened with\n * `toasts: 'below'`, and above every other one.\n *\n * The top layer is ordered by the moment of promotion and by nothing else, so\n * the only way to put the toast host under an overlay is to promote that\n * overlay again after it. The toast host therefore belongs right under the\n * trailing run of covering overlays: the ones opened after the last overlay\n * that wants toasts above it. A covering overlay under such an overlay cannot\n * be moved over the toasts without also moving over the modal above it, so the\n * newer overlay's rule wins until it closes.\n *\n * @internal\n */\n@Service()\nexport class WrOverlayOrder {\n /** Open overlays in the order they were promoted. */\n private readonly layers: Layer[] = [];\n private toasts: HTMLElement | null = null;\n /** How many of `layers` sit under the toast host. */\n private under = 0;\n /** Something may have joined the top layer since the toast host was last raised. */\n private stale = true;\n private placing = false;\n\n // Neither event bubbles out of a shadow tree, so a popover shown inside one\n // goes unseen until an overlay joins the container.\n private readonly onBeforeToggle = (event: Event): void => {\n if (this.placing || event.target === this.toasts) return;\n if ((event as ToggleEvent).newState === 'open') this.stale = true;\n };\n private readonly onFullscreenChange = (): void => {\n this.stale = true;\n };\n\n /**\n * Register an overlay right after it is attached, which is when the CDK\n * promotes it. Returns the function that takes it off the list.\n */\n add(host: HTMLElement, toasts: 'above' | 'below' = 'above'): () => void {\n const layer: Layer = { host, coversToasts: toasts === 'below' };\n this.layers.push(layer);\n this.stale = true;\n return () => {\n const at = this.layers.indexOf(layer);\n if (at < 0) return;\n this.layers.splice(at, 1);\n if (at < this.under) this.under--;\n // The overlay that goes may have been the one deciding for those under it.\n this.place(false);\n };\n }\n\n /**\n * Put the toast host on top, then every overlay that covers toasts over it.\n * Returns whether anything had to move.\n */\n raiseToasts(host: HTMLElement): boolean {\n if (host !== this.toasts) {\n this.dropToasts();\n this.toasts = host;\n this.under = this.layers.length;\n this.stale = true;\n // `beforetoggle` does not bubble, so it is caught on the way down.\n host.ownerDocument.addEventListener('beforetoggle', this.onBeforeToggle, true);\n host.ownerDocument.addEventListener('fullscreenchange', this.onFullscreenChange);\n }\n return this.place(true);\n }\n\n /** An overlay that is not on the list was promoted. */\n joined(): void {\n this.stale = true;\n }\n\n dropToasts(): void {\n const doc = this.toasts?.ownerDocument;\n doc?.removeEventListener('beforetoggle', this.onBeforeToggle, true);\n doc?.removeEventListener('fullscreenchange', this.onFullscreenChange);\n this.toasts = null;\n }\n\n /**\n * @param raise with no covering overlay open, raise the host even where the\n * list says it is on top, if a popover this list does not know may have joined.\n */\n private place(raise: boolean): boolean {\n const toasts = this.toasts;\n if (!toasts) return false;\n\n let start = this.layers.length;\n while (start > 0 && this.layers[start - 1].coversToasts) start--;\n const covering = this.layers.slice(start);\n // Already right under the covering overlays: moving anything would only\n // put the toasts over them for the length of this call.\n if (this.under === start && (covering.length > 0 || !raise || !this.stale)) return false;\n\n const doc = toasts.ownerDocument;\n const focused = doc.activeElement as HTMLElement | null;\n\n this.placing = true;\n reshow(toasts);\n this.under = start;\n this.stale = false;\n\n if (covering.length > 0) {\n // Whatever was attached after the first covering overlay sits above it\n // (a select panel inside the dialog), and has to stay there. Hosts are\n // appended on attach, so the siblings after it are those, in order.\n const above = new Set<Element>();\n for (let el: Element | null = covering[0].host; el; el = el.nextElementSibling) above.add(el);\n for (const layer of covering) above.add(layer.host);\n above.delete(toasts);\n above.forEach(reshow);\n }\n this.placing = false;\n\n // Showing a popover runs its focusing steps, which move focus to an\n // `autofocus` descendant.\n if (focused?.isConnected && doc.activeElement !== focused) focused.focus({ preventScroll: true });\n return true;\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 ScrollStrategy, ScrollStrategyOptions } from '@angular/cdk/overlay';\nimport { Service, inject } from '@angular/core';\n\n/**\n * Page scroll lock shared by every modal NGWR overlay.\n *\n * CDK's `block()` strategy has no counter: a second one refuses to engage while\n * the first holds the page, and its `disable()` is then a no-op, so closing the\n * first of two stacked modals released the page under the one still open. Here\n * every strategy is a holder, the page stays blocked while any holder is\n * enabled and is released when the last one disables, in whatever order.\n *\n * @internal\n */\n@Service()\nexport class WrScrollBlock {\n private readonly block = inject(ScrollStrategyOptions).block();\n private holders = 0;\n\n /** A scroll strategy for one overlay (or one component) that blocks the page while it is enabled. */\n strategy(): ScrollStrategy {\n let held = false;\n return {\n attach: () => undefined,\n enable: () => {\n if (!held) {\n held = true;\n this.holders++;\n }\n // CDK ignores an enable while the page is already blocked, and one that\n // found nothing to block at the first holder may find it at a later one.\n this.block.enable();\n },\n disable: () => {\n if (!held) return;\n held = false;\n if (--this.holders === 0) this.block.disable();\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 { OverlayContainer } from '@angular/cdk/overlay';\nimport { InjectionToken, inject } from '@angular/core';\n\nimport { WrOverlayContainer } from '../wr-overlay-container';\n\n/**\n * Injection token for the overlay container NGWR components render into.\n *\n * Isolated by default: a `WrOverlayContainer`, tagged `.wr-overlay-container`,\n * and never CDK's root `OverlayContainer`. Every CDK consumer that shares the\n * root one (Angular Material, NG-ZORRO) shares its element too, and with it\n * the z-index stacking, the `.cdk-overlay-pane` rules and the lifecycle — so\n * one library's overlays end up under, restyled by or torn down with\n * another's. CDK's root container is left untouched for them.\n *\n * @internal\n */\nexport const WR_OVERLAY_CONTAINER = new InjectionToken<OverlayContainer>('WR_OVERLAY_CONTAINER', {\n providedIn: 'root',\n factory: () => inject(WrOverlayContainer),\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, OverlayContainer, OverlayPositionBuilder } from '@angular/cdk/overlay';\nimport { EnvironmentInjector, InjectionToken, Injector, inject } from '@angular/core';\n\nimport { WR_OVERLAY_CONTAINER } from './wr-overlay-container.token';\n\n/**\n * Injection token for the CDK `Overlay` service NGWR components should\n * use to open panels.\n *\n * Isolated by default: a fresh `Overlay` bound to `WR_OVERLAY_CONTAINER`\n * rather than CDK's root one, so NGWR overlays never share a DOM root — and\n * with it z-index, styles and lifecycle — with Angular Material, NG-ZORRO or\n * any other CDK consumer. CDK's root `Overlay` and `OverlayContainer` are\n * left untouched, so those libraries keep theirs.\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: (): Overlay => {\n const parent = inject(EnvironmentInjector);\n const container = inject(WR_OVERLAY_CONTAINER);\n\n // `Overlay` reads `OverlayContainer` from its own injector, so a child that\n // answers with ours gets a fresh instance bound to it. Providing either in\n // the root instead would move every other CDK consumer into it as well.\n // The position builder comes along because a connected position strategy\n // measures the container it reads from its builder's injector: left in the\n // root, the first dropdown created CDK's own container just to measure it.\n const child = Injector.create({\n parent,\n providers: [\n { provide: OverlayContainer, useValue: container },\n { provide: OverlayPositionBuilder, useClass: OverlayPositionBuilder },\n { provide: Overlay, useClass: Overlay },\n ],\n });\n\n return child.get(Overlay);\n },\n});\n"],"mappings":";;;;;;;;;;;;;AAyCA,MAAa,wBAAuE;CAClF,KAAK;EAAE,SAAS;EAAU,SAAS;EAAO,UAAU;EAAU,UAAU;CAAQ;CAChF,aAAa;EAAE,SAAS;EAAS,SAAS;EAAO,UAAU;EAAS,UAAU;CAAQ;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K;IACP;IAGA,KAAK,MAAM,OAAM;GACnB;GACA,eAAc;IACZ,IAAI,CAAC,MAAM;IACX,OAAO;IACP,IAAI,EAAE,KAAK,YAAY,GAAG,KAAK,MAAM,QAAO;GAC9C;EACD;CACH;CAxBW,OAAA,OAAA,GAAA,mBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,UAAA;EAAA,MAAA;EAAa,MAAA,CAAA;EAAA,QAAA,GAAA,gBAAA;CAAA,CAAA;CAAb,OAAA,QAAA,GAAA,mBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,UAAA;EAAA,MAAA;CAAa,CAAA;;AAAb,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAa,YAAA,CAAA,EADzB,MAAA,Q;;;;;;;;ACGD,MAAa,uBAAuB,IAAI,eAAiC,wBAAwB;CAC/F,YAAY;CACZ,eAAe,OAAO,kBAAkB;AACzC,CAAA;;;;;;;ACFD,MAAa,aAAa,IAAI,eAAwB,cAAc;CAClE,YAAY;CACZ,eAAuB;EACrB,MAAM,SAAS,OAAO,mBAAmB;EACzC,MAAM,YAAY,OAAO,oBAAoB;EAiB7C,OATc,SAAS,OAAO;GAC5B;GACA,WAAW;IACT;KAAE,SAAS;KAAkB,UAAU;IAAS;IAChD;KAAE,SAAS;KAAwB,UAAU;IAAsB;IACnE;KAAE,SAAS;KAAS,UAAU;IAAO;GACtC;EACF,CAEM,CAAA,CAAM,IAAI,OAAO;CAC1B;AACD,CAAA"}
@@ -1,7 +1,7 @@
1
1
  import * as i0 from "@angular/core";
2
2
  import { Component, DestroyRef, Directive, ElementRef, Injector, ViewContainerRef, ViewEncapsulation, effect, inject, input, output, signal } from "@angular/core";
3
3
  import { coerceBooleanProperty } from "@angular/cdk/coercion";
4
- import { wrCheckStyles, wrNoteFocusReturn, wrRestoreFocus, wrToClassList } from "ngwr/utils";
4
+ import { wrCheckStyles, wrIsComposing, wrNoteFocusReturn, wrRestoreFocus, wrToClassList } from "ngwr/utils";
5
5
  import { useI18nText } from "ngwr/i18n";
6
6
  import { Directionality } from "@angular/cdk/bidi";
7
7
  import { WrButton } from "ngwr/button";
@@ -288,7 +288,7 @@ var WrPopconfirm = class WrPopconfirm {
288
288
  this.dismiss();
289
289
  });
290
290
  this.overlayRef.keydownEvents().pipe(takeUntilDestroyed(this.destroyRef)).subscribe((event) => {
291
- if (event.key === "Escape") {
291
+ if (event.key === "Escape" && !wrIsComposing(event)) {
292
292
  event.preventDefault();
293
293
  this.dismiss();
294
294
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ngwr-popconfirm.mjs","names":[],"sources":["../../../projects/lib/popconfirm/popconfirm-panel.ts","../../../projects/lib/popconfirm/popconfirm-panel.html","../../../projects/lib/popconfirm/types/popconfirm-position.ts","../../../projects/lib/popconfirm/popconfirm.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 { Component, ViewEncapsulation, input, output } from '@angular/core';\n\nimport { WrButton } from 'ngwr/button';\nimport type { WrColor } from 'ngwr/theme';\nimport { wrCheckStyles } from 'ngwr/utils';\n\n/**\n * Confirmation panel rendered inside the popconfirm overlay. Not part\n * of the public template API — use `[wrPopconfirm]` instead.\n *\n * @internal\n */\n@Component({\n selector: 'wr-popconfirm',\n templateUrl: './popconfirm-panel.html',\n encapsulation: ViewEncapsulation.None,\n host: { class: 'wr-popconfirm' },\n imports: [WrButton],\n})\nexport class WrPopconfirmPanel {\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('popconfirm');\n }\n\n readonly message = input.required<string>();\n\n /** Id the anchoring directive points `aria-describedby` at. */\n readonly messageId = input<string | null>(null);\n readonly confirmText = input<string>('Confirm');\n readonly cancelText = input<string>('Cancel');\n readonly confirmColor = input<WrColor>('primary');\n\n readonly confirmed = output<void>();\n readonly cancelled = output<void>();\n}\n","<p class=\"wr-popconfirm__message\" [attr.id]=\"messageId()\">{{ message() }}</p>\n\n<div class=\"wr-popconfirm__actions\">\n <wr-btn class=\"wr-popconfirm__action wr-popconfirm__action--cancel\" size=\"sm\" (click)=\"cancelled.emit()\">\n {{ cancelText() }}\n </wr-btn>\n <wr-btn\n class=\"wr-popconfirm__action wr-popconfirm__action--confirm\"\n size=\"sm\"\n [color]=\"confirmColor()\"\n (click)=\"confirmed.emit()\"\n >\n {{ confirmText() }}\n </wr-btn>\n</div>\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\nimport { type WrAnchoredPosition, wrAnchoredPositions } from 'ngwr/overlay';\n\n/** Where the popconfirm panel sits relative to its trigger. */\nexport type WrPopconfirmPosition = WrAnchoredPosition;\n\n/**\n * The list `withPositions()` wants: the shared fallback chain `wr-popover`\n * walks, with its 8px gap, every link tagged with the pane class of the\n * placement it puts the panel on, so the arrow\n * (`.wr-popconfirm-overlay--<placement>`) follows a flip. The CDK applies a\n * position's own `panelClass` when it lands on it and clears it on the next one;\n * the gap is an offset rather than padding, so taking the class off before it\n * measures changes nothing.\n *\n * @internal\n */\nexport function wrPopconfirmPositions(position: WrPopconfirmPosition): ConnectedPosition[] {\n return wrAnchoredPositions(position, { gap: 8, paneClass: 'wr-popconfirm-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 { type FocusTrap, FocusMonitor, FocusTrapFactory } from '@angular/cdk/a11y';\nimport { Directionality } from '@angular/cdk/bidi';\nimport { coerceBooleanProperty } from '@angular/cdk/coercion';\nimport { type OverlayRef, ScrollStrategyOptions } from '@angular/cdk/overlay';\nimport { ComponentPortal } from '@angular/cdk/portal';\nimport {\n DestroyRef,\n Directive,\n ElementRef,\n Injector,\n ViewContainerRef,\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 WrOutsideClick,\n type WrOverlayAutoFocus,\n wrFocusOverlay,\n wrFollowDirection,\n wrMirrorOffsets,\n} from 'ngwr/overlay';\nimport type { WrColor } from 'ngwr/theme';\nimport { wrToClassList, wrCheckStyles, type WrClassInput, wrNoteFocusReturn, wrRestoreFocus } from 'ngwr/utils';\n\nimport { WrPopconfirmPanel } from './popconfirm-panel';\nimport { type WrPopconfirmPosition, wrPopconfirmPositions } from './types';\n\n/**\n * How close, in px, `withPush` may park the panel to the viewport edge — the\n * `--wr-space-sm` step, and the value `wr-popover` uses.\n */\nconst VIEWPORT_MARGIN = 8;\n\n/**\n * Small \"Are you sure?\" panel anchored to its trigger. Fires `confirmed`\n * or `cancelled` and closes automatically. Built on CDK Overlay.\n *\n * @example\n * ```html\n * <wr-btn\n * color=\"danger\"\n * [wrPopconfirm]=\"'Delete this item?'\"\n * confirmColor=\"danger\"\n * confirmText=\"Delete\"\n * (confirmed)=\"remove()\"\n * >Delete</wr-btn>\n * ```\n *\n * @see https://ngwr.dev/reference/components/popconfirm\n */\nlet popconfirmUid = 0;\n\n@Directive({\n selector: '[wrPopconfirm]',\n exportAs: 'wrPopconfirm',\n host: {\n // Marks the trigger the way `[wrPopover]` and `[wrDropdown]` mark theirs. The\n // question is normally BOUND (`[wrPopconfirm]=\"question\"`), which leaves no\n // attribute in the DOM at all, so without this there is nothing to find a\n // trigger by once the panel is shut.\n class: 'wr-popconfirm-trigger',\n '[class.wr-popconfirm-trigger--disabled]': 'disabled()',\n '(click)': 'toggle($event)',\n '(keydown)': 'onTriggerKeydown($event)',\n '[attr.aria-haspopup]': 'disabled() ? null : \"dialog\"',\n '[attr.aria-expanded]': 'disabled() ? null : isOpen()',\n // Names the dialog this trigger opened, as every other overlay trigger in the\n // catalog does. `aria-haspopup=\"dialog\"` promises a dialog and `aria-expanded`\n // says it is showing; without the id, which one is left to guess.\n '[attr.aria-controls]': 'isOpen() ? panelId : null',\n },\n})\nexport class WrPopconfirm {\n /** Confirmation message. */\n readonly message = input.required<string>({ alias: 'wrPopconfirm' });\n\n /**\n * Anchor side and alignment, the twelve placements `wr-popover` takes; the\n * panel flips to another side when this one has no room.\n * @default 'top'\n */\n readonly position = input<WrPopconfirmPosition>('top');\n\n /** Label for the confirm button. @default 'Confirm' */\n /** Confirm button text. Falls back to `popconfirm.confirm`. */\n readonly confirmText = input<string | null>(null);\n\n /** Label for the cancel button. @default 'Cancel' */\n /** Cancel button text. Falls back to `popconfirm.cancel`. */\n readonly cancelText = input<string | null>(null);\n\n /**\n * Accessible name of the confirmation dialog. `role=\"dialog\"` with no name\n * announces as a bare \"dialog\". Falls back to `popconfirm.label`.\n */\n readonly ariaLabel = input<string | null>(null);\n\n // The catalog has carried these translated for as long as the component has\n // existed; the labels were hard-coded English defaults, so a localized app got\n // English buttons with the right strings sitting one file away.\n private readonly resolvedConfirm = useI18nText(this.confirmText, 'popconfirm.confirm', 'Confirm');\n private readonly resolvedCancel = useI18nText(this.cancelText, 'popconfirm.cancel', 'Cancel');\n private readonly resolvedAriaLabel = useI18nText(this.ariaLabel, 'popconfirm.label', 'Confirm action');\n\n /** Color of the confirm button. @default 'primary' */\n readonly confirmColor = input<WrColor>('primary');\n\n /**\n * Extra CSS classes for the confirmation bubble's overlay pane.\n *\n * The pane is appended to the overlay container, not to this component, so\n * nothing in the consumer's own template encloses it and no descendant rule\n * written around the trigger can reach it. This input is the only per-instance\n * handle on it. A space-separated string works as well as an array.\n */\n readonly panelClass = input<WrClassInput>(null);\n\n /**\n * Where focus goes when the panel opens. `'dialog'` puts it on the panel\n * itself, with no ring, so Tab reaches Cancel and no button is lit;\n * `'first-tabbable'` puts it on Cancel; `false` leaves it on the trigger,\n * and Tab from there walks into the panel. Closing hands focus back to the\n * trigger in every mode.\n *\n * Prefixed because the directive sits on your own element, where an\n * `autoFocus` attribute would also be the native `autofocus`.\n * @default 'dialog'\n */\n readonly autoFocus = input<WrOverlayAutoFocus>('dialog', { alias: 'wrPopconfirmAutoFocus' });\n\n /**\n * Turns the question off: a click on the host opens nothing and is left to\n * propagate, `open()` does nothing, and an open panel closes without\n * `cancelled`. The host publishes no popup ARIA meanwhile and carries\n * `wr-popconfirm-trigger--disabled`.\n *\n * The host's own `disabled` stays yours: the directive never sets it, so the\n * button still takes its own `(click)` — the way to skip the question when\n * there is nothing to confirm.\n *\n * @default false\n */\n readonly disabled = input(false, { alias: 'wrPopconfirmDisabled', transform: coerceBooleanProperty });\n\n /** Fires when the user clicks confirm. */\n readonly confirmed = output<void>();\n\n /** Fires when the user clicks cancel or dismisses the overlay. */\n readonly cancelled = output<void>();\n\n private readonly host = inject<ElementRef<HTMLElement>>(ElementRef);\n private readonly focusMonitor = inject(FocusMonitor);\n private readonly focusTraps = inject(FocusTrapFactory);\n private readonly overlay = inject(WR_OVERLAY);\n private readonly dir = inject(Directionality, { optional: true });\n private readonly outsideClick = inject(WrOutsideClick);\n private readonly vcr = inject(ViewContainerRef);\n private readonly scrollStrategies = inject(ScrollStrategyOptions);\n private readonly injector = inject(Injector);\n private readonly destroyRef = inject(DestroyRef);\n\n private readonly openState = signal(false);\n\n /** Whether the popconfirm is open. Read-only: `open()` and `close()` change it. */\n readonly isOpen = this.openState.asReadonly();\n\n private overlayRef: OverlayRef | null = null;\n private finder: FocusTrap | null = null;\n\n private readonly uid = ++popconfirmUid;\n\n /** @internal Public so the host binding can read it. */\n protected readonly panelId = `wr-popconfirm-${this.uid}`;\n\n private readonly messageId = `wr-popconfirm-message-${this.uid}`;\n\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('popconfirm');\n this.destroyRef.onDestroy(() => this.dispose());\n effect(() => {\n if (this.disabled()) this.close();\n });\n }\n\n /** @internal */\n protected toggle(event: MouseEvent): void {\n if (this.disabled()) return;\n event.stopPropagation();\n if (this.overlayRef) {\n this.close();\n } else {\n this.open();\n }\n }\n\n /** Open the panel. Does nothing while the trigger is disabled. */\n open(): void {\n if (this.disabled() || this.overlayRef) return;\n\n // Read ONCE, here, and mirror this list rather than the input: the side is\n // chosen at open and a later `position` write moves nothing, so a follower\n // that re-read the signal would let a direction flip quietly adopt a\n // position the panel never opened with.\n //\n // The list is a fallback CHAIN, each link tagged with its own\n // `wr-popconfirm-overlay--<side>` class, so the panel flips when the side\n // asked for has no room and the arrow names the side it landed on. The\n // viewport margin is `wr-popover`'s, for the same reason: without it a pushed\n // panel parks its border on the glass.\n const positions = wrPopconfirmPositions(this.position());\n\n const positionStrategy = this.overlay\n .position()\n .flexibleConnectedTo(this.host)\n .withPositions(wrMirrorOffsets(positions, this.isRtl()))\n .withPush(true)\n .withViewportMargin(VIEWPORT_MARGIN);\n\n this.overlayRef = this.overlay.create({\n positionStrategy,\n scrollStrategy: this.scrollStrategies.reposition(),\n panelClass: wrToClassList('wr-popconfirm-overlay', this.panelClass()),\n });\n\n // `isRtl()` above answered once, at `create()`, and so did the CDK's own\n // capture of the direction — neither is revisited if the app flips while the\n // question is still on screen. Both halves have to move: the `dir` on the\n // host, so `start` / `end` resolve to the other edge, and the mirrored list,\n // because `offsetX` is added to the final PHYSICAL x. Leave the list behind\n // and the 8px gap on `left` / `right` becomes an 8px overlap over the very\n // control the panel is asking about.\n wrFollowDirection(this.overlayRef, this.dir, this.injector, direction =>\n positionStrategy.withPositions(wrMirrorOffsets(positions, direction === 'rtl'))\n );\n\n // Non-modal by choice, like `wr-popover`: an outside click or Escape closes it,\n // so trapping focus would only make it harder to leave. It still needs a role, a\n // name and the question read out as its description.\n const pane = this.overlayRef.overlayElement;\n pane.id = this.panelId;\n pane.setAttribute('role', 'dialog');\n pane.setAttribute('aria-modal', 'false');\n pane.setAttribute('aria-label', this.resolvedAriaLabel());\n pane.setAttribute('aria-describedby', this.messageId);\n pane.tabIndex = -1;\n\n const portal = new ComponentPortal(WrPopconfirmPanel, this.vcr);\n const ref = this.overlayRef.attach(portal);\n ref.setInput('message', this.message());\n ref.setInput('messageId', this.messageId);\n ref.setInput('confirmText', this.resolvedConfirm());\n ref.setInput('cancelText', this.resolvedCancel());\n ref.setInput('confirmColor', this.confirmColor());\n ref.changeDetectorRef.detectChanges();\n // Focus has to be able to enter the panel: the overlay container sits at the\n // end of `<body>`, so Tab from the trigger went to the next thing on the PAGE\n // and the only way to confirm was unreachable. It enters on open as\n // `wrPopconfirmAutoFocus` says, and never onto a button unasked: the panel itself by\n // default, Cancel under `'first-tabbable'` (the action being confirmed is\n // usually the destructive one). Under `false` Tab on the trigger walks in,\n // see `onTriggerKeydown`.\n //\n // `deferAnchors`: the trap is only the finder `wrFocusOverlay` asks for. No\n // anchors go into the page and nothing is trapped.\n this.finder = this.focusTraps.create(pane, true);\n wrFocusOverlay(pane, this.finder, this.autoFocus(), this.injector);\n // And it has to LEAVE with the panel: Tab past Confirm went on to the end of\n // `<body>` and Shift+Tab before Cancel to the foot of the page, each with the\n // question still on screen and `aria-expanded` still true. See `onPaneKeydown`.\n pane.addEventListener('keydown', this.onPaneKeydown);\n pane.addEventListener('focusout', this.onPaneFocusOut);\n this.openState.set(true);\n\n ref.instance.confirmed.subscribe(() => {\n this.confirmed.emit();\n this.close();\n });\n ref.instance.cancelled.subscribe(() => this.dismiss());\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.dismiss();\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.dismiss();\n }\n });\n }\n\n close(): void {\n this.dispose();\n }\n\n private dismiss(): void {\n if (!this.overlayRef) return;\n this.cancelled.emit();\n this.dispose();\n }\n\n private dispose(): void {\n if (!this.overlayRef) return;\n // Focus lives inside the panel while it is open, and removing the panel would\n // drop it to `<body>` — hand it back to the trigger instead, as `wr-dropdown`\n // does on Escape. Only when focus is still IN there: if the user has already\n // clicked elsewhere, taking it back would be stealing.\n const pane = this.overlayRef.overlayElement;\n const returnFocus = pane.contains(document.activeElement);\n // Before the dispose: Chromium fires `focusout` for a focused node as it is\n // removed, and the pane is about to be.\n pane.removeEventListener('keydown', this.onPaneKeydown);\n pane.removeEventListener('focusout', this.onPaneFocusOut);\n this.finder?.destroy();\n this.finder = null;\n this.overlayRef.dispose();\n this.overlayRef = null;\n this.openState.set(false);\n if (returnFocus) wrRestoreFocus(this.host.nativeElement, this.focusMonitor);\n else wrNoteFocusReturn(this.host.nativeElement);\n }\n\n /**\n * Tab off either end of the panel dismisses it and takes focus back to the\n * trigger — `wr-popover`'s disclosure behaviour, for a non-modal panel whose\n * DOM sits nowhere near its trigger. Leaving is a dismissal, so `cancelled`\n * fires, as it does for Escape and an outside click.\n *\n * Forward, the trigger is focused WITHOUT `preventDefault`, so the browser's\n * own Tab runs on from there and lands on whatever follows the trigger, where a\n * panel rendered in place would have let it go. Backward, the trigger itself is\n * the destination, so the default is stopped. The panel holds two stops, Cancel\n * and Confirm, in that order.\n */\n private readonly onPaneKeydown = (event: KeyboardEvent): void => {\n const pane = this.overlayRef?.overlayElement;\n if (!pane || event.key !== 'Tab' || event.defaultPrevented) return;\n const stops = [...pane.querySelectorAll<HTMLElement>('.wr-popconfirm__action')];\n const active = document.activeElement;\n if (event.shiftKey) {\n if (active !== pane && active !== stops[0]) return;\n event.preventDefault();\n } else if (active !== stops.at(-1)) {\n return;\n }\n wrRestoreFocus(this.host.nativeElement, this.focusMonitor);\n this.dismiss();\n };\n\n /**\n * Tab on the trigger while the panel is open walks into it, as it would into a\n * panel rendered beside the trigger. The way in when focus did not move on\n * open (`wrPopconfirmAutoFocus` is `false`).\n *\n * @internal\n */\n protected onTriggerKeydown(event: KeyboardEvent): void {\n const pane = this.overlayRef?.overlayElement;\n if (!pane || event.key !== 'Tab' || event.shiftKey || event.defaultPrevented) return;\n if (event.target !== this.host.nativeElement) return;\n event.preventDefault();\n (pane.querySelector<HTMLElement>('.wr-popconfirm__action') ?? pane).focus();\n }\n\n /**\n * Focus that leaves the panel by any other road (a click on something\n * focusable elsewhere) dismisses it too, and is left where it went. A `null`\n * destination is the window losing focus or a focused node being removed,\n * neither of which is leaving.\n */\n private readonly onPaneFocusOut = (event: FocusEvent): void => {\n const next = event.relatedTarget as Node | null;\n if (!next || this.holdsFocus(next)) return;\n this.dismiss();\n };\n\n /**\n * Whether focus on `node` still belongs to this panel: inside the pane, on the\n * trigger (a press there is about to toggle it), or in an overlay opened AFTER\n * this one — the stacking `wr-popover` and `WrOutsideClick` honour, so a\n * second panel raised by `open()` does not dismiss the first by taking focus.\n */\n private holdsFocus(node: Node): boolean {\n const ref = this.overlayRef;\n if (!ref) return false;\n if (ref.overlayElement.contains(node) || this.host.nativeElement.contains(node)) return true;\n const box = ref.hostElement;\n return (\n (box.parentElement?.contains(node) ?? false) &&\n // eslint-disable-next-line no-bitwise -- compareDocumentPosition answers with a bitmask\n (box.compareDocumentPosition(node) & Node.DOCUMENT_POSITION_FOLLOWING) !== 0\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"],"mappings":";;;;;;;;;;;;;;;;;;AA0BA,IAAa,oBAAb,MAAa,kBAAiB;CAC5B,cAAA;EACE,IAAI,OAAO,cAAc,eAAe,WAAW,cAAc,YAAY;CAC/E;CAES,UAAU,MAAM,SAAkB,GAAA,YAAA,CAAA,EAAA,WAAA,UAAA,CAAA,+BAAA,CAAA,CAAA;CAGlC,YAAY,MAAqB,MAAK,GAAA,YAAA,CAAA,EAAA,WAAA,YAAA,CAAA,+BAAA,CAAA,CAAA;CACtC,cAAc,MAAc,WAAU,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AA;IAAA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;GAAA,YAAA;IAAA,mBAAA;IAAA,YAAA;IAAA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;GAAA,WAAA;IAAA,mBAAA;IAAA,YAAA;IAAA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;GAAA,cAAA;IAAA,mBAAA;IAAA,YAAA;IAAA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;GAAA,YAAA;IAAA,mBAAA;IAAA,YAAA;IAAA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;GAAA,WAAA;IAAA,mBAAA;IAAA,YAAA;IAAA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;GAAA,UAAA;IAAA,mBAAA;IAAA,YAAA;IAAA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;EAAA;EAAA,SAAA;GAAA,WAAA;GAAA,WAAA;EAAA;EAAA,MAAA;GAAA,WAAA;IAAA,SAAA;IAAA,WAAA;GAAA;GAAA,YAAA;IAAA,yCAAA;IAAA,sBAAA;IAAA,sBAAA;IAAA,sBAAA;GAAA;GAAA,gBAAA;EAAA;EAAA,UAAA,CAAA,cAAA;EAAA,UAAA;CAAA,CAAA;;AAAZ,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAY,YAAA,CAAA;EApBxB,MAAA;EAAU,MAAA,CAAA;GACT,UAAU;GACV,UAAU;GACV,MAAM;IAKJ,OAAO;IACP,2CAA2C;IAC3C,WAAW;IACX,aAAa;IACb,wBAAwB;IACxB,wBAAwB;IAIxB,wBAAwB;GACzB;EACF,CAAA"}
1
+ {"version":3,"file":"ngwr-popconfirm.mjs","names":[],"sources":["../../../projects/lib/popconfirm/popconfirm-panel.ts","../../../projects/lib/popconfirm/popconfirm-panel.html","../../../projects/lib/popconfirm/types/popconfirm-position.ts","../../../projects/lib/popconfirm/popconfirm.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 { Component, ViewEncapsulation, input, output } from '@angular/core';\n\nimport { WrButton } from 'ngwr/button';\nimport type { WrColor } from 'ngwr/theme';\nimport { wrCheckStyles } from 'ngwr/utils';\n\n/**\n * Confirmation panel rendered inside the popconfirm overlay. Not part\n * of the public template API — use `[wrPopconfirm]` instead.\n *\n * @internal\n */\n@Component({\n selector: 'wr-popconfirm',\n templateUrl: './popconfirm-panel.html',\n encapsulation: ViewEncapsulation.None,\n host: { class: 'wr-popconfirm' },\n imports: [WrButton],\n})\nexport class WrPopconfirmPanel {\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('popconfirm');\n }\n\n readonly message = input.required<string>();\n\n /** Id the anchoring directive points `aria-describedby` at. */\n readonly messageId = input<string | null>(null);\n readonly confirmText = input<string>('Confirm');\n readonly cancelText = input<string>('Cancel');\n readonly confirmColor = input<WrColor>('primary');\n\n readonly confirmed = output<void>();\n readonly cancelled = output<void>();\n}\n","<p class=\"wr-popconfirm__message\" [attr.id]=\"messageId()\">{{ message() }}</p>\n\n<div class=\"wr-popconfirm__actions\">\n <wr-btn class=\"wr-popconfirm__action wr-popconfirm__action--cancel\" size=\"sm\" (click)=\"cancelled.emit()\">\n {{ cancelText() }}\n </wr-btn>\n <wr-btn\n class=\"wr-popconfirm__action wr-popconfirm__action--confirm\"\n size=\"sm\"\n [color]=\"confirmColor()\"\n (click)=\"confirmed.emit()\"\n >\n {{ confirmText() }}\n </wr-btn>\n</div>\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\nimport { type WrAnchoredPosition, wrAnchoredPositions } from 'ngwr/overlay';\n\n/** Where the popconfirm panel sits relative to its trigger. */\nexport type WrPopconfirmPosition = WrAnchoredPosition;\n\n/**\n * The list `withPositions()` wants: the shared fallback chain `wr-popover`\n * walks, with its 8px gap, every link tagged with the pane class of the\n * placement it puts the panel on, so the arrow\n * (`.wr-popconfirm-overlay--<placement>`) follows a flip. The CDK applies a\n * position's own `panelClass` when it lands on it and clears it on the next one;\n * the gap is an offset rather than padding, so taking the class off before it\n * measures changes nothing.\n *\n * @internal\n */\nexport function wrPopconfirmPositions(position: WrPopconfirmPosition): ConnectedPosition[] {\n return wrAnchoredPositions(position, { gap: 8, paneClass: 'wr-popconfirm-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 { type FocusTrap, FocusMonitor, FocusTrapFactory } from '@angular/cdk/a11y';\nimport { Directionality } from '@angular/cdk/bidi';\nimport { coerceBooleanProperty } from '@angular/cdk/coercion';\nimport { type OverlayRef, ScrollStrategyOptions } from '@angular/cdk/overlay';\nimport { ComponentPortal } from '@angular/cdk/portal';\nimport {\n DestroyRef,\n Directive,\n ElementRef,\n Injector,\n ViewContainerRef,\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 WrOutsideClick,\n type WrOverlayAutoFocus,\n wrFocusOverlay,\n wrFollowDirection,\n wrMirrorOffsets,\n} from 'ngwr/overlay';\nimport type { WrColor } from 'ngwr/theme';\nimport {\n wrIsComposing,\n wrToClassList,\n wrCheckStyles,\n type WrClassInput,\n wrNoteFocusReturn,\n wrRestoreFocus,\n} from 'ngwr/utils';\n\nimport { WrPopconfirmPanel } from './popconfirm-panel';\nimport { type WrPopconfirmPosition, wrPopconfirmPositions } from './types';\n\n/**\n * How close, in px, `withPush` may park the panel to the viewport edge — the\n * `--wr-space-sm` step, and the value `wr-popover` uses.\n */\nconst VIEWPORT_MARGIN = 8;\n\n/**\n * Small \"Are you sure?\" panel anchored to its trigger. Fires `confirmed`\n * or `cancelled` and closes automatically. Built on CDK Overlay.\n *\n * @example\n * ```html\n * <wr-btn\n * color=\"danger\"\n * [wrPopconfirm]=\"'Delete this item?'\"\n * confirmColor=\"danger\"\n * confirmText=\"Delete\"\n * (confirmed)=\"remove()\"\n * >Delete</wr-btn>\n * ```\n *\n * @see https://ngwr.dev/reference/components/popconfirm\n */\nlet popconfirmUid = 0;\n\n@Directive({\n selector: '[wrPopconfirm]',\n exportAs: 'wrPopconfirm',\n host: {\n // Marks the trigger the way `[wrPopover]` and `[wrDropdown]` mark theirs. The\n // question is normally BOUND (`[wrPopconfirm]=\"question\"`), which leaves no\n // attribute in the DOM at all, so without this there is nothing to find a\n // trigger by once the panel is shut.\n class: 'wr-popconfirm-trigger',\n '[class.wr-popconfirm-trigger--disabled]': 'disabled()',\n '(click)': 'toggle($event)',\n '(keydown)': 'onTriggerKeydown($event)',\n '[attr.aria-haspopup]': 'disabled() ? null : \"dialog\"',\n '[attr.aria-expanded]': 'disabled() ? null : isOpen()',\n // Names the dialog this trigger opened, as every other overlay trigger in the\n // catalog does. `aria-haspopup=\"dialog\"` promises a dialog and `aria-expanded`\n // says it is showing; without the id, which one is left to guess.\n '[attr.aria-controls]': 'isOpen() ? panelId : null',\n },\n})\nexport class WrPopconfirm {\n /** Confirmation message. */\n readonly message = input.required<string>({ alias: 'wrPopconfirm' });\n\n /**\n * Anchor side and alignment, the twelve placements `wr-popover` takes; the\n * panel flips to another side when this one has no room.\n * @default 'top'\n */\n readonly position = input<WrPopconfirmPosition>('top');\n\n /** Label for the confirm button. @default 'Confirm' */\n /** Confirm button text. Falls back to `popconfirm.confirm`. */\n readonly confirmText = input<string | null>(null);\n\n /** Label for the cancel button. @default 'Cancel' */\n /** Cancel button text. Falls back to `popconfirm.cancel`. */\n readonly cancelText = input<string | null>(null);\n\n /**\n * Accessible name of the confirmation dialog. `role=\"dialog\"` with no name\n * announces as a bare \"dialog\". Falls back to `popconfirm.label`.\n */\n readonly ariaLabel = input<string | null>(null);\n\n // The catalog has carried these translated for as long as the component has\n // existed; the labels were hard-coded English defaults, so a localized app got\n // English buttons with the right strings sitting one file away.\n private readonly resolvedConfirm = useI18nText(this.confirmText, 'popconfirm.confirm', 'Confirm');\n private readonly resolvedCancel = useI18nText(this.cancelText, 'popconfirm.cancel', 'Cancel');\n private readonly resolvedAriaLabel = useI18nText(this.ariaLabel, 'popconfirm.label', 'Confirm action');\n\n /** Color of the confirm button. @default 'primary' */\n readonly confirmColor = input<WrColor>('primary');\n\n /**\n * Extra CSS classes for the confirmation bubble's overlay pane.\n *\n * The pane is appended to the overlay container, not to this component, so\n * nothing in the consumer's own template encloses it and no descendant rule\n * written around the trigger can reach it. This input is the only per-instance\n * handle on it. A space-separated string works as well as an array.\n */\n readonly panelClass = input<WrClassInput>(null);\n\n /**\n * Where focus goes when the panel opens. `'dialog'` puts it on the panel\n * itself, with no ring, so Tab reaches Cancel and no button is lit;\n * `'first-tabbable'` puts it on Cancel; `false` leaves it on the trigger,\n * and Tab from there walks into the panel. Closing hands focus back to the\n * trigger in every mode.\n *\n * Prefixed because the directive sits on your own element, where an\n * `autoFocus` attribute would also be the native `autofocus`.\n * @default 'dialog'\n */\n readonly autoFocus = input<WrOverlayAutoFocus>('dialog', { alias: 'wrPopconfirmAutoFocus' });\n\n /**\n * Turns the question off: a click on the host opens nothing and is left to\n * propagate, `open()` does nothing, and an open panel closes without\n * `cancelled`. The host publishes no popup ARIA meanwhile and carries\n * `wr-popconfirm-trigger--disabled`.\n *\n * The host's own `disabled` stays yours: the directive never sets it, so the\n * button still takes its own `(click)` — the way to skip the question when\n * there is nothing to confirm.\n *\n * @default false\n */\n readonly disabled = input(false, { alias: 'wrPopconfirmDisabled', transform: coerceBooleanProperty });\n\n /** Fires when the user clicks confirm. */\n readonly confirmed = output<void>();\n\n /** Fires when the user clicks cancel or dismisses the overlay. */\n readonly cancelled = output<void>();\n\n private readonly host = inject<ElementRef<HTMLElement>>(ElementRef);\n private readonly focusMonitor = inject(FocusMonitor);\n private readonly focusTraps = inject(FocusTrapFactory);\n private readonly overlay = inject(WR_OVERLAY);\n private readonly dir = inject(Directionality, { optional: true });\n private readonly outsideClick = inject(WrOutsideClick);\n private readonly vcr = inject(ViewContainerRef);\n private readonly scrollStrategies = inject(ScrollStrategyOptions);\n private readonly injector = inject(Injector);\n private readonly destroyRef = inject(DestroyRef);\n\n private readonly openState = signal(false);\n\n /** Whether the popconfirm is open. Read-only: `open()` and `close()` change it. */\n readonly isOpen = this.openState.asReadonly();\n\n private overlayRef: OverlayRef | null = null;\n private finder: FocusTrap | null = null;\n\n private readonly uid = ++popconfirmUid;\n\n /** @internal Public so the host binding can read it. */\n protected readonly panelId = `wr-popconfirm-${this.uid}`;\n\n private readonly messageId = `wr-popconfirm-message-${this.uid}`;\n\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('popconfirm');\n this.destroyRef.onDestroy(() => this.dispose());\n effect(() => {\n if (this.disabled()) this.close();\n });\n }\n\n /** @internal */\n protected toggle(event: MouseEvent): void {\n if (this.disabled()) return;\n event.stopPropagation();\n if (this.overlayRef) {\n this.close();\n } else {\n this.open();\n }\n }\n\n /** Open the panel. Does nothing while the trigger is disabled. */\n open(): void {\n if (this.disabled() || this.overlayRef) return;\n\n // Read ONCE, here, and mirror this list rather than the input: the side is\n // chosen at open and a later `position` write moves nothing, so a follower\n // that re-read the signal would let a direction flip quietly adopt a\n // position the panel never opened with.\n //\n // The list is a fallback CHAIN, each link tagged with its own\n // `wr-popconfirm-overlay--<side>` class, so the panel flips when the side\n // asked for has no room and the arrow names the side it landed on. The\n // viewport margin is `wr-popover`'s, for the same reason: without it a pushed\n // panel parks its border on the glass.\n const positions = wrPopconfirmPositions(this.position());\n\n const positionStrategy = this.overlay\n .position()\n .flexibleConnectedTo(this.host)\n .withPositions(wrMirrorOffsets(positions, this.isRtl()))\n .withPush(true)\n .withViewportMargin(VIEWPORT_MARGIN);\n\n this.overlayRef = this.overlay.create({\n positionStrategy,\n scrollStrategy: this.scrollStrategies.reposition(),\n panelClass: wrToClassList('wr-popconfirm-overlay', this.panelClass()),\n });\n\n // `isRtl()` above answered once, at `create()`, and so did the CDK's own\n // capture of the direction — neither is revisited if the app flips while the\n // question is still on screen. Both halves have to move: the `dir` on the\n // host, so `start` / `end` resolve to the other edge, and the mirrored list,\n // because `offsetX` is added to the final PHYSICAL x. Leave the list behind\n // and the 8px gap on `left` / `right` becomes an 8px overlap over the very\n // control the panel is asking about.\n wrFollowDirection(this.overlayRef, this.dir, this.injector, direction =>\n positionStrategy.withPositions(wrMirrorOffsets(positions, direction === 'rtl'))\n );\n\n // Non-modal by choice, like `wr-popover`: an outside click or Escape closes it,\n // so trapping focus would only make it harder to leave. It still needs a role, a\n // name and the question read out as its description.\n const pane = this.overlayRef.overlayElement;\n pane.id = this.panelId;\n pane.setAttribute('role', 'dialog');\n pane.setAttribute('aria-modal', 'false');\n pane.setAttribute('aria-label', this.resolvedAriaLabel());\n pane.setAttribute('aria-describedby', this.messageId);\n pane.tabIndex = -1;\n\n const portal = new ComponentPortal(WrPopconfirmPanel, this.vcr);\n const ref = this.overlayRef.attach(portal);\n ref.setInput('message', this.message());\n ref.setInput('messageId', this.messageId);\n ref.setInput('confirmText', this.resolvedConfirm());\n ref.setInput('cancelText', this.resolvedCancel());\n ref.setInput('confirmColor', this.confirmColor());\n ref.changeDetectorRef.detectChanges();\n // Focus has to be able to enter the panel: the overlay container sits at the\n // end of `<body>`, so Tab from the trigger went to the next thing on the PAGE\n // and the only way to confirm was unreachable. It enters on open as\n // `wrPopconfirmAutoFocus` says, and never onto a button unasked: the panel itself by\n // default, Cancel under `'first-tabbable'` (the action being confirmed is\n // usually the destructive one). Under `false` Tab on the trigger walks in,\n // see `onTriggerKeydown`.\n //\n // `deferAnchors`: the trap is only the finder `wrFocusOverlay` asks for. No\n // anchors go into the page and nothing is trapped.\n this.finder = this.focusTraps.create(pane, true);\n wrFocusOverlay(pane, this.finder, this.autoFocus(), this.injector);\n // And it has to LEAVE with the panel: Tab past Confirm went on to the end of\n // `<body>` and Shift+Tab before Cancel to the foot of the page, each with the\n // question still on screen and `aria-expanded` still true. See `onPaneKeydown`.\n pane.addEventListener('keydown', this.onPaneKeydown);\n pane.addEventListener('focusout', this.onPaneFocusOut);\n this.openState.set(true);\n\n ref.instance.confirmed.subscribe(() => {\n this.confirmed.emit();\n this.close();\n });\n ref.instance.cancelled.subscribe(() => this.dismiss());\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.dismiss();\n });\n\n this.overlayRef\n .keydownEvents()\n .pipe(takeUntilDestroyed(this.destroyRef))\n .subscribe(event => {\n if (event.key === 'Escape' && !wrIsComposing(event)) {\n event.preventDefault();\n this.dismiss();\n }\n });\n }\n\n close(): void {\n this.dispose();\n }\n\n private dismiss(): void {\n if (!this.overlayRef) return;\n this.cancelled.emit();\n this.dispose();\n }\n\n private dispose(): void {\n if (!this.overlayRef) return;\n // Focus lives inside the panel while it is open, and removing the panel would\n // drop it to `<body>` — hand it back to the trigger instead, as `wr-dropdown`\n // does on Escape. Only when focus is still IN there: if the user has already\n // clicked elsewhere, taking it back would be stealing.\n const pane = this.overlayRef.overlayElement;\n const returnFocus = pane.contains(document.activeElement);\n // Before the dispose: Chromium fires `focusout` for a focused node as it is\n // removed, and the pane is about to be.\n pane.removeEventListener('keydown', this.onPaneKeydown);\n pane.removeEventListener('focusout', this.onPaneFocusOut);\n this.finder?.destroy();\n this.finder = null;\n this.overlayRef.dispose();\n this.overlayRef = null;\n this.openState.set(false);\n if (returnFocus) wrRestoreFocus(this.host.nativeElement, this.focusMonitor);\n else wrNoteFocusReturn(this.host.nativeElement);\n }\n\n /**\n * Tab off either end of the panel dismisses it and takes focus back to the\n * trigger — `wr-popover`'s disclosure behaviour, for a non-modal panel whose\n * DOM sits nowhere near its trigger. Leaving is a dismissal, so `cancelled`\n * fires, as it does for Escape and an outside click.\n *\n * Forward, the trigger is focused WITHOUT `preventDefault`, so the browser's\n * own Tab runs on from there and lands on whatever follows the trigger, where a\n * panel rendered in place would have let it go. Backward, the trigger itself is\n * the destination, so the default is stopped. The panel holds two stops, Cancel\n * and Confirm, in that order.\n */\n private readonly onPaneKeydown = (event: KeyboardEvent): void => {\n const pane = this.overlayRef?.overlayElement;\n if (!pane || event.key !== 'Tab' || event.defaultPrevented) return;\n const stops = [...pane.querySelectorAll<HTMLElement>('.wr-popconfirm__action')];\n const active = document.activeElement;\n if (event.shiftKey) {\n if (active !== pane && active !== stops[0]) return;\n event.preventDefault();\n } else if (active !== stops.at(-1)) {\n return;\n }\n wrRestoreFocus(this.host.nativeElement, this.focusMonitor);\n this.dismiss();\n };\n\n /**\n * Tab on the trigger while the panel is open walks into it, as it would into a\n * panel rendered beside the trigger. The way in when focus did not move on\n * open (`wrPopconfirmAutoFocus` is `false`).\n *\n * @internal\n */\n protected onTriggerKeydown(event: KeyboardEvent): void {\n const pane = this.overlayRef?.overlayElement;\n if (!pane || event.key !== 'Tab' || event.shiftKey || event.defaultPrevented) return;\n if (event.target !== this.host.nativeElement) return;\n event.preventDefault();\n (pane.querySelector<HTMLElement>('.wr-popconfirm__action') ?? pane).focus();\n }\n\n /**\n * Focus that leaves the panel by any other road (a click on something\n * focusable elsewhere) dismisses it too, and is left where it went. A `null`\n * destination is the window losing focus or a focused node being removed,\n * neither of which is leaving.\n */\n private readonly onPaneFocusOut = (event: FocusEvent): void => {\n const next = event.relatedTarget as Node | null;\n if (!next || this.holdsFocus(next)) return;\n this.dismiss();\n };\n\n /**\n * Whether focus on `node` still belongs to this panel: inside the pane, on the\n * trigger (a press there is about to toggle it), or in an overlay opened AFTER\n * this one — the stacking `wr-popover` and `WrOutsideClick` honour, so a\n * second panel raised by `open()` does not dismiss the first by taking focus.\n */\n private holdsFocus(node: Node): boolean {\n const ref = this.overlayRef;\n if (!ref) return false;\n if (ref.overlayElement.contains(node) || this.host.nativeElement.contains(node)) return true;\n const box = ref.hostElement;\n return (\n (box.parentElement?.contains(node) ?? false) &&\n // eslint-disable-next-line no-bitwise -- compareDocumentPosition answers with a bitmask\n (box.compareDocumentPosition(node) & Node.DOCUMENT_POSITION_FOLLOWING) !== 0\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"],"mappings":";;;;;;;;;;;;;;;;;;AA0BA,IAAa,oBAAb,MAAa,kBAAiB;CAC5B,cAAA;EACE,IAAI,OAAO,cAAc,eAAe,WAAW,cAAc,YAAY;CAC/E;CAES,UAAU,MAAM,SAAkB,GAAA,YAAA,CAAA,EAAA,WAAA,UAAA,CAAA,+BAAA,CAAA,CAAA;CAGlC,YAAY,MAAqB,MAAK,GAAA,YAAA,CAAA,EAAA,WAAA,YAAA,CAAA,+BAAA,CAAA,CAAA;CACtC,cAAc,MAAc,WAAU,GAAA,YAAA,CAAA,EAAA,WAAA,cAAA,CAAA,+BAAA,CAAA,CAAA;CACtC,aAAa,MAAc,UAAS,GAAA,YAAA,CAAA,EAAA,WAAA,aAAA,CAAA,+BAAA,CAAA,CAAA;CACpC,eAAe,MAAe,WAAU,GAAA,YAAA,CAAA,EAAA,WAAA,eAAA,CAAA,+BAAA,CAAA,CAAA;CAExC,YAAY,OAAM;CAClB,YAAY,OAAM;CAdhB,OAAA,OAAA,GAAA,mBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,UAAA;EAAA,MAAA;EAAiB,MAAA,CAAA;EAAA,QAAA,GAAA,gBAAA;CAAA,CAAA;CAAjB,OAAA,OAAA,GAAA,qBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,MAAA;EAAiB,cAAA;EAAA,UAAA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IAAA,YAAA;IAAA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;EAAA;EAAA,SAAA;GAAA,WAAA;GAAA,WAAA;EAAA;EAAA,MAAA;GAAA,WAAA;IAAA,SAAA;IAAA,WAAA;GAAA;GAAA,YAAA;IAAA,yCAAA;IAAA,sBAAA;IAAA,sBAAA;IAAA,sBAAA;GAAA;GAAA,gBAAA;EAAA;EAAA,UAAA,CAAA,cAAA;EAAA,UAAA;CAAA,CAAA;;AAAZ,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAY,YAAA,CAAA;EApBxB,MAAA;EAAU,MAAA,CAAA;GACT,UAAU;GACV,UAAU;GACV,MAAM;IAKJ,OAAO;IACP,2CAA2C;IAC3C,WAAW;IACX,aAAa;IACb,wBAAwB;IACxB,wBAAwB;IAIxB,wBAAwB;GACzB;EACF,CAAA"}
@@ -705,7 +705,17 @@ var WrPopover = class WrPopover {
705
705
  });
706
706
  effect(() => {
707
707
  const content = this.content();
708
- this.textPanelRef?.setInput("text", typeof content === "string" ? content : "");
708
+ const panel = this.textPanelRef;
709
+ if (!panel) return;
710
+ const text = typeof content === "string" ? content : "";
711
+ untracked(() => {
712
+ if (!text) {
713
+ this.openState.set(false);
714
+ return;
715
+ }
716
+ panel.setInput("text", text);
717
+ afterNextRender(() => this.overlayRef?.updatePosition(), { injector: this.injector });
718
+ });
709
719
  });
710
720
  effect((onCleanup) => {
711
721
  const origin = this.origin();