@mintplayer/web-components 2.13.0 → 2.14.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.
@@ -12,8 +12,22 @@ class R {
12
12
  ...e
13
13
  };
14
14
  }
15
+ /**
16
+ * A snapshot no caller can write back through.
17
+ *
18
+ * The arrays are copied, not just the envelope: every setter here already
19
+ * copies on the way IN, and a shallow spread on the way out quietly undid
20
+ * that — a subscriber holding `panelSizes` was holding the store's own array,
21
+ * so sorting or splicing it reordered the panels with no notification to
22
+ * anyone. The asymmetry is the bug; this is the other half of it.
23
+ */
15
24
  getState() {
16
- return { ...this.state };
25
+ return {
26
+ ...this.state,
27
+ panelSizes: [...this.state.panelSizes],
28
+ previewSizes: this.state.previewSizes ? [...this.state.previewSizes] : null,
29
+ resizeOperation: this.state.resizeOperation ? { ...this.state.resizeOperation, sizes: [...this.state.resizeOperation.sizes] } : null
30
+ };
17
31
  }
18
32
  subscribe(e) {
19
33
  return this.listeners.add(e), () => {
@@ -153,8 +167,8 @@ class P {
153
167
  };
154
168
  }
155
169
  calculatePreviewSizes(e, i, t) {
156
- const { startPosition: s, sizes: n, indexBefore: a, indexAfter: o } = e, d = t === "horizontal" ? i.x - s.x : i.y - s.y, h = [...n], r = n[a], z = n[o];
157
- let p = r + d, l = z - d;
170
+ const { startPosition: s, sizes: n, indexBefore: a, indexAfter: o } = e, d = t === "horizontal" ? i.x - s.x : i.y - s.y, h = [...n], r = n[a], m = n[o];
171
+ let p = r + d, l = m - d;
158
172
  if (p < this.options.minPanelSize) {
159
173
  const c = this.options.minPanelSize - p;
160
174
  p = this.options.minPanelSize, l -= c;
@@ -172,7 +186,7 @@ class P {
172
186
  return this.options.minPanelSize;
173
187
  }
174
188
  }
175
- const L = S(`:host {
189
+ const O = S(`:host {
176
190
  display: block;
177
191
  width: 100%;
178
192
  height: 100%;
@@ -314,10 +328,10 @@ const L = S(`:host {
314
328
  transition: none !important;
315
329
  }
316
330
  }`);
317
- let O = 0;
331
+ let L = 0;
318
332
  class C extends A {
319
333
  constructor() {
320
- super(), this.container = null, this.panelWrappers = [], this.dividers = [], this.slotElement = null, this.mutationObserver = null, this.containerResizeObserver = null, this.unsubscribeState = null, this.instanceId = `mp-splitter-${++O}`, this.dividerFocusRestore = new w(() => this.shadowRoot, {
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-${++L}`, this.dividerFocusRestore = new w(() => this.shadowRoot, {
321
335
  selector: ".divider",
322
336
  keyOf: (e) => e.dataset.key ?? null
323
337
  }), this.stateManager = new R(), this.resizeManager = new P(), this.inputHandler = new y({
@@ -328,7 +342,7 @@ class C extends A {
328
342
  });
329
343
  }
330
344
  static {
331
- this.styles = [L];
345
+ this.styles = [O];
332
346
  }
333
347
  static get observedAttributes() {
334
348
  return [
@@ -441,8 +455,8 @@ class C extends A {
441
455
  this.dividers.forEach((a, o) => {
442
456
  const d = i[o], h = i[o + 1];
443
457
  if (d === void 0 || h === void 0) return;
444
- const r = Math.round(d / s * 100), z = Math.round(n / s * 100), p = d + h, l = Math.round((p - n) / s * 100);
445
- a.setAttribute("aria-valuenow", String(r)), a.setAttribute("aria-valuemin", String(z)), a.setAttribute("aria-valuemax", String(l));
458
+ const r = Math.round(d / s * 100), m = Math.round(n / s * 100), p = d + h, l = Math.round((p - n) / s * 100);
459
+ a.setAttribute("aria-valuenow", String(r)), a.setAttribute("aria-valuemin", String(m)), a.setAttribute("aria-valuemax", String(l));
446
460
  const c = Math.round(h / s * 100);
447
461
  a.setAttribute("aria-valuetext", r + "% / " + c + "%");
448
462
  });
@@ -520,11 +534,11 @@ class C extends A {
520
534
  (l, c) => l + c.getBoundingClientRect()[s],
521
535
  0
522
536
  ), a = this.orientation === "horizontal" ? "marginLeft" : "marginTop", o = this.orientation === "horizontal" ? "marginRight" : "marginBottom", d = this.panelWrappers.reduce((l, c) => {
523
- const m = getComputedStyle(c);
524
- return l + parseFloat(m[a]) + parseFloat(m[o]);
537
+ const z = getComputedStyle(c);
538
+ return l + parseFloat(z[a]) + parseFloat(z[o]);
525
539
  }, 0), h = Math.max(0, t - n - d), r = e.reduce((l, c) => l + c, 0);
526
540
  if (r <= 0 || Math.abs(h - r) < 1) return;
527
- const z = h / r, p = e.map((l) => l * z);
541
+ const m = h / r, p = e.map((l) => l * m);
528
542
  this.applyPanelSizes(p), this.stateManager.setPanelSizes(p), this.updateDividerAriaValues();
529
543
  }
530
544
  updateContainerOrientation() {
@@ -601,20 +615,20 @@ class C extends A {
601
615
  if (a === void 0 || o === void 0) return;
602
616
  const d = this.container.getBoundingClientRect(), h = this.orientation === "horizontal" ? d.width : d.height;
603
617
  if (h <= 0) return;
604
- const r = this.resizeManager.getMinPanelSize(), z = this.orientation === "horizontal", p = z ? "ArrowRight" : "ArrowDown", l = z ? "ArrowLeft" : "ArrowUp";
618
+ const r = this.resizeManager.getMinPanelSize(), m = this.orientation === "horizontal", p = m ? "ArrowRight" : "ArrowDown", l = m ? "ArrowLeft" : "ArrowUp";
605
619
  let c = 0;
606
620
  e === p ? c = 1 : e === l && (c = -1);
607
- let m, v;
621
+ let z, v;
608
622
  if (e === "Home")
609
- m = r, v = a + o - r;
623
+ z = r, v = a + o - r;
610
624
  else if (e === "End")
611
- m = a + o - r, v = r;
625
+ z = a + o - r, v = r;
612
626
  else if (c !== 0) {
613
627
  const f = (i ? 1 : 10) / 100 * h * c;
614
- m = a + f, v = o - f, m < r ? (m = r, v = a + o - r) : v < r && (v = r, m = a + o - r);
628
+ z = a + f, v = o - f, z < r ? (z = r, v = a + o - r) : v < r && (v = r, z = a + o - r);
615
629
  } else
616
630
  return;
617
- 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(
631
+ z === a && v === o || (n[t] = z, n[t + 1] = v, this.applyPanelSizes(n), this.stateManager.setPanelSizes(n), this.updateDividerAriaValues(), s.classList.add("active"), queueMicrotask(() => s.classList.remove("active")), this.dispatchEvent(
618
632
  new CustomEvent("resize-end", {
619
633
  bubbles: !0,
620
634
  detail: { sizes: n, orientation: this.orientation }
@@ -636,5 +650,5 @@ export {
636
650
  R as S,
637
651
  b as a,
638
652
  g as n,
639
- L as s
653
+ O as s
640
654
  };