@nanahoshi/mona-ui 0.27.2 → 0.29.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 (213) hide show
  1. package/docs/api/chart.md +2 -2
  2. package/docs/api/locales.md +8 -0
  3. package/docs/api/popup.md +1 -1
  4. package/docs/api/theme.md +2 -2
  5. package/docs/chart.md +14 -0
  6. package/docs/editor.md +2 -0
  7. package/docs/installation.md +147 -15
  8. package/docs/introduction.md +37 -15
  9. package/docs/theming-built-in-themes.md +67 -0
  10. package/docs/theming-custom-colors.md +274 -0
  11. package/docs/theming-custom-themes.md +168 -0
  12. package/docs/theming.md +164 -248
  13. package/fesm2022/nanahoshi-mona-ui-auto-complete.mjs +1089 -603
  14. package/fesm2022/nanahoshi-mona-ui-avatar.mjs +369 -184
  15. package/fesm2022/nanahoshi-mona-ui-breadcrumb.mjs +658 -371
  16. package/fesm2022/nanahoshi-mona-ui-button-group.mjs +513 -359
  17. package/fesm2022/nanahoshi-mona-ui-button.mjs +622 -517
  18. package/fesm2022/nanahoshi-mona-ui-calendar.mjs +2071 -1573
  19. package/fesm2022/nanahoshi-mona-ui-card.mjs +620 -316
  20. package/fesm2022/nanahoshi-mona-ui-chart.mjs +61151 -64921
  21. package/fesm2022/nanahoshi-mona-ui-check-box.mjs +646 -317
  22. package/fesm2022/nanahoshi-mona-ui-chip.mjs +737 -516
  23. package/fesm2022/nanahoshi-mona-ui-circular-progress-bar.mjs +441 -242
  24. package/fesm2022/nanahoshi-mona-ui-collapsible.mjs +443 -390
  25. package/fesm2022/nanahoshi-mona-ui-color-gradient.mjs +1138 -814
  26. package/fesm2022/nanahoshi-mona-ui-color-palette.mjs +1114 -959
  27. package/fesm2022/nanahoshi-mona-ui-color-picker.mjs +858 -504
  28. package/fesm2022/nanahoshi-mona-ui-combo-box.mjs +1181 -742
  29. package/fesm2022/nanahoshi-mona-ui-command.mjs +1454 -853
  30. package/fesm2022/nanahoshi-mona-ui-common.mjs +569 -743
  31. package/fesm2022/nanahoshi-mona-ui-contextmenu.mjs +978 -532
  32. package/fesm2022/nanahoshi-mona-ui-date-input.mjs +283 -266
  33. package/fesm2022/nanahoshi-mona-ui-date-picker.mjs +973 -451
  34. package/fesm2022/nanahoshi-mona-ui-datetime-picker.mjs +1203 -658
  35. package/fesm2022/nanahoshi-mona-ui-dialog.mjs +1415 -936
  36. package/fesm2022/nanahoshi-mona-ui-dropdown-button.mjs +1165 -568
  37. package/fesm2022/nanahoshi-mona-ui-dropdown-list.mjs +1142 -677
  38. package/fesm2022/nanahoshi-mona-ui-dropdowns.mjs +1018 -734
  39. package/fesm2022/nanahoshi-mona-ui-editor.mjs +3589 -2122
  40. package/fesm2022/nanahoshi-mona-ui-expansion-panel.mjs +577 -359
  41. package/fesm2022/nanahoshi-mona-ui-fieldset.mjs +311 -151
  42. package/fesm2022/nanahoshi-mona-ui-filter.mjs +1086 -718
  43. package/fesm2022/nanahoshi-mona-ui-grid-grid-colgroup.component-NhONCVIX.mjs +77 -0
  44. package/fesm2022/nanahoshi-mona-ui-grid-grid-footer-row.component-Djv8ZnT5.mjs +480 -0
  45. package/fesm2022/nanahoshi-mona-ui-grid-grid-list.component-WbXAzGCa.mjs +470 -0
  46. package/fesm2022/nanahoshi-mona-ui-grid-grid-row.component-DkWTD3pN.mjs +2115 -0
  47. package/fesm2022/nanahoshi-mona-ui-grid-grid-virtual-list.component-DAHqTwBJ.mjs +330 -0
  48. package/fesm2022/nanahoshi-mona-ui-grid-grid.styles-BmLU-3zP.mjs +3766 -0
  49. package/fesm2022/nanahoshi-mona-ui-grid.mjs +5418 -2
  50. package/fesm2022/nanahoshi-mona-ui-i18n-icu.mjs +1379 -1079
  51. package/fesm2022/nanahoshi-mona-ui-i18n.mjs +4451 -5077
  52. package/fesm2022/nanahoshi-mona-ui-internal-filter-input.mjs +344 -143
  53. package/fesm2022/nanahoshi-mona-ui-internal-indicator-icon.mjs +257 -127
  54. package/fesm2022/nanahoshi-mona-ui-internal-list.mjs +2080 -1829
  55. package/fesm2022/nanahoshi-mona-ui-internal-popup-menu.mjs +103 -141
  56. package/fesm2022/nanahoshi-mona-ui-internal-tree.mjs +2498 -2706
  57. package/fesm2022/nanahoshi-mona-ui-internal.mjs +722 -1007
  58. package/fesm2022/nanahoshi-mona-ui-label.mjs +313 -202
  59. package/fesm2022/nanahoshi-mona-ui-list-box.mjs +1308 -1009
  60. package/fesm2022/nanahoshi-mona-ui-list-view.mjs +1411 -677
  61. package/fesm2022/nanahoshi-mona-ui-list.mjs +1 -6
  62. package/fesm2022/nanahoshi-mona-ui-locales-ar-sa.mjs +556 -577
  63. package/fesm2022/nanahoshi-mona-ui-locales-de-de.mjs +530 -573
  64. package/fesm2022/nanahoshi-mona-ui-locales-es-es.mjs +530 -573
  65. package/fesm2022/nanahoshi-mona-ui-locales-fr-fr.mjs +533 -576
  66. package/fesm2022/nanahoshi-mona-ui-locales-id-id.mjs +520 -555
  67. package/fesm2022/nanahoshi-mona-ui-locales-it-it.mjs +530 -571
  68. package/fesm2022/nanahoshi-mona-ui-locales-ja-jp.mjs +520 -555
  69. package/fesm2022/nanahoshi-mona-ui-locales-ko-kr.mjs +520 -555
  70. package/fesm2022/nanahoshi-mona-ui-locales-pl-pl.mjs +599 -0
  71. package/fesm2022/nanahoshi-mona-ui-locales-pt-br.mjs +530 -571
  72. package/fesm2022/nanahoshi-mona-ui-locales-ru-ru.mjs +576 -591
  73. package/fesm2022/nanahoshi-mona-ui-locales-tr-tr.mjs +530 -565
  74. package/fesm2022/nanahoshi-mona-ui-locales-zh-cn.mjs +520 -555
  75. package/fesm2022/nanahoshi-mona-ui-locales-zh-tw.mjs +520 -555
  76. package/fesm2022/nanahoshi-mona-ui-locales.mjs +61 -77
  77. package/fesm2022/nanahoshi-mona-ui-menubar.mjs +1411 -829
  78. package/fesm2022/nanahoshi-mona-ui-multi-select.mjs +1326 -702
  79. package/fesm2022/nanahoshi-mona-ui-notification.mjs +763 -675
  80. package/fesm2022/nanahoshi-mona-ui-numeric-text-box.mjs +1306 -826
  81. package/fesm2022/nanahoshi-mona-ui-otp-input.mjs +1122 -897
  82. package/fesm2022/nanahoshi-mona-ui-pager.mjs +1110 -651
  83. package/fesm2022/nanahoshi-mona-ui-placeholder.mjs +95 -53
  84. package/fesm2022/nanahoshi-mona-ui-popover.mjs +559 -397
  85. package/fesm2022/nanahoshi-mona-ui-popup-menu.mjs +2323 -1694
  86. package/fesm2022/nanahoshi-mona-ui-popup.mjs +1657 -1455
  87. package/fesm2022/nanahoshi-mona-ui-progress-bar.mjs +441 -267
  88. package/fesm2022/nanahoshi-mona-ui-query.mjs +211 -340
  89. package/fesm2022/nanahoshi-mona-ui-radio-button.mjs +1017 -548
  90. package/fesm2022/nanahoshi-mona-ui-rating.mjs +874 -624
  91. package/fesm2022/nanahoshi-mona-ui-scroll-view.mjs +1130 -917
  92. package/fesm2022/nanahoshi-mona-ui-segmented.mjs +705 -455
  93. package/fesm2022/nanahoshi-mona-ui-sheet.mjs +461 -283
  94. package/fesm2022/nanahoshi-mona-ui-sidebar.mjs +2791 -2449
  95. package/fesm2022/nanahoshi-mona-ui-skeleton.mjs +145 -90
  96. package/fesm2022/nanahoshi-mona-ui-slider.mjs +1563 -1103
  97. package/fesm2022/nanahoshi-mona-ui-spinner.mjs +738 -673
  98. package/fesm2022/nanahoshi-mona-ui-split-button.mjs +1287 -647
  99. package/fesm2022/nanahoshi-mona-ui-splitter.mjs +1313 -909
  100. package/fesm2022/nanahoshi-mona-ui-stepper.mjs +761 -540
  101. package/fesm2022/nanahoshi-mona-ui-switch.mjs +611 -280
  102. package/fesm2022/nanahoshi-mona-ui-tabs.mjs +1393 -841
  103. package/fesm2022/nanahoshi-mona-ui-text-area.mjs +142 -73
  104. package/fesm2022/nanahoshi-mona-ui-text-box.mjs +876 -374
  105. package/fesm2022/nanahoshi-mona-ui-theme.mjs +1465 -1449
  106. package/fesm2022/nanahoshi-mona-ui-time-picker.mjs +897 -443
  107. package/fesm2022/nanahoshi-mona-ui-time-selector.mjs +1100 -703
  108. package/fesm2022/nanahoshi-mona-ui-tooltip.mjs +789 -538
  109. package/fesm2022/nanahoshi-mona-ui-tree-view.mjs +1361 -805
  110. package/fesm2022/nanahoshi-mona-ui-window.mjs +2145 -1531
  111. package/fesm2022/nanahoshi-mona-ui.mjs +1 -8
  112. package/llms.txt +7 -3
  113. package/locales/pl-pl/package.json +4 -0
  114. package/locales/pl-pl/pl-pl.messages.json +536 -0
  115. package/package.json +66 -23
  116. package/types/nanahoshi-mona-ui-auto-complete.d.ts +367 -233
  117. package/types/nanahoshi-mona-ui-avatar.d.ts +722 -649
  118. package/types/nanahoshi-mona-ui-breadcrumb.d.ts +134 -103
  119. package/types/nanahoshi-mona-ui-button-group.d.ts +213 -152
  120. package/types/nanahoshi-mona-ui-button.d.ts +227 -166
  121. package/types/nanahoshi-mona-ui-calendar.d.ts +324 -259
  122. package/types/nanahoshi-mona-ui-card.d.ts +125 -111
  123. package/types/nanahoshi-mona-ui-chart.d.ts +10483 -7326
  124. package/types/nanahoshi-mona-ui-check-box.d.ts +293 -180
  125. package/types/nanahoshi-mona-ui-chip.d.ts +208 -141
  126. package/types/nanahoshi-mona-ui-circular-progress-bar.d.ts +194 -133
  127. package/types/nanahoshi-mona-ui-collapsible.d.ts +103 -87
  128. package/types/nanahoshi-mona-ui-color-gradient.d.ts +281 -213
  129. package/types/nanahoshi-mona-ui-color-palette.d.ts +201 -138
  130. package/types/nanahoshi-mona-ui-color-picker.d.ts +283 -194
  131. package/types/nanahoshi-mona-ui-combo-box.d.ts +401 -262
  132. package/types/nanahoshi-mona-ui-command.d.ts +279 -191
  133. package/types/nanahoshi-mona-ui-common.d.ts +354 -385
  134. package/types/nanahoshi-mona-ui-contextmenu.d.ts +142 -117
  135. package/types/nanahoshi-mona-ui-date-input.d.ts +79 -96
  136. package/types/nanahoshi-mona-ui-date-picker.d.ts +338 -208
  137. package/types/nanahoshi-mona-ui-datetime-picker.d.ts +413 -259
  138. package/types/nanahoshi-mona-ui-dialog.d.ts +470 -381
  139. package/types/nanahoshi-mona-ui-dropdown-button.d.ts +216 -168
  140. package/types/nanahoshi-mona-ui-dropdown-list.d.ts +369 -243
  141. package/types/nanahoshi-mona-ui-dropdowns.d.ts +231 -217
  142. package/types/nanahoshi-mona-ui-editor.d.ts +302 -235
  143. package/types/nanahoshi-mona-ui-expansion-panel.d.ts +140 -109
  144. package/types/nanahoshi-mona-ui-fieldset.d.ts +98 -68
  145. package/types/nanahoshi-mona-ui-filter.d.ts +150 -124
  146. package/types/nanahoshi-mona-ui-grid.d.ts +1956 -1678
  147. package/types/nanahoshi-mona-ui-i18n-icu.d.ts +25 -34
  148. package/types/nanahoshi-mona-ui-i18n.d.ts +987 -1052
  149. package/types/nanahoshi-mona-ui-internal-filter-input.d.ts +118 -71
  150. package/types/nanahoshi-mona-ui-internal-indicator-icon.d.ts +56 -27
  151. package/types/nanahoshi-mona-ui-internal-list.d.ts +474 -408
  152. package/types/nanahoshi-mona-ui-internal-popup-menu.d.ts +143 -150
  153. package/types/nanahoshi-mona-ui-internal-tree.d.ts +493 -506
  154. package/types/nanahoshi-mona-ui-internal.d.ts +195 -213
  155. package/types/nanahoshi-mona-ui-label.d.ts +108 -78
  156. package/types/nanahoshi-mona-ui-list-box.d.ts +392 -322
  157. package/types/nanahoshi-mona-ui-list-view.d.ts +423 -282
  158. package/types/nanahoshi-mona-ui-list.d.ts +2 -1
  159. package/types/nanahoshi-mona-ui-locales-ar-sa.d.ts +540 -542
  160. package/types/nanahoshi-mona-ui-locales-de-de.d.ts +540 -542
  161. package/types/nanahoshi-mona-ui-locales-es-es.d.ts +540 -542
  162. package/types/nanahoshi-mona-ui-locales-fr-fr.d.ts +540 -542
  163. package/types/nanahoshi-mona-ui-locales-id-id.d.ts +540 -542
  164. package/types/nanahoshi-mona-ui-locales-it-it.d.ts +540 -542
  165. package/types/nanahoshi-mona-ui-locales-ja-jp.d.ts +540 -542
  166. package/types/nanahoshi-mona-ui-locales-ko-kr.d.ts +540 -542
  167. package/types/nanahoshi-mona-ui-locales-pl-pl.d.ts +540 -0
  168. package/types/nanahoshi-mona-ui-locales-pt-br.d.ts +540 -542
  169. package/types/nanahoshi-mona-ui-locales-ru-ru.d.ts +540 -542
  170. package/types/nanahoshi-mona-ui-locales-tr-tr.d.ts +540 -542
  171. package/types/nanahoshi-mona-ui-locales-zh-cn.d.ts +540 -542
  172. package/types/nanahoshi-mona-ui-locales-zh-tw.d.ts +540 -542
  173. package/types/nanahoshi-mona-ui-locales.d.ts +18 -19
  174. package/types/nanahoshi-mona-ui-menubar.d.ts +210 -181
  175. package/types/nanahoshi-mona-ui-multi-select.d.ts +416 -276
  176. package/types/nanahoshi-mona-ui-notification.d.ts +140 -151
  177. package/types/nanahoshi-mona-ui-numeric-text-box.d.ts +407 -270
  178. package/types/nanahoshi-mona-ui-otp-input.d.ts +364 -241
  179. package/types/nanahoshi-mona-ui-pager.d.ts +379 -301
  180. package/types/nanahoshi-mona-ui-placeholder.d.ts +35 -28
  181. package/types/nanahoshi-mona-ui-popover.d.ts +176 -134
  182. package/types/nanahoshi-mona-ui-popup-menu.d.ts +488 -344
  183. package/types/nanahoshi-mona-ui-popup.d.ts +698 -560
  184. package/types/nanahoshi-mona-ui-progress-bar.d.ts +197 -137
  185. package/types/nanahoshi-mona-ui-query.d.ts +82 -88
  186. package/types/nanahoshi-mona-ui-radio-button.d.ts +434 -269
  187. package/types/nanahoshi-mona-ui-rating.d.ts +348 -254
  188. package/types/nanahoshi-mona-ui-scroll-view.d.ts +244 -172
  189. package/types/nanahoshi-mona-ui-segmented.d.ts +250 -175
  190. package/types/nanahoshi-mona-ui-sheet.d.ts +115 -63
  191. package/types/nanahoshi-mona-ui-sidebar.d.ts +653 -493
  192. package/types/nanahoshi-mona-ui-skeleton.d.ts +55 -39
  193. package/types/nanahoshi-mona-ui-slider.d.ts +503 -354
  194. package/types/nanahoshi-mona-ui-spinner.d.ts +125 -112
  195. package/types/nanahoshi-mona-ui-split-button.d.ts +241 -196
  196. package/types/nanahoshi-mona-ui-splitter.d.ts +124 -78
  197. package/types/nanahoshi-mona-ui-stepper.d.ts +206 -181
  198. package/types/nanahoshi-mona-ui-switch.d.ts +197 -131
  199. package/types/nanahoshi-mona-ui-tabs.d.ts +349 -248
  200. package/types/nanahoshi-mona-ui-text-area.d.ts +52 -36
  201. package/types/nanahoshi-mona-ui-text-box.d.ts +349 -218
  202. package/types/nanahoshi-mona-ui-theme.d.ts +415 -408
  203. package/types/nanahoshi-mona-ui-time-picker.d.ts +357 -217
  204. package/types/nanahoshi-mona-ui-time-selector.d.ts +255 -170
  205. package/types/nanahoshi-mona-ui-tooltip.d.ts +222 -144
  206. package/types/nanahoshi-mona-ui-tree-view.d.ts +466 -308
  207. package/types/nanahoshi-mona-ui-window.d.ts +494 -399
  208. package/types/nanahoshi-mona-ui.d.ts +1 -2
  209. package/fesm2022/nanahoshi-mona-ui-grid-grid-footer-row.component-DjNnVxHE.mjs +0 -181
  210. package/fesm2022/nanahoshi-mona-ui-grid-grid-list.component-ihQIKeP-.mjs +0 -208
  211. package/fesm2022/nanahoshi-mona-ui-grid-grid-row.component-BpnybNcs.mjs +0 -1082
  212. package/fesm2022/nanahoshi-mona-ui-grid-grid-virtual-list.component-CYlgfc7c.mjs +0 -186
  213. package/fesm2022/nanahoshi-mona-ui-grid-nanahoshi-mona-ui-grid-LCzfCYd3.mjs +0 -7568
@@ -1,179 +1,206 @@
1
- import { NgTemplateOutlet } from '@angular/common';
2
- import * as i0 from '@angular/core';
3
- import { isDevMode, computed, input, Directive, model, booleanAttribute, viewChild, TemplateRef, Component, inject, output, DestroyRef, ElementRef, signal, afterNextRender, afterRenderEffect, contentChildren, numberAttribute } from '@angular/core';
4
- import { where, compact, from } from '@mirei/ts-collections';
5
- import { cva } from 'class-variance-authority';
6
- import { createElementControlId } from '@nanahoshi/mona-ui/internal';
7
- import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
8
- import { merge, fromEvent, filter, take, tap, takeUntil, finalize } from 'rxjs';
9
- import { MonaI18nService, injectComponentDirection } from '@nanahoshi/mona-ui/i18n';
10
- import { LucideChevronLeft, LucideChevronRight, LucideChevronUp, LucideChevronDown } from '@lucide/angular';
11
- import { ButtonDirective } from '@nanahoshi/mona-ui/button';
12
-
13
- const warned = new Set();
14
- /**
15
- * Reads a pane's `min` or `max` as pixels. Drags work in pixels, so a unit that needs a layout to resolve, such as a
16
- * percentage, can't be honored. It used to be read as that many pixels, which is worse than ignoring it.
17
- */
1
+ import { NgTemplateOutlet } from "@angular/common";
2
+ import * as i0 from "@angular/core";
3
+ import { Component, DestroyRef, Directive, ElementRef, TemplateRef, afterNextRender, afterRenderEffect, booleanAttribute, computed, contentChildren, inject, input, isDevMode, model, numberAttribute, output, signal, viewChild } from "@angular/core";
4
+ import { compact, from, where } from "@mirei/ts-collections";
5
+ import { cva } from "class-variance-authority";
6
+ import { createElementControlId } from "@nanahoshi/mona-ui/internal";
7
+ import { takeUntilDestroyed } from "@angular/core/rxjs-interop";
8
+ import { filter, finalize, fromEvent, merge, take, takeUntil, tap } from "rxjs";
9
+ import { MonaI18nService, injectComponentDirection } from "@nanahoshi/mona-ui/i18n";
10
+ import { LucideChevronDown, LucideChevronLeft, LucideChevronRight, LucideChevronUp } from "@lucide/angular";
11
+ import { ButtonDirective } from "@nanahoshi/mona-ui/button";
12
+ const warned = /* @__PURE__ */ new Set();
18
13
  function parsePaneSizeLimit(value) {
19
- if (value === null || value === undefined || value === "") {
20
- return null;
21
- }
22
- if (typeof value === "number") {
23
- return Number.isFinite(value) ? value : null;
24
- }
25
- const match = /^\s*(-?\d*\.?\d+)\s*(?:px)?\s*$/i.exec(value);
26
- if (match) {
27
- return Number(match[1]);
28
- }
29
- if (isDevMode() && !warned.has(value)) {
30
- warned.add(value);
31
- console.warn(`mona-splitter-pane: the limit "${value}" is ignored. Use a number or pixels.`);
32
- }
33
- return null;
34
- }
35
-
36
- class SplitterPaneStyleDirective {
37
- constructor() {
38
- this.#autoSizedPane = computed(() => {
39
- const paneList = this.paneList();
40
- const panes = where(paneList, pane => !(pane.collapsible() && pane.collapsed()));
41
- if (!panes.any()) {
42
- return null;
43
- }
44
- return panes.firstOrDefault(pane => pane.size() === "") ?? panes.last();
45
- }, /* @ts-ignore */
46
- ...(ngDevMode ? [{ debugName: "#autoSizedPane" }] : /* istanbul ignore next */ []));
47
- this.isCollapsed = computed(() => this.pane().collapsible() && this.pane().collapsed(), /* @ts-ignore */
48
- ...(ngDevMode ? [{ debugName: "isCollapsed" }] : /* istanbul ignore next */ []));
49
- this.styles = computed(() => {
50
- const pane = this.pane();
51
- const flexBasis = this.getPaneFlexBasis(pane);
52
- const flexGrow = this.getPaneFlexGrow(pane);
53
- const flexShrink = this.getPaneFlexShrink(pane);
54
- const styles = { flexGrow, flexShrink, flexBasis, ...this.getPaneLimits(pane) };
55
- return styles;
56
- }, /* @ts-ignore */
57
- ...(ngDevMode ? [{ debugName: "styles" }] : /* istanbul ignore next */ []));
58
- this.orientation = input("horizontal", /* @ts-ignore */
59
- ...(ngDevMode ? [{ debugName: "orientation" }] : /* istanbul ignore next */ []));
60
- this.pane = input.required(/* @ts-ignore */
61
- ...(ngDevMode ? [{ debugName: "pane" }] : /* istanbul ignore next */ []));
62
- this.paneList = input.required(/* @ts-ignore */
63
- ...(ngDevMode ? [{ debugName: "paneList" }] : /* istanbul ignore next */ []));
64
- }
65
- #autoSizedPane;
66
- getPaneFlexShrink(pane) {
67
- return pane.collapsible() && pane.collapsed() ? "0" : "1";
68
- }
69
- getFractionalWeight(size) {
70
- if (typeof size !== "string") {
71
- return null;
72
- }
73
- const match = size.trim().match(/^([0-9]*\.?[0-9]+)fr$/i);
74
- if (match === null) {
75
- return null;
76
- }
77
- const weight = Number(match[1]);
78
- return Number.isFinite(weight) ? weight : 1;
79
- }
80
- getPaneFlexBasis(pane) {
81
- if (pane.collapsible() && pane.collapsed()) {
82
- return "0px";
83
- }
84
- const size = this.getPaneSize(pane);
85
- if (size === null || this.isFractionalSize(size)) {
86
- return "0px";
87
- }
88
- return size;
89
- }
90
- getPaneFlexGrow(pane) {
91
- if (pane.collapsible() && pane.collapsed()) {
92
- return "0";
93
- }
94
- const size = this.getPaneSize(pane);
95
- const fractionalWeight = this.getFractionalWeight(size);
96
- if (fractionalWeight !== null) {
97
- return fractionalWeight.toString();
98
- }
99
- if (pane.uid === this.#autoSizedPane()?.uid) {
100
- return "1";
101
- }
102
- return size === null ? "1" : "0";
103
- }
104
- /** So the limits hold for first sizes and window resizes too, and not only for a drag. A collapsed pane has none. */
105
- getPaneLimits(pane) {
106
- if (pane.collapsible() && pane.collapsed()) {
107
- return {};
108
- }
109
- const min = parsePaneSizeLimit(pane.min());
110
- const max = parsePaneSizeLimit(pane.max());
111
- const minValue = min === null ? undefined : `${Math.max(0, min)}px`;
112
- const maxValue = max === null ? undefined : `${Math.max(0, max)}px`;
113
- return this.orientation() === "vertical"
114
- ? { minHeight: minValue, maxHeight: maxValue }
115
- : { minWidth: minValue, maxWidth: maxValue };
116
- }
117
- getPaneSize(pane) {
118
- const size = pane.size();
119
- if (size === "" || size === undefined || size === null) {
120
- return null;
121
- }
122
- if (typeof size === "number") {
123
- return `${size}px`;
124
- }
125
- return size;
126
- }
127
- isFractionalSize(size) {
128
- if (typeof size !== "string") {
129
- return false;
130
- }
131
- return size.trim().toLowerCase().endsWith("fr");
132
- }
133
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: SplitterPaneStyleDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
134
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.6", type: SplitterPaneStyleDirective, isStandalone: true, selector: "div[monaSplitterPaneStyle]", inputs: { orientation: { classPropertyName: "orientation", publicName: "orientation", isSignal: true, isRequired: false, transformFunction: null }, pane: { classPropertyName: "pane", publicName: "pane", isSignal: true, isRequired: true, transformFunction: null }, paneList: { classPropertyName: "paneList", publicName: "paneList", isSignal: true, isRequired: true, transformFunction: null } }, host: { properties: { "style": "styles()", "attr.aria-hidden": "isCollapsed() ? true : null", "attr.inert": "isCollapsed() ? true : null" } }, ngImport: i0 }); }
14
+ if (value === null || value === void 0 || value === "") return null;
15
+ if (typeof value === "number") return Number.isFinite(value) ? value : null;
16
+ const match = /^\s*(-?\d*\.?\d+)\s*(?:px)?\s*$/i.exec(value);
17
+ if (match) return Number(match[1]);
18
+ if (isDevMode() && !warned.has(value)) {
19
+ warned.add(value);
20
+ console.warn(`mona-splitter-pane: the limit "${value}" is ignored. Use a number or pixels.`);
21
+ }
22
+ return null;
135
23
  }
136
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: SplitterPaneStyleDirective, decorators: [{
137
- type: Directive,
138
- args: [{
139
- selector: "div[monaSplitterPaneStyle]",
140
- host: {
141
- "[style]": "styles()",
142
- "[attr.aria-hidden]": "isCollapsed() ? true : null",
143
- "[attr.inert]": "isCollapsed() ? true : null"
144
- }
145
- }]
146
- }], propDecorators: { orientation: [{ type: i0.Input, args: [{ isSignal: true, alias: "orientation", required: false }] }], pane: [{ type: i0.Input, args: [{ isSignal: true, alias: "pane", required: true }] }], paneList: [{ type: i0.Input, args: [{ isSignal: true, alias: "paneList", required: true }] }] } });
147
-
24
+ var SplitterPaneStyleDirective = class SplitterPaneStyleDirective {
25
+ constructor() {
26
+ this.#autoSizedPane = computed(() => {
27
+ const paneList = this.paneList();
28
+ const panes = where(paneList, (pane) => !(pane.collapsible() && pane.collapsed()));
29
+ if (!panes.any()) return null;
30
+ return panes.firstOrDefault((pane) => pane.size() === "") ?? panes.last();
31
+ }, ...ngDevMode ? [{ debugName: "#autoSizedPane" }] : /* istanbul ignore next */ []);
32
+ this.isCollapsed = computed(() => this.pane().collapsible() && this.pane().collapsed(), ...ngDevMode ? [{ debugName: "isCollapsed" }] : /* istanbul ignore next */ []);
33
+ this.styles = computed(() => {
34
+ const pane = this.pane();
35
+ const flexBasis = this.getPaneFlexBasis(pane);
36
+ return {
37
+ flexGrow: this.getPaneFlexGrow(pane),
38
+ flexShrink: this.getPaneFlexShrink(pane),
39
+ flexBasis,
40
+ ...this.getPaneLimits(pane)
41
+ };
42
+ }, ...ngDevMode ? [{ debugName: "styles" }] : /* istanbul ignore next */ []);
43
+ this.orientation = input("horizontal", ...ngDevMode ? [{ debugName: "orientation" }] : /* istanbul ignore next */ []);
44
+ this.pane = input.required(...ngDevMode ? [{ debugName: "pane" }] : /* istanbul ignore next */ []);
45
+ this.paneList = input.required(...ngDevMode ? [{ debugName: "paneList" }] : /* istanbul ignore next */ []);
46
+ }
47
+ #autoSizedPane;
48
+ getPaneFlexShrink(pane) {
49
+ return pane.collapsible() && pane.collapsed() ? "0" : "1";
50
+ }
51
+ getFractionalWeight(size) {
52
+ if (typeof size !== "string") return null;
53
+ const match = size.trim().match(/^([0-9]*\.?[0-9]+)fr$/i);
54
+ if (match === null) return null;
55
+ const weight = Number(match[1]);
56
+ return Number.isFinite(weight) ? weight : 1;
57
+ }
58
+ getPaneFlexBasis(pane) {
59
+ if (pane.collapsible() && pane.collapsed()) return "0px";
60
+ const size = this.getPaneSize(pane);
61
+ if (size === null || this.isFractionalSize(size)) return "0px";
62
+ return size;
63
+ }
64
+ getPaneFlexGrow(pane) {
65
+ if (pane.collapsible() && pane.collapsed()) return "0";
66
+ const size = this.getPaneSize(pane);
67
+ const fractionalWeight = this.getFractionalWeight(size);
68
+ if (fractionalWeight !== null) return fractionalWeight.toString();
69
+ if (pane.uid === this.#autoSizedPane()?.uid) return "1";
70
+ return size === null ? "1" : "0";
71
+ }
72
+ getPaneLimits(pane) {
73
+ if (pane.collapsible() && pane.collapsed()) return {};
74
+ const min = parsePaneSizeLimit(pane.min());
75
+ const max = parsePaneSizeLimit(pane.max());
76
+ const minValue = min === null ? void 0 : `${Math.max(0, min)}px`;
77
+ const maxValue = max === null ? void 0 : `${Math.max(0, max)}px`;
78
+ return this.orientation() === "vertical" ? {
79
+ minHeight: minValue,
80
+ maxHeight: maxValue
81
+ } : {
82
+ minWidth: minValue,
83
+ maxWidth: maxValue
84
+ };
85
+ }
86
+ getPaneSize(pane) {
87
+ const size = pane.size();
88
+ if (size === "" || size === void 0 || size === null) return null;
89
+ if (typeof size === "number") return `${size}px`;
90
+ return size;
91
+ }
92
+ isFractionalSize(size) {
93
+ if (typeof size !== "string") return false;
94
+ return size.trim().toLowerCase().endsWith("fr");
95
+ }
96
+ static {
97
+ this.ɵfac = i0.ɵɵngDeclareFactory({
98
+ minVersion: "12.0.0",
99
+ version: "22.2.6",
100
+ ngImport: i0,
101
+ type: SplitterPaneStyleDirective,
102
+ deps: [],
103
+ target: i0.ɵɵFactoryTarget.Directive
104
+ });
105
+ }
106
+ static {
107
+ this.ɵdir = i0.ɵɵngDeclareDirective({
108
+ minVersion: "17.1.0",
109
+ version: "22.2.6",
110
+ type: SplitterPaneStyleDirective,
111
+ isStandalone: true,
112
+ selector: "div[monaSplitterPaneStyle]",
113
+ inputs: {
114
+ orientation: {
115
+ classPropertyName: "orientation",
116
+ publicName: "orientation",
117
+ isSignal: true,
118
+ isRequired: false,
119
+ transformFunction: null
120
+ },
121
+ pane: {
122
+ classPropertyName: "pane",
123
+ publicName: "pane",
124
+ isSignal: true,
125
+ isRequired: true,
126
+ transformFunction: null
127
+ },
128
+ paneList: {
129
+ classPropertyName: "paneList",
130
+ publicName: "paneList",
131
+ isSignal: true,
132
+ isRequired: true,
133
+ transformFunction: null
134
+ }
135
+ },
136
+ host: { properties: {
137
+ "style": "styles()",
138
+ "attr.aria-hidden": "isCollapsed() ? true : null",
139
+ "attr.inert": "isCollapsed() ? true : null"
140
+ } },
141
+ ngImport: i0
142
+ });
143
+ }
144
+ };
145
+ i0.ɵɵngDeclareClassMetadata({
146
+ minVersion: "12.0.0",
147
+ version: "22.2.6",
148
+ ngImport: i0,
149
+ type: SplitterPaneStyleDirective,
150
+ decorators: [{
151
+ type: Directive,
152
+ args: [{
153
+ selector: "div[monaSplitterPaneStyle]",
154
+ host: {
155
+ "[style]": "styles()",
156
+ "[attr.aria-hidden]": "isCollapsed() ? true : null",
157
+ "[attr.inert]": "isCollapsed() ? true : null"
158
+ }
159
+ }]
160
+ }],
161
+ propDecorators: {
162
+ orientation: [{
163
+ type: i0.Input,
164
+ args: [{
165
+ isSignal: true,
166
+ alias: "orientation",
167
+ required: false
168
+ }]
169
+ }],
170
+ pane: [{
171
+ type: i0.Input,
172
+ args: [{
173
+ isSignal: true,
174
+ alias: "pane",
175
+ required: true
176
+ }]
177
+ }],
178
+ paneList: [{
179
+ type: i0.Input,
180
+ args: [{
181
+ isSignal: true,
182
+ alias: "paneList",
183
+ required: true
184
+ }]
185
+ }]
186
+ }
187
+ });
148
188
  const splitterBaseThemeVariants = cva(`
149
189
  flex h-full w-full min-h-0 min-w-0 overflow-hidden
150
190
  `, {
151
- variants: {
152
- orientation: {
153
- horizontal: "flex-row",
154
- vertical: "flex-col"
155
- }
156
- },
157
- defaultVariants: {
158
- orientation: "horizontal"
159
- }
191
+ variants: { orientation: {
192
+ horizontal: "flex-row",
193
+ vertical: "flex-col"
194
+ } },
195
+ defaultVariants: { orientation: "horizontal" }
160
196
  });
161
- /** The bar's place in the layout. Above the panes, because its hit area and focus outline reach over them. */
162
197
  const splitterResizerThemeVariants = cva(`relative z-10 flex shrink-0 items-center justify-center`, {
163
- variants: {
164
- orientation: {
165
- horizontal: "w-0.5 flex-col",
166
- vertical: "h-0.5 flex-row"
167
- }
168
- },
169
- defaultVariants: {
170
- orientation: "horizontal"
171
- }
198
+ variants: { orientation: {
199
+ horizontal: "w-0.5 flex-col",
200
+ vertical: "h-0.5 flex-row"
201
+ } },
202
+ defaultVariants: { orientation: "horizontal" }
172
203
  });
173
- /**
174
- * The bar itself. It's 2 pixels wide, so the hit area reaches past it: 12 pixels, or 24 for a coarse pointer, where more
175
- * of the pane can be given up. `touch-none`, or the browser takes a touch drag as a scroll and cancels the pointer.
176
- */
177
204
  const splitterSeparatorThemeVariants = cva(`
178
205
  absolute inset-0 touch-none
179
206
  transition-colors
@@ -183,761 +210,1138 @@ const splitterSeparatorThemeVariants = cva(`
183
210
  forced-color-adjust-none forced-colors:bg-[CanvasText]
184
211
  before:absolute before:content-['']
185
212
  `, {
186
- variants: {
187
- orientation: {
188
- horizontal: "before:inset-y-0 before:-inset-x-[5px] pointer-coarse:before:-inset-x-[11px]",
189
- vertical: "before:inset-x-0 before:-inset-y-[5px] pointer-coarse:before:-inset-y-[11px]"
190
- },
191
- resizing: {
192
- true: "bg-border-control-hover",
193
- false: "bg-border-subtle"
194
- }
195
- },
196
- defaultVariants: {
197
- orientation: "horizontal",
198
- resizing: false
199
- }
213
+ variants: {
214
+ orientation: {
215
+ horizontal: "before:inset-y-0 before:-inset-x-[5px] pointer-coarse:before:-inset-x-[11px]",
216
+ vertical: "before:inset-x-0 before:-inset-y-[5px] pointer-coarse:before:-inset-y-[11px]"
217
+ },
218
+ resizing: {
219
+ true: "bg-border-control-hover",
220
+ false: "bg-border-subtle"
221
+ }
222
+ },
223
+ defaultVariants: {
224
+ orientation: "horizontal",
225
+ resizing: false
226
+ }
200
227
  });
201
- /** Sits over the bar without taking its pointer, except for the buttons, which are 24 pixels so a finger can hit them. */
202
228
  const splitterResizerHandleThemeVariants = cva(`
203
229
  pointer-events-none
204
230
  flex items-center justify-center
205
231
  [&_button]:pointer-events-auto [&_button]:size-6 [&_button]:p-0
206
232
  `, {
207
- variants: {
208
- orientation: {
209
- horizontal: "flex-row",
210
- vertical: "flex-col"
211
- }
212
- },
213
- defaultVariants: {
214
- orientation: "horizontal"
215
- }
233
+ variants: { orientation: {
234
+ horizontal: "flex-row",
235
+ vertical: "flex-col"
236
+ } },
237
+ defaultVariants: { orientation: "horizontal" }
216
238
  });
217
-
218
- class SplitterPaneComponent {
219
- constructor() {
220
- /**
221
- * @description Whether the pane is collapsed.
222
- */
223
- this.collapsed = model(false, /* @ts-ignore */
224
- ...(ngDevMode ? [{ debugName: "collapsed" }] : /* istanbul ignore next */ []));
225
- /**
226
- * @description Whether the pane is collapsible.
227
- */
228
- this.collapsible = input(false, { ...(ngDevMode ? { debugName: "collapsible" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
229
- /**
230
- * @description Names the separator after this pane, for assistive technology. Without it, the separator has a generic
231
- * name, which can't tell one from another when a splitter has several.
232
- * @default ""
233
- */
234
- this.label = input("", /* @ts-ignore */
235
- ...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
236
- /**
237
- * @description The maximum size of the pane, in pixels. A number or a string like `"200px"`. Percentages aren't
238
- * supported, and are ignored with a warning in development.
239
- */
240
- this.max = input(null, /* @ts-ignore */
241
- ...(ngDevMode ? [{ debugName: "max" }] : /* istanbul ignore next */ []));
242
- /**
243
- * @description The minimum size of the pane, in pixels. A number or a string like `"200px"`. Percentages aren't
244
- * supported, and are ignored with a warning in development.
245
- */
246
- this.min = input(null, /* @ts-ignore */
247
- ...(ngDevMode ? [{ debugName: "min" }] : /* istanbul ignore next */ []));
248
- /**
249
- * @description Whether the pane is resizable. A separator only moves, by pointer or key, when the panes on both of its
250
- * sides are.
251
- */
252
- this.resizable = input(true, { ...(ngDevMode ? { debugName: "resizable" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
253
- /**
254
- * @description The size of the pane.
255
- */
256
- this.size = model("", /* @ts-ignore */
257
- ...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
258
- this.template = viewChild.required(TemplateRef, /* @ts-ignore */
259
- ...(ngDevMode ? [{ debugName: "template" }] : /* istanbul ignore next */ []));
260
- this.uid = createElementControlId();
261
- }
262
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: SplitterPaneComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
263
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "22.0.6", type: SplitterPaneComponent, isStandalone: true, selector: "mona-splitter-pane", inputs: { collapsed: { classPropertyName: "collapsed", publicName: "collapsed", isSignal: true, isRequired: false, transformFunction: null }, collapsible: { classPropertyName: "collapsible", publicName: "collapsible", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, max: { classPropertyName: "max", publicName: "max", isSignal: true, isRequired: false, transformFunction: null }, min: { classPropertyName: "min", publicName: "min", isSignal: true, isRequired: false, transformFunction: null }, resizable: { classPropertyName: "resizable", publicName: "resizable", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { collapsed: "collapsedChange", size: "sizeChange" }, viewQueries: [{ propertyName: "template", first: true, predicate: TemplateRef, descendants: true, isSignal: true }], ngImport: i0, template: `
239
+ var SplitterPaneComponent = class SplitterPaneComponent {
240
+ constructor() {
241
+ this.collapsed = model(false, ...ngDevMode ? [{ debugName: "collapsed" }] : /* istanbul ignore next */ []);
242
+ this.collapsible = input(false, {
243
+ ...ngDevMode ? { debugName: "collapsible" } : /* istanbul ignore next */ {},
244
+ transform: booleanAttribute
245
+ });
246
+ this.label = input("", ...ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []);
247
+ this.max = input(null, ...ngDevMode ? [{ debugName: "max" }] : /* istanbul ignore next */ []);
248
+ this.min = input(null, ...ngDevMode ? [{ debugName: "min" }] : /* istanbul ignore next */ []);
249
+ this.resizable = input(true, {
250
+ ...ngDevMode ? { debugName: "resizable" } : /* istanbul ignore next */ {},
251
+ transform: booleanAttribute
252
+ });
253
+ this.size = model("", ...ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []);
254
+ this.template = viewChild.required(TemplateRef, ...ngDevMode ? [{ debugName: "template" }] : /* istanbul ignore next */ []);
255
+ this.uid = createElementControlId();
256
+ }
257
+ static {
258
+ this.ɵfac = i0.ɵɵngDeclareFactory({
259
+ minVersion: "12.0.0",
260
+ version: "22.2.6",
261
+ ngImport: i0,
262
+ type: SplitterPaneComponent,
263
+ deps: [],
264
+ target: i0.ɵɵFactoryTarget.Component
265
+ });
266
+ }
267
+ static {
268
+ this.ɵcmp = i0.ɵɵngDeclareComponent({
269
+ minVersion: "17.2.0",
270
+ version: "22.2.6",
271
+ type: SplitterPaneComponent,
272
+ isStandalone: true,
273
+ selector: "mona-splitter-pane",
274
+ inputs: {
275
+ collapsed: {
276
+ classPropertyName: "collapsed",
277
+ publicName: "collapsed",
278
+ isSignal: true,
279
+ isRequired: false,
280
+ transformFunction: null
281
+ },
282
+ collapsible: {
283
+ classPropertyName: "collapsible",
284
+ publicName: "collapsible",
285
+ isSignal: true,
286
+ isRequired: false,
287
+ transformFunction: null
288
+ },
289
+ label: {
290
+ classPropertyName: "label",
291
+ publicName: "label",
292
+ isSignal: true,
293
+ isRequired: false,
294
+ transformFunction: null
295
+ },
296
+ max: {
297
+ classPropertyName: "max",
298
+ publicName: "max",
299
+ isSignal: true,
300
+ isRequired: false,
301
+ transformFunction: null
302
+ },
303
+ min: {
304
+ classPropertyName: "min",
305
+ publicName: "min",
306
+ isSignal: true,
307
+ isRequired: false,
308
+ transformFunction: null
309
+ },
310
+ resizable: {
311
+ classPropertyName: "resizable",
312
+ publicName: "resizable",
313
+ isSignal: true,
314
+ isRequired: false,
315
+ transformFunction: null
316
+ },
317
+ size: {
318
+ classPropertyName: "size",
319
+ publicName: "size",
320
+ isSignal: true,
321
+ isRequired: false,
322
+ transformFunction: null
323
+ }
324
+ },
325
+ outputs: {
326
+ collapsed: "collapsedChange",
327
+ size: "sizeChange"
328
+ },
329
+ viewQueries: [{
330
+ propertyName: "template",
331
+ first: true,
332
+ predicate: TemplateRef,
333
+ descendants: true,
334
+ isSignal: true
335
+ }],
336
+ ngImport: i0,
337
+ template: `
264
338
  <ng-template>
265
339
  <ng-content></ng-content>
266
340
  </ng-template>
267
- `, isInline: true }); }
268
- }
269
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: SplitterPaneComponent, decorators: [{
270
- type: Component,
271
- args: [{
272
- selector: "mona-splitter-pane",
273
- template: `
341
+ `,
342
+ isInline: true
343
+ });
344
+ }
345
+ };
346
+ i0.ɵɵngDeclareClassMetadata({
347
+ minVersion: "12.0.0",
348
+ version: "22.2.6",
349
+ ngImport: i0,
350
+ type: SplitterPaneComponent,
351
+ decorators: [{
352
+ type: Component,
353
+ args: [{
354
+ selector: "mona-splitter-pane",
355
+ template: `
274
356
  <ng-template>
275
357
  <ng-content></ng-content>
276
358
  </ng-template>
277
359
  `
278
- }]
279
- }], propDecorators: { collapsed: [{ type: i0.Input, args: [{ isSignal: true, alias: "collapsed", required: false }] }, { type: i0.Output, args: ["collapsedChange"] }], collapsible: [{ type: i0.Input, args: [{ isSignal: true, alias: "collapsible", required: false }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], max: [{ type: i0.Input, args: [{ isSignal: true, alias: "max", required: false }] }], min: [{ type: i0.Input, args: [{ isSignal: true, alias: "min", required: false }] }], resizable: [{ type: i0.Input, args: [{ isSignal: true, alias: "resizable", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }, { type: i0.Output, args: ["sizeChange"] }], template: [{ type: i0.ViewChild, args: [i0.forwardRef(() => TemplateRef), { isSignal: true }] }] } });
280
-
281
- // Generated from i18n/catalogs/en-US.messages.json by scripts/generate-locale-catalogs.ts. Do not edit.
282
- // Edit the JSON file and run `npm run generate:locale-catalogs`.
360
+ }]
361
+ }],
362
+ propDecorators: {
363
+ collapsed: [{
364
+ type: i0.Input,
365
+ args: [{
366
+ isSignal: true,
367
+ alias: "collapsed",
368
+ required: false
369
+ }]
370
+ }, {
371
+ type: i0.Output,
372
+ args: ["collapsedChange"]
373
+ }],
374
+ collapsible: [{
375
+ type: i0.Input,
376
+ args: [{
377
+ isSignal: true,
378
+ alias: "collapsible",
379
+ required: false
380
+ }]
381
+ }],
382
+ label: [{
383
+ type: i0.Input,
384
+ args: [{
385
+ isSignal: true,
386
+ alias: "label",
387
+ required: false
388
+ }]
389
+ }],
390
+ max: [{
391
+ type: i0.Input,
392
+ args: [{
393
+ isSignal: true,
394
+ alias: "max",
395
+ required: false
396
+ }]
397
+ }],
398
+ min: [{
399
+ type: i0.Input,
400
+ args: [{
401
+ isSignal: true,
402
+ alias: "min",
403
+ required: false
404
+ }]
405
+ }],
406
+ resizable: [{
407
+ type: i0.Input,
408
+ args: [{
409
+ isSignal: true,
410
+ alias: "resizable",
411
+ required: false
412
+ }]
413
+ }],
414
+ size: [{
415
+ type: i0.Input,
416
+ args: [{
417
+ isSignal: true,
418
+ alias: "size",
419
+ required: false
420
+ }]
421
+ }, {
422
+ type: i0.Output,
423
+ args: ["sizeChange"]
424
+ }],
425
+ template: [{
426
+ type: i0.ViewChild,
427
+ args: [i0.forwardRef(() => TemplateRef), { isSignal: true }]
428
+ }]
429
+ }
430
+ });
283
431
  const SPLITTER_DEFAULT_MESSAGES = {
284
- collapseDown: "Collapse pane below",
285
- collapseNext: "Collapse next pane",
286
- collapsePrevious: "Collapse previous pane",
287
- collapseUp: "Collapse pane above",
288
- resizer: "Resizer"
432
+ collapseDown: "Collapse pane below",
433
+ collapseNext: "Collapse next pane",
434
+ collapsePrevious: "Collapse previous pane",
435
+ collapseUp: "Collapse pane above",
436
+ resizer: "Resizer"
289
437
  };
290
-
291
- class SplitterResizerHandleComponent {
292
- constructor() {
293
- this.#i18n = inject(MonaI18nService);
294
- this.baseClass = computed(() => {
295
- const orientation = this.orientation();
296
- return splitterResizerHandleThemeVariants({ orientation });
297
- }, /* @ts-ignore */
298
- ...(ngDevMode ? [{ debugName: "baseClass" }] : /* istanbul ignore next */ []));
299
- this.messages = this.#i18n.componentMessages("splitter", SPLITTER_DEFAULT_MESSAGES);
300
- this.collapseNext = output();
301
- this.collapsePrevious = output();
302
- this.nextControlsVisible = input.required(/* @ts-ignore */
303
- ...(ngDevMode ? [{ debugName: "nextControlsVisible" }] : /* istanbul ignore next */ []));
304
- this.orientation = input.required(/* @ts-ignore */
305
- ...(ngDevMode ? [{ debugName: "orientation" }] : /* istanbul ignore next */ []));
306
- this.previousControlsVisible = input.required(/* @ts-ignore */
307
- ...(ngDevMode ? [{ debugName: "previousControlsVisible" }] : /* istanbul ignore next */ []));
308
- this.resizable = input.required(/* @ts-ignore */
309
- ...(ngDevMode ? [{ debugName: "resizable" }] : /* istanbul ignore next */ []));
310
- }
311
- #i18n;
312
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: SplitterResizerHandleComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
313
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: SplitterResizerHandleComponent, isStandalone: true, selector: "mona-splitter-resizer-handle", inputs: { nextControlsVisible: { classPropertyName: "nextControlsVisible", publicName: "nextControlsVisible", isSignal: true, isRequired: true, transformFunction: null }, orientation: { classPropertyName: "orientation", publicName: "orientation", isSignal: true, isRequired: true, transformFunction: null }, previousControlsVisible: { classPropertyName: "previousControlsVisible", publicName: "previousControlsVisible", isSignal: true, isRequired: true, transformFunction: null }, resizable: { classPropertyName: "resizable", publicName: "resizable", isSignal: true, isRequired: true, transformFunction: null } }, outputs: { collapseNext: "collapseNext", collapsePrevious: "collapsePrevious" }, host: { properties: { "class": "baseClass()" } }, ngImport: i0, template: "@if (orientation() === \"horizontal\") {\n @if (previousControlsVisible()) {\n <button\n monaButton\n type=\"button\"\n look=\"secondary\"\n [rounded]=\"'none'\"\n [attr.aria-label]=\"messages().collapsePrevious\"\n (click)=\"collapsePrevious.emit()\">\n <svg lucideChevronLeft [size]=\"12\" class=\"rtl:rotate-180\"></svg>\n </button>\n }\n @if (resizable()) {\n <div class=\"flex h-6 w-0.5 bg-primary/40\"></div>\n }\n @if (nextControlsVisible()) {\n <button\n monaButton\n type=\"button\"\n look=\"secondary\"\n [rounded]=\"'none'\"\n [attr.aria-label]=\"messages().collapseNext\"\n (click)=\"collapseNext.emit()\">\n <svg lucideChevronRight [size]=\"12\" class=\"rtl:rotate-180\"></svg>\n </button>\n }\n} @else {\n @if (previousControlsVisible()) {\n <button\n monaButton\n type=\"button\"\n look=\"secondary\"\n [rounded]=\"'none'\"\n [attr.aria-label]=\"messages().collapseUp\"\n (click)=\"collapsePrevious.emit()\">\n <svg lucideChevronUp [size]=\"12\"></svg>\n </button>\n }\n @if (resizable()) {\n <div class=\"flex h-0.5 w-6 bg-primary/40\"></div>\n }\n @if (nextControlsVisible()) {\n <button\n monaButton\n type=\"button\"\n look=\"secondary\"\n [rounded]=\"'none'\"\n [attr.aria-label]=\"messages().collapseDown\"\n (click)=\"collapseNext.emit()\">\n <svg lucideChevronDown [size]=\"12\"></svg>\n </button>\n }\n}\n", dependencies: [{ 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: "component", type: LucideChevronLeft, selector: "svg[lucideChevronLeft]" }, { kind: "component", type: LucideChevronRight, selector: "svg[lucideChevronRight]" }, { kind: "component", type: LucideChevronUp, selector: "svg[lucideChevronUp]" }, { kind: "component", type: LucideChevronDown, selector: "svg[lucideChevronDown]" }] }); }
314
- }
315
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: SplitterResizerHandleComponent, decorators: [{
316
- type: Component,
317
- args: [{ selector: "mona-splitter-resizer-handle", imports: [ButtonDirective, LucideChevronLeft, LucideChevronRight, LucideChevronUp, LucideChevronDown], host: {
318
- "[class]": "baseClass()"
319
- }, template: "@if (orientation() === \"horizontal\") {\n @if (previousControlsVisible()) {\n <button\n monaButton\n type=\"button\"\n look=\"secondary\"\n [rounded]=\"'none'\"\n [attr.aria-label]=\"messages().collapsePrevious\"\n (click)=\"collapsePrevious.emit()\">\n <svg lucideChevronLeft [size]=\"12\" class=\"rtl:rotate-180\"></svg>\n </button>\n }\n @if (resizable()) {\n <div class=\"flex h-6 w-0.5 bg-primary/40\"></div>\n }\n @if (nextControlsVisible()) {\n <button\n monaButton\n type=\"button\"\n look=\"secondary\"\n [rounded]=\"'none'\"\n [attr.aria-label]=\"messages().collapseNext\"\n (click)=\"collapseNext.emit()\">\n <svg lucideChevronRight [size]=\"12\" class=\"rtl:rotate-180\"></svg>\n </button>\n }\n} @else {\n @if (previousControlsVisible()) {\n <button\n monaButton\n type=\"button\"\n look=\"secondary\"\n [rounded]=\"'none'\"\n [attr.aria-label]=\"messages().collapseUp\"\n (click)=\"collapsePrevious.emit()\">\n <svg lucideChevronUp [size]=\"12\"></svg>\n </button>\n }\n @if (resizable()) {\n <div class=\"flex h-0.5 w-6 bg-primary/40\"></div>\n }\n @if (nextControlsVisible()) {\n <button\n monaButton\n type=\"button\"\n look=\"secondary\"\n [rounded]=\"'none'\"\n [attr.aria-label]=\"messages().collapseDown\"\n (click)=\"collapseNext.emit()\">\n <svg lucideChevronDown [size]=\"12\"></svg>\n </button>\n }\n}\n" }]
320
- }], propDecorators: { collapseNext: [{ type: i0.Output, args: ["collapseNext"] }], collapsePrevious: [{ type: i0.Output, args: ["collapsePrevious"] }], nextControlsVisible: [{ type: i0.Input, args: [{ isSignal: true, alias: "nextControlsVisible", required: true }] }], orientation: [{ type: i0.Input, args: [{ isSignal: true, alias: "orientation", required: true }] }], previousControlsVisible: [{ type: i0.Input, args: [{ isSignal: true, alias: "previousControlsVisible", required: true }] }], resizable: [{ type: i0.Input, args: [{ isSignal: true, alias: "resizable", required: true }] }] } });
321
-
322
- class SplitterResizerComponent {
323
- #destroyRef;
324
- #direction;
325
- #hostElementRef;
326
- #i18n;
327
- #paneSizeMemory;
328
- #splitter;
329
- constructor() {
330
- this.#destroyRef = inject(DestroyRef);
331
- this.#direction = injectComponentDirection();
332
- this.#hostElementRef = inject(ElementRef);
333
- this.#i18n = inject(MonaI18nService);
334
- this.#paneSizeMemory = new WeakMap();
335
- this.#splitter = inject(SplitterComponent);
336
- this.ariaValueMax = signal(0, /* @ts-ignore */
337
- ...(ngDevMode ? [{ debugName: "ariaValueMax" }] : /* istanbul ignore next */ []));
338
- this.ariaValueMin = signal(0, /* @ts-ignore */
339
- ...(ngDevMode ? [{ debugName: "ariaValueMin" }] : /* istanbul ignore next */ []));
340
- this.ariaValueNow = signal(0, /* @ts-ignore */
341
- ...(ngDevMode ? [{ debugName: "ariaValueNow" }] : /* istanbul ignore next */ []));
342
- this.baseClass = computed(() => {
343
- return splitterResizerThemeVariants({ orientation: this.orientation() });
344
- }, /* @ts-ignore */
345
- ...(ngDevMode ? [{ debugName: "baseClass" }] : /* istanbul ignore next */ []));
346
- this.controlsVisible = computed(() => this.hovered() || this.focused(), /* @ts-ignore */
347
- ...(ngDevMode ? [{ debugName: "controlsVisible" }] : /* istanbul ignore next */ []));
348
- this.cursor = computed(() => {
349
- if (!this.resizable()) {
350
- return "auto";
351
- }
352
- return this.orientation() === "horizontal" ? "ew-resize" : "ns-resize";
353
- }, /* @ts-ignore */
354
- ...(ngDevMode ? [{ debugName: "cursor" }] : /* istanbul ignore next */ []));
355
- this.focused = signal(false, /* @ts-ignore */
356
- ...(ngDevMode ? [{ debugName: "focused" }] : /* istanbul ignore next */ []));
357
- this.hovered = signal(false, /* @ts-ignore */
358
- ...(ngDevMode ? [{ debugName: "hovered" }] : /* istanbul ignore next */ []));
359
- this.isInert = computed(() => {
360
- return !this.resizable() && this.getCollapsibleTargetPane() === null;
361
- }, /* @ts-ignore */
362
- ...(ngDevMode ? [{ debugName: "isInert" }] : /* istanbul ignore next */ []));
363
- this.isRtl = computed(() => this.#direction() === "rtl", /* @ts-ignore */
364
- ...(ngDevMode ? [{ debugName: "isRtl" }] : /* istanbul ignore next */ []));
365
- this.messages = this.#i18n.componentMessages("splitter", SPLITTER_DEFAULT_MESSAGES);
366
- this.nextCollapseControlsVisible = computed(() => {
367
- return this.controlsVisible() && this.nextPane().collapsible() && !this.nextPane().collapsed();
368
- }, /* @ts-ignore */
369
- ...(ngDevMode ? [{ debugName: "nextCollapseControlsVisible" }] : /* istanbul ignore next */ []));
370
- this.previousCollapseControlsVisible = computed(() => {
371
- return this.controlsVisible() && this.previousPane().collapsible() && !this.previousPane().collapsed();
372
- }, /* @ts-ignore */
373
- ...(ngDevMode ? [{ debugName: "previousCollapseControlsVisible" }] : /* istanbul ignore next */ []));
374
- this.resizable = computed(() => {
375
- return this.previousPane().resizable() && this.nextPane().resizable();
376
- }, /* @ts-ignore */
377
- ...(ngDevMode ? [{ debugName: "resizable" }] : /* istanbul ignore next */ []));
378
- this.resizing = signal(false, /* @ts-ignore */
379
- ...(ngDevMode ? [{ debugName: "resizing" }] : /* istanbul ignore next */ []));
380
- this.separatorClass = computed(() => {
381
- return splitterSeparatorThemeVariants({ orientation: this.orientation(), resizing: this.resizing() });
382
- }, /* @ts-ignore */
383
- ...(ngDevMode ? [{ debugName: "separatorClass" }] : /* istanbul ignore next */ []));
384
- this.separatorElement = viewChild.required("separator", /* @ts-ignore */
385
- ...(ngDevMode ? [{ debugName: "separatorElement" }] : /* istanbul ignore next */ []));
386
- /** The way the bar runs, which is across the way the panes are laid out. */
387
- this.separatorOrientation = computed(() => {
388
- return this.orientation() === "horizontal" ? "vertical" : "horizontal";
389
- }, /* @ts-ignore */
390
- ...(ngDevMode ? [{ debugName: "separatorOrientation" }] : /* istanbul ignore next */ []));
391
- this.nextPane = input.required(/* @ts-ignore */
392
- ...(ngDevMode ? [{ debugName: "nextPane" }] : /* istanbul ignore next */ []));
393
- this.orientation = input.required(/* @ts-ignore */
394
- ...(ngDevMode ? [{ debugName: "orientation" }] : /* istanbul ignore next */ []));
395
- this.previousPane = input.required(/* @ts-ignore */
396
- ...(ngDevMode ? [{ debugName: "previousPane" }] : /* istanbul ignore next */ []));
397
- afterNextRender({
398
- read: () => this.observePaneSizes()
399
- });
400
- afterRenderEffect({
401
- read: () => {
402
- this.previousPane().size();
403
- this.previousPane().collapsed();
404
- this.nextPane().size();
405
- this.nextPane().collapsed();
406
- this.updateAriaSeparatorValues();
407
- }
408
- });
409
- }
410
- /** Focus goes to the separator first, because the button that was activated goes away with the pane. */
411
- collapseNext() {
412
- this.separatorElement().nativeElement.focus();
413
- this.collapsePane("next");
414
- }
415
- collapsePrevious() {
416
- this.separatorElement().nativeElement.focus();
417
- this.collapsePane("previous");
418
- }
419
- onFocusOut(event) {
420
- this.focused.set(this.#hostElementRef.nativeElement.contains(event.relatedTarget));
421
- }
422
- onKeydown(event) {
423
- if (this.handleKeydown(event)) {
424
- event.preventDefault();
425
- event.stopPropagation();
426
- }
427
- }
428
- /** Listens only for the length of the drag, so nothing is left behind on the document in between. */
429
- onPointerDown(event) {
430
- if (!this.resizable() || event.button !== 0 || this.resizing()) {
431
- return;
432
- }
433
- // Cancelling this also cancels the mouse events that would have moved focus, so it's moved here.
434
- event.preventDefault();
435
- const separator = this.separatorElement().nativeElement;
436
- separator.focus({ preventScroll: true });
437
- const { pointerId } = event;
438
- const isDragPointer = (other) => other.pointerId === pointerId;
439
- separator.setPointerCapture(pointerId);
440
- this.resizing.set(true);
441
- let moved = false;
442
- const dragEnd$ = merge(fromEvent(separator, "pointerup"), fromEvent(separator, "pointercancel"), fromEvent(separator, "lostpointercapture")).pipe(filter(isDragPointer), take(1), tap(() => {
443
- if (moved) {
444
- this.#splitter.notifyResizeEnd();
445
- }
446
- }));
447
- fromEvent(separator.ownerDocument, "pointermove")
448
- .pipe(filter(isDragPointer), takeUntil(dragEnd$), takeUntilDestroyed(this.#destroyRef), finalize(() => {
449
- this.resizing.set(false);
450
- if (separator.hasPointerCapture(pointerId)) {
451
- separator.releasePointerCapture(pointerId);
452
- }
453
- }))
454
- .subscribe(move => {
455
- moved = true;
456
- this.ensureExpandedBeforeResize();
457
- if (this.orientation() === "horizontal") {
458
- this.updateHorizontalPaneSizes(move);
459
- }
460
- else {
461
- this.updateVerticalPaneSizes(move);
462
- }
463
- });
464
- }
465
- toggleCollapse() {
466
- const targetPane = this.getCollapsibleTargetPane();
467
- if (targetPane === null) {
468
- return;
469
- }
470
- const targetElement = targetPane.uid === this.previousPane().uid ? this.getPaneElements()[0] : this.getPaneElements()[1];
471
- const direction = targetPane.uid === this.previousPane().uid ? "previous" : "next";
472
- this.togglePane(targetPane, targetElement, direction);
473
- this.#splitter.notifyResizeEnd();
474
- }
475
- clamp(value, min, max) {
476
- if (Number.isFinite(max)) {
477
- return Math.min(Math.max(value, min), max);
478
- }
479
- return Math.max(value, min);
480
- }
481
- clampPaneSizes(total, desiredPrev, previousPane, nextPane) {
482
- const prevMin = this.getMinSize(previousPane);
483
- const nextMin = this.getMinSize(nextPane);
484
- const prevMaxRaw = this.getMaxSize(previousPane);
485
- const nextMaxRaw = this.getMaxSize(nextPane);
486
- const prevMax = Math.min(prevMaxRaw, total - nextMin);
487
- const prevMinBound = Math.max(prevMin, total - nextMaxRaw);
488
- let prevSize = this.clamp(desiredPrev, prevMinBound, prevMax);
489
- let nextSize = total - prevSize;
490
- if (nextSize < nextMin) {
491
- nextSize = nextMin;
492
- prevSize = total - nextSize;
493
- }
494
- else if (nextSize > nextMaxRaw) {
495
- nextSize = nextMaxRaw;
496
- prevSize = total - nextSize;
497
- }
498
- // final guard for prev bounds
499
- prevSize = this.clamp(prevSize, prevMin, prevMaxRaw);
500
- nextSize = total - prevSize;
501
- return [prevSize, nextSize];
502
- }
503
- collapseAndRedistribute(targetPane, targetSize, leading, trailing) {
504
- if (targetSize <= 0) {
505
- // Nothing to hand out, as when the splitter sits in a hidden tab, but the pane still collapses.
506
- targetPane.collapsed.set(true);
507
- return;
508
- }
509
- const leadingNeighbor = leading !== null && !(leading.pane.collapsible() && leading.pane.collapsed()) ? leading : null;
510
- const trailingNeighbor = trailing !== null && !(trailing.pane.collapsible() && trailing.pane.collapsed()) ? trailing : null;
511
- const neighbors = compact([leadingNeighbor, trailingNeighbor]).toArray();
512
- if (neighbors.length === 0) {
513
- targetPane.collapsed.set(true);
514
- return;
515
- }
516
- this.distributeSpaceToNeighbors(targetSize, neighbors);
517
- targetPane.collapsed.set(true);
518
- }
519
- collapsePane(direction) {
520
- const target = this.pickTargetPane(direction);
521
- if (target === null || !target.pane.collapsible()) {
522
- return false;
523
- }
524
- this.togglePane(target.pane, target.element, target.direction);
525
- this.#splitter.notifyResizeEnd();
526
- return true;
527
- }
528
- distributeSpaceToNeighbors(space, neighbors) {
529
- const remaining = space;
530
- const capacities = neighbors.map(neighbor => {
531
- const max = this.getMaxSize(neighbor.pane);
532
- const capacity = max === Number.POSITIVE_INFINITY ? Number.POSITIVE_INFINITY : Math.max(0, max - neighbor.size);
533
- return { neighbor, capacity };
534
- });
535
- const infiniteRecipients = capacities.filter(c => !Number.isFinite(c.capacity));
536
- if (infiniteRecipients.length > 0) {
537
- const share = remaining / infiniteRecipients.length;
538
- infiniteRecipients.forEach(c => {
539
- c.neighbor.pane.size.set(`${c.neighbor.size + share}px`);
540
- });
541
- return;
542
- }
543
- const available = capacities.reduce((sum, c) => sum + c.capacity, 0);
544
- if (available <= 0) {
545
- return;
546
- }
547
- capacities.forEach(c => {
548
- const share = (c.capacity / available) * remaining;
549
- c.neighbor.pane.size.set(`${c.neighbor.size + share}px`);
550
- });
551
- }
552
- ensureExpandedBeforeResize() {
553
- if (this.previousPane().collapsed()) {
554
- this.previousPane().collapsed.set(false);
555
- }
556
- if (this.nextPane().collapsed()) {
557
- this.nextPane().collapsed.set(false);
558
- }
559
- }
560
- expandPane(targetPane, desiredSize, leading, trailing) {
561
- const targetMin = this.getMinSize(targetPane);
562
- const targetMax = this.getMaxSize(targetPane);
563
- if (desiredSize <= 0) {
564
- targetPane.collapsed.set(false);
565
- return;
566
- }
567
- const currentLeadingSize = leading?.size ?? 0;
568
- const currentTrailingSize = trailing?.size ?? 0;
569
- const neighborTotal = currentLeadingSize + currentTrailingSize;
570
- if (neighborTotal <= 0) {
571
- const clampedTarget = this.clamp(desiredSize, targetMin, targetMax);
572
- targetPane.size.set(`${clampedTarget}px`);
573
- targetPane.collapsed.set(false);
574
- return;
575
- }
576
- const availableFromLeading = leading !== null ? Math.max(0, currentLeadingSize - this.getMinSize(leading.pane)) : 0;
577
- const availableFromTrailing = trailing !== null ? Math.max(0, currentTrailingSize - this.getMinSize(trailing.pane)) : 0;
578
- const availableTotal = availableFromLeading + availableFromTrailing;
579
- if (availableTotal <= 0) {
580
- targetPane.collapsed.set(false);
581
- return;
582
- }
583
- const desiredClamped = this.clamp(desiredSize, targetMin, targetMax);
584
- const targetSize = Math.min(desiredClamped, availableTotal);
585
- if (leading !== null && availableFromLeading > 0) {
586
- const takeFromLeading = targetSize * (availableFromLeading / availableTotal);
587
- const newSize = Math.max(this.getMinSize(leading.pane), currentLeadingSize - takeFromLeading);
588
- leading.pane.size.set(`${newSize}px`);
589
- }
590
- if (trailing !== null && availableFromTrailing > 0) {
591
- const takeFromTrailing = targetSize * (availableFromTrailing / availableTotal);
592
- const newSize = Math.max(this.getMinSize(trailing.pane), currentTrailingSize - takeFromTrailing);
593
- trailing.pane.size.set(`${newSize}px`);
594
- }
595
- targetPane.size.set(`${targetSize}px`);
596
- targetPane.collapsed.set(false);
597
- }
598
- findPaneToLeft(element) {
599
- let cursor = element.previousElementSibling;
600
- while (cursor !== null) {
601
- if (cursor.dataset["pid"]) {
602
- const pane = this.#splitter.getPaneByUid(cursor.dataset["pid"]);
603
- if (pane != null) {
604
- return { pane, element: cursor };
605
- }
606
- }
607
- cursor = cursor.previousElementSibling;
608
- }
609
- return null;
610
- }
611
- findPaneToRight(element) {
612
- let cursor = element.nextElementSibling;
613
- while (cursor !== null) {
614
- if (cursor.dataset["pid"]) {
615
- const pane = this.#splitter.getPaneByUid(cursor.dataset["pid"]);
616
- if (pane != null) {
617
- return { pane, element: cursor };
618
- }
619
- }
620
- cursor = cursor.nextElementSibling;
621
- }
622
- return null;
623
- }
624
- getCollapsibleTargetPane() {
625
- const previousPane = this.previousPane();
626
- const nextPane = this.nextPane();
627
- if (previousPane.collapsible() && previousPane.collapsed()) {
628
- return previousPane;
629
- }
630
- if (nextPane.collapsible() && nextPane.collapsed()) {
631
- return nextPane;
632
- }
633
- if (previousPane.collapsible()) {
634
- return previousPane;
635
- }
636
- if (nextPane.collapsible()) {
637
- return nextPane;
638
- }
639
- return null;
640
- }
641
- getMaxSize(pane) {
642
- const max = pane.max();
643
- const parsed = parsePaneSizeLimit(max);
644
- return parsed === null ? Number.POSITIVE_INFINITY : Math.max(0, parsed);
645
- }
646
- getMinSize(pane) {
647
- const min = pane.min();
648
- const parsed = parsePaneSizeLimit(min);
649
- return parsed === null ? 0 : Math.max(0, parsed);
650
- }
651
- getNeighborPanes(targetElement, direction) {
652
- const [previousElement, nextElement] = this.getPaneElements();
653
- const leadingPane = direction === "previous"
654
- ? this.findPaneToLeft(targetElement)
655
- : { pane: this.previousPane(), element: previousElement };
656
- const trailingPane = direction === "previous"
657
- ? { pane: this.nextPane(), element: nextElement }
658
- : this.findPaneToRight(targetElement);
659
- return {
660
- leading: leadingPane !== null ? { ...leadingPane, size: this.measurePaneSize(leadingPane.element) } : null,
661
- trailing: trailingPane !== null ? { ...trailingPane, size: this.measurePaneSize(trailingPane.element) } : null
662
- };
663
- }
664
- getPaneElements() {
665
- const previousPane = this.#hostElementRef.nativeElement.previousElementSibling;
666
- const nextPane = this.#hostElementRef.nativeElement.nextElementSibling;
667
- if (previousPane === null || nextPane === null) {
668
- throw new Error("The previous or next pane element is not found.");
669
- }
670
- return [previousPane, nextPane];
671
- }
672
- getPaneRectangles() {
673
- const [previousPane, nextPane] = this.getPaneElements();
674
- return [previousPane.getBoundingClientRect(), nextPane.getBoundingClientRect()];
675
- }
676
- handleCollapserKeys(key) {
677
- const orientation = this.orientation();
678
- if (orientation === "horizontal") {
679
- const isRtl = this.isRtl();
680
- if (key === "ArrowLeft") {
681
- return this.collapsePane(isRtl ? "next" : "previous");
682
- }
683
- if (key === "ArrowRight") {
684
- return this.collapsePane(isRtl ? "previous" : "next");
685
- }
686
- }
687
- else {
688
- if (key === "ArrowUp") {
689
- return this.collapsePane("previous");
690
- }
691
- if (key === "ArrowDown") {
692
- return this.collapsePane("next");
693
- }
694
- }
695
- return false;
696
- }
697
- handleKeydown(event) {
698
- const key = event.key;
699
- if (event.ctrlKey || event.metaKey || event.shiftKey) {
700
- return false;
701
- }
702
- if (event.altKey) {
703
- return this.handleCollapserKeys(key);
704
- }
705
- if (key === "Enter") {
706
- if (this.getCollapsibleTargetPane() === null) {
707
- return false;
708
- }
709
- this.toggleCollapse();
710
- return true;
711
- }
712
- return this.handleResizerKeys(key);
713
- }
714
- handleResizerKeys(key) {
715
- if (!this.resizable()) {
716
- return false;
717
- }
718
- const step = this.#splitter.keyboardStep();
719
- if (key === "Home") {
720
- this.resizeFromKey(Number.NEGATIVE_INFINITY);
721
- return true;
722
- }
723
- if (key === "End") {
724
- this.resizeFromKey(Number.POSITIVE_INFINITY);
725
- return true;
726
- }
727
- if (this.orientation() === "horizontal") {
728
- const isRtl = this.isRtl();
729
- if (key === "ArrowLeft") {
730
- this.resizeFromKey(isRtl ? step : -step);
731
- return true;
732
- }
733
- if (key === "ArrowRight") {
734
- this.resizeFromKey(isRtl ? -step : step);
735
- return true;
736
- }
737
- }
738
- else {
739
- if (key === "ArrowUp") {
740
- this.resizeFromKey(-step);
741
- return true;
742
- }
743
- if (key === "ArrowDown") {
744
- this.resizeFromKey(step);
745
- return true;
746
- }
747
- }
748
- return false;
749
- }
750
- isCollapsed(pane) {
751
- return pane.collapsible() && pane.collapsed();
752
- }
753
- measurePaneSize(paneElement) {
754
- const rect = paneElement.getBoundingClientRect();
755
- const orientation = this.orientation();
756
- return orientation === "horizontal" ? rect.width : rect.height;
757
- }
758
- nudgeSplitter(delta) {
759
- this.ensureExpandedBeforeResize();
760
- const [previousRect, nextRect] = this.getPaneRectangles();
761
- const total = this.orientation() === "horizontal"
762
- ? previousRect.width + nextRect.width
763
- : previousRect.height + nextRect.height;
764
- const currentPrev = this.orientation() === "horizontal" ? previousRect.width : previousRect.height;
765
- const desiredPrev = this.clamp(currentPrev + delta, 0, total);
766
- const [prevSize, nextSize] = this.clampPaneSizes(total, desiredPrev, this.previousPane(), this.nextPane());
767
- this.updatePaneSizes(`${prevSize}px`, `${nextSize}px`);
768
- }
769
- /** So the separator's value follows the panes when the container resizes or a hidden tab is shown. */
770
- observePaneSizes() {
771
- if (typeof ResizeObserver === "undefined") {
772
- return;
773
- }
774
- const observer = new ResizeObserver(() => this.updateAriaSeparatorValues());
775
- this.getPaneElements().forEach(element => observer.observe(element));
776
- this.#destroyRef.onDestroy(() => observer.disconnect());
777
- }
778
- pickTargetPane(direction) {
779
- const [previousElement, nextElement] = this.getPaneElements();
780
- const previousPane = this.previousPane();
781
- const nextPane = this.nextPane();
782
- if (direction === "previous") {
783
- if (nextPane.collapsible() && nextPane.collapsed()) {
784
- return { pane: nextPane, element: nextElement, direction: "next" };
785
- }
786
- return { pane: previousPane, element: previousElement, direction: "previous" };
787
- }
788
- else {
789
- if (previousPane.collapsible() && previousPane.collapsed()) {
790
- return { pane: previousPane, element: previousElement, direction: "previous" };
791
- }
792
- return { pane: nextPane, element: nextElement, direction: "next" };
793
- }
794
- }
795
- /**
796
- * A key on a collapsed pane brings it back at the size it had, or does nothing when the key points further into it.
797
- * Resizing from there would leave it at a single step and lose that size.
798
- */
799
- resizeFromKey(delta) {
800
- const previousPane = this.previousPane();
801
- const nextPane = this.nextPane();
802
- const [previousElement, nextElement] = this.getPaneElements();
803
- if (this.isCollapsed(previousPane)) {
804
- if (delta <= 0) {
805
- return;
806
- }
807
- this.togglePane(previousPane, previousElement, "previous");
808
- }
809
- else if (this.isCollapsed(nextPane)) {
810
- if (delta >= 0) {
811
- return;
812
- }
813
- this.togglePane(nextPane, nextElement, "next");
814
- }
815
- else {
816
- this.nudgeSplitter(delta);
817
- }
818
- this.#splitter.notifyResizeEnd();
819
- }
820
- togglePane(targetPane, targetElement, direction) {
821
- const neighbors = this.getNeighborPanes(targetElement, direction);
822
- if (targetPane.collapsed()) {
823
- const storedSize = this.#paneSizeMemory.get(targetPane) ?? this.measurePaneSize(targetElement);
824
- this.expandPane(targetPane, storedSize, neighbors.leading, neighbors.trailing);
825
- }
826
- else {
827
- const targetSize = this.measurePaneSize(targetElement);
828
- if (targetSize > 0) {
829
- this.#paneSizeMemory.set(targetPane, targetSize);
830
- }
831
- this.collapseAndRedistribute(targetPane, targetSize, neighbors.leading, neighbors.trailing);
832
- }
833
- }
834
- updateAriaSeparatorValues() {
835
- const [previousRect, nextRect] = this.getPaneRectangles();
836
- const orientation = this.orientation();
837
- const previousSize = orientation === "horizontal" ? previousRect.width : previousRect.height;
838
- const nextSize = orientation === "horizontal" ? nextRect.width : nextRect.height;
839
- const total = previousSize + nextSize;
840
- const previousMin = this.getMinSize(this.previousPane());
841
- const nextMin = this.getMinSize(this.nextPane());
842
- const previousMaxRaw = this.getMaxSize(this.previousPane());
843
- const previousMax = Math.min(previousMaxRaw, total - nextMin);
844
- this.ariaValueMax.set(Math.round(Number.isFinite(previousMax) ? previousMax : total));
845
- this.ariaValueMin.set(Math.round(previousMin));
846
- this.ariaValueNow.set(Math.round(previousSize));
847
- }
848
- updateHorizontalPaneSizes(event) {
849
- const [previousRect, nextRect] = this.getPaneRectangles();
850
- const maxWidth = previousRect.width + nextRect.width;
851
- const isRtl = this.isRtl();
852
- const desiredPrevWidth = isRtl
853
- ? Math.min(Math.max(previousRect.right - event.clientX, 0), maxWidth)
854
- : Math.min(Math.max(event.clientX - previousRect.left, 0), maxWidth);
855
- const [previousPaneWidth, nextPaneWidth] = this.clampPaneSizes(maxWidth, desiredPrevWidth, this.previousPane(), this.nextPane());
856
- this.updatePaneSizes(`${previousPaneWidth}px`, `${nextPaneWidth}px`);
857
- }
858
- updatePaneSizes(previousPaneSize, nextPaneSize) {
859
- this.previousPane().collapsed.set(false);
860
- this.nextPane().collapsed.set(false);
861
- this.previousPane().size.set(previousPaneSize);
862
- this.nextPane().size.set(nextPaneSize);
863
- }
864
- updateVerticalPaneSizes(event) {
865
- const [previousRect, nextRect] = this.getPaneRectangles();
866
- const maxHeight = previousRect.height + nextRect.height;
867
- const desiredPrevHeight = Math.min(Math.max(event.clientY - previousRect.top, 0), maxHeight);
868
- const [previousPaneHeight, nextPaneHeight] = this.clampPaneSizes(maxHeight, desiredPrevHeight, this.previousPane(), this.nextPane());
869
- this.updatePaneSizes(`${previousPaneHeight}px`, `${nextPaneHeight}px`);
870
- }
871
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: SplitterResizerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
872
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "22.0.6", type: SplitterResizerComponent, isStandalone: true, selector: "mona-splitter-resizer", inputs: { nextPane: { classPropertyName: "nextPane", publicName: "nextPane", isSignal: true, isRequired: true, transformFunction: null }, orientation: { classPropertyName: "orientation", publicName: "orientation", isSignal: true, isRequired: true, transformFunction: null }, previousPane: { classPropertyName: "previousPane", publicName: "previousPane", isSignal: true, isRequired: true, transformFunction: null } }, host: { listeners: { "focusin": "focused.set(true)", "focusout": "onFocusOut($event)", "pointerenter": "hovered.set(true)", "pointerleave": "hovered.set(false)" }, properties: { "class": "baseClass()" } }, viewQueries: [{ propertyName: "separatorElement", first: true, predicate: ["separator"], descendants: true, isSignal: true }], ngImport: i0, template: "<div\n #separator\n role=\"separator\"\n [class]=\"separatorClass()\"\n [style.cursor]=\"cursor()\"\n [attr.aria-controls]=\"isInert() ? null : previousPane().uid\"\n [attr.aria-label]=\"previousPane().label() || messages().resizer\"\n [attr.aria-orientation]=\"separatorOrientation()\"\n [attr.aria-valuemax]=\"isInert() ? null : ariaValueMax()\"\n [attr.aria-valuemin]=\"isInert() ? null : ariaValueMin()\"\n [attr.aria-valuenow]=\"isInert() ? null : ariaValueNow()\"\n [attr.tabindex]=\"isInert() ? null : 0\"\n (dblclick)=\"toggleCollapse()\"\n (keydown)=\"onKeydown($event)\"\n (pointerdown)=\"onPointerDown($event)\"></div>\n<mona-splitter-resizer-handle\n (collapseNext)=\"collapseNext()\"\n (collapsePrevious)=\"collapsePrevious()\"\n [nextControlsVisible]=\"nextCollapseControlsVisible()\"\n [orientation]=\"orientation()\"\n [previousControlsVisible]=\"previousCollapseControlsVisible()\"\n [resizable]=\"resizable()\">\n</mona-splitter-resizer-handle>\n", dependencies: [{ kind: "component", type: SplitterResizerHandleComponent, selector: "mona-splitter-resizer-handle", inputs: ["nextControlsVisible", "orientation", "previousControlsVisible", "resizable"], outputs: ["collapseNext", "collapsePrevious"] }] }); }
873
- }
874
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: SplitterResizerComponent, decorators: [{
875
- type: Component,
876
- args: [{ selector: "mona-splitter-resizer", imports: [SplitterResizerHandleComponent], host: {
877
- "[class]": "baseClass()",
878
- "(focusin)": "focused.set(true)",
879
- "(focusout)": "onFocusOut($event)",
880
- "(pointerenter)": "hovered.set(true)",
881
- "(pointerleave)": "hovered.set(false)"
882
- }, template: "<div\n #separator\n role=\"separator\"\n [class]=\"separatorClass()\"\n [style.cursor]=\"cursor()\"\n [attr.aria-controls]=\"isInert() ? null : previousPane().uid\"\n [attr.aria-label]=\"previousPane().label() || messages().resizer\"\n [attr.aria-orientation]=\"separatorOrientation()\"\n [attr.aria-valuemax]=\"isInert() ? null : ariaValueMax()\"\n [attr.aria-valuemin]=\"isInert() ? null : ariaValueMin()\"\n [attr.aria-valuenow]=\"isInert() ? null : ariaValueNow()\"\n [attr.tabindex]=\"isInert() ? null : 0\"\n (dblclick)=\"toggleCollapse()\"\n (keydown)=\"onKeydown($event)\"\n (pointerdown)=\"onPointerDown($event)\"></div>\n<mona-splitter-resizer-handle\n (collapseNext)=\"collapseNext()\"\n (collapsePrevious)=\"collapsePrevious()\"\n [nextControlsVisible]=\"nextCollapseControlsVisible()\"\n [orientation]=\"orientation()\"\n [previousControlsVisible]=\"previousCollapseControlsVisible()\"\n [resizable]=\"resizable()\">\n</mona-splitter-resizer-handle>\n" }]
883
- }], ctorParameters: () => [], propDecorators: { separatorElement: [{ type: i0.ViewChild, args: ["separator", { isSignal: true }] }], nextPane: [{ type: i0.Input, args: [{ isSignal: true, alias: "nextPane", required: true }] }], orientation: [{ type: i0.Input, args: [{ isSignal: true, alias: "orientation", required: true }] }], previousPane: [{ type: i0.Input, args: [{ isSignal: true, alias: "previousPane", required: true }] }] } });
884
-
885
- class SplitterComponent {
886
- constructor() {
887
- this.baseClass = computed(() => {
888
- const orientation = this.orientation();
889
- return splitterBaseThemeVariants({ orientation });
890
- }, /* @ts-ignore */
891
- ...(ngDevMode ? [{ debugName: "baseClass" }] : /* istanbul ignore next */ []));
892
- this.paneList = contentChildren(SplitterPaneComponent, /* @ts-ignore */
893
- ...(ngDevMode ? [{ debugName: "paneList" }] : /* istanbul ignore next */ []));
894
- /**
895
- * @description How far an arrow key moves a separator, in pixels.
896
- * @default 10
897
- */
898
- this.keyboardStep = input(10, { ...(ngDevMode ? { debugName: "keyboardStep" } : /* istanbul ignore next */ {}), transform: numberAttribute });
899
- /**
900
- * @description The layout direction of the splitter panes.
901
- * @default "horizontal"
902
- */
903
- this.orientation = input("horizontal", /* @ts-ignore */
904
- ...(ngDevMode ? [{ debugName: "orientation" }] : /* istanbul ignore next */ []));
905
- /**
906
- * @description Emitted with every pane's `size`, in order, once a drag ends, after each key that resizes, and when the
907
- * separator collapses or expands a pane. Use it to save a layout: `sizeChange` on a pane fires on every move, and these
908
- * values can go straight back into `size`.
909
- */
910
- this.resizeEnd = output();
911
- }
912
- /**
913
- * @internal Used by SplitterResizerComponent to resolve sibling panes by id.
914
- */
915
- getPaneByUid(uid) {
916
- return from(this.paneList()).firstOrDefault(pane => pane.uid === uid);
917
- }
918
- /**
919
- * @internal Used by SplitterResizerComponent when a resize has finished.
920
- */
921
- notifyResizeEnd() {
922
- this.resizeEnd.emit(this.paneList().map(pane => pane.size()));
923
- }
924
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: SplitterComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
925
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: SplitterComponent, isStandalone: true, selector: "mona-splitter", inputs: { keyboardStep: { classPropertyName: "keyboardStep", publicName: "keyboardStep", isSignal: true, isRequired: false, transformFunction: null }, orientation: { classPropertyName: "orientation", publicName: "orientation", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { resizeEnd: "resizeEnd" }, host: { properties: { "class": "baseClass()" } }, queries: [{ propertyName: "paneList", predicate: SplitterPaneComponent, isSignal: true }], ngImport: i0, template: "@for (pane of paneList(); track pane.uid) {\n <div\n class=\"overflow-hidden min-w-0 min-h-0\"\n [attr.data-pid]=\"pane.uid\"\n [attr.data-px]=\"$index\"\n [id]=\"pane.uid\"\n monaSplitterPaneStyle\n [orientation]=\"orientation()\"\n [pane]=\"pane\"\n [paneList]=\"paneList()\">\n <ng-container [ngTemplateOutlet]=\"pane.template()\"></ng-container>\n </div>\n @if ($index !== $count - 1) {\n <mona-splitter-resizer\n [nextPane]=\"paneList()[$index + 1]\"\n [orientation]=\"orientation()!\"\n [previousPane]=\"paneList()[$index]\">\n </mona-splitter-resizer>\n }\n}\n", dependencies: [{ kind: "component", type: SplitterResizerComponent, selector: "mona-splitter-resizer", inputs: ["nextPane", "orientation", "previousPane"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: SplitterPaneStyleDirective, selector: "div[monaSplitterPaneStyle]", inputs: ["orientation", "pane", "paneList"] }] }); }
926
- }
927
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: SplitterComponent, decorators: [{
928
- type: Component,
929
- args: [{ selector: "mona-splitter", imports: [SplitterResizerComponent, NgTemplateOutlet, SplitterPaneStyleDirective], host: {
930
- "[class]": "baseClass()"
931
- }, template: "@for (pane of paneList(); track pane.uid) {\n <div\n class=\"overflow-hidden min-w-0 min-h-0\"\n [attr.data-pid]=\"pane.uid\"\n [attr.data-px]=\"$index\"\n [id]=\"pane.uid\"\n monaSplitterPaneStyle\n [orientation]=\"orientation()\"\n [pane]=\"pane\"\n [paneList]=\"paneList()\">\n <ng-container [ngTemplateOutlet]=\"pane.template()\"></ng-container>\n </div>\n @if ($index !== $count - 1) {\n <mona-splitter-resizer\n [nextPane]=\"paneList()[$index + 1]\"\n [orientation]=\"orientation()!\"\n [previousPane]=\"paneList()[$index]\">\n </mona-splitter-resizer>\n }\n}\n" }]
932
- }], propDecorators: { paneList: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => SplitterPaneComponent), { isSignal: true }] }], keyboardStep: [{ type: i0.Input, args: [{ isSignal: true, alias: "keyboardStep", required: false }] }], orientation: [{ type: i0.Input, args: [{ isSignal: true, alias: "orientation", required: false }] }], resizeEnd: [{ type: i0.Output, args: ["resizeEnd"] }] } });
933
-
934
- /*
935
- * Public API Surface of @nanahoshi/mona-ui/splitter
936
- */
937
-
938
- /**
939
- * Generated bundle index. Do not edit.
940
- */
941
-
438
+ var SplitterResizerHandleComponent = class SplitterResizerHandleComponent {
439
+ constructor() {
440
+ this.#i18n = inject(MonaI18nService);
441
+ this.baseClass = computed(() => {
442
+ const orientation = this.orientation();
443
+ return splitterResizerHandleThemeVariants({ orientation });
444
+ }, ...ngDevMode ? [{ debugName: "baseClass" }] : /* istanbul ignore next */ []);
445
+ this.messages = this.#i18n.componentMessages("splitter", SPLITTER_DEFAULT_MESSAGES);
446
+ this.collapseNext = output();
447
+ this.collapsePrevious = output();
448
+ this.nextControlsVisible = input.required(...ngDevMode ? [{ debugName: "nextControlsVisible" }] : /* istanbul ignore next */ []);
449
+ this.orientation = input.required(...ngDevMode ? [{ debugName: "orientation" }] : /* istanbul ignore next */ []);
450
+ this.previousControlsVisible = input.required(...ngDevMode ? [{ debugName: "previousControlsVisible" }] : /* istanbul ignore next */ []);
451
+ this.resizable = input.required(...ngDevMode ? [{ debugName: "resizable" }] : /* istanbul ignore next */ []);
452
+ }
453
+ #i18n;
454
+ static {
455
+ this.ɵfac = i0.ɵɵngDeclareFactory({
456
+ minVersion: "12.0.0",
457
+ version: "22.2.6",
458
+ ngImport: i0,
459
+ type: SplitterResizerHandleComponent,
460
+ deps: [],
461
+ target: i0.ɵɵFactoryTarget.Component
462
+ });
463
+ }
464
+ static {
465
+ this.ɵcmp = i0.ɵɵngDeclareComponent({
466
+ minVersion: "17.0.0",
467
+ version: "22.2.6",
468
+ type: SplitterResizerHandleComponent,
469
+ isStandalone: true,
470
+ selector: "mona-splitter-resizer-handle",
471
+ inputs: {
472
+ nextControlsVisible: {
473
+ classPropertyName: "nextControlsVisible",
474
+ publicName: "nextControlsVisible",
475
+ isSignal: true,
476
+ isRequired: true,
477
+ transformFunction: null
478
+ },
479
+ orientation: {
480
+ classPropertyName: "orientation",
481
+ publicName: "orientation",
482
+ isSignal: true,
483
+ isRequired: true,
484
+ transformFunction: null
485
+ },
486
+ previousControlsVisible: {
487
+ classPropertyName: "previousControlsVisible",
488
+ publicName: "previousControlsVisible",
489
+ isSignal: true,
490
+ isRequired: true,
491
+ transformFunction: null
492
+ },
493
+ resizable: {
494
+ classPropertyName: "resizable",
495
+ publicName: "resizable",
496
+ isSignal: true,
497
+ isRequired: true,
498
+ transformFunction: null
499
+ }
500
+ },
501
+ outputs: {
502
+ collapseNext: "collapseNext",
503
+ collapsePrevious: "collapsePrevious"
504
+ },
505
+ host: { properties: { "class": "baseClass()" } },
506
+ ngImport: i0,
507
+ template: "@if (orientation() === \"horizontal\") {\n @if (previousControlsVisible()) {\n <button\n monaButton\n type=\"button\"\n look=\"secondary\"\n [rounded]=\"'none'\"\n [attr.aria-label]=\"messages().collapsePrevious\"\n (click)=\"collapsePrevious.emit()\">\n <svg lucideChevronLeft [size]=\"12\" class=\"rtl:rotate-180\"></svg>\n </button>\n }\n @if (resizable()) {\n <div class=\"flex h-6 w-0.5 bg-primary/40\"></div>\n }\n @if (nextControlsVisible()) {\n <button\n monaButton\n type=\"button\"\n look=\"secondary\"\n [rounded]=\"'none'\"\n [attr.aria-label]=\"messages().collapseNext\"\n (click)=\"collapseNext.emit()\">\n <svg lucideChevronRight [size]=\"12\" class=\"rtl:rotate-180\"></svg>\n </button>\n }\n} @else {\n @if (previousControlsVisible()) {\n <button\n monaButton\n type=\"button\"\n look=\"secondary\"\n [rounded]=\"'none'\"\n [attr.aria-label]=\"messages().collapseUp\"\n (click)=\"collapsePrevious.emit()\">\n <svg lucideChevronUp [size]=\"12\"></svg>\n </button>\n }\n @if (resizable()) {\n <div class=\"flex h-0.5 w-6 bg-primary/40\"></div>\n }\n @if (nextControlsVisible()) {\n <button\n monaButton\n type=\"button\"\n look=\"secondary\"\n [rounded]=\"'none'\"\n [attr.aria-label]=\"messages().collapseDown\"\n (click)=\"collapseNext.emit()\">\n <svg lucideChevronDown [size]=\"12\"></svg>\n </button>\n }\n}\n",
508
+ dependencies: [
509
+ {
510
+ kind: "directive",
511
+ type: ButtonDirective,
512
+ selector: "button[monaButton]",
513
+ inputs: [
514
+ "aria-haspopup",
515
+ "disabled",
516
+ "iconOnly",
517
+ "loading",
518
+ "look",
519
+ "rounded",
520
+ "selected",
521
+ "size",
522
+ "tabindex",
523
+ "toggleable",
524
+ "type",
525
+ "class",
526
+ "value"
527
+ ],
528
+ outputs: ["lookChange", "selectedChange"]
529
+ },
530
+ {
531
+ kind: "component",
532
+ type: LucideChevronLeft,
533
+ selector: "svg[lucideChevronLeft]"
534
+ },
535
+ {
536
+ kind: "component",
537
+ type: LucideChevronRight,
538
+ selector: "svg[lucideChevronRight]"
539
+ },
540
+ {
541
+ kind: "component",
542
+ type: LucideChevronUp,
543
+ selector: "svg[lucideChevronUp]"
544
+ },
545
+ {
546
+ kind: "component",
547
+ type: LucideChevronDown,
548
+ selector: "svg[lucideChevronDown]"
549
+ }
550
+ ]
551
+ });
552
+ }
553
+ };
554
+ i0.ɵɵngDeclareClassMetadata({
555
+ minVersion: "12.0.0",
556
+ version: "22.2.6",
557
+ ngImport: i0,
558
+ type: SplitterResizerHandleComponent,
559
+ decorators: [{
560
+ type: Component,
561
+ args: [{
562
+ selector: "mona-splitter-resizer-handle",
563
+ imports: [
564
+ ButtonDirective,
565
+ LucideChevronLeft,
566
+ LucideChevronRight,
567
+ LucideChevronUp,
568
+ LucideChevronDown
569
+ ],
570
+ host: { "[class]": "baseClass()" },
571
+ template: "@if (orientation() === \"horizontal\") {\n @if (previousControlsVisible()) {\n <button\n monaButton\n type=\"button\"\n look=\"secondary\"\n [rounded]=\"'none'\"\n [attr.aria-label]=\"messages().collapsePrevious\"\n (click)=\"collapsePrevious.emit()\">\n <svg lucideChevronLeft [size]=\"12\" class=\"rtl:rotate-180\"></svg>\n </button>\n }\n @if (resizable()) {\n <div class=\"flex h-6 w-0.5 bg-primary/40\"></div>\n }\n @if (nextControlsVisible()) {\n <button\n monaButton\n type=\"button\"\n look=\"secondary\"\n [rounded]=\"'none'\"\n [attr.aria-label]=\"messages().collapseNext\"\n (click)=\"collapseNext.emit()\">\n <svg lucideChevronRight [size]=\"12\" class=\"rtl:rotate-180\"></svg>\n </button>\n }\n} @else {\n @if (previousControlsVisible()) {\n <button\n monaButton\n type=\"button\"\n look=\"secondary\"\n [rounded]=\"'none'\"\n [attr.aria-label]=\"messages().collapseUp\"\n (click)=\"collapsePrevious.emit()\">\n <svg lucideChevronUp [size]=\"12\"></svg>\n </button>\n }\n @if (resizable()) {\n <div class=\"flex h-0.5 w-6 bg-primary/40\"></div>\n }\n @if (nextControlsVisible()) {\n <button\n monaButton\n type=\"button\"\n look=\"secondary\"\n [rounded]=\"'none'\"\n [attr.aria-label]=\"messages().collapseDown\"\n (click)=\"collapseNext.emit()\">\n <svg lucideChevronDown [size]=\"12\"></svg>\n </button>\n }\n}\n"
572
+ }]
573
+ }],
574
+ propDecorators: {
575
+ collapseNext: [{
576
+ type: i0.Output,
577
+ args: ["collapseNext"]
578
+ }],
579
+ collapsePrevious: [{
580
+ type: i0.Output,
581
+ args: ["collapsePrevious"]
582
+ }],
583
+ nextControlsVisible: [{
584
+ type: i0.Input,
585
+ args: [{
586
+ isSignal: true,
587
+ alias: "nextControlsVisible",
588
+ required: true
589
+ }]
590
+ }],
591
+ orientation: [{
592
+ type: i0.Input,
593
+ args: [{
594
+ isSignal: true,
595
+ alias: "orientation",
596
+ required: true
597
+ }]
598
+ }],
599
+ previousControlsVisible: [{
600
+ type: i0.Input,
601
+ args: [{
602
+ isSignal: true,
603
+ alias: "previousControlsVisible",
604
+ required: true
605
+ }]
606
+ }],
607
+ resizable: [{
608
+ type: i0.Input,
609
+ args: [{
610
+ isSignal: true,
611
+ alias: "resizable",
612
+ required: true
613
+ }]
614
+ }]
615
+ }
616
+ });
617
+ var SplitterResizerComponent = class SplitterResizerComponent {
618
+ #destroyRef;
619
+ #direction;
620
+ #hostElementRef;
621
+ #i18n;
622
+ #paneSizeMemory;
623
+ #splitter;
624
+ constructor() {
625
+ this.#destroyRef = inject(DestroyRef);
626
+ this.#direction = injectComponentDirection();
627
+ this.#hostElementRef = inject(ElementRef);
628
+ this.#i18n = inject(MonaI18nService);
629
+ this.#paneSizeMemory = /* @__PURE__ */ new WeakMap();
630
+ this.#splitter = inject(SplitterComponent);
631
+ this.ariaValueMax = signal(0, ...ngDevMode ? [{ debugName: "ariaValueMax" }] : /* istanbul ignore next */ []);
632
+ this.ariaValueMin = signal(0, ...ngDevMode ? [{ debugName: "ariaValueMin" }] : /* istanbul ignore next */ []);
633
+ this.ariaValueNow = signal(0, ...ngDevMode ? [{ debugName: "ariaValueNow" }] : /* istanbul ignore next */ []);
634
+ this.baseClass = computed(() => {
635
+ return splitterResizerThemeVariants({ orientation: this.orientation() });
636
+ }, ...ngDevMode ? [{ debugName: "baseClass" }] : /* istanbul ignore next */ []);
637
+ this.controlsVisible = computed(() => this.hovered() || this.focused(), ...ngDevMode ? [{ debugName: "controlsVisible" }] : /* istanbul ignore next */ []);
638
+ this.cursor = computed(() => {
639
+ if (!this.resizable()) return "auto";
640
+ return this.orientation() === "horizontal" ? "ew-resize" : "ns-resize";
641
+ }, ...ngDevMode ? [{ debugName: "cursor" }] : /* istanbul ignore next */ []);
642
+ this.focused = signal(false, ...ngDevMode ? [{ debugName: "focused" }] : /* istanbul ignore next */ []);
643
+ this.hovered = signal(false, ...ngDevMode ? [{ debugName: "hovered" }] : /* istanbul ignore next */ []);
644
+ this.isInert = computed(() => {
645
+ return !this.resizable() && this.getCollapsibleTargetPane() === null;
646
+ }, ...ngDevMode ? [{ debugName: "isInert" }] : /* istanbul ignore next */ []);
647
+ this.isRtl = computed(() => this.#direction() === "rtl", ...ngDevMode ? [{ debugName: "isRtl" }] : /* istanbul ignore next */ []);
648
+ this.messages = this.#i18n.componentMessages("splitter", SPLITTER_DEFAULT_MESSAGES);
649
+ this.nextCollapseControlsVisible = computed(() => {
650
+ return this.controlsVisible() && this.nextPane().collapsible() && !this.nextPane().collapsed();
651
+ }, ...ngDevMode ? [{ debugName: "nextCollapseControlsVisible" }] : /* istanbul ignore next */ []);
652
+ this.previousCollapseControlsVisible = computed(() => {
653
+ return this.controlsVisible() && this.previousPane().collapsible() && !this.previousPane().collapsed();
654
+ }, ...ngDevMode ? [{ debugName: "previousCollapseControlsVisible" }] : /* istanbul ignore next */ []);
655
+ this.resizable = computed(() => {
656
+ return this.previousPane().resizable() && this.nextPane().resizable();
657
+ }, ...ngDevMode ? [{ debugName: "resizable" }] : /* istanbul ignore next */ []);
658
+ this.resizing = signal(false, ...ngDevMode ? [{ debugName: "resizing" }] : /* istanbul ignore next */ []);
659
+ this.separatorClass = computed(() => {
660
+ return splitterSeparatorThemeVariants({
661
+ orientation: this.orientation(),
662
+ resizing: this.resizing()
663
+ });
664
+ }, ...ngDevMode ? [{ debugName: "separatorClass" }] : /* istanbul ignore next */ []);
665
+ this.separatorElement = viewChild.required("separator", ...ngDevMode ? [{ debugName: "separatorElement" }] : /* istanbul ignore next */ []);
666
+ this.separatorOrientation = computed(() => {
667
+ return this.orientation() === "horizontal" ? "vertical" : "horizontal";
668
+ }, ...ngDevMode ? [{ debugName: "separatorOrientation" }] : /* istanbul ignore next */ []);
669
+ this.nextPane = input.required(...ngDevMode ? [{ debugName: "nextPane" }] : /* istanbul ignore next */ []);
670
+ this.orientation = input.required(...ngDevMode ? [{ debugName: "orientation" }] : /* istanbul ignore next */ []);
671
+ this.previousPane = input.required(...ngDevMode ? [{ debugName: "previousPane" }] : /* istanbul ignore next */ []);
672
+ afterNextRender({ read: () => this.observePaneSizes() });
673
+ afterRenderEffect({ read: () => {
674
+ this.previousPane().size();
675
+ this.previousPane().collapsed();
676
+ this.nextPane().size();
677
+ this.nextPane().collapsed();
678
+ this.updateAriaSeparatorValues();
679
+ } });
680
+ }
681
+ collapseNext() {
682
+ this.separatorElement().nativeElement.focus();
683
+ this.collapsePane("next");
684
+ }
685
+ collapsePrevious() {
686
+ this.separatorElement().nativeElement.focus();
687
+ this.collapsePane("previous");
688
+ }
689
+ onFocusOut(event) {
690
+ this.focused.set(this.#hostElementRef.nativeElement.contains(event.relatedTarget));
691
+ }
692
+ onKeydown(event) {
693
+ if (this.handleKeydown(event)) {
694
+ event.preventDefault();
695
+ event.stopPropagation();
696
+ }
697
+ }
698
+ onPointerDown(event) {
699
+ if (!this.resizable() || event.button !== 0 || this.resizing()) return;
700
+ event.preventDefault();
701
+ const separator = this.separatorElement().nativeElement;
702
+ separator.focus({ preventScroll: true });
703
+ const { pointerId } = event;
704
+ const isDragPointer = (other) => other.pointerId === pointerId;
705
+ separator.setPointerCapture(pointerId);
706
+ this.resizing.set(true);
707
+ let moved = false;
708
+ const dragEnd$ = merge(fromEvent(separator, "pointerup"), fromEvent(separator, "pointercancel"), fromEvent(separator, "lostpointercapture")).pipe(filter(isDragPointer), take(1), tap(() => {
709
+ if (moved) this.#splitter.notifyResizeEnd();
710
+ }));
711
+ fromEvent(separator.ownerDocument, "pointermove").pipe(filter(isDragPointer), takeUntil(dragEnd$), takeUntilDestroyed(this.#destroyRef), finalize(() => {
712
+ this.resizing.set(false);
713
+ if (separator.hasPointerCapture(pointerId)) separator.releasePointerCapture(pointerId);
714
+ })).subscribe((move) => {
715
+ moved = true;
716
+ this.ensureExpandedBeforeResize();
717
+ if (this.orientation() === "horizontal") this.updateHorizontalPaneSizes(move);
718
+ else this.updateVerticalPaneSizes(move);
719
+ });
720
+ }
721
+ toggleCollapse() {
722
+ const targetPane = this.getCollapsibleTargetPane();
723
+ if (targetPane === null) return;
724
+ const targetElement = targetPane.uid === this.previousPane().uid ? this.getPaneElements()[0] : this.getPaneElements()[1];
725
+ const direction = targetPane.uid === this.previousPane().uid ? "previous" : "next";
726
+ this.togglePane(targetPane, targetElement, direction);
727
+ this.#splitter.notifyResizeEnd();
728
+ }
729
+ clamp(value, min, max) {
730
+ if (Number.isFinite(max)) return Math.min(Math.max(value, min), max);
731
+ return Math.max(value, min);
732
+ }
733
+ clampPaneSizes(total, desiredPrev, previousPane, nextPane) {
734
+ const prevMin = this.getMinSize(previousPane);
735
+ const nextMin = this.getMinSize(nextPane);
736
+ const prevMaxRaw = this.getMaxSize(previousPane);
737
+ const nextMaxRaw = this.getMaxSize(nextPane);
738
+ const prevMax = Math.min(prevMaxRaw, total - nextMin);
739
+ const prevMinBound = Math.max(prevMin, total - nextMaxRaw);
740
+ let prevSize = this.clamp(desiredPrev, prevMinBound, prevMax);
741
+ let nextSize = total - prevSize;
742
+ if (nextSize < nextMin) {
743
+ nextSize = nextMin;
744
+ prevSize = total - nextSize;
745
+ } else if (nextSize > nextMaxRaw) {
746
+ nextSize = nextMaxRaw;
747
+ prevSize = total - nextSize;
748
+ }
749
+ prevSize = this.clamp(prevSize, prevMin, prevMaxRaw);
750
+ nextSize = total - prevSize;
751
+ return [prevSize, nextSize];
752
+ }
753
+ collapseAndRedistribute(targetPane, targetSize, leading, trailing) {
754
+ if (targetSize <= 0) {
755
+ targetPane.collapsed.set(true);
756
+ return;
757
+ }
758
+ const leadingNeighbor = leading !== null && !(leading.pane.collapsible() && leading.pane.collapsed()) ? leading : null;
759
+ const trailingNeighbor = trailing !== null && !(trailing.pane.collapsible() && trailing.pane.collapsed()) ? trailing : null;
760
+ const neighbors = compact([leadingNeighbor, trailingNeighbor]).toArray();
761
+ if (neighbors.length === 0) {
762
+ targetPane.collapsed.set(true);
763
+ return;
764
+ }
765
+ this.distributeSpaceToNeighbors(targetSize, neighbors);
766
+ targetPane.collapsed.set(true);
767
+ }
768
+ collapsePane(direction) {
769
+ const target = this.pickTargetPane(direction);
770
+ if (target === null || !target.pane.collapsible()) return false;
771
+ this.togglePane(target.pane, target.element, target.direction);
772
+ this.#splitter.notifyResizeEnd();
773
+ return true;
774
+ }
775
+ distributeSpaceToNeighbors(space, neighbors) {
776
+ const remaining = space;
777
+ const capacities = neighbors.map((neighbor) => {
778
+ const max = this.getMaxSize(neighbor.pane);
779
+ return {
780
+ neighbor,
781
+ capacity: max === Number.POSITIVE_INFINITY ? Number.POSITIVE_INFINITY : Math.max(0, max - neighbor.size)
782
+ };
783
+ });
784
+ const infiniteRecipients = capacities.filter((c) => !Number.isFinite(c.capacity));
785
+ if (infiniteRecipients.length > 0) {
786
+ const share = remaining / infiniteRecipients.length;
787
+ infiniteRecipients.forEach((c) => {
788
+ c.neighbor.pane.size.set(`${c.neighbor.size + share}px`);
789
+ });
790
+ return;
791
+ }
792
+ const available = capacities.reduce((sum, c) => sum + c.capacity, 0);
793
+ if (available <= 0) return;
794
+ capacities.forEach((c) => {
795
+ const share = c.capacity / available * remaining;
796
+ c.neighbor.pane.size.set(`${c.neighbor.size + share}px`);
797
+ });
798
+ }
799
+ ensureExpandedBeforeResize() {
800
+ if (this.previousPane().collapsed()) this.previousPane().collapsed.set(false);
801
+ if (this.nextPane().collapsed()) this.nextPane().collapsed.set(false);
802
+ }
803
+ expandPane(targetPane, desiredSize, leading, trailing) {
804
+ const targetMin = this.getMinSize(targetPane);
805
+ const targetMax = this.getMaxSize(targetPane);
806
+ if (desiredSize <= 0) {
807
+ targetPane.collapsed.set(false);
808
+ return;
809
+ }
810
+ const currentLeadingSize = leading?.size ?? 0;
811
+ const currentTrailingSize = trailing?.size ?? 0;
812
+ if (currentLeadingSize + currentTrailingSize <= 0) {
813
+ const clampedTarget = this.clamp(desiredSize, targetMin, targetMax);
814
+ targetPane.size.set(`${clampedTarget}px`);
815
+ targetPane.collapsed.set(false);
816
+ return;
817
+ }
818
+ const availableFromLeading = leading !== null ? Math.max(0, currentLeadingSize - this.getMinSize(leading.pane)) : 0;
819
+ const availableFromTrailing = trailing !== null ? Math.max(0, currentTrailingSize - this.getMinSize(trailing.pane)) : 0;
820
+ const availableTotal = availableFromLeading + availableFromTrailing;
821
+ if (availableTotal <= 0) {
822
+ targetPane.collapsed.set(false);
823
+ return;
824
+ }
825
+ const desiredClamped = this.clamp(desiredSize, targetMin, targetMax);
826
+ const targetSize = Math.min(desiredClamped, availableTotal);
827
+ if (leading !== null && availableFromLeading > 0) {
828
+ const takeFromLeading = targetSize * (availableFromLeading / availableTotal);
829
+ const newSize = Math.max(this.getMinSize(leading.pane), currentLeadingSize - takeFromLeading);
830
+ leading.pane.size.set(`${newSize}px`);
831
+ }
832
+ if (trailing !== null && availableFromTrailing > 0) {
833
+ const takeFromTrailing = targetSize * (availableFromTrailing / availableTotal);
834
+ const newSize = Math.max(this.getMinSize(trailing.pane), currentTrailingSize - takeFromTrailing);
835
+ trailing.pane.size.set(`${newSize}px`);
836
+ }
837
+ targetPane.size.set(`${targetSize}px`);
838
+ targetPane.collapsed.set(false);
839
+ }
840
+ findPaneToLeft(element) {
841
+ let cursor = element.previousElementSibling;
842
+ while (cursor !== null) {
843
+ if (cursor.dataset["pid"]) {
844
+ const pane = this.#splitter.getPaneByUid(cursor.dataset["pid"]);
845
+ if (pane != null) return {
846
+ pane,
847
+ element: cursor
848
+ };
849
+ }
850
+ cursor = cursor.previousElementSibling;
851
+ }
852
+ return null;
853
+ }
854
+ findPaneToRight(element) {
855
+ let cursor = element.nextElementSibling;
856
+ while (cursor !== null) {
857
+ if (cursor.dataset["pid"]) {
858
+ const pane = this.#splitter.getPaneByUid(cursor.dataset["pid"]);
859
+ if (pane != null) return {
860
+ pane,
861
+ element: cursor
862
+ };
863
+ }
864
+ cursor = cursor.nextElementSibling;
865
+ }
866
+ return null;
867
+ }
868
+ getCollapsibleTargetPane() {
869
+ const previousPane = this.previousPane();
870
+ const nextPane = this.nextPane();
871
+ if (previousPane.collapsible() && previousPane.collapsed()) return previousPane;
872
+ if (nextPane.collapsible() && nextPane.collapsed()) return nextPane;
873
+ if (previousPane.collapsible()) return previousPane;
874
+ if (nextPane.collapsible()) return nextPane;
875
+ return null;
876
+ }
877
+ getMaxSize(pane) {
878
+ const parsed = parsePaneSizeLimit(pane.max());
879
+ return parsed === null ? Number.POSITIVE_INFINITY : Math.max(0, parsed);
880
+ }
881
+ getMinSize(pane) {
882
+ const parsed = parsePaneSizeLimit(pane.min());
883
+ return parsed === null ? 0 : Math.max(0, parsed);
884
+ }
885
+ getNeighborPanes(targetElement, direction) {
886
+ const [previousElement, nextElement] = this.getPaneElements();
887
+ const leadingPane = direction === "previous" ? this.findPaneToLeft(targetElement) : {
888
+ pane: this.previousPane(),
889
+ element: previousElement
890
+ };
891
+ const trailingPane = direction === "previous" ? {
892
+ pane: this.nextPane(),
893
+ element: nextElement
894
+ } : this.findPaneToRight(targetElement);
895
+ return {
896
+ leading: leadingPane !== null ? {
897
+ ...leadingPane,
898
+ size: this.measurePaneSize(leadingPane.element)
899
+ } : null,
900
+ trailing: trailingPane !== null ? {
901
+ ...trailingPane,
902
+ size: this.measurePaneSize(trailingPane.element)
903
+ } : null
904
+ };
905
+ }
906
+ getPaneElements() {
907
+ const previousPane = this.#hostElementRef.nativeElement.previousElementSibling;
908
+ const nextPane = this.#hostElementRef.nativeElement.nextElementSibling;
909
+ if (previousPane === null || nextPane === null) throw new Error("The previous or next pane element is not found.");
910
+ return [previousPane, nextPane];
911
+ }
912
+ getPaneRectangles() {
913
+ const [previousPane, nextPane] = this.getPaneElements();
914
+ return [previousPane.getBoundingClientRect(), nextPane.getBoundingClientRect()];
915
+ }
916
+ handleCollapserKeys(key) {
917
+ if (this.orientation() === "horizontal") {
918
+ const isRtl = this.isRtl();
919
+ if (key === "ArrowLeft") return this.collapsePane(isRtl ? "next" : "previous");
920
+ if (key === "ArrowRight") return this.collapsePane(isRtl ? "previous" : "next");
921
+ } else {
922
+ if (key === "ArrowUp") return this.collapsePane("previous");
923
+ if (key === "ArrowDown") return this.collapsePane("next");
924
+ }
925
+ return false;
926
+ }
927
+ handleKeydown(event) {
928
+ const key = event.key;
929
+ if (event.ctrlKey || event.metaKey || event.shiftKey) return false;
930
+ if (event.altKey) return this.handleCollapserKeys(key);
931
+ if (key === "Enter") {
932
+ if (this.getCollapsibleTargetPane() === null) return false;
933
+ this.toggleCollapse();
934
+ return true;
935
+ }
936
+ return this.handleResizerKeys(key);
937
+ }
938
+ handleResizerKeys(key) {
939
+ if (!this.resizable()) return false;
940
+ const step = this.#splitter.keyboardStep();
941
+ if (key === "Home") {
942
+ this.resizeFromKey(Number.NEGATIVE_INFINITY);
943
+ return true;
944
+ }
945
+ if (key === "End") {
946
+ this.resizeFromKey(Number.POSITIVE_INFINITY);
947
+ return true;
948
+ }
949
+ if (this.orientation() === "horizontal") {
950
+ const isRtl = this.isRtl();
951
+ if (key === "ArrowLeft") {
952
+ this.resizeFromKey(isRtl ? step : -step);
953
+ return true;
954
+ }
955
+ if (key === "ArrowRight") {
956
+ this.resizeFromKey(isRtl ? -step : step);
957
+ return true;
958
+ }
959
+ } else {
960
+ if (key === "ArrowUp") {
961
+ this.resizeFromKey(-step);
962
+ return true;
963
+ }
964
+ if (key === "ArrowDown") {
965
+ this.resizeFromKey(step);
966
+ return true;
967
+ }
968
+ }
969
+ return false;
970
+ }
971
+ isCollapsed(pane) {
972
+ return pane.collapsible() && pane.collapsed();
973
+ }
974
+ measurePaneSize(paneElement) {
975
+ const rect = paneElement.getBoundingClientRect();
976
+ return this.orientation() === "horizontal" ? rect.width : rect.height;
977
+ }
978
+ nudgeSplitter(delta) {
979
+ this.ensureExpandedBeforeResize();
980
+ const [previousRect, nextRect] = this.getPaneRectangles();
981
+ const total = this.orientation() === "horizontal" ? previousRect.width + nextRect.width : previousRect.height + nextRect.height;
982
+ const currentPrev = this.orientation() === "horizontal" ? previousRect.width : previousRect.height;
983
+ const desiredPrev = this.clamp(currentPrev + delta, 0, total);
984
+ const [prevSize, nextSize] = this.clampPaneSizes(total, desiredPrev, this.previousPane(), this.nextPane());
985
+ this.updatePaneSizes(`${prevSize}px`, `${nextSize}px`);
986
+ }
987
+ observePaneSizes() {
988
+ if (typeof ResizeObserver === "undefined") return;
989
+ const observer = new ResizeObserver(() => this.updateAriaSeparatorValues());
990
+ this.getPaneElements().forEach((element) => observer.observe(element));
991
+ this.#destroyRef.onDestroy(() => observer.disconnect());
992
+ }
993
+ pickTargetPane(direction) {
994
+ const [previousElement, nextElement] = this.getPaneElements();
995
+ const previousPane = this.previousPane();
996
+ const nextPane = this.nextPane();
997
+ if (direction === "previous") {
998
+ if (nextPane.collapsible() && nextPane.collapsed()) return {
999
+ pane: nextPane,
1000
+ element: nextElement,
1001
+ direction: "next"
1002
+ };
1003
+ return {
1004
+ pane: previousPane,
1005
+ element: previousElement,
1006
+ direction: "previous"
1007
+ };
1008
+ } else {
1009
+ if (previousPane.collapsible() && previousPane.collapsed()) return {
1010
+ pane: previousPane,
1011
+ element: previousElement,
1012
+ direction: "previous"
1013
+ };
1014
+ return {
1015
+ pane: nextPane,
1016
+ element: nextElement,
1017
+ direction: "next"
1018
+ };
1019
+ }
1020
+ }
1021
+ resizeFromKey(delta) {
1022
+ const previousPane = this.previousPane();
1023
+ const nextPane = this.nextPane();
1024
+ const [previousElement, nextElement] = this.getPaneElements();
1025
+ if (this.isCollapsed(previousPane)) {
1026
+ if (delta <= 0) return;
1027
+ this.togglePane(previousPane, previousElement, "previous");
1028
+ } else if (this.isCollapsed(nextPane)) {
1029
+ if (delta >= 0) return;
1030
+ this.togglePane(nextPane, nextElement, "next");
1031
+ } else this.nudgeSplitter(delta);
1032
+ this.#splitter.notifyResizeEnd();
1033
+ }
1034
+ togglePane(targetPane, targetElement, direction) {
1035
+ const neighbors = this.getNeighborPanes(targetElement, direction);
1036
+ if (targetPane.collapsed()) {
1037
+ const storedSize = this.#paneSizeMemory.get(targetPane) ?? this.measurePaneSize(targetElement);
1038
+ this.expandPane(targetPane, storedSize, neighbors.leading, neighbors.trailing);
1039
+ } else {
1040
+ const targetSize = this.measurePaneSize(targetElement);
1041
+ if (targetSize > 0) this.#paneSizeMemory.set(targetPane, targetSize);
1042
+ this.collapseAndRedistribute(targetPane, targetSize, neighbors.leading, neighbors.trailing);
1043
+ }
1044
+ }
1045
+ updateAriaSeparatorValues() {
1046
+ const [previousRect, nextRect] = this.getPaneRectangles();
1047
+ const orientation = this.orientation();
1048
+ const previousSize = orientation === "horizontal" ? previousRect.width : previousRect.height;
1049
+ const total = previousSize + (orientation === "horizontal" ? nextRect.width : nextRect.height);
1050
+ const previousMin = this.getMinSize(this.previousPane());
1051
+ const nextMin = this.getMinSize(this.nextPane());
1052
+ const previousMaxRaw = this.getMaxSize(this.previousPane());
1053
+ const previousMax = Math.min(previousMaxRaw, total - nextMin);
1054
+ this.ariaValueMax.set(Math.round(Number.isFinite(previousMax) ? previousMax : total));
1055
+ this.ariaValueMin.set(Math.round(previousMin));
1056
+ this.ariaValueNow.set(Math.round(previousSize));
1057
+ }
1058
+ updateHorizontalPaneSizes(event) {
1059
+ const [previousRect, nextRect] = this.getPaneRectangles();
1060
+ const maxWidth = previousRect.width + nextRect.width;
1061
+ const desiredPrevWidth = this.isRtl() ? Math.min(Math.max(previousRect.right - event.clientX, 0), maxWidth) : Math.min(Math.max(event.clientX - previousRect.left, 0), maxWidth);
1062
+ const [previousPaneWidth, nextPaneWidth] = this.clampPaneSizes(maxWidth, desiredPrevWidth, this.previousPane(), this.nextPane());
1063
+ this.updatePaneSizes(`${previousPaneWidth}px`, `${nextPaneWidth}px`);
1064
+ }
1065
+ updatePaneSizes(previousPaneSize, nextPaneSize) {
1066
+ this.previousPane().collapsed.set(false);
1067
+ this.nextPane().collapsed.set(false);
1068
+ this.previousPane().size.set(previousPaneSize);
1069
+ this.nextPane().size.set(nextPaneSize);
1070
+ }
1071
+ updateVerticalPaneSizes(event) {
1072
+ const [previousRect, nextRect] = this.getPaneRectangles();
1073
+ const maxHeight = previousRect.height + nextRect.height;
1074
+ const desiredPrevHeight = Math.min(Math.max(event.clientY - previousRect.top, 0), maxHeight);
1075
+ const [previousPaneHeight, nextPaneHeight] = this.clampPaneSizes(maxHeight, desiredPrevHeight, this.previousPane(), this.nextPane());
1076
+ this.updatePaneSizes(`${previousPaneHeight}px`, `${nextPaneHeight}px`);
1077
+ }
1078
+ static {
1079
+ this.ɵfac = i0.ɵɵngDeclareFactory({
1080
+ minVersion: "12.0.0",
1081
+ version: "22.2.6",
1082
+ ngImport: i0,
1083
+ type: SplitterResizerComponent,
1084
+ deps: [],
1085
+ target: i0.ɵɵFactoryTarget.Component
1086
+ });
1087
+ }
1088
+ static {
1089
+ this.ɵcmp = i0.ɵɵngDeclareComponent({
1090
+ minVersion: "17.2.0",
1091
+ version: "22.2.6",
1092
+ type: SplitterResizerComponent,
1093
+ isStandalone: true,
1094
+ selector: "mona-splitter-resizer",
1095
+ inputs: {
1096
+ nextPane: {
1097
+ classPropertyName: "nextPane",
1098
+ publicName: "nextPane",
1099
+ isSignal: true,
1100
+ isRequired: true,
1101
+ transformFunction: null
1102
+ },
1103
+ orientation: {
1104
+ classPropertyName: "orientation",
1105
+ publicName: "orientation",
1106
+ isSignal: true,
1107
+ isRequired: true,
1108
+ transformFunction: null
1109
+ },
1110
+ previousPane: {
1111
+ classPropertyName: "previousPane",
1112
+ publicName: "previousPane",
1113
+ isSignal: true,
1114
+ isRequired: true,
1115
+ transformFunction: null
1116
+ }
1117
+ },
1118
+ host: {
1119
+ listeners: {
1120
+ "focusin": "focused.set(true)",
1121
+ "focusout": "onFocusOut($event)",
1122
+ "pointerenter": "hovered.set(true)",
1123
+ "pointerleave": "hovered.set(false)"
1124
+ },
1125
+ properties: { "class": "baseClass()" }
1126
+ },
1127
+ viewQueries: [{
1128
+ propertyName: "separatorElement",
1129
+ first: true,
1130
+ predicate: ["separator"],
1131
+ descendants: true,
1132
+ isSignal: true
1133
+ }],
1134
+ ngImport: i0,
1135
+ template: "<div\n #separator\n role=\"separator\"\n [class]=\"separatorClass()\"\n [style.cursor]=\"cursor()\"\n [attr.aria-controls]=\"isInert() ? null : previousPane().uid\"\n [attr.aria-label]=\"previousPane().label() || messages().resizer\"\n [attr.aria-orientation]=\"separatorOrientation()\"\n [attr.aria-valuemax]=\"isInert() ? null : ariaValueMax()\"\n [attr.aria-valuemin]=\"isInert() ? null : ariaValueMin()\"\n [attr.aria-valuenow]=\"isInert() ? null : ariaValueNow()\"\n [attr.tabindex]=\"isInert() ? null : 0\"\n (dblclick)=\"toggleCollapse()\"\n (keydown)=\"onKeydown($event)\"\n (pointerdown)=\"onPointerDown($event)\"></div>\n<mona-splitter-resizer-handle\n (collapseNext)=\"collapseNext()\"\n (collapsePrevious)=\"collapsePrevious()\"\n [nextControlsVisible]=\"nextCollapseControlsVisible()\"\n [orientation]=\"orientation()\"\n [previousControlsVisible]=\"previousCollapseControlsVisible()\"\n [resizable]=\"resizable()\">\n</mona-splitter-resizer-handle>\n",
1136
+ dependencies: [{
1137
+ kind: "component",
1138
+ type: SplitterResizerHandleComponent,
1139
+ selector: "mona-splitter-resizer-handle",
1140
+ inputs: [
1141
+ "nextControlsVisible",
1142
+ "orientation",
1143
+ "previousControlsVisible",
1144
+ "resizable"
1145
+ ],
1146
+ outputs: ["collapseNext", "collapsePrevious"]
1147
+ }]
1148
+ });
1149
+ }
1150
+ };
1151
+ i0.ɵɵngDeclareClassMetadata({
1152
+ minVersion: "12.0.0",
1153
+ version: "22.2.6",
1154
+ ngImport: i0,
1155
+ type: SplitterResizerComponent,
1156
+ decorators: [{
1157
+ type: Component,
1158
+ args: [{
1159
+ selector: "mona-splitter-resizer",
1160
+ imports: [SplitterResizerHandleComponent],
1161
+ host: {
1162
+ "[class]": "baseClass()",
1163
+ "(focusin)": "focused.set(true)",
1164
+ "(focusout)": "onFocusOut($event)",
1165
+ "(pointerenter)": "hovered.set(true)",
1166
+ "(pointerleave)": "hovered.set(false)"
1167
+ },
1168
+ template: "<div\n #separator\n role=\"separator\"\n [class]=\"separatorClass()\"\n [style.cursor]=\"cursor()\"\n [attr.aria-controls]=\"isInert() ? null : previousPane().uid\"\n [attr.aria-label]=\"previousPane().label() || messages().resizer\"\n [attr.aria-orientation]=\"separatorOrientation()\"\n [attr.aria-valuemax]=\"isInert() ? null : ariaValueMax()\"\n [attr.aria-valuemin]=\"isInert() ? null : ariaValueMin()\"\n [attr.aria-valuenow]=\"isInert() ? null : ariaValueNow()\"\n [attr.tabindex]=\"isInert() ? null : 0\"\n (dblclick)=\"toggleCollapse()\"\n (keydown)=\"onKeydown($event)\"\n (pointerdown)=\"onPointerDown($event)\"></div>\n<mona-splitter-resizer-handle\n (collapseNext)=\"collapseNext()\"\n (collapsePrevious)=\"collapsePrevious()\"\n [nextControlsVisible]=\"nextCollapseControlsVisible()\"\n [orientation]=\"orientation()\"\n [previousControlsVisible]=\"previousCollapseControlsVisible()\"\n [resizable]=\"resizable()\">\n</mona-splitter-resizer-handle>\n"
1169
+ }]
1170
+ }],
1171
+ ctorParameters: () => [],
1172
+ propDecorators: {
1173
+ separatorElement: [{
1174
+ type: i0.ViewChild,
1175
+ args: ["separator", { isSignal: true }]
1176
+ }],
1177
+ nextPane: [{
1178
+ type: i0.Input,
1179
+ args: [{
1180
+ isSignal: true,
1181
+ alias: "nextPane",
1182
+ required: true
1183
+ }]
1184
+ }],
1185
+ orientation: [{
1186
+ type: i0.Input,
1187
+ args: [{
1188
+ isSignal: true,
1189
+ alias: "orientation",
1190
+ required: true
1191
+ }]
1192
+ }],
1193
+ previousPane: [{
1194
+ type: i0.Input,
1195
+ args: [{
1196
+ isSignal: true,
1197
+ alias: "previousPane",
1198
+ required: true
1199
+ }]
1200
+ }]
1201
+ }
1202
+ });
1203
+ var SplitterComponent = class SplitterComponent {
1204
+ constructor() {
1205
+ this.baseClass = computed(() => {
1206
+ const orientation = this.orientation();
1207
+ return splitterBaseThemeVariants({ orientation });
1208
+ }, ...ngDevMode ? [{ debugName: "baseClass" }] : /* istanbul ignore next */ []);
1209
+ this.paneList = contentChildren(SplitterPaneComponent, ...ngDevMode ? [{ debugName: "paneList" }] : /* istanbul ignore next */ []);
1210
+ this.keyboardStep = input(10, {
1211
+ ...ngDevMode ? { debugName: "keyboardStep" } : /* istanbul ignore next */ {},
1212
+ transform: numberAttribute
1213
+ });
1214
+ this.orientation = input("horizontal", ...ngDevMode ? [{ debugName: "orientation" }] : /* istanbul ignore next */ []);
1215
+ this.resizeEnd = output();
1216
+ }
1217
+ getPaneByUid(uid) {
1218
+ return from(this.paneList()).firstOrDefault((pane) => pane.uid === uid);
1219
+ }
1220
+ notifyResizeEnd() {
1221
+ this.resizeEnd.emit(this.paneList().map((pane) => pane.size()));
1222
+ }
1223
+ static {
1224
+ this.ɵfac = i0.ɵɵngDeclareFactory({
1225
+ minVersion: "12.0.0",
1226
+ version: "22.2.6",
1227
+ ngImport: i0,
1228
+ type: SplitterComponent,
1229
+ deps: [],
1230
+ target: i0.ɵɵFactoryTarget.Component
1231
+ });
1232
+ }
1233
+ static {
1234
+ this.ɵcmp = i0.ɵɵngDeclareComponent({
1235
+ minVersion: "17.0.0",
1236
+ version: "22.2.6",
1237
+ type: SplitterComponent,
1238
+ isStandalone: true,
1239
+ selector: "mona-splitter",
1240
+ inputs: {
1241
+ keyboardStep: {
1242
+ classPropertyName: "keyboardStep",
1243
+ publicName: "keyboardStep",
1244
+ isSignal: true,
1245
+ isRequired: false,
1246
+ transformFunction: null
1247
+ },
1248
+ orientation: {
1249
+ classPropertyName: "orientation",
1250
+ publicName: "orientation",
1251
+ isSignal: true,
1252
+ isRequired: false,
1253
+ transformFunction: null
1254
+ }
1255
+ },
1256
+ outputs: { resizeEnd: "resizeEnd" },
1257
+ host: { properties: { "class": "baseClass()" } },
1258
+ queries: [{
1259
+ propertyName: "paneList",
1260
+ predicate: SplitterPaneComponent,
1261
+ isSignal: true
1262
+ }],
1263
+ ngImport: i0,
1264
+ template: "@for (pane of paneList(); track pane.uid) {\n <div\n class=\"overflow-hidden min-w-0 min-h-0\"\n [attr.data-pid]=\"pane.uid\"\n [attr.data-px]=\"$index\"\n [id]=\"pane.uid\"\n monaSplitterPaneStyle\n [orientation]=\"orientation()\"\n [pane]=\"pane\"\n [paneList]=\"paneList()\">\n <ng-container [ngTemplateOutlet]=\"pane.template()\"></ng-container>\n </div>\n @if ($index !== $count - 1) {\n <mona-splitter-resizer\n [nextPane]=\"paneList()[$index + 1]\"\n [orientation]=\"orientation()!\"\n [previousPane]=\"paneList()[$index]\">\n </mona-splitter-resizer>\n }\n}\n",
1265
+ dependencies: [
1266
+ {
1267
+ kind: "component",
1268
+ type: SplitterResizerComponent,
1269
+ selector: "mona-splitter-resizer",
1270
+ inputs: [
1271
+ "nextPane",
1272
+ "orientation",
1273
+ "previousPane"
1274
+ ]
1275
+ },
1276
+ {
1277
+ kind: "directive",
1278
+ type: NgTemplateOutlet,
1279
+ selector: "[ngTemplateOutlet]",
1280
+ inputs: [
1281
+ "ngTemplateOutletContext",
1282
+ "ngTemplateOutlet",
1283
+ "ngTemplateOutletInjector"
1284
+ ]
1285
+ },
1286
+ {
1287
+ kind: "directive",
1288
+ type: SplitterPaneStyleDirective,
1289
+ selector: "div[monaSplitterPaneStyle]",
1290
+ inputs: [
1291
+ "orientation",
1292
+ "pane",
1293
+ "paneList"
1294
+ ]
1295
+ }
1296
+ ]
1297
+ });
1298
+ }
1299
+ };
1300
+ i0.ɵɵngDeclareClassMetadata({
1301
+ minVersion: "12.0.0",
1302
+ version: "22.2.6",
1303
+ ngImport: i0,
1304
+ type: SplitterComponent,
1305
+ decorators: [{
1306
+ type: Component,
1307
+ args: [{
1308
+ selector: "mona-splitter",
1309
+ imports: [
1310
+ SplitterResizerComponent,
1311
+ NgTemplateOutlet,
1312
+ SplitterPaneStyleDirective
1313
+ ],
1314
+ host: { "[class]": "baseClass()" },
1315
+ template: "@for (pane of paneList(); track pane.uid) {\n <div\n class=\"overflow-hidden min-w-0 min-h-0\"\n [attr.data-pid]=\"pane.uid\"\n [attr.data-px]=\"$index\"\n [id]=\"pane.uid\"\n monaSplitterPaneStyle\n [orientation]=\"orientation()\"\n [pane]=\"pane\"\n [paneList]=\"paneList()\">\n <ng-container [ngTemplateOutlet]=\"pane.template()\"></ng-container>\n </div>\n @if ($index !== $count - 1) {\n <mona-splitter-resizer\n [nextPane]=\"paneList()[$index + 1]\"\n [orientation]=\"orientation()!\"\n [previousPane]=\"paneList()[$index]\">\n </mona-splitter-resizer>\n }\n}\n"
1316
+ }]
1317
+ }],
1318
+ propDecorators: {
1319
+ paneList: [{
1320
+ type: i0.ContentChildren,
1321
+ args: [i0.forwardRef(() => SplitterPaneComponent), { isSignal: true }]
1322
+ }],
1323
+ keyboardStep: [{
1324
+ type: i0.Input,
1325
+ args: [{
1326
+ isSignal: true,
1327
+ alias: "keyboardStep",
1328
+ required: false
1329
+ }]
1330
+ }],
1331
+ orientation: [{
1332
+ type: i0.Input,
1333
+ args: [{
1334
+ isSignal: true,
1335
+ alias: "orientation",
1336
+ required: false
1337
+ }]
1338
+ }],
1339
+ resizeEnd: [{
1340
+ type: i0.Output,
1341
+ args: ["resizeEnd"]
1342
+ }]
1343
+ }
1344
+ });
942
1345
  export { SPLITTER_DEFAULT_MESSAGES, SplitterComponent, SplitterPaneComponent };
943
- //# sourceMappingURL=nanahoshi-mona-ui-splitter.mjs.map
1346
+
1347
+ //# sourceMappingURL=nanahoshi-mona-ui-splitter.mjs.map