ngwr 16.2.0 → 16.4.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 (418) hide show
  1. package/badge/styles/_tag.scss +73 -1
  2. package/calendar/styles/_index.scss +22 -0
  3. package/carousel/styles/_index.scss +53 -1
  4. package/cascader/styles/_rules.scss +7 -0
  5. package/color-picker/styles/_index.scss +21 -0
  6. package/date-picker/styles/_index.scss +19 -0
  7. package/dropdown/styles/_index.scss +13 -19
  8. package/fesm2022/ngwr-affix.mjs +3 -3
  9. package/fesm2022/ngwr-alert-testing.mjs +70 -0
  10. package/fesm2022/ngwr-alert-testing.mjs.map +1 -0
  11. package/fesm2022/ngwr-alert.mjs +3 -3
  12. package/fesm2022/ngwr-anchor.mjs +17 -6
  13. package/fesm2022/ngwr-anchor.mjs.map +1 -1
  14. package/fesm2022/ngwr-animations-aurora.mjs +3 -3
  15. package/fesm2022/ngwr-animations-blur-reveal.mjs +3 -3
  16. package/fesm2022/ngwr-animations-click-sparks.mjs +3 -3
  17. package/fesm2022/ngwr-animations-confetti.mjs +3 -3
  18. package/fesm2022/ngwr-animations-decode.mjs +3 -3
  19. package/fesm2022/ngwr-animations-destruct.mjs +3 -3
  20. package/fesm2022/ngwr-animations-dot-grid.mjs +3 -3
  21. package/fesm2022/ngwr-animations-falling-letters.mjs +3 -3
  22. package/fesm2022/ngwr-animations-flow-lines.mjs +3 -3
  23. package/fesm2022/ngwr-animations-fluid-cursor.mjs +3 -3
  24. package/fesm2022/ngwr-animations-glitch.mjs +3 -3
  25. package/fesm2022/ngwr-animations-glow-border.mjs +3 -3
  26. package/fesm2022/ngwr-animations-gradient-flow.mjs +3 -3
  27. package/fesm2022/ngwr-animations-marquee.mjs +3 -3
  28. package/fesm2022/ngwr-animations-orbit.mjs +3 -3
  29. package/fesm2022/ngwr-animations-reveal.mjs +3 -3
  30. package/fesm2022/ngwr-animations-ripple-grid.mjs +3 -3
  31. package/fesm2022/ngwr-animations-rotate-reveal.mjs +3 -3
  32. package/fesm2022/ngwr-animations-shimmer.mjs +3 -3
  33. package/fesm2022/ngwr-animations-spotlight.mjs +3 -3
  34. package/fesm2022/ngwr-animations-thread-lines.mjs +3 -3
  35. package/fesm2022/ngwr-animations-tilt.mjs +3 -3
  36. package/fesm2022/ngwr-animations-typewriter.mjs +3 -3
  37. package/fesm2022/ngwr-avatar.mjs +3 -3
  38. package/fesm2022/ngwr-back-top.mjs +3 -3
  39. package/fesm2022/ngwr-badge.mjs +129 -11
  40. package/fesm2022/ngwr-badge.mjs.map +1 -1
  41. package/fesm2022/ngwr-breadcrumbs-testing.mjs +83 -0
  42. package/fesm2022/ngwr-breadcrumbs-testing.mjs.map +1 -0
  43. package/fesm2022/ngwr-breadcrumbs.mjs +8 -8
  44. package/fesm2022/ngwr-breadcrumbs.mjs.map +1 -1
  45. package/fesm2022/ngwr-burger-testing.mjs +45 -0
  46. package/fesm2022/ngwr-burger-testing.mjs.map +1 -0
  47. package/fesm2022/ngwr-burger.mjs +3 -3
  48. package/fesm2022/ngwr-button.mjs +6 -6
  49. package/fesm2022/ngwr-calendar-testing.mjs +18 -0
  50. package/fesm2022/ngwr-calendar-testing.mjs.map +1 -1
  51. package/fesm2022/ngwr-calendar.mjs +500 -73
  52. package/fesm2022/ngwr-calendar.mjs.map +1 -1
  53. package/fesm2022/ngwr-card.mjs +9 -9
  54. package/fesm2022/ngwr-carousel-testing.mjs +24 -1
  55. package/fesm2022/ngwr-carousel-testing.mjs.map +1 -1
  56. package/fesm2022/ngwr-carousel.mjs +73 -10
  57. package/fesm2022/ngwr-carousel.mjs.map +1 -1
  58. package/fesm2022/ngwr-cascader.mjs +45 -37
  59. package/fesm2022/ngwr-cascader.mjs.map +1 -1
  60. package/fesm2022/ngwr-charts-bar-chart.mjs +5 -4
  61. package/fesm2022/ngwr-charts-bar-chart.mjs.map +1 -1
  62. package/fesm2022/ngwr-charts-boxplot-chart.mjs +3 -3
  63. package/fesm2022/ngwr-charts-bullet-chart.mjs +3 -3
  64. package/fesm2022/ngwr-charts-calendar-heatmap.mjs +3 -3
  65. package/fesm2022/ngwr-charts-candlestick-chart.mjs +3 -3
  66. package/fesm2022/ngwr-charts-chart-legend.mjs +26 -11
  67. package/fesm2022/ngwr-charts-chart-legend.mjs.map +1 -1
  68. package/fesm2022/ngwr-charts-core.mjs +3 -3
  69. package/fesm2022/ngwr-charts-donut-chart.mjs +5 -4
  70. package/fesm2022/ngwr-charts-donut-chart.mjs.map +1 -1
  71. package/fesm2022/ngwr-charts-funnel-chart.mjs +3 -3
  72. package/fesm2022/ngwr-charts-gauge.mjs +3 -3
  73. package/fesm2022/ngwr-charts-heatmap-chart.mjs +3 -3
  74. package/fesm2022/ngwr-charts-line-chart-testing.mjs +3 -2
  75. package/fesm2022/ngwr-charts-line-chart-testing.mjs.map +1 -1
  76. package/fesm2022/ngwr-charts-line-chart.mjs +17 -7
  77. package/fesm2022/ngwr-charts-line-chart.mjs.map +1 -1
  78. package/fesm2022/ngwr-charts-meter-group.mjs +5 -4
  79. package/fesm2022/ngwr-charts-meter-group.mjs.map +1 -1
  80. package/fesm2022/ngwr-charts-radar-chart.mjs +5 -4
  81. package/fesm2022/ngwr-charts-radar-chart.mjs.map +1 -1
  82. package/fesm2022/ngwr-charts-scatter-chart.mjs +5 -4
  83. package/fesm2022/ngwr-charts-scatter-chart.mjs.map +1 -1
  84. package/fesm2022/ngwr-charts-sparkline.mjs +3 -3
  85. package/fesm2022/ngwr-charts-treemap-chart.mjs +3 -3
  86. package/fesm2022/ngwr-charts-waterfall-chart.mjs +3 -3
  87. package/fesm2022/ngwr-checkbox.mjs +6 -6
  88. package/fesm2022/ngwr-clipboard.mjs +3 -3
  89. package/fesm2022/ngwr-collapse.mjs +9 -9
  90. package/fesm2022/ngwr-color-picker-testing.mjs +11 -1
  91. package/fesm2022/ngwr-color-picker-testing.mjs.map +1 -1
  92. package/fesm2022/ngwr-color-picker.mjs +153 -37
  93. package/fesm2022/ngwr-color-picker.mjs.map +1 -1
  94. package/fesm2022/ngwr-command-palette.mjs +3 -3
  95. package/fesm2022/ngwr-comment.mjs +10 -6
  96. package/fesm2022/ngwr-comment.mjs.map +1 -1
  97. package/fesm2022/ngwr-compare-testing.mjs +84 -0
  98. package/fesm2022/ngwr-compare-testing.mjs.map +1 -0
  99. package/fesm2022/ngwr-compare.mjs +3 -3
  100. package/fesm2022/ngwr-context-menu.mjs +28 -13
  101. package/fesm2022/ngwr-context-menu.mjs.map +1 -1
  102. package/fesm2022/ngwr-cookie.mjs +3 -3
  103. package/fesm2022/ngwr-copy-value.mjs +3 -3
  104. package/fesm2022/ngwr-counter.mjs +6 -6
  105. package/fesm2022/ngwr-date-picker-testing.mjs +30 -4
  106. package/fesm2022/ngwr-date-picker-testing.mjs.map +1 -1
  107. package/fesm2022/ngwr-date-picker.mjs +342 -69
  108. package/fesm2022/ngwr-date-picker.mjs.map +1 -1
  109. package/fesm2022/ngwr-date-stamp.mjs +3 -3
  110. package/fesm2022/ngwr-date.mjs +59 -8
  111. package/fesm2022/ngwr-date.mjs.map +1 -1
  112. package/fesm2022/ngwr-density.mjs +6 -6
  113. package/fesm2022/ngwr-descriptions.mjs +6 -6
  114. package/fesm2022/ngwr-dialog.mjs +18 -18
  115. package/fesm2022/ngwr-directives.mjs +15 -15
  116. package/fesm2022/ngwr-divider.mjs +3 -3
  117. package/fesm2022/ngwr-drawer.mjs +51 -29
  118. package/fesm2022/ngwr-drawer.mjs.map +1 -1
  119. package/fesm2022/ngwr-dropdown-testing.mjs +11 -3
  120. package/fesm2022/ngwr-dropdown-testing.mjs.map +1 -1
  121. package/fesm2022/ngwr-dropdown.mjs +70 -99
  122. package/fesm2022/ngwr-dropdown.mjs.map +1 -1
  123. package/fesm2022/ngwr-editor.mjs +4 -3
  124. package/fesm2022/ngwr-editor.mjs.map +1 -1
  125. package/fesm2022/ngwr-empty.mjs +3 -3
  126. package/fesm2022/ngwr-event-calendar.mjs +186 -33
  127. package/fesm2022/ngwr-event-calendar.mjs.map +1 -1
  128. package/fesm2022/ngwr-file-upload-testing.mjs +34 -2
  129. package/fesm2022/ngwr-file-upload-testing.mjs.map +1 -1
  130. package/fesm2022/ngwr-file-upload.mjs +279 -16
  131. package/fesm2022/ngwr-file-upload.mjs.map +1 -1
  132. package/fesm2022/ngwr-form.mjs +9 -9
  133. package/fesm2022/ngwr-form.mjs.map +1 -1
  134. package/fesm2022/ngwr-graph-testing.mjs +30 -0
  135. package/fesm2022/ngwr-graph-testing.mjs.map +1 -1
  136. package/fesm2022/ngwr-graph.mjs +664 -43
  137. package/fesm2022/ngwr-graph.mjs.map +1 -1
  138. package/fesm2022/ngwr-hotkey.mjs +6 -6
  139. package/fesm2022/ngwr-i18n-ar.mjs +27 -8
  140. package/fesm2022/ngwr-i18n-ar.mjs.map +1 -1
  141. package/fesm2022/ngwr-i18n-cs.mjs +27 -8
  142. package/fesm2022/ngwr-i18n-cs.mjs.map +1 -1
  143. package/fesm2022/ngwr-i18n-de.mjs +27 -8
  144. package/fesm2022/ngwr-i18n-de.mjs.map +1 -1
  145. package/fesm2022/ngwr-i18n-en.mjs +27 -8
  146. package/fesm2022/ngwr-i18n-en.mjs.map +1 -1
  147. package/fesm2022/ngwr-i18n-es.mjs +27 -8
  148. package/fesm2022/ngwr-i18n-es.mjs.map +1 -1
  149. package/fesm2022/ngwr-i18n-fr.mjs +27 -8
  150. package/fesm2022/ngwr-i18n-fr.mjs.map +1 -1
  151. package/fesm2022/ngwr-i18n-he.mjs +27 -8
  152. package/fesm2022/ngwr-i18n-he.mjs.map +1 -1
  153. package/fesm2022/ngwr-i18n-hi.mjs +27 -8
  154. package/fesm2022/ngwr-i18n-hi.mjs.map +1 -1
  155. package/fesm2022/ngwr-i18n-id.mjs +27 -8
  156. package/fesm2022/ngwr-i18n-id.mjs.map +1 -1
  157. package/fesm2022/ngwr-i18n-it.mjs +27 -8
  158. package/fesm2022/ngwr-i18n-it.mjs.map +1 -1
  159. package/fesm2022/ngwr-i18n-ja.mjs +27 -8
  160. package/fesm2022/ngwr-i18n-ja.mjs.map +1 -1
  161. package/fesm2022/ngwr-i18n-ko.mjs +27 -8
  162. package/fesm2022/ngwr-i18n-ko.mjs.map +1 -1
  163. package/fesm2022/ngwr-i18n-nl.mjs +27 -8
  164. package/fesm2022/ngwr-i18n-nl.mjs.map +1 -1
  165. package/fesm2022/ngwr-i18n-pl.mjs +27 -8
  166. package/fesm2022/ngwr-i18n-pl.mjs.map +1 -1
  167. package/fesm2022/ngwr-i18n-pt.mjs +27 -8
  168. package/fesm2022/ngwr-i18n-pt.mjs.map +1 -1
  169. package/fesm2022/ngwr-i18n-ru.mjs +27 -8
  170. package/fesm2022/ngwr-i18n-ru.mjs.map +1 -1
  171. package/fesm2022/ngwr-i18n-sv.mjs +27 -8
  172. package/fesm2022/ngwr-i18n-sv.mjs.map +1 -1
  173. package/fesm2022/ngwr-i18n-tr.mjs +27 -8
  174. package/fesm2022/ngwr-i18n-tr.mjs.map +1 -1
  175. package/fesm2022/ngwr-i18n-uk.mjs +27 -8
  176. package/fesm2022/ngwr-i18n-uk.mjs.map +1 -1
  177. package/fesm2022/ngwr-i18n-vi.mjs +27 -8
  178. package/fesm2022/ngwr-i18n-vi.mjs.map +1 -1
  179. package/fesm2022/ngwr-i18n-zh-tw.mjs +27 -8
  180. package/fesm2022/ngwr-i18n-zh-tw.mjs.map +1 -1
  181. package/fesm2022/ngwr-i18n-zh.mjs +27 -8
  182. package/fesm2022/ngwr-i18n-zh.mjs.map +1 -1
  183. package/fesm2022/ngwr-i18n.mjs +9 -9
  184. package/fesm2022/ngwr-icon.mjs +6 -6
  185. package/fesm2022/ngwr-image-cropper.mjs +3 -3
  186. package/fesm2022/ngwr-input-number-testing.mjs +11 -0
  187. package/fesm2022/ngwr-input-number-testing.mjs.map +1 -1
  188. package/fesm2022/ngwr-input-number.mjs +68 -7
  189. package/fesm2022/ngwr-input-number.mjs.map +1 -1
  190. package/fesm2022/ngwr-input-otp.mjs +23 -3
  191. package/fesm2022/ngwr-input-otp.mjs.map +1 -1
  192. package/fesm2022/ngwr-input-testing.mjs +24 -1
  193. package/fesm2022/ngwr-input-testing.mjs.map +1 -1
  194. package/fesm2022/ngwr-input.mjs +152 -36
  195. package/fesm2022/ngwr-input.mjs.map +1 -1
  196. package/fesm2022/ngwr-keyboard.mjs +3 -3
  197. package/fesm2022/ngwr-knob.mjs +3 -3
  198. package/fesm2022/ngwr-layout.mjs +15 -15
  199. package/fesm2022/ngwr-lightbox.mjs +8 -8
  200. package/fesm2022/ngwr-lightbox.mjs.map +1 -1
  201. package/fesm2022/ngwr-list.mjs +8 -8
  202. package/fesm2022/ngwr-list.mjs.map +1 -1
  203. package/fesm2022/ngwr-load-state.mjs +15 -15
  204. package/fesm2022/ngwr-loading-bar.mjs +6 -6
  205. package/fesm2022/ngwr-mention.mjs +6 -6
  206. package/fesm2022/ngwr-meta.mjs +6 -6
  207. package/fesm2022/ngwr-overlay.mjs +175 -13
  208. package/fesm2022/ngwr-overlay.mjs.map +1 -1
  209. package/fesm2022/ngwr-page-header.mjs +3 -3
  210. package/fesm2022/ngwr-pagination.mjs +6 -3
  211. package/fesm2022/ngwr-pagination.mjs.map +1 -1
  212. package/fesm2022/ngwr-pipes.mjs +31 -29
  213. package/fesm2022/ngwr-pipes.mjs.map +1 -1
  214. package/fesm2022/ngwr-platform.mjs +9 -9
  215. package/fesm2022/ngwr-popconfirm-testing.mjs +5 -2
  216. package/fesm2022/ngwr-popconfirm-testing.mjs.map +1 -1
  217. package/fesm2022/ngwr-popconfirm.mjs +44 -63
  218. package/fesm2022/ngwr-popconfirm.mjs.map +1 -1
  219. package/fesm2022/ngwr-popover-testing.mjs +7 -1
  220. package/fesm2022/ngwr-popover-testing.mjs.map +1 -1
  221. package/fesm2022/ngwr-popover.mjs +58 -156
  222. package/fesm2022/ngwr-popover.mjs.map +1 -1
  223. package/fesm2022/ngwr-progress.mjs +50 -9
  224. package/fesm2022/ngwr-progress.mjs.map +1 -1
  225. package/fesm2022/ngwr-pull-to-refresh-testing.mjs +57 -0
  226. package/fesm2022/ngwr-pull-to-refresh-testing.mjs.map +1 -0
  227. package/fesm2022/ngwr-pull-to-refresh.mjs +3 -3
  228. package/fesm2022/ngwr-qr.mjs +3 -3
  229. package/fesm2022/ngwr-radio.mjs +6 -6
  230. package/fesm2022/ngwr-rating.mjs +3 -3
  231. package/fesm2022/ngwr-resizable-testing.mjs +113 -0
  232. package/fesm2022/ngwr-resizable-testing.mjs.map +1 -0
  233. package/fesm2022/ngwr-resizable.mjs +3 -3
  234. package/fesm2022/ngwr-result.mjs +12 -12
  235. package/fesm2022/ngwr-schema-form-testing.mjs +336 -0
  236. package/fesm2022/ngwr-schema-form-testing.mjs.map +1 -0
  237. package/fesm2022/ngwr-schema-form.mjs +416 -19
  238. package/fesm2022/ngwr-schema-form.mjs.map +1 -1
  239. package/fesm2022/ngwr-scroll.mjs +3 -3
  240. package/fesm2022/ngwr-segmented.mjs +3 -3
  241. package/fesm2022/ngwr-select-testing.mjs +19 -0
  242. package/fesm2022/ngwr-select-testing.mjs.map +1 -1
  243. package/fesm2022/ngwr-select.mjs +361 -84
  244. package/fesm2022/ngwr-select.mjs.map +1 -1
  245. package/fesm2022/ngwr-sidebar-testing.mjs +176 -0
  246. package/fesm2022/ngwr-sidebar-testing.mjs.map +1 -0
  247. package/fesm2022/ngwr-sidebar.mjs +3 -3
  248. package/fesm2022/ngwr-skeleton.mjs +3 -3
  249. package/fesm2022/ngwr-slider-testing.mjs +6 -0
  250. package/fesm2022/ngwr-slider-testing.mjs.map +1 -1
  251. package/fesm2022/ngwr-slider.mjs +21 -3
  252. package/fesm2022/ngwr-slider.mjs.map +1 -1
  253. package/fesm2022/ngwr-sortable-list.mjs +29 -12
  254. package/fesm2022/ngwr-sortable-list.mjs.map +1 -1
  255. package/fesm2022/ngwr-speed-dial.mjs +3 -3
  256. package/fesm2022/ngwr-spinner.mjs +3 -3
  257. package/fesm2022/ngwr-splitter.mjs +3 -3
  258. package/fesm2022/ngwr-statistic.mjs +9 -9
  259. package/fesm2022/ngwr-stepper.mjs +42 -11
  260. package/fesm2022/ngwr-stepper.mjs.map +1 -1
  261. package/fesm2022/ngwr-storage.mjs +3 -3
  262. package/fesm2022/ngwr-switch.mjs +3 -3
  263. package/fesm2022/ngwr-table-testing.mjs +157 -3
  264. package/fesm2022/ngwr-table-testing.mjs.map +1 -1
  265. package/fesm2022/ngwr-table.mjs +1051 -74
  266. package/fesm2022/ngwr-table.mjs.map +1 -1
  267. package/fesm2022/ngwr-tabs-router.mjs +3 -3
  268. package/fesm2022/ngwr-tabs-testing.mjs +1 -1
  269. package/fesm2022/ngwr-tabs-testing.mjs.map +1 -1
  270. package/fesm2022/ngwr-tabs.mjs +15 -10
  271. package/fesm2022/ngwr-tabs.mjs.map +1 -1
  272. package/fesm2022/ngwr-textarea-testing.mjs +11 -0
  273. package/fesm2022/ngwr-textarea-testing.mjs.map +1 -1
  274. package/fesm2022/ngwr-textarea.mjs +128 -16
  275. package/fesm2022/ngwr-textarea.mjs.map +1 -1
  276. package/fesm2022/ngwr-theme.mjs +3 -3
  277. package/fesm2022/ngwr-timeline.mjs +6 -6
  278. package/fesm2022/ngwr-toast.mjs +40 -19
  279. package/fesm2022/ngwr-toast.mjs.map +1 -1
  280. package/fesm2022/ngwr-toolbar.mjs +3 -3
  281. package/fesm2022/ngwr-tour-testing.mjs +13 -1
  282. package/fesm2022/ngwr-tour-testing.mjs.map +1 -1
  283. package/fesm2022/ngwr-tour.mjs +19 -15
  284. package/fesm2022/ngwr-tour.mjs.map +1 -1
  285. package/fesm2022/ngwr-transfer-testing.mjs +6 -0
  286. package/fesm2022/ngwr-transfer-testing.mjs.map +1 -1
  287. package/fesm2022/ngwr-transfer.mjs +24 -5
  288. package/fesm2022/ngwr-transfer.mjs.map +1 -1
  289. package/fesm2022/ngwr-tree-testing.mjs +62 -2
  290. package/fesm2022/ngwr-tree-testing.mjs.map +1 -1
  291. package/fesm2022/ngwr-tree.mjs +978 -79
  292. package/fesm2022/ngwr-tree.mjs.map +1 -1
  293. package/fesm2022/ngwr-typography.mjs +3 -3
  294. package/fesm2022/ngwr-utils-router.mjs +3 -3
  295. package/fesm2022/ngwr-utils.mjs +97 -1
  296. package/fesm2022/ngwr-utils.mjs.map +1 -1
  297. package/fesm2022/ngwr-version.mjs +1 -1
  298. package/fesm2022/ngwr-version.mjs.map +1 -1
  299. package/fesm2022/ngwr-virtual-scroll.mjs +3 -3
  300. package/fesm2022/ngwr-window.mjs +33 -22
  301. package/fesm2022/ngwr-window.mjs.map +1 -1
  302. package/file-upload/styles/_index.scss +156 -0
  303. package/graph/styles/_index.scss +87 -0
  304. package/i18n/ar.json +29 -8
  305. package/i18n/cs.json +29 -8
  306. package/i18n/de.json +29 -8
  307. package/i18n/en.json +29 -8
  308. package/i18n/es.json +29 -8
  309. package/i18n/fr.json +29 -8
  310. package/i18n/he.json +29 -8
  311. package/i18n/hi.json +29 -8
  312. package/i18n/id.json +29 -8
  313. package/i18n/it.json +29 -8
  314. package/i18n/ja.json +29 -8
  315. package/i18n/ko.json +29 -8
  316. package/i18n/nl.json +29 -8
  317. package/i18n/pl.json +29 -8
  318. package/i18n/pt.json +29 -8
  319. package/i18n/ru.json +29 -8
  320. package/i18n/sv.json +29 -8
  321. package/i18n/tr.json +29 -8
  322. package/i18n/uk.json +29 -8
  323. package/i18n/vi.json +29 -8
  324. package/i18n/zh-TW.json +29 -8
  325. package/i18n/zh.json +29 -8
  326. package/input/styles/_index.scss +68 -1
  327. package/input-otp/styles/_index.scss +14 -0
  328. package/llms-full.txt +53 -21
  329. package/llms.txt +57 -24
  330. package/overlay/styles/_arrow.scss +4 -4
  331. package/package.json +33 -1
  332. package/popconfirm/styles/_index.scss +3 -11
  333. package/progress/styles/_index.scss +32 -0
  334. package/schema-form/styles/_index.scss +78 -0
  335. package/schematics/collection.json +5 -0
  336. package/schematics/eject/index.js +158 -0
  337. package/schematics/eject/schema.js +8 -0
  338. package/schematics/eject/schema.json +24 -0
  339. package/schematics/eject/source.js +295 -0
  340. package/schematics/use/rule.js +2 -0
  341. package/schematics/use/symbol-map.json +5 -0
  342. package/select/styles/_index.scss +127 -22
  343. package/skills/ngwr/SKILL.md +31 -4
  344. package/skills/ngwr/references/catalog.md +9 -1
  345. package/slider/styles/_index.scss +22 -0
  346. package/table/styles/_index.scss +191 -3
  347. package/textarea/styles/_index.scss +80 -0
  348. package/theme/styles/_focus.scss +16 -1
  349. package/theme/styles/_motion.scss +5 -0
  350. package/transfer/styles/_index.scss +84 -0
  351. package/tree/styles/_index.scss +138 -5
  352. package/types/ngwr-alert-testing.d.ts +88 -0
  353. package/types/ngwr-badge.d.ts +72 -2
  354. package/types/ngwr-breadcrumbs-testing.d.ts +92 -0
  355. package/types/ngwr-burger-testing.d.ts +51 -0
  356. package/types/ngwr-calendar-testing.d.ts +18 -6
  357. package/types/ngwr-calendar.d.ts +272 -22
  358. package/types/ngwr-carousel-testing.d.ts +27 -6
  359. package/types/ngwr-carousel.d.ts +42 -6
  360. package/types/ngwr-cascader.d.ts +13 -6
  361. package/types/ngwr-charts-chart-legend.d.ts +9 -4
  362. package/types/ngwr-charts-line-chart-testing.d.ts +4 -1
  363. package/types/ngwr-charts-line-chart.d.ts +7 -4
  364. package/types/ngwr-color-picker-testing.d.ts +15 -4
  365. package/types/ngwr-color-picker.d.ts +76 -6
  366. package/types/ngwr-compare-testing.d.ts +72 -0
  367. package/types/ngwr-context-menu.d.ts +2 -0
  368. package/types/ngwr-date-picker-testing.d.ts +23 -8
  369. package/types/ngwr-date-picker.d.ts +100 -9
  370. package/types/ngwr-date.d.ts +71 -1
  371. package/types/ngwr-drawer.d.ts +9 -0
  372. package/types/ngwr-dropdown-testing.d.ts +20 -0
  373. package/types/ngwr-dropdown.d.ts +26 -6
  374. package/types/ngwr-event-calendar.d.ts +66 -8
  375. package/types/ngwr-file-upload-testing.d.ts +31 -2
  376. package/types/ngwr-file-upload.d.ts +156 -3
  377. package/types/ngwr-form.d.ts +47 -3
  378. package/types/ngwr-graph-testing.d.ts +36 -3
  379. package/types/ngwr-graph.d.ts +309 -13
  380. package/types/ngwr-input-number-testing.d.ts +10 -0
  381. package/types/ngwr-input-number.d.ts +30 -1
  382. package/types/ngwr-input-otp.d.ts +10 -0
  383. package/types/ngwr-input-testing.d.ts +30 -0
  384. package/types/ngwr-input.d.ts +54 -3
  385. package/types/ngwr-overlay.d.ts +84 -5
  386. package/types/ngwr-pipes.d.ts +2 -1
  387. package/types/ngwr-popconfirm-testing.d.ts +12 -3
  388. package/types/ngwr-popconfirm.d.ts +28 -3
  389. package/types/ngwr-popover-testing.d.ts +19 -2
  390. package/types/ngwr-popover.d.ts +22 -2
  391. package/types/ngwr-progress.d.ts +29 -1
  392. package/types/ngwr-pull-to-refresh-testing.d.ts +83 -0
  393. package/types/ngwr-resizable-testing.d.ts +116 -0
  394. package/types/ngwr-schema-form-testing.d.ts +260 -0
  395. package/types/ngwr-schema-form.d.ts +76 -6
  396. package/types/ngwr-select-testing.d.ts +20 -0
  397. package/types/ngwr-select.d.ts +149 -11
  398. package/types/ngwr-sidebar-testing.d.ts +176 -0
  399. package/types/ngwr-slider-testing.d.ts +3 -1
  400. package/types/ngwr-slider.d.ts +21 -1
  401. package/types/ngwr-sortable-list.d.ts +6 -0
  402. package/types/ngwr-stepper.d.ts +20 -11
  403. package/types/ngwr-table-testing.d.ts +122 -7
  404. package/types/ngwr-table.d.ts +572 -50
  405. package/types/ngwr-tabs-testing.d.ts +14 -17
  406. package/types/ngwr-tabs.d.ts +6 -0
  407. package/types/ngwr-textarea-testing.d.ts +10 -0
  408. package/types/ngwr-textarea.d.ts +48 -2
  409. package/types/ngwr-toast.d.ts +8 -1
  410. package/types/ngwr-tour-testing.d.ts +10 -0
  411. package/types/ngwr-tour.d.ts +11 -2
  412. package/types/ngwr-transfer-testing.d.ts +3 -0
  413. package/types/ngwr-transfer.d.ts +24 -1
  414. package/types/ngwr-tree-testing.d.ts +65 -1
  415. package/types/ngwr-tree.d.ts +335 -12
  416. package/types/ngwr-utils.d.ts +107 -1
  417. package/types/ngwr-version.d.ts +1 -1
  418. package/types/ngwr-window.d.ts +7 -4
@@ -1 +1 @@
1
- {"version":3,"file":"ngwr-window.mjs","names":["NO_OVERRIDE","NO_RESERVE"],"sources":["../../../projects/lib/window/tokens.ts","../../../projects/lib/window/storage-key.ts","../../../projects/lib/window/window.ts","../../../projects/lib/window/window.html","../../../projects/lib/window/window-container.ts","../../../projects/lib/window/window-container.html","../../../projects/lib/window/window-model.ts","../../../projects/lib/window/window-ref.ts","../../../projects/lib/window/services/window-manager.ts","../../../projects/lib/window/window-taskbar.ts","../../../projects/lib/window/window-taskbar.html","../../../projects/lib/window/with-windows.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 { WrWindowDefaults } from './types';\nimport type { WrWindowRef } from './window-ref';\n\n/** Resolves to the active `WrWindowRef` inside a programmatically-opened window's content tree. */\nexport const WR_WINDOW_REF = new InjectionToken<WrWindowRef<unknown, unknown>>('WR_WINDOW_REF');\n\n/** Resolves to the `data` passed in `WrWindowConfig.data`. */\nexport const WR_WINDOW_DATA = new InjectionToken<unknown>('WR_WINDOW_DATA');\n\n/** What `withWindows()` provides. @internal */\nexport const WR_WINDOW_DEFAULTS = new InjectionToken<WrWindowDefaults>('WR_WINDOW_DEFAULTS');\n","import type { WrWindowStorageConfig } from './types';\n\n/** Namespaced localStorage key for a persisted window / workspace. */\nexport function storageKey(cfg: WrWindowStorageConfig): string {\n const prefix = cfg.prefix ? `${cfg.prefix}:` : '';\n return `wr:window:${prefix}${cfg.key}`;\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 { FocusTrapFactory } from '@angular/cdk/a11y';\nimport { Directionality } from '@angular/cdk/bidi';\nimport type { ComponentType } from '@angular/cdk/portal';\nimport { NgComponentOutlet, NgTemplateOutlet } from '@angular/common';\nimport {\n Component,\n DestroyRef,\n ElementRef,\n type Injector,\n type OnInit,\n TemplateRef,\n ViewEncapsulation,\n computed,\n inject,\n input,\n output,\n signal,\n} from '@angular/core';\n\nimport { useI18nFormatter, useI18nText } from 'ngwr/i18n';\nimport { wrRandomId, wrCheckStyles } from 'ngwr/utils';\n\nimport { WrWindowManager } from './services/window-manager';\nimport type { WrWindowResolvedOs, WrWindowSlotContent, WrWindowSlotContext, WrWindowSnapTarget } from './types';\nimport type { WrWindowKeyboardMode, WrWindowModel } from './window-model';\nimport type { WrWindowRef } from './window-ref';\n\n/**\n * Stands in for the consumer input `useI18nText` expects. The chrome buttons take no\n * label input — they are icon-only OS affordances — but their names still have to\n * come from the catalog rather than from the template, which is where they used to\n * live as English literals.\n */\nconst NO_OVERRIDE = signal<string | null>(null).asReadonly();\n\n/**\n * Best-effort OS detection — runs once at module load. Looks at the\n * new `navigator.userAgentData.platform` first (Chromium, no UA\n * sniffing required), falls back to `navigator.platform` /\n * `navigator.userAgent`. SSR-safe — returns `'windows'` when there's\n * no `window`.\n */\nfunction detectOs(): WrWindowResolvedOs {\n if (typeof window === 'undefined' || typeof navigator === 'undefined') return 'windows';\n\n const uaData = (navigator as unknown as { userAgentData?: { platform?: string } }).userAgentData;\n // First non-empty source — `??` alone would keep an empty platform\n // string and skip the user-agent fallback.\n const candidates = [uaData?.platform, navigator.platform, navigator.userAgent];\n const platform = (candidates.find(v => !!v) ?? '').toLowerCase();\n if (\n platform.includes('mac') ||\n platform.includes('darwin') ||\n platform.includes('iphone') ||\n platform.includes('ipad')\n ) {\n return 'macos';\n }\n if (platform.includes('linux') || platform.includes('x11') || platform.includes('cros')) return 'linux';\n return 'windows';\n}\n\nconst DETECTED_OS = detectOs();\n\n/** How close to an edge of the work area the pointer has to be to snap there. */\nconst SNAP_HOT_ZONE = 12;\n\n/** How far a drag on a maximized or snapped window travels before the window restores under it. */\nconst DRAG_THRESHOLD = 4;\n\n/**\n * What never starts a drag, even inside a `dragHandle`: a press on a control is\n * for the control. Checked only up to the window's own element.\n */\nconst INTERACTIVE =\n 'button, input, select, textarea, a[href], label, [contenteditable]:not([contenteditable=\"false\"]), ' +\n '[role=\"button\"], [role=\"link\"], [role=\"checkbox\"], [role=\"switch\"], [role=\"radio\"], [role=\"slider\"], ' +\n '[role=\"spinbutton\"], [role=\"textbox\"], [role=\"combobox\"], [role=\"tab\"], [role=\"menuitem\"], [role=\"option\"]';\n\ninterface Edges {\n readonly t?: boolean;\n readonly r?: boolean;\n readonly b?: boolean;\n readonly l?: boolean;\n}\n\nfunction asTemplate(content: WrWindowSlotContent | null): TemplateRef<WrWindowSlotContext> | null {\n return content instanceof TemplateRef ? content : null;\n}\n\nfunction asComponent(content: WrWindowSlotContent | null): ComponentType<unknown> | null {\n return content && !(content instanceof TemplateRef) ? content : null;\n}\n\n/**\n * Internal rendering primitive for a single floating window.\n *\n * Not part of the public API — windows are opened through\n * `WrWindowManager.open(Component, config)`, which creates the window's\n * `WrWindowModel` and portals this component to draw it. Every state and\n * geometry change goes through the model; this component turns pointer and\n * key events into calls on it and owns the DOM-only parts: focus and the live\n * region.\n *\n * @internal\n */\n@Component({\n selector: 'wr-window',\n templateUrl: './window.html',\n encapsulation: ViewEncapsulation.None,\n imports: [NgTemplateOutlet, NgComponentOutlet],\n host: {\n role: 'dialog',\n // Focusable by script, never by Tab: it is where focus lands when the\n // window opens with no control in its body, and it is what a click on the\n // window's own surface focuses, so the window the user is in is the one\n // `WrWindowManager` hands Escape to.\n tabindex: '-1',\n class: 'wr-window',\n '[class]': 'classes()',\n '[style.left.px]': 'rect().left',\n '[style.top.px]': 'rect().top',\n '[style.width.px]': 'rect().width',\n '[style.height.px]': 'rect().height',\n '[style.z-index]': 'model().z()',\n '[attr.aria-labelledby]': 'titleId',\n '(pointerdown)': 'onPointerDown($event)',\n '(dblclick)': 'onBodyDblClick($event)',\n '(keydown)': 'onKeydown($event)',\n '(focusin)': 'onFocusIn($event)',\n '(focusout)': 'onFocusOut($event)',\n },\n})\nexport class WrWindow implements OnInit {\n /** The window's state and geometry. */\n readonly model = input.required<WrWindowModel>();\n /** The ref, handed to slot templates as `$implicit` and to the manager on activation. */\n readonly windowRef = input<WrWindowRef<unknown, unknown> | null>(null);\n /** The window's injector — what a slot component resolves `WR_WINDOW_REF` from. */\n readonly injector = input<Injector | undefined>(undefined);\n /** Content for the title bar, between the title and the buttons. */\n readonly titleExtra = input<WrWindowSlotContent | null>(null);\n /** Content for the status bar. */\n readonly statusBar = input<WrWindowSlotContent | null>(null);\n\n /**\n * A REQUEST to close, not the close itself. `WrWindowContainer` binds\n * `(closed)` to `WrWindowRef.close()`, which awaits the `beforeClose` hook and\n * — only if the hook agrees — disposes the overlay, so the owner is what takes\n * the window away and this component never has to hide itself.\n */\n readonly closed = output<void>();\n\n /** Auto-generated id for the title element, referenced by `aria-labelledby`. */\n protected readonly titleId = wrRandomId('wr-window-title');\n\n // `window.close` had been sitting in both catalogs unread while the template\n // hard-coded the same English beside it; the other four had no key at all, so a\n // Russian app announced four of its five window buttons in English.\n protected readonly closeLabel = useI18nText(NO_OVERRIDE, 'window.close', 'Close');\n private readonly minimizeLabel = useI18nText(NO_OVERRIDE, 'window.minimize', 'Minimize');\n private readonly maximizeLabel = useI18nText(NO_OVERRIDE, 'window.maximize', 'Maximize');\n private readonly restoreLabel = useI18nText(NO_OVERRIDE, 'window.restore', 'Restore');\n private readonly restoreDownLabel = useI18nText(NO_OVERRIDE, 'window.restoreDown', 'Restore down');\n // The taskbar has named an untitled window this way since v13; the window\n // itself announced an empty name — `aria-labelledby` pointing at nothing.\n private readonly untitled = useI18nText(NO_OVERRIDE, 'window.untitled', 'Untitled');\n private readonly moveModeText = useI18nText(\n NO_OVERRIDE,\n 'window.moveMode',\n 'Moving the window. Use the arrow keys, Enter to finish, Escape to cancel.'\n );\n private readonly resizeModeText = useI18nText(\n NO_OVERRIDE,\n 'window.resizeMode',\n 'Resizing the window. Use the arrow keys, Enter to finish, Escape to cancel.'\n );\n private readonly movedText = useI18nFormatter('window.moved', 'Window moved to {{x}}, {{y}}');\n private readonly resizedText = useI18nFormatter('window.resized', 'Window resized to {{width}} by {{height}}');\n\n private readonly manager = inject(WrWindowManager);\n private readonly elRef = inject<ElementRef<HTMLElement>>(ElementRef);\n private readonly focusTraps = inject(FocusTrapFactory);\n private readonly dir = inject(Directionality, { optional: true });\n\n /** Ends the pointer move in progress, if any: its listeners are on the document. */\n private endMove: (() => void) | null = null;\n\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('window');\n // A window closed in the middle of a drag (a shortcut, the app) must not\n // leave its listeners on the document, writing to a model nobody draws.\n inject(DestroyRef).onDestroy(() => this.endMove?.());\n }\n\n /** What the live region says: written by the keyboard modes only. */\n protected readonly announcement = signal('');\n\n /** The control focus was on last, so switching back to the window lands there. */\n private lastFocused: HTMLElement | null = null;\n\n protected readonly state = computed(() => this.model().state());\n protected readonly rect = computed(() => this.model().rect());\n private readonly options = computed(() => this.model().options());\n\n protected readonly displayTitle = computed(() => this.model().title() || this.untitled());\n\n /** Resolved OS — `auto` → detected platform. */\n readonly resolvedOs = computed<WrWindowResolvedOs>(() => {\n const os = this.options().os;\n return os === 'auto' ? DETECTED_OS : os;\n });\n\n /**\n * Whether each control is rendered: the option wins, the chrome decides the\n * default. Linux is close-only unless asked otherwise. Minimize does NOT hang\n * on a `<wr-window-taskbar>` being on the page: an app may list minimized\n * windows in a dock of its own from `WrWindowManager.minimized()`, and the\n * macOS chrome never drops a light.\n */\n protected readonly minimizeVisible = computed(() => this.options().showMinimize ?? this.resolvedOs() !== 'linux');\n protected readonly maximizeVisible = computed(() => this.options().showMaximize ?? this.resolvedOs() !== 'linux');\n protected readonly showClose = computed(() => this.options().showClose);\n\n /**\n * How many caption buttons are drawn. The macOS chrome centres its title on\n * the whole bar by padding it as wide as the cluster on the other side, and a\n * window without one of the lights has a narrower cluster.\n */\n protected readonly actionCount = computed(\n () => Number(this.minimizeVisible()) + Number(this.maximizeVisible()) + Number(this.showClose())\n );\n\n /** The minimize button doubles as restore, and says which it is. */\n protected readonly minimizeActionLabel = computed(() =>\n this.state() === 'minimized' ? this.restoreLabel() : this.minimizeLabel()\n );\n\n /** Same for maximize, whose restore has its own wording. */\n protected readonly maximizeActionLabel = computed(() =>\n this.state() === 'maximized' ? this.restoreDownLabel() : this.maximizeLabel()\n );\n\n protected readonly resizeHandles = computed(() => this.options().resizable && this.state() === 'normal');\n\n protected readonly classes = computed(() => {\n const model = this.model();\n const parts = [\n `wr-window--${this.state()}`,\n `wr-window--os-${this.resolvedOs()}`,\n `wr-window--chrome-${this.options().chromeSize}`,\n model.isActive() ? 'wr-window--active' : 'wr-window--inactive',\n ];\n if (this.resizeHandles()) parts.push('wr-window--resizable');\n if (!this.options().animations) parts.push('wr-window--no-anim');\n const mode = model.keyboardMode();\n if (mode) parts.push(mode === 'move' ? 'wr-window--keyboard-moving' : 'wr-window--keyboard-resizing');\n return parts.join(' ');\n });\n\n protected readonly titleExtraTemplate = computed(() => asTemplate(this.titleExtra()));\n protected readonly titleExtraComponent = computed(() => asComponent(this.titleExtra()));\n protected readonly statusBarTemplate = computed(() => asTemplate(this.statusBar()));\n protected readonly statusBarComponent = computed(() => asComponent(this.statusBar()));\n protected readonly slotContext = computed<WrWindowSlotContext | null>(() => {\n const ref = this.windowRef();\n return ref ? { $implicit: ref } : null;\n });\n\n ngOnInit(): void {\n this.model().element = this.elRef.nativeElement;\n }\n\n // Chrome actions\n\n protected close(): void {\n this.closed.emit();\n }\n\n protected minimize(): void {\n this.model().minimize();\n }\n\n protected maximize(): void {\n this.model().maximize();\n }\n\n // Focus\n\n /**\n * Move focus into the window: to `[cdkFocusInitial]` or the first control in\n * its body — the CDK's rule, the one `WrDialog` and `WrDrawer` follow — else\n * to the window itself. The chrome buttons are not candidates: landing on\n * Close, the first of them on macOS, is the one place a window must not open\n * onto. Called after a render, by the container.\n *\n * @internal\n */\n focusInitial(): void {\n const host = this.elRef.nativeElement;\n if (!host.isConnected || this.state() === 'minimized') return;\n const body = host.querySelector<HTMLElement>('.wr-window__body');\n if (body) {\n // `deferAnchors`: no anchors go into the page, and nothing is trapped.\n const finder = this.focusTraps.create(body, true);\n const moved = finder.focusInitialElement({ preventScroll: true });\n finder.destroy();\n if (moved) return;\n }\n host.focus({ preventScroll: true });\n }\n\n /**\n * Move focus back to the control the window had last, the way a desktop\n * returns to a window — its first control when it never had one, or when that\n * one is gone or disabled.\n *\n * @internal\n */\n focusLast(): void {\n const host = this.elRef.nativeElement;\n if (!host.isConnected || this.state() === 'minimized') return;\n const last = this.lastFocused;\n if (last?.isConnected && host.contains(last)) {\n last.focus({ preventScroll: true });\n if (host.ownerDocument.activeElement === last) return;\n }\n this.focusInitial();\n }\n\n protected onFocusIn(event: FocusEvent): void {\n const target = event.target;\n if (!(target instanceof HTMLElement) || target === this.elRef.nativeElement) return;\n // Not the chrome buttons: a click on minimize focuses it, and coming back\n // from the taskbar onto the minimize button is not coming back to the window.\n if (target.closest('.wr-window__chrome-action')) return;\n this.lastFocused = target;\n }\n\n protected onFocusOut(event: FocusEvent): void {\n const next = event.relatedTarget;\n // Focus leaving the window ends keyboard move or resize where it is, the\n // same as Enter: a mode that outlived its focus would steal the arrow keys\n // the next time the user came back.\n if (this.model().keyboardMode() && !(next instanceof Node && this.elRef.nativeElement.contains(next))) {\n this.commitKeyboard();\n }\n }\n\n // Pointer\n\n /**\n * Every press inside the window activates it. A press on a grab area — the\n * title bar, or a `dragHandle` — also starts a move, and moves focus into the\n * window itself: the move's `preventDefault()` stops the browser doing it, and\n * left alone the window the user just clicked to the front was not the one\n * that had the keyboard, so Escape closed the window behind it.\n */\n protected onPointerDown(event: PointerEvent): void {\n const model = this.model();\n if (model.keyboardMode()) this.commitKeyboard();\n const target = event.target instanceof Element ? event.target : null;\n const primary = event.button === 0;\n const grab = primary && !!target && this.isGrabArea(target);\n // A minimized window is `display: none`, so a press cannot reach it in a\n // browser; a synthetic one must not bring it back either.\n if (model.state() === 'minimized') return;\n const ref = this.windowRef();\n if (ref) this.manager._activate(ref, { focus: grab });\n if (grab) this.startMove(event);\n }\n\n /** Whether a press on `target` should start a move. */\n private isGrabArea(target: Element): boolean {\n const host = this.elRef.nativeElement;\n if (target.closest('.wr-window__chrome-action, .wr-window__handle')) return false;\n const control = target.closest(INTERACTIVE);\n if (control && host.contains(control)) return false;\n const handle = this.options().dragHandle;\n if (handle) {\n const match = target.closest(handle);\n return !!match && host.contains(match);\n }\n return !!target.closest('.wr-window__chrome');\n }\n\n /**\n * Where a double-click toggles maximize: the title bar, whatever `dragHandle`\n * says — on every desktop the bar maximizes even where it does not drag — and\n * any other grab area. Never a control or a caption button.\n */\n private isDblClickArea(target: Element): boolean {\n const host = this.elRef.nativeElement;\n if (target.closest('.wr-window__chrome-action, .wr-window__handle')) return false;\n const control = target.closest(INTERACTIVE);\n if (control && host.contains(control)) return false;\n const chrome = target.closest('.wr-window__chrome');\n return (!!chrome && host.contains(chrome)) || this.isGrabArea(target);\n }\n\n /**\n * Move the window with the pointer. The listeners go on the DOCUMENT and\n * pointer capture is taken only once the press has travelled past the drag\n * threshold, and then on the element that was pressed, never on the window.\n * Chromium sends `click` and `dblclick` to the capturing element, so a\n * capture taken on the window at press time sent every click in the title\n * bar to the window instead: the double-click that maximizes stopped\n * working, and a clickable badge in `titleExtra` never heard its click. A\n * press that stays put now keeps both, and a real drag swallows the click it\n * would otherwise end in, so dragging by a badge does not also press it.\n */\n private startMove(event: PointerEvent): void {\n const model = this.model();\n const o = model.options();\n const state = model.state();\n if (!o.movable || state === 'minimized') return;\n if (state === 'maximized' && !o.restoreOnDrag) return;\n event.preventDefault();\n this.endMove?.();\n const host = this.elRef.nativeElement;\n const doc = host.ownerDocument;\n const pressed = event.target instanceof Element ? event.target : host;\n const pointerId = event.pointerId;\n\n const originX = event.clientX;\n const originY = event.clientY;\n const start = model.rect();\n // A maximized or snapped window does not move until the drag has gone\n // somewhere: a click or a double-click on its title bar must not restore it.\n let detached = state === 'normal' && !model.snap();\n if (!detached && !o.restoreOnDrag) {\n model.unsnapInPlace();\n detached = true;\n }\n let startX = model.x();\n let startY = model.y();\n /** Past the threshold: a drag rather than a click, from here on. */\n let dragging = false;\n\n const move = (e: PointerEvent): void => {\n if (e.pointerId !== pointerId) return;\n const dx = e.clientX - originX;\n const dy = e.clientY - originY;\n if (!dragging && Math.hypot(dx, dy) >= DRAG_THRESHOLD) {\n dragging = true;\n // Keeps the moves coming over an iframe in the body. Optional, since\n // jsdom implements no pointer capture, and guarded, since a synthetic\n // pointer the browser never saw is refused with a `NotFoundError`.\n try {\n pressed.setPointerCapture?.(pointerId);\n } catch {\n // The document listeners carry the drag without it.\n }\n }\n if (!detached) {\n if (!dragging) return;\n // Restore the window's own size under the pointer, keeping the grab\n // point at the same fraction of the bar — what Windows, macOS and GNOME\n // all do. The snapped or maximized size was never the window's own.\n const fraction = start.width > 0 ? (originX - start.left) / start.width : 0.5;\n model.restore();\n startX = originX - fraction * model.width();\n startY = start.top;\n detached = true;\n }\n model.setRaw({ x: startX + dx, y: startY + dy });\n model.clamp();\n model.dragTarget.set(this.detectSnapTarget(e.clientX, e.clientY));\n };\n const stop = (): void => {\n doc.removeEventListener('pointermove', move);\n doc.removeEventListener('pointerup', end);\n doc.removeEventListener('pointercancel', end);\n if (dragging && pressed.hasPointerCapture?.(pointerId)) pressed.releasePointerCapture?.(pointerId);\n model.dragTarget.set(null);\n this.endMove = null;\n };\n const end = (e: PointerEvent): void => {\n if (e.pointerId !== pointerId) return;\n const snap = model.dragTarget();\n stop();\n if (dragging) this.swallowClick(doc, pressed);\n if (!detached) return;\n if (snap) {\n model.snapTo(snap);\n if (snap !== 'top') model.resized.next({ width: model.rect().width, height: model.rect().height });\n }\n // `moved` is where the USER put the window, so a press that never moved\n // it — a click, either half of a double-click — says nothing.\n const r = model.rect();\n if (snap || r.left !== start.left || r.top !== start.top) model.moved.next({ x: r.left, y: r.top });\n };\n\n doc.addEventListener('pointermove', move);\n doc.addEventListener('pointerup', end);\n // `pointercancel` is never followed by a `pointerup` (a pen leaving range, a\n // long-press menu, an OS gesture taking over), so without this the move\n // listener outlived the drag: every later hover dragged the window. The\n // cancelled gesture's geometry is kept rather than rolled back.\n doc.addEventListener('pointercancel', end);\n this.endMove = stop;\n }\n\n /**\n * Eat the `click` a drag ends in. The browser dispatches it straight after the\n * `pointerup`, in the same task, at the element holding capture — the one the\n * drag started on — so the listener takes only a click there, and is taken\n * away at the next task rather than left to eat a real one.\n */\n private swallowClick(doc: Document, pressed: Element): void {\n const swallow = (e: Event): void => {\n if (e.target !== pressed) return;\n doc.removeEventListener('click', swallow, true);\n e.stopPropagation();\n e.preventDefault();\n };\n doc.addEventListener('click', swallow, true);\n setTimeout(() => doc.removeEventListener('click', swallow, true));\n }\n\n /** Map a pointer position to a snap target, honouring the `snap` option and the work area. */\n private detectSnapTarget(clientX: number, clientY: number): WrWindowSnapTarget | null {\n const model = this.model();\n const mode = model.options().snap;\n if (mode === 'none') return null;\n const wa = model.workArea();\n const nearLeft = clientX <= wa.left + SNAP_HOT_ZONE;\n const nearRight = clientX >= wa.left + wa.width - SNAP_HOT_ZONE;\n const nearTop = clientY <= wa.top + SNAP_HOT_ZONE;\n const nearBottom = clientY >= wa.top + wa.height - SNAP_HOT_ZONE;\n if (mode === 'all') {\n if (nearTop && nearLeft) return 'top-left';\n if (nearTop && nearRight) return 'top-right';\n if (nearBottom && nearLeft) return 'bottom-left';\n if (nearBottom && nearRight) return 'bottom-right';\n }\n if (nearTop) return 'top'; // top edge → maximise\n if (nearLeft) return 'left';\n if (nearRight) return 'right';\n return null;\n }\n\n /**\n * A double-click on the title bar maximizes, or restores a maximized or\n * snapped window. Bound on the bar itself rather than only on the host, so a\n * `dblclick` that does not bubble — which is what a harness dispatches — still\n * reaches it.\n *\n * The gate is `showMaximize !== false`, NOT `maximizeVisible()`, and the\n * difference is a window nobody can get out of: the Linux preset hides the\n * maximize BUTTON, but the gesture is how GNOME maximizes, and `maximized` is\n * reachable there with no button at all (a snap to the top edge,\n * `ref.maximize()`, a restored layout). An explicit `showMaximize: false`\n * still turns the gesture off everywhere.\n */\n protected onChromeDblClick(event: MouseEvent): void {\n this.toggleFromDblClick(event.target);\n }\n\n /**\n * The same gesture on a body `dragHandle`, which answers it the way the title\n * bar does. A double-click in the bar bubbles here too and is the bar's.\n */\n protected onBodyDblClick(event: MouseEvent): void {\n const target = event.target;\n if (target instanceof Element && target.closest('.wr-window__chrome')) return;\n this.toggleFromDblClick(target);\n }\n\n private toggleFromDblClick(target: EventTarget | null): void {\n // Double-clicking the maximize BUTTON is two clicks on it already; the\n // chrome toggling a third time left the window maximized. A button in\n // `titleExtra` is the same: two presses of it, not a gesture on the bar.\n if (!(target instanceof Element) || !this.isDblClickArea(target)) return;\n const model = this.model();\n if (model.state() === 'minimized') return;\n if (model.state() === 'normal' && model.snap()) {\n model.restore();\n return;\n }\n if (model.options().showMaximize !== false) model.maximize();\n }\n\n protected startResize(event: PointerEvent, edges: Edges): void {\n const model = this.model();\n if (!model.options().resizable || model.state() !== 'normal') return;\n event.preventDefault();\n event.stopPropagation();\n if (model.keyboardMode()) this.commitKeyboard();\n const ref = this.windowRef();\n if (ref) this.manager._activate(ref, { focus: true });\n model.unsnapInPlace();\n const target = event.currentTarget as HTMLElement;\n target.setPointerCapture?.(event.pointerId);\n\n const startX = model.x();\n const startY = model.y();\n const startW = model.width();\n const startH = model.height();\n const originX = event.clientX;\n const originY = event.clientY;\n\n const move = (e: PointerEvent): void => {\n const o = model.options();\n const dx = e.clientX - originX;\n const dy = e.clientY - originY;\n\n let nextX = startX;\n let nextY = startY;\n let nextW = startW;\n let nextH = startH;\n\n if (edges.r) nextW = startW + dx;\n if (edges.b) nextH = startH + dy;\n if (edges.l) {\n nextW = startW - dx;\n nextX = startX + dx;\n }\n if (edges.t) {\n nextH = startH - dy;\n nextY = startY + dy;\n }\n\n // Enforce min/max — when shrinking from left/top we have to fix the position too.\n const clampedW = Math.min(o.maxWidth, Math.max(o.minWidth, nextW));\n const clampedH = Math.min(o.maxHeight, Math.max(o.minHeight, nextH));\n if (edges.l) nextX += nextW - clampedW;\n if (edges.t) nextY += nextH - clampedH;\n\n model.setRaw({ x: nextX, y: nextY, width: clampedW, height: clampedH });\n model.clamp();\n };\n const cleanup = (e: PointerEvent): void => {\n target.releasePointerCapture?.(e.pointerId);\n target.removeEventListener('pointermove', move);\n target.removeEventListener('pointerup', cleanup);\n target.removeEventListener('pointercancel', cleanup);\n model.resized.next({ width: model.width(), height: model.height() });\n };\n\n target.addEventListener('pointermove', move);\n target.addEventListener('pointerup', cleanup);\n // Same cancelled-gesture leak as `startMove` — a resize handle that is\n // still listening for `pointermove` resizes the window on a bare hover.\n target.addEventListener('pointercancel', cleanup);\n }\n\n // Bound resize handlers for the template — avoids inline object literals\n // re-creating on every change-detection tick.\n protected resizeTL = (e: PointerEvent): void => this.startResize(e, { t: true, l: true });\n protected resizeT = (e: PointerEvent): void => this.startResize(e, { t: true });\n protected resizeTR = (e: PointerEvent): void => this.startResize(e, { t: true, r: true });\n protected resizeR = (e: PointerEvent): void => this.startResize(e, { r: true });\n protected resizeBR = (e: PointerEvent): void => this.startResize(e, { b: true, r: true });\n protected resizeB = (e: PointerEvent): void => this.startResize(e, { b: true });\n protected resizeBL = (e: PointerEvent): void => this.startResize(e, { b: true, l: true });\n protected resizeL = (e: PointerEvent): void => this.startResize(e, { l: true });\n\n // Keyboard move and resize\n\n /**\n * Alt+F7 moves and Alt+F8 resizes — the keys Windows has used for both since\n * Windows 3, and what GNOME and KDE bind too. Move and resize used to be\n * drag-only, which is a WCAG 2.1.1 failure on its own.\n */\n protected onKeydown(event: KeyboardEvent): void {\n if (this.model().keyboardMode()) {\n this.onModeKey(event);\n return;\n }\n if (event.defaultPrevented || !event.altKey || event.ctrlKey || event.metaKey || event.shiftKey) return;\n if (event.key !== 'F7' && event.key !== 'F8') return;\n if (this.startKeyboard(event.key === 'F7' ? 'move' : 'resize')) event.preventDefault();\n }\n\n /**\n * Enter keyboard move or resize, with focus in the window so the keys arrive.\n * Returns `false` when the window may not be moved or resized.\n *\n * @internal\n */\n startKeyboard(mode: WrWindowKeyboardMode): boolean {\n const model = this.model();\n const ref = this.windowRef();\n if (ref) this.manager._activate(ref, { focus: false });\n if (!model.startKeyboard(mode)) return false;\n // Onto the window itself for the length of the mode, the way a desktop\n // does it: left on a button in the body, the Enter that ends the mode\n // pressed the button as well — and \"Close\" closed the window.\n this.elRef.nativeElement.focus({ preventScroll: true });\n this.announce(mode === 'move' ? this.moveModeText() : this.resizeModeText());\n return true;\n }\n\n private onModeKey(event: KeyboardEvent): void {\n const model = this.model();\n const step = event.shiftKey ? 1 : model.options().keyboardStep;\n const arrows: Record<string, readonly [number, number]> = {\n ArrowLeft: [-step, 0],\n ArrowRight: [step, 0],\n ArrowUp: [0, -step],\n ArrowDown: [0, step],\n };\n const delta = arrows[event.key];\n if (delta) {\n event.preventDefault();\n if (model.keyboardMode() === 'move') {\n model.nudge(delta[0], delta[1]);\n } else {\n // The inline end edge moves: in a right-to-left page that is the left\n // one, so the arrow pointing away from the window still grows it.\n const rtl = this.dir?.value === 'rtl';\n model.grow(rtl ? -delta[0] : delta[0], delta[1], rtl);\n }\n return;\n }\n if (event.key === 'Enter') {\n event.preventDefault();\n this.commitKeyboard();\n this.focusLast();\n } else if (event.key === 'Escape') {\n // Claimed, so the manager's Escape does not close the window as well.\n event.preventDefault();\n const mode = model.cancelKeyboard();\n if (mode) this.announceGeometry(mode);\n this.focusLast();\n } else if (event.key === 'Tab') {\n this.commitKeyboard();\n }\n }\n\n /** Keep what the keyboard mode did, and say so. Focus is the caller's business. */\n private commitKeyboard(): void {\n const mode = this.model().commitKeyboard();\n if (mode) this.announceGeometry(mode);\n }\n\n private announceGeometry(mode: WrWindowKeyboardMode): void {\n const r = this.model().rect();\n this.announce(\n mode === 'move' ? this.movedText({ x: r.left, y: r.top }) : this.resizedText({ width: r.width, height: r.height })\n );\n }\n\n private announce(text: string): void {\n this.announcement.set(text);\n }\n}\n","<!--\n No pointerdown here: the host takes every press, so a `dragHandle` in the body\n can start a move as well as the title bar, and a press anywhere activates the\n window. The double-click is bound here and on the host; see `onChromeDblClick`.\n The action count is for the macOS chrome, which pads its title as wide as the\n cluster so the title centres on the whole bar.\n-->\n<div\n class=\"wr-window__chrome\"\n [style.--wr-window-chrome-action-count]=\"actionCount()\"\n (dblclick)=\"onChromeDblClick($event)\"\n>\n <div class=\"wr-window__title\" [attr.id]=\"titleId\">{{ displayTitle() }}</div>\n <div class=\"wr-window__title-extra\">\n @if (titleExtraTemplate(); as template) {\n <ng-container *ngTemplateOutlet=\"template; context: slotContext(); injector: injector()\" />\n } @else if (titleExtraComponent(); as component) {\n <ng-container *ngComponentOutlet=\"component; injector: injector()\" />\n }\n </div>\n\n <div class=\"wr-window__chrome-actions\">\n @if (resolvedOs() === 'macos') {\n <!--\n macOS traffic lights: close, minimize, zoom, in that order from the frame\n edge. The button is the hit target and the coloured dot is its\n `::before`, so the box can be big enough to press while the dot stays\n the platform's size. The glyphs sit on an 8px grid and appear only while\n the cluster is hovered or holds keyboard focus, as they do on macOS.\n Zoom draws the full-screen arrows of Big Sur and later: pointing out to\n maximize, pointing in to restore. Every straight edge of both sits on a\n whole pixel, so the filled triangles stay hard at 1x.\n -->\n @if (showClose()) {\n <button\n type=\"button\"\n class=\"wr-window__chrome-action wr-window__chrome-action--close\"\n [attr.aria-label]=\"closeLabel()\"\n (click)=\"close()\"\n >\n <svg class=\"wr-window__chrome-action-glyph\" width=\"8\" height=\"8\" viewBox=\"0 0 8 8\" aria-hidden=\"true\">\n <path d=\"M1.5 1.5l5 5m0-5l-5 5\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" />\n </svg>\n </button>\n }\n @if (minimizeVisible()) {\n <button\n type=\"button\"\n class=\"wr-window__chrome-action wr-window__chrome-action--minimize\"\n [attr.aria-label]=\"minimizeActionLabel()\"\n (click)=\"minimize()\"\n >\n <svg class=\"wr-window__chrome-action-glyph\" width=\"8\" height=\"8\" viewBox=\"0 0 8 8\" aria-hidden=\"true\">\n <path d=\"M1.5 3.5h5\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" />\n </svg>\n </button>\n }\n @if (maximizeVisible()) {\n <button\n type=\"button\"\n class=\"wr-window__chrome-action wr-window__chrome-action--maximize\"\n [attr.aria-label]=\"maximizeActionLabel()\"\n (click)=\"maximize()\"\n >\n <svg class=\"wr-window__chrome-action-glyph\" width=\"8\" height=\"8\" viewBox=\"0 0 8 8\" aria-hidden=\"true\">\n @if (state() === 'maximized') {\n <path d=\"M3 3V.5L.5 3zM5 5v2.5L7.5 5z\" fill=\"currentColor\" />\n } @else {\n <path d=\"M1 1h4L1 5zm6 6H3l4-4z\" fill=\"currentColor\" />\n }\n </svg>\n </button>\n }\n } @else if (resolvedOs() === 'linux') {\n <!--\n GNOME (libadwaita) window controls: round buttons with Adwaita's 16px\n symbolic glyphs, 2px strokes on whole pixels. Restore is the SMALLER\n square, the way Adwaita draws it, not a second overlapping one. Close-only\n is the DEFAULT here, not a rule: `minimizeVisible()` resolves the input\n first, so `[showMinimize]=\"true\"` puts the button back, which is the only\n way a user on Linux can reach `<wr-window-taskbar>` at all.\n -->\n @if (minimizeVisible()) {\n <button\n type=\"button\"\n class=\"wr-window__chrome-action wr-window__chrome-action--minimize\"\n [attr.aria-label]=\"minimizeActionLabel()\"\n (click)=\"minimize()\"\n >\n <svg class=\"wr-window__chrome-action-glyph\" width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" aria-hidden=\"true\">\n <path d=\"M4 11h8\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" />\n </svg>\n </button>\n }\n @if (maximizeVisible()) {\n <button\n type=\"button\"\n class=\"wr-window__chrome-action wr-window__chrome-action--maximize\"\n [attr.aria-label]=\"maximizeActionLabel()\"\n (click)=\"maximize()\"\n >\n <svg class=\"wr-window__chrome-action-glyph\" width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" aria-hidden=\"true\">\n @if (state() === 'maximized') {\n <rect x=\"6\" y=\"6\" width=\"4\" height=\"4\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" />\n } @else {\n <rect x=\"5\" y=\"5\" width=\"6\" height=\"6\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" />\n }\n </svg>\n </button>\n }\n @if (showClose()) {\n <button\n type=\"button\"\n class=\"wr-window__chrome-action wr-window__chrome-action--close\"\n [attr.aria-label]=\"closeLabel()\"\n (click)=\"close()\"\n >\n <svg class=\"wr-window__chrome-action-glyph\" width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" aria-hidden=\"true\">\n <path d=\"M5 5l6 6m0-6l-6 6\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" />\n </svg>\n </button>\n }\n } @else {\n <!--\n Windows 11 caption buttons: 10px glyphs in the full-height, 46px-wide\n buttons, drawn the way Segoe Fluent Icons draws them. 1px strokes on half\n pixels, so they land on whole device pixels at 1x and 2x, and the corners\n of maximize and restore are rounded by 1px.\n -->\n @if (minimizeVisible()) {\n <button\n type=\"button\"\n class=\"wr-window__chrome-action wr-window__chrome-action--minimize\"\n [attr.aria-label]=\"minimizeActionLabel()\"\n (click)=\"minimize()\"\n >\n <svg class=\"wr-window__chrome-action-glyph\" width=\"10\" height=\"10\" viewBox=\"0 0 10 10\" aria-hidden=\"true\">\n <path d=\"M0 4.5h10\" fill=\"none\" stroke=\"currentColor\" />\n </svg>\n </button>\n }\n @if (maximizeVisible()) {\n <button\n type=\"button\"\n class=\"wr-window__chrome-action wr-window__chrome-action--maximize\"\n [attr.aria-label]=\"maximizeActionLabel()\"\n (click)=\"maximize()\"\n >\n <svg class=\"wr-window__chrome-action-glyph\" width=\"10\" height=\"10\" viewBox=\"0 0 10 10\" aria-hidden=\"true\">\n @if (state() === 'maximized') {\n <g fill=\"none\" stroke=\"currentColor\">\n <rect x=\".5\" y=\"2.5\" width=\"7\" height=\"7\" rx=\"1\" />\n <path d=\"M2.5 2.5v-1a1 1 0 0 1 1-1h5a1 1 0 0 1 1 1v5a1 1 0 0 1-1 1h-1\" />\n </g>\n } @else {\n <rect x=\".5\" y=\".5\" width=\"9\" height=\"9\" rx=\"1\" fill=\"none\" stroke=\"currentColor\" />\n }\n </svg>\n </button>\n }\n @if (showClose()) {\n <button\n type=\"button\"\n class=\"wr-window__chrome-action wr-window__chrome-action--close\"\n [attr.aria-label]=\"closeLabel()\"\n (click)=\"close()\"\n >\n <svg class=\"wr-window__chrome-action-glyph\" width=\"10\" height=\"10\" viewBox=\"0 0 10 10\" aria-hidden=\"true\">\n <path d=\"M.5.5l9 9m0-9l-9 9\" fill=\"none\" stroke=\"currentColor\" />\n </svg>\n </button>\n }\n }\n </div>\n</div>\n\n<div class=\"wr-window__body\">\n <ng-content />\n</div>\n\n<div class=\"wr-window__status-bar\">\n @if (statusBarTemplate(); as template) {\n <ng-container *ngTemplateOutlet=\"template; context: slotContext(); injector: injector()\" />\n } @else if (statusBarComponent(); as component) {\n <ng-container *ngComponentOutlet=\"component; injector: injector()\" />\n }\n</div>\n\n<!--\n Keyboard move and resize say what they did here: the mode on entry, the\n landing on Enter or Escape. Not each step — that would flood the region.\n-->\n<p class=\"wr-window__sr-only\" role=\"status\">{{ announcement() }}</p>\n\n@if (resizeHandles()) {\n <span class=\"wr-window__handle wr-window__handle--t\" (pointerdown)=\"resizeT($event)\"></span>\n <span class=\"wr-window__handle wr-window__handle--r\" (pointerdown)=\"resizeR($event)\"></span>\n <span class=\"wr-window__handle wr-window__handle--b\" (pointerdown)=\"resizeB($event)\"></span>\n <span class=\"wr-window__handle wr-window__handle--l\" (pointerdown)=\"resizeL($event)\"></span>\n <span class=\"wr-window__handle wr-window__handle--tl\" (pointerdown)=\"resizeTL($event)\"></span>\n <span class=\"wr-window__handle wr-window__handle--tr\" (pointerdown)=\"resizeTR($event)\"></span>\n <span class=\"wr-window__handle wr-window__handle--bl\" (pointerdown)=\"resizeBL($event)\"></span>\n <span class=\"wr-window__handle wr-window__handle--br\" (pointerdown)=\"resizeBR($event)\"></span>\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 ComponentType } from '@angular/cdk/portal';\nimport {\n ChangeDetectionStrategy,\n Component,\n DestroyRef,\n Injector,\n ViewContainerRef,\n ViewEncapsulation,\n afterNextRender,\n effect,\n inject,\n runInInjectionContext,\n untracked,\n viewChild,\n} from '@angular/core';\n\nimport { WrStorage } from 'ngwr/storage';\nimport { wrCheckStyles } from 'ngwr/utils';\n\nimport { WrWindowManager } from './services/window-manager';\nimport { storageKey } from './storage-key';\nimport type { WrWindowConfig } from './types';\nimport { WrWindow } from './window';\nimport type { WrWindowRef } from './window-ref';\n\n/** Coalesce live position/size writes — drag/resize fires every move. */\nconst PERSIST_DEBOUNCE_MS = 200;\n\n/** What `storage` keeps — the geometry the user chose, never what a state imposes. @internal */\nexport interface PersistedGeometry {\n readonly x?: number;\n readonly y?: number;\n readonly width?: number;\n readonly height?: number;\n}\n\n/**\n * Internal host attached by `WrWindowManager.open()`. Draws a `<wr-window>` for\n * the ref's model, creates the consumer's component inside its body, and wires\n * the DOM-only parts of the ref — focus and keyboard mode — once it is on the\n * page. State and geometry need no wiring: the ref reads the model directly.\n *\n * @internal\n */\n@Component({\n selector: 'wr-window-container',\n templateUrl: './window-container.html',\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n imports: [WrWindow],\n})\nexport class WrWindowContainer<C> {\n /** Set by the manager before view init. */\n config!: WrWindowConfig;\n /** Set by the manager before view init. */\n ref!: WrWindowRef<C, unknown>;\n /** Set by the manager before view init. */\n componentType!: ComponentType<C>;\n /** Custom injector with `WR_WINDOW_REF` / `WR_WINDOW_DATA` populated. */\n childInjector!: Injector;\n /** Set by the manager: move focus into the window once it has rendered. */\n autoFocus = true;\n\n private readonly hostInjector = inject(Injector);\n private readonly manager = inject(WrWindowManager);\n private readonly storage = inject(WrStorage);\n private readonly destroyRef = inject(DestroyRef);\n private persistTimer: ReturnType<typeof setTimeout> | null = null;\n\n private readonly contentVcr = viewChild.required('content', { read: ViewContainerRef });\n private readonly wrWindow = viewChild.required(WrWindow);\n\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('window');\n afterNextRender(() => this.attach());\n\n // Re-clamp when the WORK AREA changes — a resized viewport, a taskbar\n // appearing — and only then. It used to re-run on every geometry write,\n // repeating the clamp the drag handler had just done on each pointer move.\n effect(() => {\n const model = this.ref._model;\n model.workArea();\n untracked(() => model.clamp());\n });\n\n this.destroyRef.onDestroy(() => {\n if (this.persistTimer !== null) clearTimeout(this.persistTimer);\n });\n }\n\n private attach(): void {\n // 1. Create the consumer's component inside the body slot.\n const componentRef = this.contentVcr().createComponent(this.componentType, {\n injector: this.childInjector,\n });\n this.ref.componentRef = componentRef;\n\n // 2. The DOM-only bridges. After a render, not now: the consumer's\n // component was created a line above and has not drawn its template yet,\n // and a window coming back from the taskbar is still `display: none`\n // until its class updates.\n const w = this.wrWindow();\n const model = this.ref._model;\n this.ref._focusWindow = mode =>\n afterNextRender(\n () => {\n if (mode === 'initial') {\n w.focusInitial();\n return;\n }\n // Only for the window that is STILL the one switched to: two\n // activations in one tick each queue a focus, and the earlier one,\n // landing last, took the keyboard back from the window the user\n // actually ended on.\n if (this.manager.active() === (this.ref as WrWindowRef<unknown, unknown>)) w.focusLast();\n },\n { injector: this.hostInjector }\n );\n this.ref._startKeyboard = mode => {\n if (model.state() !== 'minimized') {\n w.startKeyboard(mode);\n return;\n }\n model.unminimize();\n afterNextRender(() => w.startKeyboard(mode), { injector: this.hostInjector });\n };\n model.onMinimizedWithFocus = () => this.onMinimizedWithFocus();\n // A ref outlives its window; a render hook must not be registered on an\n // injector that is gone.\n this.destroyRef.onDestroy(() => {\n this.ref._focusWindow = null;\n this.ref._startKeyboard = null;\n model.onMinimizedWithFocus = null;\n });\n\n // 3. Storage — hydration happened at open, as the initial geometry; from\n // here on, save as the geometry changes.\n if (this.config.storage) this.installAutosave();\n\n // 4. Focus — never into a window that opened straight into the taskbar.\n if (this.autoFocus && model.state() !== 'minimized') this.ref._focusWindow('initial');\n\n // 5. A keyboard mode asked for before the window was on the page.\n const pending = this.ref._pendingKeyboard;\n if (pending) {\n this.ref._pendingKeyboard = null;\n this.ref._startKeyboard(pending);\n }\n }\n\n /** The window was minimized while it held focus: hand focus to its taskbar tab. */\n private onMinimizedWithFocus(): void {\n // After the render that lists the window in the taskbar.\n afterNextRender(() => this.manager._focusAfterMinimize(this.ref as WrWindowRef<unknown, unknown>), {\n injector: this.hostInjector,\n });\n }\n\n /** Persist geometry whenever it changes, debounced. */\n private installAutosave(): void {\n const cfg = this.config.storage;\n if (!cfg) return;\n const persist = cfg.persist ?? 'all';\n const key = storageKey(cfg);\n const model = this.ref._model;\n\n runInInjectionContext(this.hostInjector, () => {\n effect(() => {\n // The raw geometry: what a maximized or snapped window goes back to,\n // and so what the user chose.\n const x = model.x();\n const y = model.y();\n const width = model.width();\n const height = model.height();\n\n if (this.persistTimer !== null) clearTimeout(this.persistTimer);\n this.persistTimer = setTimeout(() => {\n this.persistTimer = null;\n const payload: PersistedGeometry = {\n ...(persist !== 'size' ? { x, y } : {}),\n ...(persist !== 'position' ? { width, height } : {}),\n };\n this.storage.set(key, payload);\n }, PERSIST_DEBOUNCE_MS);\n });\n });\n }\n}\n","<wr-window\n [model]=\"ref._model\"\n [windowRef]=\"ref\"\n [injector]=\"childInjector\"\n [titleExtra]=\"config.titleExtra ?? null\"\n [statusBar]=\"config.statusBar ?? null\"\n (closed)=\"ref.close()\"\n #window\n>\n <ng-container #content />\n</wr-window>\n\n<!--\n The snap hint lives here, not inside `<wr-window>`: `.wr-window` clips, and a\n fixed child is clipped with it while the open animation's transform is on.\n It takes the exact box the drop will give the window, from the same model\n arithmetic, so the hint and the landing cannot disagree — they did when the\n hint was a CSS 50% of the layout viewport and the snap was half of\n `innerWidth`, 7.5px apart with a classic scrollbar showing.\n-->\n@if (ref._model.previewRect(); as box) {\n <div\n class=\"wr-window__snap-hint\"\n [attr.data-target]=\"ref._model.dragTarget()\"\n [style.left.px]=\"box.left\"\n [style.top.px]=\"box.top\"\n [style.width.px]=\"box.width\"\n [style.height.px]=\"box.height\"\n [style.z-index]=\"ref._model.z() + 1\"\n aria-hidden=\"true\"\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 { type Signal, type WritableSignal, computed, signal } from '@angular/core';\n\nimport { Subject } from 'rxjs';\n\nimport { wrClamp } from 'ngwr/utils';\n\nimport type {\n WrWindowChromeSize,\n WrWindowConfig,\n WrWindowOs,\n WrWindowSize,\n WrWindowSnap,\n WrWindowSnapTarget,\n WrWindowState,\n WrWindowUpdate,\n} from './types';\n\n/** What a minimized window reports as its height. It is `display: none`, so this is only a number. */\nconst MINIMIZED_HEIGHT = 40;\n\n/** A finite number, or the fallback — a `NaN` from a bad config must not reach the geometry. */\nfunction num(value: number | undefined, fallback: number): number {\n return typeof value === 'number' && !Number.isNaN(value) ? value : fallback;\n}\n\n/**\n * A rectangle in viewport pixels — the work area, a snap region, a window's box.\n *\n * @internal\n */\nexport interface WrWindowRect {\n readonly left: number;\n readonly top: number;\n readonly width: number;\n readonly height: number;\n}\n\n/** @internal A window's free-floating geometry: where it is when it is neither maximized nor snapped. */\nexport interface WrWindowGeometry {\n readonly x: number;\n readonly y: number;\n readonly width: number;\n readonly height: number;\n}\n\n/**\n * Every option a window reads after it opens, with its default applied. The\n * ones `WrWindowRef.update()` may change are signals of this object, so an\n * update reaches the chrome and the drag code alike.\n *\n * @internal\n */\nexport interface WrWindowOptions {\n readonly os: WrWindowOs;\n readonly chromeSize: WrWindowChromeSize;\n readonly animations: boolean;\n readonly minWidth: number;\n readonly minHeight: number;\n readonly maxWidth: number;\n readonly maxHeight: number;\n readonly movable: boolean;\n readonly resizable: boolean;\n readonly keepInViewport: boolean;\n readonly snap: WrWindowSnap;\n readonly restoreOnDrag: boolean;\n readonly dragHandle: string | null;\n readonly showMinimize: boolean | null;\n readonly showMaximize: boolean | null;\n readonly showClose: boolean;\n readonly closeOnEscape: boolean;\n readonly keyboard: boolean;\n readonly keyboardStep: number;\n}\n\n/** @internal */\nexport const SIZE_PRESETS: Readonly<Record<WrWindowSize, { readonly width: number; readonly height: number }>> = {\n sm: { width: 320, height: 200 },\n md: { width: 480, height: 320 },\n lg: { width: 720, height: 480 },\n};\n\n/** Keep at least this many px of a window inside the work area, so it can be grabbed again. @internal */\nexport const MIN_ON_SCREEN = 24;\n\n/** @internal `WrWindowConfig` with every default applied. */\nexport function resolveOptions(config: WrWindowConfig): WrWindowOptions {\n return {\n os: config.os ?? 'auto',\n chromeSize: config.chromeSize ?? 'md',\n animations: config.animations ?? true,\n minWidth: num(config.minWidth, 220),\n minHeight: num(config.minHeight, 140),\n maxWidth: num(config.maxWidth, Number.POSITIVE_INFINITY),\n maxHeight: num(config.maxHeight, Number.POSITIVE_INFINITY),\n movable: config.movable ?? true,\n resizable: config.resizable ?? true,\n keepInViewport: config.keepInViewport ?? true,\n snap: config.snap ?? 'none',\n restoreOnDrag: config.restoreOnDrag ?? true,\n dragHandle: config.dragHandle ?? null,\n showMinimize: config.showMinimize ?? null,\n showMaximize: config.showMaximize ?? null,\n showClose: config.showClose ?? true,\n closeOnEscape: config.closeOnEscape ?? true,\n keyboard: config.keyboard ?? true,\n keyboardStep: Math.max(1, num(config.keyboardStep, 10)),\n };\n}\n\n/** @internal The viewport, or a stand-in on the server. */\nexport function readViewport(): { readonly width: number; readonly height: number } {\n if (typeof window === 'undefined' || typeof document === 'undefined') return { width: 1024, height: 768 };\n // `clientWidth`, not `innerWidth`: a `position: fixed` box is laid out\n // against the viewport WITHOUT its scrollbar, so with a classic 15px\n // scrollbar a window maximized to `innerWidth` ran under it, and a snap to\n // the right half started 7.5px right of the hint that promised it. jsdom\n // lays nothing out and reports 0, which is what the fallback is for.\n const root = document.documentElement;\n return { width: root.clientWidth || window.innerWidth, height: root.clientHeight || window.innerHeight };\n}\n\n/** @internal Start offset `index` windows into a cascade: 30px a step, and every ten a lap 15px along. */\nexport function cascadeOffset(index: number): { readonly x: number; readonly y: number } {\n // Ten steps then back to the start, so a cascade never walks off the\n // screen — and each lap shifted 15px ALONG ONLY, so window eleven no longer\n // opens exactly on top of window one. Shifting both axes put lap three's\n // windows exactly on lap one's, one step down the diagonal; with `x - y`\n // different for each lap, no two of the first fifty windows coincide.\n const step = 50 + (index % 10) * 30;\n return { x: step + (Math.floor(index / 10) % 5) * 15, y: step };\n}\n\n/** @internal What `seedGeometry` needs to place a window that is about to open. */\nexport interface WrWindowSeed {\n readonly options: WrWindowOptions;\n readonly workArea: WrWindowRect;\n readonly size: WrWindowSize | undefined;\n readonly x?: number;\n readonly y?: number;\n readonly width?: number;\n readonly height?: number;\n /**\n * The position came back from storage or a saved layout rather than from the\n * consumer: it is moved wholly into the work area when the window fits, the\n * way a cascade position is. A desktop's geometry restored on a phone\n * otherwise opened 1100px wide with its close button off the glass.\n */\n readonly restored?: boolean;\n /** The next cascade offset, asked for only when a coordinate is missing. */\n readonly cascade: () => { readonly x: number; readonly y: number };\n readonly rtl: boolean;\n}\n\n/**\n * Where a window opens. A window OPENS on screen when it can: the size is\n * capped at the work area (the minimum still wins, since it is the consumer's\n * floor), and a cascade or restored position is moved in until the whole box\n * fits. A coordinate the consumer passed is theirs, held only to the reach a\n * drag is held to.\n *\n * @internal\n */\nexport function seedGeometry(seed: WrWindowSeed): WrWindowGeometry {\n const { options: o, workArea: wa } = seed;\n const preset = SIZE_PRESETS[seed.size ?? 'md'];\n const keep = o.keepInViewport;\n const fit = (size: number, room: number): number => (keep ? Math.min(size, room) : size);\n const width = Math.round(wrClamp(fit(seed.width ?? preset.width, wa.width), o.minWidth, o.maxWidth));\n const height = Math.round(wrClamp(fit(seed.height ?? preset.height, wa.height), o.minHeight, o.maxHeight));\n\n let x = seed.x;\n let y = seed.y;\n let cascaded = false;\n if (x == null || y == null) {\n const offset = seed.cascade();\n cascaded = true;\n // From the START edge of the work area: the right edge in a right-to-left\n // page, where the cascade used to begin at the inline end.\n x ??= seed.rtl ? wa.left + wa.width - width - offset.x : wa.left + offset.x;\n y ??= wa.top + offset.y;\n }\n const into = cascaded || !!seed.restored;\n if (keep && (into || seed.x == null)) x = wrClamp(x, wa.left, Math.max(wa.left, wa.left + wa.width - width));\n if (keep && (into || seed.y == null)) y = wrClamp(y, wa.top, Math.max(wa.top, wa.top + wa.height - height));\n return { x: Math.round(x), y: Math.round(y), width, height };\n}\n\n/** @internal How a window was set up when it opened. */\nexport interface WrWindowModelInit {\n readonly options: WrWindowOptions;\n readonly title?: string;\n readonly geometry?: WrWindowGeometry;\n readonly state?: WrWindowState;\n readonly snap?: WrWindowSnapTarget | null;\n readonly z?: number;\n readonly workArea: Signal<WrWindowRect>;\n}\n\n/** @internal A half or a quarter: what `snap` can hold. `top` is the maximized state instead. */\nexport type WrWindowSnapRegion = Exclude<WrWindowSnapTarget, 'top'>;\n\n/** @internal What `startKeyboard` hands back for the announcement. */\nexport type WrWindowKeyboardMode = 'move' | 'resize';\n\n/**\n * One window's state and geometry, and the rules for changing them.\n *\n * Created by `WrWindowManager.open()` before anything renders, so the ref's\n * signals are right from the first read and a call made before the first render\n * — `ref.maximize()` in the same tick as `open()`, `ref.setTitle()` from the\n * body's constructor — lands instead of being dropped. The component only draws\n * it and turns pointer and key events into calls on it.\n *\n * The raw `x` / `y` / `width` / `height` are the geometry the USER chose. A\n * maximized or snapped window shows something else (`rect`), and goes back to\n * the raw geometry when it leaves that state; nothing has to be saved on the\n * way in, so a `moveTo()` made while maximized is where restore lands.\n *\n * @internal\n */\nexport class WrWindowModel {\n readonly options: WritableSignal<WrWindowOptions>;\n readonly title: WritableSignal<string>;\n readonly state: WritableSignal<WrWindowState>;\n /** The half or quarter the window occupies while `normal`. `top` is never stored: it is `maximized`. */\n readonly snap: WritableSignal<WrWindowSnapRegion | null>;\n readonly x: WritableSignal<number>;\n readonly y: WritableSignal<number>;\n readonly width: WritableSignal<number>;\n readonly height: WritableSignal<number>;\n readonly z: WritableSignal<number>;\n /** Written by the manager: whether this is the window that has the keyboard. */\n readonly isActive = signal(false);\n readonly keyboardMode = signal<WrWindowKeyboardMode | null>(null);\n /** The snap region a drag in progress would land in, for the hint. */\n readonly dragTarget = signal<WrWindowSnapTarget | null>(null);\n readonly workArea: Signal<WrWindowRect>;\n\n readonly moved = new Subject<{ readonly x: number; readonly y: number }>();\n readonly resized = new Subject<{ readonly width: number; readonly height: number }>();\n readonly stateChanges = new Subject<WrWindowState>();\n\n /** Set by the component: the `<wr-window>` element, for the focus checks. */\n element: HTMLElement | null = null;\n /** Set by the container: the window was minimized while it held focus. */\n onMinimizedWithFocus: (() => void) | null = null;\n\n /** What leaving `minimized` goes back to — a window minimized while maximized comes back maximized. */\n private restoreTo: 'normal' | 'maximized' = 'normal';\n /** The geometry keyboard mode started from, after it restored the window: what a commit compares against. */\n private keyboardStart: WrWindowGeometry | null = null;\n /** Everything keyboard mode changed on entry, so Escape can put back a maximized or snapped window too. */\n private keyboardOrigin: {\n readonly geometry: WrWindowGeometry;\n readonly state: WrWindowState;\n readonly snap: WrWindowSnapRegion | null;\n } | null = null;\n\n /** The box on screen: the raw geometry, or what the state imposes on it. */\n readonly rect: Signal<WrWindowRect> = computed(() => {\n const state = this.state();\n if (state === 'maximized') return this.maximizedRect();\n const raw = { left: this.x(), top: this.y(), width: this.width(), height: this.height() };\n if (state === 'minimized') return { ...raw, height: MINIMIZED_HEIGHT };\n const snap = this.snap();\n return snap ? this.snapRect(snap) : raw;\n });\n\n /** Where the drag in progress would land, for the snap hint. */\n readonly previewRect: Signal<WrWindowRect | null> = computed(() => {\n const target = this.dragTarget();\n return target ? this.targetRect(target) : null;\n });\n\n constructor(init: WrWindowModelInit) {\n this.options = signal(init.options);\n this.title = signal(init.title ?? '');\n this.state = signal(init.state ?? 'normal');\n this.snap = signal<WrWindowSnapRegion | null>(init.snap && init.snap !== 'top' ? init.snap : null);\n const g = init.geometry ?? { x: 0, y: 0, width: SIZE_PRESETS.md.width, height: SIZE_PRESETS.md.height };\n this.x = signal(g.x);\n this.y = signal(g.y);\n this.width = signal(g.width);\n this.height = signal(g.height);\n this.z = signal(init.z ?? 0);\n this.workArea = init.workArea;\n this.clamp();\n }\n\n // State\n\n /** The one place a state is written, so `stateChanges` hears every change and only real ones. */\n setState(next: WrWindowState): void {\n const current = this.state();\n if (current === next) return;\n if (next === 'minimized') this.restoreTo = current === 'maximized' ? 'maximized' : 'normal';\n this.state.set(next);\n this.stateChanges.next(next);\n }\n\n /** Toggle: minimize, or come back to the state it was minimized from. */\n minimize(): void {\n if (this.state() === 'minimized') {\n this.unminimize();\n return;\n }\n // Read before the state flips: once the class lands, nothing inside has a\n // box and the browser has already dropped focus on `<body>`.\n const hadFocus = this.hasFocus();\n this.setState('minimized');\n if (hadFocus) this.onMinimizedWithFocus?.();\n }\n\n /** Leave `minimized` for the state the window was minimized from. A no-op otherwise. */\n unminimize(): void {\n if (this.state() === 'minimized') this.setState(this.restoreTo);\n }\n\n /** Toggle: maximize, or restore down to where it was — a snapped half included. */\n maximize(): void {\n this.setState(this.state() === 'maximized' ? 'normal' : 'maximized');\n }\n\n /** Back to the free-floating geometry: not minimized, not maximized, not snapped. */\n restore(): void {\n this.snap.set(null);\n this.setState('normal');\n }\n\n /** Snap to a region of the work area; `top` maximizes, `null` un-snaps. */\n snapTo(target: WrWindowSnapTarget | null): void {\n if (target === 'top') {\n this.setState('maximized');\n return;\n }\n this.snap.set(target);\n this.setState('normal');\n }\n\n // Geometry\n\n /** Write the raw geometry, in whole pixels — a touch drag hands out fractions. */\n setRaw(g: Partial<WrWindowGeometry>): void {\n if (g.x !== undefined) this.x.set(Math.round(g.x));\n if (g.y !== undefined) this.y.set(Math.round(g.y));\n if (g.width !== undefined) this.width.set(Math.round(g.width));\n if (g.height !== undefined) this.height.set(Math.round(g.height));\n }\n\n /**\n * A snapped window that is moved or resized by hand leaves the snap and\n * keeps the box it had, the way a desktop does — otherwise the write would\n * land in the raw geometry and nothing would visibly move.\n */\n unsnapInPlace(): void {\n if (!this.snap()) return;\n if (this.state() === 'normal') {\n const r = this.rect();\n this.setRaw({ x: r.left, y: r.top, width: r.width, height: r.height });\n }\n this.snap.set(null);\n }\n\n moveTo(x: number, y: number): void {\n this.unsnapInPlace();\n this.setRaw({ x, y });\n this.clamp();\n }\n\n resizeTo(width: number, height: number): void {\n this.unsnapInPlace();\n const o = this.options();\n this.setRaw({ width: wrClamp(width, o.minWidth, o.maxWidth), height: wrClamp(height, o.minHeight, o.maxHeight) });\n this.clamp();\n }\n\n center(): void {\n this.unsnapInPlace();\n const wa = this.workArea();\n this.setRaw({\n x: wa.left + Math.max(0, (wa.width - this.width()) / 2),\n y: wa.top + Math.max(0, (wa.height - this.height()) / 2),\n });\n }\n\n /**\n * Keep enough of the window inside the work area to grab it again. Reads the\n * work area, so a resized viewport pulls a window back into reach.\n */\n clamp(): void {\n if (!this.options().keepInViewport) return;\n const wa = this.workArea();\n const w = this.width();\n this.x.set(Math.round(wrClamp(this.x(), wa.left + MIN_ON_SCREEN - w, wa.left + wa.width - MIN_ON_SCREEN)));\n this.y.set(Math.round(wrClamp(this.y(), wa.top, wa.top + wa.height - MIN_ON_SCREEN)));\n }\n\n /** Change options on an open window. New bounds re-clamp the size the window has now. */\n update(patch: WrWindowUpdate): void {\n const { title, ...rest } = patch;\n if (title !== undefined) this.title.set(title);\n const defined: Record<string, unknown> = {};\n for (const [key, value] of Object.entries(rest)) if (value !== undefined) defined[key] = value;\n if (Object.keys(defined).length === 0) return;\n this.options.update(o => ({ ...o, ...defined }));\n if (['minWidth', 'minHeight', 'maxWidth', 'maxHeight'].some(key => key in defined)) {\n const o = this.options();\n this.setRaw({\n width: wrClamp(this.width(), o.minWidth, o.maxWidth),\n height: wrClamp(this.height(), o.minHeight, o.maxHeight),\n });\n this.clamp();\n }\n }\n\n /** The box a maximized window takes: the work area, capped at the maximum size and centred in it. */\n maximizedRect(): WrWindowRect {\n const wa = this.workArea();\n const o = this.options();\n const width = Math.min(wa.width, o.maxWidth);\n const height = Math.min(wa.height, o.maxHeight);\n return {\n left: wa.left + Math.round((wa.width - width) / 2),\n top: wa.top + Math.round((wa.height - height) / 2),\n width,\n height,\n };\n }\n\n /**\n * The box a half or a quarter takes, held to the window's own bounds: a\n * window that cannot be that narrow keeps its minimum and stays against the\n * edge it was snapped to, and the box is kept inside the work area.\n */\n snapRect(target: WrWindowSnapRegion): WrWindowRect {\n const wa = this.workArea();\n const o = this.options();\n const halfW = Math.floor(wa.width / 2);\n const halfH = Math.floor(wa.height / 2);\n const right = target === 'right' || target === 'top-right' || target === 'bottom-right';\n const bottom = target === 'bottom-left' || target === 'bottom-right';\n const quarter = target !== 'left' && target !== 'right';\n // The far half carries the odd pixel, so the two halves meet with no gap.\n const regionW = right ? wa.width - halfW : halfW;\n const regionH = quarter ? (bottom ? wa.height - halfH : halfH) : wa.height;\n const regionL = wa.left + (right ? halfW : 0);\n const regionT = wa.top + (bottom ? halfH : 0);\n const width = wrClamp(regionW, o.minWidth, o.maxWidth);\n const height = wrClamp(regionH, o.minHeight, o.maxHeight);\n const left = right ? regionL + regionW - width : regionL;\n const top = bottom ? regionT + regionH - height : regionT;\n return {\n left: wrClamp(left, wa.left, Math.max(wa.left, wa.left + wa.width - width)),\n top: wrClamp(top, wa.top, Math.max(wa.top, wa.top + wa.height - height)),\n width,\n height,\n };\n }\n\n /** Where a snap target puts the window. */\n targetRect(target: WrWindowSnapTarget): WrWindowRect {\n return target === 'top' ? this.maximizedRect() : this.snapRect(target);\n }\n\n // Keyboard move and resize\n\n /**\n * Enter keyboard move or resize. A maximized window is restored down first\n * and a snapped one keeps its box, so the arrows move what the user sees.\n * Returns `false` when the option forbids it.\n */\n startKeyboard(mode: WrWindowKeyboardMode): boolean {\n const o = this.options();\n if (!o.keyboard || this.state() === 'minimized') return false;\n if (mode === 'move' ? !o.movable : !o.resizable) return false;\n this.keyboardOrigin = {\n geometry: { x: this.x(), y: this.y(), width: this.width(), height: this.height() },\n state: this.state(),\n snap: this.snap(),\n };\n if (this.state() === 'maximized') this.setState('normal');\n this.unsnapInPlace();\n this.keyboardStart = { x: this.x(), y: this.y(), width: this.width(), height: this.height() };\n this.keyboardMode.set(mode);\n return true;\n }\n\n /** One arrow key in keyboard move. */\n nudge(dx: number, dy: number): void {\n this.setRaw({ x: this.x() + dx, y: this.y() + dy });\n this.clamp();\n }\n\n /**\n * One arrow key in keyboard resize. The edge that moves is the inline END —\n * the left one in a right-to-left page — so growing never moves the edge the\n * window reads from.\n */\n grow(dw: number, dh: number, rtl: boolean): void {\n const o = this.options();\n const width = wrClamp(this.width() + dw, o.minWidth, o.maxWidth);\n const height = wrClamp(this.height() + dh, o.minHeight, o.maxHeight);\n const x = rtl ? this.x() - (width - this.width()) : this.x();\n this.setRaw({ x, width, height });\n this.clamp();\n }\n\n /** Keep what keyboard mode did. Returns the mode it ended, for the announcement and the stream. */\n commitKeyboard(): WrWindowKeyboardMode | null {\n const mode = this.keyboardMode();\n if (!mode) return null;\n this.keyboardMode.set(null);\n const start = this.keyboardStart;\n this.keyboardStart = null;\n this.keyboardOrigin = null;\n if (mode === 'move' && (start?.x !== this.x() || start?.y !== this.y())) {\n this.moved.next({ x: this.x(), y: this.y() });\n }\n if (mode === 'resize' && (start?.width !== this.width() || start?.height !== this.height())) {\n this.resized.next({ width: this.width(), height: this.height() });\n }\n return mode;\n }\n\n /**\n * Put the window back the way keyboard mode found it: the geometry, and the\n * maximized state or the snapped half it restored on entry. Without the last\n * two, Escape on a maximized window left it restored down.\n */\n cancelKeyboard(): WrWindowKeyboardMode | null {\n const mode = this.keyboardMode();\n if (!mode) return null;\n const origin = this.keyboardOrigin;\n this.keyboardStart = null;\n this.keyboardOrigin = null;\n this.keyboardMode.set(null);\n if (origin) {\n this.setRaw(origin.geometry);\n this.snap.set(origin.snap);\n this.setState(origin.state);\n }\n return mode;\n }\n\n /** Whether focus is inside the window. */\n hasFocus(): boolean {\n const el = this.element;\n return !!el && el.contains(el.ownerDocument.activeElement);\n }\n\n /** The window closed: no stream may outlive it. */\n complete(): void {\n this.moved.complete();\n this.resized.complete();\n this.stateChanges.complete();\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 { OverlayRef } from '@angular/cdk/overlay';\nimport { type ComponentRef, type Signal, computed, signal } from '@angular/core';\n\nimport { type Observable, ReplaySubject, type Subject } from 'rxjs';\n\nimport type { WrWindowBeforeCloseHook, WrWindowSnapTarget, WrWindowState, WrWindowUpdate } from './types';\nimport { type WrWindowKeyboardMode, WrWindowModel, readViewport, resolveOptions } from './window-model';\n\n/**\n * What a ref needs from the manager that opened it.\n *\n * @internal\n */\nexport interface WrWindowRefHost {\n /** Raise the window, mark it active and, unless told otherwise, move focus into it. */\n _activate(ref: WrWindowRef<unknown, unknown>, options?: { readonly focus?: boolean }): void;\n /** Raise the window without touching focus. */\n _raise(ref: WrWindowRef<unknown, unknown>): void;\n}\n\n/**\n * Handle returned by `WrWindowManager.open()`.\n *\n * Wraps the underlying overlay, exposes signals for the live geometry,\n * and gives the consumer programmatic control over the window\n * (focus, move, resize, minimize, maximize, close).\n *\n * Every signal is right from the moment `open()` returns, and every call works\n * from then on too — including from the body component's constructor.\n *\n * @example\n * ```ts\n * const ref = manager.open(EditorComponent, {\n * title: 'Untitled.md',\n * storage: { key: 'editor', prefix: 'app' },\n * });\n *\n * ref.beforeClose(async () => {\n * if (!isDirty) return true;\n * return await confirmDiscard();\n * });\n *\n * const saved = await ref.afterClosed(); // resolves with whatever the\n * // component passed to ref.close(value)\n * ```\n */\nexport class WrWindowRef<C, R = unknown> {\n /** Stable id — used by the taskbar, workspace save, and DI. */\n readonly id: string;\n\n /**\n * @internal — emits the close result once and completes.\n *\n * A `ReplaySubject`, not a plain `Subject`, so the result survives a late\n * subscriber — the same reasoning `WrDialogRef` already carries. A caller\n * that holds the ref and awaits `afterClosed()` after any intervening\n * `await` subscribes to an already-completed stream, and a plain Subject\n * hands it nothing but `complete`: the promise resolved `undefined` and a\n * saved result was indistinguishable from a dismissal.\n */\n readonly _closed = new ReplaySubject<R | undefined>(1);\n\n /** @internal — the window's state and geometry; the signals below read through it. */\n readonly _model: WrWindowModel;\n\n /** @internal — emits whenever the state changes; `stateChanges` is its public face. */\n readonly _stateChanged: Subject<WrWindowState>;\n\n /** @internal — set by the container right after attach. */\n componentRef: ComponentRef<C> | null = null;\n\n /** @internal — whether this window opts into the taskbar list. */\n taskbarVisible = true;\n\n /** @internal — the manager that opened the window. */\n _host: WrWindowRefHost | null = null;\n\n /** @internal — close the overlay and settle the result; wired by the manager. */\n _doClose: ((result: R | undefined) => void) | null = null;\n\n /**\n * @internal — move focus into the window after the next render: to the control\n * it had last (`'last'`, falling back to the first one) or to the first one.\n * Wired by the container once the window is on the page.\n */\n _focusWindow: ((mode: 'initial' | 'last') => void) | null = null;\n\n /** @internal — enter keyboard move / resize; wired by the container. */\n _startKeyboard: ((mode: WrWindowKeyboardMode) => void) | null = null;\n\n /** @internal — a keyboard mode asked for before the window was on the page. */\n _pendingKeyboard: WrWindowKeyboardMode | null = null;\n\n /**\n * @internal — what had focus when `open()` was called, and where closing the\n * window sends it back. `null` when focus was on nothing.\n */\n _returnFocus: HTMLElement | null = null;\n\n /** Window state. A snapped window is `normal`; read {@link snap} for which half. */\n readonly state: Signal<WrWindowState>;\n /** Left edge on screen, in px — the work area's while maximized. */\n readonly x: Signal<number>;\n /** Top edge on screen, in px. */\n readonly y: Signal<number>;\n /** Width on screen, in px. */\n readonly width: Signal<number>;\n /** Height on screen, in px. */\n readonly height: Signal<number>;\n /** Stack z-index. */\n readonly z: Signal<number>;\n /** Live title. */\n readonly title: Signal<string>;\n /** The half or quarter the window is snapped to, or `null` (since v15.1). Maximized reads `null`. */\n readonly snap: Signal<WrWindowSnapTarget | null>;\n /** Whether this is the active window — the one that has the keyboard (since v15.1). */\n readonly isActive: Signal<boolean>;\n\n /** Emits the close result once, then completes — the stream `WrDialogRef.closed` is (since v15.1). */\n readonly closed: Observable<R | undefined>;\n /**\n * Emits where the user moved the window: once when a title-bar drag or a\n * keyboard move ends, and when a drag snaps it. Calls from code are silent —\n * the caller knows where it put the window (since v15.1).\n */\n readonly moved: Observable<{ readonly x: number; readonly y: number }>;\n /**\n * Emits the size the user gave the window: once when an edge drag or a\n * keyboard resize ends, and when a drag snaps it to a half or a quarter.\n * Calls from code are silent (since v15.1).\n */\n readonly resized: Observable<{ readonly width: number; readonly height: number }>;\n /** Emits every state change, from the user or from code (since v15.1). */\n readonly stateChanges: Observable<WrWindowState>;\n\n // Hooks\n private _beforeCloseHook: WrWindowBeforeCloseHook<R> | null = null;\n\n /**\n * A ref built by hand — a test double for `WR_WINDOW_REF`. It answers every\n * call with a window of its own that nothing renders.\n */\n constructor(id: string, _overlayRef: OverlayRef);\n /** @internal The manager's form: the window's model, built before anything renders. */\n constructor(id: string, _overlayRef: OverlayRef, model: WrWindowModel);\n constructor(\n id: string,\n public readonly _overlayRef: OverlayRef,\n model?: WrWindowModel\n ) {\n this.id = id;\n // A ref built by hand — a test double for `WR_WINDOW_REF` — still answers.\n const m =\n model ??\n new WrWindowModel({\n options: resolveOptions({}),\n workArea: signal({ left: 0, top: 0, ...readViewport() }),\n });\n this._model = m;\n this._stateChanged = m.stateChanges;\n this.state = m.state.asReadonly();\n this.x = computed(() => m.rect().left);\n this.y = computed(() => m.rect().top);\n this.width = computed(() => m.rect().width);\n this.height = computed(() => m.rect().height);\n this.z = m.z.asReadonly();\n this.title = m.title.asReadonly();\n this.snap = m.snap.asReadonly();\n this.isActive = m.isActive.asReadonly();\n this.closed = this._closed.asObservable();\n this.moved = m.moved.asObservable();\n this.resized = m.resized.asObservable();\n this.stateChanges = m.stateChanges.asObservable();\n }\n\n /** Resolved instance of the projected component. */\n get componentInstance(): C {\n if (!this.componentRef) {\n throw new Error('WrWindowRef: component not yet attached');\n }\n return this.componentRef.instance;\n }\n\n // Lifecycle\n\n private isClosed = false;\n\n /**\n * Close the window, optionally returning a result. If a `beforeClose`\n * hook is registered it is consulted first — a falsy resolution\n * cancels the close.\n */\n async close(result?: R): Promise<void> {\n // `WrDialogRef` / `WrDrawerRef` latch the same way on their own `isClosed`,\n // but theirs are synchronous: this is the only one of the three that AWAITS,\n // so it is the\n // only one a second call can enter mid-flight and run the hook again. Two\n // Escapes in a row do it, and so does `manager.closeAll()` while a hook is\n // pending — `_doClose` is what removes the ref from the manager's list, and\n // it has not run yet.\n if (this.isClosed) return;\n this.isClosed = true;\n\n let proceed = false;\n try {\n proceed = this._beforeCloseHook ? !!(await this._beforeCloseHook(result)) : true;\n } finally {\n // A veto is not a close, and neither is a hook that threw — release the\n // latch in both cases, or a declined close would disable the window for\n // good.\n if (!proceed) this.isClosed = false;\n }\n\n if (proceed) this._doClose?.(result);\n }\n\n /** Toggle the minimized state. Leaving it returns to the state it was minimized from. */\n minimize(): void {\n this._model.minimize();\n }\n\n /** Toggle the maximized state. Restoring down returns to where the window was, a snapped half included. */\n maximize(): void {\n this._model.maximize();\n }\n\n /** Back to `normal` at the window's own geometry — from minimized, maximized or snapped. */\n restore(): void {\n this._model.restore();\n }\n\n /**\n * Bring this window to the top of the stack. Only RAISES it: focus stays\n * where it is. Use {@link activate} to switch to the window.\n */\n focus(): void {\n this._host?._raise(this as WrWindowRef<unknown, unknown>);\n }\n\n /**\n * Switch to the window: bring it back from the taskbar if it is minimized,\n * raise it, make it the active window, and move focus to the control it had\n * last (its first control when it never had one) (since v15.1).\n */\n activate(): void {\n if (this._host) this._host._activate(this as WrWindowRef<unknown, unknown>);\n else this._model.unminimize();\n }\n\n // Programmatic geometry\n\n /**\n * Move the window to `(x, y)`, held to the work area while `keepInViewport`.\n * While maximized it moves the geometry restore lands on; a snapped window\n * leaves the snap.\n */\n moveTo(x: number, y: number): void {\n this._model.moveTo(x, y);\n }\n\n /** Resize the window, held to `minWidth`…`maxWidth` and `minHeight`…`maxHeight`. */\n resizeTo(width: number, height: number): void {\n this._model.resizeTo(width, height);\n }\n\n /** Re-position the window so it sits centered in its work area. */\n center(): void {\n this._model.center();\n }\n\n /** Snap to a half or a quarter of the work area; `'top'` maximizes, `null` un-snaps (since v15.1). */\n snapTo(target: WrWindowSnapTarget | null): void {\n this._model.snapTo(target);\n }\n\n /** Update the title-bar text, and with it the window's accessible name. */\n setTitle(title: string): void {\n this._model.title.set(title);\n }\n\n /**\n * Change options on an open window — lock it while it saves, take its close\n * button away while a task runs. New bounds re-clamp its current size\n * (since v15.1).\n */\n update(patch: WrWindowUpdate): void {\n this._model.update(patch);\n }\n\n /**\n * Move the window from the keyboard: the arrow keys step it, Shift by one\n * pixel, Enter keeps the result and Escape puts it back. Moves focus into the\n * window so the keys arrive. Bind it to a menu item or a button to offer\n * moving without a drag (since v15.1).\n */\n startMove(): void {\n this.startKeyboard('move');\n }\n\n /** Resize the window from the keyboard, the same way as {@link startMove} (since v15.1). */\n startResize(): void {\n this.startKeyboard('resize');\n }\n\n private startKeyboard(mode: WrWindowKeyboardMode): void {\n if (this._startKeyboard) this._startKeyboard(mode);\n else this._pendingKeyboard = mode;\n }\n\n // Hooks\n\n /**\n * Register a guard that runs before `close()`. Return `false` (or a\n * Promise resolving to false) to veto. Only one hook per ref —\n * subsequent calls replace the previous.\n */\n beforeClose(hook: WrWindowBeforeCloseHook<R>): void {\n this._beforeCloseHook = hook;\n }\n\n /** Resolves with the result passed to `close()` (or `undefined`). */\n afterClosed(): Promise<R | undefined> {\n return new Promise(resolve => {\n this._closed.subscribe({\n next: value => resolve(value),\n complete: () => resolve(undefined),\n });\n });\n }\n\n /** The same promise as {@link afterClosed}, under the name `WrDialogRef` uses (since v15.1). */\n awaitClose(): Promise<R | undefined> {\n return this.afterClosed();\n }\n\n /** Escape hatch — the underlying CDK overlay ref. */\n get overlayRef(): OverlayRef {\n return this._overlayRef;\n }\n}\n\nexport type { WrWindowBeforeCloseHook } 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 { FocusMonitor } from '@angular/cdk/a11y';\nimport { Directionality } from '@angular/cdk/bidi';\nimport { type OverlayRef } from '@angular/cdk/overlay';\nimport { ComponentPortal, type ComponentType } from '@angular/cdk/portal';\nimport { isPlatformBrowser } from '@angular/common';\nimport {\n DestroyRef,\n ElementRef,\n EnvironmentInjector,\n Injector,\n PLATFORM_ID,\n Service,\n type Signal,\n afterNextRender,\n computed,\n inject,\n signal,\n untracked,\n} from '@angular/core';\n\nimport { WR_OVERLAY, wrFollowDirection } from 'ngwr/overlay';\nimport { WrStorage } from 'ngwr/storage';\nimport { wrClamp, wrRandomId, wrToClassList, wrRestoreFocus } from 'ngwr/utils';\n\nimport { storageKey } from '../storage-key';\nimport { WR_WINDOW_DATA, WR_WINDOW_DEFAULTS, WR_WINDOW_REF } from '../tokens';\nimport type {\n WrWindowBounds,\n WrWindowConfig,\n WrWindowInsets,\n WrWindowLayoutSnapshot,\n WrWindowStorageConfig,\n} from '../types';\nimport { type PersistedGeometry, WrWindowContainer } from '../window-container';\nimport {\n type WrWindowRect,\n WrWindowModel,\n cascadeOffset,\n readViewport,\n resolveOptions,\n seedGeometry,\n} from '../window-model';\nimport { type WrWindowRefHost, WrWindowRef } from '../window-ref';\n\ntype AnyRef = WrWindowRef<unknown, unknown>;\n\nconst NO_RESERVE = { top: 0, bottom: 0 } as const;\n\nfunction sameRect(a: WrWindowRect, b: WrWindowRect): boolean {\n return a.left === b.left && a.top === b.top && a.width === b.width && a.height === b.height;\n}\n\n/**\n * What `WrWindowManager` needs from a `<wr-window-taskbar>` on the page: the\n * row a window's tab sits in, so focus can land on it when the window is\n * minimized and be recognised there when the window is closed from it, and\n * the strip it covers, so maximized windows stop short of it.\n *\n * @internal\n */\nexport interface WrWindowTaskbarTabs {\n /**\n * The `.wr-window-taskbar__tab` row for `ref`, the \"+N\" button when its tab is\n * folded under one, or `null` when this taskbar does not list it.\n */\n tabFor(ref: AnyRef): HTMLElement | null;\n /**\n * Whether `ref`'s place in the rail is still moving: its tab has not been\n * measured yet, or the render that folds or unfolds it has not happened. Focus\n * waits for it rather than landing on a tab about to hide or a \"+N\" not drawn.\n */\n settling(ref: AnyRef): boolean;\n /** Whether `node` is inside this taskbar. */\n contains(node: Node): boolean;\n /** The strip of the viewport this taskbar covers while it shows tabs, in px from each edge. */\n readonly reserve: Signal<{ readonly top: number; readonly bottom: number }>;\n}\n\n/**\n * Owns the open window stack, hands out z-indexes, tracks the active window,\n * cascades the default spawn position, and opens windows that wrap a consumer\n * component.\n *\n * Inject the singleton and call `open(component, config)` for a\n * dialog-style flow:\n *\n * ```ts\n * const manager = inject(WrWindowManager);\n *\n * const ref = manager.open(EditorComponent, {\n * title: 'Untitled.md',\n * size: 'lg',\n * storage: { key: 'editor', prefix: 'my-app' },\n * });\n *\n * const saved = await ref.afterClosed();\n * ```\n *\n * There is no declarative `<wr-window>`: `open()` is the only way in, so every\n * window shares this one stack.\n */\n@Service()\nexport class WrWindowManager implements WrWindowRefHost {\n private readonly focusMonitor = inject(FocusMonitor);\n private readonly overlay = inject(WR_OVERLAY);\n private readonly parentInjector = inject(EnvironmentInjector);\n private readonly storage = inject(WrStorage);\n private readonly isBrowser = isPlatformBrowser(inject(PLATFORM_ID));\n private readonly dir = inject(Directionality, { optional: true });\n private readonly defaults = inject(WR_WINDOW_DEFAULTS, { optional: true });\n private readonly destroyRef = inject(DestroyRef);\n\n private readonly baseZ = 1000;\n private topZ = this.baseZ;\n private openCount = 0;\n\n /** All open windows, in the order they opened. */\n private readonly _windows = signal<readonly AnyRef[]>([]);\n\n /** The window that has the keyboard, or `null`. */\n private readonly _active = signal<AnyRef | null>(null);\n\n /**\n * Filled by `restoreLayout` right before it invokes the consumer's\n * opener callback. The next `open()` call with a matching `config.id`\n * pops the entry and uses it as the initial geometry and state.\n */\n private readonly pendingRestores = new Map<string, WrWindowLayoutSnapshot>();\n\n /** The taskbars on the page, registered by each `<wr-window-taskbar>` for its lifetime. */\n private readonly taskbars = signal<readonly WrWindowTaskbarTabs[]>([]);\n\n /**\n * ONE viewport for every window, kept by one `resize` listener. Each window\n * used to add its own — twenty listeners for twenty windows, each writing its\n * own copy of the same two numbers.\n */\n private readonly viewport = signal(readViewport(), {\n equal: (a, b) => a.width === b.width && a.height === b.height,\n });\n /** Bumped when an element used as `bounds` may have moved: it resized, or something scrolled. */\n private readonly layoutTick = signal(0);\n private listening = false;\n private boundsObserver: ResizeObserver | null = null;\n private readonly boundElements = new Map<HTMLElement, number>();\n private readonly bumpLayout = (): void => this.layoutTick.update(n => n + 1);\n\n /** The strip the taskbars cover, edge by edge. */\n private readonly reserve = computed(() => {\n let top = 0;\n let bottom = 0;\n for (const taskbar of this.taskbars()) {\n const r = taskbar.reserve();\n top = Math.max(top, r.top);\n bottom = Math.max(bottom, r.bottom);\n }\n return top === 0 && bottom === 0 ? NO_RESERVE : { top, bottom };\n });\n\n /** All currently-open windows, in the order they opened. */\n // Spelled out rather than `AnyRef` on every public member: the alias is not\n // exported, so the published typings would name `AnyRef$1` to a consumer.\n readonly windows: Signal<readonly WrWindowRef<unknown, unknown>[]> = this._windows.asReadonly();\n\n /**\n * The active window — the one that has the keyboard: the last one focused,\n * clicked, opened with focus or switched to (since v15.1). `null` once focus\n * moves to something on the page outside every window, and while the active\n * window is minimized.\n */\n readonly active: Signal<WrWindowRef<unknown, unknown> | null> = this._active.asReadonly();\n\n /** Windows that are minimized AND opted into the taskbar. */\n readonly minimized: Signal<WrWindowRef<unknown, unknown>[]> = computed(() =>\n this._windows().filter(w => w.taskbarVisible && w.state() === 'minimized')\n );\n\n /** Reserve the next z-index. Strictly increasing across the app's lifetime. */\n bringToFront(): number {\n this.topZ += 1;\n return this.topZ;\n }\n\n /**\n * Cascade offset for new windows, so two opens don't perfectly overlap: 30px\n * a step from the work area's start edge, back to the start after ten, and\n * each lap of ten shifted 15px along so window eleven does not land exactly\n * on window one.\n */\n nextStartOffset(): { readonly x: number; readonly y: number } {\n const offset = cascadeOffset(this.openCount);\n this.openCount += 1;\n return offset;\n }\n\n /**\n * Open a window with `component` rendered as its body. Returns a ref\n * the caller can use to drive the window programmatically and await\n * its result.\n *\n * **Singleton by id** — if `config.id` is set and a window with that\n * id is already open, that window is switched to (back from the taskbar,\n * raised, focused) and its ref returned. No duplicate window is\n * created. Use this to coalesce repeated open() calls (e.g. a\n * \"Settings\" menu item that should always re-focus the same window).\n */\n open<C, R = unknown, D = unknown>(component: ComponentType<C>, config: WrWindowConfig<D> = {}): WrWindowRef<C, R> {\n // Where focus goes back to when the window closes — read before anything\n // here moves it.\n const opener = this.focusedElement();\n\n if (config.id) {\n const existing = this.findById(config.id);\n if (existing) {\n // A second open is still an open: focus goes to the window, and back to\n // whatever asked for it this time — unless that was the window itself.\n if (config.autoFocus !== false) {\n if (opener && !existing._overlayRef.overlayElement?.contains(opener)) existing._returnFocus = opener;\n this._activate(existing);\n } else {\n existing._model.unminimize();\n this._raise(existing);\n }\n return existing as WrWindowRef<C, R>;\n }\n }\n\n // Honour a pending restore — `restoreLayout` populates this Map\n // right before invoking the consumer's opener so the new window\n // seeds at the saved geometry instead of the cascade default.\n const pending = config.id ? this.pendingRestores.get(config.id) : undefined;\n if (pending) this.pendingRestores.delete(config.id!);\n\n this.listen();\n\n const options = resolveOptions(config);\n const bounds = this.boundsElement(config.bounds ?? this.defaults?.bounds);\n const workArea = this.workAreaFor(config.bounds ?? this.defaults?.bounds, bounds);\n const releaseBounds = bounds ? this.observeBounds(bounds) : null;\n\n // Saved geometry is the INITIAL geometry, through the same fit as a\n // cascade: it used to be written over the window after it had sized\n // itself, skipping the fit and the min / max clamps, so a desktop's\n // 1100px window reopened on a phone with 24px of it on the glass.\n const saved = !pending && config.storage ? this.storage.get<PersistedGeometry>(storageKey(config.storage)) : null;\n const persist = config.storage?.persist ?? 'all';\n const isNum = (v: unknown): v is number => typeof v === 'number' && !Number.isNaN(v);\n const savedPos = saved && persist !== 'size' && isNum(saved.x) && isNum(saved.y) ? saved : null;\n const savedSize = saved && persist !== 'position' && isNum(saved.width) && isNum(saved.height) ? saved : null;\n\n const geometry = untracked(() =>\n seedGeometry({\n options,\n workArea: workArea(),\n size: config.size,\n x: pending?.x ?? savedPos?.x ?? config.x,\n y: pending?.y ?? savedPos?.y ?? config.y,\n width: pending?.width ?? savedSize?.width ?? config.width,\n height: pending?.height ?? savedSize?.height ?? config.height,\n restored: !!pending || !!savedPos,\n cascade: () => this.nextStartOffset(),\n rtl: this.dir?.value === 'rtl',\n })\n );\n\n const taskbarOptIn = config.taskbar !== false;\n const model = new WrWindowModel({\n options,\n // A saved title, else the config's — an empty saved title is not one.\n title: [pending?.title, config.title].find(t => !!t) ?? '',\n geometry,\n state: pending?.state,\n snap: pending?.snap ?? null,\n z: this.bringToFront(),\n workArea,\n });\n\n // Assigned right after the ref exists; the predicate below only ever runs\n // from a keydown, long after.\n let self: AnyRef | null = null;\n\n // Each window gets its own CDK overlay pane positioned `static` —\n // <wr-window> itself uses `position: fixed`, so the pane is only a\n // mount point. Windows are never modal — reach for `WrDialog` when\n // you need a backdrop + focus trap + scroll block.\n const overlayRef: OverlayRef = this.overlay.create({\n positionStrategy: this.overlay.position().global(),\n panelClass: wrToClassList('wr-window-overlay', config.panelClass),\n hasBackdrop: false,\n // Which window an Escape belongs to is a question the CDK cannot answer\n // here. Its keyboard dispatcher walks the attached overlays newest-first\n // and hands the key to the first one willing to take it — and attach order\n // is frozen at OPEN order, because raising re-stacks with a z-index and\n // never re-attaches. Declining here is what makes it recoverable: a\n // rejected event walks on down the stack instead of being eaten, so the\n // window that does own it still gets its Escape.\n eventPredicate: () => self === null || this.ownsKeyboard(self),\n // OUT of the top layer, deliberately. The CDK puts overlay hosts there by\n // default (`popover=\"manual\"`), and the top layer orders strictly by\n // ENTRY: whatever opened last paints on top and no z-index can change it.\n // That is right for a menu or a modal and exactly wrong for a window\n // manager, whose whole job is letting the user decide which window is in\n // front. It also fixes the ordering against modals: a dialog stays in the\n // top layer, so it now sits above every window instead of below whichever\n // window happened to open after it.\n usePopover: false,\n });\n\n // The z-index has to land on the OVERLAY HOST, not only on `.wr-window`.\n // Each window sits in its own CDK global wrapper, and that wrapper is\n // `position: fixed` with a numeric `z-index` — which makes it a stacking\n // context, so a z-index written inside it only orders things against its\n // own siblings, never against another window.\n overlayRef.hostElement.style.zIndex = String(model.z());\n\n // Windows are long-lived — a session can leave one open across any number\n // of direction changes — and while `x` / `y` are physical by design (as are\n // the resize grips, deliberately), the chrome is not: the macOS title bar\n // parks its button cluster with `row-reverse`, which resolves against `dir`,\n // so a stale attribute leaves the dots and the gutter that counterbalances\n // them on opposite edges. Each `open()` has its own ref, and `_doClose`\n // disposes it, which is what ends this follower.\n wrFollowDirection(overlayRef, this.dir, this.parentInjector);\n\n const id = config.id ?? wrRandomId('wr-window');\n const ref = new WrWindowRef<C, R>(id, overlayRef, model);\n const any = ref as unknown as AnyRef;\n self = any;\n ref._host = this;\n ref.taskbarVisible = taskbarOptIn;\n\n // A minimized window is not the one with the keyboard: focus has gone to\n // its taskbar tab, or back to where the window was opened from.\n model.stateChanges.subscribe(state => {\n if (state === 'minimized' && this._active() === any) this.setActive(null);\n });\n\n // Provide WR_WINDOW_REF + WR_WINDOW_DATA inside the projected\n // component's subtree so it can `inject(WR_WINDOW_REF)` etc.\n const childInjector = Injector.create({\n parent: this.parentInjector,\n providers: [\n { provide: WR_WINDOW_REF, useValue: ref },\n { provide: WR_WINDOW_DATA, useValue: config.data ?? null },\n ],\n });\n\n const portal = new ComponentPortal<WrWindowContainer<C>>(WrWindowContainer);\n const containerRef = overlayRef.attach(portal);\n const container = containerRef.instance;\n container.config = config;\n container.ref = ref as WrWindowRef<C, unknown>;\n container.componentType = component;\n container.childInjector = childInjector;\n // A window `restoreLayout()` re-opens stays out of focus's way unless its\n // opener says otherwise: a workspace of five windows coming back must not\n // pull focus through each of them and leave it in whichever came last.\n container.autoFocus = config.autoFocus ?? !pending;\n ref._returnFocus = opener;\n\n // No role on the pane: `<wr-window>` inside it is the named `role=\"dialog\"`,\n // and a second, unnamed one around it read as \"dialog > dialog\" and tripped\n // axe's `aria-dialog-name` on every open window.\n\n // Always subscribed, and the option read when the key arrives, so\n // `update({ closeOnEscape })` reaches an open window. A key claimed below\n // it — Escape cancelling keyboard move — is not a close.\n overlayRef.keydownEvents().subscribe(event => {\n if (event.key !== 'Escape' || event.defaultPrevented || !model.options().closeOnEscape) return;\n event.preventDefault();\n void ref.close();\n });\n\n // Wire close → disposal + completion of the result subject. The\n // ref's `close()` already runs the beforeClose hook before reaching\n // this bridge.\n ref._doClose = result => {\n // Read before disposal takes the focused element out of the page. Focus\n // goes back only when it was the window's to give: inside it, on its\n // taskbar tab, or already lost. A window closed by code while the reader\n // works elsewhere leaves them there.\n const back = this.holdsFocus(any) ? ref._returnFocus : null;\n ref._returnFocus = null;\n overlayRef.dispose();\n releaseBounds?.();\n ref._closed.next(result);\n ref._closed.complete();\n model.complete();\n this._windows.update(list => list.filter(r => r !== any));\n if (this._active() === any) this.setActive(null);\n if (back?.isConnected) wrRestoreFocus(back, this.focusMonitor);\n };\n\n this._windows.update(list => [...list, any]);\n\n return ref;\n }\n\n /**\n * Switch to `ref`: back from the taskbar, raised, active, and — unless told\n * otherwise — focused on the control it had last.\n *\n * @internal\n */\n _activate(ref: AnyRef, options: { readonly focus?: boolean } = {}): void {\n if (!this._windows().includes(ref)) return;\n ref._model.unminimize();\n this._raise(ref);\n this.setActive(ref);\n if (options.focus !== false && !ref._model.hasFocus()) ref._focusWindow?.('last');\n }\n\n /**\n * Put `ref` on top of the stack. A window already on top keeps its z: every\n * click in a window used to take a new one, so the number climbed with each\n * press and every press re-wrote the host's style.\n *\n * @internal\n */\n _raise(ref: AnyRef): void {\n if (ref.z() >= this.topZ) return;\n const z = this.bringToFront();\n ref._model.z.set(z);\n const host = ref._overlayRef.hostElement;\n if (host) host.style.zIndex = String(z);\n }\n\n private setActive(ref: AnyRef | null): void {\n const previous = this._active();\n if (previous === ref) return;\n previous?._model.isActive.set(false);\n ref?._model.isActive.set(true);\n this._active.set(ref);\n }\n\n /**\n * Focus decides the active window wherever it comes from: Tab into a window,\n * a click on a field in it, a script calling `focus()`. A window that gains\n * focus is raised too — a focused window hidden behind another is a window\n * the user is typing into blind. Focus on a taskbar, or in another overlay,\n * leaves the active window as it was; focus anywhere else on the page means\n * none is.\n */\n private readonly onFocusIn = (event: FocusEvent): void => {\n const target = event.target;\n if (!(target instanceof Node)) return;\n const ref = this._windows().find(w => w._overlayRef.overlayElement?.contains(target));\n if (ref) {\n this._raise(ref);\n this.setActive(ref);\n return;\n }\n if (this.taskbars().some(t => t.contains(target))) return;\n // Focus that went into another overlay — a menu or a listbox opened from\n // inside a window, a dialog over it — is not focus that left for the page:\n // the window it came from keeps the keyboard, the way a desktop keeps a\n // window active while its menu is open.\n if (target instanceof Element && target.closest('.wr-overlay-container, .cdk-overlay-container')) return;\n this.setActive(null);\n };\n\n /** Install the shared listeners, once, on the first open in a browser. */\n private listen(): void {\n if (this.listening || !this.isBrowser) return;\n this.listening = true;\n const measure = (): void => this.viewport.set(readViewport());\n measure();\n window.addEventListener('resize', measure, { passive: true });\n document.addEventListener('focusin', this.onFocusIn, true);\n this.destroyRef.onDestroy(() => {\n window.removeEventListener('resize', measure);\n document.removeEventListener('focusin', this.onFocusIn, true);\n document.removeEventListener('scroll', this.bumpLayout, true);\n this.boundsObserver?.disconnect();\n });\n }\n\n private boundsElement(bounds: WrWindowBounds | undefined): HTMLElement | null {\n if (!bounds || bounds === 'viewport') return null;\n if (bounds instanceof ElementRef) return bounds.nativeElement;\n return typeof (bounds as HTMLElement).getBoundingClientRect === 'function' ? (bounds as HTMLElement) : null;\n }\n\n /**\n * The work area for one window: its bounds, cut to the viewport, minus the\n * strip a taskbar covers.\n */\n private workAreaFor(bounds: WrWindowBounds | undefined, element: HTMLElement | null): Signal<WrWindowRect> {\n const insets = !element && bounds && bounds !== 'viewport' ? (bounds as WrWindowInsets) : null;\n return computed(\n () => {\n const vp = this.viewport();\n const reserve = this.reserve();\n let left = 0;\n let top = 0;\n let right = vp.width;\n let bottom = vp.height;\n if (element && this.isBrowser) {\n this.layoutTick();\n const r = element.getBoundingClientRect();\n left = Math.max(0, r.left);\n top = Math.max(0, r.top);\n right = Math.min(vp.width, r.right);\n bottom = Math.min(vp.height, r.bottom);\n } else if (insets) {\n left = insets.left ?? 0;\n top = insets.top ?? 0;\n right = vp.width - (insets.right ?? 0);\n bottom = vp.height - (insets.bottom ?? 0);\n }\n top = Math.max(top, reserve.top);\n bottom = Math.min(bottom, vp.height - reserve.bottom);\n return {\n left: Math.round(left),\n top: Math.round(top),\n width: Math.max(0, Math.round(right - left)),\n height: Math.max(0, Math.round(bottom - top)),\n };\n },\n { equal: sameRect }\n );\n }\n\n /** Keep an element used as `bounds` measured while a window uses it. Returns the release. */\n private observeBounds(element: HTMLElement): () => void {\n if (!this.isBrowser) return () => undefined;\n const count = this.boundElements.get(element) ?? 0;\n this.boundElements.set(element, count + 1);\n if (count === 0) {\n if (typeof ResizeObserver !== 'undefined') {\n this.boundsObserver ??= new ResizeObserver(this.bumpLayout);\n this.boundsObserver.observe(element);\n }\n if (this.boundElements.size === 1) {\n document.addEventListener('scroll', this.bumpLayout, { capture: true, passive: true });\n }\n }\n let released = false;\n return () => {\n if (released) return;\n released = true;\n const left = (this.boundElements.get(element) ?? 1) - 1;\n if (left > 0) {\n this.boundElements.set(element, left);\n return;\n }\n this.boundElements.delete(element);\n this.boundsObserver?.unobserve(element);\n if (this.boundElements.size === 0) document.removeEventListener('scroll', this.bumpLayout, true);\n };\n }\n\n /**\n * Whether a keyboard event routed to `ref`'s overlay is actually meant for it.\n *\n * The window holding real DOM focus owns the key. When focus is on NOTHING —\n * `<body>`, which is where a click on a window's own text used to leave it —\n * the active window owns it if it is on screen, else the front-most window on\n * screen. When focus is anywhere else on the page, no window owns it: an\n * Escape pressed in the page's own search field closed a window the reader\n * was not in. That is the rule the non-modal drawer has always followed.\n *\n * A MINIMIZED window never owns a key it did not receive through focus, and\n * never counts as being in front: it is `display: none`. Focus on a taskbar\n * tab is on the page, so no window owns that key either.\n */\n private ownsKeyboard(ref: AnyRef): boolean {\n if (!this.isBrowser) return false;\n const open = this._windows();\n const active = document.activeElement;\n const focused = active ? open.find(w => w._overlayRef.overlayElement?.contains(active)) : undefined;\n if (focused) return focused === ref;\n if (active && active !== document.body) return false;\n const current = this._active();\n if (current && current.state() !== 'minimized') return current === ref;\n let front: AnyRef | null = null;\n for (const w of open) {\n if (w.state() !== 'minimized' && (!front || w.z() > front.z())) front = w;\n }\n return front === ref;\n }\n\n /**\n * Register a taskbar for as long as it is on the page. Returns the\n * unregister call.\n *\n * @internal\n */\n _registerTaskbar(taskbar: WrWindowTaskbarTabs): () => void {\n this.taskbars.update(list => [...list, taskbar]);\n return () => this.taskbars.update(list => list.filter(t => t !== taskbar));\n }\n\n /**\n * A window was minimized while it held focus, and the render that lists it\n * in the taskbar has happened: put focus on its tab's restore button. With no\n * taskbar listing it (none on the page, or `taskbar: false`), focus goes back\n * to where the window was opened from rather than being left on `<body>`.\n *\n * @internal\n */\n _focusAfterMinimize(ref: AnyRef, attempt = 0): void {\n // A tab the rail has not measured yet can fold on the next pass, and its\n // \"+N\" is not drawn until the pass after. Wait for those, a few at most,\n // rather than focus what is about to hide or fall back to the opener.\n if (attempt < 3 && this.taskbars().some(taskbar => taskbar.settling(ref))) {\n const active = this.focusedElement();\n if (active && ref._overlayRef.overlayElement?.contains(active)) active.blur();\n afterNextRender(() => this._focusAfterMinimize(ref, attempt + 1), { injector: this.parentInjector });\n return;\n }\n // The restore button is the row's first: the close button sits after it. A\n // folded window's place is the \"+N\" button, which is a button itself.\n const tab = this.taskbarTab(ref);\n const restore = tab?.matches('button') ? tab : tab?.querySelector<HTMLElement>('button');\n if (restore) restore.focus();\n else if (ref._returnFocus?.isConnected) wrRestoreFocus(ref._returnFocus, this.focusMonitor);\n // Nowhere to go: at least never leave focus parked inside a window that is\n // `display: none`, where it would keep claiming every Escape. Browsers\n // that run the focus fixup rule have already done this.\n const active = this.focusedElement();\n if (active && ref._overlayRef.overlayElement?.contains(active)) active.blur();\n }\n\n private taskbarTab(ref: AnyRef): HTMLElement | null {\n for (const taskbar of this.taskbars()) {\n const tab = taskbar.tabFor(ref);\n if (tab) return tab;\n }\n return null;\n }\n\n /** The focused element, or `null` when that is `<body>` or nothing. */\n private focusedElement(): HTMLElement | null {\n if (!this.isBrowser) return null;\n const active = document.activeElement;\n return active instanceof HTMLElement && active !== document.body ? active : null;\n }\n\n /** Whether focus is `ref`'s to hand back: inside it, on its taskbar tab, or nowhere. */\n private holdsFocus(ref: AnyRef): boolean {\n if (!this.isBrowser) return false;\n const active = this.focusedElement();\n if (!active) return true;\n return !!ref._overlayRef.overlayElement?.contains(active) || !!this.taskbarTab(ref)?.contains(active);\n }\n\n // Arranging\n\n /** Windows on screen — not minimized. */\n private onScreen(): AnyRef[] {\n return this._windows().filter(w => w.state() !== 'minimized');\n }\n\n /**\n * Restore every window on screen and stack them down from the start edge of\n * their work area, 30px apart, keeping each one's size and their order front\n * to back (since v15.1).\n */\n cascade(): void {\n const rtl = this.dir?.value === 'rtl';\n const list = this.onScreen().sort((a, b) => a.z() - b.z());\n list.forEach((ref, index) => {\n const m = ref._model;\n m.restore();\n const wa = m.workArea();\n const o = m.options();\n const fit = (size: number, room: number): number => (o.keepInViewport ? Math.min(size, room) : size);\n const width = wrClamp(fit(m.width(), wa.width), o.minWidth, o.maxWidth);\n const height = wrClamp(fit(m.height(), wa.height), o.minHeight, o.maxHeight);\n const offset = cascadeOffset(index);\n const x = rtl ? wa.left + wa.width - width - offset.x : wa.left + offset.x;\n const y = wa.top + offset.y;\n m.setRaw({\n x: wrClamp(x, wa.left, Math.max(wa.left, wa.left + wa.width - width)),\n y: wrClamp(y, wa.top, Math.max(wa.top, wa.top + wa.height - height)),\n width,\n height,\n });\n this._raise(ref);\n });\n }\n\n /**\n * Restore every window on screen and share the work area between them, in\n * the order they opened: a grid (the default), side by side in columns, or\n * stacked in rows. A row of a grid with fewer windows spreads them across its\n * whole width. In a right-to-left page the first window takes the right\n * (since v15.1).\n */\n tile(mode: 'grid' | 'columns' | 'rows' = 'grid'): void {\n const list = this.onScreen();\n const n = list.length;\n if (n === 0) return;\n const rtl = this.dir?.value === 'rtl';\n const cols = mode === 'columns' ? n : mode === 'rows' ? 1 : Math.ceil(Math.sqrt(n));\n const rows = Math.ceil(n / cols);\n list.forEach((ref, index) => {\n const m = ref._model;\n m.restore();\n const wa = m.workArea();\n const o = m.options();\n const row = Math.floor(index / cols);\n const inRow = Math.min(cols, n - row * cols);\n let col = index % cols;\n if (rtl) col = inRow - 1 - col;\n const x0 = wa.left + Math.floor((wa.width * col) / inRow);\n const x1 = wa.left + Math.floor((wa.width * (col + 1)) / inRow);\n const y0 = wa.top + Math.floor((wa.height * row) / rows);\n const y1 = wa.top + Math.floor((wa.height * (row + 1)) / rows);\n m.setRaw({\n x: x0,\n y: y0,\n width: wrClamp(x1 - x0, o.minWidth, o.maxWidth),\n height: wrClamp(y1 - y0, o.minHeight, o.maxHeight),\n });\n m.clamp();\n });\n }\n\n /** Minimize every window on screen (since v15.1). */\n minimizeAll(): void {\n for (const ref of this.onScreen()) ref._model.minimize();\n }\n\n /** Bring every minimized window back, each to the state it was minimized from (since v15.1). */\n restoreAll(): void {\n for (const ref of this._windows()) ref._model.unminimize();\n }\n\n /**\n * Switch to the next window, in the order they opened, wrapping at the end —\n * minimized windows included, which come back. Bind it to a hotkey from\n * `ngwr/hotkey`, such as Ctrl+F6 (since v15.1).\n */\n activateNext(): void {\n this.cycle(1);\n }\n\n /** Switch to the previous window, the other way round from {@link activateNext} (since v15.1). */\n activatePrevious(): void {\n this.cycle(-1);\n }\n\n private cycle(step: 1 | -1): void {\n const list = this._windows();\n if (list.length === 0) return;\n const current = this._active();\n const index = current ? list.indexOf(current) : -1;\n const next = index < 0 ? list[step > 0 ? 0 : list.length - 1] : list[(index + step + list.length) % list.length];\n this._activate(next);\n }\n\n /** Close every programmatically-opened window. */\n closeAll(): void {\n for (const ref of [...this._windows()]) {\n void ref.close();\n }\n }\n\n /** Look up an open window by its `config.id`. Returns `null` when no match. */\n findById(id: string): WrWindowRef<unknown, unknown> | null {\n return this._windows().find(r => r.id === id) ?? null;\n }\n\n /**\n * Drop the persisted geometry for a window so the next open uses the\n * config defaults again. Matches `WrWindowConfig.storage` exactly.\n */\n clearPersistedPosition(cfg: WrWindowStorageConfig): void {\n this.storage.remove(storageKey(cfg));\n }\n\n // Workspace save/restore\n //\n // A workspace is a snapshot of every open window's id + state +\n // geometry. Reopening is the consumer's job (component identities\n // aren't serialisable), so `restoreLayout` returns the captured\n // snapshots and a helper that re-applies geometry once the windows\n // have been opened again.\n\n /** Snapshot of one window — what `saveLayout` writes / `restoreLayout` returns. */\n private layoutKey(name: string): string {\n return `wr:window-layout:${name}`;\n }\n\n /**\n * Persist the geometry + state of every open programmatic window\n * under `name`. Pair with `restoreLayout(name)` after re-opening the\n * matching components.\n */\n saveLayout(name: string): void {\n // The RAW geometry, not the live one. `ref.x()` / `ref.width()` report what\n // is on screen — a maximized window measures the viewport, a minimized one\n // measures its collapsed header — so saving those threw away the size the\n // user actually chose. Restoring then re-maximized over viewport-sized\n // \"restore\" geometry, and \"Restore down\" left the window filling the screen\n // with no way back; a minimized window came back from the taskbar as a stub\n // clamped to `minHeight`. The window knows the real numbers all along.\n const snapshot: WrWindowLayoutSnapshot[] = this._windows().map(ref => ({\n id: ref.id,\n state: ref.state(),\n x: ref._model.x(),\n y: ref._model.y(),\n width: ref._model.width(),\n height: ref._model.height(),\n title: ref.title(),\n snap: ref._model.snap(),\n }));\n this.storage.set(this.layoutKey(name), snapshot);\n }\n\n /** Read a saved workspace. Returns `null` when no snapshot is found. */\n readLayout(name: string): readonly WrWindowLayoutSnapshot[] | null {\n return this.storage.get(this.layoutKey(name));\n }\n\n /**\n * Apply a saved workspace.\n *\n * Each saved entry is matched to a currently-open window by `id`. For\n * matches, the geometry / state / title is re-applied immediately.\n * For misses, the optional `open` callback is invoked so the consumer\n * can re-open the right component for that id — the freshly-opened\n * window opens straight at the saved geometry and in the saved state, with\n * no cascade flicker — fitted into the work area when this viewport is\n * smaller than the one the layout was saved on.\n *\n * ```ts\n * manager.restoreLayout('default', (id, snap) => {\n * if (id.startsWith('editor:')) {\n * manager.open(EditorComponent, { id, title: snap.title, data: ... });\n * }\n * });\n * ```\n */\n restoreLayout(name: string, open?: (id: string, snapshot: { readonly title: string }) => void): void {\n const snapshot = this.readLayout(name);\n if (!snapshot) return;\n\n for (const snap of snapshot) {\n const existing = this.findById(snap.id);\n if (existing) {\n this.applyRestore(existing, snap);\n continue;\n }\n if (!open) continue;\n // Stash the geometry so the next `open()` call with this id\n // consumes it as the seed instead of cascading.\n this.pendingRestores.set(snap.id, snap);\n open(snap.id, { title: snap.title });\n // Belt + braces: if the opener didn't actually open a window (or\n // opened with a different id), drop the stale pending entry so it\n // doesn't ambush a future open.\n if (!this.findById(snap.id)) this.pendingRestores.delete(snap.id);\n }\n }\n\n private applyRestore(ref: AnyRef, snap: WrWindowLayoutSnapshot): void {\n // Back to a known 'normal' baseline first, then the geometry, the snap and\n // the state, each written once — the toggles would un-minimize a window\n // that was already minimized.\n const m = ref._model;\n m.restore();\n if (snap.title) m.title.set(snap.title);\n m.resizeTo(snap.width, snap.height);\n m.moveTo(snap.x, snap.y);\n if (snap.snap && snap.snap !== 'top') m.snap.set(snap.snap);\n if (snap.state !== 'normal') m.setState(snap.state);\n }\n\n /** Drop a saved workspace. */\n clearLayout(name: string): void {\n this.storage.remove(this.layoutKey(name));\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 { Directionality } from '@angular/cdk/bidi';\nimport { coerceNumberProperty } from '@angular/cdk/coercion';\nimport {\n ChangeDetectionStrategy,\n Component,\n DestroyRef,\n ElementRef,\n ViewEncapsulation,\n afterNextRender,\n afterRenderEffect,\n computed,\n inject,\n input,\n signal,\n viewChild,\n viewChildren,\n} from '@angular/core';\n\nimport { WrDropdown, WrDropdownItem, WrDropdownMenu } from 'ngwr/dropdown';\nimport { useI18nFormatter, useI18nText } from 'ngwr/i18n';\nimport { wrCheckStyles } from 'ngwr/utils';\n\nimport { WrWindowManager } from './services/window-manager';\nimport type { WrWindowTaskbarShow } from './types';\nimport type { WrWindowRef } from './window-ref';\n\ntype AnyRef = WrWindowRef<unknown, unknown>;\n\n/**\n * Stands in for the consumer input `useI18nText` expects — the taskbar exposes no\n * label inputs. Read reactively rather than once at construction: the rail is as\n * long-lived as the app, so a catalog that arrives later, or a locale switch, has to\n * reach it.\n */\nconst NO_OVERRIDE = signal<string | null>(null).asReadonly();\n\nconst NO_RESERVE = { top: 0, bottom: 0 } as const;\n\n/**\n * What the rail has to fit its tabs into, in px: the width inside its padding and\n * border, the gap between two buttons, the width of the \"+N\" button and the width\n * each window's tab takes at its own title, by window id. `null` where nothing is\n * laid out — on the server, in a hidden taskbar, under jsdom — and then only\n * `maxTabs` folds.\n */\ninterface Room {\n readonly width: number;\n readonly gap: number;\n readonly more: number;\n readonly tabs: ReadonlyMap<string, number>;\n}\n\nconst sameTabs = (a: ReadonlyMap<string, number>, b: ReadonlyMap<string, number>): boolean =>\n a.size === b.size && [...a].every(([id, width]) => b.get(id) === width);\n\nconst sameRoom = (a: Room | null, b: Room | null): boolean =>\n a === b || (!!a && !!b && a.width === b.width && a.gap === b.gap && a.more === b.more && sameTabs(a.tabs, b.tabs));\n\n/** `null` and an empty attribute leave the width to decide; any number keeps at least one tab. */\nconst maxTabsAttr = (value: unknown): number | null =>\n value === null || value === undefined || value === ''\n ? null\n : Math.max(1, Math.trunc(coerceNumberProperty(value, 1)));\n\n/**\n * OS-style window taskbar. Drop one anywhere in the app — typically\n * fixed to the bottom of the viewport — and it lists the windows\n * `WrWindowManager.open()` has handed out: the minimized ones by default,\n * every open one with `show=\"all\"`. Clicking a tab switches to its window;\n * with `show=\"all\"`, clicking the active window's tab minimizes it. The close\n * glyph dismisses a window without restoring it.\n *\n * The rail is one Tab stop, a toolbar: the arrow keys move between its\n * buttons, Home and End jump to the ends.\n *\n * Focus follows the window in and out of the rail: minimizing a window\n * that holds focus puts focus on its tab here, and restoring it from the\n * tab moves focus into the window.\n *\n * While it shows tabs, the rail reserves its strip of the viewport, so a\n * maximized or snapped window stops short of it.\n *\n * The rail stays one row. A tab is as wide as its title, up to\n * `--wr-window-taskbar-tab-max-width`, and the tabs that do not fit — or every\n * one past `maxTabs` — fold under a \"+N\" button at the end, which opens them as\n * a menu. In `show=\"all\"` the active window's tab is never folded.\n *\n * Windows opted out via `config.taskbar = false` never show up here.\n *\n * @example\n * ```html\n * <wr-window-taskbar />\n * <wr-window-taskbar position=\"top\" />\n * <wr-window-taskbar show=\"all\" />\n * <wr-window-taskbar show=\"all\" [maxTabs]=\"6\" />\n * ```\n *\n * @see https://ngwr.dev/reference/components/window\n */\n@Component({\n selector: 'wr-window-taskbar',\n templateUrl: './window-taskbar.html',\n imports: [WrDropdown, WrDropdownMenu, WrDropdownItem],\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n host: {\n class: 'wr-window-taskbar',\n '[class]': 'classes()',\n role: 'toolbar',\n '[attr.aria-label]': 'railLabel()',\n '(keydown)': 'onKeydown($event)',\n '(focusin)': 'onFocusIn($event)',\n },\n})\nexport class WrWindowTaskbar {\n // Four English literals lived in this component's markup, next to a catalog that\n // already carried `window.close`. A `toolbar` with no name and tabs announced in\n // the wrong language are both invisible on screen.\n private readonly minimizedLabel = useI18nText(NO_OVERRIDE, 'window.taskbar', 'Minimized windows');\n private readonly allLabel = useI18nText(NO_OVERRIDE, 'window.taskbarAll', 'Open windows');\n /** @internal */ protected readonly closeLabel = useI18nText(NO_OVERRIDE, 'window.closeWindow', 'Close window');\n /** @internal */ protected readonly untitled = useI18nText(NO_OVERRIDE, 'window.untitled', 'Untitled');\n /** @internal */ protected readonly restoreLabel = useI18nFormatter('window.restoreWindow', 'Restore {{title}}');\n /** @internal */ protected readonly moreLabel = useI18nFormatter('window.taskbarMore', 'More windows: {{count}}');\n\n /** Edge the taskbar pins itself to. @default 'bottom' */\n readonly position = input<'top' | 'bottom'>('bottom');\n\n /**\n * Which windows the rail lists: the minimized ones, or every open one with\n * the active window marked (since v15.1). @default 'minimized'\n */\n readonly show = input<WrWindowTaskbarShow>('minimized');\n\n /**\n * The most tabs the rail shows; the rest fold under a \"+N\" button that opens\n * them as a menu (since v15.1). The width folds tabs too, whatever this says:\n * the tabs that do not fit beside the button at their own width go under it.\n * `null` leaves it to the width alone.\n * @default null\n */\n readonly maxTabs = input<number | null, unknown>(null, { transform: maxTabsAttr });\n\n private readonly manager = inject(WrWindowManager);\n private readonly host = inject<ElementRef<HTMLElement>>(ElementRef).nativeElement;\n private readonly dir = inject(Directionality, { optional: true });\n\n /** @internal */ protected readonly railLabel = computed(() =>\n this.show() === 'all' ? this.allLabel() : this.minimizedLabel()\n );\n\n /** @internal — the windows the rail lists, in the order they opened. */\n protected readonly items = computed(() =>\n this.show() === 'all' ? this.manager.windows().filter(w => w.taskbarVisible) : this.manager.minimized()\n );\n\n /** What the rail has to fit its tabs into — see {@link Room}. */\n private readonly room = signal<Room | null>(null, { equal: sameRoom });\n\n /**\n * The tabs the rail draws, in opening order: all of them while they fit and\n * `maxTabs` allows it, otherwise the most that fit beside the \"+N\" button,\n * never more than `maxTabs` and never fewer than one. The active window's tab\n * takes the last place when it would otherwise fold, so the one tab\n * `show=\"all\"` marks is always in reach. A tab not measured yet counts as\n * nothing, and the pass after its first render corrects that.\n */\n protected readonly visible = computed(() => {\n const items = this.items();\n const max = this.maxTabs() ?? Infinity;\n const room = this.room();\n const fits = (shown: readonly AnyRef[], more: boolean): boolean => {\n if (room === null) return true;\n let need = Math.max(0, shown.length - 1) * room.gap + (more ? room.gap + room.more : 0);\n for (const ref of shown) need += room.tabs.get(ref.id) ?? 0;\n // No slack beyond float noise: a row the rail accepts must not overflow,\n // or its tabs squeeze and read differently the next pass.\n return need <= room.width + 0.01;\n };\n if (items.length <= max && fits(items, false)) return items;\n const current = items.find(ref => this.isCurrent(ref));\n const first = (count: number): AnyRef[] => {\n const shown = items.slice(0, count);\n if (current && !shown.includes(current)) shown[count - 1] = current;\n return shown;\n };\n for (let count = Math.min(max, items.length - 1); count > 1; count--) {\n const shown = first(count);\n if (fits(shown, true)) return shown;\n }\n return first(1);\n });\n\n /** @internal — each listed window's place among the drawn tabs, absent while it is folded. */\n protected readonly slots = computed(() => new Map(this.visible().map((ref, index) => [ref, index])));\n\n /** @internal — the windows under the \"+N\" button, in opening order. */\n protected readonly folded = computed(() => {\n const visible = this.visible();\n return this.items().filter(ref => !visible.includes(ref));\n });\n\n /** The \"+N\" menu opens away from the edge the rail is pinned to. */\n protected readonly menuPosition = computed(() => (this.position() === 'top' ? 'bottom-end' : 'top-end'));\n\n protected readonly classes = computed(() => `wr-window-taskbar--${this.position()}`);\n\n /**\n * One row per entry of `items()`, in the same order. A folded window keeps its\n * tab, laid out but hidden, which is how the rail knows its width.\n */\n private readonly tabs = viewChildren<ElementRef<HTMLElement>>('tab');\n private readonly more = viewChild<ElementRef<HTMLButtonElement>>('more');\n\n /**\n * The rail's one Tab stop, as an index into its buttons: two per drawn tab,\n * restore then close, and the \"+N\" button last.\n */\n private readonly rovingIndex = signal(0);\n private readonly stop = computed(() => {\n const buttons = this.visible().length * 2 + (this.folded().length > 0 ? 1 : 0);\n return Math.max(0, Math.min(this.rovingIndex(), buttons - 1));\n });\n\n /** The strip of the viewport the rail covers while it shows tabs. */\n private readonly reserve = signal<{ readonly top: number; readonly bottom: number }>(NO_RESERVE, {\n equal: (a, b) => a.top === b.top && a.bottom === b.bottom,\n });\n\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('window');\n // So a window minimized with focus inside can hand it to its tab here, a\n // window closed from its tab knows the focus there was its own, and a\n // maximized window stops short of the rail.\n const unregister = this.manager._registerTaskbar({\n // A folded window's place in the rail is the \"+N\" button it sits under.\n tabFor: ref => {\n if (this.folded().includes(ref)) return this.more()?.nativeElement ?? null;\n const index = this.items().indexOf(ref);\n return index >= 0 ? (this.tabs()[index]?.nativeElement ?? null) : null;\n },\n settling: ref => {\n const room = this.room();\n const index = this.items().indexOf(ref);\n if (room === null || index < 0) return false;\n if (!room.tabs.has(ref.id)) return true;\n if (this.folded().includes(ref)) return !this.more();\n return !!this.tabs()[index]?.nativeElement.classList.contains('wr-window-taskbar__tab--folded');\n },\n contains: node => this.host.contains(node),\n reserve: this.reserve.asReadonly(),\n });\n const destroyRef = inject(DestroyRef);\n destroyRef.onDestroy(unregister);\n\n // After the render that adds or removes the rail or a tab, retitles a tab\n // or moves the rail to the other edge — and again whenever the host, the\n // rail or the viewport changes size, which is also how a late web font\n // reaches the widths.\n let observer: ResizeObserver | null = null;\n let observedRail: HTMLElement | null = null;\n afterRenderEffect(() => {\n for (const ref of this.items()) this.tabTitle(ref);\n void this.folded().length;\n this.position();\n const rail = this.host.querySelector<HTMLElement>('.wr-window-taskbar__rail');\n if (observer && rail !== observedRail) {\n if (observedRail) observer.unobserve(observedRail);\n if (rail) observer.observe(rail);\n }\n observedRail = rail;\n this.measure();\n });\n afterNextRender(() => {\n const measure = (): void => this.measure();\n observer = typeof ResizeObserver === 'undefined' ? null : new ResizeObserver(measure);\n observer?.observe(this.host);\n if (observedRail) observer?.observe(observedRail);\n window.addEventListener('resize', measure, { passive: true });\n destroyRef.onDestroy(() => {\n observer?.disconnect();\n window.removeEventListener('resize', measure);\n });\n });\n }\n\n /** A window with no title still needs a name in the rail. */\n protected tabTitle(ref: AnyRef): string {\n return ref.title() || this.untitled();\n }\n\n /** Whether `ref` is the active window and on screen — what `show=\"all\"` marks. */\n protected isCurrent(ref: AnyRef): boolean {\n return ref.isActive() && ref.state() !== 'minimized';\n }\n\n /** A minimized window's tab restores it; in `show=\"all\"` the others' tabs switch to their window. */\n protected tabLabel(ref: AnyRef): string {\n const title = this.tabTitle(ref);\n return this.show() === 'all' && ref.state() !== 'minimized' ? title : this.restoreLabel({ title });\n }\n\n protected tabIndex(button: number): number {\n return button >= 0 && button === this.stop() ? 0 : -1;\n }\n\n protected press(ref: AnyRef): void {\n // The active window's own tab minimizes it, as on every desktop taskbar.\n // Focus is on this tab, not in the window, so it stays here.\n if (this.show() === 'all' && this.isCurrent(ref)) {\n ref.minimize();\n return;\n }\n // Back from the taskbar in the state it was minimized from, raised, and\n // focused on the control it had last — the tab this was pressed on may be\n // about to leave the rail, which would drop focus on `<body>`.\n ref.activate();\n }\n\n /** A window picked from the \"+N\" menu: the menu closes and the window comes forward, as from its tab. */\n protected pick(ref: AnyRef, menu: WrDropdown): void {\n menu.close();\n this.press(ref);\n }\n\n protected close(ref: AnyRef, event: Event): void {\n event.stopPropagation();\n void ref.close();\n }\n\n /** The toolbar pattern: arrows between buttons, Home and End to the ends, mirrored in RTL. */\n protected onKeydown(event: KeyboardEvent): void {\n const buttons = this.buttons();\n if (buttons.length === 0) return;\n const current = buttons.indexOf(event.target as HTMLButtonElement);\n if (current < 0) return;\n const rtl = this.dir?.value === 'rtl';\n let next: number;\n switch (event.key) {\n case 'ArrowRight':\n next = current + (rtl ? -1 : 1);\n break;\n case 'ArrowLeft':\n next = current + (rtl ? 1 : -1);\n break;\n case 'Home':\n next = 0;\n break;\n case 'End':\n next = buttons.length - 1;\n break;\n default:\n return;\n }\n event.preventDefault();\n next = (next + buttons.length) % buttons.length;\n this.rovingIndex.set(next);\n buttons[next].focus();\n }\n\n /** A click or a script that focuses a button moves the Tab stop with it. */\n protected onFocusIn(event: FocusEvent): void {\n const index = this.buttons().indexOf(event.target as HTMLButtonElement);\n if (index >= 0) this.rovingIndex.set(index);\n }\n\n /** The drawn buttons in order — a folded tab's are hidden and out of the toolbar. */\n private buttons(): HTMLButtonElement[] {\n return [\n ...this.host.querySelectorAll<HTMLButtonElement>(\n '.wr-window-taskbar__tab:not(.wr-window-taskbar__tab--folded) button, .wr-window-taskbar__more'\n ),\n ];\n }\n\n private measure(): void {\n if (typeof window === 'undefined') return;\n this.measureRoom();\n const rect = this.host.getBoundingClientRect();\n if (rect.height <= 0) {\n this.reserve.set(NO_RESERVE);\n return;\n }\n const vh = document.documentElement.clientHeight || window.innerHeight;\n this.reserve.set(\n this.position() === 'top'\n ? { top: Math.ceil(rect.bottom), bottom: 0 }\n : { top: 0, bottom: Math.max(0, Math.ceil(vh - rect.top)) }\n );\n }\n\n /**\n * Read what the rail has to fit into. The host spans the viewport between its\n * insets, so its width is the most the rail can take, and the gap comes from\n * the stylesheet, so a consumer's hook is what the arithmetic uses.\n *\n * A tab's width is the one its title asks for, capped by its `max-width`. Every\n * tab is laid out, a folded one too, so each can be read — and a tab drawn\n * narrower than its title, squeezed as the only one left, is as wide as it is\n * plus the part of the title it clips. That keeps the reading the same however\n * the row is drawn, so a pass never feeds the next one a different answer.\n *\n * The \"+N\" button is measured once it is drawn — until then a tab's height\n * stands in for its width, and the next pass corrects it. That converges: a\n * wider button folds more, which can only keep its count's digits or add one.\n */\n private measureRoom(): void {\n const rail = this.host.querySelector<HTMLElement>('.wr-window-taskbar__rail');\n const items = this.items();\n const tabs = this.tabs().map(tab => tab.nativeElement);\n const width = this.host.clientWidth;\n if (!rail || tabs.length === 0 || width <= 0) {\n this.room.set(null);\n return;\n }\n // A render is on its way that will draw the tabs `items()` lists; measure that one.\n if (tabs.length !== items.length) return;\n const railStyle = getComputedStyle(rail);\n const px = (value: string): number => parseFloat(value) || 0;\n const inner =\n width -\n px(railStyle.paddingInlineStart) -\n px(railStyle.paddingInlineEnd) -\n px(railStyle.borderInlineStartWidth) -\n px(railStyle.borderInlineEndWidth);\n const widths = new Map<string, number>();\n tabs.forEach((tab, index) => {\n const width = tab.getBoundingClientRect().width;\n const cap = getComputedStyle(tab).maxWidth;\n // A cap that depends on the box it sits in — a percentage, a calc() with\n // one — resolves against the rail for a drawn tab and the host for a folded\n // one, so there is no width of the tab's own to recover: take it as drawn.\n const fixed = cap.endsWith('px');\n if (!fixed && cap !== 'none' && cap !== '') {\n widths.set(items[index].id, width);\n return;\n }\n // Scroll and client widths are whole pixels, so a clip of one is rounding,\n // not a title the tab is too narrow for.\n const title = tab.querySelector<HTMLElement>('.wr-window-taskbar__tab-title');\n const clipped = title ? title.scrollWidth - title.clientWidth : 0;\n const natural = width + (clipped > 1 ? clipped : 0);\n widths.set(items[index].id, fixed ? Math.min(natural, parseFloat(cap)) : natural);\n });\n const more = this.more()?.nativeElement.getBoundingClientRect().width ?? tabs[0].getBoundingClientRect().height;\n this.room.set({ width: inner, gap: px(railStyle.columnGap), more, tabs: widths });\n }\n}\n","@if (items().length > 0) {\n <div class=\"wr-window-taskbar__rail\">\n @for (ref of items(); track ref.id) {\n @let slot = slots().get(ref) ?? -1;\n <!--\n Two SIBLING buttons in a plain container, not a close button nested\n inside the tab. The close used to be a `role=\"button\"` span with\n `tabindex=\"0\"` inside the tab's own `<button>` — interactive content\n inside interactive content, which the HTML parser and `nested-interactive`\n both object to. Nothing caught it: a taskbar tab exists only while a\n window is minimized, and the a11y sweep reads prerendered HTML, where the\n rail is not rendered at all.\n -->\n <!--\n A folded window keeps its tab, hidden and out of the row but laid out,\n so the rail can read the width it would take to draw it again.\n -->\n <div\n #tab\n class=\"wr-window-taskbar__tab\"\n [class.wr-window-taskbar__tab--active]=\"isCurrent(ref)\"\n [class.wr-window-taskbar__tab--minimized]=\"ref.state() === 'minimized'\"\n [class.wr-window-taskbar__tab--folded]=\"slot < 0\"\n [attr.inert]=\"slot < 0 ? '' : null\"\n >\n <button\n type=\"button\"\n class=\"wr-window-taskbar__tab-restore\"\n [attr.aria-label]=\"tabLabel(ref)\"\n [attr.aria-pressed]=\"show() === 'all' ? isCurrent(ref) : null\"\n [attr.tabindex]=\"tabIndex(slot < 0 ? -1 : slot * 2)\"\n (click)=\"press(ref)\"\n >\n <span class=\"wr-window-taskbar__tab-title\">{{ tabTitle(ref) }}</span>\n </button>\n <button\n type=\"button\"\n class=\"wr-window-taskbar__tab-close\"\n [attr.aria-label]=\"closeLabel()\"\n [attr.tabindex]=\"tabIndex(slot < 0 ? -1 : slot * 2 + 1)\"\n (click)=\"close(ref, $event)\"\n >\n <svg width=\"9\" height=\"9\" viewBox=\"0 0 10 10\" aria-hidden=\"true\">\n <path d=\"M1 1 L9 9 M9 1 L1 9\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" />\n </svg>\n </button>\n </div>\n }\n @if (folded().length > 0) {\n <button\n #more\n #fold=\"wrDropdown\"\n type=\"button\"\n class=\"wr-window-taskbar__more\"\n [wrDropdown]=\"foldMenu\"\n [position]=\"menuPosition()\"\n [attr.aria-label]=\"moreLabel({ count: folded().length })\"\n [attr.tabindex]=\"tabIndex(visible().length * 2)\"\n >\n +{{ folded().length }}\n </button>\n <wr-dropdown-menu #foldMenu>\n @for (ref of folded(); track ref.id) {\n <wr-dropdown-item\n class=\"wr-window-taskbar__fold-item\"\n [class.wr-window-taskbar__fold-item--minimized]=\"ref.state() === 'minimized'\"\n [attr.aria-label]=\"tabLabel(ref)\"\n (click)=\"pick(ref, fold)\"\n >\n {{ tabTitle(ref) }}\n </wr-dropdown-item>\n }\n </wr-dropdown-menu>\n }\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 { type WrFeature, wrFeature } from 'ngwr/utils';\n\nimport { WR_WINDOW_DEFAULTS } from './tokens';\nimport type { WrWindowDefaults } from './types';\n\n/**\n * App-wide window defaults, as a feature of `provideWr()` — today the work area\n * every window keeps inside, so maximized windows stop short of an app header.\n * A window's own `WrWindowConfig.bounds` still wins.\n *\n * Bootstrap only: `WrWindowManager` is root-provided and reads it once, from\n * the root injector, so in a route's `providers` it changes nothing.\n *\n * @example\n * ```ts\n * import { provideWr } from 'ngwr';\n * import { withWindows } from 'ngwr/window';\n *\n * bootstrapApplication(App, {\n * providers: [provideWr(withWindows({ bounds: { top: 64 } }))],\n * });\n * ```\n */\nexport function withWindows(defaults: WrWindowDefaults): WrFeature<'windows'> {\n return wrFeature('windows', [{ provide: WR_WINDOW_DEFAULTS, useValue: defaults }]);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAaA,MAAa,gBAAgB,IAAI,eAA8C,eAAe;AAG9F,MAAa,iBAAiB,IAAI,eAAwB,gBAAgB;AAG1E,MAAa,qBAAqB,IAAI,eAAiC,oBAAoB;AChB3F,SAAgB,WAAW,KAA0B;CAEnD,OAAO,aADQ,IAAI,SAAS,GAAG,IAAI,OAAM,KAAM,KAClB,IAAI;AACnC;;;;;;;ACkCA,MAAMA,gBAAc,OAAsB,IAAI,CAAC,CAAC,WAAU;AAS1D,SAAS,WAAQ;CACf,IAAI,OAAO,WAAW,eAAe,OAAO,cAAc,aAAa,OAAO;CAM9E,MAAM,YAAY;EAJF,UAAmE,eAGvD;EAAU,UAAU;EAAU,UAAU;CAClD,CAAA,CAAW,MAAK,MAAK,CAAC,CAAC,CAAC,KAAK,GAAA,CAAI,YAAW;CAC9D,IACE,SAAS,SAAS,KAAK,KACvB,SAAS,SAAS,QAAQ,KAC1B,SAAS,SAAS,QAAQ,KAC1B,SAAS,SAAS,MAAM,GAExB,OAAO;CAET,IAAI,SAAS,SAAS,OAAO,KAAK,SAAS,SAAS,KAAK,KAAK,SAAS,SAAS,MAAM,GAAG,OAAO;CAChG,OAAO;AACT;AAEA,MAAM,cAAc,SAAQ;AAG5B,MAAM,gBAAgB;AAGtB,MAAM,iBAAiB;AAMvB,MAAM,cACJ;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F"}
1
+ {"version":3,"file":"ngwr-window.mjs","names":["NO_OVERRIDE","NO_RESERVE"],"sources":["../../../projects/lib/window/tokens.ts","../../../projects/lib/window/storage-key.ts","../../../projects/lib/window/window.ts","../../../projects/lib/window/window.html","../../../projects/lib/window/window-container.ts","../../../projects/lib/window/window-container.html","../../../projects/lib/window/window-model.ts","../../../projects/lib/window/window-ref.ts","../../../projects/lib/window/services/window-manager.ts","../../../projects/lib/window/window-taskbar.ts","../../../projects/lib/window/window-taskbar.html","../../../projects/lib/window/with-windows.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 { WrWindowDefaults } from './types';\nimport type { WrWindowRef } from './window-ref';\n\n/** Resolves to the active `WrWindowRef` inside a programmatically-opened window's content tree. */\nexport const WR_WINDOW_REF = new InjectionToken<WrWindowRef<unknown, unknown>>('WR_WINDOW_REF');\n\n/** Resolves to the `data` passed in `WrWindowConfig.data`. */\nexport const WR_WINDOW_DATA = new InjectionToken<unknown>('WR_WINDOW_DATA');\n\n/** What `withWindows()` provides. @internal */\nexport const WR_WINDOW_DEFAULTS = new InjectionToken<WrWindowDefaults>('WR_WINDOW_DEFAULTS');\n","import type { WrWindowStorageConfig } from './types';\n\n/** Namespaced localStorage key for a persisted window / workspace. */\nexport function storageKey(cfg: WrWindowStorageConfig): string {\n const prefix = cfg.prefix ? `${cfg.prefix}:` : '';\n return `wr:window:${prefix}${cfg.key}`;\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 { FocusTrapFactory } from '@angular/cdk/a11y';\nimport { Directionality } from '@angular/cdk/bidi';\nimport type { ComponentType } from '@angular/cdk/portal';\nimport { NgComponentOutlet, NgTemplateOutlet } from '@angular/common';\nimport {\n Component,\n DestroyRef,\n ElementRef,\n type Injector,\n type OnInit,\n TemplateRef,\n ViewEncapsulation,\n computed,\n inject,\n input,\n output,\n signal,\n} from '@angular/core';\n\nimport { useI18nFormatter, useI18nText } from 'ngwr/i18n';\nimport { wrRandomId, wrCheckStyles } from 'ngwr/utils';\n\nimport { WrWindowManager } from './services/window-manager';\nimport type { WrWindowResolvedOs, WrWindowSlotContent, WrWindowSlotContext, WrWindowSnapTarget } from './types';\nimport type { WrWindowKeyboardMode, WrWindowModel } from './window-model';\nimport type { WrWindowRef } from './window-ref';\n\n/**\n * Stands in for the consumer input `useI18nText` expects. The chrome buttons take no\n * label input — they are icon-only OS affordances — but their names still have to\n * come from the catalog rather than from the template, which is where they used to\n * live as English literals.\n */\nconst NO_OVERRIDE = signal<string | null>(null).asReadonly();\n\n/**\n * Best-effort OS detection — runs once at module load. Looks at the\n * new `navigator.userAgentData.platform` first (Chromium, no UA\n * sniffing required), falls back to `navigator.platform` /\n * `navigator.userAgent`. SSR-safe — returns `'windows'` when there's\n * no `window`.\n */\nfunction detectOs(): WrWindowResolvedOs {\n if (typeof window === 'undefined' || typeof navigator === 'undefined') return 'windows';\n\n const uaData = (navigator as unknown as { userAgentData?: { platform?: string } }).userAgentData;\n // First non-empty source — `??` alone would keep an empty platform\n // string and skip the user-agent fallback.\n const candidates = [uaData?.platform, navigator.platform, navigator.userAgent];\n const platform = (candidates.find(v => !!v) ?? '').toLowerCase();\n if (\n platform.includes('mac') ||\n platform.includes('darwin') ||\n platform.includes('iphone') ||\n platform.includes('ipad')\n ) {\n return 'macos';\n }\n if (platform.includes('linux') || platform.includes('x11') || platform.includes('cros')) return 'linux';\n return 'windows';\n}\n\nconst DETECTED_OS = detectOs();\n\n/** How close to an edge of the work area the pointer has to be to snap there. */\nconst SNAP_HOT_ZONE = 12;\n\n/** How far a drag on a maximized or snapped window travels before the window restores under it. */\nconst DRAG_THRESHOLD = 4;\n\n/**\n * What never starts a drag, even inside a `dragHandle`: a press on a control is\n * for the control. Checked only up to the window's own element.\n */\nconst INTERACTIVE =\n 'button, input, select, textarea, a[href], label, [contenteditable]:not([contenteditable=\"false\"]), ' +\n '[role=\"button\"], [role=\"link\"], [role=\"checkbox\"], [role=\"switch\"], [role=\"radio\"], [role=\"slider\"], ' +\n '[role=\"spinbutton\"], [role=\"textbox\"], [role=\"combobox\"], [role=\"tab\"], [role=\"menuitem\"], [role=\"option\"]';\n\ninterface Edges {\n readonly t?: boolean;\n readonly r?: boolean;\n readonly b?: boolean;\n readonly l?: boolean;\n}\n\nfunction asTemplate(content: WrWindowSlotContent | null): TemplateRef<WrWindowSlotContext> | null {\n return content instanceof TemplateRef ? content : null;\n}\n\nfunction asComponent(content: WrWindowSlotContent | null): ComponentType<unknown> | null {\n return content && !(content instanceof TemplateRef) ? content : null;\n}\n\n/**\n * Internal rendering primitive for a single floating window.\n *\n * Not part of the public API — windows are opened through\n * `WrWindowManager.open(Component, config)`, which creates the window's\n * `WrWindowModel` and portals this component to draw it. Every state and\n * geometry change goes through the model; this component turns pointer and\n * key events into calls on it and owns the DOM-only parts: focus and the live\n * region.\n *\n * @internal\n */\n@Component({\n selector: 'wr-window',\n templateUrl: './window.html',\n encapsulation: ViewEncapsulation.None,\n imports: [NgTemplateOutlet, NgComponentOutlet],\n host: {\n role: 'dialog',\n // Focusable by script, never by Tab: it is where focus lands when the\n // window opens with no control in its body, and it is what a click on the\n // window's own surface focuses, so the window the user is in is the one\n // `WrWindowManager` hands Escape to.\n tabindex: '-1',\n class: 'wr-window',\n '[class]': 'classes()',\n '[style.left.px]': 'rect().left',\n '[style.top.px]': 'rect().top',\n '[style.width.px]': 'rect().width',\n '[style.height.px]': 'rect().height',\n '[style.z-index]': 'model().z()',\n '[attr.aria-labelledby]': 'titleId',\n '(pointerdown)': 'onPointerDown($event)',\n '(dblclick)': 'onBodyDblClick($event)',\n '(keydown)': 'onKeydown($event)',\n '(focusin)': 'onFocusIn($event)',\n '(focusout)': 'onFocusOut($event)',\n },\n})\nexport class WrWindow implements OnInit {\n /** The window's state and geometry. */\n readonly model = input.required<WrWindowModel>();\n /** The ref, handed to slot templates as `$implicit` and to the manager on activation. */\n readonly windowRef = input<WrWindowRef<unknown, unknown> | null>(null);\n /** The window's injector — what a slot component resolves `WR_WINDOW_REF` from. */\n readonly injector = input<Injector | undefined>(undefined);\n /** Content for the title bar, between the title and the buttons. */\n readonly titleExtra = input<WrWindowSlotContent | null>(null);\n /** Content for the status bar. */\n readonly statusBar = input<WrWindowSlotContent | null>(null);\n\n /**\n * A REQUEST to close, not the close itself. `WrWindowContainer` binds\n * `(closed)` to `WrWindowRef.close()`, which awaits the `beforeClose` hook and\n * — only if the hook agrees — disposes the overlay, so the owner is what takes\n * the window away and this component never has to hide itself.\n */\n readonly closed = output<void>();\n\n /** Auto-generated id for the title element, referenced by `aria-labelledby`. */\n protected readonly titleId = wrRandomId('wr-window-title');\n\n // `window.close` had been sitting in both catalogs unread while the template\n // hard-coded the same English beside it; the other four had no key at all, so a\n // Russian app announced four of its five window buttons in English.\n protected readonly closeLabel = useI18nText(NO_OVERRIDE, 'window.close', 'Close');\n private readonly minimizeLabel = useI18nText(NO_OVERRIDE, 'window.minimize', 'Minimize');\n private readonly maximizeLabel = useI18nText(NO_OVERRIDE, 'window.maximize', 'Maximize');\n private readonly restoreLabel = useI18nText(NO_OVERRIDE, 'window.restore', 'Restore');\n private readonly restoreDownLabel = useI18nText(NO_OVERRIDE, 'window.restoreDown', 'Restore down');\n // The taskbar has named an untitled window this way since v13; the window\n // itself announced an empty name — `aria-labelledby` pointing at nothing.\n private readonly untitled = useI18nText(NO_OVERRIDE, 'window.untitled', 'Untitled');\n private readonly moveModeText = useI18nText(\n NO_OVERRIDE,\n 'window.moveMode',\n 'Moving the window. Use the arrow keys, Enter to finish, Escape to cancel.'\n );\n private readonly resizeModeText = useI18nText(\n NO_OVERRIDE,\n 'window.resizeMode',\n 'Resizing the window. Use the arrow keys, Enter to finish, Escape to cancel.'\n );\n private readonly movedText = useI18nFormatter('window.moved', 'Window moved to {{x}}, {{y}}');\n private readonly resizedText = useI18nFormatter('window.resized', 'Window resized to {{width}} by {{height}}');\n\n private readonly manager = inject(WrWindowManager);\n private readonly elRef = inject<ElementRef<HTMLElement>>(ElementRef);\n private readonly focusTraps = inject(FocusTrapFactory);\n private readonly dir = inject(Directionality, { optional: true });\n\n /** Ends the pointer move in progress, if any: its listeners are on the document. */\n private endMove: (() => void) | null = null;\n\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('window');\n // A window closed in the middle of a drag (a shortcut, the app) must not\n // leave its listeners on the document, writing to a model nobody draws.\n inject(DestroyRef).onDestroy(() => this.endMove?.());\n }\n\n /** What the live region says: written by the keyboard modes only. */\n protected readonly announcement = signal('');\n\n /** The control focus was on last, so switching back to the window lands there. */\n private lastFocused: HTMLElement | null = null;\n\n protected readonly state = computed(() => this.model().state());\n protected readonly rect = computed(() => this.model().rect());\n private readonly options = computed(() => this.model().options());\n\n protected readonly displayTitle = computed(() => this.model().title() || this.untitled());\n\n /** Resolved OS — `auto` → detected platform. */\n readonly resolvedOs = computed<WrWindowResolvedOs>(() => {\n const os = this.options().os;\n return os === 'auto' ? DETECTED_OS : os;\n });\n\n /**\n * Whether each control is rendered: the option wins, the chrome decides the\n * default. Linux is close-only unless asked otherwise. Minimize does NOT hang\n * on a `<wr-window-taskbar>` being on the page: an app may list minimized\n * windows in a dock of its own from `WrWindowManager.minimized()`, and the\n * macOS chrome never drops a light.\n */\n protected readonly minimizeVisible = computed(() => this.options().showMinimize ?? this.resolvedOs() !== 'linux');\n protected readonly maximizeVisible = computed(() => this.options().showMaximize ?? this.resolvedOs() !== 'linux');\n protected readonly showClose = computed(() => this.options().showClose);\n\n /**\n * How many caption buttons are drawn. The macOS chrome centres its title on\n * the whole bar by padding it as wide as the cluster on the other side, and a\n * window without one of the lights has a narrower cluster.\n */\n protected readonly actionCount = computed(\n () => Number(this.minimizeVisible()) + Number(this.maximizeVisible()) + Number(this.showClose())\n );\n\n /** The minimize button doubles as restore, and says which it is. */\n protected readonly minimizeActionLabel = computed(() =>\n this.state() === 'minimized' ? this.restoreLabel() : this.minimizeLabel()\n );\n\n /** Same for maximize, whose restore has its own wording. */\n protected readonly maximizeActionLabel = computed(() =>\n this.state() === 'maximized' ? this.restoreDownLabel() : this.maximizeLabel()\n );\n\n protected readonly resizeHandles = computed(() => this.options().resizable && this.state() === 'normal');\n\n protected readonly classes = computed(() => {\n const model = this.model();\n const parts = [\n `wr-window--${this.state()}`,\n `wr-window--os-${this.resolvedOs()}`,\n `wr-window--chrome-${this.options().chromeSize}`,\n model.isActive() ? 'wr-window--active' : 'wr-window--inactive',\n ];\n if (this.resizeHandles()) parts.push('wr-window--resizable');\n if (!this.options().animations) parts.push('wr-window--no-anim');\n const mode = model.keyboardMode();\n if (mode) parts.push(mode === 'move' ? 'wr-window--keyboard-moving' : 'wr-window--keyboard-resizing');\n return parts.join(' ');\n });\n\n protected readonly titleExtraTemplate = computed(() => asTemplate(this.titleExtra()));\n protected readonly titleExtraComponent = computed(() => asComponent(this.titleExtra()));\n protected readonly statusBarTemplate = computed(() => asTemplate(this.statusBar()));\n protected readonly statusBarComponent = computed(() => asComponent(this.statusBar()));\n protected readonly slotContext = computed<WrWindowSlotContext | null>(() => {\n const ref = this.windowRef();\n return ref ? { $implicit: ref } : null;\n });\n\n ngOnInit(): void {\n this.model().element = this.elRef.nativeElement;\n }\n\n // Chrome actions\n\n protected close(): void {\n this.closed.emit();\n }\n\n protected minimize(): void {\n this.model().minimize();\n }\n\n protected maximize(): void {\n this.model().maximize();\n }\n\n // Focus\n\n /**\n * Move focus into the window: to `[cdkFocusInitial]` or the first control in\n * its body — the CDK's rule, the one `WrDialog` and `WrDrawer` follow — else\n * to the window itself. The chrome buttons are not candidates: landing on\n * Close, the first of them on macOS, is the one place a window must not open\n * onto. Called after a render, by the container.\n *\n * @internal\n */\n focusInitial(): void {\n const host = this.elRef.nativeElement;\n if (!host.isConnected || this.state() === 'minimized') return;\n const body = host.querySelector<HTMLElement>('.wr-window__body');\n if (body) {\n // `deferAnchors`: no anchors go into the page, and nothing is trapped.\n const finder = this.focusTraps.create(body, true);\n const moved = finder.focusInitialElement({ preventScroll: true });\n finder.destroy();\n if (moved) return;\n }\n host.focus({ preventScroll: true });\n }\n\n /**\n * Move focus back to the control the window had last, the way a desktop\n * returns to a window — its first control when it never had one, or when that\n * one is gone or disabled.\n *\n * @internal\n */\n focusLast(): void {\n const host = this.elRef.nativeElement;\n if (!host.isConnected || this.state() === 'minimized') return;\n const last = this.lastFocused;\n if (last?.isConnected && host.contains(last)) {\n last.focus({ preventScroll: true });\n if (host.ownerDocument.activeElement === last) return;\n }\n this.focusInitial();\n }\n\n protected onFocusIn(event: FocusEvent): void {\n const target = event.target;\n if (!(target instanceof HTMLElement) || target === this.elRef.nativeElement) return;\n // Not the chrome buttons: a click on minimize focuses it, and coming back\n // from the taskbar onto the minimize button is not coming back to the window.\n if (target.closest('.wr-window__chrome-action')) return;\n this.lastFocused = target;\n }\n\n protected onFocusOut(event: FocusEvent): void {\n const next = event.relatedTarget;\n // Focus leaving the window ends keyboard move or resize where it is, the\n // same as Enter: a mode that outlived its focus would steal the arrow keys\n // the next time the user came back.\n if (this.model().keyboardMode() && !(next instanceof Node && this.elRef.nativeElement.contains(next))) {\n this.commitKeyboard();\n }\n }\n\n // Pointer\n\n /**\n * Every press inside the window activates it. A press on a grab area — the\n * title bar, or a `dragHandle` — also starts a move, and moves focus into the\n * window itself: the move's `preventDefault()` stops the browser doing it, and\n * left alone the window the user just clicked to the front was not the one\n * that had the keyboard, so Escape closed the window behind it.\n */\n protected onPointerDown(event: PointerEvent): void {\n const model = this.model();\n if (model.keyboardMode()) this.commitKeyboard();\n const target = event.target instanceof Element ? event.target : null;\n const primary = event.button === 0;\n const grab = primary && !!target && this.isGrabArea(target);\n // A minimized window is `display: none`, so a press cannot reach it in a\n // browser; a synthetic one must not bring it back either.\n if (model.state() === 'minimized') return;\n const ref = this.windowRef();\n if (ref) this.manager._activate(ref, { focus: grab });\n if (grab) this.startMove(event);\n }\n\n /** Whether a press on `target` should start a move. */\n private isGrabArea(target: Element): boolean {\n const host = this.elRef.nativeElement;\n if (target.closest('.wr-window__chrome-action, .wr-window__handle')) return false;\n const control = target.closest(INTERACTIVE);\n if (control && host.contains(control)) return false;\n const handle = this.options().dragHandle;\n if (handle) {\n const match = target.closest(handle);\n return !!match && host.contains(match);\n }\n return !!target.closest('.wr-window__chrome');\n }\n\n /**\n * Where a double-click toggles maximize: the title bar, whatever `dragHandle`\n * says — on every desktop the bar maximizes even where it does not drag — and\n * any other grab area. Never a control or a caption button.\n */\n private isDblClickArea(target: Element): boolean {\n const host = this.elRef.nativeElement;\n if (target.closest('.wr-window__chrome-action, .wr-window__handle')) return false;\n const control = target.closest(INTERACTIVE);\n if (control && host.contains(control)) return false;\n const chrome = target.closest('.wr-window__chrome');\n return (!!chrome && host.contains(chrome)) || this.isGrabArea(target);\n }\n\n /**\n * Move the window with the pointer. The listeners go on the DOCUMENT and\n * pointer capture is taken only once the press has travelled past the drag\n * threshold, and then on the element that was pressed, never on the window.\n * Chromium sends `click` and `dblclick` to the capturing element, so a\n * capture taken on the window at press time sent every click in the title\n * bar to the window instead: the double-click that maximizes stopped\n * working, and a clickable badge in `titleExtra` never heard its click. A\n * press that stays put now keeps both, and a real drag swallows the click it\n * would otherwise end in, so dragging by a badge does not also press it.\n */\n private startMove(event: PointerEvent): void {\n const model = this.model();\n const o = model.options();\n const state = model.state();\n if (!o.movable || state === 'minimized') return;\n if (state === 'maximized' && !o.restoreOnDrag) return;\n event.preventDefault();\n this.endMove?.();\n const host = this.elRef.nativeElement;\n const doc = host.ownerDocument;\n const pressed = event.target instanceof Element ? event.target : host;\n const pointerId = event.pointerId;\n\n const originX = event.clientX;\n const originY = event.clientY;\n const start = model.rect();\n // A maximized or snapped window does not move until the drag has gone\n // somewhere: a click or a double-click on its title bar must not restore it.\n let detached = state === 'normal' && !model.snap();\n if (!detached && !o.restoreOnDrag) {\n model.unsnapInPlace();\n detached = true;\n }\n let startX = model.x();\n let startY = model.y();\n /** Past the threshold: a drag rather than a click, from here on. */\n let dragging = false;\n\n const move = (e: PointerEvent): void => {\n if (e.pointerId !== pointerId) return;\n const dx = e.clientX - originX;\n const dy = e.clientY - originY;\n if (!dragging && Math.hypot(dx, dy) >= DRAG_THRESHOLD) {\n dragging = true;\n // Keeps the moves coming over an iframe in the body. Optional, since\n // jsdom implements no pointer capture, and guarded, since a synthetic\n // pointer the browser never saw is refused with a `NotFoundError`.\n try {\n pressed.setPointerCapture?.(pointerId);\n } catch {\n // The document listeners carry the drag without it.\n }\n }\n if (!detached) {\n if (!dragging) return;\n // Restore the window's own size under the pointer, keeping the grab\n // point at the same fraction of the bar — what Windows, macOS and GNOME\n // all do. The snapped or maximized size was never the window's own.\n const fraction = start.width > 0 ? (originX - start.left) / start.width : 0.5;\n model.restore();\n startX = originX - fraction * model.width();\n startY = start.top;\n detached = true;\n }\n model.setRaw({ x: startX + dx, y: startY + dy });\n model.clamp();\n model.dragTarget.set(this.detectSnapTarget(e.clientX, e.clientY));\n };\n const stop = (): void => {\n doc.removeEventListener('pointermove', move);\n doc.removeEventListener('pointerup', end);\n doc.removeEventListener('pointercancel', end);\n if (dragging && pressed.hasPointerCapture?.(pointerId)) pressed.releasePointerCapture?.(pointerId);\n model.dragTarget.set(null);\n this.endMove = null;\n };\n const end = (e: PointerEvent): void => {\n if (e.pointerId !== pointerId) return;\n const snap = model.dragTarget();\n stop();\n if (dragging) this.swallowClick(doc, pressed);\n if (!detached) return;\n if (snap) {\n model.snapTo(snap);\n if (snap !== 'top') model.resized.next({ width: model.rect().width, height: model.rect().height });\n }\n // `moved` is where the USER put the window, so a press that never moved\n // it — a click, either half of a double-click — says nothing.\n const r = model.rect();\n if (snap || r.left !== start.left || r.top !== start.top) model.moved.next({ x: r.left, y: r.top });\n };\n\n doc.addEventListener('pointermove', move);\n doc.addEventListener('pointerup', end);\n // `pointercancel` is never followed by a `pointerup` (a pen leaving range, a\n // long-press menu, an OS gesture taking over), so without this the move\n // listener outlived the drag: every later hover dragged the window. The\n // cancelled gesture's geometry is kept rather than rolled back.\n doc.addEventListener('pointercancel', end);\n this.endMove = stop;\n }\n\n /**\n * Eat the `click` a drag ends in. The browser dispatches it straight after the\n * `pointerup`, in the same task, at the element holding capture — the one the\n * drag started on — so the listener takes only a click there, and is taken\n * away at the next task rather than left to eat a real one.\n */\n private swallowClick(doc: Document, pressed: Element): void {\n const swallow = (e: Event): void => {\n if (e.target !== pressed) return;\n doc.removeEventListener('click', swallow, true);\n e.stopPropagation();\n e.preventDefault();\n };\n doc.addEventListener('click', swallow, true);\n setTimeout(() => doc.removeEventListener('click', swallow, true));\n }\n\n /** Map a pointer position to a snap target, honouring the `snap` option and the work area. */\n private detectSnapTarget(clientX: number, clientY: number): WrWindowSnapTarget | null {\n const model = this.model();\n const mode = model.options().snap;\n if (mode === 'none') return null;\n const wa = model.workArea();\n const nearLeft = clientX <= wa.left + SNAP_HOT_ZONE;\n const nearRight = clientX >= wa.left + wa.width - SNAP_HOT_ZONE;\n const nearTop = clientY <= wa.top + SNAP_HOT_ZONE;\n const nearBottom = clientY >= wa.top + wa.height - SNAP_HOT_ZONE;\n if (mode === 'all') {\n if (nearTop && nearLeft) return 'top-left';\n if (nearTop && nearRight) return 'top-right';\n if (nearBottom && nearLeft) return 'bottom-left';\n if (nearBottom && nearRight) return 'bottom-right';\n }\n if (nearTop) return 'top'; // top edge → maximise\n if (nearLeft) return 'left';\n if (nearRight) return 'right';\n return null;\n }\n\n /**\n * A double-click on the title bar maximizes, or restores a maximized or\n * snapped window. Bound on the bar itself rather than only on the host, so a\n * `dblclick` that does not bubble — which is what a harness dispatches — still\n * reaches it.\n *\n * The gate is `showMaximize !== false`, NOT `maximizeVisible()`, and the\n * difference is a window nobody can get out of: the Linux preset hides the\n * maximize BUTTON, but the gesture is how GNOME maximizes, and `maximized` is\n * reachable there with no button at all (a snap to the top edge,\n * `ref.maximize()`, a restored layout). An explicit `showMaximize: false`\n * still turns the gesture off everywhere.\n */\n protected onChromeDblClick(event: MouseEvent): void {\n this.toggleFromDblClick(event.target);\n }\n\n /**\n * The same gesture on a body `dragHandle`, which answers it the way the title\n * bar does. A double-click in the bar bubbles here too and is the bar's.\n */\n protected onBodyDblClick(event: MouseEvent): void {\n const target = event.target;\n if (target instanceof Element && target.closest('.wr-window__chrome')) return;\n this.toggleFromDblClick(target);\n }\n\n private toggleFromDblClick(target: EventTarget | null): void {\n // Double-clicking the maximize BUTTON is two clicks on it already; the\n // chrome toggling a third time left the window maximized. A button in\n // `titleExtra` is the same: two presses of it, not a gesture on the bar.\n if (!(target instanceof Element) || !this.isDblClickArea(target)) return;\n const model = this.model();\n if (model.state() === 'minimized') return;\n if (model.state() === 'normal' && model.snap()) {\n model.restore();\n return;\n }\n if (model.options().showMaximize !== false) model.maximize();\n }\n\n protected startResize(event: PointerEvent, edges: Edges): void {\n const model = this.model();\n if (!model.options().resizable || model.state() !== 'normal') return;\n event.preventDefault();\n event.stopPropagation();\n if (model.keyboardMode()) this.commitKeyboard();\n const ref = this.windowRef();\n if (ref) this.manager._activate(ref, { focus: true });\n model.unsnapInPlace();\n const target = event.currentTarget as HTMLElement;\n target.setPointerCapture?.(event.pointerId);\n\n const startX = model.x();\n const startY = model.y();\n const startW = model.width();\n const startH = model.height();\n const originX = event.clientX;\n const originY = event.clientY;\n\n const move = (e: PointerEvent): void => {\n const o = model.options();\n const dx = e.clientX - originX;\n const dy = e.clientY - originY;\n\n let nextX = startX;\n let nextY = startY;\n let nextW = startW;\n let nextH = startH;\n\n if (edges.r) nextW = startW + dx;\n if (edges.b) nextH = startH + dy;\n if (edges.l) {\n nextW = startW - dx;\n nextX = startX + dx;\n }\n if (edges.t) {\n nextH = startH - dy;\n nextY = startY + dy;\n }\n\n // Enforce min/max — when shrinking from left/top we have to fix the position too.\n const clampedW = Math.min(o.maxWidth, Math.max(o.minWidth, nextW));\n const clampedH = Math.min(o.maxHeight, Math.max(o.minHeight, nextH));\n if (edges.l) nextX += nextW - clampedW;\n if (edges.t) nextY += nextH - clampedH;\n\n model.setRaw({ x: nextX, y: nextY, width: clampedW, height: clampedH });\n model.clamp();\n };\n const cleanup = (e: PointerEvent): void => {\n target.releasePointerCapture?.(e.pointerId);\n target.removeEventListener('pointermove', move);\n target.removeEventListener('pointerup', cleanup);\n target.removeEventListener('pointercancel', cleanup);\n model.resized.next({ width: model.width(), height: model.height() });\n };\n\n target.addEventListener('pointermove', move);\n target.addEventListener('pointerup', cleanup);\n // Same cancelled-gesture leak as `startMove` — a resize handle that is\n // still listening for `pointermove` resizes the window on a bare hover.\n target.addEventListener('pointercancel', cleanup);\n }\n\n // Bound resize handlers for the template — avoids inline object literals\n // re-creating on every change-detection tick.\n protected resizeTL = (e: PointerEvent): void => this.startResize(e, { t: true, l: true });\n protected resizeT = (e: PointerEvent): void => this.startResize(e, { t: true });\n protected resizeTR = (e: PointerEvent): void => this.startResize(e, { t: true, r: true });\n protected resizeR = (e: PointerEvent): void => this.startResize(e, { r: true });\n protected resizeBR = (e: PointerEvent): void => this.startResize(e, { b: true, r: true });\n protected resizeB = (e: PointerEvent): void => this.startResize(e, { b: true });\n protected resizeBL = (e: PointerEvent): void => this.startResize(e, { b: true, l: true });\n protected resizeL = (e: PointerEvent): void => this.startResize(e, { l: true });\n\n // Keyboard move and resize\n\n /**\n * Alt+F7 moves and Alt+F8 resizes — the keys Windows has used for both since\n * Windows 3, and what GNOME and KDE bind too. Move and resize used to be\n * drag-only, which is a WCAG 2.1.1 failure on its own.\n */\n protected onKeydown(event: KeyboardEvent): void {\n if (this.model().keyboardMode()) {\n this.onModeKey(event);\n return;\n }\n if (event.defaultPrevented || !event.altKey || event.ctrlKey || event.metaKey || event.shiftKey) return;\n if (event.key !== 'F7' && event.key !== 'F8') return;\n if (this.startKeyboard(event.key === 'F7' ? 'move' : 'resize')) event.preventDefault();\n }\n\n /**\n * Enter keyboard move or resize, with focus in the window so the keys arrive.\n * Returns `false` when the window may not be moved or resized.\n *\n * @internal\n */\n startKeyboard(mode: WrWindowKeyboardMode): boolean {\n const model = this.model();\n const ref = this.windowRef();\n if (ref) this.manager._activate(ref, { focus: false });\n if (!model.startKeyboard(mode)) return false;\n // Onto the window itself for the length of the mode, the way a desktop\n // does it: left on a button in the body, the Enter that ends the mode\n // pressed the button as well — and \"Close\" closed the window.\n this.elRef.nativeElement.focus({ preventScroll: true });\n this.announce(mode === 'move' ? this.moveModeText() : this.resizeModeText());\n return true;\n }\n\n private onModeKey(event: KeyboardEvent): void {\n const model = this.model();\n const step = event.shiftKey ? 1 : model.options().keyboardStep;\n const arrows: Record<string, readonly [number, number]> = {\n ArrowLeft: [-step, 0],\n ArrowRight: [step, 0],\n ArrowUp: [0, -step],\n ArrowDown: [0, step],\n };\n const delta = arrows[event.key];\n if (delta) {\n event.preventDefault();\n if (model.keyboardMode() === 'move') {\n model.nudge(delta[0], delta[1]);\n } else {\n // The inline end edge moves: in a right-to-left page that is the left\n // one, so the arrow pointing away from the window still grows it.\n const rtl = this.dir?.value === 'rtl';\n model.grow(rtl ? -delta[0] : delta[0], delta[1], rtl);\n }\n return;\n }\n if (event.key === 'Enter') {\n event.preventDefault();\n this.commitKeyboard();\n this.focusLast();\n } else if (event.key === 'Escape') {\n // Claimed, so the manager's Escape does not close the window as well.\n event.preventDefault();\n const mode = model.cancelKeyboard();\n if (mode) this.announceGeometry(mode);\n this.focusLast();\n } else if (event.key === 'Tab') {\n this.commitKeyboard();\n }\n }\n\n /** Keep what the keyboard mode did, and say so. Focus is the caller's business. */\n private commitKeyboard(): void {\n const mode = this.model().commitKeyboard();\n if (mode) this.announceGeometry(mode);\n }\n\n private announceGeometry(mode: WrWindowKeyboardMode): void {\n const r = this.model().rect();\n this.announce(\n mode === 'move' ? this.movedText({ x: r.left, y: r.top }) : this.resizedText({ width: r.width, height: r.height })\n );\n }\n\n private announce(text: string): void {\n this.announcement.set(text);\n }\n}\n","<!--\n No pointerdown here: the host takes every press, so a `dragHandle` in the body\n can start a move as well as the title bar, and a press anywhere activates the\n window. The double-click is bound here and on the host; see `onChromeDblClick`.\n The action count is for the macOS chrome, which pads its title as wide as the\n cluster so the title centres on the whole bar.\n-->\n<div\n class=\"wr-window__chrome\"\n [style.--wr-window-chrome-action-count]=\"actionCount()\"\n (dblclick)=\"onChromeDblClick($event)\"\n>\n <div class=\"wr-window__title\" [attr.id]=\"titleId\">{{ displayTitle() }}</div>\n <div class=\"wr-window__title-extra\">\n @if (titleExtraTemplate(); as template) {\n <ng-container *ngTemplateOutlet=\"template; context: slotContext(); injector: injector()\" />\n } @else if (titleExtraComponent(); as component) {\n <ng-container *ngComponentOutlet=\"component; injector: injector()\" />\n }\n </div>\n\n <div class=\"wr-window__chrome-actions\">\n @if (resolvedOs() === 'macos') {\n <!--\n macOS traffic lights: close, minimize, zoom, in that order from the frame\n edge. The button is the hit target and the coloured dot is its\n `::before`, so the box can be big enough to press while the dot stays\n the platform's size. The glyphs sit on an 8px grid and appear only while\n the cluster is hovered or holds keyboard focus, as they do on macOS.\n Zoom draws the full-screen arrows of Big Sur and later: pointing out to\n maximize, pointing in to restore. Every straight edge of both sits on a\n whole pixel, so the filled triangles stay hard at 1x.\n -->\n @if (showClose()) {\n <button\n type=\"button\"\n class=\"wr-window__chrome-action wr-window__chrome-action--close\"\n [attr.aria-label]=\"closeLabel()\"\n (click)=\"close()\"\n >\n <svg class=\"wr-window__chrome-action-glyph\" width=\"8\" height=\"8\" viewBox=\"0 0 8 8\" aria-hidden=\"true\">\n <path d=\"M1.5 1.5l5 5m0-5l-5 5\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" />\n </svg>\n </button>\n }\n @if (minimizeVisible()) {\n <button\n type=\"button\"\n class=\"wr-window__chrome-action wr-window__chrome-action--minimize\"\n [attr.aria-label]=\"minimizeActionLabel()\"\n (click)=\"minimize()\"\n >\n <svg class=\"wr-window__chrome-action-glyph\" width=\"8\" height=\"8\" viewBox=\"0 0 8 8\" aria-hidden=\"true\">\n <path d=\"M1.5 3.5h5\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" />\n </svg>\n </button>\n }\n @if (maximizeVisible()) {\n <button\n type=\"button\"\n class=\"wr-window__chrome-action wr-window__chrome-action--maximize\"\n [attr.aria-label]=\"maximizeActionLabel()\"\n (click)=\"maximize()\"\n >\n <svg class=\"wr-window__chrome-action-glyph\" width=\"8\" height=\"8\" viewBox=\"0 0 8 8\" aria-hidden=\"true\">\n @if (state() === 'maximized') {\n <path d=\"M3 3V.5L.5 3zM5 5v2.5L7.5 5z\" fill=\"currentColor\" />\n } @else {\n <path d=\"M1 1h4L1 5zm6 6H3l4-4z\" fill=\"currentColor\" />\n }\n </svg>\n </button>\n }\n } @else if (resolvedOs() === 'linux') {\n <!--\n GNOME (libadwaita) window controls: round buttons with Adwaita's 16px\n symbolic glyphs, 2px strokes on whole pixels. Restore is the SMALLER\n square, the way Adwaita draws it, not a second overlapping one. Close-only\n is the DEFAULT here, not a rule: `minimizeVisible()` resolves the input\n first, so `[showMinimize]=\"true\"` puts the button back, which is the only\n way a user on Linux can reach `<wr-window-taskbar>` at all.\n -->\n @if (minimizeVisible()) {\n <button\n type=\"button\"\n class=\"wr-window__chrome-action wr-window__chrome-action--minimize\"\n [attr.aria-label]=\"minimizeActionLabel()\"\n (click)=\"minimize()\"\n >\n <svg class=\"wr-window__chrome-action-glyph\" width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" aria-hidden=\"true\">\n <path d=\"M4 11h8\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" />\n </svg>\n </button>\n }\n @if (maximizeVisible()) {\n <button\n type=\"button\"\n class=\"wr-window__chrome-action wr-window__chrome-action--maximize\"\n [attr.aria-label]=\"maximizeActionLabel()\"\n (click)=\"maximize()\"\n >\n <svg class=\"wr-window__chrome-action-glyph\" width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" aria-hidden=\"true\">\n @if (state() === 'maximized') {\n <rect x=\"6\" y=\"6\" width=\"4\" height=\"4\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" />\n } @else {\n <rect x=\"5\" y=\"5\" width=\"6\" height=\"6\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" />\n }\n </svg>\n </button>\n }\n @if (showClose()) {\n <button\n type=\"button\"\n class=\"wr-window__chrome-action wr-window__chrome-action--close\"\n [attr.aria-label]=\"closeLabel()\"\n (click)=\"close()\"\n >\n <svg class=\"wr-window__chrome-action-glyph\" width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" aria-hidden=\"true\">\n <path d=\"M5 5l6 6m0-6l-6 6\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" />\n </svg>\n </button>\n }\n } @else {\n <!--\n Windows 11 caption buttons: 10px glyphs in the full-height, 46px-wide\n buttons, drawn the way Segoe Fluent Icons draws them. 1px strokes on half\n pixels, so they land on whole device pixels at 1x and 2x, and the corners\n of maximize and restore are rounded by 1px.\n -->\n @if (minimizeVisible()) {\n <button\n type=\"button\"\n class=\"wr-window__chrome-action wr-window__chrome-action--minimize\"\n [attr.aria-label]=\"minimizeActionLabel()\"\n (click)=\"minimize()\"\n >\n <svg class=\"wr-window__chrome-action-glyph\" width=\"10\" height=\"10\" viewBox=\"0 0 10 10\" aria-hidden=\"true\">\n <path d=\"M0 4.5h10\" fill=\"none\" stroke=\"currentColor\" />\n </svg>\n </button>\n }\n @if (maximizeVisible()) {\n <button\n type=\"button\"\n class=\"wr-window__chrome-action wr-window__chrome-action--maximize\"\n [attr.aria-label]=\"maximizeActionLabel()\"\n (click)=\"maximize()\"\n >\n <svg class=\"wr-window__chrome-action-glyph\" width=\"10\" height=\"10\" viewBox=\"0 0 10 10\" aria-hidden=\"true\">\n @if (state() === 'maximized') {\n <g fill=\"none\" stroke=\"currentColor\">\n <rect x=\".5\" y=\"2.5\" width=\"7\" height=\"7\" rx=\"1\" />\n <path d=\"M2.5 2.5v-1a1 1 0 0 1 1-1h5a1 1 0 0 1 1 1v5a1 1 0 0 1-1 1h-1\" />\n </g>\n } @else {\n <rect x=\".5\" y=\".5\" width=\"9\" height=\"9\" rx=\"1\" fill=\"none\" stroke=\"currentColor\" />\n }\n </svg>\n </button>\n }\n @if (showClose()) {\n <button\n type=\"button\"\n class=\"wr-window__chrome-action wr-window__chrome-action--close\"\n [attr.aria-label]=\"closeLabel()\"\n (click)=\"close()\"\n >\n <svg class=\"wr-window__chrome-action-glyph\" width=\"10\" height=\"10\" viewBox=\"0 0 10 10\" aria-hidden=\"true\">\n <path d=\"M.5.5l9 9m0-9l-9 9\" fill=\"none\" stroke=\"currentColor\" />\n </svg>\n </button>\n }\n }\n </div>\n</div>\n\n<div class=\"wr-window__body\">\n <ng-content />\n</div>\n\n<div class=\"wr-window__status-bar\">\n @if (statusBarTemplate(); as template) {\n <ng-container *ngTemplateOutlet=\"template; context: slotContext(); injector: injector()\" />\n } @else if (statusBarComponent(); as component) {\n <ng-container *ngComponentOutlet=\"component; injector: injector()\" />\n }\n</div>\n\n<!--\n Keyboard move and resize say what they did here: the mode on entry, the\n landing on Enter or Escape. Not each step — that would flood the region.\n-->\n<p class=\"wr-window__sr-only\" role=\"status\">{{ announcement() }}</p>\n\n@if (resizeHandles()) {\n <span class=\"wr-window__handle wr-window__handle--t\" (pointerdown)=\"resizeT($event)\"></span>\n <span class=\"wr-window__handle wr-window__handle--r\" (pointerdown)=\"resizeR($event)\"></span>\n <span class=\"wr-window__handle wr-window__handle--b\" (pointerdown)=\"resizeB($event)\"></span>\n <span class=\"wr-window__handle wr-window__handle--l\" (pointerdown)=\"resizeL($event)\"></span>\n <span class=\"wr-window__handle wr-window__handle--tl\" (pointerdown)=\"resizeTL($event)\"></span>\n <span class=\"wr-window__handle wr-window__handle--tr\" (pointerdown)=\"resizeTR($event)\"></span>\n <span class=\"wr-window__handle wr-window__handle--bl\" (pointerdown)=\"resizeBL($event)\"></span>\n <span class=\"wr-window__handle wr-window__handle--br\" (pointerdown)=\"resizeBR($event)\"></span>\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 ComponentType } from '@angular/cdk/portal';\nimport {\n ChangeDetectionStrategy,\n Component,\n DestroyRef,\n Injector,\n ViewContainerRef,\n ViewEncapsulation,\n afterNextRender,\n effect,\n inject,\n runInInjectionContext,\n untracked,\n viewChild,\n} from '@angular/core';\n\nimport { WrStorage } from 'ngwr/storage';\nimport { wrCheckStyles } from 'ngwr/utils';\n\nimport { WrWindowManager } from './services/window-manager';\nimport { storageKey } from './storage-key';\nimport type { WrWindowConfig } from './types';\nimport { WrWindow } from './window';\nimport type { WrWindowRef } from './window-ref';\n\n/** Coalesce live position/size writes — drag/resize fires every move. */\nconst PERSIST_DEBOUNCE_MS = 200;\n\n/** What `storage` keeps — the geometry the user chose, never what a state imposes. @internal */\nexport interface PersistedGeometry {\n readonly x?: number;\n readonly y?: number;\n readonly width?: number;\n readonly height?: number;\n}\n\n/**\n * Internal host attached by `WrWindowManager.open()`. Draws a `<wr-window>` for\n * the ref's model, creates the consumer's component inside its body, and wires\n * the DOM-only parts of the ref — focus and keyboard mode — once it is on the\n * page. State and geometry need no wiring: the ref reads the model directly.\n *\n * @internal\n */\n@Component({\n selector: 'wr-window-container',\n templateUrl: './window-container.html',\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n imports: [WrWindow],\n})\nexport class WrWindowContainer<C> {\n /** Set by the manager before view init. */\n config!: WrWindowConfig;\n /** Set by the manager before view init. */\n ref!: WrWindowRef<C, unknown>;\n /** Set by the manager before view init. */\n componentType!: ComponentType<C>;\n /** Custom injector with `WR_WINDOW_REF` / `WR_WINDOW_DATA` populated. */\n childInjector!: Injector;\n /** Set by the manager: move focus into the window once it has rendered. */\n autoFocus = true;\n\n private readonly hostInjector = inject(Injector);\n private readonly manager = inject(WrWindowManager);\n private readonly storage = inject(WrStorage);\n private readonly destroyRef = inject(DestroyRef);\n private persistTimer: ReturnType<typeof setTimeout> | null = null;\n\n private readonly contentVcr = viewChild.required('content', { read: ViewContainerRef });\n private readonly wrWindow = viewChild.required(WrWindow);\n\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('window');\n afterNextRender(() => this.attach());\n\n // Re-clamp when the WORK AREA changes — a resized viewport, a taskbar\n // appearing — and only then. It used to re-run on every geometry write,\n // repeating the clamp the drag handler had just done on each pointer move.\n effect(() => {\n const model = this.ref._model;\n model.workArea();\n untracked(() => model.clamp());\n });\n\n this.destroyRef.onDestroy(() => {\n if (this.persistTimer !== null) clearTimeout(this.persistTimer);\n });\n }\n\n private attach(): void {\n // 1. Create the consumer's component inside the body slot.\n const componentRef = this.contentVcr().createComponent(this.componentType, {\n injector: this.childInjector,\n });\n this.ref.componentRef = componentRef;\n\n // 2. The DOM-only bridges. After a render, not now: the consumer's\n // component was created a line above and has not drawn its template yet,\n // and a window coming back from the taskbar is still `display: none`\n // until its class updates.\n const w = this.wrWindow();\n const model = this.ref._model;\n this.ref._focusWindow = mode =>\n afterNextRender(\n () => {\n if (mode === 'initial') {\n w.focusInitial();\n return;\n }\n // Only for the window that is STILL the one switched to: two\n // activations in one tick each queue a focus, and the earlier one,\n // landing last, took the keyboard back from the window the user\n // actually ended on.\n if (this.manager.active() === (this.ref as WrWindowRef<unknown, unknown>)) w.focusLast();\n },\n { injector: this.hostInjector }\n );\n this.ref._startKeyboard = mode => {\n if (model.state() !== 'minimized') {\n w.startKeyboard(mode);\n return;\n }\n model.unminimize();\n afterNextRender(() => w.startKeyboard(mode), { injector: this.hostInjector });\n };\n model.onMinimizedWithFocus = () => this.onMinimizedWithFocus();\n // A ref outlives its window; a render hook must not be registered on an\n // injector that is gone.\n this.destroyRef.onDestroy(() => {\n this.ref._focusWindow = null;\n this.ref._startKeyboard = null;\n model.onMinimizedWithFocus = null;\n });\n\n // 3. Storage — hydration happened at open, as the initial geometry; from\n // here on, save as the geometry changes.\n if (this.config.storage) this.installAutosave();\n\n // 4. Focus — never into a window that opened straight into the taskbar.\n if (this.autoFocus && model.state() !== 'minimized') this.ref._focusWindow('initial');\n\n // 5. A keyboard mode asked for before the window was on the page.\n const pending = this.ref._pendingKeyboard;\n if (pending) {\n this.ref._pendingKeyboard = null;\n this.ref._startKeyboard(pending);\n }\n }\n\n /** The window was minimized while it held focus: hand focus to its taskbar tab. */\n private onMinimizedWithFocus(): void {\n // After the render that lists the window in the taskbar.\n afterNextRender(() => this.manager._focusAfterMinimize(this.ref as WrWindowRef<unknown, unknown>), {\n injector: this.hostInjector,\n });\n }\n\n /** Persist geometry whenever it changes, debounced. */\n private installAutosave(): void {\n const cfg = this.config.storage;\n if (!cfg) return;\n const persist = cfg.persist ?? 'all';\n const key = storageKey(cfg);\n const model = this.ref._model;\n\n runInInjectionContext(this.hostInjector, () => {\n effect(() => {\n // The raw geometry: what a maximized or snapped window goes back to,\n // and so what the user chose.\n const x = model.x();\n const y = model.y();\n const width = model.width();\n const height = model.height();\n\n if (this.persistTimer !== null) clearTimeout(this.persistTimer);\n this.persistTimer = setTimeout(() => {\n this.persistTimer = null;\n const payload: PersistedGeometry = {\n ...(persist !== 'size' ? { x, y } : {}),\n ...(persist !== 'position' ? { width, height } : {}),\n };\n this.storage.set(key, payload);\n }, PERSIST_DEBOUNCE_MS);\n });\n });\n }\n}\n","<wr-window\n [model]=\"ref._model\"\n [windowRef]=\"ref\"\n [injector]=\"childInjector\"\n [titleExtra]=\"config.titleExtra ?? null\"\n [statusBar]=\"config.statusBar ?? null\"\n (closed)=\"ref.close()\"\n #window\n>\n <ng-container #content />\n</wr-window>\n\n<!--\n The snap hint lives here, not inside `<wr-window>`: `.wr-window` clips, and a\n fixed child is clipped with it while the open animation's transform is on.\n It takes the exact box the drop will give the window, from the same model\n arithmetic, so the hint and the landing cannot disagree — they did when the\n hint was a CSS 50% of the layout viewport and the snap was half of\n `innerWidth`, 7.5px apart with a classic scrollbar showing.\n-->\n@if (ref._model.previewRect(); as box) {\n <div\n class=\"wr-window__snap-hint\"\n [attr.data-target]=\"ref._model.dragTarget()\"\n [style.left.px]=\"box.left\"\n [style.top.px]=\"box.top\"\n [style.width.px]=\"box.width\"\n [style.height.px]=\"box.height\"\n [style.z-index]=\"ref._model.z() + 1\"\n aria-hidden=\"true\"\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 { type Signal, type WritableSignal, computed, signal } from '@angular/core';\n\nimport { Subject } from 'rxjs';\n\nimport { wrClamp } from 'ngwr/utils';\n\nimport type {\n WrWindowChromeSize,\n WrWindowConfig,\n WrWindowOs,\n WrWindowSize,\n WrWindowSnap,\n WrWindowSnapTarget,\n WrWindowState,\n WrWindowUpdate,\n} from './types';\n\n/** What a minimized window reports as its height. It is `display: none`, so this is only a number. */\nconst MINIMIZED_HEIGHT = 40;\n\n/** A finite number, or the fallback — a `NaN` from a bad config must not reach the geometry. */\nfunction num(value: number | undefined, fallback: number): number {\n return typeof value === 'number' && !Number.isNaN(value) ? value : fallback;\n}\n\n/**\n * A rectangle in viewport pixels — the work area, a snap region, a window's box.\n *\n * @internal\n */\nexport interface WrWindowRect {\n readonly left: number;\n readonly top: number;\n readonly width: number;\n readonly height: number;\n}\n\n/** @internal A window's free-floating geometry: where it is when it is neither maximized nor snapped. */\nexport interface WrWindowGeometry {\n readonly x: number;\n readonly y: number;\n readonly width: number;\n readonly height: number;\n}\n\n/**\n * Every option a window reads after it opens, with its default applied. The\n * ones `WrWindowRef.update()` may change are signals of this object, so an\n * update reaches the chrome and the drag code alike.\n *\n * @internal\n */\nexport interface WrWindowOptions {\n readonly os: WrWindowOs;\n readonly chromeSize: WrWindowChromeSize;\n readonly animations: boolean;\n readonly minWidth: number;\n readonly minHeight: number;\n readonly maxWidth: number;\n readonly maxHeight: number;\n readonly movable: boolean;\n readonly resizable: boolean;\n readonly keepInViewport: boolean;\n readonly snap: WrWindowSnap;\n readonly restoreOnDrag: boolean;\n readonly dragHandle: string | null;\n readonly showMinimize: boolean | null;\n readonly showMaximize: boolean | null;\n readonly showClose: boolean;\n readonly closeOnEscape: boolean;\n readonly keyboard: boolean;\n readonly keyboardStep: number;\n}\n\n/** @internal */\nexport const SIZE_PRESETS: Readonly<Record<WrWindowSize, { readonly width: number; readonly height: number }>> = {\n sm: { width: 320, height: 200 },\n md: { width: 480, height: 320 },\n lg: { width: 720, height: 480 },\n};\n\n/** Keep at least this many px of a window inside the work area, so it can be grabbed again. @internal */\nexport const MIN_ON_SCREEN = 24;\n\n/** @internal `WrWindowConfig` with every default applied. */\nexport function resolveOptions(config: WrWindowConfig): WrWindowOptions {\n return {\n os: config.os ?? 'auto',\n chromeSize: config.chromeSize ?? 'md',\n animations: config.animations ?? true,\n minWidth: num(config.minWidth, 220),\n minHeight: num(config.minHeight, 140),\n maxWidth: num(config.maxWidth, Number.POSITIVE_INFINITY),\n maxHeight: num(config.maxHeight, Number.POSITIVE_INFINITY),\n movable: config.movable ?? true,\n resizable: config.resizable ?? true,\n keepInViewport: config.keepInViewport ?? true,\n snap: config.snap ?? 'none',\n restoreOnDrag: config.restoreOnDrag ?? true,\n dragHandle: config.dragHandle ?? null,\n showMinimize: config.showMinimize ?? null,\n showMaximize: config.showMaximize ?? null,\n showClose: config.showClose ?? true,\n closeOnEscape: config.closeOnEscape ?? true,\n keyboard: config.keyboard ?? true,\n keyboardStep: Math.max(1, num(config.keyboardStep, 10)),\n };\n}\n\n/** @internal The viewport, or a stand-in on the server. */\nexport function readViewport(): { readonly width: number; readonly height: number } {\n if (typeof window === 'undefined' || typeof document === 'undefined') return { width: 1024, height: 768 };\n // `clientWidth`, not `innerWidth`: a `position: fixed` box is laid out\n // against the viewport WITHOUT its scrollbar, so with a classic 15px\n // scrollbar a window maximized to `innerWidth` ran under it, and a snap to\n // the right half started 7.5px right of the hint that promised it. jsdom\n // lays nothing out and reports 0, which is what the fallback is for.\n const root = document.documentElement;\n return { width: root.clientWidth || window.innerWidth, height: root.clientHeight || window.innerHeight };\n}\n\n/** @internal Start offset `index` windows into a cascade: 30px a step, and every ten a lap 15px along. */\nexport function cascadeOffset(index: number): { readonly x: number; readonly y: number } {\n // Ten steps then back to the start, so a cascade never walks off the\n // screen — and each lap shifted 15px ALONG ONLY, so window eleven no longer\n // opens exactly on top of window one. Shifting both axes put lap three's\n // windows exactly on lap one's, one step down the diagonal; with `x - y`\n // different for each lap, no two of the first fifty windows coincide.\n const step = 50 + (index % 10) * 30;\n return { x: step + (Math.floor(index / 10) % 5) * 15, y: step };\n}\n\n/** @internal What `seedGeometry` needs to place a window that is about to open. */\nexport interface WrWindowSeed {\n readonly options: WrWindowOptions;\n readonly workArea: WrWindowRect;\n readonly size: WrWindowSize | undefined;\n readonly x?: number;\n readonly y?: number;\n readonly width?: number;\n readonly height?: number;\n /**\n * The position came back from storage or a saved layout rather than from the\n * consumer: it is moved wholly into the work area when the window fits, the\n * way a cascade position is. A desktop's geometry restored on a phone\n * otherwise opened 1100px wide with its close button off the glass.\n */\n readonly restored?: boolean;\n /** The next cascade offset, asked for only when a coordinate is missing. */\n readonly cascade: () => { readonly x: number; readonly y: number };\n readonly rtl: boolean;\n}\n\n/**\n * Where a window opens. A window OPENS on screen when it can: the size is\n * capped at the work area (the minimum still wins, since it is the consumer's\n * floor), and a cascade or restored position is moved in until the whole box\n * fits. A coordinate the consumer passed is theirs, held only to the reach a\n * drag is held to.\n *\n * @internal\n */\nexport function seedGeometry(seed: WrWindowSeed): WrWindowGeometry {\n const { options: o, workArea: wa } = seed;\n const preset = SIZE_PRESETS[seed.size ?? 'md'];\n const keep = o.keepInViewport;\n const fit = (size: number, room: number): number => (keep ? Math.min(size, room) : size);\n const width = Math.round(wrClamp(fit(seed.width ?? preset.width, wa.width), o.minWidth, o.maxWidth));\n const height = Math.round(wrClamp(fit(seed.height ?? preset.height, wa.height), o.minHeight, o.maxHeight));\n\n let x = seed.x;\n let y = seed.y;\n let cascaded = false;\n if (x == null || y == null) {\n const offset = seed.cascade();\n cascaded = true;\n // From the START edge of the work area: the right edge in a right-to-left\n // page, where the cascade used to begin at the inline end.\n x ??= seed.rtl ? wa.left + wa.width - width - offset.x : wa.left + offset.x;\n y ??= wa.top + offset.y;\n }\n const into = cascaded || !!seed.restored;\n if (keep && (into || seed.x == null)) x = wrClamp(x, wa.left, Math.max(wa.left, wa.left + wa.width - width));\n if (keep && (into || seed.y == null)) y = wrClamp(y, wa.top, Math.max(wa.top, wa.top + wa.height - height));\n return { x: Math.round(x), y: Math.round(y), width, height };\n}\n\n/** @internal How a window was set up when it opened. */\nexport interface WrWindowModelInit {\n readonly options: WrWindowOptions;\n readonly title?: string;\n readonly geometry?: WrWindowGeometry;\n readonly state?: WrWindowState;\n readonly snap?: WrWindowSnapTarget | null;\n readonly z?: number;\n readonly workArea: Signal<WrWindowRect>;\n}\n\n/** @internal A half or a quarter: what `snap` can hold. `top` is the maximized state instead. */\nexport type WrWindowSnapRegion = Exclude<WrWindowSnapTarget, 'top'>;\n\n/** @internal What `startKeyboard` hands back for the announcement. */\nexport type WrWindowKeyboardMode = 'move' | 'resize';\n\n/**\n * One window's state and geometry, and the rules for changing them.\n *\n * Created by `WrWindowManager.open()` before anything renders, so the ref's\n * signals are right from the first read and a call made before the first render\n * — `ref.maximize()` in the same tick as `open()`, `ref.setTitle()` from the\n * body's constructor — lands instead of being dropped. The component only draws\n * it and turns pointer and key events into calls on it.\n *\n * The raw `x` / `y` / `width` / `height` are the geometry the USER chose. A\n * maximized or snapped window shows something else (`rect`), and goes back to\n * the raw geometry when it leaves that state; nothing has to be saved on the\n * way in, so a `moveTo()` made while maximized is where restore lands.\n *\n * @internal\n */\nexport class WrWindowModel {\n readonly options: WritableSignal<WrWindowOptions>;\n readonly title: WritableSignal<string>;\n readonly state: WritableSignal<WrWindowState>;\n /** The half or quarter the window occupies while `normal`. `top` is never stored: it is `maximized`. */\n readonly snap: WritableSignal<WrWindowSnapRegion | null>;\n readonly x: WritableSignal<number>;\n readonly y: WritableSignal<number>;\n readonly width: WritableSignal<number>;\n readonly height: WritableSignal<number>;\n readonly z: WritableSignal<number>;\n /** Written by the manager: whether this is the window that has the keyboard. */\n readonly isActive = signal(false);\n readonly keyboardMode = signal<WrWindowKeyboardMode | null>(null);\n /** The snap region a drag in progress would land in, for the hint. */\n readonly dragTarget = signal<WrWindowSnapTarget | null>(null);\n readonly workArea: Signal<WrWindowRect>;\n\n readonly moved = new Subject<{ readonly x: number; readonly y: number }>();\n readonly resized = new Subject<{ readonly width: number; readonly height: number }>();\n readonly stateChanges = new Subject<WrWindowState>();\n\n /** Set by the component: the `<wr-window>` element, for the focus checks. */\n element: HTMLElement | null = null;\n /** Set by the container: the window was minimized while it held focus. */\n onMinimizedWithFocus: (() => void) | null = null;\n\n /** What leaving `minimized` goes back to — a window minimized while maximized comes back maximized. */\n private restoreTo: 'normal' | 'maximized' = 'normal';\n /** The geometry keyboard mode started from, after it restored the window: what a commit compares against. */\n private keyboardStart: WrWindowGeometry | null = null;\n /** Everything keyboard mode changed on entry, so Escape can put back a maximized or snapped window too. */\n private keyboardOrigin: {\n readonly geometry: WrWindowGeometry;\n readonly state: WrWindowState;\n readonly snap: WrWindowSnapRegion | null;\n } | null = null;\n\n /** The box on screen: the raw geometry, or what the state imposes on it. */\n readonly rect: Signal<WrWindowRect> = computed(() => {\n const state = this.state();\n if (state === 'maximized') return this.maximizedRect();\n const raw = { left: this.x(), top: this.y(), width: this.width(), height: this.height() };\n if (state === 'minimized') return { ...raw, height: MINIMIZED_HEIGHT };\n const snap = this.snap();\n return snap ? this.snapRect(snap) : raw;\n });\n\n /** Where the drag in progress would land, for the snap hint. */\n readonly previewRect: Signal<WrWindowRect | null> = computed(() => {\n const target = this.dragTarget();\n return target ? this.targetRect(target) : null;\n });\n\n constructor(init: WrWindowModelInit) {\n this.options = signal(init.options);\n this.title = signal(init.title ?? '');\n this.state = signal(init.state ?? 'normal');\n this.snap = signal<WrWindowSnapRegion | null>(init.snap && init.snap !== 'top' ? init.snap : null);\n const g = init.geometry ?? { x: 0, y: 0, width: SIZE_PRESETS.md.width, height: SIZE_PRESETS.md.height };\n this.x = signal(g.x);\n this.y = signal(g.y);\n this.width = signal(g.width);\n this.height = signal(g.height);\n this.z = signal(init.z ?? 0);\n this.workArea = init.workArea;\n this.clamp();\n }\n\n // State\n\n /** The one place a state is written, so `stateChanges` hears every change and only real ones. */\n setState(next: WrWindowState): void {\n const current = this.state();\n if (current === next) return;\n if (next === 'minimized') this.restoreTo = current === 'maximized' ? 'maximized' : 'normal';\n this.state.set(next);\n this.stateChanges.next(next);\n }\n\n /** Toggle: minimize, or come back to the state it was minimized from. */\n minimize(): void {\n if (this.state() === 'minimized') {\n this.unminimize();\n return;\n }\n // Read before the state flips: once the class lands, nothing inside has a\n // box and the browser has already dropped focus on `<body>`.\n const hadFocus = this.hasFocus();\n this.setState('minimized');\n if (hadFocus) this.onMinimizedWithFocus?.();\n }\n\n /** Leave `minimized` for the state the window was minimized from. A no-op otherwise. */\n unminimize(): void {\n if (this.state() === 'minimized') this.setState(this.restoreTo);\n }\n\n /** Toggle: maximize, or restore down to where it was — a snapped half included. */\n maximize(): void {\n this.setState(this.state() === 'maximized' ? 'normal' : 'maximized');\n }\n\n /** Back to the free-floating geometry: not minimized, not maximized, not snapped. */\n restore(): void {\n this.snap.set(null);\n this.setState('normal');\n }\n\n /** Snap to a region of the work area; `top` maximizes, `null` un-snaps. */\n snapTo(target: WrWindowSnapTarget | null): void {\n if (target === 'top') {\n this.setState('maximized');\n return;\n }\n this.snap.set(target);\n this.setState('normal');\n }\n\n // Geometry\n\n /** Write the raw geometry, in whole pixels — a touch drag hands out fractions. */\n setRaw(g: Partial<WrWindowGeometry>): void {\n if (g.x !== undefined) this.x.set(Math.round(g.x));\n if (g.y !== undefined) this.y.set(Math.round(g.y));\n if (g.width !== undefined) this.width.set(Math.round(g.width));\n if (g.height !== undefined) this.height.set(Math.round(g.height));\n }\n\n /**\n * A snapped window that is moved or resized by hand leaves the snap and\n * keeps the box it had, the way a desktop does — otherwise the write would\n * land in the raw geometry and nothing would visibly move.\n */\n unsnapInPlace(): void {\n if (!this.snap()) return;\n if (this.state() === 'normal') {\n const r = this.rect();\n this.setRaw({ x: r.left, y: r.top, width: r.width, height: r.height });\n }\n this.snap.set(null);\n }\n\n moveTo(x: number, y: number): void {\n this.unsnapInPlace();\n this.setRaw({ x, y });\n this.clamp();\n }\n\n resizeTo(width: number, height: number): void {\n this.unsnapInPlace();\n const o = this.options();\n this.setRaw({ width: wrClamp(width, o.minWidth, o.maxWidth), height: wrClamp(height, o.minHeight, o.maxHeight) });\n this.clamp();\n }\n\n center(): void {\n this.unsnapInPlace();\n const wa = this.workArea();\n this.setRaw({\n x: wa.left + Math.max(0, (wa.width - this.width()) / 2),\n y: wa.top + Math.max(0, (wa.height - this.height()) / 2),\n });\n }\n\n /**\n * Keep enough of the window inside the work area to grab it again. Reads the\n * work area, so a resized viewport pulls a window back into reach.\n */\n clamp(): void {\n if (!this.options().keepInViewport) return;\n const wa = this.workArea();\n const w = this.width();\n this.x.set(Math.round(wrClamp(this.x(), wa.left + MIN_ON_SCREEN - w, wa.left + wa.width - MIN_ON_SCREEN)));\n this.y.set(Math.round(wrClamp(this.y(), wa.top, wa.top + wa.height - MIN_ON_SCREEN)));\n }\n\n /** Change options on an open window. New bounds re-clamp the size the window has now. */\n update(patch: WrWindowUpdate): void {\n const { title, ...rest } = patch;\n if (title !== undefined) this.title.set(title);\n const defined: Record<string, unknown> = {};\n for (const [key, value] of Object.entries(rest)) if (value !== undefined) defined[key] = value;\n if (Object.keys(defined).length === 0) return;\n this.options.update(o => ({ ...o, ...defined }));\n if (['minWidth', 'minHeight', 'maxWidth', 'maxHeight'].some(key => key in defined)) {\n const o = this.options();\n this.setRaw({\n width: wrClamp(this.width(), o.minWidth, o.maxWidth),\n height: wrClamp(this.height(), o.minHeight, o.maxHeight),\n });\n this.clamp();\n }\n }\n\n /** The box a maximized window takes: the work area, capped at the maximum size and centred in it. */\n maximizedRect(): WrWindowRect {\n const wa = this.workArea();\n const o = this.options();\n const width = Math.min(wa.width, o.maxWidth);\n const height = Math.min(wa.height, o.maxHeight);\n return {\n left: wa.left + Math.round((wa.width - width) / 2),\n top: wa.top + Math.round((wa.height - height) / 2),\n width,\n height,\n };\n }\n\n /**\n * The box a half or a quarter takes, held to the window's own bounds: a\n * window that cannot be that narrow keeps its minimum and stays against the\n * edge it was snapped to, and the box is kept inside the work area.\n */\n snapRect(target: WrWindowSnapRegion): WrWindowRect {\n const wa = this.workArea();\n const o = this.options();\n const halfW = Math.floor(wa.width / 2);\n const halfH = Math.floor(wa.height / 2);\n const right = target === 'right' || target === 'top-right' || target === 'bottom-right';\n const bottom = target === 'bottom-left' || target === 'bottom-right';\n const quarter = target !== 'left' && target !== 'right';\n // The far half carries the odd pixel, so the two halves meet with no gap.\n const regionW = right ? wa.width - halfW : halfW;\n const regionH = quarter ? (bottom ? wa.height - halfH : halfH) : wa.height;\n const regionL = wa.left + (right ? halfW : 0);\n const regionT = wa.top + (bottom ? halfH : 0);\n const width = wrClamp(regionW, o.minWidth, o.maxWidth);\n const height = wrClamp(regionH, o.minHeight, o.maxHeight);\n const left = right ? regionL + regionW - width : regionL;\n const top = bottom ? regionT + regionH - height : regionT;\n return {\n left: wrClamp(left, wa.left, Math.max(wa.left, wa.left + wa.width - width)),\n top: wrClamp(top, wa.top, Math.max(wa.top, wa.top + wa.height - height)),\n width,\n height,\n };\n }\n\n /** Where a snap target puts the window. */\n targetRect(target: WrWindowSnapTarget): WrWindowRect {\n return target === 'top' ? this.maximizedRect() : this.snapRect(target);\n }\n\n // Keyboard move and resize\n\n /**\n * Enter keyboard move or resize. A maximized window is restored down first\n * and a snapped one keeps its box, so the arrows move what the user sees.\n * Returns `false` when the option forbids it.\n */\n startKeyboard(mode: WrWindowKeyboardMode): boolean {\n const o = this.options();\n if (!o.keyboard || this.state() === 'minimized') return false;\n if (mode === 'move' ? !o.movable : !o.resizable) return false;\n this.keyboardOrigin = {\n geometry: { x: this.x(), y: this.y(), width: this.width(), height: this.height() },\n state: this.state(),\n snap: this.snap(),\n };\n if (this.state() === 'maximized') this.setState('normal');\n this.unsnapInPlace();\n this.keyboardStart = { x: this.x(), y: this.y(), width: this.width(), height: this.height() };\n this.keyboardMode.set(mode);\n return true;\n }\n\n /** One arrow key in keyboard move. */\n nudge(dx: number, dy: number): void {\n this.setRaw({ x: this.x() + dx, y: this.y() + dy });\n this.clamp();\n }\n\n /**\n * One arrow key in keyboard resize. The edge that moves is the inline END —\n * the left one in a right-to-left page — so growing never moves the edge the\n * window reads from.\n */\n grow(dw: number, dh: number, rtl: boolean): void {\n const o = this.options();\n const width = wrClamp(this.width() + dw, o.minWidth, o.maxWidth);\n const height = wrClamp(this.height() + dh, o.minHeight, o.maxHeight);\n const x = rtl ? this.x() - (width - this.width()) : this.x();\n this.setRaw({ x, width, height });\n this.clamp();\n }\n\n /** Keep what keyboard mode did. Returns the mode it ended, for the announcement and the stream. */\n commitKeyboard(): WrWindowKeyboardMode | null {\n const mode = this.keyboardMode();\n if (!mode) return null;\n this.keyboardMode.set(null);\n const start = this.keyboardStart;\n this.keyboardStart = null;\n this.keyboardOrigin = null;\n if (mode === 'move' && (start?.x !== this.x() || start?.y !== this.y())) {\n this.moved.next({ x: this.x(), y: this.y() });\n }\n if (mode === 'resize' && (start?.width !== this.width() || start?.height !== this.height())) {\n this.resized.next({ width: this.width(), height: this.height() });\n }\n return mode;\n }\n\n /**\n * Put the window back the way keyboard mode found it: the geometry, and the\n * maximized state or the snapped half it restored on entry. Without the last\n * two, Escape on a maximized window left it restored down.\n */\n cancelKeyboard(): WrWindowKeyboardMode | null {\n const mode = this.keyboardMode();\n if (!mode) return null;\n const origin = this.keyboardOrigin;\n this.keyboardStart = null;\n this.keyboardOrigin = null;\n this.keyboardMode.set(null);\n if (origin) {\n this.setRaw(origin.geometry);\n this.snap.set(origin.snap);\n this.setState(origin.state);\n }\n return mode;\n }\n\n /** Whether focus is inside the window. */\n hasFocus(): boolean {\n const el = this.element;\n return !!el && el.contains(el.ownerDocument.activeElement);\n }\n\n /** The window closed: no stream may outlive it. */\n complete(): void {\n this.moved.complete();\n this.resized.complete();\n this.stateChanges.complete();\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 { OverlayRef } from '@angular/cdk/overlay';\nimport { type ComponentRef, type Signal, computed, signal } from '@angular/core';\n\nimport { type Observable, ReplaySubject, type Subject } from 'rxjs';\n\nimport type { WrWindowBeforeCloseHook, WrWindowSnapTarget, WrWindowState, WrWindowUpdate } from './types';\nimport { type WrWindowKeyboardMode, WrWindowModel, readViewport, resolveOptions } from './window-model';\n\n/**\n * What a ref needs from the manager that opened it.\n *\n * @internal\n */\nexport interface WrWindowRefHost {\n /** Raise the window, mark it active and, unless told otherwise, move focus into it. */\n _activate(ref: WrWindowRef<unknown, unknown>, options?: { readonly focus?: boolean }): void;\n /** Raise the window without touching focus. */\n _raise(ref: WrWindowRef<unknown, unknown>): void;\n}\n\n/**\n * Handle returned by `WrWindowManager.open()`.\n *\n * Wraps the underlying overlay, exposes signals for the live geometry,\n * and gives the consumer programmatic control over the window\n * (focus, move, resize, minimize, maximize, close).\n *\n * Every signal is right from the moment `open()` returns, and every call works\n * from then on too — including from the body component's constructor.\n *\n * @example\n * ```ts\n * const ref = manager.open(EditorComponent, {\n * title: 'Untitled.md',\n * storage: { key: 'editor', prefix: 'app' },\n * });\n *\n * ref.beforeClose(async () => {\n * if (!isDirty) return true;\n * return await confirmDiscard();\n * });\n *\n * const saved = await ref.afterClosed(); // resolves with whatever the\n * // component passed to ref.close(value)\n * ```\n */\nexport class WrWindowRef<C, R = unknown> {\n /** Stable id — used by the taskbar, workspace save, and DI. */\n readonly id: string;\n\n /**\n * @internal — emits the close result once and completes.\n *\n * A `ReplaySubject`, not a plain `Subject`, so the result survives a late\n * subscriber — the same reasoning `WrDialogRef` already carries. A caller\n * that holds the ref and awaits `afterClosed()` after any intervening\n * `await` subscribes to an already-completed stream, and a plain Subject\n * hands it nothing but `complete`: the promise resolved `undefined` and a\n * saved result was indistinguishable from a dismissal.\n */\n readonly _closed = new ReplaySubject<R | undefined>(1);\n\n /** @internal — the window's state and geometry; the signals below read through it. */\n readonly _model: WrWindowModel;\n\n /** @internal — emits whenever the state changes; `stateChanges` is its public face. */\n readonly _stateChanged: Subject<WrWindowState>;\n\n /** @internal — set by the container right after attach. */\n componentRef: ComponentRef<C> | null = null;\n\n /** @internal — whether this window opts into the taskbar list. */\n taskbarVisible = true;\n\n /** @internal — the manager that opened the window. */\n _host: WrWindowRefHost | null = null;\n\n /** @internal — close the overlay and settle the result; wired by the manager. */\n _doClose: ((result: R | undefined) => void) | null = null;\n\n /**\n * @internal — move focus into the window after the next render: to the control\n * it had last (`'last'`, falling back to the first one) or to the first one.\n * Wired by the container once the window is on the page.\n */\n _focusWindow: ((mode: 'initial' | 'last') => void) | null = null;\n\n /** @internal — enter keyboard move / resize; wired by the container. */\n _startKeyboard: ((mode: WrWindowKeyboardMode) => void) | null = null;\n\n /** @internal — a keyboard mode asked for before the window was on the page. */\n _pendingKeyboard: WrWindowKeyboardMode | null = null;\n\n /**\n * @internal — what had focus when `open()` was called, and where closing the\n * window sends it back. `null` when focus was on nothing.\n */\n _returnFocus: HTMLElement | null = null;\n\n /** Window state. A snapped window is `normal`; read {@link snap} for which half. */\n readonly state: Signal<WrWindowState>;\n /** Left edge on screen, in px — the work area's while maximized. */\n readonly x: Signal<number>;\n /** Top edge on screen, in px. */\n readonly y: Signal<number>;\n /** Width on screen, in px. */\n readonly width: Signal<number>;\n /** Height on screen, in px. */\n readonly height: Signal<number>;\n /** Stack z-index. */\n readonly z: Signal<number>;\n /** Live title. */\n readonly title: Signal<string>;\n /** The half or quarter the window is snapped to, or `null` (since v15.1). Maximized reads `null`. */\n readonly snap: Signal<WrWindowSnapTarget | null>;\n /** Whether this is the active window — the one that has the keyboard (since v15.1). */\n readonly isActive: Signal<boolean>;\n\n /** Emits the close result once, then completes — the stream `WrDialogRef.closed` is (since v15.1). */\n readonly closed: Observable<R | undefined>;\n /**\n * Emits where the user moved the window: once when a title-bar drag or a\n * keyboard move ends, and when a drag snaps it. Calls from code are silent —\n * the caller knows where it put the window (since v15.1).\n */\n readonly moved: Observable<{ readonly x: number; readonly y: number }>;\n /**\n * Emits the size the user gave the window: once when an edge drag or a\n * keyboard resize ends, and when a drag snaps it to a half or a quarter.\n * Calls from code are silent (since v15.1).\n */\n readonly resized: Observable<{ readonly width: number; readonly height: number }>;\n /** Emits every state change, from the user or from code (since v15.1). */\n readonly stateChanges: Observable<WrWindowState>;\n\n // Hooks\n private _beforeCloseHook: WrWindowBeforeCloseHook<R> | null = null;\n\n /**\n * A ref built by hand — a test double for `WR_WINDOW_REF`. It answers every\n * call with a window of its own that nothing renders.\n */\n constructor(id: string, _overlayRef: OverlayRef);\n /** @internal The manager's form: the window's model, built before anything renders. */\n constructor(id: string, _overlayRef: OverlayRef, model: WrWindowModel);\n constructor(\n id: string,\n public readonly _overlayRef: OverlayRef,\n model?: WrWindowModel\n ) {\n this.id = id;\n // A ref built by hand — a test double for `WR_WINDOW_REF` — still answers.\n const m =\n model ??\n new WrWindowModel({\n options: resolveOptions({}),\n workArea: signal({ left: 0, top: 0, ...readViewport() }),\n });\n this._model = m;\n this._stateChanged = m.stateChanges;\n this.state = m.state.asReadonly();\n this.x = computed(() => m.rect().left);\n this.y = computed(() => m.rect().top);\n this.width = computed(() => m.rect().width);\n this.height = computed(() => m.rect().height);\n this.z = m.z.asReadonly();\n this.title = m.title.asReadonly();\n this.snap = m.snap.asReadonly();\n this.isActive = m.isActive.asReadonly();\n this.closed = this._closed.asObservable();\n this.moved = m.moved.asObservable();\n this.resized = m.resized.asObservable();\n this.stateChanges = m.stateChanges.asObservable();\n }\n\n /** Resolved instance of the projected component. */\n get componentInstance(): C {\n if (!this.componentRef) {\n throw new Error('WrWindowRef: component not yet attached');\n }\n return this.componentRef.instance;\n }\n\n // Lifecycle\n\n private isClosed = false;\n\n /**\n * Close the window, optionally returning a result. If a `beforeClose`\n * hook is registered it is consulted first — a falsy resolution\n * cancels the close.\n */\n async close(result?: R): Promise<void> {\n // `WrDialogRef` / `WrDrawerRef` latch the same way on their own `isClosed`,\n // but theirs are synchronous: this is the only one of the three that AWAITS,\n // so it is the\n // only one a second call can enter mid-flight and run the hook again. Two\n // Escapes in a row do it, and so does `manager.closeAll()` while a hook is\n // pending — `_doClose` is what removes the ref from the manager's list, and\n // it has not run yet.\n if (this.isClosed) return;\n this.isClosed = true;\n\n let proceed = false;\n try {\n proceed = this._beforeCloseHook ? !!(await this._beforeCloseHook(result)) : true;\n } finally {\n // A veto is not a close, and neither is a hook that threw — release the\n // latch in both cases, or a declined close would disable the window for\n // good.\n if (!proceed) this.isClosed = false;\n }\n\n if (proceed) this._doClose?.(result);\n }\n\n /** Toggle the minimized state. Leaving it returns to the state it was minimized from. */\n minimize(): void {\n this._model.minimize();\n }\n\n /** Toggle the maximized state. Restoring down returns to where the window was, a snapped half included. */\n maximize(): void {\n this._model.maximize();\n }\n\n /** Back to `normal` at the window's own geometry — from minimized, maximized or snapped. */\n restore(): void {\n this._model.restore();\n }\n\n /**\n * Bring this window to the top of the stack. Only RAISES it: focus stays\n * where it is. Use {@link activate} to switch to the window.\n */\n focus(): void {\n this._host?._raise(this as WrWindowRef<unknown, unknown>);\n }\n\n /**\n * Switch to the window: bring it back from the taskbar if it is minimized,\n * raise it, make it the active window, and move focus to the control it had\n * last (its first control when it never had one) (since v15.1).\n */\n activate(): void {\n if (this._host) this._host._activate(this as WrWindowRef<unknown, unknown>);\n else this._model.unminimize();\n }\n\n // Programmatic geometry\n\n /**\n * Move the window to `(x, y)`, held to the work area while `keepInViewport`.\n * While maximized it moves the geometry restore lands on; a snapped window\n * leaves the snap.\n */\n moveTo(x: number, y: number): void {\n this._model.moveTo(x, y);\n }\n\n /** Resize the window, held to `minWidth`…`maxWidth` and `minHeight`…`maxHeight`. */\n resizeTo(width: number, height: number): void {\n this._model.resizeTo(width, height);\n }\n\n /** Re-position the window so it sits centered in its work area. */\n center(): void {\n this._model.center();\n }\n\n /** Snap to a half or a quarter of the work area; `'top'` maximizes, `null` un-snaps (since v15.1). */\n snapTo(target: WrWindowSnapTarget | null): void {\n this._model.snapTo(target);\n }\n\n /** Update the title-bar text, and with it the window's accessible name. */\n setTitle(title: string): void {\n this._model.title.set(title);\n }\n\n /**\n * Change options on an open window — lock it while it saves, take its close\n * button away while a task runs. New bounds re-clamp its current size\n * (since v15.1).\n */\n update(patch: WrWindowUpdate): void {\n this._model.update(patch);\n }\n\n /**\n * Move the window from the keyboard: the arrow keys step it, Shift by one\n * pixel, Enter keeps the result and Escape puts it back. Moves focus into the\n * window so the keys arrive. Bind it to a menu item or a button to offer\n * moving without a drag (since v15.1).\n */\n startMove(): void {\n this.startKeyboard('move');\n }\n\n /** Resize the window from the keyboard, the same way as {@link startMove} (since v15.1). */\n startResize(): void {\n this.startKeyboard('resize');\n }\n\n private startKeyboard(mode: WrWindowKeyboardMode): void {\n if (this._startKeyboard) this._startKeyboard(mode);\n else this._pendingKeyboard = mode;\n }\n\n // Hooks\n\n /**\n * Register a guard that runs before `close()`. Return `false` (or a\n * Promise resolving to false) to veto. Only one hook per ref —\n * subsequent calls replace the previous.\n */\n beforeClose(hook: WrWindowBeforeCloseHook<R>): void {\n this._beforeCloseHook = hook;\n }\n\n /** Resolves with the result passed to `close()` (or `undefined`). */\n afterClosed(): Promise<R | undefined> {\n return new Promise(resolve => {\n this._closed.subscribe({\n next: value => resolve(value),\n complete: () => resolve(undefined),\n });\n });\n }\n\n /** The same promise as {@link afterClosed}, under the name `WrDialogRef` uses (since v15.1). */\n awaitClose(): Promise<R | undefined> {\n return this.afterClosed();\n }\n\n /** Escape hatch — the underlying CDK overlay ref. */\n get overlayRef(): OverlayRef {\n return this._overlayRef;\n }\n}\n\nexport type { WrWindowBeforeCloseHook } 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 { FocusMonitor } from '@angular/cdk/a11y';\nimport { Directionality } from '@angular/cdk/bidi';\nimport { type OverlayRef } from '@angular/cdk/overlay';\nimport { ComponentPortal, type ComponentType } from '@angular/cdk/portal';\nimport { isPlatformBrowser } from '@angular/common';\nimport {\n DestroyRef,\n ElementRef,\n EnvironmentInjector,\n Injector,\n PLATFORM_ID,\n Service,\n type Signal,\n afterNextRender,\n computed,\n inject,\n signal,\n untracked,\n} from '@angular/core';\n\nimport { WR_OVERLAY, wrFollowDirection } from 'ngwr/overlay';\nimport { WrStorage } from 'ngwr/storage';\nimport { wrClamp, wrRandomId, wrToClassList, wrRestoreFocus } from 'ngwr/utils';\n\nimport { storageKey } from '../storage-key';\nimport { WR_WINDOW_DATA, WR_WINDOW_DEFAULTS, WR_WINDOW_REF } from '../tokens';\nimport type {\n WrWindowBounds,\n WrWindowConfig,\n WrWindowInsets,\n WrWindowLayoutSnapshot,\n WrWindowStorageConfig,\n} from '../types';\nimport { type PersistedGeometry, WrWindowContainer } from '../window-container';\nimport {\n type WrWindowRect,\n WrWindowModel,\n cascadeOffset,\n readViewport,\n resolveOptions,\n seedGeometry,\n} from '../window-model';\nimport { type WrWindowRefHost, WrWindowRef } from '../window-ref';\n\ntype AnyRef = WrWindowRef<unknown, unknown>;\n\nconst NO_RESERVE = { top: 0, bottom: 0 } as const;\n\nfunction sameRect(a: WrWindowRect, b: WrWindowRect): boolean {\n return a.left === b.left && a.top === b.top && a.width === b.width && a.height === b.height;\n}\n\n/**\n * What `WrWindowManager` needs from a `<wr-window-taskbar>` on the page: the\n * row a window's tab sits in, so focus can land on it when the window is\n * minimized and be recognised there when the window is closed from it, and\n * the strip it covers, so maximized windows stop short of it.\n *\n * @internal\n */\nexport interface WrWindowTaskbarTabs {\n /**\n * The `.wr-window-taskbar__tab` row for `ref`, the \"+N\" button when its tab is\n * folded under one, or `null` when this taskbar does not list it.\n */\n tabFor(ref: AnyRef): HTMLElement | null;\n /**\n * Whether `ref`'s place in the rail is still moving: its tab has not been\n * measured yet, or the render that folds or unfolds it has not happened. Focus\n * waits for it rather than landing on a tab about to hide or a \"+N\" not drawn.\n */\n settling(ref: AnyRef): boolean;\n /** Whether `node` is inside this taskbar. */\n contains(node: Node): boolean;\n /** The strip of the viewport this taskbar covers while it shows tabs, in px from each edge. */\n readonly reserve: Signal<{ readonly top: number; readonly bottom: number }>;\n}\n\n/**\n * Owns the open window stack, hands out z-indexes, tracks the active window,\n * cascades the default spawn position, and opens windows that wrap a consumer\n * component.\n *\n * Inject the singleton and call `open(component, config)` for a\n * dialog-style flow:\n *\n * ```ts\n * const manager = inject(WrWindowManager);\n *\n * const ref = manager.open(EditorComponent, {\n * title: 'Untitled.md',\n * size: 'lg',\n * storage: { key: 'editor', prefix: 'my-app' },\n * });\n *\n * const saved = await ref.afterClosed();\n * ```\n *\n * There is no declarative `<wr-window>`: `open()` is the only way in, so every\n * window shares this one stack.\n */\n@Service()\nexport class WrWindowManager implements WrWindowRefHost {\n private readonly focusMonitor = inject(FocusMonitor);\n private readonly overlay = inject(WR_OVERLAY);\n private readonly parentInjector = inject(EnvironmentInjector);\n private readonly storage = inject(WrStorage);\n private readonly isBrowser = isPlatformBrowser(inject(PLATFORM_ID));\n private readonly dir = inject(Directionality, { optional: true });\n private readonly defaults = inject(WR_WINDOW_DEFAULTS, { optional: true });\n private readonly destroyRef = inject(DestroyRef);\n\n private readonly baseZ = 1000;\n private topZ = this.baseZ;\n private openCount = 0;\n\n /** All open windows, in the order they opened. */\n private readonly _windows = signal<readonly AnyRef[]>([]);\n\n /** The window that has the keyboard, or `null`. */\n private readonly _active = signal<AnyRef | null>(null);\n\n /**\n * Filled by `restoreLayout` right before it invokes the consumer's\n * opener callback. The next `open()` call with a matching `config.id`\n * pops the entry and uses it as the initial geometry and state.\n */\n private readonly pendingRestores = new Map<string, WrWindowLayoutSnapshot>();\n\n /** The taskbars on the page, registered by each `<wr-window-taskbar>` for its lifetime. */\n private readonly taskbars = signal<readonly WrWindowTaskbarTabs[]>([]);\n\n /**\n * ONE viewport for every window, kept by one `resize` listener while any\n * window is open. Each window used to add its own — twenty listeners for\n * twenty windows, each writing its own copy of the same two numbers.\n */\n private readonly viewport = signal(readViewport(), {\n equal: (a, b) => a.width === b.width && a.height === b.height,\n });\n /** Bumped when an element used as `bounds` may have moved: it resized, or something scrolled. */\n private readonly layoutTick = signal(0);\n private listening = false;\n private boundsObserver: ResizeObserver | null = null;\n private readonly boundElements = new Map<HTMLElement, number>();\n private readonly bumpLayout = (): void => this.layoutTick.update(n => n + 1);\n private readonly measure = (): void => this.viewport.set(readViewport());\n\n constructor() {\n this.destroyRef.onDestroy(() => {\n this.unlisten();\n if (!this.isBrowser) return;\n document.removeEventListener('scroll', this.bumpLayout, true);\n this.boundsObserver?.disconnect();\n });\n }\n\n /** The strip the taskbars cover, edge by edge. */\n private readonly reserve = computed(() => {\n let top = 0;\n let bottom = 0;\n for (const taskbar of this.taskbars()) {\n const r = taskbar.reserve();\n top = Math.max(top, r.top);\n bottom = Math.max(bottom, r.bottom);\n }\n return top === 0 && bottom === 0 ? NO_RESERVE : { top, bottom };\n });\n\n /** All currently-open windows, in the order they opened. */\n // Spelled out rather than `AnyRef` on every public member: the alias is not\n // exported, so the published typings would name `AnyRef$1` to a consumer.\n readonly windows: Signal<readonly WrWindowRef<unknown, unknown>[]> = this._windows.asReadonly();\n\n /**\n * The active window — the one that has the keyboard: the last one focused,\n * clicked, opened with focus or switched to (since v15.1). `null` once focus\n * moves to something on the page outside every window, and while the active\n * window is minimized.\n */\n readonly active: Signal<WrWindowRef<unknown, unknown> | null> = this._active.asReadonly();\n\n /** Windows that are minimized AND opted into the taskbar. */\n readonly minimized: Signal<WrWindowRef<unknown, unknown>[]> = computed(() =>\n this._windows().filter(w => w.taskbarVisible && w.state() === 'minimized')\n );\n\n /** Reserve the next z-index. Strictly increasing across the app's lifetime. */\n bringToFront(): number {\n this.topZ += 1;\n return this.topZ;\n }\n\n /**\n * Cascade offset for new windows, so two opens don't perfectly overlap: 30px\n * a step from the work area's start edge, back to the start after ten, and\n * each lap of ten shifted 15px along so window eleven does not land exactly\n * on window one.\n */\n nextStartOffset(): { readonly x: number; readonly y: number } {\n const offset = cascadeOffset(this.openCount);\n this.openCount += 1;\n return offset;\n }\n\n /**\n * Open a window with `component` rendered as its body. Returns a ref\n * the caller can use to drive the window programmatically and await\n * its result.\n *\n * **Singleton by id** — if `config.id` is set and a window with that\n * id is already open, that window is switched to (back from the taskbar,\n * raised, focused) and its ref returned. No duplicate window is\n * created. Use this to coalesce repeated open() calls (e.g. a\n * \"Settings\" menu item that should always re-focus the same window).\n */\n open<C, R = unknown, D = unknown>(component: ComponentType<C>, config: WrWindowConfig<D> = {}): WrWindowRef<C, R> {\n // Where focus goes back to when the window closes — read before anything\n // here moves it.\n const opener = this.focusedElement();\n\n if (config.id) {\n const existing = this.findById(config.id);\n if (existing) {\n // A second open is still an open: focus goes to the window, and back to\n // whatever asked for it this time — unless that was the window itself.\n if (config.autoFocus !== false) {\n if (opener && !existing._overlayRef.overlayElement?.contains(opener)) existing._returnFocus = opener;\n this._activate(existing);\n } else {\n existing._model.unminimize();\n this._raise(existing);\n }\n return existing as WrWindowRef<C, R>;\n }\n }\n\n // Honour a pending restore — `restoreLayout` populates this Map\n // right before invoking the consumer's opener so the new window\n // seeds at the saved geometry instead of the cascade default.\n const pending = config.id ? this.pendingRestores.get(config.id) : undefined;\n if (pending) this.pendingRestores.delete(config.id!);\n\n this.listen();\n\n const options = resolveOptions(config);\n const bounds = this.boundsElement(config.bounds ?? this.defaults?.bounds);\n const workArea = this.workAreaFor(config.bounds ?? this.defaults?.bounds, bounds);\n const releaseBounds = bounds ? this.observeBounds(bounds) : null;\n\n // Saved geometry is the INITIAL geometry, through the same fit as a\n // cascade: it used to be written over the window after it had sized\n // itself, skipping the fit and the min / max clamps, so a desktop's\n // 1100px window reopened on a phone with 24px of it on the glass.\n const saved = !pending && config.storage ? this.storage.get<PersistedGeometry>(storageKey(config.storage)) : null;\n const persist = config.storage?.persist ?? 'all';\n const isNum = (v: unknown): v is number => typeof v === 'number' && !Number.isNaN(v);\n const savedPos = saved && persist !== 'size' && isNum(saved.x) && isNum(saved.y) ? saved : null;\n const savedSize = saved && persist !== 'position' && isNum(saved.width) && isNum(saved.height) ? saved : null;\n\n const geometry = untracked(() =>\n seedGeometry({\n options,\n workArea: workArea(),\n size: config.size,\n x: pending?.x ?? savedPos?.x ?? config.x,\n y: pending?.y ?? savedPos?.y ?? config.y,\n width: pending?.width ?? savedSize?.width ?? config.width,\n height: pending?.height ?? savedSize?.height ?? config.height,\n restored: !!pending || !!savedPos,\n cascade: () => this.nextStartOffset(),\n rtl: this.dir?.value === 'rtl',\n })\n );\n\n const taskbarOptIn = config.taskbar !== false;\n const model = new WrWindowModel({\n options,\n // A saved title, else the config's — an empty saved title is not one.\n title: [pending?.title, config.title].find(t => !!t) ?? '',\n geometry,\n state: pending?.state,\n snap: pending?.snap ?? null,\n z: this.bringToFront(),\n workArea,\n });\n\n // Assigned right after the ref exists; the predicate below only ever runs\n // from a keydown, long after.\n let self: AnyRef | null = null;\n\n // Each window gets its own CDK overlay pane positioned `static` —\n // <wr-window> itself uses `position: fixed`, so the pane is only a\n // mount point. Windows are never modal — reach for `WrDialog` when\n // you need a backdrop + focus trap + scroll block.\n const overlayRef: OverlayRef = this.overlay.create({\n positionStrategy: this.overlay.position().global(),\n panelClass: wrToClassList('wr-window-overlay', config.panelClass),\n hasBackdrop: false,\n // Which window an Escape belongs to is a question the CDK cannot answer\n // here. Its keyboard dispatcher walks the attached overlays newest-first\n // and hands the key to the first one willing to take it — and attach order\n // is frozen at OPEN order, because raising re-stacks with a z-index and\n // never re-attaches. Declining here is what makes it recoverable: a\n // rejected event walks on down the stack instead of being eaten, so the\n // window that does own it still gets its Escape.\n eventPredicate: () => self === null || this.ownsKeyboard(self),\n // OUT of the top layer, deliberately. The CDK puts overlay hosts there by\n // default (`popover=\"manual\"`), and the top layer orders strictly by\n // ENTRY: whatever opened last paints on top and no z-index can change it.\n // That is right for a menu or a modal and exactly wrong for a window\n // manager, whose whole job is letting the user decide which window is in\n // front. It also fixes the ordering against modals: a dialog stays in the\n // top layer, so it now sits above every window instead of below whichever\n // window happened to open after it.\n usePopover: false,\n });\n\n // The z-index has to land on the OVERLAY HOST, not only on `.wr-window`.\n // Each window sits in its own CDK global wrapper, and that wrapper is\n // `position: fixed` with a numeric `z-index` — which makes it a stacking\n // context, so a z-index written inside it only orders things against its\n // own siblings, never against another window.\n overlayRef.hostElement.style.zIndex = String(model.z());\n\n // Windows are long-lived — a session can leave one open across any number\n // of direction changes — and while `x` / `y` are physical by design (as are\n // the resize grips, deliberately), the chrome is not: the macOS title bar\n // parks its button cluster with `row-reverse`, which resolves against `dir`,\n // so a stale attribute leaves the dots and the gutter that counterbalances\n // them on opposite edges. Each `open()` has its own ref, and `_doClose`\n // disposes it, which is what ends this follower.\n wrFollowDirection(overlayRef, this.dir, this.parentInjector);\n\n const id = config.id ?? wrRandomId('wr-window');\n const ref = new WrWindowRef<C, R>(id, overlayRef, model);\n const any = ref as unknown as AnyRef;\n self = any;\n ref._host = this;\n ref.taskbarVisible = taskbarOptIn;\n\n // A minimized window is not the one with the keyboard: focus has gone to\n // its taskbar tab, or back to where the window was opened from.\n model.stateChanges.subscribe(state => {\n if (state === 'minimized' && this._active() === any) this.setActive(null);\n });\n\n // Provide WR_WINDOW_REF + WR_WINDOW_DATA inside the projected\n // component's subtree so it can `inject(WR_WINDOW_REF)` etc.\n const childInjector = Injector.create({\n parent: this.parentInjector,\n providers: [\n { provide: WR_WINDOW_REF, useValue: ref },\n { provide: WR_WINDOW_DATA, useValue: config.data ?? null },\n ],\n });\n\n const portal = new ComponentPortal<WrWindowContainer<C>>(WrWindowContainer);\n const containerRef = overlayRef.attach(portal);\n const container = containerRef.instance;\n container.config = config;\n container.ref = ref as WrWindowRef<C, unknown>;\n container.componentType = component;\n container.childInjector = childInjector;\n // A window `restoreLayout()` re-opens stays out of focus's way unless its\n // opener says otherwise: a workspace of five windows coming back must not\n // pull focus through each of them and leave it in whichever came last.\n container.autoFocus = config.autoFocus ?? !pending;\n ref._returnFocus = opener;\n\n // No role on the pane: `<wr-window>` inside it is the named `role=\"dialog\"`,\n // and a second, unnamed one around it read as \"dialog > dialog\" and tripped\n // axe's `aria-dialog-name` on every open window.\n\n // Always subscribed, and the option read when the key arrives, so\n // `update({ closeOnEscape })` reaches an open window. A key claimed below\n // it — Escape cancelling keyboard move — is not a close.\n overlayRef.keydownEvents().subscribe(event => {\n if (event.key !== 'Escape' || event.defaultPrevented || !model.options().closeOnEscape) return;\n event.preventDefault();\n void ref.close();\n });\n\n // Wire close → disposal + completion of the result subject. The\n // ref's `close()` already runs the beforeClose hook before reaching\n // this bridge.\n ref._doClose = result => {\n // Read before disposal takes the focused element out of the page. Focus\n // goes back only when it was the window's to give: inside it, on its\n // taskbar tab, or already lost. A window closed by code while the reader\n // works elsewhere leaves them there.\n const back = this.holdsFocus(any) ? ref._returnFocus : null;\n ref._returnFocus = null;\n overlayRef.dispose();\n releaseBounds?.();\n ref._closed.next(result);\n ref._closed.complete();\n model.complete();\n this._windows.update(list => list.filter(r => r !== any));\n if (this._active() === any) this.setActive(null);\n if (this._windows().length === 0) this.unlisten();\n if (back?.isConnected) wrRestoreFocus(back, this.focusMonitor);\n };\n\n this._windows.update(list => [...list, any]);\n\n return ref;\n }\n\n /**\n * Switch to `ref`: back from the taskbar, raised, active, and — unless told\n * otherwise — focused on the control it had last.\n *\n * @internal\n */\n _activate(ref: AnyRef, options: { readonly focus?: boolean } = {}): void {\n if (!this._windows().includes(ref)) return;\n ref._model.unminimize();\n this._raise(ref);\n this.setActive(ref);\n if (options.focus !== false && !ref._model.hasFocus()) ref._focusWindow?.('last');\n }\n\n /**\n * Put `ref` on top of the stack. A window already on top keeps its z: every\n * click in a window used to take a new one, so the number climbed with each\n * press and every press re-wrote the host's style.\n *\n * @internal\n */\n _raise(ref: AnyRef): void {\n if (ref.z() >= this.topZ) return;\n const z = this.bringToFront();\n ref._model.z.set(z);\n const host = ref._overlayRef.hostElement;\n if (host) host.style.zIndex = String(z);\n }\n\n private setActive(ref: AnyRef | null): void {\n const previous = this._active();\n if (previous === ref) return;\n previous?._model.isActive.set(false);\n ref?._model.isActive.set(true);\n this._active.set(ref);\n }\n\n /**\n * Focus decides the active window wherever it comes from: Tab into a window,\n * a click on a field in it, a script calling `focus()`. A window that gains\n * focus is raised too — a focused window hidden behind another is a window\n * the user is typing into blind. Focus on a taskbar, or in another overlay,\n * leaves the active window as it was; focus anywhere else on the page means\n * none is.\n */\n private readonly onFocusIn = (event: FocusEvent): void => {\n const target = event.target;\n if (!(target instanceof Node)) return;\n const ref = this._windows().find(w => w._overlayRef.overlayElement?.contains(target));\n if (ref) {\n this._raise(ref);\n this.setActive(ref);\n return;\n }\n if (this.taskbars().some(t => t.contains(target))) return;\n // Focus that went into another overlay — a menu or a listbox opened from\n // inside a window, a dialog over it — is not focus that left for the page:\n // the window it came from keeps the keyboard, the way a desktop keeps a\n // window active while its menu is open.\n if (target instanceof Element && target.closest('.wr-overlay-container, .cdk-overlay-container')) return;\n this.setActive(null);\n };\n\n /** Install the shared listeners while a window is open. */\n private listen(): void {\n if (this.listening || !this.isBrowser) return;\n this.listening = true;\n // Nothing kept the viewport current while no window was open.\n this.measure();\n window.addEventListener('resize', this.measure, { passive: true });\n document.addEventListener('focusin', this.onFocusIn, true);\n }\n\n private unlisten(): void {\n if (!this.listening) return;\n this.listening = false;\n window.removeEventListener('resize', this.measure);\n document.removeEventListener('focusin', this.onFocusIn, true);\n }\n\n private boundsElement(bounds: WrWindowBounds | undefined): HTMLElement | null {\n if (!bounds || bounds === 'viewport') return null;\n if (bounds instanceof ElementRef) return bounds.nativeElement;\n return typeof (bounds as HTMLElement).getBoundingClientRect === 'function' ? (bounds as HTMLElement) : null;\n }\n\n /**\n * The work area for one window: its bounds, cut to the viewport, minus the\n * strip a taskbar covers.\n */\n private workAreaFor(bounds: WrWindowBounds | undefined, element: HTMLElement | null): Signal<WrWindowRect> {\n const insets = !element && bounds && bounds !== 'viewport' ? (bounds as WrWindowInsets) : null;\n return computed(\n () => {\n const vp = this.viewport();\n const reserve = this.reserve();\n let left = 0;\n let top = 0;\n let right = vp.width;\n let bottom = vp.height;\n if (element && this.isBrowser) {\n this.layoutTick();\n const r = element.getBoundingClientRect();\n left = Math.max(0, r.left);\n top = Math.max(0, r.top);\n right = Math.min(vp.width, r.right);\n bottom = Math.min(vp.height, r.bottom);\n } else if (insets) {\n left = insets.left ?? 0;\n top = insets.top ?? 0;\n right = vp.width - (insets.right ?? 0);\n bottom = vp.height - (insets.bottom ?? 0);\n }\n top = Math.max(top, reserve.top);\n bottom = Math.min(bottom, vp.height - reserve.bottom);\n return {\n left: Math.round(left),\n top: Math.round(top),\n width: Math.max(0, Math.round(right - left)),\n height: Math.max(0, Math.round(bottom - top)),\n };\n },\n { equal: sameRect }\n );\n }\n\n /** Keep an element used as `bounds` measured while a window uses it. Returns the release. */\n private observeBounds(element: HTMLElement): () => void {\n if (!this.isBrowser) return () => undefined;\n const count = this.boundElements.get(element) ?? 0;\n this.boundElements.set(element, count + 1);\n if (count === 0) {\n if (typeof ResizeObserver !== 'undefined') {\n this.boundsObserver ??= new ResizeObserver(this.bumpLayout);\n this.boundsObserver.observe(element);\n }\n if (this.boundElements.size === 1) {\n document.addEventListener('scroll', this.bumpLayout, { capture: true, passive: true });\n }\n }\n let released = false;\n return () => {\n if (released) return;\n released = true;\n const left = (this.boundElements.get(element) ?? 1) - 1;\n if (left > 0) {\n this.boundElements.set(element, left);\n return;\n }\n this.boundElements.delete(element);\n this.boundsObserver?.unobserve(element);\n if (this.boundElements.size === 0) document.removeEventListener('scroll', this.bumpLayout, true);\n };\n }\n\n /**\n * Whether a keyboard event routed to `ref`'s overlay is actually meant for it.\n *\n * The window holding real DOM focus owns the key. When focus is on NOTHING —\n * `<body>`, which is where a click on a window's own text used to leave it —\n * the active window owns it if it is on screen, else the front-most window on\n * screen. When focus is anywhere else on the page, no window owns it: an\n * Escape pressed in the page's own search field closed a window the reader\n * was not in. That is the rule the non-modal drawer has always followed.\n *\n * A MINIMIZED window never owns a key it did not receive through focus, and\n * never counts as being in front: it is `display: none`. Focus on a taskbar\n * tab is on the page, so no window owns that key either.\n */\n private ownsKeyboard(ref: AnyRef): boolean {\n if (!this.isBrowser) return false;\n const open = this._windows();\n const active = document.activeElement;\n const focused = active ? open.find(w => w._overlayRef.overlayElement?.contains(active)) : undefined;\n if (focused) return focused === ref;\n if (active && active !== document.body) return false;\n const current = this._active();\n if (current && current.state() !== 'minimized') return current === ref;\n let front: AnyRef | null = null;\n for (const w of open) {\n if (w.state() !== 'minimized' && (!front || w.z() > front.z())) front = w;\n }\n return front === ref;\n }\n\n /**\n * Register a taskbar for as long as it is on the page. Returns the\n * unregister call.\n *\n * @internal\n */\n _registerTaskbar(taskbar: WrWindowTaskbarTabs): () => void {\n this.taskbars.update(list => [...list, taskbar]);\n return () => this.taskbars.update(list => list.filter(t => t !== taskbar));\n }\n\n /**\n * A window was minimized while it held focus, and the render that lists it\n * in the taskbar has happened: put focus on its tab's restore button. With no\n * taskbar listing it (none on the page, or `taskbar: false`), focus goes back\n * to where the window was opened from rather than being left on `<body>`.\n *\n * @internal\n */\n _focusAfterMinimize(ref: AnyRef, attempt = 0): void {\n // A tab the rail has not measured yet can fold on the next pass, and its\n // \"+N\" is not drawn until the pass after. Wait for those, a few at most,\n // rather than focus what is about to hide or fall back to the opener.\n if (attempt < 3 && this.taskbars().some(taskbar => taskbar.settling(ref))) {\n const active = this.focusedElement();\n if (active && ref._overlayRef.overlayElement?.contains(active)) active.blur();\n afterNextRender(() => this._focusAfterMinimize(ref, attempt + 1), { injector: this.parentInjector });\n return;\n }\n // The restore button is the row's first: the close button sits after it. A\n // folded window's place is the \"+N\" button, which is a button itself.\n const tab = this.taskbarTab(ref);\n const restore = tab?.matches('button') ? tab : tab?.querySelector<HTMLElement>('button');\n if (restore) restore.focus();\n else if (ref._returnFocus?.isConnected) wrRestoreFocus(ref._returnFocus, this.focusMonitor);\n // Nowhere to go: at least never leave focus parked inside a window that is\n // `display: none`, where it would keep claiming every Escape. Browsers\n // that run the focus fixup rule have already done this.\n const active = this.focusedElement();\n if (active && ref._overlayRef.overlayElement?.contains(active)) active.blur();\n }\n\n private taskbarTab(ref: AnyRef): HTMLElement | null {\n for (const taskbar of this.taskbars()) {\n const tab = taskbar.tabFor(ref);\n if (tab) return tab;\n }\n return null;\n }\n\n /** The focused element, or `null` when that is `<body>` or nothing. */\n private focusedElement(): HTMLElement | null {\n if (!this.isBrowser) return null;\n const active = document.activeElement;\n return active instanceof HTMLElement && active !== document.body ? active : null;\n }\n\n /** Whether focus is `ref`'s to hand back: inside it, on its taskbar tab, or nowhere. */\n private holdsFocus(ref: AnyRef): boolean {\n if (!this.isBrowser) return false;\n const active = this.focusedElement();\n if (!active) return true;\n return !!ref._overlayRef.overlayElement?.contains(active) || !!this.taskbarTab(ref)?.contains(active);\n }\n\n // Arranging\n\n /** Windows on screen — not minimized. */\n private onScreen(): AnyRef[] {\n return this._windows().filter(w => w.state() !== 'minimized');\n }\n\n /**\n * Restore every window on screen and stack them down from the start edge of\n * their work area, 30px apart, keeping each one's size and their order front\n * to back (since v15.1).\n */\n cascade(): void {\n const rtl = this.dir?.value === 'rtl';\n const list = this.onScreen().sort((a, b) => a.z() - b.z());\n list.forEach((ref, index) => {\n const m = ref._model;\n m.restore();\n const wa = m.workArea();\n const o = m.options();\n const fit = (size: number, room: number): number => (o.keepInViewport ? Math.min(size, room) : size);\n const width = wrClamp(fit(m.width(), wa.width), o.minWidth, o.maxWidth);\n const height = wrClamp(fit(m.height(), wa.height), o.minHeight, o.maxHeight);\n const offset = cascadeOffset(index);\n const x = rtl ? wa.left + wa.width - width - offset.x : wa.left + offset.x;\n const y = wa.top + offset.y;\n m.setRaw({\n x: wrClamp(x, wa.left, Math.max(wa.left, wa.left + wa.width - width)),\n y: wrClamp(y, wa.top, Math.max(wa.top, wa.top + wa.height - height)),\n width,\n height,\n });\n this._raise(ref);\n });\n }\n\n /**\n * Restore every window on screen and share the work area between them, in\n * the order they opened: a grid (the default), side by side in columns, or\n * stacked in rows. A row of a grid with fewer windows spreads them across its\n * whole width. In a right-to-left page the first window takes the right\n * (since v15.1).\n */\n tile(mode: 'grid' | 'columns' | 'rows' = 'grid'): void {\n const list = this.onScreen();\n const n = list.length;\n if (n === 0) return;\n const rtl = this.dir?.value === 'rtl';\n const cols = mode === 'columns' ? n : mode === 'rows' ? 1 : Math.ceil(Math.sqrt(n));\n const rows = Math.ceil(n / cols);\n list.forEach((ref, index) => {\n const m = ref._model;\n m.restore();\n const wa = m.workArea();\n const o = m.options();\n const row = Math.floor(index / cols);\n const inRow = Math.min(cols, n - row * cols);\n let col = index % cols;\n if (rtl) col = inRow - 1 - col;\n const x0 = wa.left + Math.floor((wa.width * col) / inRow);\n const x1 = wa.left + Math.floor((wa.width * (col + 1)) / inRow);\n const y0 = wa.top + Math.floor((wa.height * row) / rows);\n const y1 = wa.top + Math.floor((wa.height * (row + 1)) / rows);\n m.setRaw({\n x: x0,\n y: y0,\n width: wrClamp(x1 - x0, o.minWidth, o.maxWidth),\n height: wrClamp(y1 - y0, o.minHeight, o.maxHeight),\n });\n m.clamp();\n });\n }\n\n /** Minimize every window on screen (since v15.1). */\n minimizeAll(): void {\n for (const ref of this.onScreen()) ref._model.minimize();\n }\n\n /** Bring every minimized window back, each to the state it was minimized from (since v15.1). */\n restoreAll(): void {\n for (const ref of this._windows()) ref._model.unminimize();\n }\n\n /**\n * Switch to the next window, in the order they opened, wrapping at the end —\n * minimized windows included, which come back. Bind it to a hotkey from\n * `ngwr/hotkey`, such as Ctrl+F6 (since v15.1).\n */\n activateNext(): void {\n this.cycle(1);\n }\n\n /** Switch to the previous window, the other way round from {@link activateNext} (since v15.1). */\n activatePrevious(): void {\n this.cycle(-1);\n }\n\n private cycle(step: 1 | -1): void {\n const list = this._windows();\n if (list.length === 0) return;\n const current = this._active();\n const index = current ? list.indexOf(current) : -1;\n const next = index < 0 ? list[step > 0 ? 0 : list.length - 1] : list[(index + step + list.length) % list.length];\n this._activate(next);\n }\n\n /** Close every programmatically-opened window. */\n closeAll(): void {\n for (const ref of [...this._windows()]) {\n void ref.close();\n }\n }\n\n /** Look up an open window by its `config.id`. Returns `null` when no match. */\n findById(id: string): WrWindowRef<unknown, unknown> | null {\n return this._windows().find(r => r.id === id) ?? null;\n }\n\n /**\n * Drop the persisted geometry for a window so the next open uses the\n * config defaults again. Matches `WrWindowConfig.storage` exactly.\n */\n clearPersistedPosition(cfg: WrWindowStorageConfig): void {\n this.storage.remove(storageKey(cfg));\n }\n\n // Workspace save/restore\n //\n // A workspace is a snapshot of every open window's id + state +\n // geometry. Reopening is the consumer's job (component identities\n // aren't serialisable), so `restoreLayout` returns the captured\n // snapshots and a helper that re-applies geometry once the windows\n // have been opened again.\n\n /** Snapshot of one window — what `saveLayout` writes / `restoreLayout` returns. */\n private layoutKey(name: string): string {\n return `wr:window-layout:${name}`;\n }\n\n /**\n * Persist the geometry + state of every open programmatic window\n * under `name`. Pair with `restoreLayout(name)` after re-opening the\n * matching components.\n */\n saveLayout(name: string): void {\n // The RAW geometry, not the live one. `ref.x()` / `ref.width()` report what\n // is on screen — a maximized window measures the viewport, a minimized one\n // measures its collapsed header — so saving those threw away the size the\n // user actually chose. Restoring then re-maximized over viewport-sized\n // \"restore\" geometry, and \"Restore down\" left the window filling the screen\n // with no way back; a minimized window came back from the taskbar as a stub\n // clamped to `minHeight`. The window knows the real numbers all along.\n const snapshot: WrWindowLayoutSnapshot[] = this._windows().map(ref => ({\n id: ref.id,\n state: ref.state(),\n x: ref._model.x(),\n y: ref._model.y(),\n width: ref._model.width(),\n height: ref._model.height(),\n title: ref.title(),\n snap: ref._model.snap(),\n }));\n this.storage.set(this.layoutKey(name), snapshot);\n }\n\n /** Read a saved workspace. Returns `null` when no snapshot is found. */\n readLayout(name: string): readonly WrWindowLayoutSnapshot[] | null {\n return this.storage.get(this.layoutKey(name));\n }\n\n /**\n * Apply a saved workspace.\n *\n * Each saved entry is matched to a currently-open window by `id`. For\n * matches, the geometry / state / title is re-applied immediately.\n * For misses, the optional `open` callback is invoked so the consumer\n * can re-open the right component for that id — the freshly-opened\n * window opens straight at the saved geometry and in the saved state, with\n * no cascade flicker — fitted into the work area when this viewport is\n * smaller than the one the layout was saved on.\n *\n * ```ts\n * manager.restoreLayout('default', (id, snap) => {\n * if (id.startsWith('editor:')) {\n * manager.open(EditorComponent, { id, title: snap.title, data: ... });\n * }\n * });\n * ```\n */\n restoreLayout(name: string, open?: (id: string, snapshot: { readonly title: string }) => void): void {\n const snapshot = this.readLayout(name);\n if (!snapshot) return;\n\n for (const snap of snapshot) {\n const existing = this.findById(snap.id);\n if (existing) {\n this.applyRestore(existing, snap);\n continue;\n }\n if (!open) continue;\n // Stash the geometry so the next `open()` call with this id\n // consumes it as the seed instead of cascading.\n this.pendingRestores.set(snap.id, snap);\n open(snap.id, { title: snap.title });\n // Belt + braces: if the opener didn't actually open a window (or\n // opened with a different id), drop the stale pending entry so it\n // doesn't ambush a future open.\n if (!this.findById(snap.id)) this.pendingRestores.delete(snap.id);\n }\n }\n\n private applyRestore(ref: AnyRef, snap: WrWindowLayoutSnapshot): void {\n // Back to a known 'normal' baseline first, then the geometry, the snap and\n // the state, each written once — the toggles would un-minimize a window\n // that was already minimized.\n const m = ref._model;\n m.restore();\n if (snap.title) m.title.set(snap.title);\n m.resizeTo(snap.width, snap.height);\n m.moveTo(snap.x, snap.y);\n if (snap.snap && snap.snap !== 'top') m.snap.set(snap.snap);\n if (snap.state !== 'normal') m.setState(snap.state);\n }\n\n /** Drop a saved workspace. */\n clearLayout(name: string): void {\n this.storage.remove(this.layoutKey(name));\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 { Directionality } from '@angular/cdk/bidi';\nimport { coerceNumberProperty } from '@angular/cdk/coercion';\nimport {\n ChangeDetectionStrategy,\n Component,\n DestroyRef,\n ElementRef,\n ViewEncapsulation,\n afterNextRender,\n afterRenderEffect,\n computed,\n inject,\n input,\n signal,\n viewChild,\n viewChildren,\n} from '@angular/core';\n\nimport { WrDropdown, WrDropdownItem, WrDropdownMenu } from 'ngwr/dropdown';\nimport { useI18nFormatter, useI18nText } from 'ngwr/i18n';\nimport { wrCheckStyles } from 'ngwr/utils';\n\nimport { WrWindowManager } from './services/window-manager';\nimport type { WrWindowTaskbarShow } from './types';\nimport type { WrWindowRef } from './window-ref';\n\ntype AnyRef = WrWindowRef<unknown, unknown>;\n\n/**\n * Stands in for the consumer input `useI18nText` expects — the taskbar exposes no\n * label inputs. Read reactively rather than once at construction: the rail is as\n * long-lived as the app, so a catalog that arrives later, or a locale switch, has to\n * reach it.\n */\nconst NO_OVERRIDE = signal<string | null>(null).asReadonly();\n\nconst NO_RESERVE = { top: 0, bottom: 0 } as const;\n\n/**\n * What the rail has to fit its tabs into, in px: the width inside its padding and\n * border, the gap between two buttons, the width of the \"+N\" button and the width\n * each window's tab takes at its own title, by window id. `null` where nothing is\n * laid out — on the server, in a hidden taskbar, under jsdom — and then only\n * `maxTabs` folds.\n */\ninterface Room {\n readonly width: number;\n readonly gap: number;\n readonly more: number;\n readonly tabs: ReadonlyMap<string, number>;\n}\n\nconst sameTabs = (a: ReadonlyMap<string, number>, b: ReadonlyMap<string, number>): boolean =>\n a.size === b.size && [...a].every(([id, width]) => b.get(id) === width);\n\nconst sameRoom = (a: Room | null, b: Room | null): boolean =>\n a === b || (!!a && !!b && a.width === b.width && a.gap === b.gap && a.more === b.more && sameTabs(a.tabs, b.tabs));\n\n/** `null` and an empty attribute leave the width to decide; any number keeps at least one tab. */\nconst maxTabsAttr = (value: unknown): number | null =>\n value === null || value === undefined || value === ''\n ? null\n : Math.max(1, Math.trunc(coerceNumberProperty(value, 1)));\n\n/**\n * OS-style window taskbar. Drop one anywhere in the app — typically\n * fixed to the bottom of the viewport — and it lists the windows\n * `WrWindowManager.open()` has handed out: the minimized ones by default,\n * every open one with `show=\"all\"`. Clicking a tab switches to its window;\n * with `show=\"all\"`, clicking the active window's tab minimizes it. The close\n * glyph dismisses a window without restoring it.\n *\n * The rail is one Tab stop, a toolbar: the arrow keys move between its\n * buttons, Home and End jump to the ends.\n *\n * Focus follows the window in and out of the rail: minimizing a window\n * that holds focus puts focus on its tab here, and restoring it from the\n * tab moves focus into the window.\n *\n * While it shows tabs, the rail reserves its strip of the viewport, so a\n * maximized or snapped window stops short of it.\n *\n * The rail stays one row. A tab is as wide as its title, up to\n * `--wr-window-taskbar-tab-max-width`, and the tabs that do not fit — or every\n * one past `maxTabs` — fold under a \"+N\" button at the end, which opens them as\n * a menu. In `show=\"all\"` the active window's tab is never folded.\n *\n * Windows opted out via `config.taskbar = false` never show up here.\n *\n * @example\n * ```html\n * <wr-window-taskbar />\n * <wr-window-taskbar position=\"top\" />\n * <wr-window-taskbar show=\"all\" />\n * <wr-window-taskbar show=\"all\" [maxTabs]=\"6\" />\n * ```\n *\n * @see https://ngwr.dev/reference/components/window\n */\n@Component({\n selector: 'wr-window-taskbar',\n templateUrl: './window-taskbar.html',\n imports: [WrDropdown, WrDropdownMenu, WrDropdownItem],\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n host: {\n class: 'wr-window-taskbar',\n '[class]': 'classes()',\n role: 'toolbar',\n '[attr.aria-label]': 'railLabel()',\n '(keydown)': 'onKeydown($event)',\n '(focusin)': 'onFocusIn($event)',\n },\n})\nexport class WrWindowTaskbar {\n // Four English literals lived in this component's markup, next to a catalog that\n // already carried `window.close`. A `toolbar` with no name and tabs announced in\n // the wrong language are both invisible on screen.\n private readonly minimizedLabel = useI18nText(NO_OVERRIDE, 'window.taskbar', 'Minimized windows');\n private readonly allLabel = useI18nText(NO_OVERRIDE, 'window.taskbarAll', 'Open windows');\n /** @internal */ protected readonly closeLabel = useI18nText(NO_OVERRIDE, 'window.closeWindow', 'Close window');\n /** @internal */ protected readonly untitled = useI18nText(NO_OVERRIDE, 'window.untitled', 'Untitled');\n /** @internal */ protected readonly restoreLabel = useI18nFormatter('window.restoreWindow', 'Restore {{title}}');\n /** @internal */ protected readonly moreLabel = useI18nFormatter('window.taskbarMore', 'More windows: {{count}}');\n\n /** Edge the taskbar pins itself to. @default 'bottom' */\n readonly position = input<'top' | 'bottom'>('bottom');\n\n /**\n * Which windows the rail lists: the minimized ones, or every open one with\n * the active window marked (since v15.1). @default 'minimized'\n */\n readonly show = input<WrWindowTaskbarShow>('minimized');\n\n /**\n * The most tabs the rail shows; the rest fold under a \"+N\" button that opens\n * them as a menu (since v15.1). The width folds tabs too, whatever this says:\n * the tabs that do not fit beside the button at their own width go under it.\n * `null` leaves it to the width alone.\n * @default null\n */\n readonly maxTabs = input<number | null, unknown>(null, { transform: maxTabsAttr });\n\n private readonly manager = inject(WrWindowManager);\n private readonly host = inject<ElementRef<HTMLElement>>(ElementRef).nativeElement;\n private readonly dir = inject(Directionality, { optional: true });\n\n /** @internal */ protected readonly railLabel = computed(() =>\n this.show() === 'all' ? this.allLabel() : this.minimizedLabel()\n );\n\n /** @internal — the windows the rail lists, in the order they opened. */\n protected readonly items = computed(() =>\n this.show() === 'all' ? this.manager.windows().filter(w => w.taskbarVisible) : this.manager.minimized()\n );\n\n /** What the rail has to fit its tabs into — see {@link Room}. */\n private readonly room = signal<Room | null>(null, { equal: sameRoom });\n\n /**\n * The tabs the rail draws, in opening order: all of them while they fit and\n * `maxTabs` allows it, otherwise the most that fit beside the \"+N\" button,\n * never more than `maxTabs` and never fewer than one. The active window's tab\n * takes the last place when it would otherwise fold, so the one tab\n * `show=\"all\"` marks is always in reach. A tab not measured yet counts as\n * nothing, and the pass after its first render corrects that.\n */\n protected readonly visible = computed(() => {\n const items = this.items();\n const max = this.maxTabs() ?? Infinity;\n const room = this.room();\n const fits = (shown: readonly AnyRef[], more: boolean): boolean => {\n if (room === null) return true;\n let need = Math.max(0, shown.length - 1) * room.gap + (more ? room.gap + room.more : 0);\n for (const ref of shown) need += room.tabs.get(ref.id) ?? 0;\n // No slack beyond float noise: a row the rail accepts must not overflow,\n // or its tabs squeeze and read differently the next pass.\n return need <= room.width + 0.01;\n };\n if (items.length <= max && fits(items, false)) return items;\n const current = items.find(ref => this.isCurrent(ref));\n const first = (count: number): AnyRef[] => {\n const shown = items.slice(0, count);\n if (current && !shown.includes(current)) shown[count - 1] = current;\n return shown;\n };\n for (let count = Math.min(max, items.length - 1); count > 1; count--) {\n const shown = first(count);\n if (fits(shown, true)) return shown;\n }\n return first(1);\n });\n\n /** @internal — each listed window's place among the drawn tabs, absent while it is folded. */\n protected readonly slots = computed(() => new Map(this.visible().map((ref, index) => [ref, index])));\n\n /** @internal — the windows under the \"+N\" button, in opening order. */\n protected readonly folded = computed(() => {\n const visible = this.visible();\n return this.items().filter(ref => !visible.includes(ref));\n });\n\n /** The \"+N\" menu opens away from the edge the rail is pinned to. */\n protected readonly menuPosition = computed(() => (this.position() === 'top' ? 'bottom-end' : 'top-end'));\n\n protected readonly classes = computed(() => `wr-window-taskbar--${this.position()}`);\n\n /**\n * One row per entry of `items()`, in the same order. A folded window keeps its\n * tab, laid out but hidden, which is how the rail knows its width.\n */\n private readonly tabs = viewChildren<ElementRef<HTMLElement>>('tab');\n private readonly more = viewChild<ElementRef<HTMLButtonElement>>('more');\n\n /**\n * The rail's one Tab stop, as an index into its buttons: two per drawn tab,\n * restore then close, and the \"+N\" button last.\n */\n private readonly rovingIndex = signal(0);\n private readonly stop = computed(() => {\n const buttons = this.visible().length * 2 + (this.folded().length > 0 ? 1 : 0);\n return Math.max(0, Math.min(this.rovingIndex(), buttons - 1));\n });\n\n /** The strip of the viewport the rail covers while it shows tabs. */\n private readonly reserve = signal<{ readonly top: number; readonly bottom: number }>(NO_RESERVE, {\n equal: (a, b) => a.top === b.top && a.bottom === b.bottom,\n });\n\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('window');\n // So a window minimized with focus inside can hand it to its tab here, a\n // window closed from its tab knows the focus there was its own, and a\n // maximized window stops short of the rail.\n const unregister = this.manager._registerTaskbar({\n // A folded window's place in the rail is the \"+N\" button it sits under.\n tabFor: ref => {\n if (this.folded().includes(ref)) return this.more()?.nativeElement ?? null;\n const index = this.items().indexOf(ref);\n return index >= 0 ? (this.tabs()[index]?.nativeElement ?? null) : null;\n },\n settling: ref => {\n const room = this.room();\n const index = this.items().indexOf(ref);\n if (room === null || index < 0) return false;\n if (!room.tabs.has(ref.id)) return true;\n if (this.folded().includes(ref)) return !this.more();\n return !!this.tabs()[index]?.nativeElement.classList.contains('wr-window-taskbar__tab--folded');\n },\n contains: node => this.host.contains(node),\n reserve: this.reserve.asReadonly(),\n });\n const destroyRef = inject(DestroyRef);\n destroyRef.onDestroy(unregister);\n\n // After the render that adds or removes the rail or a tab, retitles a tab\n // or moves the rail to the other edge — and again whenever the host, the\n // rail or the viewport changes size, which is also how a late web font\n // reaches the widths.\n let observer: ResizeObserver | null = null;\n let observedRail: HTMLElement | null = null;\n afterRenderEffect(() => {\n for (const ref of this.items()) this.tabTitle(ref);\n void this.folded().length;\n this.position();\n const rail = this.host.querySelector<HTMLElement>('.wr-window-taskbar__rail');\n if (observer && rail !== observedRail) {\n if (observedRail) observer.unobserve(observedRail);\n if (rail) observer.observe(rail);\n }\n observedRail = rail;\n this.measure();\n });\n afterNextRender(() => {\n const measure = (): void => this.measure();\n observer = typeof ResizeObserver === 'undefined' ? null : new ResizeObserver(measure);\n observer?.observe(this.host);\n if (observedRail) observer?.observe(observedRail);\n window.addEventListener('resize', measure, { passive: true });\n destroyRef.onDestroy(() => {\n observer?.disconnect();\n window.removeEventListener('resize', measure);\n });\n });\n }\n\n /** A window with no title still needs a name in the rail. */\n protected tabTitle(ref: AnyRef): string {\n return ref.title() || this.untitled();\n }\n\n /** Whether `ref` is the active window and on screen — what `show=\"all\"` marks. */\n protected isCurrent(ref: AnyRef): boolean {\n return ref.isActive() && ref.state() !== 'minimized';\n }\n\n /** A minimized window's tab restores it; in `show=\"all\"` the others' tabs switch to their window. */\n protected tabLabel(ref: AnyRef): string {\n const title = this.tabTitle(ref);\n return this.show() === 'all' && ref.state() !== 'minimized' ? title : this.restoreLabel({ title });\n }\n\n protected tabIndex(button: number): number {\n return button >= 0 && button === this.stop() ? 0 : -1;\n }\n\n protected press(ref: AnyRef): void {\n // The active window's own tab minimizes it, as on every desktop taskbar.\n // Focus is on this tab, not in the window, so it stays here.\n if (this.show() === 'all' && this.isCurrent(ref)) {\n ref.minimize();\n return;\n }\n // Back from the taskbar in the state it was minimized from, raised, and\n // focused on the control it had last — the tab this was pressed on may be\n // about to leave the rail, which would drop focus on `<body>`.\n ref.activate();\n }\n\n /** A window picked from the \"+N\" menu: the menu closes and the window comes forward, as from its tab. */\n protected pick(ref: AnyRef, menu: WrDropdown): void {\n menu.close();\n this.press(ref);\n }\n\n protected close(ref: AnyRef, event: Event): void {\n event.stopPropagation();\n void ref.close();\n }\n\n /** The toolbar pattern: arrows between buttons, Home and End to the ends, mirrored in RTL. */\n protected onKeydown(event: KeyboardEvent): void {\n const buttons = this.buttons();\n if (buttons.length === 0) return;\n const current = buttons.indexOf(event.target as HTMLButtonElement);\n if (current < 0) return;\n const rtl = this.dir?.value === 'rtl';\n let next: number;\n switch (event.key) {\n case 'ArrowRight':\n next = current + (rtl ? -1 : 1);\n break;\n case 'ArrowLeft':\n next = current + (rtl ? 1 : -1);\n break;\n case 'Home':\n next = 0;\n break;\n case 'End':\n next = buttons.length - 1;\n break;\n default:\n return;\n }\n event.preventDefault();\n next = (next + buttons.length) % buttons.length;\n this.rovingIndex.set(next);\n buttons[next].focus();\n }\n\n /** A click or a script that focuses a button moves the Tab stop with it. */\n protected onFocusIn(event: FocusEvent): void {\n const index = this.buttons().indexOf(event.target as HTMLButtonElement);\n if (index >= 0) this.rovingIndex.set(index);\n }\n\n /** The drawn buttons in order — a folded tab's are hidden and out of the toolbar. */\n private buttons(): HTMLButtonElement[] {\n return [\n ...this.host.querySelectorAll<HTMLButtonElement>(\n '.wr-window-taskbar__tab:not(.wr-window-taskbar__tab--folded) button, .wr-window-taskbar__more'\n ),\n ];\n }\n\n private measure(): void {\n if (typeof window === 'undefined') return;\n this.measureRoom();\n const rect = this.host.getBoundingClientRect();\n if (rect.height <= 0) {\n this.reserve.set(NO_RESERVE);\n return;\n }\n const vh = document.documentElement.clientHeight || window.innerHeight;\n this.reserve.set(\n this.position() === 'top'\n ? { top: Math.ceil(rect.bottom), bottom: 0 }\n : { top: 0, bottom: Math.max(0, Math.ceil(vh - rect.top)) }\n );\n }\n\n /**\n * Read what the rail has to fit into. The host spans the viewport between its\n * insets, so its width is the most the rail can take, and the gap comes from\n * the stylesheet, so a consumer's hook is what the arithmetic uses.\n *\n * A tab's width is the one its title asks for, capped by its `max-width`. Every\n * tab is laid out, a folded one too, so each can be read — and a tab drawn\n * narrower than its title, squeezed as the only one left, is as wide as it is\n * plus the part of the title it clips. That keeps the reading the same however\n * the row is drawn, so a pass never feeds the next one a different answer.\n *\n * The \"+N\" button is measured once it is drawn — until then a tab's height\n * stands in for its width, and the next pass corrects it. That converges: a\n * wider button folds more, which can only keep its count's digits or add one.\n */\n private measureRoom(): void {\n const rail = this.host.querySelector<HTMLElement>('.wr-window-taskbar__rail');\n const items = this.items();\n const tabs = this.tabs().map(tab => tab.nativeElement);\n const width = this.host.clientWidth;\n if (!rail || tabs.length === 0 || width <= 0) {\n this.room.set(null);\n return;\n }\n // A render is on its way that will draw the tabs `items()` lists; measure that one.\n if (tabs.length !== items.length) return;\n const railStyle = getComputedStyle(rail);\n const px = (value: string): number => parseFloat(value) || 0;\n const inner =\n width -\n px(railStyle.paddingInlineStart) -\n px(railStyle.paddingInlineEnd) -\n px(railStyle.borderInlineStartWidth) -\n px(railStyle.borderInlineEndWidth);\n const widths = new Map<string, number>();\n tabs.forEach((tab, index) => {\n const width = tab.getBoundingClientRect().width;\n const cap = getComputedStyle(tab).maxWidth;\n // A cap that depends on the box it sits in — a percentage, a calc() with\n // one — resolves against the rail for a drawn tab and the host for a folded\n // one, so there is no width of the tab's own to recover: take it as drawn.\n const fixed = cap.endsWith('px');\n if (!fixed && cap !== 'none' && cap !== '') {\n widths.set(items[index].id, width);\n return;\n }\n // Scroll and client widths are whole pixels, so a clip of one is rounding,\n // not a title the tab is too narrow for.\n const title = tab.querySelector<HTMLElement>('.wr-window-taskbar__tab-title');\n const clipped = title ? title.scrollWidth - title.clientWidth : 0;\n const natural = width + (clipped > 1 ? clipped : 0);\n widths.set(items[index].id, fixed ? Math.min(natural, parseFloat(cap)) : natural);\n });\n const more = this.more()?.nativeElement.getBoundingClientRect().width ?? tabs[0].getBoundingClientRect().height;\n this.room.set({ width: inner, gap: px(railStyle.columnGap), more, tabs: widths });\n }\n}\n","@if (items().length > 0) {\n <div class=\"wr-window-taskbar__rail\">\n @for (ref of items(); track ref.id) {\n @let slot = slots().get(ref) ?? -1;\n <!--\n Two SIBLING buttons in a plain container, not a close button nested\n inside the tab. The close used to be a `role=\"button\"` span with\n `tabindex=\"0\"` inside the tab's own `<button>` — interactive content\n inside interactive content, which the HTML parser and `nested-interactive`\n both object to. Nothing caught it: a taskbar tab exists only while a\n window is minimized, and the a11y sweep reads prerendered HTML, where the\n rail is not rendered at all.\n -->\n <!--\n A folded window keeps its tab, hidden and out of the row but laid out,\n so the rail can read the width it would take to draw it again.\n -->\n <div\n #tab\n class=\"wr-window-taskbar__tab\"\n [class.wr-window-taskbar__tab--active]=\"isCurrent(ref)\"\n [class.wr-window-taskbar__tab--minimized]=\"ref.state() === 'minimized'\"\n [class.wr-window-taskbar__tab--folded]=\"slot < 0\"\n [attr.inert]=\"slot < 0 ? '' : null\"\n >\n <button\n type=\"button\"\n class=\"wr-window-taskbar__tab-restore\"\n [attr.aria-label]=\"tabLabel(ref)\"\n [attr.aria-pressed]=\"show() === 'all' ? isCurrent(ref) : null\"\n [attr.tabindex]=\"tabIndex(slot < 0 ? -1 : slot * 2)\"\n (click)=\"press(ref)\"\n >\n <span class=\"wr-window-taskbar__tab-title\">{{ tabTitle(ref) }}</span>\n </button>\n <button\n type=\"button\"\n class=\"wr-window-taskbar__tab-close\"\n [attr.aria-label]=\"closeLabel()\"\n [attr.tabindex]=\"tabIndex(slot < 0 ? -1 : slot * 2 + 1)\"\n (click)=\"close(ref, $event)\"\n >\n <svg width=\"9\" height=\"9\" viewBox=\"0 0 10 10\" aria-hidden=\"true\">\n <path d=\"M1 1 L9 9 M9 1 L1 9\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" />\n </svg>\n </button>\n </div>\n }\n @if (folded().length > 0) {\n <button\n #more\n #fold=\"wrDropdown\"\n type=\"button\"\n class=\"wr-window-taskbar__more\"\n [wrDropdown]=\"foldMenu\"\n [position]=\"menuPosition()\"\n [attr.aria-label]=\"moreLabel({ count: folded().length })\"\n [attr.tabindex]=\"tabIndex(visible().length * 2)\"\n >\n +{{ folded().length }}\n </button>\n <wr-dropdown-menu #foldMenu>\n @for (ref of folded(); track ref.id) {\n <wr-dropdown-item\n class=\"wr-window-taskbar__fold-item\"\n [class.wr-window-taskbar__fold-item--minimized]=\"ref.state() === 'minimized'\"\n [attr.aria-label]=\"tabLabel(ref)\"\n (click)=\"pick(ref, fold)\"\n >\n {{ tabTitle(ref) }}\n </wr-dropdown-item>\n }\n </wr-dropdown-menu>\n }\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 { type WrFeature, wrFeature } from 'ngwr/utils';\n\nimport { WR_WINDOW_DEFAULTS } from './tokens';\nimport type { WrWindowDefaults } from './types';\n\n/**\n * App-wide window defaults, as a feature of `provideWr()` — today the work area\n * every window keeps inside, so maximized windows stop short of an app header.\n * A window's own `WrWindowConfig.bounds` still wins.\n *\n * Bootstrap only: `WrWindowManager` is root-provided and reads it once, from\n * the root injector, so in a route's `providers` it changes nothing.\n *\n * @example\n * ```ts\n * import { provideWr } from 'ngwr';\n * import { withWindows } from 'ngwr/window';\n *\n * bootstrapApplication(App, {\n * providers: [provideWr(withWindows({ bounds: { top: 64 } }))],\n * });\n * ```\n */\nexport function withWindows(defaults: WrWindowDefaults): WrFeature<'windows'> {\n return wrFeature('windows', [{ provide: WR_WINDOW_DEFAULTS, useValue: defaults }]);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAaA,MAAa,gBAAgB,IAAI,eAA8C,eAAe;AAG9F,MAAa,iBAAiB,IAAI,eAAwB,gBAAgB;AAG1E,MAAa,qBAAqB,IAAI,eAAiC,oBAAoB;AChB3F,SAAgB,WAAW,KAA0B;CAEnD,OAAO,aADQ,IAAI,SAAS,GAAG,IAAI,OAAM,KAAM,KAClB,IAAI;AACnC;;;;;;;ACkCA,MAAMA,gBAAc,OAAsB,IAAI,CAAC,CAAC,WAAU;AAS1D,SAAS,WAAQ;CACf,IAAI,OAAO,WAAW,eAAe,OAAO,cAAc,aAAa,OAAO;CAM9E,MAAM,YAAY;EAJF,UAAmE,eAGvD;EAAU,UAAU;EAAU,UAAU;CAClD,CAAA,CAAW,MAAK,MAAK,CAAC,CAAC,CAAC,KAAK,GAAA,CAAI,YAAW;CAC9D,IACE,SAAS,SAAS,KAAK,KACvB,SAAS,SAAS,QAAQ,KAC1B,SAAS,SAAS,QAAQ,KAC1B,SAAS,SAAS,MAAM,GAExB,OAAO;CAET,IAAI,SAAS,SAAS,OAAO,KAAK,SAAS,SAAS,KAAK,KAAK,SAAS,SAAS,MAAM,GAAG,OAAO;CAChG,OAAO;AACT;AAEA,MAAM,cAAc,SAAQ;AAG5B,MAAM,gBAAgB;AAGtB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