@mintplayer/web-components 2.12.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mintplayer/web-components",
3
- "version": "2.12.0",
3
+ "version": "2.14.0",
4
4
  "description": "Framework-agnostic Lit web components for the @mintplayer/bootstrap design system. Consumed by @mintplayer/ng-bootstrap, @mintplayer/react-bootstrap, and @mintplayer/vue-bootstrap.",
5
5
  "license": "MIT",
6
6
  "repository": {
package/ribbon/index.mjs CHANGED
@@ -1206,7 +1206,7 @@ var ae = Object.defineProperty, Z = (s, e, i, r) => {
1206
1206
  };
1207
1207
  class N extends k {
1208
1208
  constructor() {
1209
- super(...arguments), this.label = "Quick Access Toolbar", this.touchMode = "auto", this.onKeyDown = (e) => {
1209
+ super(...arguments), this.label = "Quick Access Toolbar", this.touchMode = "auto", this.lastAppliedLabel = null, this.onKeyDown = (e) => {
1210
1210
  const { key: i } = e;
1211
1211
  if (i !== "ArrowLeft" && i !== "ArrowRight" && i !== "Home" && i !== "End")
1212
1212
  return;
@@ -1282,13 +1282,17 @@ class N extends k {
1282
1282
  `;
1283
1283
  }
1284
1284
  connectedCallback() {
1285
- super.connectedCallback(), this.setAttribute("role", "toolbar"), this.hasAttribute("aria-label") || this.setAttribute("aria-label", this.label), this.addEventListener("keydown", this.onKeyDown);
1285
+ super.connectedCallback(), this.setAttribute("role", "toolbar"), this.applyLabel(), this.addEventListener("keydown", this.onKeyDown);
1286
1286
  }
1287
1287
  disconnectedCallback() {
1288
1288
  super.disconnectedCallback(), this.removeEventListener("keydown", this.onKeyDown);
1289
1289
  }
1290
1290
  updated(e) {
1291
- e.has("label") && this.setAttribute("aria-label", this.label);
1291
+ e.has("label") && this.applyLabel();
1292
+ }
1293
+ applyLabel() {
1294
+ const e = this.getAttribute("aria-label");
1295
+ e !== null && e !== this.lastAppliedLabel && e !== this.label || (this.setAttribute("aria-label", this.label), this.lastAppliedLabel = this.label);
1292
1296
  }
1293
1297
  render() {
1294
1298
  return d`
@@ -26,9 +26,20 @@ export declare class MpQuickAccessToolbar extends LitElement {
26
26
  * typically bind the same value to both for consistency.
27
27
  */
28
28
  touchMode: 'on' | 'off' | 'auto';
29
+ /**
30
+ * The last `aria-label` this element wrote itself, so it can tell its own
31
+ * value apart from a consumer's. Without it, `connectedCallback`'s
32
+ * "don't clobber" guard is dead code: `updated()` runs whenever `label` is in
33
+ * the changed set, and a Lit property with a class-field default IS in that
34
+ * set on the very first update — so a consumer's own, typically localized,
35
+ * label was replaced before the first paint. Same rule as `mp-ribbon`'s
36
+ * `applyRegionLabel`.
37
+ */
38
+ private lastAppliedLabel;
29
39
  connectedCallback(): void;
30
40
  disconnectedCallback(): void;
31
41
  updated(changed: Map<string, unknown>): void;
42
+ private applyLabel;
32
43
  render(): TemplateResult;
33
44
  private onKeyDown;
34
45
  private collectItems;
@@ -1,4 +1,4 @@
1
- import { I as t, M as s, R as r, a as n, S as i, n as l, s as p } from "../chunks/mp-splitter-LszuRDbR.mjs";
1
+ import { I as t, M as s, R as r, a as n, S as i, n as l, s as p } from "../chunks/mp-splitter-Ckn1kN4v.mjs";
2
2
  export {
3
3
  t as InputHandler,
4
4
  s as MpSplitter,
@@ -10,6 +10,15 @@ export declare class SplitterStateManager {
10
10
  private state;
11
11
  private listeners;
12
12
  constructor(initialState?: Partial<SplitterState>);
13
+ /**
14
+ * A snapshot no caller can write back through.
15
+ *
16
+ * The arrays are copied, not just the envelope: every setter here already
17
+ * copies on the way IN, and a shallow spread on the way out quietly undid
18
+ * that — a subscriber holding `panelSizes` was holding the store's own array,
19
+ * so sorting or splicing it reordered the panels with no notification to
20
+ * anyone. The asymmetry is the bug; this is the other half of it.
21
+ */
13
22
  getState(): SplitterState;
14
23
  subscribe(listener: SplitterStateListener): () => void;
15
24
  private notifyListeners;
@@ -1,179 +0,0 @@
1
- function E(t) {
2
- const s = /* @__PURE__ */ new Map(), e = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map(), i = (o, l) => {
3
- s.set(o.id, o), e.set(o.id, l);
4
- const d = o.children?.length ? o.children.map((a) => i(a, o)).reduce((a, u) => a + u, 0) : o.value ?? 0;
5
- n.set(o.id, d);
6
- const c = (o.children ?? []).filter((a) => r.get(a.id) !== void 0), h = c.map((a) => n.get(a.id) ?? 0).reduce((a, u) => a + u, 0);
7
- return r.set(
8
- o.id,
9
- o.colorValue !== void 0 ? o.colorValue : h > 0 ? c.map((a) => (r.get(a.id) ?? 0) * (n.get(a.id) ?? 0)).reduce((a, u) => a + u, 0) / h : void 0
10
- ), d;
11
- };
12
- return i(t, null), { root: t, byId: s, parents: e, values: n, colorValues: r };
13
- }
14
- function Z(t, s) {
15
- const e = (n) => n ? [...e(t.parents.get(n.id)), n] : [];
16
- return e(s);
17
- }
18
- function S(t, s) {
19
- return Z(t, s).length;
20
- }
21
- const T = (t) => !!(t.children?.length || t.hasChildren);
22
- function V(t, s) {
23
- return [...s.children ?? []].sort(
24
- (e, n) => (t.values.get(n.id) ?? 0) - (t.values.get(e.id) ?? 0)
25
- );
26
- }
27
- function q(t, s) {
28
- return s !== void 0 && t.byId.get(s) || t.root;
29
- }
30
- function F(t, s) {
31
- const e = (n) => n.children?.length ? 1 + Math.max(...n.children.map(e)) : 0;
32
- return e(q(t, s));
33
- }
34
- function U(t, s, e = {}) {
35
- const { maxDepth: n = 2, minFraction: r = 0 } = e, i = q(t, s), o = [], l = (d, c, h, a, u) => {
36
- if (a > n) return;
37
- const $ = V(t, d);
38
- if (!$.length) return;
39
- const p = $.map((m) => t.values.get(m.id) ?? 0).reduce((m, g) => m + g, 0);
40
- $.reduce((m, g, x) => {
41
- const w = p > 0 ? (t.values.get(g.id) ?? 0) / p : 1 / $.length, M = m + (h - c) * w;
42
- return M - m >= r && M > m && (o.push({
43
- node: g,
44
- x0: m,
45
- x1: M,
46
- depth: a,
47
- level: u + 1,
48
- setsize: $.length,
49
- posinset: x + 1,
50
- hasChildren: T(g)
51
- }), l(g, m, M, a + 1, u + 1)), M;
52
- }, c);
53
- };
54
- return l(i, 0, 1, 1, S(t, i)), o;
55
- }
56
- function N(t, s) {
57
- const e = t.reduce((l, d) => l + d, 0);
58
- if (e === 0 || s === 0) return 1 / 0;
59
- const n = Math.max(...t), r = Math.min(...t), i = e * e, o = s * s;
60
- return Math.max(o * n / i, i / (o * r));
61
- }
62
- function D(t, s) {
63
- const e = /* @__PURE__ */ new Map();
64
- let n = { ...s }, r = t.filter((l) => l.area > 0);
65
- const i = (l) => {
66
- const d = l.reduce((a, u) => a + u.area, 0), c = n.x1 - n.x0, h = n.y1 - n.y0;
67
- if (!(d <= 0 || c <= 0 || h <= 0))
68
- if (c >= h) {
69
- const a = d / h;
70
- l.reduce((u, $) => {
71
- const p = $.area / a;
72
- return e.set($.id, { x0: n.x0, y0: u, x1: n.x0 + a, y1: u + p }), u + p;
73
- }, n.y0), n = { ...n, x0: n.x0 + a };
74
- } else {
75
- const a = d / c;
76
- l.reduce((u, $) => {
77
- const p = $.area / a;
78
- return e.set($.id, { x0: u, y0: n.y0, x1: u + p, y1: n.y0 + a }), u + p;
79
- }, n.x0), n = { ...n, y0: n.y0 + a };
80
- }
81
- };
82
- let o = [];
83
- for (; r.length; ) {
84
- const l = Math.min(n.x1 - n.x0, n.y1 - n.y0), d = [...o, r[0]];
85
- !o.length || N(d.map((c) => c.area), l) <= N(o.map((c) => c.area), l) ? (o = d, r = r.slice(1)) : (i(o), o = []);
86
- }
87
- return i(o), e;
88
- }
89
- function W(t, s, e = {}) {
90
- const { maxDepth: n = 2, minArea: r = 0, childPadding: i = 0, childHeaderSpace: o = 0 } = e, l = q(t, s), d = [], c = (a) => {
91
- const u = {
92
- x0: a.x0 + i,
93
- y0: a.y0 + i + o,
94
- x1: a.x1 - i,
95
- y1: a.y1 - i
96
- };
97
- return u.x1 - u.x0 > 0 && u.y1 - u.y0 > 0 ? u : null;
98
- }, h = (a, u, $, p) => {
99
- if ($ > n) return;
100
- const m = $ === 1 ? u : c(u);
101
- if (!m) return;
102
- const g = V(t, a);
103
- if (!g.length) return;
104
- const x = (m.x1 - m.x0) * (m.y1 - m.y0), w = g.map((f) => t.values.get(f.id) ?? 0).reduce((f, P) => f + P, 0), M = g.map((f) => ({
105
- id: f.id,
106
- area: w > 0 ? (t.values.get(f.id) ?? 0) / w * x : x / g.length
107
- })), A = D(M, m);
108
- g.map((f, P) => ({ kid: f, i: P, r: A.get(f.id) })).filter((f) => !!f.r && (f.r.x1 - f.r.x0) * (f.r.y1 - f.r.y0) >= r).map((f) => (d.push({
109
- node: f.kid,
110
- ...f.r,
111
- depth: $,
112
- level: p + 1,
113
- setsize: g.length,
114
- posinset: f.i + 1,
115
- hasChildren: T(f.kid)
116
- }), h(f.kid, f.r, $ + 1, p + 1), f));
117
- };
118
- return h(l, { x0: 0, y0: 0, x1: 1, y1: 1 }, 1, S(t, l)), d;
119
- }
120
- const k = 2 * Math.PI, v = 1e-6, y = (t, s, e) => I(t + s * Math.sin(e)), b = (t, s, e) => I(t - s * Math.cos(e)), I = (t) => Math.round(t * 1e3) / 1e3;
121
- function z(t, s, e, n) {
122
- const r = `M ${y(t, n, 0)} ${b(s, n, 0)} A ${n} ${n} 0 1 1 ${y(t, n, Math.PI)} ${b(s, n, Math.PI)} A ${n} ${n} 0 1 1 ${y(t, n, 0)} ${b(s, n, 0)} Z`;
123
- if (e <= v) return r;
124
- const i = `M ${y(t, e, 0)} ${b(s, e, 0)} A ${e} ${e} 0 1 0 ${y(t, e, Math.PI)} ${b(s, e, Math.PI)} A ${e} ${e} 0 1 0 ${y(t, e, 0)} ${b(s, e, 0)} Z`;
125
- return `${r} ${i}`;
126
- }
127
- function j(t, s, e, n, r, i, o = {}) {
128
- const { padAngle: l = 0, ringGap: d = 1 } = o, c = Math.max(0, e), h = Math.max(c, n - d);
129
- if (h - c <= v || i - r <= v) return "";
130
- if (i - r >= k - v) return z(t, s, c, h);
131
- const a = Math.min((i - r) / 2, l) / 2, u = a > 0 ? o.padRadius ?? Math.sqrt(c * c + h * h) : 0, $ = (L) => L > v ? Math.asin(Math.min(1, u * Math.sin(a) / L)) : 0, p = (r + i) / 2, m = (L, H) => H > L ? [L, H] : [p, p + v], [g, x] = m(r + $(h), i - $(h)), w = x - g > Math.PI ? 1 : 0, M = `M ${y(t, h, g)} ${b(s, h, g)} A ${h} ${h} 0 ${w} 1 ${y(t, h, x)} ${b(s, h, x)}`;
132
- if (c <= v) return `${M} L ${I(t)} ${I(s)} Z`;
133
- const [A, f] = m(r + $(c), i - $(c)), P = f - A > Math.PI ? 1 : 0;
134
- return `${M} L ${y(t, c, f)} ${b(s, c, f)} A ${c} ${c} 0 ${P} 0 ${y(t, c, A)} ${b(s, c, A)} Z`;
135
- }
136
- function G(t, s, e) {
137
- const n = (t + s) / 2 * 360 % 360;
138
- return `rotate(${I(n - 90)}) translate(${I(e)},0) rotate(${n < 180 ? 0 : 180})`;
139
- }
140
- function K(t, s, e, n = 0.03) {
141
- return e * (s - t) > n;
142
- }
143
- function O(t) {
144
- const s = t.trim().match(/^#([0-9a-f]{3}|[0-9a-f]{6})$/i)?.[1];
145
- if (s) {
146
- const n = s.length === 3 ? [...s].map((r) => r + r).join("") : s;
147
- return [0, 2, 4].map((r) => parseInt(n.slice(r, r + 2), 16));
148
- }
149
- const e = t.trim().match(/^rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/i);
150
- if (e) return [Number(e[1]), Number(e[2]), Number(e[3])];
151
- throw new Error(`Unsupported color: "${t}" (use #rrggbb or rgb(r, g, b))`);
152
- }
153
- function R([t, s, e]) {
154
- const n = t / 255, r = s / 255, i = e / 255, o = Math.max(n, r, i), l = Math.min(n, r, i), d = (o + l) / 2;
155
- if (o === l) return { h: 0, s: 0, l: d };
156
- const c = o - l, h = d > 0.5 ? c / (2 - o - l) : c / (o + l);
157
- return { h: (o === n ? (r - i) / c + (r < i ? 6 : 0) : o === r ? (i - n) / c + 2 : (n - r) / c + 4) * 60, s: h, l: d };
158
- }
159
- function B(t, s, e, n) {
160
- const r = R(O(e)), i = R(O(n)), o = s - t;
161
- return (l) => {
162
- const d = o === 0 ? 0 : Math.min(1, Math.max(0, (l - t) / o)), c = r.h + (i.h - r.h) * d, h = r.s + (i.s - r.s) * d, a = r.l + (i.l - r.l) * d;
163
- return `hsl(${C(c)}, ${C(h * 100)}%, ${C(a * 100)}%)`;
164
- };
165
- }
166
- const C = (t) => Math.round(t * 10) / 10;
167
- export {
168
- G as a,
169
- K as b,
170
- j as c,
171
- E as d,
172
- B as e,
173
- Z as f,
174
- F as g,
175
- S as l,
176
- U as p,
177
- q as r,
178
- W as s
179
- };