ngwr 14.4.0 → 14.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (149) hide show
  1. package/README.md +3 -3
  2. package/fesm2022/ngwr-breadcrumbs.mjs +2 -2
  3. package/fesm2022/ngwr-breadcrumbs.mjs.map +1 -1
  4. package/fesm2022/ngwr-cascader.mjs +15 -3
  5. package/fesm2022/ngwr-cascader.mjs.map +1 -1
  6. package/fesm2022/ngwr-color-picker.mjs +18 -2
  7. package/fesm2022/ngwr-color-picker.mjs.map +1 -1
  8. package/fesm2022/ngwr-context-menu.mjs +35 -3
  9. package/fesm2022/ngwr-context-menu.mjs.map +1 -1
  10. package/fesm2022/ngwr-date-picker.mjs +30 -2
  11. package/fesm2022/ngwr-date-picker.mjs.map +1 -1
  12. package/fesm2022/ngwr-dialog.mjs +12 -1
  13. package/fesm2022/ngwr-dialog.mjs.map +1 -1
  14. package/fesm2022/ngwr-drag-drop.mjs +2 -2
  15. package/fesm2022/ngwr-drag-drop.mjs.map +1 -1
  16. package/fesm2022/ngwr-drawer.mjs +48 -2
  17. package/fesm2022/ngwr-drawer.mjs.map +1 -1
  18. package/fesm2022/ngwr-dropdown.mjs +22 -2
  19. package/fesm2022/ngwr-dropdown.mjs.map +1 -1
  20. package/fesm2022/ngwr-graph-testing.mjs +243 -0
  21. package/fesm2022/ngwr-graph-testing.mjs.map +1 -0
  22. package/fesm2022/ngwr-graph.mjs +1112 -0
  23. package/fesm2022/ngwr-graph.mjs.map +1 -0
  24. package/fesm2022/ngwr-i18n-ar.mjs +5 -0
  25. package/fesm2022/ngwr-i18n-ar.mjs.map +1 -1
  26. package/fesm2022/ngwr-i18n-cs.mjs +5 -0
  27. package/fesm2022/ngwr-i18n-cs.mjs.map +1 -1
  28. package/fesm2022/ngwr-i18n-de.mjs +5 -0
  29. package/fesm2022/ngwr-i18n-de.mjs.map +1 -1
  30. package/fesm2022/ngwr-i18n-en.mjs +9 -0
  31. package/fesm2022/ngwr-i18n-en.mjs.map +1 -1
  32. package/fesm2022/ngwr-i18n-es.mjs +5 -0
  33. package/fesm2022/ngwr-i18n-es.mjs.map +1 -1
  34. package/fesm2022/ngwr-i18n-fr.mjs +5 -0
  35. package/fesm2022/ngwr-i18n-fr.mjs.map +1 -1
  36. package/fesm2022/ngwr-i18n-he.mjs +5 -0
  37. package/fesm2022/ngwr-i18n-he.mjs.map +1 -1
  38. package/fesm2022/ngwr-i18n-hi.mjs +5 -0
  39. package/fesm2022/ngwr-i18n-hi.mjs.map +1 -1
  40. package/fesm2022/ngwr-i18n-id.mjs +5 -0
  41. package/fesm2022/ngwr-i18n-id.mjs.map +1 -1
  42. package/fesm2022/ngwr-i18n-it.mjs +5 -0
  43. package/fesm2022/ngwr-i18n-it.mjs.map +1 -1
  44. package/fesm2022/ngwr-i18n-ja.mjs +5 -0
  45. package/fesm2022/ngwr-i18n-ja.mjs.map +1 -1
  46. package/fesm2022/ngwr-i18n-ko.mjs +5 -0
  47. package/fesm2022/ngwr-i18n-ko.mjs.map +1 -1
  48. package/fesm2022/ngwr-i18n-nl.mjs +5 -0
  49. package/fesm2022/ngwr-i18n-nl.mjs.map +1 -1
  50. package/fesm2022/ngwr-i18n-pl.mjs +5 -0
  51. package/fesm2022/ngwr-i18n-pl.mjs.map +1 -1
  52. package/fesm2022/ngwr-i18n-pt.mjs +5 -0
  53. package/fesm2022/ngwr-i18n-pt.mjs.map +1 -1
  54. package/fesm2022/ngwr-i18n-ru.mjs +5 -0
  55. package/fesm2022/ngwr-i18n-ru.mjs.map +1 -1
  56. package/fesm2022/ngwr-i18n-sv.mjs +5 -0
  57. package/fesm2022/ngwr-i18n-sv.mjs.map +1 -1
  58. package/fesm2022/ngwr-i18n-tr.mjs +5 -0
  59. package/fesm2022/ngwr-i18n-tr.mjs.map +1 -1
  60. package/fesm2022/ngwr-i18n-uk.mjs +5 -0
  61. package/fesm2022/ngwr-i18n-uk.mjs.map +1 -1
  62. package/fesm2022/ngwr-i18n-vi.mjs +5 -0
  63. package/fesm2022/ngwr-i18n-vi.mjs.map +1 -1
  64. package/fesm2022/ngwr-i18n-zh-TW.mjs +5 -0
  65. package/fesm2022/ngwr-i18n-zh-TW.mjs.map +1 -1
  66. package/fesm2022/ngwr-i18n-zh.mjs +5 -0
  67. package/fesm2022/ngwr-i18n-zh.mjs.map +1 -1
  68. package/fesm2022/ngwr-lightbox.mjs +25 -4
  69. package/fesm2022/ngwr-lightbox.mjs.map +1 -1
  70. package/fesm2022/ngwr-list.mjs +2 -2
  71. package/fesm2022/ngwr-list.mjs.map +1 -1
  72. package/fesm2022/ngwr-mention.mjs +18 -2
  73. package/fesm2022/ngwr-mention.mjs.map +1 -1
  74. package/fesm2022/ngwr-overlay.mjs +119 -4
  75. package/fesm2022/ngwr-overlay.mjs.map +1 -1
  76. package/fesm2022/ngwr-popconfirm.mjs +19 -3
  77. package/fesm2022/ngwr-popconfirm.mjs.map +1 -1
  78. package/fesm2022/ngwr-popover-testing.mjs +22 -5
  79. package/fesm2022/ngwr-popover-testing.mjs.map +1 -1
  80. package/fesm2022/ngwr-popover.mjs +215 -27
  81. package/fesm2022/ngwr-popover.mjs.map +1 -1
  82. package/fesm2022/ngwr-segmented.mjs +34 -1
  83. package/fesm2022/ngwr-segmented.mjs.map +1 -1
  84. package/fesm2022/ngwr-select.mjs +15 -1
  85. package/fesm2022/ngwr-select.mjs.map +1 -1
  86. package/fesm2022/ngwr-toast.mjs +19 -2
  87. package/fesm2022/ngwr-toast.mjs.map +1 -1
  88. package/fesm2022/ngwr-tour.mjs +20 -6
  89. package/fesm2022/ngwr-tour.mjs.map +1 -1
  90. package/fesm2022/ngwr-tree.mjs +9 -2
  91. package/fesm2022/ngwr-tree.mjs.map +1 -1
  92. package/fesm2022/ngwr-version.mjs +1 -1
  93. package/fesm2022/ngwr-version.mjs.map +1 -1
  94. package/fesm2022/ngwr-window.mjs +18 -1
  95. package/fesm2022/ngwr-window.mjs.map +1 -1
  96. package/graph/styles/_index.scss +113 -0
  97. package/i18n/ar.json +5 -0
  98. package/i18n/cs.json +5 -0
  99. package/i18n/de.json +5 -0
  100. package/i18n/en.json +5 -0
  101. package/i18n/es.json +5 -0
  102. package/i18n/fr.json +5 -0
  103. package/i18n/he.json +5 -0
  104. package/i18n/hi.json +5 -0
  105. package/i18n/id.json +5 -0
  106. package/i18n/it.json +5 -0
  107. package/i18n/ja.json +5 -0
  108. package/i18n/ko.json +5 -0
  109. package/i18n/nl.json +5 -0
  110. package/i18n/pl.json +5 -0
  111. package/i18n/pt.json +5 -0
  112. package/i18n/ru.json +5 -0
  113. package/i18n/sv.json +5 -0
  114. package/i18n/tr.json +5 -0
  115. package/i18n/uk.json +5 -0
  116. package/i18n/vi.json +5 -0
  117. package/i18n/zh-TW.json +5 -0
  118. package/i18n/zh.json +5 -0
  119. package/llms-full.txt +12 -2
  120. package/llms.txt +8 -6
  121. package/package.json +10 -1
  122. package/schematics/use/symbol-map.json +2 -0
  123. package/segmented/styles/_index.scss +8 -0
  124. package/skills/ngwr/SKILL.md +1 -1
  125. package/skills/ngwr/references/catalog.md +2 -0
  126. package/styles.scss +1 -0
  127. package/theme/styles/_focus.scss +7 -0
  128. package/types/ngwr-cascader.d.ts +7 -0
  129. package/types/ngwr-color-picker.d.ts +8 -0
  130. package/types/ngwr-context-menu.d.ts +10 -0
  131. package/types/ngwr-date-picker.d.ts +16 -0
  132. package/types/ngwr-dialog.d.ts +1 -0
  133. package/types/ngwr-drawer.d.ts +28 -0
  134. package/types/ngwr-dropdown.d.ts +9 -0
  135. package/types/ngwr-graph-testing.d.ts +190 -0
  136. package/types/ngwr-graph.d.ts +203 -0
  137. package/types/ngwr-lightbox.d.ts +15 -0
  138. package/types/ngwr-mention.d.ts +7 -0
  139. package/types/ngwr-overlay.d.ts +62 -4
  140. package/types/ngwr-popconfirm.d.ts +1 -0
  141. package/types/ngwr-popover-testing.d.ts +22 -5
  142. package/types/ngwr-popover.d.ts +28 -8
  143. package/types/ngwr-segmented.d.ts +16 -0
  144. package/types/ngwr-select.d.ts +7 -0
  145. package/types/ngwr-toast.d.ts +2 -0
  146. package/types/ngwr-tour.d.ts +6 -0
  147. package/types/ngwr-tree.d.ts +2 -1
  148. package/types/ngwr-version.d.ts +1 -1
  149. package/types/ngwr-window.d.ts +1 -0
@@ -1,7 +1,8 @@
1
+ import { Directionality } from '@angular/cdk/bidi';
1
2
  import { ComponentPortal } from '@angular/cdk/portal';
2
3
  import * as i0 from '@angular/core';
3
- import { input, output, signal, computed, inject, ElementRef, ViewEncapsulation, Component, DestroyRef, InjectionToken, Service, makeEnvironmentProviders, ENVIRONMENT_INITIALIZER, isDevMode, EnvironmentInjector, ApplicationRef } from '@angular/core';
4
- import { WR_OVERLAY } from 'ngwr/overlay';
4
+ import { input, output, signal, computed, inject, ElementRef, ViewEncapsulation, Component, DestroyRef, InjectionToken, Injector, Service, makeEnvironmentProviders, ENVIRONMENT_INITIALIZER, isDevMode, EnvironmentInjector, ApplicationRef } from '@angular/core';
5
+ import { WR_OVERLAY, wrFollowDirection } from 'ngwr/overlay';
5
6
  import { useI18nText } from 'ngwr/i18n';
6
7
 
7
8
  /**
@@ -371,6 +372,12 @@ const WR_TOAST_CONFIG = new InjectionToken('WR_TOAST_CONFIG', {
371
372
  factory: () => DEFAULT_TOAST_CONFIG,
372
373
  });
373
374
 
375
+ /**
376
+ * @license
377
+ *
378
+ * Use of this source code is governed by an MIT-style license that can be
379
+ * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE
380
+ */
374
381
  /**
375
382
  * Opens toast notifications in a single shared overlay.
376
383
  *
@@ -392,6 +399,8 @@ const WR_TOAST_CONFIG = new InjectionToken('WR_TOAST_CONFIG', {
392
399
  class WrToast {
393
400
  overlay = inject(WR_OVERLAY);
394
401
  config = inject(WR_TOAST_CONFIG);
402
+ injector = inject(Injector);
403
+ dir = inject(Directionality, { optional: true });
395
404
  overlayRef = null;
396
405
  hostRef = null;
397
406
  /** Watches the overlay container for overlays opened after the host. */
@@ -498,6 +507,14 @@ class WrToast {
498
507
  hasBackdrop: false,
499
508
  panelClass: ['wr-toast-overlay'],
500
509
  });
510
+ // The corner is `inset-inline-start` / `-end` on the host component, so the
511
+ // side the stack sits on is decided entirely by the `dir` the CDK wrote at
512
+ // create. This host outlives every individual toast — it is torn down only
513
+ // when the last one leaves — so without this a stack raised before a flip
514
+ // stays on the reader's old side for the rest of the run. The position
515
+ // strategy is bare, so nothing else moves. Torn down with the ref by
516
+ // `disposeHost()`, and the next `ensureHost()` installs a new follower.
517
+ wrFollowDirection(this.overlayRef, this.dir, this.injector);
501
518
  const portal = new ComponentPortal(WrToastHost);
502
519
  this.hostRef = this.overlayRef.attach(portal);
503
520
  this.hostRef.setInput('position', position);
@@ -1 +1 @@
1
- {"version":3,"file":"ngwr-toast.mjs","sources":["../../../projects/lib/toast/toast-item.ts","../../../projects/lib/toast/toast-item.html","../../../projects/lib/toast/toast-host.ts","../../../projects/lib/toast/toast-host.html","../../../projects/lib/toast/toast-ref.ts","../../../projects/lib/toast/default-toast-config.ts","../../../projects/lib/toast/tokens/toast-config.token.ts","../../../projects/lib/toast/services/toast.ts","../../../projects/lib/toast/provide-wr-toast-config.ts","../../../projects/lib/toast/ngwr-toast.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, ElementRef, ViewEncapsulation, computed, inject, input, output, signal } from '@angular/core';\n\nimport type { WrToastConfig, WrToastType } from './interfaces';\n\n/**\n * One toast row inside the toast host. Not used directly — see\n * `WrToast.show()`.\n *\n * @internal\n */\n@Component({\n selector: 'wr-toast',\n templateUrl: './toast-item.html',\n encapsulation: ViewEncapsulation.None,\n host: {\n '[class]': 'classes()',\n '[style.--wr-toast-duration]': 'durationMs()',\n '[style.transform]': 'swipeTransform()',\n '[style.opacity]': 'swipeOpacity()',\n '[style.transition]': 'swiping() ? \"none\" : null',\n '[attr.role]': 'liveRole()',\n '[attr.aria-live]': 'liveLevel()',\n '(mouseenter)': 'pauseRequested.emit()',\n '(mouseleave)': 'resumeRequested.emit()',\n '(touchstart)': 'onSwipeStart($event)',\n '(touchmove)': 'onSwipeMove($event)',\n '(touchend)': 'onSwipeEnd()',\n '(touchcancel)': 'onSwipeEnd()',\n },\n})\nexport class WrToastItem {\n readonly type = input<WrToastType>('info');\n readonly title = input<string | null>(null);\n readonly message = input.required<string>();\n readonly dismissible = input<boolean>(true);\n readonly showProgress = input<boolean>(false);\n readonly showCopy = input<boolean>(false);\n /** Auto-dismiss duration in ms — used to scale the progress bar. `0` hides it. */\n readonly duration = input<number>(0);\n /**\n * Already resolved by the host — strings, not the config's nullable shape.\n * The item renders them and never reaches for the catalog itself.\n */\n readonly labels = input.required<{ [K in keyof WrToastConfig['labels']]: string }>();\n\n readonly dismissed = output<void>();\n readonly pauseRequested = output<void>();\n readonly resumeRequested = output<void>();\n\n /** True for ~1.5s after a successful copy; flips the icon to a check. */\n protected readonly justCopied = signal(false);\n private copyResetTimer: ReturnType<typeof setTimeout> | null = null;\n\n protected readonly classes = computed(() => `wr-toast wr-toast--${this.type()}`);\n\n /** Escalate to `alert`/`assertive` for danger/warning toasts. */\n protected readonly liveRole = computed(() => (this.type() === 'danger' ? 'alert' : 'status'));\n protected readonly liveLevel = computed(() =>\n this.type() === 'danger' || this.type() === 'warning' ? 'assertive' : 'polite'\n );\n\n /** Inline CSS value for `--wr-toast-duration`. */\n protected readonly durationMs = computed(() => `${this.duration()}ms`);\n\n protected readonly progressVisible = computed(() => this.showProgress() && this.duration() > 0);\n\n protected async onCopy(): Promise<void> {\n try {\n await navigator.clipboard.writeText(this.message());\n this.justCopied.set(true);\n if (this.copyResetTimer) clearTimeout(this.copyResetTimer);\n this.copyResetTimer = setTimeout(() => this.justCopied.set(false), 1500);\n } catch {\n // Clipboard unavailable (insecure context / permission denied) — silent.\n }\n }\n\n // Swipe-sideways-to-dismiss. The toast follows the finger and fades; releasing\n // past 40% of its width emits `dismissed`, otherwise it snaps back.\n private readonly elRef = inject<ElementRef<HTMLElement>>(ElementRef);\n private swipeStartX = 0;\n private swipeWidth = 0;\n protected readonly swipeX = signal(0);\n protected readonly swiping = signal(false);\n\n protected readonly swipeTransform = computed(() => (this.swipeX() === 0 ? null : `translateX(${this.swipeX()}px)`));\n protected readonly swipeOpacity = computed(() => {\n const dist = Math.abs(this.swipeX());\n return dist === 0 ? null : Math.max(0, 1 - dist / (this.swipeWidth || 1));\n });\n\n protected onSwipeStart(event: TouchEvent): void {\n if (!this.dismissible()) return;\n const touch = event.touches[0];\n if (!touch) return;\n this.swipeStartX = touch.clientX;\n this.swipeWidth = this.elRef.nativeElement.offsetWidth;\n this.swiping.set(true);\n }\n\n protected onSwipeMove(event: TouchEvent): void {\n if (!this.swiping()) return;\n const touch = event.touches[0];\n if (!touch) return;\n this.swipeX.set(touch.clientX - this.swipeStartX);\n }\n\n protected onSwipeEnd(): void {\n if (!this.swiping()) return;\n this.swiping.set(false);\n if (Math.abs(this.swipeX()) > (this.swipeWidth || 0) * 0.4) {\n this.dismissed.emit();\n } else {\n this.swipeX.set(0);\n }\n }\n}\n","<!-- A glyph per type, and this is the one channel the toast had none of. Its\n four types differed by `--wr-toast-accent` alone — a 3px inline-start\n border, in four colours that sit within 1.06:1 of each other in relative\n luminance, so `success` and `danger` were the same 3px line to a reader\n who cannot separate hue. The shapes are the ones `wr-alert` and\n `wr-result` already use for the same four meanings: a check in a broken\n circle, a triangle, an octagon, an `i`. Three components agreeing is worth\n more than three components each being locally reasonable.\n\n `aria-hidden`, because the type is already announced: the host takes\n `role=\"alert\"` for danger and `role=\"status\"` otherwise. -->\n<svg\n class=\"wr-toast__icon wr-icon__svg\"\n xmlns=\"http://www.w3.org/2000/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>\n @switch (type()) {\n @case ('success') {\n <path d=\"M21.801 10A10 10 0 1 1 17 3.335\" />\n <path d=\"m9 11 3 3L22 4\" />\n }\n @case ('warning') {\n <path d=\"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3\" />\n <path d=\"M12 9v4\" />\n <path d=\"M12 17h.01\" />\n }\n @case ('danger') {\n <path\n d=\"M2.586 16.726A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2h6.624a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586z\"\n />\n <path d=\"M12 8v4\" />\n <path d=\"M12 16h.01\" />\n }\n @default {\n <circle cx=\"12\" cy=\"12\" r=\"10\" />\n <path d=\"M12 16v-4\" />\n <path d=\"M12 8h.01\" />\n }\n }\n</svg>\n\n<div class=\"wr-toast__body\">\n @if (title(); as text) {\n <p class=\"wr-toast__title\">{{ text }}</p>\n }\n <p class=\"wr-toast__message\">{{ message() }}</p>\n</div>\n\n<div class=\"wr-toast__actions\">\n @if (showCopy()) {\n <button\n type=\"button\"\n class=\"wr-toast__action wr-toast__action--copy\"\n [attr.aria-label]=\"justCopied() ? labels().copied : labels().copy\"\n [title]=\"justCopied() ? labels().copied : labels().copy\"\n (click)=\"onCopy()\"\n >\n @if (justCopied()) {\n <svg\n class=\"wr-icon__svg\"\n xmlns=\"http://www.w3.org/2000/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 >\n <path d=\"M20 6 9 17l-5-5\" />\n </svg>\n } @else {\n <svg\n class=\"wr-icon__svg\"\n xmlns=\"http://www.w3.org/2000/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 >\n <rect width=\"14\" height=\"14\" x=\"8\" y=\"8\" rx=\"2\" ry=\"2\" />\n <path d=\"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2\" />\n </svg>\n }\n </button>\n }\n\n @if (dismissible()) {\n <button\n type=\"button\"\n class=\"wr-toast__action wr-toast__action--close\"\n [attr.aria-label]=\"labels().close\"\n [title]=\"labels().close\"\n (click)=\"dismissed.emit()\"\n >\n <svg\n class=\"wr-icon__svg\"\n xmlns=\"http://www.w3.org/2000/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 >\n <path d=\"M18 6 6 18\" />\n <path d=\"m6 6 12 12\" />\n </svg>\n </button>\n }\n</div>\n\n@if (progressVisible()) {\n <span class=\"wr-toast__progress\" aria-hidden=\"true\"></span>\n}\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { Component, DestroyRef, ViewEncapsulation, computed, inject, input, output, signal } from '@angular/core';\n\nimport { useI18nText } from 'ngwr/i18n';\n\nimport type { WrToastConfig, WrToastMode, WrToastOptions, WrToastPosition } from './interfaces';\nimport { WrToastItem } from './toast-item';\n\n/** ms before the pointer or focus leaving actually collapses the stack. Buffers\n * the cursor briefly leaving the host as toasts reflow underneath it, and focus\n * hopping between two buttons inside the host. */\nconst COLLAPSE_DELAY_MS = 120;\n\n/** Active entry pushed by the service — adds the bookkeeping fields the host renders. */\ntype ActiveToast = WrToastOptions & {\n readonly id: number;\n readonly resolvedDuration: number;\n};\n\n/**\n * Internal host that lives inside the toast overlay and renders the\n * active stack. Owned by `WrToast`.\n *\n * @internal\n */\n@Component({\n selector: 'wr-toast-host',\n templateUrl: './toast-host.html',\n encapsulation: ViewEncapsulation.None,\n host: {\n '[class]': 'classes()',\n role: 'region',\n '[attr.aria-label]': 'regionLabel()',\n '(mouseenter)': 'onMouseEnter()',\n '(mouseleave)': 'onMouseLeave()',\n '(focusin)': 'onFocusIn()',\n '(focusout)': 'onFocusOut()',\n },\n imports: [WrToastItem],\n})\nexport class WrToastHost {\n readonly position = input<WrToastPosition>('top-end');\n readonly config = input.required<WrToastConfig>();\n /** Layout mode. @default 'stack' (Sonner-style; hover to fan out) */\n readonly mode = input<WrToastMode>('stack');\n\n /**\n * Every string this host and its items render, resolved through the catalog.\n *\n * The config value WINS when the consumer sets one, and its default is now\n * `null` — until v11 those defaults were English literals, so the four\n * `toast.*` keys in the shipped catalogs were dead and a Russian app got an\n * English close button. `region` had no key at all: the live region's name\n * was the literal `'Notifications'` in a host binding.\n */\n protected readonly regionLabel = useI18nText(signal(null), 'toast.region', 'Notifications');\n\n private readonly closeLabel = useI18nText(\n computed(() => this.config().labels.close),\n 'toast.close',\n 'Close'\n );\n private readonly copyLabel = useI18nText(\n computed(() => this.config().labels.copy),\n 'toast.copy',\n 'Copy'\n );\n private readonly copiedLabel = useI18nText(\n computed(() => this.config().labels.copied),\n 'toast.copied',\n 'Copied'\n );\n protected readonly closeAllLabel = useI18nText(\n computed(() => this.config().labels.closeAll),\n 'toast.closeAll',\n 'Close all'\n );\n\n /** What `wr-toast-item` receives — resolved, so the item stays presentational. */\n protected readonly labels = computed(() => ({\n close: this.closeLabel(),\n copy: this.copyLabel(),\n copied: this.copiedLabel(),\n closeAll: this.closeAllLabel(),\n }));\n\n /** @internal — hovering or focusing the stack toggles this in stack mode. */\n protected readonly expanded = signal(false);\n\n /** Pointer is over the host. */\n private readonly hovered = signal(false);\n /** Focus is somewhere inside the host — keyboard equivalent of hovering, and\n * the only way a keyboard user can reach the \"Close all\" button. */\n private readonly focusWithin = signal(false);\n\n private readonly destroyRef = inject(DestroyRef);\n private collapseTimer: ReturnType<typeof setTimeout> | null = null;\n\n constructor() {\n this.destroyRef.onDestroy(() => this.clearCollapseTimer());\n }\n\n /** @internal */\n protected onMouseEnter(): void {\n this.hovered.set(true);\n this.syncExpanded();\n }\n\n /** @internal */\n protected onMouseLeave(): void {\n this.hovered.set(false);\n this.syncExpanded();\n }\n\n /** @internal */\n protected onFocusIn(): void {\n this.focusWithin.set(true);\n this.syncExpanded();\n }\n\n /** @internal */\n protected onFocusOut(): void {\n this.focusWithin.set(false);\n this.syncExpanded();\n }\n\n /** Expand immediately while the pointer or focus is inside, and delay the\n * collapse so a cursor briefly slipping off the host during a layout reflow\n * — or focus moving between two buttons inside it — doesn't cause a flicker. */\n private syncExpanded(): void {\n if (this.hovered() || this.focusWithin()) {\n this.clearCollapseTimer();\n this.expanded.set(true);\n return;\n }\n if (this.collapseTimer !== null) return;\n this.collapseTimer = setTimeout(() => {\n this.collapseTimer = null;\n if (!this.hovered() && !this.focusWithin()) this.expanded.set(false);\n }, COLLAPSE_DELAY_MS);\n }\n\n private clearCollapseTimer(): void {\n if (this.collapseTimer !== null) {\n clearTimeout(this.collapseTimer);\n this.collapseTimer = null;\n }\n }\n\n /** @internal — pushed by the service: the rendered (capped) stack. */\n readonly toasts = signal<readonly ActiveToast[]>([]);\n\n /** @internal — pushed by the service: count still queued behind the cap. */\n readonly queued = signal(0);\n\n /** Total outstanding toasts (visible + queued) — what \"Close all\" clears. */\n protected readonly totalCount = computed(() => this.toasts().length + this.queued());\n\n /** @internal — service listens to update its internal state. */\n readonly dismissed = output<number>();\n readonly pauseRequested = output<number>();\n readonly resumeRequested = output<number>();\n readonly dismissAllRequested = output<void>();\n\n protected readonly classes = computed(() => {\n const parts = ['wr-toast-host', `wr-toast-host--${this.position()}`, `wr-toast-host--${this.mode()}`];\n if (this.mode() === 'stack' && this.expanded()) parts.push('wr-toast-host--expanded');\n return parts.join(' ');\n });\n\n /** Distance from the front of the stack (0 = newest / fully visible). */\n protected stackIndex(i: number): number {\n return this.toasts().length - 1 - i;\n }\n\n protected readonly closeAllVisible = computed(() => {\n const cfg = this.config();\n // In stack mode the toasts cascade absolutely while collapsed, which\n // makes the close-all button jump between layout positions on hover\n // (button moves → cursor leaves → host collapses → cycle = blink).\n // Only show it once the stack is expanded — by hover OR by focus entering\n // it, so it stays reachable from the keyboard — or always in list mode.\n if (this.mode() === 'stack' && !this.expanded()) return false;\n return cfg.showCloseAll && this.toasts().length >= cfg.closeAllThreshold;\n });\n\n protected showProgressFor(t: WrToastOptions): boolean {\n return t.showProgress ?? this.config().showProgress;\n }\n\n protected showCopyFor(t: WrToastOptions): boolean {\n return t.showCopy ?? this.config().showCopy;\n }\n}\n","@if (closeAllVisible()) {\n <button type=\"button\" class=\"wr-toast-host__close-all\" (click)=\"dismissAllRequested.emit()\">\n {{ closeAllLabel() }} ({{ totalCount() }})\n </button>\n}\n\n@for (toast of toasts(); track toast.id) {\n <wr-toast\n [style.--wr-toast-stack-index]=\"stackIndex($index)\"\n [type]=\"toast.type ?? 'info'\"\n [title]=\"toast.title ?? null\"\n [message]=\"toast.message\"\n [dismissible]=\"toast.dismissible ?? true\"\n [showProgress]=\"showProgressFor(toast)\"\n [showCopy]=\"showCopyFor(toast)\"\n [duration]=\"toast.resolvedDuration\"\n [labels]=\"labels()\"\n (dismissed)=\"dismissed.emit(toast.id)\"\n (pauseRequested)=\"pauseRequested.emit(toast.id)\"\n (resumeRequested)=\"resumeRequested.emit(toast.id)\"\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 { WrToastOptions } from './interfaces';\n\n/**\n * Handle returned by `WrToast.show()`. Call `dismiss()` to remove\n * the toast early. Inspect `options` to see what the caller requested.\n */\nexport class WrToastRef {\n constructor(\n public readonly id: number,\n public readonly options: WrToastOptions,\n private readonly onDismiss: (id: number) => void\n ) {}\n\n /** Remove this toast from the stack. */\n dismiss(): void {\n this.onDismiss(this.id);\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 { WrToastConfig } from './interfaces';\n\n/**\n * Library defaults applied when no {@link provideWrToastConfig} call is\n * registered. Merged shallowly with the consumer's overrides (the `labels`\n * sub-object is merged separately so callers can override one string at a\n * time).\n */\nexport const DEFAULT_TOAST_CONFIG: WrToastConfig = {\n position: 'top-end',\n mode: 'stack',\n duration: 4000,\n showProgress: true,\n showCopy: false,\n showCloseAll: true,\n closeAllThreshold: 2,\n maxStack: 5,\n // Null, not English: the host resolves each one through the i18n catalog and\n // falls back to English only if nothing is registered. See `WrToastConfig`.\n labels: {\n close: null,\n copy: null,\n copied: null,\n closeAll: 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 { InjectionToken } from '@angular/core';\n\nimport { DEFAULT_TOAST_CONFIG } from '../default-toast-config';\nimport type { WrToastConfig } from '../interfaces';\n\n/**\n * Holds the global {@link WrToastConfig} used by {@link WrToast}.\n * The default factory returns {@link DEFAULT_TOAST_CONFIG} so the service\n * works out of the box; override via {@link provideWrToastConfig}.\n */\nexport const WR_TOAST_CONFIG = new InjectionToken<WrToastConfig>('WR_TOAST_CONFIG', {\n providedIn: 'root',\n factory: () => DEFAULT_TOAST_CONFIG,\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 { ComponentPortal } from '@angular/cdk/portal';\nimport { type ComponentRef, Service, inject } from '@angular/core';\n\nimport { WR_OVERLAY } from 'ngwr/overlay';\n\nimport type { WrToastOptions, WrToastPosition } from '../interfaces';\nimport { WrToastHost } from '../toast-host';\nimport { WrToastRef } from '../toast-ref';\nimport { WR_TOAST_CONFIG } from '../tokens';\n\ntype ActiveEntry = WrToastOptions & {\n readonly id: number;\n /** Resolved auto-dismiss duration in ms after merging with global config. */\n readonly resolvedDuration: number;\n /** Resolved corner for this stack. */\n readonly resolvedPosition: WrToastPosition;\n /** Pending timeout handle. */\n timer?: ReturnType<typeof setTimeout>;\n /** Timestamp of the last timer (re)start, used to compute remaining on pause. */\n startedAt?: number;\n /** Milliseconds left when paused. */\n remaining: number;\n};\n\n/**\n * Opens toast notifications in a single shared overlay.\n *\n * Global defaults come from {@link WR_TOAST_CONFIG}; register\n * {@link provideWrToastConfig} once at bootstrap to customise. Each\n * `show()` call accepts per-toast overrides via {@link WrToastOptions}.\n *\n * @example\n * ```ts\n * const toast = inject(WrToast);\n *\n * toast.show({ type: 'success', title: 'Saved', message: 'Profile updated.' });\n * toast.show({ type: 'danger', message: 'Network error', duration: 0 });\n * toast.show({ message: 'Permalink copied', position: 'bottom', showCopy: true });\n * ```\n *\n * @see https://ngwr.dev/reference/components/toast\n */\n@Service()\nexport class WrToast {\n private readonly overlay = inject(WR_OVERLAY);\n private readonly config = inject(WR_TOAST_CONFIG);\n\n private overlayRef: OverlayRef | null = null;\n private hostRef: ComponentRef<WrToastHost> | null = null;\n /** Watches the overlay container for overlays opened after the host. */\n private containerObserver: MutationObserver | null = null;\n private currentPosition: WrToastPosition = this.config.position;\n private currentMode: 'stack' | 'list' = this.config.mode;\n private nextId = 1;\n /** Currently rendered toasts (capped at `config.maxStack`). */\n private active: ActiveEntry[] = [];\n /** Overflow waiting for a free slot — promoted FIFO as actives dismiss, so\n * nothing is ever silently dropped. */\n private queue: ActiveEntry[] = [];\n\n /** Open a toast. Returns a handle you can `dismiss()` early. */\n show(options: WrToastOptions): WrToastRef {\n const resolvedPosition = options.position ?? this.config.position;\n const resolvedDuration = options.duration ?? this.config.duration;\n\n this.ensureHost(resolvedPosition);\n // A toast raised now belongs above everything already on screen, and the host\n // it goes into may be much older than the dialog it has to clear. See\n // `raiseHost`.\n this.raiseHost();\n\n const entry: ActiveEntry = {\n ...options,\n id: this.nextId++,\n resolvedDuration,\n resolvedPosition,\n remaining: resolvedDuration,\n };\n\n const max = this.config.maxStack;\n if (max > 0 && this.active.length >= max) {\n // Stack is full — hold this one in the queue (no timer until it's shown).\n this.queue = [...this.queue, entry];\n this.pushToHost();\n } else {\n this.active = [...this.active, entry];\n this.pushToHost();\n this.startTimer(entry);\n }\n\n return new WrToastRef(entry.id, options, id => this.dismiss(id));\n }\n\n /** Dismiss a single toast by id. */\n dismiss(id: number): void {\n const entry = this.active.find(t => t.id === id);\n if (entry?.timer) clearTimeout(entry.timer);\n this.active = this.active.filter(t => t.id !== id);\n // A dismiss can also target a still-queued toast.\n this.queue = this.queue.filter(t => t.id !== id);\n this.promoteFromQueue();\n this.pushToHost();\n if (this.active.length === 0 && this.queue.length === 0) this.disposeHost();\n }\n\n /** Dismiss every visible toast. Wired to the host's \"Close all\" button. */\n dismissAll(): void {\n for (const entry of this.active) {\n if (entry.timer) clearTimeout(entry.timer);\n }\n this.active = [];\n this.queue = [];\n this.disposeHost();\n }\n\n /** Change the corner the stack opens in. Affects future toasts. */\n setPosition(position: WrToastPosition): void {\n this.currentPosition = position;\n if (this.hostRef) this.hostRef.setInput('position', position);\n }\n\n /** Switch the layout mode at runtime. Persists across host re-creation. */\n setMode(mode: 'stack' | 'list'): void {\n this.currentMode = mode;\n if (this.hostRef) this.hostRef.setInput('mode', mode);\n }\n\n // Timer\n\n private startTimer(entry: ActiveEntry): void {\n if (entry.remaining <= 0) return;\n entry.startedAt = Date.now();\n entry.timer = setTimeout(() => this.dismiss(entry.id), entry.remaining);\n }\n\n private pauseTimer(entry: ActiveEntry): void {\n if (!entry.timer) return;\n clearTimeout(entry.timer);\n entry.timer = undefined;\n if (entry.startedAt) {\n entry.remaining = Math.max(0, entry.remaining - (Date.now() - entry.startedAt));\n }\n }\n\n // Host plumbing\n\n private ensureHost(position: WrToastPosition): void {\n if (this.overlayRef) {\n if (position !== this.currentPosition) this.setPosition(position);\n return;\n }\n\n this.currentPosition = position;\n\n this.overlayRef = this.overlay.create({\n positionStrategy: this.overlay.position().global(),\n scrollStrategy: this.overlay.scrollStrategies.noop(),\n hasBackdrop: false,\n panelClass: ['wr-toast-overlay'],\n });\n\n const portal = new ComponentPortal(WrToastHost);\n this.hostRef = this.overlayRef.attach(portal);\n this.hostRef.setInput('position', position);\n this.hostRef.setInput('mode', this.currentMode);\n this.hostRef.setInput('config', this.config);\n\n const inst = this.hostRef.instance;\n inst.dismissed.subscribe(id => this.dismiss(id));\n inst.dismissAllRequested.subscribe(() => this.dismissAll());\n inst.pauseRequested.subscribe(id => {\n const entry = this.active.find(t => t.id === id);\n if (entry) this.pauseTimer(entry);\n });\n inst.resumeRequested.subscribe(id => {\n const entry = this.active.find(t => t.id === id);\n if (entry) this.startTimer(entry);\n });\n\n this.watchForNewerOverlays();\n }\n\n /**\n * Put the host back on top of the browser's top layer.\n *\n * The stacking rule here is not a z-index and cannot be fixed with one. CDK 22\n * promotes every overlay by calling `showPopover()` on its host element, and\n * the top layer is ordered by the MOMENT of promotion — a popover shown later\n * paints over one shown earlier no matter what either element's z-index, DOM\n * order or containing block says. The toast host is created once and kept\n * alive until the last toast leaves, so its place in that order is frozen at\n * whenever the first toast of the run appeared. Every dialog and drawer opened\n * after that sits above it.\n *\n * The symptom was as bad as the mechanism is quiet: a toast raised from inside\n * an open dialog rendered UNDER the dialog's backdrop, dimmed by it and\n * hit-tested as it — so the close button was unreachable and clicking where it\n * appeared closed the dialog instead. Nothing threw, and a toast with\n * `duration: 0` never went away on its own.\n *\n * Hiding and re-showing moves the host to the end of the top layer. Both calls\n * happen in one task, so there is no frame in which the host is `display:\n * none` and nothing re-runs a toast's enter animation.\n *\n * Skipped while focus is inside the host: Chromium keeps focus across this\n * pair, but the hide-popover algorithm is specified to restore focus to the\n * previously focused element, and a host the user is already tabbing through\n * is by definition reachable. In practice the two never coincide — a modal\n * traps focus, so focus inside the host means nothing is above it to escape.\n */\n private raiseHost(): void {\n const host = this.overlayRef?.hostElement;\n // `usePopover` is off when the platform has no popover support (and on the\n // server), and then there is no top layer to be at the wrong end of.\n if (!host?.isConnected || !host.hasAttribute('popover')) return;\n if (host.contains(host.ownerDocument.activeElement)) return;\n try {\n host.hidePopover();\n host.showPopover();\n } catch {\n // `hidePopover` throws if the host is not showing — nothing to raise.\n }\n }\n\n /**\n * Re-raise the host whenever another overlay joins the container.\n *\n * `show()` covers the reported order (toast raised while a dialog is up). This\n * covers the mirror image, which is the same defect seen from the other side:\n * a toast already on screen when the dialog opens is left under it, unclickable\n * for the rest of its duration, and no further `show()` is coming to fix it.\n *\n * Observing the host's own parent rather than a container resolved from the\n * injector keeps this correct whether or not `provideWrOverlay()` is installed\n * — the host is in whichever container it was actually appended to. Re-showing\n * a popover moves nothing in the DOM, so this cannot re-trigger itself.\n */\n private watchForNewerOverlays(): void {\n const parent = this.overlayRef?.hostElement.parentElement;\n if (!parent || typeof MutationObserver === 'undefined') return;\n this.containerObserver = new MutationObserver(() => this.raiseHost());\n this.containerObserver.observe(parent, { childList: true });\n }\n\n /** Fill any free stack slots from the queue (FIFO), starting each promoted\n * toast's auto-dismiss timer only as it becomes visible. */\n private promoteFromQueue(): void {\n const max = this.config.maxStack;\n while ((max <= 0 || this.active.length < max) && this.queue.length > 0) {\n const [next, ...rest] = this.queue;\n this.queue = rest;\n this.active = [...this.active, next];\n this.startTimer(next);\n }\n }\n\n private pushToHost(): void {\n this.hostRef?.instance.toasts.set([...this.active]);\n this.hostRef?.instance.queued.set(this.queue.length);\n }\n\n private disposeHost(): void {\n this.containerObserver?.disconnect();\n this.containerObserver = null;\n if (this.overlayRef) {\n this.overlayRef.dispose();\n this.overlayRef = null;\n this.hostRef = null;\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 {\n ApplicationRef,\n ENVIRONMENT_INITIALIZER,\n type EnvironmentProviders,\n EnvironmentInjector,\n inject,\n isDevMode,\n makeEnvironmentProviders,\n} from '@angular/core';\n\nimport { DEFAULT_TOAST_CONFIG } from './default-toast-config';\nimport type { WrToastConfig } from './interfaces';\nimport { WR_TOAST_CONFIG } from './tokens';\n\n/**\n * Registers a global {@link WrToastConfig} for {@link WrToast}. Any\n * field you omit falls back to {@link DEFAULT_TOAST_CONFIG}; the `labels`\n * sub-object is merged separately so you can override a single string at a\n * time (useful for i18n).\n *\n * @example\n * ```ts\n * bootstrapApplication(AppComponent, {\n * providers: [\n * provideWrToastConfig({\n * position: 'bottom-end',\n * showCopy: true,\n * maxStack: 3,\n * labels: { close: 'Закрыть' },\n * }),\n * ],\n * });\n * ```\n *\n * **Bootstrap only, and the three ngwr providers differ here.** {@link WrToast}\n * is root-provided, so it reads this token once from the ROOT injector — a\n * `provideWrToastConfig()` in a route's `providers` is never seen, and used to\n * be ignored in silence. It now warns in dev mode instead. By contrast\n * `provideWrConfig()` IS read per route, because components resolve it from\n * their own injector, and `provideWrIcons()` works at any level and chains, so\n * a route may add icons to the set its parent registered.\n */\nexport function provideWrToastConfig(\n config: Partial<Omit<WrToastConfig, 'labels'>> & { readonly labels?: Partial<WrToastConfig['labels']> }\n): EnvironmentProviders {\n const merged: WrToastConfig = {\n ...DEFAULT_TOAST_CONFIG,\n ...config,\n labels: { ...DEFAULT_TOAST_CONFIG.labels, ...config.labels },\n };\n return makeEnvironmentProviders([\n { provide: WR_TOAST_CONFIG, useValue: merged },\n ...(isDevMode()\n ? [\n {\n provide: ENVIRONMENT_INITIALIZER,\n multi: true,\n useValue: (): void => {\n // Compared by identity against the application's own injector: a\n // route creates a child EnvironmentInjector, and the root-provided\n // service will resolve the token from the root regardless of what\n // this one holds. Reported here rather than at the call site,\n // because a provider function cannot know where it was spread.\n const here = inject(EnvironmentInjector);\n if (here !== inject(ApplicationRef).injector) {\n // eslint-disable-next-line no-console -- dev-mode misconfiguration diagnostic\n console.warn(\n '[NGWR] provideWrToastConfig() is in a route or child injector, where WrToast will never read it — ' +\n 'the service is root-provided and resolves WR_TOAST_CONFIG once, from the root. Move it to the ' +\n 'application providers, or set the same fields per call on toast.show().'\n );\n }\n },\n },\n ]\n : []),\n ]);\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;AAAA;;;;;AAKG;AAMH;;;;;AAKG;MAqBU,WAAW,CAAA;IACb,IAAI,GAAG,KAAK,CAAc,MAAM;6EAAC;IACjC,KAAK,GAAG,KAAK,CAAgB,IAAI;8EAAC;IAClC,OAAO,GAAG,KAAK,CAAC,QAAQ;gFAAU;IAClC,WAAW,GAAG,KAAK,CAAU,IAAI;oFAAC;IAClC,YAAY,GAAG,KAAK,CAAU,KAAK;qFAAC;IACpC,QAAQ,GAAG,KAAK,CAAU,KAAK;iFAAC;;IAEhC,QAAQ,GAAG,KAAK,CAAS,CAAC;iFAAC;AACpC;;;AAGG;IACM,MAAM,GAAG,KAAK,CAAC,QAAQ;+EAAoD;IAE3E,SAAS,GAAG,MAAM,EAAQ;IAC1B,cAAc,GAAG,MAAM,EAAQ;IAC/B,eAAe,GAAG,MAAM,EAAQ;;IAGtB,UAAU,GAAG,MAAM,CAAC,KAAK;mFAAC;IACrC,cAAc,GAAyC,IAAI;IAEhD,OAAO,GAAG,QAAQ,CAAC,MAAM,CAAA,mBAAA,EAAsB,IAAI,CAAC,IAAI,EAAE,CAAA,CAAE;gFAAC;;IAG7D,QAAQ,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,IAAI,EAAE,KAAK,QAAQ,GAAG,OAAO,GAAG,QAAQ,CAAC;iFAAC;IAC1E,SAAS,GAAG,QAAQ,CAAC,MACtC,IAAI,CAAC,IAAI,EAAE,KAAK,QAAQ,IAAI,IAAI,CAAC,IAAI,EAAE,KAAK,SAAS,GAAG,WAAW,GAAG,QAAQ;kFAC/E;;I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AACzB,YAAA,IAAI,CAAC,UAAU,GAAG,IAAI;AACtB,YAAA,IAAI,CAAC,OAAO,GAAG,IAAI;QACrB;IACF;uGAlOW,OAAO,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,OAAA,EAAA,CAAA;wGAAP,OAAO,EAAA,CAAA;;2FAAP,OAAO,EAAA,UAAA,EAAA,CAAA;kBADnB;;;AClDD;;;;;AAKG;AAgBH;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BG;AACG,SAAU,oBAAoB,CAClC,MAAuG,EAAA;AAEvG,IAAA,MAAM,MAAM,GAAkB;AAC5B,QAAA,GAAG,oBAAoB;AACvB,QAAA,GAAG,MAAM;QACT,MAAM,EAAE,EAAE,GAAG,oBAAoB,CAAC,MAAM,EAAE,GAAG,MAAM,CAAC,MAAM,EAAE;KAC7D;AACD,IAAA,OAAO,wBAAwB,CAAC;AAC9B,QAAA,EAAE,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,EAAE;QAC9C,IAAI,SAAS;AACX,cAAE;AACE,gBAAA;AACE,oBAAA,OAAO,EAAE,uBAAuB;AAChC,oBAAA,KAAK,EAAE,IAAI;oBACX,QAAQ,EAAE,MAAW;;;;;;AAMnB,wBAAA,MAAM,IAAI,GAAG,MAAM,CAAC,mBAAmB,CAAC;wBACxC,IAAI,IAAI,KAAK,MAAM,CAAC,cAAc,CAAC,CAAC,QAAQ,EAAE;;4BAE5C,OAAO,CAAC,IAAI,CACV,oGAAoG;gCAClG,gGAAgG;AAChG,gCAAA,yEAAyE,CAC5E;wBACH;oBACF,CAAC;AACF,iBAAA;AACF;cACD,EAAE,CAAC;AACR,KAAA,CAAC;AACJ;;ACpFA;;AAEG;;;;"}
1
+ {"version":3,"file":"ngwr-toast.mjs","sources":["../../../projects/lib/toast/toast-item.ts","../../../projects/lib/toast/toast-item.html","../../../projects/lib/toast/toast-host.ts","../../../projects/lib/toast/toast-host.html","../../../projects/lib/toast/toast-ref.ts","../../../projects/lib/toast/default-toast-config.ts","../../../projects/lib/toast/tokens/toast-config.token.ts","../../../projects/lib/toast/services/toast.ts","../../../projects/lib/toast/provide-wr-toast-config.ts","../../../projects/lib/toast/ngwr-toast.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, ElementRef, ViewEncapsulation, computed, inject, input, output, signal } from '@angular/core';\n\nimport type { WrToastConfig, WrToastType } from './interfaces';\n\n/**\n * One toast row inside the toast host. Not used directly — see\n * `WrToast.show()`.\n *\n * @internal\n */\n@Component({\n selector: 'wr-toast',\n templateUrl: './toast-item.html',\n encapsulation: ViewEncapsulation.None,\n host: {\n '[class]': 'classes()',\n '[style.--wr-toast-duration]': 'durationMs()',\n '[style.transform]': 'swipeTransform()',\n '[style.opacity]': 'swipeOpacity()',\n '[style.transition]': 'swiping() ? \"none\" : null',\n '[attr.role]': 'liveRole()',\n '[attr.aria-live]': 'liveLevel()',\n '(mouseenter)': 'pauseRequested.emit()',\n '(mouseleave)': 'resumeRequested.emit()',\n '(touchstart)': 'onSwipeStart($event)',\n '(touchmove)': 'onSwipeMove($event)',\n '(touchend)': 'onSwipeEnd()',\n '(touchcancel)': 'onSwipeEnd()',\n },\n})\nexport class WrToastItem {\n readonly type = input<WrToastType>('info');\n readonly title = input<string | null>(null);\n readonly message = input.required<string>();\n readonly dismissible = input<boolean>(true);\n readonly showProgress = input<boolean>(false);\n readonly showCopy = input<boolean>(false);\n /** Auto-dismiss duration in ms — used to scale the progress bar. `0` hides it. */\n readonly duration = input<number>(0);\n /**\n * Already resolved by the host — strings, not the config's nullable shape.\n * The item renders them and never reaches for the catalog itself.\n */\n readonly labels = input.required<{ [K in keyof WrToastConfig['labels']]: string }>();\n\n readonly dismissed = output<void>();\n readonly pauseRequested = output<void>();\n readonly resumeRequested = output<void>();\n\n /** True for ~1.5s after a successful copy; flips the icon to a check. */\n protected readonly justCopied = signal(false);\n private copyResetTimer: ReturnType<typeof setTimeout> | null = null;\n\n protected readonly classes = computed(() => `wr-toast wr-toast--${this.type()}`);\n\n /** Escalate to `alert`/`assertive` for danger/warning toasts. */\n protected readonly liveRole = computed(() => (this.type() === 'danger' ? 'alert' : 'status'));\n protected readonly liveLevel = computed(() =>\n this.type() === 'danger' || this.type() === 'warning' ? 'assertive' : 'polite'\n );\n\n /** Inline CSS value for `--wr-toast-duration`. */\n protected readonly durationMs = computed(() => `${this.duration()}ms`);\n\n protected readonly progressVisible = computed(() => this.showProgress() && this.duration() > 0);\n\n protected async onCopy(): Promise<void> {\n try {\n await navigator.clipboard.writeText(this.message());\n this.justCopied.set(true);\n if (this.copyResetTimer) clearTimeout(this.copyResetTimer);\n this.copyResetTimer = setTimeout(() => this.justCopied.set(false), 1500);\n } catch {\n // Clipboard unavailable (insecure context / permission denied) — silent.\n }\n }\n\n // Swipe-sideways-to-dismiss. The toast follows the finger and fades; releasing\n // past 40% of its width emits `dismissed`, otherwise it snaps back.\n private readonly elRef = inject<ElementRef<HTMLElement>>(ElementRef);\n private swipeStartX = 0;\n private swipeWidth = 0;\n protected readonly swipeX = signal(0);\n protected readonly swiping = signal(false);\n\n protected readonly swipeTransform = computed(() => (this.swipeX() === 0 ? null : `translateX(${this.swipeX()}px)`));\n protected readonly swipeOpacity = computed(() => {\n const dist = Math.abs(this.swipeX());\n return dist === 0 ? null : Math.max(0, 1 - dist / (this.swipeWidth || 1));\n });\n\n protected onSwipeStart(event: TouchEvent): void {\n if (!this.dismissible()) return;\n const touch = event.touches[0];\n if (!touch) return;\n this.swipeStartX = touch.clientX;\n this.swipeWidth = this.elRef.nativeElement.offsetWidth;\n this.swiping.set(true);\n }\n\n protected onSwipeMove(event: TouchEvent): void {\n if (!this.swiping()) return;\n const touch = event.touches[0];\n if (!touch) return;\n this.swipeX.set(touch.clientX - this.swipeStartX);\n }\n\n protected onSwipeEnd(): void {\n if (!this.swiping()) return;\n this.swiping.set(false);\n if (Math.abs(this.swipeX()) > (this.swipeWidth || 0) * 0.4) {\n this.dismissed.emit();\n } else {\n this.swipeX.set(0);\n }\n }\n}\n","<!-- A glyph per type, and this is the one channel the toast had none of. Its\n four types differed by `--wr-toast-accent` alone — a 3px inline-start\n border, in four colours that sit within 1.06:1 of each other in relative\n luminance, so `success` and `danger` were the same 3px line to a reader\n who cannot separate hue. The shapes are the ones `wr-alert` and\n `wr-result` already use for the same four meanings: a check in a broken\n circle, a triangle, an octagon, an `i`. Three components agreeing is worth\n more than three components each being locally reasonable.\n\n `aria-hidden`, because the type is already announced: the host takes\n `role=\"alert\"` for danger and `role=\"status\"` otherwise. -->\n<svg\n class=\"wr-toast__icon wr-icon__svg\"\n xmlns=\"http://www.w3.org/2000/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>\n @switch (type()) {\n @case ('success') {\n <path d=\"M21.801 10A10 10 0 1 1 17 3.335\" />\n <path d=\"m9 11 3 3L22 4\" />\n }\n @case ('warning') {\n <path d=\"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3\" />\n <path d=\"M12 9v4\" />\n <path d=\"M12 17h.01\" />\n }\n @case ('danger') {\n <path\n d=\"M2.586 16.726A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2h6.624a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586z\"\n />\n <path d=\"M12 8v4\" />\n <path d=\"M12 16h.01\" />\n }\n @default {\n <circle cx=\"12\" cy=\"12\" r=\"10\" />\n <path d=\"M12 16v-4\" />\n <path d=\"M12 8h.01\" />\n }\n }\n</svg>\n\n<div class=\"wr-toast__body\">\n @if (title(); as text) {\n <p class=\"wr-toast__title\">{{ text }}</p>\n }\n <p class=\"wr-toast__message\">{{ message() }}</p>\n</div>\n\n<div class=\"wr-toast__actions\">\n @if (showCopy()) {\n <button\n type=\"button\"\n class=\"wr-toast__action wr-toast__action--copy\"\n [attr.aria-label]=\"justCopied() ? labels().copied : labels().copy\"\n [title]=\"justCopied() ? labels().copied : labels().copy\"\n (click)=\"onCopy()\"\n >\n @if (justCopied()) {\n <svg\n class=\"wr-icon__svg\"\n xmlns=\"http://www.w3.org/2000/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 >\n <path d=\"M20 6 9 17l-5-5\" />\n </svg>\n } @else {\n <svg\n class=\"wr-icon__svg\"\n xmlns=\"http://www.w3.org/2000/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 >\n <rect width=\"14\" height=\"14\" x=\"8\" y=\"8\" rx=\"2\" ry=\"2\" />\n <path d=\"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2\" />\n </svg>\n }\n </button>\n }\n\n @if (dismissible()) {\n <button\n type=\"button\"\n class=\"wr-toast__action wr-toast__action--close\"\n [attr.aria-label]=\"labels().close\"\n [title]=\"labels().close\"\n (click)=\"dismissed.emit()\"\n >\n <svg\n class=\"wr-icon__svg\"\n xmlns=\"http://www.w3.org/2000/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 >\n <path d=\"M18 6 6 18\" />\n <path d=\"m6 6 12 12\" />\n </svg>\n </button>\n }\n</div>\n\n@if (progressVisible()) {\n <span class=\"wr-toast__progress\" aria-hidden=\"true\"></span>\n}\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { Component, DestroyRef, ViewEncapsulation, computed, inject, input, output, signal } from '@angular/core';\n\nimport { useI18nText } from 'ngwr/i18n';\n\nimport type { WrToastConfig, WrToastMode, WrToastOptions, WrToastPosition } from './interfaces';\nimport { WrToastItem } from './toast-item';\n\n/** ms before the pointer or focus leaving actually collapses the stack. Buffers\n * the cursor briefly leaving the host as toasts reflow underneath it, and focus\n * hopping between two buttons inside the host. */\nconst COLLAPSE_DELAY_MS = 120;\n\n/** Active entry pushed by the service — adds the bookkeeping fields the host renders. */\ntype ActiveToast = WrToastOptions & {\n readonly id: number;\n readonly resolvedDuration: number;\n};\n\n/**\n * Internal host that lives inside the toast overlay and renders the\n * active stack. Owned by `WrToast`.\n *\n * @internal\n */\n@Component({\n selector: 'wr-toast-host',\n templateUrl: './toast-host.html',\n encapsulation: ViewEncapsulation.None,\n host: {\n '[class]': 'classes()',\n role: 'region',\n '[attr.aria-label]': 'regionLabel()',\n '(mouseenter)': 'onMouseEnter()',\n '(mouseleave)': 'onMouseLeave()',\n '(focusin)': 'onFocusIn()',\n '(focusout)': 'onFocusOut()',\n },\n imports: [WrToastItem],\n})\nexport class WrToastHost {\n readonly position = input<WrToastPosition>('top-end');\n readonly config = input.required<WrToastConfig>();\n /** Layout mode. @default 'stack' (Sonner-style; hover to fan out) */\n readonly mode = input<WrToastMode>('stack');\n\n /**\n * Every string this host and its items render, resolved through the catalog.\n *\n * The config value WINS when the consumer sets one, and its default is now\n * `null` — until v11 those defaults were English literals, so the four\n * `toast.*` keys in the shipped catalogs were dead and a Russian app got an\n * English close button. `region` had no key at all: the live region's name\n * was the literal `'Notifications'` in a host binding.\n */\n protected readonly regionLabel = useI18nText(signal(null), 'toast.region', 'Notifications');\n\n private readonly closeLabel = useI18nText(\n computed(() => this.config().labels.close),\n 'toast.close',\n 'Close'\n );\n private readonly copyLabel = useI18nText(\n computed(() => this.config().labels.copy),\n 'toast.copy',\n 'Copy'\n );\n private readonly copiedLabel = useI18nText(\n computed(() => this.config().labels.copied),\n 'toast.copied',\n 'Copied'\n );\n protected readonly closeAllLabel = useI18nText(\n computed(() => this.config().labels.closeAll),\n 'toast.closeAll',\n 'Close all'\n );\n\n /** What `wr-toast-item` receives — resolved, so the item stays presentational. */\n protected readonly labels = computed(() => ({\n close: this.closeLabel(),\n copy: this.copyLabel(),\n copied: this.copiedLabel(),\n closeAll: this.closeAllLabel(),\n }));\n\n /** @internal — hovering or focusing the stack toggles this in stack mode. */\n protected readonly expanded = signal(false);\n\n /** Pointer is over the host. */\n private readonly hovered = signal(false);\n /** Focus is somewhere inside the host — keyboard equivalent of hovering, and\n * the only way a keyboard user can reach the \"Close all\" button. */\n private readonly focusWithin = signal(false);\n\n private readonly destroyRef = inject(DestroyRef);\n private collapseTimer: ReturnType<typeof setTimeout> | null = null;\n\n constructor() {\n this.destroyRef.onDestroy(() => this.clearCollapseTimer());\n }\n\n /** @internal */\n protected onMouseEnter(): void {\n this.hovered.set(true);\n this.syncExpanded();\n }\n\n /** @internal */\n protected onMouseLeave(): void {\n this.hovered.set(false);\n this.syncExpanded();\n }\n\n /** @internal */\n protected onFocusIn(): void {\n this.focusWithin.set(true);\n this.syncExpanded();\n }\n\n /** @internal */\n protected onFocusOut(): void {\n this.focusWithin.set(false);\n this.syncExpanded();\n }\n\n /** Expand immediately while the pointer or focus is inside, and delay the\n * collapse so a cursor briefly slipping off the host during a layout reflow\n * — or focus moving between two buttons inside it — doesn't cause a flicker. */\n private syncExpanded(): void {\n if (this.hovered() || this.focusWithin()) {\n this.clearCollapseTimer();\n this.expanded.set(true);\n return;\n }\n if (this.collapseTimer !== null) return;\n this.collapseTimer = setTimeout(() => {\n this.collapseTimer = null;\n if (!this.hovered() && !this.focusWithin()) this.expanded.set(false);\n }, COLLAPSE_DELAY_MS);\n }\n\n private clearCollapseTimer(): void {\n if (this.collapseTimer !== null) {\n clearTimeout(this.collapseTimer);\n this.collapseTimer = null;\n }\n }\n\n /** @internal — pushed by the service: the rendered (capped) stack. */\n readonly toasts = signal<readonly ActiveToast[]>([]);\n\n /** @internal — pushed by the service: count still queued behind the cap. */\n readonly queued = signal(0);\n\n /** Total outstanding toasts (visible + queued) — what \"Close all\" clears. */\n protected readonly totalCount = computed(() => this.toasts().length + this.queued());\n\n /** @internal — service listens to update its internal state. */\n readonly dismissed = output<number>();\n readonly pauseRequested = output<number>();\n readonly resumeRequested = output<number>();\n readonly dismissAllRequested = output<void>();\n\n protected readonly classes = computed(() => {\n const parts = ['wr-toast-host', `wr-toast-host--${this.position()}`, `wr-toast-host--${this.mode()}`];\n if (this.mode() === 'stack' && this.expanded()) parts.push('wr-toast-host--expanded');\n return parts.join(' ');\n });\n\n /** Distance from the front of the stack (0 = newest / fully visible). */\n protected stackIndex(i: number): number {\n return this.toasts().length - 1 - i;\n }\n\n protected readonly closeAllVisible = computed(() => {\n const cfg = this.config();\n // In stack mode the toasts cascade absolutely while collapsed, which\n // makes the close-all button jump between layout positions on hover\n // (button moves → cursor leaves → host collapses → cycle = blink).\n // Only show it once the stack is expanded — by hover OR by focus entering\n // it, so it stays reachable from the keyboard — or always in list mode.\n if (this.mode() === 'stack' && !this.expanded()) return false;\n return cfg.showCloseAll && this.toasts().length >= cfg.closeAllThreshold;\n });\n\n protected showProgressFor(t: WrToastOptions): boolean {\n return t.showProgress ?? this.config().showProgress;\n }\n\n protected showCopyFor(t: WrToastOptions): boolean {\n return t.showCopy ?? this.config().showCopy;\n }\n}\n","@if (closeAllVisible()) {\n <button type=\"button\" class=\"wr-toast-host__close-all\" (click)=\"dismissAllRequested.emit()\">\n {{ closeAllLabel() }} ({{ totalCount() }})\n </button>\n}\n\n@for (toast of toasts(); track toast.id) {\n <wr-toast\n [style.--wr-toast-stack-index]=\"stackIndex($index)\"\n [type]=\"toast.type ?? 'info'\"\n [title]=\"toast.title ?? null\"\n [message]=\"toast.message\"\n [dismissible]=\"toast.dismissible ?? true\"\n [showProgress]=\"showProgressFor(toast)\"\n [showCopy]=\"showCopyFor(toast)\"\n [duration]=\"toast.resolvedDuration\"\n [labels]=\"labels()\"\n (dismissed)=\"dismissed.emit(toast.id)\"\n (pauseRequested)=\"pauseRequested.emit(toast.id)\"\n (resumeRequested)=\"resumeRequested.emit(toast.id)\"\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 { WrToastOptions } from './interfaces';\n\n/**\n * Handle returned by `WrToast.show()`. Call `dismiss()` to remove\n * the toast early. Inspect `options` to see what the caller requested.\n */\nexport class WrToastRef {\n constructor(\n public readonly id: number,\n public readonly options: WrToastOptions,\n private readonly onDismiss: (id: number) => void\n ) {}\n\n /** Remove this toast from the stack. */\n dismiss(): void {\n this.onDismiss(this.id);\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 { WrToastConfig } from './interfaces';\n\n/**\n * Library defaults applied when no {@link provideWrToastConfig} call is\n * registered. Merged shallowly with the consumer's overrides (the `labels`\n * sub-object is merged separately so callers can override one string at a\n * time).\n */\nexport const DEFAULT_TOAST_CONFIG: WrToastConfig = {\n position: 'top-end',\n mode: 'stack',\n duration: 4000,\n showProgress: true,\n showCopy: false,\n showCloseAll: true,\n closeAllThreshold: 2,\n maxStack: 5,\n // Null, not English: the host resolves each one through the i18n catalog and\n // falls back to English only if nothing is registered. See `WrToastConfig`.\n labels: {\n close: null,\n copy: null,\n copied: null,\n closeAll: 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 { InjectionToken } from '@angular/core';\n\nimport { DEFAULT_TOAST_CONFIG } from '../default-toast-config';\nimport type { WrToastConfig } from '../interfaces';\n\n/**\n * Holds the global {@link WrToastConfig} used by {@link WrToast}.\n * The default factory returns {@link DEFAULT_TOAST_CONFIG} so the service\n * works out of the box; override via {@link provideWrToastConfig}.\n */\nexport const WR_TOAST_CONFIG = new InjectionToken<WrToastConfig>('WR_TOAST_CONFIG', {\n providedIn: 'root',\n factory: () => DEFAULT_TOAST_CONFIG,\n});\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { Directionality } from '@angular/cdk/bidi';\nimport { type OverlayRef } from '@angular/cdk/overlay';\nimport { ComponentPortal } from '@angular/cdk/portal';\nimport { type ComponentRef, Injector, Service, inject } from '@angular/core';\n\nimport { WR_OVERLAY, wrFollowDirection } from 'ngwr/overlay';\n\nimport type { WrToastOptions, WrToastPosition } from '../interfaces';\nimport { WrToastHost } from '../toast-host';\nimport { WrToastRef } from '../toast-ref';\nimport { WR_TOAST_CONFIG } from '../tokens';\n\ntype ActiveEntry = WrToastOptions & {\n readonly id: number;\n /** Resolved auto-dismiss duration in ms after merging with global config. */\n readonly resolvedDuration: number;\n /** Resolved corner for this stack. */\n readonly resolvedPosition: WrToastPosition;\n /** Pending timeout handle. */\n timer?: ReturnType<typeof setTimeout>;\n /** Timestamp of the last timer (re)start, used to compute remaining on pause. */\n startedAt?: number;\n /** Milliseconds left when paused. */\n remaining: number;\n};\n\n/**\n * Opens toast notifications in a single shared overlay.\n *\n * Global defaults come from {@link WR_TOAST_CONFIG}; register\n * {@link provideWrToastConfig} once at bootstrap to customise. Each\n * `show()` call accepts per-toast overrides via {@link WrToastOptions}.\n *\n * @example\n * ```ts\n * const toast = inject(WrToast);\n *\n * toast.show({ type: 'success', title: 'Saved', message: 'Profile updated.' });\n * toast.show({ type: 'danger', message: 'Network error', duration: 0 });\n * toast.show({ message: 'Permalink copied', position: 'bottom', showCopy: true });\n * ```\n *\n * @see https://ngwr.dev/reference/components/toast\n */\n@Service()\nexport class WrToast {\n private readonly overlay = inject(WR_OVERLAY);\n private readonly config = inject(WR_TOAST_CONFIG);\n private readonly injector = inject(Injector);\n private readonly dir = inject(Directionality, { optional: true });\n\n private overlayRef: OverlayRef | null = null;\n private hostRef: ComponentRef<WrToastHost> | null = null;\n /** Watches the overlay container for overlays opened after the host. */\n private containerObserver: MutationObserver | null = null;\n private currentPosition: WrToastPosition = this.config.position;\n private currentMode: 'stack' | 'list' = this.config.mode;\n private nextId = 1;\n /** Currently rendered toasts (capped at `config.maxStack`). */\n private active: ActiveEntry[] = [];\n /** Overflow waiting for a free slot — promoted FIFO as actives dismiss, so\n * nothing is ever silently dropped. */\n private queue: ActiveEntry[] = [];\n\n /** Open a toast. Returns a handle you can `dismiss()` early. */\n show(options: WrToastOptions): WrToastRef {\n const resolvedPosition = options.position ?? this.config.position;\n const resolvedDuration = options.duration ?? this.config.duration;\n\n this.ensureHost(resolvedPosition);\n // A toast raised now belongs above everything already on screen, and the host\n // it goes into may be much older than the dialog it has to clear. See\n // `raiseHost`.\n this.raiseHost();\n\n const entry: ActiveEntry = {\n ...options,\n id: this.nextId++,\n resolvedDuration,\n resolvedPosition,\n remaining: resolvedDuration,\n };\n\n const max = this.config.maxStack;\n if (max > 0 && this.active.length >= max) {\n // Stack is full — hold this one in the queue (no timer until it's shown).\n this.queue = [...this.queue, entry];\n this.pushToHost();\n } else {\n this.active = [...this.active, entry];\n this.pushToHost();\n this.startTimer(entry);\n }\n\n return new WrToastRef(entry.id, options, id => this.dismiss(id));\n }\n\n /** Dismiss a single toast by id. */\n dismiss(id: number): void {\n const entry = this.active.find(t => t.id === id);\n if (entry?.timer) clearTimeout(entry.timer);\n this.active = this.active.filter(t => t.id !== id);\n // A dismiss can also target a still-queued toast.\n this.queue = this.queue.filter(t => t.id !== id);\n this.promoteFromQueue();\n this.pushToHost();\n if (this.active.length === 0 && this.queue.length === 0) this.disposeHost();\n }\n\n /** Dismiss every visible toast. Wired to the host's \"Close all\" button. */\n dismissAll(): void {\n for (const entry of this.active) {\n if (entry.timer) clearTimeout(entry.timer);\n }\n this.active = [];\n this.queue = [];\n this.disposeHost();\n }\n\n /** Change the corner the stack opens in. Affects future toasts. */\n setPosition(position: WrToastPosition): void {\n this.currentPosition = position;\n if (this.hostRef) this.hostRef.setInput('position', position);\n }\n\n /** Switch the layout mode at runtime. Persists across host re-creation. */\n setMode(mode: 'stack' | 'list'): void {\n this.currentMode = mode;\n if (this.hostRef) this.hostRef.setInput('mode', mode);\n }\n\n // Timer\n\n private startTimer(entry: ActiveEntry): void {\n if (entry.remaining <= 0) return;\n entry.startedAt = Date.now();\n entry.timer = setTimeout(() => this.dismiss(entry.id), entry.remaining);\n }\n\n private pauseTimer(entry: ActiveEntry): void {\n if (!entry.timer) return;\n clearTimeout(entry.timer);\n entry.timer = undefined;\n if (entry.startedAt) {\n entry.remaining = Math.max(0, entry.remaining - (Date.now() - entry.startedAt));\n }\n }\n\n // Host plumbing\n\n private ensureHost(position: WrToastPosition): void {\n if (this.overlayRef) {\n if (position !== this.currentPosition) this.setPosition(position);\n return;\n }\n\n this.currentPosition = position;\n\n this.overlayRef = this.overlay.create({\n positionStrategy: this.overlay.position().global(),\n scrollStrategy: this.overlay.scrollStrategies.noop(),\n hasBackdrop: false,\n panelClass: ['wr-toast-overlay'],\n });\n\n // The corner is `inset-inline-start` / `-end` on the host component, so the\n // side the stack sits on is decided entirely by the `dir` the CDK wrote at\n // create. This host outlives every individual toast — it is torn down only\n // when the last one leaves — so without this a stack raised before a flip\n // stays on the reader's old side for the rest of the run. The position\n // strategy is bare, so nothing else moves. Torn down with the ref by\n // `disposeHost()`, and the next `ensureHost()` installs a new follower.\n wrFollowDirection(this.overlayRef, this.dir, this.injector);\n\n const portal = new ComponentPortal(WrToastHost);\n this.hostRef = this.overlayRef.attach(portal);\n this.hostRef.setInput('position', position);\n this.hostRef.setInput('mode', this.currentMode);\n this.hostRef.setInput('config', this.config);\n\n const inst = this.hostRef.instance;\n inst.dismissed.subscribe(id => this.dismiss(id));\n inst.dismissAllRequested.subscribe(() => this.dismissAll());\n inst.pauseRequested.subscribe(id => {\n const entry = this.active.find(t => t.id === id);\n if (entry) this.pauseTimer(entry);\n });\n inst.resumeRequested.subscribe(id => {\n const entry = this.active.find(t => t.id === id);\n if (entry) this.startTimer(entry);\n });\n\n this.watchForNewerOverlays();\n }\n\n /**\n * Put the host back on top of the browser's top layer.\n *\n * The stacking rule here is not a z-index and cannot be fixed with one. CDK 22\n * promotes every overlay by calling `showPopover()` on its host element, and\n * the top layer is ordered by the MOMENT of promotion — a popover shown later\n * paints over one shown earlier no matter what either element's z-index, DOM\n * order or containing block says. The toast host is created once and kept\n * alive until the last toast leaves, so its place in that order is frozen at\n * whenever the first toast of the run appeared. Every dialog and drawer opened\n * after that sits above it.\n *\n * The symptom was as bad as the mechanism is quiet: a toast raised from inside\n * an open dialog rendered UNDER the dialog's backdrop, dimmed by it and\n * hit-tested as it — so the close button was unreachable and clicking where it\n * appeared closed the dialog instead. Nothing threw, and a toast with\n * `duration: 0` never went away on its own.\n *\n * Hiding and re-showing moves the host to the end of the top layer. Both calls\n * happen in one task, so there is no frame in which the host is `display:\n * none` and nothing re-runs a toast's enter animation.\n *\n * Skipped while focus is inside the host: Chromium keeps focus across this\n * pair, but the hide-popover algorithm is specified to restore focus to the\n * previously focused element, and a host the user is already tabbing through\n * is by definition reachable. In practice the two never coincide — a modal\n * traps focus, so focus inside the host means nothing is above it to escape.\n */\n private raiseHost(): void {\n const host = this.overlayRef?.hostElement;\n // `usePopover` is off when the platform has no popover support (and on the\n // server), and then there is no top layer to be at the wrong end of.\n if (!host?.isConnected || !host.hasAttribute('popover')) return;\n if (host.contains(host.ownerDocument.activeElement)) return;\n try {\n host.hidePopover();\n host.showPopover();\n } catch {\n // `hidePopover` throws if the host is not showing — nothing to raise.\n }\n }\n\n /**\n * Re-raise the host whenever another overlay joins the container.\n *\n * `show()` covers the reported order (toast raised while a dialog is up). This\n * covers the mirror image, which is the same defect seen from the other side:\n * a toast already on screen when the dialog opens is left under it, unclickable\n * for the rest of its duration, and no further `show()` is coming to fix it.\n *\n * Observing the host's own parent rather than a container resolved from the\n * injector keeps this correct whether or not `provideWrOverlay()` is installed\n * — the host is in whichever container it was actually appended to. Re-showing\n * a popover moves nothing in the DOM, so this cannot re-trigger itself.\n */\n private watchForNewerOverlays(): void {\n const parent = this.overlayRef?.hostElement.parentElement;\n if (!parent || typeof MutationObserver === 'undefined') return;\n this.containerObserver = new MutationObserver(() => this.raiseHost());\n this.containerObserver.observe(parent, { childList: true });\n }\n\n /** Fill any free stack slots from the queue (FIFO), starting each promoted\n * toast's auto-dismiss timer only as it becomes visible. */\n private promoteFromQueue(): void {\n const max = this.config.maxStack;\n while ((max <= 0 || this.active.length < max) && this.queue.length > 0) {\n const [next, ...rest] = this.queue;\n this.queue = rest;\n this.active = [...this.active, next];\n this.startTimer(next);\n }\n }\n\n private pushToHost(): void {\n this.hostRef?.instance.toasts.set([...this.active]);\n this.hostRef?.instance.queued.set(this.queue.length);\n }\n\n private disposeHost(): void {\n this.containerObserver?.disconnect();\n this.containerObserver = null;\n if (this.overlayRef) {\n this.overlayRef.dispose();\n this.overlayRef = null;\n this.hostRef = null;\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 {\n ApplicationRef,\n ENVIRONMENT_INITIALIZER,\n type EnvironmentProviders,\n EnvironmentInjector,\n inject,\n isDevMode,\n makeEnvironmentProviders,\n} from '@angular/core';\n\nimport { DEFAULT_TOAST_CONFIG } from './default-toast-config';\nimport type { WrToastConfig } from './interfaces';\nimport { WR_TOAST_CONFIG } from './tokens';\n\n/**\n * Registers a global {@link WrToastConfig} for {@link WrToast}. Any\n * field you omit falls back to {@link DEFAULT_TOAST_CONFIG}; the `labels`\n * sub-object is merged separately so you can override a single string at a\n * time (useful for i18n).\n *\n * @example\n * ```ts\n * bootstrapApplication(AppComponent, {\n * providers: [\n * provideWrToastConfig({\n * position: 'bottom-end',\n * showCopy: true,\n * maxStack: 3,\n * labels: { close: 'Закрыть' },\n * }),\n * ],\n * });\n * ```\n *\n * **Bootstrap only, and the three ngwr providers differ here.** {@link WrToast}\n * is root-provided, so it reads this token once from the ROOT injector — a\n * `provideWrToastConfig()` in a route's `providers` is never seen, and used to\n * be ignored in silence. It now warns in dev mode instead. By contrast\n * `provideWrConfig()` IS read per route, because components resolve it from\n * their own injector, and `provideWrIcons()` works at any level and chains, so\n * a route may add icons to the set its parent registered.\n */\nexport function provideWrToastConfig(\n config: Partial<Omit<WrToastConfig, 'labels'>> & { readonly labels?: Partial<WrToastConfig['labels']> }\n): EnvironmentProviders {\n const merged: WrToastConfig = {\n ...DEFAULT_TOAST_CONFIG,\n ...config,\n labels: { ...DEFAULT_TOAST_CONFIG.labels, ...config.labels },\n };\n return makeEnvironmentProviders([\n { provide: WR_TOAST_CONFIG, useValue: merged },\n ...(isDevMode()\n ? [\n {\n provide: ENVIRONMENT_INITIALIZER,\n multi: true,\n useValue: (): void => {\n // Compared by identity against the application's own injector: a\n // route creates a child EnvironmentInjector, and the root-provided\n // service will resolve the token from the root regardless of what\n // this one holds. Reported here rather than at the call site,\n // because a provider function cannot know where it was spread.\n const here = inject(EnvironmentInjector);\n if (here !== inject(ApplicationRef).injector) {\n // eslint-disable-next-line no-console -- dev-mode misconfiguration diagnostic\n console.warn(\n '[NGWR] provideWrToastConfig() is in a route or child injector, where WrToast will never read it — ' +\n 'the service is root-provided and resolves WR_TOAST_CONFIG once, from the root. Move it to the ' +\n 'application providers, or set the same fields per call on toast.show().'\n );\n }\n },\n },\n ]\n : []),\n ]);\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;AAAA;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,CAAC,UAAU,GAAG,IAAI;AACtB,YAAA,IAAI,CAAC,OAAO,GAAG,IAAI;QACrB;IACF;uGA7OW,OAAO,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,OAAA,EAAA,CAAA;wGAAP,OAAO,EAAA,CAAA;;2FAAP,OAAO,EAAA,UAAA,EAAA,CAAA;kBADnB;;;ACnDD;;;;;AAKG;AAgBH;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BG;AACG,SAAU,oBAAoB,CAClC,MAAuG,EAAA;AAEvG,IAAA,MAAM,MAAM,GAAkB;AAC5B,QAAA,GAAG,oBAAoB;AACvB,QAAA,GAAG,MAAM;QACT,MAAM,EAAE,EAAE,GAAG,oBAAoB,CAAC,MAAM,EAAE,GAAG,MAAM,CAAC,MAAM,EAAE;KAC7D;AACD,IAAA,OAAO,wBAAwB,CAAC;AAC9B,QAAA,EAAE,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,EAAE;QAC9C,IAAI,SAAS;AACX,cAAE;AACE,gBAAA;AACE,oBAAA,OAAO,EAAE,uBAAuB;AAChC,oBAAA,KAAK,EAAE,IAAI;oBACX,QAAQ,EAAE,MAAW;;;;;;AAMnB,wBAAA,MAAM,IAAI,GAAG,MAAM,CAAC,mBAAmB,CAAC;wBACxC,IAAI,IAAI,KAAK,MAAM,CAAC,cAAc,CAAC,CAAC,QAAQ,EAAE;;4BAE5C,OAAO,CAAC,IAAI,CACV,oGAAoG;gCAClG,gGAAgG;AAChG,gCAAA,yEAAyE,CAC5E;wBACH;oBACF,CAAC;AACF,iBAAA;AACF;cACD,EAAE,CAAC;AACR,KAAA,CAAC;AACJ;;ACpFA;;AAEG;;;;"}
@@ -5,7 +5,7 @@ import { ComponentPortal } from '@angular/cdk/portal';
5
5
  import { isPlatformBrowser } from '@angular/common';
6
6
  import * as i0 from '@angular/core';
7
7
  import { InjectionToken, inject, computed, ViewEncapsulation, Component, EnvironmentInjector, DOCUMENT, PLATFORM_ID, signal, DestroyRef, Injector, Service } from '@angular/core';
8
- import { WR_OVERLAY, wrMirrorOffsets } from 'ngwr/overlay';
8
+ import { WR_OVERLAY, wrFollowDirection, wrMirrorOffsets } from 'ngwr/overlay';
9
9
  import { WrButton } from 'ngwr/button';
10
10
  import { readI18nText, useI18nFormatter } from 'ngwr/i18n';
11
11
 
@@ -256,17 +256,19 @@ class WrTour {
256
256
  const positionStrategy = this.overlay
257
257
  .position()
258
258
  .flexibleConnectedTo(target)
259
- .withPositions(wrMirrorOffsets(FALLBACKS[placement].map(side => ({
260
- ...CONNECTED[side],
261
- offsetY: side === 'bottom' ? 12 : side === 'top' ? -12 : 0,
262
- offsetX: side === 'right' ? 12 : side === 'left' ? -12 : 0,
263
- })), this.isRtl()))
259
+ .withPositions(this.stepPositions(placement, this.isRtl()))
264
260
  .withPush(true);
265
261
  this.overlayRef = this.overlay.create({
266
262
  positionStrategy,
267
263
  scrollStrategy: this.scrollStrategies.reposition(),
268
264
  panelClass: 'wr-tour-overlay',
269
265
  });
266
+ // The CDK read the direction once, just now. A tour is long-lived by nature
267
+ // — a step can sit on screen while the user changes a language setting — and
268
+ // without this the card keeps the direction the step opened in, with the
269
+ // 12px gap that held it clear of the spotlight now pointing into it.
270
+ // Per step, because every move disposes this ref and builds the next.
271
+ wrFollowDirection(this.overlayRef, this.dir, this.injector, direction => positionStrategy.withPositions(this.stepPositions(placement, direction === 'rtl')));
270
272
  const portal = new ComponentPortal(WrTourPopup, null, Injector.create({ parent: this.injector, providers: [{ provide: WR_TOUR_STEP, useValue: this }] }));
271
273
  const ref = this.overlayRef.attach(portal);
272
274
  // Kept on the instance, not in a local: a trap registers with CDK's
@@ -292,6 +294,18 @@ class WrTour {
292
294
  window.removeEventListener('resize', reposition);
293
295
  };
294
296
  }
297
+ /**
298
+ * The card's fallback table for one placement, with its inline offsets already
299
+ * mirrored. Built per call rather than per step: the direction can change while
300
+ * the step is on screen, and a table is what has to be rebuilt when it does.
301
+ */
302
+ stepPositions(placement, isRtl) {
303
+ return wrMirrorOffsets(FALLBACKS[placement].map(side => ({
304
+ ...CONNECTED[side],
305
+ offsetY: side === 'bottom' ? 12 : side === 'top' ? -12 : 0,
306
+ offsetX: side === 'right' ? 12 : side === 'left' ? -12 : 0,
307
+ })), isRtl);
308
+ }
295
309
  placeSpotlight(target) {
296
310
  const el = this.spotlight;
297
311
  if (!el)
@@ -1 +1 @@
1
- {"version":3,"file":"ngwr-tour.mjs","sources":["../../../projects/lib/tour/tour-popup.ts","../../../projects/lib/tour/tour-popup.html","../../../projects/lib/tour/tour.ts","../../../projects/lib/tour/ngwr-tour.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, InjectionToken, ViewEncapsulation, computed, inject } from '@angular/core';\n\nimport { WrButton } from 'ngwr/button';\nimport { readI18nText, useI18nFormatter } from 'ngwr/i18n';\n\nimport type { WrTourStep } from './interfaces';\n\n/** What the popup needs from the running tour, without importing the service (cycle). */\nexport interface WrTourController {\n readonly index: () => number;\n readonly total: () => number;\n readonly step: () => WrTourStep | null;\n /**\n * Whether this is the last step the user will actually see — the service looks\n * ahead for a reachable one, because a trailing step whose target is missing gets\n * skipped and the raw count would call the final card \"Next\".\n */\n readonly isLast: () => boolean;\n /**\n * Whether this is the first step the user will actually see — the service looks\n * BEHIND for a reachable one, for the mirror reason: a leading step whose target\n * is missing gets skipped, so the tour opens on a later index and the raw one\n * would put a Back button on the very first card.\n */\n readonly isFirst: () => boolean;\n next(): void;\n prev(): void;\n stop(): void;\n}\n\n/** Provided by `WrTour` when it attaches the popup portal. */\nexport const WR_TOUR_STEP = new InjectionToken<WrTourController>('WR_TOUR_STEP');\n\n/**\n * The card a tour shows next to the spotlit element. Rendered by `WrTour` into\n * a CDK overlay — not something you place yourself.\n *\n * @see https://ngwr.dev/reference/services/tour\n */\n@Component({\n selector: 'wr-tour-popup',\n templateUrl: './tour-popup.html',\n encapsulation: ViewEncapsulation.None,\n host: { class: 'wr-tour-popup', role: 'dialog', 'aria-modal': 'true', '[attr.aria-label]': 'ariaLabel()' },\n imports: [WrButton],\n})\nexport class WrTourPopup {\n protected readonly tour = inject(WR_TOUR_STEP);\n\n // `readI18nText`, not `useI18nText`: these have no consumer-facing input to\n // forward. Both helpers are reactive.\n protected readonly nextLabel = readI18nText('tour.next', 'Next');\n protected readonly backLabel = readI18nText('tour.back', 'Back');\n protected readonly doneLabel = readI18nText('tour.done', 'Done');\n protected readonly skipLabel = readI18nText('tour.skip', 'Skip tour');\n\n /** `Step {{current}} of {{total}}` — also the dialog's accessible name. */\n protected readonly progress = useI18nFormatter('tour.progress', 'Step {{current}} of {{total}}');\n\n // From the service, not `index() >= total() - 1`: a trailing step whose target is\n // missing gets skipped, so the raw count called the final card \"Next\" and then\n // ended the tour when it was pressed.\n protected readonly isLast = computed(() => this.tour.isLast());\n // Same story at the other end, and the same fix: `index() <= 0` rendered a Back\n // button on the first card of a tour whose leading step had been skipped, and\n // `prev()` walks off the start and returns — so the button did nothing at all.\n protected readonly isFirst = computed(() => this.tour.isFirst());\n\n protected readonly progressText = computed(() =>\n this.progress({ current: this.tour.index() + 1, total: this.tour.total() })\n );\n\n protected readonly ariaLabel = computed(() => {\n const title = this.tour.step()?.title;\n return title ? `${title} — ${this.progressText()}` : this.progressText();\n });\n}\n","@let step = tour.step();\n\n<p class=\"wr-tour-popup__progress\">{{ progressText() }}</p>\n\n@if (step?.title; as title) {\n <h2 class=\"wr-tour-popup__title\">{{ title }}</h2>\n}\n\n<p class=\"wr-tour-popup__content\">{{ step?.content }}</p>\n\n<div class=\"wr-tour-popup__actions\">\n <!-- The three buttons are told apart by a class rather than by their position in\n the row: the back button is conditional, so an index means one thing on the\n first step and another everywhere else — and the labels are translated. -->\n <button\n wr-btn\n type=\"button\"\n size=\"sm\"\n color=\"medium\"\n outlined\n class=\"wr-tour-popup__action wr-tour-popup__action--skip\"\n (click)=\"tour.stop()\"\n >\n {{ skipLabel() }}\n </button>\n\n <span class=\"wr-tour-popup__spacer\"></span>\n\n @if (!isFirst()) {\n <button\n wr-btn\n type=\"button\"\n size=\"sm\"\n outlined\n class=\"wr-tour-popup__action wr-tour-popup__action--back\"\n (click)=\"tour.prev()\"\n >\n {{ backLabel() }}\n </button>\n }\n <button\n wr-btn\n type=\"button\"\n size=\"sm\"\n color=\"primary\"\n class=\"wr-tour-popup__action wr-tour-popup__action--next\"\n (click)=\"tour.next()\"\n >\n {{ isLast() ? doneLabel() : nextLabel() }}\n </button>\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 ConfigurableFocusTrap, ConfigurableFocusTrapFactory } from '@angular/cdk/a11y';\nimport { Directionality } from '@angular/cdk/bidi';\nimport { type OverlayRef, ScrollStrategyOptions } from '@angular/cdk/overlay';\nimport { ComponentPortal } from '@angular/cdk/portal';\nimport { isPlatformBrowser } from '@angular/common';\nimport {\n DOCUMENT,\n DestroyRef,\n EnvironmentInjector,\n Injector,\n PLATFORM_ID,\n Service,\n computed,\n inject,\n signal,\n} from '@angular/core';\n\nimport { WR_OVERLAY, wrMirrorOffsets } from 'ngwr/overlay';\n\nimport type { WrTourPlacement, WrTourStep } from './interfaces';\nimport { WR_TOUR_STEP, WrTourPopup } from './tour-popup';\n\n/** Fallback order per preferred side — the opposite side first, then the sides. */\nconst FALLBACKS: Record<WrTourPlacement, readonly WrTourPlacement[]> = {\n bottom: ['bottom', 'top', 'right', 'left'],\n top: ['top', 'bottom', 'right', 'left'],\n left: ['left', 'right', 'bottom', 'top'],\n right: ['right', 'left', 'bottom', 'top'],\n};\n\nconst CONNECTED: Record<\n WrTourPlacement,\n {\n originX: 'start' | 'center' | 'end';\n originY: 'top' | 'center' | 'bottom';\n overlayX: 'start' | 'center' | 'end';\n overlayY: 'top' | 'center' | 'bottom';\n }\n> = {\n bottom: { originX: 'center', originY: 'bottom', overlayX: 'center', overlayY: 'top' },\n top: { originX: 'center', originY: 'top', overlayX: 'center', overlayY: 'bottom' },\n left: { originX: 'start', originY: 'center', overlayX: 'end', overlayY: 'center' },\n right: { originX: 'end', originY: 'center', overlayX: 'start', overlayY: 'center' },\n};\n\n/**\n * Guided product tour: a spotlight over one element at a time plus a popup\n * explaining it.\n *\n * Steps are data, not markup — call `start()` with an array and the service owns\n * the overlay, the cut-out, focus and the keyboard. A step whose target is not\n * on the page is skipped rather than shown floating, so a tour survives a\n * feature being hidden behind a flag or a permission.\n *\n * @example\n * ```ts\n * private readonly tour = inject(WrTour);\n *\n * showMeAround(): void {\n * this.tour.start([\n * { target: '[data-tour=\"search\"]', title: 'Search', content: 'Find anything by name.' },\n * { target: '[data-tour=\"filters\"]', content: 'Narrow the list down.', placement: 'right' },\n * ]);\n * }\n * ```\n *\n * @see https://ngwr.dev/reference/services/tour\n */\n@Service()\nexport class WrTour {\n private readonly overlay = inject(WR_OVERLAY);\n private readonly dir = inject(Directionality, { optional: true });\n private readonly scrollStrategies = inject(ScrollStrategyOptions);\n private readonly injector = inject(EnvironmentInjector);\n private readonly focusTrapFactory = inject(ConfigurableFocusTrapFactory);\n private readonly document = inject(DOCUMENT);\n private readonly isBrowser = isPlatformBrowser(inject(PLATFORM_ID));\n\n private readonly steps = signal<readonly WrTourStep[]>([]);\n private readonly cursor = signal(-1);\n\n private overlayRef: OverlayRef | null = null;\n private focusTrap: ConfigurableFocusTrap | null = null;\n private spotlight: HTMLElement | null = null;\n private detachKeydown: (() => void) | null = null;\n private detachReposition: (() => void) | null = null;\n private restoreFocus: HTMLElement | null = null;\n\n /** Whether a tour is running. */\n readonly active = computed(() => this.cursor() >= 0);\n\n /** Zero-based index of the current step, `-1` when idle. */\n readonly index = computed(() => this.cursor());\n\n /** How many steps this tour has. */\n readonly total = computed(() => this.steps().length);\n\n /** The step being shown, or `null` when idle. */\n readonly step = computed<WrTourStep | null>(() => this.steps()[this.cursor()] ?? null);\n\n // Whether any step AFTER the current one can actually be shown. Settled once per\n // move, in `goTo`, because reachability is a DOM question and not a signal.\n private readonly noStepAfter = signal(false);\n\n // The same question looking the other way. Settled in `goTo` for the same reason.\n private readonly noStepBefore = signal(true);\n\n /**\n * Whether this is the last step the user will see. Not `index() === total() - 1`:\n * a trailing step whose target is missing is skipped, so comparing against the\n * raw count left the primary button reading \"Next\" on the final card and then\n * ending the tour when it was pressed.\n */\n readonly isLast = computed(() => this.noStepAfter());\n\n /**\n * Whether this is the first step the user will see. Not `index() === 0`, for the\n * mirror of the reason above: a LEADING step whose target is missing is skipped,\n * so the tour opens on a later index and the raw one put a Back button on the\n * first card — one that did nothing at all, because `prev()` walks off the start\n * and returns without moving.\n */\n readonly isFirst = computed(() => this.noStepBefore());\n\n constructor() {\n // Everything this service owns lives OUTSIDE its own injector: a CDK overlay, a\n // div appended to `document.body`, a document keydown listener and two window\n // listeners. Nothing removes them when the injector goes, so a tour running at\n // teardown left its cut-out on the page.\n inject(DestroyRef).onDestroy(() => this.stop());\n }\n\n /**\n * Begin a tour. Restarts if one is already running. A no-op under SSR — a\n * tour is a client-side affordance and there is nothing to spotlight on the\n * server.\n */\n start(steps: readonly WrTourStep[]): void {\n if (!this.isBrowser || steps.length === 0) return;\n this.stop();\n this.steps.set(steps);\n this.restoreFocus = this.document.activeElement as HTMLElement | null;\n this.goTo(0, 1);\n }\n\n /** Advance; finishes the tour past the last step. */\n next(): void {\n this.goTo(this.cursor() + 1, 1);\n }\n\n /** Go back; stays put on the first step. */\n prev(): void {\n this.goTo(this.cursor() - 1, -1);\n }\n\n /** End the tour and return focus where it was. */\n stop(): void {\n this.teardownStep();\n this.steps.set([]);\n this.cursor.set(-1);\n this.restoreFocus?.focus?.();\n this.restoreFocus = null;\n }\n\n /**\n * Move to `index`, skipping steps whose target is not in the DOM. `direction`\n * says which way to keep skipping, so a missing step never traps the tour\n * between two dead ends.\n */\n private goTo(index: number, direction: 1 | -1): void {\n const steps = this.steps();\n let i = index;\n while (i >= 0 && i < steps.length && this.resolve(steps[i]) === null) i += direction;\n\n if (i < 0) {\n // Ran off the start while going back — stay where we were.\n return;\n }\n if (i >= steps.length) {\n this.stop();\n return;\n }\n\n this.teardownStep();\n this.cursor.set(i);\n this.noStepAfter.set(!this.anyResolvableAfter(i));\n this.noStepBefore.set(!this.anyResolvableBefore(i));\n this.openStep(steps[i]);\n }\n\n /** Whether the tour has a step past `index` that can actually be shown. */\n private anyResolvableAfter(index: number): boolean {\n const steps = this.steps();\n for (let i = index + 1; i < steps.length; i += 1) {\n if (this.resolve(steps[i]) !== null) return true;\n }\n return false;\n }\n\n /** Whether the tour has a step before `index` that can actually be shown. */\n private anyResolvableBefore(index: number): boolean {\n const steps = this.steps();\n for (let i = index - 1; i >= 0; i -= 1) {\n if (this.resolve(steps[i]) !== null) return true;\n }\n return false;\n }\n\n private resolve(step: WrTourStep): HTMLElement | null {\n if (typeof step.target !== 'string') return step.target.isConnected ? step.target : null;\n return this.document.querySelector<HTMLElement>(step.target);\n }\n\n private openStep(step: WrTourStep): void {\n const target = this.resolve(step);\n if (!target) return;\n\n target.scrollIntoView({ block: 'center', inline: 'nearest', behavior: 'smooth' });\n\n // The cut-out is a bare element sized to the target with an enormous spread\n // shadow: everything outside it dims, the target itself stays untouched.\n // Cheaper and far more robust than a clip-path polygon, and it needs no\n // recompute when the page reflows beyond moving the box.\n const spotlight = this.document.createElement('div');\n spotlight.className = 'wr-tour__spotlight';\n spotlight.setAttribute('aria-hidden', 'true');\n this.document.body.appendChild(spotlight);\n this.spotlight = spotlight;\n this.placeSpotlight(target);\n\n const placement = step.placement ?? 'bottom';\n const positionStrategy = this.overlay\n .position()\n .flexibleConnectedTo(target)\n .withPositions(\n wrMirrorOffsets(\n FALLBACKS[placement].map(side => ({\n ...CONNECTED[side],\n offsetY: side === 'bottom' ? 12 : side === 'top' ? -12 : 0,\n offsetX: side === 'right' ? 12 : side === 'left' ? -12 : 0,\n })),\n this.isRtl()\n )\n )\n .withPush(true);\n\n this.overlayRef = this.overlay.create({\n positionStrategy,\n scrollStrategy: this.scrollStrategies.reposition(),\n panelClass: 'wr-tour-overlay',\n });\n\n const portal = new ComponentPortal(\n WrTourPopup,\n null,\n Injector.create({ parent: this.injector, providers: [{ provide: WR_TOUR_STEP, useValue: this }] })\n );\n const ref = this.overlayRef.attach(portal);\n\n // Kept on the instance, not in a local: a trap registers with CDK's\n // `FocusTrapManager` and installs a capture-phase document focus listener, so an\n // undestroyed one leaks per STEP and every tour left a stack of them behind.\n this.focusTrap = this.focusTrapFactory.create(ref.location.nativeElement as HTMLElement);\n void this.focusTrap.focusInitialElementWhenReady();\n\n const onKey = (event: KeyboardEvent): void => {\n // The listener is on the document, so a step shown over a dialog would see the\n // Escape that dialog just handled and close the tour too.\n if (event.key === 'Escape' && !event.defaultPrevented) {\n event.preventDefault();\n this.stop();\n }\n };\n this.document.addEventListener('keydown', onKey);\n this.detachKeydown = () => this.document.removeEventListener('keydown', onKey);\n\n const reposition = (): void => this.placeSpotlight(target);\n window.addEventListener('scroll', reposition, true);\n window.addEventListener('resize', reposition);\n this.detachReposition = () => {\n window.removeEventListener('scroll', reposition, true);\n window.removeEventListener('resize', reposition);\n };\n }\n\n private placeSpotlight(target: HTMLElement): void {\n const el = this.spotlight;\n if (!el) return;\n const r = target.getBoundingClientRect();\n const pad = 6;\n el.style.top = `${r.top - pad}px`;\n el.style.left = `${r.left - pad}px`;\n el.style.width = `${r.width + pad * 2}px`;\n el.style.height = `${r.height + pad * 2}px`;\n }\n\n private teardownStep(): void {\n this.focusTrap?.destroy();\n this.focusTrap = null;\n this.detachKeydown?.();\n this.detachKeydown = null;\n this.detachReposition?.();\n this.detachReposition = null;\n this.overlayRef?.dispose();\n this.overlayRef = null;\n this.spotlight?.remove();\n this.spotlight = null;\n }\n\n /**\n * Whether the app reads right-to-left.\n *\n * Optional inject: `Directionality` is root-provided, so this is never null in\n * an app — but a bare `TestBed` that provides nothing should still get a\n * component that works, and defaulting to LTR is the honest fallback.\n */\n private isRtl(): boolean {\n return this.dir?.value === 'rtl';\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;;;;AAAA;;;;;AAKG;AAgCH;AACO,MAAM,YAAY,GAAG,IAAI,cAAc,CAAmB,cAAc,CAAC;AAEhF;;;;;AAKG;MAQU,WAAW,CAAA;AACH,IAAA,IAAI,GAAG,MAAM,CAAC,YAAY,CAAC;;;AAI3B,IAAA,SAAS,GAAG,YAAY,CAAC,WAAW,EAAE,MAAM,CAAC;AAC7C,IAAA,SAAS,GAAG,YAAY,CAAC,WAAW,EAAE,MAAM,CAAC;AAC7C,IAAA,SAAS,GAAG,YAAY,CAAC,WAAW,EAAE,MAAM,CAAC;AAC7C,IAAA,SAAS,GAAG,YAAY,CAAC,WAAW,EAAE,WAAW,CAAC;;AAGlD,IAAA,QAAQ,GAAG,gBAAgB,CAAC,eAAe,EAAE,+BAA+B,CAAC;;;;IAK7E,MAAM,GAAG,QAAQ,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE;+EAAC;;;;IAI3C,OAAO,GAAG,QAAQ,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE;gFAAC;AAE7C,IAAA,YAAY,GAAG,QAAQ,CAAC,MACzC,IAAI,CAAC,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,GAAG,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,EAAE,CAAC;qFAC5E;AAEkB,IAAA,SAAS,GAAG,QAAQ,CAAC,MAAK;QAC3C,MAAM,KAAK,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,EAAE,KAAK;AACrC,QAAA,OAAO,KAAK,GAAG,CAAA,EAAG,KAAK,MAAM,IAAI,CAAC,YAAY,EAAE,CAAA,CAAE,G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O,IAAI,CAAC,GAAG,EAAE,KAAK,KAAK,KAAK;IAClC;uGAzPW,MAAM,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,OAAA,EAAA,CAAA;wGAAN,MAAM,EAAA,CAAA;;2FAAN,MAAM,EAAA,UAAA,EAAA,CAAA;kBADlB;;;AC3ED;;AAEG;;;;"}
1
+ {"version":3,"file":"ngwr-tour.mjs","sources":["../../../projects/lib/tour/tour-popup.ts","../../../projects/lib/tour/tour-popup.html","../../../projects/lib/tour/tour.ts","../../../projects/lib/tour/ngwr-tour.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, InjectionToken, ViewEncapsulation, computed, inject } from '@angular/core';\n\nimport { WrButton } from 'ngwr/button';\nimport { readI18nText, useI18nFormatter } from 'ngwr/i18n';\n\nimport type { WrTourStep } from './interfaces';\n\n/** What the popup needs from the running tour, without importing the service (cycle). */\nexport interface WrTourController {\n readonly index: () => number;\n readonly total: () => number;\n readonly step: () => WrTourStep | null;\n /**\n * Whether this is the last step the user will actually see — the service looks\n * ahead for a reachable one, because a trailing step whose target is missing gets\n * skipped and the raw count would call the final card \"Next\".\n */\n readonly isLast: () => boolean;\n /**\n * Whether this is the first step the user will actually see — the service looks\n * BEHIND for a reachable one, for the mirror reason: a leading step whose target\n * is missing gets skipped, so the tour opens on a later index and the raw one\n * would put a Back button on the very first card.\n */\n readonly isFirst: () => boolean;\n next(): void;\n prev(): void;\n stop(): void;\n}\n\n/** Provided by `WrTour` when it attaches the popup portal. */\nexport const WR_TOUR_STEP = new InjectionToken<WrTourController>('WR_TOUR_STEP');\n\n/**\n * The card a tour shows next to the spotlit element. Rendered by `WrTour` into\n * a CDK overlay — not something you place yourself.\n *\n * @see https://ngwr.dev/reference/services/tour\n */\n@Component({\n selector: 'wr-tour-popup',\n templateUrl: './tour-popup.html',\n encapsulation: ViewEncapsulation.None,\n host: { class: 'wr-tour-popup', role: 'dialog', 'aria-modal': 'true', '[attr.aria-label]': 'ariaLabel()' },\n imports: [WrButton],\n})\nexport class WrTourPopup {\n protected readonly tour = inject(WR_TOUR_STEP);\n\n // `readI18nText`, not `useI18nText`: these have no consumer-facing input to\n // forward. Both helpers are reactive.\n protected readonly nextLabel = readI18nText('tour.next', 'Next');\n protected readonly backLabel = readI18nText('tour.back', 'Back');\n protected readonly doneLabel = readI18nText('tour.done', 'Done');\n protected readonly skipLabel = readI18nText('tour.skip', 'Skip tour');\n\n /** `Step {{current}} of {{total}}` — also the dialog's accessible name. */\n protected readonly progress = useI18nFormatter('tour.progress', 'Step {{current}} of {{total}}');\n\n // From the service, not `index() >= total() - 1`: a trailing step whose target is\n // missing gets skipped, so the raw count called the final card \"Next\" and then\n // ended the tour when it was pressed.\n protected readonly isLast = computed(() => this.tour.isLast());\n // Same story at the other end, and the same fix: `index() <= 0` rendered a Back\n // button on the first card of a tour whose leading step had been skipped, and\n // `prev()` walks off the start and returns — so the button did nothing at all.\n protected readonly isFirst = computed(() => this.tour.isFirst());\n\n protected readonly progressText = computed(() =>\n this.progress({ current: this.tour.index() + 1, total: this.tour.total() })\n );\n\n protected readonly ariaLabel = computed(() => {\n const title = this.tour.step()?.title;\n return title ? `${title} — ${this.progressText()}` : this.progressText();\n });\n}\n","@let step = tour.step();\n\n<p class=\"wr-tour-popup__progress\">{{ progressText() }}</p>\n\n@if (step?.title; as title) {\n <h2 class=\"wr-tour-popup__title\">{{ title }}</h2>\n}\n\n<p class=\"wr-tour-popup__content\">{{ step?.content }}</p>\n\n<div class=\"wr-tour-popup__actions\">\n <!-- The three buttons are told apart by a class rather than by their position in\n the row: the back button is conditional, so an index means one thing on the\n first step and another everywhere else — and the labels are translated. -->\n <button\n wr-btn\n type=\"button\"\n size=\"sm\"\n color=\"medium\"\n outlined\n class=\"wr-tour-popup__action wr-tour-popup__action--skip\"\n (click)=\"tour.stop()\"\n >\n {{ skipLabel() }}\n </button>\n\n <span class=\"wr-tour-popup__spacer\"></span>\n\n @if (!isFirst()) {\n <button\n wr-btn\n type=\"button\"\n size=\"sm\"\n outlined\n class=\"wr-tour-popup__action wr-tour-popup__action--back\"\n (click)=\"tour.prev()\"\n >\n {{ backLabel() }}\n </button>\n }\n <button\n wr-btn\n type=\"button\"\n size=\"sm\"\n color=\"primary\"\n class=\"wr-tour-popup__action wr-tour-popup__action--next\"\n (click)=\"tour.next()\"\n >\n {{ isLast() ? doneLabel() : nextLabel() }}\n </button>\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 ConfigurableFocusTrap, ConfigurableFocusTrapFactory } from '@angular/cdk/a11y';\nimport { Directionality } from '@angular/cdk/bidi';\nimport { type ConnectedPosition, type OverlayRef, ScrollStrategyOptions } from '@angular/cdk/overlay';\nimport { ComponentPortal } from '@angular/cdk/portal';\nimport { isPlatformBrowser } from '@angular/common';\nimport {\n DOCUMENT,\n DestroyRef,\n EnvironmentInjector,\n Injector,\n PLATFORM_ID,\n Service,\n computed,\n inject,\n signal,\n} from '@angular/core';\n\nimport { WR_OVERLAY, wrFollowDirection, wrMirrorOffsets } from 'ngwr/overlay';\n\nimport type { WrTourPlacement, WrTourStep } from './interfaces';\nimport { WR_TOUR_STEP, WrTourPopup } from './tour-popup';\n\n/** Fallback order per preferred side — the opposite side first, then the sides. */\nconst FALLBACKS: Record<WrTourPlacement, readonly WrTourPlacement[]> = {\n bottom: ['bottom', 'top', 'right', 'left'],\n top: ['top', 'bottom', 'right', 'left'],\n left: ['left', 'right', 'bottom', 'top'],\n right: ['right', 'left', 'bottom', 'top'],\n};\n\nconst CONNECTED: Record<\n WrTourPlacement,\n {\n originX: 'start' | 'center' | 'end';\n originY: 'top' | 'center' | 'bottom';\n overlayX: 'start' | 'center' | 'end';\n overlayY: 'top' | 'center' | 'bottom';\n }\n> = {\n bottom: { originX: 'center', originY: 'bottom', overlayX: 'center', overlayY: 'top' },\n top: { originX: 'center', originY: 'top', overlayX: 'center', overlayY: 'bottom' },\n left: { originX: 'start', originY: 'center', overlayX: 'end', overlayY: 'center' },\n right: { originX: 'end', originY: 'center', overlayX: 'start', overlayY: 'center' },\n};\n\n/**\n * Guided product tour: a spotlight over one element at a time plus a popup\n * explaining it.\n *\n * Steps are data, not markup — call `start()` with an array and the service owns\n * the overlay, the cut-out, focus and the keyboard. A step whose target is not\n * on the page is skipped rather than shown floating, so a tour survives a\n * feature being hidden behind a flag or a permission.\n *\n * @example\n * ```ts\n * private readonly tour = inject(WrTour);\n *\n * showMeAround(): void {\n * this.tour.start([\n * { target: '[data-tour=\"search\"]', title: 'Search', content: 'Find anything by name.' },\n * { target: '[data-tour=\"filters\"]', content: 'Narrow the list down.', placement: 'right' },\n * ]);\n * }\n * ```\n *\n * @see https://ngwr.dev/reference/services/tour\n */\n@Service()\nexport class WrTour {\n private readonly overlay = inject(WR_OVERLAY);\n private readonly dir = inject(Directionality, { optional: true });\n private readonly scrollStrategies = inject(ScrollStrategyOptions);\n private readonly injector = inject(EnvironmentInjector);\n private readonly focusTrapFactory = inject(ConfigurableFocusTrapFactory);\n private readonly document = inject(DOCUMENT);\n private readonly isBrowser = isPlatformBrowser(inject(PLATFORM_ID));\n\n private readonly steps = signal<readonly WrTourStep[]>([]);\n private readonly cursor = signal(-1);\n\n private overlayRef: OverlayRef | null = null;\n private focusTrap: ConfigurableFocusTrap | null = null;\n private spotlight: HTMLElement | null = null;\n private detachKeydown: (() => void) | null = null;\n private detachReposition: (() => void) | null = null;\n private restoreFocus: HTMLElement | null = null;\n\n /** Whether a tour is running. */\n readonly active = computed(() => this.cursor() >= 0);\n\n /** Zero-based index of the current step, `-1` when idle. */\n readonly index = computed(() => this.cursor());\n\n /** How many steps this tour has. */\n readonly total = computed(() => this.steps().length);\n\n /** The step being shown, or `null` when idle. */\n readonly step = computed<WrTourStep | null>(() => this.steps()[this.cursor()] ?? null);\n\n // Whether any step AFTER the current one can actually be shown. Settled once per\n // move, in `goTo`, because reachability is a DOM question and not a signal.\n private readonly noStepAfter = signal(false);\n\n // The same question looking the other way. Settled in `goTo` for the same reason.\n private readonly noStepBefore = signal(true);\n\n /**\n * Whether this is the last step the user will see. Not `index() === total() - 1`:\n * a trailing step whose target is missing is skipped, so comparing against the\n * raw count left the primary button reading \"Next\" on the final card and then\n * ending the tour when it was pressed.\n */\n readonly isLast = computed(() => this.noStepAfter());\n\n /**\n * Whether this is the first step the user will see. Not `index() === 0`, for the\n * mirror of the reason above: a LEADING step whose target is missing is skipped,\n * so the tour opens on a later index and the raw one put a Back button on the\n * first card — one that did nothing at all, because `prev()` walks off the start\n * and returns without moving.\n */\n readonly isFirst = computed(() => this.noStepBefore());\n\n constructor() {\n // Everything this service owns lives OUTSIDE its own injector: a CDK overlay, a\n // div appended to `document.body`, a document keydown listener and two window\n // listeners. Nothing removes them when the injector goes, so a tour running at\n // teardown left its cut-out on the page.\n inject(DestroyRef).onDestroy(() => this.stop());\n }\n\n /**\n * Begin a tour. Restarts if one is already running. A no-op under SSR — a\n * tour is a client-side affordance and there is nothing to spotlight on the\n * server.\n */\n start(steps: readonly WrTourStep[]): void {\n if (!this.isBrowser || steps.length === 0) return;\n this.stop();\n this.steps.set(steps);\n this.restoreFocus = this.document.activeElement as HTMLElement | null;\n this.goTo(0, 1);\n }\n\n /** Advance; finishes the tour past the last step. */\n next(): void {\n this.goTo(this.cursor() + 1, 1);\n }\n\n /** Go back; stays put on the first step. */\n prev(): void {\n this.goTo(this.cursor() - 1, -1);\n }\n\n /** End the tour and return focus where it was. */\n stop(): void {\n this.teardownStep();\n this.steps.set([]);\n this.cursor.set(-1);\n this.restoreFocus?.focus?.();\n this.restoreFocus = null;\n }\n\n /**\n * Move to `index`, skipping steps whose target is not in the DOM. `direction`\n * says which way to keep skipping, so a missing step never traps the tour\n * between two dead ends.\n */\n private goTo(index: number, direction: 1 | -1): void {\n const steps = this.steps();\n let i = index;\n while (i >= 0 && i < steps.length && this.resolve(steps[i]) === null) i += direction;\n\n if (i < 0) {\n // Ran off the start while going back — stay where we were.\n return;\n }\n if (i >= steps.length) {\n this.stop();\n return;\n }\n\n this.teardownStep();\n this.cursor.set(i);\n this.noStepAfter.set(!this.anyResolvableAfter(i));\n this.noStepBefore.set(!this.anyResolvableBefore(i));\n this.openStep(steps[i]);\n }\n\n /** Whether the tour has a step past `index` that can actually be shown. */\n private anyResolvableAfter(index: number): boolean {\n const steps = this.steps();\n for (let i = index + 1; i < steps.length; i += 1) {\n if (this.resolve(steps[i]) !== null) return true;\n }\n return false;\n }\n\n /** Whether the tour has a step before `index` that can actually be shown. */\n private anyResolvableBefore(index: number): boolean {\n const steps = this.steps();\n for (let i = index - 1; i >= 0; i -= 1) {\n if (this.resolve(steps[i]) !== null) return true;\n }\n return false;\n }\n\n private resolve(step: WrTourStep): HTMLElement | null {\n if (typeof step.target !== 'string') return step.target.isConnected ? step.target : null;\n return this.document.querySelector<HTMLElement>(step.target);\n }\n\n private openStep(step: WrTourStep): void {\n const target = this.resolve(step);\n if (!target) return;\n\n target.scrollIntoView({ block: 'center', inline: 'nearest', behavior: 'smooth' });\n\n // The cut-out is a bare element sized to the target with an enormous spread\n // shadow: everything outside it dims, the target itself stays untouched.\n // Cheaper and far more robust than a clip-path polygon, and it needs no\n // recompute when the page reflows beyond moving the box.\n const spotlight = this.document.createElement('div');\n spotlight.className = 'wr-tour__spotlight';\n spotlight.setAttribute('aria-hidden', 'true');\n this.document.body.appendChild(spotlight);\n this.spotlight = spotlight;\n this.placeSpotlight(target);\n\n const placement = step.placement ?? 'bottom';\n const positionStrategy = this.overlay\n .position()\n .flexibleConnectedTo(target)\n .withPositions(this.stepPositions(placement, this.isRtl()))\n .withPush(true);\n\n this.overlayRef = this.overlay.create({\n positionStrategy,\n scrollStrategy: this.scrollStrategies.reposition(),\n panelClass: 'wr-tour-overlay',\n });\n\n // The CDK read the direction once, just now. A tour is long-lived by nature\n // — a step can sit on screen while the user changes a language setting — and\n // without this the card keeps the direction the step opened in, with the\n // 12px gap that held it clear of the spotlight now pointing into it.\n // Per step, because every move disposes this ref and builds the next.\n wrFollowDirection(this.overlayRef, this.dir, this.injector, direction =>\n positionStrategy.withPositions(this.stepPositions(placement, direction === 'rtl'))\n );\n\n const portal = new ComponentPortal(\n WrTourPopup,\n null,\n Injector.create({ parent: this.injector, providers: [{ provide: WR_TOUR_STEP, useValue: this }] })\n );\n const ref = this.overlayRef.attach(portal);\n\n // Kept on the instance, not in a local: a trap registers with CDK's\n // `FocusTrapManager` and installs a capture-phase document focus listener, so an\n // undestroyed one leaks per STEP and every tour left a stack of them behind.\n this.focusTrap = this.focusTrapFactory.create(ref.location.nativeElement as HTMLElement);\n void this.focusTrap.focusInitialElementWhenReady();\n\n const onKey = (event: KeyboardEvent): void => {\n // The listener is on the document, so a step shown over a dialog would see the\n // Escape that dialog just handled and close the tour too.\n if (event.key === 'Escape' && !event.defaultPrevented) {\n event.preventDefault();\n this.stop();\n }\n };\n this.document.addEventListener('keydown', onKey);\n this.detachKeydown = () => this.document.removeEventListener('keydown', onKey);\n\n const reposition = (): void => this.placeSpotlight(target);\n window.addEventListener('scroll', reposition, true);\n window.addEventListener('resize', reposition);\n this.detachReposition = () => {\n window.removeEventListener('scroll', reposition, true);\n window.removeEventListener('resize', reposition);\n };\n }\n\n /**\n * The card's fallback table for one placement, with its inline offsets already\n * mirrored. Built per call rather than per step: the direction can change while\n * the step is on screen, and a table is what has to be rebuilt when it does.\n */\n private stepPositions(placement: WrTourPlacement, isRtl: boolean): ConnectedPosition[] {\n return wrMirrorOffsets(\n FALLBACKS[placement].map(side => ({\n ...CONNECTED[side],\n offsetY: side === 'bottom' ? 12 : side === 'top' ? -12 : 0,\n offsetX: side === 'right' ? 12 : side === 'left' ? -12 : 0,\n })),\n isRtl\n );\n }\n\n private placeSpotlight(target: HTMLElement): void {\n const el = this.spotlight;\n if (!el) return;\n const r = target.getBoundingClientRect();\n const pad = 6;\n el.style.top = `${r.top - pad}px`;\n el.style.left = `${r.left - pad}px`;\n el.style.width = `${r.width + pad * 2}px`;\n el.style.height = `${r.height + pad * 2}px`;\n }\n\n private teardownStep(): void {\n this.focusTrap?.destroy();\n this.focusTrap = null;\n this.detachKeydown?.();\n this.detachKeydown = null;\n this.detachReposition?.();\n this.detachReposition = null;\n this.overlayRef?.dispose();\n this.overlayRef = null;\n this.spotlight?.remove();\n this.spotlight = null;\n }\n\n /**\n * Whether the app reads right-to-left.\n *\n * Optional inject: `Directionality` is root-provided, so this is never null in\n * an app — but a bare `TestBed` that provides nothing should still get a\n * component that works, and defaulting to LTR is the honest fallback.\n */\n private isRtl(): boolean {\n return this.dir?.value === 'rtl';\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;;;;AAAA;;;;;AAKG;AAgCH;AACO,MAAM,YAAY,GAAG,IAAI,cAAc,CAAmB,cAAc,CAAC;AAEhF;;;;;AAKG;MAQU,WAAW,CAAA;AACH,IAAA,IAAI,GAAG,MAAM,CAAC,YAAY,CAAC;;;AAI3B,IAAA,SAAS,GAAG,YAAY,CAAC,WAAW,EAAE,MAAM,CAAC;AAC7C,IAAA,SAAS,GAAG,YAAY,CAAC,WAAW,EAAE,MAAM,CAAC;AAC7C,IAAA,SAAS,GAAG,YAAY,CAAC,WAAW,EAAE,MAAM,CAAC;AAC7C,IAAA,SAAS,GAAG,YAAY,CAAC,WAAW,EAAE,WAAW,CAAC;;AAGlD,IAAA,QAAQ,GAAG,gBAAgB,CAAC,eAAe,EAAE,+BAA+B,CAAC;;;;IAK7E,MAAM,GAAG,QAAQ,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE;+EAAC;;;;IAI3C,OAAO,GAAG,QAAQ,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE;gFAAC;AAE7C,IAAA,YAAY,GAA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AAA,CAAI;AACnC,QAAA,EAAE,CAAC,KAAK,CAAC,KAAK,GAAG,CAAA,EAAG,CAAC,CAAC,KAAK,GAAG,GAAG,GAAG,CAAC,IAAI;AACzC,QAAA,EAAE,CAAC,KAAK,CAAC,MAAM,GAAG,CAAA,EAAG,CAAC,CAAC,MAAM,GAAG,GAAG,GAAG,CAAC,IAAI;IAC7C;IAEQ,YAAY,GAAA;AAClB,QAAA,IAAI,CAAC,SAAS,EAAE,OAAO,EAAE;AACzB,QAAA,IAAI,CAAC,SAAS,GAAG,IAAI;AACrB,QAAA,IAAI,CAAC,aAAa,IAAI;AACtB,QAAA,IAAI,CAAC,aAAa,GAAG,IAAI;AACzB,QAAA,IAAI,CAAC,gBAAgB,IAAI;AACzB,QAAA,IAAI,CAAC,gBAAgB,GAAG,IAAI;AAC5B,QAAA,IAAI,CAAC,UAAU,EAAE,OAAO,EAAE;AAC1B,QAAA,IAAI,CAAC,UAAU,GAAG,IAAI;AACtB,QAAA,IAAI,CAAC,SAAS,EAAE,MAAM,EAAE;AACxB,QAAA,IAAI,CAAC,SAAS,GAAG,IAAI;IACvB;AAEA;;;;;;AAMG;IACK,KAAK,GAAA;AACX,QAAA,OAAO,IAAI,CAAC,GAAG,EAAE,KAAK,KAAK,KAAK;IAClC;uGAzQW,MAAM,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,OAAA,EAAA,CAAA;wGAAN,MAAM,EAAA,CAAA;;2FAAN,MAAM,EAAA,UAAA,EAAA,CAAA;kBADlB;;;AC3ED;;AAEG;;;;"}
@@ -8,7 +8,7 @@ import { input, model, computed, output, inject, ElementRef, ViewContainerRef, D
8
8
  import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
9
9
  import { useFormFieldAria } from 'ngwr/form';
10
10
  import { useI18nText, readI18nText, useI18nFormatter } from 'ngwr/i18n';
11
- import { WR_OVERLAY, WrOutsideClick } from 'ngwr/overlay';
11
+ import { WR_OVERLAY, WrOutsideClick, wrFollowDirection } from 'ngwr/overlay';
12
12
 
13
13
  /**
14
14
  * @license
@@ -187,7 +187,8 @@ class WrTree {
187
187
  * anyway, and a missing one simply reads as `ltr`.
188
188
  *
189
189
  * Read at keystroke time rather than cached, so a runtime `dir` flip needs no
190
- * subscription to `change`.
190
+ * subscription to `change` — the overlay is the half that does, and
191
+ * `wrFollowDirection` in `openOverlay()` is where that lives.
191
192
  */
192
193
  dir = inject(Directionality, { optional: true });
193
194
  /** Currently focused row's index in the flattened visible list. */
@@ -831,6 +832,12 @@ class WrTree {
831
832
  width: this.host.nativeElement.getBoundingClientRect().width,
832
833
  panelClass: 'wr-tree-overlay',
833
834
  });
835
+ // The pane is appended to `<body>`, so the only thing telling it which way
836
+ // to read is the `dir` the CDK captured when this ref was created. The
837
+ // arrow-key mapping above reads `Directionality` LIVE, so without this a
838
+ // mid-session flip left ArrowLeft opening branches the panel still indented
839
+ // rightward. Ends with the ref; reopening installs a new one.
840
+ wrFollowDirection(this.overlayRef, this.dir, this.injector);
834
841
  this.overlayRef.attach(new TemplatePortal(tpl, this.vcr));
835
842
  // The panel owns the keyboard from here, in BOTH render shapes. `onKeydown`
836
843
  // lives on the `<ul>` inside the portal, and the trigger's own handler