@mintplayer/web-components 2.1.1 → 2.3.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.d.ts +1 -0
- package/accordion/index.mjs +549 -0
- package/accordion/src/components/index.d.ts +3 -0
- package/accordion/src/components/mp-accordion-tab.d.ts +30 -0
- package/accordion/src/components/mp-accordion.d.ts +66 -0
- package/accordion/src/index.d.ts +3 -0
- package/accordion/src/styles/index.d.ts +1 -0
- package/calendar/index.mjs +1 -1
- package/calendar/src/mp-calendar.element.d.ts +2 -0
- package/carousel/index.d.ts +1 -0
- package/carousel/index.mjs +994 -0
- package/carousel/src/components/index.d.ts +1 -0
- package/carousel/src/components/mp-carousel.d.ts +58 -0
- package/carousel/src/index.d.ts +3 -0
- package/carousel/src/styles/index.d.ts +1 -0
- package/carousel/src/types/carousel.d.ts +10 -0
- package/carousel/src/types/index.d.ts +1 -0
- package/checkbox/index.mjs +1 -1
- package/checkbox/src/components/mp-checkbox.d.ts +59 -1
- 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 +21 -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 +219 -132
- package/scheduler/src/components/mp-scheduler.d.ts +3 -0
- package/scheduler/src/views/base-view.d.ts +23 -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/splitter/src/index.d.ts +1 -1
- package/swiper-core/index.d.ts +1 -0
- package/swiper-core/index.mjs +184 -0
- package/swiper-core/src/index-machine.d.ts +59 -0
- package/swiper-core/src/index.d.ts +4 -0
- package/swiper-core/src/keymap.d.ts +2 -0
- package/swiper-core/src/models/index.d.ts +1 -0
- package/swiper-core/src/models/types.d.ts +99 -0
- package/swiper-core/src/pointer-arbiter.d.ts +45 -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/mp-checkbox-BokLL7BS.mjs +0 -211
- package/dropdown/src/styles/dropdown.styles.d.ts +0 -2
|
@@ -72,6 +72,7 @@ export declare class MpScheduler extends LitElement {
|
|
|
72
72
|
private updateTitle;
|
|
73
73
|
private renderView;
|
|
74
74
|
private onStateChange;
|
|
75
|
+
private previousIsLoading;
|
|
75
76
|
private detectAndEmitChanges;
|
|
76
77
|
private updateUI;
|
|
77
78
|
private scheduleDragUpdate;
|
|
@@ -92,6 +93,8 @@ export declare class MpScheduler extends LitElement {
|
|
|
92
93
|
*/
|
|
93
94
|
private handleFocusIn;
|
|
94
95
|
private handleKeyDown;
|
|
96
|
+
/** Keyboard face of the more-link / year-month-header click delegation. */
|
|
97
|
+
private activateFocusedDrillControl;
|
|
95
98
|
private getFocusedKind;
|
|
96
99
|
private handleAltShortcut;
|
|
97
100
|
private handleEventKeyDown;
|
|
@@ -84,4 +84,27 @@ export declare abstract class BaseView {
|
|
|
84
84
|
* Helper to clear container
|
|
85
85
|
*/
|
|
86
86
|
protected clearContainer(): void;
|
|
87
|
+
/**
|
|
88
|
+
* Retrofit the ARIA grid chain onto a rendered view (wc-aria PRD step 5.7):
|
|
89
|
+
* the container claims `grid`, layout-only wrappers become `presentation`
|
|
90
|
+
* so they stop breaking the chain, the header strip becomes the
|
|
91
|
+
* column-header row, and the cell groups named by `rows` become rows. The
|
|
92
|
+
* cells themselves already carry role="gridcell" + ids + roving tabindex.
|
|
93
|
+
*
|
|
94
|
+
* The mapping is pragmatic, not ideal: week/day DOM is COLUMN-major (a row
|
|
95
|
+
* here is one day's column of time cells), because the layout was built
|
|
96
|
+
* for CSS first. The cells' focus announcements carry full day+time, so
|
|
97
|
+
* navigation stays understandable.
|
|
98
|
+
*/
|
|
99
|
+
protected applyGridRoles(config: {
|
|
100
|
+
columnHeaderRow?: string;
|
|
101
|
+
columnHeaders?: string;
|
|
102
|
+
presentation?: string[];
|
|
103
|
+
rows?: string;
|
|
104
|
+
/** Extra gridcells (e.g. a per-row events overlay whose buttons need a
|
|
105
|
+
* cell to live in — rows may not own buttons directly). */
|
|
106
|
+
cells?: string;
|
|
107
|
+
}): void;
|
|
108
|
+
/** aria-current="date" on every element the views styled `.today`. */
|
|
109
|
+
protected markToday(): void;
|
|
87
110
|
}
|
package/select/index.mjs
CHANGED
|
@@ -5,10 +5,18 @@ export interface MpSelectOption {
|
|
|
5
5
|
label: string;
|
|
6
6
|
disabled?: boolean;
|
|
7
7
|
}
|
|
8
|
+
export interface MpSelectOptgroup {
|
|
9
|
+
label: string;
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
options: MpSelectOption[];
|
|
12
|
+
}
|
|
13
|
+
/** One entry of the rendered list: a plain option, or a labelled group of them. */
|
|
14
|
+
export type MpSelectItem = MpSelectOption | MpSelectOptgroup;
|
|
8
15
|
export interface SelectChangeEventDetail {
|
|
9
16
|
value: string | null;
|
|
10
17
|
values: string[];
|
|
11
18
|
}
|
|
19
|
+
declare const MpSelect_base: typeof LitElement & (new (...args: any[]) => import('@mintplayer/web-components/a11y').FormAssociatedElement);
|
|
12
20
|
/**
|
|
13
21
|
* `<mp-select>` — Bootstrap-styled native `<select>` wrapped in a Lit element.
|
|
14
22
|
*
|
|
@@ -34,7 +42,7 @@ export interface SelectChangeEventDetail {
|
|
|
34
42
|
* a `composed: true` `change` event so consumers using the native event
|
|
35
43
|
* name continue to fire.
|
|
36
44
|
*/
|
|
37
|
-
export declare class MpSelect extends
|
|
45
|
+
export declare class MpSelect extends MpSelect_base {
|
|
38
46
|
static styles: import('lit').CSSResult[];
|
|
39
47
|
static shadowRootOptions: {
|
|
40
48
|
delegatesFocus: boolean;
|
|
@@ -50,11 +58,21 @@ export declare class MpSelect extends LitElement {
|
|
|
50
58
|
private _numberVisible;
|
|
51
59
|
private _disabled;
|
|
52
60
|
private _value;
|
|
61
|
+
private _inputLabel;
|
|
62
|
+
private _errorText;
|
|
63
|
+
private readonly _errorId;
|
|
53
64
|
private _values;
|
|
54
65
|
private _options;
|
|
55
66
|
private _slotOptions;
|
|
56
67
|
private readonly _selectRef;
|
|
57
68
|
private _slotObserver;
|
|
69
|
+
/**
|
|
70
|
+
* Tier-2 naming. No `role` is passed on purpose: the inner `<select>` already
|
|
71
|
+
* carries the real role, and adding one to the host would announce the control
|
|
72
|
+
* twice. For the same reason the references are targeted at that `<select>`
|
|
73
|
+
* rather than at the host's `ElementInternals`.
|
|
74
|
+
*/
|
|
75
|
+
private readonly hostAria;
|
|
58
76
|
get size(): MpSelectSize;
|
|
59
77
|
set size(value: MpSelectSize);
|
|
60
78
|
get multiple(): boolean;
|
|
@@ -63,20 +81,59 @@ export declare class MpSelect extends LitElement {
|
|
|
63
81
|
set numberVisible(value: number | null);
|
|
64
82
|
get disabled(): boolean;
|
|
65
83
|
set disabled(value: boolean);
|
|
84
|
+
/**
|
|
85
|
+
* Accessible name for the inner `<select>`, as `inputLabel` / `input-label`.
|
|
86
|
+
*
|
|
87
|
+
* Named for where it lands rather than what it is: the value is written to the
|
|
88
|
+
* control *inside* the shadow root, not to the host. Plain `label` was rejected
|
|
89
|
+
* because `<option label>` and `<optgroup label>` are literally in play in this
|
|
90
|
+
* component's own markup, so `label` would read as one of those.
|
|
91
|
+
*
|
|
92
|
+
* This is the tier-1 naming path — always available, and the documented fallback
|
|
93
|
+
* where cross-root element references are not. `aria-labelledby` on the host is
|
|
94
|
+
* tier 2 and takes precedence, being a live reference rather than a copied
|
|
95
|
+
* string.
|
|
96
|
+
*/
|
|
97
|
+
get inputLabel(): string | null;
|
|
98
|
+
set inputLabel(value: string | null);
|
|
99
|
+
/**
|
|
100
|
+
* Validation message, as `errorText` / `error-text`. Rendered as a
|
|
101
|
+
* `.invalid-feedback` node inside the shadow root and referenced from the inner
|
|
102
|
+
* `<select>` by `aria-errormessage` **and** `aria-describedby`, but only while
|
|
103
|
+
* `invalid` is set — `aria-errormessage` is meaningless on a control that is not
|
|
104
|
+
* `aria-invalid`. Text rather than a node, for the same reason `inputLabel`
|
|
105
|
+
* exists: a consumer's own element is outside this shadow root, where an IDREF
|
|
106
|
+
* from the `<select>` cannot reach it.
|
|
107
|
+
*/
|
|
108
|
+
get errorText(): string | null;
|
|
109
|
+
set errorText(value: string | null);
|
|
66
110
|
get value(): string | null;
|
|
67
111
|
set value(value: string | null);
|
|
68
112
|
get values(): string[];
|
|
69
113
|
set values(value: string[]);
|
|
70
|
-
get options():
|
|
71
|
-
set options(value:
|
|
114
|
+
get options(): MpSelectItem[] | null;
|
|
115
|
+
set options(value: MpSelectItem[] | null);
|
|
72
116
|
attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
|
|
73
117
|
disconnectedCallback(): void;
|
|
74
118
|
render(): TemplateResult;
|
|
75
119
|
protected updated(): void;
|
|
120
|
+
private renderOption;
|
|
76
121
|
private isSelected;
|
|
122
|
+
/**
|
|
123
|
+
* Mirror slotted <option>/<optgroup> children. Optgroups previously
|
|
124
|
+
* vanished WITH ALL THEIR OPTIONS (audit Critical): the filter kept only
|
|
125
|
+
* top-level OPTION tags, so anything grouped never reached the shadow
|
|
126
|
+
* <select>.
|
|
127
|
+
*/
|
|
128
|
+
private collectSlotItems;
|
|
77
129
|
private onSlotChange;
|
|
78
130
|
private observeSlottedMutations;
|
|
79
131
|
private refreshSlotOptions;
|
|
80
132
|
private onNativeChange;
|
|
81
133
|
private reflectBoolean;
|
|
134
|
+
formValue(): string | FormData | null;
|
|
135
|
+
formReset(): void;
|
|
136
|
+
formRestore(state: string | FormData | File | null): void;
|
|
137
|
+
formValidityAnchor(): HTMLElement | null;
|
|
82
138
|
}
|
|
139
|
+
export {};
|
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';
|