@mintplayer/web-components 2.16.0 → 2.18.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-B7st6G-I.mjs → mp-datatable-CEpSxlkd.mjs} +660 -357
- package/chunks/{mp-datetime-picker.element-DsWA1AFs.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-CwaAAOcm.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-DifgO6jT.mjs → overlay-controller-BHDagokg.mjs} +96 -92
- 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 +66193 -0
- package/datatable/index.mjs +1 -1
- package/datatable/src/components/column-resize.d.ts +11 -0
- package/datatable/src/components/index.d.ts +1 -1
- package/datatable/src/components/mp-datatable.d.ts +264 -20
- package/datatable/src/index.d.ts +1 -1
- package/datatable/src/types/labels.d.ts +11 -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 +1 -1
- package/overlay/src/overlay-controller.d.ts +0 -14
- 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/query-builder/src/mp-query-condition.element.template.d.ts +0 -2
package/multi-range/index.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { html as o, unsafeCSS as
|
|
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
|
|
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
|
-
|
|
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((
|
|
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)
|
|
180
|
-
|
|
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="${
|
|
199
|
+
`.thumb[data-thumb-index="${i}"]`
|
|
183
200
|
);
|
|
184
|
-
a && this.startDrag(
|
|
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 = [
|
|
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,
|
|
283
|
-
return Math.min(Math.max(r, i),
|
|
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
|
-
/**
|
|
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
|
|
289
|
-
const i = r.getBoundingClientRect()
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
return this.snapToStep(
|
|
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,
|
|
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
|
|
339
|
+
return a + (s ? -r : r);
|
|
334
340
|
case "ArrowLeft":
|
|
335
|
-
return
|
|
341
|
+
return a + (s ? r : -r);
|
|
336
342
|
case "ArrowUp":
|
|
337
|
-
return
|
|
343
|
+
return a + r;
|
|
338
344
|
case "ArrowDown":
|
|
339
|
-
return
|
|
345
|
+
return a - r;
|
|
340
346
|
case "PageUp":
|
|
341
|
-
return
|
|
347
|
+
return a + i;
|
|
342
348
|
case "PageDown":
|
|
343
|
-
return
|
|
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,
|
|
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[
|
|
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,
|
|
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),
|
|
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=${
|
|
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=${
|
|
411
|
+
aria-valuetext=${m ?? u}
|
|
406
412
|
aria-disabled=${this.disabled ? "true" : u}
|
|
407
|
-
style=${
|
|
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">${
|
|
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",
|
|
426
|
+
typeof customElements < "u" && !customElements.get("mp-multi-range") && customElements.define("mp-multi-range", f);
|
|
421
427
|
export {
|
|
422
|
-
|
|
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
|
-
/**
|
|
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;
|