@mintplayer/web-components 2.15.0 → 2.17.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/accordion/index.mjs +5 -5
- package/calendar/index.mjs +1 -1
- package/carousel/index.mjs +57 -143
- package/charts/core/index.mjs +30 -20
- package/charts/core/src/attributes.d.ts +18 -0
- package/charts/core/src/index.d.ts +2 -0
- package/charts/core/src/view-window.d.ts +46 -0
- package/charts/hierarchy/index.mjs +245 -256
- package/charts/hierarchy/src/components/mp-hierarchy-chart.d.ts +1 -3
- package/charts/sparkline/index.mjs +27 -26
- package/charts/trend/index.mjs +21 -20
- package/checkbox/index.mjs +1 -1
- package/checkbox/src/components/mp-checkbox.d.ts +1 -0
- package/chunks/attributes-L3eKsbdy.mjs +16 -0
- package/chunks/color-mode-warning-71FmlzWX.mjs +13 -0
- package/chunks/{form-check.styles-B0pxJ6YC.mjs → form-check.styles-DqvBnspm.mjs} +24 -3
- package/chunks/{mp-calendar.element-CJ8-t-Zn.mjs → mp-calendar.element-BIHS9SZZ.mjs} +11 -6
- package/chunks/{mp-checkbox-CzwS7Y_t.mjs → mp-checkbox-zV83gILn.mjs} +44 -36
- package/chunks/mp-datatable-eRpl7-2V.mjs +2238 -0
- package/chunks/{mp-datetime-picker.element-D1CiLbHm.mjs → mp-datetime-picker.element-Cxu5-qRE.mjs} +29 -32
- package/chunks/{mp-pagination-Dea75mD4.mjs → mp-pagination-hGy4dL7p.mjs} +9 -4
- package/chunks/{mp-radio-cL46sUA0.mjs → mp-radio-BhRVNdKp.mjs} +32 -28
- package/chunks/{mp-select-BNrbPwN4.mjs → mp-select-CgqYFvUj.mjs} +41 -26
- package/chunks/{mp-splitter-Ckn1kN4v.mjs → mp-splitter-DLehrw3Y.mjs} +144 -120
- package/chunks/{mp-timepicker.element-COZEUIoE.mjs → mp-timepicker.element-BiB9lkgc.mjs} +58 -45
- package/chunks/{mp-toggle-button-eo_aTQtu.mjs → mp-toggle-button-CaS9uYLE.mjs} +26 -24
- package/chunks/{mp-treeview-C8iltDbq.mjs → mp-treeview-CaMTDrvY.mjs} +51 -50
- package/chunks/{overlay-controller-D6agzzOI.mjs → overlay-controller-BHDagokg.mjs} +130 -70
- package/chunks/{id-DNZVAnGC.mjs → resource.service--lqLwEqk.mjs} +144 -206
- package/chunks/view-window-DGvFiDnW.mjs +263 -0
- package/code-snippet/index.mjs +70 -66
- package/code-snippet/src/hljs-loaders.generated.d.ts +1 -1
- package/custom-elements.json +65750 -0
- package/datatable/index.mjs +6 -5
- package/datatable/src/components/column-resize.d.ts +11 -0
- package/datatable/src/components/mp-datatable.d.ts +206 -1
- package/datatable/src/index.d.ts +3 -1
- package/datatable/src/types/column-def.d.ts +61 -0
- package/datatable/src/types/filter.d.ts +138 -0
- package/datatable/src/types/index.d.ts +3 -2
- package/datatable/src/types/labels.d.ts +58 -0
- package/datepicker/index.mjs +10 -9
- package/datetime-picker/index.mjs +1 -1
- package/datetime-picker/src/mp-datetime-picker.element.d.ts +3 -0
- package/dock/index.mjs +430 -463
- package/dock/src/components/mint-dock-manager.element.d.ts +25 -2
- package/dock/src/core/resize.d.ts +60 -0
- package/dropdown-menu/index.mjs +4 -2
- package/dropdown-menu/src/components/mp-dropdown-menu.d.ts +6 -1
- package/dropdown-menu/src/index.d.ts +1 -1
- package/dropdown-menu/src/types/dropdown.d.ts +14 -1
- package/dropdown-menu/src/types/index.d.ts +1 -1
- package/file-manager/index.mjs +63 -61
- package/file-manager/src/components/mp-file-manager.d.ts +4 -3
- package/multi-range/index.mjs +56 -50
- package/multi-range/src/mint-multi-range.element.d.ts +4 -10
- package/multi-range/src/pointer-geometry.d.ts +31 -0
- package/navbar/index.mjs +89 -439
- package/overlay/index.mjs +5 -2
- package/overlay/src/index.d.ts +2 -0
- package/overlay/src/overlay-controller.d.ts +27 -14
- package/overlay/src/overlay-portal.d.ts +53 -0
- package/overlay/src/placement.d.ts +48 -0
- package/package.json +7 -1
- package/pagination/index.mjs +1 -1
- package/phone-input/index.mjs +44 -40
- package/phone-input/src/components/stack.d.ts +8 -0
- package/query-builder/index.mjs +418 -466
- package/query-builder/src/dnd/drag-controller.d.ts +12 -8
- package/query-builder/src/mp-query-builder.element.d.ts +5 -1
- package/query-builder/src/mp-query-condition.element.d.ts +1 -0
- package/radio/index.mjs +1 -1
- package/radio-group/index.mjs +1 -1
- package/ribbon/index.mjs +477 -498
- package/ribbon/src/core/band-text-color.d.ts +10 -0
- package/ribbon/src/core/key-tip-allocator.d.ts +10 -0
- package/ribbon/src/core/plan-reduce-steps.d.ts +62 -0
- package/ribbon/src/mp-ribbon.element.d.ts +0 -27
- package/scheduler/index.mjs +726 -711
- package/scheduler/src/components/mp-scheduler.d.ts +19 -3
- package/scheduler/src/drag/drag-manager.d.ts +1 -9
- package/scheduler/src/input/input-handler.d.ts +12 -2
- package/scheduler/src/utils/geometry.d.ts +39 -0
- package/scheduler/src/views/timeline-view.d.ts +0 -1
- package/scheduler-core/index.mjs +84 -71
- package/scheduler-core/src/services/resource.service.d.ts +0 -12
- package/scheduler-core/src/services/timeline.service.d.ts +0 -9
- package/select/index.mjs +1 -1
- package/select/src/components/mp-select.d.ts +1 -0
- package/signature-pad/index.mjs +21 -23
- package/signature-pad/src/canvas-point.d.ts +26 -0
- package/signature-pad/src/mp-signature-pad.element.d.ts +1 -7
- package/splitter/index.mjs +1 -1
- package/splitter/src/components/mp-splitter.d.ts +16 -0
- package/splitter/src/managers/index.d.ts +1 -0
- package/splitter/src/managers/rescale-panel-sizes.d.ts +14 -0
- package/swiper-core/index.mjs +2 -2
- package/theming/bs-theme-preboot.js +1 -0
- package/theming/color-mode.css +36 -0
- package/theming/index.d.ts +1 -0
- package/theming/index.mjs +327 -0
- package/theming/src/components/mp-theme-toggle.d.ts +71 -0
- package/theming/src/cookie.d.ts +31 -0
- package/theming/src/index.d.ts +5 -0
- package/theming/src/preboot.d.ts +1 -0
- package/theming/src/resolve.d.ts +36 -0
- package/theming/src/store.d.ts +27 -0
- package/theming/src/styles/theme-toggle.styles.d.ts +2 -0
- package/theming/src/testing/fake-broadcast-channel.d.ts +35 -0
- package/theming/src/toggle-modes.d.ts +23 -0
- package/tile-manager/index.mjs +252 -211
- package/tile-manager/src/components/mint-tile-manager.element.d.ts +8 -0
- package/tile-manager/src/utils/grid-geometry.d.ts +49 -0
- package/timeline/index.mjs +156 -164
- package/timeline/src/components/mp-timeline.d.ts +41 -7
- package/timepicker/index.mjs +7 -4
- package/timepicker/src/mp-time-list.element.d.ts +26 -0
- package/timepicker/src/mp-timepicker.element.d.ts +3 -0
- package/toggle-button/index.mjs +1 -1
- package/tree-select/index.mjs +21 -9
- package/treeview/index.mjs +1 -1
- package/treeview/src/components/mp-treeview.d.ts +6 -4
- package/chunks/color-DIeST-IS.mjs +0 -224
- package/chunks/mp-datatable-UJI8E73X.mjs +0 -1400
- package/datatable/src/styles/datatable.styles.d.ts +0 -2
- package/query-builder/src/mp-query-condition.element.template.d.ts +0 -2
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { unsafeCSS as S, LitElement as A, html as M } from "lit";
|
|
2
2
|
import "lit/directives/ref.js";
|
|
3
3
|
import { F as w } from "./focus-restore-DxuP1Oe2.mjs";
|
|
4
|
-
var b = /* @__PURE__ */ ((
|
|
4
|
+
var b = /* @__PURE__ */ ((l) => (l.Idle = "idle", l.Resizing = "resizing", l))(b || {});
|
|
5
5
|
class R {
|
|
6
6
|
constructor(e) {
|
|
7
7
|
this.listeners = /* @__PURE__ */ new Set(), this.state = {
|
|
@@ -36,8 +36,8 @@ class R {
|
|
|
36
36
|
}
|
|
37
37
|
notifyListeners() {
|
|
38
38
|
const e = this.getState();
|
|
39
|
-
for (const
|
|
40
|
-
|
|
39
|
+
for (const t of this.listeners)
|
|
40
|
+
t(e);
|
|
41
41
|
}
|
|
42
42
|
setOrientation(e) {
|
|
43
43
|
this.state.orientation !== e && (this.state = { ...this.state, orientation: e }, this.notifyListeners());
|
|
@@ -79,19 +79,19 @@ class R {
|
|
|
79
79
|
return this.state.resizeOperation?.state === b.Resizing;
|
|
80
80
|
}
|
|
81
81
|
}
|
|
82
|
-
function g(
|
|
83
|
-
const e = "touches" in
|
|
84
|
-
let
|
|
82
|
+
function g(l) {
|
|
83
|
+
const e = "touches" in l;
|
|
84
|
+
let t, i;
|
|
85
85
|
if (e) {
|
|
86
|
-
const s =
|
|
87
|
-
|
|
86
|
+
const s = l.touches[0] || l.changedTouches[0];
|
|
87
|
+
t = s.clientX, i = s.clientY;
|
|
88
88
|
} else
|
|
89
|
-
|
|
89
|
+
t = l.clientX, i = l.clientY;
|
|
90
90
|
return {
|
|
91
|
-
clientX:
|
|
92
|
-
clientY:
|
|
93
|
-
point: { x:
|
|
94
|
-
originalEvent:
|
|
91
|
+
clientX: t,
|
|
92
|
+
clientY: i,
|
|
93
|
+
point: { x: t, y: i },
|
|
94
|
+
originalEvent: l,
|
|
95
95
|
isTouch: e
|
|
96
96
|
};
|
|
97
97
|
}
|
|
@@ -107,14 +107,14 @@ class y {
|
|
|
107
107
|
constructor(e) {
|
|
108
108
|
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);
|
|
109
109
|
}
|
|
110
|
-
attachDividerListeners(e,
|
|
111
|
-
e.addEventListener("mousedown", (
|
|
110
|
+
attachDividerListeners(e, t) {
|
|
111
|
+
e.addEventListener("mousedown", (i) => this.handleMouseDown(i, t, e)), e.addEventListener("touchstart", (i) => this.handleTouchStart(i, t, e), { passive: !1 }), e.addEventListener("keydown", (i) => this.handleKeyDown(i, t, e));
|
|
112
112
|
}
|
|
113
|
-
handleKeyDown(e,
|
|
114
|
-
this.callbacks.onResizeKey && E.has(e.key) && (e.preventDefault(), this.callbacks.onResizeKey(e.key, e.shiftKey,
|
|
113
|
+
handleKeyDown(e, t, i) {
|
|
114
|
+
this.callbacks.onResizeKey && E.has(e.key) && (e.preventDefault(), this.callbacks.onResizeKey(e.key, e.shiftKey, t, i));
|
|
115
115
|
}
|
|
116
|
-
handleMouseDown(e,
|
|
117
|
-
e.preventDefault(), this.startResize(e,
|
|
116
|
+
handleMouseDown(e, t, i) {
|
|
117
|
+
e.preventDefault(), this.startResize(e, t, i), document.addEventListener("mousemove", this.boundMouseMove), document.addEventListener("mouseup", this.boundMouseUp);
|
|
118
118
|
}
|
|
119
119
|
handleMouseMove(e) {
|
|
120
120
|
this.isActive && (e.preventDefault(), this.callbacks.onResizeMove(g(e)));
|
|
@@ -122,8 +122,8 @@ class y {
|
|
|
122
122
|
handleMouseUp(e) {
|
|
123
123
|
this.isActive && (this.endResize(e), document.removeEventListener("mousemove", this.boundMouseMove), document.removeEventListener("mouseup", this.boundMouseUp));
|
|
124
124
|
}
|
|
125
|
-
handleTouchStart(e,
|
|
126
|
-
e.preventDefault(), this.startResize(e,
|
|
125
|
+
handleTouchStart(e, t, i) {
|
|
126
|
+
e.preventDefault(), this.startResize(e, t, i), document.addEventListener("touchmove", this.boundTouchMove, { passive: !1 }), document.addEventListener("touchend", this.boundTouchEnd), document.addEventListener("touchcancel", this.boundTouchEnd);
|
|
127
127
|
}
|
|
128
128
|
handleTouchMove(e) {
|
|
129
129
|
this.isActive && (e.preventDefault(), this.callbacks.onResizeMove(g(e)));
|
|
@@ -131,8 +131,8 @@ class y {
|
|
|
131
131
|
handleTouchEnd(e) {
|
|
132
132
|
this.isActive && (this.endResize(e), document.removeEventListener("touchmove", this.boundTouchMove), document.removeEventListener("touchend", this.boundTouchEnd), document.removeEventListener("touchcancel", this.boundTouchEnd));
|
|
133
133
|
}
|
|
134
|
-
startResize(e,
|
|
135
|
-
this.isActive = !0, this.currentDividerIndex =
|
|
134
|
+
startResize(e, t, i) {
|
|
135
|
+
this.isActive = !0, this.currentDividerIndex = t, this.currentDividerElement = i, this.callbacks.onResizeStart(g(e), t, i);
|
|
136
136
|
}
|
|
137
137
|
endResize(e) {
|
|
138
138
|
this.callbacks.onResizeEnd(g(e)), this.isActive = !1, this.currentDividerIndex = -1, this.currentDividerElement = null;
|
|
@@ -150,34 +150,34 @@ class P {
|
|
|
150
150
|
minPanelSize: e.minPanelSize ?? 50
|
|
151
151
|
};
|
|
152
152
|
}
|
|
153
|
-
computePanelSizes(e,
|
|
154
|
-
return e.map((
|
|
155
|
-
const s =
|
|
156
|
-
return
|
|
153
|
+
computePanelSizes(e, t) {
|
|
154
|
+
return e.map((i) => {
|
|
155
|
+
const s = i.getBoundingClientRect();
|
|
156
|
+
return t === "horizontal" ? s.width : s.height;
|
|
157
157
|
});
|
|
158
158
|
}
|
|
159
|
-
createResizeOperation(e,
|
|
159
|
+
createResizeOperation(e, t, i, s) {
|
|
160
160
|
return {
|
|
161
161
|
state: b.Resizing,
|
|
162
162
|
startPosition: { ...e },
|
|
163
|
-
sizes: [...
|
|
164
|
-
indexBefore:
|
|
165
|
-
indexAfter:
|
|
163
|
+
sizes: [...t],
|
|
164
|
+
indexBefore: i,
|
|
165
|
+
indexAfter: i + 1,
|
|
166
166
|
dividerElement: s
|
|
167
167
|
};
|
|
168
168
|
}
|
|
169
|
-
calculatePreviewSizes(e,
|
|
170
|
-
const { startPosition: s, sizes: n, indexBefore: a, indexAfter: o } = e,
|
|
171
|
-
let
|
|
172
|
-
if (
|
|
173
|
-
const
|
|
174
|
-
|
|
169
|
+
calculatePreviewSizes(e, t, i) {
|
|
170
|
+
const { startPosition: s, sizes: n, indexBefore: a, indexAfter: o } = e, c = i === "horizontal" ? t.x - s.x : t.y - s.y, h = [...n], r = n[a], p = n[o];
|
|
171
|
+
let u = r + c, d = p - c;
|
|
172
|
+
if (u < this.options.minPanelSize) {
|
|
173
|
+
const z = this.options.minPanelSize - u;
|
|
174
|
+
u = this.options.minPanelSize, d -= z;
|
|
175
175
|
}
|
|
176
|
-
if (
|
|
177
|
-
const
|
|
178
|
-
|
|
176
|
+
if (d < this.options.minPanelSize) {
|
|
177
|
+
const z = this.options.minPanelSize - d;
|
|
178
|
+
d = this.options.minPanelSize, u -= z;
|
|
179
179
|
}
|
|
180
|
-
return
|
|
180
|
+
return u = Math.max(u, this.options.minPanelSize), d = Math.max(d, this.options.minPanelSize), h[a] = u, h[o] = d, h;
|
|
181
181
|
}
|
|
182
182
|
setMinPanelSize(e) {
|
|
183
183
|
this.options.minPanelSize = e;
|
|
@@ -186,7 +186,16 @@ class P {
|
|
|
186
186
|
return this.options.minPanelSize;
|
|
187
187
|
}
|
|
188
188
|
}
|
|
189
|
-
|
|
189
|
+
function O(l, e) {
|
|
190
|
+
if (l.length === 0 || !Number.isFinite(e)) return null;
|
|
191
|
+
const t = l.reduce((n, a) => n + a, 0);
|
|
192
|
+
if (!(t > 0)) return null;
|
|
193
|
+
const i = Math.max(0, e);
|
|
194
|
+
if (Math.abs(i - t) < 1) return null;
|
|
195
|
+
const s = i / t;
|
|
196
|
+
return l.map((n) => n * s);
|
|
197
|
+
}
|
|
198
|
+
const L = S(`:host {
|
|
190
199
|
display: block;
|
|
191
200
|
width: 100%;
|
|
192
201
|
height: 100%;
|
|
@@ -328,10 +337,10 @@ const O = S(`:host {
|
|
|
328
337
|
transition: none !important;
|
|
329
338
|
}
|
|
330
339
|
}`);
|
|
331
|
-
let
|
|
332
|
-
class
|
|
340
|
+
let C = 0;
|
|
341
|
+
class k extends A {
|
|
333
342
|
constructor() {
|
|
334
|
-
super(), this.container = null, this.panelWrappers = [], this.dividers = [], this.slotElement = null, this.mutationObserver = null, this.containerResizeObserver = null, this.unsubscribeState = null, this.instanceId = `mp-splitter-${++
|
|
343
|
+
super(), this.container = null, this.panelWrappers = [], this.dividers = [], this.slotElement = null, this.mutationObserver = null, this.containerResizeObserver = null, this.unsubscribeState = null, this.instanceId = `mp-splitter-${++C}`, this.dividerFocusRestore = new w(() => this.shadowRoot, {
|
|
335
344
|
selector: ".divider",
|
|
336
345
|
keyOf: (e) => e.dataset.key ?? null
|
|
337
346
|
}), this.stateManager = new R(), this.resizeManager = new P(), this.inputHandler = new y({
|
|
@@ -342,7 +351,7 @@ class C extends A {
|
|
|
342
351
|
});
|
|
343
352
|
}
|
|
344
353
|
static {
|
|
345
|
-
this.styles = [
|
|
354
|
+
this.styles = [L];
|
|
346
355
|
}
|
|
347
356
|
static get observedAttributes() {
|
|
348
357
|
return [
|
|
@@ -361,37 +370,54 @@ class C extends A {
|
|
|
361
370
|
firstUpdated() {
|
|
362
371
|
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", () => {
|
|
363
372
|
this.updatePanelsFromSlot();
|
|
364
|
-
}), this.
|
|
373
|
+
}), this.attachObservers();
|
|
374
|
+
}
|
|
375
|
+
connectedCallback() {
|
|
376
|
+
super.connectedCallback(), this.container && this.attachObservers();
|
|
377
|
+
}
|
|
378
|
+
/**
|
|
379
|
+
* Observers + state subscription, plus a deferred panel rebuild so children
|
|
380
|
+
* changed while detached are picked up. Paired with disconnectedCallback.
|
|
381
|
+
*/
|
|
382
|
+
attachObservers() {
|
|
383
|
+
this.setupMutationObserver(), this.subscribeToState(), this.setupContainerResizeObserver(), requestAnimationFrame(() => {
|
|
365
384
|
this.updatePanelsFromSlot();
|
|
366
385
|
});
|
|
367
386
|
}
|
|
368
387
|
disconnectedCallback() {
|
|
369
|
-
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();
|
|
388
|
+
this.stateManager.isResizing() && this.handleResizeEnd(), 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();
|
|
370
389
|
}
|
|
371
|
-
attributeChangedCallback(e,
|
|
372
|
-
if (super.attributeChangedCallback(e,
|
|
390
|
+
attributeChangedCallback(e, t, i) {
|
|
391
|
+
if (super.attributeChangedCallback(e, t, i), t !== i)
|
|
373
392
|
switch (e) {
|
|
374
393
|
case "orientation":
|
|
375
|
-
this.stateManager.setOrientation(
|
|
376
|
-
t || "horizontal"
|
|
377
|
-
), this.updateContainerOrientation();
|
|
394
|
+
this.stateManager.setOrientation(this.orientation), this.updateContainerOrientation();
|
|
378
395
|
break;
|
|
379
396
|
case "min-panel-size":
|
|
380
|
-
const s =
|
|
397
|
+
const s = i ? parseInt(i, 10) : 50;
|
|
381
398
|
this.resizeManager.setMinPanelSize(isNaN(s) ? 50 : s);
|
|
382
399
|
break;
|
|
383
400
|
}
|
|
384
401
|
}
|
|
385
402
|
// Public API
|
|
403
|
+
/**
|
|
404
|
+
* Anything but "vertical" is horizontal. The attribute was cast straight to
|
|
405
|
+
* `Direction`, so an unknown value was reported as the orientation and added
|
|
406
|
+
* to the container as a class, matching neither layout rule.
|
|
407
|
+
*/
|
|
386
408
|
get orientation() {
|
|
387
|
-
return this.getAttribute("orientation")
|
|
409
|
+
return this.getAttribute("orientation") === "vertical" ? "vertical" : "horizontal";
|
|
388
410
|
}
|
|
389
411
|
set orientation(e) {
|
|
390
412
|
this.setAttribute("orientation", e);
|
|
391
413
|
}
|
|
414
|
+
/**
|
|
415
|
+
* The minimum panel size the resize maths enforces. Read from the resize
|
|
416
|
+
* manager, the single source of truth, so a non-numeric attribute reads
|
|
417
|
+
* back as the 50 px fallback actually in use rather than NaN.
|
|
418
|
+
*/
|
|
392
419
|
get minPanelSize() {
|
|
393
|
-
|
|
394
|
-
return e ? parseInt(e, 10) : 50;
|
|
420
|
+
return this.resizeManager.getMinPanelSize();
|
|
395
421
|
}
|
|
396
422
|
set minPanelSize(e) {
|
|
397
423
|
this.setAttribute("min-panel-size", String(e));
|
|
@@ -415,9 +441,9 @@ class C extends A {
|
|
|
415
441
|
* (Arrow{Left,Right,Up,Down}, Home, End); `fine` halves the step (matches
|
|
416
442
|
* Shift modifier on the keyboard path).
|
|
417
443
|
*/
|
|
418
|
-
resizeDividerBy(e,
|
|
444
|
+
resizeDividerBy(e, t, i = !1) {
|
|
419
445
|
const s = this.dividers[e];
|
|
420
|
-
s && this.handleResizeKey(
|
|
446
|
+
s && this.handleResizeKey(t, i, e, s);
|
|
421
447
|
}
|
|
422
448
|
setPanelSizes(e) {
|
|
423
449
|
this.applyPanelSizes(e), this.stateManager.setPanelSizes(e);
|
|
@@ -447,18 +473,18 @@ class C extends A {
|
|
|
447
473
|
*/
|
|
448
474
|
updateDividerAriaValues() {
|
|
449
475
|
if (this.dividers.length === 0 || !this.container) return;
|
|
450
|
-
const e = this.stateManager.getState(),
|
|
451
|
-
if (
|
|
452
|
-
const
|
|
476
|
+
const e = this.stateManager.getState(), t = e.previewSizes ?? e.panelSizes;
|
|
477
|
+
if (t.length !== this.panelWrappers.length || t.length === 0) return;
|
|
478
|
+
const i = this.container.getBoundingClientRect(), s = this.orientation === "horizontal" ? i.width : i.height;
|
|
453
479
|
if (s <= 0) return;
|
|
454
480
|
const n = this.resizeManager.getMinPanelSize();
|
|
455
481
|
this.dividers.forEach((a, o) => {
|
|
456
|
-
const
|
|
457
|
-
if (
|
|
458
|
-
const r = Math.round(
|
|
459
|
-
a.setAttribute("aria-valuenow", String(r)), a.setAttribute("aria-valuemin", String(
|
|
460
|
-
const
|
|
461
|
-
a.setAttribute("aria-valuetext", r + "% / " +
|
|
482
|
+
const c = t[o], h = t[o + 1];
|
|
483
|
+
if (c === void 0 || h === void 0) return;
|
|
484
|
+
const r = Math.round(c / s * 100), p = Math.round(n / s * 100), u = c + h, d = Math.round((u - n) / s * 100);
|
|
485
|
+
a.setAttribute("aria-valuenow", String(r)), a.setAttribute("aria-valuemin", String(p)), a.setAttribute("aria-valuemax", String(d));
|
|
486
|
+
const z = Math.round(h / s * 100);
|
|
487
|
+
a.setAttribute("aria-valuetext", r + "% / " + z + "%");
|
|
462
488
|
});
|
|
463
489
|
}
|
|
464
490
|
updatePanelsFromSlot() {
|
|
@@ -468,14 +494,14 @@ class C extends A {
|
|
|
468
494
|
);
|
|
469
495
|
if (e.length === 0) return;
|
|
470
496
|
this.dividerFocusRestore.capture(), this.container.innerHTML = "", this.panelWrappers = [], this.dividers = [];
|
|
471
|
-
const
|
|
497
|
+
const t = e.length, i = this.orientation === "horizontal" ? "vertical" : "horizontal";
|
|
472
498
|
e.forEach((n, a) => {
|
|
473
499
|
const o = document.createElement("div");
|
|
474
500
|
o.className = "panel-wrapper flex-grow", o.id = `${this.instanceId}-panel-${a}`;
|
|
475
|
-
const
|
|
476
|
-
if (
|
|
501
|
+
const c = document.createElement("slot"), h = `panel-${a}`;
|
|
502
|
+
if (c.name = h, n.slot = h, o.appendChild(c), this.panelWrappers.push(o), this.container.appendChild(o), a < t - 1) {
|
|
477
503
|
const r = document.createElement("div");
|
|
478
|
-
r.className = "divider", r.dataset.key = `divider-${a}`, r.setAttribute("role", "separator"), r.setAttribute("aria-orientation",
|
|
504
|
+
r.className = "divider", r.dataset.key = `divider-${a}`, r.setAttribute("role", "separator"), r.setAttribute("aria-orientation", i), r.setAttribute("tabindex", "0"), r.setAttribute(
|
|
479
505
|
"aria-controls",
|
|
480
506
|
`${this.instanceId}-panel-${a} ${this.instanceId}-panel-${a + 1}`
|
|
481
507
|
), r.setAttribute(
|
|
@@ -507,10 +533,10 @@ class C extends A {
|
|
|
507
533
|
*/
|
|
508
534
|
pinSizesFromCurrentLayout() {
|
|
509
535
|
if (this.panelWrappers.length === 0) return;
|
|
510
|
-
const e = this.orientation === "horizontal" ? "width" : "height",
|
|
511
|
-
(
|
|
536
|
+
const e = this.orientation === "horizontal" ? "width" : "height", t = this.panelWrappers.map(
|
|
537
|
+
(i) => i.getBoundingClientRect()[e]
|
|
512
538
|
);
|
|
513
|
-
|
|
539
|
+
t.every((i) => i <= 0) || (this.applyPanelSizes(t), this.stateManager.setPanelSizes(t));
|
|
514
540
|
}
|
|
515
541
|
setupContainerResizeObserver() {
|
|
516
542
|
!this.container || typeof ResizeObserver > "u" || (this.containerResizeObserver = new ResizeObserver(() => {
|
|
@@ -528,38 +554,36 @@ class C extends A {
|
|
|
528
554
|
if (!this.container || this.panelWrappers.length === 0 || this.stateManager.isResizing()) return;
|
|
529
555
|
const e = this.stateManager.getState().panelSizes;
|
|
530
556
|
if (e.length === 0 || e.length !== this.panelWrappers.length) return;
|
|
531
|
-
const
|
|
532
|
-
if (
|
|
557
|
+
const t = this.container.getBoundingClientRect(), i = this.orientation === "horizontal" ? t.width : t.height;
|
|
558
|
+
if (i <= 0) return;
|
|
533
559
|
const s = this.orientation === "horizontal" ? "width" : "height", n = this.dividers.reduce(
|
|
534
|
-
(
|
|
560
|
+
(r, p) => r + p.getBoundingClientRect()[s],
|
|
535
561
|
0
|
|
536
|
-
), a = this.orientation === "horizontal" ? "marginLeft" : "marginTop", o = this.orientation === "horizontal" ? "marginRight" : "marginBottom",
|
|
537
|
-
const
|
|
538
|
-
return
|
|
539
|
-
}, 0), h =
|
|
540
|
-
|
|
541
|
-
const m = h / r, p = e.map((l) => l * m);
|
|
542
|
-
this.applyPanelSizes(p), this.stateManager.setPanelSizes(p), this.updateDividerAriaValues();
|
|
562
|
+
), a = this.orientation === "horizontal" ? "marginLeft" : "marginTop", o = this.orientation === "horizontal" ? "marginRight" : "marginBottom", c = this.panelWrappers.reduce((r, p) => {
|
|
563
|
+
const u = getComputedStyle(p);
|
|
564
|
+
return r + parseFloat(u[a]) + parseFloat(u[o]);
|
|
565
|
+
}, 0), h = O(e, i - n - c);
|
|
566
|
+
h && (this.applyPanelSizes(h), this.stateManager.setPanelSizes(h), this.updateDividerAriaValues());
|
|
543
567
|
}
|
|
544
568
|
updateContainerOrientation() {
|
|
545
569
|
if (!this.container) return;
|
|
546
570
|
this.container.className = `splitter-container ${this.orientation}`;
|
|
547
571
|
const e = this.orientation === "horizontal" ? "vertical" : "horizontal";
|
|
548
|
-
this.dividers.forEach((
|
|
549
|
-
|
|
572
|
+
this.dividers.forEach((t) => {
|
|
573
|
+
t.setAttribute("aria-orientation", e);
|
|
550
574
|
});
|
|
551
575
|
}
|
|
552
|
-
handleResizeStart(e,
|
|
576
|
+
handleResizeStart(e, t, i) {
|
|
553
577
|
const s = this.resizeManager.computePanelSizes(
|
|
554
578
|
this.panelWrappers,
|
|
555
579
|
this.orientation
|
|
556
580
|
), n = this.resizeManager.createResizeOperation(
|
|
557
581
|
e.point,
|
|
558
582
|
s,
|
|
559
|
-
|
|
560
|
-
|
|
583
|
+
t,
|
|
584
|
+
i
|
|
561
585
|
);
|
|
562
|
-
this.stateManager.startResize(n),
|
|
586
|
+
this.stateManager.startResize(n), i.classList.add("active"), this.dispatchEvent(
|
|
563
587
|
new CustomEvent("resize-start", {
|
|
564
588
|
bubbles: !0,
|
|
565
589
|
detail: {
|
|
@@ -570,32 +594,32 @@ class C extends A {
|
|
|
570
594
|
);
|
|
571
595
|
}
|
|
572
596
|
handleResizeMove(e) {
|
|
573
|
-
const
|
|
574
|
-
if (!
|
|
575
|
-
const
|
|
576
|
-
|
|
597
|
+
const t = this.stateManager.getState();
|
|
598
|
+
if (!t.resizeOperation) return;
|
|
599
|
+
const i = this.resizeManager.calculatePreviewSizes(
|
|
600
|
+
t.resizeOperation,
|
|
577
601
|
e.point,
|
|
578
602
|
this.orientation
|
|
579
603
|
);
|
|
580
|
-
this.stateManager.updateResize(
|
|
604
|
+
this.stateManager.updateResize(i), this.applyPanelSizes(i), this.dispatchEvent(
|
|
581
605
|
new CustomEvent("resizing", {
|
|
582
606
|
bubbles: !0,
|
|
583
607
|
detail: {
|
|
584
|
-
sizes:
|
|
608
|
+
sizes: i,
|
|
585
609
|
orientation: this.orientation
|
|
586
610
|
}
|
|
587
611
|
})
|
|
588
612
|
);
|
|
589
613
|
}
|
|
590
614
|
handleResizeEnd(e) {
|
|
591
|
-
const
|
|
592
|
-
if (!
|
|
593
|
-
const
|
|
594
|
-
|
|
615
|
+
const t = this.stateManager.getState();
|
|
616
|
+
if (!t.resizeOperation) return;
|
|
617
|
+
const i = t.previewSizes || t.resizeOperation.sizes;
|
|
618
|
+
t.resizeOperation.dividerElement && t.resizeOperation.dividerElement.classList.remove("active"), this.stateManager.endResize(i), this.dispatchEvent(
|
|
595
619
|
new CustomEvent("resize-end", {
|
|
596
620
|
bubbles: !0,
|
|
597
621
|
detail: {
|
|
598
|
-
sizes:
|
|
622
|
+
sizes: i,
|
|
599
623
|
orientation: this.orientation
|
|
600
624
|
}
|
|
601
625
|
})
|
|
@@ -607,28 +631,28 @@ class C extends A {
|
|
|
607
631
|
* Fires resize-start → resize-end with the new sizes so consumers don't
|
|
608
632
|
* need to special-case keyboard vs. drag.
|
|
609
633
|
*/
|
|
610
|
-
handleResizeKey(e,
|
|
634
|
+
handleResizeKey(e, t, i, s) {
|
|
611
635
|
if (!this.container || this.panelWrappers.length === 0) return;
|
|
612
636
|
const n = [...this.stateManager.getState().panelSizes];
|
|
613
637
|
if (n.length !== this.panelWrappers.length) return;
|
|
614
|
-
const a = n[
|
|
638
|
+
const a = n[i], o = n[i + 1];
|
|
615
639
|
if (a === void 0 || o === void 0) return;
|
|
616
|
-
const
|
|
640
|
+
const c = this.container.getBoundingClientRect(), h = this.orientation === "horizontal" ? c.width : c.height;
|
|
617
641
|
if (h <= 0) return;
|
|
618
|
-
const r = this.resizeManager.getMinPanelSize(),
|
|
619
|
-
let
|
|
620
|
-
e ===
|
|
621
|
-
let
|
|
642
|
+
const r = this.resizeManager.getMinPanelSize(), p = this.orientation === "horizontal", u = p ? "ArrowRight" : "ArrowDown", d = p ? "ArrowLeft" : "ArrowUp";
|
|
643
|
+
let z = 0;
|
|
644
|
+
e === u ? z = 1 : e === d && (z = -1);
|
|
645
|
+
let m, v;
|
|
622
646
|
if (e === "Home")
|
|
623
|
-
|
|
647
|
+
m = r, v = a + o - r;
|
|
624
648
|
else if (e === "End")
|
|
625
|
-
|
|
626
|
-
else if (
|
|
627
|
-
const f = (
|
|
628
|
-
|
|
649
|
+
m = a + o - r, v = r;
|
|
650
|
+
else if (z !== 0) {
|
|
651
|
+
const f = (t ? 1 : 10) / 100 * h * z;
|
|
652
|
+
m = a + f, v = o - f, m < r ? (m = r, v = a + o - r) : v < r && (v = r, m = a + o - r);
|
|
629
653
|
} else
|
|
630
654
|
return;
|
|
631
|
-
|
|
655
|
+
m === a && v === o || (n[i] = m, n[i + 1] = v, this.applyPanelSizes(n), this.stateManager.setPanelSizes(n), this.updateDividerAriaValues(), s.classList.add("active"), queueMicrotask(() => s.classList.remove("active")), this.dispatchEvent(
|
|
632
656
|
new CustomEvent("resize-end", {
|
|
633
657
|
bubbles: !0,
|
|
634
658
|
detail: { sizes: n, orientation: this.orientation }
|
|
@@ -636,19 +660,19 @@ class C extends A {
|
|
|
636
660
|
));
|
|
637
661
|
}
|
|
638
662
|
applyPanelSizes(e) {
|
|
639
|
-
const
|
|
663
|
+
const t = this.orientation === "horizontal" ? "width" : "height", i = this.orientation === "horizontal" ? "height" : "width";
|
|
640
664
|
this.panelWrappers.forEach((s, n) => {
|
|
641
|
-
e[n] !== void 0 && (s.style[
|
|
665
|
+
e[n] !== void 0 && (s.style[t] = `${e[n]}px`, s.style[i] = "", s.classList.remove("flex-grow"));
|
|
642
666
|
});
|
|
643
667
|
}
|
|
644
668
|
}
|
|
645
|
-
typeof customElements < "u" && !customElements.get("mp-splitter") && customElements.define("mp-splitter",
|
|
669
|
+
typeof customElements < "u" && !customElements.get("mp-splitter") && customElements.define("mp-splitter", k);
|
|
646
670
|
export {
|
|
647
671
|
y as I,
|
|
648
|
-
|
|
672
|
+
k as M,
|
|
649
673
|
P as R,
|
|
650
674
|
R as S,
|
|
651
675
|
b as a,
|
|
652
676
|
g as n,
|
|
653
|
-
|
|
677
|
+
L as s
|
|
654
678
|
};
|