@nanahoshi/mona-ui 0.27.1 → 0.28.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 (359) hide show
  1. package/docs/api/auto-complete.md +67 -0
  2. package/docs/api/avatar.md +31 -0
  3. package/docs/api/breadcrumb.md +74 -0
  4. package/docs/api/button-group.md +71 -0
  5. package/docs/api/button.md +84 -0
  6. package/docs/api/calendar.md +123 -0
  7. package/docs/api/card.md +97 -0
  8. package/docs/api/chart.md +4380 -0
  9. package/docs/api/check-box.md +70 -0
  10. package/docs/api/chip.md +55 -0
  11. package/docs/api/circular-progress-bar.md +71 -0
  12. package/docs/api/collapsible.md +71 -0
  13. package/docs/api/color-gradient.md +54 -0
  14. package/docs/api/color-palette.md +52 -0
  15. package/docs/api/color-picker.md +89 -0
  16. package/docs/api/combo-box.md +69 -0
  17. package/docs/api/command.md +282 -0
  18. package/docs/api/common.md +599 -0
  19. package/docs/api/contextmenu.md +239 -0
  20. package/docs/api/date-input.md +119 -0
  21. package/docs/api/date-picker.md +67 -0
  22. package/docs/api/datetime-picker.md +72 -0
  23. package/docs/api/dialog.md +291 -0
  24. package/docs/api/dropdown-button.md +248 -0
  25. package/docs/api/dropdown-list.md +72 -0
  26. package/docs/api/dropdowns.md +172 -0
  27. package/docs/api/editor.md +117 -0
  28. package/docs/api/expansion-panel.md +85 -0
  29. package/docs/api/fieldset.md +33 -0
  30. package/docs/api/filter.md +116 -0
  31. package/docs/api/grid.md +1445 -0
  32. package/docs/api/i18n.md +1699 -0
  33. package/docs/api/label.md +58 -0
  34. package/docs/api/list-box.md +301 -0
  35. package/docs/api/list-view.md +294 -0
  36. package/docs/api/list.md +119 -0
  37. package/docs/api/locales.md +134 -0
  38. package/docs/api/menubar.md +275 -0
  39. package/docs/api/multi-select.md +92 -0
  40. package/docs/api/notification.md +164 -0
  41. package/docs/api/numeric-text-box.md +130 -0
  42. package/docs/api/otp-input.md +100 -0
  43. package/docs/api/pager.md +371 -0
  44. package/docs/api/placeholder.md +18 -0
  45. package/docs/api/popover.md +170 -0
  46. package/docs/api/popup-menu.md +328 -0
  47. package/docs/api/popup.md +299 -0
  48. package/docs/api/progress-bar.md +79 -0
  49. package/docs/api/query.md +367 -0
  50. package/docs/api/radio-button.md +113 -0
  51. package/docs/api/rating.md +187 -0
  52. package/docs/api/scroll-view.md +93 -0
  53. package/docs/api/segmented.md +114 -0
  54. package/docs/api/sheet.md +65 -0
  55. package/docs/api/sidebar.md +583 -0
  56. package/docs/api/skeleton.md +26 -0
  57. package/docs/api/slider.md +173 -0
  58. package/docs/api/spinner.md +132 -0
  59. package/docs/api/split-button.md +261 -0
  60. package/docs/api/splitter.md +57 -0
  61. package/docs/api/stepper.md +148 -0
  62. package/docs/api/switch.md +78 -0
  63. package/docs/api/tabs.md +139 -0
  64. package/docs/api/text-area.md +20 -0
  65. package/docs/api/text-box.md +106 -0
  66. package/docs/api/theme.md +627 -0
  67. package/docs/api/time-picker.md +69 -0
  68. package/docs/api/time-selector.md +54 -0
  69. package/docs/api/tooltip.md +112 -0
  70. package/docs/api/tree-view.md +631 -0
  71. package/docs/api/window.md +245 -0
  72. package/docs/auto-complete.md +28 -329
  73. package/docs/avatar.md +4 -24
  74. package/docs/breadcrumb.md +10 -65
  75. package/docs/button-group.md +7 -60
  76. package/docs/button.md +8 -67
  77. package/docs/calendar.md +16 -121
  78. package/docs/card.md +16 -79
  79. package/docs/chart-bar.md +16 -234
  80. package/docs/chart-financial.md +10 -121
  81. package/docs/chart-funnel.md +13 -176
  82. package/docs/chart-heatmap.md +15 -131
  83. package/docs/chart-line-area.md +12 -137
  84. package/docs/chart-pie.md +17 -221
  85. package/docs/chart-radar.md +13 -129
  86. package/docs/chart-radial.md +13 -211
  87. package/docs/chart-scatter.md +6 -74
  88. package/docs/chart-treemap.md +14 -196
  89. package/docs/chart.md +168 -1892
  90. package/docs/checkbox.md +5 -61
  91. package/docs/chip.md +7 -42
  92. package/docs/circular-progress-bar.md +9 -61
  93. package/docs/collapsible.md +5 -87
  94. package/docs/color-gradient.md +8 -81
  95. package/docs/color-palette.md +7 -69
  96. package/docs/color-picker.md +9 -105
  97. package/docs/combo-box.md +28 -331
  98. package/docs/command.md +25 -236
  99. package/docs/contextmenu.md +15 -140
  100. package/docs/date-picker.md +7 -110
  101. package/docs/datetime-picker.md +7 -129
  102. package/docs/decimal-textbox.md +6 -69
  103. package/docs/dialog.md +23 -263
  104. package/docs/dropdown-button.md +15 -146
  105. package/docs/dropdown-list.md +29 -332
  106. package/docs/editor.md +10 -164
  107. package/docs/expansion-panel.md +7 -69
  108. package/docs/fieldset.md +5 -24
  109. package/docs/grid-columns.md +12 -92
  110. package/docs/grid-editing.md +29 -291
  111. package/docs/grid-grouping.md +11 -50
  112. package/docs/grid-rows.md +10 -74
  113. package/docs/grid-selection.md +7 -36
  114. package/docs/grid-server.md +8 -293
  115. package/docs/grid-sorting-filtering.md +10 -333
  116. package/docs/grid-state-export.md +17 -228
  117. package/docs/grid.md +23 -216
  118. package/docs/input.md +7 -19
  119. package/docs/installation.md +147 -15
  120. package/docs/introduction.md +37 -15
  121. package/docs/label.md +8 -39
  122. package/docs/list-box.md +21 -253
  123. package/docs/list-view.md +25 -232
  124. package/docs/menubar.md +21 -167
  125. package/docs/multi-select.md +31 -350
  126. package/docs/notification.md +17 -116
  127. package/docs/numeric-textbox.md +9 -78
  128. package/docs/otp-input.md +9 -95
  129. package/docs/pager.md +19 -239
  130. package/docs/placeholder.md +5 -18
  131. package/docs/popover.md +13 -123
  132. package/docs/popup-menu.md +22 -243
  133. package/docs/popup.md +24 -248
  134. package/docs/progress-bar.md +10 -75
  135. package/docs/radio-button.md +8 -96
  136. package/docs/range-slider.md +9 -82
  137. package/docs/rating.md +15 -163
  138. package/docs/scroll-view.md +9 -86
  139. package/docs/segmented.md +8 -90
  140. package/docs/sheet.md +10 -74
  141. package/docs/sidebar-menus.md +20 -155
  142. package/docs/sidebar-state.md +16 -134
  143. package/docs/sidebar.md +18 -218
  144. package/docs/skeleton.md +5 -26
  145. package/docs/slider.md +9 -97
  146. package/docs/spinner.md +15 -95
  147. package/docs/split-button.md +21 -166
  148. package/docs/splitter.md +9 -56
  149. package/docs/stepper.md +13 -127
  150. package/docs/switch.md +8 -58
  151. package/docs/tabs.md +13 -111
  152. package/docs/textarea.md +4 -13
  153. package/docs/textbox.md +10 -77
  154. package/docs/theming-built-in-themes.md +67 -0
  155. package/docs/theming-custom-colors.md +274 -0
  156. package/docs/theming-custom-themes.md +168 -0
  157. package/docs/theming.md +164 -248
  158. package/docs/time-picker.md +7 -112
  159. package/docs/tooltip-directive.md +12 -96
  160. package/docs/tooltip.md +12 -96
  161. package/docs/tree-view.md +42 -495
  162. package/docs/window.md +19 -230
  163. package/fesm2022/nanahoshi-mona-ui-auto-complete.mjs +1089 -603
  164. package/fesm2022/nanahoshi-mona-ui-avatar.mjs +369 -184
  165. package/fesm2022/nanahoshi-mona-ui-breadcrumb.mjs +658 -371
  166. package/fesm2022/nanahoshi-mona-ui-button-group.mjs +513 -359
  167. package/fesm2022/nanahoshi-mona-ui-button.mjs +622 -517
  168. package/fesm2022/nanahoshi-mona-ui-calendar.mjs +2070 -1573
  169. package/fesm2022/nanahoshi-mona-ui-card.mjs +620 -316
  170. package/fesm2022/nanahoshi-mona-ui-chart.mjs +61151 -64921
  171. package/fesm2022/nanahoshi-mona-ui-check-box.mjs +646 -317
  172. package/fesm2022/nanahoshi-mona-ui-chip.mjs +737 -516
  173. package/fesm2022/nanahoshi-mona-ui-circular-progress-bar.mjs +441 -242
  174. package/fesm2022/nanahoshi-mona-ui-collapsible.mjs +443 -389
  175. package/fesm2022/nanahoshi-mona-ui-color-gradient.mjs +1138 -814
  176. package/fesm2022/nanahoshi-mona-ui-color-palette.mjs +1114 -959
  177. package/fesm2022/nanahoshi-mona-ui-color-picker.mjs +858 -504
  178. package/fesm2022/nanahoshi-mona-ui-combo-box.mjs +1181 -742
  179. package/fesm2022/nanahoshi-mona-ui-command.mjs +1454 -853
  180. package/fesm2022/nanahoshi-mona-ui-common.mjs +569 -740
  181. package/fesm2022/nanahoshi-mona-ui-contextmenu.mjs +978 -532
  182. package/fesm2022/nanahoshi-mona-ui-date-input.mjs +283 -254
  183. package/fesm2022/nanahoshi-mona-ui-date-picker.mjs +973 -451
  184. package/fesm2022/nanahoshi-mona-ui-datetime-picker.mjs +1203 -658
  185. package/fesm2022/nanahoshi-mona-ui-dialog.mjs +1415 -936
  186. package/fesm2022/nanahoshi-mona-ui-dropdown-button.mjs +1165 -568
  187. package/fesm2022/nanahoshi-mona-ui-dropdown-list.mjs +1142 -677
  188. package/fesm2022/nanahoshi-mona-ui-dropdowns.mjs +1018 -729
  189. package/fesm2022/nanahoshi-mona-ui-editor.mjs +3589 -2122
  190. package/fesm2022/nanahoshi-mona-ui-expansion-panel.mjs +577 -359
  191. package/fesm2022/nanahoshi-mona-ui-fieldset.mjs +311 -151
  192. package/fesm2022/nanahoshi-mona-ui-filter.mjs +1086 -718
  193. package/fesm2022/nanahoshi-mona-ui-grid-grid-colgroup.component-NhONCVIX.mjs +77 -0
  194. package/fesm2022/nanahoshi-mona-ui-grid-grid-footer-row.component-Djv8ZnT5.mjs +480 -0
  195. package/fesm2022/nanahoshi-mona-ui-grid-grid-list.component-WbXAzGCa.mjs +470 -0
  196. package/fesm2022/nanahoshi-mona-ui-grid-grid-row.component-DkWTD3pN.mjs +2115 -0
  197. package/fesm2022/nanahoshi-mona-ui-grid-grid-virtual-list.component-DAHqTwBJ.mjs +330 -0
  198. package/fesm2022/nanahoshi-mona-ui-grid-grid.styles-BmLU-3zP.mjs +3766 -0
  199. package/fesm2022/nanahoshi-mona-ui-grid.mjs +5418 -2
  200. package/fesm2022/nanahoshi-mona-ui-i18n-icu.mjs +1379 -1079
  201. package/fesm2022/nanahoshi-mona-ui-i18n.mjs +4451 -5068
  202. package/fesm2022/nanahoshi-mona-ui-internal-filter-input.mjs +344 -143
  203. package/fesm2022/nanahoshi-mona-ui-internal-indicator-icon.mjs +257 -127
  204. package/fesm2022/nanahoshi-mona-ui-internal-list.mjs +2080 -1829
  205. package/fesm2022/nanahoshi-mona-ui-internal-popup-menu.mjs +103 -141
  206. package/fesm2022/nanahoshi-mona-ui-internal-tree.mjs +2498 -2706
  207. package/fesm2022/nanahoshi-mona-ui-internal.mjs +722 -1007
  208. package/fesm2022/nanahoshi-mona-ui-label.mjs +313 -202
  209. package/fesm2022/nanahoshi-mona-ui-list-box.mjs +1308 -1009
  210. package/fesm2022/nanahoshi-mona-ui-list-view.mjs +1411 -677
  211. package/fesm2022/nanahoshi-mona-ui-list.mjs +1 -6
  212. package/fesm2022/nanahoshi-mona-ui-locales-ar-sa.mjs +556 -577
  213. package/fesm2022/nanahoshi-mona-ui-locales-de-de.mjs +530 -573
  214. package/fesm2022/nanahoshi-mona-ui-locales-es-es.mjs +530 -573
  215. package/fesm2022/nanahoshi-mona-ui-locales-fr-fr.mjs +533 -576
  216. package/fesm2022/nanahoshi-mona-ui-locales-id-id.mjs +520 -555
  217. package/fesm2022/nanahoshi-mona-ui-locales-it-it.mjs +530 -571
  218. package/fesm2022/nanahoshi-mona-ui-locales-ja-jp.mjs +520 -555
  219. package/fesm2022/nanahoshi-mona-ui-locales-ko-kr.mjs +520 -555
  220. package/fesm2022/nanahoshi-mona-ui-locales-pt-br.mjs +530 -571
  221. package/fesm2022/nanahoshi-mona-ui-locales-ru-ru.mjs +576 -591
  222. package/fesm2022/nanahoshi-mona-ui-locales-tr-tr.mjs +530 -565
  223. package/fesm2022/nanahoshi-mona-ui-locales-zh-cn.mjs +520 -555
  224. package/fesm2022/nanahoshi-mona-ui-locales-zh-tw.mjs +520 -555
  225. package/fesm2022/nanahoshi-mona-ui-locales.mjs +59 -77
  226. package/fesm2022/nanahoshi-mona-ui-menubar.mjs +1411 -829
  227. package/fesm2022/nanahoshi-mona-ui-multi-select.mjs +1326 -702
  228. package/fesm2022/nanahoshi-mona-ui-notification.mjs +763 -675
  229. package/fesm2022/nanahoshi-mona-ui-numeric-text-box.mjs +1306 -826
  230. package/fesm2022/nanahoshi-mona-ui-otp-input.mjs +1122 -897
  231. package/fesm2022/nanahoshi-mona-ui-pager.mjs +1110 -651
  232. package/fesm2022/nanahoshi-mona-ui-placeholder.mjs +95 -53
  233. package/fesm2022/nanahoshi-mona-ui-popover.mjs +559 -397
  234. package/fesm2022/nanahoshi-mona-ui-popup-menu.mjs +2323 -1694
  235. package/fesm2022/nanahoshi-mona-ui-popup.mjs +1657 -1455
  236. package/fesm2022/nanahoshi-mona-ui-progress-bar.mjs +441 -267
  237. package/fesm2022/nanahoshi-mona-ui-query.mjs +211 -340
  238. package/fesm2022/nanahoshi-mona-ui-radio-button.mjs +1017 -548
  239. package/fesm2022/nanahoshi-mona-ui-rating.mjs +874 -624
  240. package/fesm2022/nanahoshi-mona-ui-scroll-view.mjs +1130 -917
  241. package/fesm2022/nanahoshi-mona-ui-segmented.mjs +705 -455
  242. package/fesm2022/nanahoshi-mona-ui-sheet.mjs +461 -283
  243. package/fesm2022/nanahoshi-mona-ui-sidebar.mjs +2791 -2449
  244. package/fesm2022/nanahoshi-mona-ui-skeleton.mjs +145 -90
  245. package/fesm2022/nanahoshi-mona-ui-slider.mjs +1563 -1103
  246. package/fesm2022/nanahoshi-mona-ui-spinner.mjs +738 -673
  247. package/fesm2022/nanahoshi-mona-ui-split-button.mjs +1287 -647
  248. package/fesm2022/nanahoshi-mona-ui-splitter.mjs +1313 -909
  249. package/fesm2022/nanahoshi-mona-ui-stepper.mjs +761 -540
  250. package/fesm2022/nanahoshi-mona-ui-switch.mjs +611 -280
  251. package/fesm2022/nanahoshi-mona-ui-tabs.mjs +1393 -841
  252. package/fesm2022/nanahoshi-mona-ui-text-area.mjs +142 -73
  253. package/fesm2022/nanahoshi-mona-ui-text-box.mjs +876 -374
  254. package/fesm2022/nanahoshi-mona-ui-theme.mjs +1465 -1449
  255. package/fesm2022/nanahoshi-mona-ui-time-picker.mjs +897 -443
  256. package/fesm2022/nanahoshi-mona-ui-time-selector.mjs +1100 -703
  257. package/fesm2022/nanahoshi-mona-ui-tooltip.mjs +789 -538
  258. package/fesm2022/nanahoshi-mona-ui-tree-view.mjs +1361 -805
  259. package/fesm2022/nanahoshi-mona-ui-window.mjs +2145 -1531
  260. package/fesm2022/nanahoshi-mona-ui.mjs +1 -8
  261. package/llms.txt +80 -2
  262. package/package.json +62 -23
  263. package/types/nanahoshi-mona-ui-auto-complete.d.ts +367 -233
  264. package/types/nanahoshi-mona-ui-avatar.d.ts +722 -649
  265. package/types/nanahoshi-mona-ui-breadcrumb.d.ts +134 -103
  266. package/types/nanahoshi-mona-ui-button-group.d.ts +213 -152
  267. package/types/nanahoshi-mona-ui-button.d.ts +227 -166
  268. package/types/nanahoshi-mona-ui-calendar.d.ts +324 -259
  269. package/types/nanahoshi-mona-ui-card.d.ts +125 -111
  270. package/types/nanahoshi-mona-ui-chart.d.ts +10483 -7326
  271. package/types/nanahoshi-mona-ui-check-box.d.ts +293 -180
  272. package/types/nanahoshi-mona-ui-chip.d.ts +208 -141
  273. package/types/nanahoshi-mona-ui-circular-progress-bar.d.ts +194 -133
  274. package/types/nanahoshi-mona-ui-collapsible.d.ts +105 -87
  275. package/types/nanahoshi-mona-ui-color-gradient.d.ts +281 -213
  276. package/types/nanahoshi-mona-ui-color-palette.d.ts +201 -138
  277. package/types/nanahoshi-mona-ui-color-picker.d.ts +283 -194
  278. package/types/nanahoshi-mona-ui-combo-box.d.ts +401 -262
  279. package/types/nanahoshi-mona-ui-command.d.ts +279 -191
  280. package/types/nanahoshi-mona-ui-common.d.ts +360 -385
  281. package/types/nanahoshi-mona-ui-contextmenu.d.ts +142 -117
  282. package/types/nanahoshi-mona-ui-date-input.d.ts +97 -97
  283. package/types/nanahoshi-mona-ui-date-picker.d.ts +338 -208
  284. package/types/nanahoshi-mona-ui-datetime-picker.d.ts +413 -259
  285. package/types/nanahoshi-mona-ui-dialog.d.ts +470 -381
  286. package/types/nanahoshi-mona-ui-dropdown-button.d.ts +216 -168
  287. package/types/nanahoshi-mona-ui-dropdown-list.d.ts +369 -243
  288. package/types/nanahoshi-mona-ui-dropdowns.d.ts +255 -235
  289. package/types/nanahoshi-mona-ui-editor.d.ts +302 -235
  290. package/types/nanahoshi-mona-ui-expansion-panel.d.ts +140 -109
  291. package/types/nanahoshi-mona-ui-fieldset.d.ts +98 -68
  292. package/types/nanahoshi-mona-ui-filter.d.ts +150 -124
  293. package/types/nanahoshi-mona-ui-grid.d.ts +1956 -1678
  294. package/types/nanahoshi-mona-ui-i18n-icu.d.ts +25 -34
  295. package/types/nanahoshi-mona-ui-i18n.d.ts +999 -1052
  296. package/types/nanahoshi-mona-ui-internal-filter-input.d.ts +118 -71
  297. package/types/nanahoshi-mona-ui-internal-indicator-icon.d.ts +56 -27
  298. package/types/nanahoshi-mona-ui-internal-list.d.ts +474 -408
  299. package/types/nanahoshi-mona-ui-internal-popup-menu.d.ts +143 -150
  300. package/types/nanahoshi-mona-ui-internal-tree.d.ts +493 -506
  301. package/types/nanahoshi-mona-ui-internal.d.ts +195 -213
  302. package/types/nanahoshi-mona-ui-label.d.ts +108 -78
  303. package/types/nanahoshi-mona-ui-list-box.d.ts +392 -322
  304. package/types/nanahoshi-mona-ui-list-view.d.ts +423 -282
  305. package/types/nanahoshi-mona-ui-list.d.ts +2 -1
  306. package/types/nanahoshi-mona-ui-locales-ar-sa.d.ts +540 -542
  307. package/types/nanahoshi-mona-ui-locales-de-de.d.ts +540 -542
  308. package/types/nanahoshi-mona-ui-locales-es-es.d.ts +540 -542
  309. package/types/nanahoshi-mona-ui-locales-fr-fr.d.ts +540 -542
  310. package/types/nanahoshi-mona-ui-locales-id-id.d.ts +540 -542
  311. package/types/nanahoshi-mona-ui-locales-it-it.d.ts +540 -542
  312. package/types/nanahoshi-mona-ui-locales-ja-jp.d.ts +540 -542
  313. package/types/nanahoshi-mona-ui-locales-ko-kr.d.ts +540 -542
  314. package/types/nanahoshi-mona-ui-locales-pt-br.d.ts +540 -542
  315. package/types/nanahoshi-mona-ui-locales-ru-ru.d.ts +540 -542
  316. package/types/nanahoshi-mona-ui-locales-tr-tr.d.ts +540 -542
  317. package/types/nanahoshi-mona-ui-locales-zh-cn.d.ts +540 -542
  318. package/types/nanahoshi-mona-ui-locales-zh-tw.d.ts +540 -542
  319. package/types/nanahoshi-mona-ui-locales.d.ts +17 -19
  320. package/types/nanahoshi-mona-ui-menubar.d.ts +210 -181
  321. package/types/nanahoshi-mona-ui-multi-select.d.ts +416 -276
  322. package/types/nanahoshi-mona-ui-notification.d.ts +140 -151
  323. package/types/nanahoshi-mona-ui-numeric-text-box.d.ts +407 -270
  324. package/types/nanahoshi-mona-ui-otp-input.d.ts +364 -241
  325. package/types/nanahoshi-mona-ui-pager.d.ts +379 -301
  326. package/types/nanahoshi-mona-ui-placeholder.d.ts +35 -28
  327. package/types/nanahoshi-mona-ui-popover.d.ts +176 -134
  328. package/types/nanahoshi-mona-ui-popup-menu.d.ts +488 -344
  329. package/types/nanahoshi-mona-ui-popup.d.ts +698 -560
  330. package/types/nanahoshi-mona-ui-progress-bar.d.ts +197 -137
  331. package/types/nanahoshi-mona-ui-query.d.ts +82 -88
  332. package/types/nanahoshi-mona-ui-radio-button.d.ts +434 -269
  333. package/types/nanahoshi-mona-ui-rating.d.ts +348 -254
  334. package/types/nanahoshi-mona-ui-scroll-view.d.ts +244 -172
  335. package/types/nanahoshi-mona-ui-segmented.d.ts +250 -175
  336. package/types/nanahoshi-mona-ui-sheet.d.ts +115 -63
  337. package/types/nanahoshi-mona-ui-sidebar.d.ts +653 -493
  338. package/types/nanahoshi-mona-ui-skeleton.d.ts +55 -39
  339. package/types/nanahoshi-mona-ui-slider.d.ts +503 -354
  340. package/types/nanahoshi-mona-ui-spinner.d.ts +125 -112
  341. package/types/nanahoshi-mona-ui-split-button.d.ts +241 -196
  342. package/types/nanahoshi-mona-ui-splitter.d.ts +124 -78
  343. package/types/nanahoshi-mona-ui-stepper.d.ts +206 -181
  344. package/types/nanahoshi-mona-ui-switch.d.ts +197 -131
  345. package/types/nanahoshi-mona-ui-tabs.d.ts +349 -248
  346. package/types/nanahoshi-mona-ui-text-area.d.ts +52 -36
  347. package/types/nanahoshi-mona-ui-text-box.d.ts +349 -218
  348. package/types/nanahoshi-mona-ui-theme.d.ts +415 -408
  349. package/types/nanahoshi-mona-ui-time-picker.d.ts +357 -217
  350. package/types/nanahoshi-mona-ui-time-selector.d.ts +255 -170
  351. package/types/nanahoshi-mona-ui-tooltip.d.ts +222 -144
  352. package/types/nanahoshi-mona-ui-tree-view.d.ts +466 -308
  353. package/types/nanahoshi-mona-ui-window.d.ts +494 -399
  354. package/types/nanahoshi-mona-ui.d.ts +1 -2
  355. package/fesm2022/nanahoshi-mona-ui-grid-grid-footer-row.component-DjNnVxHE.mjs +0 -181
  356. package/fesm2022/nanahoshi-mona-ui-grid-grid-list.component-ihQIKeP-.mjs +0 -208
  357. package/fesm2022/nanahoshi-mona-ui-grid-grid-row.component-BpnybNcs.mjs +0 -1082
  358. package/fesm2022/nanahoshi-mona-ui-grid-grid-virtual-list.component-CYlgfc7c.mjs +0 -186
  359. package/fesm2022/nanahoshi-mona-ui-grid-nanahoshi-mona-ui-grid-LCzfCYd3.mjs +0 -7568
@@ -1,574 +1,797 @@
1
- import * as i0 from '@angular/core';
2
- import { Directive, inject, DestroyRef, DOCUMENT, ElementRef, NgZone, input, afterNextRender, Pipe, Injector, viewChild, ViewContainerRef, computed, signal, TemplateRef, effect, untracked, isDevMode, Component, InjectionToken, forwardRef, Injectable, contentChild, output, model } from '@angular/core';
3
- import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
4
- import { themeOverlaySurfaceClasses, createElementControlId, focusElement, positionGlobalOverlay, inertOutside } from '@nanahoshi/mona-ui/internal';
5
- import { PopupDataInjectionToken, PopupCloseEvent, PopupCloseSource, PopupService } from '@nanahoshi/mona-ui/popup';
6
- import { fromEvent, ReplaySubject, Subject, asapScheduler, take, takeUntil, merge, map } from 'rxjs';
7
- import * as i1 from '@angular/cdk/a11y';
8
- import { CdkTrapFocus } from '@angular/cdk/a11y';
9
- import { NgTemplateOutlet } from '@angular/common';
10
- import { LucideMinimize, LucideMaximize, LucideAppWindow, LucideMinus, LucideDynamicIcon, LucideX } from '@lucide/angular';
11
- import { ButtonDirective } from '@nanahoshi/mona-ui/button';
12
- import { MonaI18nService, mergeMessages } from '@nanahoshi/mona-ui/i18n';
13
- import { cva } from 'class-variance-authority';
14
-
15
- class WindowActionTemplateDirective {
16
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: WindowActionTemplateDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
17
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.0.6", type: WindowActionTemplateDirective, isStandalone: true, selector: "ng-template[monaWindowActionTemplate]", ngImport: i0 }); }
18
- }
19
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: WindowActionTemplateDirective, decorators: [{
20
- type: Directive,
21
- args: [{
22
- selector: "ng-template[monaWindowActionTemplate]"
23
- }]
24
- }] });
25
-
26
- class WindowContentTemplateDirective {
27
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: WindowContentTemplateDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
28
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.0.6", type: WindowContentTemplateDirective, isStandalone: true, selector: "ng-template[monaWindowContentTemplate]", ngImport: i0 }); }
29
- }
30
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: WindowContentTemplateDirective, decorators: [{
31
- type: Directive,
32
- args: [{
33
- selector: "ng-template[monaWindowContentTemplate]"
34
- }]
35
- }] });
36
-
37
- class WindowFooterTemplateDirective {
38
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: WindowFooterTemplateDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
39
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.0.6", type: WindowFooterTemplateDirective, isStandalone: true, selector: "ng-template[monaWindowFooterTemplate]", ngImport: i0 }); }
40
- }
41
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: WindowFooterTemplateDirective, decorators: [{
42
- type: Directive,
43
- args: [{
44
- selector: "ng-template[monaWindowFooterTemplate]"
45
- }]
46
- }] });
47
-
48
- class WindowTitleTemplateDirective {
49
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: WindowTitleTemplateDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
50
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.0.6", type: WindowTitleTemplateDirective, isStandalone: true, selector: "ng-template[monaWindowTitleTemplate]", ngImport: i0 }); }
51
- }
52
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: WindowTitleTemplateDirective, decorators: [{
53
- type: Directive,
54
- args: [{
55
- selector: "ng-template[monaWindowTitleTemplate]"
56
- }]
57
- }] });
58
-
59
- const DEFAULT_MAX_WINDOW_HEIGHT = 800;
60
- const DEFAULT_MAX_WINDOW_WIDTH = 1200;
61
- const DEFAULT_MIN_WINDOW_HEIGHT = 50;
62
- const DEFAULT_MIN_WINDOW_WIDTH = 50;
63
-
1
+ import * as i0 from "@angular/core";
2
+ import { Component, DOCUMENT, DestroyRef, Directive, ElementRef, Injectable, InjectionToken, Injector, NgZone, Pipe, TemplateRef, ViewContainerRef, afterNextRender, computed, contentChild, effect, forwardRef, inject, input, isDevMode, model, output, signal, untracked, viewChild } from "@angular/core";
3
+ import { takeUntilDestroyed } from "@angular/core/rxjs-interop";
4
+ import { createElementControlId, focusElement, inertOutside, positionGlobalOverlay, themeOverlaySurfaceClasses } from "@nanahoshi/mona-ui/internal";
5
+ import { PopupCloseEvent, PopupCloseSource, PopupDataInjectionToken, PopupService } from "@nanahoshi/mona-ui/popup";
6
+ import { ReplaySubject, Subject, asapScheduler, fromEvent, map, merge, take, takeUntil } from "rxjs";
7
+ import * as i1 from "@angular/cdk/a11y";
8
+ import { CdkTrapFocus } from "@angular/cdk/a11y";
9
+ import { NgTemplateOutlet } from "@angular/common";
10
+ import { LucideAppWindow, LucideDynamicIcon, LucideMaximize, LucideMinimize, LucideMinus, LucideX } from "@lucide/angular";
11
+ import { ButtonDirective } from "@nanahoshi/mona-ui/button";
12
+ import { MonaI18nService, mergeMessages } from "@nanahoshi/mona-ui/i18n";
13
+ import { cva } from "class-variance-authority";
14
+ var WindowActionTemplateDirective = class WindowActionTemplateDirective {
15
+ static {
16
+ this.ɵfac = i0.ɵɵngDeclareFactory({
17
+ minVersion: "12.0.0",
18
+ version: "22.2.6",
19
+ ngImport: i0,
20
+ type: WindowActionTemplateDirective,
21
+ deps: [],
22
+ target: i0.ɵɵFactoryTarget.Directive
23
+ });
24
+ }
25
+ static {
26
+ this.ɵdir = i0.ɵɵngDeclareDirective({
27
+ minVersion: "14.0.0",
28
+ version: "22.2.6",
29
+ type: WindowActionTemplateDirective,
30
+ isStandalone: true,
31
+ selector: "ng-template[monaWindowActionTemplate]",
32
+ ngImport: i0
33
+ });
34
+ }
35
+ };
36
+ i0.ɵɵngDeclareClassMetadata({
37
+ minVersion: "12.0.0",
38
+ version: "22.2.6",
39
+ ngImport: i0,
40
+ type: WindowActionTemplateDirective,
41
+ decorators: [{
42
+ type: Directive,
43
+ args: [{ selector: "ng-template[monaWindowActionTemplate]" }]
44
+ }]
45
+ });
46
+ var WindowContentTemplateDirective = class WindowContentTemplateDirective {
47
+ static {
48
+ this.ɵfac = i0.ɵɵngDeclareFactory({
49
+ minVersion: "12.0.0",
50
+ version: "22.2.6",
51
+ ngImport: i0,
52
+ type: WindowContentTemplateDirective,
53
+ deps: [],
54
+ target: i0.ɵɵFactoryTarget.Directive
55
+ });
56
+ }
57
+ static {
58
+ this.ɵdir = i0.ɵɵngDeclareDirective({
59
+ minVersion: "14.0.0",
60
+ version: "22.2.6",
61
+ type: WindowContentTemplateDirective,
62
+ isStandalone: true,
63
+ selector: "ng-template[monaWindowContentTemplate]",
64
+ ngImport: i0
65
+ });
66
+ }
67
+ };
68
+ i0.ɵɵngDeclareClassMetadata({
69
+ minVersion: "12.0.0",
70
+ version: "22.2.6",
71
+ ngImport: i0,
72
+ type: WindowContentTemplateDirective,
73
+ decorators: [{
74
+ type: Directive,
75
+ args: [{ selector: "ng-template[monaWindowContentTemplate]" }]
76
+ }]
77
+ });
78
+ var WindowFooterTemplateDirective = class WindowFooterTemplateDirective {
79
+ static {
80
+ this.ɵfac = i0.ɵɵngDeclareFactory({
81
+ minVersion: "12.0.0",
82
+ version: "22.2.6",
83
+ ngImport: i0,
84
+ type: WindowFooterTemplateDirective,
85
+ deps: [],
86
+ target: i0.ɵɵFactoryTarget.Directive
87
+ });
88
+ }
89
+ static {
90
+ this.ɵdir = i0.ɵɵngDeclareDirective({
91
+ minVersion: "14.0.0",
92
+ version: "22.2.6",
93
+ type: WindowFooterTemplateDirective,
94
+ isStandalone: true,
95
+ selector: "ng-template[monaWindowFooterTemplate]",
96
+ ngImport: i0
97
+ });
98
+ }
99
+ };
100
+ i0.ɵɵngDeclareClassMetadata({
101
+ minVersion: "12.0.0",
102
+ version: "22.2.6",
103
+ ngImport: i0,
104
+ type: WindowFooterTemplateDirective,
105
+ decorators: [{
106
+ type: Directive,
107
+ args: [{ selector: "ng-template[monaWindowFooterTemplate]" }]
108
+ }]
109
+ });
110
+ var WindowTitleTemplateDirective = class WindowTitleTemplateDirective {
111
+ static {
112
+ this.ɵfac = i0.ɵɵngDeclareFactory({
113
+ minVersion: "12.0.0",
114
+ version: "22.2.6",
115
+ ngImport: i0,
116
+ type: WindowTitleTemplateDirective,
117
+ deps: [],
118
+ target: i0.ɵɵFactoryTarget.Directive
119
+ });
120
+ }
121
+ static {
122
+ this.ɵdir = i0.ɵɵngDeclareDirective({
123
+ minVersion: "14.0.0",
124
+ version: "22.2.6",
125
+ type: WindowTitleTemplateDirective,
126
+ isStandalone: true,
127
+ selector: "ng-template[monaWindowTitleTemplate]",
128
+ ngImport: i0
129
+ });
130
+ }
131
+ };
132
+ i0.ɵɵngDeclareClassMetadata({
133
+ minVersion: "12.0.0",
134
+ version: "22.2.6",
135
+ ngImport: i0,
136
+ type: WindowTitleTemplateDirective,
137
+ decorators: [{
138
+ type: Directive,
139
+ args: [{ selector: "ng-template[monaWindowTitleTemplate]" }]
140
+ }]
141
+ });
64
142
  const KEYBOARD_STEP = 10;
65
143
  const KEYBOARD_STEP_FINE = 1;
66
- /** How far the pointer travels before a press on the title bar becomes a drag, so a click or double-click isn't. */
67
144
  const DRAG_THRESHOLD = 3;
68
- /** Controls inside the title bar (its buttons, an action template) that take the pointer and keys themselves. */
69
145
  const INTERACTIVE$1 = "a[href], button, input, select, textarea, [contenteditable]:not([contenteditable='false']), [tabindex]";
70
- /**
71
- * The window's title bar: dragging it with the pointer moves the window, and while it has focus the arrow keys move
72
- * the window and Control (or Command) with the arrow keys resizes it. Shift makes either step 1px instead of 10px.
73
- */
74
- class WindowDragHandlerDirective {
75
- #destroyRef;
76
- #document;
77
- #hostElementRef;
78
- #zone;
79
- #activeCleanup;
80
- constructor() {
81
- this.#destroyRef = inject(DestroyRef);
82
- this.#document = inject(DOCUMENT);
83
- this.#hostElementRef = inject(ElementRef);
84
- this.#zone = inject(NgZone);
85
- this.draggable = input(true, /* @ts-ignore */
86
- ...(ngDevMode ? [{ debugName: "draggable" }] : /* istanbul ignore next */ []));
87
- this.maxHeight = input(/* @ts-ignore */
88
- ...(ngDevMode ? [undefined, { debugName: "maxHeight" }] : /* istanbul ignore next */ []));
89
- this.maxWidth = input(/* @ts-ignore */
90
- ...(ngDevMode ? [undefined, { debugName: "maxWidth" }] : /* istanbul ignore next */ []));
91
- this.minHeight = input(/* @ts-ignore */
92
- ...(ngDevMode ? [undefined, { debugName: "minHeight" }] : /* istanbul ignore next */ []));
93
- this.minWidth = input(/* @ts-ignore */
94
- ...(ngDevMode ? [undefined, { debugName: "minWidth" }] : /* istanbul ignore next */ []));
95
- this.resizable = input(false, /* @ts-ignore */
96
- ...(ngDevMode ? [{ debugName: "resizable" }] : /* istanbul ignore next */ []));
97
- this.windowRef = input.required(/* @ts-ignore */
98
- ...(ngDevMode ? [{ debugName: "windowRef" }] : /* istanbul ignore next */ []));
99
- afterNextRender({
100
- write: () => this.#setEvents()
101
- });
102
- this.#destroyRef.onDestroy(() => this.#activeCleanup?.());
103
- }
104
- onKeydown(event) {
105
- // Keys pressed on the title bar's own buttons, or on controls in an action template, are theirs.
106
- if (event.target !== this.#hostElementRef.nativeElement || event.altKey) {
107
- return;
108
- }
109
- const deltas = {
110
- ArrowDown: [0, 1],
111
- ArrowLeft: [-1, 0],
112
- ArrowRight: [1, 0],
113
- ArrowUp: [0, -1]
114
- };
115
- const delta = deltas[event.key];
116
- if (!delta) {
117
- return;
118
- }
119
- const step = event.shiftKey ? KEYBOARD_STEP_FINE : KEYBOARD_STEP;
120
- const [deltaX, deltaY] = [delta[0] * step, delta[1] * step];
121
- const handled = event.ctrlKey || event.metaKey ? this.#resizeBy(deltaX, deltaY) : this.#moveBy(deltaX, deltaY);
122
- if (handled) {
123
- event.preventDefault();
124
- }
125
- }
126
- /** Moves the window by the given amount, keeping all of it in the viewport. */
127
- #moveBy(deltaX, deltaY) {
128
- if (!this.draggable()) {
129
- return false;
130
- }
131
- const windowRef = this.windowRef();
132
- const rect = windowRef.element.getBoundingClientRect();
133
- const { innerHeight, innerWidth } = this.#viewport();
134
- const left = Math.round(Math.min(Math.max(0, rect.left + deltaX), Math.max(0, innerWidth - rect.width)));
135
- const top = Math.round(Math.min(Math.max(0, rect.top + deltaY), Math.max(0, innerHeight - rect.height)));
136
- windowRef.moveStart$$.next();
137
- windowRef.move({ left, top });
138
- windowRef.move$$.next({ left, top });
139
- windowRef.moveEnd$$.next();
140
- return true;
141
- }
142
- #onPointerDown(event) {
143
- if (!this.draggable() || event.button !== 0 || !event.isPrimary) {
144
- return;
145
- }
146
- const host = this.#hostElementRef.nativeElement;
147
- const target = event.target instanceof Element ? event.target.closest(INTERACTIVE$1) : null;
148
- if (target && target !== host && host.contains(target)) {
149
- return;
150
- }
151
- const windowRef = this.windowRef();
152
- const rect = windowRef.element.getBoundingClientRect();
153
- const { innerHeight, innerWidth } = this.#viewport();
154
- const pointerId = event.pointerId;
155
- const initialX = event.clientX;
156
- const initialY = event.clientY;
157
- let dragging = false;
158
- const onPointerMove = (moveEvent) => {
159
- if (moveEvent.pointerId !== pointerId) {
160
- return;
161
- }
162
- const deltaX = moveEvent.clientX - initialX;
163
- const deltaY = moveEvent.clientY - initialY;
164
- if (!dragging) {
165
- if (Math.hypot(deltaX, deltaY) < DRAG_THRESHOLD) {
166
- return;
167
- }
168
- dragging = true;
169
- windowRef.moveStart$$.next();
170
- }
171
- if (moveEvent.clientX < 0 ||
172
- moveEvent.clientX > innerWidth ||
173
- moveEvent.clientY < 0 ||
174
- moveEvent.clientY > innerHeight) {
175
- return;
176
- }
177
- // The title bar stays below the top edge, where it can still be grabbed.
178
- const top = Math.max(0, Math.round(rect.top + deltaY));
179
- const left = Math.round(rect.left + deltaX);
180
- windowRef.move({ left, top });
181
- windowRef.move$$.next({ left, top });
182
- };
183
- const cleanup = () => {
184
- this.#document.removeEventListener("pointermove", onPointerMove);
185
- this.#document.removeEventListener("pointerup", onPointerEnd);
186
- this.#document.removeEventListener("pointercancel", onPointerEnd);
187
- if (host.hasPointerCapture?.(pointerId)) {
188
- host.releasePointerCapture(pointerId);
189
- }
190
- this.#activeCleanup = undefined;
191
- };
192
- const onPointerEnd = (endEvent) => {
193
- if (endEvent.pointerId !== pointerId) {
194
- return;
195
- }
196
- cleanup();
197
- if (dragging) {
198
- dragging = false;
199
- windowRef.moveEnd$$.next();
200
- }
201
- };
202
- this.#activeCleanup?.();
203
- this.#activeCleanup = cleanup;
204
- try {
205
- host.setPointerCapture?.(pointerId);
206
- }
207
- catch {
208
- // The pointer may already be gone; the document listeners still finish the drag.
209
- }
210
- this.#document.addEventListener("pointermove", onPointerMove);
211
- this.#document.addEventListener("pointerup", onPointerEnd);
212
- this.#document.addEventListener("pointercancel", onPointerEnd);
213
- }
214
- /**
215
- * Resizes the window from its bottom and right edges by the given amount, within its minimum and maximum sizes
216
- * and the viewport.
217
- */
218
- #resizeBy(deltaX, deltaY) {
219
- if (!this.resizable()) {
220
- return false;
221
- }
222
- const windowRef = this.windowRef();
223
- const rect = windowRef.element.getBoundingClientRect();
224
- const { innerHeight, innerWidth } = this.#viewport();
225
- const clamp = (value, min, max) => Math.round(Math.max(min, Math.min(value, max)));
226
- const minWidth = this.minWidth() ?? DEFAULT_MIN_WINDOW_WIDTH;
227
- const minHeight = this.minHeight() ?? DEFAULT_MIN_WINDOW_HEIGHT;
228
- const maxWidth = Math.max(minWidth, Math.min(this.maxWidth() ?? innerWidth, innerWidth - rect.left));
229
- const maxHeight = Math.max(minHeight, Math.min(this.maxHeight() ?? innerHeight, innerHeight - rect.top));
230
- const width = deltaX === 0 ? Math.round(rect.width) : clamp(rect.width + deltaX, minWidth, maxWidth);
231
- const height = deltaY === 0 ? Math.round(rect.height) : clamp(rect.height + deltaY, minHeight, maxHeight);
232
- const left = Math.round(rect.left);
233
- const top = Math.round(rect.top);
234
- // Pin the window where it is, so a centered window grows from its top-left corner like a dragged edge.
235
- windowRef.move({ left, top });
236
- windowRef.resize({ height, width });
237
- windowRef.resize$$.next({ height, left, top, width });
238
- return true;
239
- }
240
- #setEvents() {
241
- this.#zone.runOutsideAngular(() => {
242
- fromEvent(this.#hostElementRef.nativeElement, "pointerdown")
243
- .pipe(takeUntilDestroyed(this.#destroyRef))
244
- .subscribe(event => this.#onPointerDown(event));
245
- });
246
- }
247
- #viewport() {
248
- const view = this.#document.defaultView;
249
- return {
250
- innerHeight: view?.innerHeight || DEFAULT_MAX_WINDOW_HEIGHT,
251
- innerWidth: view?.innerWidth || DEFAULT_MAX_WINDOW_WIDTH
252
- };
253
- }
254
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: WindowDragHandlerDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
255
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.6", type: WindowDragHandlerDirective, isStandalone: true, selector: "div[monaWindowDragHandler]", inputs: { draggable: { classPropertyName: "draggable", publicName: "draggable", isSignal: true, isRequired: false, transformFunction: null }, maxHeight: { classPropertyName: "maxHeight", publicName: "maxHeight", isSignal: true, isRequired: false, transformFunction: null }, maxWidth: { classPropertyName: "maxWidth", publicName: "maxWidth", isSignal: true, isRequired: false, transformFunction: null }, minHeight: { classPropertyName: "minHeight", publicName: "minHeight", isSignal: true, isRequired: false, transformFunction: null }, minWidth: { classPropertyName: "minWidth", publicName: "minWidth", isSignal: true, isRequired: false, transformFunction: null }, resizable: { classPropertyName: "resizable", publicName: "resizable", isSignal: true, isRequired: false, transformFunction: null }, windowRef: { classPropertyName: "windowRef", publicName: "windowRef", isSignal: true, isRequired: true, transformFunction: null } }, host: { listeners: { "keydown": "onKeydown($event)" } }, ngImport: i0 }); }
256
- }
257
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: WindowDragHandlerDirective, decorators: [{
258
- type: Directive,
259
- args: [{
260
- selector: "div[monaWindowDragHandler]",
261
- host: {
262
- "(keydown)": "onKeydown($event)"
263
- }
264
- }]
265
- }], ctorParameters: () => [], propDecorators: { draggable: [{ type: i0.Input, args: [{ isSignal: true, alias: "draggable", required: false }] }], maxHeight: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxHeight", required: false }] }], maxWidth: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxWidth", required: false }] }], minHeight: [{ type: i0.Input, args: [{ isSignal: true, alias: "minHeight", required: false }] }], minWidth: [{ type: i0.Input, args: [{ isSignal: true, alias: "minWidth", required: false }] }], resizable: [{ type: i0.Input, args: [{ isSignal: true, alias: "resizable", required: false }] }], windowRef: [{ type: i0.Input, args: [{ isSignal: true, alias: "windowRef", required: true }] }] } });
266
-
267
- /**
268
- * A resize handle on a window's edge or corner, for the pointer. The keyboard resizes from the title bar instead
269
- * (see `WindowDragHandlerDirective`), so the handles stay out of the Tab order.
270
- */
271
- class WindowResizeHandlerDirective {
272
- #destroyRef;
273
- #document;
274
- #hostElementRef;
275
- #zone;
276
- #activeCleanup;
277
- constructor() {
278
- this.#destroyRef = inject(DestroyRef);
279
- this.#document = inject(DOCUMENT);
280
- this.#hostElementRef = inject(ElementRef);
281
- this.#zone = inject(NgZone);
282
- this.direction = input.required(/* @ts-ignore */
283
- ...(ngDevMode ? [{ debugName: "direction" }] : /* istanbul ignore next */ []));
284
- this.maxHeight = input(/* @ts-ignore */
285
- ...(ngDevMode ? [undefined, { debugName: "maxHeight" }] : /* istanbul ignore next */ []));
286
- this.maxWidth = input(/* @ts-ignore */
287
- ...(ngDevMode ? [undefined, { debugName: "maxWidth" }] : /* istanbul ignore next */ []));
288
- this.minHeight = input(/* @ts-ignore */
289
- ...(ngDevMode ? [undefined, { debugName: "minHeight" }] : /* istanbul ignore next */ []));
290
- this.minWidth = input(/* @ts-ignore */
291
- ...(ngDevMode ? [undefined, { debugName: "minWidth" }] : /* istanbul ignore next */ []));
292
- this.windowRef = input.required(/* @ts-ignore */
293
- ...(ngDevMode ? [{ debugName: "windowRef" }] : /* istanbul ignore next */ []));
294
- afterNextRender({
295
- write: () => this.#setEvents()
296
- });
297
- this.#destroyRef.onDestroy(() => this.#activeCleanup?.());
298
- }
299
- #applyResize(result, initial) {
300
- const windowRef = this.windowRef();
301
- // Pin both axes first, so the edge that isn't dragged stays put even when the window was centered.
302
- windowRef.move({ left: result.left ?? initial.left, top: result.top ?? initial.top });
303
- windowRef.resize({ height: result.height, width: result.width });
304
- windowRef.resize$$.next({
305
- width: result.width ?? initial.width,
306
- height: result.height ?? initial.height,
307
- left: result.left ?? initial.left,
308
- top: result.top ?? initial.top
309
- });
310
- }
311
- #bounds() {
312
- const innerWidth = this.#document.defaultView?.innerWidth || DEFAULT_MAX_WINDOW_WIDTH;
313
- const innerHeight = this.#document.defaultView?.innerHeight || DEFAULT_MAX_WINDOW_HEIGHT;
314
- return {
315
- innerWidth,
316
- innerHeight,
317
- minWidth: this.minWidth() || DEFAULT_MIN_WINDOW_WIDTH,
318
- minHeight: this.minHeight() || DEFAULT_MIN_WINDOW_HEIGHT,
319
- maxWidth: this.maxWidth() ?? innerWidth,
320
- maxHeight: this.maxHeight() ?? innerHeight
321
- };
322
- }
323
- #computeResize(direction, deltaX, deltaY, initial, bounds) {
324
- const { minWidth, minHeight, maxWidth, maxHeight, innerWidth, innerHeight } = bounds;
325
- let height;
326
- let left;
327
- let width;
328
- let top;
329
- switch (direction) {
330
- case "northwest":
331
- if (initial.top + deltaY <= 0 || initial.height - deltaY < minHeight) {
332
- return null;
333
- }
334
- if (initial.height - deltaY > maxHeight || initial.width - deltaX > maxWidth) {
335
- return null;
336
- }
337
- height = initial.height - deltaY;
338
- top = initial.top + deltaY;
339
- if (initial.left + deltaX < 0 || initial.width - deltaX < minWidth) {
340
- return null;
341
- }
342
- width = initial.width - deltaX;
343
- left = initial.left + deltaX;
344
- break;
345
- case "north":
346
- if (initial.top + deltaY <= 0 || initial.height - deltaY < minHeight) {
347
- return null;
348
- }
349
- if (initial.height - deltaY > maxHeight) {
350
- return null;
351
- }
352
- height = initial.height - deltaY;
353
- top = initial.top + deltaY;
354
- break;
355
- case "northeast":
356
- if (initial.top + deltaY <= 0 || initial.height - deltaY < minHeight) {
357
- return null;
358
- }
359
- if (initial.height - deltaY > maxHeight || initial.width + deltaX > maxWidth) {
360
- return null;
361
- }
362
- height = initial.height - deltaY;
363
- top = initial.top + deltaY;
364
- if (initial.width + deltaX < minWidth || initial.left + initial.width + deltaX > innerWidth) {
365
- return null;
366
- }
367
- width = initial.width + deltaX;
368
- break;
369
- case "east":
370
- if (initial.width + deltaX < minWidth || initial.left + initial.width + deltaX > innerWidth) {
371
- return null;
372
- }
373
- if (initial.width + deltaX > maxWidth) {
374
- return null;
375
- }
376
- width = initial.width + deltaX;
377
- break;
378
- case "southeast":
379
- if (initial.height + deltaY < minHeight || initial.top + initial.height + deltaY > innerHeight) {
380
- return null;
381
- }
382
- if (initial.height + deltaY > maxHeight || initial.width + deltaX > maxWidth) {
383
- return null;
384
- }
385
- height = initial.height + deltaY;
386
- if (initial.width + deltaX < minWidth || initial.left + initial.width + deltaX > innerWidth) {
387
- return null;
388
- }
389
- width = initial.width + deltaX;
390
- break;
391
- case "south":
392
- if (initial.height + deltaY < minHeight || initial.top + initial.height + deltaY > innerHeight) {
393
- return null;
394
- }
395
- if (initial.height + deltaY > maxHeight) {
396
- return null;
397
- }
398
- height = initial.height + deltaY;
399
- break;
400
- case "southwest":
401
- if (initial.height + deltaY < minHeight || initial.top + initial.height + deltaY > innerHeight) {
402
- return null;
403
- }
404
- if (initial.height + deltaY > maxHeight || initial.width - deltaX > maxWidth) {
405
- return null;
406
- }
407
- height = initial.height + deltaY;
408
- if (initial.left + deltaX < 0 || initial.width - deltaX < minWidth) {
409
- return null;
410
- }
411
- width = initial.width - deltaX;
412
- left = initial.left + deltaX;
413
- break;
414
- case "west":
415
- if (initial.left + deltaX < 0 || initial.width - deltaX < minWidth) {
416
- return null;
417
- }
418
- if (initial.width - deltaX > maxWidth) {
419
- return null;
420
- }
421
- width = initial.width - deltaX;
422
- left = initial.left + deltaX;
423
- break;
424
- }
425
- return { width, height, left, top };
426
- }
427
- #onPointerDown(event) {
428
- if (event.button !== 0 || !event.isPrimary) {
429
- return;
430
- }
431
- event.preventDefault();
432
- const handle = this.#hostElementRef.nativeElement;
433
- const pointerId = event.pointerId;
434
- const element = this.windowRef().element;
435
- const rect = element.getBoundingClientRect();
436
- const initial = { width: rect.width, height: rect.height, top: rect.top, left: rect.left };
437
- const initialX = event.clientX;
438
- const initialY = event.clientY;
439
- const oldSelectStart = this.#document.onselectstart;
440
- const oldDragStart = this.#document.ondragstart;
441
- this.#document.onselectstart = () => false;
442
- this.#document.ondragstart = () => false;
443
- const bounds = this.#bounds();
444
- const onPointerMove = (moveEvent) => {
445
- if (moveEvent.pointerId !== pointerId) {
446
- return;
447
- }
448
- const deltaX = moveEvent.clientX - initialX;
449
- const deltaY = moveEvent.clientY - initialY;
450
- const result = this.#computeResize(this.direction(), deltaX, deltaY, initial, bounds);
451
- if (!result) {
452
- return;
453
- }
454
- this.#applyResize(result, initial);
455
- };
456
- const cleanup = () => {
457
- this.#document.removeEventListener("pointermove", onPointerMove);
458
- this.#document.removeEventListener("pointerup", onPointerEnd);
459
- this.#document.removeEventListener("pointercancel", onPointerEnd);
460
- this.#document.onselectstart = oldSelectStart;
461
- this.#document.ondragstart = oldDragStart;
462
- if (handle.hasPointerCapture?.(pointerId)) {
463
- handle.releasePointerCapture(pointerId);
464
- }
465
- this.#activeCleanup = undefined;
466
- };
467
- const onPointerEnd = (endEvent) => {
468
- if (endEvent.pointerId === pointerId) {
469
- cleanup();
470
- }
471
- };
472
- this.#activeCleanup?.();
473
- this.#activeCleanup = cleanup;
474
- try {
475
- handle.setPointerCapture?.(pointerId);
476
- }
477
- catch {
478
- // The pointer may already be gone; the document listeners still finish the resize.
479
- }
480
- this.#document.addEventListener("pointermove", onPointerMove);
481
- this.#document.addEventListener("pointerup", onPointerEnd);
482
- this.#document.addEventListener("pointercancel", onPointerEnd);
483
- }
484
- #setEvents() {
485
- this.#zone.runOutsideAngular(() => {
486
- fromEvent(this.#hostElementRef.nativeElement, "pointerdown")
487
- .pipe(takeUntilDestroyed(this.#destroyRef))
488
- .subscribe(event => this.#onPointerDown(event));
489
- });
490
- }
491
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: WindowResizeHandlerDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
492
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.6", type: WindowResizeHandlerDirective, isStandalone: true, selector: "div[monaWindowResizeHandler]", inputs: { direction: { classPropertyName: "direction", publicName: "direction", isSignal: true, isRequired: true, transformFunction: null }, maxHeight: { classPropertyName: "maxHeight", publicName: "maxHeight", isSignal: true, isRequired: false, transformFunction: null }, maxWidth: { classPropertyName: "maxWidth", publicName: "maxWidth", isSignal: true, isRequired: false, transformFunction: null }, minHeight: { classPropertyName: "minHeight", publicName: "minHeight", isSignal: true, isRequired: false, transformFunction: null }, minWidth: { classPropertyName: "minWidth", publicName: "minWidth", isSignal: true, isRequired: false, transformFunction: null }, windowRef: { classPropertyName: "windowRef", publicName: "windowRef", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0 }); }
493
- }
494
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: WindowResizeHandlerDirective, decorators: [{
495
- type: Directive,
496
- args: [{
497
- selector: "div[monaWindowResizeHandler]"
498
- }]
499
- }], ctorParameters: () => [], propDecorators: { direction: [{ type: i0.Input, args: [{ isSignal: true, alias: "direction", required: true }] }], maxHeight: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxHeight", required: false }] }], maxWidth: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxWidth", required: false }] }], minHeight: [{ type: i0.Input, args: [{ isSignal: true, alias: "minHeight", required: false }] }], minWidth: [{ type: i0.Input, args: [{ isSignal: true, alias: "minWidth", required: false }] }], windowRef: [{ type: i0.Input, args: [{ isSignal: true, alias: "windowRef", required: true }] }] } });
500
-
501
- // Generated from i18n/catalogs/en-US.messages.json by scripts/generate-locale-catalogs.ts. Do not edit.
502
- // Edit the JSON file and run `npm run generate:locale-catalogs`.
146
+ var WindowDragHandlerDirective = class WindowDragHandlerDirective {
147
+ #destroyRef;
148
+ #document;
149
+ #hostElementRef;
150
+ #zone;
151
+ #activeCleanup;
152
+ constructor() {
153
+ this.#destroyRef = inject(DestroyRef);
154
+ this.#document = inject(DOCUMENT);
155
+ this.#hostElementRef = inject(ElementRef);
156
+ this.#zone = inject(NgZone);
157
+ this.draggable = input(true, ...ngDevMode ? [{ debugName: "draggable" }] : /* istanbul ignore next */ []);
158
+ this.maxHeight = input(...ngDevMode ? [void 0, { debugName: "maxHeight" }] : /* istanbul ignore next */ []);
159
+ this.maxWidth = input(...ngDevMode ? [void 0, { debugName: "maxWidth" }] : /* istanbul ignore next */ []);
160
+ this.minHeight = input(...ngDevMode ? [void 0, { debugName: "minHeight" }] : /* istanbul ignore next */ []);
161
+ this.minWidth = input(...ngDevMode ? [void 0, { debugName: "minWidth" }] : /* istanbul ignore next */ []);
162
+ this.resizable = input(false, ...ngDevMode ? [{ debugName: "resizable" }] : /* istanbul ignore next */ []);
163
+ this.windowRef = input.required(...ngDevMode ? [{ debugName: "windowRef" }] : /* istanbul ignore next */ []);
164
+ afterNextRender({ write: () => this.#setEvents() });
165
+ this.#destroyRef.onDestroy(() => this.#activeCleanup?.());
166
+ }
167
+ onKeydown(event) {
168
+ if (event.target !== this.#hostElementRef.nativeElement || event.altKey) return;
169
+ const delta = {
170
+ ArrowDown: [0, 1],
171
+ ArrowLeft: [-1, 0],
172
+ ArrowRight: [1, 0],
173
+ ArrowUp: [0, -1]
174
+ }[event.key];
175
+ if (!delta) return;
176
+ const step = event.shiftKey ? KEYBOARD_STEP_FINE : KEYBOARD_STEP;
177
+ const [deltaX, deltaY] = [delta[0] * step, delta[1] * step];
178
+ if (event.ctrlKey || event.metaKey ? this.#resizeBy(deltaX, deltaY) : this.#moveBy(deltaX, deltaY)) event.preventDefault();
179
+ }
180
+ #moveBy(deltaX, deltaY) {
181
+ if (!this.draggable()) return false;
182
+ const windowRef = this.windowRef();
183
+ const rect = windowRef.element.getBoundingClientRect();
184
+ const { innerHeight, innerWidth } = this.#viewport();
185
+ const left = Math.round(Math.min(Math.max(0, rect.left + deltaX), Math.max(0, innerWidth - rect.width)));
186
+ const top = Math.round(Math.min(Math.max(0, rect.top + deltaY), Math.max(0, innerHeight - rect.height)));
187
+ windowRef.moveStart$$.next();
188
+ windowRef.move({
189
+ left,
190
+ top
191
+ });
192
+ windowRef.move$$.next({
193
+ left,
194
+ top
195
+ });
196
+ windowRef.moveEnd$$.next();
197
+ return true;
198
+ }
199
+ #onPointerDown(event) {
200
+ if (!this.draggable() || event.button !== 0 || !event.isPrimary) return;
201
+ const host = this.#hostElementRef.nativeElement;
202
+ const target = event.target instanceof Element ? event.target.closest(INTERACTIVE$1) : null;
203
+ if (target && target !== host && host.contains(target)) return;
204
+ const windowRef = this.windowRef();
205
+ const rect = windowRef.element.getBoundingClientRect();
206
+ const { innerHeight, innerWidth } = this.#viewport();
207
+ const pointerId = event.pointerId;
208
+ const initialX = event.clientX;
209
+ const initialY = event.clientY;
210
+ let dragging = false;
211
+ const onPointerMove = (moveEvent) => {
212
+ if (moveEvent.pointerId !== pointerId) return;
213
+ const deltaX = moveEvent.clientX - initialX;
214
+ const deltaY = moveEvent.clientY - initialY;
215
+ if (!dragging) {
216
+ if (Math.hypot(deltaX, deltaY) < DRAG_THRESHOLD) return;
217
+ dragging = true;
218
+ windowRef.moveStart$$.next();
219
+ }
220
+ if (moveEvent.clientX < 0 || moveEvent.clientX > innerWidth || moveEvent.clientY < 0 || moveEvent.clientY > innerHeight) return;
221
+ const top = Math.max(0, Math.round(rect.top + deltaY));
222
+ const left = Math.round(rect.left + deltaX);
223
+ windowRef.move({
224
+ left,
225
+ top
226
+ });
227
+ windowRef.move$$.next({
228
+ left,
229
+ top
230
+ });
231
+ };
232
+ const cleanup = () => {
233
+ this.#document.removeEventListener("pointermove", onPointerMove);
234
+ this.#document.removeEventListener("pointerup", onPointerEnd);
235
+ this.#document.removeEventListener("pointercancel", onPointerEnd);
236
+ if (host.hasPointerCapture?.(pointerId)) host.releasePointerCapture(pointerId);
237
+ this.#activeCleanup = void 0;
238
+ };
239
+ const onPointerEnd = (endEvent) => {
240
+ if (endEvent.pointerId !== pointerId) return;
241
+ cleanup();
242
+ if (dragging) {
243
+ dragging = false;
244
+ windowRef.moveEnd$$.next();
245
+ }
246
+ };
247
+ this.#activeCleanup?.();
248
+ this.#activeCleanup = cleanup;
249
+ try {
250
+ host.setPointerCapture?.(pointerId);
251
+ } catch {}
252
+ this.#document.addEventListener("pointermove", onPointerMove);
253
+ this.#document.addEventListener("pointerup", onPointerEnd);
254
+ this.#document.addEventListener("pointercancel", onPointerEnd);
255
+ }
256
+ #resizeBy(deltaX, deltaY) {
257
+ if (!this.resizable()) return false;
258
+ const windowRef = this.windowRef();
259
+ const rect = windowRef.element.getBoundingClientRect();
260
+ const { innerHeight, innerWidth } = this.#viewport();
261
+ const clamp = (value, min, max) => Math.round(Math.max(min, Math.min(value, max)));
262
+ const minWidth = this.minWidth() ?? 50;
263
+ const minHeight = this.minHeight() ?? 50;
264
+ const maxWidth = Math.max(minWidth, Math.min(this.maxWidth() ?? innerWidth, innerWidth - rect.left));
265
+ const maxHeight = Math.max(minHeight, Math.min(this.maxHeight() ?? innerHeight, innerHeight - rect.top));
266
+ const width = deltaX === 0 ? Math.round(rect.width) : clamp(rect.width + deltaX, minWidth, maxWidth);
267
+ const height = deltaY === 0 ? Math.round(rect.height) : clamp(rect.height + deltaY, minHeight, maxHeight);
268
+ const left = Math.round(rect.left);
269
+ const top = Math.round(rect.top);
270
+ windowRef.move({
271
+ left,
272
+ top
273
+ });
274
+ windowRef.resize({
275
+ height,
276
+ width
277
+ });
278
+ windowRef.resize$$.next({
279
+ height,
280
+ left,
281
+ top,
282
+ width
283
+ });
284
+ return true;
285
+ }
286
+ #setEvents() {
287
+ this.#zone.runOutsideAngular(() => {
288
+ fromEvent(this.#hostElementRef.nativeElement, "pointerdown").pipe(takeUntilDestroyed(this.#destroyRef)).subscribe((event) => this.#onPointerDown(event));
289
+ });
290
+ }
291
+ #viewport() {
292
+ const view = this.#document.defaultView;
293
+ return {
294
+ innerHeight: view?.innerHeight || 800,
295
+ innerWidth: view?.innerWidth || 1200
296
+ };
297
+ }
298
+ static {
299
+ this.ɵfac = i0.ɵɵngDeclareFactory({
300
+ minVersion: "12.0.0",
301
+ version: "22.2.6",
302
+ ngImport: i0,
303
+ type: WindowDragHandlerDirective,
304
+ deps: [],
305
+ target: i0.ɵɵFactoryTarget.Directive
306
+ });
307
+ }
308
+ static {
309
+ this.ɵdir = i0.ɵɵngDeclareDirective({
310
+ minVersion: "17.1.0",
311
+ version: "22.2.6",
312
+ type: WindowDragHandlerDirective,
313
+ isStandalone: true,
314
+ selector: "div[monaWindowDragHandler]",
315
+ inputs: {
316
+ draggable: {
317
+ classPropertyName: "draggable",
318
+ publicName: "draggable",
319
+ isSignal: true,
320
+ isRequired: false,
321
+ transformFunction: null
322
+ },
323
+ maxHeight: {
324
+ classPropertyName: "maxHeight",
325
+ publicName: "maxHeight",
326
+ isSignal: true,
327
+ isRequired: false,
328
+ transformFunction: null
329
+ },
330
+ maxWidth: {
331
+ classPropertyName: "maxWidth",
332
+ publicName: "maxWidth",
333
+ isSignal: true,
334
+ isRequired: false,
335
+ transformFunction: null
336
+ },
337
+ minHeight: {
338
+ classPropertyName: "minHeight",
339
+ publicName: "minHeight",
340
+ isSignal: true,
341
+ isRequired: false,
342
+ transformFunction: null
343
+ },
344
+ minWidth: {
345
+ classPropertyName: "minWidth",
346
+ publicName: "minWidth",
347
+ isSignal: true,
348
+ isRequired: false,
349
+ transformFunction: null
350
+ },
351
+ resizable: {
352
+ classPropertyName: "resizable",
353
+ publicName: "resizable",
354
+ isSignal: true,
355
+ isRequired: false,
356
+ transformFunction: null
357
+ },
358
+ windowRef: {
359
+ classPropertyName: "windowRef",
360
+ publicName: "windowRef",
361
+ isSignal: true,
362
+ isRequired: true,
363
+ transformFunction: null
364
+ }
365
+ },
366
+ host: { listeners: { "keydown": "onKeydown($event)" } },
367
+ ngImport: i0
368
+ });
369
+ }
370
+ };
371
+ i0.ɵɵngDeclareClassMetadata({
372
+ minVersion: "12.0.0",
373
+ version: "22.2.6",
374
+ ngImport: i0,
375
+ type: WindowDragHandlerDirective,
376
+ decorators: [{
377
+ type: Directive,
378
+ args: [{
379
+ selector: "div[monaWindowDragHandler]",
380
+ host: { "(keydown)": "onKeydown($event)" }
381
+ }]
382
+ }],
383
+ ctorParameters: () => [],
384
+ propDecorators: {
385
+ draggable: [{
386
+ type: i0.Input,
387
+ args: [{
388
+ isSignal: true,
389
+ alias: "draggable",
390
+ required: false
391
+ }]
392
+ }],
393
+ maxHeight: [{
394
+ type: i0.Input,
395
+ args: [{
396
+ isSignal: true,
397
+ alias: "maxHeight",
398
+ required: false
399
+ }]
400
+ }],
401
+ maxWidth: [{
402
+ type: i0.Input,
403
+ args: [{
404
+ isSignal: true,
405
+ alias: "maxWidth",
406
+ required: false
407
+ }]
408
+ }],
409
+ minHeight: [{
410
+ type: i0.Input,
411
+ args: [{
412
+ isSignal: true,
413
+ alias: "minHeight",
414
+ required: false
415
+ }]
416
+ }],
417
+ minWidth: [{
418
+ type: i0.Input,
419
+ args: [{
420
+ isSignal: true,
421
+ alias: "minWidth",
422
+ required: false
423
+ }]
424
+ }],
425
+ resizable: [{
426
+ type: i0.Input,
427
+ args: [{
428
+ isSignal: true,
429
+ alias: "resizable",
430
+ required: false
431
+ }]
432
+ }],
433
+ windowRef: [{
434
+ type: i0.Input,
435
+ args: [{
436
+ isSignal: true,
437
+ alias: "windowRef",
438
+ required: true
439
+ }]
440
+ }]
441
+ }
442
+ });
443
+ var WindowResizeHandlerDirective = class WindowResizeHandlerDirective {
444
+ #destroyRef;
445
+ #document;
446
+ #hostElementRef;
447
+ #zone;
448
+ #activeCleanup;
449
+ constructor() {
450
+ this.#destroyRef = inject(DestroyRef);
451
+ this.#document = inject(DOCUMENT);
452
+ this.#hostElementRef = inject(ElementRef);
453
+ this.#zone = inject(NgZone);
454
+ this.direction = input.required(...ngDevMode ? [{ debugName: "direction" }] : /* istanbul ignore next */ []);
455
+ this.maxHeight = input(...ngDevMode ? [void 0, { debugName: "maxHeight" }] : /* istanbul ignore next */ []);
456
+ this.maxWidth = input(...ngDevMode ? [void 0, { debugName: "maxWidth" }] : /* istanbul ignore next */ []);
457
+ this.minHeight = input(...ngDevMode ? [void 0, { debugName: "minHeight" }] : /* istanbul ignore next */ []);
458
+ this.minWidth = input(...ngDevMode ? [void 0, { debugName: "minWidth" }] : /* istanbul ignore next */ []);
459
+ this.windowRef = input.required(...ngDevMode ? [{ debugName: "windowRef" }] : /* istanbul ignore next */ []);
460
+ afterNextRender({ write: () => this.#setEvents() });
461
+ this.#destroyRef.onDestroy(() => this.#activeCleanup?.());
462
+ }
463
+ #applyResize(result, initial) {
464
+ const windowRef = this.windowRef();
465
+ windowRef.move({
466
+ left: result.left ?? initial.left,
467
+ top: result.top ?? initial.top
468
+ });
469
+ windowRef.resize({
470
+ height: result.height,
471
+ width: result.width
472
+ });
473
+ windowRef.resize$$.next({
474
+ width: result.width ?? initial.width,
475
+ height: result.height ?? initial.height,
476
+ left: result.left ?? initial.left,
477
+ top: result.top ?? initial.top
478
+ });
479
+ }
480
+ #bounds() {
481
+ const innerWidth = this.#document.defaultView?.innerWidth || 1200;
482
+ const innerHeight = this.#document.defaultView?.innerHeight || 800;
483
+ return {
484
+ innerWidth,
485
+ innerHeight,
486
+ minWidth: this.minWidth() || 50,
487
+ minHeight: this.minHeight() || 50,
488
+ maxWidth: this.maxWidth() ?? innerWidth,
489
+ maxHeight: this.maxHeight() ?? innerHeight
490
+ };
491
+ }
492
+ #computeResize(direction, deltaX, deltaY, initial, bounds) {
493
+ const { minWidth, minHeight, maxWidth, maxHeight, innerWidth, innerHeight } = bounds;
494
+ let height;
495
+ let left;
496
+ let width;
497
+ let top;
498
+ switch (direction) {
499
+ case "northwest":
500
+ if (initial.top + deltaY <= 0 || initial.height - deltaY < minHeight) return null;
501
+ if (initial.height - deltaY > maxHeight || initial.width - deltaX > maxWidth) return null;
502
+ height = initial.height - deltaY;
503
+ top = initial.top + deltaY;
504
+ if (initial.left + deltaX < 0 || initial.width - deltaX < minWidth) return null;
505
+ width = initial.width - deltaX;
506
+ left = initial.left + deltaX;
507
+ break;
508
+ case "north":
509
+ if (initial.top + deltaY <= 0 || initial.height - deltaY < minHeight) return null;
510
+ if (initial.height - deltaY > maxHeight) return null;
511
+ height = initial.height - deltaY;
512
+ top = initial.top + deltaY;
513
+ break;
514
+ case "northeast":
515
+ if (initial.top + deltaY <= 0 || initial.height - deltaY < minHeight) return null;
516
+ if (initial.height - deltaY > maxHeight || initial.width + deltaX > maxWidth) return null;
517
+ height = initial.height - deltaY;
518
+ top = initial.top + deltaY;
519
+ if (initial.width + deltaX < minWidth || initial.left + initial.width + deltaX > innerWidth) return null;
520
+ width = initial.width + deltaX;
521
+ break;
522
+ case "east":
523
+ if (initial.width + deltaX < minWidth || initial.left + initial.width + deltaX > innerWidth) return null;
524
+ if (initial.width + deltaX > maxWidth) return null;
525
+ width = initial.width + deltaX;
526
+ break;
527
+ case "southeast":
528
+ if (initial.height + deltaY < minHeight || initial.top + initial.height + deltaY > innerHeight) return null;
529
+ if (initial.height + deltaY > maxHeight || initial.width + deltaX > maxWidth) return null;
530
+ height = initial.height + deltaY;
531
+ if (initial.width + deltaX < minWidth || initial.left + initial.width + deltaX > innerWidth) return null;
532
+ width = initial.width + deltaX;
533
+ break;
534
+ case "south":
535
+ if (initial.height + deltaY < minHeight || initial.top + initial.height + deltaY > innerHeight) return null;
536
+ if (initial.height + deltaY > maxHeight) return null;
537
+ height = initial.height + deltaY;
538
+ break;
539
+ case "southwest":
540
+ if (initial.height + deltaY < minHeight || initial.top + initial.height + deltaY > innerHeight) return null;
541
+ if (initial.height + deltaY > maxHeight || initial.width - deltaX > maxWidth) return null;
542
+ height = initial.height + deltaY;
543
+ if (initial.left + deltaX < 0 || initial.width - deltaX < minWidth) return null;
544
+ width = initial.width - deltaX;
545
+ left = initial.left + deltaX;
546
+ break;
547
+ case "west":
548
+ if (initial.left + deltaX < 0 || initial.width - deltaX < minWidth) return null;
549
+ if (initial.width - deltaX > maxWidth) return null;
550
+ width = initial.width - deltaX;
551
+ left = initial.left + deltaX;
552
+ }
553
+ return {
554
+ width,
555
+ height,
556
+ left,
557
+ top
558
+ };
559
+ }
560
+ #onPointerDown(event) {
561
+ if (event.button !== 0 || !event.isPrimary) return;
562
+ event.preventDefault();
563
+ const handle = this.#hostElementRef.nativeElement;
564
+ const pointerId = event.pointerId;
565
+ const rect = this.windowRef().element.getBoundingClientRect();
566
+ const initial = {
567
+ width: rect.width,
568
+ height: rect.height,
569
+ top: rect.top,
570
+ left: rect.left
571
+ };
572
+ const initialX = event.clientX;
573
+ const initialY = event.clientY;
574
+ const oldSelectStart = this.#document.onselectstart;
575
+ const oldDragStart = this.#document.ondragstart;
576
+ this.#document.onselectstart = () => false;
577
+ this.#document.ondragstart = () => false;
578
+ const bounds = this.#bounds();
579
+ const onPointerMove = (moveEvent) => {
580
+ if (moveEvent.pointerId !== pointerId) return;
581
+ const deltaX = moveEvent.clientX - initialX;
582
+ const deltaY = moveEvent.clientY - initialY;
583
+ const result = this.#computeResize(this.direction(), deltaX, deltaY, initial, bounds);
584
+ if (!result) return;
585
+ this.#applyResize(result, initial);
586
+ };
587
+ const cleanup = () => {
588
+ this.#document.removeEventListener("pointermove", onPointerMove);
589
+ this.#document.removeEventListener("pointerup", onPointerEnd);
590
+ this.#document.removeEventListener("pointercancel", onPointerEnd);
591
+ this.#document.onselectstart = oldSelectStart;
592
+ this.#document.ondragstart = oldDragStart;
593
+ if (handle.hasPointerCapture?.(pointerId)) handle.releasePointerCapture(pointerId);
594
+ this.#activeCleanup = void 0;
595
+ };
596
+ const onPointerEnd = (endEvent) => {
597
+ if (endEvent.pointerId === pointerId) cleanup();
598
+ };
599
+ this.#activeCleanup?.();
600
+ this.#activeCleanup = cleanup;
601
+ try {
602
+ handle.setPointerCapture?.(pointerId);
603
+ } catch {}
604
+ this.#document.addEventListener("pointermove", onPointerMove);
605
+ this.#document.addEventListener("pointerup", onPointerEnd);
606
+ this.#document.addEventListener("pointercancel", onPointerEnd);
607
+ }
608
+ #setEvents() {
609
+ this.#zone.runOutsideAngular(() => {
610
+ fromEvent(this.#hostElementRef.nativeElement, "pointerdown").pipe(takeUntilDestroyed(this.#destroyRef)).subscribe((event) => this.#onPointerDown(event));
611
+ });
612
+ }
613
+ static {
614
+ this.ɵfac = i0.ɵɵngDeclareFactory({
615
+ minVersion: "12.0.0",
616
+ version: "22.2.6",
617
+ ngImport: i0,
618
+ type: WindowResizeHandlerDirective,
619
+ deps: [],
620
+ target: i0.ɵɵFactoryTarget.Directive
621
+ });
622
+ }
623
+ static {
624
+ this.ɵdir = i0.ɵɵngDeclareDirective({
625
+ minVersion: "17.1.0",
626
+ version: "22.2.6",
627
+ type: WindowResizeHandlerDirective,
628
+ isStandalone: true,
629
+ selector: "div[monaWindowResizeHandler]",
630
+ inputs: {
631
+ direction: {
632
+ classPropertyName: "direction",
633
+ publicName: "direction",
634
+ isSignal: true,
635
+ isRequired: true,
636
+ transformFunction: null
637
+ },
638
+ maxHeight: {
639
+ classPropertyName: "maxHeight",
640
+ publicName: "maxHeight",
641
+ isSignal: true,
642
+ isRequired: false,
643
+ transformFunction: null
644
+ },
645
+ maxWidth: {
646
+ classPropertyName: "maxWidth",
647
+ publicName: "maxWidth",
648
+ isSignal: true,
649
+ isRequired: false,
650
+ transformFunction: null
651
+ },
652
+ minHeight: {
653
+ classPropertyName: "minHeight",
654
+ publicName: "minHeight",
655
+ isSignal: true,
656
+ isRequired: false,
657
+ transformFunction: null
658
+ },
659
+ minWidth: {
660
+ classPropertyName: "minWidth",
661
+ publicName: "minWidth",
662
+ isSignal: true,
663
+ isRequired: false,
664
+ transformFunction: null
665
+ },
666
+ windowRef: {
667
+ classPropertyName: "windowRef",
668
+ publicName: "windowRef",
669
+ isSignal: true,
670
+ isRequired: true,
671
+ transformFunction: null
672
+ }
673
+ },
674
+ ngImport: i0
675
+ });
676
+ }
677
+ };
678
+ i0.ɵɵngDeclareClassMetadata({
679
+ minVersion: "12.0.0",
680
+ version: "22.2.6",
681
+ ngImport: i0,
682
+ type: WindowResizeHandlerDirective,
683
+ decorators: [{
684
+ type: Directive,
685
+ args: [{ selector: "div[monaWindowResizeHandler]" }]
686
+ }],
687
+ ctorParameters: () => [],
688
+ propDecorators: {
689
+ direction: [{
690
+ type: i0.Input,
691
+ args: [{
692
+ isSignal: true,
693
+ alias: "direction",
694
+ required: true
695
+ }]
696
+ }],
697
+ maxHeight: [{
698
+ type: i0.Input,
699
+ args: [{
700
+ isSignal: true,
701
+ alias: "maxHeight",
702
+ required: false
703
+ }]
704
+ }],
705
+ maxWidth: [{
706
+ type: i0.Input,
707
+ args: [{
708
+ isSignal: true,
709
+ alias: "maxWidth",
710
+ required: false
711
+ }]
712
+ }],
713
+ minHeight: [{
714
+ type: i0.Input,
715
+ args: [{
716
+ isSignal: true,
717
+ alias: "minHeight",
718
+ required: false
719
+ }]
720
+ }],
721
+ minWidth: [{
722
+ type: i0.Input,
723
+ args: [{
724
+ isSignal: true,
725
+ alias: "minWidth",
726
+ required: false
727
+ }]
728
+ }],
729
+ windowRef: [{
730
+ type: i0.Input,
731
+ args: [{
732
+ isSignal: true,
733
+ alias: "windowRef",
734
+ required: true
735
+ }]
736
+ }]
737
+ }
738
+ });
503
739
  const WINDOW_DEFAULT_MESSAGES = {
504
- close: "Close",
505
- closeWindow: "Close window",
506
- maximize: "Maximize",
507
- minimize: "Minimize",
508
- moveOrResizeWindow: "Move or resize window. Use arrow keys to move, or Control and arrow keys to resize.",
509
- moveWindow: "Move window. Use arrow keys to move.",
510
- resizeBottom: "Resize window from the bottom. Use arrow keys to resize.",
511
- resizeBottomLeft: "Resize window from the bottom-left corner. Use arrow keys to resize.",
512
- resizeBottomRight: "Resize window from the bottom-right corner. Use arrow keys to resize.",
513
- resizeLeft: "Resize window from the left. Use arrow keys to resize.",
514
- resizeRight: "Resize window from the right. Use arrow keys to resize.",
515
- resizeTop: "Resize window from the top. Use arrow keys to resize.",
516
- resizeTopLeft: "Resize window from the top-left corner. Use arrow keys to resize.",
517
- resizeTopRight: "Resize window from the top-right corner. Use arrow keys to resize.",
518
- resizeWindow: "Resize window. Use Control and arrow keys to resize.",
519
- restore: "Restore"
740
+ close: "Close",
741
+ closeWindow: "Close window",
742
+ maximize: "Maximize",
743
+ minimize: "Minimize",
744
+ moveOrResizeWindow: "Move or resize window. Use arrow keys to move, or Control and arrow keys to resize.",
745
+ moveWindow: "Move window. Use arrow keys to move.",
746
+ resizeBottom: "Resize window from the bottom. Use arrow keys to resize.",
747
+ resizeBottomLeft: "Resize window from the bottom-left corner. Use arrow keys to resize.",
748
+ resizeBottomRight: "Resize window from the bottom-right corner. Use arrow keys to resize.",
749
+ resizeLeft: "Resize window from the left. Use arrow keys to resize.",
750
+ resizeRight: "Resize window from the right. Use arrow keys to resize.",
751
+ resizeTop: "Resize window from the top. Use arrow keys to resize.",
752
+ resizeTopLeft: "Resize window from the top-left corner. Use arrow keys to resize.",
753
+ resizeTopRight: "Resize window from the top-right corner. Use arrow keys to resize.",
754
+ resizeWindow: "Resize window. Use Control and arrow keys to resize.",
755
+ restore: "Restore"
520
756
  };
521
-
522
757
  const windowBaseThemeVariants = cva(`
523
758
  flex h-full w-full flex-col
524
759
  ${themeOverlaySurfaceClasses} text-foreground
525
760
  `, {
526
- variants: {
527
- rounded: {
528
- none: "rounded-none",
529
- small: "rounded-sm",
530
- medium: "rounded-md",
531
- large: "rounded-lg"
532
- }
533
- },
534
- defaultVariants: {
535
- rounded: "medium"
536
- }
761
+ variants: { rounded: {
762
+ none: "rounded-none",
763
+ small: "rounded-sm",
764
+ medium: "rounded-md",
765
+ large: "rounded-lg"
766
+ } },
767
+ defaultVariants: { rounded: "medium" }
537
768
  });
538
769
  const windowContentContainerThemeVariants = cva(`
539
770
  relative flex h-full w-full flex-col
540
771
  border border-border
541
772
  shadow-(--shadow-overlay)
542
- `, {
543
- variants: {
544
- rounded: {
545
- none: "rounded-none",
546
- small: "rounded-sm",
547
- medium: "rounded-md",
548
- large: "rounded-lg"
549
- }
550
- }
551
- });
773
+ `, { variants: { rounded: {
774
+ none: "rounded-none",
775
+ small: "rounded-sm",
776
+ medium: "rounded-md",
777
+ large: "rounded-lg"
778
+ } } });
552
779
  const windowContentThemeVariants = cva(`
553
780
  flex-1 overflow-auto
554
781
  [scrollbar-color:var(--color-scrollbar-thumb)_var(--color-scrollbar-track)] [scrollbar-width:thin]
555
782
  `);
556
783
  const windowResizerThemeVariants = cva(`
557
784
  absolute flex touch-none
558
- `, {
559
- variants: {
560
- position: {
561
- east: "inset-y-0 -end-0.5 w-2 cursor-ew-resize rtl:-start-0.5 rtl:end-auto",
562
- north: "inset-x-0 -top-0.5 h-2 cursor-ns-resize",
563
- south: "inset-x-0 -bottom-0.5 h-2 cursor-ns-resize",
564
- west: "inset-y-0 -start-0.5 w-2 cursor-ew-resize rtl:-end-0.5 rtl:start-auto",
565
- northeast: "-top-0.5 -end-0.5 w-2 h-2 cursor-nesw-resize rtl:-start-0.5 rtl:end-auto",
566
- northwest: "-top-0.5 -start-0.5 w-2 h-2 cursor-nwse-resize rtl:-end-0.5 rtl:start-auto",
567
- southeast: "-bottom-0.5 -end-0.5 w-2 h-2 cursor-nwse-resize rtl:-start-0.5 rtl:end-auto",
568
- southwest: "-bottom-0.5 -start-0.5 w-2 h-2 cursor-nesw-resize rtl:-end-0.5 rtl:start-auto"
569
- }
570
- }
571
- });
785
+ `, { variants: { position: {
786
+ east: "inset-y-0 -end-0.5 w-2 cursor-ew-resize rtl:-start-0.5 rtl:end-auto",
787
+ north: "inset-x-0 -top-0.5 h-2 cursor-ns-resize",
788
+ south: "inset-x-0 -bottom-0.5 h-2 cursor-ns-resize",
789
+ west: "inset-y-0 -start-0.5 w-2 cursor-ew-resize rtl:-end-0.5 rtl:start-auto",
790
+ northeast: "-top-0.5 -end-0.5 w-2 h-2 cursor-nesw-resize rtl:-start-0.5 rtl:end-auto",
791
+ northwest: "-top-0.5 -start-0.5 w-2 h-2 cursor-nwse-resize rtl:-end-0.5 rtl:start-auto",
792
+ southeast: "-bottom-0.5 -end-0.5 w-2 h-2 cursor-nwse-resize rtl:-start-0.5 rtl:end-auto",
793
+ southwest: "-bottom-0.5 -start-0.5 w-2 h-2 cursor-nesw-resize rtl:-end-0.5 rtl:start-auto"
794
+ } } });
572
795
  const windowTitleBarActionThemeVariants = cva(`
573
796
  flex items-center justify-evenly
574
797
  `);
@@ -576,997 +799,1388 @@ const windowTitleBarThemeVariants = cva(`
576
799
  flex items-center justify-start
577
800
  overflow-hidden px-2 py-1 text-sm
578
801
  border-b border-border-subtle
579
- `, {
580
- variants: {
581
- look: {
582
- default: "bg-surface-muted text-foreground",
583
- primary: "bg-primary text-primary-foreground"
584
- },
585
- rounded: {
586
- none: "rounded-ss-none rounded-se-none",
587
- small: "rounded-ss-sm rounded-se-sm",
588
- medium: "rounded-ss-md rounded-se-md",
589
- large: "rounded-ss-lg rounded-se-lg"
590
- }
591
- }
592
- });
802
+ `, { variants: {
803
+ look: {
804
+ default: "bg-surface-muted text-foreground",
805
+ primary: "bg-primary text-primary-foreground"
806
+ },
807
+ rounded: {
808
+ none: "rounded-ss-none rounded-se-none",
809
+ small: "rounded-ss-sm rounded-se-sm",
810
+ medium: "rounded-ss-md rounded-se-md",
811
+ large: "rounded-ss-lg rounded-se-lg"
812
+ }
813
+ } });
593
814
  const windowTitleContainerThemeVariants = cva(`
594
815
  flex h-full flex-1 items-center overflow-hidden
595
816
  cursor-default select-none text-ellipsis
596
817
  `);
597
818
  const windowTitleThemeVariants = cva(`
598
819
  overflow-hidden text-ellipsis whitespace-nowrap font-semibold
599
- `, {
600
- variants: {
601
- look: {
602
- default: "text-foreground",
603
- primary: "text-primary-foreground"
604
- }
605
- }
820
+ `, { variants: { look: {
821
+ default: "text-foreground",
822
+ primary: "text-primary-foreground"
823
+ } } });
824
+ var ResizePositionPipe = class ResizePositionPipe {
825
+ transform(position) {
826
+ if (!position) return null;
827
+ return windowResizerThemeVariants({ position });
828
+ }
829
+ static {
830
+ this.ɵfac = i0.ɵɵngDeclareFactory({
831
+ minVersion: "12.0.0",
832
+ version: "22.2.6",
833
+ ngImport: i0,
834
+ type: ResizePositionPipe,
835
+ deps: [],
836
+ target: i0.ɵɵFactoryTarget.Pipe
837
+ });
838
+ }
839
+ static {
840
+ this.ɵpipe = i0.ɵɵngDeclarePipe({
841
+ minVersion: "14.0.0",
842
+ version: "22.2.6",
843
+ ngImport: i0,
844
+ type: ResizePositionPipe,
845
+ isStandalone: true,
846
+ name: "monaResizePosition"
847
+ });
848
+ }
849
+ };
850
+ i0.ɵɵngDeclareClassMetadata({
851
+ minVersion: "12.0.0",
852
+ version: "22.2.6",
853
+ ngImport: i0,
854
+ type: ResizePositionPipe,
855
+ decorators: [{
856
+ type: Pipe,
857
+ args: [{ name: "monaResizePosition" }]
858
+ }]
606
859
  });
607
-
608
- class ResizePositionPipe {
609
- transform(position) {
610
- if (!position) {
611
- return null;
612
- }
613
- return windowResizerThemeVariants({ position });
614
- }
615
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: ResizePositionPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
616
- static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "22.0.6", ngImport: i0, type: ResizePositionPipe, isStandalone: true, name: "monaResizePosition" }); }
617
- }
618
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: ResizePositionPipe, decorators: [{
619
- type: Pipe,
620
- args: [{
621
- name: "monaResizePosition"
622
- }]
623
- }] });
624
-
625
- /** Targets inside the title bar whose double-click is their own. */
626
860
  const INTERACTIVE = "a[href], button, input, select, textarea, [contenteditable]:not([contenteditable='false'])";
627
- class WindowContentComponent {
628
- #destroyRef;
629
- #hostElementRef;
630
- #i18n;
631
- #injector;
632
- #localeMessages;
633
- #trapFocus;
634
- #beforeMaximize;
635
- #beforeMinimize;
636
- #componentRef;
637
- constructor() {
638
- this.#destroyRef = inject(DestroyRef);
639
- this.#hostElementRef = inject(ElementRef);
640
- this.#i18n = inject(MonaI18nService);
641
- this.#injector = inject(Injector);
642
- this.#localeMessages = this.#i18n.componentMessages("window", WINDOW_DEFAULT_MESSAGES);
643
- this.#trapFocus = inject(CdkTrapFocus);
644
- this.#beforeMaximize = null;
645
- this.#beforeMinimize = null;
646
- this.#componentRef = null;
647
- this.componentHost = viewChild("componentHost", { ...(ngDevMode ? { debugName: "componentHost" } : /* istanbul ignore next */ {}), read: ViewContainerRef });
648
- this.baseClass = computed(() => {
649
- const rounded = this.windowData.rounded;
650
- return windowBaseThemeVariants({ rounded });
651
- }, /* @ts-ignore */
652
- ...(ngDevMode ? [{ debugName: "baseClass" }] : /* istanbul ignore next */ []));
653
- this.contentClass = computed(() => {
654
- return windowContentThemeVariants();
655
- }, /* @ts-ignore */
656
- ...(ngDevMode ? [{ debugName: "contentClass" }] : /* istanbul ignore next */ []));
657
- this.contentContainerClass = computed(() => {
658
- const rounded = this.windowData.rounded;
659
- return windowContentContainerThemeVariants({ rounded });
660
- }, /* @ts-ignore */
661
- ...(ngDevMode ? [{ debugName: "contentContainerClass" }] : /* istanbul ignore next */ []));
662
- this.headerId = createElementControlId();
663
- this.maximizeIcon = computed(() => {
664
- return this.maximized() ? LucideMinimize : LucideMaximize;
665
- }, /* @ts-ignore */
666
- ...(ngDevMode ? [{ debugName: "maximizeIcon" }] : /* istanbul ignore next */ []));
667
- this.maximized = signal(false, /* @ts-ignore */
668
- ...(ngDevMode ? [{ debugName: "maximized" }] : /* istanbul ignore next */ []));
669
- this.messages = computed(() => {
670
- return mergeMessages(this.#localeMessages(), this.windowData.messages);
671
- }, /* @ts-ignore */
672
- ...(ngDevMode ? [{ debugName: "messages" }] : /* istanbul ignore next */ []));
673
- this.minimizeIcon = computed(() => {
674
- return this.minimized() ? LucideAppWindow : LucideMinus;
675
- }, /* @ts-ignore */
676
- ...(ngDevMode ? [{ debugName: "minimizeIcon" }] : /* istanbul ignore next */ []));
677
- this.minimized = signal(false, /* @ts-ignore */
678
- ...(ngDevMode ? [{ debugName: "minimized" }] : /* istanbul ignore next */ []));
679
- this.resizeDirections = [
680
- "north",
681
- "south",
682
- "east",
683
- "west",
684
- "northeast",
685
- "northwest",
686
- "southeast",
687
- "southwest"
688
- ];
689
- this.titleBarActionClass = computed(() => {
690
- return windowTitleBarActionThemeVariants();
691
- }, /* @ts-ignore */
692
- ...(ngDevMode ? [{ debugName: "titleBarActionClass" }] : /* istanbul ignore next */ []));
693
- this.titleBarClass = computed(() => {
694
- const look = this.windowData.look;
695
- const rounded = this.windowData.rounded;
696
- return windowTitleBarThemeVariants({ look, rounded });
697
- }, /* @ts-ignore */
698
- ...(ngDevMode ? [{ debugName: "titleBarClass" }] : /* istanbul ignore next */ []));
699
- /** The title bar's name, which also says which keys move or resize the window; none when it does neither. */
700
- this.titleBarLabel = computed(() => {
701
- const { draggable, resizable } = this.windowData;
702
- const messages = this.messages();
703
- if (draggable && resizable) {
704
- return messages.moveOrResizeWindow;
705
- }
706
- if (draggable) {
707
- return messages.moveWindow;
708
- }
709
- return resizable ? messages.resizeWindow : null;
710
- }, /* @ts-ignore */
711
- ...(ngDevMode ? [{ debugName: "titleBarLabel" }] : /* istanbul ignore next */ []));
712
- this.titleClass = computed(() => {
713
- const look = this.windowData.look;
714
- return windowTitleThemeVariants({ look });
715
- }, /* @ts-ignore */
716
- ...(ngDevMode ? [{ debugName: "titleClass" }] : /* istanbul ignore next */ []));
717
- this.titleContainerClass = computed(() => {
718
- return windowTitleContainerThemeVariants();
719
- }, /* @ts-ignore */
720
- ...(ngDevMode ? [{ debugName: "titleContainerClass" }] : /* istanbul ignore next */ []));
721
- this.windowData = inject(PopupDataInjectionToken);
722
- this.windowRef = this.windowData.windowReference.windowRef;
723
- const content = this.windowData.content;
724
- this.contentTemplate = content instanceof TemplateRef ? content : null;
725
- this.contentComponent = content && !(content instanceof TemplateRef) ? content : null;
726
- this.hasTitle = !!this.windowData.title || !!this.windowData.titleTemplate;
727
- this.#trapFocus.autoCapture = true;
728
- this.#trapFocus.enabled = this.windowData.modal ?? false;
729
- effect(() => {
730
- const host = this.componentHost();
731
- untracked(() => this.#renderComponent(host));
732
- });
733
- // Capture phase: the window is raised before the title bar captures the pointer for a drag, since moving
734
- // the overlay in the DOM would release that capture.
735
- const raise = () => this.windowData.windowReference.bringToFront();
736
- const host = this.#hostElementRef.nativeElement;
737
- host.addEventListener("pointerdown", raise, { capture: true });
738
- this.#destroyRef.onDestroy(() => {
739
- host.removeEventListener("pointerdown", raise, { capture: true });
740
- this.#componentRef?.destroy();
741
- this.windowData.windowReference.setComponentRef(undefined);
742
- });
743
- afterNextRender({
744
- write: () => {
745
- this.focusElement();
746
- if (isDevMode()) {
747
- this.#warnIfUnnamed();
748
- }
749
- }
750
- });
751
- }
752
- onCloseClick(event) {
753
- this.closeWindow(event);
754
- }
755
- /** Focus arriving from outside raises the window, as a click does. */
756
- onFocusIn(event) {
757
- const from = event.relatedTarget;
758
- if (from instanceof Node && this.#hostElementRef.nativeElement.contains(from)) {
759
- return;
760
- }
761
- this.windowData.windowReference.bringToFront();
762
- }
763
- onMaximizeClick() {
764
- if (this.minimized()) {
765
- this.#restoreFromMinimize();
766
- }
767
- if (this.maximized()) {
768
- this.#restoreFromMaximize();
769
- }
770
- else {
771
- this.#maximize();
772
- }
773
- }
774
- onMinimizeClick() {
775
- if (this.minimized()) {
776
- this.#restoreFromMinimize();
777
- }
778
- else {
779
- this.#minimize();
780
- }
781
- }
782
- onTitleBarDoubleClick(event) {
783
- if (!this.windowData.maximizable) {
784
- return;
785
- }
786
- const target = event.target instanceof Element ? event.target.closest(INTERACTIVE) : null;
787
- if (target) {
788
- return;
789
- }
790
- this.onMaximizeClick();
791
- }
792
- #maximize() {
793
- const reference = this.windowData.windowReference;
794
- const { height, width } = reference.size;
795
- this.#beforeMaximize = { placement: reference.placement, size: { height, width } };
796
- this.maximized.set(true);
797
- // CSS lengths follow the viewport as it resizes, within the window's maxWidth and maxHeight.
798
- reference.setSize({ height: "100dvh", width: "100dvw" });
799
- reference.center();
800
- }
801
- #minimize() {
802
- const reference = this.windowData.windowReference;
803
- const { height, minHeight, width } = reference.size;
804
- this.#beforeMinimize = { height, minHeight, width };
805
- this.minimized.set(true);
806
- // Keep the width it has, so a window sized by its content doesn't shrink to its title.
807
- reference.setSize({ height: "fit-content", minHeight: 0, width: width ?? reference.width });
808
- }
809
- #renderComponent(host) {
810
- const type = this.contentComponent;
811
- if (!host || !type || this.#componentRef) {
812
- return;
813
- }
814
- host.clear();
815
- this.#componentRef = host.createComponent(type, { injector: this.#injector });
816
- this.windowData.windowReference.setComponentRef(this.#componentRef);
817
- }
818
- #restoreFromMaximize() {
819
- const saved = this.#beforeMaximize;
820
- this.#beforeMaximize = null;
821
- this.maximized.set(false);
822
- if (saved) {
823
- this.windowData.windowReference.setSize(saved.size);
824
- this.windowData.windowReference.place(saved.placement);
825
- }
826
- }
827
- #restoreFromMinimize() {
828
- const saved = this.#beforeMinimize;
829
- this.#beforeMinimize = null;
830
- this.minimized.set(false);
831
- if (saved) {
832
- this.windowData.windowReference.setSize(saved);
833
- }
834
- }
835
- #warnIfUnnamed() {
836
- if (this.hasTitle || this.windowData.ariaLabel) {
837
- return;
838
- }
839
- console.warn("[Mona Window] A window needs an accessible name. Set a title, a title template or aria-label (ariaLabel in the service settings).", this.#hostElementRef.nativeElement);
840
- }
841
- closeWindow(event) {
842
- // preventClose and close$ get their say inside close(); this button doesn't ask a second time.
843
- const closeEvent = new PopupCloseEvent({ event, via: PopupCloseSource.CloseButton, originalEvent: event });
844
- this.windowData.windowReference.close(closeEvent);
845
- }
846
- focusElement() {
847
- const element = this.windowData.focusedElement;
848
- if (!element) {
849
- return;
850
- }
851
- const windowElement = this.#hostElementRef.nativeElement;
852
- // The focus trap moves focus to its first tabbable element after this runs; marking the target makes it
853
- // land here instead.
854
- focusElement(windowElement, element)?.setAttribute("cdkFocusInitial", "");
855
- }
856
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: WindowContentComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
857
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: WindowContentComponent, isStandalone: true, selector: "mona-window-content", host: { attributes: { "role": "dialog" }, listeners: { "focusin": "onFocusIn($event)" }, properties: { "class": "baseClass()", "attr.aria-label": "hasTitle ? null : windowData.ariaLabel || null", "attr.aria-labelledby": "hasTitle ? headerId : null", "attr.aria-modal": "windowData.modal ? 'true' : 'false'" } }, viewQueries: [{ propertyName: "componentHost", first: true, predicate: ["componentHost"], descendants: true, read: ViewContainerRef, isSignal: true }], hostDirectives: [{ directive: i1.CdkTrapFocus }], ngImport: i0, template: "<div [class]=\"contentContainerClass()\">\n <div\n [class]=\"titleBarClass()\"\n [class.touch-none]=\"windowData.draggable\"\n monaWindowDragHandler\n (dblclick)=\"onTitleBarDoubleClick($event)\"\n [draggable]=\"windowData.draggable && !maximized()\"\n [resizable]=\"windowData.resizable && !maximized() && !minimized()\"\n [minWidth]=\"windowData.minWidth\"\n [minHeight]=\"windowData.minHeight\"\n [maxWidth]=\"windowData.maxWidth\"\n [maxHeight]=\"windowData.maxHeight\"\n [windowRef]=\"windowData.windowReference\"\n [attr.tabindex]=\"titleBarLabel() ? 0 : null\"\n [attr.role]=\"titleBarLabel() ? 'group' : null\"\n [attr.aria-label]=\"titleBarLabel()\">\n <div [id]=\"headerId\" [class]=\"titleContainerClass()\">\n @if (windowData.titleTemplate) {\n <ng-container [ngTemplateOutlet]=\"windowData.titleTemplate\"></ng-container>\n } @else {\n <span [class]=\"titleClass()\">{{ windowData.title ?? \"\" }}</span>\n }\n </div>\n <div [class]=\"titleBarActionClass()\">\n @if (windowData.actionTemplate) {\n <ng-container\n [ngTemplateOutlet]=\"windowData.actionTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: windowRef }\">\n </ng-container>\n }\n @if (windowData.minimizable) {\n @let minimizeTitle = minimized() ? messages().restore : messages().minimize;\n <button\n monaButton\n look=\"ghost\"\n size=\"small\"\n type=\"button\"\n [iconOnly]=\"true\"\n [rounded]=\"windowData.rounded\"\n [title]=\"minimizeTitle\"\n [attr.aria-label]=\"minimizeTitle\"\n (dblclick)=\"$event.stopPropagation()\"\n (click)=\"onMinimizeClick()\">\n <svg [lucideIcon]=\"minimizeIcon()\" [size]=\"16\" aria-hidden=\"true\"></svg>\n </button>\n }\n @if (windowData.maximizable) {\n @let maximizeTitle = maximized() ? messages().restore : messages().maximize;\n <button\n monaButton\n look=\"ghost\"\n size=\"small\"\n type=\"button\"\n [iconOnly]=\"true\"\n [rounded]=\"windowData.rounded\"\n [title]=\"maximizeTitle\"\n [attr.aria-label]=\"maximizeTitle\"\n (dblclick)=\"$event.stopPropagation()\"\n (click)=\"onMaximizeClick()\">\n <svg [lucideIcon]=\"maximizeIcon()\" [size]=\"16\" aria-hidden=\"true\"></svg>\n </button>\n }\n @if (windowData.closable) {\n <button\n monaButton\n look=\"ghost\"\n size=\"small\"\n type=\"button\"\n [iconOnly]=\"true\"\n [rounded]=\"windowData.rounded\"\n [title]=\"messages().close\"\n [attr.aria-label]=\"messages().closeWindow\"\n (dblclick)=\"$event.stopPropagation()\"\n (click)=\"onCloseClick($event)\">\n <svg lucideX [size]=\"16\" aria-hidden=\"true\"></svg>\n </button>\n }\n </div>\n </div>\n <!-- Minimizing hides the content instead of destroying it, so its state survives a restore. -->\n <div [class]=\"contentClass()\" [hidden]=\"minimized()\" [attr.inert]=\"minimized() ? '' : null\">\n @if (contentTemplate) {\n <ng-container\n [ngTemplateOutlet]=\"contentTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: windowData.data, windowRef: windowRef }\"></ng-container>\n } @else if (contentComponent) {\n <ng-container #componentHost></ng-container>\n }\n </div>\n @if (windowData.footerTemplate) {\n <div [hidden]=\"minimized()\" [attr.inert]=\"minimized() ? '' : null\">\n <ng-container [ngTemplateOutlet]=\"windowData.footerTemplate\"></ng-container>\n </div>\n }\n @if (windowData.resizable && !maximized() && !minimized()) {\n @for (direction of resizeDirections; track direction) {\n <div\n monaWindowResizeHandler\n aria-hidden=\"true\"\n [attr.data-direction]=\"direction\"\n [direction]=\"direction\"\n [minWidth]=\"windowData.minWidth\"\n [minHeight]=\"windowData.minHeight\"\n [maxWidth]=\"windowData.maxWidth\"\n [maxHeight]=\"windowData.maxHeight\"\n [windowRef]=\"windowData.windowReference\"\n [class]=\"direction | monaResizePosition\"></div>\n }\n }\n</div>\n", dependencies: [{ kind: "directive", type: WindowDragHandlerDirective, selector: "div[monaWindowDragHandler]", inputs: ["draggable", "maxHeight", "maxWidth", "minHeight", "minWidth", "resizable", "windowRef"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: ButtonDirective, selector: "button[monaButton]", inputs: ["aria-haspopup", "disabled", "iconOnly", "loading", "look", "rounded", "selected", "size", "tabindex", "toggleable", "type", "class", "value"], outputs: ["lookChange", "selectedChange"] }, { kind: "directive", type: WindowResizeHandlerDirective, selector: "div[monaWindowResizeHandler]", inputs: ["direction", "maxHeight", "maxWidth", "minHeight", "minWidth", "windowRef"] }, { kind: "component", type: LucideDynamicIcon, selector: "svg[lucideIcon]", inputs: ["lucideIcon"] }, { kind: "component", type: LucideX, selector: "svg[lucideX]" }, { kind: "pipe", type: ResizePositionPipe, name: "monaResizePosition" }] }); }
858
- }
859
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: WindowContentComponent, decorators: [{
860
- type: Component,
861
- args: [{ selector: "mona-window-content", imports: [
862
- WindowDragHandlerDirective,
863
- NgTemplateOutlet,
864
- ButtonDirective,
865
- WindowResizeHandlerDirective,
866
- ResizePositionPipe,
867
- LucideDynamicIcon,
868
- LucideX
869
- ], host: {
870
- "[class]": "baseClass()",
871
- "[attr.aria-label]": "hasTitle ? null : windowData.ariaLabel || null",
872
- "[attr.aria-labelledby]": "hasTitle ? headerId : null",
873
- "[attr.aria-modal]": "windowData.modal ? 'true' : 'false'",
874
- "(focusin)": "onFocusIn($event)",
875
- role: "dialog"
876
- }, hostDirectives: [CdkTrapFocus], template: "<div [class]=\"contentContainerClass()\">\n <div\n [class]=\"titleBarClass()\"\n [class.touch-none]=\"windowData.draggable\"\n monaWindowDragHandler\n (dblclick)=\"onTitleBarDoubleClick($event)\"\n [draggable]=\"windowData.draggable && !maximized()\"\n [resizable]=\"windowData.resizable && !maximized() && !minimized()\"\n [minWidth]=\"windowData.minWidth\"\n [minHeight]=\"windowData.minHeight\"\n [maxWidth]=\"windowData.maxWidth\"\n [maxHeight]=\"windowData.maxHeight\"\n [windowRef]=\"windowData.windowReference\"\n [attr.tabindex]=\"titleBarLabel() ? 0 : null\"\n [attr.role]=\"titleBarLabel() ? 'group' : null\"\n [attr.aria-label]=\"titleBarLabel()\">\n <div [id]=\"headerId\" [class]=\"titleContainerClass()\">\n @if (windowData.titleTemplate) {\n <ng-container [ngTemplateOutlet]=\"windowData.titleTemplate\"></ng-container>\n } @else {\n <span [class]=\"titleClass()\">{{ windowData.title ?? \"\" }}</span>\n }\n </div>\n <div [class]=\"titleBarActionClass()\">\n @if (windowData.actionTemplate) {\n <ng-container\n [ngTemplateOutlet]=\"windowData.actionTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: windowRef }\">\n </ng-container>\n }\n @if (windowData.minimizable) {\n @let minimizeTitle = minimized() ? messages().restore : messages().minimize;\n <button\n monaButton\n look=\"ghost\"\n size=\"small\"\n type=\"button\"\n [iconOnly]=\"true\"\n [rounded]=\"windowData.rounded\"\n [title]=\"minimizeTitle\"\n [attr.aria-label]=\"minimizeTitle\"\n (dblclick)=\"$event.stopPropagation()\"\n (click)=\"onMinimizeClick()\">\n <svg [lucideIcon]=\"minimizeIcon()\" [size]=\"16\" aria-hidden=\"true\"></svg>\n </button>\n }\n @if (windowData.maximizable) {\n @let maximizeTitle = maximized() ? messages().restore : messages().maximize;\n <button\n monaButton\n look=\"ghost\"\n size=\"small\"\n type=\"button\"\n [iconOnly]=\"true\"\n [rounded]=\"windowData.rounded\"\n [title]=\"maximizeTitle\"\n [attr.aria-label]=\"maximizeTitle\"\n (dblclick)=\"$event.stopPropagation()\"\n (click)=\"onMaximizeClick()\">\n <svg [lucideIcon]=\"maximizeIcon()\" [size]=\"16\" aria-hidden=\"true\"></svg>\n </button>\n }\n @if (windowData.closable) {\n <button\n monaButton\n look=\"ghost\"\n size=\"small\"\n type=\"button\"\n [iconOnly]=\"true\"\n [rounded]=\"windowData.rounded\"\n [title]=\"messages().close\"\n [attr.aria-label]=\"messages().closeWindow\"\n (dblclick)=\"$event.stopPropagation()\"\n (click)=\"onCloseClick($event)\">\n <svg lucideX [size]=\"16\" aria-hidden=\"true\"></svg>\n </button>\n }\n </div>\n </div>\n <!-- Minimizing hides the content instead of destroying it, so its state survives a restore. -->\n <div [class]=\"contentClass()\" [hidden]=\"minimized()\" [attr.inert]=\"minimized() ? '' : null\">\n @if (contentTemplate) {\n <ng-container\n [ngTemplateOutlet]=\"contentTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: windowData.data, windowRef: windowRef }\"></ng-container>\n } @else if (contentComponent) {\n <ng-container #componentHost></ng-container>\n }\n </div>\n @if (windowData.footerTemplate) {\n <div [hidden]=\"minimized()\" [attr.inert]=\"minimized() ? '' : null\">\n <ng-container [ngTemplateOutlet]=\"windowData.footerTemplate\"></ng-container>\n </div>\n }\n @if (windowData.resizable && !maximized() && !minimized()) {\n @for (direction of resizeDirections; track direction) {\n <div\n monaWindowResizeHandler\n aria-hidden=\"true\"\n [attr.data-direction]=\"direction\"\n [direction]=\"direction\"\n [minWidth]=\"windowData.minWidth\"\n [minHeight]=\"windowData.minHeight\"\n [maxWidth]=\"windowData.maxWidth\"\n [maxHeight]=\"windowData.maxHeight\"\n [windowRef]=\"windowData.windowReference\"\n [class]=\"direction | monaResizePosition\"></div>\n }\n }\n</div>\n" }]
877
- }], ctorParameters: () => [], propDecorators: { componentHost: [{ type: i0.ViewChild, args: ["componentHost", { ...{ read: ViewContainerRef }, isSignal: true }] }] } });
878
-
879
- /**
880
- * The `data` a window was opened with, for a component given as its `content`.
881
- * @example
882
- * ```ts
883
- * readonly #data = inject<{ name: string }>(WINDOW_DATA);
884
- * ```
885
- */
861
+ var WindowContentComponent = class WindowContentComponent {
862
+ #destroyRef;
863
+ #hostElementRef;
864
+ #i18n;
865
+ #injector;
866
+ #localeMessages;
867
+ #trapFocus;
868
+ #beforeMaximize;
869
+ #beforeMinimize;
870
+ #componentRef;
871
+ constructor() {
872
+ this.#destroyRef = inject(DestroyRef);
873
+ this.#hostElementRef = inject(ElementRef);
874
+ this.#i18n = inject(MonaI18nService);
875
+ this.#injector = inject(Injector);
876
+ this.#localeMessages = this.#i18n.componentMessages("window", WINDOW_DEFAULT_MESSAGES);
877
+ this.#trapFocus = inject(CdkTrapFocus);
878
+ this.#beforeMaximize = null;
879
+ this.#beforeMinimize = null;
880
+ this.#componentRef = null;
881
+ this.componentHost = viewChild("componentHost", {
882
+ ...ngDevMode ? { debugName: "componentHost" } : /* istanbul ignore next */ {},
883
+ read: ViewContainerRef
884
+ });
885
+ this.baseClass = computed(() => {
886
+ const rounded = this.windowData.rounded;
887
+ return windowBaseThemeVariants({ rounded });
888
+ }, ...ngDevMode ? [{ debugName: "baseClass" }] : /* istanbul ignore next */ []);
889
+ this.contentClass = computed(() => {
890
+ return windowContentThemeVariants();
891
+ }, ...ngDevMode ? [{ debugName: "contentClass" }] : /* istanbul ignore next */ []);
892
+ this.contentContainerClass = computed(() => {
893
+ const rounded = this.windowData.rounded;
894
+ return windowContentContainerThemeVariants({ rounded });
895
+ }, ...ngDevMode ? [{ debugName: "contentContainerClass" }] : /* istanbul ignore next */ []);
896
+ this.headerId = createElementControlId();
897
+ this.maximizeIcon = computed(() => {
898
+ return this.maximized() ? LucideMinimize : LucideMaximize;
899
+ }, ...ngDevMode ? [{ debugName: "maximizeIcon" }] : /* istanbul ignore next */ []);
900
+ this.maximized = signal(false, ...ngDevMode ? [{ debugName: "maximized" }] : /* istanbul ignore next */ []);
901
+ this.messages = computed(() => {
902
+ return mergeMessages(this.#localeMessages(), this.windowData.messages);
903
+ }, ...ngDevMode ? [{ debugName: "messages" }] : /* istanbul ignore next */ []);
904
+ this.minimizeIcon = computed(() => {
905
+ return this.minimized() ? LucideAppWindow : LucideMinus;
906
+ }, ...ngDevMode ? [{ debugName: "minimizeIcon" }] : /* istanbul ignore next */ []);
907
+ this.minimized = signal(false, ...ngDevMode ? [{ debugName: "minimized" }] : /* istanbul ignore next */ []);
908
+ this.resizeDirections = [
909
+ "north",
910
+ "south",
911
+ "east",
912
+ "west",
913
+ "northeast",
914
+ "northwest",
915
+ "southeast",
916
+ "southwest"
917
+ ];
918
+ this.titleBarActionClass = computed(() => {
919
+ return windowTitleBarActionThemeVariants();
920
+ }, ...ngDevMode ? [{ debugName: "titleBarActionClass" }] : /* istanbul ignore next */ []);
921
+ this.titleBarClass = computed(() => {
922
+ const look = this.windowData.look;
923
+ const rounded = this.windowData.rounded;
924
+ return windowTitleBarThemeVariants({
925
+ look,
926
+ rounded
927
+ });
928
+ }, ...ngDevMode ? [{ debugName: "titleBarClass" }] : /* istanbul ignore next */ []);
929
+ this.titleBarLabel = computed(() => {
930
+ const { draggable, resizable } = this.windowData;
931
+ const messages = this.messages();
932
+ if (draggable && resizable) return messages.moveOrResizeWindow;
933
+ if (draggable) return messages.moveWindow;
934
+ return resizable ? messages.resizeWindow : null;
935
+ }, ...ngDevMode ? [{ debugName: "titleBarLabel" }] : /* istanbul ignore next */ []);
936
+ this.titleClass = computed(() => {
937
+ const look = this.windowData.look;
938
+ return windowTitleThemeVariants({ look });
939
+ }, ...ngDevMode ? [{ debugName: "titleClass" }] : /* istanbul ignore next */ []);
940
+ this.titleContainerClass = computed(() => {
941
+ return windowTitleContainerThemeVariants();
942
+ }, ...ngDevMode ? [{ debugName: "titleContainerClass" }] : /* istanbul ignore next */ []);
943
+ this.windowData = inject(PopupDataInjectionToken);
944
+ this.windowRef = this.windowData.windowReference.windowRef;
945
+ const content = this.windowData.content;
946
+ this.contentTemplate = content instanceof TemplateRef ? content : null;
947
+ this.contentComponent = content && !(content instanceof TemplateRef) ? content : null;
948
+ this.hasTitle = !!this.windowData.title || !!this.windowData.titleTemplate;
949
+ this.#trapFocus.autoCapture = true;
950
+ this.#trapFocus.enabled = this.windowData.modal ?? false;
951
+ effect(() => {
952
+ const host = this.componentHost();
953
+ untracked(() => this.#renderComponent(host));
954
+ });
955
+ const raise = () => this.windowData.windowReference.bringToFront();
956
+ const host = this.#hostElementRef.nativeElement;
957
+ host.addEventListener("pointerdown", raise, { capture: true });
958
+ this.#destroyRef.onDestroy(() => {
959
+ host.removeEventListener("pointerdown", raise, { capture: true });
960
+ this.#componentRef?.destroy();
961
+ this.windowData.windowReference.setComponentRef(void 0);
962
+ });
963
+ afterNextRender({ write: () => {
964
+ this.focusElement();
965
+ if (isDevMode()) this.#warnIfUnnamed();
966
+ } });
967
+ }
968
+ onCloseClick(event) {
969
+ this.closeWindow(event);
970
+ }
971
+ onFocusIn(event) {
972
+ const from = event.relatedTarget;
973
+ if (from instanceof Node && this.#hostElementRef.nativeElement.contains(from)) return;
974
+ this.windowData.windowReference.bringToFront();
975
+ }
976
+ onMaximizeClick() {
977
+ if (this.minimized()) this.#restoreFromMinimize();
978
+ if (this.maximized()) this.#restoreFromMaximize();
979
+ else this.#maximize();
980
+ }
981
+ onMinimizeClick() {
982
+ if (this.minimized()) this.#restoreFromMinimize();
983
+ else this.#minimize();
984
+ }
985
+ onTitleBarDoubleClick(event) {
986
+ if (!this.windowData.maximizable) return;
987
+ if (event.target instanceof Element ? event.target.closest(INTERACTIVE) : null) return;
988
+ this.onMaximizeClick();
989
+ }
990
+ #maximize() {
991
+ const reference = this.windowData.windowReference;
992
+ const { height, width } = reference.size;
993
+ this.#beforeMaximize = {
994
+ placement: reference.placement,
995
+ size: {
996
+ height,
997
+ width
998
+ }
999
+ };
1000
+ this.maximized.set(true);
1001
+ reference.setSize({
1002
+ height: "100dvh",
1003
+ width: "100dvw"
1004
+ });
1005
+ reference.center();
1006
+ }
1007
+ #minimize() {
1008
+ const reference = this.windowData.windowReference;
1009
+ const { height, minHeight, width } = reference.size;
1010
+ this.#beforeMinimize = {
1011
+ height,
1012
+ minHeight,
1013
+ width
1014
+ };
1015
+ this.minimized.set(true);
1016
+ reference.setSize({
1017
+ height: "fit-content",
1018
+ minHeight: 0,
1019
+ width: width ?? reference.width
1020
+ });
1021
+ }
1022
+ #renderComponent(host) {
1023
+ const type = this.contentComponent;
1024
+ if (!host || !type || this.#componentRef) return;
1025
+ host.clear();
1026
+ this.#componentRef = host.createComponent(type, { injector: this.#injector });
1027
+ this.windowData.windowReference.setComponentRef(this.#componentRef);
1028
+ }
1029
+ #restoreFromMaximize() {
1030
+ const saved = this.#beforeMaximize;
1031
+ this.#beforeMaximize = null;
1032
+ this.maximized.set(false);
1033
+ if (saved) {
1034
+ this.windowData.windowReference.setSize(saved.size);
1035
+ this.windowData.windowReference.place(saved.placement);
1036
+ }
1037
+ }
1038
+ #restoreFromMinimize() {
1039
+ const saved = this.#beforeMinimize;
1040
+ this.#beforeMinimize = null;
1041
+ this.minimized.set(false);
1042
+ if (saved) this.windowData.windowReference.setSize(saved);
1043
+ }
1044
+ #warnIfUnnamed() {
1045
+ if (this.hasTitle || this.windowData.ariaLabel) return;
1046
+ console.warn("[Mona Window] A window needs an accessible name. Set a title, a title template or aria-label (ariaLabel in the service settings).", this.#hostElementRef.nativeElement);
1047
+ }
1048
+ closeWindow(event) {
1049
+ const closeEvent = new PopupCloseEvent({
1050
+ event,
1051
+ via: PopupCloseSource.CloseButton,
1052
+ originalEvent: event
1053
+ });
1054
+ this.windowData.windowReference.close(closeEvent);
1055
+ }
1056
+ focusElement() {
1057
+ const element = this.windowData.focusedElement;
1058
+ if (!element) return;
1059
+ const windowElement = this.#hostElementRef.nativeElement;
1060
+ focusElement(windowElement, element)?.setAttribute("cdkFocusInitial", "");
1061
+ }
1062
+ static {
1063
+ this.ɵfac = i0.ɵɵngDeclareFactory({
1064
+ minVersion: "12.0.0",
1065
+ version: "22.2.6",
1066
+ ngImport: i0,
1067
+ type: WindowContentComponent,
1068
+ deps: [],
1069
+ target: i0.ɵɵFactoryTarget.Component
1070
+ });
1071
+ }
1072
+ static {
1073
+ this.ɵcmp = i0.ɵɵngDeclareComponent({
1074
+ minVersion: "17.0.0",
1075
+ version: "22.2.6",
1076
+ type: WindowContentComponent,
1077
+ isStandalone: true,
1078
+ selector: "mona-window-content",
1079
+ host: {
1080
+ attributes: { "role": "dialog" },
1081
+ listeners: { "focusin": "onFocusIn($event)" },
1082
+ properties: {
1083
+ "class": "baseClass()",
1084
+ "attr.aria-label": "hasTitle ? null : windowData.ariaLabel || null",
1085
+ "attr.aria-labelledby": "hasTitle ? headerId : null",
1086
+ "attr.aria-modal": "windowData.modal ? 'true' : 'false'"
1087
+ }
1088
+ },
1089
+ viewQueries: [{
1090
+ propertyName: "componentHost",
1091
+ first: true,
1092
+ predicate: ["componentHost"],
1093
+ descendants: true,
1094
+ read: ViewContainerRef,
1095
+ isSignal: true
1096
+ }],
1097
+ hostDirectives: [{ directive: i1.CdkTrapFocus }],
1098
+ ngImport: i0,
1099
+ template: "<div [class]=\"contentContainerClass()\">\n <div\n [class]=\"titleBarClass()\"\n [class.touch-none]=\"windowData.draggable\"\n monaWindowDragHandler\n (dblclick)=\"onTitleBarDoubleClick($event)\"\n [draggable]=\"windowData.draggable && !maximized()\"\n [resizable]=\"windowData.resizable && !maximized() && !minimized()\"\n [minWidth]=\"windowData.minWidth\"\n [minHeight]=\"windowData.minHeight\"\n [maxWidth]=\"windowData.maxWidth\"\n [maxHeight]=\"windowData.maxHeight\"\n [windowRef]=\"windowData.windowReference\"\n [attr.tabindex]=\"titleBarLabel() ? 0 : null\"\n [attr.role]=\"titleBarLabel() ? 'group' : null\"\n [attr.aria-label]=\"titleBarLabel()\">\n <div [id]=\"headerId\" [class]=\"titleContainerClass()\">\n @if (windowData.titleTemplate) {\n <ng-container [ngTemplateOutlet]=\"windowData.titleTemplate\"></ng-container>\n } @else {\n <span [class]=\"titleClass()\">{{ windowData.title ?? \"\" }}</span>\n }\n </div>\n <div [class]=\"titleBarActionClass()\">\n @if (windowData.actionTemplate) {\n <ng-container\n [ngTemplateOutlet]=\"windowData.actionTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: windowRef }\">\n </ng-container>\n }\n @if (windowData.minimizable) {\n @let minimizeTitle = minimized() ? messages().restore : messages().minimize;\n <button\n monaButton\n look=\"ghost\"\n size=\"small\"\n type=\"button\"\n [iconOnly]=\"true\"\n [rounded]=\"windowData.rounded\"\n [title]=\"minimizeTitle\"\n [attr.aria-label]=\"minimizeTitle\"\n (dblclick)=\"$event.stopPropagation()\"\n (click)=\"onMinimizeClick()\">\n <svg [lucideIcon]=\"minimizeIcon()\" [size]=\"16\" aria-hidden=\"true\"></svg>\n </button>\n }\n @if (windowData.maximizable) {\n @let maximizeTitle = maximized() ? messages().restore : messages().maximize;\n <button\n monaButton\n look=\"ghost\"\n size=\"small\"\n type=\"button\"\n [iconOnly]=\"true\"\n [rounded]=\"windowData.rounded\"\n [title]=\"maximizeTitle\"\n [attr.aria-label]=\"maximizeTitle\"\n (dblclick)=\"$event.stopPropagation()\"\n (click)=\"onMaximizeClick()\">\n <svg [lucideIcon]=\"maximizeIcon()\" [size]=\"16\" aria-hidden=\"true\"></svg>\n </button>\n }\n @if (windowData.closable) {\n <button\n monaButton\n look=\"ghost\"\n size=\"small\"\n type=\"button\"\n [iconOnly]=\"true\"\n [rounded]=\"windowData.rounded\"\n [title]=\"messages().close\"\n [attr.aria-label]=\"messages().closeWindow\"\n (dblclick)=\"$event.stopPropagation()\"\n (click)=\"onCloseClick($event)\">\n <svg lucideX [size]=\"16\" aria-hidden=\"true\"></svg>\n </button>\n }\n </div>\n </div>\n <!-- Minimizing hides the content instead of destroying it, so its state survives a restore. -->\n <div [class]=\"contentClass()\" [hidden]=\"minimized()\" [attr.inert]=\"minimized() ? '' : null\">\n @if (contentTemplate) {\n <ng-container\n [ngTemplateOutlet]=\"contentTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: windowData.data, windowRef: windowRef }\"></ng-container>\n } @else if (contentComponent) {\n <ng-container #componentHost></ng-container>\n }\n </div>\n @if (windowData.footerTemplate) {\n <div [hidden]=\"minimized()\" [attr.inert]=\"minimized() ? '' : null\">\n <ng-container [ngTemplateOutlet]=\"windowData.footerTemplate\"></ng-container>\n </div>\n }\n @if (windowData.resizable && !maximized() && !minimized()) {\n @for (direction of resizeDirections; track direction) {\n <div\n monaWindowResizeHandler\n aria-hidden=\"true\"\n [attr.data-direction]=\"direction\"\n [direction]=\"direction\"\n [minWidth]=\"windowData.minWidth\"\n [minHeight]=\"windowData.minHeight\"\n [maxWidth]=\"windowData.maxWidth\"\n [maxHeight]=\"windowData.maxHeight\"\n [windowRef]=\"windowData.windowReference\"\n [class]=\"direction | monaResizePosition\"></div>\n }\n }\n</div>\n",
1100
+ dependencies: [
1101
+ {
1102
+ kind: "directive",
1103
+ type: WindowDragHandlerDirective,
1104
+ selector: "div[monaWindowDragHandler]",
1105
+ inputs: [
1106
+ "draggable",
1107
+ "maxHeight",
1108
+ "maxWidth",
1109
+ "minHeight",
1110
+ "minWidth",
1111
+ "resizable",
1112
+ "windowRef"
1113
+ ]
1114
+ },
1115
+ {
1116
+ kind: "directive",
1117
+ type: NgTemplateOutlet,
1118
+ selector: "[ngTemplateOutlet]",
1119
+ inputs: [
1120
+ "ngTemplateOutletContext",
1121
+ "ngTemplateOutlet",
1122
+ "ngTemplateOutletInjector"
1123
+ ]
1124
+ },
1125
+ {
1126
+ kind: "directive",
1127
+ type: ButtonDirective,
1128
+ selector: "button[monaButton]",
1129
+ inputs: [
1130
+ "aria-haspopup",
1131
+ "disabled",
1132
+ "iconOnly",
1133
+ "loading",
1134
+ "look",
1135
+ "rounded",
1136
+ "selected",
1137
+ "size",
1138
+ "tabindex",
1139
+ "toggleable",
1140
+ "type",
1141
+ "class",
1142
+ "value"
1143
+ ],
1144
+ outputs: ["lookChange", "selectedChange"]
1145
+ },
1146
+ {
1147
+ kind: "directive",
1148
+ type: WindowResizeHandlerDirective,
1149
+ selector: "div[monaWindowResizeHandler]",
1150
+ inputs: [
1151
+ "direction",
1152
+ "maxHeight",
1153
+ "maxWidth",
1154
+ "minHeight",
1155
+ "minWidth",
1156
+ "windowRef"
1157
+ ]
1158
+ },
1159
+ {
1160
+ kind: "component",
1161
+ type: LucideDynamicIcon,
1162
+ selector: "svg[lucideIcon]",
1163
+ inputs: ["lucideIcon"]
1164
+ },
1165
+ {
1166
+ kind: "component",
1167
+ type: LucideX,
1168
+ selector: "svg[lucideX]"
1169
+ },
1170
+ {
1171
+ kind: "pipe",
1172
+ type: ResizePositionPipe,
1173
+ name: "monaResizePosition"
1174
+ }
1175
+ ]
1176
+ });
1177
+ }
1178
+ };
1179
+ i0.ɵɵngDeclareClassMetadata({
1180
+ minVersion: "12.0.0",
1181
+ version: "22.2.6",
1182
+ ngImport: i0,
1183
+ type: WindowContentComponent,
1184
+ decorators: [{
1185
+ type: Component,
1186
+ args: [{
1187
+ selector: "mona-window-content",
1188
+ imports: [
1189
+ WindowDragHandlerDirective,
1190
+ NgTemplateOutlet,
1191
+ ButtonDirective,
1192
+ WindowResizeHandlerDirective,
1193
+ ResizePositionPipe,
1194
+ LucideDynamicIcon,
1195
+ LucideX
1196
+ ],
1197
+ host: {
1198
+ "[class]": "baseClass()",
1199
+ "[attr.aria-label]": "hasTitle ? null : windowData.ariaLabel || null",
1200
+ "[attr.aria-labelledby]": "hasTitle ? headerId : null",
1201
+ "[attr.aria-modal]": "windowData.modal ? 'true' : 'false'",
1202
+ "(focusin)": "onFocusIn($event)",
1203
+ role: "dialog"
1204
+ },
1205
+ hostDirectives: [CdkTrapFocus],
1206
+ template: "<div [class]=\"contentContainerClass()\">\n <div\n [class]=\"titleBarClass()\"\n [class.touch-none]=\"windowData.draggable\"\n monaWindowDragHandler\n (dblclick)=\"onTitleBarDoubleClick($event)\"\n [draggable]=\"windowData.draggable && !maximized()\"\n [resizable]=\"windowData.resizable && !maximized() && !minimized()\"\n [minWidth]=\"windowData.minWidth\"\n [minHeight]=\"windowData.minHeight\"\n [maxWidth]=\"windowData.maxWidth\"\n [maxHeight]=\"windowData.maxHeight\"\n [windowRef]=\"windowData.windowReference\"\n [attr.tabindex]=\"titleBarLabel() ? 0 : null\"\n [attr.role]=\"titleBarLabel() ? 'group' : null\"\n [attr.aria-label]=\"titleBarLabel()\">\n <div [id]=\"headerId\" [class]=\"titleContainerClass()\">\n @if (windowData.titleTemplate) {\n <ng-container [ngTemplateOutlet]=\"windowData.titleTemplate\"></ng-container>\n } @else {\n <span [class]=\"titleClass()\">{{ windowData.title ?? \"\" }}</span>\n }\n </div>\n <div [class]=\"titleBarActionClass()\">\n @if (windowData.actionTemplate) {\n <ng-container\n [ngTemplateOutlet]=\"windowData.actionTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: windowRef }\">\n </ng-container>\n }\n @if (windowData.minimizable) {\n @let minimizeTitle = minimized() ? messages().restore : messages().minimize;\n <button\n monaButton\n look=\"ghost\"\n size=\"small\"\n type=\"button\"\n [iconOnly]=\"true\"\n [rounded]=\"windowData.rounded\"\n [title]=\"minimizeTitle\"\n [attr.aria-label]=\"minimizeTitle\"\n (dblclick)=\"$event.stopPropagation()\"\n (click)=\"onMinimizeClick()\">\n <svg [lucideIcon]=\"minimizeIcon()\" [size]=\"16\" aria-hidden=\"true\"></svg>\n </button>\n }\n @if (windowData.maximizable) {\n @let maximizeTitle = maximized() ? messages().restore : messages().maximize;\n <button\n monaButton\n look=\"ghost\"\n size=\"small\"\n type=\"button\"\n [iconOnly]=\"true\"\n [rounded]=\"windowData.rounded\"\n [title]=\"maximizeTitle\"\n [attr.aria-label]=\"maximizeTitle\"\n (dblclick)=\"$event.stopPropagation()\"\n (click)=\"onMaximizeClick()\">\n <svg [lucideIcon]=\"maximizeIcon()\" [size]=\"16\" aria-hidden=\"true\"></svg>\n </button>\n }\n @if (windowData.closable) {\n <button\n monaButton\n look=\"ghost\"\n size=\"small\"\n type=\"button\"\n [iconOnly]=\"true\"\n [rounded]=\"windowData.rounded\"\n [title]=\"messages().close\"\n [attr.aria-label]=\"messages().closeWindow\"\n (dblclick)=\"$event.stopPropagation()\"\n (click)=\"onCloseClick($event)\">\n <svg lucideX [size]=\"16\" aria-hidden=\"true\"></svg>\n </button>\n }\n </div>\n </div>\n <!-- Minimizing hides the content instead of destroying it, so its state survives a restore. -->\n <div [class]=\"contentClass()\" [hidden]=\"minimized()\" [attr.inert]=\"minimized() ? '' : null\">\n @if (contentTemplate) {\n <ng-container\n [ngTemplateOutlet]=\"contentTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: windowData.data, windowRef: windowRef }\"></ng-container>\n } @else if (contentComponent) {\n <ng-container #componentHost></ng-container>\n }\n </div>\n @if (windowData.footerTemplate) {\n <div [hidden]=\"minimized()\" [attr.inert]=\"minimized() ? '' : null\">\n <ng-container [ngTemplateOutlet]=\"windowData.footerTemplate\"></ng-container>\n </div>\n }\n @if (windowData.resizable && !maximized() && !minimized()) {\n @for (direction of resizeDirections; track direction) {\n <div\n monaWindowResizeHandler\n aria-hidden=\"true\"\n [attr.data-direction]=\"direction\"\n [direction]=\"direction\"\n [minWidth]=\"windowData.minWidth\"\n [minHeight]=\"windowData.minHeight\"\n [maxWidth]=\"windowData.maxWidth\"\n [maxHeight]=\"windowData.maxHeight\"\n [windowRef]=\"windowData.windowReference\"\n [class]=\"direction | monaResizePosition\"></div>\n }\n }\n</div>\n"
1207
+ }]
1208
+ }],
1209
+ ctorParameters: () => [],
1210
+ propDecorators: { componentHost: [{
1211
+ type: i0.ViewChild,
1212
+ args: ["componentHost", {
1213
+ read: ViewContainerRef,
1214
+ isSignal: true
1215
+ }]
1216
+ }] }
1217
+ });
886
1218
  const WINDOW_DATA = new InjectionToken("WINDOW_DATA");
887
-
888
- /**
889
- * A handle on an open window.
890
- * @typeParam R the type of the value passed to `close(value)`
891
- */
892
- class WindowRef {
893
- #options;
894
- constructor(options) {
895
- this.#options = options;
896
- }
897
- /**
898
- * Centers the window in the viewport. It stays centered as its size changes, until it is moved.
899
- */
900
- center() {
901
- this.#options.center();
902
- }
903
- /**
904
- * Closes the window. `close$` can still prevent it.
905
- * @param result the value `closed$` reports
906
- */
907
- close(result) {
908
- this.#options.close(result);
909
- }
910
- /** Closes the window after the given delay, in milliseconds. */
911
- closeWithDelay(delay, result) {
912
- this.#options.closeWithDelay(delay, result);
913
- }
914
- /**
915
- * Moves the window, in pixels from the viewport's top-left corner. An axis that isn't given keeps its place.
916
- */
917
- move(params) {
918
- this.#options.move(params);
919
- }
920
- /**
921
- * Resizes the window, in pixels. A dimension that isn't given keeps its size; `center` centers the window
922
- * afterward.
923
- */
924
- resize(params) {
925
- this.#options.resize(params);
926
- }
927
- /**
928
- * Emits before the window closes, whatever closes it. Call `preventDefault()` to keep it open. Completes once the
929
- * window has closed.
930
- */
931
- get close$() {
932
- return this.#options.close$;
933
- }
934
- /**
935
- * Emits how the window closed, once it has closed, then completes. Replays to late subscribers.
936
- */
937
- get closed$() {
938
- return this.#options.closed$;
939
- }
940
- /** The hosted component, when `content` is a component rather than a `TemplateRef`. */
941
- get component() {
942
- return this.#options.component;
943
- }
944
- /** Emits while the window is dragged. Completes when it closes. */
945
- get drag$() {
946
- return this.#options.drag$;
947
- }
948
- /** Emits when a drag ends. Completes when the window closes. */
949
- get dragEnd$() {
950
- return this.#options.dragEnd$;
951
- }
952
- /** Emits when a drag starts. Completes when the window closes. */
953
- get dragStart$() {
954
- return this.#options.dragStart$;
955
- }
956
- /** The window's overlay element. */
957
- get element() {
958
- return this.#options.element;
959
- }
960
- /** The window's current rendered height, in pixels. */
961
- get height() {
962
- return this.#options.height;
963
- }
964
- /** The underlying `PopupRef`, for advanced overlay access. */
965
- get popupRef() {
966
- return this.#options.popupRef;
967
- }
968
- /** Emits while the window is resized by the user. Completes when it closes. */
969
- get resize$() {
970
- return this.#options.resize$;
971
- }
972
- /** The window's current rendered width, in pixels. */
973
- get width() {
974
- return this.#options.width;
975
- }
976
- }
977
-
978
- /** Marks the overlay hosts that hold a window, so a window can be raised above the other windows. */
1219
+ var WindowRef = class {
1220
+ #options;
1221
+ constructor(options) {
1222
+ this.#options = options;
1223
+ }
1224
+ center() {
1225
+ this.#options.center();
1226
+ }
1227
+ close(result) {
1228
+ this.#options.close(result);
1229
+ }
1230
+ closeWithDelay(delay, result) {
1231
+ this.#options.closeWithDelay(delay, result);
1232
+ }
1233
+ move(params) {
1234
+ this.#options.move(params);
1235
+ }
1236
+ resize(params) {
1237
+ this.#options.resize(params);
1238
+ }
1239
+ get close$() {
1240
+ return this.#options.close$;
1241
+ }
1242
+ get closed$() {
1243
+ return this.#options.closed$;
1244
+ }
1245
+ get component() {
1246
+ return this.#options.component;
1247
+ }
1248
+ get drag$() {
1249
+ return this.#options.drag$;
1250
+ }
1251
+ get dragEnd$() {
1252
+ return this.#options.dragEnd$;
1253
+ }
1254
+ get dragStart$() {
1255
+ return this.#options.dragStart$;
1256
+ }
1257
+ get element() {
1258
+ return this.#options.element;
1259
+ }
1260
+ get height() {
1261
+ return this.#options.height;
1262
+ }
1263
+ get popupRef() {
1264
+ return this.#options.popupRef;
1265
+ }
1266
+ get resize$() {
1267
+ return this.#options.resize$;
1268
+ }
1269
+ get width() {
1270
+ return this.#options.width;
1271
+ }
1272
+ };
979
1273
  const WINDOW_HOST_CLASS = "mona-window-host";
980
- /**
981
- * @internal - used by WindowService. Do not export.
982
- */
983
- class WindowReference {
984
- #closed$;
985
- #document;
986
- #options;
987
- #windowRef;
988
- #left;
989
- #top;
990
- constructor(options, document) {
991
- this.#closed$ = new ReplaySubject(1);
992
- this.#left = null;
993
- this.#top = null;
994
- this.move$$ = new Subject();
995
- this.moveEnd$$ = new Subject();
996
- this.moveStart$$ = new Subject();
997
- this.resize$$ = new Subject();
998
- this.#options = options;
999
- this.#document = document;
1000
- this.#windowRef = new WindowRef(this);
1001
- }
1002
- /**
1003
- * Raises the window above the other open windows, keeping focus where it was inside it. Other overlays keep
1004
- * their order.
1005
- */
1006
- bringToFront() {
1007
- const host = this.#popupRefOrThrow.overlayRef.hostElement;
1008
- const container = host.parentElement;
1009
- if (!container) {
1010
- return;
1011
- }
1012
- const windows = Array.from(container.children).filter(child => child.classList.contains(WINDOW_HOST_CLASS));
1013
- const topmost = windows.at(-1);
1014
- if (!topmost || topmost === host) {
1015
- return;
1016
- }
1017
- const active = this.#document.activeElement;
1018
- const focused = active instanceof HTMLElement && host.contains(active) ? active : null;
1019
- topmost.after(host);
1020
- if (focused && this.#document.activeElement !== focused) {
1021
- focused.focus({ preventScroll: true });
1022
- }
1023
- }
1024
- center() {
1025
- this.#left = null;
1026
- this.#top = null;
1027
- this.#place();
1028
- }
1029
- close(result) {
1030
- const event = result instanceof PopupCloseEvent
1031
- ? result
1032
- : new PopupCloseEvent({ result, via: PopupCloseSource.Programmatic });
1033
- this.#popupRefOrThrow.close(event);
1034
- }
1035
- closeWithDelay(delay, result) {
1036
- asapScheduler.schedule(() => this.close(result), delay);
1037
- }
1038
- /**
1039
- * Connects the window to its popup and places it: at `left`/`top`, or centered on an axis that isn't given.
1040
- */
1041
- initializePopupRef(popupRef, placement = {}) {
1042
- this.#options.popupRef = popupRef;
1043
- this.#left = placement.left ?? null;
1044
- this.#top = placement.top ?? null;
1045
- popupRef.overlayRef.hostElement.classList.add(WINDOW_HOST_CLASS);
1046
- this.#place();
1047
- popupRef.closed.pipe(take(1)).subscribe(event => {
1048
- this.move$$.complete();
1049
- this.moveEnd$$.complete();
1050
- this.moveStart$$.complete();
1051
- this.resize$$.complete();
1052
- this.#closed$.next({
1053
- value: event.result,
1054
- via: event.via ?? PopupCloseSource.Programmatic
1055
- });
1056
- this.#closed$.complete();
1057
- });
1058
- }
1059
- /**
1060
- * Moves the window. An axis that isn't given keeps its place.
1061
- */
1062
- move(params) {
1063
- if (params.left != null) {
1064
- this.#left = params.left;
1065
- }
1066
- if (params.top != null) {
1067
- this.#top = params.top;
1068
- }
1069
- this.#place();
1070
- }
1071
- /**
1072
- * Places the window on both axes at once; `null` centers it on that axis.
1073
- */
1074
- place(placement) {
1075
- this.#left = placement.left;
1076
- this.#top = placement.top;
1077
- this.#place();
1078
- }
1079
- /**
1080
- * Resizes the window. A dimension that isn't given keeps its size.
1081
- */
1082
- resize(params) {
1083
- const size = {};
1084
- if (params.width != null) {
1085
- size.width = params.width;
1086
- }
1087
- if (params.height != null) {
1088
- size.height = params.height;
1089
- }
1090
- if (size.width != null || size.height != null) {
1091
- this.setSize(size);
1092
- }
1093
- if (params.center) {
1094
- this.center();
1095
- }
1096
- }
1097
- setComponentRef(componentRef) {
1098
- this.#options.componentRef = componentRef;
1099
- }
1100
- /**
1101
- * Sets any of the overlay's sizes, CSS lengths included. Sizes that aren't given keep their value.
1102
- */
1103
- setSize(size) {
1104
- this.#popupRefOrThrow.overlayRef.updateSize(size);
1105
- }
1106
- #place() {
1107
- positionGlobalOverlay(this.#popupRefOrThrow.overlayRef, { left: this.#left, top: this.#top });
1108
- }
1109
- get close$() {
1110
- const popupRef = this.#popupRefOrThrow;
1111
- return popupRef.beforeClose.pipe(takeUntil(merge(popupRef.closed, this.#closed$).pipe(take(1))), map(event => event));
1112
- }
1113
- get closed$() {
1114
- return this.#closed$.asObservable();
1115
- }
1116
- get component() {
1117
- return this.#options.componentRef ?? null;
1118
- }
1119
- get drag$() {
1120
- return this.move$$.asObservable();
1121
- }
1122
- get dragEnd$() {
1123
- return this.moveEnd$$.asObservable();
1124
- }
1125
- get dragStart$() {
1126
- return this.moveStart$$.asObservable();
1127
- }
1128
- get element() {
1129
- return this.#popupRefOrThrow.overlayRef.overlayElement;
1130
- }
1131
- get height() {
1132
- return this.element.offsetHeight;
1133
- }
1134
- /** Where the window was last placed; `null` on an axis it is centered on. */
1135
- get placement() {
1136
- return { left: this.#left, top: this.#top };
1137
- }
1138
- get popupRef() {
1139
- return this.#popupRefOrThrow;
1140
- }
1141
- get resize$() {
1142
- return this.resize$$.asObservable();
1143
- }
1144
- /** The sizes the overlay was last given, as set (pixels or CSS lengths). */
1145
- get size() {
1146
- const { height, maxHeight, maxWidth, minHeight, minWidth, width } = this.#popupRefOrThrow.overlayRef.getConfig();
1147
- return { height, maxHeight, maxWidth, minHeight, minWidth, width };
1148
- }
1149
- get width() {
1150
- return this.element.offsetWidth;
1151
- }
1152
- get windowRef() {
1153
- return this.#windowRef;
1154
- }
1155
- get #popupRefOrThrow() {
1156
- if (!this.#options.popupRef) {
1157
- throw new Error("WindowReference: popupRef has not been initialized.");
1158
- }
1159
- return this.#options.popupRef;
1160
- }
1161
- }
1162
-
1274
+ var WindowReference = class {
1275
+ #closed$;
1276
+ #document;
1277
+ #options;
1278
+ #windowRef;
1279
+ #left;
1280
+ #top;
1281
+ constructor(options, document) {
1282
+ this.#closed$ = new ReplaySubject(1);
1283
+ this.#left = null;
1284
+ this.#top = null;
1285
+ this.move$$ = new Subject();
1286
+ this.moveEnd$$ = new Subject();
1287
+ this.moveStart$$ = new Subject();
1288
+ this.resize$$ = new Subject();
1289
+ this.#options = options;
1290
+ this.#document = document;
1291
+ this.#windowRef = new WindowRef(this);
1292
+ }
1293
+ bringToFront() {
1294
+ const host = this.#popupRefOrThrow.overlayRef.hostElement;
1295
+ const container = host.parentElement;
1296
+ if (!container) return;
1297
+ const topmost = Array.from(container.children).filter((child) => child.classList.contains(WINDOW_HOST_CLASS)).at(-1);
1298
+ if (!topmost || topmost === host) return;
1299
+ const active = this.#document.activeElement;
1300
+ const focused = active instanceof HTMLElement && host.contains(active) ? active : null;
1301
+ topmost.after(host);
1302
+ if (focused && this.#document.activeElement !== focused) focused.focus({ preventScroll: true });
1303
+ }
1304
+ center() {
1305
+ this.#left = null;
1306
+ this.#top = null;
1307
+ this.#place();
1308
+ }
1309
+ close(result) {
1310
+ const event = result instanceof PopupCloseEvent ? result : new PopupCloseEvent({
1311
+ result,
1312
+ via: PopupCloseSource.Programmatic
1313
+ });
1314
+ this.#popupRefOrThrow.close(event);
1315
+ }
1316
+ closeWithDelay(delay, result) {
1317
+ asapScheduler.schedule(() => this.close(result), delay);
1318
+ }
1319
+ initializePopupRef(popupRef, placement = {}) {
1320
+ this.#options.popupRef = popupRef;
1321
+ this.#left = placement.left ?? null;
1322
+ this.#top = placement.top ?? null;
1323
+ popupRef.overlayRef.hostElement.classList.add(WINDOW_HOST_CLASS);
1324
+ this.#place();
1325
+ popupRef.closed.pipe(take(1)).subscribe((event) => {
1326
+ this.move$$.complete();
1327
+ this.moveEnd$$.complete();
1328
+ this.moveStart$$.complete();
1329
+ this.resize$$.complete();
1330
+ this.#closed$.next({
1331
+ value: event.result,
1332
+ via: event.via ?? PopupCloseSource.Programmatic
1333
+ });
1334
+ this.#closed$.complete();
1335
+ });
1336
+ }
1337
+ move(params) {
1338
+ if (params.left != null) this.#left = params.left;
1339
+ if (params.top != null) this.#top = params.top;
1340
+ this.#place();
1341
+ }
1342
+ place(placement) {
1343
+ this.#left = placement.left;
1344
+ this.#top = placement.top;
1345
+ this.#place();
1346
+ }
1347
+ resize(params) {
1348
+ const size = {};
1349
+ if (params.width != null) size.width = params.width;
1350
+ if (params.height != null) size.height = params.height;
1351
+ if (size.width != null || size.height != null) this.setSize(size);
1352
+ if (params.center) this.center();
1353
+ }
1354
+ setComponentRef(componentRef) {
1355
+ this.#options.componentRef = componentRef;
1356
+ }
1357
+ setSize(size) {
1358
+ this.#popupRefOrThrow.overlayRef.updateSize(size);
1359
+ }
1360
+ #place() {
1361
+ positionGlobalOverlay(this.#popupRefOrThrow.overlayRef, {
1362
+ left: this.#left,
1363
+ top: this.#top
1364
+ });
1365
+ }
1366
+ get close$() {
1367
+ const popupRef = this.#popupRefOrThrow;
1368
+ return popupRef.beforeClose.pipe(takeUntil(merge(popupRef.closed, this.#closed$).pipe(take(1))), map((event) => event));
1369
+ }
1370
+ get closed$() {
1371
+ return this.#closed$.asObservable();
1372
+ }
1373
+ get component() {
1374
+ return this.#options.componentRef ?? null;
1375
+ }
1376
+ get drag$() {
1377
+ return this.move$$.asObservable();
1378
+ }
1379
+ get dragEnd$() {
1380
+ return this.moveEnd$$.asObservable();
1381
+ }
1382
+ get dragStart$() {
1383
+ return this.moveStart$$.asObservable();
1384
+ }
1385
+ get element() {
1386
+ return this.#popupRefOrThrow.overlayRef.overlayElement;
1387
+ }
1388
+ get height() {
1389
+ return this.element.offsetHeight;
1390
+ }
1391
+ get placement() {
1392
+ return {
1393
+ left: this.#left,
1394
+ top: this.#top
1395
+ };
1396
+ }
1397
+ get popupRef() {
1398
+ return this.#popupRefOrThrow;
1399
+ }
1400
+ get resize$() {
1401
+ return this.resize$$.asObservable();
1402
+ }
1403
+ get size() {
1404
+ const { height, maxHeight, maxWidth, minHeight, minWidth, width } = this.#popupRefOrThrow.overlayRef.getConfig();
1405
+ return {
1406
+ height,
1407
+ maxHeight,
1408
+ maxWidth,
1409
+ minHeight,
1410
+ minWidth,
1411
+ width
1412
+ };
1413
+ }
1414
+ get width() {
1415
+ return this.element.offsetWidth;
1416
+ }
1417
+ get windowRef() {
1418
+ return this.#windowRef;
1419
+ }
1420
+ get #popupRefOrThrow() {
1421
+ if (!this.#options.popupRef) throw new Error("WindowReference: popupRef has not been initialized.");
1422
+ return this.#options.popupRef;
1423
+ }
1424
+ };
1163
1425
  const createWindowInjectorData = (settings) => {
1164
- return {
1165
- actionTemplate: settings.actionTemplate,
1166
- ariaLabel: settings.ariaLabel,
1167
- closable: settings.closable ?? true,
1168
- closeOnEscape: settings.closeOnEscape ?? true,
1169
- content: settings.content,
1170
- data: settings.data,
1171
- draggable: settings.draggable ?? false,
1172
- focusedElement: settings.focusedElement,
1173
- footerTemplate: settings.footerTemplate,
1174
- height: settings.height,
1175
- left: settings.left,
1176
- look: settings.look ?? "default",
1177
- maxHeight: settings.maxHeight,
1178
- maxWidth: settings.maxWidth,
1179
- maximizable: settings.maximizable ?? true,
1180
- messages: settings.messages,
1181
- minHeight: settings.minHeight ?? DEFAULT_MIN_WINDOW_HEIGHT,
1182
- minWidth: settings.minWidth ?? DEFAULT_MIN_WINDOW_WIDTH,
1183
- minimizable: settings.minimizable ?? true,
1184
- modal: settings.modal,
1185
- resizable: settings.resizable ?? false,
1186
- rounded: settings.rounded ?? "medium",
1187
- title: typeof settings.title === "string" ? settings.title : undefined,
1188
- titleTemplate: typeof settings.title === "string" ? undefined : settings.title,
1189
- top: settings.top,
1190
- width: settings.width
1191
- };
1426
+ return {
1427
+ actionTemplate: settings.actionTemplate,
1428
+ ariaLabel: settings.ariaLabel,
1429
+ closable: settings.closable ?? true,
1430
+ closeOnEscape: settings.closeOnEscape ?? true,
1431
+ content: settings.content,
1432
+ data: settings.data,
1433
+ draggable: settings.draggable ?? false,
1434
+ focusedElement: settings.focusedElement,
1435
+ footerTemplate: settings.footerTemplate,
1436
+ height: settings.height,
1437
+ left: settings.left,
1438
+ look: settings.look ?? "default",
1439
+ maxHeight: settings.maxHeight,
1440
+ maxWidth: settings.maxWidth,
1441
+ maximizable: settings.maximizable ?? true,
1442
+ messages: settings.messages,
1443
+ minHeight: settings.minHeight ?? 50,
1444
+ minWidth: settings.minWidth ?? 50,
1445
+ minimizable: settings.minimizable ?? true,
1446
+ modal: settings.modal,
1447
+ resizable: settings.resizable ?? false,
1448
+ rounded: settings.rounded ?? "medium",
1449
+ title: typeof settings.title === "string" ? settings.title : void 0,
1450
+ titleTemplate: typeof settings.title === "string" ? void 0 : settings.title,
1451
+ top: settings.top,
1452
+ width: settings.width
1453
+ };
1192
1454
  };
1193
-
1194
- class WindowService {
1195
- #document = inject(DOCUMENT);
1196
- #injector = inject(Injector);
1197
- #popupService = inject(PopupService);
1198
- /**
1199
- * Opens a window.
1200
- * @typeParam R the type of the value passed to `WindowRef.close(value)`
1201
- * @typeParam D the type of `data`
1202
- */
1203
- open(settings) {
1204
- const modal = settings.modal ?? false;
1205
- const windowReference = new WindowReference({}, this.#document);
1206
- const injectorData = {
1207
- ...createWindowInjectorData(settings),
1208
- windowReference: windowReference
1209
- };
1210
- const windowClass = typeof settings.windowClass === "string" ? [settings.windowClass] : settings.windowClass;
1211
- const popupRef = this.#popupService.create({
1212
- anchor: this.#document.body,
1213
- backdropClass: modal
1214
- ? ["fixed", "inset-0", "bg-background/50", "transition-opacity", "z-40", "backdrop-blur-xs"]
1215
- : "transparent",
1216
- blockScroll: modal,
1217
- closeOnBackdropClick: false,
1218
- closeOnEscape: settings.closeOnEscape ?? true,
1219
- closeOnOutsideClick: false,
1220
- content: WindowContentComponent,
1221
- data: injectorData,
1222
- hasBackdrop: modal,
1223
- height: settings.height ?? "fit-content",
1224
- injector: settings.injector,
1225
- maxHeight: settings.maxHeight ?? "100dvh",
1226
- maxWidth: settings.maxWidth ?? "100dvw",
1227
- minHeight: settings.minHeight,
1228
- minWidth: settings.minWidth,
1229
- // A window dragged past an edge keeps its size instead of shrinking to fit the overlay wrapper.
1230
- popupClass: [
1231
- "shrink-0",
1232
- ...(windowClass ?? []).flatMap(name => name.split(/\s+/)).filter(name => name !== "")
1233
- ],
1234
- popupWrapperClass: "mona-popup-constrain-height",
1235
- positionStrategy: "global",
1236
- preventClose: settings.preventClose,
1237
- providers: [
1238
- { provide: WindowRef, useFactory: forwardRef(() => windowReference.windowRef) },
1239
- { provide: WINDOW_DATA, useValue: settings.data }
1240
- ],
1241
- width: settings.width
1242
- });
1243
- windowReference.initializePopupRef(popupRef, { left: settings.left, top: settings.top });
1244
- if (modal) {
1245
- const release = inertOutside(popupRef.overlayRef.hostElement);
1246
- merge(popupRef.closeStart, popupRef.closed)
1247
- .pipe(take(1))
1248
- .subscribe(() => release());
1249
- }
1250
- // Once rendered, center again from the real size, in case the content changed it.
1251
- afterNextRender({ write: () => popupRef.overlayRef.updatePosition() }, { injector: this.#injector });
1252
- return windowReference.windowRef;
1253
- }
1254
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: WindowService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
1255
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: WindowService, providedIn: "root" }); }
1256
- }
1257
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: WindowService, decorators: [{
1258
- type: Injectable,
1259
- args: [{
1260
- providedIn: "root"
1261
- }]
1262
- }] });
1263
-
1264
- class WindowComponent {
1265
- #destroyRef;
1266
- #windowService;
1267
- #destroyed;
1268
- #windowRef;
1269
- constructor() {
1270
- this.#destroyRef = inject(DestroyRef);
1271
- this.#windowService = inject(WindowService);
1272
- this.#destroyed = false;
1273
- this.actionTemplate = contentChild(WindowActionTemplateDirective, { ...(ngDevMode ? { debugName: "actionTemplate" } : /* istanbul ignore next */ {}), read: TemplateRef });
1274
- this.contentTemplate = contentChild(WindowContentTemplateDirective, { ...(ngDevMode ? { debugName: "contentTemplate" } : /* istanbul ignore next */ {}), read: TemplateRef });
1275
- this.footerTemplate = contentChild(WindowFooterTemplateDirective, { ...(ngDevMode ? { debugName: "footerTemplate" } : /* istanbul ignore next */ {}), read: TemplateRef });
1276
- this.projectedContent = viewChild.required("projectedContent", { ...(ngDevMode ? { debugName: "projectedContent" } : /* istanbul ignore next */ {}), read: TemplateRef });
1277
- this.titleTemplate = contentChild(WindowTitleTemplateDirective, { ...(ngDevMode ? { debugName: "titleTemplate" } : /* istanbul ignore next */ {}), read: TemplateRef });
1278
- /**
1279
- * @description Accessible name for the window when it has no `title` or title template.
1280
- */
1281
- this.ariaLabel = input(undefined, { ...(ngDevMode ? { debugName: "ariaLabel" } : /* istanbul ignore next */ {}), alias: "aria-label" });
1282
- /**
1283
- * @description Sets the visibility of the close button in the window header.
1284
- * @default true
1285
- */
1286
- this.closable = input(true, /* @ts-ignore */
1287
- ...(ngDevMode ? [{ debugName: "closable" }] : /* istanbul ignore next */ []));
1288
- /**
1289
- * @description Emits before the window closes, whatever closes it: the close button, Escape, a programmatic close,
1290
- * or the component being destroyed. Call `preventDefault()` to keep it open (a close caused by destruction can't
1291
- * be kept).
1292
- */
1293
- // eslint-disable-next-line @angular-eslint/no-output-native
1294
- this.close = output();
1295
- /**
1296
- * @description Sets whether the window should close when the escape key is pressed.
1297
- * @default true
1298
- */
1299
- this.closeOnEscape = input(true, /* @ts-ignore */
1300
- ...(ngDevMode ? [{ debugName: "closeOnEscape" }] : /* istanbul ignore next */ []));
1301
- /**
1302
- * @description Emitted after the window has fully closed (post-animation). Preventing this event has no effect.
1303
- */
1304
- this.closed = output();
1305
- /**
1306
- * @description Emits when the window dragging ends.
1307
- */
1308
- this.dragEnd = output();
1309
- /**
1310
- * @description Emits when the window dragging starts.
1311
- */
1312
- this.dragStart = output();
1313
- /**
1314
- * @description Sets whether the window can be dragged by the user.
1315
- * @default true
1316
- */
1317
- this.draggable = input(true, /* @ts-ignore */
1318
- ...(ngDevMode ? [{ debugName: "draggable" }] : /* istanbul ignore next */ []));
1319
- /**
1320
- * @description Sets the element that should receive focus when the window is opened.
1321
- * Accepts an element reference or a query selector string.
1322
- */
1323
- this.focusedElement = input(/* @ts-ignore */
1324
- ...(ngDevMode ? [undefined, { debugName: "focusedElement" }] : /* istanbul ignore next */ []));
1325
- /**
1326
- * @description Sets the height of the window.
1327
- */
1328
- this.height = model(/* @ts-ignore */
1329
- ...(ngDevMode ? [undefined, { debugName: "height" }] : /* istanbul ignore next */ []));
1330
- /**
1331
- * @description Sets the left position of the window.
1332
- */
1333
- this.left = model(/* @ts-ignore */
1334
- ...(ngDevMode ? [undefined, { debugName: "left" }] : /* istanbul ignore next */ []));
1335
- /**
1336
- * @description Sets the look of the window.
1337
- * @default "default"
1338
- */
1339
- this.look = input("default", /* @ts-ignore */
1340
- ...(ngDevMode ? [{ debugName: "look" }] : /* istanbul ignore next */ []));
1341
- /**
1342
- * @description Sets the maximum height of the window.
1343
- */
1344
- this.maxHeight = input(/* @ts-ignore */
1345
- ...(ngDevMode ? [undefined, { debugName: "maxHeight" }] : /* istanbul ignore next */ []));
1346
- /**
1347
- * @description Sets the maximum width of the window.
1348
- */
1349
- this.maxWidth = input(/* @ts-ignore */
1350
- ...(ngDevMode ? [undefined, { debugName: "maxWidth" }] : /* istanbul ignore next */ []));
1351
- /**
1352
- * @description Sets whether the user can maximize the window.
1353
- * @default true
1354
- */
1355
- this.maximizable = input(/* @ts-ignore */
1356
- ...(ngDevMode ? [undefined, { debugName: "maximizable" }] : /* istanbul ignore next */ []));
1357
- /**
1358
- * @description Internationalization message overrides for accessible labels.
1359
- */
1360
- this.messages = input(/* @ts-ignore */
1361
- ...(ngDevMode ? [undefined, { debugName: "messages" }] : /* istanbul ignore next */ []));
1362
- /**
1363
- * @description Sets the minimum height of the window.
1364
- */
1365
- this.minHeight = input(/* @ts-ignore */
1366
- ...(ngDevMode ? [undefined, { debugName: "minHeight" }] : /* istanbul ignore next */ []));
1367
- /**
1368
- * @description Sets the minimum width of the window.
1369
- */
1370
- this.minWidth = input(/* @ts-ignore */
1371
- ...(ngDevMode ? [undefined, { debugName: "minWidth" }] : /* istanbul ignore next */ []));
1372
- /**
1373
- * @description Sets whether the user can minimize the window.
1374
- * @default true
1375
- */
1376
- this.minimizable = input(/* @ts-ignore */
1377
- ...(ngDevMode ? [undefined, { debugName: "minimizable" }] : /* istanbul ignore next */ []));
1378
- /**
1379
- * @description Sets whether the window should have an overlay behind it.
1380
- * @default false
1381
- */
1382
- this.modal = input(/* @ts-ignore */
1383
- ...(ngDevMode ? [undefined, { debugName: "modal" }] : /* istanbul ignore next */ []));
1384
- /**
1385
- * @description Sets whether the user can resize the window.
1386
- * @default false
1387
- */
1388
- this.resizable = input(/* @ts-ignore */
1389
- ...(ngDevMode ? [undefined, { debugName: "resizable" }] : /* istanbul ignore next */ []));
1390
- /**
1391
- * @description Sets the border radius of the window.
1392
- * @default "medium"
1393
- */
1394
- this.rounded = input("medium", /* @ts-ignore */
1395
- ...(ngDevMode ? [{ debugName: "rounded" }] : /* istanbul ignore next */ []));
1396
- /**
1397
- * @description Sets the title of the window.
1398
- */
1399
- this.title = input(/* @ts-ignore */
1400
- ...(ngDevMode ? [undefined, { debugName: "title" }] : /* istanbul ignore next */ []));
1401
- /**
1402
- * @description Sets the top position of the window.
1403
- */
1404
- this.top = model(/* @ts-ignore */
1405
- ...(ngDevMode ? [undefined, { debugName: "top" }] : /* istanbul ignore next */ []));
1406
- /**
1407
- * @description Sets the width of the window.
1408
- */
1409
- this.width = model(/* @ts-ignore */
1410
- ...(ngDevMode ? [undefined, { debugName: "width" }] : /* istanbul ignore next */ []));
1411
- effect(() => {
1412
- const top = this.top();
1413
- const left = this.left();
1414
- this.#windowRef?.move({ top, left });
1415
- });
1416
- effect(() => {
1417
- const height = this.height();
1418
- const width = this.width();
1419
- const center = untracked(() => this.top() == null && this.left() == null);
1420
- this.#windowRef?.resize({ height, width, center });
1421
- });
1422
- afterNextRender({ write: () => this.#openWindow() });
1423
- this.#destroyRef.onDestroy(() => {
1424
- // Outputs can't emit once the component is destroyed, so this close is silent.
1425
- this.#destroyed = true;
1426
- this.#windowRef?.close();
1427
- });
1428
- }
1429
- /** Closes the window. */
1430
- closeWindow() {
1431
- this.#windowRef?.close();
1432
- }
1433
- /**
1434
- * Moves the window, in pixels. An axis that isn't given keeps its place.
1435
- */
1436
- move(position) {
1437
- this.#windowRef?.move(position);
1438
- }
1439
- /**
1440
- * Opens the window. Called once after the first render; call it again to reopen a window that was closed. Does
1441
- * nothing while the window is open.
1442
- */
1443
- openWindow() {
1444
- this.#openWindow();
1445
- }
1446
- /**
1447
- * Resizes the window, in pixels. A dimension that isn't given keeps its size.
1448
- */
1449
- resize(dimensions) {
1450
- this.#windowRef?.resize(dimensions);
1451
- }
1452
- #openWindow() {
1453
- if (this.#windowRef || this.#destroyed) {
1454
- return;
1455
- }
1456
- this.#windowRef = this.#windowService.open({
1457
- actionTemplate: this.actionTemplate(),
1458
- ariaLabel: this.ariaLabel(),
1459
- closable: this.closable(),
1460
- closeOnEscape: this.closeOnEscape(),
1461
- content: this.contentTemplate() ?? this.projectedContent(),
1462
- draggable: this.draggable(),
1463
- focusedElement: this.focusedElement(),
1464
- footerTemplate: this.footerTemplate(),
1465
- height: this.height(),
1466
- left: this.left(),
1467
- look: this.look(),
1468
- maxHeight: this.maxHeight(),
1469
- maxWidth: this.maxWidth(),
1470
- maximizable: this.maximizable(),
1471
- messages: this.messages(),
1472
- minHeight: this.minHeight(),
1473
- minWidth: this.minWidth(),
1474
- minimizable: this.minimizable(),
1475
- modal: this.modal(),
1476
- resizable: this.resizable(),
1477
- rounded: this.rounded(),
1478
- title: this.titleTemplate() ?? this.title(),
1479
- top: this.top(),
1480
- width: this.width()
1481
- });
1482
- this.#setSubscriptions();
1483
- }
1484
- #setCloseSubscription() {
1485
- const windowRef = this.#windowRef;
1486
- if (!windowRef) {
1487
- return;
1488
- }
1489
- // Not tied to this component's lifetime: destroying it closes the window, and these finish with it.
1490
- windowRef.close$.subscribe(event => {
1491
- if (!this.#destroyed) {
1492
- this.close.emit(event);
1493
- }
1494
- });
1495
- windowRef.closed$.subscribe(() => {
1496
- if (this.#windowRef === windowRef) {
1497
- this.#windowRef = undefined;
1498
- }
1499
- if (!this.#destroyed) {
1500
- this.closed.emit();
1501
- }
1502
- });
1503
- }
1504
- #setDragSubscription() {
1505
- if (!this.#windowRef) {
1506
- return;
1507
- }
1508
- this.#windowRef.drag$.pipe(takeUntilDestroyed(this.#destroyRef)).subscribe(event => {
1509
- if (event.left != null) {
1510
- this.left.set(event.left);
1511
- }
1512
- if (event.top != null) {
1513
- this.top.set(event.top);
1514
- }
1515
- });
1516
- this.#windowRef.dragEnd$.pipe(takeUntilDestroyed(this.#destroyRef)).subscribe(() => {
1517
- this.dragEnd.emit();
1518
- });
1519
- this.#windowRef.dragStart$.pipe(takeUntilDestroyed(this.#destroyRef)).subscribe(() => {
1520
- this.dragStart.emit();
1521
- });
1522
- }
1523
- #setResizeSubscription() {
1524
- if (!this.#windowRef) {
1525
- return;
1526
- }
1527
- this.#windowRef.resize$.pipe(takeUntilDestroyed(this.#destroyRef)).subscribe(event => {
1528
- if (event.width != null) {
1529
- this.width.set(event.width);
1530
- }
1531
- if (event.height != null) {
1532
- this.height.set(event.height);
1533
- }
1534
- if (event.left != null) {
1535
- this.left.set(event.left);
1536
- }
1537
- if (event.top != null) {
1538
- this.top.set(event.top);
1539
- }
1540
- });
1541
- }
1542
- #setSubscriptions() {
1543
- this.#setCloseSubscription();
1544
- this.#setDragSubscription();
1545
- this.#setResizeSubscription();
1546
- }
1547
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: WindowComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1548
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "22.0.6", type: WindowComponent, isStandalone: true, selector: "mona-window", inputs: { ariaLabel: { classPropertyName: "ariaLabel", publicName: "aria-label", isSignal: true, isRequired: false, transformFunction: null }, closable: { classPropertyName: "closable", publicName: "closable", isSignal: true, isRequired: false, transformFunction: null }, closeOnEscape: { classPropertyName: "closeOnEscape", publicName: "closeOnEscape", isSignal: true, isRequired: false, transformFunction: null }, draggable: { classPropertyName: "draggable", publicName: "draggable", isSignal: true, isRequired: false, transformFunction: null }, focusedElement: { classPropertyName: "focusedElement", publicName: "focusedElement", isSignal: true, isRequired: false, transformFunction: null }, height: { classPropertyName: "height", publicName: "height", isSignal: true, isRequired: false, transformFunction: null }, left: { classPropertyName: "left", publicName: "left", isSignal: true, isRequired: false, transformFunction: null }, look: { classPropertyName: "look", publicName: "look", isSignal: true, isRequired: false, transformFunction: null }, maxHeight: { classPropertyName: "maxHeight", publicName: "maxHeight", isSignal: true, isRequired: false, transformFunction: null }, maxWidth: { classPropertyName: "maxWidth", publicName: "maxWidth", isSignal: true, isRequired: false, transformFunction: null }, maximizable: { classPropertyName: "maximizable", publicName: "maximizable", isSignal: true, isRequired: false, transformFunction: null }, messages: { classPropertyName: "messages", publicName: "messages", isSignal: true, isRequired: false, transformFunction: null }, minHeight: { classPropertyName: "minHeight", publicName: "minHeight", isSignal: true, isRequired: false, transformFunction: null }, minWidth: { classPropertyName: "minWidth", publicName: "minWidth", isSignal: true, isRequired: false, transformFunction: null }, minimizable: { classPropertyName: "minimizable", publicName: "minimizable", isSignal: true, isRequired: false, transformFunction: null }, modal: { classPropertyName: "modal", publicName: "modal", isSignal: true, isRequired: false, transformFunction: null }, resizable: { classPropertyName: "resizable", publicName: "resizable", isSignal: true, isRequired: false, transformFunction: null }, rounded: { classPropertyName: "rounded", publicName: "rounded", isSignal: true, isRequired: false, transformFunction: null }, title: { classPropertyName: "title", publicName: "title", isSignal: true, isRequired: false, transformFunction: null }, top: { classPropertyName: "top", publicName: "top", isSignal: true, isRequired: false, transformFunction: null }, width: { classPropertyName: "width", publicName: "width", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { close: "close", closed: "closed", dragEnd: "dragEnd", dragStart: "dragStart", height: "heightChange", left: "leftChange", top: "topChange", width: "widthChange" }, host: { properties: { "attr.aria-label": "null" }, classAttribute: "hidden" }, queries: [{ propertyName: "actionTemplate", first: true, predicate: WindowActionTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }, { propertyName: "contentTemplate", first: true, predicate: WindowContentTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }, { propertyName: "footerTemplate", first: true, predicate: WindowFooterTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }, { propertyName: "titleTemplate", first: true, predicate: WindowTitleTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }], viewQueries: [{ propertyName: "projectedContent", first: true, predicate: ["projectedContent"], descendants: true, read: TemplateRef, isSignal: true }], ngImport: i0, template: `<ng-template #projectedContent><ng-content /></ng-template>`, isInline: true }); }
1549
- }
1550
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: WindowComponent, decorators: [{
1551
- type: Component,
1552
- args: [{
1553
- selector: "mona-window",
1554
- // Content placed directly inside <mona-window> is the window's content, unless a monaWindowContentTemplate is given.
1555
- template: `<ng-template #projectedContent><ng-content /></ng-template>`,
1556
- host: {
1557
- "[attr.aria-label]": "null",
1558
- class: "hidden"
1559
- }
1560
- }]
1561
- }], ctorParameters: () => [], propDecorators: { actionTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => WindowActionTemplateDirective), { ...{ read: TemplateRef }, isSignal: true }] }], contentTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => WindowContentTemplateDirective), { ...{ read: TemplateRef }, isSignal: true }] }], footerTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => WindowFooterTemplateDirective), { ...{ read: TemplateRef }, isSignal: true }] }], projectedContent: [{ type: i0.ViewChild, args: ["projectedContent", { ...{ read: TemplateRef }, isSignal: true }] }], titleTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => WindowTitleTemplateDirective), { ...{ read: TemplateRef }, isSignal: true }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-label", required: false }] }], closable: [{ type: i0.Input, args: [{ isSignal: true, alias: "closable", required: false }] }], close: [{ type: i0.Output, args: ["close"] }], closeOnEscape: [{ type: i0.Input, args: [{ isSignal: true, alias: "closeOnEscape", required: false }] }], closed: [{ type: i0.Output, args: ["closed"] }], dragEnd: [{ type: i0.Output, args: ["dragEnd"] }], dragStart: [{ type: i0.Output, args: ["dragStart"] }], draggable: [{ type: i0.Input, args: [{ isSignal: true, alias: "draggable", required: false }] }], focusedElement: [{ type: i0.Input, args: [{ isSignal: true, alias: "focusedElement", required: false }] }], height: [{ type: i0.Input, args: [{ isSignal: true, alias: "height", required: false }] }, { type: i0.Output, args: ["heightChange"] }], left: [{ type: i0.Input, args: [{ isSignal: true, alias: "left", required: false }] }, { type: i0.Output, args: ["leftChange"] }], look: [{ type: i0.Input, args: [{ isSignal: true, alias: "look", required: false }] }], maxHeight: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxHeight", required: false }] }], maxWidth: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxWidth", required: false }] }], maximizable: [{ type: i0.Input, args: [{ isSignal: true, alias: "maximizable", required: false }] }], messages: [{ type: i0.Input, args: [{ isSignal: true, alias: "messages", required: false }] }], minHeight: [{ type: i0.Input, args: [{ isSignal: true, alias: "minHeight", required: false }] }], minWidth: [{ type: i0.Input, args: [{ isSignal: true, alias: "minWidth", required: false }] }], minimizable: [{ type: i0.Input, args: [{ isSignal: true, alias: "minimizable", required: false }] }], modal: [{ type: i0.Input, args: [{ isSignal: true, alias: "modal", required: false }] }], resizable: [{ type: i0.Input, args: [{ isSignal: true, alias: "resizable", required: false }] }], rounded: [{ type: i0.Input, args: [{ isSignal: true, alias: "rounded", required: false }] }], title: [{ type: i0.Input, args: [{ isSignal: true, alias: "title", required: false }] }], top: [{ type: i0.Input, args: [{ isSignal: true, alias: "top", required: false }] }, { type: i0.Output, args: ["topChange"] }], width: [{ type: i0.Input, args: [{ isSignal: true, alias: "width", required: false }] }, { type: i0.Output, args: ["widthChange"] }] } });
1562
-
1563
- /*
1564
- * Public API Surface of @nanahoshi/mona-ui/window
1565
- */
1566
-
1567
- /**
1568
- * Generated bundle index. Do not edit.
1569
- */
1570
-
1455
+ var WindowService = class WindowService {
1456
+ #document = inject(DOCUMENT);
1457
+ #injector = inject(Injector);
1458
+ #popupService = inject(PopupService);
1459
+ open(settings) {
1460
+ const modal = settings.modal ?? false;
1461
+ const windowReference = new WindowReference({}, this.#document);
1462
+ const injectorData = {
1463
+ ...createWindowInjectorData(settings),
1464
+ windowReference
1465
+ };
1466
+ const windowClass = typeof settings.windowClass === "string" ? [settings.windowClass] : settings.windowClass;
1467
+ const popupRef = this.#popupService.create({
1468
+ anchor: this.#document.body,
1469
+ backdropClass: modal ? [
1470
+ "fixed",
1471
+ "inset-0",
1472
+ "bg-background/50",
1473
+ "transition-opacity",
1474
+ "z-40",
1475
+ "backdrop-blur-xs"
1476
+ ] : "transparent",
1477
+ blockScroll: modal,
1478
+ closeOnBackdropClick: false,
1479
+ closeOnEscape: settings.closeOnEscape ?? true,
1480
+ closeOnOutsideClick: false,
1481
+ content: WindowContentComponent,
1482
+ data: injectorData,
1483
+ hasBackdrop: modal,
1484
+ height: settings.height ?? "fit-content",
1485
+ injector: settings.injector,
1486
+ maxHeight: settings.maxHeight ?? "100dvh",
1487
+ maxWidth: settings.maxWidth ?? "100dvw",
1488
+ minHeight: settings.minHeight,
1489
+ minWidth: settings.minWidth,
1490
+ popupClass: ["shrink-0", ...(windowClass ?? []).flatMap((name) => name.split(/\s+/)).filter((name) => name !== "")],
1491
+ popupWrapperClass: "mona-popup-constrain-height",
1492
+ positionStrategy: "global",
1493
+ preventClose: settings.preventClose,
1494
+ providers: [{
1495
+ provide: WindowRef,
1496
+ useFactory: forwardRef(() => windowReference.windowRef)
1497
+ }, {
1498
+ provide: WINDOW_DATA,
1499
+ useValue: settings.data
1500
+ }],
1501
+ width: settings.width
1502
+ });
1503
+ windowReference.initializePopupRef(popupRef, {
1504
+ left: settings.left,
1505
+ top: settings.top
1506
+ });
1507
+ if (modal) {
1508
+ const release = inertOutside(popupRef.overlayRef.hostElement);
1509
+ merge(popupRef.closeStart, popupRef.closed).pipe(take(1)).subscribe(() => release());
1510
+ }
1511
+ afterNextRender({ write: () => popupRef.overlayRef.updatePosition() }, { injector: this.#injector });
1512
+ return windowReference.windowRef;
1513
+ }
1514
+ static {
1515
+ this.ɵfac = i0.ɵɵngDeclareFactory({
1516
+ minVersion: "12.0.0",
1517
+ version: "22.2.6",
1518
+ ngImport: i0,
1519
+ type: WindowService,
1520
+ deps: [],
1521
+ target: i0.ɵɵFactoryTarget.Injectable
1522
+ });
1523
+ }
1524
+ static {
1525
+ this.ɵprov = i0.ɵɵngDeclareInjectable({
1526
+ minVersion: "12.0.0",
1527
+ version: "22.2.6",
1528
+ ngImport: i0,
1529
+ type: WindowService,
1530
+ providedIn: "root"
1531
+ });
1532
+ }
1533
+ };
1534
+ i0.ɵɵngDeclareClassMetadata({
1535
+ minVersion: "12.0.0",
1536
+ version: "22.2.6",
1537
+ ngImport: i0,
1538
+ type: WindowService,
1539
+ decorators: [{
1540
+ type: Injectable,
1541
+ args: [{ providedIn: "root" }]
1542
+ }]
1543
+ });
1544
+ var WindowComponent = class WindowComponent {
1545
+ #destroyRef;
1546
+ #windowService;
1547
+ #destroyed;
1548
+ #windowRef;
1549
+ constructor() {
1550
+ this.#destroyRef = inject(DestroyRef);
1551
+ this.#windowService = inject(WindowService);
1552
+ this.#destroyed = false;
1553
+ this.actionTemplate = contentChild(WindowActionTemplateDirective, {
1554
+ ...ngDevMode ? { debugName: "actionTemplate" } : /* istanbul ignore next */ {},
1555
+ read: TemplateRef
1556
+ });
1557
+ this.contentTemplate = contentChild(WindowContentTemplateDirective, {
1558
+ ...ngDevMode ? { debugName: "contentTemplate" } : /* istanbul ignore next */ {},
1559
+ read: TemplateRef
1560
+ });
1561
+ this.footerTemplate = contentChild(WindowFooterTemplateDirective, {
1562
+ ...ngDevMode ? { debugName: "footerTemplate" } : /* istanbul ignore next */ {},
1563
+ read: TemplateRef
1564
+ });
1565
+ this.projectedContent = viewChild.required("projectedContent", {
1566
+ ...ngDevMode ? { debugName: "projectedContent" } : /* istanbul ignore next */ {},
1567
+ read: TemplateRef
1568
+ });
1569
+ this.titleTemplate = contentChild(WindowTitleTemplateDirective, {
1570
+ ...ngDevMode ? { debugName: "titleTemplate" } : /* istanbul ignore next */ {},
1571
+ read: TemplateRef
1572
+ });
1573
+ this.ariaLabel = input(void 0, {
1574
+ ...ngDevMode ? { debugName: "ariaLabel" } : /* istanbul ignore next */ {},
1575
+ alias: "aria-label"
1576
+ });
1577
+ this.closable = input(true, ...ngDevMode ? [{ debugName: "closable" }] : /* istanbul ignore next */ []);
1578
+ this.close = output();
1579
+ this.closeOnEscape = input(true, ...ngDevMode ? [{ debugName: "closeOnEscape" }] : /* istanbul ignore next */ []);
1580
+ this.closed = output();
1581
+ this.dragEnd = output();
1582
+ this.dragStart = output();
1583
+ this.draggable = input(true, ...ngDevMode ? [{ debugName: "draggable" }] : /* istanbul ignore next */ []);
1584
+ this.focusedElement = input(...ngDevMode ? [void 0, { debugName: "focusedElement" }] : /* istanbul ignore next */ []);
1585
+ this.height = model(...ngDevMode ? [void 0, { debugName: "height" }] : /* istanbul ignore next */ []);
1586
+ this.left = model(...ngDevMode ? [void 0, { debugName: "left" }] : /* istanbul ignore next */ []);
1587
+ this.look = input("default", ...ngDevMode ? [{ debugName: "look" }] : /* istanbul ignore next */ []);
1588
+ this.maxHeight = input(...ngDevMode ? [void 0, { debugName: "maxHeight" }] : /* istanbul ignore next */ []);
1589
+ this.maxWidth = input(...ngDevMode ? [void 0, { debugName: "maxWidth" }] : /* istanbul ignore next */ []);
1590
+ this.maximizable = input(...ngDevMode ? [void 0, { debugName: "maximizable" }] : /* istanbul ignore next */ []);
1591
+ this.messages = input(...ngDevMode ? [void 0, { debugName: "messages" }] : /* istanbul ignore next */ []);
1592
+ this.minHeight = input(...ngDevMode ? [void 0, { debugName: "minHeight" }] : /* istanbul ignore next */ []);
1593
+ this.minWidth = input(...ngDevMode ? [void 0, { debugName: "minWidth" }] : /* istanbul ignore next */ []);
1594
+ this.minimizable = input(...ngDevMode ? [void 0, { debugName: "minimizable" }] : /* istanbul ignore next */ []);
1595
+ this.modal = input(...ngDevMode ? [void 0, { debugName: "modal" }] : /* istanbul ignore next */ []);
1596
+ this.resizable = input(...ngDevMode ? [void 0, { debugName: "resizable" }] : /* istanbul ignore next */ []);
1597
+ this.rounded = input("medium", ...ngDevMode ? [{ debugName: "rounded" }] : /* istanbul ignore next */ []);
1598
+ this.title = input(...ngDevMode ? [void 0, { debugName: "title" }] : /* istanbul ignore next */ []);
1599
+ this.top = model(...ngDevMode ? [void 0, { debugName: "top" }] : /* istanbul ignore next */ []);
1600
+ this.width = model(...ngDevMode ? [void 0, { debugName: "width" }] : /* istanbul ignore next */ []);
1601
+ effect(() => {
1602
+ const top = this.top();
1603
+ const left = this.left();
1604
+ this.#windowRef?.move({
1605
+ top,
1606
+ left
1607
+ });
1608
+ });
1609
+ effect(() => {
1610
+ const height = this.height();
1611
+ const width = this.width();
1612
+ const center = untracked(() => this.top() == null && this.left() == null);
1613
+ this.#windowRef?.resize({
1614
+ height,
1615
+ width,
1616
+ center
1617
+ });
1618
+ });
1619
+ afterNextRender({ write: () => this.#openWindow() });
1620
+ this.#destroyRef.onDestroy(() => {
1621
+ this.#destroyed = true;
1622
+ this.#windowRef?.close();
1623
+ });
1624
+ }
1625
+ closeWindow() {
1626
+ this.#windowRef?.close();
1627
+ }
1628
+ move(position) {
1629
+ this.#windowRef?.move(position);
1630
+ }
1631
+ openWindow() {
1632
+ this.#openWindow();
1633
+ }
1634
+ resize(dimensions) {
1635
+ this.#windowRef?.resize(dimensions);
1636
+ }
1637
+ #openWindow() {
1638
+ if (this.#windowRef || this.#destroyed) return;
1639
+ this.#windowRef = this.#windowService.open({
1640
+ actionTemplate: this.actionTemplate(),
1641
+ ariaLabel: this.ariaLabel(),
1642
+ closable: this.closable(),
1643
+ closeOnEscape: this.closeOnEscape(),
1644
+ content: this.contentTemplate() ?? this.projectedContent(),
1645
+ draggable: this.draggable(),
1646
+ focusedElement: this.focusedElement(),
1647
+ footerTemplate: this.footerTemplate(),
1648
+ height: this.height(),
1649
+ left: this.left(),
1650
+ look: this.look(),
1651
+ maxHeight: this.maxHeight(),
1652
+ maxWidth: this.maxWidth(),
1653
+ maximizable: this.maximizable(),
1654
+ messages: this.messages(),
1655
+ minHeight: this.minHeight(),
1656
+ minWidth: this.minWidth(),
1657
+ minimizable: this.minimizable(),
1658
+ modal: this.modal(),
1659
+ resizable: this.resizable(),
1660
+ rounded: this.rounded(),
1661
+ title: this.titleTemplate() ?? this.title(),
1662
+ top: this.top(),
1663
+ width: this.width()
1664
+ });
1665
+ this.#setSubscriptions();
1666
+ }
1667
+ #setCloseSubscription() {
1668
+ const windowRef = this.#windowRef;
1669
+ if (!windowRef) return;
1670
+ windowRef.close$.subscribe((event) => {
1671
+ if (!this.#destroyed) this.close.emit(event);
1672
+ });
1673
+ windowRef.closed$.subscribe(() => {
1674
+ if (this.#windowRef === windowRef) this.#windowRef = void 0;
1675
+ if (!this.#destroyed) this.closed.emit();
1676
+ });
1677
+ }
1678
+ #setDragSubscription() {
1679
+ if (!this.#windowRef) return;
1680
+ this.#windowRef.drag$.pipe(takeUntilDestroyed(this.#destroyRef)).subscribe((event) => {
1681
+ if (event.left != null) this.left.set(event.left);
1682
+ if (event.top != null) this.top.set(event.top);
1683
+ });
1684
+ this.#windowRef.dragEnd$.pipe(takeUntilDestroyed(this.#destroyRef)).subscribe(() => {
1685
+ this.dragEnd.emit();
1686
+ });
1687
+ this.#windowRef.dragStart$.pipe(takeUntilDestroyed(this.#destroyRef)).subscribe(() => {
1688
+ this.dragStart.emit();
1689
+ });
1690
+ }
1691
+ #setResizeSubscription() {
1692
+ if (!this.#windowRef) return;
1693
+ this.#windowRef.resize$.pipe(takeUntilDestroyed(this.#destroyRef)).subscribe((event) => {
1694
+ if (event.width != null) this.width.set(event.width);
1695
+ if (event.height != null) this.height.set(event.height);
1696
+ if (event.left != null) this.left.set(event.left);
1697
+ if (event.top != null) this.top.set(event.top);
1698
+ });
1699
+ }
1700
+ #setSubscriptions() {
1701
+ this.#setCloseSubscription();
1702
+ this.#setDragSubscription();
1703
+ this.#setResizeSubscription();
1704
+ }
1705
+ static {
1706
+ this.ɵfac = i0.ɵɵngDeclareFactory({
1707
+ minVersion: "12.0.0",
1708
+ version: "22.2.6",
1709
+ ngImport: i0,
1710
+ type: WindowComponent,
1711
+ deps: [],
1712
+ target: i0.ɵɵFactoryTarget.Component
1713
+ });
1714
+ }
1715
+ static {
1716
+ this.ɵcmp = i0.ɵɵngDeclareComponent({
1717
+ minVersion: "17.2.0",
1718
+ version: "22.2.6",
1719
+ type: WindowComponent,
1720
+ isStandalone: true,
1721
+ selector: "mona-window",
1722
+ inputs: {
1723
+ ariaLabel: {
1724
+ classPropertyName: "ariaLabel",
1725
+ publicName: "aria-label",
1726
+ isSignal: true,
1727
+ isRequired: false,
1728
+ transformFunction: null
1729
+ },
1730
+ closable: {
1731
+ classPropertyName: "closable",
1732
+ publicName: "closable",
1733
+ isSignal: true,
1734
+ isRequired: false,
1735
+ transformFunction: null
1736
+ },
1737
+ closeOnEscape: {
1738
+ classPropertyName: "closeOnEscape",
1739
+ publicName: "closeOnEscape",
1740
+ isSignal: true,
1741
+ isRequired: false,
1742
+ transformFunction: null
1743
+ },
1744
+ draggable: {
1745
+ classPropertyName: "draggable",
1746
+ publicName: "draggable",
1747
+ isSignal: true,
1748
+ isRequired: false,
1749
+ transformFunction: null
1750
+ },
1751
+ focusedElement: {
1752
+ classPropertyName: "focusedElement",
1753
+ publicName: "focusedElement",
1754
+ isSignal: true,
1755
+ isRequired: false,
1756
+ transformFunction: null
1757
+ },
1758
+ height: {
1759
+ classPropertyName: "height",
1760
+ publicName: "height",
1761
+ isSignal: true,
1762
+ isRequired: false,
1763
+ transformFunction: null
1764
+ },
1765
+ left: {
1766
+ classPropertyName: "left",
1767
+ publicName: "left",
1768
+ isSignal: true,
1769
+ isRequired: false,
1770
+ transformFunction: null
1771
+ },
1772
+ look: {
1773
+ classPropertyName: "look",
1774
+ publicName: "look",
1775
+ isSignal: true,
1776
+ isRequired: false,
1777
+ transformFunction: null
1778
+ },
1779
+ maxHeight: {
1780
+ classPropertyName: "maxHeight",
1781
+ publicName: "maxHeight",
1782
+ isSignal: true,
1783
+ isRequired: false,
1784
+ transformFunction: null
1785
+ },
1786
+ maxWidth: {
1787
+ classPropertyName: "maxWidth",
1788
+ publicName: "maxWidth",
1789
+ isSignal: true,
1790
+ isRequired: false,
1791
+ transformFunction: null
1792
+ },
1793
+ maximizable: {
1794
+ classPropertyName: "maximizable",
1795
+ publicName: "maximizable",
1796
+ isSignal: true,
1797
+ isRequired: false,
1798
+ transformFunction: null
1799
+ },
1800
+ messages: {
1801
+ classPropertyName: "messages",
1802
+ publicName: "messages",
1803
+ isSignal: true,
1804
+ isRequired: false,
1805
+ transformFunction: null
1806
+ },
1807
+ minHeight: {
1808
+ classPropertyName: "minHeight",
1809
+ publicName: "minHeight",
1810
+ isSignal: true,
1811
+ isRequired: false,
1812
+ transformFunction: null
1813
+ },
1814
+ minWidth: {
1815
+ classPropertyName: "minWidth",
1816
+ publicName: "minWidth",
1817
+ isSignal: true,
1818
+ isRequired: false,
1819
+ transformFunction: null
1820
+ },
1821
+ minimizable: {
1822
+ classPropertyName: "minimizable",
1823
+ publicName: "minimizable",
1824
+ isSignal: true,
1825
+ isRequired: false,
1826
+ transformFunction: null
1827
+ },
1828
+ modal: {
1829
+ classPropertyName: "modal",
1830
+ publicName: "modal",
1831
+ isSignal: true,
1832
+ isRequired: false,
1833
+ transformFunction: null
1834
+ },
1835
+ resizable: {
1836
+ classPropertyName: "resizable",
1837
+ publicName: "resizable",
1838
+ isSignal: true,
1839
+ isRequired: false,
1840
+ transformFunction: null
1841
+ },
1842
+ rounded: {
1843
+ classPropertyName: "rounded",
1844
+ publicName: "rounded",
1845
+ isSignal: true,
1846
+ isRequired: false,
1847
+ transformFunction: null
1848
+ },
1849
+ title: {
1850
+ classPropertyName: "title",
1851
+ publicName: "title",
1852
+ isSignal: true,
1853
+ isRequired: false,
1854
+ transformFunction: null
1855
+ },
1856
+ top: {
1857
+ classPropertyName: "top",
1858
+ publicName: "top",
1859
+ isSignal: true,
1860
+ isRequired: false,
1861
+ transformFunction: null
1862
+ },
1863
+ width: {
1864
+ classPropertyName: "width",
1865
+ publicName: "width",
1866
+ isSignal: true,
1867
+ isRequired: false,
1868
+ transformFunction: null
1869
+ }
1870
+ },
1871
+ outputs: {
1872
+ close: "close",
1873
+ closed: "closed",
1874
+ dragEnd: "dragEnd",
1875
+ dragStart: "dragStart",
1876
+ height: "heightChange",
1877
+ left: "leftChange",
1878
+ top: "topChange",
1879
+ width: "widthChange"
1880
+ },
1881
+ host: {
1882
+ properties: { "attr.aria-label": "null" },
1883
+ classAttribute: "hidden"
1884
+ },
1885
+ queries: [
1886
+ {
1887
+ propertyName: "actionTemplate",
1888
+ first: true,
1889
+ predicate: WindowActionTemplateDirective,
1890
+ descendants: true,
1891
+ read: TemplateRef,
1892
+ isSignal: true
1893
+ },
1894
+ {
1895
+ propertyName: "contentTemplate",
1896
+ first: true,
1897
+ predicate: WindowContentTemplateDirective,
1898
+ descendants: true,
1899
+ read: TemplateRef,
1900
+ isSignal: true
1901
+ },
1902
+ {
1903
+ propertyName: "footerTemplate",
1904
+ first: true,
1905
+ predicate: WindowFooterTemplateDirective,
1906
+ descendants: true,
1907
+ read: TemplateRef,
1908
+ isSignal: true
1909
+ },
1910
+ {
1911
+ propertyName: "titleTemplate",
1912
+ first: true,
1913
+ predicate: WindowTitleTemplateDirective,
1914
+ descendants: true,
1915
+ read: TemplateRef,
1916
+ isSignal: true
1917
+ }
1918
+ ],
1919
+ viewQueries: [{
1920
+ propertyName: "projectedContent",
1921
+ first: true,
1922
+ predicate: ["projectedContent"],
1923
+ descendants: true,
1924
+ read: TemplateRef,
1925
+ isSignal: true
1926
+ }],
1927
+ ngImport: i0,
1928
+ template: `<ng-template #projectedContent><ng-content /></ng-template>`,
1929
+ isInline: true
1930
+ });
1931
+ }
1932
+ };
1933
+ i0.ɵɵngDeclareClassMetadata({
1934
+ minVersion: "12.0.0",
1935
+ version: "22.2.6",
1936
+ ngImport: i0,
1937
+ type: WindowComponent,
1938
+ decorators: [{
1939
+ type: Component,
1940
+ args: [{
1941
+ selector: "mona-window",
1942
+ template: `<ng-template #projectedContent><ng-content /></ng-template>`,
1943
+ host: {
1944
+ "[attr.aria-label]": "null",
1945
+ class: "hidden"
1946
+ }
1947
+ }]
1948
+ }],
1949
+ ctorParameters: () => [],
1950
+ propDecorators: {
1951
+ actionTemplate: [{
1952
+ type: i0.ContentChild,
1953
+ args: [i0.forwardRef(() => WindowActionTemplateDirective), {
1954
+ read: TemplateRef,
1955
+ isSignal: true
1956
+ }]
1957
+ }],
1958
+ contentTemplate: [{
1959
+ type: i0.ContentChild,
1960
+ args: [i0.forwardRef(() => WindowContentTemplateDirective), {
1961
+ read: TemplateRef,
1962
+ isSignal: true
1963
+ }]
1964
+ }],
1965
+ footerTemplate: [{
1966
+ type: i0.ContentChild,
1967
+ args: [i0.forwardRef(() => WindowFooterTemplateDirective), {
1968
+ read: TemplateRef,
1969
+ isSignal: true
1970
+ }]
1971
+ }],
1972
+ projectedContent: [{
1973
+ type: i0.ViewChild,
1974
+ args: ["projectedContent", {
1975
+ read: TemplateRef,
1976
+ isSignal: true
1977
+ }]
1978
+ }],
1979
+ titleTemplate: [{
1980
+ type: i0.ContentChild,
1981
+ args: [i0.forwardRef(() => WindowTitleTemplateDirective), {
1982
+ read: TemplateRef,
1983
+ isSignal: true
1984
+ }]
1985
+ }],
1986
+ ariaLabel: [{
1987
+ type: i0.Input,
1988
+ args: [{
1989
+ isSignal: true,
1990
+ alias: "aria-label",
1991
+ required: false
1992
+ }]
1993
+ }],
1994
+ closable: [{
1995
+ type: i0.Input,
1996
+ args: [{
1997
+ isSignal: true,
1998
+ alias: "closable",
1999
+ required: false
2000
+ }]
2001
+ }],
2002
+ close: [{
2003
+ type: i0.Output,
2004
+ args: ["close"]
2005
+ }],
2006
+ closeOnEscape: [{
2007
+ type: i0.Input,
2008
+ args: [{
2009
+ isSignal: true,
2010
+ alias: "closeOnEscape",
2011
+ required: false
2012
+ }]
2013
+ }],
2014
+ closed: [{
2015
+ type: i0.Output,
2016
+ args: ["closed"]
2017
+ }],
2018
+ dragEnd: [{
2019
+ type: i0.Output,
2020
+ args: ["dragEnd"]
2021
+ }],
2022
+ dragStart: [{
2023
+ type: i0.Output,
2024
+ args: ["dragStart"]
2025
+ }],
2026
+ draggable: [{
2027
+ type: i0.Input,
2028
+ args: [{
2029
+ isSignal: true,
2030
+ alias: "draggable",
2031
+ required: false
2032
+ }]
2033
+ }],
2034
+ focusedElement: [{
2035
+ type: i0.Input,
2036
+ args: [{
2037
+ isSignal: true,
2038
+ alias: "focusedElement",
2039
+ required: false
2040
+ }]
2041
+ }],
2042
+ height: [{
2043
+ type: i0.Input,
2044
+ args: [{
2045
+ isSignal: true,
2046
+ alias: "height",
2047
+ required: false
2048
+ }]
2049
+ }, {
2050
+ type: i0.Output,
2051
+ args: ["heightChange"]
2052
+ }],
2053
+ left: [{
2054
+ type: i0.Input,
2055
+ args: [{
2056
+ isSignal: true,
2057
+ alias: "left",
2058
+ required: false
2059
+ }]
2060
+ }, {
2061
+ type: i0.Output,
2062
+ args: ["leftChange"]
2063
+ }],
2064
+ look: [{
2065
+ type: i0.Input,
2066
+ args: [{
2067
+ isSignal: true,
2068
+ alias: "look",
2069
+ required: false
2070
+ }]
2071
+ }],
2072
+ maxHeight: [{
2073
+ type: i0.Input,
2074
+ args: [{
2075
+ isSignal: true,
2076
+ alias: "maxHeight",
2077
+ required: false
2078
+ }]
2079
+ }],
2080
+ maxWidth: [{
2081
+ type: i0.Input,
2082
+ args: [{
2083
+ isSignal: true,
2084
+ alias: "maxWidth",
2085
+ required: false
2086
+ }]
2087
+ }],
2088
+ maximizable: [{
2089
+ type: i0.Input,
2090
+ args: [{
2091
+ isSignal: true,
2092
+ alias: "maximizable",
2093
+ required: false
2094
+ }]
2095
+ }],
2096
+ messages: [{
2097
+ type: i0.Input,
2098
+ args: [{
2099
+ isSignal: true,
2100
+ alias: "messages",
2101
+ required: false
2102
+ }]
2103
+ }],
2104
+ minHeight: [{
2105
+ type: i0.Input,
2106
+ args: [{
2107
+ isSignal: true,
2108
+ alias: "minHeight",
2109
+ required: false
2110
+ }]
2111
+ }],
2112
+ minWidth: [{
2113
+ type: i0.Input,
2114
+ args: [{
2115
+ isSignal: true,
2116
+ alias: "minWidth",
2117
+ required: false
2118
+ }]
2119
+ }],
2120
+ minimizable: [{
2121
+ type: i0.Input,
2122
+ args: [{
2123
+ isSignal: true,
2124
+ alias: "minimizable",
2125
+ required: false
2126
+ }]
2127
+ }],
2128
+ modal: [{
2129
+ type: i0.Input,
2130
+ args: [{
2131
+ isSignal: true,
2132
+ alias: "modal",
2133
+ required: false
2134
+ }]
2135
+ }],
2136
+ resizable: [{
2137
+ type: i0.Input,
2138
+ args: [{
2139
+ isSignal: true,
2140
+ alias: "resizable",
2141
+ required: false
2142
+ }]
2143
+ }],
2144
+ rounded: [{
2145
+ type: i0.Input,
2146
+ args: [{
2147
+ isSignal: true,
2148
+ alias: "rounded",
2149
+ required: false
2150
+ }]
2151
+ }],
2152
+ title: [{
2153
+ type: i0.Input,
2154
+ args: [{
2155
+ isSignal: true,
2156
+ alias: "title",
2157
+ required: false
2158
+ }]
2159
+ }],
2160
+ top: [{
2161
+ type: i0.Input,
2162
+ args: [{
2163
+ isSignal: true,
2164
+ alias: "top",
2165
+ required: false
2166
+ }]
2167
+ }, {
2168
+ type: i0.Output,
2169
+ args: ["topChange"]
2170
+ }],
2171
+ width: [{
2172
+ type: i0.Input,
2173
+ args: [{
2174
+ isSignal: true,
2175
+ alias: "width",
2176
+ required: false
2177
+ }]
2178
+ }, {
2179
+ type: i0.Output,
2180
+ args: ["widthChange"]
2181
+ }]
2182
+ }
2183
+ });
1571
2184
  export { WINDOW_DATA, WINDOW_DEFAULT_MESSAGES, WindowActionTemplateDirective, WindowComponent, WindowContentTemplateDirective, WindowFooterTemplateDirective, WindowRef, WindowService, WindowTitleTemplateDirective };
1572
- //# sourceMappingURL=nanahoshi-mona-ui-window.mjs.map
2185
+
2186
+ //# sourceMappingURL=nanahoshi-mona-ui-window.mjs.map