ngwr 16.0.0 → 16.2.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 (295) 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 +95 -3
  6. package/date-stamp/styles/_index.scss +38 -0
  7. package/dialog/styles/_index.scss +38 -0
  8. package/dropdown/styles/_index.scss +37 -1
  9. package/fesm2022/internal-CVLvP9b_.mjs +33 -0
  10. package/fesm2022/internal-CVLvP9b_.mjs.map +1 -0
  11. package/fesm2022/ngwr-alert.mjs +11 -7
  12. package/fesm2022/ngwr-alert.mjs.map +1 -1
  13. package/fesm2022/ngwr-avatar.mjs +11 -7
  14. package/fesm2022/ngwr-avatar.mjs.map +1 -1
  15. package/fesm2022/ngwr-back-top.mjs +10 -6
  16. package/fesm2022/ngwr-back-top.mjs.map +1 -1
  17. package/fesm2022/ngwr-badge.mjs +18 -6
  18. package/fesm2022/ngwr-badge.mjs.map +1 -1
  19. package/fesm2022/ngwr-burger.mjs +9 -6
  20. package/fesm2022/ngwr-burger.mjs.map +1 -1
  21. package/fesm2022/ngwr-button.mjs +8 -4
  22. package/fesm2022/ngwr-button.mjs.map +1 -1
  23. package/fesm2022/ngwr-calendar.mjs +19 -8
  24. package/fesm2022/ngwr-calendar.mjs.map +1 -1
  25. package/fesm2022/ngwr-card.mjs +9 -5
  26. package/fesm2022/ngwr-card.mjs.map +1 -1
  27. package/fesm2022/ngwr-cascader.mjs +11 -5
  28. package/fesm2022/ngwr-cascader.mjs.map +1 -1
  29. package/fesm2022/ngwr-charts-calendar-heatmap.mjs +5 -2
  30. package/fesm2022/ngwr-charts-calendar-heatmap.mjs.map +1 -1
  31. package/fesm2022/ngwr-checkbox.mjs +10 -6
  32. package/fesm2022/ngwr-checkbox.mjs.map +1 -1
  33. package/fesm2022/ngwr-clipboard.mjs +2 -1
  34. package/fesm2022/ngwr-clipboard.mjs.map +1 -1
  35. package/fesm2022/ngwr-collapse.mjs +9 -5
  36. package/fesm2022/ngwr-collapse.mjs.map +1 -1
  37. package/fesm2022/ngwr-color-picker.mjs +4 -2
  38. package/fesm2022/ngwr-color-picker.mjs.map +1 -1
  39. package/fesm2022/ngwr-comment.mjs +13 -7
  40. package/fesm2022/ngwr-comment.mjs.map +1 -1
  41. package/fesm2022/ngwr-compare.mjs +9 -3
  42. package/fesm2022/ngwr-compare.mjs.map +1 -1
  43. package/fesm2022/ngwr-context-menu.mjs +4 -2
  44. package/fesm2022/ngwr-context-menu.mjs.map +1 -1
  45. package/fesm2022/ngwr-copy-value.mjs +11 -6
  46. package/fesm2022/ngwr-copy-value.mjs.map +1 -1
  47. package/fesm2022/ngwr-date-picker-testing.mjs +18 -0
  48. package/fesm2022/ngwr-date-picker-testing.mjs.map +1 -1
  49. package/fesm2022/ngwr-date-picker.mjs +238 -38
  50. package/fesm2022/ngwr-date-picker.mjs.map +1 -1
  51. package/fesm2022/ngwr-date-stamp-testing.mjs +34 -0
  52. package/fesm2022/ngwr-date-stamp-testing.mjs.map +1 -0
  53. package/fesm2022/ngwr-date-stamp.mjs +213 -0
  54. package/fesm2022/ngwr-date-stamp.mjs.map +1 -0
  55. package/fesm2022/ngwr-date.mjs +364 -54
  56. package/fesm2022/ngwr-date.mjs.map +1 -1
  57. package/fesm2022/ngwr-descriptions.mjs +9 -5
  58. package/fesm2022/ngwr-descriptions.mjs.map +1 -1
  59. package/fesm2022/ngwr-dialog-testing.mjs +23 -2
  60. package/fesm2022/ngwr-dialog-testing.mjs.map +1 -1
  61. package/fesm2022/ngwr-dialog.mjs +45 -16
  62. package/fesm2022/ngwr-dialog.mjs.map +1 -1
  63. package/fesm2022/ngwr-directives.mjs +102 -11
  64. package/fesm2022/ngwr-directives.mjs.map +1 -1
  65. package/fesm2022/ngwr-divider.mjs +4 -2
  66. package/fesm2022/ngwr-divider.mjs.map +1 -1
  67. package/fesm2022/ngwr-drawer.mjs +29 -3
  68. package/fesm2022/ngwr-drawer.mjs.map +1 -1
  69. package/fesm2022/ngwr-dropdown-testing.mjs +38 -3
  70. package/fesm2022/ngwr-dropdown-testing.mjs.map +1 -1
  71. package/fesm2022/ngwr-dropdown.mjs +362 -26
  72. package/fesm2022/ngwr-dropdown.mjs.map +1 -1
  73. package/fesm2022/ngwr-editor.mjs +5 -2
  74. package/fesm2022/ngwr-editor.mjs.map +1 -1
  75. package/fesm2022/ngwr-event-calendar.mjs +4 -2
  76. package/fesm2022/ngwr-event-calendar.mjs.map +1 -1
  77. package/fesm2022/ngwr-file-upload.mjs +9 -3
  78. package/fesm2022/ngwr-file-upload.mjs.map +1 -1
  79. package/fesm2022/ngwr-form.mjs +18 -6
  80. package/fesm2022/ngwr-form.mjs.map +1 -1
  81. package/fesm2022/ngwr-i18n-ar.mjs +9 -2
  82. package/fesm2022/ngwr-i18n-ar.mjs.map +1 -1
  83. package/fesm2022/ngwr-i18n-cs.mjs +9 -2
  84. package/fesm2022/ngwr-i18n-cs.mjs.map +1 -1
  85. package/fesm2022/ngwr-i18n-de.mjs +9 -2
  86. package/fesm2022/ngwr-i18n-de.mjs.map +1 -1
  87. package/fesm2022/ngwr-i18n-en.mjs +9 -2
  88. package/fesm2022/ngwr-i18n-en.mjs.map +1 -1
  89. package/fesm2022/ngwr-i18n-es.mjs +9 -2
  90. package/fesm2022/ngwr-i18n-es.mjs.map +1 -1
  91. package/fesm2022/ngwr-i18n-fr.mjs +9 -2
  92. package/fesm2022/ngwr-i18n-fr.mjs.map +1 -1
  93. package/fesm2022/ngwr-i18n-he.mjs +9 -2
  94. package/fesm2022/ngwr-i18n-he.mjs.map +1 -1
  95. package/fesm2022/ngwr-i18n-hi.mjs +9 -2
  96. package/fesm2022/ngwr-i18n-hi.mjs.map +1 -1
  97. package/fesm2022/ngwr-i18n-id.mjs +9 -2
  98. package/fesm2022/ngwr-i18n-id.mjs.map +1 -1
  99. package/fesm2022/ngwr-i18n-it.mjs +9 -2
  100. package/fesm2022/ngwr-i18n-it.mjs.map +1 -1
  101. package/fesm2022/ngwr-i18n-ja.mjs +9 -2
  102. package/fesm2022/ngwr-i18n-ja.mjs.map +1 -1
  103. package/fesm2022/ngwr-i18n-ko.mjs +9 -2
  104. package/fesm2022/ngwr-i18n-ko.mjs.map +1 -1
  105. package/fesm2022/ngwr-i18n-nl.mjs +9 -2
  106. package/fesm2022/ngwr-i18n-nl.mjs.map +1 -1
  107. package/fesm2022/ngwr-i18n-pl.mjs +9 -2
  108. package/fesm2022/ngwr-i18n-pl.mjs.map +1 -1
  109. package/fesm2022/ngwr-i18n-pt.mjs +9 -2
  110. package/fesm2022/ngwr-i18n-pt.mjs.map +1 -1
  111. package/fesm2022/ngwr-i18n-ru.mjs +9 -2
  112. package/fesm2022/ngwr-i18n-ru.mjs.map +1 -1
  113. package/fesm2022/ngwr-i18n-sv.mjs +9 -2
  114. package/fesm2022/ngwr-i18n-sv.mjs.map +1 -1
  115. package/fesm2022/ngwr-i18n-tr.mjs +9 -2
  116. package/fesm2022/ngwr-i18n-tr.mjs.map +1 -1
  117. package/fesm2022/ngwr-i18n-uk.mjs +9 -2
  118. package/fesm2022/ngwr-i18n-uk.mjs.map +1 -1
  119. package/fesm2022/ngwr-i18n-vi.mjs +9 -2
  120. package/fesm2022/ngwr-i18n-vi.mjs.map +1 -1
  121. package/fesm2022/ngwr-i18n-zh-tw.mjs +9 -2
  122. package/fesm2022/ngwr-i18n-zh-tw.mjs.map +1 -1
  123. package/fesm2022/ngwr-i18n-zh.mjs +9 -2
  124. package/fesm2022/ngwr-i18n-zh.mjs.map +1 -1
  125. package/fesm2022/ngwr-i18n.mjs +34 -8
  126. package/fesm2022/ngwr-i18n.mjs.map +1 -1
  127. package/fesm2022/ngwr-input-number.mjs +9 -3
  128. package/fesm2022/ngwr-input-number.mjs.map +1 -1
  129. package/fesm2022/ngwr-input-otp.mjs +4 -2
  130. package/fesm2022/ngwr-input-otp.mjs.map +1 -1
  131. package/fesm2022/ngwr-input.mjs +20 -10
  132. package/fesm2022/ngwr-input.mjs.map +1 -1
  133. package/fesm2022/ngwr-keyboard.mjs +9 -3
  134. package/fesm2022/ngwr-keyboard.mjs.map +1 -1
  135. package/fesm2022/ngwr-knob.mjs +9 -3
  136. package/fesm2022/ngwr-knob.mjs.map +1 -1
  137. package/fesm2022/ngwr-layout.mjs +13 -5
  138. package/fesm2022/ngwr-layout.mjs.map +1 -1
  139. package/fesm2022/ngwr-lightbox-testing.mjs +26 -0
  140. package/fesm2022/ngwr-lightbox-testing.mjs.map +1 -1
  141. package/fesm2022/ngwr-lightbox.mjs +255 -15
  142. package/fesm2022/ngwr-lightbox.mjs.map +1 -1
  143. package/fesm2022/ngwr-list.mjs +13 -5
  144. package/fesm2022/ngwr-list.mjs.map +1 -1
  145. package/fesm2022/ngwr-load-state.mjs +9 -5
  146. package/fesm2022/ngwr-load-state.mjs.map +1 -1
  147. package/fesm2022/ngwr-overlay.mjs +84 -1
  148. package/fesm2022/ngwr-overlay.mjs.map +1 -1
  149. package/fesm2022/ngwr-pagination.mjs +3 -2
  150. package/fesm2022/ngwr-pagination.mjs.map +1 -1
  151. package/fesm2022/ngwr-pipes.mjs +47 -9
  152. package/fesm2022/ngwr-pipes.mjs.map +1 -1
  153. package/fesm2022/ngwr-popover.mjs +93 -4
  154. package/fesm2022/ngwr-popover.mjs.map +1 -1
  155. package/fesm2022/ngwr-progress.mjs +4 -2
  156. package/fesm2022/ngwr-progress.mjs.map +1 -1
  157. package/fesm2022/ngwr-radio.mjs +9 -5
  158. package/fesm2022/ngwr-radio.mjs.map +1 -1
  159. package/fesm2022/ngwr-rating.mjs +9 -3
  160. package/fesm2022/ngwr-rating.mjs.map +1 -1
  161. package/fesm2022/ngwr-resizable.mjs +503 -0
  162. package/fesm2022/ngwr-resizable.mjs.map +1 -0
  163. package/fesm2022/ngwr-result.mjs +9 -5
  164. package/fesm2022/ngwr-result.mjs.map +1 -1
  165. package/fesm2022/ngwr-schema-form.mjs +3 -0
  166. package/fesm2022/ngwr-schema-form.mjs.map +1 -1
  167. package/fesm2022/ngwr-segmented.mjs +4 -2
  168. package/fesm2022/ngwr-segmented.mjs.map +1 -1
  169. package/fesm2022/ngwr-select.mjs +13 -5
  170. package/fesm2022/ngwr-select.mjs.map +1 -1
  171. package/fesm2022/ngwr-skeleton.mjs +4 -2
  172. package/fesm2022/ngwr-skeleton.mjs.map +1 -1
  173. package/fesm2022/ngwr-slider-testing.mjs +17 -0
  174. package/fesm2022/ngwr-slider-testing.mjs.map +1 -1
  175. package/fesm2022/ngwr-slider.mjs +91 -13
  176. package/fesm2022/ngwr-slider.mjs.map +1 -1
  177. package/fesm2022/ngwr-sortable-list-testing.mjs +103 -0
  178. package/fesm2022/ngwr-sortable-list-testing.mjs.map +1 -0
  179. package/fesm2022/ngwr-sortable-list.mjs +257 -53
  180. package/fesm2022/ngwr-sortable-list.mjs.map +1 -1
  181. package/fesm2022/ngwr-speed-dial.mjs +4 -2
  182. package/fesm2022/ngwr-speed-dial.mjs.map +1 -1
  183. package/fesm2022/ngwr-spinner.mjs +4 -2
  184. package/fesm2022/ngwr-spinner.mjs.map +1 -1
  185. package/fesm2022/ngwr-splitter.mjs +17 -21
  186. package/fesm2022/ngwr-splitter.mjs.map +1 -1
  187. package/fesm2022/ngwr-stepper.mjs +9 -3
  188. package/fesm2022/ngwr-stepper.mjs.map +1 -1
  189. package/fesm2022/ngwr-switch.mjs +9 -5
  190. package/fesm2022/ngwr-switch.mjs.map +1 -1
  191. package/fesm2022/ngwr-table-testing.mjs +5 -1
  192. package/fesm2022/ngwr-table-testing.mjs.map +1 -1
  193. package/fesm2022/ngwr-table.mjs +167 -10
  194. package/fesm2022/ngwr-table.mjs.map +1 -1
  195. package/fesm2022/ngwr-textarea.mjs +9 -3
  196. package/fesm2022/ngwr-textarea.mjs.map +1 -1
  197. package/fesm2022/ngwr-timeline.mjs +18 -8
  198. package/fesm2022/ngwr-timeline.mjs.map +1 -1
  199. package/fesm2022/ngwr-toast-testing.mjs +6 -1
  200. package/fesm2022/ngwr-toast-testing.mjs.map +1 -1
  201. package/fesm2022/ngwr-toast.mjs +529 -104
  202. package/fesm2022/ngwr-toast.mjs.map +1 -1
  203. package/fesm2022/ngwr-transfer.mjs +4 -2
  204. package/fesm2022/ngwr-transfer.mjs.map +1 -1
  205. package/fesm2022/ngwr-tree.mjs +4 -2
  206. package/fesm2022/ngwr-tree.mjs.map +1 -1
  207. package/fesm2022/ngwr-typography.mjs +9 -3
  208. package/fesm2022/ngwr-typography.mjs.map +1 -1
  209. package/fesm2022/ngwr-utils-router.mjs +18 -2
  210. package/fesm2022/ngwr-utils-router.mjs.map +1 -1
  211. package/fesm2022/ngwr-utils.mjs +9 -2
  212. package/fesm2022/ngwr-utils.mjs.map +1 -1
  213. package/fesm2022/ngwr-version.mjs +1 -1
  214. package/fesm2022/ngwr-version.mjs.map +1 -1
  215. package/fesm2022/ngwr-window.mjs +7 -4
  216. package/fesm2022/ngwr-window.mjs.map +1 -1
  217. package/fesm2022/ngwr.mjs.map +1 -1
  218. package/i18n/ar.json +13 -2
  219. package/i18n/cs.json +13 -2
  220. package/i18n/de.json +13 -2
  221. package/i18n/en.json +13 -2
  222. package/i18n/es.json +13 -2
  223. package/i18n/fr.json +13 -2
  224. package/i18n/he.json +13 -2
  225. package/i18n/hi.json +13 -2
  226. package/i18n/id.json +13 -2
  227. package/i18n/it.json +13 -2
  228. package/i18n/ja.json +13 -2
  229. package/i18n/ko.json +13 -2
  230. package/i18n/nl.json +13 -2
  231. package/i18n/pl.json +13 -2
  232. package/i18n/pt.json +13 -2
  233. package/i18n/ru.json +13 -2
  234. package/i18n/sv.json +13 -2
  235. package/i18n/tr.json +13 -2
  236. package/i18n/uk.json +13 -2
  237. package/i18n/vi.json +13 -2
  238. package/i18n/zh-TW.json +13 -2
  239. package/i18n/zh.json +13 -2
  240. package/input/styles/_index.scss +10 -5
  241. package/input-number/styles/_index.scss +6 -3
  242. package/input-otp/styles/_index.scss +4 -2
  243. package/lightbox/styles/_rules.scss +96 -0
  244. package/llms-full.txt +40 -17
  245. package/llms.txt +20 -4
  246. package/package.json +19 -1
  247. package/radio/styles/_index.scss +4 -2
  248. package/resizable/styles/_index.scss +154 -0
  249. package/schematics/use/rule.js +1 -0
  250. package/schematics/use/symbol-map.json +5 -0
  251. package/select/styles/_index.scss +6 -3
  252. package/skills/ngwr/SKILL.md +1 -1
  253. package/skills/ngwr/references/catalog.md +6 -2
  254. package/skills/ngwr/references/setup.md +3 -0
  255. package/slider/styles/_index.scss +106 -0
  256. package/sortable-list/styles/_rules.scss +23 -1
  257. package/switch/styles/_index.scss +4 -2
  258. package/table/styles/_index.scss +53 -0
  259. package/textarea/styles/_index.scss +4 -2
  260. package/theme/styles/_motion.scss +6 -0
  261. package/toast/styles/_index.scss +19 -0
  262. package/types/ngwr-burger.d.ts +0 -1
  263. package/types/ngwr-calendar.d.ts +7 -0
  264. package/types/ngwr-charts-calendar-heatmap.d.ts +2 -1
  265. package/types/ngwr-clipboard.d.ts +7 -0
  266. package/types/ngwr-date-picker-testing.d.ts +17 -0
  267. package/types/ngwr-date-picker.d.ts +88 -4
  268. package/types/ngwr-date-stamp-testing.d.ts +47 -0
  269. package/types/ngwr-date-stamp.d.ts +127 -0
  270. package/types/ngwr-date.d.ts +251 -37
  271. package/types/ngwr-dialog-testing.d.ts +10 -0
  272. package/types/ngwr-dialog.d.ts +72 -4
  273. package/types/ngwr-directives.d.ts +36 -1
  274. package/types/ngwr-drawer.d.ts +21 -0
  275. package/types/ngwr-dropdown-testing.d.ts +53 -5
  276. package/types/ngwr-dropdown.d.ts +100 -0
  277. package/types/ngwr-i18n.d.ts +44 -14
  278. package/types/ngwr-lightbox-testing.d.ts +27 -0
  279. package/types/ngwr-lightbox.d.ts +71 -6
  280. package/types/ngwr-overlay.d.ts +36 -0
  281. package/types/ngwr-pipes.d.ts +48 -13
  282. package/types/ngwr-popover.d.ts +39 -1
  283. package/types/ngwr-resizable.d.ts +228 -0
  284. package/types/ngwr-slider-testing.d.ts +8 -1
  285. package/types/ngwr-slider.d.ts +89 -3
  286. package/types/ngwr-sortable-list-testing.d.ts +79 -0
  287. package/types/ngwr-sortable-list.d.ts +113 -10
  288. package/types/ngwr-table-testing.d.ts +3 -1
  289. package/types/ngwr-table.d.ts +120 -4
  290. package/types/ngwr-toast-testing.d.ts +12 -1
  291. package/types/ngwr-toast.d.ts +215 -18
  292. package/types/ngwr-utils-router.d.ts +22 -0
  293. package/types/ngwr-utils.d.ts +8 -1
  294. package/types/ngwr-version.d.ts +1 -1
  295. package/types/ngwr.d.ts +1 -0
@@ -1 +1 @@
1
- {"version":3,"file":"ngwr-lightbox.mjs","names":[],"sources":["../../../projects/lib/lightbox/lightbox.ts","../../../projects/lib/lightbox/lightbox.html"],"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, ConfigurableFocusTrapFactory, FocusMonitor } from '@angular/cdk/a11y';\nimport { Directionality } from '@angular/cdk/bidi';\nimport { coerceBooleanProperty } from '@angular/cdk/coercion';\nimport { type OverlayRef } from '@angular/cdk/overlay';\nimport { TemplatePortal } from '@angular/cdk/portal';\nimport type { TemplateRef } from '@angular/core';\nimport {\n Component,\n DestroyRef,\n EnvironmentInjector,\n Injector,\n ViewContainerRef,\n ViewEncapsulation,\n computed,\n effect,\n inject,\n input,\n signal,\n viewChild,\n} from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\n\nimport { useI18nText } from 'ngwr/i18n';\nimport { WR_OVERLAY, wrFollowDirection } from 'ngwr/overlay';\nimport { wrToClassList, type WrClassInput, wrRestoreFocus } from 'ngwr/utils';\n\nlet viewerUid = 0;\n\n/**\n * Image with click-to-zoom lightbox. The thumbnail is a plain `<img>`\n * with whatever sizing/`object-fit` you give it; clicking opens a CDK\n * overlay showing the full image, with Escape + close button + backdrop\n * to dismiss.\n *\n * @example\n * ```html\n * <wr-lightbox\n * src=\"/photo.jpg\"\n * alt=\"Mountain\"\n * style=\"width: 16rem; height: 10rem; object-fit: cover\"\n * />\n * ```\n *\n * @see https://ngwr.dev/reference/components/lightbox\n */\n@Component({\n selector: 'wr-lightbox',\n templateUrl: './lightbox.html',\n styleUrl: './lightbox.scss',\n encapsulation: ViewEncapsulation.None,\n host: {\n '[class]': 'classes()',\n '[style.aspect-ratio]': 'aspectRatio()',\n },\n})\nexport class WrLightbox {\n /** Accessible name of the thumbnail button. Falls back to `alt`, then `image.open`. */\n readonly openLabel = input<string | null>(null);\n\n /** Accessible name of the viewer's close button. Falls back to `image.close`, then `'Close preview'`. */\n readonly closeLabel = input<string | null>(null);\n\n protected readonly resolvedCloseLabel = useI18nText(this.closeLabel, 'image.close', 'Close preview');\n\n /** Image source. */\n readonly src = input.required<string>();\n\n /** Alt text. Required for a11y; falls back to an empty string. @default '' */\n readonly alt = input<string>('');\n\n /**\n * Lighter source for the THUMBNAIL — a small or blurred copy, so the grid does not\n * pull full-size images. The viewer always shows `src`; the thumbnail does not swap\n * to it later.\n */\n readonly preview = input<string | null>(null);\n\n // Both of these were hard-coded English literals in the template, next to a catalog\n // that already carried `image.open` translated and unread. `useI18nText` already\n // does the whole chain — a non-empty binding wins, then the catalog, then the\n // English default — so the alt text (which describes the actual picture) is what\n // gets forwarded, with `openLabel` ahead of it as the explicit override.\n protected readonly resolvedOpenLabel = useI18nText(\n computed(() => {\n // Not `??`: an empty `openLabel` is no label at all, so it has to fall through\n // to the alt text rather than winning as an empty string.\n const explicit = this.openLabel();\n if (explicit) return explicit;\n return this.alt();\n }),\n 'image.open',\n 'Open preview'\n );\n\n protected readonly resolvedViewerLabel = useI18nText(this.alt, 'image.viewer', 'Image preview');\n\n /** Disable the click-to-zoom lightbox. @default false */\n readonly disablePreview = input(false, { transform: coerceBooleanProperty });\n\n /** Caption shown under the full image in the lightbox. */\n readonly caption = input<string>('');\n\n /**\n * Reserve space before the image resolves by fixing the thumbnail's\n * `aspect-ratio` (e.g. `'16 / 9'`, `'4 / 3'`, or a number like `1.5`).\n * Prevents the layout jump when the intrinsic image size isn't known up\n * front — pair it with a `width` and the box keeps its height from first\n * paint. @default null\n */\n readonly aspectRatio = input<string | number | null>(null);\n\n /**\n * Extra CSS classes for the viewer's overlay pane.\n *\n * The pane is appended to the overlay container, not to this component, so\n * nothing in the consumer's own template encloses it and no descendant rule\n * written around the trigger can reach it. This input is the only per-instance\n * handle on it. A space-separated string works as well as an array.\n */\n readonly panelClass = input<WrClassInput>(null);\n\n protected readonly open = signal(false);\n protected readonly loaded = signal(false);\n\n /**\n * Id the trigger's `aria-controls` points at while the viewer is open.\n *\n * @internal Public so the host bindings can read it.\n */\n protected readonly viewerId = `wr-lightbox-viewer-${++viewerUid}`;\n\n protected readonly classes = computed(() => {\n const parts = ['wr-lightbox'];\n if (this.open()) parts.push('wr-lightbox--open');\n if (!this.loaded()) parts.push('wr-lightbox--loading');\n return parts.join(' ');\n });\n\n // Query by name — `@if` blocks register their own TemplateRefs, so an\n // unqualified TemplateRef query would grab the thumbnail branch instead.\n protected readonly panelTpl = viewChild.required<TemplateRef<unknown>>('viewerTpl');\n\n private readonly focusMonitor = inject(FocusMonitor);\n private readonly overlay = inject(WR_OVERLAY);\n private readonly vcr = inject(ViewContainerRef);\n private readonly destroyRef = inject(DestroyRef);\n private readonly injector = inject(Injector);\n private readonly focusTrapFactory = inject(ConfigurableFocusTrapFactory);\n /**\n * The reading direction the open viewer has to keep up with, resolved off the\n * ENVIRONMENT injector rather than this component's — the same instance the\n * CDK read when it stamped the overlay, since `createOverlayRef` takes\n * `Directionality` from the `Overlay`'s injector and no node-level `[dir]` is\n * in that chain. The viewer is appended to the overlay container on `<body>`,\n * not into whatever region the thumbnail sits in, so reading the node\n * injector would rewrite a correctly-stamped panel to an island's direction\n * one pass after it opened rather than follow the application at all.\n *\n * `null` never happens in an app — `Directionality` is root-provided — but a\n * bare `TestBed` should still get a viewer that opens.\n */\n private readonly dir = inject(EnvironmentInjector).get(Directionality, null);\n private focusTrap: ConfigurableFocusTrap | null = null;\n private previouslyFocused: HTMLElement | null = null;\n private overlayRef: OverlayRef | null = null;\n\n constructor() {\n // Destroying the component while the viewer is open removes the projected\n // content (the portal uses this component's ViewContainerRef) but leaves the\n // overlay pane and its full-screen backdrop behind, with page scroll still\n // blocked. Dispose the overlay explicitly.\n this.destroyRef.onDestroy(() => this.closeOverlay());\n\n effect(() => {\n if (this.open()) this.openOverlay();\n else this.closeOverlay();\n });\n }\n\n protected onClick(): void {\n if (this.disablePreview()) return;\n this.open.set(true);\n }\n\n protected onClose(): void {\n this.open.set(false);\n }\n\n // Swipe-down-to-dismiss on the open viewer. The image follows the finger and\n // fades; releasing past ~20% of the viewer height closes it.\n private viewerStartY = 0;\n private viewerSwiping = false;\n\n protected onViewerSwipeStart(event: TouchEvent): void {\n const touch = event.touches[0];\n if (!touch) return;\n this.viewerStartY = touch.clientY;\n this.viewerSwiping = true;\n }\n\n protected onViewerSwipeMove(event: TouchEvent, viewer: HTMLElement): void {\n if (!this.viewerSwiping) return;\n const touch = event.touches[0];\n if (!touch) return;\n const dy = touch.clientY - this.viewerStartY;\n if (dy <= 0) {\n viewer.style.transform = '';\n viewer.style.opacity = '';\n return;\n }\n event.preventDefault();\n viewer.style.transition = 'none';\n viewer.style.transform = `translateY(${dy}px)`;\n viewer.style.opacity = String(Math.max(0.3, 1 - dy / (viewer.offsetHeight || 1)));\n }\n\n protected onViewerSwipeEnd(event: TouchEvent, viewer: HTMLElement): void {\n if (!this.viewerSwiping) return;\n this.viewerSwiping = false;\n const touch = event.changedTouches[0];\n const dy = touch ? touch.clientY - this.viewerStartY : 0;\n if (dy > (viewer.offsetHeight || 0) * 0.2) {\n this.onClose();\n } else {\n viewer.style.transition = '';\n viewer.style.transform = '';\n viewer.style.opacity = '';\n }\n }\n\n /**\n * The thumbnail has settled, one way or the other. A failure counts: `--loading`\n * animates a shimmer AND sets `opacity: 0` on the image, so a broken `src` with no\n * error path left an invisible box shimmering for ever instead of showing its alt\n * text.\n */\n protected onSettled(): void {\n this.loaded.set(true);\n }\n\n // Overlay\n\n private openOverlay(): void {\n if (this.overlayRef) return;\n\n this.overlayRef = this.overlay.create({\n hasBackdrop: true,\n backdropClass: 'wr-lightbox-backdrop',\n positionStrategy: this.overlay.position().global().centerHorizontally().centerVertically(),\n scrollStrategy: this.overlay.scrollStrategies.block(),\n panelClass: wrToClassList('wr-lightbox-overlay', this.panelClass()),\n });\n\n // Centred on both axes, so no geometry rides on the direction — but the\n // viewer's own chrome does. The ✕ is placed with `inset-inline-end` and the\n // caption reads as prose, both against the `dir` the CDK froze at create, so\n // a flip while the viewer is open leaves the button on the wrong corner.\n wrFollowDirection(this.overlayRef, this.dir, this.injector);\n\n const portal = new TemplatePortal(this.panelTpl(), this.vcr);\n this.overlayRef.attach(portal);\n\n // The viewer declares role=\"dialog\" + aria-modal=\"true\", which promises the\n // rest of the page is inert. Without a focus trap that promise is a lie:\n // Tab walks straight out of the viewer into the page behind the backdrop.\n const active = document.activeElement;\n this.previouslyFocused = active instanceof HTMLElement ? active : null;\n this.focusTrap = this.focusTrapFactory.create(this.overlayRef.overlayElement);\n void this.focusTrap.focusInitialElementWhenReady();\n\n this.overlayRef\n .backdropClick()\n .pipe(takeUntilDestroyed(this.destroyRef))\n .subscribe(() => this.open.set(false));\n\n this.overlayRef\n .keydownEvents()\n .pipe(takeUntilDestroyed(this.destroyRef))\n .subscribe(event => {\n if (event.key === 'Escape') {\n event.preventDefault();\n this.open.set(false);\n }\n });\n }\n\n private closeOverlay(): void {\n if (!this.overlayRef) return;\n this.focusTrap?.destroy();\n this.focusTrap = null;\n const restore = this.previouslyFocused;\n this.previouslyFocused = null;\n this.overlayRef.dispose();\n this.overlayRef = null;\n // Send focus back where it came from, or it lands on <body> and the user\n // has to tab from the top of the page again.\n if (restore && typeof restore.focus === 'function') wrRestoreFocus(restore, this.focusMonitor);\n }\n}\n","@if (disablePreview()) {\n <img\n class=\"wr-lightbox__thumb\"\n [src]=\"preview() || src()\"\n [alt]=\"alt()\"\n (load)=\"onSettled()\"\n (error)=\"onSettled()\"\n loading=\"lazy\"\n decoding=\"async\"\n />\n} @else {\n <!-- The trigger opens a modal dialog, and used to say so nowhere: no hint that it\n opens anything, and nothing on the page tying it to the viewer it opened. -->\n <button\n type=\"button\"\n class=\"wr-lightbox__trigger\"\n aria-haspopup=\"dialog\"\n [attr.aria-controls]=\"open() ? viewerId : null\"\n [attr.aria-label]=\"resolvedOpenLabel()\"\n (click)=\"onClick()\"\n >\n <img\n class=\"wr-lightbox__thumb\"\n [src]=\"preview() || src()\"\n [alt]=\"alt()\"\n (load)=\"onSettled()\"\n (error)=\"onSettled()\"\n loading=\"lazy\"\n decoding=\"async\"\n />\n </button>\n}\n\n<ng-template #viewerTpl>\n <div\n #viewer\n class=\"wr-lightbox-viewer\"\n [id]=\"viewerId\"\n role=\"dialog\"\n aria-modal=\"true\"\n [attr.aria-label]=\"resolvedViewerLabel()\"\n (touchstart)=\"onViewerSwipeStart($event)\"\n (touchmove)=\"onViewerSwipeMove($event, viewer)\"\n (touchend)=\"onViewerSwipeEnd($event, viewer)\"\n (touchcancel)=\"onViewerSwipeEnd($event, viewer)\"\n >\n <button\n type=\"button\"\n class=\"wr-lightbox-viewer__close\"\n [attr.aria-label]=\"resolvedCloseLabel()\"\n (click)=\"onClose()\"\n (keydown.enter)=\"onClose()\"\n (keydown.space)=\"onClose()\"\n >\n <svg\n class=\"wr-icon__svg\"\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n aria-hidden=\"true\"\n >\n <path d=\"M18 6 6 18\" />\n <path d=\"m6 6 12 12\" />\n </svg>\n </button>\n <!--\n Styled `cursor: zoom-out`, which is a promise: clicking the image closes. A\n REDUNDANT mouse affordance — the close button, Escape, the backdrop and\n swipe-down all do the same thing and all reach a keyboard — so the image stays\n out of the tab order rather than becoming a second close stop.\n -->\n <!-- eslint-disable-next-line @angular-eslint/template/click-events-have-key-events,@angular-eslint/template/interactive-supports-focus -->\n <img class=\"wr-lightbox-viewer__full\" [src]=\"src()\" [alt]=\"alt()\" (click)=\"onClose()\" />\n @if (caption()) {\n <div class=\"wr-lightbox-viewer__caption\">{{ caption() }}</div>\n }\n </div>\n</ng-template>\n"],"mappings":";;;;;;;;;;;;;;;;AAiCA,IAAI,YAAY;AA6BhB,IAAa,aAAb,MAAa,WAAU;CAEZ,YAAY,MAAqB,MAAK,GAAA,YAAA,CAAA,EAAA,WAAA,YAAA,CAAA,+BAAA,CAAA,CAAA;CAGtC,aAAa,MAAqB,MAAK,GAAA,YAAA,CAAA,EAAA,WAAA,aAAA,CAAA,+BAAA,CAAA,CAAA;CAE7B,qBAAqB,YAAY,KAAK,YAAY,eAAe,eAAe;CAG1F,MAAM,MAAM,SAAkB,GAAA,YAAA,CAAA,EAAA,WAAA,MAAA,CAAA,+BAAA,CAAA,CAAA;CAG9B,MAAM,MAAc,IAAG,GAAA,YAAA,CAAA,EAAA,WAAA,MAAA,CAAA,+BAAA,CAAA,CAAA;CAOvB,UAAU,MAAqB,MAAK,GAAA,YAAA,CAAA,EAAA,WAAA,UAAA,CAAA,+BAAA,CAAA,CAAA;CAO1B,oBAAoB,YACrC,eAAc;EAGZ,MAAM,WAAW,KAAK,UAAS;EAC/B,IAAI,UAAU,OAAO;EACrB,OAAO,KAAK,IAAG;CACjB,CAAC,GACD,cACA,cAAc;CAGG,sBAAsB,YAAY,KAAK,KAAK,gBAAgB,eAAe;CAGrF,iBAAiB,MAAM,OAAK;EAAA,GAAA,YAAA,EAAA,WAAA,iBAAA,+BAAA,CAAA;EAAI,WAAW;CAAqB,CAAA;CAGhE,UAAU,MAAc,IAAG,GAAA,YAAA,CAAA,EAAA,WA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,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,YAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,KAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,KAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,SAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,gBAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,SAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,aAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,YAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,UAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,aAAW,EAAA,UAAA,KAAA,CAAA;EAAA,CAAA;CAAA;AAAA,CAAA"}
1
+ {"version":3,"file":"ngwr-lightbox.mjs","names":[],"sources":["../../../projects/lib/lightbox/lightbox-groups.ts","../../../projects/lib/lightbox/lightbox.ts","../../../projects/lib/lightbox/lightbox.html"],"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 { Service, signal, type WritableSignal } from '@angular/core';\n\nimport type { WrLightbox } from './lightbox';\n\ninterface Entry {\n readonly member: WrLightbox;\n readonly host: HTMLElement;\n}\n\n/**\n * Every grouped `wr-lightbox`, keyed by its `group`.\n *\n * @internal\n */\n@Service()\nexport class WrLightboxGroups {\n private readonly groups = new Map<string, WritableSignal<readonly Entry[]>>();\n\n add(group: string, member: WrLightbox, host: HTMLElement): void {\n this.entries(group).update(list => [...list, { member, host }]);\n }\n\n remove(group: string, member: WrLightbox): void {\n const entries = this.entries(group);\n entries.update(list => list.filter(entry => entry.member !== member));\n if (!entries().length) this.groups.delete(group);\n }\n\n /**\n * Re-reads the order. Registration follows creation, and a member that only\n * MOVED in the document registers nothing, so the gallery asks again each\n * time it opens.\n */\n refresh(group: string): void {\n this.groups.get(group)?.update(list => [...list]);\n }\n\n /** The group's members in document order. */\n members(group: string): readonly WrLightbox[] {\n return [...this.entries(group)()]\n .sort((a, b) =>\n // eslint-disable-next-line no-bitwise -- compareDocumentPosition answers with a bitmask\n (a.host.compareDocumentPosition(b.host) & Node.DOCUMENT_POSITION_FOLLOWING) !== 0 ? -1 : 1\n )\n .map(entry => entry.member);\n }\n\n private entries(group: string): WritableSignal<readonly Entry[]> {\n let entries = this.groups.get(group);\n if (!entries) {\n entries = signal<readonly Entry[]>([]);\n this.groups.set(group, entries);\n }\n return entries;\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 ConfigurableFocusTrap, ConfigurableFocusTrapFactory, FocusMonitor } from '@angular/cdk/a11y';\nimport { Directionality } from '@angular/cdk/bidi';\nimport { coerceBooleanProperty } from '@angular/cdk/coercion';\nimport { type OverlayRef } from '@angular/cdk/overlay';\nimport { TemplatePortal } from '@angular/cdk/portal';\nimport { isPlatformBrowser } from '@angular/common';\nimport type { Signal, TemplateRef } from '@angular/core';\nimport {\n Component,\n DestroyRef,\n ElementRef,\n EnvironmentInjector,\n Injector,\n PLATFORM_ID,\n ViewContainerRef,\n ViewEncapsulation,\n computed,\n effect,\n inject,\n input,\n signal,\n untracked,\n viewChild,\n} from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\n\nimport { useI18nFormatter, useI18nText } from 'ngwr/i18n';\nimport { WR_OVERLAY, wrFollowDirection } from 'ngwr/overlay';\nimport { wrToClassList, type WrClassInput, wrRestoreFocus } from 'ngwr/utils';\n\nimport { WrLightboxGroups } from './lightbox-groups';\n\n/** How far a horizontal swipe travels before it turns the page. */\nconst SWIPE_STEP_PX = 48;\n\nlet viewerUid = 0;\n\n/**\n * Image with click-to-zoom lightbox. The thumbnail is a plain `<img>`\n * with whatever sizing/`object-fit` you give it; clicking opens a CDK\n * overlay showing the full image, with Escape + close button + backdrop\n * to dismiss.\n *\n * Lightboxes that share a `group` form a gallery in document order: the viewer\n * gains previous and next buttons, a counter and the arrow keys.\n *\n * @example\n * ```html\n * <wr-lightbox\n * src=\"/photo.jpg\"\n * alt=\"Mountain\"\n * style=\"width: 16rem; height: 10rem; object-fit: cover\"\n * />\n * ```\n *\n * @see https://ngwr.dev/reference/components/lightbox\n */\n@Component({\n selector: 'wr-lightbox',\n templateUrl: './lightbox.html',\n styleUrl: './lightbox.scss',\n encapsulation: ViewEncapsulation.None,\n host: {\n class: 'wr-lightbox',\n '[class]': 'classes()',\n '[style.aspect-ratio]': 'aspectRatio()',\n },\n})\nexport class WrLightbox {\n /** Accessible name of the thumbnail button. Falls back to `alt`, then `image.open`. */\n readonly openLabel = input<string | null>(null);\n\n /** Accessible name of the viewer's close button. Falls back to `image.close`, then `'Close preview'`. */\n readonly closeLabel = input<string | null>(null);\n\n protected readonly resolvedCloseLabel = useI18nText(this.closeLabel, 'image.close', 'Close preview');\n\n /** Image source. */\n readonly src = input.required<string>();\n\n /** Alt text. Required for a11y; falls back to an empty string. @default '' */\n readonly alt = input<string>('');\n\n /**\n * Lighter source for the THUMBNAIL — a small or blurred copy, so the grid does not\n * pull full-size images. The viewer always shows `src`; the thumbnail does not swap\n * to it later.\n */\n readonly preview = input<string | null>(null);\n\n // Both of these were hard-coded English literals in the template, next to a catalog\n // that already carried `image.open` translated and unread. `useI18nText` already\n // does the whole chain — a non-empty binding wins, then the catalog, then the\n // English default — so the alt text (which describes the actual picture) is what\n // gets forwarded, with `openLabel` ahead of it as the explicit override.\n protected readonly resolvedOpenLabel = useI18nText(\n computed(() => {\n // Not `??`: an empty `openLabel` is no label at all, so it has to fall through\n // to the alt text rather than winning as an empty string.\n const explicit = this.openLabel();\n if (explicit) return explicit;\n return this.alt();\n }),\n 'image.open',\n 'Open preview'\n );\n\n protected readonly resolvedViewerLabel = useI18nText(\n computed(() => this.shown().alt()),\n 'image.viewer',\n 'Image preview'\n );\n\n /** Disable the click-to-zoom lightbox. @default false */\n readonly disablePreview = input(false, { transform: coerceBooleanProperty });\n\n /** Caption shown under the full image in the lightbox. */\n readonly caption = input<string>('');\n\n /**\n * Reserve space before the image resolves by fixing the thumbnail's\n * `aspect-ratio` (e.g. `'16 / 9'`, `'4 / 3'`, or a number like `1.5`).\n * Prevents the layout jump when the intrinsic image size isn't known up\n * front — pair it with a `width` and the box keeps its height from first\n * paint. @default null\n */\n readonly aspectRatio = input<string | number | null>(null);\n\n /**\n * Extra CSS classes for the viewer's overlay pane.\n *\n * The pane is appended to the overlay container, not to this component, so\n * nothing in the consumer's own template encloses it and no descendant rule\n * written around the trigger can reach it. This input is the only per-instance\n * handle on it. A space-separated string works as well as an array.\n */\n readonly panelClass = input<WrClassInput>(null);\n\n /**\n * Gallery name. Every `wr-lightbox` with the same group, in document order,\n * can be paged through from whichever one was opened. A lightbox with\n * `disablePreview` stays out of it. @default null\n */\n readonly group = input<string | null>(null);\n\n /** Wrap from the last image of the group to the first, and back. @default false */\n readonly loop = input(false, { transform: coerceBooleanProperty });\n\n /** Accessible name of the viewer's previous button. Falls back to `common.previous`. */\n readonly previousLabel = input<string | null>(null);\n\n /** Accessible name of the viewer's next button. Falls back to `common.next`. */\n readonly nextLabel = input<string | null>(null);\n\n protected readonly resolvedPreviousLabel = useI18nText(this.previousLabel, 'common.previous', 'Previous');\n protected readonly resolvedNextLabel = useI18nText(this.nextLabel, 'common.next', 'Next');\n private readonly counterText = useI18nFormatter('image.counter', '{{current}} / {{total}}');\n private readonly positionText = useI18nFormatter('image.position', 'Image {{current}} of {{total}}');\n\n protected readonly open = signal(false);\n protected readonly loaded = signal(false);\n\n /**\n * Id the trigger's `aria-controls` points at while the viewer is open.\n *\n * @internal Public so the host bindings can read it.\n */\n protected readonly viewerId = `wr-lightbox-viewer-${++viewerUid}`;\n\n protected readonly classes = computed(() => {\n const parts: string[] = [];\n if (this.open()) parts.push('wr-lightbox--open');\n if (!this.loaded()) parts.push('wr-lightbox--loading');\n return parts.join(' ');\n });\n\n // Query by name — `@if` blocks register their own TemplateRefs, so an\n // unqualified TemplateRef query would grab the thumbnail branch instead.\n protected readonly panelTpl = viewChild.required<TemplateRef<unknown>>('viewerTpl');\n\n private readonly groups = inject(WrLightboxGroups);\n private readonly host = inject<ElementRef<HTMLElement>>(ElementRef).nativeElement;\n private readonly isBrowser = isPlatformBrowser(inject(PLATFORM_ID));\n private readonly focusMonitor = inject(FocusMonitor);\n private readonly overlay = inject(WR_OVERLAY);\n private readonly vcr = inject(ViewContainerRef);\n private readonly destroyRef = inject(DestroyRef);\n private readonly injector = inject(Injector);\n private readonly focusTrapFactory = inject(ConfigurableFocusTrapFactory);\n /**\n * The reading direction the open viewer has to keep up with, resolved off the\n * ENVIRONMENT injector rather than this component's — the same instance the\n * CDK read when it stamped the overlay, since `createOverlayRef` takes\n * `Directionality` from the `Overlay`'s injector and no node-level `[dir]` is\n * in that chain. The viewer is appended to the overlay container on `<body>`,\n * not into whatever region the thumbnail sits in, so reading the node\n * injector would rewrite a correctly-stamped panel to an island's direction\n * one pass after it opened rather than follow the application at all.\n *\n * `null` never happens in an app — `Directionality` is root-provided — but a\n * bare `TestBed` should still get a viewer that opens.\n */\n private readonly dir = inject(EnvironmentInjector).get(Directionality, null);\n private focusTrap: ConfigurableFocusTrap | null = null;\n private previouslyFocused: HTMLElement | null = null;\n private overlayRef: OverlayRef | null = null;\n\n /** The gallery this lightbox pages through; empty when it stands alone. */\n protected readonly gallery: Signal<readonly WrLightbox[]> = computed(() => {\n const group = this.group();\n if (!group) return [];\n const members = this.groups.members(group).filter(member => !member.disablePreview());\n return members.length > 1 && members.includes(this) ? members : [];\n });\n\n private readonly target = signal<WrLightbox | null>(null);\n private lastIndex = 0;\n\n /** The lightbox whose image the viewer is showing. */\n protected readonly shown: Signal<WrLightbox> = computed(() => {\n const target = this.target();\n return target && this.gallery().includes(target) ? target : this;\n });\n\n protected readonly index = computed(() => this.gallery().indexOf(this.shown()));\n protected readonly canPrevious = computed(() => this.loop() || this.index() > 0);\n protected readonly canNext = computed(() => this.loop() || this.index() < this.gallery().length - 1);\n\n protected readonly counter = computed(() => this.counterText(this.place()));\n\n protected readonly announcement = computed(() => {\n const alt = this.shown().alt();\n const position = this.positionText(this.place());\n return alt ? `${position}, ${alt}` : position;\n });\n\n private readonly preloaded = new Set<string>();\n\n constructor() {\n // Destroying the component while the viewer is open removes the projected\n // content (the portal uses this component's ViewContainerRef) but leaves the\n // overlay pane and its full-screen backdrop behind, with page scroll still\n // blocked. Dispose the overlay explicitly.\n this.destroyRef.onDestroy(() => this.closeOverlay());\n\n effect(() => {\n if (this.open()) this.openOverlay();\n else this.closeOverlay();\n });\n\n effect(onCleanup => {\n const group = this.group();\n if (!group) return;\n this.groups.add(group, this, this.host);\n onCleanup(() => this.groups.remove(group, this));\n });\n\n // The image on screen left the group: stay at its place in the order\n // instead of jumping back to the one that was opened.\n effect(() => {\n const target = this.target();\n if (!target) return;\n const gallery = this.gallery();\n const index = gallery.indexOf(target);\n if (index >= 0) {\n this.lastIndex = index;\n return;\n }\n untracked(() => this.target.set(gallery[Math.min(this.lastIndex, gallery.length - 1)] ?? null));\n });\n\n effect(() => {\n if (!this.isBrowser || !this.open()) return;\n const gallery = this.gallery();\n // The viewer's own <img> fetches this one.\n this.preloaded.add(this.shown().src());\n for (const delta of [-1, 1]) {\n const neighbour = gallery[this.wrap(this.index() + delta)];\n if (neighbour) this.preload(neighbour.src());\n }\n });\n }\n\n protected onClick(): void {\n if (this.disablePreview()) return;\n const group = this.group();\n if (group) this.groups.refresh(group);\n this.target.set(this);\n this.open.set(true);\n }\n\n /** Move through the gallery by one image; a no-op at an end unless `loop` is set. */\n protected step(delta: -1 | 1): void {\n this.show(this.wrap(this.index() + delta));\n }\n\n private show(index: number): void {\n const member = this.gallery()[index];\n if (member) this.target.set(member);\n }\n\n private wrap(index: number): number {\n const total = this.gallery().length;\n return this.loop() && total ? (index + total) % total : index;\n }\n\n private place(): { current: number; total: number } {\n return { current: this.index() + 1, total: this.gallery().length };\n }\n\n private preload(src: string): void {\n if (this.preloaded.has(src)) return;\n this.preloaded.add(src);\n new Image().src = src;\n }\n\n protected onClose(): void {\n this.open.set(false);\n }\n\n // Swipe-down-to-dismiss on the open viewer. The image follows the finger and\n // fades; releasing past ~20% of the viewer height closes it.\n private viewerStartX = 0;\n private viewerStartY = 0;\n private viewerSwiping = false;\n\n protected onViewerSwipeStart(event: TouchEvent): void {\n const touch = event.touches[0];\n if (!touch) return;\n this.viewerStartX = touch.clientX;\n this.viewerStartY = touch.clientY;\n this.viewerSwiping = true;\n }\n\n protected onViewerSwipeMove(event: TouchEvent, viewer: HTMLElement): void {\n if (!this.viewerSwiping) return;\n const touch = event.touches[0];\n if (!touch) return;\n const dy = touch.clientY - this.viewerStartY;\n if (dy <= 0 || this.isSideways(touch.clientX - this.viewerStartX, dy)) {\n viewer.style.transform = '';\n viewer.style.opacity = '';\n return;\n }\n event.preventDefault();\n viewer.style.transition = 'none';\n viewer.style.transform = `translateY(${dy}px)`;\n viewer.style.opacity = String(Math.max(0.3, 1 - dy / (viewer.offsetHeight || 1)));\n }\n\n protected onViewerSwipeEnd(event: TouchEvent, viewer: HTMLElement): void {\n if (!this.viewerSwiping) return;\n this.viewerSwiping = false;\n const touch = event.changedTouches[0];\n const dx = touch ? touch.clientX - this.viewerStartX : 0;\n const dy = touch ? touch.clientY - this.viewerStartY : 0;\n if (this.isSideways(dx, dy)) {\n if (Math.abs(dx) >= SWIPE_STEP_PX) this.step(dx < 0 !== this.isRtl() ? 1 : -1);\n } else if (dy > (viewer.offsetHeight || 0) * 0.2) {\n this.onClose();\n } else {\n viewer.style.transition = '';\n viewer.style.transform = '';\n viewer.style.opacity = '';\n }\n }\n\n /** A drag that belongs to the gallery rather than to swipe-down-to-dismiss. */\n private isSideways(dx: number, dy: number): boolean {\n return this.gallery().length > 0 && Math.abs(dx) > Math.abs(dy);\n }\n\n private isRtl(): boolean {\n return this.dir?.value === 'rtl';\n }\n\n /**\n * The thumbnail has settled, one way or the other. A failure counts: `--loading`\n * animates a shimmer AND sets `opacity: 0` on the image, so a broken `src` with no\n * error path left an invisible box shimmering for ever instead of showing its alt\n * text.\n */\n protected onSettled(): void {\n this.loaded.set(true);\n }\n\n // Overlay\n\n private openOverlay(): void {\n if (this.overlayRef) return;\n\n this.overlayRef = this.overlay.create({\n hasBackdrop: true,\n backdropClass: 'wr-lightbox-backdrop',\n positionStrategy: this.overlay.position().global().centerHorizontally().centerVertically(),\n scrollStrategy: this.overlay.scrollStrategies.block(),\n panelClass: wrToClassList('wr-lightbox-overlay', this.panelClass()),\n });\n\n // Centred on both axes, so no geometry rides on the direction — but the\n // viewer's own chrome does. The ✕ is placed with `inset-inline-end` and the\n // caption reads as prose, both against the `dir` the CDK froze at create, so\n // a flip while the viewer is open leaves the button on the wrong corner.\n wrFollowDirection(this.overlayRef, this.dir, this.injector);\n\n const portal = new TemplatePortal(this.panelTpl(), this.vcr);\n this.overlayRef.attach(portal);\n\n // The viewer declares role=\"dialog\" + aria-modal=\"true\", which promises the\n // rest of the page is inert. Without a focus trap that promise is a lie:\n // Tab walks straight out of the viewer into the page behind the backdrop.\n const active = document.activeElement;\n this.previouslyFocused = active instanceof HTMLElement ? active : null;\n this.focusTrap = this.focusTrapFactory.create(this.overlayRef.overlayElement);\n void this.focusTrap.focusInitialElementWhenReady();\n\n this.overlayRef\n .backdropClick()\n .pipe(takeUntilDestroyed(this.destroyRef))\n .subscribe(() => this.open.set(false));\n\n this.overlayRef\n .keydownEvents()\n .pipe(takeUntilDestroyed(this.destroyRef))\n .subscribe(event => {\n if (event.key === 'Escape') {\n event.preventDefault();\n this.open.set(false);\n } else {\n this.onGalleryKey(event);\n }\n });\n }\n\n private onGalleryKey(event: KeyboardEvent): void {\n const total = this.gallery().length;\n if (!total || event.altKey || event.ctrlKey || event.metaKey || event.shiftKey) return;\n\n switch (event.key) {\n case 'ArrowLeft':\n this.step(this.isRtl() ? 1 : -1);\n break;\n case 'ArrowRight':\n this.step(this.isRtl() ? -1 : 1);\n break;\n case 'Home':\n this.show(0);\n break;\n case 'End':\n this.show(total - 1);\n break;\n default:\n return;\n }\n event.preventDefault();\n }\n\n private closeOverlay(): void {\n if (!this.overlayRef) return;\n this.focusTrap?.destroy();\n this.focusTrap = null;\n const restore = this.previouslyFocused;\n this.previouslyFocused = null;\n this.overlayRef.dispose();\n this.overlayRef = null;\n // Send focus back where it came from, or it lands on <body> and the user\n // has to tab from the top of the page again.\n if (restore && typeof restore.focus === 'function') wrRestoreFocus(restore, this.focusMonitor);\n }\n}\n","@if (disablePreview()) {\n <img\n class=\"wr-lightbox__thumb\"\n [src]=\"preview() || src()\"\n [alt]=\"alt()\"\n (load)=\"onSettled()\"\n (error)=\"onSettled()\"\n loading=\"lazy\"\n decoding=\"async\"\n />\n} @else {\n <!-- The trigger opens a modal dialog, and used to say so nowhere: no hint that it\n opens anything, and nothing on the page tying it to the viewer it opened. -->\n <button\n type=\"button\"\n class=\"wr-lightbox__trigger\"\n aria-haspopup=\"dialog\"\n [attr.aria-controls]=\"open() ? viewerId : null\"\n [attr.aria-label]=\"resolvedOpenLabel()\"\n (click)=\"onClick()\"\n >\n <img\n class=\"wr-lightbox__thumb\"\n [src]=\"preview() || src()\"\n [alt]=\"alt()\"\n (load)=\"onSettled()\"\n (error)=\"onSettled()\"\n loading=\"lazy\"\n decoding=\"async\"\n />\n </button>\n}\n\n<ng-template #viewerTpl>\n <div\n #viewer\n class=\"wr-lightbox-viewer\"\n [id]=\"viewerId\"\n role=\"dialog\"\n aria-modal=\"true\"\n [attr.aria-label]=\"resolvedViewerLabel()\"\n (touchstart)=\"onViewerSwipeStart($event)\"\n (touchmove)=\"onViewerSwipeMove($event, viewer)\"\n (touchend)=\"onViewerSwipeEnd($event, viewer)\"\n (touchcancel)=\"onViewerSwipeEnd($event, viewer)\"\n >\n <button\n type=\"button\"\n class=\"wr-lightbox-viewer__close\"\n [attr.aria-label]=\"resolvedCloseLabel()\"\n (click)=\"onClose()\"\n (keydown.enter)=\"onClose()\"\n (keydown.space)=\"onClose()\"\n >\n <svg\n class=\"wr-icon__svg\"\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n aria-hidden=\"true\"\n >\n <path d=\"M18 6 6 18\" />\n <path d=\"m6 6 12 12\" />\n </svg>\n </button>\n @if (gallery().length) {\n <span class=\"wr-lightbox-viewer__counter\" aria-hidden=\"true\">{{ counter() }}</span>\n <!-- `aria-disabled`, not `disabled`: a disabled button drops focus to <body>,\n out of the trap, the moment the last image is reached. -->\n <button\n type=\"button\"\n class=\"wr-lightbox-viewer__nav wr-lightbox-viewer__nav--previous\"\n [class.wr-lightbox-viewer__nav--disabled]=\"!canPrevious()\"\n [attr.aria-label]=\"resolvedPreviousLabel()\"\n [attr.aria-disabled]=\"canPrevious() ? null : 'true'\"\n (click)=\"step(-1)\"\n >\n <svg\n class=\"wr-icon__svg\"\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n aria-hidden=\"true\"\n >\n <path d=\"m15 18-6-6 6-6\" />\n </svg>\n </button>\n <button\n type=\"button\"\n class=\"wr-lightbox-viewer__nav wr-lightbox-viewer__nav--next\"\n [class.wr-lightbox-viewer__nav--disabled]=\"!canNext()\"\n [attr.aria-label]=\"resolvedNextLabel()\"\n [attr.aria-disabled]=\"canNext() ? null : 'true'\"\n (click)=\"step(1)\"\n >\n <svg\n class=\"wr-icon__svg\"\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n aria-hidden=\"true\"\n >\n <path d=\"m9 18 6-6-6-6\" />\n </svg>\n </button>\n }\n <!--\n Styled `cursor: zoom-out`, which is a promise: clicking the image closes. A\n REDUNDANT mouse affordance — the close button, Escape, the backdrop and\n swipe-down all do the same thing and all reach a keyboard — so the image stays\n out of the tab order rather than becoming a second close stop.\n -->\n <!-- eslint-disable-next-line @angular-eslint/template/click-events-have-key-events,@angular-eslint/template/interactive-supports-focus -->\n <img class=\"wr-lightbox-viewer__full\" [src]=\"shown().src()\" [alt]=\"shown().alt()\" (click)=\"onClose()\" />\n @if (shown().caption()) {\n <div class=\"wr-lightbox-viewer__caption\">{{ shown().caption() }}</div>\n }\n @if (gallery().length) {\n <span class=\"wr-lightbox-viewer__status\" role=\"status\" aria-live=\"polite\">{{ announcement() }}</span>\n }\n </div>\n</ng-template>\n"],"mappings":";;;;;;;;;;;;;;;;;AAsBA,IAAa,mBAAb,MAAa,iBAAgB;CACV,yBAAS,IAAI,IAAG;CAEjC,IAAI,OAAe,QAAoB,MAAiB;EACtD,KAAK,QAAQ,KAAK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MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,SAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,aAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,YAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,OAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,MAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,eAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,WAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,UAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,aAAW,EAAA,UAAA,KAAA,CAAA;EAAA,CAAA;CAAA;AAAA,CAAA"}
@@ -23,7 +23,7 @@ var WrList = class WrList {
23
23
  });
24
24
  ariaLabel = input("", ...ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []);
25
25
  classes = computed(() => {
26
- const parts = ["wr-list"];
26
+ const parts = [];
27
27
  if (this.bordered()) parts.push("wr-list--bordered");
28
28
  if (this.dividers()) parts.push("wr-list--dividers");
29
29
  if (this.dense()) parts.push("wr-list--dense");
@@ -73,7 +73,10 @@ var WrList = class WrList {
73
73
  transformFunction: null
74
74
  }
75
75
  },
76
- host: { properties: { "class": "classes()" } },
76
+ host: {
77
+ properties: { "class": "classes()" },
78
+ classAttribute: "wr-list"
79
+ },
77
80
  ngImport: i0,
78
81
  template: "<ul class=\"wr-list__items\" role=\"list\" [attr.aria-label]=\"ariaLabel() || null\"><ng-content /></ul>",
79
82
  isInline: true,
@@ -92,7 +95,10 @@ i0.ɵɵngDeclareClassMetadata({
92
95
  selector: "wr-list",
93
96
  template: "<ul class=\"wr-list__items\" role=\"list\" [attr.aria-label]=\"ariaLabel() || null\"><ng-content /></ul>",
94
97
  encapsulation: ViewEncapsulation.None,
95
- host: { "[class]": "classes()" },
98
+ host: {
99
+ class: "wr-list",
100
+ "[class]": "classes()"
101
+ },
96
102
  styles: [".wr-btn:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo)}.wr-table__sort-btn:focus-visible,.wr-table-filter__trigger:focus-visible,.wr-table__expand-btn:focus-visible,.wr-table__group-toggle:focus-visible,.wr-table__tree-toggle:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo)}.wr-table:has(>.wr-table__scroll:focus-visible){outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo)}.wr-table__scroll:focus-visible{outline:none}.wr-tabs__tab:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo);outline-offset:-2px}.wr-tabs__panel:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo)}.wr-sidebar__row:focus-visible,.wr-sidebar__toggle:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo);outline-offset:-2px}.wr-anchor__link:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo)}.wr-collapse__header:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo);outline-offset:-2px}.wr-collapse--flat .wr-collapse__header:focus-visible{outline-offset:var(--wr-focus-ring-offset)}.wr-command-palette__option:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo)}.wr-mention-panel__option:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo)}.wr-segmented__option:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo)}.wr-back-top:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo)}.wr-carousel__nav:focus-visible,.wr-carousel__dot:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo)}.wr-speed-dial__trigger:focus-visible,.wr-speed-dial__action:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo)}.wr-stepper__header-button:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo)}.wr-window__chrome-action:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo)}.wr-date-picker__trigger:focus-visible,.wr-time-picker__step:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo)}.wr-dropdown-item:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo)}.wr-alert__close:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo)}.wr-graph__viewport:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo)}.wr-chart-legend__toggle:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo)}.wr-pull-to-refresh:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo)}.wr-tree__toggle:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo)}.wr-color-picker__sv:focus-visible,.wr-color-picker__slider:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo)}.wr-input-group__toggle:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo);outline-offset:-2px}.wr-input-number__step:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo);outline-offset:-2px}.wr-file-upload__zone:focus-visible,.wr-file-upload__remove:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo)}.wr-event-calendar__more:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo);position:relative;z-index:1}.wr-list{--wr-list-item-padding-y: var(--wr-space-md);--wr-list-item-padding-x: var(--wr-space-lg);--wr-list-item-gap: var(--wr-space-md);--wr-list-divider-color: var(--wr-border-base);--wr-list-radius: var(--wr-border-radius-base);--wr-list-bg: transparent;--wr-list-hover-bg: var(--wr-color-hover);--wr-list-active-bg: color-mix(in srgb, var(--wr-color-primary) 8%, transparent);--wr-list-font-family: var(--wr-font-family-base);--wr-list-font-size: var(--wr-text-sm);display:block;font-family:var(--wr-list-font-family);font-size:var(--wr-list-font-size);color:var(--wr-color-on-surface);background:var(--wr-list-bg)}.wr-list__items{list-style:none;margin:0;padding:0}.wr-list--bordered{border:1px solid var(--wr-list-divider-color);border-radius:var(--wr-list-radius)}@supports (corner-shape: squircle){.wr-list--bordered{corner-shape:squircle;border-radius:calc(var(--wr-list-radius) * 1.85)}}.wr-list--bordered{overflow:hidden}.wr-list--dividers .wr-list__item:not(:last-child){border-bottom:1px solid var(--wr-list-divider-color)}.wr-list--dense{--wr-list-item-padding-y: var(--wr-space-sm)}.wr-list__item{display:flex;align-items:center;gap:var(--wr-list-item-gap);padding:calc(var(--wr-list-item-padding-y) * var(--wr-density-y, 1)) calc(var(--wr-list-item-padding-x) * var(--wr-density-x, 1));color:inherit;transition:background .12s ease}.wr-list__item--interactive{cursor:pointer}.wr-list__item--interactive:hover{background:var(--wr-list-hover-bg)}.wr-list__item--interactive:active{background:var(--wr-list-active-bg)}.wr-list__item--interactive:focus-visible{outline:var(--wr-focus-ring-width) solid var(--wr-focus-ring-color);outline-offset:var(--wr-focus-ring-offset);box-shadow:0 0 0 var(--wr-focus-ring-offset) var(--wr-focus-ring-halo);outline-offset:-2px}.wr-list__item--disabled{opacity:var(--wr-disabled-opacity);pointer-events:none;cursor:not-allowed}.wr-list__leading,.wr-list__trailing{display:inline-flex;align-items:center;flex:0 0 auto;color:color-mix(in srgb,var(--wr-color-on-surface) 65%,transparent)}.wr-list__leading:empty,.wr-list__trailing:empty{display:none}.wr-list__body{flex:1 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}\n"]
97
103
  }]
98
104
  }],
@@ -150,7 +156,7 @@ var WrListItem = class WrListItem {
150
156
  transform: coerceBooleanProperty
151
157
  });
152
158
  classes = computed(() => {
153
- const parts = ["wr-list__item"];
159
+ const parts = [];
154
160
  if (this.interactive()) parts.push("wr-list__item--interactive");
155
161
  if (this.disabled()) parts.push("wr-list__item--disabled");
156
162
  return parts.join(" ");
@@ -200,7 +206,8 @@ var WrListItem = class WrListItem {
200
206
  "class": "classes()",
201
207
  "attr.tabindex": "interactive() ? \"0\" : null",
202
208
  "attr.aria-disabled": "disabled() || null"
203
- }
209
+ },
210
+ classAttribute: "wr-list__item"
204
211
  },
205
212
  ngImport: i0,
206
213
  template: "<span class=\"wr-list__leading\"><ng-content select=\"[wrListItemLeading]\" /></span>\n<span class=\"wr-list__body\"><ng-content /></span>\n<span class=\"wr-list__trailing\"><ng-content select=\"[wrListItemTrailing]\" /></span>\n",
@@ -218,6 +225,7 @@ i0.ɵɵngDeclareClassMetadata({
218
225
  selector: "wr-list-item",
219
226
  encapsulation: ViewEncapsulation.None,
220
227
  host: {
228
+ class: "wr-list__item",
221
229
  "[class]": "classes()",
222
230
  role: "listitem",
223
231
  "[attr.tabindex]": "interactive() ? \"0\" : null",
@@ -1 +1 @@
1
- {"version":3,"file":"ngwr-list.mjs","names":[],"sources":["../../../projects/lib/list/list.ts","../../../projects/lib/list/list-item.ts","../../../projects/lib/list/list-item.html"],"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 { coerceBooleanProperty } from '@angular/cdk/coercion';\nimport { Component, ViewEncapsulation, computed, input } from '@angular/core';\n\n/**\n * Generic list container. Renders `<ul role=\"list\">` with optional\n * borders, dividers between items, and dense (compact) padding. Project\n * `<wr-list-item>` children — they pick up the container's settings\n * through CSS cascade, no DI needed.\n *\n * @example\n * ```html\n * <wr-list bordered dividers>\n * <wr-list-item>\n * <wr-icon ngProjectAs=\"[wrListItemLeading]\" name=\"folder\" />\n * Reports\n * <span ngProjectAs=\"[wrListItemTrailing]\">12</span>\n * </wr-list-item>\n * <wr-list-item interactive (click)=\"open(item)\">\n * Click anywhere on this row\n * </wr-list-item>\n * </wr-list>\n * ```\n *\n * @see https://ngwr.dev/reference/components/list\n */\n@Component({\n selector: 'wr-list',\n // The label goes on the `<ul role=\"list\">`, not on the host. `<wr-list>` is a\n // role-less generic element, and ARIA 1.2 prohibits `aria-label` on one — so\n // the attribute was legal-looking, axe-reportable (`aria-prohibited-attr`)\n // and, worse, silent: the list it was written for stayed nameless, and a page\n // with three of them announced three identical unnamed lists.\n template: '<ul class=\"wr-list__items\" role=\"list\" [attr.aria-label]=\"ariaLabel() || null\"><ng-content /></ul>',\n styleUrl: './list.scss',\n encapsulation: ViewEncapsulation.None,\n host: {\n '[class]': 'classes()',\n },\n})\nexport class WrList {\n /** Wrap the list in a card-style border + radius. @default false */\n readonly bordered = input(false, { transform: coerceBooleanProperty });\n\n /** Draw a thin divider between items. @default false */\n readonly dividers = input(false, { transform: coerceBooleanProperty });\n\n /** Use compact padding on every item. @default false */\n readonly dense = input(false, { transform: coerceBooleanProperty });\n\n /** Optional accessible label for the list. */\n readonly ariaLabel = input<string>('');\n\n protected readonly classes = computed(() => {\n const parts = ['wr-list'];\n if (this.bordered()) parts.push('wr-list--bordered');\n if (this.dividers()) parts.push('wr-list--dividers');\n if (this.dense()) parts.push('wr-list--dense');\n return parts.join(' ');\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 { coerceBooleanProperty } from '@angular/cdk/coercion';\nimport { Component, ViewEncapsulation, computed, input } from '@angular/core';\n\nimport { wrCheckStyles } from 'ngwr/utils';\n\n/**\n * Row inside `<wr-list>`. Three projection slots:\n *\n * - `[wrListItemLeading]` — icon, avatar, status dot, etc.\n * - default — main label / body\n * - `[wrListItemTrailing]` — meta value, action button, chevron\n *\n * Set `interactive` to get hover and cursor styles, a tab stop, and Enter /\n * Space activation. The role stays `listitem`: the row lives inside a\n * `<ul role=\"list\">`, where a `button` or `option` child role would break the\n * structure the container promises. That means an interactive row ANNOUNCES as\n * a list item rather than as a control — deliberate, but worth knowing when the\n * whole row is the only way to reach an action. Where the action needs to be\n * announced as one, project a real button into `[wrListItemTrailing]`.\n *\n * @example\n * ```html\n * <wr-list-item>Plain row</wr-list-item>\n *\n * <wr-list-item interactive (click)=\"onPick(item)\">\n * <wr-icon ngProjectAs=\"[wrListItemLeading]\" name=\"folder\" />\n * Reports\n * <span ngProjectAs=\"[wrListItemTrailing]\">12</span>\n * </wr-list-item>\n * ```\n */\n@Component({\n selector: 'wr-list-item',\n templateUrl: './list-item.html',\n encapsulation: ViewEncapsulation.None,\n host: {\n '[class]': 'classes()',\n role: 'listitem',\n '[attr.tabindex]': 'interactive() ? \"0\" : null',\n '[attr.aria-disabled]': 'disabled() || null',\n '(keydown.enter)': 'onActivate($event)',\n '(keydown.space)': 'onActivate($event)',\n },\n})\nexport class WrListItem {\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('list');\n }\n\n /** Adds hover / cursor styles + keyboard activation. @default false */\n readonly interactive = input(false, { transform: coerceBooleanProperty });\n\n /** Visual disabled state. Suppresses hover + keyboard activation. @default false */\n readonly disabled = input(false, { transform: coerceBooleanProperty });\n\n protected readonly classes = computed(() => {\n const parts = ['wr-list__item'];\n if (this.interactive()) parts.push('wr-list__item--interactive');\n if (this.disabled()) parts.push('wr-list__item--disabled');\n return parts.join(' ');\n });\n\n protected onActivate(event: Event): void {\n if (!this.interactive() || this.disabled()) return;\n event.preventDefault();\n (event.currentTarget as HTMLElement).click();\n }\n}\n","<span class=\"wr-list__leading\"><ng-content select=\"[wrListItemLeading]\" /></span>\n<span class=\"wr-list__body\"><ng-content /></span>\n<span class=\"wr-list__trailing\"><ng-content select=\"[wrListItemTrailing]\" /></span>\n"],"mappings":";;;;;;;;;;AA8CA,IAAa,SAAb,MAAa,OAAM;CAER,WAAW,MAAM,OAAK;EAAA,GAAA,YAAA,EAAA,WAAA,WAAA,+BAAA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,GAAA,qBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,MAAA;EAAU,cAAA;EAAA,UAAA;EAAA,QAAA;GAAA,aAAA;IAAA,mBAAA;IAAA,YAAA;IAAA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;GAAA,UAAA;IAAA,mBAAA;IAAA,YAAA;IAAA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;EAAA;EAAA,MAAA;GAAA,YAAA,EAAA,QAAA,WAAA;GAAA,WAAA;IAAA,iBAAA;IAAA,iBAAA;GAAA;GAAA,YAAA;IAAA,SAAA;IAAA,iBAAA;IAAA,sBAAA;GAAA;EAAA;EAAA,UAAA;EAAA,UCnDvB;EAGA,eAAA,GAAA,kBAAA;CAAA,CAAA;;ADgDa,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAU,YAAA,CAAA;EAbtB,MAAA;EACW,MAAA,CAAA;GAAA,UAAA;GAAc,eAET,kBAAkB;GAAI,MAC/B;IACJ,WAAW;IACX,MAAM;IACN,mBAAmB;IACnB,wBAAwB;IACxB,mBAAmB;IACnB,mBAAmB;GACpB;GAAA,UAAA;EAAA,CAAA"}
1
+ {"version":3,"file":"ngwr-list.mjs","names":[],"sources":["../../../projects/lib/list/list.ts","../../../projects/lib/list/list-item.ts","../../../projects/lib/list/list-item.html"],"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 { coerceBooleanProperty } from '@angular/cdk/coercion';\nimport { Component, ViewEncapsulation, computed, input } from '@angular/core';\n\n/**\n * Generic list container. Renders `<ul role=\"list\">` with optional\n * borders, dividers between items, and dense (compact) padding. Project\n * `<wr-list-item>` children — they pick up the container's settings\n * through CSS cascade, no DI needed.\n *\n * @example\n * ```html\n * <wr-list bordered dividers>\n * <wr-list-item>\n * <wr-icon ngProjectAs=\"[wrListItemLeading]\" name=\"folder\" />\n * Reports\n * <span ngProjectAs=\"[wrListItemTrailing]\">12</span>\n * </wr-list-item>\n * <wr-list-item interactive (click)=\"open(item)\">\n * Click anywhere on this row\n * </wr-list-item>\n * </wr-list>\n * ```\n *\n * @see https://ngwr.dev/reference/components/list\n */\n@Component({\n selector: 'wr-list',\n // The label goes on the `<ul role=\"list\">`, not on the host. `<wr-list>` is a\n // role-less generic element, and ARIA 1.2 prohibits `aria-label` on one — so\n // the attribute was legal-looking, axe-reportable (`aria-prohibited-attr`)\n // and, worse, silent: the list it was written for stayed nameless, and a page\n // with three of them announced three identical unnamed lists.\n template: '<ul class=\"wr-list__items\" role=\"list\" [attr.aria-label]=\"ariaLabel() || null\"><ng-content /></ul>',\n styleUrl: './list.scss',\n encapsulation: ViewEncapsulation.None,\n host: {\n class: 'wr-list',\n '[class]': 'classes()',\n },\n})\nexport class WrList {\n /** Wrap the list in a card-style border + radius. @default false */\n readonly bordered = input(false, { transform: coerceBooleanProperty });\n\n /** Draw a thin divider between items. @default false */\n readonly dividers = input(false, { transform: coerceBooleanProperty });\n\n /** Use compact padding on every item. @default false */\n readonly dense = input(false, { transform: coerceBooleanProperty });\n\n /** Optional accessible label for the list. */\n readonly ariaLabel = input<string>('');\n\n protected readonly classes = computed(() => {\n const parts: string[] = [];\n if (this.bordered()) parts.push('wr-list--bordered');\n if (this.dividers()) parts.push('wr-list--dividers');\n if (this.dense()) parts.push('wr-list--dense');\n return parts.join(' ');\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 { coerceBooleanProperty } from '@angular/cdk/coercion';\nimport { Component, ViewEncapsulation, computed, input } from '@angular/core';\n\nimport { wrCheckStyles } from 'ngwr/utils';\n\n/**\n * Row inside `<wr-list>`. Three projection slots:\n *\n * - `[wrListItemLeading]` — icon, avatar, status dot, etc.\n * - default — main label / body\n * - `[wrListItemTrailing]` — meta value, action button, chevron\n *\n * Set `interactive` to get hover and cursor styles, a tab stop, and Enter /\n * Space activation. The role stays `listitem`: the row lives inside a\n * `<ul role=\"list\">`, where a `button` or `option` child role would break the\n * structure the container promises. That means an interactive row ANNOUNCES as\n * a list item rather than as a control — deliberate, but worth knowing when the\n * whole row is the only way to reach an action. Where the action needs to be\n * announced as one, project a real button into `[wrListItemTrailing]`.\n *\n * @example\n * ```html\n * <wr-list-item>Plain row</wr-list-item>\n *\n * <wr-list-item interactive (click)=\"onPick(item)\">\n * <wr-icon ngProjectAs=\"[wrListItemLeading]\" name=\"folder\" />\n * Reports\n * <span ngProjectAs=\"[wrListItemTrailing]\">12</span>\n * </wr-list-item>\n * ```\n */\n@Component({\n selector: 'wr-list-item',\n templateUrl: './list-item.html',\n encapsulation: ViewEncapsulation.None,\n host: {\n class: 'wr-list__item',\n '[class]': 'classes()',\n role: 'listitem',\n '[attr.tabindex]': 'interactive() ? \"0\" : null',\n '[attr.aria-disabled]': 'disabled() || null',\n '(keydown.enter)': 'onActivate($event)',\n '(keydown.space)': 'onActivate($event)',\n },\n})\nexport class WrListItem {\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('list');\n }\n\n /** Adds hover / cursor styles + keyboard activation. @default false */\n readonly interactive = input(false, { transform: coerceBooleanProperty });\n\n /** Visual disabled state. Suppresses hover + keyboard activation. @default false */\n readonly disabled = input(false, { transform: coerceBooleanProperty });\n\n protected readonly classes = computed(() => {\n const parts: string[] = [];\n if (this.interactive()) parts.push('wr-list__item--interactive');\n if (this.disabled()) parts.push('wr-list__item--disabled');\n return parts.join(' ');\n });\n\n protected onActivate(event: Event): void {\n if (!this.interactive() || this.disabled()) return;\n event.preventDefault();\n (event.currentTarget as HTMLElement).click();\n }\n}\n","<span class=\"wr-list__leading\"><ng-content select=\"[wrListItemLeading]\" /></span>\n<span class=\"wr-list__body\"><ng-content /></span>\n<span class=\"wr-list__trailing\"><ng-content select=\"[wrListItemTrailing]\" /></span>\n"],"m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EAAA,YAAA;EAAA,SAAA;EAAA,UAAA;EAAA,MAAA;EAAU,MAAA,CAAA;EAAA,QAAA,GAAA,gBAAA;CAAA,CAAA;CAAV,OAAA,OAAA,GAAA,qBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,MAAA;EAAU,cAAA;EAAA,UAAA;EAAA,QAAA;GAAA,aAAA;IAAA,mBAAA;IAAA,YAAA;IAAA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;GAAA,UAAA;IAAA,mBAAA;IAAA,YAAA;IAAA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;EAAA;EAAA,MAAA;GAAA,YAAA,EAAA,QAAA,WAAA;GAAA,WAAA;IAAA,iBAAA;IAAA,iBAAA;GAAA;GAAA,YAAA;IAAA,SAAA;IAAA,iBAAA;IAAA,sBAAA;GAAA;GAAA,gBAAA;EAAA;EAAA,UAAA;EAAA,UCpDvB;EAGA,eAAA,GAAA,kBAAA;CAAA,CAAA;;ADiDa,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAU,YAAA,CAAA;EAdtB,MAAA;EACW,MAAA,CAAA;GAAA,UAAA;GAAc,eAET,kBAAkB;GAAI,MAC/B;IACJ,OAAO;IACP,WAAW;IACX,MAAM;IACN,mBAAmB;IACnB,wBAAwB;IACxB,mBAAmB;IACnB,mBAAmB;GACpB;GAAA,UAAA;EAAA,CAAA"}
@@ -200,7 +200,7 @@ var WrLoadState = class WrLoadState {
200
200
  });
201
201
  retrying = computed(() => this.pressed() || (this.resource()?.isLoading() ?? false), ...ngDevMode ? [{ debugName: "retrying" }] : /* istanbul ignore next */ []);
202
202
  classes = computed(() => {
203
- const parts = ["wr-load-state", `wr-load-state--${this.state()}`];
203
+ const parts = [`wr-load-state--${this.state()}`];
204
204
  if (this.busy()) parts.push("wr-load-state--busy");
205
205
  return parts.join(" ");
206
206
  }, ...ngDevMode ? [{ debugName: "classes" }] : /* istanbul ignore next */ []);
@@ -288,10 +288,13 @@ var WrLoadState = class WrLoadState {
288
288
  }
289
289
  },
290
290
  outputs: { retry: "retry" },
291
- host: { properties: {
292
- "class": "classes()",
293
- "attr.aria-busy": "busy() ? \"true\" : null"
294
- } },
291
+ host: {
292
+ properties: {
293
+ "class": "classes()",
294
+ "attr.aria-busy": "busy() ? \"true\" : null"
295
+ },
296
+ classAttribute: "wr-load-state"
297
+ },
295
298
  queries: [
296
299
  {
297
300
  propertyName: "contentTpl",
@@ -404,6 +407,7 @@ i0.ɵɵngDeclareClassMetadata({
404
407
  ],
405
408
  encapsulation: ViewEncapsulation.None,
406
409
  host: {
410
+ class: "wr-load-state",
407
411
  "[class]": "classes()",
408
412
  "[attr.aria-busy]": "busy() ? \"true\" : null"
409
413
  },
@@ -1 +1 @@
1
- {"version":3,"file":"ngwr-load-state.mjs","names":[],"sources":["../../../projects/lib/load-state/load-state-templates.ts","../../../projects/lib/load-state/load-state.ts","../../../projects/lib/load-state/load-state.html"],"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 { Directive, type Resource, TemplateRef, inject, input } from '@angular/core';\n\nimport type { WrSafeAny } from 'ngwr/utils';\n\nimport type { WrLoadStateContentContext, WrLoadStateErrorContext } from './types';\n\n/**\n * The content `<wr-load-state>` draws once the data is ready. A template rather\n * than projected content, so nothing of it is created before that: a plain\n * `<ng-content>` would be instantiated in every state.\n *\n * Name the resource through `[wrLoadStateContentOf]` and `let-value` arrives\n * typed. The input is read by the type checker only, the way `[wrTableCellOf]`\n * types a table cell: the wrapper hands the template the same context whether\n * or not it is set.\n *\n * @example\n * ```html\n * <wr-load-state [resource]=\"users\">\n * <ng-template wrLoadStateContent [wrLoadStateContentOf]=\"users\" let-users>\n * <wr-table [items]=\"users\" [columns]=\"columns\" />\n * </ng-template>\n * </wr-load-state>\n * ```\n */\n@Directive({\n selector: 'ng-template[wrLoadStateContent]',\n})\nexport class WrLoadStateContent<T = WrSafeAny> {\n /**\n * The resource the template draws, for the type checker: nothing reads it at\n * runtime. Bind the same resource as the wrapper's `[resource]`.\n */\n readonly wrLoadStateContentOf = input<Resource<T | undefined> | null | undefined>(undefined);\n\n readonly template = inject<TemplateRef<WrLoadStateContentContext<T>>>(TemplateRef);\n\n /**\n * Types the template's `let-` variables under `strictTemplates`. `T` defaults\n * to `WrSafeAny` for the reason `WrOptionLeading` gives: without\n * `[wrLoadStateContentOf]` nothing infers the value, and narrowed to\n * `unknown` every `value.length` would stop compiling.\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars -- a guard's parameters exist to be narrowed, never read\n static ngTemplateContextGuard<T>(_dir: WrLoadStateContent<T>, _ctx: unknown): _ctx is WrLoadStateContentContext<T> {\n return true;\n }\n}\n\n/**\n * Replaces the default skeleton while `<wr-load-state>` loads for the first time.\n *\n * @example\n * ```html\n * <ng-template wrLoadStateLoading><wr-spinner /></ng-template>\n * ```\n */\n@Directive({\n selector: 'ng-template[wrLoadStateLoading]',\n})\nexport class WrLoadStateLoading {\n readonly template = inject<TemplateRef<void>>(TemplateRef);\n}\n\n/**\n * Replaces the default failure of `<wr-load-state>`. The context carries the\n * error, `retry()` and `retrying`; the error's message is the app's to show.\n *\n * @example\n * ```html\n * <ng-template wrLoadStateError let-error let-retry=\"retry\" let-retrying=\"retrying\">\n * <wr-alert type=\"danger\" title=\"Could not load\" [message]=\"error.message\">\n * <wr-btn wrAlertActions size=\"sm\" [loading]=\"retrying\" (click)=\"retry()\">Try again</wr-btn>\n * </wr-alert>\n * </ng-template>\n * ```\n */\n@Directive({\n selector: 'ng-template[wrLoadStateError]',\n})\nexport class WrLoadStateError<E = WrSafeAny> {\n readonly template = inject<TemplateRef<WrLoadStateErrorContext<E>>>(TemplateRef);\n\n /**\n * Types the template's `let-` variables under `strictTemplates`. `E` defaults\n * to `WrSafeAny` for the reason `WrOptionLeading` gives: nothing infers the error\n * type, and narrowed to `unknown`, `error.message` would not compile.\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars -- a guard's parameters exist to be narrowed, never read\n static ngTemplateContextGuard<E>(_dir: WrLoadStateError<E>, _ctx: unknown): _ctx is WrLoadStateErrorContext<E> {\n return true;\n }\n}\n\n/**\n * Replaces the default `<wr-empty>` of `<wr-load-state>`.\n *\n * @example\n * ```html\n * <ng-template wrLoadStateEmpty>\n * <wr-empty title=\"No orders yet\"><wr-btn wrEmptyActions (click)=\"create()\">Create one</wr-btn></wr-empty>\n * </ng-template>\n * ```\n */\n@Directive({\n selector: 'ng-template[wrLoadStateEmpty]',\n})\nexport class WrLoadStateEmpty {\n readonly template = inject<TemplateRef<void>>(TemplateRef);\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 { NgTemplateOutlet } from '@angular/common';\nimport {\n Component,\n type Resource,\n ViewEncapsulation,\n type WritableResource,\n computed,\n contentChild,\n input,\n linkedSignal,\n output,\n} from '@angular/core';\n\nimport { WrButton } from 'ngwr/button';\nimport { WrEmpty } from 'ngwr/empty';\nimport { useI18nText } from 'ngwr/i18n';\nimport { WrResult } from 'ngwr/result';\nimport { WrSkeleton } from 'ngwr/skeleton';\nimport { wrNumAttr, type WrSafeAny, wrCheckStyles } from 'ngwr/utils';\n\nimport { WrLoadStateContent, WrLoadStateEmpty, WrLoadStateError, WrLoadStateLoading } from './load-state-templates';\nimport type { WrLoadStateContentContext, WrLoadStateErrorContext, WrLoadStateStatus } from './types';\n\n/** The default `isEmpty`: nothing, or a list with nothing in it. */\nconst isEmptyValue = (value: unknown): boolean => value == null || (Array.isArray(value) && value.length === 0);\n\n/**\n * One wrapper for the four states of a screen that loads: the skeleton, the\n * failure with a retry, the empty slot and the content. Give it a `resource`\n * and it reads the state from there; give it a `status` and the app decides.\n * Never both.\n *\n * The content and any custom part are templates, so nothing of the content is\n * created before it is ready. The defaults are `<wr-skeleton [lines]>`,\n * `<wr-result status=\"error\">` with a retry button, and `<wr-empty>`, so the\n * minimal use is the resource and a content template.\n *\n * What each resource status draws:\n *\n * | `resource.status()` | Drawn |\n * | --------------------- | --------------------------------------------------------------------- |\n * | `loading` | the skeleton |\n * | `reloading` | what was on screen, marked busy; the failure, with its button busy, after a failed load; the skeleton when there is no value yet |\n * | `error` | the failure |\n * | `resolved`, `local` | the empty slot when `isEmpty(value)`, else the content |\n * | `idle` | the content or the empty slot by `isEmpty`: nothing was asked for, so nothing loads |\n *\n * Accessibility: the host carries `aria-busy` while a load is in flight, the\n * failure's title is announced once through a polite live region, nothing is\n * announced for a reload that keeps the content, and focus is never moved.\n *\n * @example\n * ```html\n * <wr-load-state [resource]=\"users\">\n * <ng-template wrLoadStateContent [wrLoadStateContentOf]=\"users\" let-users>\n * <wr-table [items]=\"users\" [columns]=\"columns\" />\n * </ng-template>\n * </wr-load-state>\n *\n * <wr-load-state [status]=\"status()\" (retry)=\"load()\">\n * <ng-template wrLoadStateContent>{{ text() }}</ng-template>\n * </wr-load-state>\n * ```\n *\n * @see https://ngwr.dev/reference/components/load-state\n */\n@Component({\n selector: 'wr-load-state',\n templateUrl: './load-state.html',\n imports: [NgTemplateOutlet, WrSkeleton, WrResult, WrEmpty, WrButton],\n encapsulation: ViewEncapsulation.None,\n host: {\n '[class]': 'classes()',\n '[attr.aria-busy]': 'busy() ? \"true\" : null',\n },\n})\nexport class WrLoadState<T = WrSafeAny> {\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('load-state');\n }\n\n /**\n * The state, when the app decides it. Ignored while `resource` is set.\n *\n * @default null\n */\n readonly status = input<WrLoadStateStatus | null>(null);\n\n /**\n * The resource to read the state from: `resource()`, `rxResource()` and\n * `httpResource()` alike. The retry button calls its `reload()`.\n *\n * @default null\n */\n readonly resource = input<Resource<T | undefined> | null>(null);\n\n /**\n * Decides whether a settled value shows the empty slot instead of the content.\n * The default is empty for `null`, `undefined` and an empty array.\n *\n * @default isEmptyValue\n */\n readonly isEmpty = input<(value: T | undefined) => boolean>(isEmptyValue);\n\n /**\n * How many lines the default skeleton draws.\n *\n * @default 3\n */\n readonly lines = input(3, { transform: wrNumAttr(3) });\n\n /** The failure's title. Falls back to `loadState.failed`, then `'Could not load'`. */\n readonly errorLabel = input<string | null>(null);\n\n /** The retry button's label. Falls back to `loadState.retry`, then `'Try again'`. */\n readonly retryLabel = input<string | null>(null);\n\n /** The default empty slot's title. Falls back to `empty.noData` through `<wr-empty>`. */\n readonly emptyLabel = input<string | null>(null);\n\n /**\n * Emitted when the retry button is pressed, once per press that starts a\n * retry. With a `resource`, `reload()` has been called as well.\n */\n readonly retry = output<void>();\n\n protected readonly resolvedErrorLabel = useI18nText(this.errorLabel, 'loadState.failed', 'Could not load');\n protected readonly resolvedRetryLabel = useI18nText(this.retryLabel, 'loadState.retry', 'Try again');\n\n protected readonly contentTpl = contentChild<WrLoadStateContent<T>>(WrLoadStateContent);\n protected readonly loadingTpl = contentChild(WrLoadStateLoading);\n protected readonly errorTpl = contentChild(WrLoadStateError);\n protected readonly emptyTpl = contentChild(WrLoadStateEmpty);\n\n protected readonly state = computed<WrLoadStateStatus>(() => {\n const resource = this.resource();\n if (!resource) return this.status() ?? 'loading';\n const status = resource.status();\n if (status === 'loading') return 'loading';\n if (status === 'error') return 'error';\n const held = resource.hasValue();\n if (status === 'reloading' && !held) return resource.error() !== undefined ? 'error' : 'loading';\n return this.isEmpty()(held ? resource.value() : undefined) ? 'empty' : 'ready';\n });\n\n /** A load is in flight: the first one, or a reload behind whatever is on screen. */\n protected readonly busy = computed(() => {\n const resource = this.resource();\n return resource ? resource.isLoading() : this.state() === 'loading';\n });\n\n /**\n * A press that has not reached the resource's status yet. `reload()` flips the\n * status in the same tick, so with a resource this covers only the gap before\n * it; with a `status` it holds until the app answers the `retry` output.\n */\n private readonly pressed = linkedSignal({\n source: () => [this.status(), this.resource()?.status()],\n computation: () => false,\n });\n\n protected readonly retrying = computed(() => this.pressed() || (this.resource()?.isLoading() ?? false));\n\n protected readonly classes = computed(() => {\n const parts = ['wr-load-state', `wr-load-state--${this.state()}`];\n if (this.busy()) parts.push('wr-load-state--busy');\n return parts.join(' ');\n });\n\n protected readonly contentContext = computed<WrLoadStateContentContext<T | undefined>>(() => {\n const resource = this.resource();\n return {\n $implicit: resource?.hasValue() ? resource.value() : undefined,\n reloading: this.busy(),\n };\n });\n\n protected readonly errorContext = computed<WrLoadStateErrorContext>(() => ({\n $implicit: this.resource()?.error(),\n retry: () => this.onRetry(),\n retrying: this.retrying(),\n }));\n\n /** A second press while one is in flight starts nothing. */\n protected onRetry(): void {\n if (this.retrying()) return;\n this.pressed.set(true);\n this.retry.emit();\n (this.resource() as Partial<WritableResource<T | undefined>> | null)?.reload?.();\n }\n}\n","@switch (state()) {\n @case ('loading') {\n @if (loadingTpl(); as custom) {\n <ng-container [ngTemplateOutlet]=\"custom.template\" />\n } @else {\n <wr-skeleton class=\"wr-load-state__skeleton\" [lines]=\"lines()\" />\n }\n }\n @case ('error') {\n @if (errorTpl(); as custom) {\n <ng-container [ngTemplateOutlet]=\"custom.template\" [ngTemplateOutletContext]=\"errorContext()\" />\n } @else {\n <wr-result class=\"wr-load-state__error\" status=\"error\" [title]=\"resolvedErrorLabel()\">\n <wr-btn wrResultExtra class=\"wr-load-state__retry\" size=\"sm\" [loading]=\"retrying()\" (click)=\"onRetry()\">\n {{ resolvedRetryLabel() }}\n </wr-btn>\n </wr-result>\n }\n }\n @case ('empty') {\n @if (emptyTpl(); as custom) {\n <ng-container [ngTemplateOutlet]=\"custom.template\" />\n } @else {\n <wr-empty class=\"wr-load-state__empty\" [title]=\"emptyLabel()\" />\n }\n }\n @case ('ready') {\n @if (contentTpl(); as custom) {\n <ng-container [ngTemplateOutlet]=\"custom.template\" [ngTemplateOutletContext]=\"contentContext()\" />\n }\n }\n}\n<!-- Always in the DOM, so a screen reader is watching it before the failure\n lands. The text leaves while a retry runs and comes back if that fails, so\n a second failure is announced too; a reload behind the content never\n touches it. -->\n<span class=\"wr-load-state__announce\" role=\"status\" aria-live=\"polite\">\n @if (state() === 'error' && !retrying()) {\n {{ resolvedErrorLabel() }}\n }\n</span>\n"],"mappings":";;;;;;;;;;;;;;;AAmCA,IAAa,qBAAb,MAAa,mBAAkB;CAKpB,uBAAuB,MAAkD,QAAU,GAAA,YAAA,CAAA,EAAA,WAAA,uBAAA,CAAA,+BAAA,CAAA,CAAA;CAEnF,WAAW,OAAkD,WAAW;CASjF,OAAO,uBAA0B,MAA6B,MAAa;EACzE,OAAO;CACT;CAlBW,OAAA,OAAA,GAAA,mBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,UAAA;EAAA,MAAA;EAAkB,MAAA,CAAA;EAAA,QAAA,GAAA,gBAAA;CAAA,CAAA;CAAlB,OAAA,OAAA,GAAA,qBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,MAAA;EAAkB,cAAA;EAAA,UAAA;EAAA,QAAA,EAAA,sBAAA;GAAA,mBAAA;GAAA,YAAA;GAAA,UAAA;GAAA,YAAA;GAAA,mBAAA;EAAA,EAAA;EAAA,UAAA;CAAA,CAAA;;AAAlB,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAkB,YAAA,CAAA;EAH9B,MAAA;EAAU,MAAA,CAAA,EACT,UAAU,kCACX,CAAA;;;;;;;;;;;AAiCD,IAAa,qBAAb,MAAa,mBAAkB;CACpB,WAAW,OAA0B,WAAW;CAD9C,OAAA,OAAA,GAAA,mBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,UAAA;EAAA,MAAA;EAAkB,MAAA,CAAA;EAAA,QAAA,GAAA,gBAAA;CAAA,CAAA;CAAlB,OAAA,OAAA,GAAA,qBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,MAAA;EAAkB,cAAA;EAAA,UAAA;EAAA,UAAA;CAAA,CAAA;;AAAlB,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UA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;EAAA,UAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,GAAA,iBAChB,gBAAgB,GAAA,EAAA,UAAA,KAAA,CAAA;EAAA,CAAA;CAAA;AAAA,CAAA"}
1
+ {"version":3,"file":"ngwr-load-state.mjs","names":[],"sources":["../../../projects/lib/load-state/load-state-templates.ts","../../../projects/lib/load-state/load-state.ts","../../../projects/lib/load-state/load-state.html"],"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 { Directive, type Resource, TemplateRef, inject, input } from '@angular/core';\n\nimport type { WrSafeAny } from 'ngwr/utils';\n\nimport type { WrLoadStateContentContext, WrLoadStateErrorContext } from './types';\n\n/**\n * The content `<wr-load-state>` draws once the data is ready. A template rather\n * than projected content, so nothing of it is created before that: a plain\n * `<ng-content>` would be instantiated in every state.\n *\n * Name the resource through `[wrLoadStateContentOf]` and `let-value` arrives\n * typed. The input is read by the type checker only, the way `[wrTableCellOf]`\n * types a table cell: the wrapper hands the template the same context whether\n * or not it is set.\n *\n * @example\n * ```html\n * <wr-load-state [resource]=\"users\">\n * <ng-template wrLoadStateContent [wrLoadStateContentOf]=\"users\" let-users>\n * <wr-table [items]=\"users\" [columns]=\"columns\" />\n * </ng-template>\n * </wr-load-state>\n * ```\n */\n@Directive({\n selector: 'ng-template[wrLoadStateContent]',\n})\nexport class WrLoadStateContent<T = WrSafeAny> {\n /**\n * The resource the template draws, for the type checker: nothing reads it at\n * runtime. Bind the same resource as the wrapper's `[resource]`.\n */\n readonly wrLoadStateContentOf = input<Resource<T | undefined> | null | undefined>(undefined);\n\n readonly template = inject<TemplateRef<WrLoadStateContentContext<T>>>(TemplateRef);\n\n /**\n * Types the template's `let-` variables under `strictTemplates`. `T` defaults\n * to `WrSafeAny` for the reason `WrOptionLeading` gives: without\n * `[wrLoadStateContentOf]` nothing infers the value, and narrowed to\n * `unknown` every `value.length` would stop compiling.\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars -- a guard's parameters exist to be narrowed, never read\n static ngTemplateContextGuard<T>(_dir: WrLoadStateContent<T>, _ctx: unknown): _ctx is WrLoadStateContentContext<T> {\n return true;\n }\n}\n\n/**\n * Replaces the default skeleton while `<wr-load-state>` loads for the first time.\n *\n * @example\n * ```html\n * <ng-template wrLoadStateLoading><wr-spinner /></ng-template>\n * ```\n */\n@Directive({\n selector: 'ng-template[wrLoadStateLoading]',\n})\nexport class WrLoadStateLoading {\n readonly template = inject<TemplateRef<void>>(TemplateRef);\n}\n\n/**\n * Replaces the default failure of `<wr-load-state>`. The context carries the\n * error, `retry()` and `retrying`; the error's message is the app's to show.\n *\n * @example\n * ```html\n * <ng-template wrLoadStateError let-error let-retry=\"retry\" let-retrying=\"retrying\">\n * <wr-alert type=\"danger\" title=\"Could not load\" [message]=\"error.message\">\n * <wr-btn wrAlertActions size=\"sm\" [loading]=\"retrying\" (click)=\"retry()\">Try again</wr-btn>\n * </wr-alert>\n * </ng-template>\n * ```\n */\n@Directive({\n selector: 'ng-template[wrLoadStateError]',\n})\nexport class WrLoadStateError<E = WrSafeAny> {\n readonly template = inject<TemplateRef<WrLoadStateErrorContext<E>>>(TemplateRef);\n\n /**\n * Types the template's `let-` variables under `strictTemplates`. `E` defaults\n * to `WrSafeAny` for the reason `WrOptionLeading` gives: nothing infers the error\n * type, and narrowed to `unknown`, `error.message` would not compile.\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars -- a guard's parameters exist to be narrowed, never read\n static ngTemplateContextGuard<E>(_dir: WrLoadStateError<E>, _ctx: unknown): _ctx is WrLoadStateErrorContext<E> {\n return true;\n }\n}\n\n/**\n * Replaces the default `<wr-empty>` of `<wr-load-state>`.\n *\n * @example\n * ```html\n * <ng-template wrLoadStateEmpty>\n * <wr-empty title=\"No orders yet\"><wr-btn wrEmptyActions (click)=\"create()\">Create one</wr-btn></wr-empty>\n * </ng-template>\n * ```\n */\n@Directive({\n selector: 'ng-template[wrLoadStateEmpty]',\n})\nexport class WrLoadStateEmpty {\n readonly template = inject<TemplateRef<void>>(TemplateRef);\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 { NgTemplateOutlet } from '@angular/common';\nimport {\n Component,\n type Resource,\n ViewEncapsulation,\n type WritableResource,\n computed,\n contentChild,\n input,\n linkedSignal,\n output,\n} from '@angular/core';\n\nimport { WrButton } from 'ngwr/button';\nimport { WrEmpty } from 'ngwr/empty';\nimport { useI18nText } from 'ngwr/i18n';\nimport { WrResult } from 'ngwr/result';\nimport { WrSkeleton } from 'ngwr/skeleton';\nimport { wrNumAttr, type WrSafeAny, wrCheckStyles } from 'ngwr/utils';\n\nimport { WrLoadStateContent, WrLoadStateEmpty, WrLoadStateError, WrLoadStateLoading } from './load-state-templates';\nimport type { WrLoadStateContentContext, WrLoadStateErrorContext, WrLoadStateStatus } from './types';\n\n/** The default `isEmpty`: nothing, or a list with nothing in it. */\nconst isEmptyValue = (value: unknown): boolean => value == null || (Array.isArray(value) && value.length === 0);\n\n/**\n * One wrapper for the four states of a screen that loads: the skeleton, the\n * failure with a retry, the empty slot and the content. Give it a `resource`\n * and it reads the state from there; give it a `status` and the app decides.\n * Never both.\n *\n * The content and any custom part are templates, so nothing of the content is\n * created before it is ready. The defaults are `<wr-skeleton [lines]>`,\n * `<wr-result status=\"error\">` with a retry button, and `<wr-empty>`, so the\n * minimal use is the resource and a content template.\n *\n * What each resource status draws:\n *\n * | `resource.status()` | Drawn |\n * | --------------------- | --------------------------------------------------------------------- |\n * | `loading` | the skeleton |\n * | `reloading` | what was on screen, marked busy; the failure, with its button busy, after a failed load; the skeleton when there is no value yet |\n * | `error` | the failure |\n * | `resolved`, `local` | the empty slot when `isEmpty(value)`, else the content |\n * | `idle` | the content or the empty slot by `isEmpty`: nothing was asked for, so nothing loads |\n *\n * Accessibility: the host carries `aria-busy` while a load is in flight, the\n * failure's title is announced once through a polite live region, nothing is\n * announced for a reload that keeps the content, and focus is never moved.\n *\n * @example\n * ```html\n * <wr-load-state [resource]=\"users\">\n * <ng-template wrLoadStateContent [wrLoadStateContentOf]=\"users\" let-users>\n * <wr-table [items]=\"users\" [columns]=\"columns\" />\n * </ng-template>\n * </wr-load-state>\n *\n * <wr-load-state [status]=\"status()\" (retry)=\"load()\">\n * <ng-template wrLoadStateContent>{{ text() }}</ng-template>\n * </wr-load-state>\n * ```\n *\n * @see https://ngwr.dev/reference/components/load-state\n */\n@Component({\n selector: 'wr-load-state',\n templateUrl: './load-state.html',\n imports: [NgTemplateOutlet, WrSkeleton, WrResult, WrEmpty, WrButton],\n encapsulation: ViewEncapsulation.None,\n host: {\n class: 'wr-load-state',\n '[class]': 'classes()',\n '[attr.aria-busy]': 'busy() ? \"true\" : null',\n },\n})\nexport class WrLoadState<T = WrSafeAny> {\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('load-state');\n }\n\n /**\n * The state, when the app decides it. Ignored while `resource` is set.\n *\n * @default null\n */\n readonly status = input<WrLoadStateStatus | null>(null);\n\n /**\n * The resource to read the state from: `resource()`, `rxResource()` and\n * `httpResource()` alike. The retry button calls its `reload()`.\n *\n * @default null\n */\n readonly resource = input<Resource<T | undefined> | null>(null);\n\n /**\n * Decides whether a settled value shows the empty slot instead of the content.\n * The default is empty for `null`, `undefined` and an empty array.\n *\n * @default isEmptyValue\n */\n readonly isEmpty = input<(value: T | undefined) => boolean>(isEmptyValue);\n\n /**\n * How many lines the default skeleton draws.\n *\n * @default 3\n */\n readonly lines = input(3, { transform: wrNumAttr(3) });\n\n /** The failure's title. Falls back to `loadState.failed`, then `'Could not load'`. */\n readonly errorLabel = input<string | null>(null);\n\n /** The retry button's label. Falls back to `loadState.retry`, then `'Try again'`. */\n readonly retryLabel = input<string | null>(null);\n\n /** The default empty slot's title. Falls back to `empty.noData` through `<wr-empty>`. */\n readonly emptyLabel = input<string | null>(null);\n\n /**\n * Emitted when the retry button is pressed, once per press that starts a\n * retry. With a `resource`, `reload()` has been called as well.\n */\n readonly retry = output<void>();\n\n protected readonly resolvedErrorLabel = useI18nText(this.errorLabel, 'loadState.failed', 'Could not load');\n protected readonly resolvedRetryLabel = useI18nText(this.retryLabel, 'loadState.retry', 'Try again');\n\n protected readonly contentTpl = contentChild<WrLoadStateContent<T>>(WrLoadStateContent);\n protected readonly loadingTpl = contentChild(WrLoadStateLoading);\n protected readonly errorTpl = contentChild(WrLoadStateError);\n protected readonly emptyTpl = contentChild(WrLoadStateEmpty);\n\n protected readonly state = computed<WrLoadStateStatus>(() => {\n const resource = this.resource();\n if (!resource) return this.status() ?? 'loading';\n const status = resource.status();\n if (status === 'loading') return 'loading';\n if (status === 'error') return 'error';\n const held = resource.hasValue();\n if (status === 'reloading' && !held) return resource.error() !== undefined ? 'error' : 'loading';\n return this.isEmpty()(held ? resource.value() : undefined) ? 'empty' : 'ready';\n });\n\n /** A load is in flight: the first one, or a reload behind whatever is on screen. */\n protected readonly busy = computed(() => {\n const resource = this.resource();\n return resource ? resource.isLoading() : this.state() === 'loading';\n });\n\n /**\n * A press that has not reached the resource's status yet. `reload()` flips the\n * status in the same tick, so with a resource this covers only the gap before\n * it; with a `status` it holds until the app answers the `retry` output.\n */\n private readonly pressed = linkedSignal({\n source: () => [this.status(), this.resource()?.status()],\n computation: () => false,\n });\n\n protected readonly retrying = computed(() => this.pressed() || (this.resource()?.isLoading() ?? false));\n\n protected readonly classes = computed(() => {\n const parts = [`wr-load-state--${this.state()}`];\n if (this.busy()) parts.push('wr-load-state--busy');\n return parts.join(' ');\n });\n\n protected readonly contentContext = computed<WrLoadStateContentContext<T | undefined>>(() => {\n const resource = this.resource();\n return {\n $implicit: resource?.hasValue() ? resource.value() : undefined,\n reloading: this.busy(),\n };\n });\n\n protected readonly errorContext = computed<WrLoadStateErrorContext>(() => ({\n $implicit: this.resource()?.error(),\n retry: () => this.onRetry(),\n retrying: this.retrying(),\n }));\n\n /** A second press while one is in flight starts nothing. */\n protected onRetry(): void {\n if (this.retrying()) return;\n this.pressed.set(true);\n this.retry.emit();\n (this.resource() as Partial<WritableResource<T | undefined>> | null)?.reload?.();\n }\n}\n","@switch (state()) {\n @case ('loading') {\n @if (loadingTpl(); as custom) {\n <ng-container [ngTemplateOutlet]=\"custom.template\" />\n } @else {\n <wr-skeleton class=\"wr-load-state__skeleton\" [lines]=\"lines()\" />\n }\n }\n @case ('error') {\n @if (errorTpl(); as custom) {\n <ng-container [ngTemplateOutlet]=\"custom.template\" [ngTemplateOutletContext]=\"errorContext()\" />\n } @else {\n <wr-result class=\"wr-load-state__error\" status=\"error\" [title]=\"resolvedErrorLabel()\">\n <wr-btn wrResultExtra class=\"wr-load-state__retry\" size=\"sm\" [loading]=\"retrying()\" (click)=\"onRetry()\">\n {{ resolvedRetryLabel() }}\n </wr-btn>\n </wr-result>\n }\n }\n @case ('empty') {\n @if (emptyTpl(); as custom) {\n <ng-container [ngTemplateOutlet]=\"custom.template\" />\n } @else {\n <wr-empty class=\"wr-load-state__empty\" [title]=\"emptyLabel()\" />\n }\n }\n @case ('ready') {\n @if (contentTpl(); as custom) {\n <ng-container [ngTemplateOutlet]=\"custom.template\" [ngTemplateOutletContext]=\"contentContext()\" />\n }\n }\n}\n<!-- Always in the DOM, so a screen reader is watching it before the failure\n lands. The text leaves while a retry runs and comes back if that fails, so\n a second failure is announced too; a reload behind the content never\n touches it. -->\n<span class=\"wr-load-state__announce\" role=\"status\" aria-live=\"polite\">\n @if (state() === 'error' && !retrying()) {\n {{ resolvedErrorLabel() }}\n }\n</span>\n"],"mappings":";;;;;;;;;;;;;;;AAmCA,IAAa,qBAAb,MAAa,mBAAkB;CAKpB,uBAAuB,MAAkD,QAAU,GAAA,YAAA,CAAA,EAAA,WAAA,uBAAA,CAAA,+BAAA,CAAA,CAAA;CAEnF,WAAW,OAAkD,WAAW;CASjF,OAAO,uBAA0B,MAA6B,MAAa;EAC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AAA;GAAA,CAAA;EAAA,CAAA;EAAA,OAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,YAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,YAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,YAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,OAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,OAAA;EAAA,CAAA;EAAA,YAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,GAAA,iBAAA,kBAAkB,GAAA,EAAA,UAAA,KAAA,CAAA;EAAA,CAAA;EAAA,YAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,GAAA,iBACzC,kBAAkB,GAAA,EAAA,UAAA,KAAA,CAAA;EAAA,CAAA;EAAA,UAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,GAAA,iBACpB,gBAAgB,GAAA,EAAA,UAAA,KAAA,CAAA;EAAA,CAAA;EAAA,UAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,GAAA,iBAChB,gBAAgB,GAAA,EAAA,UAAA,KAAA,CAAA;EAAA,CAAA;CAAA;AAAA,CAAA"}
@@ -251,6 +251,89 @@ i0.ɵɵngDeclareClassMetadata({
251
251
  * Use of this source code is governed by an MIT-style license that can be
252
252
  * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE
253
253
  */
254
+ function reshow(host) {
255
+ if (!host.isConnected || !host.hasAttribute("popover")) return;
256
+ try {
257
+ host.hidePopover();
258
+ host.showPopover();
259
+ } catch {}
260
+ }
261
+ var WrOverlayOrder = class WrOverlayOrder {
262
+ layers = [];
263
+ toasts = null;
264
+ under = 0;
265
+ add(host, toasts = "above") {
266
+ const layer = {
267
+ host,
268
+ coversToasts: toasts === "below"
269
+ };
270
+ this.layers.push(layer);
271
+ return () => {
272
+ const at = this.layers.indexOf(layer);
273
+ if (at < 0) return;
274
+ this.layers.splice(at, 1);
275
+ if (at < this.under) this.under--;
276
+ this.place(false);
277
+ };
278
+ }
279
+ raiseToasts(host) {
280
+ if (host !== this.toasts) {
281
+ this.toasts = host;
282
+ this.under = this.layers.length;
283
+ }
284
+ this.place(true);
285
+ }
286
+ dropToasts() {
287
+ this.toasts = null;
288
+ }
289
+ place(raise) {
290
+ const toasts = this.toasts;
291
+ if (!toasts) return;
292
+ let start = this.layers.length;
293
+ while (start > 0 && this.layers[start - 1].coversToasts) start--;
294
+ const covering = this.layers.slice(start);
295
+ if (this.under === start && (covering.length > 0 || !raise)) return;
296
+ const doc = toasts.ownerDocument;
297
+ const focused = doc.activeElement;
298
+ reshow(toasts);
299
+ this.under = start;
300
+ if (covering.length > 0) {
301
+ const above = /* @__PURE__ */ new Set();
302
+ for (let el = covering[0].host; el; el = el.nextElementSibling) above.add(el);
303
+ for (const layer of covering) above.add(layer.host);
304
+ above.delete(toasts);
305
+ above.forEach(reshow);
306
+ }
307
+ if (focused?.isConnected && doc.activeElement !== focused) focused.focus({ preventScroll: true });
308
+ }
309
+ static ɵfac = i0.ɵɵngDeclareFactory({
310
+ minVersion: "12.0.0",
311
+ version: "22.2.5",
312
+ ngImport: i0,
313
+ type: WrOverlayOrder,
314
+ deps: [],
315
+ target: i0.ɵɵFactoryTarget.Service
316
+ });
317
+ static ɵprov = i0.ɵɵngDeclareService({
318
+ minVersion: "22.0.0",
319
+ version: "22.2.5",
320
+ ngImport: i0,
321
+ type: WrOverlayOrder
322
+ });
323
+ };
324
+ i0.ɵɵngDeclareClassMetadata({
325
+ minVersion: "12.0.0",
326
+ version: "22.2.5",
327
+ ngImport: i0,
328
+ type: WrOverlayOrder,
329
+ decorators: [{ type: Service }]
330
+ });
331
+ /**
332
+ * @license
333
+ *
334
+ * Use of this source code is governed by an MIT-style license that can be
335
+ * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE
336
+ */
254
337
  const WR_OVERLAY_CONTAINER = new InjectionToken("WR_OVERLAY_CONTAINER", {
255
338
  providedIn: "root",
256
339
  factory: () => inject(WrOverlayContainer)
@@ -285,6 +368,6 @@ const WR_OVERLAY = new InjectionToken("WR_OVERLAY", {
285
368
  }).get(Overlay);
286
369
  }
287
370
  });
288
- export { WR_OVERLAY, WR_OVERLAY_CONTAINER, WrOutsideClick, WrOverlayContainer, wrAppendOverlayClose, wrFollowDirection, wrFollowSize, wrMirrorOffsets };
371
+ export { WR_OVERLAY, WR_OVERLAY_CONTAINER, WrOutsideClick, WrOverlayContainer, WrOverlayOrder, wrAppendOverlayClose, wrFollowDirection, wrFollowSize, wrMirrorOffsets };
289
372
 
290
373
  //# sourceMappingURL=ngwr-overlay.mjs.map