ngwr 15.9.0 → 16.0.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 (375) hide show
  1. package/animations/aurora/styles/_index.scss +1 -1
  2. package/animations/blur-reveal/styles/_index.scss +1 -1
  3. package/animations/decode/styles/_index.scss +1 -1
  4. package/animations/dot-grid/styles/_index.scss +1 -1
  5. package/animations/flow-lines/styles/_index.scss +1 -1
  6. package/animations/fluid-cursor/styles/_index.scss +1 -1
  7. package/animations/{core → internal}/styles/_mixins.scss +1 -1
  8. package/animations/reveal/styles/_index.scss +1 -1
  9. package/animations/ripple-grid/styles/_index.scss +1 -1
  10. package/animations/rotate-reveal/styles/_index.scss +1 -1
  11. package/animations/thread-lines/styles/_index.scss +1 -1
  12. package/animations/typewriter/styles/_index.scss +1 -1
  13. package/copy-value/styles/_index.scss +104 -0
  14. package/date-picker/styles/_index.scss +117 -0
  15. package/fesm2022/{ngwr-animations-core.mjs → internal-BaQU4t_0.mjs} +6 -49
  16. package/fesm2022/internal-BaQU4t_0.mjs.map +1 -0
  17. package/fesm2022/ngwr-alert.mjs +2 -2
  18. package/fesm2022/ngwr-alert.mjs.map +1 -1
  19. package/fesm2022/ngwr-animations-aurora.mjs +21 -21
  20. package/fesm2022/ngwr-animations-aurora.mjs.map +1 -1
  21. package/fesm2022/ngwr-animations-blur-reveal.mjs +3 -3
  22. package/fesm2022/ngwr-animations-blur-reveal.mjs.map +1 -1
  23. package/fesm2022/ngwr-animations-click-sparks.mjs +2 -2
  24. package/fesm2022/ngwr-animations-click-sparks.mjs.map +1 -1
  25. package/fesm2022/ngwr-animations-confetti.mjs +5 -5
  26. package/fesm2022/ngwr-animations-confetti.mjs.map +1 -1
  27. package/fesm2022/ngwr-animations-decode.mjs +4 -4
  28. package/fesm2022/ngwr-animations-decode.mjs.map +1 -1
  29. package/fesm2022/ngwr-animations-destruct.mjs +5 -5
  30. package/fesm2022/ngwr-animations-destruct.mjs.map +1 -1
  31. package/fesm2022/ngwr-animations-dot-grid.mjs +7 -7
  32. package/fesm2022/ngwr-animations-dot-grid.mjs.map +1 -1
  33. package/fesm2022/ngwr-animations-falling-letters.mjs +3 -3
  34. package/fesm2022/ngwr-animations-falling-letters.mjs.map +1 -1
  35. package/fesm2022/ngwr-animations-flow-lines.mjs +17 -17
  36. package/fesm2022/ngwr-animations-flow-lines.mjs.map +1 -1
  37. package/fesm2022/ngwr-animations-fluid-cursor.mjs +12 -12
  38. package/fesm2022/ngwr-animations-fluid-cursor.mjs.map +1 -1
  39. package/fesm2022/ngwr-animations-glitch.mjs +2 -2
  40. package/fesm2022/ngwr-animations-glitch.mjs.map +1 -1
  41. package/fesm2022/ngwr-animations-marquee.mjs +2 -2
  42. package/fesm2022/ngwr-animations-marquee.mjs.map +1 -1
  43. package/fesm2022/ngwr-animations-orbit.mjs +7 -7
  44. package/fesm2022/ngwr-animations-orbit.mjs.map +1 -1
  45. package/fesm2022/ngwr-animations-reveal.mjs +4 -4
  46. package/fesm2022/ngwr-animations-reveal.mjs.map +1 -1
  47. package/fesm2022/ngwr-animations-ripple-grid.mjs +5 -5
  48. package/fesm2022/ngwr-animations-ripple-grid.mjs.map +1 -1
  49. package/fesm2022/ngwr-animations-rotate-reveal.mjs +4 -4
  50. package/fesm2022/ngwr-animations-rotate-reveal.mjs.map +1 -1
  51. package/fesm2022/ngwr-animations-shimmer.mjs +2 -2
  52. package/fesm2022/ngwr-animations-shimmer.mjs.map +1 -1
  53. package/fesm2022/ngwr-animations-spotlight.mjs +1 -1
  54. package/fesm2022/ngwr-animations-spotlight.mjs.map +1 -1
  55. package/fesm2022/ngwr-animations-thread-lines.mjs +16 -16
  56. package/fesm2022/ngwr-animations-thread-lines.mjs.map +1 -1
  57. package/fesm2022/ngwr-animations-tilt.mjs +3 -3
  58. package/fesm2022/ngwr-animations-tilt.mjs.map +1 -1
  59. package/fesm2022/ngwr-animations-typewriter.mjs +4 -4
  60. package/fesm2022/ngwr-animations-typewriter.mjs.map +1 -1
  61. package/fesm2022/ngwr-avatar.mjs +3 -3
  62. package/fesm2022/ngwr-avatar.mjs.map +1 -1
  63. package/fesm2022/ngwr-badge.mjs.map +1 -1
  64. package/fesm2022/ngwr-cascader.mjs +43 -20
  65. package/fesm2022/ngwr-cascader.mjs.map +1 -1
  66. package/fesm2022/ngwr-charts-bar-chart.mjs +13 -13
  67. package/fesm2022/ngwr-charts-bar-chart.mjs.map +1 -1
  68. package/fesm2022/ngwr-charts-boxplot-chart.mjs +9 -9
  69. package/fesm2022/ngwr-charts-boxplot-chart.mjs.map +1 -1
  70. package/fesm2022/ngwr-charts-bullet-chart.mjs +8 -8
  71. package/fesm2022/ngwr-charts-bullet-chart.mjs.map +1 -1
  72. package/fesm2022/ngwr-charts-candlestick-chart.mjs +11 -11
  73. package/fesm2022/ngwr-charts-candlestick-chart.mjs.map +1 -1
  74. package/fesm2022/ngwr-charts-chart-legend.mjs +2 -2
  75. package/fesm2022/ngwr-charts-chart-legend.mjs.map +1 -1
  76. package/fesm2022/ngwr-charts-core.mjs +20 -20
  77. package/fesm2022/ngwr-charts-core.mjs.map +1 -1
  78. package/fesm2022/ngwr-charts-donut-chart.mjs +2 -2
  79. package/fesm2022/ngwr-charts-donut-chart.mjs.map +1 -1
  80. package/fesm2022/ngwr-charts-funnel-chart.mjs +6 -6
  81. package/fesm2022/ngwr-charts-funnel-chart.mjs.map +1 -1
  82. package/fesm2022/ngwr-charts-gauge.mjs +3 -3
  83. package/fesm2022/ngwr-charts-gauge.mjs.map +1 -1
  84. package/fesm2022/ngwr-charts-heatmap-chart.mjs +3 -3
  85. package/fesm2022/ngwr-charts-heatmap-chart.mjs.map +1 -1
  86. package/fesm2022/ngwr-charts-line-chart.mjs +10 -10
  87. package/fesm2022/ngwr-charts-line-chart.mjs.map +1 -1
  88. package/fesm2022/ngwr-charts-meter-group.mjs +2 -2
  89. package/fesm2022/ngwr-charts-meter-group.mjs.map +1 -1
  90. package/fesm2022/ngwr-charts-radar-chart.mjs +11 -11
  91. package/fesm2022/ngwr-charts-radar-chart.mjs.map +1 -1
  92. package/fesm2022/ngwr-charts-scatter-chart.mjs +10 -10
  93. package/fesm2022/ngwr-charts-scatter-chart.mjs.map +1 -1
  94. package/fesm2022/ngwr-charts-treemap-chart.mjs +4 -4
  95. package/fesm2022/ngwr-charts-treemap-chart.mjs.map +1 -1
  96. package/fesm2022/ngwr-charts-waterfall-chart.mjs +7 -7
  97. package/fesm2022/ngwr-charts-waterfall-chart.mjs.map +1 -1
  98. package/fesm2022/ngwr-checkbox.mjs +2 -2
  99. package/fesm2022/ngwr-checkbox.mjs.map +1 -1
  100. package/fesm2022/ngwr-collapse.mjs +2 -2
  101. package/fesm2022/ngwr-collapse.mjs.map +1 -1
  102. package/fesm2022/ngwr-color-picker.mjs +52 -52
  103. package/fesm2022/ngwr-color-picker.mjs.map +1 -1
  104. package/fesm2022/ngwr-command-palette.mjs +4 -4
  105. package/fesm2022/ngwr-command-palette.mjs.map +1 -1
  106. package/fesm2022/ngwr-comment.mjs +2 -2
  107. package/fesm2022/ngwr-comment.mjs.map +1 -1
  108. package/fesm2022/ngwr-compare.mjs +6 -6
  109. package/fesm2022/ngwr-compare.mjs.map +1 -1
  110. package/fesm2022/ngwr-context-menu.mjs +4 -4
  111. package/fesm2022/ngwr-context-menu.mjs.map +1 -1
  112. package/fesm2022/ngwr-copy-value-testing.mjs +58 -0
  113. package/fesm2022/ngwr-copy-value-testing.mjs.map +1 -0
  114. package/fesm2022/ngwr-copy-value.mjs +196 -0
  115. package/fesm2022/ngwr-copy-value.mjs.map +1 -0
  116. package/fesm2022/ngwr-counter.mjs +3 -3
  117. package/fesm2022/ngwr-counter.mjs.map +1 -1
  118. package/fesm2022/ngwr-date-picker-testing.mjs.map +1 -1
  119. package/fesm2022/ngwr-date-picker.mjs +217 -40
  120. package/fesm2022/ngwr-date-picker.mjs.map +1 -1
  121. package/fesm2022/ngwr-date.mjs +27 -5
  122. package/fesm2022/ngwr-date.mjs.map +1 -1
  123. package/fesm2022/ngwr-dialog.mjs +32 -3
  124. package/fesm2022/ngwr-dialog.mjs.map +1 -1
  125. package/fesm2022/ngwr-directives.mjs +116 -1
  126. package/fesm2022/ngwr-directives.mjs.map +1 -1
  127. package/fesm2022/ngwr-drawer.mjs +3 -3
  128. package/fesm2022/ngwr-drawer.mjs.map +1 -1
  129. package/fesm2022/ngwr-dropdown.mjs +13 -12
  130. package/fesm2022/ngwr-dropdown.mjs.map +1 -1
  131. package/fesm2022/ngwr-editor.mjs +28 -28
  132. package/fesm2022/ngwr-editor.mjs.map +1 -1
  133. package/fesm2022/ngwr-event-calendar.mjs +5 -5
  134. package/fesm2022/ngwr-event-calendar.mjs.map +1 -1
  135. package/fesm2022/ngwr-file-upload.mjs +8 -8
  136. package/fesm2022/ngwr-file-upload.mjs.map +1 -1
  137. package/fesm2022/ngwr-graph.mjs +3 -3
  138. package/fesm2022/ngwr-graph.mjs.map +1 -1
  139. package/fesm2022/ngwr-hotkey.mjs +22 -22
  140. package/fesm2022/ngwr-hotkey.mjs.map +1 -1
  141. package/fesm2022/ngwr-i18n-ar.mjs +5 -0
  142. package/fesm2022/ngwr-i18n-ar.mjs.map +1 -1
  143. package/fesm2022/ngwr-i18n-cs.mjs +5 -0
  144. package/fesm2022/ngwr-i18n-cs.mjs.map +1 -1
  145. package/fesm2022/ngwr-i18n-de.mjs +5 -0
  146. package/fesm2022/ngwr-i18n-de.mjs.map +1 -1
  147. package/fesm2022/ngwr-i18n-en.mjs +5 -0
  148. package/fesm2022/ngwr-i18n-en.mjs.map +1 -1
  149. package/fesm2022/ngwr-i18n-es.mjs +5 -0
  150. package/fesm2022/ngwr-i18n-es.mjs.map +1 -1
  151. package/fesm2022/ngwr-i18n-fr.mjs +5 -0
  152. package/fesm2022/ngwr-i18n-fr.mjs.map +1 -1
  153. package/fesm2022/ngwr-i18n-he.mjs +5 -0
  154. package/fesm2022/ngwr-i18n-he.mjs.map +1 -1
  155. package/fesm2022/ngwr-i18n-hi.mjs +5 -0
  156. package/fesm2022/ngwr-i18n-hi.mjs.map +1 -1
  157. package/fesm2022/ngwr-i18n-id.mjs +5 -0
  158. package/fesm2022/ngwr-i18n-id.mjs.map +1 -1
  159. package/fesm2022/ngwr-i18n-it.mjs +5 -0
  160. package/fesm2022/ngwr-i18n-it.mjs.map +1 -1
  161. package/fesm2022/ngwr-i18n-ja.mjs +5 -0
  162. package/fesm2022/ngwr-i18n-ja.mjs.map +1 -1
  163. package/fesm2022/ngwr-i18n-ko.mjs +5 -0
  164. package/fesm2022/ngwr-i18n-ko.mjs.map +1 -1
  165. package/fesm2022/ngwr-i18n-nl.mjs +5 -0
  166. package/fesm2022/ngwr-i18n-nl.mjs.map +1 -1
  167. package/fesm2022/ngwr-i18n-pl.mjs +5 -0
  168. package/fesm2022/ngwr-i18n-pl.mjs.map +1 -1
  169. package/fesm2022/ngwr-i18n-pt.mjs +5 -0
  170. package/fesm2022/ngwr-i18n-pt.mjs.map +1 -1
  171. package/fesm2022/ngwr-i18n-ru.mjs +5 -0
  172. package/fesm2022/ngwr-i18n-ru.mjs.map +1 -1
  173. package/fesm2022/ngwr-i18n-sv.mjs +5 -0
  174. package/fesm2022/ngwr-i18n-sv.mjs.map +1 -1
  175. package/fesm2022/ngwr-i18n-tr.mjs +5 -0
  176. package/fesm2022/ngwr-i18n-tr.mjs.map +1 -1
  177. package/fesm2022/ngwr-i18n-uk.mjs +5 -0
  178. package/fesm2022/ngwr-i18n-uk.mjs.map +1 -1
  179. package/fesm2022/ngwr-i18n-vi.mjs +5 -0
  180. package/fesm2022/ngwr-i18n-vi.mjs.map +1 -1
  181. package/fesm2022/ngwr-i18n-zh-tw.mjs +5 -0
  182. package/fesm2022/ngwr-i18n-zh-tw.mjs.map +1 -1
  183. package/fesm2022/ngwr-i18n-zh.mjs +5 -0
  184. package/fesm2022/ngwr-i18n-zh.mjs.map +1 -1
  185. package/fesm2022/ngwr-i18n.mjs +2 -2
  186. package/fesm2022/ngwr-i18n.mjs.map +1 -1
  187. package/fesm2022/ngwr-icon.mjs +5 -5
  188. package/fesm2022/ngwr-icon.mjs.map +1 -1
  189. package/fesm2022/ngwr-image-cropper.mjs +11 -11
  190. package/fesm2022/ngwr-image-cropper.mjs.map +1 -1
  191. package/fesm2022/ngwr-input-number.mjs +4 -4
  192. package/fesm2022/ngwr-input-number.mjs.map +1 -1
  193. package/fesm2022/ngwr-input-otp.mjs +2 -2
  194. package/fesm2022/ngwr-input-otp.mjs.map +1 -1
  195. package/fesm2022/ngwr-input.mjs +15 -15
  196. package/fesm2022/ngwr-input.mjs.map +1 -1
  197. package/fesm2022/ngwr-keyboard.mjs +28 -28
  198. package/fesm2022/ngwr-keyboard.mjs.map +1 -1
  199. package/fesm2022/ngwr-knob.mjs +4 -4
  200. package/fesm2022/ngwr-knob.mjs.map +1 -1
  201. package/fesm2022/ngwr-lightbox.mjs +2 -2
  202. package/fesm2022/ngwr-lightbox.mjs.map +1 -1
  203. package/fesm2022/ngwr-load-state.mjs +2 -2
  204. package/fesm2022/ngwr-load-state.mjs.map +1 -1
  205. package/fesm2022/ngwr-mention.mjs +6 -6
  206. package/fesm2022/ngwr-mention.mjs.map +1 -1
  207. package/fesm2022/ngwr-meta.mjs +19 -3
  208. package/fesm2022/ngwr-meta.mjs.map +1 -1
  209. package/fesm2022/ngwr-overlay.mjs +3 -3
  210. package/fesm2022/ngwr-overlay.mjs.map +1 -1
  211. package/fesm2022/ngwr-pagination.mjs +7 -5
  212. package/fesm2022/ngwr-pagination.mjs.map +1 -1
  213. package/fesm2022/ngwr-pipes.mjs +3 -5
  214. package/fesm2022/ngwr-pipes.mjs.map +1 -1
  215. package/fesm2022/ngwr-platform.mjs +4 -1
  216. package/fesm2022/ngwr-platform.mjs.map +1 -1
  217. package/fesm2022/ngwr-popconfirm.mjs +6 -5
  218. package/fesm2022/ngwr-popconfirm.mjs.map +1 -1
  219. package/fesm2022/ngwr-popover.mjs +31 -30
  220. package/fesm2022/ngwr-popover.mjs.map +1 -1
  221. package/fesm2022/ngwr-pull-to-refresh.mjs +2 -2
  222. package/fesm2022/ngwr-pull-to-refresh.mjs.map +1 -1
  223. package/fesm2022/ngwr-qr.mjs +6 -6
  224. package/fesm2022/ngwr-qr.mjs.map +1 -1
  225. package/fesm2022/ngwr-radio.mjs +3 -3
  226. package/fesm2022/ngwr-radio.mjs.map +1 -1
  227. package/fesm2022/ngwr-rating.mjs +10 -10
  228. package/fesm2022/ngwr-rating.mjs.map +1 -1
  229. package/fesm2022/ngwr-schema-form.mjs +15 -5
  230. package/fesm2022/ngwr-schema-form.mjs.map +1 -1
  231. package/fesm2022/ngwr-select.mjs +57 -34
  232. package/fesm2022/ngwr-select.mjs.map +1 -1
  233. package/fesm2022/ngwr-sidebar.mjs +3 -3
  234. package/fesm2022/ngwr-sidebar.mjs.map +1 -1
  235. package/fesm2022/ngwr-skeleton.mjs +2 -2
  236. package/fesm2022/ngwr-skeleton.mjs.map +1 -1
  237. package/fesm2022/ngwr-slider-testing.mjs.map +1 -1
  238. package/fesm2022/ngwr-slider.mjs +13 -13
  239. package/fesm2022/ngwr-slider.mjs.map +1 -1
  240. package/fesm2022/ngwr-sortable-list.mjs +3 -3
  241. package/fesm2022/ngwr-sortable-list.mjs.map +1 -1
  242. package/fesm2022/ngwr-splitter.mjs +5 -5
  243. package/fesm2022/ngwr-splitter.mjs.map +1 -1
  244. package/fesm2022/ngwr-statistic.mjs +5 -3
  245. package/fesm2022/ngwr-statistic.mjs.map +1 -1
  246. package/fesm2022/ngwr-storage.mjs +6 -4
  247. package/fesm2022/ngwr-storage.mjs.map +1 -1
  248. package/fesm2022/ngwr-switch.mjs +2 -2
  249. package/fesm2022/ngwr-switch.mjs.map +1 -1
  250. package/fesm2022/ngwr-table-testing.mjs.map +1 -1
  251. package/fesm2022/ngwr-table.mjs +231 -27
  252. package/fesm2022/ngwr-table.mjs.map +1 -1
  253. package/fesm2022/ngwr-tabs.mjs +2 -2
  254. package/fesm2022/ngwr-tabs.mjs.map +1 -1
  255. package/fesm2022/ngwr-toast-testing.mjs +8 -1
  256. package/fesm2022/ngwr-toast-testing.mjs.map +1 -1
  257. package/fesm2022/ngwr-toast.mjs +63 -20
  258. package/fesm2022/ngwr-toast.mjs.map +1 -1
  259. package/fesm2022/ngwr-tour.mjs +7 -7
  260. package/fesm2022/ngwr-tour.mjs.map +1 -1
  261. package/fesm2022/ngwr-transfer.mjs +20 -9
  262. package/fesm2022/ngwr-transfer.mjs.map +1 -1
  263. package/fesm2022/ngwr-tree.mjs +64 -24
  264. package/fesm2022/ngwr-tree.mjs.map +1 -1
  265. package/fesm2022/ngwr-utils.mjs +98 -55
  266. package/fesm2022/ngwr-utils.mjs.map +1 -1
  267. package/fesm2022/ngwr-validators.mjs +2 -2
  268. package/fesm2022/ngwr-validators.mjs.map +1 -1
  269. package/fesm2022/ngwr-version.mjs +1 -1
  270. package/fesm2022/ngwr-version.mjs.map +1 -1
  271. package/fesm2022/ngwr-window.mjs +26 -26
  272. package/fesm2022/ngwr-window.mjs.map +1 -1
  273. package/fesm2022/ngwr.mjs.map +1 -1
  274. package/i18n/ar.json +5 -0
  275. package/i18n/cs.json +5 -0
  276. package/i18n/de.json +5 -0
  277. package/i18n/en.json +5 -0
  278. package/i18n/es.json +5 -0
  279. package/i18n/fr.json +5 -0
  280. package/i18n/he.json +5 -0
  281. package/i18n/hi.json +5 -0
  282. package/i18n/id.json +5 -0
  283. package/i18n/it.json +5 -0
  284. package/i18n/ja.json +5 -0
  285. package/i18n/ko.json +5 -0
  286. package/i18n/nl.json +5 -0
  287. package/i18n/pl.json +5 -0
  288. package/i18n/pt.json +5 -0
  289. package/i18n/ru.json +5 -0
  290. package/i18n/sv.json +5 -0
  291. package/i18n/tr.json +5 -0
  292. package/i18n/uk.json +5 -0
  293. package/i18n/vi.json +5 -0
  294. package/i18n/zh-TW.json +5 -0
  295. package/i18n/zh.json +5 -0
  296. package/input-number/styles/_index.scss +6 -0
  297. package/llms-full.txt +31 -19
  298. package/llms.txt +37 -19
  299. package/mcp/providers.js +1 -1
  300. package/package.json +15 -10
  301. package/schematics/icon-set/index.js +3 -3
  302. package/schematics/migrations/v16/index.js +742 -0
  303. package/schematics/migrations.json +5 -0
  304. package/schematics/ng-add/index.js +4 -4
  305. package/schematics/provider/index.js +4 -4
  306. package/schematics/use/symbol-map.json +2 -0
  307. package/select/styles/_index.scss +1 -1
  308. package/skills/ngwr/SKILL.md +6 -4
  309. package/skills/ngwr/references/catalog.md +4 -2
  310. package/skills/ngwr/references/setup.md +10 -9
  311. package/table/styles/_index.scss +85 -29
  312. package/toast/styles/_index.scss +30 -0
  313. package/tree/styles/_index.scss +17 -0
  314. package/types/index-CXbgza47.d.ts +13 -0
  315. package/types/ngwr-animations-aurora.d.ts +1 -1
  316. package/types/ngwr-animations-blur-reveal.d.ts +2 -2
  317. package/types/ngwr-animations-dot-grid.d.ts +1 -2
  318. package/types/ngwr-animations-flow-lines.d.ts +1 -1
  319. package/types/ngwr-animations-fluid-cursor.d.ts +1 -1
  320. package/types/ngwr-animations-reveal.d.ts +4 -8
  321. package/types/ngwr-animations-ripple-grid.d.ts +1 -1
  322. package/types/ngwr-animations-spotlight.d.ts +1 -1
  323. package/types/ngwr-animations-thread-lines.d.ts +1 -1
  324. package/types/ngwr-animations-tilt.d.ts +1 -1
  325. package/types/ngwr-avatar.d.ts +2 -2
  326. package/types/ngwr-badge.d.ts +1 -1
  327. package/types/ngwr-cascader.d.ts +12 -1
  328. package/types/ngwr-charts-boxplot-chart.d.ts +1 -1
  329. package/types/ngwr-charts-bullet-chart.d.ts +2 -2
  330. package/types/ngwr-charts-candlestick-chart.d.ts +1 -1
  331. package/types/ngwr-charts-core.d.ts +12 -12
  332. package/types/ngwr-charts-line-chart.d.ts +2 -2
  333. package/types/ngwr-charts-radar-chart.d.ts +1 -1
  334. package/types/ngwr-charts-scatter-chart.d.ts +2 -2
  335. package/types/ngwr-charts-waterfall-chart.d.ts +1 -1
  336. package/types/ngwr-color-picker.d.ts +12 -12
  337. package/types/ngwr-copy-value-testing.d.ts +87 -0
  338. package/types/ngwr-copy-value.d.ts +95 -0
  339. package/types/ngwr-date-picker-testing.d.ts +3 -3
  340. package/types/ngwr-date-picker.d.ts +97 -1
  341. package/types/ngwr-date.d.ts +44 -3
  342. package/types/ngwr-dialog.d.ts +50 -3
  343. package/types/ngwr-directives.d.ts +40 -0
  344. package/types/ngwr-drawer.d.ts +1 -1
  345. package/types/ngwr-dropdown.d.ts +3 -2
  346. package/types/ngwr-hotkey.d.ts +5 -5
  347. package/types/ngwr-i18n.d.ts +3 -3
  348. package/types/ngwr-icon.d.ts +26 -26
  349. package/types/ngwr-input-number.d.ts +2 -2
  350. package/types/ngwr-input.d.ts +8 -8
  351. package/types/ngwr-load-state.d.ts +6 -6
  352. package/types/ngwr-meta.d.ts +18 -0
  353. package/types/ngwr-pipes.d.ts +6 -4
  354. package/types/ngwr-platform.d.ts +2 -1
  355. package/types/ngwr-popconfirm.d.ts +3 -2
  356. package/types/ngwr-popover.d.ts +4 -3
  357. package/types/ngwr-select.d.ts +33 -18
  358. package/types/ngwr-slider-testing.d.ts +2 -2
  359. package/types/ngwr-slider.d.ts +3 -3
  360. package/types/ngwr-statistic.d.ts +5 -1
  361. package/types/ngwr-storage.d.ts +1 -1
  362. package/types/ngwr-table-testing.d.ts +2 -1
  363. package/types/ngwr-table.d.ts +136 -11
  364. package/types/ngwr-tabs.d.ts +10 -2
  365. package/types/ngwr-toast-testing.d.ts +6 -2
  366. package/types/ngwr-toast.d.ts +33 -5
  367. package/types/ngwr-transfer.d.ts +5 -0
  368. package/types/ngwr-tree.d.ts +22 -2
  369. package/types/ngwr-utils.d.ts +157 -82
  370. package/types/ngwr-validators.d.ts +4 -2
  371. package/types/ngwr-version.d.ts +1 -1
  372. package/types/ngwr.d.ts +1 -0
  373. package/types/pointer-tracker-D7fXxLQL.d.ts +24 -0
  374. package/fesm2022/ngwr-animations-core.mjs.map +0 -1
  375. package/types/ngwr-animations-core.d.ts +0 -294
@@ -1 +1 @@
1
- {"version":3,"file":"ngwr-statistic.mjs","names":[],"sources":["../../../projects/lib/statistic/statistic.ts","../../../projects/lib/statistic/statistic.html","../../../projects/lib/statistic/statistic-countdown.ts","../../../projects/lib/statistic/statistic-countdown.html","../../../projects/lib/statistic/statistic-group.ts"],"sourcesContent":["/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { coerceBooleanProperty, coerceNumberProperty } from '@angular/cdk/coercion';\nimport {\n Component,\n LOCALE_ID,\n ViewEncapsulation,\n computed,\n effect,\n inject,\n input,\n signal,\n untracked,\n} from '@angular/core';\n\nimport { WrCountUp } from 'ngwr/counter';\nimport { useI18nFormatter, useI18nText } from 'ngwr/i18n';\nimport { WrPlatform } from 'ngwr/platform';\nimport { numAttr, wrCheckStyles } from 'ngwr/utils';\n\n/** Digits with one optional point and a sign: the form `Intl` reads exactly. */\nconst PLAIN_DECIMAL = /^[+-]?(?:\\d+\\.?\\d*|\\.\\d+)$/;\n\n/**\n * KPI card — label + big number + optional prefix/suffix + delta. Pair\n * with `<wr-statistic-group>` for a responsive dashboard grid.\n *\n * When `value` is numeric the number counts up (eased) from its previous\n * value to the new one on every change — see `animate`. String values and\n * `prefers-reduced-motion` render instantly.\n *\n * @example\n * ```html\n * <wr-statistic label=\"Active users\" [value]=\"12345\" suffix=\"users\" />\n * <wr-statistic label=\"Revenue\" [value]=\"9512\" prefix=\"$\" [delta]=\"12.4\" />\n * <wr-statistic label=\"Churn\" [value]=\"1.8\" suffix=\"%\" [precision]=\"1\" />\n * ```\n *\n * @see https://ngwr.dev/reference/components/statistic\n */\n@Component({\n selector: 'wr-statistic',\n templateUrl: './statistic.html',\n encapsulation: ViewEncapsulation.None,\n host: { class: 'wr-statistic' },\n imports: [WrCountUp],\n})\nexport class WrStatistic {\n private readonly platform = inject(WrPlatform);\n private readonly locale = inject(LOCALE_ID);\n\n /**\n * The caption above the figure — what the number counts. Keep it short; the\n * value is the thing being read, and this names it.\n */\n readonly label = input<string>('');\n\n /** The number (or string) to display in the main slot. */\n readonly value = input<number | string | null>(null);\n\n /** Prefix glyph / symbol (e.g. `'$'`). */\n readonly prefix = input<string>('');\n\n /** Suffix glyph / unit (e.g. `'%'`, `'kg'`). */\n readonly suffix = input<string>('');\n\n /** Fixed number of decimals applied to numeric values. @default 0 */\n readonly precision = input(0, { transform: (v: unknown): number => Math.max(0, coerceNumberProperty(v, 0)) });\n\n /**\n * Count up to a new numeric `value` instead of swapping instantly. Always\n * off for string values or under `prefers-reduced-motion`. @default true\n */\n readonly animate = input(true, { transform: coerceBooleanProperty });\n\n /** Count-up duration (ms). @default 700 */\n readonly duration = input(700, { transform: numAttr(700) });\n\n /**\n * The current value coerced to a finite number, or `null` when `value` is\n * a non-numeric string / empty / nullish (rendered as-is).\n */\n protected readonly numericValue = computed<number | null>(() => {\n const raw = this.value();\n if (raw === null || raw === '') return null;\n const n = typeof raw === 'number' ? raw : coerceNumberProperty(raw, Number.NaN);\n return Number.isFinite(n) ? n : null;\n });\n\n /** Whether the value should count up (browser, numeric, opted-in, motion allowed). */\n protected readonly animated = computed<boolean>(\n () =>\n this.platform.isBrowser &&\n this.animate() &&\n !this.platform.prefersReducedMotion() &&\n typeof this.value() === 'number' &&\n this.numericValue() !== null\n );\n\n /** Animation start — the previously-rendered numeric value (0 on first paint). */\n protected readonly animateFrom = signal(0);\n\n /** Bookkeeping: the last numeric value seen, fed back as the next `from`. */\n private readonly lastNumeric = signal(0);\n\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('statistic');\n // Whenever the numeric value changes, snapshot the prior value as the\n // count-up start, then remember the new one for the next transition.\n effect(() => {\n const next = this.numericValue();\n if (next === null) return;\n untracked(() => {\n this.animateFrom.set(this.lastNumeric());\n this.lastNumeric.set(next);\n });\n });\n }\n\n /**\n * Static (non-animated) display string. Numeric values honour `precision`\n * and locale grouping so they match the count-up output; everything else\n * renders verbatim with an em-dash fallback.\n */\n protected readonly displayValue = computed<string>(() => {\n const n = this.numericValue();\n if (n !== null) {\n // A plain decimal string is formatted as it is, the way `wrNumber` does it,\n // so a long amount keeps every digit. `format()` has taken a string since\n // ES2023, though the ES2022 lib types it as a number only.\n const raw = typeof this.value() === 'string' ? String(this.value()).trim() : '';\n return new Intl.NumberFormat(this.locale, {\n minimumFractionDigits: this.precision(),\n maximumFractionDigits: this.precision(),\n }).format(PLAIN_DECIMAL.test(raw) ? (raw as unknown as number) : n);\n }\n // `numericValue` above already reads `''` as \"no value\"; rendering it\n // verbatim put an empty card on screen instead of the placeholder.\n const raw = this.value();\n return raw === null || raw === undefined || raw === '' ? '—' : String(raw);\n });\n\n /**\n * Optional delta vs previous period — shown as `+x.x%` (or `-x.x%`).\n * Use `deltaSuffix` to change the trailing unit.\n */\n readonly delta = input<number | null>(null, {\n transform: (v: unknown): number | null => {\n if (v === null || v === undefined || v === '') return null;\n const n = coerceNumberProperty(v, Number.NaN);\n return Number.isFinite(n) ? n : null;\n },\n });\n\n // The default moved from the literal `'%'` to `null` so the catalog gets a\n // say. `%` is a string the LIBRARY owns and no locale could reach: a locale\n // that writes it differently — or writes it as a word — had nowhere to put\n // that but a per-instance binding on every `<wr-statistic>` on the page. A\n // bound value still wins, exactly as before, which is what makes this safe.\n /** Unit appended to the delta value. Falls back to `statistic.deltaSuffix`, then `'%'`. */\n readonly deltaSuffix = input<string | null>(null);\n\n protected readonly hasDelta = computed(() => this.delta() !== null);\n\n protected readonly deltaDirection = computed<'up' | 'down' | 'flat'>(() => {\n const d = this.delta();\n if (d === null || d === 0) return 'flat';\n return d > 0 ? 'up' : 'down';\n });\n\n protected readonly resolvedDeltaSuffix = useI18nText(this.deltaSuffix, 'statistic.deltaSuffix', '%');\n\n /** `{{value}}{{suffix}}` — the join, so a locale owns the space before the unit. */\n private readonly deltaFormat = useI18nFormatter('statistic.delta', '{{value}}{{suffix}}');\n\n /**\n * The delta chip, e.g. `+12.4%`.\n *\n * It was `` `${sign}${d}${suffix}` ``, printed one line under a value that\n * goes through `Intl.NumberFormat` — so the two disagreed inside one\n * component: ar-SA showed `١٬٢٣٤٬٥٦٧٫٨٩` above a Latin `12.4%`, and de-DE\n * `1.234.567,89` above `+12.4%`. The sign comes from `signDisplay`, which also\n * fixes the RTL half of it: `+` written by hand is a neutral character that\n * the BiDi algorithm moves to the other end of the number.\n *\n * The digit count is taken from the number rather than from `precision()`,\n * which describes the VALUE and not the delta — so what renders is the same\n * digits as before, in the locale's own numerals. One exception, and it is an\n * improvement rather than a regression: a magnitude JavaScript prints in\n * exponent notation (`1e-7`, `1e+21`) used to reach the DOM that way and is\n * now formatted as a number.\n */\n protected readonly deltaText = computed(() => {\n const d = this.delta();\n if (d === null) return '';\n const decimals = Math.min(20, (String(Math.abs(d)).split('.')[1] ?? '').length);\n const value = new Intl.NumberFormat(this.locale, {\n signDisplay: 'exceptZero',\n minimumFractionDigits: decimals,\n maximumFractionDigits: decimals,\n }).format(d);\n return this.deltaFormat({ value, suffix: this.resolvedDeltaSuffix() });\n });\n}\n","@if (label()) {\n <div class=\"wr-statistic__label\">{{ label() }}</div>\n}\n<div class=\"wr-statistic__value\">\n @if (prefix()) {\n <span class=\"wr-statistic__prefix\">{{ prefix() }}</span>\n }\n @if (animated()) {\n <wr-count-up\n class=\"wr-statistic__number\"\n [from]=\"animateFrom()\"\n [to]=\"numericValue() ?? 0\"\n [decimals]=\"precision()\"\n [duration]=\"duration()\"\n />\n } @else {\n <span class=\"wr-statistic__number\">{{ displayValue() }}</span>\n }\n @if (suffix()) {\n <span class=\"wr-statistic__suffix\">{{ suffix() }}</span>\n }\n</div>\n@if (hasDelta()) {\n <div [class]=\"`wr-statistic__delta wr-statistic__delta--${deltaDirection()}`\">\n @if (deltaDirection() === 'up') {\n <svg width=\"10\" height=\"10\" viewBox=\"0 0 10 10\" aria-hidden=\"true\">\n <path d=\"M5 1 L9 8 L1 8 Z\" fill=\"currentColor\" />\n </svg>\n } @else if (deltaDirection() === 'down') {\n <svg width=\"10\" height=\"10\" viewBox=\"0 0 10 10\" aria-hidden=\"true\">\n <path d=\"M5 9 L9 2 L1 2 Z\" fill=\"currentColor\" />\n </svg>\n }\n <span>{{ deltaText() }}</span>\n </div>\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 { isPlatformBrowser } from '@angular/common';\nimport {\n Component,\n PLATFORM_ID,\n ViewEncapsulation,\n computed,\n effect,\n inject,\n input,\n output,\n signal,\n} from '@angular/core';\n\nimport { type WrDurationUnit, wrSplitDuration } from 'ngwr/pipes';\nimport { numAttr, wrCheckStyles } from 'ngwr/utils';\n\n// Helpers\n\nfunction toMs(value: Date | string | number): number {\n if (value instanceof Date) return value.getTime();\n if (typeof value === 'number') return value;\n return new Date(value).getTime();\n}\n\nfunction pad(n: number, width: number): string {\n return String(n).padStart(width, '0');\n}\n\n/**\n * The format's tokens, longest first inside the alternation so `DD` beats `D`,\n * `HH` beats `H`, `mm` beats `m` and `SSS` beats `ss` beats `s`. Matched in one pass\n * so the output is never re-scanned: a sequential `.replace()` chain turned\n * `D days HH:mm:ss` into `1 day42 11:59:42`, its last `/s/g` step re-matching the\n * literal `s` inside `days`.\n */\nconst TOKEN = /(?<![A-Za-z])(?:SSS|DD|HH|mm|ss|D|H|m|s)(?![A-Za-z])/g;\n\n/** The unit each token's letter stands for. */\nconst UNIT_OF: Readonly<Record<string, WrDurationUnit>> = {\n D: 'day',\n H: 'hour',\n m: 'minute',\n s: 'second',\n S: 'millisecond',\n};\n\n/**\n * A unit the format does not show is carried into the next larger one it does:\n * `HH:mm:ss` with three days left reads `73:00:00`. Every unit was taken modulo\n * the next one whatever the format held, so the default format dropped whole days\n * and showed `00:59:59` for three days and an hour. The split itself is\n * `wrSplitDuration`, shared with `wrDuration`.\n */\nfunction formatRemaining(ms: number, fmt: string): string {\n const shown = new Set((fmt.match(TOKEN) ?? []).map(token => UNIT_OF[token[0]]));\n const value = wrSplitDuration(ms, shown);\n return fmt.replace(TOKEN, token => {\n const n = value[UNIT_OF[token[0]]] ?? 0;\n return token === 'SSS' ? pad(n, 3) : token.length === 2 ? pad(n, 2) : String(n);\n });\n}\n\n/**\n * Live-counting variant of `<wr-statistic>` that targets a future date\n * and ticks down to zero. The format string uses Day/Hour/Minute/Second\n * tokens (`D`, `H`, `m`, `s`, double for zero-padded, plus `SSS` for\n * milliseconds).\n *\n * @example\n * ```html\n * <wr-statistic-countdown\n * label=\"Launch in\"\n * [target]=\"launchDate\"\n * format=\"D days HH:mm:ss\"\n * (countdownEnd)=\"onLive()\"\n * />\n * ```\n *\n * @see https://ngwr.dev/reference/components/statistic\n */\n@Component({\n selector: 'wr-statistic-countdown',\n templateUrl: './statistic-countdown.html',\n encapsulation: ViewEncapsulation.None,\n host: { class: 'wr-statistic' },\n})\nexport class WrStatisticCountdown {\n /** Target date / timestamp the countdown is running down to. */\n readonly target = input.required<Date | string | number>();\n\n /** Label rendered above the value. */\n readonly label = input<string>('');\n\n /**\n * Format string. Tokens: `D`/`DD` (days), `H`/`HH` (hours),\n * `m`/`mm` (minutes), `s`/`ss` (seconds), `SSS` (milliseconds).\n * Double-letter forms zero-pad to width 2. A unit the format leaves out is\n * carried into the next larger one it shows, so `HH:mm:ss` reads `73:00:00`\n * with three days and an hour left. @default 'HH:mm:ss'\n */\n readonly format = input<string>('HH:mm:ss');\n\n /** Optional text shown once the countdown reaches zero. */\n readonly endText = input<string | null>(null);\n\n /**\n * Tick interval in ms. Drop to ~16 for `SSS` (millisecond display). Floored\n * at one frame — `0` (or an unparseable value) asked `setInterval` to run as\n * fast as the browser would allow, which is a busy loop, not a countdown.\n * @default 1000\n */\n readonly tickMs = input(1000, { transform: (v: unknown): number => Math.max(16, numAttr(1000)(v)) });\n\n /** Fires once when the countdown crosses zero. */\n readonly countdownEnd = output<void>();\n\n private readonly isBrowser = isPlatformBrowser(inject(PLATFORM_ID));\n\n private readonly targetMs = computed(() => toMs(this.target()));\n\n /**\n * Milliseconds left, or `null` when `target` does not parse to a date at all.\n * `new Date('nope').getTime()` is `NaN`, and `NaN` propagated all the way to\n * the screen as `NaN:NaN:NaN` — and, worse, `tick` compared it to `0` and so\n * never fired `countdownEnd`, while a guard that only clamped the text would\n * have fired it immediately for a target that was never reached.\n */\n private remainingMs(): number | null {\n const target = this.targetMs();\n return Number.isFinite(target) ? Math.max(0, target - Date.now()) : null;\n }\n\n /** Remaining milliseconds (live signal). */\n protected readonly remaining = signal(0);\n protected readonly finished = signal(false);\n\n protected readonly display = computed(() => {\n if (this.finished() && this.endText() != null) return this.endText()!;\n return formatRemaining(this.remaining(), this.format());\n });\n\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('statistic');\n // Seed once synchronously so SSR / first paint shows a sane value.\n effect(() => {\n const ms = this.remainingMs();\n this.remaining.set(ms ?? 0);\n this.finished.set(ms === 0);\n });\n\n if (!this.isBrowser) return;\n\n // The interval is REBUILT when `tickMs` changes, which is what makes the\n // input bindable rather than an authoring-time constant. Read once from\n // inside `afterNextRender` it was a plain, untracked read, so\n // `[tickMs]=\"precise() ? 16 : 1000\"` kept whatever period the first frame\n // saw and nothing looked wrong — the countdown still counted. Same shape\n // `wr-rotating-text` uses for its own rotation period; the `onCleanup` is\n // what keeps a period change from leaving the old interval running beside\n // the new one.\n effect(onCleanup => {\n const handle = setInterval(() => this.tick(), this.tickMs());\n onCleanup(() => clearInterval(handle));\n });\n }\n\n private tick(): void {\n const ms = this.remainingMs();\n if (ms === null) return;\n this.remaining.set(ms);\n if (ms === 0 && !this.finished()) {\n this.finished.set(true);\n this.countdownEnd.emit();\n }\n }\n}\n","@if (label()) {\n <div class=\"wr-statistic__label\">{{ label() }}</div>\n}\n<div class=\"wr-statistic__value\">\n <span class=\"wr-statistic__number\">{{ display() }}</span>\n</div>\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { coerceNumberProperty } from '@angular/cdk/coercion';\nimport { Component, ViewEncapsulation, input } from '@angular/core';\n\nimport { wrCheckStyles } from 'ngwr/utils';\n\n/**\n * Dashboard grid for `<wr-statistic>` cards. The column count follows the\n * group's OWN width — an intrinsic container-query grid sized by its box, not\n * a viewport media query — so it reflows correctly inside any column, card, or\n * split pane. Columns are never narrower than `min`; `columns` optionally caps\n * how many ever sit side by side on a wide container.\n *\n * @example\n * ```html\n * <wr-statistic-group [columns]=\"4\" min=\"11rem\">\n * <wr-statistic label=\"Active users\" [value]=\"12345\" />\n * <wr-statistic label=\"Revenue\" [value]=\"9512\" prefix=\"$\" [delta]=\"12.4\" />\n * <wr-statistic label=\"Churn\" [value]=\"1.8\" suffix=\"%\" [delta]=\"-0.4\" />\n * <wr-statistic label=\"Sessions\" [value]=\"48210\" />\n * </wr-statistic-group>\n * ```\n *\n * @see https://ngwr.dev/reference/components/statistic\n */\n@Component({\n selector: 'wr-statistic-group',\n template: '<div class=\"wr-statistic-group__grid\"><ng-content /></div>',\n encapsulation: ViewEncapsulation.None,\n host: {\n class: 'wr-statistic-group',\n '[style.--wr-statistic-group-min]': 'min()',\n '[style.--wr-statistic-group-columns]': 'columns() || null',\n },\n})\nexport class WrStatisticGroup {\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('statistic');\n }\n\n /**\n * Minimum width of each column before the grid reflows to fewer columns.\n * Any CSS length — smaller packs more cards per row. @default '12rem'\n */\n readonly min = input<string>('12rem');\n\n /**\n * Cap on how many columns ever sit side by side on a wide container. `0`\n * (default) leaves it uncapped — fit as many `min`-wide columns as the\n * width allows. @default 0\n */\n readonly columns = input(0, { transform: (v: unknown): number => Math.max(0, coerceNumberProperty(v, 0)) });\n}\n"],"mappings":";;;;;;;;;;;;;;;AA0BA,MAAM,gBAAgB;AA0BtB,IAAa,cAAb,MAAa,YAAW;CACL,W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cAAc,WAAW;CAC9E;CAMS,MAAM,MAAc,SAAQ,GAAA,YAAA,CAAA,EAAA,WAAA,MAAA,CAAA,+BAAA,CAAA,CAAA;CAO5B,UAAU,MAAM,GAAC;EAAA,GAAA,YAAA,EAAA,WAAA,UAAA,+BAAA,CAAA;EAAI,YAAY,MAAuB,KAAK,IAAI,GAAG,qBAAqB,GAAG,CAAC,CAAC;CAAC,CAAA;CAhB7F,OAAA,OAAA,GAAA,mBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,UAAA;EAAA,MAAA;EAAgB,MAAA,CAAA;EAAA,QAAA,GAAA,gBAAA;CAAA,CAAA;CAAhB,OAAA,OAAA,GAAA,qBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,MAAA;EAAgB,cAAA;EAAA,UAAA;EAAA,QAAA;GAAA,KAAA;IAAA,mBAAA;IAAA,YAAA;IAAA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;GAAA,SAAA;IAAA,mBAAA;IAAA,YAAA;IAAA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;EAAA;EAAA,MAAA;GAAA,YAAA;IAAA,kCAAA;IAAA,sCAAA;GAAA;GAAA,gBAAA;EAAA;EAAA,UAAA;EAAA,UARjB;EAA4D,UAAA;EAAA,eAAA,GAAA,kBAAA;CAAA,CAAA;;AAQ3D,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAgB,YAAA,CAAA;EAV5B,MAAA;EAAU,MAAA,CAAA;GACT,UAAU;GACV,UAAU;GACV,eAAe,kBAAkB;GACjC,MAAM;IACJ,OAAO;IACP,oCAAoC;IACpC,wCAAwC;GACzC;EACF,CAAA"}
1
+ {"version":3,"file":"ngwr-statistic.mjs","names":[],"sources":["../../../projects/lib/statistic/statistic.ts","../../../projects/lib/statistic/statistic.html","../../../projects/lib/statistic/statistic-countdown.ts","../../../projects/lib/statistic/statistic-countdown.html","../../../projects/lib/statistic/statistic-group.ts"],"sourcesContent":["/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { coerceBooleanProperty, coerceNumberProperty } from '@angular/cdk/coercion';\nimport {\n Component,\n LOCALE_ID,\n ViewEncapsulation,\n computed,\n effect,\n inject,\n input,\n signal,\n untracked,\n} from '@angular/core';\n\nimport { WrCountUp } from 'ngwr/counter';\nimport { useI18nFormatter, useI18nText } from 'ngwr/i18n';\nimport { WrPlatform } from 'ngwr/platform';\nimport { wrNumAttr, wrCheckStyles } from 'ngwr/utils';\n\n/** Digits with one optional point and a sign: the form `Intl` reads exactly. */\nconst PLAIN_DECIMAL = /^[+-]?(?:\\d+\\.?\\d*|\\.\\d+)$/;\n\n/**\n * KPI card — label + big number + optional prefix/suffix + delta. Pair\n * with `<wr-statistic-group>` for a responsive dashboard grid.\n *\n * When `value` is numeric the number counts up (eased) from its previous\n * value to the new one on every change — see `animate`. String values and\n * `prefers-reduced-motion` render instantly.\n *\n * @example\n * ```html\n * <wr-statistic label=\"Active users\" [value]=\"12345\" suffix=\"users\" />\n * <wr-statistic label=\"Revenue\" [value]=\"9512\" prefix=\"$\" [delta]=\"12.4\" />\n * <wr-statistic label=\"Churn\" [value]=\"1.8\" suffix=\"%\" [precision]=\"1\" />\n * ```\n *\n * @see https://ngwr.dev/reference/components/statistic\n */\n@Component({\n selector: 'wr-statistic',\n templateUrl: './statistic.html',\n encapsulation: ViewEncapsulation.None,\n host: { class: 'wr-statistic' },\n imports: [WrCountUp],\n})\nexport class WrStatistic {\n private readonly platform = inject(WrPlatform);\n private readonly locale = inject(LOCALE_ID);\n\n /**\n * The caption above the figure — what the number counts. Keep it short; the\n * value is the thing being read, and this names it.\n */\n readonly label = input<string>('');\n\n /** The number (or string) to display in the main slot. */\n readonly value = input<number | string | null>(null);\n\n /** Prefix glyph / symbol (e.g. `'$'`). */\n readonly prefix = input<string>('');\n\n /** Suffix glyph / unit (e.g. `'%'`, `'kg'`). */\n readonly suffix = input<string>('');\n\n /** Fixed number of decimals applied to numeric values. @default 0 */\n readonly precision = input(0, { transform: (v: unknown): number => Math.max(0, coerceNumberProperty(v, 0)) });\n\n /**\n * Count up to a new numeric `value` instead of swapping instantly. Always\n * off for string values or under `prefers-reduced-motion`. @default true\n */\n readonly animate = input(true, { transform: coerceBooleanProperty });\n\n /** Count-up duration (ms). @default 700 */\n readonly duration = input(700, { transform: wrNumAttr(700) });\n\n /**\n * The current value coerced to a finite number, or `null` when `value` is\n * a non-numeric string / empty / nullish (rendered as-is).\n */\n protected readonly numericValue = computed<number | null>(() => {\n const raw = this.value();\n if (raw === null || raw === '') return null;\n const n = typeof raw === 'number' ? raw : coerceNumberProperty(raw, Number.NaN);\n return Number.isFinite(n) ? n : null;\n });\n\n /** Whether the value should count up (browser, numeric, opted-in, motion allowed). */\n protected readonly animated = computed<boolean>(\n () =>\n this.platform.isBrowser &&\n this.animate() &&\n !this.platform.prefersReducedMotion() &&\n typeof this.value() === 'number' &&\n this.numericValue() !== null\n );\n\n /** Animation start — the previously-rendered numeric value (0 on first paint). */\n protected readonly animateFrom = signal(0);\n\n /** Bookkeeping: the last numeric value seen, fed back as the next `from`. */\n private readonly lastNumeric = signal(0);\n\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('statistic');\n // Whenever the numeric value changes, snapshot the prior value as the\n // count-up start, then remember the new one for the next transition.\n effect(() => {\n const next = this.numericValue();\n if (next === null) return;\n untracked(() => {\n this.animateFrom.set(this.lastNumeric());\n this.lastNumeric.set(next);\n });\n });\n }\n\n /**\n * Static (non-animated) display string. Numeric values honour `precision`\n * and locale grouping so they match the count-up output; everything else\n * renders verbatim with an em-dash fallback.\n */\n protected readonly displayValue = computed<string>(() => {\n const n = this.numericValue();\n if (n !== null) {\n // A plain decimal string is formatted as it is, the way `wrNumber` does it,\n // so a long amount keeps every digit. `format()` has taken a string since\n // ES2023, though the ES2022 lib types it as a number only.\n const raw = typeof this.value() === 'string' ? String(this.value()).trim() : '';\n return new Intl.NumberFormat(this.locale, {\n minimumFractionDigits: this.precision(),\n maximumFractionDigits: this.precision(),\n }).format(PLAIN_DECIMAL.test(raw) ? (raw as unknown as number) : n);\n }\n // `numericValue` above already reads `''` as \"no value\"; rendering it\n // verbatim put an empty card on screen instead of the placeholder.\n const raw = this.value();\n return raw === null || raw === undefined || raw === '' ? '—' : String(raw);\n });\n\n /**\n * Optional delta vs previous period — shown as `+x.x%` (or `-x.x%`).\n * Use `deltaSuffix` to change the trailing unit.\n */\n readonly delta = input<number | null>(null, {\n transform: (v: unknown): number | null => {\n if (v === null || v === undefined || v === '') return null;\n const n = coerceNumberProperty(v, Number.NaN);\n return Number.isFinite(n) ? n : null;\n },\n });\n\n // The default moved from the literal `'%'` to `null` so the catalog gets a\n // say. `%` is a string the LIBRARY owns and no locale could reach: a locale\n // that writes it differently — or writes it as a word — had nowhere to put\n // that but a per-instance binding on every `<wr-statistic>` on the page. A\n // bound value still wins, exactly as before, which is what makes this safe.\n /** Unit appended to the delta value. Falls back to `statistic.deltaSuffix`, then `'%'`. */\n readonly deltaSuffix = input<string | null>(null);\n\n protected readonly hasDelta = computed(() => this.delta() !== null);\n\n protected readonly deltaDirection = computed<'up' | 'down' | 'flat'>(() => {\n const d = this.delta();\n if (d === null || d === 0) return 'flat';\n return d > 0 ? 'up' : 'down';\n });\n\n protected readonly resolvedDeltaSuffix = useI18nText(this.deltaSuffix, 'statistic.deltaSuffix', '%');\n\n /** `{{value}}{{suffix}}` — the join, so a locale owns the space before the unit. */\n private readonly deltaFormat = useI18nFormatter('statistic.delta', '{{value}}{{suffix}}');\n\n /**\n * The delta chip, e.g. `+12.4%`.\n *\n * It was `` `${sign}${d}${suffix}` ``, printed one line under a value that\n * goes through `Intl.NumberFormat` — so the two disagreed inside one\n * component: ar-SA showed `١٬٢٣٤٬٥٦٧٫٨٩` above a Latin `12.4%`, and de-DE\n * `1.234.567,89` above `+12.4%`. The sign comes from `signDisplay`, which also\n * fixes the RTL half of it: `+` written by hand is a neutral character that\n * the BiDi algorithm moves to the other end of the number.\n *\n * The digit count is taken from the number rather than from `precision()`,\n * which describes the VALUE and not the delta — so what renders is the same\n * digits as before, in the locale's own numerals. One exception, and it is an\n * improvement rather than a regression: a magnitude JavaScript prints in\n * exponent notation (`1e-7`, `1e+21`) used to reach the DOM that way and is\n * now formatted as a number.\n */\n protected readonly deltaText = computed(() => {\n const d = this.delta();\n if (d === null) return '';\n const decimals = Math.min(20, (String(Math.abs(d)).split('.')[1] ?? '').length);\n const value = new Intl.NumberFormat(this.locale, {\n signDisplay: 'exceptZero',\n minimumFractionDigits: decimals,\n maximumFractionDigits: decimals,\n }).format(d);\n return this.deltaFormat({ value, suffix: this.resolvedDeltaSuffix() });\n });\n}\n","@if (label()) {\n <div class=\"wr-statistic__label\">{{ label() }}</div>\n}\n<div class=\"wr-statistic__value\">\n @if (prefix()) {\n <span class=\"wr-statistic__prefix\">{{ prefix() }}</span>\n }\n @if (animated()) {\n <wr-count-up\n class=\"wr-statistic__number\"\n [from]=\"animateFrom()\"\n [to]=\"numericValue() ?? 0\"\n [decimals]=\"precision()\"\n [duration]=\"duration()\"\n />\n } @else {\n <span class=\"wr-statistic__number\">{{ displayValue() }}</span>\n }\n @if (suffix()) {\n <span class=\"wr-statistic__suffix\">{{ suffix() }}</span>\n }\n</div>\n@if (hasDelta()) {\n <div [class]=\"`wr-statistic__delta wr-statistic__delta--${deltaDirection()}`\">\n @if (deltaDirection() === 'up') {\n <svg width=\"10\" height=\"10\" viewBox=\"0 0 10 10\" aria-hidden=\"true\">\n <path d=\"M5 1 L9 8 L1 8 Z\" fill=\"currentColor\" />\n </svg>\n } @else if (deltaDirection() === 'down') {\n <svg width=\"10\" height=\"10\" viewBox=\"0 0 10 10\" aria-hidden=\"true\">\n <path d=\"M5 9 L9 2 L1 2 Z\" fill=\"currentColor\" />\n </svg>\n }\n <span>{{ deltaText() }}</span>\n </div>\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 { isPlatformBrowser } from '@angular/common';\nimport {\n Component,\n PLATFORM_ID,\n ViewEncapsulation,\n computed,\n effect,\n inject,\n input,\n output,\n signal,\n untracked,\n} from '@angular/core';\n\nimport { type WrDurationUnit, wrSplitDuration } from 'ngwr/pipes';\nimport { wrNumAttr, wrCheckStyles } from 'ngwr/utils';\n\n// Helpers\n\nfunction toMs(value: Date | string | number): number {\n if (value instanceof Date) return value.getTime();\n if (typeof value === 'number') return value;\n return new Date(value).getTime();\n}\n\nfunction pad(n: number, width: number): string {\n return String(n).padStart(width, '0');\n}\n\n/**\n * The format's tokens, longest first inside the alternation so `DD` beats `D`,\n * `HH` beats `H`, `mm` beats `m` and `SSS` beats `ss` beats `s`. Matched in one pass\n * so the output is never re-scanned: a sequential `.replace()` chain turned\n * `D days HH:mm:ss` into `1 day42 11:59:42`, its last `/s/g` step re-matching the\n * literal `s` inside `days`.\n */\nconst TOKEN = /(?<![A-Za-z])(?:SSS|DD|HH|mm|ss|D|H|m|s)(?![A-Za-z])/g;\n\n/** The unit each token's letter stands for. */\nconst UNIT_OF: Readonly<Record<string, WrDurationUnit>> = {\n D: 'day',\n H: 'hour',\n m: 'minute',\n s: 'second',\n S: 'millisecond',\n};\n\n/**\n * A unit the format does not show is carried into the next larger one it does:\n * `HH:mm:ss` with three days left reads `73:00:00`. Every unit was taken modulo\n * the next one whatever the format held, so the default format dropped whole days\n * and showed `00:59:59` for three days and an hour. The split itself is\n * `wrSplitDuration`, shared with `wrDuration`.\n */\nfunction formatRemaining(ms: number, fmt: string): string {\n const shown = new Set((fmt.match(TOKEN) ?? []).map(token => UNIT_OF[token[0]]));\n const value = wrSplitDuration(ms, shown);\n return fmt.replace(TOKEN, token => {\n const n = value[UNIT_OF[token[0]]] ?? 0;\n return token === 'SSS' ? pad(n, 3) : token.length === 2 ? pad(n, 2) : String(n);\n });\n}\n\n/**\n * Live-counting variant of `<wr-statistic>` that targets a future date\n * and ticks down to zero. The format string uses Day/Hour/Minute/Second\n * tokens (`D`, `H`, `m`, `s`, double for zero-padded, plus `SSS` for\n * milliseconds).\n *\n * @example\n * ```html\n * <wr-statistic-countdown\n * label=\"Launch in\"\n * [target]=\"launchDate\"\n * format=\"D days HH:mm:ss\"\n * (countdownEnd)=\"onLive()\"\n * />\n * ```\n *\n * @see https://ngwr.dev/reference/components/statistic\n */\n@Component({\n selector: 'wr-statistic-countdown',\n templateUrl: './statistic-countdown.html',\n encapsulation: ViewEncapsulation.None,\n host: { class: 'wr-statistic' },\n})\nexport class WrStatisticCountdown {\n /** Target date / timestamp the countdown is running down to. */\n readonly target = input.required<Date | string | number>();\n\n /** Label rendered above the value. */\n readonly label = input<string>('');\n\n /**\n * Format string. Tokens: `D`/`DD` (days), `H`/`HH` (hours),\n * `m`/`mm` (minutes), `s`/`ss` (seconds), `SSS` (milliseconds).\n * Double-letter forms zero-pad to width 2. A unit the format leaves out is\n * carried into the next larger one it shows, so `HH:mm:ss` reads `73:00:00`\n * with three days and an hour left. @default 'HH:mm:ss'\n */\n readonly format = input<string>('HH:mm:ss');\n\n /** Optional text shown once the countdown reaches zero. */\n readonly endText = input<string | null>(null);\n\n /**\n * Tick interval in ms. Drop to ~16 for `SSS` (millisecond display). Floored\n * at one frame — `0` (or an unparseable value) asked `setInterval` to run as\n * fast as the browser would allow, which is a busy loop, not a countdown.\n * @default 1000\n */\n readonly tickMs = input(1000, { transform: (v: unknown): number => Math.max(16, wrNumAttr(1000)(v)) });\n\n /**\n * Fires once for each target that is reached, or that has already passed when\n * it is set, mount included, so an app reloaded after expiry still hears it.\n * A new future target counts down again and fires again.\n */\n readonly countdownEnd = output<void>();\n\n private readonly isBrowser = isPlatformBrowser(inject(PLATFORM_ID));\n\n private readonly targetMs = computed(() => toMs(this.target()));\n\n /**\n * Milliseconds left, or `null` when `target` does not parse to a date at all.\n * `new Date('nope').getTime()` is `NaN`, and `NaN` propagated all the way to\n * the screen as `NaN:NaN:NaN` — and, worse, `tick` compared it to `0` and so\n * never fired `countdownEnd`, while a guard that only clamped the text would\n * have fired it immediately for a target that was never reached.\n */\n private remainingMs(): number | null {\n const target = this.targetMs();\n return Number.isFinite(target) ? Math.max(0, target - Date.now()) : null;\n }\n\n /** Remaining milliseconds (live signal). */\n protected readonly remaining = signal(0);\n protected readonly finished = signal(false);\n\n protected readonly display = computed(() => {\n if (this.finished() && this.endText() != null) return this.endText()!;\n return formatRemaining(this.remaining(), this.format());\n });\n\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('statistic');\n // Seed once synchronously so SSR / first paint shows a sane value.\n effect(() => {\n const ms = this.remainingMs();\n this.remaining.set(ms ?? 0);\n this.finished.set(ms === 0);\n // A target already past never crosses zero in `tick`, so it ends here.\n if (ms === 0) untracked(() => this.countdownEnd.emit());\n });\n\n if (!this.isBrowser) return;\n\n // The interval is REBUILT when `tickMs` changes, which is what makes the\n // input bindable rather than an authoring-time constant. Read once from\n // inside `afterNextRender` it was a plain, untracked read, so\n // `[tickMs]=\"precise() ? 16 : 1000\"` kept whatever period the first frame\n // saw and nothing looked wrong — the countdown still counted. Same shape\n // `wr-rotating-text` uses for its own rotation period; the `onCleanup` is\n // what keeps a period change from leaving the old interval running beside\n // the new one.\n effect(onCleanup => {\n if (this.finished()) return;\n const handle = setInterval(() => this.tick(), this.tickMs());\n onCleanup(() => clearInterval(handle));\n });\n }\n\n private tick(): void {\n const ms = this.remainingMs();\n if (ms === null) return;\n this.remaining.set(ms);\n if (ms === 0 && !this.finished()) {\n this.finished.set(true);\n this.countdownEnd.emit();\n }\n }\n}\n","@if (label()) {\n <div class=\"wr-statistic__label\">{{ label() }}</div>\n}\n<div class=\"wr-statistic__value\">\n <span class=\"wr-statistic__number\">{{ display() }}</span>\n</div>\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { coerceNumberProperty } from '@angular/cdk/coercion';\nimport { Component, ViewEncapsulation, input } from '@angular/core';\n\nimport { wrCheckStyles } from 'ngwr/utils';\n\n/**\n * Dashboard grid for `<wr-statistic>` cards. The column count follows the\n * group's OWN width — an intrinsic container-query grid sized by its box, not\n * a viewport media query — so it reflows correctly inside any column, card, or\n * split pane. Columns are never narrower than `min`; `columns` optionally caps\n * how many ever sit side by side on a wide container.\n *\n * @example\n * ```html\n * <wr-statistic-group [columns]=\"4\" min=\"11rem\">\n * <wr-statistic label=\"Active users\" [value]=\"12345\" />\n * <wr-statistic label=\"Revenue\" [value]=\"9512\" prefix=\"$\" [delta]=\"12.4\" />\n * <wr-statistic label=\"Churn\" [value]=\"1.8\" suffix=\"%\" [delta]=\"-0.4\" />\n * <wr-statistic label=\"Sessions\" [value]=\"48210\" />\n * </wr-statistic-group>\n * ```\n *\n * @see https://ngwr.dev/reference/components/statistic\n */\n@Component({\n selector: 'wr-statistic-group',\n template: '<div class=\"wr-statistic-group__grid\"><ng-content /></div>',\n encapsulation: ViewEncapsulation.None,\n host: {\n class: 'wr-statistic-group',\n '[style.--wr-statistic-group-min]': 'min()',\n '[style.--wr-statistic-group-columns]': 'columns() || null',\n },\n})\nexport class WrStatisticGroup {\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('statistic');\n }\n\n /**\n * Minimum width of each column before the grid reflows to fewer columns.\n * Any CSS length — smaller packs more cards per row. @default '12rem'\n */\n readonly min = input<string>('12rem');\n\n /**\n * Cap on how many columns ever sit side by side on a wide container. `0`\n * (default) leaves it uncapped — fit as many `min`-wide columns as the\n * width allows. @default 0\n */\n readonly columns = input(0, { transform: (v: unknown): number => Math.max(0, coerceNumberProperty(v, 0)) });\n}\n"],"mappings":";;;;;;;;;;;;;;;AA0BA,MAAM,gBAAgB;AA0BtB,IAAa,cAAb,MAAa,YAAW;CACL,WAAW,OAAO,UAAU;CAC5B,SAAS,OA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AgB;CAC3B,cAAA;EACE,IAAI,OAAO,cAAc,eAAe,WAAW,cAAc,WAAW;CAC9E;CAMS,MAAM,MAAc,SAAQ,GAAA,YAAA,CAAA,EAAA,WAAA,MAAA,CAAA,+BAAA,CAAA,CAAA;CAO5B,UAAU,MAAM,GAAC;EAAA,GAAA,YAAA,EAAA,WAAA,UAAA,+BAAA,CAAA;EAAI,YAAY,MAAuB,KAAK,IAAI,GAAG,qBAAqB,GAAG,CAAC,CAAC;CAAC,CAAA;CAhB7F,OAAA,OAAA,GAAA,mBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,UAAA;EAAA,MAAA;EAAgB,MAAA,CAAA;EAAA,QAAA,GAAA,gBAAA;CAAA,CAAA;CAAhB,OAAA,OAAA,GAAA,qBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,MAAA;EAAgB,cAAA;EAAA,UAAA;EAAA,QAAA;GAAA,KAAA;IAAA,mBAAA;IAAA,YAAA;IAAA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;GAAA,SAAA;IAAA,mBAAA;IAAA,YAAA;IAAA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;EAAA;EAAA,MAAA;GAAA,YAAA;IAAA,kCAAA;IAAA,sCAAA;GAAA;GAAA,gBAAA;EAAA;EAAA,UAAA;EAAA,UARjB;EAA4D,UAAA;EAAA,eAAA,GAAA,kBAAA;CAAA,CAAA;;AAQ3D,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAgB,YAAA,CAAA;EAV5B,MAAA;EAAU,MAAA,CAAA;GACT,UAAU;GACV,UAAU;GACV,eAAe,kBAAkB;GACjC,MAAM;IACJ,OAAO;IACP,oCAAoC;IACpC,wCAAwC;GACzC;EACF,CAAA"}
@@ -33,7 +33,7 @@ function probe(engine) {
33
33
  return false;
34
34
  }
35
35
  }
36
- function createMemoryStorage() {
36
+ function wrCreateMemoryStorage() {
37
37
  const map = /* @__PURE__ */ new Map();
38
38
  return {
39
39
  get length() {
@@ -59,8 +59,10 @@ function createMemoryStorage() {
59
59
  const WR_STORAGE_ENGINE = new InjectionToken("WR_STORAGE_ENGINE", {
60
60
  providedIn: "root",
61
61
  factory: () => {
62
- if (typeof localStorage === "undefined") return createMemoryStorage();
63
- return probe(localStorage) ? localStorage : createMemoryStorage();
62
+ try {
63
+ if (typeof localStorage !== "undefined" && probe(localStorage)) return localStorage;
64
+ } catch {}
65
+ return wrCreateMemoryStorage();
64
66
  }
65
67
  });
66
68
  /**
@@ -251,6 +253,6 @@ function withStorage(options = {}) {
251
253
  });
252
254
  return wrFeature("storage", providers);
253
255
  }
254
- export { DEFAULT_WR_STORAGE_CONFIG, WR_STORAGE_CONFIG, WR_STORAGE_ENGINE, WrStorage, createMemoryStorage, withStorage };
256
+ export { DEFAULT_WR_STORAGE_CONFIG, WR_STORAGE_CONFIG, WR_STORAGE_ENGINE, WrStorage, withStorage, wrCreateMemoryStorage };
255
257
 
256
258
  //# sourceMappingURL=ngwr-storage.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"ngwr-storage.mjs","names":[],"sources":["../../../projects/lib/storage/storage-config.ts","../../../projects/lib/storage/storage-engine.ts","../../../projects/lib/storage/storage.ts","../../../projects/lib/storage/with-storage.ts"],"sourcesContent":["/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { InjectionToken } from '@angular/core';\n\nimport type { WrStorageConfigResolved } from './types';\n\nexport const DEFAULT_WR_STORAGE_CONFIG: WrStorageConfigResolved = {\n prefix: '',\n json: true,\n ttl: 0,\n};\n\nexport const WR_STORAGE_CONFIG = new InjectionToken<WrStorageConfigResolved>('WR_STORAGE_CONFIG', {\n providedIn: 'root',\n factory: () => DEFAULT_WR_STORAGE_CONFIG,\n});\n\nexport type { WrStorageConfig, WrStorageConfigResolved } from './types';\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { InjectionToken } from '@angular/core';\n\nimport type { WrStorageEngine } from './types';\n\n/**\n * Probe a `Storage` candidate to confirm it's writable. Safari private\n * mode, disabled cookies, and storage-blocked iframes all throw on\n * `setItem` — fall back to memory in those cases.\n */\nfunction probe(engine: WrStorageEngine): boolean {\n try {\n const k = '__wr_storage_probe__';\n engine.setItem(k, '1');\n engine.removeItem(k);\n return true;\n } catch {\n return false;\n }\n}\n\n/**\n * In-memory implementation of `Storage`. Used as the SSR / private-mode\n * fallback. Exported so consumers can opt into it explicitly for tests.\n */\nexport function createMemoryStorage(): WrStorageEngine {\n const map = new Map<string, string>();\n return {\n get length(): number {\n return map.size;\n },\n clear(): void {\n map.clear();\n },\n getItem(key: string): string | null {\n return map.has(key) ? map.get(key)! : null;\n },\n key(i: number): string | null {\n return Array.from(map.keys())[i] ?? null;\n },\n removeItem(key: string): void {\n map.delete(key);\n },\n setItem(key: string, value: string): void {\n map.set(key, value);\n },\n };\n}\n\n/**\n * Injection token for the active storage engine. Provide it at BOOTSTRAP to\n * swap engines (e.g. `sessionStorage` for a tab-only app):\n *\n * ```ts\n * providers: [{ provide: WR_STORAGE_ENGINE, useValue: sessionStorage }]\n * ```\n *\n * Not at an arbitrary injector level: `WrStorage` is root-provided and reads\n * the token in a field initializer, so the singleton resolves its engine once\n * and a token re-provided on a lazy route or in a component's `providers`\n * reaches no existing `inject(WrStorage)` — every read and write still goes to\n * the engine the root instance already took, with nothing thrown and nothing\n * logged. A feature that genuinely needs its own engine provides its own\n * `WrStorage` beside it.\n *\n * The default factory returns `localStorage` in the browser when it's\n * actually writable, an in-memory map otherwise.\n */\nexport const WR_STORAGE_ENGINE = new InjectionToken<WrStorageEngine>('WR_STORAGE_ENGINE', {\n providedIn: 'root',\n factory: () => {\n if (typeof localStorage === 'undefined') return createMemoryStorage();\n return probe(localStorage) ? localStorage : createMemoryStorage();\n },\n});\n\nexport type { WrStorageEngine } from './types';\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 { isPlatformBrowser } from '@angular/common';\nimport {\n DestroyRef,\n Service,\n PLATFORM_ID,\n type Signal,\n type WritableSignal,\n inject,\n signal,\n untracked,\n} from '@angular/core';\n\nimport { WR_STORAGE_CONFIG } from './storage-config';\nimport { WR_STORAGE_ENGINE } from './storage-engine';\nimport type { WrStorageEnvelope } from './types';\n\nfunction isEnvelope(x: unknown): x is WrStorageEnvelope {\n return x !== null && typeof x === 'object' && 'v' in x;\n}\n\n/**\n * One key's signal. `sig.set` persists, so a refresh from storage goes through\n * `write`, the setter the signal was born with.\n */\ninterface Watcher {\n readonly sig: WritableSignal<unknown>;\n readonly fallback: unknown;\n readonly write: (value: unknown) => void;\n}\n\n/**\n * Reactive key/value storage on top of any `Storage`-compatible engine.\n *\n * - **Swap engines** through {@link WR_STORAGE_ENGINE} or\n * `provideWr(withStorage(...))`. Default: `localStorage` with an in-memory\n * fallback for SSR / private mode.\n * - **Namespacing** via `prefix` (config) — every key is transparently\n * prefixed on read / write.\n * - **TTL** per-call or default — values past their expiry are removed\n * lazily on the next `get` / `watch` read.\n * - **Reactive watch** — `watch(key)` returns a `Signal` that updates on\n * local writes and cross-tab `storage` events. `signal(key, default)` is the\n * writable twin: `set` and `update` persist as they go.\n * - **On-disk format** — values are wrapped in a {@link WrStorageEnvelope}\n * (`{\"v\":…,\"e\":…}`) while `json` is on. Anything reading the same key from\n * outside Angular has to unwrap it.\n *\n * SSR-safe: the default engine factory returns an in-memory shim when\n * `localStorage` is unavailable, so reads always work.\n *\n * @example\n * ```ts\n * const store = inject(WrStorage);\n *\n * store.set('user', { name: 'Ada' });\n * store.get<{ name: string }>('user'); // { name: 'Ada' }\n *\n * store.set('cart', items, { ttl: 60_000 }); // expires in 60s\n *\n * const theme = store.watch<'light' | 'dark'>('theme', 'light');\n * effect(() => console.log('theme is', theme()));\n *\n * const density = store.signal<'compact' | 'comfortable'>('density', 'comfortable');\n * density.set('compact'); // stored, and every tab follows\n * ```\n *\n * @see https://ngwr.dev/reference/services/storage\n */\n@Service()\nexport class WrStorage {\n private readonly engine = inject(WR_STORAGE_ENGINE);\n private readonly config = inject(WR_STORAGE_CONFIG);\n private readonly destroyRef = inject(DestroyRef);\n private readonly isBrowser = isPlatformBrowser(inject(PLATFORM_ID));\n\n /**\n * Per-key watchers. Shared so multiple `watch(k)` and `signal(k)` calls reuse\n * one signal.\n *\n * The fallback is kept alongside the signal because every refresh has to read\n * the key the same way `watch` first did. Refreshing without it made `get` and\n * `watch` disagree about what an ABSENT key means: after a `remove()` the\n * signal went to `null` while `get(key, fallback)` still answered with the\n * default, so a consumer watching `'theme'` with a `'light'` fallback got no\n * theme at all rather than the light one.\n */\n private readonly watchers = new Map<string, Watcher>();\n private listenerInstalled = false;\n\n // Public API\n\n /**\n * Is `key` present? A raw presence check: it does not parse the envelope, so\n * an EXPIRED entry still answers `true` until something reads it — `get()`\n * is what notices the TTL and removes the key on its way out. Branch on\n * `get() !== null` when the answer has to respect expiry; this one is for\n * \"is there anything under this key at all\", quota accounting included.\n */\n has(key: string): boolean {\n return this.engine.getItem(this.fullKey(key)) !== null;\n }\n\n /**\n * Read `key`. Returns `fallback` (default `null`) when the key is\n * missing or expired. Expired values are also removed as a side effect.\n */\n get<T = unknown>(key: string, fallback: T | null = null): T | null {\n const fk = this.fullKey(key);\n const raw = this.engine.getItem(fk);\n if (raw === null) return fallback;\n\n if (!this.config.json) return raw as unknown as T;\n\n let parsed: unknown;\n try {\n parsed = JSON.parse(raw);\n } catch {\n // Non-JSON value written by external code — return as-is.\n return raw as unknown as T;\n }\n\n if (!isEnvelope(parsed)) return parsed as T;\n\n if (parsed.e !== undefined && parsed.e < Date.now()) {\n this.remove(key);\n return fallback;\n }\n return parsed.v as T;\n }\n\n /**\n * Write `value` at `key`. Per-call `ttl` (ms) overrides the config\n * default. JSON-serializable values only when `json` is on (the default).\n *\n * What lands in the engine is a {@link WrStorageEnvelope} —\n * `{\"v\":<value>}`, plus `\"e\"` when a TTL applies — not the bare value. Code\n * outside Angular that reads the same key has to unwrap it; see the envelope's\n * own docs for the exact format.\n */\n set<T = unknown>(key: string, value: T, opts?: { ttl?: number }): void {\n if (this.persist(key, value, opts)) this.notify(key);\n }\n\n /** Remove `key`. No-op when absent. */\n remove(key: string): void {\n this.engine.removeItem(this.fullKey(key));\n this.notify(key);\n }\n\n /**\n * Clear every key owned by this prefix. When `prefix` is empty this\n * defers to `engine.clear()` (clears everything — be careful with\n * shared storage).\n */\n clear(): void {\n const p = this.config.prefix;\n if (p) {\n for (const fk of this.rawKeys()) this.engine.removeItem(fk);\n } else {\n this.engine.clear();\n }\n // Refresh every active watcher — they may have just been cleared.\n this.refreshAll();\n }\n\n /** All known keys under our prefix, with the prefix stripped. */\n keys(): readonly string[] {\n const p = this.config.prefix;\n return this.rawKeys().map(k => (p ? k.slice(p.length) : k));\n }\n\n /**\n * Reactive read of `key`. Updates when this instance writes to the key,\n * when `clear()` runs, and when another tab updates `localStorage`\n * under the same prefix. Returned signal is shared per key — calling\n * `watch(k)` twice returns the same signal.\n */\n watch<T = unknown>(key: string, fallback: T | null = null): Signal<T | null> {\n return (this.watcher(key, fallback).sig as WritableSignal<T | null>).asReadonly();\n }\n\n /**\n * Writable twin of {@link watch}: `set` and `update` store the value, then\n * the signal takes it. The signal is the one `watch(key)` reads, so a\n * `set()`, `remove()` or `clear()` on this instance moves it too, and so does\n * a write from another tab; a key another tab removes goes back to\n * `defaultValue`. Shared per key, so a second `signal(key)` is the same\n * signal and the first call's default stands.\n *\n * A `set` to the value it already holds (`Object.is`) writes nothing, like a\n * plain signal. A write the engine refuses (quota, storage disabled) is\n * logged and dropped exactly as `set()` does, and nothing throws: the signal\n * keeps the new value for this tab, and the next load reads what was stored\n * before.\n *\n * On the server it reads the engine as `watch()` does, so with the default\n * in-memory engine it holds `defaultValue`, and no `storage` listener is\n * installed. Hydration: the server renders that default and the browser\n * instance reads `localStorage` when it is created, so the first client\n * render can differ from the server markup, as with `watch()`.\n */\n signal<T>(key: string, defaultValue: T): WritableSignal<T> {\n return this.watcher(key, defaultValue).sig as WritableSignal<T>;\n }\n\n // Internals\n\n private fullKey(key: string): string {\n return this.config.prefix + key;\n }\n\n private watcher(key: string, fallback: unknown): Watcher {\n const existing = this.watchers.get(key);\n if (existing) return existing;\n\n const sig = signal<unknown>(this.get(key, fallback));\n const write = sig.set.bind(sig);\n sig.set = value => {\n if (Object.is(value, untracked(sig))) return;\n this.persist(key, value);\n write(value);\n };\n sig.update = fn => sig.set(fn(untracked(sig)));\n\n const entry: Watcher = { sig, fallback, write };\n this.watchers.set(key, entry);\n this.installCrossTabListener();\n return entry;\n }\n\n /** Serialize and store. `false` when nothing landed in the engine. */\n private persist<T>(key: string, value: T, opts?: { ttl?: number }): boolean {\n const fk = this.fullKey(key);\n let serialized: string;\n\n if (this.config.json) {\n const ttl = opts?.ttl ?? this.config.ttl;\n const env: WrStorageEnvelope<T> = ttl ? { v: value, e: Date.now() + ttl } : { v: value };\n try {\n serialized = JSON.stringify(env);\n } catch (err) {\n // eslint-disable-next-line no-console -- intentional diagnostic for unserialisable values\n console.warn('[ngwr/storage] value not JSON-serializable', err);\n return false;\n }\n } else {\n serialized = String(value);\n }\n\n try {\n this.engine.setItem(fk, serialized);\n } catch (err) {\n // Quota exceeded / disabled / cleared mid-write — log + carry on.\n // eslint-disable-next-line no-console -- intentional diagnostic on storage write failure\n console.warn('[ngwr/storage] setItem failed', err);\n return false;\n }\n return true;\n }\n\n private notify(key: string): void {\n const entry = this.watchers.get(key);\n if (entry) entry.write(this.get(key, entry.fallback));\n }\n\n private refreshAll(): void {\n for (const [k, entry] of this.watchers) entry.write(this.get(k, entry.fallback));\n }\n\n private rawKeys(): string[] {\n const p = this.config.prefix;\n const out: string[] = [];\n for (let i = 0; i < this.engine.length; i++) {\n const k = this.engine.key(i);\n if (k === null) continue;\n if (!p || k.startsWith(p)) out.push(k);\n }\n return out;\n }\n\n private installCrossTabListener(): void {\n if (!this.isBrowser || this.listenerInstalled) return;\n this.listenerInstalled = true;\n\n const handler = (event: StorageEvent): void => {\n // `storage` only fires for `localStorage` / `sessionStorage`, and\n // only for changes from OTHER tabs. Local writes are handled by\n // `notify()` in `set`/`remove`/`clear`.\n if (event.key === null) {\n // Storage cleared from another tab.\n this.refreshAll();\n return;\n }\n const p = this.config.prefix;\n if (p && !event.key.startsWith(p)) return;\n this.notify(p ? event.key.slice(p.length) : event.key);\n };\n\n window.addEventListener('storage', handler);\n\n // The listener belongs to THIS injector. Root-provided it lives as long as\n // the page, but a route or component that lists `WrStorage` in its own\n // `providers` used to leave the handler on the window after its injector was\n // gone — still driving the watcher signals of a destroyed instance, and\n // holding the instance and every signal in it reachable for the life of the\n // page. Same bug `WrHotkey` already fixed once.\n this.destroyRef.onDestroy(() => {\n window.removeEventListener('storage', handler);\n this.listenerInstalled = false;\n });\n }\n}\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport type { Provider } from '@angular/core';\n\nimport { type WrFeature, wrFeature } from 'ngwr/utils';\n\nimport { DEFAULT_WR_STORAGE_CONFIG, WR_STORAGE_CONFIG, type WrStorageConfigResolved } from './storage-config';\nimport { WR_STORAGE_ENGINE } from './storage-engine';\nimport type { WrStorageOptions } from './types';\n\n/**\n * Configure {@link WrStorage}, as a feature of `provideWr()`. All fields\n * optional — merged with defaults.\n *\n * Bootstrap only: {@link WrStorage} is root-provided and resolves its engine\n * and config once, from the root injector — see {@link WR_STORAGE_ENGINE}.\n *\n * @example Override the engine globally (e.g. session storage)\n * ```ts\n * import { provideWr } from 'ngwr';\n * import { withStorage } from 'ngwr/storage';\n *\n * providers: [provideWr(withStorage({ engine: sessionStorage }))]\n * ```\n *\n * @example Lazy engine factory (e.g. wrap localStorage with encryption)\n * ```ts\n * provideWr(withStorage({ engine: () => new EncryptedStorage(localStorage, key) }))\n * ```\n *\n * @example Namespace + auto-expire\n * ```ts\n * provideWr(withStorage({ prefix: 'myapp:', ttl: 24 * 60 * 60 * 1000 }))\n * ```\n */\nexport function withStorage(options: WrStorageOptions = {}): WrFeature<'storage'> {\n const { engine, ...config } = options;\n\n const merged: WrStorageConfigResolved = { ...DEFAULT_WR_STORAGE_CONFIG, ...config };\n\n const providers: Provider[] = [{ provide: WR_STORAGE_CONFIG, useValue: merged }];\n\n if (engine !== undefined) {\n providers.push(\n typeof engine === 'function'\n ? { provide: WR_STORAGE_ENGINE, useFactory: engine }\n : { provide: WR_STORAGE_ENGINE, useValue: engine }\n );\n }\n\n return wrFeature('storage', providers);\n}\n"],"mappings":";;;;;;;;;;AAWA,MAAa,4BAAqD;CAChE,QAAQ;CACR,MAAM;CACN,KAAK;AACN;AAED,MAAa,oBAAoB,IAAI,eAAwC,qBAAqB;CAChG,YAAY;CACZ,eAAe;AAChB,CAAA;;;;;;;ACJD,SAAS,MAAM,QAAuB;CACpC,IAAI;EACF,MAAM,IAAI;EACV,OAAO,QAAQ,GAAG,GAAG;EACrB,OAAO,WAAW,CAAC;EACnB,OAAO;CACT,QAAQ;EACN,OAAO;CACT;AACF;AAMA,SAAgB,sBAAmB;CACjC,MAAM,sBAAM,IAAI,IAAG;CACnB,OAAO;EACL,IAAI,SAAM;GACR,OAAO,IAAI;EACb;EACA,QAAK;GACH,IAAI,MAAK;EACX;EACA,QAAQ,KAAW;GACjB,OAAO,IAAI,IAAI,GAAG,IAAI,IAAI,IAAI,GAAG,IAAK;EACxC;EACA,IAAI,GAAS;GACX,OAAO,MAAM,KAAK,IAAI,KAAI,CAAE,CAAC,CAAC,MAAM;EACtC;EACA,WAAW,KAAW;GACpB,IAAI,OAAO,GAAG;EAChB;EACA,QAAQ,KAAa,OAAa;GAChC,IAAI,IAAI,KAAK,KAAK;EACpB;CACD;AACH;AAqBA,MAAa,oBAAoB,IAAI,e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EAQ1C,KAAK,WAAW,gBAAe;GAC7B,OAAO,oBAAoB,WAAW,OAAO;GAC7C,KAAK,oBAAoB;EAC3B,CAAC;CACH;CAjPW,OAAA,OAAA,GAAA,mBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,UAAA;EAAA,MAAA;EAAS,MAAA,CAAA;EAAA,QAAA,GAAA,gBAAA;CAAA,CAAA;CAAT,OAAA,QAAA,GAAA,mBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,UAAA;EAAA,MAAA;CAAS,CAAA;;AAAT,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAS,YAAA,CAAA,EADrB,MAAA,Q;;;;;;;;ACnCD,SAAgB,YAAY,UAA4B,CAAA,GAAE;CACxD,MAAM,EAAE,QAAQ,GAAG,WAAW;CAE9B,MAAM,SAAkC;EAAE,GAAG;EAA2B,GAAG;CAAM;CAEjF,MAAM,YAAwB,CAAC;EAAE,SAAS;EAAmB,UAAU;CAAM,CAAE;CAE/E,IAAI,WAAW,QACb,UAAU,KACR,OAAO,WAAW,aACd;EAAE,SAAS;EAAmB,YAAY;CAAM,IAChD;EAAE,SAAS;EAAmB,UAAU;CAAM,CAAE;CAIxD,OAAO,UAAU,WAAW,SAAS;AACvC"}
1
+ {"version":3,"file":"ngwr-storage.mjs","names":[],"sources":["../../../projects/lib/storage/storage-config.ts","../../../projects/lib/storage/storage-engine.ts","../../../projects/lib/storage/storage.ts","../../../projects/lib/storage/with-storage.ts"],"sourcesContent":["/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { InjectionToken } from '@angular/core';\n\nimport type { WrStorageConfigResolved } from './types';\n\nexport const DEFAULT_WR_STORAGE_CONFIG: WrStorageConfigResolved = {\n prefix: '',\n json: true,\n ttl: 0,\n};\n\nexport const WR_STORAGE_CONFIG = new InjectionToken<WrStorageConfigResolved>('WR_STORAGE_CONFIG', {\n providedIn: 'root',\n factory: () => DEFAULT_WR_STORAGE_CONFIG,\n});\n\nexport type { WrStorageConfig, WrStorageConfigResolved } from './types';\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { InjectionToken } from '@angular/core';\n\nimport type { WrStorageEngine } from './types';\n\n/**\n * Probe a `Storage` candidate to confirm it's writable. Safari private\n * mode, disabled cookies, and storage-blocked iframes all throw on\n * `setItem` — fall back to memory in those cases.\n */\nfunction probe(engine: WrStorageEngine): boolean {\n try {\n const k = '__wr_storage_probe__';\n engine.setItem(k, '1');\n engine.removeItem(k);\n return true;\n } catch {\n return false;\n }\n}\n\n/**\n * In-memory implementation of `Storage`. Used as the SSR / private-mode\n * fallback. Exported so consumers can opt into it explicitly for tests.\n */\nexport function wrCreateMemoryStorage(): WrStorageEngine {\n const map = new Map<string, string>();\n return {\n get length(): number {\n return map.size;\n },\n clear(): void {\n map.clear();\n },\n getItem(key: string): string | null {\n return map.has(key) ? map.get(key)! : null;\n },\n key(i: number): string | null {\n return Array.from(map.keys())[i] ?? null;\n },\n removeItem(key: string): void {\n map.delete(key);\n },\n setItem(key: string, value: string): void {\n map.set(key, value);\n },\n };\n}\n\n/**\n * Injection token for the active storage engine. Provide it at BOOTSTRAP to\n * swap engines (e.g. `sessionStorage` for a tab-only app):\n *\n * ```ts\n * providers: [{ provide: WR_STORAGE_ENGINE, useValue: sessionStorage }]\n * ```\n *\n * Not at an arbitrary injector level: `WrStorage` is root-provided and reads\n * the token in a field initializer, so the singleton resolves its engine once\n * and a token re-provided on a lazy route or in a component's `providers`\n * reaches no existing `inject(WrStorage)` — every read and write still goes to\n * the engine the root instance already took, with nothing thrown and nothing\n * logged. A feature that genuinely needs its own engine provides its own\n * `WrStorage` beside it.\n *\n * The default factory returns `localStorage` in the browser when it's\n * actually writable, an in-memory map otherwise.\n */\nexport const WR_STORAGE_ENGINE = new InjectionToken<WrStorageEngine>('WR_STORAGE_ENGINE', {\n providedIn: 'root',\n factory: () => {\n try {\n // The getter itself throws a SecurityError when the browser blocks storage.\n if (typeof localStorage !== 'undefined' && probe(localStorage)) return localStorage;\n } catch {\n // Fall through to memory.\n }\n return wrCreateMemoryStorage();\n },\n});\n\nexport type { WrStorageEngine } from './types';\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 { isPlatformBrowser } from '@angular/common';\nimport {\n DestroyRef,\n Service,\n PLATFORM_ID,\n type Signal,\n type WritableSignal,\n inject,\n signal,\n untracked,\n} from '@angular/core';\n\nimport { WR_STORAGE_CONFIG } from './storage-config';\nimport { WR_STORAGE_ENGINE } from './storage-engine';\nimport type { WrStorageEnvelope } from './types';\n\nfunction isEnvelope(x: unknown): x is WrStorageEnvelope {\n return x !== null && typeof x === 'object' && 'v' in x;\n}\n\n/**\n * One key's signal. `sig.set` persists, so a refresh from storage goes through\n * `write`, the setter the signal was born with.\n */\ninterface Watcher {\n readonly sig: WritableSignal<unknown>;\n readonly fallback: unknown;\n readonly write: (value: unknown) => void;\n}\n\n/**\n * Reactive key/value storage on top of any `Storage`-compatible engine.\n *\n * - **Swap engines** through {@link WR_STORAGE_ENGINE} or\n * `provideWr(withStorage(...))`. Default: `localStorage` with an in-memory\n * fallback for SSR / private mode.\n * - **Namespacing** via `prefix` (config) — every key is transparently\n * prefixed on read / write.\n * - **TTL** per-call or default — values past their expiry are removed\n * lazily on the next `get` / `watch` read.\n * - **Reactive watch** — `watch(key)` returns a `Signal` that updates on\n * local writes and cross-tab `storage` events. `signal(key, default)` is the\n * writable twin: `set` and `update` persist as they go.\n * - **On-disk format** — values are wrapped in a {@link WrStorageEnvelope}\n * (`{\"v\":…,\"e\":…}`) while `json` is on. Anything reading the same key from\n * outside Angular has to unwrap it.\n *\n * SSR-safe: the default engine factory returns an in-memory shim when\n * `localStorage` is unavailable, so reads always work.\n *\n * @example\n * ```ts\n * const store = inject(WrStorage);\n *\n * store.set('user', { name: 'Ada' });\n * store.get<{ name: string }>('user'); // { name: 'Ada' }\n *\n * store.set('cart', items, { ttl: 60_000 }); // expires in 60s\n *\n * const theme = store.watch<'light' | 'dark'>('theme', 'light');\n * effect(() => console.log('theme is', theme()));\n *\n * const density = store.signal<'compact' | 'comfortable'>('density', 'comfortable');\n * density.set('compact'); // stored, and every tab follows\n * ```\n *\n * @see https://ngwr.dev/reference/services/storage\n */\n@Service()\nexport class WrStorage {\n private readonly engine = inject(WR_STORAGE_ENGINE);\n private readonly config = inject(WR_STORAGE_CONFIG);\n private readonly destroyRef = inject(DestroyRef);\n private readonly isBrowser = isPlatformBrowser(inject(PLATFORM_ID));\n\n /**\n * Per-key watchers. Shared so multiple `watch(k)` and `signal(k)` calls reuse\n * one signal.\n *\n * The fallback is kept alongside the signal because every refresh has to read\n * the key the same way `watch` first did. Refreshing without it made `get` and\n * `watch` disagree about what an ABSENT key means: after a `remove()` the\n * signal went to `null` while `get(key, fallback)` still answered with the\n * default, so a consumer watching `'theme'` with a `'light'` fallback got no\n * theme at all rather than the light one.\n */\n private readonly watchers = new Map<string, Watcher>();\n private listenerInstalled = false;\n\n // Public API\n\n /**\n * Is `key` present? A raw presence check: it does not parse the envelope, so\n * an EXPIRED entry still answers `true` until something reads it — `get()`\n * is what notices the TTL and removes the key on its way out. Branch on\n * `get() !== null` when the answer has to respect expiry; this one is for\n * \"is there anything under this key at all\", quota accounting included.\n */\n has(key: string): boolean {\n return this.engine.getItem(this.fullKey(key)) !== null;\n }\n\n /**\n * Read `key`. Returns `fallback` (default `null`) when the key is\n * missing or expired. Expired values are also removed as a side effect.\n */\n get<T = unknown>(key: string, fallback: T | null = null): T | null {\n const fk = this.fullKey(key);\n const raw = this.engine.getItem(fk);\n if (raw === null) return fallback;\n\n if (!this.config.json) return raw as unknown as T;\n\n let parsed: unknown;\n try {\n parsed = JSON.parse(raw);\n } catch {\n // Non-JSON value written by external code — return as-is.\n return raw as unknown as T;\n }\n\n if (!isEnvelope(parsed)) return parsed as T;\n\n if (parsed.e !== undefined && parsed.e < Date.now()) {\n this.remove(key);\n return fallback;\n }\n return parsed.v as T;\n }\n\n /**\n * Write `value` at `key`. Per-call `ttl` (ms) overrides the config\n * default. JSON-serializable values only when `json` is on (the default).\n *\n * What lands in the engine is a {@link WrStorageEnvelope} —\n * `{\"v\":<value>}`, plus `\"e\"` when a TTL applies — not the bare value. Code\n * outside Angular that reads the same key has to unwrap it; see the envelope's\n * own docs for the exact format.\n */\n set<T = unknown>(key: string, value: T, opts?: { ttl?: number }): void {\n if (this.persist(key, value, opts)) this.notify(key);\n }\n\n /** Remove `key`. No-op when absent. */\n remove(key: string): void {\n this.engine.removeItem(this.fullKey(key));\n this.notify(key);\n }\n\n /**\n * Clear every key owned by this prefix. When `prefix` is empty this\n * defers to `engine.clear()` (clears everything — be careful with\n * shared storage).\n */\n clear(): void {\n const p = this.config.prefix;\n if (p) {\n for (const fk of this.rawKeys()) this.engine.removeItem(fk);\n } else {\n this.engine.clear();\n }\n // Refresh every active watcher — they may have just been cleared.\n this.refreshAll();\n }\n\n /** All known keys under our prefix, with the prefix stripped. */\n keys(): readonly string[] {\n const p = this.config.prefix;\n return this.rawKeys().map(k => (p ? k.slice(p.length) : k));\n }\n\n /**\n * Reactive read of `key`. Updates when this instance writes to the key,\n * when `clear()` runs, and when another tab updates `localStorage`\n * under the same prefix. Returned signal is shared per key — calling\n * `watch(k)` twice returns the same signal.\n */\n watch<T = unknown>(key: string, fallback: T | null = null): Signal<T | null> {\n return (this.watcher(key, fallback).sig as WritableSignal<T | null>).asReadonly();\n }\n\n /**\n * Writable twin of {@link watch}: `set` and `update` store the value, then\n * the signal takes it. The signal is the one `watch(key)` reads, so a\n * `set()`, `remove()` or `clear()` on this instance moves it too, and so does\n * a write from another tab; a key another tab removes goes back to\n * `defaultValue`. Shared per key, so a second `signal(key)` is the same\n * signal and the first call's default stands.\n *\n * A `set` to the value it already holds (`Object.is`) writes nothing, like a\n * plain signal. A write the engine refuses (quota, storage disabled) is\n * logged and dropped exactly as `set()` does, and nothing throws: the signal\n * keeps the new value for this tab, and the next load reads what was stored\n * before.\n *\n * On the server it reads the engine as `watch()` does, so with the default\n * in-memory engine it holds `defaultValue`, and no `storage` listener is\n * installed. Hydration: the server renders that default and the browser\n * instance reads `localStorage` when it is created, so the first client\n * render can differ from the server markup, as with `watch()`.\n */\n signal<T>(key: string, defaultValue: T): WritableSignal<T> {\n return this.watcher(key, defaultValue).sig as WritableSignal<T>;\n }\n\n // Internals\n\n private fullKey(key: string): string {\n return this.config.prefix + key;\n }\n\n private watcher(key: string, fallback: unknown): Watcher {\n const existing = this.watchers.get(key);\n if (existing) return existing;\n\n const sig = signal<unknown>(this.get(key, fallback));\n const write = sig.set.bind(sig);\n sig.set = value => {\n if (Object.is(value, untracked(sig))) return;\n this.persist(key, value);\n write(value);\n };\n sig.update = fn => sig.set(fn(untracked(sig)));\n\n const entry: Watcher = { sig, fallback, write };\n this.watchers.set(key, entry);\n this.installCrossTabListener();\n return entry;\n }\n\n /** Serialize and store. `false` when nothing landed in the engine. */\n private persist<T>(key: string, value: T, opts?: { ttl?: number }): boolean {\n const fk = this.fullKey(key);\n let serialized: string;\n\n if (this.config.json) {\n const ttl = opts?.ttl ?? this.config.ttl;\n const env: WrStorageEnvelope<T> = ttl ? { v: value, e: Date.now() + ttl } : { v: value };\n try {\n serialized = JSON.stringify(env);\n } catch (err) {\n // eslint-disable-next-line no-console -- intentional diagnostic for unserialisable values\n console.warn('[ngwr/storage] value not JSON-serializable', err);\n return false;\n }\n } else {\n serialized = String(value);\n }\n\n try {\n this.engine.setItem(fk, serialized);\n } catch (err) {\n // Quota exceeded / disabled / cleared mid-write — log + carry on.\n // eslint-disable-next-line no-console -- intentional diagnostic on storage write failure\n console.warn('[ngwr/storage] setItem failed', err);\n return false;\n }\n return true;\n }\n\n private notify(key: string): void {\n const entry = this.watchers.get(key);\n if (entry) entry.write(this.get(key, entry.fallback));\n }\n\n private refreshAll(): void {\n for (const [k, entry] of this.watchers) entry.write(this.get(k, entry.fallback));\n }\n\n private rawKeys(): string[] {\n const p = this.config.prefix;\n const out: string[] = [];\n for (let i = 0; i < this.engine.length; i++) {\n const k = this.engine.key(i);\n if (k === null) continue;\n if (!p || k.startsWith(p)) out.push(k);\n }\n return out;\n }\n\n private installCrossTabListener(): void {\n if (!this.isBrowser || this.listenerInstalled) return;\n this.listenerInstalled = true;\n\n const handler = (event: StorageEvent): void => {\n // `storage` only fires for `localStorage` / `sessionStorage`, and\n // only for changes from OTHER tabs. Local writes are handled by\n // `notify()` in `set`/`remove`/`clear`.\n if (event.key === null) {\n // Storage cleared from another tab.\n this.refreshAll();\n return;\n }\n const p = this.config.prefix;\n if (p && !event.key.startsWith(p)) return;\n this.notify(p ? event.key.slice(p.length) : event.key);\n };\n\n window.addEventListener('storage', handler);\n\n // The listener belongs to THIS injector. Root-provided it lives as long as\n // the page, but a route or component that lists `WrStorage` in its own\n // `providers` used to leave the handler on the window after its injector was\n // gone — still driving the watcher signals of a destroyed instance, and\n // holding the instance and every signal in it reachable for the life of the\n // page. Same bug `WrHotkey` already fixed once.\n this.destroyRef.onDestroy(() => {\n window.removeEventListener('storage', handler);\n this.listenerInstalled = false;\n });\n }\n}\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport type { Provider } from '@angular/core';\n\nimport { type WrFeature, wrFeature } from 'ngwr/utils';\n\nimport { DEFAULT_WR_STORAGE_CONFIG, WR_STORAGE_CONFIG, type WrStorageConfigResolved } from './storage-config';\nimport { WR_STORAGE_ENGINE } from './storage-engine';\nimport type { WrStorageOptions } from './types';\n\n/**\n * Configure {@link WrStorage}, as a feature of `provideWr()`. All fields\n * optional — merged with defaults.\n *\n * Bootstrap only: {@link WrStorage} is root-provided and resolves its engine\n * and config once, from the root injector — see {@link WR_STORAGE_ENGINE}.\n *\n * @example Override the engine globally (e.g. session storage)\n * ```ts\n * import { provideWr } from 'ngwr';\n * import { withStorage } from 'ngwr/storage';\n *\n * providers: [provideWr(withStorage({ engine: sessionStorage }))]\n * ```\n *\n * @example Lazy engine factory (e.g. wrap localStorage with encryption)\n * ```ts\n * provideWr(withStorage({ engine: () => new EncryptedStorage(localStorage, key) }))\n * ```\n *\n * @example Namespace + auto-expire\n * ```ts\n * provideWr(withStorage({ prefix: 'myapp:', ttl: 24 * 60 * 60 * 1000 }))\n * ```\n */\nexport function withStorage(options: WrStorageOptions = {}): WrFeature<'storage'> {\n const { engine, ...config } = options;\n\n const merged: WrStorageConfigResolved = { ...DEFAULT_WR_STORAGE_CONFIG, ...config };\n\n const providers: Provider[] = [{ provide: WR_STORAGE_CONFIG, useValue: merged }];\n\n if (engine !== undefined) {\n providers.push(\n typeof engine === 'function'\n ? { provide: WR_STORAGE_ENGINE, useFactory: engine }\n : { provide: WR_STORAGE_ENGINE, useValue: engine }\n );\n }\n\n return wrFeature('storage', providers);\n}\n"],"mappings":";;;;;;;;;;AAWA,MAAa,4BAAqD;CAChE,QAAQ;CACR,MAAM;CACN,KAAK;AACN;AAED,MAAa,oBAAoB,IAAI,eAAwC,qBAAqB;CAChG,YAAY;CACZ,eAAe;AAChB,CAAA;;;;;;;ACJD,SAAS,MAAM,QAAuB;CACpC,IAAI;EACF,MAAM,IAAI;EACV,OAAO,QAAQ,GAAG,GAAG;EACrB,OAAO,WAAW,CAAC;EACnB,OAAO;CACT,QAAQ;EACN,OAAO;CACT;AACF;AAMA,SAAgB,wBAAqB;CACnC,MAAM,sBAAM,IAAI,IAAG;CACnB,OAAO;EACL,IAAI,SAAM;GACR,OAAO,IAAI;EACb;EACA,QAAK;GACH,IAAI,MAAK;EACX;EACA,QAAQ,KAAW;GACjB,OAAO,IAAI,IAAI,GAAG,IAAI,IAAI,IAAI,GAAG,IAAK;EACxC;EACA,IAAI,GAAS;GACX,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AEtB,KAAK,WAAU;IACf;GACF;GACA,MAAM,IAAI,KAAK,OAAO;GACtB,IAAI,KAAK,CAAC,MAAM,IAAI,WAAW,CAAC,GAAG;GACnC,KAAK,OAAO,IAAI,MAAM,IAAI,MAAM,EAAE,MAAM,IAAI,MAAM,GAAG;EACvD;EAEA,OAAO,iBAAiB,WAAW,OAAO;EAQ1C,KAAK,WAAW,gBAAe;GAC7B,OAAO,oBAAoB,WAAW,OAAO;GAC7C,KAAK,oBAAoB;EAC3B,CAAC;CACH;CAjPW,OAAA,OAAA,GAAA,mBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,UAAA;EAAA,MAAA;EAAS,MAAA,CAAA;EAAA,QAAA,GAAA,gBAAA;CAAA,CAAA;CAAT,OAAA,QAAA,GAAA,mBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,UAAA;EAAA,MAAA;CAAS,CAAA;;AAAT,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAS,YAAA,CAAA,EADrB,MAAA,Q;;;;;;;;ACnCD,SAAgB,YAAY,UAA4B,CAAA,GAAE;CACxD,MAAM,EAAE,QAAQ,GAAG,WAAW;CAE9B,MAAM,SAAkC;EAAE,GAAG;EAA2B,GAAG;CAAM;CAEjF,MAAM,YAAwB,CAAC;EAAE,SAAS;EAAmB,UAAU;CAAM,CAAE;CAE/E,IAAI,WAAW,QACb,UAAU,KACR,OAAO,WAAW,aACd;EAAE,SAAS;EAAmB,YAAY;CAAM,IAChD;EAAE,SAAS;EAAmB,UAAU;CAAM,CAAE;CAIxD,OAAO,UAAU,WAAW,SAAS;AACvC"}
@@ -1,7 +1,7 @@
1
1
  import * as i0 from "@angular/core";
2
2
  import { Component, ViewEncapsulation, computed, input, model, output, viewChild } from "@angular/core";
3
3
  import { coerceBooleanProperty } from "@angular/cdk/coercion";
4
- import { randomId, wrCheckStyles } from "ngwr/utils";
4
+ import { wrCheckStyles, wrRandomId } from "ngwr/utils";
5
5
  import { useFormFieldAria } from "ngwr/form";
6
6
  /**
7
7
  * @license
@@ -14,7 +14,7 @@ var WrSwitch = class WrSwitch {
14
14
  if (typeof ngDevMode === "undefined" || ngDevMode) wrCheckStyles("switch");
15
15
  }
16
16
  ariaLabel = input(null, ...ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []);
17
- id = input(randomId("wr-switch"), ...ngDevMode ? [{ debugName: "id" }] : /* istanbul ignore next */ []);
17
+ id = input(wrRandomId("wr-switch"), ...ngDevMode ? [{ debugName: "id" }] : /* istanbul ignore next */ []);
18
18
  disabled = input(false, {
19
19
  ...ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {},
20
20
  transform: coerceBooleanProperty
@@ -1 +1 @@
1
- {"version":3,"file":"ngwr-switch.mjs","names":[],"sources":["../../../projects/lib/switch/switch.ts","../../../projects/lib/switch/switch.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 {\n Component,\n type ElementRef,\n ViewEncapsulation,\n computed,\n input,\n model,\n output,\n viewChild,\n} from '@angular/core';\nimport type { FormCheckboxControl } from '@angular/forms/signals';\n\nimport { useFormFieldAria } from 'ngwr/form';\nimport { randomId, wrCheckStyles } from 'ngwr/utils';\n\n/**\n * Boolean toggle with an iOS-style slider.\n *\n * A signal-forms native control: it implements `FormCheckboxControl`, so\n * `[formField]` binds straight to its `checked` model — no\n * `ControlValueAccessor` in between. `[(checked)]` works standalone.\n *\n * @example\n * ```html\n * <!-- signal forms -->\n * <wr-switch [formField]=\"form.notifications\">Notifications</wr-switch>\n *\n * <!-- standalone two-way binding -->\n * <wr-switch [(checked)]=\"enabled\">Notifications</wr-switch>\n * ```\n *\n * @see https://ngwr.dev/reference/components/switch\n */\nexport type WrSwitchSize = 'sm' | 'md' | 'lg';\n\n@Component({\n selector: 'wr-switch',\n templateUrl: './switch.html',\n encapsulation: ViewEncapsulation.None,\n host: {\n '[class]': 'classes()',\n // The `id` input belongs to the native input, not to this element — a static\n // `id=\"x\"` would otherwise be written here too and leave the document with\n // two elements sharing it, which is what broke `<label for>`.\n '[attr.id]': 'null',\n },\n})\nexport class WrSwitch implements FormCheckboxControl {\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('switch');\n }\n\n /**\n * Accessible name for a switch used WITHOUT projected text. The wrapping\n * `<label>` names the control whenever content is projected; with none, the\n * label is empty and the input has no name at all.\n */\n readonly ariaLabel = input<string | null>(null);\n\n /**\n * Stable id used to associate the native input with its label. Lands on the\n * inner `<input>`; the host never keeps it.\n */\n readonly id = input<string>(randomId('wr-switch'));\n\n /**\n * Disable the switch. Bound automatically from the field's disabled state\n * when used with `[formField]`.\n *\n * @default false\n */\n readonly disabled = input(false, { transform: coerceBooleanProperty });\n\n /**\n * Refuse edits while staying focusable and submittable. Bound automatically\n * from the field's readonly state when used with `[formField]`.\n *\n * A native checkbox ignores the `readonly` attribute, so this cancels the\n * click's activation behaviour instead — which covers Space too, since the key\n * arrives as a click — and mirrors the state as `aria-readonly`, which role\n * `switch` supports.\n *\n * @default false\n */\n readonly readonly = input(false, { transform: coerceBooleanProperty });\n\n /** The surrounding `<wr-form-field>`'s error state. @internal */\n protected readonly fieldAria = useFormFieldAria();\n\n /** Control size — shares the `--wr-control-*` contract. @default 'md' */\n readonly size = input<WrSwitchSize>('md');\n\n /** On / off state. Bound by `[formField]`, or two-way via `[(checked)]`. */\n readonly checked = model<boolean>(false);\n\n /** Emitted on blur so a bound field can mark itself touched. */\n readonly touch = output<void>();\n\n private readonly native = viewChild.required<ElementRef<HTMLInputElement>>('native');\n\n protected readonly classes = computed(() => {\n const parts = ['wr-switch'];\n const size = this.size();\n if (size !== 'md') parts.push(`wr-switch--${size}`);\n if (this.checked()) parts.push('wr-switch--checked');\n if (this.disabled()) parts.push('wr-switch--disabled');\n else if (this.readonly()) parts.push('wr-switch--readonly');\n return parts.join(' ');\n });\n\n /**\n * Focus the switch — what Signal Forms calls to focus this control. The native\n * input takes it, since the host has no tab stop of its own; a disabled switch\n * refuses, as a disabled input always does.\n */\n focus(options?: FocusOptions): void {\n this.native().nativeElement.focus(options);\n }\n\n // Template handlers\n\n /**\n * Cancel the toggle while readonly. `change` never fires for a click whose\n * default was prevented, so this is the only guard the pointer and Space paths\n * need; `onInputChange` keeps its own for a synthetic `change`.\n */\n protected onInputClick(event: Event): void {\n if (this.readonly()) event.preventDefault();\n }\n\n protected onInputChange(event: Event): void {\n if (this.readonly()) {\n // A synthetic `change` cannot be prevented — put the DOM back instead.\n (event.target as HTMLInputElement).checked = this.checked();\n return;\n }\n this.checked.set((event.target as HTMLInputElement).checked);\n }\n\n protected onInputBlur(): void {\n this.touch.emit();\n }\n}\n","<label class=\"wr-switch__label\" [for]=\"id()\">\n <input\n #native\n class=\"wr-switch__input\"\n type=\"checkbox\"\n role=\"switch\"\n [id]=\"id()\"\n [attr.aria-label]=\"ariaLabel()\"\n [checked]=\"checked()\"\n [disabled]=\"disabled()\"\n [attr.aria-readonly]=\"readonly() || null\"\n [attr.aria-invalid]=\"fieldAria.ariaInvalid()\"\n [attr.aria-describedby]=\"fieldAria.describedBy()\"\n (click)=\"onInputClick($event)\"\n (change)=\"onInputChange($event)\"\n (blur)=\"onInputBlur()\"\n />\n\n <span class=\"wr-switch__track\" aria-hidden=\"true\">\n <span class=\"wr-switch__thumb\"></span>\n </span>\n\n <span class=\"wr-switch__text\">\n <ng-content />\n </span>\n</label>\n"],"mappings":";;;;;;;;;;;AAuDA,IAAa,WAAb,MAAa,SAAQ;CACnB,cAAA;EACE,IAAI,OAAO,cAAc,eAAe,WAAW,cAAc,QAAQ;CAC3E;CAOS,YAAY,MAAqB,MAAK,GAAA,YAAA,CAAA,EAAA,WAAA,YAAA,CAAA,+BAAA,CAAA,CAAA;CAMtC,KAAK,MAAc,SAAS,WAAW,GAAE,GAA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AW;IAIX,aAAa;GACd;GAAA,UAAA;EAAA,CAAA;CAqD0E,CAAA;CAAA,sBAAA,CAAA;CAAA,gBAAA;EAAA,WAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,IAAA,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;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,UAAA,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,SAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,GAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,eAAA;EAAA,CAAA;EAAA,OAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,OAAA;EAAA,CAAA;EAAA,QAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,UAAQ,EAAA,UAAA,KAAA,CAAA;EAAA,CAAA;CAAA;AAAA,CAAA"}
1
+ {"version":3,"file":"ngwr-switch.mjs","names":[],"sources":["../../../projects/lib/switch/switch.ts","../../../projects/lib/switch/switch.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 {\n Component,\n type ElementRef,\n ViewEncapsulation,\n computed,\n input,\n model,\n output,\n viewChild,\n} from '@angular/core';\nimport type { FormCheckboxControl } from '@angular/forms/signals';\n\nimport { useFormFieldAria } from 'ngwr/form';\nimport { wrRandomId, wrCheckStyles } from 'ngwr/utils';\n\n/**\n * Boolean toggle with an iOS-style slider.\n *\n * A signal-forms native control: it implements `FormCheckboxControl`, so\n * `[formField]` binds straight to its `checked` model — no\n * `ControlValueAccessor` in between. `[(checked)]` works standalone.\n *\n * @example\n * ```html\n * <!-- signal forms -->\n * <wr-switch [formField]=\"form.notifications\">Notifications</wr-switch>\n *\n * <!-- standalone two-way binding -->\n * <wr-switch [(checked)]=\"enabled\">Notifications</wr-switch>\n * ```\n *\n * @see https://ngwr.dev/reference/components/switch\n */\nexport type WrSwitchSize = 'sm' | 'md' | 'lg';\n\n@Component({\n selector: 'wr-switch',\n templateUrl: './switch.html',\n encapsulation: ViewEncapsulation.None,\n host: {\n '[class]': 'classes()',\n // The `id` input belongs to the native input, not to this element — a static\n // `id=\"x\"` would otherwise be written here too and leave the document with\n // two elements sharing it, which is what broke `<label for>`.\n '[attr.id]': 'null',\n },\n})\nexport class WrSwitch implements FormCheckboxControl {\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('switch');\n }\n\n /**\n * Accessible name for a switch used WITHOUT projected text. The wrapping\n * `<label>` names the control whenever content is projected; with none, the\n * label is empty and the input has no name at all.\n */\n readonly ariaLabel = input<string | null>(null);\n\n /**\n * Stable id used to associate the native input with its label. Lands on the\n * inner `<input>`; the host never keeps it.\n */\n readonly id = input<string>(wrRandomId('wr-switch'));\n\n /**\n * Disable the switch. Bound automatically from the field's disabled state\n * when used with `[formField]`.\n *\n * @default false\n */\n readonly disabled = input(false, { transform: coerceBooleanProperty });\n\n /**\n * Refuse edits while staying focusable and submittable. Bound automatically\n * from the field's readonly state when used with `[formField]`.\n *\n * A native checkbox ignores the `readonly` attribute, so this cancels the\n * click's activation behaviour instead — which covers Space too, since the key\n * arrives as a click — and mirrors the state as `aria-readonly`, which role\n * `switch` supports.\n *\n * @default false\n */\n readonly readonly = input(false, { transform: coerceBooleanProperty });\n\n /** The surrounding `<wr-form-field>`'s error state. @internal */\n protected readonly fieldAria = useFormFieldAria();\n\n /** Control size — shares the `--wr-control-*` contract. @default 'md' */\n readonly size = input<WrSwitchSize>('md');\n\n /** On / off state. Bound by `[formField]`, or two-way via `[(checked)]`. */\n readonly checked = model<boolean>(false);\n\n /** Emitted on blur so a bound field can mark itself touched. */\n readonly touch = output<void>();\n\n private readonly native = viewChild.required<ElementRef<HTMLInputElement>>('native');\n\n protected readonly classes = computed(() => {\n const parts = ['wr-switch'];\n const size = this.size();\n if (size !== 'md') parts.push(`wr-switch--${size}`);\n if (this.checked()) parts.push('wr-switch--checked');\n if (this.disabled()) parts.push('wr-switch--disabled');\n else if (this.readonly()) parts.push('wr-switch--readonly');\n return parts.join(' ');\n });\n\n /**\n * Focus the switch — what Signal Forms calls to focus this control. The native\n * input takes it, since the host has no tab stop of its own; a disabled switch\n * refuses, as a disabled input always does.\n */\n focus(options?: FocusOptions): void {\n this.native().nativeElement.focus(options);\n }\n\n // Template handlers\n\n /**\n * Cancel the toggle while readonly. `change` never fires for a click whose\n * default was prevented, so this is the only guard the pointer and Space paths\n * need; `onInputChange` keeps its own for a synthetic `change`.\n */\n protected onInputClick(event: Event): void {\n if (this.readonly()) event.preventDefault();\n }\n\n protected onInputChange(event: Event): void {\n if (this.readonly()) {\n // A synthetic `change` cannot be prevented — put the DOM back instead.\n (event.target as HTMLInputElement).checked = this.checked();\n return;\n }\n this.checked.set((event.target as HTMLInputElement).checked);\n }\n\n protected onInputBlur(): void {\n this.touch.emit();\n }\n}\n","<label class=\"wr-switch__label\" [for]=\"id()\">\n <input\n #native\n class=\"wr-switch__input\"\n type=\"checkbox\"\n role=\"switch\"\n [id]=\"id()\"\n [attr.aria-label]=\"ariaLabel()\"\n [checked]=\"checked()\"\n [disabled]=\"disabled()\"\n [attr.aria-readonly]=\"readonly() || null\"\n [attr.aria-invalid]=\"fieldAria.ariaInvalid()\"\n [attr.aria-describedby]=\"fieldAria.describedBy()\"\n (click)=\"onInputClick($event)\"\n (change)=\"onInputChange($event)\"\n (blur)=\"onInputBlur()\"\n />\n\n <span class=\"wr-switch__track\" aria-hidden=\"true\">\n <span class=\"wr-switch__thumb\"></span>\n </span>\n\n <span class=\"wr-switch__text\">\n <ng-content />\n </span>\n</label>\n"],"mappings":";;;;;;;;;;;AAuDA,IAAa,WAAb,MAAa,SAAQ;CACnB,cAAA;EACE,IAAI,OAAO,cAAc,eAAe,WAAW,cAAc,QAAQ;CAC3E;CAOS,YAAY,MAAqB,MAAK,GAAA,YAAA,CAAA,EAAA,WAAA,YAAA,CAAA,+BAAA,CAAA,CAAA;CAMtC,KAAK,MAAc,WAAW,WAAW,GAAE,GAAA,YAAA,CAAA,EAAA,WAAA,KAAA,CAAA,+BAAA,CAAA,CAAA;CAQ3C,WAAW,MAAM,OAAK;EAAA,GAAA,YAAA,EAAA,WAAA,WAAA,+BAAA,CAAA;EAAI,WAAW;CAAqB,CAAA;CAa1D,WAAW,MAAM,OAAK;EAAA,GAAA,YAAA,EAAA,WAAA,WAAA,+BAAA,CAAA;EAAI,WAAW;CAAqB,CAAA;CAGhD,YAAY,iBAAgB;CAGtC,OAAO,MAAoB,MAAK,GAAA,YAAA,CAAA,EAAA,WAAA,OAAA,CAAA,+BAAA,CAAA,CAAA;CAGhC,UAAU,MAAe,OAAM,GAAA,YAAA,CAAA,EAAA,WAAA,UAAA,CAAA,+BAAA,CAAA,CAAA;CAG/B,QAAQ,OAAM;CAEN,SAAS,UAAU,SAAuC,UAAS,GAAA,YAAA,CAAA,EAAA,WAAA,SAAA,CAAA,+BAAA,CAAA,CAAA;CAEjE,UAAU,eAAc;EACzC,MAAM,QAAQ,CAAC,WAAW;EAC1B,MAAM,OAAO,KAAK,KAAI;EACtB,IAAI,SAAS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AA,SAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,GAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,eAAA;EAAA,CAAA;EAAA,OAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,OAAA;EAAA,CAAA;EAAA,QAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,UAAQ,EAAA,UAAA,KAAA,CAAA;EAAA,CAAA;CAAA;AAAA,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"ngwr-table-testing.mjs","names":[],"sources":["../../../projects/lib/table/testing/wr-table-harness-text.ts","../../../projects/lib/table/testing/wr-table-cell-harness.ts","../../../projects/lib/table/testing/wr-table-header-cell-harness.ts","../../../projects/lib/table/testing/wr-table-row-harness.ts","../../../projects/lib/table/testing/wr-table-harness.ts"],"sourcesContent":["/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\n/**\n * Collapse the whitespace inside a table cell to what a user reads on one line.\n *\n * `TestElement.text()` only trims the ends, and a `<td>` is rarely one text node:\n * the tree column puts a toggle in front of the value, a `[wrTableExpand]` detail\n * cell holds whatever the consumer projected. The template's own indentation is\n * NOT the problem — Angular's default `preserveWhitespaces: false` drops\n * whitespace-only text nodes at compile time, so `'\\n Ada\\n'` never reaches\n * `textContent`. What does reach it is whitespace inside a VALUE (`'first\\n\\n\n * programmer'` out of a textarea or an API) and, in a consumer app compiled with\n * `preserveWhitespaces: true`, the indentation after all. Every run becomes one\n * space so a spec can assert the rendered line either way.\n */\nexport function wrTableHarnessText(text: string): string {\n return text.replace(/\\s+/g, ' ').trim();\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 { ContentContainerComponentHarness, HarnessPredicate } from '@angular/cdk/testing';\n\nimport type { WrTableCellHarnessFilters } from './types';\nimport { wrTableHarnessText } from './wr-table-harness-text';\n\n/**\n * Test harness for one data cell of a `<wr-table>` row.\n *\n * A CONTENT CONTAINER, because a cell is where a consumer's own components end\n * up: a `[wrTableCell]` template can render a `<wr-tag>`, a button, an input, and\n * `cell.getHarness(WrButtonHarness…)` resolves those INSIDE this cell — so the\n * \"Delete\" button of row 3 cannot be mistaken for the one in row 1.\n *\n * @example\n * ```ts\n * const [row] = await table.getRows({ cellText: 'Ada' });\n * const [status] = await row.getCells({ columnTitle: 'Status' });\n *\n * expect(await status.getText()).toBe('active');\n * ```\n *\n * @see https://ngwr.dev/guides/testing\n */\nexport class WrTableCellHarness extends ContentContainerComponentHarness {\n /**\n * Data cells only. The lead selection and expand cells carry the same\n * `.wr-table__td` class — they hold the row's controls, not its data — so a cell\n * list that swept them in would no longer line up with the header list.\n */\n static hostSelector = '.wr-table__td:not(.wr-table__td--select):not(.wr-table__td--expand)';\n\n /** Build a predicate that narrows the query. */\n static with(options: WrTableCellHarnessFilters = {}): HarnessPredicate<WrTableCellHarness> {\n return new HarnessPredicate(WrTableCellHarness, options)\n .addOption('text', options.text, (harness, text) => HarnessPredicate.stringMatches(harness.getText(), text))\n .addOption('columnTitle', options.columnTitle, (harness, title) =>\n HarnessPredicate.stringMatches(harness.getColumnTitle(), title)\n );\n }\n\n /** The cell's text, with the template's indentation collapsed to single spaces. */\n async getText(): Promise<string> {\n return wrTableHarnessText(await (await this.host()).text());\n }\n\n /**\n * The title of the column this cell belongs to.\n *\n * Read from `data-label` — the attribute responsive card mode prints in front of\n * each value — because it is the only place a cell says which column it is in.\n * The column KEY is never in the DOM at all.\n */\n async getColumnTitle(): Promise<string | null> {\n return (await this.host()).getAttribute('data-label');\n }\n\n /** Which edge the cell's column is frozen against, or `null` when it scrolls. */\n async getPin(): Promise<'left' | 'right' | null> {\n const host = await this.host();\n if (await host.hasClass('wr-table__td--pin-left')) return 'left';\n if (await host.hasClass('wr-table__td--pin-right')) return 'right';\n return null;\n }\n}\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { ComponentHarness, HarnessPredicate } from '@angular/cdk/testing';\n\nimport type { WrTableHeaderCellHarnessFilters } from './types';\n\n/**\n * Test harness for one column header of a `<wr-table>`.\n *\n * The selector deliberately skips the two LEAD headers — selection and expand —\n * which carry the same `.wr-table__th` class but hold a checkbox or nothing at\n * all. What is left lines up index-for-index with the data columns, so a header's\n * position is its column's position.\n *\n * Columns are addressed by their TITLE here and everywhere else in this harness\n * family, never by their `columns` key: the key never reaches the DOM. Only the\n * title does — in this header and in every cell's `data-label` — so it is the one\n * handle a spec and the rendered table share.\n *\n * @see https://ngwr.dev/guides/testing\n */\nexport class WrTableHeaderCellHarness extends ComponentHarness {\n static hostSelector = '.wr-table__th:not(.wr-table__th--select):not(.wr-table__th--expand)';\n\n /** Build a predicate that narrows the query. */\n static with(options: WrTableHeaderCellHarnessFilters = {}): HarnessPredicate<WrTableHeaderCellHarness> {\n return new HarnessPredicate(WrTableHeaderCellHarness, options)\n .addOption('text', options.text, (harness, text) => HarnessPredicate.stringMatches(harness.getText(), text))\n .addOption('sortable', options.sortable, async (harness, sortable) => (await harness.isSortable()) === sortable);\n }\n\n /** The column title, trimmed. The sort and filter controls are not part of it. */\n async getText(): Promise<string> {\n return (await this.locatorFor('.wr-table__title')()).text();\n }\n\n /**\n * The direction this column announces, exactly as `aria-sort` puts it — or\n * `null` when the column does not sort.\n *\n * `null` is not \"unsorted\": a sortable column with no direction announces\n * `'none'`, and only a plain column omits the attribute entirely. Claiming\n * sortability a column does not have is the bug that distinction prevents.\n *\n * Only the PRIMARY sort key announces a direction (ARIA puts `aria-sort` on one\n * header at a time), so a secondary key of a multi-column sort answers\n * `'none'` here while its arrow says otherwise. Read that one through\n * {@link getSortIndicator} and {@link getSortOrder}.\n */\n async getSortDirection(): Promise<'ascending' | 'descending' | 'none' | null> {\n const sort = await (await this.host()).getAttribute('aria-sort');\n return sort as 'ascending' | 'descending' | 'none' | null;\n }\n\n /**\n * The direction the header's indicator DRAWS — `'ascending'`, `'descending'`,\n * or `null` while the column is not sorted (or does not sort at all).\n *\n * The drawn half of the sort state, and the only half a secondary key has:\n * read from the indicator's own `--asc` / `--desc` modifier, so it answers for\n * every sorted column, where {@link getSortDirection} answers for the primary\n * one alone.\n */\n async getSortIndicator(): Promise<'ascending' | 'descending' | null> {\n const indicator = await this.locatorForOptional('wr-table-sort')();\n if (!indicator) return null;\n if (await indicator.hasClass('wr-table-sort--asc')) return 'ascending';\n if (await indicator.hasClass('wr-table-sort--desc')) return 'descending';\n return null;\n }\n\n /**\n * This column's 1-based place in the sort, or `null` when it does not sort by\n * anything right now.\n *\n * Read from the number drawn after the indicator while several columns sort.\n * A lone sorted column draws no number — a \"1\" would say nothing its arrow does\n * not — so it answers `1` from its indicator alone, and that is the one case\n * this method infers rather than reads.\n */\n async getSortOrder(): Promise<number | null> {\n const badge = await this.locatorForOptional('.wr-table__sort-order')();\n if (badge) return Number.parseInt(await badge.text(), 10);\n return (await this.getSortIndicator()) === null ? null : 1;\n }\n\n /** Whether the column offers sorting at all. */\n async isSortable(): Promise<boolean> {\n return (await this.getSortDirection()) !== null;\n }\n\n /**\n * Advance the sort one step — none → ascending → descending → none, the cycle a\n * click on the indicator drives.\n *\n * Throws on a column with no sort control rather than doing nothing: the quiet\n * version of this leaves a spec asserting an unchanged direction and passing.\n */\n async sort(): Promise<void> {\n const button = await this.locatorForOptional('.wr-table__sort-btn')();\n if (!button) {\n throw new Error(\n `WrTableHeaderCellHarness.sort(): the \"${await this.getText()}\" column has no sort control — ` +\n 'its column definition needs `sortable: true`.'\n );\n }\n await button.click();\n }\n\n /** Whether the column offers a filter dropdown (its definition carries a NON-EMPTY `filterItems`). */\n async isFilterable(): Promise<boolean> {\n return (await this.locatorForOptional('wr-table-filter')()) !== null;\n }\n\n /** Which edge the column is frozen against, or `null` when it scrolls with the rest. */\n async getPin(): Promise<'left' | 'right' | null> {\n const host = await this.host();\n if (await host.hasClass('wr-table__th--pin-left')) return 'left';\n if (await host.hasClass('wr-table__th--pin-right')) return 'right';\n return null;\n }\n}\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { ContentContainerComponentHarness, HarnessPredicate } from '@angular/cdk/testing';\n\nimport type { WrTableCellHarnessFilters, WrTableRowHarnessFilters } from './types';\nimport { WrTableCellHarness } from './wr-table-cell-harness';\n\n/**\n * Test harness for one body row of a `<wr-table>` — flat, grouped or tree.\n *\n * Also a CONTENT CONTAINER, so `row.getHarness(WrButtonHarness…)` reaches the\n * consumer's own components anywhere in the row without leaving this row.\n *\n * @example\n * ```ts\n * const [ada] = await table.getRows({ cellText: 'Ada' });\n *\n * await ada.select();\n * await (await ada.getHarness(WrButtonHarness.with({ text: 'Edit' }))).click();\n * ```\n *\n * @see https://ngwr.dev/guides/testing\n */\nexport class WrTableRowHarness extends ContentContainerComponentHarness {\n /**\n * `.wr-table__tr` is the DATA row and nothing else.\n *\n * Everything else a `<tbody>` can hold is a `<tr>` too: the group band\n * (`.wr-table__group-row`), its subtotal row, the detail row a `[wrTableExpand]`\n * template renders, the two virtual spacers, and the \"no data\" row. Querying\n * `tbody tr` would hand every one of those back as a row with no cells.\n */\n static hostSelector = '.wr-table__tr';\n\n /** Build a predicate that narrows the query. */\n static with(options: WrTableRowHarnessFilters = {}): HarnessPredicate<WrTableRowHarness> {\n return new HarnessPredicate(WrTableRowHarness, options)\n .addOption('cellText', options.cellText, async (harness, text) => {\n for (const cell of await harness.getCellTexts()) {\n if (await HarnessPredicate.stringMatches(cell, text)) return true;\n }\n return false;\n })\n .addOption('selected', options.selected, async (harness, selected) => (await harness.isSelected()) === selected)\n .addOption('expanded', options.expanded, async (harness, expanded) => (await harness.isExpanded()) === expanded)\n .addOption('level', options.level, async (harness, level) => (await harness.getLevel()) === level);\n }\n\n private readonly selectBox = this.locatorForOptional('.wr-table__td--select input.wr-checkbox__input');\n\n /**\n * The row's disclosure control, whichever of the two the table gave it: the lead\n * button of a `[wrTableExpand]` table, or the tree toggle inside the tree column.\n * The two never coexist — a tree row owns its own disclosure, so the component\n * refuses the pair.\n *\n * `button` in the tree selector is load-bearing. A leaf renders a `<span>` with\n * the same `.wr-table__tree-toggle` class purely to hold the indent, and taking\n * that for a control would report every leaf as expandable.\n */\n private readonly disclosure = this.locatorForOptional('.wr-table__expand-btn, button.wr-table__tree-toggle');\n\n /** The row's data cells, in DOM order. The lead control cells are not cells. */\n async getCells(filters: WrTableCellHarnessFilters = {}): Promise<WrTableCellHarness[]> {\n return this.locatorForAll(WrTableCellHarness.with(filters))();\n }\n\n /** The text of every data cell, in DOM order. */\n async getCellTexts(): Promise<string[]> {\n const cells = await this.getCells();\n return Promise.all(cells.map(cell => cell.getText()));\n }\n\n /**\n * Whether the row is selected.\n *\n * Read from the `--selected` modifier, which is what the row looks like and what\n * a consumer styles against. It also means a row is not \"selected\" while\n * `rowSelection` is off, however many keys the `selection` model holds — nothing\n * on screen says otherwise.\n */\n async isSelected(): Promise<boolean> {\n return (await this.host()).hasClass('wr-table__tr--selected');\n }\n\n /** Whether the row offers a selection checkbox at all. */\n async isSelectable(): Promise<boolean> {\n return (await this.selectBox()) !== null;\n }\n\n /** Flip the row's checkbox. Throws when the table has no selection column. */\n async toggleSelection(): Promise<void> {\n const box = await this.selectBox();\n if (!box) {\n throw new Error(\n 'WrTableRowHarness.toggleSelection(): this row has no checkbox — the table needs ' +\n \"`rowSelection` set to 'single' or 'multiple'.\"\n );\n }\n await box.click();\n }\n\n /** Select the row if it is not already selected. */\n async select(): Promise<void> {\n if (!(await this.isSelected())) await this.toggleSelection();\n }\n\n /** Deselect the row if it is selected. */\n async deselect(): Promise<void> {\n if (await this.isSelected()) await this.toggleSelection();\n }\n\n /**\n * Whether the row has something to open — a detail template's disclosure, or\n * children in a tree. A tree leaf answers `false`.\n */\n async isExpandable(): Promise<boolean> {\n return (await this.disclosure()) !== null;\n }\n\n /** Whether the row is open, from the disclosure's `aria-expanded`. */\n async isExpanded(): Promise<boolean> {\n const toggle = await this.disclosure();\n return toggle !== null && (await toggle.getAttribute('aria-expanded')) === 'true';\n }\n\n /** Open or close the row. Throws when it has nothing to open. */\n async toggleExpand(): Promise<void> {\n const toggle = await this.disclosure();\n if (!toggle) {\n throw new Error(\n 'WrTableRowHarness.toggleExpand(): this row has no disclosure control — a flat table needs a ' +\n '`[wrTableExpand]` template, and a tree row with no children is a leaf.'\n );\n }\n await toggle.click();\n }\n\n /**\n * The row's depth as the table announces it — 1-based `aria-level`, `null` in a\n * flat table, where depth is not a thing that exists.\n */\n async getLevel(): Promise<number | null> {\n return this.numericAttribute('aria-level');\n }\n\n /** The row's 1-based position among its siblings (`aria-posinset`), or `null` when flat. */\n async getPosInSet(): Promise<number | null> {\n return this.numericAttribute('aria-posinset');\n }\n\n /** How many rows are in the row's sibling set, itself included (`aria-setsize`); `null` when flat. */\n async getSetSize(): Promise<number | null> {\n return this.numericAttribute('aria-setsize');\n }\n\n /**\n * The row's 1-based index in the FULL dataset (`aria-rowindex`, header included),\n * or `null` when the table is not virtualized.\n *\n * Only a windowed table publishes it, and that is precisely when it matters: the\n * rows in the DOM are a slice, so their DOM order says nothing about where they\n * sit in the data.\n */\n async getRowIndex(): Promise<number | null> {\n return this.numericAttribute('aria-rowindex');\n }\n\n private async numericAttribute(name: string): Promise<number | null> {\n const value = await (await this.host()).getAttribute(name);\n return value === null ? null : Number.parseInt(value, 10);\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 { ComponentHarness, HarnessPredicate, type TestElement } from '@angular/cdk/testing';\n\nimport type { WrTableHarnessFilters, WrTableHeaderCellHarnessFilters, WrTableRowHarnessFilters } from './types';\nimport { wrTableHarnessText } from './wr-table-harness-text';\nimport { WrTableHeaderCellHarness } from './wr-table-header-cell-harness';\nimport { WrTableRowHarness } from './wr-table-row-harness';\n\n/**\n * Test harness for `<wr-table>` — the root of a small family, since a table is a\n * tree and not one control: {@link WrTableHeaderCellHarness} for a column header,\n * {@link WrTableRowHarness} for a body row, and `WrTableCellHarness` for a cell.\n *\n * Columns are addressed by their header TITLE, never by their `columns` key: the\n * key never reaches the DOM.\n *\n * What this harness deliberately does NOT do:\n * - open a column's filter dropdown. The panel is a `wr-dropdown` in the overlay\n * container, and driving it belongs to a dropdown harness rather than this one;\n * {@link WrTableHeaderCellHarness.isFilterable} reports that a column offers one.\n * - scroll a virtualized body. See {@link getRows}.\n *\n * @example\n * ```ts\n * const table = await loader.getHarness(WrTableHarness);\n *\n * expect(await table.getHeaderTexts()).toEqual(['Name', 'Role']);\n * await table.sortByColumn('Name');\n * expect(await table.getSortDirection('Name')).toBe('ascending');\n * ```\n *\n * @see https://ngwr.dev/guides/testing\n */\nexport class WrTableHarness extends ComponentHarness {\n static hostSelector = 'wr-table';\n\n /** Build a predicate that narrows the query — pass to `getHarness` / `getAllHarnesses`. */\n static with(options: WrTableHarnessFilters = {}): HarnessPredicate<WrTableHarness> {\n return new HarnessPredicate(WrTableHarness, options)\n .addOption('columnTitle', options.columnTitle, async (harness, title) => {\n for (const header of await harness.getHeaderTexts()) {\n if (await HarnessPredicate.stringMatches(header, title)) return true;\n }\n return false;\n })\n .addOption('tree', options.tree, async (harness, tree) => (await harness.isTree()) === tree);\n }\n\n private readonly tableEl = this.locatorFor('table.wr-table__table');\n private readonly selectAllBox = this.locatorForOptional('.wr-table__th--select input.wr-checkbox__input');\n\n /**\n * The role the table announces.\n *\n * A flat table sets no `role` at all, so it announces the native `table` role —\n * NOT `grid`, which would promise cell-by-cell keyboard navigation it does not\n * implement. `childrenKey` turns it into a `treegrid`, and that role is the only\n * place the hierarchy exists for a screen-reader user: the indent is decoration.\n */\n async getRole(): Promise<'treegrid' | 'table'> {\n return (await (await this.tableEl()).getAttribute('role')) === 'treegrid' ? 'treegrid' : 'table';\n }\n\n /** Whether the rows are a hierarchy rather than a flat list. */\n async isTree(): Promise<boolean> {\n return (await this.getRole()) === 'treegrid';\n }\n\n /**\n * Whether the body is WINDOWED right now.\n *\n * Read from the host modifier rather than from the input, and that is the point:\n * `virtualScroll` is a request, not a promise. The table falls back to rendering\n * every row whenever the layout stops being uniform — grouping, a detail\n * template, responsive card mode, a visible pager, a tree — so this answers what\n * actually happened.\n */\n async isVirtual(): Promise<boolean> {\n return (await this.host()).hasClass('wr-table--virtual');\n }\n\n /** Whether the loading spinner is covering the table. */\n async isLoading(): Promise<boolean> {\n return (await this.locatorForOptional('.wr-table__loading')()) !== null;\n }\n\n /** The column headers, in render order — which `columnOrder` and a drag can change. */\n async getHeaderCells(filters: WrTableHeaderCellHarnessFilters = {}): Promise<WrTableHeaderCellHarness[]> {\n return this.locatorForAll(WrTableHeaderCellHarness.with(filters))();\n }\n\n /**\n * The column titles, in render order.\n *\n * The selection and expand headers are not columns and are not here, so this\n * list stays as wide as every row from {@link getCellTexts}.\n */\n async getHeaderTexts(): Promise<string[]> {\n const headers = await this.getHeaderCells();\n return Promise.all(headers.map(header => header.getText()));\n }\n\n /**\n * The direction a column announces via `aria-sort`, or `null` when it does not\n * sort. Only the primary key of a multi-column sort announces one; see\n * {@link getSortIndicator} for the rest.\n */\n async getSortDirection(columnTitle: string): Promise<'ascending' | 'descending' | 'none' | null> {\n return (await this.headerCellFor(columnTitle)).getSortDirection();\n }\n\n /**\n * The direction a column's indicator draws, for every sorted column — a\n * secondary key included — or `null` when the column is not sorted.\n */\n async getSortIndicator(columnTitle: string): Promise<'ascending' | 'descending' | null> {\n return (await this.headerCellFor(columnTitle)).getSortIndicator();\n }\n\n /** A column's 1-based place in the sort (`1` is the primary key), or `null` when it is not sorted. */\n async getSortOrder(columnTitle: string): Promise<number | null> {\n return (await this.headerCellFor(columnTitle)).getSortOrder();\n }\n\n /**\n * Advance a column's sort one step — none → ascending → descending → none.\n *\n * Sorting is the host's job: `<wr-table>` publishes the intent through its `sort`\n * model and never reorders `items` itself, so a spec that expects the rows to\n * move has to sort the data the way the app does.\n */\n async sortByColumn(columnTitle: string): Promise<void> {\n await (await this.headerCellFor(columnTitle)).sort();\n }\n\n /**\n * The body rows currently rendered, in DOM order.\n *\n * \"Currently rendered\" is the whole caveat of a virtualized table: while\n * {@link isVirtual} is true the `<tbody>` holds only the window around the scroll\n * offset, padded by a spacer row at each end that still has rows to stand in for\n * (one of them, at the top or the bottom of the list), so this returns the\n * WINDOW — not the dataset.\n * {@link getAriaRowCount} is the total the table announces and\n * {@link WrTableRowHarness.getRowIndex} says where a row sits in it. Nothing here\n * scrolls that window on purpose: the viewport has no layout in a unit test, so a\n * `scrollTo` would silently do nothing. Reach for `WrTable.scrollToRow()` in a\n * real browser, or narrow the data instead.\n *\n * Group bands, per-group subtotals, detail rows and the \"no data\" row are not\n * rows and never appear here.\n */\n async getRows(filters: WrTableRowHarnessFilters = {}): Promise<WrTableRowHarness[]> {\n return this.locatorForAll(WrTableRowHarness.with(filters))();\n }\n\n /** The whole body as a matrix of cell text — one array per row, one entry per column. */\n async getCellTexts(): Promise<string[][]> {\n const rows = await this.getRows();\n return Promise.all(rows.map(row => row.getCellTexts()));\n }\n\n /**\n * The `<tfoot>` summary cells, one per column and `''` for a column with no\n * `summary`. Empty when no column defines one.\n *\n * The lead cells are dropped so this lines up with {@link getHeaderTexts}. A\n * per-group subtotal row is NOT here — it lives in the body, under its band.\n */\n async getFooterTexts(): Promise<string[]> {\n const cells = await this.locatorForAll('tfoot .wr-table__foot-cell:not(.wr-table__foot-cell--lead)')();\n return Promise.all(cells.map(async cell => wrTableHarnessText(await cell.text())));\n }\n\n /** The \"no data\" message, or `null` while the table has rows to show. */\n async getEmptyText(): Promise<string | null> {\n const empty = await this.locatorForOptional('.wr-table__empty')();\n return empty ? wrTableHarnessText(await empty.text()) : null;\n }\n\n /**\n * The row count the table announces (`aria-rowcount` — header and summary row\n * included), or `null` when it is not virtualized and every row is in the DOM.\n */\n async getAriaRowCount(): Promise<number | null> {\n const count = await (await this.tableEl()).getAttribute('aria-rowcount');\n return count === null ? null : Number.parseInt(count, 10);\n }\n\n /** Whether the header offers a select-all box — only `rowSelection=\"multiple\"` does. */\n async hasSelectAll(): Promise<boolean> {\n return (await this.selectAllBox()) !== null;\n }\n\n /** Whether every row in the select-all scope is selected — see {@link toggleSelectAll}. */\n async isAllSelected(): Promise<boolean> {\n return (await this.selectAllHost()).getProperty<boolean>('checked');\n }\n\n /**\n * Whether some rows are selected and others are not — the box's third state.\n *\n * `indeterminate` is a DOM PROPERTY, not an attribute: reading the attribute\n * reports `null` for a box that is visibly dashed.\n */\n async isPartiallySelected(): Promise<boolean> {\n return (await this.selectAllHost()).getProperty<boolean>('indeterminate');\n }\n\n /**\n * Click the select-all box, once.\n *\n * Its scope is the rows the table RENDERS — the current page, and a collapsed\n * group's rows are out because collapsing drops them from that list. A\n * virtualized table's off-window rows are IN, though: the window is a slice\n * taken after the list is built, so one click selects the whole dataset and not\n * just what is in the DOM. And the third state is worth knowing about before\n * asserting: while the selection is partial the box reads unchecked, so one\n * click selects everything rather than clearing it.\n */\n async toggleSelectAll(): Promise<void> {\n await (await this.selectAllHost()).click();\n }\n\n /**\n * The text of each open detail row, in row order.\n *\n * A detail row is a full-width `<tr>` NEXT TO the row it belongs to, not inside\n * it — which is why it is neither one of {@link getRows} nor one of a row's\n * cells.\n */\n async getDetailTexts(): Promise<string[]> {\n const details = await this.locatorForAll('.wr-table__detail')();\n return Promise.all(details.map(async detail => wrTableHarnessText(await detail.text())));\n }\n\n /**\n * The group band labels, in order.\n *\n * Empty when `groupBy` is off — and also when a `[wrTableGroupHeader]` template\n * replaced the built-in band, since the label is then the consumer's own markup.\n * Reach for that through {@link getRows}' siblings or your own component's\n * harness.\n */\n async getGroupLabels(): Promise<string[]> {\n const labels = await this.locatorForAll('.wr-table__group-label')();\n return Promise.all(labels.map(label => label.text()));\n }\n\n /** Whether the band with this label is collapsed. */\n async isGroupCollapsed(label: string): Promise<boolean> {\n const toggle = await this.groupToggleFor(label);\n return (await toggle.getAttribute('aria-expanded')) === 'false';\n }\n\n /** Collapse or expand the band with this label. */\n async toggleGroup(label: string): Promise<void> {\n await (await this.groupToggleFor(label)).click();\n }\n\n /** The header for a column title, or a failure that says which titles do exist. */\n private async headerCellFor(columnTitle: string): Promise<WrTableHeaderCellHarness> {\n const [header] = await this.getHeaderCells({ text: columnTitle });\n if (!header) {\n const titles = await this.getHeaderTexts();\n throw new Error(\n `WrTableHarness: no column headed \"${columnTitle}\". Columns are addressed by their title, ` +\n `not by their key — this table shows [${titles.join(', ')}].`\n );\n }\n return header;\n }\n\n /**\n * The collapse toggle of one band.\n *\n * Paired by index rather than by containment: both lists are emitted once per\n * band by the same loop, in the same order, and a `TestElement` cannot be\n * queried into.\n */\n private async groupToggleFor(label: string): Promise<TestElement> {\n const index = (await this.getGroupLabels()).indexOf(label);\n if (index < 0) {\n throw new Error(\n `WrTableHarness: no group band labelled \"${label}\" — is \\`groupBy\\` set, and is the band the ` +\n 'built-in one rather than a `[wrTableGroupHeader]` template?'\n );\n }\n return (await this.locatorForAll('.wr-table__group-toggle')())[index];\n }\n\n /** The select-all input, or a failure naming both reasons it is missing. */\n private async selectAllHost(): Promise<TestElement> {\n const box = await this.selectAllBox();\n if (!box) {\n throw new Error(\n 'WrTableHarness: this table has no select-all box — `rowSelection` is off, or it is ' +\n \"'single', which has no select-all by design.\"\n );\n }\n return box;\n }\n}\n"],"mappings":";;;;;;;AAoBA,SAAgB,mBAAmB,MAAY;CAC7C,OAAO,KAAK,QAAQ,QAAQ,GAAG,CAAC,CAAC,KAAI;AACvC;;;;;;;ACQA,IAAa,qBAAb,MAAa,2BAA2B,iCAAgC;CAMtE,OAAO,eAAe;CAGtB,OAAO,KAAK,UAAqC,CAAA,GAAE;EACjD,OAAO,IAA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AQ,GACV,MAAM,IAAI,MACR,2CAA2C,MAAK,0GACe;EAGnE,QAAQ,MAAM,KAAK,cAAc,yBAAyB,CAAC,CAAA,EAAA,CAAI;CACjE;CAGQ,MAAM,gBAAa;EACzB,MAAM,MAAM,MAAM,KAAK,aAAY;EACnC,IAAI,CAAC,KACH,MAAM,IAAI,MACR,iIACgD;EAGpD,OAAO;CACT"}
1
+ {"version":3,"file":"ngwr-table-testing.mjs","names":[],"sources":["../../../projects/lib/table/testing/wr-table-harness-text.ts","../../../projects/lib/table/testing/wr-table-cell-harness.ts","../../../projects/lib/table/testing/wr-table-header-cell-harness.ts","../../../projects/lib/table/testing/wr-table-row-harness.ts","../../../projects/lib/table/testing/wr-table-harness.ts"],"sourcesContent":["/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\n/**\n * Collapse the whitespace inside a table cell to what a user reads on one line.\n *\n * `TestElement.text()` only trims the ends, and a `<td>` is rarely one text node:\n * the tree column puts a toggle in front of the value, a `[wrTableExpand]` detail\n * cell holds whatever the consumer projected. The template's own indentation is\n * NOT the problem — Angular's default `preserveWhitespaces: false` drops\n * whitespace-only text nodes at compile time, so `'\\n Ada\\n'` never reaches\n * `textContent`. What does reach it is whitespace inside a VALUE (`'first\\n\\n\n * programmer'` out of a textarea or an API) and, in a consumer app compiled with\n * `preserveWhitespaces: true`, the indentation after all. Every run becomes one\n * space so a spec can assert the rendered line either way.\n */\nexport function wrTableHarnessText(text: string): string {\n return text.replace(/\\s+/g, ' ').trim();\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 { ContentContainerComponentHarness, HarnessPredicate } from '@angular/cdk/testing';\n\nimport type { WrTableCellHarnessFilters } from './types';\nimport { wrTableHarnessText } from './wr-table-harness-text';\n\n/**\n * Test harness for one data cell of a `<wr-table>` row.\n *\n * A CONTENT CONTAINER, because a cell is where a consumer's own components end\n * up: a `[wrTableCell]` template can render a `<wr-tag>`, a button, an input, and\n * `cell.getHarness(WrButtonHarness…)` resolves those INSIDE this cell — so the\n * \"Delete\" button of row 3 cannot be mistaken for the one in row 1.\n *\n * @example\n * ```ts\n * const [row] = await table.getRows({ cellText: 'Ada' });\n * const [status] = await row.getCells({ columnTitle: 'Status' });\n *\n * expect(await status.getText()).toBe('active');\n * ```\n *\n * @see https://ngwr.dev/guides/testing\n */\nexport class WrTableCellHarness extends ContentContainerComponentHarness {\n /**\n * Data cells only. The lead selection and expand cells carry the same\n * `.wr-table__td` class — they hold the row's controls, not its data — so a cell\n * list that swept them in would no longer line up with the header list.\n */\n static hostSelector = '.wr-table__td:not(.wr-table__td--select):not(.wr-table__td--expand)';\n\n /** Build a predicate that narrows the query. */\n static with(options: WrTableCellHarnessFilters = {}): HarnessPredicate<WrTableCellHarness> {\n return new HarnessPredicate(WrTableCellHarness, options)\n .addOption('text', options.text, (harness, text) => HarnessPredicate.stringMatches(harness.getText(), text))\n .addOption('columnTitle', options.columnTitle, (harness, title) =>\n HarnessPredicate.stringMatches(harness.getColumnTitle(), title)\n );\n }\n\n /** The cell's text, with the template's indentation collapsed to single spaces. */\n async getText(): Promise<string> {\n return wrTableHarnessText(await (await this.host()).text());\n }\n\n /**\n * The title of the column this cell belongs to.\n *\n * Read from `data-label` — the attribute responsive card mode prints in front of\n * each value — because it is the only place a cell says which column it is in.\n * The column KEY is never in the DOM at all.\n */\n async getColumnTitle(): Promise<string | null> {\n return (await this.host()).getAttribute('data-label');\n }\n\n /** Which edge the cell's column is frozen against, or `null` when it scrolls. */\n async getPin(): Promise<'left' | 'right' | null> {\n const host = await this.host();\n if (await host.hasClass('wr-table__td--pin-left')) return 'left';\n if (await host.hasClass('wr-table__td--pin-right')) return 'right';\n return null;\n }\n}\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { ComponentHarness, HarnessPredicate } from '@angular/cdk/testing';\n\nimport type { WrTableHeaderCellHarnessFilters } from './types';\n\n/**\n * Test harness for one column header of a `<wr-table>`.\n *\n * The selector deliberately skips the two LEAD headers — selection and expand —\n * which carry the same `.wr-table__th` class but hold a checkbox or nothing at\n * all. What is left lines up index-for-index with the data columns, so a header's\n * position is its column's position.\n *\n * Columns are addressed by their TITLE here and everywhere else in this harness\n * family, never by their `columns` key: the key never reaches the DOM. Only the\n * title does — in this header and in every cell's `data-label` — so it is the one\n * handle a spec and the rendered table share.\n *\n * @see https://ngwr.dev/guides/testing\n */\nexport class WrTableHeaderCellHarness extends ComponentHarness {\n static hostSelector = '.wr-table__th:not(.wr-table__th--select):not(.wr-table__th--expand)';\n\n /** Build a predicate that narrows the query. */\n static with(options: WrTableHeaderCellHarnessFilters = {}): HarnessPredicate<WrTableHeaderCellHarness> {\n return new HarnessPredicate(WrTableHeaderCellHarness, options)\n .addOption('text', options.text, (harness, text) => HarnessPredicate.stringMatches(harness.getText(), text))\n .addOption('sortable', options.sortable, async (harness, sortable) => (await harness.isSortable()) === sortable);\n }\n\n /** The column title, trimmed. The sort and filter controls are not part of it. */\n async getText(): Promise<string> {\n return (await this.locatorFor('.wr-table__title')()).text();\n }\n\n /**\n * The direction this column announces, exactly as `aria-sort` puts it — or\n * `null` when the column does not sort.\n *\n * `null` is not \"unsorted\": a sortable column with no direction announces\n * `'none'`, and only a plain column omits the attribute entirely. Claiming\n * sortability a column does not have is the bug that distinction prevents.\n *\n * Only the PRIMARY sort key announces a direction (ARIA puts `aria-sort` on one\n * header at a time), so a secondary key of a multi-column sort answers\n * `'none'` here while its arrow says otherwise. Read that one through\n * {@link getSortIndicator} and {@link getSortOrder}.\n */\n async getSortDirection(): Promise<'ascending' | 'descending' | 'none' | null> {\n const sort = await (await this.host()).getAttribute('aria-sort');\n return sort as 'ascending' | 'descending' | 'none' | null;\n }\n\n /**\n * The direction the header's indicator DRAWS — `'ascending'`, `'descending'`,\n * or `null` while the column is not sorted (or does not sort at all).\n *\n * The drawn half of the sort state, and the only half a secondary key has:\n * read from the indicator's own `--asc` / `--desc` modifier, so it answers for\n * every sorted column, where {@link getSortDirection} answers for the primary\n * one alone.\n */\n async getSortIndicator(): Promise<'ascending' | 'descending' | null> {\n const indicator = await this.locatorForOptional('wr-table-sort')();\n if (!indicator) return null;\n if (await indicator.hasClass('wr-table-sort--asc')) return 'ascending';\n if (await indicator.hasClass('wr-table-sort--desc')) return 'descending';\n return null;\n }\n\n /**\n * This column's 1-based place in the sort, or `null` when it does not sort by\n * anything right now.\n *\n * Read from the number drawn after the indicator while several columns sort.\n * A lone sorted column draws no number — a \"1\" would say nothing its arrow does\n * not — so it answers `1` from its indicator alone, and that is the one case\n * this method infers rather than reads.\n */\n async getSortOrder(): Promise<number | null> {\n const badge = await this.locatorForOptional('.wr-table__sort-order')();\n if (badge) return Number.parseInt(await badge.text(), 10);\n return (await this.getSortIndicator()) === null ? null : 1;\n }\n\n /** Whether the column offers sorting at all. */\n async isSortable(): Promise<boolean> {\n return (await this.getSortDirection()) !== null;\n }\n\n /**\n * Advance the sort one step — none → ascending → descending → none, the cycle a\n * click on the indicator drives.\n *\n * Throws on a column with no sort control rather than doing nothing: the quiet\n * version of this leaves a spec asserting an unchanged direction and passing.\n */\n async sort(): Promise<void> {\n const button = await this.locatorForOptional('.wr-table__sort-btn')();\n if (!button) {\n throw new Error(\n `WrTableHeaderCellHarness.sort(): the \"${await this.getText()}\" column has no sort control — ` +\n 'its column definition needs `sortable: true`.'\n );\n }\n await button.click();\n }\n\n /** Whether the column offers a filter dropdown (its definition carries a NON-EMPTY `filterItems`). */\n async isFilterable(): Promise<boolean> {\n return (await this.locatorForOptional('wr-table-filter')()) !== null;\n }\n\n /** Which edge the column is frozen against, or `null` when it scrolls with the rest. */\n async getPin(): Promise<'left' | 'right' | null> {\n const host = await this.host();\n if (await host.hasClass('wr-table__th--pin-left')) return 'left';\n if (await host.hasClass('wr-table__th--pin-right')) return 'right';\n return null;\n }\n}\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { ContentContainerComponentHarness, HarnessPredicate } from '@angular/cdk/testing';\n\nimport type { WrTableCellHarnessFilters, WrTableRowHarnessFilters } from './types';\nimport { WrTableCellHarness } from './wr-table-cell-harness';\n\n/**\n * Test harness for one body row of a `<wr-table>` — flat, grouped or tree.\n *\n * Also a CONTENT CONTAINER, so `row.getHarness(WrButtonHarness…)` reaches the\n * consumer's own components anywhere in the row without leaving this row.\n *\n * @example\n * ```ts\n * const [ada] = await table.getRows({ cellText: 'Ada' });\n *\n * await ada.select();\n * await (await ada.getHarness(WrButtonHarness.with({ text: 'Edit' }))).click();\n * ```\n *\n * @see https://ngwr.dev/guides/testing\n */\nexport class WrTableRowHarness extends ContentContainerComponentHarness {\n /**\n * `.wr-table__tr` is the DATA row and nothing else.\n *\n * Everything else a `<tbody>` can hold is a `<tr>` too: the group band\n * (`.wr-table__group-row`), its subtotal row, the detail row a `[wrTableExpand]`\n * template renders, the two virtual spacers, and the \"no data\" row. Querying\n * `tbody tr` would hand every one of those back as a row with no cells.\n */\n static hostSelector = '.wr-table__tr';\n\n /** Build a predicate that narrows the query. */\n static with(options: WrTableRowHarnessFilters = {}): HarnessPredicate<WrTableRowHarness> {\n return new HarnessPredicate(WrTableRowHarness, options)\n .addOption('cellText', options.cellText, async (harness, text) => {\n for (const cell of await harness.getCellTexts()) {\n if (await HarnessPredicate.stringMatches(cell, text)) return true;\n }\n return false;\n })\n .addOption('selected', options.selected, async (harness, selected) => (await harness.isSelected()) === selected)\n .addOption('expanded', options.expanded, async (harness, expanded) => (await harness.isExpanded()) === expanded)\n .addOption('level', options.level, async (harness, level) => (await harness.getLevel()) === level);\n }\n\n private readonly selectBox = this.locatorForOptional('.wr-table__td--select input.wr-checkbox__input');\n\n /**\n * The row's disclosure control, whichever of the two the table gave it: the lead\n * button of a `[wrTableExpand]` table, or the tree toggle inside the tree column.\n * The two never coexist — a tree row owns its own disclosure, so the component\n * refuses the pair.\n *\n * `button` in the tree selector is load-bearing. A leaf renders a `<span>` with\n * the same `.wr-table__tree-toggle` class purely to hold the indent, and taking\n * that for a control would report every leaf as expandable.\n */\n private readonly disclosure = this.locatorForOptional('.wr-table__expand-btn, button.wr-table__tree-toggle');\n\n /** The row's data cells, in DOM order. The lead control cells are not cells. */\n async getCells(filters: WrTableCellHarnessFilters = {}): Promise<WrTableCellHarness[]> {\n return this.locatorForAll(WrTableCellHarness.with(filters))();\n }\n\n /** The text of every data cell, in DOM order. */\n async getCellTexts(): Promise<string[]> {\n const cells = await this.getCells();\n return Promise.all(cells.map(cell => cell.getText()));\n }\n\n /**\n * Whether the row is selected.\n *\n * Read from the `--selected` modifier, which is what the row looks like and what\n * a consumer styles against. It also means a row is not \"selected\" while\n * `rowSelection` is off, however many keys the `selection` model holds — nothing\n * on screen says otherwise.\n */\n async isSelected(): Promise<boolean> {\n return (await this.host()).hasClass('wr-table__tr--selected');\n }\n\n /** Whether the row offers a selection checkbox at all. */\n async isSelectable(): Promise<boolean> {\n return (await this.selectBox()) !== null;\n }\n\n /** Flip the row's checkbox. Throws when the table has no selection column. */\n async toggleSelection(): Promise<void> {\n const box = await this.selectBox();\n if (!box) {\n throw new Error(\n 'WrTableRowHarness.toggleSelection(): this row has no checkbox — the table needs ' +\n \"`rowSelection` set to 'single' or 'multiple'.\"\n );\n }\n await box.click();\n }\n\n /** Select the row if it is not already selected. */\n async select(): Promise<void> {\n if (!(await this.isSelected())) await this.toggleSelection();\n }\n\n /** Deselect the row if it is selected. */\n async deselect(): Promise<void> {\n if (await this.isSelected()) await this.toggleSelection();\n }\n\n /**\n * Whether the row has something to open — a detail template's disclosure, or\n * children in a tree. A tree leaf answers `false`.\n */\n async isExpandable(): Promise<boolean> {\n return (await this.disclosure()) !== null;\n }\n\n /** Whether the row is open, from the disclosure's `aria-expanded`. */\n async isExpanded(): Promise<boolean> {\n const toggle = await this.disclosure();\n return toggle !== null && (await toggle.getAttribute('aria-expanded')) === 'true';\n }\n\n /** Open or close the row. Throws when it has nothing to open. */\n async toggleExpand(): Promise<void> {\n const toggle = await this.disclosure();\n if (!toggle) {\n throw new Error(\n 'WrTableRowHarness.toggleExpand(): this row has no disclosure control — a flat table needs a ' +\n '`[wrTableExpand]` template, and a tree row with no children is a leaf.'\n );\n }\n await toggle.click();\n }\n\n /**\n * The row's depth as the table announces it — 1-based `aria-level`, `null` in a\n * flat table, where depth is not a thing that exists.\n */\n async getLevel(): Promise<number | null> {\n return this.numericAttribute('aria-level');\n }\n\n /** The row's 1-based position among its siblings (`aria-posinset`), or `null` when flat. */\n async getPosInSet(): Promise<number | null> {\n return this.numericAttribute('aria-posinset');\n }\n\n /** How many rows are in the row's sibling set, itself included (`aria-setsize`); `null` when flat. */\n async getSetSize(): Promise<number | null> {\n return this.numericAttribute('aria-setsize');\n }\n\n /**\n * The row's 1-based index in the FULL dataset (`aria-rowindex`, header included),\n * or `null` when the table is not virtualized.\n *\n * Only a windowed table publishes it, and that is precisely when it matters: the\n * rows in the DOM are a slice, so their DOM order says nothing about where they\n * sit in the data.\n */\n async getRowIndex(): Promise<number | null> {\n return this.numericAttribute('aria-rowindex');\n }\n\n private async numericAttribute(name: string): Promise<number | null> {\n const value = await (await this.host()).getAttribute(name);\n return value === null ? null : Number.parseInt(value, 10);\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 { ComponentHarness, HarnessPredicate, type TestElement } from '@angular/cdk/testing';\n\nimport type { WrTableHarnessFilters, WrTableHeaderCellHarnessFilters, WrTableRowHarnessFilters } from './types';\nimport { wrTableHarnessText } from './wr-table-harness-text';\nimport { WrTableHeaderCellHarness } from './wr-table-header-cell-harness';\nimport { WrTableRowHarness } from './wr-table-row-harness';\n\n/**\n * Test harness for `<wr-table>` — the root of a small family, since a table is a\n * tree and not one control: {@link WrTableHeaderCellHarness} for a column header,\n * {@link WrTableRowHarness} for a body row, and `WrTableCellHarness` for a cell.\n *\n * Columns are addressed by their header TITLE, never by their `columns` key: the\n * key never reaches the DOM.\n *\n * What this harness deliberately does NOT do:\n * - open a column's filter dropdown. The panel is a `wr-dropdown` in the overlay\n * container, and driving it belongs to a dropdown harness rather than this one;\n * {@link WrTableHeaderCellHarness.isFilterable} reports that a column offers one.\n * - scroll a virtualized body. See {@link getRows}.\n *\n * @example\n * ```ts\n * const table = await loader.getHarness(WrTableHarness);\n *\n * expect(await table.getHeaderTexts()).toEqual(['Name', 'Role']);\n * await table.sortByColumn('Name');\n * expect(await table.getSortDirection('Name')).toBe('ascending');\n * ```\n *\n * @see https://ngwr.dev/guides/testing\n */\nexport class WrTableHarness extends ComponentHarness {\n static hostSelector = 'wr-table';\n\n /** Build a predicate that narrows the query — pass to `getHarness` / `getAllHarnesses`. */\n static with(options: WrTableHarnessFilters = {}): HarnessPredicate<WrTableHarness> {\n return new HarnessPredicate(WrTableHarness, options)\n .addOption('columnTitle', options.columnTitle, async (harness, title) => {\n for (const header of await harness.getHeaderTexts()) {\n if (await HarnessPredicate.stringMatches(header, title)) return true;\n }\n return false;\n })\n .addOption('tree', options.tree, async (harness, tree) => (await harness.isTree()) === tree);\n }\n\n private readonly tableEl = this.locatorFor('table.wr-table__table');\n private readonly selectAllBox = this.locatorForOptional('.wr-table__th--select input.wr-checkbox__input');\n\n /**\n * The role the table announces.\n *\n * A flat table sets no `role` at all, so it announces the native `table` role —\n * NOT `grid`, which would promise cell-by-cell keyboard navigation it does not\n * implement. `childrenKey` turns it into a `treegrid`, and that role is the only\n * place the hierarchy exists for a screen-reader user: the indent is decoration.\n */\n async getRole(): Promise<'treegrid' | 'table'> {\n return (await (await this.tableEl()).getAttribute('role')) === 'treegrid' ? 'treegrid' : 'table';\n }\n\n /** Whether the rows are a hierarchy rather than a flat list. */\n async isTree(): Promise<boolean> {\n return (await this.getRole()) === 'treegrid';\n }\n\n /**\n * Whether the body is WINDOWED right now.\n *\n * Read from the host modifier rather than from the input, and that is the point:\n * `virtualScroll` is a request, not a promise. The table falls back to rendering\n * every row whenever the layout stops being uniform — grouping, a detail\n * template, responsive card mode, a visible pager, a tree — so this answers what\n * actually happened.\n */\n async isVirtual(): Promise<boolean> {\n return (await this.host()).hasClass('wr-table--virtual');\n }\n\n /** Whether the loading spinner is covering the table. */\n async isLoading(): Promise<boolean> {\n return (await this.locatorForOptional('.wr-table__loading')()) !== null;\n }\n\n /** The column headers, in render order — which `columnOrder` and a drag can change. */\n async getHeaderCells(filters: WrTableHeaderCellHarnessFilters = {}): Promise<WrTableHeaderCellHarness[]> {\n return this.locatorForAll(WrTableHeaderCellHarness.with(filters))();\n }\n\n /**\n * The column titles, in render order.\n *\n * The selection and expand headers are not columns and are not here, so this\n * list stays as wide as every row from {@link getCellTexts}.\n */\n async getHeaderTexts(): Promise<string[]> {\n const headers = await this.getHeaderCells();\n return Promise.all(headers.map(header => header.getText()));\n }\n\n /**\n * The direction a column announces via `aria-sort`, or `null` when it does not\n * sort. Only the primary key of a multi-column sort announces one; see\n * {@link getSortIndicator} for the rest.\n */\n async getSortDirection(columnTitle: string): Promise<'ascending' | 'descending' | 'none' | null> {\n return (await this.headerCellFor(columnTitle)).getSortDirection();\n }\n\n /**\n * The direction a column's indicator draws, for every sorted column — a\n * secondary key included — or `null` when the column is not sorted.\n */\n async getSortIndicator(columnTitle: string): Promise<'ascending' | 'descending' | null> {\n return (await this.headerCellFor(columnTitle)).getSortIndicator();\n }\n\n /** A column's 1-based place in the sort (`1` is the primary key), or `null` when it is not sorted. */\n async getSortOrder(columnTitle: string): Promise<number | null> {\n return (await this.headerCellFor(columnTitle)).getSortOrder();\n }\n\n /**\n * Advance a column's sort one step — none → ascending → descending → none.\n *\n * Sorting is the host's job: `<wr-table>` publishes the intent through its `sort`\n * model and never reorders `items` itself, so a spec that expects the rows to\n * move has to sort the data the way the app does.\n */\n async sortByColumn(columnTitle: string): Promise<void> {\n await (await this.headerCellFor(columnTitle)).sort();\n }\n\n /**\n * The body rows currently rendered, in DOM order.\n *\n * \"Currently rendered\" is the whole caveat of a virtualized table: while\n * {@link isVirtual} is true the `<tbody>` holds only the window around the scroll\n * offset, padded by a spacer row at each end that still has rows to stand in for\n * (one of them, at the top or the bottom of the list), so this returns the\n * WINDOW — not the dataset.\n * {@link getAriaRowCount} is the total the table announces and\n * {@link WrTableRowHarness.getRowIndex} says where a row sits in it. Nothing here\n * scrolls that window on purpose: the viewport has no layout in a unit test, so a\n * `scrollTo` would silently do nothing. Reach for `WrTable.scrollToRow()` in a\n * real browser, or narrow the data instead.\n *\n * Group bands, per-group subtotals, detail rows and the \"no data\" row are not\n * rows and never appear here.\n */\n async getRows(filters: WrTableRowHarnessFilters = {}): Promise<WrTableRowHarness[]> {\n return this.locatorForAll(WrTableRowHarness.with(filters))();\n }\n\n /** The whole body as a matrix of cell text — one array per row, one entry per column. */\n async getCellTexts(): Promise<string[][]> {\n const rows = await this.getRows();\n return Promise.all(rows.map(row => row.getCellTexts()));\n }\n\n /**\n * The `<tfoot>` summary cells, one per column and `''` for a column with no\n * `summary`. Empty when no column defines one.\n *\n * The lead cells are dropped so this lines up with {@link getHeaderTexts}. A\n * per-group subtotal row is NOT here — it lives in the body, under its band.\n */\n async getFooterTexts(): Promise<string[]> {\n const cells = await this.locatorForAll('tfoot .wr-table__foot-cell:not(.wr-table__foot-cell--lead)')();\n return Promise.all(cells.map(async cell => wrTableHarnessText(await cell.text())));\n }\n\n /** The \"no data\" message, or `null` while the table has rows to show. */\n async getEmptyText(): Promise<string | null> {\n const empty = await this.locatorForOptional('.wr-table__empty')();\n return empty ? wrTableHarnessText(await empty.text()) : null;\n }\n\n /**\n * The row count the table announces (`aria-rowcount` — header and summary row\n * included), or `null` when it is not virtualized and every row is in the DOM.\n */\n async getAriaRowCount(): Promise<number | null> {\n const count = await (await this.tableEl()).getAttribute('aria-rowcount');\n return count === null ? null : Number.parseInt(count, 10);\n }\n\n /** Whether the header offers a select-all box — only `rowSelection=\"multiple\"` does. */\n async hasSelectAll(): Promise<boolean> {\n return (await this.selectAllBox()) !== null;\n }\n\n /** Whether every row in the select-all scope is selected — see {@link toggleSelectAll}. */\n async isAllSelected(): Promise<boolean> {\n return (await this.selectAllHost()).getProperty<boolean>('checked');\n }\n\n /**\n * Whether some rows are selected and others are not — the box's third state.\n *\n * `indeterminate` is a DOM PROPERTY, not an attribute: reading the attribute\n * reports `null` for a box that is visibly dashed.\n */\n async isPartiallySelected(): Promise<boolean> {\n return (await this.selectAllHost()).getProperty<boolean>('indeterminate');\n }\n\n /**\n * Click the select-all box, once.\n *\n * Under `selectAllScope=\"all\"` its scope is every page of `items`. Otherwise\n * its scope is the rows the table RENDERS — the current page, and a collapsed\n * group's rows are out because collapsing drops them from that list. A\n * virtualized table's off-window rows are IN, though: the window is a slice\n * taken after the list is built, so one click selects the whole dataset and not\n * just what is in the DOM. And the third state is worth knowing about before\n * asserting: while the selection is partial the box reads unchecked, so one\n * click selects everything rather than clearing it.\n */\n async toggleSelectAll(): Promise<void> {\n await (await this.selectAllHost()).click();\n }\n\n /**\n * The text of each open detail row, in row order.\n *\n * A detail row is a full-width `<tr>` NEXT TO the row it belongs to, not inside\n * it — which is why it is neither one of {@link getRows} nor one of a row's\n * cells.\n */\n async getDetailTexts(): Promise<string[]> {\n const details = await this.locatorForAll('.wr-table__detail')();\n return Promise.all(details.map(async detail => wrTableHarnessText(await detail.text())));\n }\n\n /**\n * The group band labels, in order.\n *\n * Empty when `groupBy` is off — and also when a `[wrTableGroupHeader]` template\n * replaced the built-in band, since the label is then the consumer's own markup.\n * Reach for that through {@link getRows}' siblings or your own component's\n * harness.\n */\n async getGroupLabels(): Promise<string[]> {\n const labels = await this.locatorForAll('.wr-table__group-label')();\n return Promise.all(labels.map(label => label.text()));\n }\n\n /** Whether the band with this label is collapsed. */\n async isGroupCollapsed(label: string): Promise<boolean> {\n const toggle = await this.groupToggleFor(label);\n return (await toggle.getAttribute('aria-expanded')) === 'false';\n }\n\n /** Collapse or expand the band with this label. */\n async toggleGroup(label: string): Promise<void> {\n await (await this.groupToggleFor(label)).click();\n }\n\n /** The header for a column title, or a failure that says which titles do exist. */\n private async headerCellFor(columnTitle: string): Promise<WrTableHeaderCellHarness> {\n const [header] = await this.getHeaderCells({ text: columnTitle });\n if (!header) {\n const titles = await this.getHeaderTexts();\n throw new Error(\n `WrTableHarness: no column headed \"${columnTitle}\". Columns are addressed by their title, ` +\n `not by their key — this table shows [${titles.join(', ')}].`\n );\n }\n return header;\n }\n\n /**\n * The collapse toggle of one band.\n *\n * Paired by index rather than by containment: both lists are emitted once per\n * band by the same loop, in the same order, and a `TestElement` cannot be\n * queried into.\n */\n private async groupToggleFor(label: string): Promise<TestElement> {\n const index = (await this.getGroupLabels()).indexOf(label);\n if (index < 0) {\n throw new Error(\n `WrTableHarness: no group band labelled \"${label}\" — is \\`groupBy\\` set, and is the band the ` +\n 'built-in one rather than a `[wrTableGroupHeader]` template?'\n );\n }\n return (await this.locatorForAll('.wr-table__group-toggle')())[index];\n }\n\n /** The select-all input, or a failure naming both reasons it is missing. */\n private async selectAllHost(): Promise<TestElement> {\n const box = await this.selectAllBox();\n if (!box) {\n throw new Error(\n 'WrTableHarness: this table has no select-all box — `rowSelection` is off, or it is ' +\n \"'single', which has no select-all by design.\"\n );\n }\n return box;\n }\n}\n"],"mappings":";;;;;;;AAoBA,SAAgB,mBAAmB,MAAY;CAC7C,OAAO,KAAK,QAAQ,QAAQ,GAAG,CAAC,CAAC,KAAI;AACvC;;;;;;;ACQA,IAAa,qBAAb,MAAa,2BAA2B,iCAAgC;CAMtE,OAAO,eAAe;CAGtB,OAAO,KAAK,UAAqC,CAAA,GAAE;EACjD,OAAO,IAAI,iBAAiB,oBAAoB,OAAO,CAAC,CACrD,UAAU,QAAQ,QAAQ,OAAO,SAAS,SAAS,iBAAiB,cA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