@nanahoshi/mona-ui 0.24.11 → 0.25.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.
- package/README.md +9 -0
- package/fesm2022/nanahoshi-mona-ui-auto-complete.mjs +11 -10
- package/fesm2022/nanahoshi-mona-ui-avatar.mjs +37 -20
- package/fesm2022/nanahoshi-mona-ui-breadcrumb.mjs +239 -47
- package/fesm2022/nanahoshi-mona-ui-button-group.mjs +184 -31
- package/fesm2022/nanahoshi-mona-ui-button.mjs +47 -11
- package/fesm2022/nanahoshi-mona-ui-calendar.mjs +17 -13
- package/fesm2022/nanahoshi-mona-ui-card.mjs +54 -30
- package/fesm2022/nanahoshi-mona-ui-chart.mjs +27 -22
- package/fesm2022/nanahoshi-mona-ui-check-box.mjs +112 -31
- package/fesm2022/nanahoshi-mona-ui-chip.mjs +131 -89
- package/fesm2022/nanahoshi-mona-ui-circular-progress-bar.mjs +59 -19
- package/fesm2022/nanahoshi-mona-ui-collapsible.mjs +118 -41
- package/fesm2022/nanahoshi-mona-ui-color-gradient.mjs +243 -212
- package/fesm2022/nanahoshi-mona-ui-color-palette.mjs +155 -86
- package/fesm2022/nanahoshi-mona-ui-color-picker.mjs +161 -131
- package/fesm2022/nanahoshi-mona-ui-combo-box.mjs +12 -11
- package/fesm2022/nanahoshi-mona-ui-common.mjs +18 -1
- package/fesm2022/nanahoshi-mona-ui-date-picker.mjs +10 -9
- package/fesm2022/nanahoshi-mona-ui-datetime-picker.mjs +10 -9
- package/fesm2022/nanahoshi-mona-ui-dialog.mjs +2 -2
- package/fesm2022/nanahoshi-mona-ui-dropdown-button.mjs +2 -2
- package/fesm2022/nanahoshi-mona-ui-dropdown-list.mjs +10 -9
- package/fesm2022/nanahoshi-mona-ui-editor.mjs +25 -24
- package/fesm2022/nanahoshi-mona-ui-expansion-panel.mjs +202 -33
- package/fesm2022/nanahoshi-mona-ui-fieldset.mjs +31 -10
- package/fesm2022/nanahoshi-mona-ui-filter.mjs +1 -1
- package/fesm2022/{nanahoshi-mona-ui-grid-grid-footer-row.component-DhKLnW06.mjs → nanahoshi-mona-ui-grid-grid-footer-row.component-2tVhD2hK.mjs} +2 -2
- package/fesm2022/{nanahoshi-mona-ui-grid-grid-list.component-voGbKOiB.mjs → nanahoshi-mona-ui-grid-grid-list.component-BAN70Wcn.mjs} +4 -4
- package/fesm2022/{nanahoshi-mona-ui-grid-grid-row.component-HQ1Kv6R9.mjs → nanahoshi-mona-ui-grid-grid-row.component-C_kCaA5b.mjs} +7 -7
- package/fesm2022/{nanahoshi-mona-ui-grid-grid-virtual-list.component-PNLJFcuH.mjs → nanahoshi-mona-ui-grid-grid-virtual-list.component-BsNfrAHz.mjs} +4 -4
- package/fesm2022/{nanahoshi-mona-ui-grid-nanahoshi-mona-ui-grid-BO19AVwC.mjs → nanahoshi-mona-ui-grid-nanahoshi-mona-ui-grid-CEfVa7eo.mjs} +27 -29
- package/fesm2022/nanahoshi-mona-ui-grid.mjs +1 -1
- package/fesm2022/nanahoshi-mona-ui-i18n-icu.mjs +39 -4
- package/fesm2022/nanahoshi-mona-ui-internal-filter-input.mjs +2 -2
- package/fesm2022/nanahoshi-mona-ui-internal-indicator-icon.mjs +1 -1
- package/fesm2022/nanahoshi-mona-ui-internal-list.mjs +5 -5
- package/fesm2022/nanahoshi-mona-ui-internal-tree.mjs +7 -7
- package/fesm2022/nanahoshi-mona-ui-internal.mjs +183 -47
- package/fesm2022/nanahoshi-mona-ui-label.mjs +111 -15
- package/fesm2022/nanahoshi-mona-ui-list-box.mjs +1 -1
- package/fesm2022/nanahoshi-mona-ui-list-view.mjs +1 -1
- package/fesm2022/nanahoshi-mona-ui-locales-ar-sa.mjs +33 -4
- package/fesm2022/nanahoshi-mona-ui-locales-de-de.mjs +33 -4
- package/fesm2022/nanahoshi-mona-ui-locales-es-es.mjs +33 -4
- package/fesm2022/nanahoshi-mona-ui-locales-fr-fr.mjs +33 -4
- package/fesm2022/nanahoshi-mona-ui-locales-id-id.mjs +33 -4
- package/fesm2022/nanahoshi-mona-ui-locales-it-it.mjs +33 -4
- package/fesm2022/nanahoshi-mona-ui-locales-ja-jp.mjs +33 -4
- package/fesm2022/nanahoshi-mona-ui-locales-ko-kr.mjs +33 -4
- package/fesm2022/nanahoshi-mona-ui-locales-pt-br.mjs +33 -4
- package/fesm2022/nanahoshi-mona-ui-locales-ru-ru.mjs +33 -4
- package/fesm2022/nanahoshi-mona-ui-locales-tr-tr.mjs +33 -4
- package/fesm2022/nanahoshi-mona-ui-locales-zh-cn.mjs +33 -4
- package/fesm2022/nanahoshi-mona-ui-locales-zh-tw.mjs +33 -4
- package/fesm2022/nanahoshi-mona-ui-menubar.mjs +2 -2
- package/fesm2022/nanahoshi-mona-ui-multi-select.mjs +14 -13
- package/fesm2022/nanahoshi-mona-ui-notification.mjs +1 -1
- package/fesm2022/nanahoshi-mona-ui-numeric-text-box.mjs +13 -12
- package/fesm2022/nanahoshi-mona-ui-otp-input.mjs +192 -56
- package/fesm2022/nanahoshi-mona-ui-pager.mjs +1 -1
- package/fesm2022/nanahoshi-mona-ui-placeholder.mjs +3 -1
- package/fesm2022/nanahoshi-mona-ui-popup-menu.mjs +2 -2
- package/fesm2022/nanahoshi-mona-ui-progress-bar.mjs +60 -29
- package/fesm2022/nanahoshi-mona-ui-radio-button.mjs +334 -37
- package/fesm2022/nanahoshi-mona-ui-rating.mjs +84 -30
- package/fesm2022/nanahoshi-mona-ui-scroll-view.mjs +274 -108
- package/fesm2022/nanahoshi-mona-ui-segmented.mjs +127 -37
- package/fesm2022/nanahoshi-mona-ui-sheet.mjs +2 -2
- package/fesm2022/nanahoshi-mona-ui-sidebar.mjs +595 -170
- package/fesm2022/nanahoshi-mona-ui-skeleton.mjs +3 -2
- package/fesm2022/nanahoshi-mona-ui-slider.mjs +323 -166
- package/fesm2022/nanahoshi-mona-ui-spinner.mjs +167 -82
- package/fesm2022/nanahoshi-mona-ui-split-button.mjs +3 -3
- package/fesm2022/nanahoshi-mona-ui-splitter.mjs +273 -165
- package/fesm2022/nanahoshi-mona-ui-stepper.mjs +219 -132
- package/fesm2022/nanahoshi-mona-ui-switch.mjs +84 -32
- package/fesm2022/nanahoshi-mona-ui-tabs.mjs +337 -116
- package/fesm2022/nanahoshi-mona-ui-text-area.mjs +10 -12
- package/fesm2022/nanahoshi-mona-ui-text-box.mjs +21 -8
- package/fesm2022/nanahoshi-mona-ui-theme.mjs +444 -88
- package/fesm2022/nanahoshi-mona-ui-time-picker.mjs +10 -9
- package/fesm2022/nanahoshi-mona-ui-time-selector.mjs +15 -14
- package/fesm2022/nanahoshi-mona-ui-tooltip.mjs +17 -3
- package/fesm2022/nanahoshi-mona-ui-window.mjs +1 -1
- package/i18n/catalogs/en-US.messages.json +33 -4
- package/locales/ar-sa/ar-sa.messages.json +33 -4
- package/locales/de-de/de-de.messages.json +33 -4
- package/locales/es-es/es-es.messages.json +33 -4
- package/locales/fr-fr/fr-fr.messages.json +33 -4
- package/locales/id-id/id-id.messages.json +33 -4
- package/locales/it-it/it-it.messages.json +33 -4
- package/locales/ja-jp/ja-jp.messages.json +33 -4
- package/locales/ko-kr/ko-kr.messages.json +33 -4
- package/locales/pt-br/pt-br.messages.json +33 -4
- package/locales/ru-ru/ru-ru.messages.json +33 -4
- package/locales/tr-tr/tr-tr.messages.json +33 -4
- package/locales/zh-cn/zh-cn.messages.json +33 -4
- package/locales/zh-tw/zh-tw.messages.json +33 -4
- package/package.json +2 -1
- package/styles.css +156 -0
- package/types/nanahoshi-mona-ui-auto-complete.d.ts +1 -0
- package/types/nanahoshi-mona-ui-avatar.d.ts +18 -11
- package/types/nanahoshi-mona-ui-breadcrumb.d.ts +62 -14
- package/types/nanahoshi-mona-ui-button-group.d.ts +86 -16
- package/types/nanahoshi-mona-ui-button.d.ts +26 -3
- package/types/nanahoshi-mona-ui-calendar.d.ts +1 -0
- package/types/nanahoshi-mona-ui-card.d.ts +22 -6
- package/types/nanahoshi-mona-ui-check-box.d.ts +54 -13
- package/types/nanahoshi-mona-ui-chip.d.ts +31 -18
- package/types/nanahoshi-mona-ui-circular-progress-bar.d.ts +21 -5
- package/types/nanahoshi-mona-ui-collapsible.d.ts +20 -11
- package/types/nanahoshi-mona-ui-color-gradient.d.ts +62 -36
- package/types/nanahoshi-mona-ui-color-palette.d.ts +65 -27
- package/types/nanahoshi-mona-ui-color-picker.d.ts +64 -23
- package/types/nanahoshi-mona-ui-combo-box.d.ts +1 -0
- package/types/nanahoshi-mona-ui-common.d.ts +28 -2
- package/types/nanahoshi-mona-ui-date-picker.d.ts +1 -0
- package/types/nanahoshi-mona-ui-datetime-picker.d.ts +1 -0
- package/types/nanahoshi-mona-ui-dropdown-list.d.ts +1 -0
- package/types/nanahoshi-mona-ui-editor.d.ts +1 -0
- package/types/nanahoshi-mona-ui-expansion-panel.d.ts +51 -7
- package/types/nanahoshi-mona-ui-fieldset.d.ts +18 -4
- package/types/nanahoshi-mona-ui-grid.d.ts +0 -1
- package/types/nanahoshi-mona-ui-i18n.d.ts +38 -3
- package/types/nanahoshi-mona-ui-internal.d.ts +95 -14
- package/types/nanahoshi-mona-ui-label.d.ts +17 -2
- package/types/nanahoshi-mona-ui-locales-ar-sa.d.ts +29 -0
- package/types/nanahoshi-mona-ui-locales-de-de.d.ts +29 -0
- package/types/nanahoshi-mona-ui-locales-es-es.d.ts +29 -0
- package/types/nanahoshi-mona-ui-locales-fr-fr.d.ts +29 -0
- package/types/nanahoshi-mona-ui-locales-id-id.d.ts +29 -0
- package/types/nanahoshi-mona-ui-locales-it-it.d.ts +29 -0
- package/types/nanahoshi-mona-ui-locales-ja-jp.d.ts +29 -0
- package/types/nanahoshi-mona-ui-locales-ko-kr.d.ts +29 -0
- package/types/nanahoshi-mona-ui-locales-pt-br.d.ts +29 -0
- package/types/nanahoshi-mona-ui-locales-ru-ru.d.ts +29 -0
- package/types/nanahoshi-mona-ui-locales-tr-tr.d.ts +29 -0
- package/types/nanahoshi-mona-ui-locales-zh-cn.d.ts +29 -0
- package/types/nanahoshi-mona-ui-locales-zh-tw.d.ts +29 -0
- package/types/nanahoshi-mona-ui-multi-select.d.ts +1 -0
- package/types/nanahoshi-mona-ui-numeric-text-box.d.ts +1 -0
- package/types/nanahoshi-mona-ui-otp-input.d.ts +49 -12
- package/types/nanahoshi-mona-ui-placeholder.d.ts +2 -1
- package/types/nanahoshi-mona-ui-progress-bar.d.ts +21 -9
- package/types/nanahoshi-mona-ui-radio-button.d.ts +165 -20
- package/types/nanahoshi-mona-ui-rating.d.ts +21 -6
- package/types/nanahoshi-mona-ui-scroll-view.d.ts +59 -27
- package/types/nanahoshi-mona-ui-segmented.d.ts +52 -24
- package/types/nanahoshi-mona-ui-sidebar.d.ts +104 -41
- package/types/nanahoshi-mona-ui-skeleton.d.ts +1 -1
- package/types/nanahoshi-mona-ui-slider.d.ts +99 -35
- package/types/nanahoshi-mona-ui-spinner.d.ts +9 -5
- package/types/nanahoshi-mona-ui-splitter.d.ts +31 -10
- package/types/nanahoshi-mona-ui-stepper.d.ts +58 -12
- package/types/nanahoshi-mona-ui-switch.d.ts +32 -10
- package/types/nanahoshi-mona-ui-tabs.d.ts +75 -20
- package/types/nanahoshi-mona-ui-text-area.d.ts +7 -7
- package/types/nanahoshi-mona-ui-text-box.d.ts +2 -0
- package/types/nanahoshi-mona-ui-theme.d.ts +392 -15
- package/types/nanahoshi-mona-ui-time-picker.d.ts +1 -0
- package/types/nanahoshi-mona-ui-time-selector.d.ts +1 -0
- package/types/nanahoshi-mona-ui-tooltip.d.ts +7 -1
|
@@ -1,15 +1,38 @@
|
|
|
1
1
|
import { NgTemplateOutlet } from '@angular/common';
|
|
2
2
|
import * as i0 from '@angular/core';
|
|
3
|
-
import { computed, input, Directive, model, viewChild, TemplateRef, Component, inject, output, DestroyRef, ElementRef, signal, afterNextRender, afterRenderEffect, contentChildren } 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
4
|
import { where, compact, from } from '@mirei/ts-collections';
|
|
5
5
|
import { cva } from 'class-variance-authority';
|
|
6
|
-
import {
|
|
6
|
+
import { createElementControlId } from '@nanahoshi/mona-ui/internal';
|
|
7
7
|
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
8
|
-
import {
|
|
8
|
+
import { merge, fromEvent, filter, take, tap, takeUntil, finalize } from 'rxjs';
|
|
9
9
|
import { MonaI18nService, injectComponentDirection } from '@nanahoshi/mona-ui/i18n';
|
|
10
10
|
import { LucideChevronLeft, LucideChevronRight, LucideChevronUp, LucideChevronDown } from '@lucide/angular';
|
|
11
11
|
import { ButtonDirective } from '@nanahoshi/mona-ui/button';
|
|
12
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
|
+
*/
|
|
18
|
+
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
|
+
|
|
13
36
|
class SplitterPaneStyleDirective {
|
|
14
37
|
constructor() {
|
|
15
38
|
this.#autoSizedPane = computed(() => {
|
|
@@ -21,15 +44,19 @@ class SplitterPaneStyleDirective {
|
|
|
21
44
|
return panes.firstOrDefault(pane => pane.size() === "") ?? panes.last();
|
|
22
45
|
}, /* @ts-ignore */
|
|
23
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 */ []));
|
|
24
49
|
this.styles = computed(() => {
|
|
25
50
|
const pane = this.pane();
|
|
26
51
|
const flexBasis = this.getPaneFlexBasis(pane);
|
|
27
52
|
const flexGrow = this.getPaneFlexGrow(pane);
|
|
28
53
|
const flexShrink = this.getPaneFlexShrink(pane);
|
|
29
|
-
const styles = { flexGrow, flexShrink, flexBasis };
|
|
54
|
+
const styles = { flexGrow, flexShrink, flexBasis, ...this.getPaneLimits(pane) };
|
|
30
55
|
return styles;
|
|
31
56
|
}, /* @ts-ignore */
|
|
32
57
|
...(ngDevMode ? [{ debugName: "styles" }] : /* istanbul ignore next */ []));
|
|
58
|
+
this.orientation = input("horizontal", /* @ts-ignore */
|
|
59
|
+
...(ngDevMode ? [{ debugName: "orientation" }] : /* istanbul ignore next */ []));
|
|
33
60
|
this.pane = input.required(/* @ts-ignore */
|
|
34
61
|
...(ngDevMode ? [{ debugName: "pane" }] : /* istanbul ignore next */ []));
|
|
35
62
|
this.paneList = input.required(/* @ts-ignore */
|
|
@@ -74,6 +101,19 @@ class SplitterPaneStyleDirective {
|
|
|
74
101
|
}
|
|
75
102
|
return size === null ? "1" : "0";
|
|
76
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
|
+
}
|
|
77
117
|
getPaneSize(pane) {
|
|
78
118
|
const size = pane.size();
|
|
79
119
|
if (size === "" || size === undefined || size === null) {
|
|
@@ -91,7 +131,7 @@ class SplitterPaneStyleDirective {
|
|
|
91
131
|
return size.trim().toLowerCase().endsWith("fr");
|
|
92
132
|
}
|
|
93
133
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: SplitterPaneStyleDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
94
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.6", type: SplitterPaneStyleDirective, isStandalone: true, selector: "div[monaSplitterPaneStyle]", inputs: { 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()", "aria-hidden": "
|
|
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 }); }
|
|
95
135
|
}
|
|
96
136
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: SplitterPaneStyleDirective, decorators: [{
|
|
97
137
|
type: Directive,
|
|
@@ -99,10 +139,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImpor
|
|
|
99
139
|
selector: "div[monaSplitterPaneStyle]",
|
|
100
140
|
host: {
|
|
101
141
|
"[style]": "styles()",
|
|
102
|
-
"[aria-hidden]": "
|
|
142
|
+
"[attr.aria-hidden]": "isCollapsed() ? true : null",
|
|
143
|
+
"[attr.inert]": "isCollapsed() ? true : null"
|
|
103
144
|
}
|
|
104
145
|
}]
|
|
105
|
-
}], propDecorators: { pane: [{ type: i0.Input, args: [{ isSignal: true, alias: "pane", required: true }] }], paneList: [{ type: i0.Input, args: [{ isSignal: true, alias: "paneList", required: true }] }] } });
|
|
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 }] }] } });
|
|
106
147
|
|
|
107
148
|
const splitterBaseThemeVariants = cva(`
|
|
108
149
|
flex h-full w-full min-h-0 min-w-0 overflow-hidden
|
|
@@ -117,22 +158,39 @@ const splitterBaseThemeVariants = cva(`
|
|
|
117
158
|
orientation: "horizontal"
|
|
118
159
|
}
|
|
119
160
|
});
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
161
|
+
/** The bar's place in the layout. Above the panes, because its hit area and focus outline reach over them. */
|
|
162
|
+
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
|
+
}
|
|
172
|
+
});
|
|
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
|
+
const splitterSeparatorThemeVariants = cva(`
|
|
178
|
+
absolute inset-0 touch-none
|
|
123
179
|
transition-colors
|
|
124
180
|
hover:bg-border-control active:bg-border-control-hover
|
|
125
181
|
focus-visible:bg-border-control
|
|
126
|
-
focus-visible:
|
|
182
|
+
focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-focus-indicator
|
|
183
|
+
forced-color-adjust-none forced-colors:bg-[CanvasText]
|
|
184
|
+
before:absolute before:content-['']
|
|
127
185
|
`, {
|
|
128
186
|
variants: {
|
|
129
187
|
orientation: {
|
|
130
|
-
horizontal: "
|
|
131
|
-
vertical: "
|
|
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]"
|
|
132
190
|
},
|
|
133
191
|
resizing: {
|
|
134
192
|
true: "bg-border-control-hover",
|
|
135
|
-
false: ""
|
|
193
|
+
false: "bg-border-subtle"
|
|
136
194
|
}
|
|
137
195
|
},
|
|
138
196
|
defaultVariants: {
|
|
@@ -140,14 +198,16 @@ const splitterResizerThemeVariants = cva(`
|
|
|
140
198
|
resizing: false
|
|
141
199
|
}
|
|
142
200
|
});
|
|
201
|
+
/** Sits over the bar without taking its pointer, except for the buttons, which are 24 pixels so a finger can hit them. */
|
|
143
202
|
const splitterResizerHandleThemeVariants = cva(`
|
|
203
|
+
pointer-events-none
|
|
144
204
|
flex items-center justify-center
|
|
145
|
-
[&_button]:p-0
|
|
205
|
+
[&_button]:pointer-events-auto [&_button]:size-6 [&_button]:p-0
|
|
146
206
|
`, {
|
|
147
207
|
variants: {
|
|
148
208
|
orientation: {
|
|
149
|
-
horizontal: "flex-row
|
|
150
|
-
vertical: "flex-col
|
|
209
|
+
horizontal: "flex-row",
|
|
210
|
+
vertical: "flex-col"
|
|
151
211
|
}
|
|
152
212
|
},
|
|
153
213
|
defaultVariants: {
|
|
@@ -165,23 +225,31 @@ class SplitterPaneComponent {
|
|
|
165
225
|
/**
|
|
166
226
|
* @description Whether the pane is collapsible.
|
|
167
227
|
*/
|
|
168
|
-
this.collapsible = input(false, /*
|
|
169
|
-
|
|
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 */ []));
|
|
170
236
|
/**
|
|
171
|
-
* @description The maximum size of the pane.
|
|
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.
|
|
172
239
|
*/
|
|
173
240
|
this.max = input(null, /* @ts-ignore */
|
|
174
241
|
...(ngDevMode ? [{ debugName: "max" }] : /* istanbul ignore next */ []));
|
|
175
242
|
/**
|
|
176
|
-
* @description The minimum size of the pane.
|
|
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.
|
|
177
245
|
*/
|
|
178
246
|
this.min = input(null, /* @ts-ignore */
|
|
179
247
|
...(ngDevMode ? [{ debugName: "min" }] : /* istanbul ignore next */ []));
|
|
180
248
|
/**
|
|
181
|
-
* @description Whether the pane is resizable.
|
|
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.
|
|
182
251
|
*/
|
|
183
|
-
this.resizable = input(true, /*
|
|
184
|
-
...(ngDevMode ? [{ debugName: "resizable" }] : /* istanbul ignore next */ []));
|
|
252
|
+
this.resizable = input(true, { ...(ngDevMode ? { debugName: "resizable" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
185
253
|
/**
|
|
186
254
|
* @description The size of the pane.
|
|
187
255
|
*/
|
|
@@ -189,10 +257,10 @@ class SplitterPaneComponent {
|
|
|
189
257
|
...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
|
|
190
258
|
this.template = viewChild.required(TemplateRef, /* @ts-ignore */
|
|
191
259
|
...(ngDevMode ? [{ debugName: "template" }] : /* istanbul ignore next */ []));
|
|
192
|
-
this.uid =
|
|
260
|
+
this.uid = createElementControlId();
|
|
193
261
|
}
|
|
194
262
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: SplitterPaneComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
195
|
-
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 }, 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: `
|
|
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: `
|
|
196
264
|
<ng-template>
|
|
197
265
|
<ng-content></ng-content>
|
|
198
266
|
</ng-template>
|
|
@@ -208,7 +276,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImpor
|
|
|
208
276
|
</ng-template>
|
|
209
277
|
`
|
|
210
278
|
}]
|
|
211
|
-
}], 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 }] }], 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 }] }] } });
|
|
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 }] }] } });
|
|
212
280
|
|
|
213
281
|
// Generated from i18n/catalogs/en-US.messages.json by scripts/generate-locale-catalogs.ts. Do not edit.
|
|
214
282
|
// Edit the JSON file and run `npm run generate:locale-catalogs`.
|
|
@@ -241,18 +309,14 @@ class SplitterResizerHandleComponent {
|
|
|
241
309
|
...(ngDevMode ? [{ debugName: "resizable" }] : /* istanbul ignore next */ []));
|
|
242
310
|
}
|
|
243
311
|
#i18n;
|
|
244
|
-
onPointerDown(event) {
|
|
245
|
-
event.preventDefault();
|
|
246
|
-
event.stopPropagation();
|
|
247
|
-
}
|
|
248
312
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: SplitterResizerHandleComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
249
|
-
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 look=\"secondary\"\n [rounded]=\"'none'\"\n [attr.aria-label]=\"messages().collapsePrevious\"\n (click)=\"collapsePrevious.emit(
|
|
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]" }] }); }
|
|
250
314
|
}
|
|
251
315
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: SplitterResizerHandleComponent, decorators: [{
|
|
252
316
|
type: Component,
|
|
253
317
|
args: [{ selector: "mona-splitter-resizer-handle", imports: [ButtonDirective, LucideChevronLeft, LucideChevronRight, LucideChevronUp, LucideChevronDown], host: {
|
|
254
318
|
"[class]": "baseClass()"
|
|
255
|
-
}, template: "@if (orientation() === \"horizontal\") {\n @if (previousControlsVisible()) {\n <button\n monaButton\n look=\"secondary\"\n [rounded]=\"'none'\"\n [attr.aria-label]=\"messages().collapsePrevious\"\n (click)=\"collapsePrevious.emit(
|
|
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" }]
|
|
256
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 }] }] } });
|
|
257
321
|
|
|
258
322
|
class SplitterResizerComponent {
|
|
@@ -269,8 +333,6 @@ class SplitterResizerComponent {
|
|
|
269
333
|
this.#i18n = inject(MonaI18nService);
|
|
270
334
|
this.#paneSizeMemory = new WeakMap();
|
|
271
335
|
this.#splitter = inject(SplitterComponent);
|
|
272
|
-
this.isRtl = computed(() => this.#direction() === "rtl", /* @ts-ignore */
|
|
273
|
-
...(ngDevMode ? [{ debugName: "isRtl" }] : /* istanbul ignore next */ []));
|
|
274
336
|
this.ariaValueMax = signal(0, /* @ts-ignore */
|
|
275
337
|
...(ngDevMode ? [{ debugName: "ariaValueMax" }] : /* istanbul ignore next */ []));
|
|
276
338
|
this.ariaValueMin = signal(0, /* @ts-ignore */
|
|
@@ -278,24 +340,35 @@ class SplitterResizerComponent {
|
|
|
278
340
|
this.ariaValueNow = signal(0, /* @ts-ignore */
|
|
279
341
|
...(ngDevMode ? [{ debugName: "ariaValueNow" }] : /* istanbul ignore next */ []));
|
|
280
342
|
this.baseClass = computed(() => {
|
|
281
|
-
|
|
282
|
-
const resizing = this.resizing();
|
|
283
|
-
return splitterResizerThemeVariants({ orientation, resizing });
|
|
343
|
+
return splitterResizerThemeVariants({ orientation: this.orientation() });
|
|
284
344
|
}, /* @ts-ignore */
|
|
285
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 */ []));
|
|
286
357
|
this.hovered = signal(false, /* @ts-ignore */
|
|
287
358
|
...(ngDevMode ? [{ debugName: "hovered" }] : /* istanbul ignore next */ []));
|
|
288
359
|
this.isInert = computed(() => {
|
|
289
360
|
return !this.resizable() && this.getCollapsibleTargetPane() === null;
|
|
290
361
|
}, /* @ts-ignore */
|
|
291
362
|
...(ngDevMode ? [{ debugName: "isInert" }] : /* istanbul ignore next */ []));
|
|
363
|
+
this.isRtl = computed(() => this.#direction() === "rtl", /* @ts-ignore */
|
|
364
|
+
...(ngDevMode ? [{ debugName: "isRtl" }] : /* istanbul ignore next */ []));
|
|
292
365
|
this.messages = this.#i18n.componentMessages("splitter", SPLITTER_DEFAULT_MESSAGES);
|
|
293
366
|
this.nextCollapseControlsVisible = computed(() => {
|
|
294
|
-
return this.
|
|
367
|
+
return this.controlsVisible() && this.nextPane().collapsible() && !this.nextPane().collapsed();
|
|
295
368
|
}, /* @ts-ignore */
|
|
296
369
|
...(ngDevMode ? [{ debugName: "nextCollapseControlsVisible" }] : /* istanbul ignore next */ []));
|
|
297
370
|
this.previousCollapseControlsVisible = computed(() => {
|
|
298
|
-
return this.
|
|
371
|
+
return this.controlsVisible() && this.previousPane().collapsible() && !this.previousPane().collapsed();
|
|
299
372
|
}, /* @ts-ignore */
|
|
300
373
|
...(ngDevMode ? [{ debugName: "previousCollapseControlsVisible" }] : /* istanbul ignore next */ []));
|
|
301
374
|
this.resizable = computed(() => {
|
|
@@ -304,11 +377,17 @@ class SplitterResizerComponent {
|
|
|
304
377
|
...(ngDevMode ? [{ debugName: "resizable" }] : /* istanbul ignore next */ []));
|
|
305
378
|
this.resizing = signal(false, /* @ts-ignore */
|
|
306
379
|
...(ngDevMode ? [{ debugName: "resizing" }] : /* istanbul ignore next */ []));
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
this.
|
|
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 */ []));
|
|
312
391
|
this.nextPane = input.required(/* @ts-ignore */
|
|
313
392
|
...(ngDevMode ? [{ debugName: "nextPane" }] : /* istanbul ignore next */ []));
|
|
314
393
|
this.orientation = input.required(/* @ts-ignore */
|
|
@@ -316,11 +395,7 @@ class SplitterResizerComponent {
|
|
|
316
395
|
this.previousPane = input.required(/* @ts-ignore */
|
|
317
396
|
...(ngDevMode ? [{ debugName: "previousPane" }] : /* istanbul ignore next */ []));
|
|
318
397
|
afterNextRender({
|
|
319
|
-
read: () =>
|
|
320
|
-
this.setHoverEvents();
|
|
321
|
-
this.setPointerEvents();
|
|
322
|
-
this.setKeyboardEvents();
|
|
323
|
-
}
|
|
398
|
+
read: () => this.observePaneSizes()
|
|
324
399
|
});
|
|
325
400
|
afterRenderEffect({
|
|
326
401
|
read: () => {
|
|
@@ -332,16 +407,61 @@ class SplitterResizerComponent {
|
|
|
332
407
|
}
|
|
333
408
|
});
|
|
334
409
|
}
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
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();
|
|
338
413
|
this.collapsePane("next");
|
|
339
414
|
}
|
|
340
|
-
collapsePrevious(
|
|
341
|
-
|
|
342
|
-
event.stopPropagation();
|
|
415
|
+
collapsePrevious() {
|
|
416
|
+
this.separatorElement().nativeElement.focus();
|
|
343
417
|
this.collapsePane("previous");
|
|
344
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
|
+
}
|
|
345
465
|
toggleCollapse() {
|
|
346
466
|
const targetPane = this.getCollapsibleTargetPane();
|
|
347
467
|
if (targetPane === null) {
|
|
@@ -350,6 +470,7 @@ class SplitterResizerComponent {
|
|
|
350
470
|
const targetElement = targetPane.uid === this.previousPane().uid ? this.getPaneElements()[0] : this.getPaneElements()[1];
|
|
351
471
|
const direction = targetPane.uid === this.previousPane().uid ? "previous" : "next";
|
|
352
472
|
this.togglePane(targetPane, targetElement, direction);
|
|
473
|
+
this.#splitter.notifyResizeEnd();
|
|
353
474
|
}
|
|
354
475
|
clamp(value, min, max) {
|
|
355
476
|
if (Number.isFinite(max)) {
|
|
@@ -381,6 +502,8 @@ class SplitterResizerComponent {
|
|
|
381
502
|
}
|
|
382
503
|
collapseAndRedistribute(targetPane, targetSize, leading, trailing) {
|
|
383
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);
|
|
384
507
|
return;
|
|
385
508
|
}
|
|
386
509
|
const leadingNeighbor = leading !== null && !(leading.pane.collapsible() && leading.pane.collapsed()) ? leading : null;
|
|
@@ -396,9 +519,11 @@ class SplitterResizerComponent {
|
|
|
396
519
|
collapsePane(direction) {
|
|
397
520
|
const target = this.pickTargetPane(direction);
|
|
398
521
|
if (target === null || !target.pane.collapsible()) {
|
|
399
|
-
return;
|
|
522
|
+
return false;
|
|
400
523
|
}
|
|
401
524
|
this.togglePane(target.pane, target.element, target.direction);
|
|
525
|
+
this.#splitter.notifyResizeEnd();
|
|
526
|
+
return true;
|
|
402
527
|
}
|
|
403
528
|
distributeSpaceToNeighbors(space, neighbors) {
|
|
404
529
|
const remaining = space;
|
|
@@ -496,22 +621,6 @@ class SplitterResizerComponent {
|
|
|
496
621
|
}
|
|
497
622
|
return null;
|
|
498
623
|
}
|
|
499
|
-
focusAdjacentResizer(forward) {
|
|
500
|
-
let cursor = this.#hostElementRef.nativeElement;
|
|
501
|
-
if (!cursor) {
|
|
502
|
-
return false;
|
|
503
|
-
}
|
|
504
|
-
while (true) {
|
|
505
|
-
cursor = forward ? cursor.nextElementSibling : cursor.previousElementSibling;
|
|
506
|
-
if (cursor === null) {
|
|
507
|
-
return false;
|
|
508
|
-
}
|
|
509
|
-
if (cursor instanceof HTMLElement && cursor.tagName.toLowerCase() === "mona-splitter-resizer") {
|
|
510
|
-
cursor.focus();
|
|
511
|
-
return true;
|
|
512
|
-
}
|
|
513
|
-
}
|
|
514
|
-
}
|
|
515
624
|
getCollapsibleTargetPane() {
|
|
516
625
|
const previousPane = this.previousPane();
|
|
517
626
|
const nextPane = this.nextPane();
|
|
@@ -531,12 +640,12 @@ class SplitterResizerComponent {
|
|
|
531
640
|
}
|
|
532
641
|
getMaxSize(pane) {
|
|
533
642
|
const max = pane.max();
|
|
534
|
-
const parsed =
|
|
643
|
+
const parsed = parsePaneSizeLimit(max);
|
|
535
644
|
return parsed === null ? Number.POSITIVE_INFINITY : Math.max(0, parsed);
|
|
536
645
|
}
|
|
537
646
|
getMinSize(pane) {
|
|
538
647
|
const min = pane.min();
|
|
539
|
-
const parsed =
|
|
648
|
+
const parsed = parsePaneSizeLimit(min);
|
|
540
649
|
return parsed === null ? 0 : Math.max(0, parsed);
|
|
541
650
|
}
|
|
542
651
|
getNeighborPanes(targetElement, direction) {
|
|
@@ -569,71 +678,78 @@ class SplitterResizerComponent {
|
|
|
569
678
|
if (orientation === "horizontal") {
|
|
570
679
|
const isRtl = this.isRtl();
|
|
571
680
|
if (key === "ArrowLeft") {
|
|
572
|
-
this.collapsePane(isRtl ? "next" : "previous");
|
|
573
|
-
return true;
|
|
681
|
+
return this.collapsePane(isRtl ? "next" : "previous");
|
|
574
682
|
}
|
|
575
683
|
if (key === "ArrowRight") {
|
|
576
|
-
this.collapsePane(isRtl ? "previous" : "next");
|
|
577
|
-
return true;
|
|
684
|
+
return this.collapsePane(isRtl ? "previous" : "next");
|
|
578
685
|
}
|
|
579
686
|
}
|
|
580
687
|
else {
|
|
581
688
|
if (key === "ArrowUp") {
|
|
582
|
-
this.collapsePane("previous");
|
|
583
|
-
return true;
|
|
689
|
+
return this.collapsePane("previous");
|
|
584
690
|
}
|
|
585
691
|
if (key === "ArrowDown") {
|
|
586
|
-
this.collapsePane("next");
|
|
587
|
-
return true;
|
|
692
|
+
return this.collapsePane("next");
|
|
588
693
|
}
|
|
589
694
|
}
|
|
590
695
|
return false;
|
|
591
696
|
}
|
|
592
697
|
handleKeydown(event) {
|
|
593
698
|
const key = event.key;
|
|
594
|
-
if (
|
|
595
|
-
return
|
|
699
|
+
if (event.ctrlKey || event.metaKey || event.shiftKey) {
|
|
700
|
+
return false;
|
|
701
|
+
}
|
|
702
|
+
if (event.altKey) {
|
|
703
|
+
return this.handleCollapserKeys(key);
|
|
596
704
|
}
|
|
597
705
|
if (key === "Enter") {
|
|
706
|
+
if (this.getCollapsibleTargetPane() === null) {
|
|
707
|
+
return false;
|
|
708
|
+
}
|
|
598
709
|
this.toggleCollapse();
|
|
599
710
|
return true;
|
|
600
711
|
}
|
|
601
|
-
if (event.altKey) {
|
|
602
|
-
return this.handleCollapserKeys(key);
|
|
603
|
-
}
|
|
604
712
|
return this.handleResizerKeys(key);
|
|
605
713
|
}
|
|
606
714
|
handleResizerKeys(key) {
|
|
607
|
-
|
|
608
|
-
const step = 10;
|
|
609
|
-
const previousPane = this.previousPane();
|
|
610
|
-
const nextPane = this.nextPane();
|
|
611
|
-
if (!previousPane.resizable() && !nextPane.resizable()) {
|
|
715
|
+
if (!this.resizable()) {
|
|
612
716
|
return false;
|
|
613
717
|
}
|
|
614
|
-
|
|
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") {
|
|
615
728
|
const isRtl = this.isRtl();
|
|
616
729
|
if (key === "ArrowLeft") {
|
|
617
|
-
this.
|
|
730
|
+
this.resizeFromKey(isRtl ? step : -step);
|
|
618
731
|
return true;
|
|
619
732
|
}
|
|
620
733
|
if (key === "ArrowRight") {
|
|
621
|
-
this.
|
|
734
|
+
this.resizeFromKey(isRtl ? -step : step);
|
|
622
735
|
return true;
|
|
623
736
|
}
|
|
624
737
|
}
|
|
625
738
|
else {
|
|
626
739
|
if (key === "ArrowUp") {
|
|
627
|
-
this.
|
|
740
|
+
this.resizeFromKey(-step);
|
|
628
741
|
return true;
|
|
629
742
|
}
|
|
630
743
|
if (key === "ArrowDown") {
|
|
631
|
-
this.
|
|
744
|
+
this.resizeFromKey(step);
|
|
632
745
|
return true;
|
|
633
746
|
}
|
|
634
747
|
}
|
|
635
748
|
return false;
|
|
636
749
|
}
|
|
750
|
+
isCollapsed(pane) {
|
|
751
|
+
return pane.collapsible() && pane.collapsed();
|
|
752
|
+
}
|
|
637
753
|
measurePaneSize(paneElement) {
|
|
638
754
|
const rect = paneElement.getBoundingClientRect();
|
|
639
755
|
const orientation = this.orientation();
|
|
@@ -650,16 +766,14 @@ class SplitterResizerComponent {
|
|
|
650
766
|
const [prevSize, nextSize] = this.clampPaneSizes(total, desiredPrev, this.previousPane(), this.nextPane());
|
|
651
767
|
this.updatePaneSizes(`${prevSize}px`, `${nextSize}px`);
|
|
652
768
|
}
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
if (typeof value === "number") {
|
|
658
|
-
return Number.isFinite(value) ? value : null;
|
|
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;
|
|
659
773
|
}
|
|
660
|
-
const
|
|
661
|
-
|
|
662
|
-
|
|
774
|
+
const observer = new ResizeObserver(() => this.updateAriaSeparatorValues());
|
|
775
|
+
this.getPaneElements().forEach(element => observer.observe(element));
|
|
776
|
+
this.#destroyRef.onDestroy(() => observer.disconnect());
|
|
663
777
|
}
|
|
664
778
|
pickTargetPane(direction) {
|
|
665
779
|
const [previousElement, nextElement] = this.getPaneElements();
|
|
@@ -678,50 +792,30 @@ class SplitterResizerComponent {
|
|
|
678
792
|
return { pane: nextPane, element: nextElement, direction: "next" };
|
|
679
793
|
}
|
|
680
794
|
}
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
fromEvent(this.#hostElementRef.nativeElement, "keydown")
|
|
693
|
-
.pipe(takeUntilDestroyed(this.#destroyRef))
|
|
694
|
-
.subscribe(event => {
|
|
695
|
-
const handled = this.handleKeydown(event);
|
|
696
|
-
if (handled) {
|
|
697
|
-
event.preventDefault();
|
|
698
|
-
event.stopPropagation();
|
|
699
|
-
}
|
|
700
|
-
});
|
|
701
|
-
}
|
|
702
|
-
setPointerEvents() {
|
|
703
|
-
const pointerDown$ = fromEvent(this.#hostElementRef.nativeElement, "pointerdown").pipe(filter(() => this.resizable()), tap(event => {
|
|
704
|
-
event.preventDefault();
|
|
705
|
-
this.#hostElementRef.nativeElement.setPointerCapture(event.pointerId);
|
|
706
|
-
this.resizing.set(true);
|
|
707
|
-
}));
|
|
708
|
-
const pointerUp$ = fromEvent(this.#hostElementRef.nativeElement, "pointerup").pipe(tap(event => {
|
|
709
|
-
this.#hostElementRef.nativeElement.releasePointerCapture(event.pointerId);
|
|
710
|
-
this.resizing.set(false);
|
|
711
|
-
this.setPointerEvents();
|
|
712
|
-
}));
|
|
713
|
-
fromEvent(document, "pointermove")
|
|
714
|
-
.pipe(skipUntil(pointerDown$), takeUntil(pointerUp$))
|
|
715
|
-
.subscribe(event => {
|
|
716
|
-
this.ensureExpandedBeforeResize();
|
|
717
|
-
const orientation = this.orientation();
|
|
718
|
-
if (orientation === "horizontal") {
|
|
719
|
-
this.updateHorizontalPaneSizes(event);
|
|
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;
|
|
720
806
|
}
|
|
721
|
-
|
|
722
|
-
|
|
807
|
+
this.togglePane(previousPane, previousElement, "previous");
|
|
808
|
+
}
|
|
809
|
+
else if (this.isCollapsed(nextPane)) {
|
|
810
|
+
if (delta >= 0) {
|
|
811
|
+
return;
|
|
723
812
|
}
|
|
724
|
-
|
|
813
|
+
this.togglePane(nextPane, nextElement, "next");
|
|
814
|
+
}
|
|
815
|
+
else {
|
|
816
|
+
this.nudgeSplitter(delta);
|
|
817
|
+
}
|
|
818
|
+
this.#splitter.notifyResizeEnd();
|
|
725
819
|
}
|
|
726
820
|
togglePane(targetPane, targetElement, direction) {
|
|
727
821
|
const neighbors = this.getNeighborPanes(targetElement, direction);
|
|
@@ -731,7 +825,9 @@ class SplitterResizerComponent {
|
|
|
731
825
|
}
|
|
732
826
|
else {
|
|
733
827
|
const targetSize = this.measurePaneSize(targetElement);
|
|
734
|
-
|
|
828
|
+
if (targetSize > 0) {
|
|
829
|
+
this.#paneSizeMemory.set(targetPane, targetSize);
|
|
830
|
+
}
|
|
735
831
|
this.collapseAndRedistribute(targetPane, targetSize, neighbors.leading, neighbors.trailing);
|
|
736
832
|
}
|
|
737
833
|
}
|
|
@@ -773,23 +869,18 @@ class SplitterResizerComponent {
|
|
|
773
869
|
this.updatePaneSizes(`${previousPaneHeight}px`, `${nextPaneHeight}px`);
|
|
774
870
|
}
|
|
775
871
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: SplitterResizerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
776
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.
|
|
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"] }] }); }
|
|
777
873
|
}
|
|
778
874
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: SplitterResizerComponent, decorators: [{
|
|
779
875
|
type: Component,
|
|
780
876
|
args: [{ selector: "mona-splitter-resizer", imports: [SplitterResizerHandleComponent], host: {
|
|
781
877
|
"[class]": "baseClass()",
|
|
782
|
-
"
|
|
783
|
-
"(
|
|
784
|
-
|
|
785
|
-
"
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
"[attr.aria-valuemin]": "ariaValueMin()",
|
|
789
|
-
"[attr.aria-valuenow]": "ariaValueNow()",
|
|
790
|
-
"[attr.tabindex]": "isInert() ? -1 : 0"
|
|
791
|
-
}, template: "<mona-splitter-resizer-handle\n (collapseNext)=\"collapseNext($event)\"\n (collapsePrevious)=\"collapsePrevious($event)\"\n [nextControlsVisible]=\"nextCollapseControlsVisible()\"\n [orientation]=\"orientation()\"\n [previousControlsVisible]=\"previousCollapseControlsVisible()\"\n [resizable]=\"resizable()\">\n</mona-splitter-resizer-handle>\n" }]
|
|
792
|
-
}], ctorParameters: () => [], propDecorators: { ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-label", required: false }] }], 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 }] }] } });
|
|
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 }] }] } });
|
|
793
884
|
|
|
794
885
|
class SplitterComponent {
|
|
795
886
|
constructor() {
|
|
@@ -800,12 +891,23 @@ class SplitterComponent {
|
|
|
800
891
|
...(ngDevMode ? [{ debugName: "baseClass" }] : /* istanbul ignore next */ []));
|
|
801
892
|
this.paneList = contentChildren(SplitterPaneComponent, /* @ts-ignore */
|
|
802
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 });
|
|
803
899
|
/**
|
|
804
900
|
* @description The layout direction of the splitter panes.
|
|
805
901
|
* @default "horizontal"
|
|
806
902
|
*/
|
|
807
903
|
this.orientation = input("horizontal", /* @ts-ignore */
|
|
808
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();
|
|
809
911
|
}
|
|
810
912
|
/**
|
|
811
913
|
* @internal Used by SplitterResizerComponent to resolve sibling panes by id.
|
|
@@ -813,15 +915,21 @@ class SplitterComponent {
|
|
|
813
915
|
getPaneByUid(uid) {
|
|
814
916
|
return from(this.paneList()).firstOrDefault(pane => pane.uid === uid);
|
|
815
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
|
+
}
|
|
816
924
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: SplitterComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
817
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: SplitterComponent, isStandalone: true, selector: "mona-splitter", inputs: { orientation: { classPropertyName: "orientation", publicName: "orientation", isSignal: true, isRequired: false, transformFunction: null } }, 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 monaSplitterPaneStyle\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: ["
|
|
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"] }] }); }
|
|
818
926
|
}
|
|
819
927
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: SplitterComponent, decorators: [{
|
|
820
928
|
type: Component,
|
|
821
929
|
args: [{ selector: "mona-splitter", imports: [SplitterResizerComponent, NgTemplateOutlet, SplitterPaneStyleDirective], host: {
|
|
822
930
|
"[class]": "baseClass()"
|
|
823
|
-
}, 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 monaSplitterPaneStyle\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" }]
|
|
824
|
-
}], propDecorators: { paneList: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => SplitterPaneComponent), { isSignal: true }] }], orientation: [{ type: i0.Input, args: [{ isSignal: true, alias: "orientation", required: false }] }] } });
|
|
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"] }] } });
|
|
825
933
|
|
|
826
934
|
/*
|
|
827
935
|
* Public API Surface of @nanahoshi/mona-ui/splitter
|