ngwr 16.0.0 → 16.1.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 (268) hide show
  1. package/badge/styles/_tag.scss +8 -4
  2. package/button/styles/_index.scss +13 -7
  3. package/cascader/styles/_rules.scss +4 -2
  4. package/checkbox/styles/_index.scss +4 -2
  5. package/date-picker/styles/_index.scss +6 -2
  6. package/date-stamp/styles/_index.scss +38 -0
  7. package/dialog/styles/_index.scss +38 -0
  8. package/fesm2022/internal-CVLvP9b_.mjs +33 -0
  9. package/fesm2022/internal-CVLvP9b_.mjs.map +1 -0
  10. package/fesm2022/ngwr-alert.mjs +11 -7
  11. package/fesm2022/ngwr-alert.mjs.map +1 -1
  12. package/fesm2022/ngwr-avatar.mjs +11 -7
  13. package/fesm2022/ngwr-avatar.mjs.map +1 -1
  14. package/fesm2022/ngwr-back-top.mjs +10 -6
  15. package/fesm2022/ngwr-back-top.mjs.map +1 -1
  16. package/fesm2022/ngwr-badge.mjs +18 -6
  17. package/fesm2022/ngwr-badge.mjs.map +1 -1
  18. package/fesm2022/ngwr-burger.mjs +9 -6
  19. package/fesm2022/ngwr-burger.mjs.map +1 -1
  20. package/fesm2022/ngwr-button.mjs +8 -4
  21. package/fesm2022/ngwr-button.mjs.map +1 -1
  22. package/fesm2022/ngwr-calendar.mjs +19 -8
  23. package/fesm2022/ngwr-calendar.mjs.map +1 -1
  24. package/fesm2022/ngwr-card.mjs +9 -5
  25. package/fesm2022/ngwr-card.mjs.map +1 -1
  26. package/fesm2022/ngwr-cascader.mjs +11 -5
  27. package/fesm2022/ngwr-cascader.mjs.map +1 -1
  28. package/fesm2022/ngwr-charts-calendar-heatmap.mjs +5 -2
  29. package/fesm2022/ngwr-charts-calendar-heatmap.mjs.map +1 -1
  30. package/fesm2022/ngwr-checkbox.mjs +10 -6
  31. package/fesm2022/ngwr-checkbox.mjs.map +1 -1
  32. package/fesm2022/ngwr-clipboard.mjs +2 -1
  33. package/fesm2022/ngwr-clipboard.mjs.map +1 -1
  34. package/fesm2022/ngwr-collapse.mjs +9 -5
  35. package/fesm2022/ngwr-collapse.mjs.map +1 -1
  36. package/fesm2022/ngwr-color-picker.mjs +4 -2
  37. package/fesm2022/ngwr-color-picker.mjs.map +1 -1
  38. package/fesm2022/ngwr-comment.mjs +13 -7
  39. package/fesm2022/ngwr-comment.mjs.map +1 -1
  40. package/fesm2022/ngwr-compare.mjs +9 -3
  41. package/fesm2022/ngwr-compare.mjs.map +1 -1
  42. package/fesm2022/ngwr-context-menu.mjs +4 -2
  43. package/fesm2022/ngwr-context-menu.mjs.map +1 -1
  44. package/fesm2022/ngwr-copy-value.mjs +11 -6
  45. package/fesm2022/ngwr-copy-value.mjs.map +1 -1
  46. package/fesm2022/ngwr-date-picker.mjs +86 -30
  47. package/fesm2022/ngwr-date-picker.mjs.map +1 -1
  48. package/fesm2022/ngwr-date-stamp-testing.mjs +34 -0
  49. package/fesm2022/ngwr-date-stamp-testing.mjs.map +1 -0
  50. package/fesm2022/ngwr-date-stamp.mjs +149 -0
  51. package/fesm2022/ngwr-date-stamp.mjs.map +1 -0
  52. package/fesm2022/ngwr-date.mjs +279 -50
  53. package/fesm2022/ngwr-date.mjs.map +1 -1
  54. package/fesm2022/ngwr-descriptions.mjs +9 -5
  55. package/fesm2022/ngwr-descriptions.mjs.map +1 -1
  56. package/fesm2022/ngwr-dialog-testing.mjs +23 -2
  57. package/fesm2022/ngwr-dialog-testing.mjs.map +1 -1
  58. package/fesm2022/ngwr-dialog.mjs +45 -16
  59. package/fesm2022/ngwr-dialog.mjs.map +1 -1
  60. package/fesm2022/ngwr-directives.mjs +102 -11
  61. package/fesm2022/ngwr-directives.mjs.map +1 -1
  62. package/fesm2022/ngwr-divider.mjs +4 -2
  63. package/fesm2022/ngwr-divider.mjs.map +1 -1
  64. package/fesm2022/ngwr-drawer.mjs +29 -3
  65. package/fesm2022/ngwr-drawer.mjs.map +1 -1
  66. package/fesm2022/ngwr-dropdown.mjs +4 -2
  67. package/fesm2022/ngwr-dropdown.mjs.map +1 -1
  68. package/fesm2022/ngwr-editor.mjs +5 -2
  69. package/fesm2022/ngwr-editor.mjs.map +1 -1
  70. package/fesm2022/ngwr-event-calendar.mjs +4 -2
  71. package/fesm2022/ngwr-event-calendar.mjs.map +1 -1
  72. package/fesm2022/ngwr-file-upload.mjs +9 -3
  73. package/fesm2022/ngwr-file-upload.mjs.map +1 -1
  74. package/fesm2022/ngwr-form.mjs +18 -6
  75. package/fesm2022/ngwr-form.mjs.map +1 -1
  76. package/fesm2022/ngwr-i18n-ar.mjs +2 -0
  77. package/fesm2022/ngwr-i18n-ar.mjs.map +1 -1
  78. package/fesm2022/ngwr-i18n-cs.mjs +2 -0
  79. package/fesm2022/ngwr-i18n-cs.mjs.map +1 -1
  80. package/fesm2022/ngwr-i18n-de.mjs +2 -0
  81. package/fesm2022/ngwr-i18n-de.mjs.map +1 -1
  82. package/fesm2022/ngwr-i18n-en.mjs +2 -0
  83. package/fesm2022/ngwr-i18n-en.mjs.map +1 -1
  84. package/fesm2022/ngwr-i18n-es.mjs +2 -0
  85. package/fesm2022/ngwr-i18n-es.mjs.map +1 -1
  86. package/fesm2022/ngwr-i18n-fr.mjs +2 -0
  87. package/fesm2022/ngwr-i18n-fr.mjs.map +1 -1
  88. package/fesm2022/ngwr-i18n-he.mjs +2 -0
  89. package/fesm2022/ngwr-i18n-he.mjs.map +1 -1
  90. package/fesm2022/ngwr-i18n-hi.mjs +2 -0
  91. package/fesm2022/ngwr-i18n-hi.mjs.map +1 -1
  92. package/fesm2022/ngwr-i18n-id.mjs +2 -0
  93. package/fesm2022/ngwr-i18n-id.mjs.map +1 -1
  94. package/fesm2022/ngwr-i18n-it.mjs +2 -0
  95. package/fesm2022/ngwr-i18n-it.mjs.map +1 -1
  96. package/fesm2022/ngwr-i18n-ja.mjs +2 -0
  97. package/fesm2022/ngwr-i18n-ja.mjs.map +1 -1
  98. package/fesm2022/ngwr-i18n-ko.mjs +2 -0
  99. package/fesm2022/ngwr-i18n-ko.mjs.map +1 -1
  100. package/fesm2022/ngwr-i18n-nl.mjs +2 -0
  101. package/fesm2022/ngwr-i18n-nl.mjs.map +1 -1
  102. package/fesm2022/ngwr-i18n-pl.mjs +2 -0
  103. package/fesm2022/ngwr-i18n-pl.mjs.map +1 -1
  104. package/fesm2022/ngwr-i18n-pt.mjs +2 -0
  105. package/fesm2022/ngwr-i18n-pt.mjs.map +1 -1
  106. package/fesm2022/ngwr-i18n-ru.mjs +2 -0
  107. package/fesm2022/ngwr-i18n-ru.mjs.map +1 -1
  108. package/fesm2022/ngwr-i18n-sv.mjs +2 -0
  109. package/fesm2022/ngwr-i18n-sv.mjs.map +1 -1
  110. package/fesm2022/ngwr-i18n-tr.mjs +2 -0
  111. package/fesm2022/ngwr-i18n-tr.mjs.map +1 -1
  112. package/fesm2022/ngwr-i18n-uk.mjs +2 -0
  113. package/fesm2022/ngwr-i18n-uk.mjs.map +1 -1
  114. package/fesm2022/ngwr-i18n-vi.mjs +2 -0
  115. package/fesm2022/ngwr-i18n-vi.mjs.map +1 -1
  116. package/fesm2022/ngwr-i18n-zh-tw.mjs +2 -0
  117. package/fesm2022/ngwr-i18n-zh-tw.mjs.map +1 -1
  118. package/fesm2022/ngwr-i18n-zh.mjs +2 -0
  119. package/fesm2022/ngwr-i18n-zh.mjs.map +1 -1
  120. package/fesm2022/ngwr-i18n.mjs +34 -8
  121. package/fesm2022/ngwr-i18n.mjs.map +1 -1
  122. package/fesm2022/ngwr-input-number.mjs +9 -3
  123. package/fesm2022/ngwr-input-number.mjs.map +1 -1
  124. package/fesm2022/ngwr-input-otp.mjs +4 -2
  125. package/fesm2022/ngwr-input-otp.mjs.map +1 -1
  126. package/fesm2022/ngwr-input.mjs +20 -10
  127. package/fesm2022/ngwr-input.mjs.map +1 -1
  128. package/fesm2022/ngwr-keyboard.mjs +9 -3
  129. package/fesm2022/ngwr-keyboard.mjs.map +1 -1
  130. package/fesm2022/ngwr-knob.mjs +9 -3
  131. package/fesm2022/ngwr-knob.mjs.map +1 -1
  132. package/fesm2022/ngwr-layout.mjs +13 -5
  133. package/fesm2022/ngwr-layout.mjs.map +1 -1
  134. package/fesm2022/ngwr-lightbox.mjs +9 -5
  135. package/fesm2022/ngwr-lightbox.mjs.map +1 -1
  136. package/fesm2022/ngwr-list.mjs +13 -5
  137. package/fesm2022/ngwr-list.mjs.map +1 -1
  138. package/fesm2022/ngwr-load-state.mjs +9 -5
  139. package/fesm2022/ngwr-load-state.mjs.map +1 -1
  140. package/fesm2022/ngwr-overlay.mjs +84 -1
  141. package/fesm2022/ngwr-overlay.mjs.map +1 -1
  142. package/fesm2022/ngwr-pagination.mjs +3 -2
  143. package/fesm2022/ngwr-pagination.mjs.map +1 -1
  144. package/fesm2022/ngwr-pipes.mjs +21 -5
  145. package/fesm2022/ngwr-pipes.mjs.map +1 -1
  146. package/fesm2022/ngwr-popover.mjs +93 -4
  147. package/fesm2022/ngwr-popover.mjs.map +1 -1
  148. package/fesm2022/ngwr-progress.mjs +4 -2
  149. package/fesm2022/ngwr-progress.mjs.map +1 -1
  150. package/fesm2022/ngwr-radio.mjs +9 -5
  151. package/fesm2022/ngwr-radio.mjs.map +1 -1
  152. package/fesm2022/ngwr-rating.mjs +9 -3
  153. package/fesm2022/ngwr-rating.mjs.map +1 -1
  154. package/fesm2022/ngwr-resizable.mjs +503 -0
  155. package/fesm2022/ngwr-resizable.mjs.map +1 -0
  156. package/fesm2022/ngwr-result.mjs +9 -5
  157. package/fesm2022/ngwr-result.mjs.map +1 -1
  158. package/fesm2022/ngwr-segmented.mjs +4 -2
  159. package/fesm2022/ngwr-segmented.mjs.map +1 -1
  160. package/fesm2022/ngwr-select.mjs +13 -5
  161. package/fesm2022/ngwr-select.mjs.map +1 -1
  162. package/fesm2022/ngwr-skeleton.mjs +4 -2
  163. package/fesm2022/ngwr-skeleton.mjs.map +1 -1
  164. package/fesm2022/ngwr-slider.mjs +4 -2
  165. package/fesm2022/ngwr-slider.mjs.map +1 -1
  166. package/fesm2022/ngwr-speed-dial.mjs +4 -2
  167. package/fesm2022/ngwr-speed-dial.mjs.map +1 -1
  168. package/fesm2022/ngwr-spinner.mjs +4 -2
  169. package/fesm2022/ngwr-spinner.mjs.map +1 -1
  170. package/fesm2022/ngwr-splitter.mjs +17 -21
  171. package/fesm2022/ngwr-splitter.mjs.map +1 -1
  172. package/fesm2022/ngwr-stepper.mjs +9 -3
  173. package/fesm2022/ngwr-stepper.mjs.map +1 -1
  174. package/fesm2022/ngwr-switch.mjs +9 -5
  175. package/fesm2022/ngwr-switch.mjs.map +1 -1
  176. package/fesm2022/ngwr-table-testing.mjs +5 -1
  177. package/fesm2022/ngwr-table-testing.mjs.map +1 -1
  178. package/fesm2022/ngwr-table.mjs +167 -10
  179. package/fesm2022/ngwr-table.mjs.map +1 -1
  180. package/fesm2022/ngwr-textarea.mjs +9 -3
  181. package/fesm2022/ngwr-textarea.mjs.map +1 -1
  182. package/fesm2022/ngwr-timeline.mjs +18 -8
  183. package/fesm2022/ngwr-timeline.mjs.map +1 -1
  184. package/fesm2022/ngwr-toast-testing.mjs +6 -1
  185. package/fesm2022/ngwr-toast-testing.mjs.map +1 -1
  186. package/fesm2022/ngwr-toast.mjs +529 -104
  187. package/fesm2022/ngwr-toast.mjs.map +1 -1
  188. package/fesm2022/ngwr-transfer.mjs +4 -2
  189. package/fesm2022/ngwr-transfer.mjs.map +1 -1
  190. package/fesm2022/ngwr-tree.mjs +4 -2
  191. package/fesm2022/ngwr-tree.mjs.map +1 -1
  192. package/fesm2022/ngwr-typography.mjs +9 -3
  193. package/fesm2022/ngwr-typography.mjs.map +1 -1
  194. package/fesm2022/ngwr-utils-router.mjs +18 -2
  195. package/fesm2022/ngwr-utils-router.mjs.map +1 -1
  196. package/fesm2022/ngwr-utils.mjs +9 -2
  197. package/fesm2022/ngwr-utils.mjs.map +1 -1
  198. package/fesm2022/ngwr-version.mjs +1 -1
  199. package/fesm2022/ngwr-version.mjs.map +1 -1
  200. package/fesm2022/ngwr-window.mjs +7 -4
  201. package/fesm2022/ngwr-window.mjs.map +1 -1
  202. package/fesm2022/ngwr.mjs.map +1 -1
  203. package/i18n/ar.json +6 -0
  204. package/i18n/cs.json +6 -0
  205. package/i18n/de.json +6 -0
  206. package/i18n/en.json +6 -0
  207. package/i18n/es.json +6 -0
  208. package/i18n/fr.json +6 -0
  209. package/i18n/he.json +6 -0
  210. package/i18n/hi.json +6 -0
  211. package/i18n/id.json +6 -0
  212. package/i18n/it.json +6 -0
  213. package/i18n/ja.json +6 -0
  214. package/i18n/ko.json +6 -0
  215. package/i18n/nl.json +6 -0
  216. package/i18n/pl.json +6 -0
  217. package/i18n/pt.json +6 -0
  218. package/i18n/ru.json +6 -0
  219. package/i18n/sv.json +6 -0
  220. package/i18n/tr.json +6 -0
  221. package/i18n/uk.json +6 -0
  222. package/i18n/vi.json +6 -0
  223. package/i18n/zh-TW.json +6 -0
  224. package/i18n/zh.json +6 -0
  225. package/input/styles/_index.scss +10 -5
  226. package/input-number/styles/_index.scss +6 -3
  227. package/input-otp/styles/_index.scss +4 -2
  228. package/llms-full.txt +29 -10
  229. package/llms.txt +8 -4
  230. package/package.json +15 -1
  231. package/radio/styles/_index.scss +4 -2
  232. package/resizable/styles/_index.scss +154 -0
  233. package/schematics/use/rule.js +1 -0
  234. package/schematics/use/symbol-map.json +4 -0
  235. package/select/styles/_index.scss +6 -3
  236. package/skills/ngwr/SKILL.md +1 -1
  237. package/skills/ngwr/references/catalog.md +4 -1
  238. package/skills/ngwr/references/setup.md +3 -0
  239. package/switch/styles/_index.scss +4 -2
  240. package/table/styles/_index.scss +53 -0
  241. package/textarea/styles/_index.scss +4 -2
  242. package/theme/styles/_motion.scss +6 -0
  243. package/toast/styles/_index.scss +19 -0
  244. package/types/ngwr-burger.d.ts +0 -1
  245. package/types/ngwr-calendar.d.ts +7 -0
  246. package/types/ngwr-charts-calendar-heatmap.d.ts +2 -1
  247. package/types/ngwr-clipboard.d.ts +7 -0
  248. package/types/ngwr-date-picker.d.ts +9 -2
  249. package/types/ngwr-date-stamp-testing.d.ts +47 -0
  250. package/types/ngwr-date-stamp.d.ts +81 -0
  251. package/types/ngwr-date.d.ts +135 -24
  252. package/types/ngwr-dialog-testing.d.ts +10 -0
  253. package/types/ngwr-dialog.d.ts +72 -4
  254. package/types/ngwr-directives.d.ts +36 -1
  255. package/types/ngwr-drawer.d.ts +21 -0
  256. package/types/ngwr-i18n.d.ts +44 -14
  257. package/types/ngwr-overlay.d.ts +36 -0
  258. package/types/ngwr-pipes.d.ts +15 -0
  259. package/types/ngwr-popover.d.ts +39 -1
  260. package/types/ngwr-resizable.d.ts +228 -0
  261. package/types/ngwr-table-testing.d.ts +3 -1
  262. package/types/ngwr-table.d.ts +120 -4
  263. package/types/ngwr-toast-testing.d.ts +12 -1
  264. package/types/ngwr-toast.d.ts +215 -18
  265. package/types/ngwr-utils-router.d.ts +22 -0
  266. package/types/ngwr-utils.d.ts +8 -1
  267. package/types/ngwr-version.d.ts +1 -1
  268. package/types/ngwr.d.ts +1 -0
@@ -7,7 +7,7 @@ import { Directionality } from "@angular/cdk/bidi";
7
7
  import { WrButton } from "ngwr/button";
8
8
  import { ScrollStrategyOptions } from "@angular/cdk/overlay";
9
9
  import { ComponentPortal } from "@angular/cdk/portal";
10
- import { WR_OVERLAY, wrAppendOverlayClose, wrFollowDirection } from "ngwr/overlay";
10
+ import { WR_OVERLAY, WrOverlayOrder, wrAppendOverlayClose, wrFollowDirection } from "ngwr/overlay";
11
11
  import { ConfigurableFocusTrapFactory, FocusMonitor } from "@angular/cdk/a11y";
12
12
  import { ReplaySubject } from "rxjs";
13
13
  import { WrMeta } from "ngwr/meta";
@@ -231,7 +231,10 @@ var WrDialogFooter = class WrDialogFooter {
231
231
  isRequired: false,
232
232
  transformFunction: null
233
233
  } },
234
- host: { properties: { "class": "classes()" } },
234
+ host: {
235
+ properties: { "class": "classes()" },
236
+ classAttribute: "wr-dialog__footer"
237
+ },
235
238
  ngImport: i0
236
239
  });
237
240
  };
@@ -244,7 +247,10 @@ i0.ɵɵngDeclareClassMetadata({
244
247
  type: Directive,
245
248
  args: [{
246
249
  selector: "[wrDialogFooter]",
247
- host: { "[class]": "classes()" }
250
+ host: {
251
+ class: "wr-dialog__footer",
252
+ "[class]": "classes()"
253
+ }
248
254
  }]
249
255
  }],
250
256
  ctorParameters: () => [],
@@ -350,13 +356,19 @@ i0.ɵɵngDeclareClassMetadata({
350
356
  * Use of this source code is governed by an MIT-style license that can be
351
357
  * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE
352
358
  */
359
+ const INTENT_COLORS = {
360
+ danger: "danger",
361
+ warning: "warning"
362
+ };
353
363
  var WrDialogConfirm = class WrDialogConfirm {
354
364
  constructor() {
355
365
  if (typeof ngDevMode === "undefined" || ngDevMode) wrCheckStyles("dialog");
356
366
  }
357
367
  data = inject(WR_DIALOG_DATA);
358
368
  ref = inject(WrDialogRef);
359
- color = this.data.confirmColor ?? "primary";
369
+ alert = this.data.alert === true;
370
+ intent = this.data.intent ?? null;
371
+ color = this.data.confirmColor ?? (this.alert || !this.intent ? "primary" : INTENT_COLORS[this.intent] ?? "primary");
360
372
  danger = this.color === "danger";
361
373
  confirmLabel = useI18nText(signal(this.data.confirmLabel ?? null), "common.ok", "OK");
362
374
  cancelLabel = useI18nText(signal(this.data.cancelLabel ?? null), "common.cancel", "Cancel");
@@ -379,7 +391,7 @@ var WrDialogConfirm = class WrDialogConfirm {
379
391
  classAttribute: "wr-dialog-confirm"
380
392
  },
381
393
  ngImport: i0,
382
- template: "<h2 wrDialogTitle>{{ data.title }}</h2>\n@if (data.message) {\n <div wrDialogContent>{{ data.message }}</div>\n}\n<!--\n Initial focus sits on the safe answer of a danger question and on the confirm\n button otherwise, through the `cdkFocusInitial` the focus trap already reads.\n-->\n<div wrDialogFooter>\n <button\n wr-btn\n type=\"button\"\n class=\"wr-dialog-confirm__action wr-dialog-confirm__action--cancel\"\n [attr.cdkFocusInitial]=\"danger ? '' : null\"\n (click)=\"ref.close(false)\"\n >\n {{ cancelLabel() }}\n </button>\n <button\n wr-btn\n type=\"button\"\n class=\"wr-dialog-confirm__action wr-dialog-confirm__action--confirm\"\n [color]=\"color\"\n [attr.cdkFocusInitial]=\"danger ? null : ''\"\n (click)=\"ref.close(true)\"\n >\n {{ confirmLabel() }}\n </button>\n</div>\n",
394
+ template: "<h2 wrDialogTitle>\n @if (intent) {\n <svg\n [class]=\"`wr-dialog-confirm__icon wr-dialog-confirm__icon--${intent}`\"\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 <!-- The glyphs `wr-alert` and `wr-toast` draw for the same four meanings. -->\n @switch (intent) {\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 {{ data.title }}\n</h2>\n@if (data.message) {\n <div wrDialogContent>{{ data.message }}</div>\n}\n<!--\n Initial focus sits on the safe answer of a danger question and on the confirm\n button otherwise, through the `cdkFocusInitial` the focus trap already reads.\n An alert has one button, and it takes the focus.\n-->\n<div wrDialogFooter>\n @if (alert) {\n <button\n wr-btn\n type=\"button\"\n class=\"wr-dialog-confirm__action wr-dialog-confirm__action--ok\"\n [color]=\"color\"\n [attr.cdkFocusInitial]=\"''\"\n (click)=\"ref.close()\"\n >\n {{ confirmLabel() }}\n </button>\n } @else {\n <button\n wr-btn\n type=\"button\"\n class=\"wr-dialog-confirm__action wr-dialog-confirm__action--cancel\"\n [attr.cdkFocusInitial]=\"danger ? '' : null\"\n (click)=\"ref.close(false)\"\n >\n {{ cancelLabel() }}\n </button>\n <button\n wr-btn\n type=\"button\"\n class=\"wr-dialog-confirm__action wr-dialog-confirm__action--confirm\"\n [color]=\"color\"\n [attr.cdkFocusInitial]=\"danger ? null : ''\"\n (click)=\"ref.close(true)\"\n >\n {{ confirmLabel() }}\n </button>\n }\n</div>\n",
383
395
  dependencies: [
384
396
  {
385
397
  kind: "component",
@@ -440,7 +452,7 @@ i0.ɵɵngDeclareClassMetadata({
440
452
  class: "wr-dialog-confirm",
441
453
  "[class.wr-dialog-confirm--danger]": "danger"
442
454
  },
443
- template: "<h2 wrDialogTitle>{{ data.title }}</h2>\n@if (data.message) {\n <div wrDialogContent>{{ data.message }}</div>\n}\n<!--\n Initial focus sits on the safe answer of a danger question and on the confirm\n button otherwise, through the `cdkFocusInitial` the focus trap already reads.\n-->\n<div wrDialogFooter>\n <button\n wr-btn\n type=\"button\"\n class=\"wr-dialog-confirm__action wr-dialog-confirm__action--cancel\"\n [attr.cdkFocusInitial]=\"danger ? '' : null\"\n (click)=\"ref.close(false)\"\n >\n {{ cancelLabel() }}\n </button>\n <button\n wr-btn\n type=\"button\"\n class=\"wr-dialog-confirm__action wr-dialog-confirm__action--confirm\"\n [color]=\"color\"\n [attr.cdkFocusInitial]=\"danger ? null : ''\"\n (click)=\"ref.close(true)\"\n >\n {{ confirmLabel() }}\n </button>\n</div>\n"
455
+ template: "<h2 wrDialogTitle>\n @if (intent) {\n <svg\n [class]=\"`wr-dialog-confirm__icon wr-dialog-confirm__icon--${intent}`\"\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 <!-- The glyphs `wr-alert` and `wr-toast` draw for the same four meanings. -->\n @switch (intent) {\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 {{ data.title }}\n</h2>\n@if (data.message) {\n <div wrDialogContent>{{ data.message }}</div>\n}\n<!--\n Initial focus sits on the safe answer of a danger question and on the confirm\n button otherwise, through the `cdkFocusInitial` the focus trap already reads.\n An alert has one button, and it takes the focus.\n-->\n<div wrDialogFooter>\n @if (alert) {\n <button\n wr-btn\n type=\"button\"\n class=\"wr-dialog-confirm__action wr-dialog-confirm__action--ok\"\n [color]=\"color\"\n [attr.cdkFocusInitial]=\"''\"\n (click)=\"ref.close()\"\n >\n {{ confirmLabel() }}\n </button>\n } @else {\n <button\n wr-btn\n type=\"button\"\n class=\"wr-dialog-confirm__action wr-dialog-confirm__action--cancel\"\n [attr.cdkFocusInitial]=\"danger ? '' : null\"\n (click)=\"ref.close(false)\"\n >\n {{ cancelLabel() }}\n </button>\n <button\n wr-btn\n type=\"button\"\n class=\"wr-dialog-confirm__action wr-dialog-confirm__action--confirm\"\n [color]=\"color\"\n [attr.cdkFocusInitial]=\"danger ? null : ''\"\n (click)=\"ref.close(true)\"\n >\n {{ confirmLabel() }}\n </button>\n }\n</div>\n"
444
456
  }]
445
457
  }],
446
458
  ctorParameters: () => []
@@ -464,6 +476,7 @@ var WrDialog = class WrDialog {
464
476
  location = inject(Location);
465
477
  destroyRef = inject(DestroyRef);
466
478
  defaults = inject(WR_DIALOG_DEFAULTS);
479
+ order = inject(WrOverlayOrder);
467
480
  open(component, options = {}) {
468
481
  const overlayRef = this.overlay.create({
469
482
  positionStrategy: this.overlay.position().global().centerHorizontally().centerVertically(),
@@ -499,6 +512,7 @@ var WrDialog = class WrDialog {
499
512
  });
500
513
  const portal = new ComponentPortal(component, null, injector);
501
514
  dialogRef.componentRef = overlayRef.attach(portal);
515
+ overlayRef.detachments().subscribe(this.order.add(overlayRef.hostElement, options.toasts));
502
516
  if (options.closeOnBackdropClick !== false) overlayRef.backdropClick().subscribe(() => dialogRef.close());
503
517
  if (options.closeOnEscape !== false) overlayRef.keydownEvents().subscribe((event) => {
504
518
  if (event.key === "Escape") {
@@ -537,22 +551,37 @@ var WrDialog = class WrDialog {
537
551
  }
538
552
  async confirm(options) {
539
553
  if (!this.isBrowser) return false;
540
- const { title, message, confirmLabel, cancelLabel, confirmColor, ...rest } = options;
554
+ const { title, message, confirmLabel, cancelLabel, confirmColor, intent, ...rest } = options;
555
+ return await this.ask(rest, {
556
+ title,
557
+ message,
558
+ confirmLabel,
559
+ cancelLabel,
560
+ confirmColor,
561
+ intent
562
+ }) === true;
563
+ }
564
+ async alert(options) {
565
+ if (!this.isBrowser) return;
566
+ const { title, message, okLabel, intent, ...rest } = options;
567
+ await this.ask(rest, {
568
+ title,
569
+ message,
570
+ confirmLabel: okLabel,
571
+ intent,
572
+ alert: true
573
+ });
574
+ }
575
+ ask(options, data) {
541
576
  const ref = this.open(WrDialogConfirm, {
542
- ...rest,
577
+ ...options,
543
578
  role: "alertdialog",
544
579
  closable: false,
545
- data: {
546
- title,
547
- message,
548
- confirmLabel,
549
- cancelLabel,
550
- confirmColor
551
- }
580
+ data
552
581
  });
553
582
  const unhook = this.destroyRef.onDestroy(() => ref.close());
554
583
  ref.closed.subscribe({ complete: unhook });
555
- return await ref.awaitClose() === true;
584
+ return ref.awaitClose();
556
585
  }
557
586
  watchNavigation(overlayRef, dialogRef) {
558
587
  const stopWatching = this.location.onUrlChange(() => dialogRef.close());
@@ -1 +1 @@
1
- {"version":3,"file":"ngwr-dialog.mjs","names":["uid"],"sources":["../../../projects/lib/dialog/dialog-ref.ts","../../../projects/lib/dialog/directives/dialog-title.ts","../../../projects/lib/dialog/directives/dialog-content.ts","../../../projects/lib/dialog/directives/dialog-footer.ts","../../../projects/lib/dialog/tokens/dialog-defaults.token.ts","../../../projects/lib/dialog/tokens/dialog-data.token.ts","../../../projects/lib/dialog/tokens/dialog-ref.token.ts","../../../projects/lib/dialog/directives/dialog-close.ts","../../../projects/lib/dialog/confirm/dialog-confirm.ts","../../../projects/lib/dialog/confirm/dialog-confirm.html","../../../projects/lib/dialog/dialog.ts","../../../projects/lib/dialog/with-dialog.ts"],"sourcesContent":["/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { type ConfigurableFocusTrap, FocusMonitor } from '@angular/cdk/a11y';\nimport type { OverlayRef } from '@angular/cdk/overlay';\nimport { type ComponentRef, type EffectRef, type Injector, type Signal, effect, untracked } from '@angular/core';\n\nimport { ReplaySubject } from 'rxjs';\n\nimport { wrRestoreFocus } from 'ngwr/utils';\n\n/**\n * Handle returned by `WrDialog.open()`.\n *\n * Wraps the underlying `OverlayRef` and tracks the close result. It is also\n * provided inside the dialog's own injector, so the projected content can\n * inject it and close itself — the counterpart to `[wrDialogClose]` when the\n * close is programmatic (after a save succeeds, say) rather than a click.\n *\n * @example\n * ```ts\n * // Caller side.\n * const ref = dialog.open<ConfirmComponent, boolean>(ConfirmComponent);\n * const result = await ref.awaitClose(); // boolean | undefined\n * ```\n *\n * @example\n * ```ts\n * // Content side — the dialog closes itself.\n * @Component({...})\n * export class ConfirmComponent {\n * private readonly ref = inject(WrDialogRef);\n *\n * save(): void {\n * this.store.save();\n * this.ref.close(true);\n * }\n * }\n * ```\n */\nexport class WrDialogRef<C, R = unknown> {\n /**\n * Emits the close result once and completes.\n *\n * A `ReplaySubject`, not a plain `Subject`, so the result survives a late\n * subscriber: content can close itself before `open()` has even returned, and\n * `awaitClose()` may be called long after the dismissal — both would otherwise\n * see only `complete` and resolve `undefined`.\n */\n readonly closed = new ReplaySubject<R | undefined>(1);\n\n /** @internal */\n componentRef: ComponentRef<C> | null = null;\n\n /** @internal */\n focusTrap: ConfigurableFocusTrap | null = null;\n\n /** @internal */\n previouslyFocused: HTMLElement | null = null;\n\n private readonly watchers: EffectRef[] = [];\n\n private readonly focusMonitor: FocusMonitor | null;\n\n /**\n * @param _overlayRef the overlay the dialog is mounted in.\n * @param injector what `closeWhen()` runs its watcher in. `WrDialog.open()`\n * passes the root injector; a ref built without one cannot watch.\n */\n constructor(\n private readonly _overlayRef: OverlayRef,\n private readonly injector?: Injector\n ) {\n // Resolved now: the injector may be gone by the time the dialog closes.\n this.focusMonitor = injector?.get(FocusMonitor, null) ?? null;\n }\n\n /** The instantiated dialog component. */\n get componentInstance(): C {\n if (!this.componentRef) {\n throw new Error('WrDialogRef: component not yet attached');\n }\n return this.componentRef.instance;\n }\n\n private isClosed = false;\n\n /** Close the dialog, optionally returning a result. */\n close(result?: R): void {\n if (this.isClosed) return;\n this.isClosed = true;\n for (const watcher of this.watchers.splice(0)) watcher.destroy();\n this.closed.next(result);\n this.closed.complete();\n // Content that closes itself while constructing gets here with\n // `OverlayRef.attach()` still on the stack — `componentRef` is assigned\n // only once attach returns. Disposing mid-attach leaves the CDK writing to\n // a detached host, so let the current task finish first.\n if (!this.componentRef) {\n queueMicrotask(() => this.teardown());\n return;\n }\n this.teardown();\n }\n\n private teardown(): void {\n this.focusTrap?.destroy();\n this.focusTrap = null;\n const restore = this.previouslyFocused;\n this.previouslyFocused = null;\n this._overlayRef.dispose();\n // Drop the destroyed component so a retained ref doesn't pin its instance,\n // host element and view in memory.\n this.componentRef = null;\n // Restore focus after disposal so the trigger is reachable again.\n if (restore && typeof restore.focus === 'function') {\n wrRestoreFocus(restore, this.focusMonitor);\n }\n }\n\n /**\n * Close the dialog once `source` reads `true`, with `result` - `undefined`\n * when omitted, which is what every dismissal closes with. A source that is\n * already `true` closes it on the next change detection, after the attach\n * has finished.\n *\n * The watcher belongs to the dialog: it runs in the root injector, so the\n * caller needs no injection context, and it is destroyed when the dialog\n * closes by any path, so a source that turns `true` later does nothing. Each\n * call adds a watcher; the first to fire closes. A closed dialog ignores the\n * call.\n *\n * @example\n * ```ts\n * const saved = computed(() => this.save.status() === 'resolved');\n * this.dialog.open(SavingComponent).closeWhen(saved, 'saved');\n * ```\n */\n closeWhen(source: Signal<boolean>, result?: R): void {\n if (this.isClosed) return;\n if (!this.injector) {\n throw new Error('WrDialogRef: closeWhen() needs a ref opened by WrDialog, which carries the injector');\n }\n this.watchers.push(\n effect(\n () => {\n if (source()) untracked(() => this.close(result));\n },\n { injector: this.injector }\n )\n );\n }\n\n /** Resolves with the close result when the dialog is dismissed. */\n awaitClose(): Promise<R | undefined> {\n return new Promise(resolve => {\n this.closed.subscribe({\n next: value => resolve(value),\n complete: () => resolve(undefined),\n });\n });\n }\n\n /** Underlying overlay ref — escape hatch for advanced cases. */\n get overlayRef(): OverlayRef {\n return this._overlayRef;\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 { Directive, ElementRef, inject } from '@angular/core';\n\nimport { wrCheckStyles } from 'ngwr/utils';\n\nlet uid = 0;\n\n/**\n * Styles a dialog title row. Use on a heading inside an opened dialog.\n * Auto-assigns an `id` so the dialog panel can reference it via\n * `aria-labelledby`.\n *\n * @example\n * ```html\n * <h2 wrDialogTitle>Confirm delete</h2>\n * ```\n */\n@Directive({\n selector: '[wrDialogTitle]',\n exportAs: 'wrDialogTitle',\n host: { class: 'wr-dialog__title', '[attr.id]': 'id' },\n})\nexport class WrDialogTitle {\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('dialog');\n }\n\n /** Generated id used for `aria-labelledby` wiring. */\n readonly id = `wr-dialog-title-${++uid}`;\n\n /** @internal */\n readonly elementRef = inject(ElementRef<HTMLElement>);\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 { CdkScrollable } from '@angular/cdk/scrolling';\nimport { Directive, input } from '@angular/core';\n\nimport { wrCheckStyles } from 'ngwr/utils';\n\nlet uid = 0;\n\n/**\n * Styles the scrollable body section of a dialog. Auto-assigns an `id` so an\n * `alertdialog` panel can reference it via `aria-describedby`.\n *\n * `CdkScrollable` is a host directive because this element is a real scroll\n * container (`overflow: auto`) and an anchored overlay opened from inside it has\n * to follow its trigger. CDK's `reposition()` strategy listens to\n * `ScrollDispatcher`, which is fed by registered scrollables plus ONE\n * non-capturing `document` listener — and element `scroll` does not bubble, so\n * without the registration a `<wr-select>` halfway down a long dialog form kept\n * its panel pinned to the viewport while the trigger scrolled away. Angular\n * Material carries the same host directive on `MatDialogContent` for the same\n * reason.\n *\n * @example\n * ```html\n * <div wrDialogContent>…body…</div>\n * ```\n */\n@Directive({\n selector: '[wrDialogContent]',\n host: { class: 'wr-dialog__content', '[attr.id]': 'id()' },\n hostDirectives: [CdkScrollable],\n})\nexport class WrDialogContent {\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('dialog');\n }\n\n /** The element's id, generated unless given. An `alertdialog` names it in `aria-describedby`. */\n readonly id = input(`wr-dialog-content-${++uid}`);\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 { Directive, computed, input } from '@angular/core';\n\nimport { wrCheckStyles } from 'ngwr/utils';\n\n/**\n * Footer row, typically holding action buttons.\n *\n * @example\n * ```html\n * <div wrDialogFooter align=\"end\">\n * <wr-btn wrDialogClose>Cancel</wr-btn>\n * <wr-btn color=\"danger\" (click)=\"confirm()\">Delete</wr-btn>\n * </div>\n * ```\n */\n@Directive({\n selector: '[wrDialogFooter]',\n host: { '[class]': 'classes()' },\n})\nexport class WrDialogFooter {\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('dialog');\n }\n\n /**\n * Horizontal alignment of the children.\n *\n * @default 'end'\n */\n readonly align = input<'start' | 'center' | 'end'>('end');\n\n protected readonly classes = computed(() => `wr-dialog__footer wr-dialog__footer--${this.align()}`);\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 type { WrDialogDefaults } from '../types';\n\n/** What `withDialog()` provides. @internal */\nexport const WR_DIALOG_DEFAULTS = new InjectionToken<WrDialogDefaults>('WR_DIALOG_DEFAULTS', {\n factory: (): WrDialogDefaults => ({}),\n});\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { InjectionToken } from '@angular/core';\n\n/**\n * Token that exposes the `data` payload passed to `WrDialog.open()`.\n *\n * @example\n * ```ts\n * @Component({...})\n * export class ConfirmComponent {\n * readonly data = inject<ConfirmData>(WR_DIALOG_DATA);\n * }\n * ```\n */\nexport const WR_DIALOG_DATA = new InjectionToken<unknown>('WR_DIALOG_DATA');\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 type { WrDialogRef } from '../dialog-ref';\n\n/**\n * Token exposing the open dialog's `WrDialogRef` to components and\n * directives rendered inside it (e.g. `[wrDialogClose]`).\n *\n * **Prefer `inject(WrDialogRef)`** — the ref is provided under the class token\n * too, and the class path is the documented one. It already covers both cases\n * you might reach for a token for: `inject(WrDialogRef, { optional: true })`\n * works for content that also renders outside a dialog, and\n * `inject<WrDialogRef<ConfirmComponent, boolean>>(WrDialogRef)` types the\n * generics without a cast.\n *\n * This token is the same object under a second key. It exists for the library's\n * own directives (`[wrDialogClose]`) and for swapping the provider out — a test\n * stub, say — without touching the class.\n *\n * @example\n * ```ts\n * @Component({...})\n * export class ConfirmComponent {\n * private readonly ref = inject<WrDialogRef<ConfirmComponent, boolean>>(WrDialogRef);\n *\n * confirm(): void {\n * this.ref.close(true);\n * }\n * }\n * ```\n */\nexport const WR_DIALOG_REF = new InjectionToken<WrDialogRef<unknown, unknown>>('WR_DIALOG_REF');\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 { Directive, inject, input } from '@angular/core';\n\nimport { wrCheckStyles } from 'ngwr/utils';\n\nimport type { WrDialogRef } from '../dialog-ref';\nimport { WR_DIALOG_REF } from '../tokens';\n\n/**\n * Closes the dialog when the host element is clicked.\n *\n * Optionally passes a `[wrDialogClose]` value as the close result.\n *\n * @example\n * ```html\n * <wr-btn wrDialogClose>Cancel</wr-btn>\n * <wr-btn color=\"primary\" [wrDialogClose]=\"true\">Confirm</wr-btn>\n * ```\n */\n@Directive({\n selector: '[wrDialogClose]',\n host: { '(click)': 'onClick()' },\n})\nexport class WrDialogClose<R = unknown> {\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('dialog');\n }\n\n /**\n * Value to pass to `close()`. When unset — or used as a bare attribute — the\n * dialog closes with `undefined`.\n */\n readonly result = input<R | undefined, R | undefined | ''>(undefined, {\n alias: 'wrDialogClose',\n // A bare `wrDialogClose` attribute arrives as the empty string; that means\n // \"no result\", not a result of `''`. Matches `wrDrawerClose`.\n transform: value => (value === '' ? undefined : value),\n });\n\n private readonly ref = inject<WrDialogRef<unknown, R>>(WR_DIALOG_REF, { optional: true });\n\n protected onClick(): void {\n this.ref?.close(this.result());\n }\n}\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { Component, ViewEncapsulation, inject, signal } from '@angular/core';\n\nimport { WrButton } from 'ngwr/button';\nimport { useI18nText } from 'ngwr/i18n';\nimport { wrCheckStyles } from 'ngwr/utils';\n\nimport { WrDialogRef } from '../dialog-ref';\nimport { WrDialogContent, WrDialogFooter, WrDialogTitle } from '../directives';\nimport { WR_DIALOG_DATA } from '../tokens';\nimport type { WrDialogConfirmOptions } from '../types';\n\n/**\n * The content `WrDialog.confirm()` mounts: the dialog's own title, content and\n * footer around two `wr-btn`. Not exported; the service is the API.\n */\n@Component({\n selector: 'wr-dialog-confirm',\n templateUrl: './dialog-confirm.html',\n imports: [WrButton, WrDialogTitle, WrDialogContent, WrDialogFooter],\n encapsulation: ViewEncapsulation.None,\n host: {\n class: 'wr-dialog-confirm',\n '[class.wr-dialog-confirm--danger]': 'danger',\n },\n})\nexport class WrDialogConfirm {\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('dialog');\n }\n\n protected readonly data = inject<WrDialogConfirmOptions>(WR_DIALOG_DATA);\n protected readonly ref = inject<WrDialogRef<WrDialogConfirm, boolean>>(WrDialogRef);\n\n protected readonly color = this.data.confirmColor ?? 'primary';\n protected readonly danger = this.color === 'danger';\n\n protected readonly confirmLabel = useI18nText(signal(this.data.confirmLabel ?? null), 'common.ok', 'OK');\n protected readonly cancelLabel = useI18nText(signal(this.data.cancelLabel ?? null), 'common.cancel', 'Cancel');\n}\n","<h2 wrDialogTitle>{{ data.title }}</h2>\n@if (data.message) {\n <div wrDialogContent>{{ data.message }}</div>\n}\n<!--\n Initial focus sits on the safe answer of a danger question and on the confirm\n button otherwise, through the `cdkFocusInitial` the focus trap already reads.\n-->\n<div wrDialogFooter>\n <button\n wr-btn\n type=\"button\"\n class=\"wr-dialog-confirm__action wr-dialog-confirm__action--cancel\"\n [attr.cdkFocusInitial]=\"danger ? '' : null\"\n (click)=\"ref.close(false)\"\n >\n {{ cancelLabel() }}\n </button>\n <button\n wr-btn\n type=\"button\"\n class=\"wr-dialog-confirm__action wr-dialog-confirm__action--confirm\"\n [color]=\"color\"\n [attr.cdkFocusInitial]=\"danger ? null : ''\"\n (click)=\"ref.close(true)\"\n >\n {{ confirmLabel() }}\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 { ConfigurableFocusTrapFactory } from '@angular/cdk/a11y';\nimport { Directionality } from '@angular/cdk/bidi';\nimport { type OverlayRef, ScrollStrategyOptions } from '@angular/cdk/overlay';\nimport { ComponentPortal, type ComponentType } from '@angular/cdk/portal';\nimport { Location, isPlatformBrowser } from '@angular/common';\nimport {\n DestroyRef,\n EnvironmentInjector,\n Service,\n Injector,\n PLATFORM_ID,\n type WritableSignal,\n afterEveryRender,\n inject,\n signal,\n} from '@angular/core';\n\nimport { WrI18n } from 'ngwr/i18n';\nimport { WrMeta } from 'ngwr/meta';\nimport { WR_OVERLAY, wrAppendOverlayClose, wrFollowDirection } from 'ngwr/overlay';\nimport { wrToClassList } from 'ngwr/utils';\n\nimport { WrDialogConfirm } from './confirm/dialog-confirm';\nimport { WrDialogRef } from './dialog-ref';\nimport { WR_DIALOG_DATA, WR_DIALOG_DEFAULTS, WR_DIALOG_REF } from './tokens';\nimport type { WrDialogConfirmOptions, WrDialogOptions } from './types';\n\nconst DEFAULT_PANEL_CLASS = 'wr-dialog-panel';\nconst DEFAULT_BACKDROP_CLASS = 'wr-dialog-backdrop';\n\n/**\n * Opens dialog components in an isolated NGWR overlay.\n *\n * Uses `WR_OVERLAY`, so dialogs render into NGWR's own overlay container\n * and never collide with other CDK consumers (Material, NG-ZORRO, etc.).\n *\n * @example\n * ```ts\n * const dialog = inject(WrDialog);\n *\n * const ref = dialog.open(ConfirmComponent, {\n * data: { message: 'Delete this item?' },\n * width: '24rem',\n * });\n *\n * const ok = await ref.awaitClose();\n * if (ok) remove();\n * ```\n *\n * @see https://ngwr.dev/reference/components/dialog\n */\n@Service()\nexport class WrDialog {\n private readonly overlay = inject(WR_OVERLAY);\n private readonly scrollStrategies = inject(ScrollStrategyOptions);\n private readonly parentInjector = inject(EnvironmentInjector);\n private readonly focusTrapFactory = inject(ConfigurableFocusTrapFactory);\n private readonly isBrowser = isPlatformBrowser(inject(PLATFORM_ID));\n private readonly i18n = inject(WrI18n, { optional: true });\n private readonly dir = inject(Directionality, { optional: true });\n // Resolvable wherever the CDK's own `Overlay` is — it injects the same thing\n // to implement `disposeOnNavigation`.\n private readonly location = inject(Location);\n private readonly destroyRef = inject(DestroyRef);\n private readonly defaults = inject(WR_DIALOG_DEFAULTS);\n\n open<C, R = unknown, D = unknown>(component: ComponentType<C>, options: WrDialogOptions<D> = {}): WrDialogRef<C, R> {\n const overlayRef: OverlayRef = this.overlay.create({\n positionStrategy: this.overlay.position().global().centerHorizontally().centerVertically(),\n scrollStrategy: this.scrollStrategies.block(),\n hasBackdrop: true,\n backdropClass: DEFAULT_BACKDROP_CLASS,\n panelClass: wrToClassList(DEFAULT_PANEL_CLASS, options.panelClass),\n width: options.width,\n maxWidth: options.maxWidth,\n });\n\n // The CDK captures the direction as a string at create and never looks\n // again, so an app that flips while a dialog is up leaves the panel behind.\n // Nothing here derives from it — the box is centred and its x offset is\n // empty, so `apply()`'s RTL branch moves nothing — but the `dir` attribute\n // is what the dialog's own logical CSS and every ngwr control inside it\n // resolve `start` and `end` against, so it has to follow. No teardown kept:\n // the follower ends on the ref's own `detachments()`, which every dismissal\n // path goes through, and each `open()` creates a fresh ref of its own.\n wrFollowDirection(overlayRef, this.dir, this.parentInjector);\n\n const dialogRef = new WrDialogRef<C, R>(overlayRef, this.parentInjector);\n\n if (this.isBrowser) {\n const active = document.activeElement;\n dialogRef.previouslyFocused = active instanceof HTMLElement ? active : null;\n }\n\n const injector = Injector.create({\n parent: this.parentInjector,\n providers: [\n { provide: WR_DIALOG_DATA, useValue: options.data },\n { provide: WR_DIALOG_REF, useValue: dialogRef },\n // Provided as its own token as well, so dialog content can reach for\n // the familiar `inject(WrDialogRef)` and close itself.\n { provide: WrDialogRef, useValue: dialogRef },\n ],\n });\n\n const portal = new ComponentPortal(component, null, injector);\n dialogRef.componentRef = overlayRef.attach(portal);\n\n // Wired BEFORE the panel is decorated, and the order is the fix: everything\n // below attaches attributes, a ✕ and a focus trap to an overlay that is\n // already on screen, so anything that throws in there used to leave an\n // `aria-modal` panel with no dismissal path at all — no ✕, no backdrop\n // handler, no Escape — over the whole application, and no ref for the caller\n // to close it with. A dialog that fails to finish opening must still be one\n // the user can get rid of. Overlay subscriptions complete when the overlay is\n // disposed, so no explicit teardown is required.\n if (options.closeOnBackdropClick !== false) {\n overlayRef.backdropClick().subscribe(() => dialogRef.close());\n }\n if (options.closeOnEscape !== false) {\n overlayRef.keydownEvents().subscribe(event => {\n if (event.key === 'Escape') {\n event.preventDefault();\n dialogRef.close();\n }\n });\n }\n if (options.closeOnNavigation !== false) {\n this.watchNavigation(overlayRef, dialogRef);\n }\n\n if (this.isBrowser) {\n const host = overlayRef.overlayElement;\n const role = options.role ?? 'dialog';\n host.setAttribute('role', role);\n host.setAttribute('aria-modal', 'true');\n // Built-in dismiss. Appended after the content portal so it paints above\n // it, and marked on the panel so the title reserves the corner gutter.\n if (options.closable !== false) {\n host.classList.add('wr-dialog-panel--closable');\n const label = options.closeLabel ?? this.closeLabel();\n wrAppendOverlayClose(host, 'wr-dialog__close', label, () => dialogRef.close());\n }\n // Wire aria-labelledby to wrDialogTitle's auto-id once content is in DOM.\n // Has to wait for a render, not a microtask: attaching the portal only\n // schedules change detection, so under zoneless CD a microtask runs while\n // the content is still an empty view and the title id doesn't exist yet.\n //\n // And after EVERY render, not just the next one: the title belongs to the\n // caller's component, so an `@if` or a late-arriving heading can replace\n // or remove the element the attribute names. A reference to a node that is\n // no longer there is not a name — the dialog announces as unnamed — so a\n // missing title clears the attribute rather than leaving it dangling.\n //\n // An `alertdialog` is described by its content the same way: the message\n // is the dialog, and it can be conditional too.\n const tabTitle = (options.tabTitle ?? this.defaults.tabTitle) ? this.nameTab(overlayRef) : null;\n const labelSync = afterEveryRender(\n () => {\n const titleEl = host.querySelector<HTMLElement>('[wrDialogTitle], [wr-dialog-title]');\n if (titleEl?.id) host.setAttribute('aria-labelledby', titleEl.id);\n else host.removeAttribute('aria-labelledby');\n tabTitle?.set((titleEl?.textContent ?? '').replace(/\\s+/g, ' ').trim());\n if (role !== 'alertdialog') return;\n const contentEl = host.querySelector<HTMLElement>('[wrDialogContent], [wr-dialog-content]');\n if (contentEl?.id) host.setAttribute('aria-describedby', contentEl.id);\n else host.removeAttribute('aria-describedby');\n },\n { injector: this.parentInjector }\n );\n // The hook is bound to the root injector, so it outlives the dialog unless\n // it is torn down with it. `detachments()` fires on dispose, which is the\n // one path every dismissal goes through.\n overlayRef.detachments().subscribe(() => labelSync.destroy());\n // Trap focus inside the dialog and move initial focus in.\n const trap = this.focusTrapFactory.create(host);\n dialogRef.focusTrap = trap;\n void trap.focusInitialElementWhenReady();\n }\n\n return dialogRef;\n }\n\n /**\n * Ask a yes-or-no question and get the answer: `true` only when the user\n * pressed the confirm button. Escape, the backdrop, the cancel button, a\n * navigation and the application being torn down all resolve `false`. The\n * promise settles exactly once and never rejects, so the caller needs no\n * `catch` and no cleanup.\n *\n * The dialog is `role=\"alertdialog\"`, named by `title` and described by\n * `message`, with no corner dismiss: the two buttons are the answers. Labels\n * fall back to the `common.ok` and `common.cancel` catalog keys. With\n * `confirmColor: 'danger'` initial focus is on the cancel button; otherwise it\n * is on the confirm button. Focus returns to the opener on close, as it does\n * for `open()`.\n *\n * On the server nothing can answer, so it resolves `false` at once and opens\n * nothing.\n *\n * @example\n * ```ts\n * const ok = await dialog.confirm({\n * title: 'Delete this item?',\n * message: 'This cannot be undone.',\n * confirmLabel: 'Delete',\n * confirmColor: 'danger',\n * });\n * if (ok) remove();\n * ```\n */\n async confirm(options: WrDialogConfirmOptions): Promise<boolean> {\n if (!this.isBrowser) return false;\n const { title, message, confirmLabel, cancelLabel, confirmColor, ...rest } = options;\n const ref = this.open<WrDialogConfirm, boolean, WrDialogConfirmOptions>(WrDialogConfirm, {\n ...rest,\n role: 'alertdialog',\n closable: false,\n data: { title, message, confirmLabel, cancelLabel, confirmColor },\n });\n // The root injector going away takes the overlay container with it and\n // completes nothing, which would leave this promise pending for good.\n const unhook = this.destroyRef.onDestroy(() => ref.close());\n ref.closed.subscribe({ complete: unhook });\n return (await ref.awaitClose()) === true;\n }\n\n /**\n * Tie the dialog's lifetime to the URL it was opened on.\n *\n * Nothing else does. The overlay belongs to a root service and is dismissed\n * only by the backdrop, Escape or an explicit `close()`, so pressing Back\n * swapped the routed view underneath and left the modal pane, its backdrop and\n * its focus trap sitting over a page the user never opened them on.\n *\n * `onUrlChange`, not `Location.subscribe()` — which is what CDK's own\n * `disposeOnNavigation` uses: `subscribe` fires on popstate alone, so an\n * in-app `router.navigate()` left the dialog standing. And `dialogRef.close()`\n * rather than disposing the overlay behind the ref's back, which would never\n * emit `closed`, never destroy the focus trap, and leave `awaitClose()`\n * pending forever.\n */\n private watchNavigation<C, R>(overlayRef: OverlayRef, dialogRef: WrDialogRef<C, R>): void {\n const stopWatching = this.location.onUrlChange(() => dialogRef.close());\n // Unhooked a microtask late, because `Location` notifies its listeners with\n // a `forEach` and unregistering splices the array it is iterating: removing\n // ours synchronously from inside the notification would shift the next entry\n // into the slot forEach has already passed, and a SECOND stacked dialog\n // would be skipped and left behind.\n overlayRef.detachments().subscribe(() => queueMicrotask(stopWatching));\n }\n\n /**\n * Put the dialog's title in front of the page title for as long as the\n * overlay is attached, and hand back where to write that title.\n *\n * A `titlePrefix` layer rather than a composed `title`: the page title stays\n * whatever the layers under it resolve to, so a page that retitles itself\n * under an open dialog is followed, and closing restores nothing, it only\n * removes the layer. Stacked dialogs each hold a layer and the top one wins.\n *\n * `WrMeta` is resolved here and not injected with the service: constructing\n * it applies its defaults to `<head>`, which an app that never asked for\n * `tabTitle` must not pay for.\n */\n private nameTab(overlayRef: OverlayRef): WritableSignal<string> {\n const heading = signal('');\n const layer = this.parentInjector.get(WrMeta).bind(() => (heading() ? { titlePrefix: heading() } : {}));\n overlayRef.detachments().subscribe(() => layer.pop());\n return heading;\n }\n\n /**\n * The dismiss button's accessible name.\n *\n * Two failure modes, and resolving PER OPEN is what covers both. `t()` hands\n * back the KEY on a miss, and `WrI18n` is root-provided with an empty catalog\n * by default, so an app that never configured i18n named its dismiss button\n * \"dialog.close\" — a name axe cannot fault, because a name is present, and a\n * screen reader reads out verbatim. Resolving once at injection time fixed\n * that but froze the answer: this is a root service, constructed before an\n * async catalog has loaded, so a localized app got the English fallback on\n * every dialog it ever opened.\n */\n private closeLabel(): string {\n const resolved = this.i18n?.t('dialog.close');\n return !resolved || resolved === 'dialog.close' ? 'Close dialog' : resolved;\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 WrFeature, wrFeature } from 'ngwr/utils';\n\nimport { WR_DIALOG_DEFAULTS } from './tokens';\nimport type { WrDialogDefaults } from './types';\n\n/**\n * App-wide dialog defaults, as a feature of `provideWr()`: today `tabTitle`,\n * so every dialog names the browser tab while it is open. The same option on\n * `open()` or `confirm()` still wins.\n *\n * Bootstrap only: `WrDialog` is root-provided and reads it once, from the root\n * injector, so in a route's `providers` it changes nothing.\n *\n * @example\n * ```ts\n * import { provideWr } from 'ngwr';\n * import { withDialog } from 'ngwr/dialog';\n *\n * bootstrapApplication(App, {\n * providers: [provideWr(withDialog({ tabTitle: true }))],\n * });\n * ```\n */\nexport function withDialog(defaults: WrDialogDefaults): WrFeature<'dialog'> {\n return wrFeature('dialog', [{ provide: WR_DIALOG_DEFAULTS, useValue: defaults }]);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AA4CA,IAAa,cAAb,MAAwB;CA8BH;CACA;CAtBV,SAAS,IAAI,cAA6B,CAAC;CAGpD,eAAuC;CAGvC,YAA0C;CAG1C,oBAAwC;CAEvB,WAAwB,CAAA;CAExB;CAOjB,YACmB,aACA,UAAmB;EADnB,KAAA,cAAA;EACA,KAAA,WAAA;EAGjB,KAAK,eAAe,UAAU,IAAI,cAAc,IAAI,KAAK;CAC3D;CAGA,IAAI,oBAAiB;EACnB,IAAI,CAAC,KAAK,cACR,MAAM,IAAI,MAAM,yCAAyC;EAE3D,OAAO,KAAK,aAAa;CAC3B;CAEQ,WAAW;CAGnB,MAAM,QAAU;EACd,IAAI,KAAK,UAAU;EACnB,KAAK,WAAW;EAChB,KAAK,MAAM,WAAW,KAAK,SAAS,OAAO,CAAC,GAAG,QAAQ,QAAO;EAC9D,KAAK,OAAO,KAAK,MAAM;EACvB,KAAK,OAAO,SAAQ;EAKpB,IAAI,CAAC,KAAK,cAAc;GACtB,qBAAqB,KAAK,SAAQ,CAAE;GACpC;EACF;EACA,KAAK,SAAQ;CACf;CAEQ,WAAQ;EACd,KAAK,WAAW,QAAO;EACvB,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CAAC,gBAAgB,eAAe,YAAY,CAAC;CACvE;CAeQ,QAAQ,YAAsB;EACpC,MAAM,UAAU,OAAO,IAAG,GAAA,YAAA,CAAA,EAAA,WAAA,UAAA,CAAA,+BAAA,CAAA,CAAA;EAC1B,MAAM,QAAQ,KAAK,eAAe,IAAI,MAAM,CAAC,CAAC,WAAY,QAAO,IAAK,EAAE,aAAa,QAAO,EAAE,IAAK,CAAA,CAAG;EACtG,WAAW,YAAW,CAAE,CAAC,gBAAgB,MAAM,IAAG,CAAE;EACpD,OAAO;CACT;CAcQ,aAAU;EAChB,MAAM,WAAW,KAAK,MAAM,EAAE,cAAc;EAC5C,OAAO,CAAC,YAAY,aAAa,iBAAiB,iBAAiB;CACrE;CA3OW,OAAA,OAAA,GAAA,mBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,UAAA;EAAA,MAAA;EAAQ,MAAA,CAAA;EAAA,QAAA,GAAA,gBAAA;CAAA,CAAA;CAAR,OAAA,QAAA,GAAA,mBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,UAAA;EAAA,MAAA;CAAQ,CAAA;;AAAR,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAQ,YAAA,CAAA,EADpB,MAAA,Q;;;;;;;;AC5BD,SAAgB,WAAW,UAA0B;CACnD,OAAO,UAAU,UAAU,CAAC;EAAE,SAAS;EAAoB,UAAU;CAAQ,CAAE,CAAC;AAClF"}
1
+ {"version":3,"file":"ngwr-dialog.mjs","names":["uid"],"sources":["../../../projects/lib/dialog/dialog-ref.ts","../../../projects/lib/dialog/directives/dialog-title.ts","../../../projects/lib/dialog/directives/dialog-content.ts","../../../projects/lib/dialog/directives/dialog-footer.ts","../../../projects/lib/dialog/tokens/dialog-defaults.token.ts","../../../projects/lib/dialog/tokens/dialog-data.token.ts","../../../projects/lib/dialog/tokens/dialog-ref.token.ts","../../../projects/lib/dialog/directives/dialog-close.ts","../../../projects/lib/dialog/confirm/dialog-confirm.ts","../../../projects/lib/dialog/confirm/dialog-confirm.html","../../../projects/lib/dialog/dialog.ts","../../../projects/lib/dialog/with-dialog.ts"],"sourcesContent":["/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { type ConfigurableFocusTrap, FocusMonitor } from '@angular/cdk/a11y';\nimport type { OverlayRef } from '@angular/cdk/overlay';\nimport { type ComponentRef, type EffectRef, type Injector, type Signal, effect, untracked } from '@angular/core';\n\nimport { ReplaySubject } from 'rxjs';\n\nimport { wrRestoreFocus } from 'ngwr/utils';\n\n/**\n * Handle returned by `WrDialog.open()`.\n *\n * Wraps the underlying `OverlayRef` and tracks the close result. It is also\n * provided inside the dialog's own injector, so the projected content can\n * inject it and close itself — the counterpart to `[wrDialogClose]` when the\n * close is programmatic (after a save succeeds, say) rather than a click.\n *\n * @example\n * ```ts\n * // Caller side.\n * const ref = dialog.open<ConfirmComponent, boolean>(ConfirmComponent);\n * const result = await ref.awaitClose(); // boolean | undefined\n * ```\n *\n * @example\n * ```ts\n * // Content side — the dialog closes itself.\n * @Component({...})\n * export class ConfirmComponent {\n * private readonly ref = inject(WrDialogRef);\n *\n * save(): void {\n * this.store.save();\n * this.ref.close(true);\n * }\n * }\n * ```\n */\nexport class WrDialogRef<C, R = unknown> {\n /**\n * Emits the close result once and completes.\n *\n * A `ReplaySubject`, not a plain `Subject`, so the result survives a late\n * subscriber: content can close itself before `open()` has even returned, and\n * `awaitClose()` may be called long after the dismissal — both would otherwise\n * see only `complete` and resolve `undefined`.\n */\n readonly closed = new ReplaySubject<R | undefined>(1);\n\n /** @internal */\n componentRef: ComponentRef<C> | null = null;\n\n /** @internal */\n focusTrap: ConfigurableFocusTrap | null = null;\n\n /** @internal */\n previouslyFocused: HTMLElement | null = null;\n\n private readonly watchers: EffectRef[] = [];\n\n private readonly focusMonitor: FocusMonitor | null;\n\n /**\n * @param _overlayRef the overlay the dialog is mounted in.\n * @param injector what `closeWhen()` runs its watcher in. `WrDialog.open()`\n * passes the root injector; a ref built without one cannot watch.\n */\n constructor(\n private readonly _overlayRef: OverlayRef,\n private readonly injector?: Injector\n ) {\n // Resolved now: the injector may be gone by the time the dialog closes.\n this.focusMonitor = injector?.get(FocusMonitor, null) ?? null;\n }\n\n /** The instantiated dialog component. */\n get componentInstance(): C {\n if (!this.componentRef) {\n throw new Error('WrDialogRef: component not yet attached');\n }\n return this.componentRef.instance;\n }\n\n private isClosed = false;\n\n /** Close the dialog, optionally returning a result. */\n close(result?: R): void {\n if (this.isClosed) return;\n this.isClosed = true;\n for (const watcher of this.watchers.splice(0)) watcher.destroy();\n this.closed.next(result);\n this.closed.complete();\n // Content that closes itself while constructing gets here with\n // `OverlayRef.attach()` still on the stack — `componentRef` is assigned\n // only once attach returns. Disposing mid-attach leaves the CDK writing to\n // a detached host, so let the current task finish first.\n if (!this.componentRef) {\n queueMicrotask(() => this.teardown());\n return;\n }\n this.teardown();\n }\n\n private teardown(): void {\n this.focusTrap?.destroy();\n this.focusTrap = null;\n const restore = this.previouslyFocused;\n this.previouslyFocused = null;\n this._overlayRef.dispose();\n // Drop the destroyed component so a retained ref doesn't pin its instance,\n // host element and view in memory.\n this.componentRef = null;\n // Restore focus after disposal so the trigger is reachable again.\n if (restore && typeof restore.focus === 'function') {\n wrRestoreFocus(restore, this.focusMonitor);\n }\n }\n\n /**\n * Close the dialog once `source` reads `true`, with `result` - `undefined`\n * when omitted, which is what every dismissal closes with. A source that is\n * already `true` closes it on the next change detection, after the attach\n * has finished.\n *\n * The watcher belongs to the dialog: it runs in the root injector, so the\n * caller needs no injection context, and it is destroyed when the dialog\n * closes by any path, so a source that turns `true` later does nothing. Each\n * call adds a watcher; the first to fire closes. A closed dialog ignores the\n * call.\n *\n * @example\n * ```ts\n * const saved = computed(() => this.save.status() === 'resolved');\n * this.dialog.open(SavingComponent).closeWhen(saved, 'saved');\n * ```\n */\n closeWhen(source: Signal<boolean>, result?: R): void {\n if (this.isClosed) return;\n if (!this.injector) {\n throw new Error('WrDialogRef: closeWhen() needs a ref opened by WrDialog, which carries the injector');\n }\n this.watchers.push(\n effect(\n () => {\n if (source()) untracked(() => this.close(result));\n },\n { injector: this.injector }\n )\n );\n }\n\n /** Resolves with the close result when the dialog is dismissed. */\n awaitClose(): Promise<R | undefined> {\n return new Promise(resolve => {\n this.closed.subscribe({\n next: value => resolve(value),\n complete: () => resolve(undefined),\n });\n });\n }\n\n /** Underlying overlay ref — escape hatch for advanced cases. */\n get overlayRef(): OverlayRef {\n return this._overlayRef;\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 { Directive, ElementRef, inject } from '@angular/core';\n\nimport { wrCheckStyles } from 'ngwr/utils';\n\nlet uid = 0;\n\n/**\n * Styles a dialog title row. Use on a heading inside an opened dialog.\n * Auto-assigns an `id` so the dialog panel can reference it via\n * `aria-labelledby`.\n *\n * @example\n * ```html\n * <h2 wrDialogTitle>Confirm delete</h2>\n * ```\n */\n@Directive({\n selector: '[wrDialogTitle]',\n exportAs: 'wrDialogTitle',\n host: { class: 'wr-dialog__title', '[attr.id]': 'id' },\n})\nexport class WrDialogTitle {\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('dialog');\n }\n\n /** Generated id used for `aria-labelledby` wiring. */\n readonly id = `wr-dialog-title-${++uid}`;\n\n /** @internal */\n readonly elementRef = inject(ElementRef<HTMLElement>);\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 { CdkScrollable } from '@angular/cdk/scrolling';\nimport { Directive, input } from '@angular/core';\n\nimport { wrCheckStyles } from 'ngwr/utils';\n\nlet uid = 0;\n\n/**\n * Styles the scrollable body section of a dialog. Auto-assigns an `id` so an\n * `alertdialog` panel can reference it via `aria-describedby`.\n *\n * `CdkScrollable` is a host directive because this element is a real scroll\n * container (`overflow: auto`) and an anchored overlay opened from inside it has\n * to follow its trigger. CDK's `reposition()` strategy listens to\n * `ScrollDispatcher`, which is fed by registered scrollables plus ONE\n * non-capturing `document` listener — and element `scroll` does not bubble, so\n * without the registration a `<wr-select>` halfway down a long dialog form kept\n * its panel pinned to the viewport while the trigger scrolled away. Angular\n * Material carries the same host directive on `MatDialogContent` for the same\n * reason.\n *\n * @example\n * ```html\n * <div wrDialogContent>…body…</div>\n * ```\n */\n@Directive({\n selector: '[wrDialogContent]',\n host: { class: 'wr-dialog__content', '[attr.id]': 'id()' },\n hostDirectives: [CdkScrollable],\n})\nexport class WrDialogContent {\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('dialog');\n }\n\n /** The element's id, generated unless given. An `alertdialog` names it in `aria-describedby`. */\n readonly id = input(`wr-dialog-content-${++uid}`);\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 { Directive, computed, input } from '@angular/core';\n\nimport { wrCheckStyles } from 'ngwr/utils';\n\n/**\n * Footer row, typically holding action buttons.\n *\n * @example\n * ```html\n * <div wrDialogFooter align=\"end\">\n * <wr-btn wrDialogClose>Cancel</wr-btn>\n * <wr-btn color=\"danger\" (click)=\"confirm()\">Delete</wr-btn>\n * </div>\n * ```\n */\n@Directive({\n selector: '[wrDialogFooter]',\n host: { class: 'wr-dialog__footer', '[class]': 'classes()' },\n})\nexport class WrDialogFooter {\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('dialog');\n }\n\n /**\n * Horizontal alignment of the children.\n *\n * @default 'end'\n */\n readonly align = input<'start' | 'center' | 'end'>('end');\n\n protected readonly classes = computed(() => `wr-dialog__footer wr-dialog__footer--${this.align()}`);\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 type { WrDialogDefaults } from '../types';\n\n/** What `withDialog()` provides. @internal */\nexport const WR_DIALOG_DEFAULTS = new InjectionToken<WrDialogDefaults>('WR_DIALOG_DEFAULTS', {\n factory: (): WrDialogDefaults => ({}),\n});\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { InjectionToken } from '@angular/core';\n\n/**\n * Token that exposes the `data` payload passed to `WrDialog.open()`.\n *\n * @example\n * ```ts\n * @Component({...})\n * export class ConfirmComponent {\n * readonly data = inject<ConfirmData>(WR_DIALOG_DATA);\n * }\n * ```\n */\nexport const WR_DIALOG_DATA = new InjectionToken<unknown>('WR_DIALOG_DATA');\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 type { WrDialogRef } from '../dialog-ref';\n\n/**\n * Token exposing the open dialog's `WrDialogRef` to components and\n * directives rendered inside it (e.g. `[wrDialogClose]`).\n *\n * **Prefer `inject(WrDialogRef)`** — the ref is provided under the class token\n * too, and the class path is the documented one. It already covers both cases\n * you might reach for a token for: `inject(WrDialogRef, { optional: true })`\n * works for content that also renders outside a dialog, and\n * `inject<WrDialogRef<ConfirmComponent, boolean>>(WrDialogRef)` types the\n * generics without a cast.\n *\n * This token is the same object under a second key. It exists for the library's\n * own directives (`[wrDialogClose]`) and for swapping the provider out — a test\n * stub, say — without touching the class.\n *\n * @example\n * ```ts\n * @Component({...})\n * export class ConfirmComponent {\n * private readonly ref = inject<WrDialogRef<ConfirmComponent, boolean>>(WrDialogRef);\n *\n * confirm(): void {\n * this.ref.close(true);\n * }\n * }\n * ```\n */\nexport const WR_DIALOG_REF = new InjectionToken<WrDialogRef<unknown, unknown>>('WR_DIALOG_REF');\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 { Directive, inject, input } from '@angular/core';\n\nimport { wrCheckStyles } from 'ngwr/utils';\n\nimport type { WrDialogRef } from '../dialog-ref';\nimport { WR_DIALOG_REF } from '../tokens';\n\n/**\n * Closes the dialog when the host element is clicked.\n *\n * Optionally passes a `[wrDialogClose]` value as the close result.\n *\n * @example\n * ```html\n * <wr-btn wrDialogClose>Cancel</wr-btn>\n * <wr-btn color=\"primary\" [wrDialogClose]=\"true\">Confirm</wr-btn>\n * ```\n */\n@Directive({\n selector: '[wrDialogClose]',\n host: { '(click)': 'onClick()' },\n})\nexport class WrDialogClose<R = unknown> {\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('dialog');\n }\n\n /**\n * Value to pass to `close()`. When unset — or used as a bare attribute — the\n * dialog closes with `undefined`.\n */\n readonly result = input<R | undefined, R | undefined | ''>(undefined, {\n alias: 'wrDialogClose',\n // A bare `wrDialogClose` attribute arrives as the empty string; that means\n // \"no result\", not a result of `''`. Matches `wrDrawerClose`.\n transform: value => (value === '' ? undefined : value),\n });\n\n private readonly ref = inject<WrDialogRef<unknown, R>>(WR_DIALOG_REF, { optional: true });\n\n protected onClick(): void {\n this.ref?.close(this.result());\n }\n}\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { Component, ViewEncapsulation, inject, signal } from '@angular/core';\n\nimport { WrButton } from 'ngwr/button';\nimport { useI18nText } from 'ngwr/i18n';\nimport { wrCheckStyles } from 'ngwr/utils';\n\nimport { WrDialogRef } from '../dialog-ref';\nimport { WrDialogContent, WrDialogFooter, WrDialogTitle } from '../directives';\nimport { WR_DIALOG_DATA } from '../tokens';\nimport type { WrDialogIntent } from '../types';\n\nimport type { WrDialogConfirmData } from './dialog-confirm-data';\n\nconst INTENT_COLORS: Partial<Record<WrDialogIntent, 'danger' | 'warning'>> = { danger: 'danger', warning: 'warning' };\n\n/**\n * The content `WrDialog.confirm()` and `WrDialog.alert()` mount: the dialog's\n * own title, content and footer around two `wr-btn`, or one for an alert. Not\n * exported; the service is the API.\n */\n@Component({\n selector: 'wr-dialog-confirm',\n templateUrl: './dialog-confirm.html',\n imports: [WrButton, WrDialogTitle, WrDialogContent, WrDialogFooter],\n encapsulation: ViewEncapsulation.None,\n host: {\n class: 'wr-dialog-confirm',\n '[class.wr-dialog-confirm--danger]': 'danger',\n },\n})\nexport class WrDialogConfirm {\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('dialog');\n }\n\n protected readonly data = inject<WrDialogConfirmData>(WR_DIALOG_DATA);\n protected readonly ref = inject<WrDialogRef<WrDialogConfirm, boolean>>(WrDialogRef);\n\n protected readonly alert = this.data.alert === true;\n protected readonly intent = this.data.intent ?? null;\n // An alert's button dismisses a message, so it never takes the intent's color.\n protected readonly color =\n this.data.confirmColor ?? (this.alert || !this.intent ? 'primary' : (INTENT_COLORS[this.intent] ?? 'primary'));\n protected readonly danger = this.color === 'danger';\n\n protected readonly confirmLabel = useI18nText(signal(this.data.confirmLabel ?? null), 'common.ok', 'OK');\n protected readonly cancelLabel = useI18nText(signal(this.data.cancelLabel ?? null), 'common.cancel', 'Cancel');\n}\n","<h2 wrDialogTitle>\n @if (intent) {\n <svg\n [class]=\"`wr-dialog-confirm__icon wr-dialog-confirm__icon--${intent}`\"\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 <!-- The glyphs `wr-alert` and `wr-toast` draw for the same four meanings. -->\n @switch (intent) {\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 {{ data.title }}\n</h2>\n@if (data.message) {\n <div wrDialogContent>{{ data.message }}</div>\n}\n<!--\n Initial focus sits on the safe answer of a danger question and on the confirm\n button otherwise, through the `cdkFocusInitial` the focus trap already reads.\n An alert has one button, and it takes the focus.\n-->\n<div wrDialogFooter>\n @if (alert) {\n <button\n wr-btn\n type=\"button\"\n class=\"wr-dialog-confirm__action wr-dialog-confirm__action--ok\"\n [color]=\"color\"\n [attr.cdkFocusInitial]=\"''\"\n (click)=\"ref.close()\"\n >\n {{ confirmLabel() }}\n </button>\n } @else {\n <button\n wr-btn\n type=\"button\"\n class=\"wr-dialog-confirm__action wr-dialog-confirm__action--cancel\"\n [attr.cdkFocusInitial]=\"danger ? '' : null\"\n (click)=\"ref.close(false)\"\n >\n {{ cancelLabel() }}\n </button>\n <button\n wr-btn\n type=\"button\"\n class=\"wr-dialog-confirm__action wr-dialog-confirm__action--confirm\"\n [color]=\"color\"\n [attr.cdkFocusInitial]=\"danger ? null : ''\"\n (click)=\"ref.close(true)\"\n >\n {{ confirmLabel() }}\n </button>\n }\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 { ConfigurableFocusTrapFactory } from '@angular/cdk/a11y';\nimport { Directionality } from '@angular/cdk/bidi';\nimport { type OverlayRef, ScrollStrategyOptions } from '@angular/cdk/overlay';\nimport { ComponentPortal, type ComponentType } from '@angular/cdk/portal';\nimport { Location, isPlatformBrowser } from '@angular/common';\nimport {\n DestroyRef,\n EnvironmentInjector,\n Service,\n Injector,\n PLATFORM_ID,\n type WritableSignal,\n afterEveryRender,\n inject,\n signal,\n} from '@angular/core';\n\nimport { WrI18n } from 'ngwr/i18n';\nimport { WrMeta } from 'ngwr/meta';\nimport { WR_OVERLAY, WrOverlayOrder, wrAppendOverlayClose, wrFollowDirection } from 'ngwr/overlay';\nimport { wrToClassList } from 'ngwr/utils';\n\nimport { WrDialogConfirm } from './confirm/dialog-confirm';\nimport type { WrDialogConfirmData } from './confirm/dialog-confirm-data';\nimport { WrDialogRef } from './dialog-ref';\nimport { WR_DIALOG_DATA, WR_DIALOG_DEFAULTS, WR_DIALOG_REF } from './tokens';\nimport type { WrDialogAlertOptions, WrDialogConfirmOptions, WrDialogOptions } from './types';\n\nconst DEFAULT_PANEL_CLASS = 'wr-dialog-panel';\nconst DEFAULT_BACKDROP_CLASS = 'wr-dialog-backdrop';\n\n/**\n * Opens dialog components in an isolated NGWR overlay.\n *\n * Uses `WR_OVERLAY`, so dialogs render into NGWR's own overlay container\n * and never collide with other CDK consumers (Material, NG-ZORRO, etc.).\n *\n * @example\n * ```ts\n * const dialog = inject(WrDialog);\n *\n * const ref = dialog.open(ConfirmComponent, {\n * data: { message: 'Delete this item?' },\n * width: '24rem',\n * });\n *\n * const ok = await ref.awaitClose();\n * if (ok) remove();\n * ```\n *\n * @see https://ngwr.dev/reference/components/dialog\n */\n@Service()\nexport class WrDialog {\n private readonly overlay = inject(WR_OVERLAY);\n private readonly scrollStrategies = inject(ScrollStrategyOptions);\n private readonly parentInjector = inject(EnvironmentInjector);\n private readonly focusTrapFactory = inject(ConfigurableFocusTrapFactory);\n private readonly isBrowser = isPlatformBrowser(inject(PLATFORM_ID));\n private readonly i18n = inject(WrI18n, { optional: true });\n private readonly dir = inject(Directionality, { optional: true });\n // Resolvable wherever the CDK's own `Overlay` is — it injects the same thing\n // to implement `disposeOnNavigation`.\n private readonly location = inject(Location);\n private readonly destroyRef = inject(DestroyRef);\n private readonly defaults = inject(WR_DIALOG_DEFAULTS);\n private readonly order = inject(WrOverlayOrder);\n\n open<C, R = unknown, D = unknown>(component: ComponentType<C>, options: WrDialogOptions<D> = {}): WrDialogRef<C, R> {\n const overlayRef: OverlayRef = this.overlay.create({\n positionStrategy: this.overlay.position().global().centerHorizontally().centerVertically(),\n scrollStrategy: this.scrollStrategies.block(),\n hasBackdrop: true,\n backdropClass: DEFAULT_BACKDROP_CLASS,\n panelClass: wrToClassList(DEFAULT_PANEL_CLASS, options.panelClass),\n width: options.width,\n maxWidth: options.maxWidth,\n });\n\n // The CDK captures the direction as a string at create and never looks\n // again, so an app that flips while a dialog is up leaves the panel behind.\n // Nothing here derives from it — the box is centred and its x offset is\n // empty, so `apply()`'s RTL branch moves nothing — but the `dir` attribute\n // is what the dialog's own logical CSS and every ngwr control inside it\n // resolve `start` and `end` against, so it has to follow. No teardown kept:\n // the follower ends on the ref's own `detachments()`, which every dismissal\n // path goes through, and each `open()` creates a fresh ref of its own.\n wrFollowDirection(overlayRef, this.dir, this.parentInjector);\n\n const dialogRef = new WrDialogRef<C, R>(overlayRef, this.parentInjector);\n\n if (this.isBrowser) {\n const active = document.activeElement;\n dialogRef.previouslyFocused = active instanceof HTMLElement ? active : null;\n }\n\n const injector = Injector.create({\n parent: this.parentInjector,\n providers: [\n { provide: WR_DIALOG_DATA, useValue: options.data },\n { provide: WR_DIALOG_REF, useValue: dialogRef },\n // Provided as its own token as well, so dialog content can reach for\n // the familiar `inject(WrDialogRef)` and close itself.\n { provide: WrDialogRef, useValue: dialogRef },\n ],\n });\n\n const portal = new ComponentPortal(component, null, injector);\n dialogRef.componentRef = overlayRef.attach(portal);\n overlayRef.detachments().subscribe(this.order.add(overlayRef.hostElement, options.toasts));\n\n // Wired BEFORE the panel is decorated, and the order is the fix: everything\n // below attaches attributes, a ✕ and a focus trap to an overlay that is\n // already on screen, so anything that throws in there used to leave an\n // `aria-modal` panel with no dismissal path at all — no ✕, no backdrop\n // handler, no Escape — over the whole application, and no ref for the caller\n // to close it with. A dialog that fails to finish opening must still be one\n // the user can get rid of. Overlay subscriptions complete when the overlay is\n // disposed, so no explicit teardown is required.\n if (options.closeOnBackdropClick !== false) {\n overlayRef.backdropClick().subscribe(() => dialogRef.close());\n }\n if (options.closeOnEscape !== false) {\n overlayRef.keydownEvents().subscribe(event => {\n if (event.key === 'Escape') {\n event.preventDefault();\n dialogRef.close();\n }\n });\n }\n if (options.closeOnNavigation !== false) {\n this.watchNavigation(overlayRef, dialogRef);\n }\n\n if (this.isBrowser) {\n const host = overlayRef.overlayElement;\n const role = options.role ?? 'dialog';\n host.setAttribute('role', role);\n host.setAttribute('aria-modal', 'true');\n // Built-in dismiss. Appended after the content portal so it paints above\n // it, and marked on the panel so the title reserves the corner gutter.\n if (options.closable !== false) {\n host.classList.add('wr-dialog-panel--closable');\n const label = options.closeLabel ?? this.closeLabel();\n wrAppendOverlayClose(host, 'wr-dialog__close', label, () => dialogRef.close());\n }\n // Wire aria-labelledby to wrDialogTitle's auto-id once content is in DOM.\n // Has to wait for a render, not a microtask: attaching the portal only\n // schedules change detection, so under zoneless CD a microtask runs while\n // the content is still an empty view and the title id doesn't exist yet.\n //\n // And after EVERY render, not just the next one: the title belongs to the\n // caller's component, so an `@if` or a late-arriving heading can replace\n // or remove the element the attribute names. A reference to a node that is\n // no longer there is not a name — the dialog announces as unnamed — so a\n // missing title clears the attribute rather than leaving it dangling.\n //\n // An `alertdialog` is described by its content the same way: the message\n // is the dialog, and it can be conditional too.\n const tabTitle = (options.tabTitle ?? this.defaults.tabTitle) ? this.nameTab(overlayRef) : null;\n const labelSync = afterEveryRender(\n () => {\n const titleEl = host.querySelector<HTMLElement>('[wrDialogTitle], [wr-dialog-title]');\n if (titleEl?.id) host.setAttribute('aria-labelledby', titleEl.id);\n else host.removeAttribute('aria-labelledby');\n tabTitle?.set((titleEl?.textContent ?? '').replace(/\\s+/g, ' ').trim());\n if (role !== 'alertdialog') return;\n const contentEl = host.querySelector<HTMLElement>('[wrDialogContent], [wr-dialog-content]');\n if (contentEl?.id) host.setAttribute('aria-describedby', contentEl.id);\n else host.removeAttribute('aria-describedby');\n },\n { injector: this.parentInjector }\n );\n // The hook is bound to the root injector, so it outlives the dialog unless\n // it is torn down with it. `detachments()` fires on dispose, which is the\n // one path every dismissal goes through.\n overlayRef.detachments().subscribe(() => labelSync.destroy());\n // Trap focus inside the dialog and move initial focus in.\n const trap = this.focusTrapFactory.create(host);\n dialogRef.focusTrap = trap;\n void trap.focusInitialElementWhenReady();\n }\n\n return dialogRef;\n }\n\n /**\n * Ask a yes-or-no question and get the answer: `true` only when the user\n * pressed the confirm button. Escape, the backdrop, the cancel button, a\n * navigation and the application being torn down all resolve `false`. The\n * promise settles exactly once and never rejects, so the caller needs no\n * `catch` and no cleanup.\n *\n * The dialog is `role=\"alertdialog\"`, named by `title` and described by\n * `message`, with no corner dismiss: the two buttons are the answers. Labels\n * fall back to the `common.ok` and `common.cancel` catalog keys. With\n * `confirmColor: 'danger'` initial focus is on the cancel button; otherwise it\n * is on the confirm button. Focus returns to the opener on close, as it does\n * for `open()`.\n *\n * `intent` puts an icon before the title, and `danger` or `warning` color the\n * confirm button unless `confirmColor` is set, so a `danger` question also\n * starts on the cancel button.\n *\n * On the server nothing can answer, so it resolves `false` at once and opens\n * nothing.\n *\n * @example\n * ```ts\n * const ok = await dialog.confirm({\n * title: 'Delete this item?',\n * message: 'This cannot be undone.',\n * confirmLabel: 'Delete',\n * intent: 'danger',\n * });\n * if (ok) remove();\n * ```\n */\n async confirm(options: WrDialogConfirmOptions): Promise<boolean> {\n if (!this.isBrowser) return false;\n const { title, message, confirmLabel, cancelLabel, confirmColor, intent, ...rest } = options;\n return (await this.ask(rest, { title, message, confirmLabel, cancelLabel, confirmColor, intent })) === true;\n }\n\n /**\n * Show a message with one button and wait until the user has dismissed it.\n * The button, Escape, the backdrop, a navigation and the application being\n * torn down all resolve the promise, which settles exactly once with no\n * value and never rejects.\n *\n * The dialog is `confirm()`'s with one button: `role=\"alertdialog\"` for every\n * intent, named by `title` and described by `message`, with no corner\n * dismiss. The button takes the initial focus and its label falls back to the\n * `common.ok` catalog key. `intent` puts an icon before the title.\n *\n * On the server it resolves at once and opens nothing.\n *\n * @example\n * ```ts\n * await dialog.alert({\n * title: 'Range too large',\n * message: 'Pick at most 31 days to export.',\n * okLabel: 'Close',\n * intent: 'danger',\n * });\n * ```\n */\n async alert(options: WrDialogAlertOptions): Promise<void> {\n if (!this.isBrowser) return;\n const { title, message, okLabel, intent, ...rest } = options;\n await this.ask(rest, { title, message, confirmLabel: okLabel, intent, alert: true });\n }\n\n private ask(options: WrDialogOptions, data: WrDialogConfirmData): Promise<boolean | undefined> {\n const ref = this.open<WrDialogConfirm, boolean, WrDialogConfirmData>(WrDialogConfirm, {\n ...options,\n role: 'alertdialog',\n closable: false,\n data,\n });\n // The root injector going away takes the overlay container with it and\n // completes nothing, which would leave this promise pending for good.\n const unhook = this.destroyRef.onDestroy(() => ref.close());\n ref.closed.subscribe({ complete: unhook });\n return ref.awaitClose();\n }\n\n /**\n * Tie the dialog's lifetime to the URL it was opened on.\n *\n * Nothing else does. The overlay belongs to a root service and is dismissed\n * only by the backdrop, Escape or an explicit `close()`, so pressing Back\n * swapped the routed view underneath and left the modal pane, its backdrop and\n * its focus trap sitting over a page the user never opened them on.\n *\n * `onUrlChange`, not `Location.subscribe()` — which is what CDK's own\n * `disposeOnNavigation` uses: `subscribe` fires on popstate alone, so an\n * in-app `router.navigate()` left the dialog standing. And `dialogRef.close()`\n * rather than disposing the overlay behind the ref's back, which would never\n * emit `closed`, never destroy the focus trap, and leave `awaitClose()`\n * pending forever.\n */\n private watchNavigation<C, R>(overlayRef: OverlayRef, dialogRef: WrDialogRef<C, R>): void {\n const stopWatching = this.location.onUrlChange(() => dialogRef.close());\n // Unhooked a microtask late, because `Location` notifies its listeners with\n // a `forEach` and unregistering splices the array it is iterating: removing\n // ours synchronously from inside the notification would shift the next entry\n // into the slot forEach has already passed, and a SECOND stacked dialog\n // would be skipped and left behind.\n overlayRef.detachments().subscribe(() => queueMicrotask(stopWatching));\n }\n\n /**\n * Put the dialog's title in front of the page title for as long as the\n * overlay is attached, and hand back where to write that title.\n *\n * A `titlePrefix` layer rather than a composed `title`: the page title stays\n * whatever the layers under it resolve to, so a page that retitles itself\n * under an open dialog is followed, and closing restores nothing, it only\n * removes the layer. Stacked dialogs each hold a layer and the top one wins.\n *\n * `WrMeta` is resolved here and not injected with the service: constructing\n * it applies its defaults to `<head>`, which an app that never asked for\n * `tabTitle` must not pay for.\n */\n private nameTab(overlayRef: OverlayRef): WritableSignal<string> {\n const heading = signal('');\n const layer = this.parentInjector.get(WrMeta).bind(() => (heading() ? { titlePrefix: heading() } : {}));\n overlayRef.detachments().subscribe(() => layer.pop());\n return heading;\n }\n\n /**\n * The dismiss button's accessible name.\n *\n * Two failure modes, and resolving PER OPEN is what covers both. `t()` hands\n * back the KEY on a miss, and `WrI18n` is root-provided with an empty catalog\n * by default, so an app that never configured i18n named its dismiss button\n * \"dialog.close\" — a name axe cannot fault, because a name is present, and a\n * screen reader reads out verbatim. Resolving once at injection time fixed\n * that but froze the answer: this is a root service, constructed before an\n * async catalog has loaded, so a localized app got the English fallback on\n * every dialog it ever opened.\n */\n private closeLabel(): string {\n const resolved = this.i18n?.t('dialog.close');\n return !resolved || resolved === 'dialog.close' ? 'Close dialog' : resolved;\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 WrFeature, wrFeature } from 'ngwr/utils';\n\nimport { WR_DIALOG_DEFAULTS } from './tokens';\nimport type { WrDialogDefaults } from './types';\n\n/**\n * App-wide dialog defaults, as a feature of `provideWr()`: today `tabTitle`,\n * so every dialog names the browser tab while it is open. The same option on\n * `open()` or `confirm()` still wins.\n *\n * Bootstrap only: `WrDialog` is root-provided and reads it once, from the root\n * injector, so in a route's `providers` it changes nothing.\n *\n * @example\n * ```ts\n * import { provideWr } from 'ngwr';\n * import { withDialog } from 'ngwr/dialog';\n *\n * bootstrapApplication(App, {\n * providers: [provideWr(withDialog({ tabTitle: true }))],\n * });\n * ```\n */\nexport function withDialog(defaults: WrDialogDefaults): WrFeature<'dialog'> {\n return wrFeature('dialog', [{ provide: WR_DIALOG_DEFAULTS, useValue: defaults }]);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AA4CA,IAAa,cAAb,MAAwB;CA8BH;CACA;CAtBV,SAAS,IAAI,cAA6B,CAAC;CAGpD,eAAuC;CAGvC,YAA0C;CAG1C,oBAAwC;CAEvB,WAAwB,CAAA;CAExB;CAOjB,YACmB,aACA,UAAmB;EADnB,KAAA,cAAA;EACA,KAAA,WAAA;EAGjB,KAAK,eAAe,UAAU,IAAI,cAAc,IAAI,KAAK;CAC3D;CAGA,IAAI,oBAAiB;EACnB,IAAI,CAAC,KAAK,cACR,MAAM,IAAI,MAAM,yCAAyC;EAE3D,OAAO,KAAK,aAAa;CAC3B;CAEQ,WAAW;CAGnB,MAAM,QAAU;EACd,IAAI,KAAK,UAAU;EACnB,KAAK,WAAW;EAChB,KAAK,MAAM,WAAW,KAAK,SAAS,OAAO,CAAC,GAAG,QAAQ,QAAO;EAC9D,KAAK,OAAO,KAAK,MAAM;EACvB,KAAK,OAAO,SAAQ;EAKpB,IAAI,CAAC,KAAK,cAAc;GACtB,qBAAqB,KAAK,SAAQ,CAAE;GACpC;EACF;EACA,KAAK,S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A;CAAR,OAAA,QAAA,GAAA,mBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,UAAA;EAAA,MAAA;CAAQ,CAAA;;AAAR,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAQ,YAAA,CAAA,EADpB,MAAA,Q;;;;;;;;AC7BD,SAAgB,WAAW,UAA0B;CACnD,OAAO,UAAU,UAAU,CAAC;EAAE,SAAS;EAAoB,UAAU;CAAQ,CAAE,CAAC;AAClF"}
@@ -1,9 +1,13 @@
1
1
  import * as i0 from "@angular/core";
2
- import { DestroyRef, Directive, ElementRef, NgZone, PLATFORM_ID, afterEveryRender, afterNextRender, effect, inject, input, output } from "@angular/core";
2
+ import { DestroyRef, Directive, ElementRef, Injector, NgZone, PLATFORM_ID, afterEveryRender, afterNextRender, effect, inject, input, output, signal } from "@angular/core";
3
3
  import { coerceBooleanProperty, coerceNumberProperty } from "@angular/cdk/coercion";
4
4
  import { DOCUMENT as DOCUMENT$1, isPlatformBrowser } from "@angular/common";
5
5
  import { wrRestoreFocus } from "ngwr/utils";
6
- import { FocusMonitor } from "@angular/cdk/a11y";
6
+ import { useI18nText } from "ngwr/i18n";
7
+ import { WrPopover, wrUseTextTooltip } from "ngwr/popover";
8
+ import { FocusMonitor, LiveAnnouncer } from "@angular/cdk/a11y";
9
+ import { WR_COPIED_DURATION } from "ngwr/clipboard";
10
+ import { WrToast } from "ngwr/toast";
7
11
  /**
8
12
  * @license
9
13
  *
@@ -257,11 +261,32 @@ i0.ɵɵngDeclareClassMetadata({
257
261
  * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE
258
262
  */
259
263
  var WrCopyToClipboard = class WrCopyToClipboard {
264
+ constructor() {
265
+ inject(DestroyRef).onDestroy(() => {
266
+ this.destroyed = true;
267
+ this.clearTimer();
268
+ });
269
+ }
260
270
  wrCopyToClipboard = input.required(...ngDevMode ? [{ debugName: "wrCopyToClipboard" }] : /* istanbul ignore next */ []);
271
+ wrCopyToClipboardToast = input(false, {
272
+ ...ngDevMode ? { debugName: "wrCopyToClipboardToast" } : /* istanbul ignore next */ {},
273
+ transform: coerceBooleanProperty
274
+ });
275
+ copiedLabel = input(null, ...ngDevMode ? [{ debugName: "copiedLabel" }] : /* istanbul ignore next */ []);
261
276
  copied = output();
262
277
  copyFailed = output();
278
+ justCopied = signal(false, ...ngDevMode ? [{ debugName: "justCopied" }] : /* istanbul ignore next */ []);
279
+ resolvedCopiedLabel = useI18nText(this.copiedLabel, "copyToClipboard.copied", "Copied");
263
280
  focusMonitor = inject(FocusMonitor);
264
281
  doc = inject(DOCUMENT$1);
282
+ injector = inject(Injector);
283
+ tooltip = wrUseTextTooltip();
284
+ hostPopover = inject(WrPopover, {
285
+ self: true,
286
+ optional: true
287
+ });
288
+ destroyed = false;
289
+ timer = null;
265
290
  async copy() {
266
291
  const text = this.wrCopyToClipboard();
267
292
  const async = this.doc.defaultView?.navigator?.clipboard;
@@ -276,9 +301,34 @@ var WrCopyToClipboard = class WrCopyToClipboard {
276
301
  this.copyFailed.emit(error);
277
302
  return false;
278
303
  }
304
+ if (this.destroyed) return true;
305
+ this.confirm();
279
306
  this.copied.emit(text);
280
307
  return true;
281
308
  }
309
+ confirm() {
310
+ const label = this.resolvedCopiedLabel();
311
+ this.clearTimer();
312
+ this.justCopied.set(true);
313
+ if (this.wrCopyToClipboardToast()) this.injector.get(WrToast).show({
314
+ type: "success",
315
+ message: label,
316
+ showCopy: false
317
+ });
318
+ else {
319
+ if (this.hostPopover?.mode() === "tooltip") this.hostPopover.close();
320
+ this.tooltip.show(label);
321
+ this.injector.get(LiveAnnouncer).announce(label, "polite", WR_COPIED_DURATION);
322
+ }
323
+ this.timer = setTimeout(() => {
324
+ this.justCopied.set(false);
325
+ this.tooltip.hide();
326
+ }, WR_COPIED_DURATION);
327
+ }
328
+ clearTimer() {
329
+ if (this.timer !== null) clearTimeout(this.timer);
330
+ this.timer = null;
331
+ }
282
332
  fallback(text) {
283
333
  const node = this.doc.createElement("textarea");
284
334
  node.value = text;
@@ -312,18 +362,38 @@ var WrCopyToClipboard = class WrCopyToClipboard {
312
362
  type: WrCopyToClipboard,
313
363
  isStandalone: true,
314
364
  selector: "[wrCopyToClipboard]",
315
- inputs: { wrCopyToClipboard: {
316
- classPropertyName: "wrCopyToClipboard",
317
- publicName: "wrCopyToClipboard",
318
- isSignal: true,
319
- isRequired: true,
320
- transformFunction: null
321
- } },
365
+ inputs: {
366
+ wrCopyToClipboard: {
367
+ classPropertyName: "wrCopyToClipboard",
368
+ publicName: "wrCopyToClipboard",
369
+ isSignal: true,
370
+ isRequired: true,
371
+ transformFunction: null
372
+ },
373
+ wrCopyToClipboardToast: {
374
+ classPropertyName: "wrCopyToClipboardToast",
375
+ publicName: "wrCopyToClipboardToast",
376
+ isSignal: true,
377
+ isRequired: false,
378
+ transformFunction: null
379
+ },
380
+ copiedLabel: {
381
+ classPropertyName: "copiedLabel",
382
+ publicName: "copiedLabel",
383
+ isSignal: true,
384
+ isRequired: false,
385
+ transformFunction: null
386
+ }
387
+ },
322
388
  outputs: {
323
389
  copied: "copied",
324
390
  copyFailed: "copyFailed"
325
391
  },
326
- host: { listeners: { "click": "copy()" } },
392
+ host: {
393
+ listeners: { "click": "copy()" },
394
+ properties: { "class.wr-copy-to-clipboard--copied": "justCopied()" },
395
+ classAttribute: "wr-copy-to-clipboard"
396
+ },
327
397
  exportAs: ["wrCopyToClipboard"],
328
398
  ngImport: i0
329
399
  });
@@ -338,9 +408,14 @@ i0.ɵɵngDeclareClassMetadata({
338
408
  args: [{
339
409
  selector: "[wrCopyToClipboard]",
340
410
  exportAs: "wrCopyToClipboard",
341
- host: { "(click)": "copy()" }
411
+ host: {
412
+ class: "wr-copy-to-clipboard",
413
+ "[class.wr-copy-to-clipboard--copied]": "justCopied()",
414
+ "(click)": "copy()"
415
+ }
342
416
  }]
343
417
  }],
418
+ ctorParameters: () => [],
344
419
  propDecorators: {
345
420
  wrCopyToClipboard: [{
346
421
  type: i0.Input,
@@ -350,6 +425,22 @@ i0.ɵɵngDeclareClassMetadata({
350
425
  required: true
351
426
  }]
352
427
  }],
428
+ wrCopyToClipboardToast: [{
429
+ type: i0.Input,
430
+ args: [{
431
+ isSignal: true,
432
+ alias: "wrCopyToClipboardToast",
433
+ required: false
434
+ }]
435
+ }],
436
+ copiedLabel: [{
437
+ type: i0.Input,
438
+ args: [{
439
+ isSignal: true,
440
+ alias: "copiedLabel",
441
+ required: false
442
+ }]
443
+ }],
353
444
  copied: [{
354
445
  type: i0.Output,
355
446
  args: ["copied"]