@mintplayer/web-components 2.2.0 → 2.4.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/a11y/index.mjs +26 -2
- package/a11y/src/dismiss-stack.d.ts +25 -0
- package/a11y/src/error-text.d.ts +41 -0
- package/a11y/src/focus-restore.d.ts +116 -0
- package/a11y/src/focus-trap.d.ts +69 -0
- package/a11y/src/form-associated.d.ts +48 -0
- package/a11y/src/host-aria.d.ts +154 -0
- package/a11y/src/index.d.ts +16 -0
- package/a11y/src/inert-regions.d.ts +52 -0
- package/a11y/src/live-announcer.d.ts +8 -0
- package/a11y/src/roving-focus.d.ts +118 -0
- package/a11y/src/testing/expect-idref-resolves.d.ts +31 -0
- package/a11y/src/testing/index.d.ts +1 -0
- package/accordion/index.mjs +180 -174
- package/accordion/src/components/mp-accordion.d.ts +18 -13
- package/calendar/index.mjs +1 -1
- package/calendar/src/mp-calendar.element.d.ts +2 -0
- package/carousel/index.mjs +211 -164
- package/carousel/src/components/mp-carousel.d.ts +1 -0
- package/checkbox/index.mjs +1 -1
- package/checkbox/src/components/mp-checkbox.d.ts +59 -1
- package/chunks/color-CpFtrIoX.mjs +899 -0
- package/chunks/focus-restore-DxuP1Oe2.mjs +94 -0
- package/chunks/focus-trap-DTOLJ5bb.mjs +121 -0
- package/chunks/form-associated-axmc5sY0.mjs +58 -0
- package/chunks/host-aria-WSGs7SPQ.mjs +152 -0
- package/chunks/inert-regions-DXCnn1LN.mjs +48 -0
- package/chunks/invalid-feedback.styles-he0JYrJm.mjs +11 -0
- package/chunks/{live-announcer-CZDTKulf.mjs → live-announcer-Bi0orG4n.mjs} +9 -9
- package/chunks/{mp-calendar.element-UC68iDbi.mjs → mp-calendar.element-u6uS31_j.mjs} +136 -105
- package/chunks/mp-checkbox-Ph2mMRGz.mjs +312 -0
- package/chunks/{mp-datatable-Bfw0KGkV.mjs → mp-datatable-BwTlh9A_.mjs} +265 -103
- package/chunks/{mp-pagination-BGxsawFL.mjs → mp-pagination-Dea75mD4.mjs} +25 -22
- package/chunks/mp-radio-BjW1HNSc.mjs +300 -0
- package/chunks/{mp-select-BDS1-YGn.mjs → mp-select-Ctu-v1-p.mjs} +163 -40
- package/chunks/{mp-splitter-C8cGCmac.mjs → mp-splitter-LszuRDbR.mjs} +53 -46
- package/chunks/{mp-tab-page-D1b4x-y2.mjs → mp-tab-page-CaCzX1ym.mjs} +46 -45
- package/chunks/{mp-timepicker.element-BwEiwX92.mjs → mp-timepicker.element-Bz393NDQ.mjs} +93 -86
- package/chunks/{mp-toggle-button-dLZNDUVz.mjs → mp-toggle-button-Kz6sIgBJ.mjs} +131 -37
- package/chunks/{mp-treeview-C48F63xb.mjs → mp-treeview-tkWu28iF.mjs} +67 -43
- package/chunks/overlay-controller-DPt13i8p.mjs +314 -0
- package/chunks/roving-focus-CrL9982a.mjs +129 -0
- package/code-snippet/index.mjs +21 -13
- package/code-snippet/src/mp-code-snippet.element.d.ts +6 -0
- package/datatable/index.mjs +1 -1
- package/datatable/src/components/mp-datatable.d.ts +50 -0
- package/datatable/src/types/index.d.ts +2 -0
- package/datatable/src/types/labels.d.ts +30 -0
- package/datepicker/index.mjs +45 -22
- package/datepicker/src/mp-datepicker.element.d.ts +30 -0
- package/datetime-picker/index.mjs +15 -9
- package/dock/index.mjs +365 -209
- package/dock/src/components/mint-dock-manager.element.d.ts +63 -3
- package/dropdown-menu/index.mjs +135 -90
- package/dropdown-menu/src/components/mp-dropdown-menu.d.ts +12 -3
- package/file-manager/index.mjs +279 -214
- package/file-manager/src/components/mp-file-manager.d.ts +22 -0
- package/file-manager/src/types/messages.d.ts +9 -0
- package/multi-range/index.mjs +26 -10
- package/multi-range/src/mint-multi-range.element.d.ts +7 -0
- package/navbar/index.mjs +53 -39
- package/navbar/src/components/mp-navbar.d.ts +1 -0
- package/otp-input/index.mjs +82 -48
- package/otp-input/src/mint-otp-input.element.d.ts +31 -3
- package/overlay/index.mjs +2 -258
- package/overlay/src/overlay-controller.d.ts +64 -4
- package/package.json +9 -1
- package/pagination/index.mjs +1 -1
- package/query-builder/index.mjs +117 -87
- package/query-builder/src/model/messages.d.ts +9 -0
- package/radio/index.mjs +2 -160
- package/radio/src/components/mp-radio.d.ts +58 -3
- package/radio-group/index.d.ts +1 -0
- package/radio-group/index.mjs +145 -0
- package/radio-group/src/components/mp-radio-group.d.ts +52 -0
- package/radio-group/src/index.d.ts +1 -0
- package/radio-group/src/styles/radio-group.styles.d.ts +2 -0
- package/ribbon/index.mjs +316 -304
- package/ribbon/src/mp-ribbon.element.d.ts +16 -0
- package/scheduler/index.mjs +892 -493
- package/scheduler/src/components/mp-scheduler.d.ts +30 -0
- package/scheduler/src/input/input-handler.d.ts +2 -0
- package/scheduler/src/views/base-view.d.ts +43 -6
- package/scheduler/src/views/timeline-view.d.ts +6 -0
- package/scheduler-core/index.mjs +73 -70
- package/scheduler-core/src/models/index.d.ts +1 -0
- package/scheduler-core/src/models/messages.d.ts +69 -0
- package/scheduler-core/src/models/options.d.ts +4 -0
- package/select/index.mjs +1 -1
- package/select/src/components/mp-select.d.ts +60 -3
- package/shell/index.mjs +142 -31
- package/shell/src/components/mp-shell.d.ts +1 -0
- package/signature-pad/index.d.ts +1 -0
- package/signature-pad/index.mjs +230 -0
- package/signature-pad/src/index.d.ts +2 -0
- package/signature-pad/src/mp-signature-pad.element.d.ts +143 -0
- package/signature-pad/src/mp-signature-pad.element.template.d.ts +2 -0
- package/signature-pad/src/types/signature.d.ts +12 -0
- package/splitter/index.mjs +1 -1
- package/splitter/src/components/mp-splitter.d.ts +7 -0
- package/tab-control/index.mjs +1 -1
- package/tile-manager/index.mjs +110 -93
- package/timeline/index.mjs +138 -54
- package/timeline/src/components/mp-timeline.d.ts +15 -0
- package/timepicker/index.mjs +1 -1
- package/timepicker/src/mp-time-list.element.d.ts +13 -4
- package/timepicker/src/mp-timepicker.element.d.ts +29 -0
- package/toggle-button/index.mjs +1 -1
- package/toggle-button/src/components/mp-toggle-button.d.ts +32 -1
- package/tree-select/index.mjs +233 -121
- package/tree-select/src/components/mp-tree-select.d.ts +37 -0
- package/treeview/index.mjs +1 -1
- package/treeview/src/components/mp-treeview.d.ts +10 -1
- package/chunks/color-CyamnJnn.mjs +0 -847
- package/chunks/mp-checkbox-BokLL7BS.mjs +0 -211
package/shell/index.mjs
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import { unsafeCSS as
|
|
2
|
-
const
|
|
1
|
+
import { unsafeCSS as a, LitElement as r, nothing as h, html as n } from "lit";
|
|
2
|
+
const d = a(`:host {
|
|
3
3
|
display: flex;
|
|
4
4
|
flex-direction: column;
|
|
5
5
|
position: relative;
|
|
6
6
|
--mp-shell-size: 15rem;
|
|
7
7
|
--mp-shell-open: 0;
|
|
8
|
+
--mp-shell-vis: hidden;
|
|
9
|
+
--mp-shell-vis-delay: 0.3s;
|
|
8
10
|
--mp-shell-wide: 0;
|
|
9
11
|
}
|
|
10
12
|
|
|
@@ -28,7 +30,8 @@ const h = l(`:host {
|
|
|
28
30
|
overflow-x: hidden;
|
|
29
31
|
overflow-y: auto;
|
|
30
32
|
min-block-size: 0;
|
|
31
|
-
|
|
33
|
+
visibility: var(--mp-shell-vis, visible);
|
|
34
|
+
transition: transform 0.3s ease-in-out, inline-size 0.3s ease-in-out, visibility 0s var(--mp-shell-vis-delay, 0s);
|
|
32
35
|
}
|
|
33
36
|
|
|
34
37
|
.content {
|
|
@@ -51,6 +54,26 @@ const h = l(`:host {
|
|
|
51
54
|
border: 0;
|
|
52
55
|
}
|
|
53
56
|
|
|
57
|
+
.shell-toggle:focus-visible ~ .topbar .shell-hamburger {
|
|
58
|
+
outline: 2px solid var(--bs-primary, #0d6efd);
|
|
59
|
+
outline-offset: 2px;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.skip-link {
|
|
63
|
+
position: absolute;
|
|
64
|
+
inset-block-start: 0;
|
|
65
|
+
inset-inline-start: 0;
|
|
66
|
+
z-index: 1050;
|
|
67
|
+
padding: 0.5rem 1rem;
|
|
68
|
+
background: var(--bs-body-bg, #fff);
|
|
69
|
+
color: var(--bs-body-color, #212529);
|
|
70
|
+
transform: translateY(-200%);
|
|
71
|
+
}
|
|
72
|
+
.skip-link:focus-visible {
|
|
73
|
+
transform: none;
|
|
74
|
+
outline: 2px solid var(--bs-primary, #0d6efd);
|
|
75
|
+
}
|
|
76
|
+
|
|
54
77
|
.shell-hamburger {
|
|
55
78
|
display: inline-flex;
|
|
56
79
|
align-items: center;
|
|
@@ -249,106 +272,161 @@ const h = l(`:host {
|
|
|
249
272
|
|
|
250
273
|
:host([state=show]) {
|
|
251
274
|
--mp-shell-open: 1;
|
|
275
|
+
--mp-shell-vis: visible;
|
|
276
|
+
--mp-shell-vis-delay: 0s;
|
|
252
277
|
}
|
|
253
278
|
|
|
254
279
|
:host([state=hide]) {
|
|
255
280
|
--mp-shell-open: 0;
|
|
281
|
+
--mp-shell-vis: hidden;
|
|
282
|
+
--mp-shell-vis-delay: 0.3s;
|
|
256
283
|
}
|
|
257
284
|
|
|
258
285
|
:host([breakpoint=xs]:not([state=show]):not([state=hide]):not([external-toggle])) .shell-toggle:not(:checked) ~ .sidebar-root {
|
|
259
286
|
--mp-shell-open: 0;
|
|
287
|
+
--mp-shell-vis: hidden;
|
|
288
|
+
--mp-shell-vis-delay: 0.3s;
|
|
260
289
|
}
|
|
261
290
|
:host([breakpoint=xs]:not([state=show]):not([state=hide]):not([external-toggle])) .shell-toggle:checked ~ .sidebar-root {
|
|
262
291
|
--mp-shell-open: 1;
|
|
292
|
+
--mp-shell-vis: visible;
|
|
293
|
+
--mp-shell-vis-delay: 0s;
|
|
263
294
|
}
|
|
264
295
|
|
|
265
296
|
@media (min-width: 576px) {
|
|
266
297
|
:host([breakpoint=sm]:not([state=show]):not([state=hide]):not([external-toggle])) .shell-toggle:not(:checked) ~ .sidebar-root {
|
|
267
298
|
--mp-shell-open: 1;
|
|
299
|
+
--mp-shell-vis: visible;
|
|
300
|
+
--mp-shell-vis-delay: 0s;
|
|
268
301
|
}
|
|
269
302
|
:host([breakpoint=sm]:not([state=show]):not([state=hide]):not([external-toggle])) .shell-toggle:checked ~ .sidebar-root {
|
|
270
303
|
--mp-shell-open: 0;
|
|
304
|
+
--mp-shell-vis: hidden;
|
|
305
|
+
--mp-shell-vis-delay: 0.3s;
|
|
271
306
|
}
|
|
272
307
|
}
|
|
273
308
|
@media (max-width: 575.98px) {
|
|
274
309
|
:host([breakpoint=sm]:not([state=show]):not([state=hide]):not([external-toggle])) .shell-toggle:not(:checked) ~ .sidebar-root {
|
|
275
310
|
--mp-shell-open: 0;
|
|
311
|
+
--mp-shell-vis: hidden;
|
|
312
|
+
--mp-shell-vis-delay: 0.3s;
|
|
276
313
|
}
|
|
277
314
|
:host([breakpoint=sm]:not([state=show]):not([state=hide]):not([external-toggle])) .shell-toggle:checked ~ .sidebar-root {
|
|
278
315
|
--mp-shell-open: 1;
|
|
316
|
+
--mp-shell-vis: visible;
|
|
317
|
+
--mp-shell-vis-delay: 0s;
|
|
279
318
|
}
|
|
280
319
|
}
|
|
281
320
|
|
|
282
321
|
@media (min-width: 768px) {
|
|
283
322
|
:host([breakpoint=md]:not([state=show]):not([state=hide]):not([external-toggle])) .shell-toggle:not(:checked) ~ .sidebar-root {
|
|
284
323
|
--mp-shell-open: 1;
|
|
324
|
+
--mp-shell-vis: visible;
|
|
325
|
+
--mp-shell-vis-delay: 0s;
|
|
285
326
|
}
|
|
286
327
|
:host([breakpoint=md]:not([state=show]):not([state=hide]):not([external-toggle])) .shell-toggle:checked ~ .sidebar-root {
|
|
287
328
|
--mp-shell-open: 0;
|
|
329
|
+
--mp-shell-vis: hidden;
|
|
330
|
+
--mp-shell-vis-delay: 0.3s;
|
|
288
331
|
}
|
|
289
332
|
}
|
|
290
333
|
@media (max-width: 767.98px) {
|
|
291
334
|
:host([breakpoint=md]:not([state=show]):not([state=hide]):not([external-toggle])) .shell-toggle:not(:checked) ~ .sidebar-root {
|
|
292
335
|
--mp-shell-open: 0;
|
|
336
|
+
--mp-shell-vis: hidden;
|
|
337
|
+
--mp-shell-vis-delay: 0.3s;
|
|
293
338
|
}
|
|
294
339
|
:host([breakpoint=md]:not([state=show]):not([state=hide]):not([external-toggle])) .shell-toggle:checked ~ .sidebar-root {
|
|
295
340
|
--mp-shell-open: 1;
|
|
341
|
+
--mp-shell-vis: visible;
|
|
342
|
+
--mp-shell-vis-delay: 0s;
|
|
296
343
|
}
|
|
297
344
|
}
|
|
298
345
|
|
|
299
346
|
@media (min-width: 992px) {
|
|
300
347
|
:host([breakpoint=lg]:not([state=show]):not([state=hide]):not([external-toggle])) .shell-toggle:not(:checked) ~ .sidebar-root {
|
|
301
348
|
--mp-shell-open: 1;
|
|
349
|
+
--mp-shell-vis: visible;
|
|
350
|
+
--mp-shell-vis-delay: 0s;
|
|
302
351
|
}
|
|
303
352
|
:host([breakpoint=lg]:not([state=show]):not([state=hide]):not([external-toggle])) .shell-toggle:checked ~ .sidebar-root {
|
|
304
353
|
--mp-shell-open: 0;
|
|
354
|
+
--mp-shell-vis: hidden;
|
|
355
|
+
--mp-shell-vis-delay: 0.3s;
|
|
305
356
|
}
|
|
306
357
|
}
|
|
307
358
|
@media (max-width: 991.98px) {
|
|
308
359
|
:host([breakpoint=lg]:not([state=show]):not([state=hide]):not([external-toggle])) .shell-toggle:not(:checked) ~ .sidebar-root {
|
|
309
360
|
--mp-shell-open: 0;
|
|
361
|
+
--mp-shell-vis: hidden;
|
|
362
|
+
--mp-shell-vis-delay: 0.3s;
|
|
310
363
|
}
|
|
311
364
|
:host([breakpoint=lg]:not([state=show]):not([state=hide]):not([external-toggle])) .shell-toggle:checked ~ .sidebar-root {
|
|
312
365
|
--mp-shell-open: 1;
|
|
366
|
+
--mp-shell-vis: visible;
|
|
367
|
+
--mp-shell-vis-delay: 0s;
|
|
313
368
|
}
|
|
314
369
|
}
|
|
315
370
|
|
|
316
371
|
@media (min-width: 1200px) {
|
|
317
372
|
:host([breakpoint=xl]:not([state=show]):not([state=hide]):not([external-toggle])) .shell-toggle:not(:checked) ~ .sidebar-root {
|
|
318
373
|
--mp-shell-open: 1;
|
|
374
|
+
--mp-shell-vis: visible;
|
|
375
|
+
--mp-shell-vis-delay: 0s;
|
|
319
376
|
}
|
|
320
377
|
:host([breakpoint=xl]:not([state=show]):not([state=hide]):not([external-toggle])) .shell-toggle:checked ~ .sidebar-root {
|
|
321
378
|
--mp-shell-open: 0;
|
|
379
|
+
--mp-shell-vis: hidden;
|
|
380
|
+
--mp-shell-vis-delay: 0.3s;
|
|
322
381
|
}
|
|
323
382
|
}
|
|
324
383
|
@media (max-width: 1199.98px) {
|
|
325
384
|
:host([breakpoint=xl]:not([state=show]):not([state=hide]):not([external-toggle])) .shell-toggle:not(:checked) ~ .sidebar-root {
|
|
326
385
|
--mp-shell-open: 0;
|
|
386
|
+
--mp-shell-vis: hidden;
|
|
387
|
+
--mp-shell-vis-delay: 0.3s;
|
|
327
388
|
}
|
|
328
389
|
:host([breakpoint=xl]:not([state=show]):not([state=hide]):not([external-toggle])) .shell-toggle:checked ~ .sidebar-root {
|
|
329
390
|
--mp-shell-open: 1;
|
|
391
|
+
--mp-shell-vis: visible;
|
|
392
|
+
--mp-shell-vis-delay: 0s;
|
|
330
393
|
}
|
|
331
394
|
}
|
|
332
395
|
|
|
333
396
|
@media (min-width: 1400px) {
|
|
334
397
|
:host([breakpoint=xxl]:not([state=show]):not([state=hide]):not([external-toggle])) .shell-toggle:not(:checked) ~ .sidebar-root {
|
|
335
398
|
--mp-shell-open: 1;
|
|
399
|
+
--mp-shell-vis: visible;
|
|
400
|
+
--mp-shell-vis-delay: 0s;
|
|
336
401
|
}
|
|
337
402
|
:host([breakpoint=xxl]:not([state=show]):not([state=hide]):not([external-toggle])) .shell-toggle:checked ~ .sidebar-root {
|
|
338
403
|
--mp-shell-open: 0;
|
|
404
|
+
--mp-shell-vis: hidden;
|
|
405
|
+
--mp-shell-vis-delay: 0.3s;
|
|
339
406
|
}
|
|
340
407
|
}
|
|
341
408
|
@media (max-width: 1399.98px) {
|
|
342
409
|
:host([breakpoint=xxl]:not([state=show]):not([state=hide]):not([external-toggle])) .shell-toggle:not(:checked) ~ .sidebar-root {
|
|
343
410
|
--mp-shell-open: 0;
|
|
411
|
+
--mp-shell-vis: hidden;
|
|
412
|
+
--mp-shell-vis-delay: 0.3s;
|
|
344
413
|
}
|
|
345
414
|
:host([breakpoint=xxl]:not([state=show]):not([state=hide]):not([external-toggle])) .shell-toggle:checked ~ .sidebar-root {
|
|
346
415
|
--mp-shell-open: 1;
|
|
416
|
+
--mp-shell-vis: visible;
|
|
417
|
+
--mp-shell-vis-delay: 0s;
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
@media (prefers-reduced-motion: reduce) {
|
|
422
|
+
.sidebar,
|
|
423
|
+
.content {
|
|
424
|
+
transition: none;
|
|
347
425
|
}
|
|
348
426
|
}`);
|
|
349
|
-
class p extends
|
|
427
|
+
class p extends r {
|
|
350
428
|
static {
|
|
351
|
-
this.styles = [
|
|
429
|
+
this.styles = [d];
|
|
352
430
|
}
|
|
353
431
|
static get observedAttributes() {
|
|
354
432
|
return [
|
|
@@ -363,11 +441,37 @@ class p extends a {
|
|
|
363
441
|
return this.constructor.observedAttributes.includes("defer-hydration") || this.shadowRoot?.replaceChildren(), super.createRenderRoot();
|
|
364
442
|
}
|
|
365
443
|
connectedCallback() {
|
|
366
|
-
super.connectedCallback(), this.addEventListener("click", this.#
|
|
444
|
+
super.connectedCallback(), this.setAttribute("data-js", ""), this.addEventListener("click", this.#l), typeof window < "u" && window.addEventListener("resize", this.#i);
|
|
367
445
|
}
|
|
368
446
|
disconnectedCallback() {
|
|
369
|
-
super.disconnectedCallback(), this.removeEventListener("click", this.#e);
|
|
447
|
+
super.disconnectedCallback(), this.removeEventListener("click", this.#l), typeof window < "u" && window.removeEventListener("resize", this.#i), this.#e !== null && cancelAnimationFrame(this.#e);
|
|
370
448
|
}
|
|
449
|
+
#e = null;
|
|
450
|
+
#i = () => {
|
|
451
|
+
this.#e === null && (this.#e = requestAnimationFrame(() => {
|
|
452
|
+
this.#e = null, this.#t();
|
|
453
|
+
}));
|
|
454
|
+
};
|
|
455
|
+
/**
|
|
456
|
+
* The live aria-expanded upgrade — driven by the RESOLVED visual state
|
|
457
|
+
* (#cssOpen), never the raw checkbox: in `auto` wide mode the checkbox is
|
|
458
|
+
* INVERTED (checked means closed), so mirroring `checked` would announce
|
|
459
|
+
* the opposite of the truth. Only the JS tier writes it; the static chrome
|
|
460
|
+
* keeps the honest native checkbox.
|
|
461
|
+
*/
|
|
462
|
+
#t() {
|
|
463
|
+
const e = this.toggleInput;
|
|
464
|
+
!e || !this.hasAttribute("data-js") || (e.setAttribute("role", "button"), e.setAttribute("aria-expanded", String(this.#s())));
|
|
465
|
+
}
|
|
466
|
+
firstUpdated() {
|
|
467
|
+
this.#t();
|
|
468
|
+
}
|
|
469
|
+
/** Skip link (WCAG 2.4.1): the shell is the app frame, so it owns the one
|
|
470
|
+
* bypass block an app needs. JS tier only — with no script the click could
|
|
471
|
+
* not move focus into the shadow content region. */
|
|
472
|
+
#r = (e) => {
|
|
473
|
+
e.preventDefault(), this.renderRoot?.querySelector(".content")?.focus();
|
|
474
|
+
};
|
|
371
475
|
/**
|
|
372
476
|
* Auto-close the drawer when a navigation link inside the `sidebar` slot is
|
|
373
477
|
* clicked — only when `dismiss-on-navigate` is set AND the shell is in
|
|
@@ -379,18 +483,18 @@ class p extends a {
|
|
|
379
483
|
* active path and cancel their own navigation. Opt-out (rather than opt-in)
|
|
380
484
|
* keeps the common case — every leaf link dismisses — annotation-free.
|
|
381
485
|
*/
|
|
382
|
-
#
|
|
486
|
+
#l = (e) => {
|
|
383
487
|
if (!this.hasAttribute("dismiss-on-navigate") || this.#o()) return;
|
|
384
|
-
const t = e.composedPath(),
|
|
385
|
-
if (
|
|
386
|
-
const
|
|
387
|
-
if (
|
|
388
|
-
|
|
389
|
-
(
|
|
488
|
+
const t = e.composedPath(), s = this.renderRoot?.querySelector('slot[name="sidebar"]'), l = s ? t.indexOf(s) : -1;
|
|
489
|
+
if (l < 0) return;
|
|
490
|
+
const o = t.slice(0, l);
|
|
491
|
+
if (o.some((i) => i instanceof HTMLElement && i.hasAttribute("data-no-dismiss"))) return;
|
|
492
|
+
o.some(
|
|
493
|
+
(i) => i instanceof HTMLElement && i.tagName === "A" && i.hasAttribute("href")
|
|
390
494
|
) && this.open && this.toggle(!1);
|
|
391
495
|
};
|
|
392
|
-
attributeChangedCallback(e, t,
|
|
393
|
-
super.attributeChangedCallback(e, t,
|
|
496
|
+
attributeChangedCallback(e, t, s) {
|
|
497
|
+
super.attributeChangedCallback(e, t, s), e === "size" && (s ? this.style.setProperty("--mp-shell-size", s) : this.style.removeProperty("--mp-shell-size")), e === "state" && this.#t();
|
|
394
498
|
}
|
|
395
499
|
get toggleInput() {
|
|
396
500
|
return this.renderRoot?.querySelector(".shell-toggle") ?? null;
|
|
@@ -401,13 +505,13 @@ class p extends a {
|
|
|
401
505
|
* viewport and the toggle checkbox all at once. The CSS is the single source
|
|
402
506
|
* of truth; we don't re-derive the matrix in JS.
|
|
403
507
|
*/
|
|
404
|
-
#
|
|
508
|
+
#s() {
|
|
405
509
|
if (typeof window > "u") return !1;
|
|
406
510
|
const e = this.renderRoot?.querySelector(".sidebar-root");
|
|
407
511
|
return e ? getComputedStyle(e).getPropertyValue("--mp-shell-open").trim() === "1" : !1;
|
|
408
512
|
}
|
|
409
513
|
/** An explicit `state` (`show`/`hide`) freezes the CSS checkbox. */
|
|
410
|
-
#
|
|
514
|
+
#h() {
|
|
411
515
|
const e = this.getAttribute("state");
|
|
412
516
|
return e === "show" || e === "hide";
|
|
413
517
|
}
|
|
@@ -429,24 +533,24 @@ class p extends a {
|
|
|
429
533
|
* "inverted from the responsive default": wide default = open (checked ⇒
|
|
430
534
|
* closed); narrow default = closed (checked ⇒ open).
|
|
431
535
|
*/
|
|
432
|
-
#
|
|
536
|
+
#n(e) {
|
|
433
537
|
const t = this.toggleInput;
|
|
434
538
|
t && (t.checked = this.#o() ? !e : e);
|
|
435
539
|
}
|
|
436
540
|
/** Whether the sidebar is currently (visually) open. */
|
|
437
541
|
get open() {
|
|
438
|
-
return this.#
|
|
542
|
+
return this.#s();
|
|
439
543
|
}
|
|
440
544
|
/** Programmatically open/close the sidebar. Pass a boolean to force a state. */
|
|
441
545
|
toggle(e) {
|
|
442
546
|
const t = e ?? !this.open;
|
|
443
|
-
this.#
|
|
547
|
+
this.#n(t), this.#t(), this.#a(t);
|
|
444
548
|
}
|
|
445
|
-
#
|
|
446
|
-
const e = this.#
|
|
447
|
-
this.#
|
|
549
|
+
#d = () => {
|
|
550
|
+
const e = this.#s(), t = this.#h() ? !e : e;
|
|
551
|
+
this.#n(t), this.#t(), this.#a(t);
|
|
448
552
|
};
|
|
449
|
-
#
|
|
553
|
+
#a(e) {
|
|
450
554
|
this.dispatchEvent(
|
|
451
555
|
new CustomEvent("statechange", {
|
|
452
556
|
detail: { open: e },
|
|
@@ -456,23 +560,30 @@ class p extends a {
|
|
|
456
560
|
);
|
|
457
561
|
}
|
|
458
562
|
render() {
|
|
459
|
-
|
|
563
|
+
const e = this.hasAttribute("data-js");
|
|
564
|
+
return n`
|
|
565
|
+
${e ? n`<a href="#" class="skip-link" @click=${this.#r}>Skip to content</a>` : h}
|
|
460
566
|
<input
|
|
461
567
|
type="checkbox"
|
|
462
568
|
id="mp-shell-toggle"
|
|
463
569
|
class="shell-toggle"
|
|
464
570
|
aria-label="Toggle sidebar"
|
|
465
|
-
|
|
571
|
+
aria-controls="shell-sidebar"
|
|
572
|
+
@change=${this.#d}
|
|
466
573
|
/>
|
|
467
|
-
<div class="topbar" part="topbar">
|
|
574
|
+
<div class="topbar" part="topbar" role="banner">
|
|
468
575
|
<label for="mp-shell-toggle" class="shell-hamburger" part="hamburger" title="Toggle sidebar">
|
|
469
576
|
<slot name="hamburger">☰</slot>
|
|
470
577
|
</label>
|
|
471
578
|
<slot name="topbar"></slot>
|
|
472
579
|
</div>
|
|
473
580
|
<div class="sidebar-root" part="sidebar-root">
|
|
474
|
-
<aside class="sidebar" part="sidebar" aria-label="Sidebar"><slot name="sidebar"></slot></aside>
|
|
475
|
-
|
|
581
|
+
<aside id="shell-sidebar" class="sidebar" part="sidebar" aria-label="Sidebar"><slot name="sidebar"></slot></aside>
|
|
582
|
+
<!-- tabindex=0, not -1: .content is the scroll container, and a
|
|
583
|
+
scrollable region only a mouse can reach fails WCAG 2.1.1 (axe
|
|
584
|
+
scrollable-region-focusable). The skip link's focus() target is
|
|
585
|
+
unaffected. -->
|
|
586
|
+
<div class="content" part="content" role="main" tabindex="0"><slot></slot></div>
|
|
476
587
|
</div>
|
|
477
588
|
<slot name="toggle"></slot>
|
|
478
589
|
`;
|
|
@@ -481,5 +592,5 @@ class p extends a {
|
|
|
481
592
|
customElements.get("mp-shell") || customElements.define("mp-shell", p);
|
|
482
593
|
export {
|
|
483
594
|
p as MpShell,
|
|
484
|
-
|
|
595
|
+
d as shellStyles
|
|
485
596
|
};
|
|
@@ -49,6 +49,7 @@ export declare class MpShell extends LitElement {
|
|
|
49
49
|
protected createRenderRoot(): HTMLElement | DocumentFragment;
|
|
50
50
|
connectedCallback(): void;
|
|
51
51
|
disconnectedCallback(): void;
|
|
52
|
+
protected firstUpdated(): void;
|
|
52
53
|
attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
|
|
53
54
|
private get toggleInput();
|
|
54
55
|
/** Whether the sidebar is currently (visually) open. */
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './src';
|
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
import { html as a, unsafeCSS as d, LitElement as b, nothing as p } from "lit";
|
|
2
|
+
import { query as c } from "lit/decorators.js";
|
|
3
|
+
import "lit/directives/ref.js";
|
|
4
|
+
import { H as g } from "../chunks/host-aria-WSGs7SPQ.mjs";
|
|
5
|
+
a`<!-- Rendered dynamically by render(). This file exists only so the codegen-wc
|
|
6
|
+
target emits a \`styles\` export from the sibling .scss. -->`;
|
|
7
|
+
const f = d(`:host {
|
|
8
|
+
display: inline-block;
|
|
9
|
+
max-width: 100%;
|
|
10
|
+
box-sizing: border-box;
|
|
11
|
+
border: 1px solid var(--bs-border-color, #dee2e6);
|
|
12
|
+
border-radius: var(--bs-border-radius, 0.375rem);
|
|
13
|
+
background-color: var(--bs-body-bg, #fff);
|
|
14
|
+
font-family: inherit;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
canvas {
|
|
18
|
+
display: block;
|
|
19
|
+
max-width: 100%;
|
|
20
|
+
height: auto;
|
|
21
|
+
touch-action: none;
|
|
22
|
+
cursor: crosshair;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.controls {
|
|
26
|
+
display: flex;
|
|
27
|
+
gap: 0.25rem;
|
|
28
|
+
padding: 0.25rem;
|
|
29
|
+
border-top: 1px solid var(--bs-border-color, #dee2e6);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
input.form-control {
|
|
33
|
+
flex: 1 1 auto;
|
|
34
|
+
min-width: 0;
|
|
35
|
+
padding: 0.25rem 0.5rem;
|
|
36
|
+
font-size: 0.875rem;
|
|
37
|
+
line-height: 1.5;
|
|
38
|
+
color: var(--bs-body-color, #212529);
|
|
39
|
+
background-color: var(--bs-body-bg, #fff);
|
|
40
|
+
background-clip: padding-box;
|
|
41
|
+
border: 1px solid var(--bs-border-color, #dee2e6);
|
|
42
|
+
border-radius: var(--bs-border-radius-sm, 0.25rem);
|
|
43
|
+
outline: 0;
|
|
44
|
+
}
|
|
45
|
+
input.form-control:focus {
|
|
46
|
+
border-color: var(--bs-primary, #0d6efd);
|
|
47
|
+
box-shadow: 0 0 0 0.2rem rgba(var(--bs-primary-rgb, 13, 110, 253), 0.25);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
button.control-btn {
|
|
51
|
+
flex: 0 0 auto;
|
|
52
|
+
padding: 0.25rem 0.5rem;
|
|
53
|
+
font-size: 0.875rem;
|
|
54
|
+
line-height: 1.5;
|
|
55
|
+
color: var(--bs-secondary, #6c757d);
|
|
56
|
+
background-color: transparent;
|
|
57
|
+
border: 1px solid var(--bs-secondary, #6c757d);
|
|
58
|
+
border-radius: var(--bs-border-radius-sm, 0.25rem);
|
|
59
|
+
cursor: pointer;
|
|
60
|
+
}
|
|
61
|
+
button.control-btn:hover {
|
|
62
|
+
color: #fff;
|
|
63
|
+
background-color: var(--bs-secondary, #6c757d);
|
|
64
|
+
}
|
|
65
|
+
button.control-btn:focus-visible {
|
|
66
|
+
outline: 2px solid var(--bs-primary, #0d6efd);
|
|
67
|
+
outline-offset: 2px;
|
|
68
|
+
}`);
|
|
69
|
+
var y = Object.defineProperty, u = (o, t, e, i) => {
|
|
70
|
+
for (var r = void 0, s = o.length - 1, n; s >= 0; s--)
|
|
71
|
+
(n = o[s]) && (r = n(t, e, r) || r);
|
|
72
|
+
return r && y(t, e, r), r;
|
|
73
|
+
};
|
|
74
|
+
class l extends b {
|
|
75
|
+
constructor() {
|
|
76
|
+
super(...arguments), this.width = 500, this.height = 300, this.inputLabel = null, this.typeLabel = "Type your signature", this.undoLabel = "Undo", this.clearLabel = "Clear", this.showAccessibilityToggle = !0, this.ariaLabelForRender = null, this.ariaLabelledByForSync = null, this.ariaDescribedByForSync = null, this._signature = { strokes: [] }, this._isDrawing = !1, this._context = null, this.hostAria = new g(this, {
|
|
77
|
+
referenceTarget: () => this.canvasEl ?? null
|
|
78
|
+
}), this.onPointerStart = (t) => {
|
|
79
|
+
t.preventDefault(), this._isDrawing = !0;
|
|
80
|
+
const e = this.toCanvasPoint(t);
|
|
81
|
+
this._signature.strokes.push({ points: [e] }), this._signature = { ...this._signature }, this._context && (this._context.strokeStyle = "black", this._context.beginPath(), this._context.moveTo(e.x, e.y)), this.dispatchSignatureChange();
|
|
82
|
+
}, this.onPointerMove = (t) => {
|
|
83
|
+
if (!this._isDrawing) return;
|
|
84
|
+
t.preventDefault();
|
|
85
|
+
const e = this.toCanvasPoint(t);
|
|
86
|
+
this._signature.strokes.at(-1)?.points.push(e), this._signature = { ...this._signature }, this._context && (this._context.lineTo(e.x, e.y), this._context.stroke()), this.dispatchSignatureChange();
|
|
87
|
+
}, this.onPointerEnd = (t) => {
|
|
88
|
+
this._isDrawing && (t.preventDefault(), this._isDrawing = !1);
|
|
89
|
+
}, this.onTypedInput = (t) => {
|
|
90
|
+
const e = t.target.value;
|
|
91
|
+
this._signature = { ...this._signature, text: e || void 0 }, this.redraw(), this.dispatchSignatureChange();
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
static {
|
|
95
|
+
this.styles = [f];
|
|
96
|
+
}
|
|
97
|
+
static {
|
|
98
|
+
this.properties = {
|
|
99
|
+
signature: { attribute: !1 },
|
|
100
|
+
width: { attribute: "width", type: Number, reflect: !0 },
|
|
101
|
+
height: { attribute: "height", type: Number, reflect: !0 },
|
|
102
|
+
inputLabel: { attribute: "input-label", type: String, reflect: !1 },
|
|
103
|
+
typeLabel: { attribute: "type-label", type: String, reflect: !1 },
|
|
104
|
+
undoLabel: { attribute: "undo-label", type: String, reflect: !1 },
|
|
105
|
+
clearLabel: { attribute: "clear-label", type: String, reflect: !1 },
|
|
106
|
+
// Default-true boolean: presence-style attributes cannot express "off",
|
|
107
|
+
// so the attribute takes an explicit "false" (any other value, including
|
|
108
|
+
// bare presence, means true).
|
|
109
|
+
showAccessibilityToggle: {
|
|
110
|
+
attribute: "show-accessibility-toggle",
|
|
111
|
+
converter: { fromAttribute: (t) => t !== "false" },
|
|
112
|
+
reflect: !1
|
|
113
|
+
},
|
|
114
|
+
// Not a real property; listed so a host aria-label change re-renders. The
|
|
115
|
+
// consumer's aria-label wins over inputLabel, same precedence as every
|
|
116
|
+
// other control in the library.
|
|
117
|
+
ariaLabelForRender: { attribute: "aria-label", type: String, reflect: !1 },
|
|
118
|
+
// Phantom too: reference attributes are re-resolved in updated().
|
|
119
|
+
ariaLabelledByForSync: { attribute: "aria-labelledby", type: String, reflect: !1 },
|
|
120
|
+
ariaDescribedByForSync: { attribute: "aria-describedby", type: String, reflect: !1 }
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
get signature() {
|
|
124
|
+
return this._signature;
|
|
125
|
+
}
|
|
126
|
+
set signature(t) {
|
|
127
|
+
const e = this._signature;
|
|
128
|
+
this._signature = t ?? { strokes: [] }, this.requestUpdate("signature", e);
|
|
129
|
+
}
|
|
130
|
+
connectedCallback() {
|
|
131
|
+
super.connectedCallback(), typeof window < "u" && window.addEventListener("pointerup", this.onPointerEnd);
|
|
132
|
+
}
|
|
133
|
+
disconnectedCallback() {
|
|
134
|
+
super.disconnectedCallback(), typeof window < "u" && window.removeEventListener("pointerup", this.onPointerEnd);
|
|
135
|
+
}
|
|
136
|
+
/** Focus the pad = focus its typed-signature input (the keyboard entry point). */
|
|
137
|
+
focus(t) {
|
|
138
|
+
const e = this.typedInputEl;
|
|
139
|
+
e ? e.focus(t) : super.focus(t);
|
|
140
|
+
}
|
|
141
|
+
undo() {
|
|
142
|
+
this._signature.strokes.length && (this._signature = { ...this._signature, strokes: this._signature.strokes.slice(0, -1) }, this.requestUpdate(), this.redraw(), this.dispatchSignatureChange());
|
|
143
|
+
}
|
|
144
|
+
clear() {
|
|
145
|
+
!this._signature.strokes.length && !this._signature.text || (this._signature = { strokes: [] }, this.requestUpdate(), this.redraw(), this.dispatchSignatureChange());
|
|
146
|
+
}
|
|
147
|
+
firstUpdated() {
|
|
148
|
+
this._context = this.canvasEl?.getContext("2d", { willReadFrequently: !0 }) ?? null, this.redraw();
|
|
149
|
+
}
|
|
150
|
+
updated(t) {
|
|
151
|
+
this.hostAria.syncReferences(), (t.has("signature") || t.has("width") || t.has("height")) && this.redraw();
|
|
152
|
+
}
|
|
153
|
+
/* ---- Drawing ---- */
|
|
154
|
+
/**
|
|
155
|
+
* Map a pointer event into canvas BITMAP coordinates. `offsetX/offsetY` are
|
|
156
|
+
* CSS pixels of the rendered box; when the canvas is CSS-sized (e.g.
|
|
157
|
+
* `width: 100%`) those disagree with the `width`/`height` drawing space and
|
|
158
|
+
* every stroke would land offset and stretched. Scaling by
|
|
159
|
+
* bitmap-size / rendered-rect keeps drawing correct under any CSS sizing.
|
|
160
|
+
*/
|
|
161
|
+
toCanvasPoint(t) {
|
|
162
|
+
const e = this.canvasEl;
|
|
163
|
+
if (!e) return { x: t.offsetX, y: t.offsetY };
|
|
164
|
+
const i = e.getBoundingClientRect();
|
|
165
|
+
return !i.width || !i.height ? { x: t.offsetX, y: t.offsetY } : {
|
|
166
|
+
x: (t.clientX - i.left) * (e.width / i.width),
|
|
167
|
+
y: (t.clientY - i.top) * (e.height / i.height)
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
/** Repaint the canvas from the model: every stroke, then the typed text. */
|
|
171
|
+
redraw() {
|
|
172
|
+
const t = this._context;
|
|
173
|
+
if (!t) return;
|
|
174
|
+
const { strokes: e, text: i } = this._signature;
|
|
175
|
+
t.clearRect(0, 0, this.width, this.height), t.fillStyle = "black", t.strokeStyle = "black";
|
|
176
|
+
for (const r of e) {
|
|
177
|
+
const [s, ...n] = r.points;
|
|
178
|
+
if (s) {
|
|
179
|
+
t.beginPath(), t.moveTo(s.x, s.y);
|
|
180
|
+
for (const h of n)
|
|
181
|
+
t.lineTo(h.x, h.y);
|
|
182
|
+
t.stroke();
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
i && (t.font = `${Math.min(this.height * 0.35, 64)}px "Segoe Script", "Brush Script MT", cursive`, t.textBaseline = "middle", t.fillText(i, 12, this.height / 2, this.width - 24));
|
|
186
|
+
}
|
|
187
|
+
dispatchSignatureChange() {
|
|
188
|
+
this.dispatchEvent(new CustomEvent("signature-change", {
|
|
189
|
+
detail: this._signature,
|
|
190
|
+
bubbles: !0,
|
|
191
|
+
composed: !0
|
|
192
|
+
}));
|
|
193
|
+
}
|
|
194
|
+
/* ---- Render ---- */
|
|
195
|
+
render() {
|
|
196
|
+
const t = this.getAttribute("aria-label") ?? this.inputLabel ?? "Signature pad";
|
|
197
|
+
return a`
|
|
198
|
+
<canvas
|
|
199
|
+
width=${this.width}
|
|
200
|
+
height=${this.height}
|
|
201
|
+
role="img"
|
|
202
|
+
aria-label=${t}
|
|
203
|
+
@pointerdown=${this.onPointerStart}
|
|
204
|
+
@pointermove=${this.onPointerMove}
|
|
205
|
+
></canvas>
|
|
206
|
+
<div class="controls">
|
|
207
|
+
${this.showAccessibilityToggle ? a`<input
|
|
208
|
+
class="form-control"
|
|
209
|
+
type="text"
|
|
210
|
+
aria-label=${this.typeLabel}
|
|
211
|
+
placeholder=${this.typeLabel}
|
|
212
|
+
.value=${this._signature.text ?? ""}
|
|
213
|
+
@input=${this.onTypedInput}
|
|
214
|
+
/>` : p}
|
|
215
|
+
<button type="button" class="control-btn" @click=${() => this.undo()}>${this.undoLabel}</button>
|
|
216
|
+
<button type="button" class="control-btn" @click=${() => this.clear()}>${this.clearLabel}</button>
|
|
217
|
+
</div>
|
|
218
|
+
`;
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
u([
|
|
222
|
+
c("canvas")
|
|
223
|
+
], l.prototype, "canvasEl");
|
|
224
|
+
u([
|
|
225
|
+
c("input.form-control")
|
|
226
|
+
], l.prototype, "typedInputEl");
|
|
227
|
+
typeof customElements < "u" && !customElements.get("mp-signature-pad") && customElements.define("mp-signature-pad", l);
|
|
228
|
+
export {
|
|
229
|
+
l as MpSignaturePadElement
|
|
230
|
+
};
|