@mintplayer/web-components 1.0.0 → 1.2.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/a11y/index.mjs +2 -56
- package/calendar/index.mjs +2 -363
- package/checkbox/index.mjs +4 -0
- package/checkbox/src/components/index.d.ts +2 -0
- package/checkbox/src/components/mp-checkbox.d.ts +69 -0
- package/checkbox/src/index.d.ts +2 -0
- package/chunks/color-C4VT0EL7.mjs +847 -0
- package/chunks/form-check.styles-jBlHetYX.mjs +151 -0
- package/chunks/live-announcer-CZDTKulf.mjs +58 -0
- package/chunks/mp-calendar.element-UC68iDbi.mjs +365 -0
- package/chunks/mp-checkbox-BokLL7BS.mjs +211 -0
- package/chunks/mp-datatable-Con0yQue.mjs +1125 -0
- package/chunks/mp-pagination-BGxsawFL.mjs +326 -0
- package/chunks/mp-select-BDS1-YGn.mjs +254 -0
- package/chunks/mp-splitter-C8cGCmac.mjs +633 -0
- package/chunks/mp-tab-page-D1b4x-y2.mjs +414 -0
- package/chunks/mp-timepicker.element-BwEiwX92.mjs +428 -0
- package/chunks/mp-toggle-button-dLZNDUVz.mjs +534 -0
- package/chunks/mp-treeview-Bfq4_IVW.mjs +474 -0
- package/code-snippet/index.mjs +16 -13
- package/datatable/index.mjs +7 -0
- package/datatable/src/components/index.d.ts +2 -0
- package/datatable/src/components/mp-datatable.d.ts +260 -0
- package/datatable/src/index.d.ts +6 -0
- package/datatable/src/sort/compute-next-sort.d.ts +18 -0
- package/datatable/src/sort/index.d.ts +3 -0
- package/datatable/src/sort/sort-rows.d.ts +6 -0
- package/datatable/src/styles/datatable.styles.d.ts +2 -0
- package/datatable/src/styles/index.d.ts +1 -0
- package/datatable/src/types/column-def.d.ts +41 -0
- package/datatable/src/types/index.d.ts +2 -0
- package/datatable/src/types/tree.d.ts +42 -0
- package/datepicker/index.mjs +240 -0
- package/datepicker/src/index.d.ts +1 -0
- package/datepicker/src/mp-datepicker.element.d.ts +94 -0
- package/datepicker/src/mp-datepicker.element.template.d.ts +2 -0
- package/datetime-picker/index.mjs +427 -0
- package/datetime-picker/src/index.d.ts +1 -0
- package/datetime-picker/src/mp-datetime-picker.element.d.ts +174 -0
- package/datetime-picker/src/mp-datetime-picker.element.template.d.ts +2 -0
- package/dock/index.mjs +2402 -0
- package/dock/src/components/index.d.ts +1 -0
- package/dock/src/components/mint-dock-manager.element.d.ts +313 -0
- package/dock/src/components/mint-dock-manager.element.template.d.ts +2 -0
- package/dock/src/index.d.ts +2 -0
- package/dock/src/types/dock-layout.d.ts +65 -0
- package/dock/src/types/index.d.ts +1 -0
- package/file-manager/index.mjs +1263 -0
- package/file-manager/src/components/index.d.ts +2 -0
- package/file-manager/src/components/mp-file-manager.d.ts +320 -0
- package/file-manager/src/index.d.ts +5 -0
- package/file-manager/src/styles/file-manager.styles.d.ts +2 -0
- package/file-manager/src/styles/index.d.ts +1 -0
- package/file-manager/src/types/file-system-node.d.ts +24 -0
- package/file-manager/src/types/index.d.ts +3 -0
- package/file-manager/src/types/messages.d.ts +43 -0
- package/multi-range/index.mjs +407 -0
- package/multi-range/src/index.d.ts +2 -0
- package/multi-range/src/mint-multi-range.element.d.ts +124 -0
- package/multi-range/src/mint-multi-range.element.template.d.ts +2 -0
- package/multi-range/src/types/multi-range-orientation.d.ts +1 -0
- package/otp-input/index.mjs +362 -0
- package/otp-input/src/index.d.ts +4 -0
- package/otp-input/src/mint-otp-input.element.d.ts +134 -0
- package/otp-input/src/mint-otp-input.element.template.d.ts +2 -0
- package/otp-input/src/types/otp-input-case.d.ts +1 -0
- package/otp-input/src/types/otp-input-size.d.ts +1 -0
- package/otp-input/src/types/otp-input-type.d.ts +1 -0
- package/overlay/index.mjs +260 -0
- package/overlay/src/index.d.ts +2 -0
- package/overlay/src/overlay-controller.d.ts +205 -0
- package/package.json +1 -1
- package/pagination/index.mjs +5 -0
- package/pagination/src/components/index.d.ts +2 -0
- package/pagination/src/components/mp-pagination.d.ts +95 -0
- package/pagination/src/index.d.ts +2 -0
- package/pagination/src/styles/index.d.ts +1 -0
- package/pagination/src/styles/pagination.styles.d.ts +2 -0
- package/query-builder/index.mjs +3720 -0
- package/query-builder/src/context.d.ts +14 -0
- package/query-builder/src/dnd/drag-controller.d.ts +69 -0
- package/query-builder/src/index.d.ts +23 -0
- package/query-builder/src/model/default-tree.d.ts +7 -0
- package/query-builder/src/model/editor.d.ts +15 -0
- package/query-builder/src/model/errors.d.ts +6 -0
- package/query-builder/src/model/expression.d.ts +22 -0
- package/query-builder/src/model/field-def.d.ts +17 -0
- package/query-builder/src/model/messages.d.ts +17 -0
- package/query-builder/src/model/operator-overrides.d.ts +21 -0
- package/query-builder/src/model/operators.d.ts +8 -0
- package/query-builder/src/model/saved-query.d.ts +6 -0
- package/query-builder/src/model/sort.d.ts +9 -0
- package/query-builder/src/model/tree-ops.d.ts +56 -0
- package/query-builder/src/mp-query-builder.element.d.ts +158 -0
- package/query-builder/src/mp-query-builder.element.template.d.ts +2 -0
- package/query-builder/src/mp-query-condition.element.d.ts +44 -0
- package/query-builder/src/mp-query-condition.element.template.d.ts +2 -0
- package/query-builder/src/mp-query-group.element.d.ts +52 -0
- package/query-builder/src/mp-query-group.element.template.d.ts +2 -0
- package/query-builder/src/mp-query-subquery.element.d.ts +37 -0
- package/query-builder/src/mp-query-subquery.element.template.d.ts +2 -0
- package/query-builder/src/preview/render-expression.d.ts +23 -0
- package/query-builder/src/value-editors/builtin-editors.d.ts +6 -0
- package/query-builder/src/visitor/visit-tree.d.ts +29 -0
- package/query-builder/src/visitor/visitor-types.d.ts +15 -0
- package/radio/index.mjs +162 -0
- package/radio/src/components/index.d.ts +2 -0
- package/radio/src/components/mp-radio.d.ts +63 -0
- package/radio/src/index.d.ts +2 -0
- package/ribbon/index.mjs +3151 -0
- package/ribbon/src/index.d.ts +10 -0
- package/ribbon/src/items/index.d.ts +15 -0
- package/ribbon/src/items/mp-ribbon-button.element.d.ts +10 -0
- package/ribbon/src/items/mp-ribbon-checkbox.element.d.ts +11 -0
- package/ribbon/src/items/mp-ribbon-color-picker.element.d.ts +12 -0
- package/ribbon/src/items/mp-ribbon-combobox.element.d.ts +19 -0
- package/ribbon/src/items/mp-ribbon-dropdown-button.element.d.ts +16 -0
- package/ribbon/src/items/mp-ribbon-gallery-item.element.d.ts +15 -0
- package/ribbon/src/items/mp-ribbon-gallery.element.d.ts +11 -0
- package/ribbon/src/items/mp-ribbon-group-button.element.d.ts +18 -0
- package/ribbon/src/items/mp-ribbon-item-base.d.ts +68 -0
- package/ribbon/src/items/mp-ribbon-menu-item.element.d.ts +13 -0
- package/ribbon/src/items/mp-ribbon-menu-separator.element.d.ts +6 -0
- package/ribbon/src/items/mp-ribbon-split-button.element.d.ts +23 -0
- package/ribbon/src/items/mp-ribbon-template-item.element.d.ts +12 -0
- package/ribbon/src/items/mp-ribbon-toggle-button.element.d.ts +12 -0
- package/ribbon/src/mp-quick-access-toolbar.element.d.ts +35 -0
- package/ribbon/src/mp-ribbon-contextual-tab-set.element.d.ts +18 -0
- package/ribbon/src/mp-ribbon-group.element.d.ts +59 -0
- package/ribbon/src/mp-ribbon-tab.element.d.ts +72 -0
- package/ribbon/src/mp-ribbon.element.d.ts +211 -0
- package/ribbon/src/types/ribbon.types.d.ts +4 -0
- package/scheduler/index.mjs +3567 -0
- package/scheduler/src/components/mp-scheduler.d.ts +238 -0
- package/scheduler/src/drag/drag-manager.d.ts +90 -0
- package/scheduler/src/drag/drag-preview.d.ts +42 -0
- package/scheduler/src/drag/drag-state-machine.d.ts +102 -0
- package/scheduler/src/drag/drag-types.d.ts +104 -0
- package/scheduler/src/drag/index.d.ts +4 -0
- package/scheduler/src/events/event-types.d.ts +58 -0
- package/scheduler/src/events/index.d.ts +2 -0
- package/scheduler/src/events/scheduler-event-emitter.d.ts +52 -0
- package/scheduler/src/index.d.ts +6 -0
- package/scheduler/src/input/index.d.ts +2 -0
- package/scheduler/src/input/input-handler.d.ts +105 -0
- package/scheduler/src/input/pointer-event.d.ts +39 -0
- package/scheduler/src/state/scheduler-state.d.ts +189 -0
- package/scheduler/src/styles/scheduler.styles.d.ts +2 -0
- package/scheduler/src/views/base-view.d.ts +87 -0
- package/scheduler/src/views/day-view.d.ts +25 -0
- package/scheduler/src/views/index.d.ts +6 -0
- package/scheduler/src/views/month-view.d.ts +27 -0
- package/scheduler/src/views/timeline-view.d.ts +23 -0
- package/scheduler/src/views/week-view.d.ts +28 -0
- package/scheduler/src/views/year-view.d.ts +25 -0
- package/scheduler-core/index.mjs +174 -0
- package/scheduler-core/src/index.d.ts +3 -0
- package/scheduler-core/src/models/drag-state.d.ts +43 -0
- package/scheduler-core/src/models/event.d.ts +111 -0
- package/scheduler-core/src/models/events.d.ts +108 -0
- package/scheduler-core/src/models/index.d.ts +7 -0
- package/scheduler-core/src/models/options.d.ts +88 -0
- package/scheduler-core/src/models/resource.d.ts +58 -0
- package/scheduler-core/src/models/time-slot.d.ts +31 -0
- package/scheduler-core/src/models/types.d.ts +20 -0
- package/scheduler-core/src/services/date.service.d.ts +140 -0
- package/scheduler-core/src/services/index.d.ts +4 -0
- package/scheduler-core/src/services/position.service.d.ts +35 -0
- package/scheduler-core/src/services/resource.service.d.ts +83 -0
- package/scheduler-core/src/services/timeline.service.d.ts +103 -0
- package/scheduler-core/src/utils/color.d.ts +24 -0
- package/scheduler-core/src/utils/dom.d.ts +54 -0
- package/scheduler-core/src/utils/id.d.ts +16 -0
- package/scheduler-core/src/utils/index.d.ts +3 -0
- package/select/index.mjs +4 -0
- package/select/src/components/index.d.ts +2 -0
- package/select/src/components/mp-select.d.ts +82 -0
- package/select/src/index.d.ts +2 -0
- package/splitter/index.mjs +10 -0
- package/splitter/src/components/index.d.ts +2 -0
- package/splitter/src/components/mp-splitter.d.ts +109 -0
- package/splitter/src/index.d.ts +11 -0
- package/splitter/src/input/index.d.ts +4 -0
- package/splitter/src/input/input-handler.d.ts +36 -0
- package/splitter/src/input/pointer-event.d.ts +9 -0
- package/splitter/src/managers/index.d.ts +2 -0
- package/splitter/src/managers/resize-manager.d.ts +13 -0
- package/splitter/src/state/index.d.ts +2 -0
- package/splitter/src/state/splitter-state.d.ts +24 -0
- package/splitter/src/styles/index.d.ts +1 -0
- package/splitter/src/styles/splitter.styles.d.ts +2 -0
- package/splitter/src/types/direction.d.ts +1 -0
- package/splitter/src/types/index.d.ts +5 -0
- package/splitter/src/types/panel-info.d.ts +6 -0
- package/splitter/src/types/point.d.ts +4 -0
- package/splitter/src/types/resize-operation.d.ts +13 -0
- package/tab-control/index.mjs +6 -0
- package/tab-control/src/components/index.d.ts +3 -0
- package/tab-control/src/components/mp-tab-control.d.ts +50 -0
- package/tab-control/src/components/mp-tab-page.d.ts +35 -0
- package/tab-control/src/index.d.ts +4 -0
- package/tab-control/src/styles/index.d.ts +1 -0
- package/tab-control/src/styles/tab-control.styles.d.ts +2 -0
- package/tab-control/src/types/index.d.ts +1 -0
- package/tab-control/src/types/tabs-position.d.ts +1 -0
- package/tile-manager/index.mjs +867 -0
- package/tile-manager/src/components/index.d.ts +2 -0
- package/tile-manager/src/components/mint-tile-manager.element.d.ts +204 -0
- package/tile-manager/src/components/mint-tile-manager.element.template.d.ts +2 -0
- package/tile-manager/src/index.d.ts +4 -0
- package/tile-manager/src/types/grid-rect.d.ts +12 -0
- package/tile-manager/src/types/index.d.ts +3 -0
- package/tile-manager/src/types/tile-layout-snapshot.d.ts +15 -0
- package/tile-manager/src/types/tile-position.d.ts +10 -0
- package/tile-manager/src/utils/index.d.ts +1 -0
- package/tile-manager/src/utils/pack.d.ts +24 -0
- package/timepicker/index.mjs +5 -0
- package/timepicker/src/index.d.ts +2 -0
- package/timepicker/src/mp-time-list.element.d.ts +76 -0
- package/timepicker/src/mp-time-list.element.template.d.ts +2 -0
- package/timepicker/src/mp-timepicker.element.d.ts +87 -0
- package/timepicker/src/mp-timepicker.element.template.d.ts +2 -0
- package/toggle-button/index.mjs +5 -0
- package/toggle-button/src/components/index.d.ts +2 -0
- package/toggle-button/src/components/mp-toggle-button.d.ts +50 -0
- package/toggle-button/src/index.d.ts +3 -0
- package/toggle-button/src/styles/index.d.ts +1 -0
- package/toggle-button/src/styles/toggle-button.styles.d.ts +2 -0
- package/treeview/index.mjs +5 -0
- package/treeview/src/components/index.d.ts +2 -0
- package/treeview/src/components/mp-treeview.d.ts +113 -0
- package/treeview/src/index.d.ts +4 -0
- package/treeview/src/styles/index.d.ts +1 -0
- package/treeview/src/styles/treeview.styles.d.ts +2 -0
- package/treeview/src/types/index.d.ts +1 -0
- package/treeview/src/types/tree-node.d.ts +14 -0
- package/custom-elements.json +0 -1774
|
@@ -0,0 +1,633 @@
|
|
|
1
|
+
import { unsafeCSS as S, LitElement as A, html as M } from "lit";
|
|
2
|
+
var b = /* @__PURE__ */ ((c) => (c.Idle = "idle", c.Resizing = "resizing", c))(b || {});
|
|
3
|
+
class w {
|
|
4
|
+
constructor(e) {
|
|
5
|
+
this.listeners = /* @__PURE__ */ new Set(), this.state = {
|
|
6
|
+
orientation: "horizontal",
|
|
7
|
+
panelSizes: [],
|
|
8
|
+
previewSizes: null,
|
|
9
|
+
resizeOperation: null,
|
|
10
|
+
...e
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
getState() {
|
|
14
|
+
return { ...this.state };
|
|
15
|
+
}
|
|
16
|
+
subscribe(e) {
|
|
17
|
+
return this.listeners.add(e), () => {
|
|
18
|
+
this.listeners.delete(e);
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
notifyListeners() {
|
|
22
|
+
const e = this.getState();
|
|
23
|
+
for (const i of this.listeners)
|
|
24
|
+
i(e);
|
|
25
|
+
}
|
|
26
|
+
setOrientation(e) {
|
|
27
|
+
this.state.orientation !== e && (this.state = { ...this.state, orientation: e }, this.notifyListeners());
|
|
28
|
+
}
|
|
29
|
+
setPanelSizes(e) {
|
|
30
|
+
this.state = { ...this.state, panelSizes: [...e] }, this.notifyListeners();
|
|
31
|
+
}
|
|
32
|
+
setPreviewSizes(e) {
|
|
33
|
+
this.state = { ...this.state, previewSizes: e ? [...e] : null }, this.notifyListeners();
|
|
34
|
+
}
|
|
35
|
+
startResize(e) {
|
|
36
|
+
this.state = {
|
|
37
|
+
...this.state,
|
|
38
|
+
resizeOperation: { ...e }
|
|
39
|
+
}, this.notifyListeners();
|
|
40
|
+
}
|
|
41
|
+
updateResize(e) {
|
|
42
|
+
this.state = {
|
|
43
|
+
...this.state,
|
|
44
|
+
previewSizes: [...e]
|
|
45
|
+
}, this.notifyListeners();
|
|
46
|
+
}
|
|
47
|
+
endResize(e) {
|
|
48
|
+
this.state = {
|
|
49
|
+
...this.state,
|
|
50
|
+
panelSizes: [...e],
|
|
51
|
+
previewSizes: null,
|
|
52
|
+
resizeOperation: null
|
|
53
|
+
}, this.notifyListeners();
|
|
54
|
+
}
|
|
55
|
+
cancelResize() {
|
|
56
|
+
this.state = {
|
|
57
|
+
...this.state,
|
|
58
|
+
previewSizes: null,
|
|
59
|
+
resizeOperation: null
|
|
60
|
+
}, this.notifyListeners();
|
|
61
|
+
}
|
|
62
|
+
isResizing() {
|
|
63
|
+
return this.state.resizeOperation?.state === b.Resizing;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
function g(c) {
|
|
67
|
+
const e = "touches" in c;
|
|
68
|
+
let i, t;
|
|
69
|
+
if (e) {
|
|
70
|
+
const s = c.touches[0] || c.changedTouches[0];
|
|
71
|
+
i = s.clientX, t = s.clientY;
|
|
72
|
+
} else
|
|
73
|
+
i = c.clientX, t = c.clientY;
|
|
74
|
+
return {
|
|
75
|
+
clientX: i,
|
|
76
|
+
clientY: t,
|
|
77
|
+
point: { x: i, y: t },
|
|
78
|
+
originalEvent: c,
|
|
79
|
+
isTouch: e
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
const E = /* @__PURE__ */ new Set([
|
|
83
|
+
"ArrowLeft",
|
|
84
|
+
"ArrowRight",
|
|
85
|
+
"ArrowUp",
|
|
86
|
+
"ArrowDown",
|
|
87
|
+
"Home",
|
|
88
|
+
"End"
|
|
89
|
+
]);
|
|
90
|
+
class R {
|
|
91
|
+
constructor(e) {
|
|
92
|
+
this.isActive = !1, this.currentDividerIndex = -1, this.currentDividerElement = null, this.callbacks = e, this.boundMouseMove = this.handleMouseMove.bind(this), this.boundMouseUp = this.handleMouseUp.bind(this), this.boundTouchMove = this.handleTouchMove.bind(this), this.boundTouchEnd = this.handleTouchEnd.bind(this);
|
|
93
|
+
}
|
|
94
|
+
attachDividerListeners(e, i) {
|
|
95
|
+
e.addEventListener("mousedown", (t) => this.handleMouseDown(t, i, e)), e.addEventListener("touchstart", (t) => this.handleTouchStart(t, i, e), { passive: !1 }), e.addEventListener("keydown", (t) => this.handleKeyDown(t, i, e));
|
|
96
|
+
}
|
|
97
|
+
handleKeyDown(e, i, t) {
|
|
98
|
+
this.callbacks.onResizeKey && E.has(e.key) && (e.preventDefault(), this.callbacks.onResizeKey(e.key, e.shiftKey, i, t));
|
|
99
|
+
}
|
|
100
|
+
handleMouseDown(e, i, t) {
|
|
101
|
+
e.preventDefault(), this.startResize(e, i, t), document.addEventListener("mousemove", this.boundMouseMove), document.addEventListener("mouseup", this.boundMouseUp);
|
|
102
|
+
}
|
|
103
|
+
handleMouseMove(e) {
|
|
104
|
+
this.isActive && (e.preventDefault(), this.callbacks.onResizeMove(g(e)));
|
|
105
|
+
}
|
|
106
|
+
handleMouseUp(e) {
|
|
107
|
+
this.isActive && (this.endResize(e), document.removeEventListener("mousemove", this.boundMouseMove), document.removeEventListener("mouseup", this.boundMouseUp));
|
|
108
|
+
}
|
|
109
|
+
handleTouchStart(e, i, t) {
|
|
110
|
+
e.preventDefault(), this.startResize(e, i, t), document.addEventListener("touchmove", this.boundTouchMove, { passive: !1 }), document.addEventListener("touchend", this.boundTouchEnd), document.addEventListener("touchcancel", this.boundTouchEnd);
|
|
111
|
+
}
|
|
112
|
+
handleTouchMove(e) {
|
|
113
|
+
this.isActive && (e.preventDefault(), this.callbacks.onResizeMove(g(e)));
|
|
114
|
+
}
|
|
115
|
+
handleTouchEnd(e) {
|
|
116
|
+
this.isActive && (this.endResize(e), document.removeEventListener("touchmove", this.boundTouchMove), document.removeEventListener("touchend", this.boundTouchEnd), document.removeEventListener("touchcancel", this.boundTouchEnd));
|
|
117
|
+
}
|
|
118
|
+
startResize(e, i, t) {
|
|
119
|
+
this.isActive = !0, this.currentDividerIndex = i, this.currentDividerElement = t, this.callbacks.onResizeStart(g(e), i, t);
|
|
120
|
+
}
|
|
121
|
+
endResize(e) {
|
|
122
|
+
this.callbacks.onResizeEnd(g(e)), this.isActive = !1, this.currentDividerIndex = -1, this.currentDividerElement = null;
|
|
123
|
+
}
|
|
124
|
+
dispose() {
|
|
125
|
+
document.removeEventListener("mousemove", this.boundMouseMove), document.removeEventListener("mouseup", this.boundMouseUp), document.removeEventListener("touchmove", this.boundTouchMove), document.removeEventListener("touchend", this.boundTouchEnd), document.removeEventListener("touchcancel", this.boundTouchEnd), this.isActive = !1, this.currentDividerIndex = -1, this.currentDividerElement = null;
|
|
126
|
+
}
|
|
127
|
+
getIsActive() {
|
|
128
|
+
return this.isActive;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
class P {
|
|
132
|
+
constructor(e = {}) {
|
|
133
|
+
this.options = {
|
|
134
|
+
minPanelSize: e.minPanelSize ?? 50
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
computePanelSizes(e, i) {
|
|
138
|
+
return e.map((t) => {
|
|
139
|
+
const s = t.getBoundingClientRect();
|
|
140
|
+
return i === "horizontal" ? s.width : s.height;
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
createResizeOperation(e, i, t, s) {
|
|
144
|
+
return {
|
|
145
|
+
state: b.Resizing,
|
|
146
|
+
startPosition: { ...e },
|
|
147
|
+
sizes: [...i],
|
|
148
|
+
indexBefore: t,
|
|
149
|
+
indexAfter: t + 1,
|
|
150
|
+
dividerElement: s
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
calculatePreviewSizes(e, i, t) {
|
|
154
|
+
const { startPosition: s, sizes: n, indexBefore: a, indexAfter: o } = e, u = t === "horizontal" ? i.x - s.x : i.y - s.y, h = [...n], r = n[a], z = n[o];
|
|
155
|
+
let d = r + u, l = z - u;
|
|
156
|
+
if (d < this.options.minPanelSize) {
|
|
157
|
+
const p = this.options.minPanelSize - d;
|
|
158
|
+
d = this.options.minPanelSize, l -= p;
|
|
159
|
+
}
|
|
160
|
+
if (l < this.options.minPanelSize) {
|
|
161
|
+
const p = this.options.minPanelSize - l;
|
|
162
|
+
l = this.options.minPanelSize, d -= p;
|
|
163
|
+
}
|
|
164
|
+
return d = Math.max(d, this.options.minPanelSize), l = Math.max(l, this.options.minPanelSize), h[a] = d, h[o] = l, h;
|
|
165
|
+
}
|
|
166
|
+
setMinPanelSize(e) {
|
|
167
|
+
this.options.minPanelSize = e;
|
|
168
|
+
}
|
|
169
|
+
getMinPanelSize() {
|
|
170
|
+
return this.options.minPanelSize;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
const y = S(`:host {
|
|
174
|
+
display: block;
|
|
175
|
+
width: 100%;
|
|
176
|
+
height: 100%;
|
|
177
|
+
--mp-splitter-size: 8px;
|
|
178
|
+
--mp-splitter-thumb-margin: 3px;
|
|
179
|
+
--mp-splitter-divider-color: var(--bs-border-color, #eee);
|
|
180
|
+
--mp-splitter-divider-hover-color: var(--bs-primary, #1389fd);
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
:host([touch-mode]) {
|
|
184
|
+
--mp-splitter-thumb-margin: 20px;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
* {
|
|
188
|
+
box-sizing: border-box;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
.splitter-container {
|
|
192
|
+
display: flex;
|
|
193
|
+
width: 100%;
|
|
194
|
+
height: 100%;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
.splitter-container.horizontal {
|
|
198
|
+
flex-direction: row;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
.splitter-container.vertical {
|
|
202
|
+
flex-direction: column;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
.panel-wrapper {
|
|
206
|
+
overflow: hidden;
|
|
207
|
+
position: relative;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
.panel-wrapper.flex-grow {
|
|
211
|
+
flex: 1 1 0;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
/* Divider base styles */
|
|
215
|
+
.divider {
|
|
216
|
+
flex-shrink: 0;
|
|
217
|
+
transition: background-color 0.15s ease-in-out;
|
|
218
|
+
z-index: 3;
|
|
219
|
+
touch-action: none;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
.divider::before {
|
|
223
|
+
content: "";
|
|
224
|
+
display: block;
|
|
225
|
+
background-color: var(--mp-splitter-divider-color);
|
|
226
|
+
background-position: center center;
|
|
227
|
+
background-repeat: no-repeat;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
.divider:hover::before,
|
|
231
|
+
.divider.active::before,
|
|
232
|
+
.divider:focus-visible::before {
|
|
233
|
+
background-color: var(--mp-splitter-divider-hover-color);
|
|
234
|
+
border-radius: calc(var(--mp-splitter-size) / 2);
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
.divider:focus {
|
|
238
|
+
outline: none;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
.divider:focus-visible {
|
|
242
|
+
outline: 2px solid var(--mp-splitter-divider-hover-color);
|
|
243
|
+
outline-offset: 1px;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
/* Horizontal splitter styles */
|
|
247
|
+
.splitter-container.horizontal > .divider {
|
|
248
|
+
width: calc(var(--mp-splitter-size) + 2 * var(--mp-splitter-thumb-margin));
|
|
249
|
+
height: 100%;
|
|
250
|
+
cursor: col-resize;
|
|
251
|
+
border-left: var(--mp-splitter-thumb-margin) solid transparent;
|
|
252
|
+
border-right: var(--mp-splitter-thumb-margin) solid transparent;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
.splitter-container.horizontal > .divider::before {
|
|
256
|
+
height: 100%;
|
|
257
|
+
width: var(--mp-splitter-size);
|
|
258
|
+
margin: 0 auto;
|
|
259
|
+
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAeCAYAAADkftS9AAAAIklEQVQoU2M4c+bMfxAGAgYYmwGrIIiDjrELjpo5aiZeMwF+yNnOs5KSvgAAAABJRU5ErkJggg==);
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
.splitter-container.horizontal > .panel-wrapper:not(:first-child) {
|
|
263
|
+
margin-left: calc(-1 * var(--mp-splitter-thumb-margin));
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
.splitter-container.horizontal > .panel-wrapper:not(:last-child) {
|
|
267
|
+
margin-right: calc(-1 * var(--mp-splitter-thumb-margin));
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
/* Vertical splitter styles */
|
|
271
|
+
.splitter-container.vertical > .divider {
|
|
272
|
+
width: 100%;
|
|
273
|
+
height: calc(var(--mp-splitter-size) + 2 * var(--mp-splitter-thumb-margin));
|
|
274
|
+
cursor: row-resize;
|
|
275
|
+
border-top: var(--mp-splitter-thumb-margin) solid transparent;
|
|
276
|
+
border-bottom: var(--mp-splitter-thumb-margin) solid transparent;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
.splitter-container.vertical > .divider::before {
|
|
280
|
+
height: var(--mp-splitter-size);
|
|
281
|
+
width: 100%;
|
|
282
|
+
margin: auto 0;
|
|
283
|
+
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB4AAAAFCAMAAABl/6zIAAAABlBMVEUAAADMzMzIT8AyAAAAAXRSTlMAQObYZgAAABRJREFUeAFjYGRkwIMJSeMHlBkOABP7AEGzSuPKAAAAAElFTkSuQmCC);
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
.splitter-container.vertical > .panel-wrapper:not(:first-child) {
|
|
287
|
+
margin-top: calc(-1 * var(--mp-splitter-thumb-margin));
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
.splitter-container.vertical > .panel-wrapper:not(:last-child) {
|
|
291
|
+
margin-bottom: calc(-1 * var(--mp-splitter-thumb-margin));
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
/* Resizing state */
|
|
295
|
+
:host([resizing]) .splitter-container {
|
|
296
|
+
cursor: col-resize;
|
|
297
|
+
user-select: none;
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
:host([resizing]) .splitter-container.vertical {
|
|
301
|
+
cursor: row-resize;
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
/* Slot content styling */
|
|
305
|
+
::slotted(*) {
|
|
306
|
+
width: 100%;
|
|
307
|
+
height: 100%;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
@media (prefers-reduced-motion: reduce) {
|
|
311
|
+
.divider {
|
|
312
|
+
transition: none !important;
|
|
313
|
+
}
|
|
314
|
+
}`);
|
|
315
|
+
let L = 0;
|
|
316
|
+
class O extends A {
|
|
317
|
+
constructor() {
|
|
318
|
+
super(), this.container = null, this.panelWrappers = [], this.dividers = [], this.slotElement = null, this.mutationObserver = null, this.containerResizeObserver = null, this.unsubscribeState = null, this.instanceId = `mp-splitter-${++L}`, this.stateManager = new w(), this.resizeManager = new P(), this.inputHandler = new R({
|
|
319
|
+
onResizeStart: this.handleResizeStart.bind(this),
|
|
320
|
+
onResizeMove: this.handleResizeMove.bind(this),
|
|
321
|
+
onResizeEnd: this.handleResizeEnd.bind(this),
|
|
322
|
+
onResizeKey: this.handleResizeKey.bind(this)
|
|
323
|
+
});
|
|
324
|
+
}
|
|
325
|
+
static {
|
|
326
|
+
this.styles = [y];
|
|
327
|
+
}
|
|
328
|
+
static get observedAttributes() {
|
|
329
|
+
return [
|
|
330
|
+
...super.observedAttributes ?? [],
|
|
331
|
+
"orientation",
|
|
332
|
+
"min-panel-size",
|
|
333
|
+
"touch-mode"
|
|
334
|
+
];
|
|
335
|
+
}
|
|
336
|
+
render() {
|
|
337
|
+
return M`
|
|
338
|
+
<div class="splitter-container"></div>
|
|
339
|
+
<slot></slot>
|
|
340
|
+
`;
|
|
341
|
+
}
|
|
342
|
+
firstUpdated() {
|
|
343
|
+
this.container = this.shadowRoot.querySelector(".splitter-container"), this.container.classList.add(this.orientation), this.slotElement = this.shadowRoot.querySelector("slot"), this.slotElement.style.display = "none", this.slotElement.addEventListener("slotchange", () => {
|
|
344
|
+
this.updatePanelsFromSlot();
|
|
345
|
+
}), this.setupMutationObserver(), this.subscribeToState(), this.setupContainerResizeObserver(), requestAnimationFrame(() => {
|
|
346
|
+
this.updatePanelsFromSlot();
|
|
347
|
+
});
|
|
348
|
+
}
|
|
349
|
+
disconnectedCallback() {
|
|
350
|
+
this.inputHandler.dispose(), this.mutationObserver && (this.mutationObserver.disconnect(), this.mutationObserver = null), this.containerResizeObserver && (this.containerResizeObserver.disconnect(), this.containerResizeObserver = null), this.unsubscribeState && (this.unsubscribeState(), this.unsubscribeState = null), super.disconnectedCallback();
|
|
351
|
+
}
|
|
352
|
+
attributeChangedCallback(e, i, t) {
|
|
353
|
+
if (super.attributeChangedCallback(e, i, t), i !== t)
|
|
354
|
+
switch (e) {
|
|
355
|
+
case "orientation":
|
|
356
|
+
this.stateManager.setOrientation(
|
|
357
|
+
t || "horizontal"
|
|
358
|
+
), this.updateContainerOrientation();
|
|
359
|
+
break;
|
|
360
|
+
case "min-panel-size":
|
|
361
|
+
const s = t ? parseInt(t, 10) : 50;
|
|
362
|
+
this.resizeManager.setMinPanelSize(isNaN(s) ? 50 : s);
|
|
363
|
+
break;
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
// Public API
|
|
367
|
+
get orientation() {
|
|
368
|
+
return this.getAttribute("orientation") || "horizontal";
|
|
369
|
+
}
|
|
370
|
+
set orientation(e) {
|
|
371
|
+
this.setAttribute("orientation", e);
|
|
372
|
+
}
|
|
373
|
+
get minPanelSize() {
|
|
374
|
+
const e = this.getAttribute("min-panel-size");
|
|
375
|
+
return e ? parseInt(e, 10) : 50;
|
|
376
|
+
}
|
|
377
|
+
set minPanelSize(e) {
|
|
378
|
+
this.setAttribute("min-panel-size", String(e));
|
|
379
|
+
}
|
|
380
|
+
get touchMode() {
|
|
381
|
+
return this.hasAttribute("touch-mode");
|
|
382
|
+
}
|
|
383
|
+
set touchMode(e) {
|
|
384
|
+
e ? this.setAttribute("touch-mode", "") : this.removeAttribute("touch-mode");
|
|
385
|
+
}
|
|
386
|
+
getPanelSizes() {
|
|
387
|
+
return this.stateManager.getState().panelSizes;
|
|
388
|
+
}
|
|
389
|
+
/**
|
|
390
|
+
* Drive a keyboard-style resize on a divider programmatically. Used by the
|
|
391
|
+
* dock manager's intersection-handle keymap so a single keystroke can
|
|
392
|
+
* resize both the horizontal and vertical dividers a 2D handle sits on,
|
|
393
|
+
* without re-implementing the percent-step + clamp math here.
|
|
394
|
+
*
|
|
395
|
+
* `key` is one of the keys handled by the divider keymap
|
|
396
|
+
* (Arrow{Left,Right,Up,Down}, Home, End); `fine` halves the step (matches
|
|
397
|
+
* Shift modifier on the keyboard path).
|
|
398
|
+
*/
|
|
399
|
+
resizeDividerBy(e, i, t = !1) {
|
|
400
|
+
const s = this.dividers[e];
|
|
401
|
+
s && this.handleResizeKey(i, t, e, s);
|
|
402
|
+
}
|
|
403
|
+
setPanelSizes(e) {
|
|
404
|
+
this.applyPanelSizes(e), this.stateManager.setPanelSizes(e);
|
|
405
|
+
}
|
|
406
|
+
// Private methods
|
|
407
|
+
setupMutationObserver() {
|
|
408
|
+
this.mutationObserver = new MutationObserver(() => {
|
|
409
|
+
this.updatePanelsFromSlot();
|
|
410
|
+
}), this.mutationObserver.observe(this, {
|
|
411
|
+
childList: !0,
|
|
412
|
+
subtree: !1
|
|
413
|
+
});
|
|
414
|
+
}
|
|
415
|
+
subscribeToState() {
|
|
416
|
+
this.unsubscribeState = this.stateManager.subscribe((e) => {
|
|
417
|
+
e.resizeOperation ? this.setAttribute("resizing", "") : this.removeAttribute("resizing"), this.updateDividerAriaValues();
|
|
418
|
+
});
|
|
419
|
+
}
|
|
420
|
+
/**
|
|
421
|
+
* Mirror current panel sizes to each divider's aria-valuenow / valuemin /
|
|
422
|
+
* valuemax as percent of container. Per §10 Q3 of the WC ARIA PRD: percent
|
|
423
|
+
* is more intuitive for SR users than pixels.
|
|
424
|
+
*
|
|
425
|
+
* Per-divider math: divider i sits between panels[i] and panels[i+1] and
|
|
426
|
+
* "owns" the size of panels[i]. valuemin = minPanelSize as % of container;
|
|
427
|
+
* valuemax = (panels[i].size + panels[i+1].size - minPanelSize) as %.
|
|
428
|
+
*/
|
|
429
|
+
updateDividerAriaValues() {
|
|
430
|
+
if (this.dividers.length === 0 || !this.container) return;
|
|
431
|
+
const e = this.stateManager.getState(), i = e.previewSizes ?? e.panelSizes;
|
|
432
|
+
if (i.length !== this.panelWrappers.length || i.length === 0) return;
|
|
433
|
+
const t = this.container.getBoundingClientRect(), s = this.orientation === "horizontal" ? t.width : t.height;
|
|
434
|
+
if (s <= 0) return;
|
|
435
|
+
const n = this.resizeManager.getMinPanelSize();
|
|
436
|
+
this.dividers.forEach((a, o) => {
|
|
437
|
+
const u = i[o], h = i[o + 1];
|
|
438
|
+
if (u === void 0 || h === void 0) return;
|
|
439
|
+
const r = Math.round(u / s * 100), z = Math.round(n / s * 100), d = u + h, l = Math.round((d - n) / s * 100);
|
|
440
|
+
a.setAttribute("aria-valuenow", String(r)), a.setAttribute("aria-valuemin", String(z)), a.setAttribute("aria-valuemax", String(l));
|
|
441
|
+
});
|
|
442
|
+
}
|
|
443
|
+
updatePanelsFromSlot() {
|
|
444
|
+
if (!this.container) return;
|
|
445
|
+
const e = Array.from(this.children).filter(
|
|
446
|
+
(n) => n instanceof HTMLElement
|
|
447
|
+
);
|
|
448
|
+
if (e.length === 0) return;
|
|
449
|
+
this.container.innerHTML = "", this.panelWrappers = [], this.dividers = [];
|
|
450
|
+
const i = e.length, t = this.orientation === "horizontal" ? "vertical" : "horizontal";
|
|
451
|
+
e.forEach((n, a) => {
|
|
452
|
+
const o = document.createElement("div");
|
|
453
|
+
o.className = "panel-wrapper flex-grow", o.id = `${this.instanceId}-panel-${a}`;
|
|
454
|
+
const u = document.createElement("slot"), h = `panel-${a}`;
|
|
455
|
+
if (u.name = h, n.slot = h, o.appendChild(u), this.panelWrappers.push(o), this.container.appendChild(o), a < i - 1) {
|
|
456
|
+
const r = document.createElement("div");
|
|
457
|
+
r.className = "divider", r.setAttribute("role", "separator"), r.setAttribute("aria-orientation", t), r.setAttribute("tabindex", "0"), r.setAttribute(
|
|
458
|
+
"aria-controls",
|
|
459
|
+
`${this.instanceId}-panel-${a} ${this.instanceId}-panel-${a + 1}`
|
|
460
|
+
), r.setAttribute(
|
|
461
|
+
"aria-label",
|
|
462
|
+
`Resize between panel ${a + 1} and panel ${a + 2}`
|
|
463
|
+
), this.inputHandler.attachDividerListeners(r, a), this.dividers.push(r), this.container.appendChild(r);
|
|
464
|
+
}
|
|
465
|
+
});
|
|
466
|
+
const s = this.stateManager.getState().panelSizes;
|
|
467
|
+
if (s.length > 0 && s.length === this.panelWrappers.length) {
|
|
468
|
+
this.applyPanelSizes(s), requestAnimationFrame(() => this.handleContainerResize());
|
|
469
|
+
return;
|
|
470
|
+
}
|
|
471
|
+
requestAnimationFrame(() => {
|
|
472
|
+
const n = this.stateManager.getState().panelSizes;
|
|
473
|
+
if (n.length === this.panelWrappers.length && n.length > 0) {
|
|
474
|
+
this.applyPanelSizes(n);
|
|
475
|
+
return;
|
|
476
|
+
}
|
|
477
|
+
this.pinSizesFromCurrentLayout();
|
|
478
|
+
});
|
|
479
|
+
}
|
|
480
|
+
/**
|
|
481
|
+
* Read each panel-wrapper's measured pixel size and persist it as the
|
|
482
|
+
* authoritative panel size. After this runs, every wrapper carries an
|
|
483
|
+
* inline `width` (or `height`) — content intrinsic size cannot leak into
|
|
484
|
+
* the parent flex container, so a nested splitter's drag does not shift
|
|
485
|
+
* the parent's layout.
|
|
486
|
+
*/
|
|
487
|
+
pinSizesFromCurrentLayout() {
|
|
488
|
+
if (this.panelWrappers.length === 0) return;
|
|
489
|
+
const e = this.orientation === "horizontal" ? "width" : "height", i = this.panelWrappers.map(
|
|
490
|
+
(t) => t.getBoundingClientRect()[e]
|
|
491
|
+
);
|
|
492
|
+
i.every((t) => t <= 0) || (this.applyPanelSizes(i), this.stateManager.setPanelSizes(i));
|
|
493
|
+
}
|
|
494
|
+
setupContainerResizeObserver() {
|
|
495
|
+
!this.container || typeof ResizeObserver > "u" || (this.containerResizeObserver = new ResizeObserver(() => {
|
|
496
|
+
this.handleContainerResize();
|
|
497
|
+
}), this.containerResizeObserver.observe(this.container));
|
|
498
|
+
}
|
|
499
|
+
/**
|
|
500
|
+
* When the splitter's container resizes (window resize, parent splitter
|
|
501
|
+
* pinning its sizes, etc.), scale every panel-wrapper proportionally so
|
|
502
|
+
* the existing ratios are preserved. Without this we'd be stuck with the
|
|
503
|
+
* original pixel sizes when the surrounding viewport changes — what
|
|
504
|
+
* `flex-basis: 0` gave master "for free".
|
|
505
|
+
*/
|
|
506
|
+
handleContainerResize() {
|
|
507
|
+
if (!this.container || this.panelWrappers.length === 0 || this.stateManager.isResizing()) return;
|
|
508
|
+
const e = this.stateManager.getState().panelSizes;
|
|
509
|
+
if (e.length === 0 || e.length !== this.panelWrappers.length) return;
|
|
510
|
+
const i = this.container.getBoundingClientRect(), t = this.orientation === "horizontal" ? i.width : i.height;
|
|
511
|
+
if (t <= 0) return;
|
|
512
|
+
const s = this.orientation === "horizontal" ? "width" : "height", n = this.dividers.reduce(
|
|
513
|
+
(l, p) => l + p.getBoundingClientRect()[s],
|
|
514
|
+
0
|
|
515
|
+
), a = this.orientation === "horizontal" ? "marginLeft" : "marginTop", o = this.orientation === "horizontal" ? "marginRight" : "marginBottom", u = this.panelWrappers.reduce((l, p) => {
|
|
516
|
+
const m = getComputedStyle(p);
|
|
517
|
+
return l + parseFloat(m[a]) + parseFloat(m[o]);
|
|
518
|
+
}, 0), h = Math.max(0, t - n - u), r = e.reduce((l, p) => l + p, 0);
|
|
519
|
+
if (r <= 0 || Math.abs(h - r) < 1) return;
|
|
520
|
+
const z = h / r, d = e.map((l) => l * z);
|
|
521
|
+
this.applyPanelSizes(d), this.stateManager.setPanelSizes(d), this.updateDividerAriaValues();
|
|
522
|
+
}
|
|
523
|
+
updateContainerOrientation() {
|
|
524
|
+
if (!this.container) return;
|
|
525
|
+
this.container.className = `splitter-container ${this.orientation}`;
|
|
526
|
+
const e = this.orientation === "horizontal" ? "vertical" : "horizontal";
|
|
527
|
+
this.dividers.forEach((i) => {
|
|
528
|
+
i.setAttribute("aria-orientation", e);
|
|
529
|
+
});
|
|
530
|
+
}
|
|
531
|
+
handleResizeStart(e, i, t) {
|
|
532
|
+
const s = this.resizeManager.computePanelSizes(
|
|
533
|
+
this.panelWrappers,
|
|
534
|
+
this.orientation
|
|
535
|
+
), n = this.resizeManager.createResizeOperation(
|
|
536
|
+
e.point,
|
|
537
|
+
s,
|
|
538
|
+
i,
|
|
539
|
+
t
|
|
540
|
+
);
|
|
541
|
+
this.stateManager.startResize(n), t.classList.add("active"), this.dispatchEvent(
|
|
542
|
+
new CustomEvent("resize-start", {
|
|
543
|
+
bubbles: !0,
|
|
544
|
+
detail: {
|
|
545
|
+
sizes: s,
|
|
546
|
+
orientation: this.orientation
|
|
547
|
+
}
|
|
548
|
+
})
|
|
549
|
+
);
|
|
550
|
+
}
|
|
551
|
+
handleResizeMove(e) {
|
|
552
|
+
const i = this.stateManager.getState();
|
|
553
|
+
if (!i.resizeOperation) return;
|
|
554
|
+
const t = this.resizeManager.calculatePreviewSizes(
|
|
555
|
+
i.resizeOperation,
|
|
556
|
+
e.point,
|
|
557
|
+
this.orientation
|
|
558
|
+
);
|
|
559
|
+
this.stateManager.updateResize(t), this.applyPanelSizes(t), this.dispatchEvent(
|
|
560
|
+
new CustomEvent("resizing", {
|
|
561
|
+
bubbles: !0,
|
|
562
|
+
detail: {
|
|
563
|
+
sizes: t,
|
|
564
|
+
orientation: this.orientation
|
|
565
|
+
}
|
|
566
|
+
})
|
|
567
|
+
);
|
|
568
|
+
}
|
|
569
|
+
handleResizeEnd(e) {
|
|
570
|
+
const i = this.stateManager.getState();
|
|
571
|
+
if (!i.resizeOperation) return;
|
|
572
|
+
const t = i.previewSizes || i.resizeOperation.sizes;
|
|
573
|
+
i.resizeOperation.dividerElement && i.resizeOperation.dividerElement.classList.remove("active"), this.stateManager.endResize(t), this.dispatchEvent(
|
|
574
|
+
new CustomEvent("resize-end", {
|
|
575
|
+
bubbles: !0,
|
|
576
|
+
detail: {
|
|
577
|
+
sizes: t,
|
|
578
|
+
orientation: this.orientation
|
|
579
|
+
}
|
|
580
|
+
})
|
|
581
|
+
);
|
|
582
|
+
}
|
|
583
|
+
/**
|
|
584
|
+
* Keyboard-driven resize on a focused divider. ArrowKeys ±10% (Shift = ±1%)
|
|
585
|
+
* along the splitter's axis; Home/End shrink/grow panelBefore to its limit.
|
|
586
|
+
* Fires resize-start → resize-end with the new sizes so consumers don't
|
|
587
|
+
* need to special-case keyboard vs. drag.
|
|
588
|
+
*/
|
|
589
|
+
handleResizeKey(e, i, t, s) {
|
|
590
|
+
if (!this.container || this.panelWrappers.length === 0) return;
|
|
591
|
+
const n = [...this.stateManager.getState().panelSizes];
|
|
592
|
+
if (n.length !== this.panelWrappers.length) return;
|
|
593
|
+
const a = n[t], o = n[t + 1];
|
|
594
|
+
if (a === void 0 || o === void 0) return;
|
|
595
|
+
const u = this.container.getBoundingClientRect(), h = this.orientation === "horizontal" ? u.width : u.height;
|
|
596
|
+
if (h <= 0) return;
|
|
597
|
+
const r = this.resizeManager.getMinPanelSize(), z = this.orientation === "horizontal", d = z ? "ArrowRight" : "ArrowDown", l = z ? "ArrowLeft" : "ArrowUp";
|
|
598
|
+
let p = 0;
|
|
599
|
+
e === d ? p = 1 : e === l && (p = -1);
|
|
600
|
+
let m, v;
|
|
601
|
+
if (e === "Home")
|
|
602
|
+
m = r, v = a + o - r;
|
|
603
|
+
else if (e === "End")
|
|
604
|
+
m = a + o - r, v = r;
|
|
605
|
+
else if (p !== 0) {
|
|
606
|
+
const f = (i ? 1 : 10) / 100 * h * p;
|
|
607
|
+
m = a + f, v = o - f, m < r ? (m = r, v = a + o - r) : v < r && (v = r, m = a + o - r);
|
|
608
|
+
} else
|
|
609
|
+
return;
|
|
610
|
+
m === a && v === o || (n[t] = m, n[t + 1] = v, this.applyPanelSizes(n), this.stateManager.setPanelSizes(n), this.updateDividerAriaValues(), s.classList.add("active"), queueMicrotask(() => s.classList.remove("active")), this.dispatchEvent(
|
|
611
|
+
new CustomEvent("resize-end", {
|
|
612
|
+
bubbles: !0,
|
|
613
|
+
detail: { sizes: n, orientation: this.orientation }
|
|
614
|
+
})
|
|
615
|
+
));
|
|
616
|
+
}
|
|
617
|
+
applyPanelSizes(e) {
|
|
618
|
+
const i = this.orientation === "horizontal" ? "width" : "height", t = this.orientation === "horizontal" ? "height" : "width";
|
|
619
|
+
this.panelWrappers.forEach((s, n) => {
|
|
620
|
+
e[n] !== void 0 && (s.style[i] = `${e[n]}px`, s.style[t] = "", s.classList.remove("flex-grow"));
|
|
621
|
+
});
|
|
622
|
+
}
|
|
623
|
+
}
|
|
624
|
+
typeof customElements < "u" && !customElements.get("mp-splitter") && customElements.define("mp-splitter", O);
|
|
625
|
+
export {
|
|
626
|
+
R as I,
|
|
627
|
+
O as M,
|
|
628
|
+
P as R,
|
|
629
|
+
w as S,
|
|
630
|
+
b as a,
|
|
631
|
+
g as n,
|
|
632
|
+
y as s
|
|
633
|
+
};
|