@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.
Files changed (126) hide show
  1. package/accordion/index.mjs +5 -5
  2. package/calendar/index.mjs +1 -1
  3. package/carousel/index.mjs +57 -143
  4. package/charts/core/index.mjs +30 -20
  5. package/charts/core/src/attributes.d.ts +18 -0
  6. package/charts/core/src/index.d.ts +2 -0
  7. package/charts/core/src/view-window.d.ts +46 -0
  8. package/charts/hierarchy/index.mjs +245 -256
  9. package/charts/hierarchy/src/components/mp-hierarchy-chart.d.ts +1 -3
  10. package/charts/sparkline/index.mjs +27 -26
  11. package/charts/trend/index.mjs +21 -20
  12. package/checkbox/index.mjs +1 -1
  13. package/checkbox/src/components/mp-checkbox.d.ts +1 -0
  14. package/chunks/attributes-L3eKsbdy.mjs +16 -0
  15. package/chunks/color-mode-warning-71FmlzWX.mjs +13 -0
  16. package/chunks/{form-check.styles-B0pxJ6YC.mjs → form-check.styles-DqvBnspm.mjs} +24 -3
  17. package/chunks/{mp-calendar.element-CJ8-t-Zn.mjs → mp-calendar.element-BIHS9SZZ.mjs} +11 -6
  18. package/chunks/{mp-checkbox-CzwS7Y_t.mjs → mp-checkbox-zV83gILn.mjs} +44 -36
  19. package/chunks/mp-datatable-eRpl7-2V.mjs +2238 -0
  20. package/chunks/{mp-datetime-picker.element-D1CiLbHm.mjs → mp-datetime-picker.element-Cxu5-qRE.mjs} +29 -32
  21. package/chunks/{mp-pagination-Dea75mD4.mjs → mp-pagination-hGy4dL7p.mjs} +9 -4
  22. package/chunks/{mp-radio-cL46sUA0.mjs → mp-radio-BhRVNdKp.mjs} +32 -28
  23. package/chunks/{mp-select-BNrbPwN4.mjs → mp-select-CgqYFvUj.mjs} +41 -26
  24. package/chunks/{mp-splitter-Ckn1kN4v.mjs → mp-splitter-DLehrw3Y.mjs} +144 -120
  25. package/chunks/{mp-timepicker.element-COZEUIoE.mjs → mp-timepicker.element-BiB9lkgc.mjs} +58 -45
  26. package/chunks/{mp-toggle-button-eo_aTQtu.mjs → mp-toggle-button-CaS9uYLE.mjs} +26 -24
  27. package/chunks/{mp-treeview-C8iltDbq.mjs → mp-treeview-CaMTDrvY.mjs} +51 -50
  28. package/chunks/{overlay-controller-D6agzzOI.mjs → overlay-controller-BHDagokg.mjs} +130 -70
  29. package/chunks/{id-DNZVAnGC.mjs → resource.service--lqLwEqk.mjs} +144 -206
  30. package/chunks/view-window-DGvFiDnW.mjs +263 -0
  31. package/code-snippet/index.mjs +70 -66
  32. package/code-snippet/src/hljs-loaders.generated.d.ts +1 -1
  33. package/custom-elements.json +65750 -0
  34. package/datatable/index.mjs +6 -5
  35. package/datatable/src/components/column-resize.d.ts +11 -0
  36. package/datatable/src/components/mp-datatable.d.ts +206 -1
  37. package/datatable/src/index.d.ts +3 -1
  38. package/datatable/src/types/column-def.d.ts +61 -0
  39. package/datatable/src/types/filter.d.ts +138 -0
  40. package/datatable/src/types/index.d.ts +3 -2
  41. package/datatable/src/types/labels.d.ts +58 -0
  42. package/datepicker/index.mjs +10 -9
  43. package/datetime-picker/index.mjs +1 -1
  44. package/datetime-picker/src/mp-datetime-picker.element.d.ts +3 -0
  45. package/dock/index.mjs +430 -463
  46. package/dock/src/components/mint-dock-manager.element.d.ts +25 -2
  47. package/dock/src/core/resize.d.ts +60 -0
  48. package/dropdown-menu/index.mjs +4 -2
  49. package/dropdown-menu/src/components/mp-dropdown-menu.d.ts +6 -1
  50. package/dropdown-menu/src/index.d.ts +1 -1
  51. package/dropdown-menu/src/types/dropdown.d.ts +14 -1
  52. package/dropdown-menu/src/types/index.d.ts +1 -1
  53. package/file-manager/index.mjs +63 -61
  54. package/file-manager/src/components/mp-file-manager.d.ts +4 -3
  55. package/multi-range/index.mjs +56 -50
  56. package/multi-range/src/mint-multi-range.element.d.ts +4 -10
  57. package/multi-range/src/pointer-geometry.d.ts +31 -0
  58. package/navbar/index.mjs +89 -439
  59. package/overlay/index.mjs +5 -2
  60. package/overlay/src/index.d.ts +2 -0
  61. package/overlay/src/overlay-controller.d.ts +27 -14
  62. package/overlay/src/overlay-portal.d.ts +53 -0
  63. package/overlay/src/placement.d.ts +48 -0
  64. package/package.json +7 -1
  65. package/pagination/index.mjs +1 -1
  66. package/phone-input/index.mjs +44 -40
  67. package/phone-input/src/components/stack.d.ts +8 -0
  68. package/query-builder/index.mjs +418 -466
  69. package/query-builder/src/dnd/drag-controller.d.ts +12 -8
  70. package/query-builder/src/mp-query-builder.element.d.ts +5 -1
  71. package/query-builder/src/mp-query-condition.element.d.ts +1 -0
  72. package/radio/index.mjs +1 -1
  73. package/radio-group/index.mjs +1 -1
  74. package/ribbon/index.mjs +477 -498
  75. package/ribbon/src/core/band-text-color.d.ts +10 -0
  76. package/ribbon/src/core/key-tip-allocator.d.ts +10 -0
  77. package/ribbon/src/core/plan-reduce-steps.d.ts +62 -0
  78. package/ribbon/src/mp-ribbon.element.d.ts +0 -27
  79. package/scheduler/index.mjs +726 -711
  80. package/scheduler/src/components/mp-scheduler.d.ts +19 -3
  81. package/scheduler/src/drag/drag-manager.d.ts +1 -9
  82. package/scheduler/src/input/input-handler.d.ts +12 -2
  83. package/scheduler/src/utils/geometry.d.ts +39 -0
  84. package/scheduler/src/views/timeline-view.d.ts +0 -1
  85. package/scheduler-core/index.mjs +84 -71
  86. package/scheduler-core/src/services/resource.service.d.ts +0 -12
  87. package/scheduler-core/src/services/timeline.service.d.ts +0 -9
  88. package/select/index.mjs +1 -1
  89. package/select/src/components/mp-select.d.ts +1 -0
  90. package/signature-pad/index.mjs +21 -23
  91. package/signature-pad/src/canvas-point.d.ts +26 -0
  92. package/signature-pad/src/mp-signature-pad.element.d.ts +1 -7
  93. package/splitter/index.mjs +1 -1
  94. package/splitter/src/components/mp-splitter.d.ts +16 -0
  95. package/splitter/src/managers/index.d.ts +1 -0
  96. package/splitter/src/managers/rescale-panel-sizes.d.ts +14 -0
  97. package/swiper-core/index.mjs +2 -2
  98. package/theming/bs-theme-preboot.js +1 -0
  99. package/theming/color-mode.css +36 -0
  100. package/theming/index.d.ts +1 -0
  101. package/theming/index.mjs +327 -0
  102. package/theming/src/components/mp-theme-toggle.d.ts +71 -0
  103. package/theming/src/cookie.d.ts +31 -0
  104. package/theming/src/index.d.ts +5 -0
  105. package/theming/src/preboot.d.ts +1 -0
  106. package/theming/src/resolve.d.ts +36 -0
  107. package/theming/src/store.d.ts +27 -0
  108. package/theming/src/styles/theme-toggle.styles.d.ts +2 -0
  109. package/theming/src/testing/fake-broadcast-channel.d.ts +35 -0
  110. package/theming/src/toggle-modes.d.ts +23 -0
  111. package/tile-manager/index.mjs +252 -211
  112. package/tile-manager/src/components/mint-tile-manager.element.d.ts +8 -0
  113. package/tile-manager/src/utils/grid-geometry.d.ts +49 -0
  114. package/timeline/index.mjs +156 -164
  115. package/timeline/src/components/mp-timeline.d.ts +41 -7
  116. package/timepicker/index.mjs +7 -4
  117. package/timepicker/src/mp-time-list.element.d.ts +26 -0
  118. package/timepicker/src/mp-timepicker.element.d.ts +3 -0
  119. package/toggle-button/index.mjs +1 -1
  120. package/tree-select/index.mjs +21 -9
  121. package/treeview/index.mjs +1 -1
  122. package/treeview/src/components/mp-treeview.d.ts +6 -4
  123. package/chunks/color-DIeST-IS.mjs +0 -224
  124. package/chunks/mp-datatable-UJI8E73X.mjs +0 -1400
  125. package/datatable/src/styles/datatable.styles.d.ts +0 -2
  126. package/query-builder/src/mp-query-condition.element.template.d.ts +0 -2
@@ -1,8 +1,8 @@
1
- import { html as o, unsafeCSS as m, LitElement as c, nothing as u } from "lit";
1
+ import { html as o, unsafeCSS as c, LitElement as b, nothing as u } from "lit";
2
2
  o`<!-- Track + thumbs are rendered dynamically by render(). This file exists so the
3
3
  codegen-wc target produces a \`styles\` export from the sibling .scss; the
4
4
  \`template\` export it generates here is intentionally unused. -->`;
5
- const b = m(`:host {
5
+ const d = c(`:host {
6
6
  display: block;
7
7
  position: relative;
8
8
  box-sizing: border-box;
@@ -169,23 +169,40 @@ const b = m(`:host {
169
169
  transition: none;
170
170
  }
171
171
  }`);
172
- class d extends c {
172
+ function p(n, t, e, r) {
173
+ const i = r.vertical ? n.height : n.width;
174
+ if (!(i > 0)) return null;
175
+ const a = r.vertical ? n.bottom - e : r.rtl ? n.right - t : t - n.left;
176
+ return Math.min(1, Math.max(0, a / i));
177
+ }
178
+ function g(n, t) {
179
+ return n.reduce((e, r, i) => {
180
+ const a = Math.abs(n[e] - t), s = Math.abs(r - t);
181
+ return s < a ? i : s > a ? e : t > r ? i : e;
182
+ }, 0);
183
+ }
184
+ class f extends b {
173
185
  constructor() {
174
186
  super(...arguments), this.min = 0, this.max = 100, this.step = 1, this.minDistance = 0, this.orientation = "horizontal", this.disabled = !1, this.formatValue = null, this._value = null, this.dragState = null, this.trackEl = null, this.rtlDuringGesture = null, this.onThumbPointerDown = (t, e) => {
175
187
  this.disabled || this.startDrag(t, e.pointerId, e.currentTarget);
176
188
  }, this.onTrackPointerDown = (t) => {
177
- if (this.disabled || t.composedPath().some((n) => n instanceof HTMLElement && n.classList?.contains("thumb"))) return;
189
+ if (this.disabled || t.composedPath().some((s) => s instanceof HTMLElement && s.classList?.contains("thumb"))) return;
178
190
  this.rtlDuringGesture = getComputedStyle(this).direction === "rtl";
179
- const r = this.valueFromPointer(t.clientX, t.clientY), i = this.value, s = this.nearestThumbIndex(i, r);
180
- this.moveThumb(s, r) && this.dispatchValueChange();
191
+ const r = this.valueFromPointer(t.clientX, t.clientY);
192
+ if (r === null) {
193
+ this.rtlDuringGesture = null;
194
+ return;
195
+ }
196
+ const i = g(this.value, r);
197
+ this.moveThumb(i, r) && this.dispatchValueChange();
181
198
  const a = this.renderRoot.querySelector(
182
- `.thumb[data-thumb-index="${s}"]`
199
+ `.thumb[data-thumb-index="${i}"]`
183
200
  );
184
- a && this.startDrag(s, t.pointerId, a);
201
+ a && this.startDrag(i, t.pointerId, a);
185
202
  }, this.onPointerMove = (t) => {
186
203
  if (!this.dragState || t.pointerId !== this.dragState.pointerId) return;
187
204
  const e = this.valueFromPointer(t.clientX, t.clientY);
188
- this.moveThumb(this.dragState.thumbIndex, e);
205
+ e !== null && this.moveThumb(this.dragState.thumbIndex, e);
189
206
  }, this.onPointerUp = (t) => {
190
207
  if (!this.dragState || t.pointerId !== this.dragState.pointerId) return;
191
208
  const e = t.target;
@@ -197,7 +214,7 @@ class d extends c {
197
214
  }, this._thumbLabels = null;
198
215
  }
199
216
  static {
200
- this.styles = [b];
217
+ this.styles = [d];
201
218
  }
202
219
  static get observedAttributes() {
203
220
  return [
@@ -279,18 +296,21 @@ class d extends c {
279
296
  * Returns the candidate clamped between its (already-respected) neighbours.
280
297
  */
281
298
  constrainThumb(t, e, r) {
282
- const i = e > 0 ? t[e - 1] + this.minDistance : this.min, s = e < t.length - 1 ? t[e + 1] - this.minDistance : this.max;
283
- return Math.min(Math.max(r, i), s);
299
+ const i = e > 0 ? t[e - 1] + this.minDistance : this.min, a = e < t.length - 1 ? t[e + 1] - this.minDistance : this.max;
300
+ return Math.min(Math.max(r, i), a);
284
301
  }
285
- /** Map a pointer coordinate inside the track rect to a value in [min, max]. */
302
+ /**
303
+ * Map a pointer coordinate inside the track rect to a value in [min, max],
304
+ * or null when the track has no length to map onto (see pointerFraction).
305
+ */
286
306
  valueFromPointer(t, e) {
287
307
  const r = this.trackEl ?? this.renderRoot.querySelector(".track");
288
- if (!r) return this.min;
289
- const i = r.getBoundingClientRect();
290
- let s;
291
- this.isVertical() ? s = (i.bottom - e) / i.height : this.isRtl() ? s = (i.right - t) / i.width : s = (t - i.left) / i.width, s = Math.min(1, Math.max(0, s));
292
- const a = this.min + s * (this.max - this.min);
293
- return this.snapToStep(a);
308
+ if (!r) return null;
309
+ const i = p(r.getBoundingClientRect(), t, e, {
310
+ vertical: this.isVertical(),
311
+ rtl: this.isRtl()
312
+ });
313
+ return i === null ? null : this.snapToStep(this.min + i * (this.max - this.min));
294
314
  }
295
315
  /** Update one thumb in-place; emit `value-input`. Returns true if value changed. */
296
316
  moveThumb(t, e) {
@@ -311,36 +331,22 @@ class d extends c {
311
331
  startDrag(t, e, r) {
312
332
  this.disabled || (this.rtlDuringGesture === null && (this.rtlDuringGesture = getComputedStyle(this).direction === "rtl"), r.setPointerCapture(e), r.focus(), this.dragState = { thumbIndex: t, pointerId: e }, this.requestUpdate());
313
333
  }
314
- /**
315
- * Returns the index of the thumb closest to `target`. Ties (multiple thumbs
316
- * stacked at the same value) are broken by direction: clicks to the right of
317
- * the stack pick the highest-index thumb, clicks to the left pick the
318
- * lowest. Without this, a stack would always select the lowest-index thumb,
319
- * which is blocked by its higher-indexed neighbours and can't move toward
320
- * the click — the user would see no response.
321
- */
322
- nearestThumbIndex(t, e) {
323
- return t.reduce((r, i, s) => {
324
- const a = Math.abs(t[r] - e), n = Math.abs(i - e);
325
- return n < a ? s : n > a ? r : e > i ? s : r;
326
- }, 0);
327
- }
328
334
  /** Return the target value for a key press, or null if the key isn't bound. */
329
335
  keyboardTarget(t, e) {
330
- const r = this.step || 1, i = r * 10, s = this.value[t], a = !this.isVertical() && this.isRtl();
336
+ const r = this.step || 1, i = r * 10, a = this.value[t], s = !this.isVertical() && this.isRtl();
331
337
  switch (e) {
332
338
  case "ArrowRight":
333
- return s + (a ? -r : r);
339
+ return a + (s ? -r : r);
334
340
  case "ArrowLeft":
335
- return s + (a ? r : -r);
341
+ return a + (s ? r : -r);
336
342
  case "ArrowUp":
337
- return s + r;
343
+ return a + r;
338
344
  case "ArrowDown":
339
- return s - r;
345
+ return a - r;
340
346
  case "PageUp":
341
- return s + i;
347
+ return a + i;
342
348
  case "PageDown":
343
- return s - i;
349
+ return a - i;
344
350
  case "Home":
345
351
  return this.min;
346
352
  case "End":
@@ -350,9 +356,9 @@ class d extends c {
350
356
  }
351
357
  }
352
358
  render() {
353
- const t = this.value, e = this.isVertical(), r = t.slice(0, -1).map((i, s) => ({
359
+ const t = this.value, e = this.isVertical(), r = t.slice(0, -1).map((i, a) => ({
354
360
  from: this.percent(i),
355
- to: this.percent(t[s + 1])
361
+ to: this.percent(t[a + 1])
356
362
  }));
357
363
  return o`
358
364
  <div
@@ -364,7 +370,7 @@ class d extends c {
364
370
  @pointercancel=${this.onPointerUp}
365
371
  >
366
372
  ${r.map((i) => this.renderFill(i, e))}
367
- ${t.map((i, s) => this.renderThumb(i, s, e))}
373
+ ${t.map((i, a) => this.renderThumb(i, a, e))}
368
374
  </div>
369
375
  `;
370
376
  }
@@ -388,7 +394,7 @@ class d extends c {
388
394
  return r === 2 ? t === 0 ? "Minimum value" : "Maximum value" : `Value ${t + 1} of ${r}`;
389
395
  }
390
396
  renderThumb(t, e, r) {
391
- const i = this.percent(t), s = r ? `bottom: ${i}%;` : `inset-inline-start: ${i}%;`, a = this.formatThumb(t), n = this.dragState?.thumbIndex === e, h = this.formatValue ? a : null;
397
+ const i = this.percent(t), a = r ? `bottom: ${i}%;` : `inset-inline-start: ${i}%;`, s = this.formatThumb(t), h = this.dragState?.thumbIndex === e, m = this.formatValue ? s : null;
392
398
  return o`
393
399
  <button
394
400
  class="thumb"
@@ -397,18 +403,18 @@ class d extends c {
397
403
  role="slider"
398
404
  aria-label=${this.thumbName(e)}
399
405
  data-thumb-index=${e}
400
- data-dragging=${n ? "true" : "false"}
406
+ data-dragging=${h ? "true" : "false"}
401
407
  aria-valuemin=${this.min}
402
408
  aria-valuemax=${this.max}
403
409
  aria-valuenow=${t}
404
410
  aria-orientation=${this.orientation}
405
- aria-valuetext=${h ?? u}
411
+ aria-valuetext=${m ?? u}
406
412
  aria-disabled=${this.disabled ? "true" : u}
407
- style=${s}
413
+ style=${a}
408
414
  @pointerdown=${(l) => this.onThumbPointerDown(e, l)}
409
415
  @keydown=${(l) => this.onThumbKeyDown(e, l)}
410
416
  >
411
- <span class="tooltip" part="tooltip">${a}</span>
417
+ <span class="tooltip" part="tooltip">${s}</span>
412
418
  </button>
413
419
  `;
414
420
  }
@@ -417,7 +423,7 @@ class d extends c {
417
423
  return [...this.value];
418
424
  }
419
425
  }
420
- typeof customElements < "u" && !customElements.get("mp-multi-range") && customElements.define("mp-multi-range", d);
426
+ typeof customElements < "u" && !customElements.get("mp-multi-range") && customElements.define("mp-multi-range", f);
421
427
  export {
422
- d as MintMultiRangeElement
428
+ f as MintMultiRangeElement
423
429
  };
@@ -89,7 +89,10 @@ export declare class MintMultiRangeElement extends LitElement {
89
89
  * Returns the candidate clamped between its (already-respected) neighbours.
90
90
  */
91
91
  private constrainThumb;
92
- /** Map a pointer coordinate inside the track rect to a value in [min, max]. */
92
+ /**
93
+ * Map a pointer coordinate inside the track rect to a value in [min, max],
94
+ * or null when the track has no length to map onto (see pointerFraction).
95
+ */
93
96
  private valueFromPointer;
94
97
  /** Update one thumb in-place; emit `value-input`. Returns true if value changed. */
95
98
  private moveThumb;
@@ -97,15 +100,6 @@ export declare class MintMultiRangeElement extends LitElement {
97
100
  private startDrag;
98
101
  private onThumbPointerDown;
99
102
  private onTrackPointerDown;
100
- /**
101
- * Returns the index of the thumb closest to `target`. Ties (multiple thumbs
102
- * stacked at the same value) are broken by direction: clicks to the right of
103
- * the stack pick the highest-index thumb, clicks to the left pick the
104
- * lowest. Without this, a stack would always select the lowest-index thumb,
105
- * which is blocked by its higher-indexed neighbours and can't move toward
106
- * the click — the user would see no response.
107
- */
108
- private nearestThumbIndex;
109
103
  private onPointerMove;
110
104
  private onPointerUp;
111
105
  private onThumbKeyDown;
@@ -0,0 +1,31 @@
1
+ /** The parts of a track's bounding rect the pointer mapping reads. */
2
+ export interface TrackRect {
3
+ left: number;
4
+ right: number;
5
+ bottom: number;
6
+ width: number;
7
+ height: number;
8
+ }
9
+ export interface TrackAxis {
10
+ vertical: boolean;
11
+ /** Only read for a horizontal track: RTL measures from the right edge. */
12
+ rtl: boolean;
13
+ }
14
+ /**
15
+ * Where a pointer sits along the track, as a fraction in [0, 1] from the
16
+ * track's start (bottom when vertical, the inline-start edge otherwise).
17
+ * Positions past either end clamp to it.
18
+ *
19
+ * Returns null when the track has no length on its axis: an unrendered or
20
+ * collapsed track (display: none, a zero-size container) has no position to
21
+ * map to, and dividing by its zero length would turn the value into NaN.
22
+ */
23
+ export declare function pointerFraction(rect: TrackRect, clientX: number, clientY: number, axis: TrackAxis): number | null;
24
+ /**
25
+ * The index of the thumb closest to `target`. Ties (thumbs stacked on one
26
+ * value) break by side: a target above the stack picks its highest-index
27
+ * thumb, one below or on it picks the lowest. Without this a stack would
28
+ * always pick the lowest thumb, which its higher neighbours block from moving
29
+ * up toward the target, so the press would do nothing.
30
+ */
31
+ export declare function nearestThumbIndex(values: readonly number[], target: number): number;