ngwr 15.3.0 → 15.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (162) hide show
  1. package/bits/border-glow/styles/_rules.scss +60 -49
  2. package/bits/click-spark/click-spark.scss +5 -1
  3. package/bits/click-spark/styles/_index.scss +10 -15
  4. package/bits/click-spark/styles/_rules.scss +20 -0
  5. package/comment/styles/_index.scss +270 -0
  6. package/dialog/styles/_index.scss +6 -0
  7. package/fesm2022/ngwr-bits-aurora.mjs +108 -52
  8. package/fesm2022/ngwr-bits-aurora.mjs.map +1 -1
  9. package/fesm2022/ngwr-bits-border-glow-testing.mjs +8 -8
  10. package/fesm2022/ngwr-bits-border-glow-testing.mjs.map +1 -1
  11. package/fesm2022/ngwr-bits-border-glow.mjs +29 -26
  12. package/fesm2022/ngwr-bits-border-glow.mjs.map +1 -1
  13. package/fesm2022/ngwr-bits-dot-grid.mjs +11 -14
  14. package/fesm2022/ngwr-bits-dot-grid.mjs.map +1 -1
  15. package/fesm2022/ngwr-bits-fuzzy-text.mjs +18 -4
  16. package/fesm2022/ngwr-bits-fuzzy-text.mjs.map +1 -1
  17. package/fesm2022/ngwr-bits-ripple-grid.mjs +14 -13
  18. package/fesm2022/ngwr-bits-ripple-grid.mjs.map +1 -1
  19. package/fesm2022/ngwr-bits-splash-cursor.mjs +21 -10
  20. package/fesm2022/ngwr-bits-splash-cursor.mjs.map +1 -1
  21. package/fesm2022/ngwr-bits-waves.mjs +10 -15
  22. package/fesm2022/ngwr-bits-waves.mjs.map +1 -1
  23. package/fesm2022/ngwr-comment-testing.mjs +60 -0
  24. package/fesm2022/ngwr-comment-testing.mjs.map +1 -0
  25. package/fesm2022/ngwr-comment.mjs +516 -0
  26. package/fesm2022/ngwr-comment.mjs.map +1 -0
  27. package/fesm2022/ngwr-dialog-testing.mjs +14 -0
  28. package/fesm2022/ngwr-dialog-testing.mjs.map +1 -1
  29. package/fesm2022/ngwr-dialog.mjs +293 -134
  30. package/fesm2022/ngwr-dialog.mjs.map +1 -1
  31. package/fesm2022/ngwr-drawer.mjs +2 -0
  32. package/fesm2022/ngwr-drawer.mjs.map +1 -1
  33. package/fesm2022/ngwr-editor.mjs +1 -1
  34. package/fesm2022/ngwr-hotkey.mjs +86 -6
  35. package/fesm2022/ngwr-hotkey.mjs.map +1 -1
  36. package/fesm2022/ngwr-i18n-ar.mjs +19 -0
  37. package/fesm2022/ngwr-i18n-ar.mjs.map +1 -1
  38. package/fesm2022/ngwr-i18n-cs.mjs +19 -0
  39. package/fesm2022/ngwr-i18n-cs.mjs.map +1 -1
  40. package/fesm2022/ngwr-i18n-de.mjs +19 -0
  41. package/fesm2022/ngwr-i18n-de.mjs.map +1 -1
  42. package/fesm2022/ngwr-i18n-en.mjs +19 -0
  43. package/fesm2022/ngwr-i18n-en.mjs.map +1 -1
  44. package/fesm2022/ngwr-i18n-es.mjs +19 -0
  45. package/fesm2022/ngwr-i18n-es.mjs.map +1 -1
  46. package/fesm2022/ngwr-i18n-fr.mjs +19 -0
  47. package/fesm2022/ngwr-i18n-fr.mjs.map +1 -1
  48. package/fesm2022/ngwr-i18n-he.mjs +19 -0
  49. package/fesm2022/ngwr-i18n-he.mjs.map +1 -1
  50. package/fesm2022/ngwr-i18n-hi.mjs +19 -0
  51. package/fesm2022/ngwr-i18n-hi.mjs.map +1 -1
  52. package/fesm2022/ngwr-i18n-id.mjs +19 -0
  53. package/fesm2022/ngwr-i18n-id.mjs.map +1 -1
  54. package/fesm2022/ngwr-i18n-it.mjs +19 -0
  55. package/fesm2022/ngwr-i18n-it.mjs.map +1 -1
  56. package/fesm2022/ngwr-i18n-ja.mjs +19 -0
  57. package/fesm2022/ngwr-i18n-ja.mjs.map +1 -1
  58. package/fesm2022/ngwr-i18n-ko.mjs +19 -0
  59. package/fesm2022/ngwr-i18n-ko.mjs.map +1 -1
  60. package/fesm2022/ngwr-i18n-nl.mjs +19 -0
  61. package/fesm2022/ngwr-i18n-nl.mjs.map +1 -1
  62. package/fesm2022/ngwr-i18n-pl.mjs +19 -0
  63. package/fesm2022/ngwr-i18n-pl.mjs.map +1 -1
  64. package/fesm2022/ngwr-i18n-pt.mjs +19 -0
  65. package/fesm2022/ngwr-i18n-pt.mjs.map +1 -1
  66. package/fesm2022/ngwr-i18n-ru.mjs +19 -0
  67. package/fesm2022/ngwr-i18n-ru.mjs.map +1 -1
  68. package/fesm2022/ngwr-i18n-sv.mjs +19 -0
  69. package/fesm2022/ngwr-i18n-sv.mjs.map +1 -1
  70. package/fesm2022/ngwr-i18n-tr.mjs +19 -0
  71. package/fesm2022/ngwr-i18n-tr.mjs.map +1 -1
  72. package/fesm2022/ngwr-i18n-uk.mjs +19 -0
  73. package/fesm2022/ngwr-i18n-uk.mjs.map +1 -1
  74. package/fesm2022/ngwr-i18n-vi.mjs +19 -0
  75. package/fesm2022/ngwr-i18n-vi.mjs.map +1 -1
  76. package/fesm2022/ngwr-i18n-zh-tw.mjs +19 -0
  77. package/fesm2022/ngwr-i18n-zh-tw.mjs.map +1 -1
  78. package/fesm2022/ngwr-i18n-zh.mjs +19 -0
  79. package/fesm2022/ngwr-i18n-zh.mjs.map +1 -1
  80. package/fesm2022/ngwr-input-number-testing.mjs.map +1 -1
  81. package/fesm2022/ngwr-input-number.mjs +109 -12
  82. package/fesm2022/ngwr-input-number.mjs.map +1 -1
  83. package/fesm2022/ngwr-keyboard.mjs +78 -18
  84. package/fesm2022/ngwr-keyboard.mjs.map +1 -1
  85. package/fesm2022/ngwr-pipes.mjs +162 -51
  86. package/fesm2022/ngwr-pipes.mjs.map +1 -1
  87. package/fesm2022/ngwr-platform.mjs +134 -2
  88. package/fesm2022/ngwr-platform.mjs.map +1 -1
  89. package/fesm2022/ngwr-schema-form.mjs +2 -1
  90. package/fesm2022/ngwr-schema-form.mjs.map +1 -1
  91. package/fesm2022/ngwr-select.mjs.map +1 -1
  92. package/fesm2022/ngwr-statistic.mjs +11 -16
  93. package/fesm2022/ngwr-statistic.mjs.map +1 -1
  94. package/fesm2022/ngwr-storage.mjs +54 -33
  95. package/fesm2022/ngwr-storage.mjs.map +1 -1
  96. package/fesm2022/ngwr-table.mjs +90 -34
  97. package/fesm2022/ngwr-table.mjs.map +1 -1
  98. package/fesm2022/ngwr-transfer.mjs +1 -1
  99. package/fesm2022/ngwr-utils-router.mjs +165 -0
  100. package/fesm2022/ngwr-utils-router.mjs.map +1 -0
  101. package/fesm2022/ngwr-utils.mjs +311 -3
  102. package/fesm2022/ngwr-utils.mjs.map +1 -1
  103. package/fesm2022/ngwr-version.mjs +1 -1
  104. package/fesm2022/ngwr-version.mjs.map +1 -1
  105. package/i18n/ar.json +19 -0
  106. package/i18n/cs.json +19 -0
  107. package/i18n/de.json +19 -0
  108. package/i18n/en.json +19 -0
  109. package/i18n/es.json +19 -0
  110. package/i18n/fr.json +19 -0
  111. package/i18n/he.json +19 -0
  112. package/i18n/hi.json +19 -0
  113. package/i18n/id.json +19 -0
  114. package/i18n/it.json +19 -0
  115. package/i18n/ja.json +19 -0
  116. package/i18n/ko.json +19 -0
  117. package/i18n/nl.json +19 -0
  118. package/i18n/pl.json +19 -0
  119. package/i18n/pt.json +19 -0
  120. package/i18n/ru.json +19 -0
  121. package/i18n/sv.json +19 -0
  122. package/i18n/tr.json +19 -0
  123. package/i18n/uk.json +19 -0
  124. package/i18n/vi.json +19 -0
  125. package/i18n/zh-TW.json +19 -0
  126. package/i18n/zh.json +19 -0
  127. package/llms-full.txt +32 -16
  128. package/package.json +14 -1
  129. package/schematics/use/symbol-map.json +3 -0
  130. package/skills/ngwr/SKILL.md +4 -2
  131. package/skills/ngwr/references/catalog.md +3 -0
  132. package/table/styles/_index.scss +17 -0
  133. package/types/ngwr-badge.d.ts +2 -2
  134. package/types/ngwr-bits-aurora.d.ts +24 -2
  135. package/types/ngwr-bits-border-glow-testing.d.ts +9 -5
  136. package/types/ngwr-bits-border-glow.d.ts +10 -4
  137. package/types/ngwr-bits-fuzzy-text.d.ts +2 -1
  138. package/types/ngwr-bits-ripple-grid.d.ts +7 -2
  139. package/types/ngwr-bits-splash-cursor.d.ts +2 -1
  140. package/types/ngwr-button.d.ts +1 -1
  141. package/types/ngwr-comment-testing.d.ts +90 -0
  142. package/types/ngwr-comment.d.ts +304 -0
  143. package/types/ngwr-dialog-testing.d.ts +7 -0
  144. package/types/ngwr-dialog.d.ts +109 -6
  145. package/types/ngwr-divider.d.ts +1 -1
  146. package/types/ngwr-drawer.d.ts +1 -1
  147. package/types/ngwr-hotkey.d.ts +60 -3
  148. package/types/ngwr-image-cropper.d.ts +1 -1
  149. package/types/ngwr-input-number-testing.d.ts +5 -0
  150. package/types/ngwr-input-number.d.ts +91 -12
  151. package/types/ngwr-keyboard.d.ts +28 -1
  152. package/types/ngwr-pipes.d.ts +142 -32
  153. package/types/ngwr-platform.d.ts +73 -7
  154. package/types/ngwr-popconfirm.d.ts +2 -2
  155. package/types/ngwr-progress.d.ts +1 -1
  156. package/types/ngwr-select.d.ts +19 -13
  157. package/types/ngwr-skeleton.d.ts +1 -1
  158. package/types/ngwr-storage.d.ts +33 -3
  159. package/types/ngwr-table.d.ts +145 -44
  160. package/types/ngwr-utils-router.d.ts +95 -0
  161. package/types/ngwr-utils.d.ts +262 -2
  162. package/types/ngwr-version.d.ts +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"ngwr-dialog-testing.mjs","names":[],"sources":["../../../projects/lib/dialog/testing/wr-dialog-harness.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 { ContentContainerComponentHarness, HarnessPredicate, TestKey } from '@angular/cdk/testing';\n\nimport type { WrDialogHarnessFilters } from './types';\n\n/**\n * Test harness for a dialog opened with `WrDialog.open()`.\n *\n * A dialog is never inside the fixture — `WrDialog` attaches it to the overlay\n * container — so load this from `TestbedHarnessEnvironment.documentRootLoader()`\n * rather than from `loader()`. The harness is a CONTENT CONTAINER, which is what\n * makes the interesting assertions possible: the buttons and fields it holds are\n * the consumer's own components, so `dialog.getHarness(WrButtonHarness…)` reads\n * them without the spec ever touching the overlay.\n *\n * @example\n * ```ts\n * const rootLoader = TestbedHarnessEnvironment.documentRootLoader(fixture);\n * const dialog = await rootLoader.getHarness(WrDialogHarness);\n *\n * expect(await dialog.getTitleText()).toBe('Delete this item?');\n * await (await dialog.getHarness(WrButtonHarness.with({ text: 'Delete' }))).click();\n * ```\n *\n * @see https://ngwr.dev/guides/testing\n */\nexport class WrDialogHarness extends ContentContainerComponentHarness {\n /** The overlay panel `WrDialog` creates. */\n static hostSelector = '.wr-dialog-panel';\n\n /** Build a predicate that narrows the query — useful when two dialogs are stacked. */\n static with(options: WrDialogHarnessFilters = {}): HarnessPredicate<WrDialogHarness> {\n return new HarnessPredicate(WrDialogHarness, options).addOption('title', options.title, (harness, title) =>\n HarnessPredicate.stringMatches(harness.getTitleText(), title)\n );\n }\n\n /** The `[wrDialogTitle]` text, or `null` when the dialog has no title. */\n async getTitleText(): Promise<string | null> {\n const title = await this.locatorForOptional('.wr-dialog__title')();\n return title ? title.text() : null;\n }\n\n /** The `[wrDialogContent]` text, or `null` when the dialog projects no content region. */\n async getContentText(): Promise<string | null> {\n const content = await this.locatorForOptional('.wr-dialog__content')();\n return content ? content.text() : null;\n }\n\n /**\n * The role and modality the dialog announces.\n *\n * Worth asserting rather than assuming: `WrDialog` sets these on the OVERLAY\n * element, not on the component it renders, so a consumer looking for them on\n * their own host would not find them.\n */\n async getRole(): Promise<string | null> {\n return (await this.host()).getAttribute('role');\n }\n\n /** Whether the dialog is marked `aria-modal`. */\n async isModal(): Promise<boolean> {\n return (await (await this.host()).getAttribute('aria-modal')) === 'true';\n }\n\n /** Whether the built-in dismiss button is present (`closable`, the default). */\n async isClosable(): Promise<boolean> {\n return (await this.locatorForOptional('.wr-dialog__close')()) !== null;\n }\n\n /** The dismiss button's accessible name — the string a screen reader reads out. */\n async getCloseLabel(): Promise<string | null> {\n const close = await this.locatorForOptional('.wr-dialog__close')();\n return close ? close.getAttribute('aria-label') : null;\n }\n\n /** Click the built-in dismiss button. Throws when the dialog was opened `closable: false`. */\n async close(): Promise<void> {\n await (await this.locatorFor('.wr-dialog__close')()).click();\n }\n\n /** Press Escape. A dialog opened `closeOnEscape: false` ignores it — assert, do not assume. */\n async sendEscape(): Promise<void> {\n await (await this.host()).sendKeys(TestKey.ESCAPE);\n }\n\n /** Whether focus is currently somewhere inside the dialog, where the trap should keep it. */\n async isFocusTrapped(): Promise<boolean> {\n return (await this.host()).matchesSelector(':focus-within');\n }\n}\n"],"mappings":";;;;;;;AAgCA,IAAa,kBAAb,MAAa,wBAAwB,iCAAgC;CAEnE,OAAO,eAAe;CAGtB,OAAO,KAAK,UAAkC,CAAA,GAAE;EAC9C,OAAO,IAAI,iBAAiB,iBAAiB,OAAO,CAAC,CAAC,UAAU,SAAS,QAAQ,QAAQ,SAAS,UAChG,iBAAiB,cAAc,QAAQ,aAAY,GAAI,KAAK,CAAC;CAEjE;CAGA,MAAM,eAAY;EAChB,MAAM,QAAQ,MAAM,KAAK,mBAAmB,mBAAmB,CAAC,CAAA;EAChE,OAAO,QAAQ,MAAM,KAAI,IAAK;CAChC;CAGA,MAAM,iBAAc;EAClB,MAAM,UAAU,MAAM,KAAK,mBAAmB,qBAAqB,CAAC,CAAA;EACpE,OAAO,UAAU,QAAQ,KAAI,IAAK;CACpC;CASA,MAAM,UAAO;EACX,QAAQ,MAAM,KAAK,KAAI,EAAA,CAAI,aAAa,MAAM;CAChD;CAGA,MAAM,UAAO;EACX,OAAQ,OAAO,MAAM,KAAK,KAAI,EAAA,CAAI,aAAa,YAAY,MAAO;CACpE;CAGA,MAAM,aAAU;EACd,OAAQ,MAAM,KAAK,mBAAmB,mBAAmB,CAAC,CAAA,MAAQ;CACpE;CAGA,MAAM,gBAAa;EACjB,MAAM,QAAQ,MAAM,KAAK,mBAAmB,mBAAmB,CAAC,CAAA;EAChE,OAAO,QAAQ,MAAM,aAAa,YAAY,IAAI;CACpD;CAGA,MAAM,QAAK;EACT,OAAO,MAAM,KAAK,WAAW,mBAAmB,CAAC,CAAA,EAAA,CAAI,MAAK;CAC5D;CAGA,MAAM,aAAU;EACd,OAAO,MAAM,KAAK,KAAI,EAAA,CAAI,SAAS,QAAQ,MAAM;CACnD;CAGA,MAAM,iBAAc;EAClB,QAAQ,MAAM,KAAK,KAAI,EAAA,CAAI,gBAAgB,eAAe;CAC5D"}
1
+ {"version":3,"file":"ngwr-dialog-testing.mjs","names":[],"sources":["../../../projects/lib/dialog/testing/wr-dialog-harness.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 { ContentContainerComponentHarness, HarnessPredicate, type TestElement, TestKey } from '@angular/cdk/testing';\n\nimport type { WrDialogHarnessFilters } from './types';\n\n/**\n * Test harness for a dialog opened with `WrDialog.open()`.\n *\n * A dialog is never inside the fixture — `WrDialog` attaches it to the overlay\n * container — so load this from `TestbedHarnessEnvironment.documentRootLoader()`\n * rather than from `loader()`. The harness is a CONTENT CONTAINER, which is what\n * makes the interesting assertions possible: the buttons and fields it holds are\n * the consumer's own components, so `dialog.getHarness(WrButtonHarness…)` reads\n * them without the spec ever touching the overlay.\n *\n * @example\n * ```ts\n * const rootLoader = TestbedHarnessEnvironment.documentRootLoader(fixture);\n * const dialog = await rootLoader.getHarness(WrDialogHarness);\n *\n * expect(await dialog.getTitleText()).toBe('Delete this item?');\n * await (await dialog.getHarness(WrButtonHarness.with({ text: 'Delete' }))).click();\n * ```\n *\n * @see https://ngwr.dev/guides/testing\n */\nexport class WrDialogHarness extends ContentContainerComponentHarness {\n /** The overlay panel `WrDialog` creates. */\n static hostSelector = '.wr-dialog-panel';\n\n /** Build a predicate that narrows the query — useful when two dialogs are stacked. */\n static with(options: WrDialogHarnessFilters = {}): HarnessPredicate<WrDialogHarness> {\n return new HarnessPredicate(WrDialogHarness, options).addOption('title', options.title, (harness, title) =>\n HarnessPredicate.stringMatches(harness.getTitleText(), title)\n );\n }\n\n /** The `[wrDialogTitle]` text, or `null` when the dialog has no title. */\n async getTitleText(): Promise<string | null> {\n const title = await this.locatorForOptional('.wr-dialog__title')();\n return title ? title.text() : null;\n }\n\n /** The `[wrDialogContent]` text, or `null` when the dialog projects no content region. */\n async getContentText(): Promise<string | null> {\n const content = await this.locatorForOptional('.wr-dialog__content')();\n return content ? content.text() : null;\n }\n\n /**\n * The role and modality the dialog announces.\n *\n * Worth asserting rather than assuming: `WrDialog` sets these on the OVERLAY\n * element, not on the component it renders, so a consumer looking for them on\n * their own host would not find them.\n */\n async getRole(): Promise<string | null> {\n return (await this.host()).getAttribute('role');\n }\n\n /** Whether the dialog is marked `aria-modal`. */\n async isModal(): Promise<boolean> {\n return (await (await this.host()).getAttribute('aria-modal')) === 'true';\n }\n\n /** Whether the built-in dismiss button is present (`closable`, the default). */\n async isClosable(): Promise<boolean> {\n return (await this.locatorForOptional('.wr-dialog__close')()) !== null;\n }\n\n /** The dismiss button's accessible name — the string a screen reader reads out. */\n async getCloseLabel(): Promise<string | null> {\n const close = await this.locatorForOptional('.wr-dialog__close')();\n return close ? close.getAttribute('aria-label') : null;\n }\n\n /** Click the built-in dismiss button. Throws when the dialog was opened `closable: false`. */\n async close(): Promise<void> {\n await (await this.locatorFor('.wr-dialog__close')()).click();\n }\n\n /** Press Escape. A dialog opened `closeOnEscape: false` ignores it — assert, do not assume. */\n async sendEscape(): Promise<void> {\n await (await this.host()).sendKeys(TestKey.ESCAPE);\n }\n\n /** Whether this is a `WrDialog.confirm()` dialog, the one `confirm()` and `cancel()` answer. */\n async isConfirm(): Promise<boolean> {\n return (await this.locatorForOptional('.wr-dialog-confirm')()) !== null;\n }\n\n /** Press the confirm button of a `WrDialog.confirm()` dialog. Throws on any other dialog. */\n async confirm(): Promise<void> {\n await (await this.answer('confirm')).click();\n }\n\n /** Press the cancel button of a `WrDialog.confirm()` dialog. Throws on any other dialog. */\n async cancel(): Promise<void> {\n await (await this.answer('cancel')).click();\n }\n\n private async answer(which: 'confirm' | 'cancel'): Promise<TestElement> {\n const button = await this.locatorForOptional(`.wr-dialog-confirm__action--${which}`)();\n if (!button) {\n throw new Error(\n `WrDialogHarness: ${which}() answers a WrDialog.confirm() dialog; this one was opened with open()`\n );\n }\n return button;\n }\n\n /** Whether focus is currently somewhere inside the dialog, where the trap should keep it. */\n async isFocusTrapped(): Promise<boolean> {\n return (await this.host()).matchesSelector(':focus-within');\n }\n}\n"],"mappings":";;;;;;;AAgCA,IAAa,kBAAb,MAAa,wBAAwB,iCAAgC;CAEnE,OAAO,eAAe;CAGtB,OAAO,KAAK,UAAkC,CAAA,GAAE;EAC9C,OAAO,IAAI,iBAAiB,iBAAiB,OAAO,CAAC,CAAC,UAAU,SAAS,QAAQ,QAAQ,SAAS,UAChG,iBAAiB,cAAc,QAAQ,aAAY,GAAI,KAAK,CAAC;CAEjE;CAGA,MAAM,eAAY;EAChB,MAAM,QAAQ,MAAM,KAAK,mBAAmB,mBAAmB,CAAC,CAAA;EAChE,OAAO,QAAQ,MAAM,KAAI,IAAK;CAChC;CAGA,MAAM,iBAAc;EAClB,MAAM,UAAU,MAAM,KAAK,mBAAmB,qBAAqB,CAAC,CAAA;EACpE,OAAO,UAAU,QAAQ,KAAI,IAAK;CACpC;CASA,MAAM,UAAO;EACX,QAAQ,MAAM,KAAK,KAAI,EAAA,CAAI,aAAa,MAAM;CAChD;CAGA,MAAM,UAAO;EACX,OAAQ,OAAO,MAAM,KAAK,KAAI,EAAA,CAAI,aAAa,YAAY,MAAO;CACpE;CAGA,MAAM,aAAU;EACd,OAAQ,MAAM,KAAK,mBAAmB,mBAAmB,CAAC,CAAA,MAAQ;CACpE;CAGA,MAAM,gBAAa;EACjB,MAAM,QAAQ,MAAM,KAAK,mBAAmB,mBAAmB,CAAC,CAAA;EAChE,OAAO,QAAQ,MAAM,aAAa,YAAY,IAAI;CACpD;CAGA,MAAM,QAAK;EACT,OAAO,MAAM,KAAK,WAAW,mBAAmB,CAAC,CAAA,EAAA,CAAI,MAAK;CAC5D;CAGA,MAAM,aAAU;EACd,OAAO,MAAM,KAAK,KAAI,EAAA,CAAI,SAAS,QAAQ,MAAM;CACnD;CAGA,MAAM,YAAS;EACb,OAAQ,MAAM,KAAK,mBAAmB,oBAAoB,CAAC,CAAA,MAAQ;CACrE;CAGA,MAAM,UAAO;EACX,OAAO,MAAM,KAAK,OAAO,SAAS,EAAA,CAAG,MAAK;CAC5C;CAGA,MAAM,SAAM;EACV,OAAO,MAAM,KAAK,OAAO,QAAQ,EAAA,CAAG,MAAK;CAC3C;CAEQ,MAAM,OAAO,OAA2B;EAC9C,MAAM,SAAS,MAAM,KAAK,mBAAmB,+BAA+B,OAAO,CAAC,CAAA;EACpF,IAAI,CAAC,QACH,MAAM,IAAI,MACR,oBAAoB,MAAK,wEAAyE;EAGtG,OAAO;CACT;CAGA,MAAM,iBAAc;EAClB,QAAQ,MAAM,KAAK,KAAI,EAAA,CAAI,gBAAgB,eAAe;CAC5D"}
@@ -1,7 +1,7 @@
1
1
  import * as i0 from "@angular/core";
2
- import { Directive, ElementRef, EnvironmentInjector, InjectionToken, Injector, PLATFORM_ID, Service, afterEveryRender, computed, inject, input } from "@angular/core";
2
+ import { Component, DestroyRef, Directive, ElementRef, EnvironmentInjector, InjectionToken, Injector, PLATFORM_ID, Service, ViewEncapsulation, afterEveryRender, computed, effect, inject, input, signal, untracked } from "@angular/core";
3
3
  import { Location, isPlatformBrowser } from "@angular/common";
4
- import { WrI18n } from "ngwr/i18n";
4
+ import { WrI18n, useI18nText } from "ngwr/i18n";
5
5
  import { toClassList } from "ngwr/utils";
6
6
  import { Directionality } from "@angular/cdk/bidi";
7
7
  import { ScrollStrategyOptions } from "@angular/cdk/overlay";
@@ -9,6 +9,7 @@ import { ComponentPortal } from "@angular/cdk/portal";
9
9
  import { WR_OVERLAY, wrAppendOverlayClose, wrFollowDirection } from "ngwr/overlay";
10
10
  import { ConfigurableFocusTrapFactory } from "@angular/cdk/a11y";
11
11
  import { ReplaySubject } from "rxjs";
12
+ import { WrButton } from "ngwr/button";
12
13
  import * as i1 from "@angular/cdk/scrolling";
13
14
  import { CdkScrollable } from "@angular/cdk/scrolling";
14
15
  /**
@@ -19,12 +20,15 @@ import { CdkScrollable } from "@angular/cdk/scrolling";
19
20
  */
20
21
  var WrDialogRef = class {
21
22
  _overlayRef;
23
+ injector;
22
24
  closed = new ReplaySubject(1);
23
25
  componentRef = null;
24
26
  focusTrap = null;
25
27
  previouslyFocused = null;
26
- constructor(_overlayRef) {
28
+ watchers = [];
29
+ constructor(_overlayRef, injector) {
27
30
  this._overlayRef = _overlayRef;
31
+ this.injector = injector;
28
32
  }
29
33
  get componentInstance() {
30
34
  if (!this.componentRef) throw new Error("WrDialogRef: component not yet attached");
@@ -34,6 +38,7 @@ var WrDialogRef = class {
34
38
  close(result) {
35
39
  if (this.isClosed) return;
36
40
  this.isClosed = true;
41
+ for (const watcher of this.watchers.splice(0)) watcher.destroy();
37
42
  this.closed.next(result);
38
43
  this.closed.complete();
39
44
  if (!this.componentRef) {
@@ -51,6 +56,13 @@ var WrDialogRef = class {
51
56
  this.componentRef = null;
52
57
  if (restore && typeof restore.focus === "function") restore.focus();
53
58
  }
59
+ closeWhen(source, result) {
60
+ if (this.isClosed) return;
61
+ if (!this.injector) throw new Error("WrDialogRef: closeWhen() needs a ref opened by WrDialog, which carries the injector");
62
+ this.watchers.push(effect(() => {
63
+ if (source()) untracked(() => this.close(result));
64
+ }, { injector: this.injector }));
65
+ }
54
66
  awaitClose() {
55
67
  return new Promise((resolve) => {
56
68
  this.closed.subscribe({
@@ -69,134 +81,9 @@ var WrDialogRef = class {
69
81
  * Use of this source code is governed by an MIT-style license that can be
70
82
  * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE
71
83
  */
72
- const WR_DIALOG_DATA = new InjectionToken("WR_DIALOG_DATA");
73
- /**
74
- * @license
75
- *
76
- * Use of this source code is governed by an MIT-style license that can be
77
- * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE
78
- */
79
- const WR_DIALOG_REF = new InjectionToken("WR_DIALOG_REF");
80
- /**
81
- * @license
82
- *
83
- * Use of this source code is governed by an MIT-style license that can be
84
- * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE
85
- */
86
- const DEFAULT_PANEL_CLASS = "wr-dialog-panel";
87
- const DEFAULT_BACKDROP_CLASS = "wr-dialog-backdrop";
88
- var WrDialog = class WrDialog {
89
- overlay = inject(WR_OVERLAY);
90
- scrollStrategies = inject(ScrollStrategyOptions);
91
- parentInjector = inject(EnvironmentInjector);
92
- focusTrapFactory = inject(ConfigurableFocusTrapFactory);
93
- isBrowser = isPlatformBrowser(inject(PLATFORM_ID));
94
- i18n = inject(WrI18n, { optional: true });
95
- dir = inject(Directionality, { optional: true });
96
- location = inject(Location);
97
- open(component, options = {}) {
98
- const overlayRef = this.overlay.create({
99
- positionStrategy: this.overlay.position().global().centerHorizontally().centerVertically(),
100
- scrollStrategy: this.scrollStrategies.block(),
101
- hasBackdrop: true,
102
- backdropClass: DEFAULT_BACKDROP_CLASS,
103
- panelClass: toClassList(DEFAULT_PANEL_CLASS, options.panelClass),
104
- width: options.width,
105
- maxWidth: options.maxWidth
106
- });
107
- wrFollowDirection(overlayRef, this.dir, this.parentInjector);
108
- const dialogRef = new WrDialogRef(overlayRef);
109
- if (this.isBrowser) {
110
- const active = document.activeElement;
111
- dialogRef.previouslyFocused = active instanceof HTMLElement ? active : null;
112
- }
113
- const injector = Injector.create({
114
- parent: this.parentInjector,
115
- providers: [
116
- {
117
- provide: WR_DIALOG_DATA,
118
- useValue: options.data
119
- },
120
- {
121
- provide: WR_DIALOG_REF,
122
- useValue: dialogRef
123
- },
124
- {
125
- provide: WrDialogRef,
126
- useValue: dialogRef
127
- }
128
- ]
129
- });
130
- const portal = new ComponentPortal(component, null, injector);
131
- dialogRef.componentRef = overlayRef.attach(portal);
132
- if (options.closeOnBackdropClick !== false) overlayRef.backdropClick().subscribe(() => dialogRef.close());
133
- if (options.closeOnEscape !== false) overlayRef.keydownEvents().subscribe((event) => {
134
- if (event.key === "Escape") {
135
- event.preventDefault();
136
- dialogRef.close();
137
- }
138
- });
139
- if (options.closeOnNavigation !== false) this.watchNavigation(overlayRef, dialogRef);
140
- if (this.isBrowser) {
141
- const host = overlayRef.overlayElement;
142
- host.setAttribute("role", "dialog");
143
- host.setAttribute("aria-modal", "true");
144
- if (options.closable !== false) {
145
- host.classList.add("wr-dialog-panel--closable");
146
- const label = options.closeLabel ?? this.closeLabel();
147
- wrAppendOverlayClose(host, "wr-dialog__close", label, () => dialogRef.close());
148
- }
149
- const labelSync = afterEveryRender(() => {
150
- const titleEl = host.querySelector("[wrDialogTitle], [wr-dialog-title]");
151
- if (titleEl?.id) host.setAttribute("aria-labelledby", titleEl.id);
152
- else host.removeAttribute("aria-labelledby");
153
- }, { injector: this.parentInjector });
154
- overlayRef.detachments().subscribe(() => labelSync.destroy());
155
- const trap = this.focusTrapFactory.create(host);
156
- dialogRef.focusTrap = trap;
157
- trap.focusInitialElementWhenReady();
158
- }
159
- return dialogRef;
160
- }
161
- watchNavigation(overlayRef, dialogRef) {
162
- const stopWatching = this.location.onUrlChange(() => dialogRef.close());
163
- overlayRef.detachments().subscribe(() => queueMicrotask(stopWatching));
164
- }
165
- closeLabel() {
166
- const resolved = this.i18n?.t("dialog.close");
167
- return !resolved || resolved === "dialog.close" ? "Close dialog" : resolved;
168
- }
169
- static ɵfac = i0.ɵɵngDeclareFactory({
170
- minVersion: "12.0.0",
171
- version: "22.2.4",
172
- ngImport: i0,
173
- type: WrDialog,
174
- deps: [],
175
- target: i0.ɵɵFactoryTarget.Service
176
- });
177
- static ɵprov = i0.ɵɵngDeclareService({
178
- minVersion: "22.0.0",
179
- version: "22.2.4",
180
- ngImport: i0,
181
- type: WrDialog
182
- });
183
- };
184
- i0.ɵɵngDeclareClassMetadata({
185
- minVersion: "12.0.0",
186
- version: "22.2.4",
187
- ngImport: i0,
188
- type: WrDialog,
189
- decorators: [{ type: Service }]
190
- });
191
- /**
192
- * @license
193
- *
194
- * Use of this source code is governed by an MIT-style license that can be
195
- * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE
196
- */
197
- let uid = 0;
84
+ let uid$1 = 0;
198
85
  var WrDialogTitle = class WrDialogTitle {
199
- id = `wr-dialog-title-${++uid}`;
86
+ id = `wr-dialog-title-${++uid$1}`;
200
87
  elementRef = inject(ElementRef);
201
88
  static ɵfac = i0.ɵɵngDeclareFactory({
202
89
  minVersion: "12.0.0",
@@ -216,6 +103,7 @@ var WrDialogTitle = class WrDialogTitle {
216
103
  properties: { "attr.id": "id" },
217
104
  classAttribute: "wr-dialog__title"
218
105
  },
106
+ exportAs: ["wrDialogTitle"],
219
107
  ngImport: i0
220
108
  });
221
109
  };
@@ -228,6 +116,7 @@ i0.ɵɵngDeclareClassMetadata({
228
116
  type: Directive,
229
117
  args: [{
230
118
  selector: "[wrDialogTitle]",
119
+ exportAs: "wrDialogTitle",
231
120
  host: {
232
121
  class: "wr-dialog__title",
233
122
  "[attr.id]": "id"
@@ -241,7 +130,9 @@ i0.ɵɵngDeclareClassMetadata({
241
130
  * Use of this source code is governed by an MIT-style license that can be
242
131
  * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE
243
132
  */
133
+ let uid = 0;
244
134
  var WrDialogContent = class WrDialogContent {
135
+ id = input(`wr-dialog-content-${++uid}`, ...ngDevMode ? [{ debugName: "id" }] : /* istanbul ignore next */ []);
245
136
  static ɵfac = i0.ɵɵngDeclareFactory({
246
137
  minVersion: "12.0.0",
247
138
  version: "22.2.4",
@@ -251,12 +142,22 @@ var WrDialogContent = class WrDialogContent {
251
142
  target: i0.ɵɵFactoryTarget.Directive
252
143
  });
253
144
  static ɵdir = i0.ɵɵngDeclareDirective({
254
- minVersion: "14.0.0",
145
+ minVersion: "17.1.0",
255
146
  version: "22.2.4",
256
147
  type: WrDialogContent,
257
148
  isStandalone: true,
258
149
  selector: "[wrDialogContent]",
259
- host: { classAttribute: "wr-dialog__content" },
150
+ inputs: { id: {
151
+ classPropertyName: "id",
152
+ publicName: "id",
153
+ isSignal: true,
154
+ isRequired: false,
155
+ transformFunction: null
156
+ } },
157
+ host: {
158
+ properties: { "attr.id": "id()" },
159
+ classAttribute: "wr-dialog__content"
160
+ },
260
161
  hostDirectives: [{ directive: i1.CdkScrollable }],
261
162
  ngImport: i0
262
163
  });
@@ -270,10 +171,21 @@ i0.ɵɵngDeclareClassMetadata({
270
171
  type: Directive,
271
172
  args: [{
272
173
  selector: "[wrDialogContent]",
273
- host: { class: "wr-dialog__content" },
174
+ host: {
175
+ class: "wr-dialog__content",
176
+ "[attr.id]": "id()"
177
+ },
274
178
  hostDirectives: [CdkScrollable]
275
179
  }]
276
- }]
180
+ }],
181
+ propDecorators: { id: [{
182
+ type: i0.Input,
183
+ args: [{
184
+ isSignal: true,
185
+ alias: "id",
186
+ required: false
187
+ }]
188
+ }] }
277
189
  });
278
190
  /**
279
191
  * @license
@@ -336,6 +248,20 @@ i0.ɵɵngDeclareClassMetadata({
336
248
  * Use of this source code is governed by an MIT-style license that can be
337
249
  * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE
338
250
  */
251
+ const WR_DIALOG_DATA = new InjectionToken("WR_DIALOG_DATA");
252
+ /**
253
+ * @license
254
+ *
255
+ * Use of this source code is governed by an MIT-style license that can be
256
+ * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE
257
+ */
258
+ const WR_DIALOG_REF = new InjectionToken("WR_DIALOG_REF");
259
+ /**
260
+ * @license
261
+ *
262
+ * Use of this source code is governed by an MIT-style license that can be
263
+ * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE
264
+ */
339
265
  var WrDialogClose = class WrDialogClose {
340
266
  result = input(void 0, {
341
267
  ...ngDevMode ? { debugName: "result" } : /* istanbul ignore next */ {},
@@ -392,6 +318,239 @@ i0.ɵɵngDeclareClassMetadata({
392
318
  }]
393
319
  }] }
394
320
  });
321
+ /**
322
+ * @license
323
+ *
324
+ * Use of this source code is governed by an MIT-style license that can be
325
+ * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE
326
+ */
327
+ var WrDialogConfirm = class WrDialogConfirm {
328
+ data = inject(WR_DIALOG_DATA);
329
+ ref = inject(WrDialogRef);
330
+ color = this.data.confirmColor ?? "primary";
331
+ danger = this.color === "danger";
332
+ confirmLabel = useI18nText(signal(this.data.confirmLabel ?? null), "common.ok", "OK");
333
+ cancelLabel = useI18nText(signal(this.data.cancelLabel ?? null), "common.cancel", "Cancel");
334
+ static ɵfac = i0.ɵɵngDeclareFactory({
335
+ minVersion: "12.0.0",
336
+ version: "22.2.4",
337
+ ngImport: i0,
338
+ type: WrDialogConfirm,
339
+ deps: [],
340
+ target: i0.ɵɵFactoryTarget.Component
341
+ });
342
+ static ɵcmp = i0.ɵɵngDeclareComponent({
343
+ minVersion: "17.0.0",
344
+ version: "22.2.4",
345
+ type: WrDialogConfirm,
346
+ isStandalone: true,
347
+ selector: "wr-dialog-confirm",
348
+ host: {
349
+ properties: { "class.wr-dialog-confirm--danger": "danger" },
350
+ classAttribute: "wr-dialog-confirm"
351
+ },
352
+ ngImport: i0,
353
+ 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",
354
+ dependencies: [
355
+ {
356
+ kind: "component",
357
+ type: WrButton,
358
+ selector: "wr-btn, button[wr-btn], a[wr-btn]",
359
+ inputs: [
360
+ "color",
361
+ "size",
362
+ "shape",
363
+ "icon",
364
+ "iconPosition",
365
+ "disabled",
366
+ "outlined",
367
+ "block",
368
+ "loading",
369
+ "disabledWhenLoading"
370
+ ]
371
+ },
372
+ {
373
+ kind: "directive",
374
+ type: WrDialogTitle,
375
+ selector: "[wrDialogTitle]",
376
+ exportAs: ["wrDialogTitle"]
377
+ },
378
+ {
379
+ kind: "directive",
380
+ type: WrDialogContent,
381
+ selector: "[wrDialogContent]",
382
+ inputs: ["id"]
383
+ },
384
+ {
385
+ kind: "directive",
386
+ type: WrDialogFooter,
387
+ selector: "[wrDialogFooter]",
388
+ inputs: ["align"]
389
+ }
390
+ ],
391
+ encapsulation: i0.ViewEncapsulation.None
392
+ });
393
+ };
394
+ i0.ɵɵngDeclareClassMetadata({
395
+ minVersion: "12.0.0",
396
+ version: "22.2.4",
397
+ ngImport: i0,
398
+ type: WrDialogConfirm,
399
+ decorators: [{
400
+ type: Component,
401
+ args: [{
402
+ selector: "wr-dialog-confirm",
403
+ imports: [
404
+ WrButton,
405
+ WrDialogTitle,
406
+ WrDialogContent,
407
+ WrDialogFooter
408
+ ],
409
+ encapsulation: ViewEncapsulation.None,
410
+ host: {
411
+ class: "wr-dialog-confirm",
412
+ "[class.wr-dialog-confirm--danger]": "danger"
413
+ },
414
+ 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"
415
+ }]
416
+ }]
417
+ });
418
+ /**
419
+ * @license
420
+ *
421
+ * Use of this source code is governed by an MIT-style license that can be
422
+ * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE
423
+ */
424
+ const DEFAULT_PANEL_CLASS = "wr-dialog-panel";
425
+ const DEFAULT_BACKDROP_CLASS = "wr-dialog-backdrop";
426
+ var WrDialog = class WrDialog {
427
+ overlay = inject(WR_OVERLAY);
428
+ scrollStrategies = inject(ScrollStrategyOptions);
429
+ parentInjector = inject(EnvironmentInjector);
430
+ focusTrapFactory = inject(ConfigurableFocusTrapFactory);
431
+ isBrowser = isPlatformBrowser(inject(PLATFORM_ID));
432
+ i18n = inject(WrI18n, { optional: true });
433
+ dir = inject(Directionality, { optional: true });
434
+ location = inject(Location);
435
+ destroyRef = inject(DestroyRef);
436
+ open(component, options = {}) {
437
+ const overlayRef = this.overlay.create({
438
+ positionStrategy: this.overlay.position().global().centerHorizontally().centerVertically(),
439
+ scrollStrategy: this.scrollStrategies.block(),
440
+ hasBackdrop: true,
441
+ backdropClass: DEFAULT_BACKDROP_CLASS,
442
+ panelClass: toClassList(DEFAULT_PANEL_CLASS, options.panelClass),
443
+ width: options.width,
444
+ maxWidth: options.maxWidth
445
+ });
446
+ wrFollowDirection(overlayRef, this.dir, this.parentInjector);
447
+ const dialogRef = new WrDialogRef(overlayRef, this.parentInjector);
448
+ if (this.isBrowser) {
449
+ const active = document.activeElement;
450
+ dialogRef.previouslyFocused = active instanceof HTMLElement ? active : null;
451
+ }
452
+ const injector = Injector.create({
453
+ parent: this.parentInjector,
454
+ providers: [
455
+ {
456
+ provide: WR_DIALOG_DATA,
457
+ useValue: options.data
458
+ },
459
+ {
460
+ provide: WR_DIALOG_REF,
461
+ useValue: dialogRef
462
+ },
463
+ {
464
+ provide: WrDialogRef,
465
+ useValue: dialogRef
466
+ }
467
+ ]
468
+ });
469
+ const portal = new ComponentPortal(component, null, injector);
470
+ dialogRef.componentRef = overlayRef.attach(portal);
471
+ if (options.closeOnBackdropClick !== false) overlayRef.backdropClick().subscribe(() => dialogRef.close());
472
+ if (options.closeOnEscape !== false) overlayRef.keydownEvents().subscribe((event) => {
473
+ if (event.key === "Escape") {
474
+ event.preventDefault();
475
+ dialogRef.close();
476
+ }
477
+ });
478
+ if (options.closeOnNavigation !== false) this.watchNavigation(overlayRef, dialogRef);
479
+ if (this.isBrowser) {
480
+ const host = overlayRef.overlayElement;
481
+ const role = options.role ?? "dialog";
482
+ host.setAttribute("role", role);
483
+ host.setAttribute("aria-modal", "true");
484
+ if (options.closable !== false) {
485
+ host.classList.add("wr-dialog-panel--closable");
486
+ const label = options.closeLabel ?? this.closeLabel();
487
+ wrAppendOverlayClose(host, "wr-dialog__close", label, () => dialogRef.close());
488
+ }
489
+ const labelSync = afterEveryRender(() => {
490
+ const titleEl = host.querySelector("[wrDialogTitle], [wr-dialog-title]");
491
+ if (titleEl?.id) host.setAttribute("aria-labelledby", titleEl.id);
492
+ else host.removeAttribute("aria-labelledby");
493
+ if (role !== "alertdialog") return;
494
+ const contentEl = host.querySelector("[wrDialogContent], [wr-dialog-content]");
495
+ if (contentEl?.id) host.setAttribute("aria-describedby", contentEl.id);
496
+ else host.removeAttribute("aria-describedby");
497
+ }, { injector: this.parentInjector });
498
+ overlayRef.detachments().subscribe(() => labelSync.destroy());
499
+ const trap = this.focusTrapFactory.create(host);
500
+ dialogRef.focusTrap = trap;
501
+ trap.focusInitialElementWhenReady();
502
+ }
503
+ return dialogRef;
504
+ }
505
+ async confirm(options) {
506
+ if (!this.isBrowser) return false;
507
+ const { title, message, confirmLabel, cancelLabel, confirmColor, ...rest } = options;
508
+ const ref = this.open(WrDialogConfirm, {
509
+ ...rest,
510
+ role: "alertdialog",
511
+ closable: false,
512
+ data: {
513
+ title,
514
+ message,
515
+ confirmLabel,
516
+ cancelLabel,
517
+ confirmColor
518
+ }
519
+ });
520
+ const unhook = this.destroyRef.onDestroy(() => ref.close());
521
+ ref.closed.subscribe({ complete: unhook });
522
+ return await ref.awaitClose() === true;
523
+ }
524
+ watchNavigation(overlayRef, dialogRef) {
525
+ const stopWatching = this.location.onUrlChange(() => dialogRef.close());
526
+ overlayRef.detachments().subscribe(() => queueMicrotask(stopWatching));
527
+ }
528
+ closeLabel() {
529
+ const resolved = this.i18n?.t("dialog.close");
530
+ return !resolved || resolved === "dialog.close" ? "Close dialog" : resolved;
531
+ }
532
+ static ɵfac = i0.ɵɵngDeclareFactory({
533
+ minVersion: "12.0.0",
534
+ version: "22.2.4",
535
+ ngImport: i0,
536
+ type: WrDialog,
537
+ deps: [],
538
+ target: i0.ɵɵFactoryTarget.Service
539
+ });
540
+ static ɵprov = i0.ɵɵngDeclareService({
541
+ minVersion: "22.0.0",
542
+ version: "22.2.4",
543
+ ngImport: i0,
544
+ type: WrDialog
545
+ });
546
+ };
547
+ i0.ɵɵngDeclareClassMetadata({
548
+ minVersion: "12.0.0",
549
+ version: "22.2.4",
550
+ ngImport: i0,
551
+ type: WrDialog,
552
+ decorators: [{ type: Service }]
553
+ });
395
554
  export { WR_DIALOG_DATA, WR_DIALOG_REF, WrDialog, WrDialogClose, WrDialogContent, WrDialogFooter, WrDialogRef, WrDialogTitle };
396
555
 
397
556
  //# sourceMappingURL=ngwr-dialog.mjs.map