@molecule/app-ui-angular 1.0.6 → 1.1.1

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 (308) hide show
  1. package/README.md +11740 -1143
  2. package/dist/components/accordion.component.d.ts +114 -0
  3. package/dist/components/accordion.component.d.ts.map +1 -0
  4. package/dist/components/accordion.component.js +286 -0
  5. package/dist/components/accordion.component.js.map +1 -0
  6. package/dist/components/alert.component.d.ts +81 -37
  7. package/dist/components/alert.component.d.ts.map +1 -1
  8. package/dist/components/alert.component.js +232 -146
  9. package/dist/components/alert.component.js.map +1 -1
  10. package/dist/components/auth-guard.component.d.ts +94 -0
  11. package/dist/components/auth-guard.component.d.ts.map +1 -0
  12. package/dist/components/auth-guard.component.js +212 -0
  13. package/dist/components/auth-guard.component.js.map +1 -0
  14. package/dist/components/avatar.component.d.ts +97 -0
  15. package/dist/components/avatar.component.d.ts.map +1 -0
  16. package/dist/components/avatar.component.js +216 -0
  17. package/dist/components/avatar.component.js.map +1 -0
  18. package/dist/components/badge.component.d.ts +27 -12
  19. package/dist/components/badge.component.d.ts.map +1 -1
  20. package/dist/components/badge.component.js +47 -47
  21. package/dist/components/badge.component.js.map +1 -1
  22. package/dist/components/button.component.d.ts +96 -14
  23. package/dist/components/button.component.d.ts.map +1 -1
  24. package/dist/components/button.component.js +232 -87
  25. package/dist/components/button.component.js.map +1 -1
  26. package/dist/components/card.component.d.ts +135 -0
  27. package/dist/components/card.component.d.ts.map +1 -0
  28. package/dist/components/card.component.js +291 -0
  29. package/dist/components/card.component.js.map +1 -0
  30. package/dist/components/checkbox.component.d.ts +102 -29
  31. package/dist/components/checkbox.component.d.ts.map +1 -1
  32. package/dist/components/checkbox.component.js +222 -113
  33. package/dist/components/checkbox.component.js.map +1 -1
  34. package/dist/components/confirm-button.component.d.ts +130 -0
  35. package/dist/components/confirm-button.component.d.ts.map +1 -0
  36. package/dist/components/confirm-button.component.js +322 -0
  37. package/dist/components/confirm-button.component.js.map +1 -0
  38. package/dist/components/confirm-dialog.component.d.ts +60 -0
  39. package/dist/components/confirm-dialog.component.d.ts.map +1 -0
  40. package/dist/components/confirm-dialog.component.js +152 -0
  41. package/dist/components/confirm-dialog.component.js.map +1 -0
  42. package/dist/components/dropdown.component.d.ts +313 -0
  43. package/dist/components/dropdown.component.d.ts.map +1 -0
  44. package/dist/components/dropdown.component.js +919 -0
  45. package/dist/components/dropdown.component.js.map +1 -0
  46. package/dist/components/empty-state.component.d.ts +73 -0
  47. package/dist/components/empty-state.component.d.ts.map +1 -0
  48. package/dist/components/empty-state.component.js +180 -0
  49. package/dist/components/empty-state.component.js.map +1 -0
  50. package/dist/components/floating-input.component.d.ts +86 -0
  51. package/dist/components/floating-input.component.d.ts.map +1 -0
  52. package/dist/components/floating-input.component.js +167 -0
  53. package/dist/components/floating-input.component.js.map +1 -0
  54. package/dist/components/form-field.component.d.ts +111 -0
  55. package/dist/components/form-field.component.d.ts.map +1 -0
  56. package/dist/components/form-field.component.js +300 -0
  57. package/dist/components/form-field.component.js.map +1 -0
  58. package/dist/components/form.component.d.ts +77 -0
  59. package/dist/components/form.component.d.ts.map +1 -0
  60. package/dist/components/form.component.js +222 -0
  61. package/dist/components/form.component.js.map +1 -0
  62. package/dist/components/icon.component.d.ts +85 -0
  63. package/dist/components/icon.component.d.ts.map +1 -0
  64. package/dist/components/icon.component.js +187 -0
  65. package/dist/components/icon.component.js.map +1 -0
  66. package/dist/components/index.d.ts +49 -0
  67. package/dist/components/index.d.ts.map +1 -1
  68. package/dist/components/index.js +49 -0
  69. package/dist/components/index.js.map +1 -1
  70. package/dist/components/input.component.d.ts +157 -54
  71. package/dist/components/input.component.d.ts.map +1 -1
  72. package/dist/components/input.component.js +437 -222
  73. package/dist/components/input.component.js.map +1 -1
  74. package/dist/components/label.component.d.ts +29 -0
  75. package/dist/components/label.component.d.ts.map +1 -0
  76. package/dist/components/label.component.js +60 -0
  77. package/dist/components/label.component.js.map +1 -0
  78. package/dist/components/language-picker.component.d.ts +124 -0
  79. package/dist/components/language-picker.component.d.ts.map +1 -0
  80. package/dist/components/language-picker.component.js +305 -0
  81. package/dist/components/language-picker.component.js.map +1 -0
  82. package/dist/components/layout.component.d.ts +167 -0
  83. package/dist/components/layout.component.d.ts.map +1 -0
  84. package/dist/components/layout.component.js +364 -0
  85. package/dist/components/layout.component.js.map +1 -0
  86. package/dist/components/load-error-banner.component.d.ts +103 -0
  87. package/dist/components/load-error-banner.component.d.ts.map +1 -0
  88. package/dist/components/load-error-banner.component.js +263 -0
  89. package/dist/components/load-error-banner.component.js.map +1 -0
  90. package/dist/components/modal.component.d.ts +125 -95
  91. package/dist/components/modal.component.d.ts.map +1 -1
  92. package/dist/components/modal.component.js +458 -271
  93. package/dist/components/modal.component.js.map +1 -1
  94. package/dist/components/molecule/alert.component.d.ts +77 -0
  95. package/dist/components/molecule/alert.component.d.ts.map +1 -0
  96. package/dist/components/molecule/alert.component.js +229 -0
  97. package/dist/components/molecule/alert.component.js.map +1 -0
  98. package/dist/components/molecule/badge.component.d.ts +27 -0
  99. package/dist/components/molecule/badge.component.d.ts.map +1 -0
  100. package/dist/components/molecule/badge.component.js +79 -0
  101. package/dist/components/molecule/badge.component.js.map +1 -0
  102. package/dist/components/molecule/button.component.d.ts +38 -0
  103. package/dist/components/molecule/button.component.d.ts.map +1 -0
  104. package/dist/components/molecule/button.component.js +137 -0
  105. package/dist/components/molecule/button.component.js.map +1 -0
  106. package/dist/components/molecule/checkbox.component.d.ts +53 -0
  107. package/dist/components/molecule/checkbox.component.d.ts.map +1 -0
  108. package/dist/components/molecule/checkbox.component.js +166 -0
  109. package/dist/components/molecule/checkbox.component.js.map +1 -0
  110. package/dist/components/molecule/index.d.ts +18 -0
  111. package/dist/components/molecule/index.d.ts.map +1 -0
  112. package/dist/components/molecule/index.js +18 -0
  113. package/dist/components/molecule/index.js.map +1 -0
  114. package/dist/components/molecule/input.component.d.ts +93 -0
  115. package/dist/components/molecule/input.component.d.ts.map +1 -0
  116. package/dist/components/molecule/input.component.js +314 -0
  117. package/dist/components/molecule/input.component.js.map +1 -0
  118. package/dist/components/molecule/modal.component.d.ts +148 -0
  119. package/dist/components/molecule/modal.component.d.ts.map +1 -0
  120. package/dist/components/molecule/modal.component.js +382 -0
  121. package/dist/components/molecule/modal.component.js.map +1 -0
  122. package/dist/components/molecule/radio-group.component.d.ts +63 -0
  123. package/dist/components/molecule/radio-group.component.d.ts.map +1 -0
  124. package/dist/components/molecule/radio-group.component.js +208 -0
  125. package/dist/components/molecule/radio-group.component.js.map +1 -0
  126. package/dist/components/molecule/select.component.d.ts +72 -0
  127. package/dist/components/molecule/select.component.d.ts.map +1 -0
  128. package/dist/components/molecule/select.component.js +274 -0
  129. package/dist/components/molecule/select.component.js.map +1 -0
  130. package/dist/components/molecule/spinner.component.d.ts +42 -0
  131. package/dist/components/molecule/spinner.component.d.ts.map +1 -0
  132. package/dist/components/molecule/spinner.component.js +122 -0
  133. package/dist/components/molecule/spinner.component.js.map +1 -0
  134. package/dist/components/molecule/switch.component.d.ts +54 -0
  135. package/dist/components/molecule/switch.component.d.ts.map +1 -0
  136. package/dist/components/molecule/switch.component.js +148 -0
  137. package/dist/components/molecule/switch.component.js.map +1 -0
  138. package/dist/components/molecule/toast.component.d.ts +98 -0
  139. package/dist/components/molecule/toast.component.d.ts.map +1 -0
  140. package/dist/components/molecule/toast.component.js +305 -0
  141. package/dist/components/molecule/toast.component.js.map +1 -0
  142. package/dist/components/molecule/tooltip.component.d.ts +77 -0
  143. package/dist/components/molecule/tooltip.component.d.ts.map +1 -0
  144. package/dist/components/molecule/tooltip.component.js +316 -0
  145. package/dist/components/molecule/tooltip.component.js.map +1 -0
  146. package/dist/components/optimistic-toggle-button.component.d.ts +125 -0
  147. package/dist/components/optimistic-toggle-button.component.d.ts.map +1 -0
  148. package/dist/components/optimistic-toggle-button.component.js +296 -0
  149. package/dist/components/optimistic-toggle-button.component.js.map +1 -0
  150. package/dist/components/page-header.component.d.ts +77 -0
  151. package/dist/components/page-header.component.d.ts.map +1 -0
  152. package/dist/components/page-header.component.js +225 -0
  153. package/dist/components/page-header.component.js.map +1 -0
  154. package/dist/components/page-shell.component.d.ts +101 -0
  155. package/dist/components/page-shell.component.d.ts.map +1 -0
  156. package/dist/components/page-shell.component.js +221 -0
  157. package/dist/components/page-shell.component.js.map +1 -0
  158. package/dist/components/pagination.component.d.ts +137 -0
  159. package/dist/components/pagination.component.d.ts.map +1 -0
  160. package/dist/components/pagination.component.js +419 -0
  161. package/dist/components/pagination.component.js.map +1 -0
  162. package/dist/components/panel-close.component.d.ts +43 -0
  163. package/dist/components/panel-close.component.d.ts.map +1 -0
  164. package/dist/components/panel-close.component.js +75 -0
  165. package/dist/components/panel-close.component.js.map +1 -0
  166. package/dist/components/progress.component.d.ts +84 -0
  167. package/dist/components/progress.component.d.ts.map +1 -0
  168. package/dist/components/progress.component.js +219 -0
  169. package/dist/components/progress.component.js.map +1 -0
  170. package/dist/components/prompt-dialog.component.d.ts +121 -0
  171. package/dist/components/prompt-dialog.component.d.ts.map +1 -0
  172. package/dist/components/prompt-dialog.component.js +332 -0
  173. package/dist/components/prompt-dialog.component.js.map +1 -0
  174. package/dist/components/radio-group.component.d.ts +66 -34
  175. package/dist/components/radio-group.component.d.ts.map +1 -1
  176. package/dist/components/radio-group.component.js +146 -125
  177. package/dist/components/radio-group.component.js.map +1 -1
  178. package/dist/components/responsive-app-shell.component.d.ts +408 -0
  179. package/dist/components/responsive-app-shell.component.d.ts.map +1 -0
  180. package/dist/components/responsive-app-shell.component.js +1144 -0
  181. package/dist/components/responsive-app-shell.component.js.map +1 -0
  182. package/dist/components/select.component.d.ts +135 -38
  183. package/dist/components/select.component.d.ts.map +1 -1
  184. package/dist/components/select.component.js +373 -181
  185. package/dist/components/select.component.js.map +1 -1
  186. package/dist/components/separator.component.d.ts +39 -0
  187. package/dist/components/separator.component.d.ts.map +1 -0
  188. package/dist/components/separator.component.js +73 -0
  189. package/dist/components/separator.component.js.map +1 -0
  190. package/dist/components/sidebar-user-card.component.d.ts +106 -0
  191. package/dist/components/sidebar-user-card.component.d.ts.map +1 -0
  192. package/dist/components/sidebar-user-card.component.js +277 -0
  193. package/dist/components/sidebar-user-card.component.js.map +1 -0
  194. package/dist/components/skeleton.component.d.ts +100 -0
  195. package/dist/components/skeleton.component.d.ts.map +1 -0
  196. package/dist/components/skeleton.component.js +214 -0
  197. package/dist/components/skeleton.component.js.map +1 -0
  198. package/dist/components/spinner.component.d.ts +36 -19
  199. package/dist/components/spinner.component.d.ts.map +1 -1
  200. package/dist/components/spinner.component.js +69 -71
  201. package/dist/components/spinner.component.js.map +1 -1
  202. package/dist/components/switch.component.d.ts +72 -29
  203. package/dist/components/switch.component.d.ts.map +1 -1
  204. package/dist/components/switch.component.js +163 -91
  205. package/dist/components/switch.component.js.map +1 -1
  206. package/dist/components/table.component.d.ts +193 -0
  207. package/dist/components/table.component.d.ts.map +1 -0
  208. package/dist/components/table.component.js +550 -0
  209. package/dist/components/table.component.js.map +1 -0
  210. package/dist/components/tabs.component.d.ts +140 -0
  211. package/dist/components/tabs.component.d.ts.map +1 -0
  212. package/dist/components/tabs.component.js +390 -0
  213. package/dist/components/tabs.component.js.map +1 -0
  214. package/dist/components/template-outlet.directive.d.ts +50 -0
  215. package/dist/components/template-outlet.directive.d.ts.map +1 -0
  216. package/dist/components/template-outlet.directive.js +81 -0
  217. package/dist/components/template-outlet.directive.js.map +1 -0
  218. package/dist/components/textarea.component.d.ts +151 -0
  219. package/dist/components/textarea.component.d.ts.map +1 -0
  220. package/dist/components/textarea.component.js +340 -0
  221. package/dist/components/textarea.component.js.map +1 -0
  222. package/dist/components/theme-toggle.component.d.ts +58 -0
  223. package/dist/components/theme-toggle.component.d.ts.map +1 -0
  224. package/dist/components/theme-toggle.component.js +124 -0
  225. package/dist/components/theme-toggle.component.js.map +1 -0
  226. package/dist/components/toast.component.d.ts +237 -49
  227. package/dist/components/toast.component.d.ts.map +1 -1
  228. package/dist/components/toast.component.js +636 -201
  229. package/dist/components/toast.component.js.map +1 -1
  230. package/dist/components/tooltip.component.d.ts +95 -45
  231. package/dist/components/tooltip.component.d.ts.map +1 -1
  232. package/dist/components/tooltip.component.js +372 -221
  233. package/dist/components/tooltip.component.js.map +1 -1
  234. package/dist/components/user-menu-popover.component.d.ts +283 -0
  235. package/dist/components/user-menu-popover.component.d.ts.map +1 -0
  236. package/dist/components/user-menu-popover.component.js +646 -0
  237. package/dist/components/user-menu-popover.component.js.map +1 -0
  238. package/dist/components/user-menu.component.d.ts +95 -0
  239. package/dist/components/user-menu.component.d.ts.map +1 -0
  240. package/dist/components/user-menu.component.js +218 -0
  241. package/dist/components/user-menu.component.js.map +1 -0
  242. package/dist/hooks/index.d.ts +7 -0
  243. package/dist/hooks/index.d.ts.map +1 -0
  244. package/dist/hooks/index.js +7 -0
  245. package/dist/hooks/index.js.map +1 -0
  246. package/dist/hooks/use-is-desktop.d.ts +22 -0
  247. package/dist/hooks/use-is-desktop.d.ts.map +1 -0
  248. package/dist/hooks/use-is-desktop.js +37 -0
  249. package/dist/hooks/use-is-desktop.js.map +1 -0
  250. package/dist/index.d.ts +32 -17
  251. package/dist/index.d.ts.map +1 -1
  252. package/dist/index.js +32 -17
  253. package/dist/index.js.map +1 -1
  254. package/dist/types.d.ts +1 -1
  255. package/dist/types.d.ts.map +1 -1
  256. package/dist/utilities/dom-context.d.ts +42 -0
  257. package/dist/utilities/dom-context.d.ts.map +1 -0
  258. package/dist/utilities/dom-context.js +66 -0
  259. package/dist/utilities/dom-context.js.map +1 -0
  260. package/dist/utilities/focus.d.ts +32 -0
  261. package/dist/utilities/focus.d.ts.map +1 -0
  262. package/dist/utilities/focus.js +47 -0
  263. package/dist/utilities/focus.js.map +1 -0
  264. package/dist/utilities/form-field-context.d.ts +34 -0
  265. package/dist/utilities/form-field-context.d.ts.map +1 -0
  266. package/dist/utilities/form-field-context.js +28 -0
  267. package/dist/utilities/form-field-context.js.map +1 -0
  268. package/dist/utilities/form-submit-error.d.ts +17 -0
  269. package/dist/utilities/form-submit-error.d.ts.map +1 -0
  270. package/dist/utilities/form-submit-error.js +42 -0
  271. package/dist/utilities/form-submit-error.js.map +1 -0
  272. package/dist/utilities/icon-markup.d.ts +17 -0
  273. package/dist/utilities/icon-markup.d.ts.map +1 -0
  274. package/dist/utilities/icon-markup.js +46 -0
  275. package/dist/utilities/icon-markup.js.map +1 -0
  276. package/dist/utilities/ids.d.ts +15 -0
  277. package/dist/utilities/ids.d.ts.map +1 -0
  278. package/dist/utilities/ids.js +19 -0
  279. package/dist/utilities/ids.js.map +1 -0
  280. package/dist/utilities/index.d.ts +11 -0
  281. package/dist/utilities/index.d.ts.map +1 -1
  282. package/dist/utilities/index.js +11 -0
  283. package/dist/utilities/index.js.map +1 -1
  284. package/dist/utilities/initials.d.ts +13 -0
  285. package/dist/utilities/initials.d.ts.map +1 -0
  286. package/dist/utilities/initials.js +23 -0
  287. package/dist/utilities/initials.js.map +1 -0
  288. package/dist/utilities/node-value.d.ts +31 -0
  289. package/dist/utilities/node-value.d.ts.map +1 -0
  290. package/dist/utilities/node-value.js +37 -0
  291. package/dist/utilities/node-value.js.map +1 -0
  292. package/dist/utilities/optimistic-value.d.ts +81 -0
  293. package/dist/utilities/optimistic-value.d.ts.map +1 -0
  294. package/dist/utilities/optimistic-value.js +154 -0
  295. package/dist/utilities/optimistic-value.js.map +1 -0
  296. package/dist/utilities/render-icon.d.ts +77 -7
  297. package/dist/utilities/render-icon.d.ts.map +1 -1
  298. package/dist/utilities/render-icon.js +123 -33
  299. package/dist/utilities/render-icon.js.map +1 -1
  300. package/dist/utilities/rest-attrs.d.ts +21 -0
  301. package/dist/utilities/rest-attrs.d.ts.map +1 -0
  302. package/dist/utilities/rest-attrs.js +37 -0
  303. package/dist/utilities/rest-attrs.js.map +1 -0
  304. package/dist/utilities/style.d.ts +23 -0
  305. package/dist/utilities/style.d.ts.map +1 -0
  306. package/dist/utilities/style.js +86 -0
  307. package/dist/utilities/style.js.map +1 -0
  308. package/package.json +6 -4
@@ -1,48 +1,45 @@
1
1
  /**
2
- * Angular Alert UI component with UIClassMap-driven styling.
2
+ * Alert component (React parity).
3
3
  *
4
4
  * @module
5
5
  */
6
- import { ChangeDetectionStrategy, Component, EventEmitter, Input, Output } from '@angular/core';
7
- import { t } from '@molecule/app-i18n';
6
+ import { Component, ElementRef, EventEmitter, inject, Output, Renderer2, ViewChild, } from '@angular/core';
7
+ import { useTranslation } from '@molecule/app-angular';
8
8
  import { getClassMap } from '@molecule/app-ui';
9
- import { getIconSvg } from '../utilities/render-icon.js';
9
+ import { MolIconSvg, resolveIcon } from '../utilities/render-icon.js';
10
+ import { styleText } from '../utilities/style.js';
11
+ import { SlotWrapper } from './button.component.js';
10
12
  import * as i0 from "@angular/core";
11
- const _c0 = ["*"];
12
- function MoleculeAlert_Conditional_1_Template(rf, ctx) { if (rf & 1) {
13
- i0.ɵɵdomElementStart(0, "span");
14
- i0.ɵɵdomElement(1, "span", 3);
15
- i0.ɵɵdomElementEnd();
16
- } if (rf & 2) {
17
- const ctx_r0 = i0.ɵɵnextContext();
18
- i0.ɵɵclassMap(ctx_r0.cm.alertIconWrapper);
19
- i0.ɵɵadvance();
20
- i0.ɵɵdomProperty("innerHTML", ctx_r0.statusIconSvg, i0.ɵɵsanitizeHtml);
21
- } }
22
- function MoleculeAlert_Conditional_3_Template(rf, ctx) { if (rf & 1) {
23
- i0.ɵɵdomElementStart(0, "h5");
13
+ const _c0 = ["iconSlot"];
14
+ const _c1 = ["defaultGlyph"];
15
+ const _c2 = [[["", "slot", "icon"]], "*"];
16
+ const _c3 = ["[slot=icon]", "*"];
17
+ function Alert_Conditional_6_Template(rf, ctx) { if (rf & 1) {
18
+ i0.ɵɵelementStart(0, "h5");
24
19
  i0.ɵɵtext(1);
25
- i0.ɵɵdomElementEnd();
20
+ i0.ɵɵelementEnd();
26
21
  } if (rf & 2) {
27
22
  const ctx_r0 = i0.ɵɵnextContext();
28
- i0.ɵɵclassMap(ctx_r0.titleClass);
23
+ i0.ɵɵclassMap(ctx_r0.cm().alertTitle);
29
24
  i0.ɵɵadvance();
30
25
  i0.ɵɵtextInterpolate(ctx_r0.title);
31
26
  } }
32
- function MoleculeAlert_Conditional_6_Template(rf, ctx) { if (rf & 1) {
27
+ function Alert_Conditional_9_Template(rf, ctx) { if (rf & 1) {
33
28
  const _r2 = i0.ɵɵgetCurrentView();
34
- i0.ɵɵdomElementStart(0, "button", 4);
35
- i0.ɵɵdomListener("click", function MoleculeAlert_Conditional_6_Template_button_click_0_listener() { i0.ɵɵrestoreView(_r2); const ctx_r0 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r0.dismiss.emit()); });
36
- i0.ɵɵdomElement(1, "span", 3);
37
- i0.ɵɵdomElementEnd();
29
+ i0.ɵɵelementStart(0, "button", 5);
30
+ i0.ɵɵlistener("click", function Alert_Conditional_9_Template_button_click_0_listener($event) { i0.ɵɵrestoreView(_r2); const ctx_r0 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r0.dismiss.emit($event)); });
31
+ i0.ɵɵnamespaceSVG();
32
+ i0.ɵɵelement(1, "svg", 2);
33
+ i0.ɵɵelementEnd();
38
34
  } if (rf & 2) {
39
35
  const ctx_r0 = i0.ɵɵnextContext();
40
- i0.ɵɵclassMap(ctx_r0.cm.alertDismiss);
41
- i0.ɵɵattribute("aria-label", ctx_r0.dismissAriaLabel);
36
+ i0.ɵɵclassMap(ctx_r0.cm().alertDismiss);
37
+ i0.ɵɵattribute("aria-label", ctx_r0.dismissText());
42
38
  i0.ɵɵadvance();
43
- i0.ɵɵdomProperty("innerHTML", ctx_r0.dismissIconSvg, i0.ɵɵsanitizeHtml);
39
+ i0.ɵɵproperty("data", ctx_r0.closeIcon());
44
40
  } }
45
- const statusVariantMap = {
41
+ /** Alert status → class-map variant. */
42
+ const STATUS_VARIANT = {
46
43
  primary: 'default',
47
44
  secondary: 'default',
48
45
  success: 'success',
@@ -50,173 +47,262 @@ const statusVariantMap = {
50
47
  error: 'error',
51
48
  info: 'info',
52
49
  };
50
+ /** Alert variant → default status glyph (none for `default`). */
51
+ const STATUS_ICON = {
52
+ info: 'info-circle',
53
+ success: 'check-circle',
54
+ warning: 'exclamation-triangle',
55
+ error: 'x-circle',
56
+ };
53
57
  /**
54
- * Angular Alert UI component with UIClassMap-driven styling.
55
- */
56
- /**
57
- * Molecule Alert class.
58
+ * Alert component.
59
+ *
60
+ * `role` follows `live` (assertive `alert` by default, polite `status` for a
61
+ * banner that is part of the page's normal content).
62
+ *
63
+ * React renders `{(icon || defaultIcon) && <span className={alertIconWrapper}>…}`:
64
+ * the icon wrapper span exists only when a custom icon is given or the status
65
+ * has a default glyph, and its content is the custom icon XOR the default
66
+ * glyph. Here the span and the default glyph both always exist in the
67
+ * template (projection capture points) and are detached from the DOM when
68
+ * React would not render them ({@link SlotWrapper}); the decision is made at
69
+ * view init, when view queries resolve.
58
70
  */
59
- export class MoleculeAlert {
71
+ export class Alert {
72
+ /** Alert title. */
60
73
  title;
74
+ /** Status color. */
61
75
  status = 'info';
76
+ /** Visual variant. */
62
77
  variant;
63
- dismissible = false;
78
+ /** Whether the alert announces assertively (default true). */
79
+ live = true;
80
+ /** Whether a dismiss button renders. */
81
+ dismissible;
82
+ /** Accessible label for the dismiss button. */
64
83
  dismissLabel;
84
+ /** Extra classes. */
65
85
  className;
86
+ /** Inline style object (React camelCase). */
66
87
  style;
88
+ /** `data-testid`. */
67
89
  testId;
90
+ /** Fires the raw click event when the dismiss button is pressed. */
68
91
  dismiss = new EventEmitter();
92
+ /** The icon wrapper span (projection capture point). */
93
+ iconSlot;
94
+ /** The default status glyph (detached when a custom icon is projected). */
95
+ defaultGlyph;
96
+ hasCustomIcon = false;
97
+ /**
98
+ * Reactive translation, read in the injection context. Its `t` reads the
99
+ * locale, so the view re-renders the text on a locale switch (the static `t`
100
+ * does not).
101
+ */
102
+ i18n = useTranslation();
103
+ sync = new SlotWrapper(inject(ElementRef), inject(Renderer2));
69
104
  /**
70
- * Retrieves the current UI class map.
71
- * @returns The UIClassMap instance for styling.
105
+ * The current class map.
106
+ * @returns The UIClassMap.
72
107
  */
73
- get cm() {
108
+ cm() {
74
109
  return getClassMap();
75
110
  }
76
111
  /**
77
- * Computes the accessible dismiss button label.
78
- * @returns The localized aria-label for the dismiss button.
112
+ * The class-map variant for the status.
113
+ * @returns The mapped variant.
114
+ */
115
+ get alertVariant() {
116
+ return STATUS_VARIANT[this.status] || 'default';
117
+ }
118
+ /**
119
+ * The default status glyph (none for the `default` variant, matching
120
+ * React's `statusIconMap` gap).
121
+ * @returns The resolved icon, or null when the variant has no glyph.
79
122
  */
80
- get dismissAriaLabel() {
81
- return this.dismissLabel || t('ui.alert.dismiss', undefined, { defaultValue: 'Dismiss' });
123
+ defaultIcon() {
124
+ const name = STATUS_ICON[this.alertVariant];
125
+ return name ? resolveIcon(name, this.cm().iconMd) : null;
82
126
  }
83
127
  /**
84
- * Retrieves the CSS class for the alert title.
85
- * @returns The title class name string.
128
+ * A non-null glyph to bind (an empty resolved icon when the variant has
129
+ * none; that svg is detached from the DOM anyway).
130
+ * @returns The resolved icon data.
86
131
  */
87
- get titleClass() {
88
- return this.cm.alertTitle;
132
+ resolvedDefaultIcon() {
133
+ return (this.defaultIcon() ?? {
134
+ icon: { paths: [] },
135
+ className: '',
136
+ stroked: false,
137
+ viewBox: '0 0 20 20',
138
+ });
89
139
  }
90
140
  /**
91
- * Retrieves the CSS class for the alert description.
92
- * @returns The description class name string.
141
+ * The dismiss button's X glyph.
142
+ * @returns The resolved icon.
93
143
  */
94
- get descriptionClass() {
95
- return this.cm.alertDescription;
144
+ closeIcon() {
145
+ return resolveIcon('x-mark', this.cm().iconSm);
96
146
  }
97
147
  /**
98
- * Determines the icon type based on the alert status.
99
- * @returns The mapped icon type string.
148
+ * The dismiss button's accessible label.
149
+ * @returns The label text.
100
150
  */
101
- get iconType() {
102
- return statusVariantMap[this.status] || 'default';
151
+ dismissText() {
152
+ return (this.dismissLabel ?? this.i18n.t('ui.alert.dismiss', undefined, { defaultValue: 'Dismiss' }));
103
153
  }
104
154
  /**
105
- * Determines whether the status icon should be shown.
106
- * @returns True if the icon type is not default.
155
+ * Computes the alert class list.
156
+ * @returns The class string.
107
157
  */
108
- get showIcon() {
109
- return this.iconType !== 'default';
158
+ classes() {
159
+ return this.cm().cn(this.cm().alert({ variant: this.alertVariant }), this.variant === 'left-accent' && this.cm().alertLeftAccent({ variant: this.alertVariant }), this.className);
110
160
  }
111
- statusIconMap = {
112
- info: 'info-circle',
113
- success: 'check-circle',
114
- warning: 'exclamation-triangle',
115
- error: 'x-circle',
116
- };
117
161
  /**
118
- * Generates the SVG markup for the status icon.
119
- * @returns The SVG string for the current status icon.
162
+ * Serializes the inline style.
163
+ * @returns The style attribute text.
120
164
  */
121
- get statusIconSvg() {
122
- const name = this.statusIconMap[this.iconType];
123
- return name ? getIconSvg(name, this.cm.iconMd) : '';
165
+ hostStyle() {
166
+ return styleText(this.style);
124
167
  }
125
168
  /**
126
- * Generates the SVG markup for the dismiss icon.
127
- * @returns The SVG string for the dismiss button icon.
169
+ * Decides icon presence at view init (view queries resolve only then) and
170
+ * applies React's conditions.
128
171
  */
129
- get dismissIconSvg() {
130
- return getIconSvg('x-mark', this.cm.iconSm);
172
+ ngAfterViewInit() {
173
+ const span = this.iconSlot?.nativeElement;
174
+ const glyph = this.defaultGlyph?.nativeElement;
175
+ // Projected nodes are the span's children other than the default glyph.
176
+ this.hasCustomIcon = !!span && hasNodesExcept(span, glyph);
177
+ this.syncIcon();
131
178
  }
132
179
  /**
133
- * Computes the combined CSS classes for the alert container.
134
- * @returns The alert container class name string.
180
+ * Re-reconciles on later passes.
135
181
  */
136
- get alertClasses() {
137
- const cmVariant = statusVariantMap[this.status] || 'default';
138
- return this.cm.cn(this.cm.alert({ variant: cmVariant }), this.className);
182
+ ngDoCheck() {
183
+ this.syncIcon();
139
184
  }
140
- static ɵfac = function MoleculeAlert_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || MoleculeAlert)(); };
141
- static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: MoleculeAlert, selectors: [["mol-alert"]], inputs: { title: "title", status: "status", variant: "variant", dismissible: "dismissible", dismissLabel: "dismissLabel", className: "className", style: "style", testId: "testId" }, outputs: { dismiss: "dismiss" }, ngContentSelectors: _c0, decls: 7, vars: 12, consts: [["role", "alert"], [3, "class"], ["type", "button", 3, "class"], [3, "innerHTML"], ["type", "button", 3, "click"]], template: function MoleculeAlert_Template(rf, ctx) { if (rf & 1) {
142
- i0.ɵɵprojectionDef();
143
- i0.ɵɵdomElementStart(0, "div", 0);
144
- i0.ɵɵconditionalCreate(1, MoleculeAlert_Conditional_1_Template, 2, 3, "span", 1);
145
- i0.ɵɵdomElementStart(2, "div");
146
- i0.ɵɵconditionalCreate(3, MoleculeAlert_Conditional_3_Template, 2, 3, "h5", 1);
147
- i0.ɵɵdomElementStart(4, "div");
148
- i0.ɵɵprojection(5);
149
- i0.ɵɵdomElementEnd()();
150
- i0.ɵɵconditionalCreate(6, MoleculeAlert_Conditional_6_Template, 2, 4, "button", 2);
151
- i0.ɵɵdomElementEnd();
185
+ /**
186
+ * Applies React's `{(icon || defaultIcon) && <span>{icon || defaultIcon}</span>}`.
187
+ */
188
+ syncIcon() {
189
+ const span = this.iconSlot?.nativeElement;
190
+ this.sync.sync(this.defaultGlyph?.nativeElement, !this.hasCustomIcon && this.defaultIcon() !== null, span);
191
+ this.sync.sync(span, this.hasCustomIcon || this.defaultIcon() !== null);
192
+ }
193
+ static ɵfac = function Alert_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || Alert)(); };
194
+ static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: Alert, selectors: [["div", "mol-alert", ""]], viewQuery: function Alert_Query(rf, ctx) { if (rf & 1) {
195
+ i0.ɵɵviewQuery(_c0, 5)(_c1, 5, ElementRef);
152
196
  } if (rf & 2) {
153
- i0.ɵɵstyleMap(ctx.style);
154
- i0.ɵɵclassMap(ctx.alertClasses);
155
- i0.ɵɵattribute("data-testid", ctx.testId);
156
- i0.ɵɵadvance();
157
- i0.ɵɵconditional(ctx.showIcon ? 1 : -1);
158
- i0.ɵɵadvance();
159
- i0.ɵɵclassMap(ctx.cm.alertContent);
197
+ let _t;
198
+ i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.iconSlot = _t.first);
199
+ i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.defaultGlyph = _t.first);
200
+ } }, hostVars: 6, hostBindings: function Alert_HostBindings(rf, ctx) { if (rf & 2) {
201
+ i0.ɵɵattribute("role", ctx.live ? "alert" : "status")("data-testid", ctx.testId);
202
+ i0.ɵɵstyleMap(ctx.hostStyle());
203
+ i0.ɵɵclassMap(ctx.classes());
204
+ } }, inputs: { title: "title", status: "status", variant: "variant", live: "live", dismissible: "dismissible", dismissLabel: "dismissLabel", className: "className", style: "style", testId: "testId" }, outputs: { dismiss: "dismiss" }, ngContentSelectors: _c3, decls: 10, vars: 9, consts: [["iconSlot", ""], ["defaultGlyph", ""], ["mol-icon", "", 3, "data"], [3, "class"], ["type", "button", 3, "class"], ["type", "button", 3, "click"]], template: function Alert_Template(rf, ctx) { if (rf & 1) {
205
+ i0.ɵɵprojectionDef(_c2);
206
+ i0.ɵɵelementStart(0, "span", null, 0);
207
+ i0.ɵɵnamespaceSVG();
208
+ i0.ɵɵelement(2, "svg", 2, 1);
209
+ i0.ɵɵprojection(4);
210
+ i0.ɵɵelementEnd();
211
+ i0.ɵɵnamespaceHTML();
212
+ i0.ɵɵelementStart(5, "div");
213
+ i0.ɵɵconditionalCreate(6, Alert_Conditional_6_Template, 2, 3, "h5", 3);
214
+ i0.ɵɵelementStart(7, "div");
215
+ i0.ɵɵprojection(8, 1);
216
+ i0.ɵɵelementEnd()();
217
+ i0.ɵɵconditionalCreate(9, Alert_Conditional_9_Template, 2, 4, "button", 4);
218
+ } if (rf & 2) {
219
+ i0.ɵɵclassMap(ctx.cm().alertIconWrapper);
220
+ i0.ɵɵadvance(2);
221
+ i0.ɵɵproperty("data", ctx.resolvedDefaultIcon());
222
+ i0.ɵɵadvance(3);
223
+ i0.ɵɵclassMap(ctx.cm().alertContent);
160
224
  i0.ɵɵadvance();
161
- i0.ɵɵconditional(ctx.title ? 3 : -1);
225
+ i0.ɵɵconditional(ctx.title ? 6 : -1);
162
226
  i0.ɵɵadvance();
163
- i0.ɵɵclassMap(ctx.descriptionClass);
227
+ i0.ɵɵclassMap(ctx.cm().alertDescription);
164
228
  i0.ɵɵadvance(2);
165
- i0.ɵɵconditional(ctx.dismissible ? 6 : -1);
166
- } }, encapsulation: 2 });
229
+ i0.ɵɵconditional(ctx.dismissible ? 9 : -1);
230
+ } }, dependencies: [MolIconSvg], encapsulation: 2 });
167
231
  }
168
- (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(MoleculeAlert, [{
232
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(Alert, [{
169
233
  type: Component,
170
234
  args: [{
171
- selector: 'mol-alert',
235
+ selector: 'div[mol-alert]',
172
236
  standalone: true,
173
- changeDetection: ChangeDetectionStrategy.OnPush,
174
- template: `
175
- <div role="alert" [class]="alertClasses" [style]="style" [attr.data-testid]="testId">
176
- @if (showIcon) {
177
- <span [class]="cm.alertIconWrapper">
178
- <span [innerHTML]="statusIconSvg"></span>
179
- </span>
180
- }
181
- <div [class]="cm.alertContent">
182
- @if (title) {
183
- <h5 [class]="titleClass">{{ title }}</h5>
184
- }
185
- <div [class]="descriptionClass">
186
- <ng-content></ng-content>
187
- </div>
188
- </div>
189
- @if (dismissible) {
190
- <button
191
- type="button"
192
- (click)="dismiss.emit()"
193
- [class]="cm.alertDismiss"
194
- [attr.aria-label]="dismissAriaLabel"
195
- >
196
- <span [innerHTML]="dismissIconSvg"></span>
197
- </button>
237
+ imports: [MolIconSvg],
238
+ inputs: [
239
+ 'title',
240
+ 'status',
241
+ 'variant',
242
+ 'live',
243
+ 'dismissible',
244
+ 'dismissLabel',
245
+ 'className',
246
+ 'style',
247
+ 'testId',
248
+ ],
249
+ outputs: ['dismiss'],
250
+ host: {
251
+ '[attr.role]': 'live ? "alert" : "status"',
252
+ '[class]': 'classes()',
253
+ '[style]': 'hostStyle()',
254
+ '[attr.data-testid]': 'testId',
255
+ },
256
+ template: `<span [class]="cm().alertIconWrapper" #iconSlot>
257
+ <svg mol-icon [data]="resolvedDefaultIcon()" #defaultGlyph />
258
+ <ng-content select="[slot=icon]"></ng-content>
259
+ </span>
260
+ <div [class]="cm().alertContent">
261
+ @if (title) {
262
+ <h5 [class]="cm().alertTitle">{{ title }}</h5>
198
263
  }
264
+ <div [class]="cm().alertDescription"><ng-content></ng-content></div>
199
265
  </div>
200
- `,
266
+ @if (dismissible) {
267
+ <button
268
+ type="button"
269
+ [class]="cm().alertDismiss"
270
+ [attr.aria-label]="dismissText()"
271
+ (click)="dismiss.emit($event)"
272
+ >
273
+ <svg mol-icon [data]="closeIcon()" />
274
+ </button>
275
+ }`,
201
276
  }]
202
- }], null, { title: [{
203
- type: Input
204
- }], status: [{
205
- type: Input
206
- }], variant: [{
207
- type: Input
208
- }], dismissible: [{
209
- type: Input
210
- }], dismissLabel: [{
211
- type: Input
212
- }], className: [{
213
- type: Input
214
- }], style: [{
215
- type: Input
216
- }], testId: [{
217
- type: Input
218
- }], dismiss: [{
277
+ }], null, { dismiss: [{
219
278
  type: Output
279
+ }], iconSlot: [{
280
+ type: ViewChild,
281
+ args: ['iconSlot']
282
+ }], defaultGlyph: [{
283
+ type: ViewChild,
284
+ args: ['defaultGlyph', { read: ElementRef }]
220
285
  }] }); })();
221
- (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(MoleculeAlert, { className: "MoleculeAlert", filePath: "components/alert.component.ts", lineNumber: 64 }); })();
286
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(Alert, { className: "Alert", filePath: "components/alert.component.ts", lineNumber: 104 }); })();
287
+ /**
288
+ * Whether an element captured any element or text node other than one
289
+ * excluded element (the always-mounted default glyph).
290
+ *
291
+ * @param el - The wrapper element.
292
+ * @param except - The element to ignore.
293
+ * @returns True when at least one other projected node exists.
294
+ */
295
+ function hasNodesExcept(el, except) {
296
+ if (!el)
297
+ return false;
298
+ for (const node of Array.from(el.childNodes)) {
299
+ if (node === except)
300
+ continue;
301
+ if (node.nodeType === 1)
302
+ return true;
303
+ if (node.nodeType === 3 && (node.textContent ?? '').trim())
304
+ return true;
305
+ }
306
+ return false;
307
+ }
222
308
  //# sourceMappingURL=alert.component.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"alert.component.js","sourceRoot":"","sources":["../../src/components/alert.component.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,uBAAuB,EAAE,SAAS,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAE/F,OAAO,EAAE,CAAC,EAAE,MAAM,oBAAoB,CAAA;AAGtC,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAE9C,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAA;;;;IAsBhD,+BAAoC;IAClC,6BAAyC;IAC3C,oBAAO;;;IAFD,yCAA6B;IAC3B,cAA2B;IAA3B,sEAA2B;;;IAKjC,6BAAyB;IAAA,YAAW;IAAA,oBAAK;;;IAArC,gCAAoB;IAAC,cAAW;IAAX,kCAAW;;;;IAOtC,oCAKC;IAHC,oLAAS,qBAAc,KAAC;IAIxB,6BAA0C;IAC5C,oBAAS;;;IAJP,qCAAyB;;IAGnB,cAA4B;IAA5B,uEAA4B;;AAvC5C,MAAM,gBAAgB,GACpB;IACE,OAAO,EAAE,SAAS;IAClB,SAAS,EAAE,SAAS;IACpB,OAAO,EAAE,SAAS;IAClB,OAAO,EAAE,SAAS;IAClB,KAAK,EAAE,OAAO;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CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,CAAA;IACrD,CAAC;IAED;;;OAGG;IACH,IAAI,cAAc;QAChB,OAAO,UAAU,CAAC,QAAQ,EAAE,IAAI,CAAC,EAAE,CAAC,MAAM,CAAC,CAAA;IAC7C,CAAC;IAED;;;OAGG;IACH,IAAI,YAAY;QACd,MAAM,SAAS,GAAG,gBAAgB,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,SAAS,CAAA;QAC5D,OAAO,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC,EAAE,IAAI,CAAC,SAAS,CAAC,CAAA;IAC1E,CAAC;uGA3FU,aAAa;6DAAb,aAAa;;YA9BtB,iCAAqF;YACnF,gFAAgB;YAKhB,8BAA+B;YAC7B,8EAAa;YAGb,8BAAgC;YAC9B,kBAAyB;YAE7B,AADE,oBAAM,EACF;YACN,kFAAmB;YAUrB,oBAAM;;YAxBmC,wBAAe;YAAtC,+BAAsB;;YACtC,cAIC;YAJD,uCAIC;YACI,cAAyB;YAAzB,kCAAyB;YAC5B,cAEC;YAFD,oCAEC;YACI,cAA0B;YAA1B,mCAA0B;YAIjC,eASC;YATD,0CASC;;;iFAOM,aAAa;cAnCzB,SAAS;eAAC;gBACT,QAAQ,EAAE,WAAW;gBACrB,UAAU,EAAE,IAAI;gBAChB,eAAe,EAAE,uBAAuB,CAAC,MAAM;gBAC/C,QAAQ,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BT;aACF;;kBAKE,KAAK;;kBACL,KAAK;;kBACL,KAAK;;kBACL,KAAK;;kBACL,KAAK;;kBACL,KAAK;;kBACL,KAAK;;kBACL,KAAK;;kBAEL,MAAM;;kFAVI,aAAa"}
1
+ {"version":3,"file":"alert.component.js","sourceRoot":"","sources":["../../src/components/alert.component.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH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QAAE,OAAO,KAAK,CAAA;IACrB,KAAK,MAAM,IAAI,IAAI,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,EAAE,CAAC;QAC7C,IAAI,IAAI,KAAK,MAAM;YAAE,SAAQ;QAC7B,IAAI,IAAI,CAAC,QAAQ,KAAK,CAAC;YAAE,OAAO,IAAI,CAAA;QACpC,IAAI,IAAI,CAAC,QAAQ,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE;YAAE,OAAO,IAAI,CAAA;IACzE,CAAC;IACD,OAAO,KAAK,CAAA;AACd,CAAC"}
@@ -0,0 +1,94 @@
1
+ /**
2
+ * AuthGuard component (React parity).
3
+ *
4
+ * @module
5
+ */
6
+ import { type AfterViewInit, ElementRef } from '@angular/core';
7
+ import * as i0 from "@angular/core";
8
+ /**
9
+ * Route-element guard for authenticated sections of a routing tree.
10
+ *
11
+ * While the auth status is `'loading'` it renders the `loadingFallback` slot
12
+ * (or the default `data-mol-id="auth-guard-loading"` tag); while
13
+ * `'unauthenticated'` off the login path it renders nothing and redirects to
14
+ * `loginPath` (state `from` carries the attempted location); otherwise it
15
+ * renders the projected children. The host is unwrapped by the DOM normalizer
16
+ * (`data-parity-unwrap`) and `display: contents` keeps it fragment-like —
17
+ * React's root is a fragment. On the login path itself the guard renders its
18
+ * children, so a guard wrapping the whole route tree does not redirect in a
19
+ * loop.
20
+ *
21
+ * The projected children need one stable capture point, so they live in an
22
+ * always-mounted wrapper the guard moves into (or out of) the host itself:
23
+ * React renders them bare, never inside a wrapper element, and renders
24
+ * nothing at all while redirecting.
25
+ */
26
+ export declare class AuthGuard implements AfterViewInit {
27
+ /**
28
+ * i18n key for the default loading-tag text (default `common.loading`).
29
+ * Ignored when a `loadingFallback` slot is projected.
30
+ */
31
+ loadingKey?: string;
32
+ /** Fallback text if the i18n key is missing (default `Loading...`). */
33
+ loadingDefault?: string;
34
+ /** Path to redirect to when unauthenticated (default `/login`). */
35
+ loginPath?: string;
36
+ /** Fired when `isAuthenticated` becomes true (also when true at mount). */
37
+ onAuthenticated?: () => void;
38
+ /** The default loading tag. */
39
+ defaultLoading?: ElementRef<HTMLDivElement>;
40
+ /** The `loadingFallback` slot capture (always mounted). */
41
+ fallbackWrap?: ElementRef<HTMLSpanElement>;
42
+ /** The children capture; its nodes are moved bare into the host to render. */
43
+ childrenWrap?: ElementRef<HTMLSpanElement>;
44
+ /** Auth state, read in the component's injection context. */
45
+ readonly auth: import("@molecule/app-angular").UseAuthResult<unknown, Record<never, never>>;
46
+ /** Router state and actions, read in the component's injection context. */
47
+ readonly router: import("@molecule/app-angular").UseRouterResult;
48
+ /**
49
+ * Reactive translation, read in the injection context. Its `t` reads the
50
+ * locale, so the view re-renders the text on a locale switch (the static `t`
51
+ * does not).
52
+ */
53
+ private readonly i18n;
54
+ private readonly sync;
55
+ private readonly host;
56
+ private hasFallback;
57
+ private lastAuthenticated;
58
+ /** The login path the guard navigated to for the current redirect state. */
59
+ private redirectedTo;
60
+ /** The children nodes currently adopted into the host. */
61
+ private adopted;
62
+ /**
63
+ * Runs the first reconciliation after the view init (slot detection) and
64
+ * again whenever the auth status or the location changes — the effect
65
+ * tracks both signals directly, so the guard re-evaluates even though no
66
+ * template binding reads them.
67
+ */
68
+ private readonly guardEffect;
69
+ /**
70
+ * Detects the `loadingFallback` slot presence (view queries resolve only by
71
+ * view init).
72
+ */
73
+ ngAfterViewInit(): void;
74
+ /**
75
+ * Applies React's branch for the current auth status and location, fires
76
+ * `onAuthenticated` on its rising edge, and redirects once per entry into
77
+ * the redirect state.
78
+ */
79
+ private reconcile;
80
+ /**
81
+ * Shows exactly one branch's content, the way React's early returns do.
82
+ *
83
+ * @param branch - The branch to render.
84
+ */
85
+ private renderBranch;
86
+ /**
87
+ * The localized default loading text.
88
+ * @returns The translated text.
89
+ */
90
+ loadingText(): string;
91
+ static ɵfac: i0.ɵɵFactoryDeclaration<AuthGuard, never>;
92
+ static ɵcmp: i0.ɵɵComponentDeclaration<AuthGuard, "mol-auth-guard", never, { "loadingKey": { "alias": "loadingKey"; "required": false; }; "loadingDefault": { "alias": "loadingDefault"; "required": false; }; "loginPath": { "alias": "loginPath"; "required": false; }; "onAuthenticated": { "alias": "onAuthenticated"; "required": false; }; }, {}, never, ["[slot=loadingFallback]", "*"], true, never>;
93
+ }
94
+ //# sourceMappingURL=auth-guard.component.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth-guard.component.d.ts","sourceRoot":"","sources":["../../src/components/auth-guard.component.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,KAAK,aAAa,EAGlB,UAAU,EAIX,MAAM,eAAe,CAAA;;AActB;;;;;;;;;;;;;;;;;GAiBG;AACH,qBAYa,SAAU,YAAW,aAAa;IAC7C;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,uEAAuE;IACvE,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,mEAAmE;IACnE,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,2EAA2E;IAC3E,eAAe,CAAC,EAAE,MAAM,IAAI,CAAA;IAE5B,+BAA+B;IACF,cAAc,CAAC,EAAE,UAAU,CAAC,cAAc,CAAC,CAAA;IACxE,2DAA2D;IAChC,YAAY,CAAC,EAAE,UAAU,CAAC,eAAe,CAAC,CAAA;IACrE,8EAA8E;IACnD,YAAY,CAAC,EAAE,UAAU,CAAC,eAAe,CAAC,CAAA;IAErE,6DAA6D;IAC7D,QAAQ,CAAC,IAAI,+EAAY;IACzB,2EAA2E;IAC3E,QAAQ,CAAC,MAAM,kDAAc;IAE7B;;;;OAIG;IACH,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAmB;IAExC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAyD;IAC9E,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAqB;IAC1C,OAAO,CAAC,WAAW,CAAQ;IAC3B,OAAO,CAAC,iBAAi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