@melodicdev/components 3.0.0 → 4.0.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/assets/melodic-components.js +4371 -2363
- package/assets/melodic-components.js.map +1 -1
- package/assets/melodic-components.min.js +6220 -4461
- package/lib/components/data-display/calendar-view/calendar-view-month.template.d.ts.map +1 -1
- package/lib/components/data-display/calendar-view/calendar-view-month.template.js +17 -0
- package/lib/components/data-display/calendar-view/calendar-view.component.d.ts +23 -3
- package/lib/components/data-display/calendar-view/calendar-view.component.d.ts.map +1 -1
- package/lib/components/data-display/calendar-view/calendar-view.component.js +76 -21
- package/lib/components/data-display/calendar-view/calendar-view.utils.d.ts +9 -0
- package/lib/components/data-display/calendar-view/calendar-view.utils.d.ts.map +1 -1
- package/lib/components/data-display/calendar-view/calendar-view.utils.js +68 -19
- package/lib/components/data-display/data-grid/data-grid.component.d.ts +24 -0
- package/lib/components/data-display/data-grid/data-grid.component.d.ts.map +1 -1
- package/lib/components/data-display/data-grid/data-grid.component.js +104 -31
- package/lib/components/data-display/data-grid/data-grid.template.d.ts.map +1 -1
- package/lib/components/data-display/data-grid/data-grid.template.js +3 -0
- package/lib/components/data-display/table/table.component.d.ts +7 -0
- package/lib/components/data-display/table/table.component.d.ts.map +1 -1
- package/lib/components/data-display/table/table.component.js +20 -5
- package/lib/components/data-display/table/table.template.d.ts.map +1 -1
- package/lib/components/data-display/table/table.template.js +3 -0
- package/lib/components/data-display/table-core/index.d.ts +1 -0
- package/lib/components/data-display/table-core/index.d.ts.map +1 -1
- package/lib/components/data-display/table-core/index.js +1 -0
- package/lib/components/data-display/table-core/memo.d.ts +10 -0
- package/lib/components/data-display/table-core/memo.d.ts.map +1 -0
- package/lib/components/data-display/table-core/memo.js +20 -0
- package/lib/components/feedback/alert/alert.styles.d.ts.map +1 -1
- package/lib/components/feedback/alert/alert.styles.js +25 -0
- package/lib/components/feedback/progress/progress.styles.d.ts.map +1 -1
- package/lib/components/feedback/progress/progress.styles.js +8 -3
- package/lib/components/feedback/spinner/spinner.styles.d.ts.map +1 -1
- package/lib/components/feedback/spinner/spinner.styles.js +2 -11
- package/lib/components/feedback/toast/toast-container.template.d.ts.map +1 -1
- package/lib/components/feedback/toast/toast-container.template.js +4 -0
- package/lib/components/feedback/toast/toast.component.d.ts +3 -2
- package/lib/components/feedback/toast/toast.component.d.ts.map +1 -1
- package/lib/components/feedback/toast/toast.component.js +10 -0
- package/lib/components/feedback/toast/toast.service.d.ts +26 -6
- package/lib/components/feedback/toast/toast.service.d.ts.map +1 -1
- package/lib/components/feedback/toast/toast.service.js +53 -18
- package/lib/components/feedback/toast/toast.template.js +1 -1
- package/lib/components/forms/autocomplete/autocomplete.component.d.ts +7 -0
- package/lib/components/forms/autocomplete/autocomplete.component.d.ts.map +1 -1
- package/lib/components/forms/autocomplete/autocomplete.component.js +39 -0
- package/lib/components/forms/autocomplete/autocomplete.template.d.ts.map +1 -1
- package/lib/components/forms/autocomplete/autocomplete.template.js +5 -1
- package/lib/components/forms/button-group/button-group.component.d.ts +3 -2
- package/lib/components/forms/button-group/button-group.component.d.ts.map +1 -1
- package/lib/components/forms/button-group/button-group.component.js +11 -1
- package/lib/components/forms/checkbox/checkbox.component.d.ts +4 -0
- package/lib/components/forms/checkbox/checkbox.component.d.ts.map +1 -1
- package/lib/components/forms/checkbox/checkbox.component.js +5 -1
- package/lib/components/forms/checkbox/checkbox.template.d.ts.map +1 -1
- package/lib/components/forms/checkbox/checkbox.template.js +2 -0
- package/lib/components/forms/date-picker/calendar.component.d.ts +21 -0
- package/lib/components/forms/date-picker/calendar.component.d.ts.map +1 -1
- package/lib/components/forms/date-picker/calendar.component.js +69 -2
- package/lib/components/forms/date-picker/calendar.template.d.ts.map +1 -1
- package/lib/components/forms/date-picker/calendar.template.js +6 -3
- package/lib/components/forms/date-picker/date-picker.component.d.ts +6 -0
- package/lib/components/forms/date-picker/date-picker.component.d.ts.map +1 -1
- package/lib/components/forms/date-picker/date-picker.component.js +41 -12
- package/lib/components/forms/file-upload/file-upload.component.d.ts.map +1 -1
- package/lib/components/forms/file-upload/file-upload.component.js +15 -5
- package/lib/components/forms/form-field/form-field.component.d.ts +8 -0
- package/lib/components/forms/form-field/form-field.component.d.ts.map +1 -1
- package/lib/components/forms/form-field/form-field.component.js +41 -6
- package/lib/components/forms/form-field/form-field.template.js +1 -1
- package/lib/components/forms/input/input.component.d.ts +26 -3
- package/lib/components/forms/input/input.component.d.ts.map +1 -1
- package/lib/components/forms/input/input.component.js +46 -6
- package/lib/components/forms/input/input.template.d.ts.map +1 -1
- package/lib/components/forms/input/input.template.js +9 -0
- package/lib/components/forms/radio-card-group/radio-card-group.component.d.ts +6 -0
- package/lib/components/forms/radio-card-group/radio-card-group.component.d.ts.map +1 -1
- package/lib/components/forms/radio-card-group/radio-card-group.component.js +34 -0
- package/lib/components/forms/radio-card-group/radio-card.component.d.ts +6 -0
- package/lib/components/forms/radio-card-group/radio-card.component.d.ts.map +1 -1
- package/lib/components/forms/radio-card-group/radio-card.component.js +7 -1
- package/lib/components/forms/radio-card-group/radio-card.template.js +1 -1
- package/lib/components/forms/select/select.component.d.ts +8 -0
- package/lib/components/forms/select/select.component.d.ts.map +1 -1
- package/lib/components/forms/select/select.component.js +75 -1
- package/lib/components/forms/select/select.template.d.ts.map +1 -1
- package/lib/components/forms/select/select.template.js +5 -1
- package/lib/components/forms/textarea/textarea.component.d.ts +10 -3
- package/lib/components/forms/textarea/textarea.component.d.ts.map +1 -1
- package/lib/components/forms/textarea/textarea.component.js +10 -5
- package/lib/components/forms/textarea/textarea.template.d.ts.map +1 -1
- package/lib/components/forms/textarea/textarea.template.js +2 -0
- package/lib/components/forms/time-picker/time-picker.component.d.ts +16 -0
- package/lib/components/forms/time-picker/time-picker.component.d.ts.map +1 -1
- package/lib/components/forms/time-picker/time-picker.component.js +43 -3
- package/lib/components/foundation/container/container.component.js +5 -5
- package/lib/components/foundation/container/container.styles.d.ts.map +1 -1
- package/lib/components/foundation/container/container.styles.js +10 -0
- package/lib/components/foundation/stack/stack.component.d.ts +6 -0
- package/lib/components/foundation/stack/stack.component.d.ts.map +1 -1
- package/lib/components/foundation/stack/stack.component.js +11 -5
- package/lib/components/foundation/stack/stack.styles.d.ts.map +1 -1
- package/lib/components/foundation/stack/stack.styles.js +14 -0
- package/lib/components/general/icon/icon.template.d.ts.map +1 -1
- package/lib/components/general/icon/icon.template.js +7 -1
- package/lib/components/navigation/breadcrumb/breadcrumb-item.template.d.ts.map +1 -1
- package/lib/components/navigation/breadcrumb/breadcrumb-item.template.js +2 -1
- package/lib/components/navigation/functions/match-by-route.function.d.ts +16 -0
- package/lib/components/navigation/functions/match-by-route.function.d.ts.map +1 -0
- package/lib/components/navigation/functions/match-by-route.function.js +34 -0
- package/lib/components/navigation/functions/route-link.function.d.ts +20 -0
- package/lib/components/navigation/functions/route-link.function.d.ts.map +1 -0
- package/lib/components/navigation/functions/route-link.function.js +34 -0
- package/lib/components/navigation/pagination/pagination.component.d.ts +8 -0
- package/lib/components/navigation/pagination/pagination.component.d.ts.map +1 -1
- package/lib/components/navigation/pagination/pagination.component.js +12 -2
- package/lib/components/navigation/pagination/pagination.styles.d.ts.map +1 -1
- package/lib/components/navigation/pagination/pagination.styles.js +10 -0
- package/lib/components/navigation/pagination/pagination.template.js +2 -2
- package/lib/components/navigation/sidebar/sidebar-item.template.d.ts.map +1 -1
- package/lib/components/navigation/sidebar/sidebar-item.template.js +5 -1
- package/lib/components/navigation/sidebar/sidebar.component.d.ts +12 -6
- package/lib/components/navigation/sidebar/sidebar.component.d.ts.map +1 -1
- package/lib/components/navigation/sidebar/sidebar.component.js +20 -12
- package/lib/components/navigation/sidebar/sidebar.template.d.ts.map +1 -1
- package/lib/components/navigation/sidebar/sidebar.template.js +5 -1
- package/lib/components/navigation/steps/step.component.d.ts.map +1 -1
- package/lib/components/navigation/steps/step.component.js +19 -1
- package/lib/components/navigation/steps/step.template.d.ts.map +1 -1
- package/lib/components/navigation/steps/step.template.js +6 -0
- package/lib/components/navigation/steps/steps.component.d.ts +10 -0
- package/lib/components/navigation/steps/steps.component.d.ts.map +1 -1
- package/lib/components/navigation/steps/steps.component.js +42 -9
- package/lib/components/navigation/steps/steps.template.js +9 -0
- package/lib/components/navigation/tabs/tab-panel.styles.d.ts.map +1 -1
- package/lib/components/navigation/tabs/tab-panel.styles.js +7 -2
- package/lib/components/navigation/tabs/tabs.component.d.ts +10 -0
- package/lib/components/navigation/tabs/tabs.component.d.ts.map +1 -1
- package/lib/components/navigation/tabs/tabs.component.js +36 -7
- package/lib/components/overlays/dialog/dialog-ref.class.d.ts +19 -9
- package/lib/components/overlays/dialog/dialog-ref.class.d.ts.map +1 -1
- package/lib/components/overlays/dialog/dialog-ref.class.js +37 -5
- package/lib/components/overlays/dropdown/dropdown.component.d.ts +7 -0
- package/lib/components/overlays/dropdown/dropdown.component.d.ts.map +1 -1
- package/lib/components/overlays/dropdown/dropdown.component.js +26 -11
- package/lib/components/overlays/popover/popover.component.d.ts +8 -0
- package/lib/components/overlays/popover/popover.component.d.ts.map +1 -1
- package/lib/components/overlays/popover/popover.component.js +17 -0
- package/lib/components/overlays/tooltip/tooltip.component.d.ts +6 -5
- package/lib/components/overlays/tooltip/tooltip.component.d.ts.map +1 -1
- package/lib/components/overlays/tooltip/tooltip.component.js +14 -10
- package/lib/components/sections/app-shell/app-shell.component.d.ts +13 -0
- package/lib/components/sections/app-shell/app-shell.component.d.ts.map +1 -1
- package/lib/components/sections/app-shell/app-shell.component.js +45 -1
- package/lib/components/sections/app-shell/app-shell.styles.d.ts.map +1 -1
- package/lib/components/sections/app-shell/app-shell.styles.js +15 -0
- package/lib/components/sections/app-shell/app-shell.template.d.ts.map +1 -1
- package/lib/components/sections/app-shell/app-shell.template.js +5 -0
- package/lib/components/sections/page-section/page-section.template.d.ts.map +1 -1
- package/lib/components/sections/page-section/page-section.template.js +6 -1
- package/lib/directives/tooltip.directive.d.ts.map +1 -1
- package/lib/directives/tooltip.directive.js +39 -6
- package/lib/theme/functions/apply-theme.function.d.ts +4 -1
- package/lib/theme/functions/apply-theme.function.d.ts.map +1 -1
- package/lib/theme/functions/apply-theme.function.js +20 -4
- package/lib/theme/functions/create-theme.function.js +0 -1
- package/lib/utils/accessibility/cross-root-aria.d.ts +40 -0
- package/lib/utils/accessibility/cross-root-aria.d.ts.map +1 -0
- package/lib/utils/accessibility/cross-root-aria.js +97 -0
- package/lib/utils/accessibility/index.d.ts +1 -0
- package/lib/utils/accessibility/index.d.ts.map +1 -1
- package/lib/utils/accessibility/index.js +1 -0
- package/lib/utils/directives/index.d.ts +1 -0
- package/lib/utils/directives/index.d.ts.map +1 -1
- package/lib/utils/directives/index.js +1 -0
- package/lib/utils/directives/watch-light-slots.d.ts +20 -0
- package/lib/utils/directives/watch-light-slots.d.ts.map +1 -0
- package/lib/utils/directives/watch-light-slots.js +36 -0
- package/package.json +2 -2
|
@@ -3,8 +3,8 @@ import type { IDialogConfig } from './dialog-config.interface';
|
|
|
3
3
|
export declare class DialogRef<TResult = unknown, TData = unknown> {
|
|
4
4
|
private readonly _dialogID;
|
|
5
5
|
private readonly _dialogEl;
|
|
6
|
-
private
|
|
7
|
-
private
|
|
6
|
+
private _afterOpenedCallbacks;
|
|
7
|
+
private _afterClosedCallbacks;
|
|
8
8
|
private _data;
|
|
9
9
|
private _disableClose;
|
|
10
10
|
private _pendingResult;
|
|
@@ -21,16 +21,26 @@ export declare class DialogRef<TResult = unknown, TData = unknown> {
|
|
|
21
21
|
open(): void;
|
|
22
22
|
close(result?: TResult): void;
|
|
23
23
|
/**
|
|
24
|
-
*
|
|
25
|
-
* accumulate and
|
|
24
|
+
* Run `callback` after this dialog opens — on every open, not just the next
|
|
25
|
+
* one. Multiple callbacks accumulate and run in registration order.
|
|
26
|
+
*
|
|
27
|
+
* Returns an unsubscribe function. Reach for it when the dialog is an
|
|
28
|
+
* inline `<ml-dialog>`, whose DialogRef is reused across opens: registering
|
|
29
|
+
* a new closure before each `open()` otherwise leaves every previous one
|
|
30
|
+
* attached, and they all run.
|
|
26
31
|
*/
|
|
27
|
-
afterOpened(callback: () => void): void;
|
|
32
|
+
afterOpened(callback: () => void): () => void;
|
|
28
33
|
/**
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
* invoked in registration order.
|
|
34
|
+
* Run `callback` after this dialog closes — including native dismissals
|
|
35
|
+
* (Escape / backdrop) — on every close. See `afterOpened()`.
|
|
32
36
|
*/
|
|
33
|
-
afterClosed(callback: (result: TResult | undefined) => void): void;
|
|
37
|
+
afterClosed(callback: (result: TResult | undefined) => void): () => void;
|
|
38
|
+
/**
|
|
39
|
+
* A handful of callbacks is normal; dozens means they are being registered
|
|
40
|
+
* inside the code that opens the dialog and never released — the failure
|
|
41
|
+
* this API's unsubscribe function exists to prevent.
|
|
42
|
+
*/
|
|
43
|
+
private warnOnRunawayCallbacks;
|
|
34
44
|
private onCancel;
|
|
35
45
|
private onBackdropClick;
|
|
36
46
|
private onClose;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dialog-ref.class.d.ts","sourceRoot":"","sources":["../../../../src/components/overlays/dialog/dialog-ref.class.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"dialog-ref.class.d.ts","sourceRoot":"","sources":["../../../../src/components/overlays/dialog/dialog-ref.class.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAM/D,qBAAa,SAAS,CAAC,OAAO,GAAG,OAAO,EAAE,KAAK,GAAG,OAAO;IAqBvD,OAAO,CAAC,QAAQ,CAAC,SAAS;IAC1B,OAAO,CAAC,QAAQ,CAAC,SAAS;IAjB3B,OAAO,CAAC,qBAAqB,CAAsB;IACnD,OAAO,CAAC,qBAAqB,CAAiD;IAC9E,OAAO,CAAC,KAAK,CAAoB;IACjC,OAAO,CAAC,aAAa,CAAS;IAC9B,OAAO,CAAC,cAAc,CAAsB;IAG5C,OAAO,CAAC,cAAc,CAAS;IAG/B,OAAO,CAAC,kBAAkB,CAAS;IACnC,OAAO,CAAC,QAAQ,CAAC,aAAa,CAA4B;IAC1D,OAAO,CAAC,QAAQ,CAAC,oBAAoB,CAAmC;IACxE,OAAO,CAAC,QAAQ,CAAC,YAAY,CAA2B;gBAGtC,SAAS,EAAE,QAAQ,EACnB,SAAS,EAAE,iBAAiB;IAS9C,IAAW,QAAQ,IAAI,QAAQ,CAE9B;IAED,IAAW,IAAI,IAAI,KAAK,GAAG,SAAS,CAEnC;IAED,IAAW,YAAY,IAAI,OAAO,CAEjC;IAEM,WAAW,CAAC,MAAM,EAAE,aAAa,CAAC,KAAK,CAAC,GAAG,IAAI;IAyB/C,IAAI,IAAI,IAAI;IASZ,KAAK,CAAC,MAAM,CAAC,EAAE,OAAO,GAAG,IAAI;IAWpC;;;;;;;;OAQG;IACI,WAAW,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,MAAM,IAAI;IASpD;;;OAGG;IACI,WAAW,CAAC,QAAQ,EAAE,CAAC,MAAM,EAAE,OAAO,GAAG,SAAS,KAAK,IAAI,GAAG,MAAM,IAAI;IAS/E;;;;OAIG;IACH,OAAO,CAAC,sBAAsB;IAa9B,OAAO,CAAC,QAAQ;IAMhB,OAAO,CAAC,eAAe;IAMvB,OAAO,CAAC,OAAO;IAIf,OAAO,CAAC,YAAY;IAiBpB,OAAO,CAAC,0BAA0B;CAelC"}
|
|
@@ -1,7 +1,14 @@
|
|
|
1
|
+
import { devWarn } from '@melodicdev/core';
|
|
2
|
+
/** Registered-callback count at which the accumulation warning fires. */
|
|
3
|
+
const RUNAWAY_CALLBACK_COUNT = 20;
|
|
1
4
|
export class DialogRef {
|
|
2
5
|
constructor(_dialogID, _dialogEl) {
|
|
3
6
|
this._dialogID = _dialogID;
|
|
4
7
|
this._dialogEl = _dialogEl;
|
|
8
|
+
// Persistent: one registration fires on EVERY open/close cycle. An inline
|
|
9
|
+
// <ml-dialog> keeps the same DialogRef across opens, so a caller that
|
|
10
|
+
// registers a fresh closure before each open piles them up — hence the
|
|
11
|
+
// returned unsubscribe function, and the dev warning below.
|
|
5
12
|
this._afterOpenedCallbacks = [];
|
|
6
13
|
this._afterClosedCallbacks = [];
|
|
7
14
|
this._disableClose = false;
|
|
@@ -67,19 +74,44 @@ export class DialogRef {
|
|
|
67
74
|
this.notifyClosed();
|
|
68
75
|
}
|
|
69
76
|
/**
|
|
70
|
-
*
|
|
71
|
-
* accumulate and
|
|
77
|
+
* Run `callback` after this dialog opens — on every open, not just the next
|
|
78
|
+
* one. Multiple callbacks accumulate and run in registration order.
|
|
79
|
+
*
|
|
80
|
+
* Returns an unsubscribe function. Reach for it when the dialog is an
|
|
81
|
+
* inline `<ml-dialog>`, whose DialogRef is reused across opens: registering
|
|
82
|
+
* a new closure before each `open()` otherwise leaves every previous one
|
|
83
|
+
* attached, and they all run.
|
|
72
84
|
*/
|
|
73
85
|
afterOpened(callback) {
|
|
74
86
|
this._afterOpenedCallbacks.push(callback);
|
|
87
|
+
this.warnOnRunawayCallbacks('afterOpened', this._afterOpenedCallbacks.length);
|
|
88
|
+
return () => {
|
|
89
|
+
this._afterOpenedCallbacks = this._afterOpenedCallbacks.filter((entry) => entry !== callback);
|
|
90
|
+
};
|
|
75
91
|
}
|
|
76
92
|
/**
|
|
77
|
-
*
|
|
78
|
-
*
|
|
79
|
-
* invoked in registration order.
|
|
93
|
+
* Run `callback` after this dialog closes — including native dismissals
|
|
94
|
+
* (Escape / backdrop) — on every close. See `afterOpened()`.
|
|
80
95
|
*/
|
|
81
96
|
afterClosed(callback) {
|
|
82
97
|
this._afterClosedCallbacks.push(callback);
|
|
98
|
+
this.warnOnRunawayCallbacks('afterClosed', this._afterClosedCallbacks.length);
|
|
99
|
+
return () => {
|
|
100
|
+
this._afterClosedCallbacks = this._afterClosedCallbacks.filter((entry) => entry !== callback);
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* A handful of callbacks is normal; dozens means they are being registered
|
|
105
|
+
* inside the code that opens the dialog and never released — the failure
|
|
106
|
+
* this API's unsubscribe function exists to prevent.
|
|
107
|
+
*/
|
|
108
|
+
warnOnRunawayCallbacks(method, count) {
|
|
109
|
+
if (count !== RUNAWAY_CALLBACK_COUNT) {
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
devWarn(`dialog-ref-callbacks:${method}`, `DialogRef.${method}() has ${count} registered callbacks on one dialog. ` +
|
|
113
|
+
'They all run on every open/close. If you are registering inside the code that opens the dialog, ' +
|
|
114
|
+
'call the unsubscribe function it returns (or register once, outside).');
|
|
83
115
|
}
|
|
84
116
|
onCancel(event) {
|
|
85
117
|
if (this._disableClose) {
|
|
@@ -54,6 +54,13 @@ export declare class DropdownComponent implements IElementRef, OnCreate, OnDestr
|
|
|
54
54
|
private returnFocusToTrigger;
|
|
55
55
|
/** First element assigned to the trigger slot (light DOM). */
|
|
56
56
|
private getAssignedTrigger;
|
|
57
|
+
/**
|
|
58
|
+
* The element that actually receives focus for the slotted trigger. For
|
|
59
|
+
* `<ml-button>` that is the `<button>` inside its shadow root; ARIA set on
|
|
60
|
+
* the host is not announced, which made the documented example
|
|
61
|
+
* inaccessible.
|
|
62
|
+
*/
|
|
63
|
+
private getTriggerControl;
|
|
57
64
|
/** Keep the slotted trigger's menu-button ARIA in sync with open state. */
|
|
58
65
|
private readonly syncTriggerAria;
|
|
59
66
|
/** True when the (deep) focused element is inside this dropdown. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dropdown.component.d.ts","sourceRoot":"","sources":["../../../../src/components/overlays/dropdown/dropdown.component.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACzE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"dropdown.component.d.ts","sourceRoot":"","sources":["../../../../src/components/overlays/dropdown/dropdown.component.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACzE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAUzD;;;;;;;;;;;;;;;;;GAiBG;AACH,qBAMa,iBAAkB,YAAW,WAAW,EAAE,QAAQ,EAAE,SAAS;IAClE,UAAU,EAAG,WAAW,CAAC;IAEhC,yCAAyC;IAClC,SAAS,EAAE,SAAS,CAAkB;IAE7C,yCAAyC;IAClC,MAAM,SAAK;IAElB,qCAAqC;IAC9B,KAAK,UAAS;IAErB,yBAAyB;IAClB,MAAM,UAAS;IAEtB,OAAO,CAAC,aAAa,CAAM;IAC3B,OAAO,CAAC,QAAQ,CAAC,WAAW,CAKxB;IAGJ,OAAO,CAAC,QAAQ,CAAC,aAAa,CAA4B;IAI1D,OAAO,CAAC,oBAAoB,CAAS;IAE9B,QAAQ,IAAI,IAAI;IAYhB,SAAS,IAAI,IAAI;IAWxB,oBAAoB;IACb,IAAI,IAAI,IAAI;IAOnB,qBAAqB;IACd,KAAK,IAAI,IAAI;IAOpB,sBAAsB;IACf,MAAM,QAAO,IAAI,CAUtB;IAEF,OAAO,CAAC,QAAQ,CAAC,YAAY,CA6B3B;IAEF,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAW/B;IAEF,OAAO,CAAC,QAAQ,CAAC,aAAa,CA6D5B;IAEF,OAAO,CAAC,iBAAiB;IAyBzB,OAAO,CAAC,cAAc;IAMtB,OAAO,CAAC,aAAa;IAWrB,OAAO,CAAC,iBAAiB;IAWzB,OAAO,CAAC,gBAAgB;IAiBxB,OAAO,CAAC,UAAU;IAYlB,OAAO,CAAC,gBAAgB;IAIxB,OAAO,CAAC,eAAe;IAOvB,OAAO,CAAC,oBAAoB;IAI5B,8DAA8D;IAC9D,OAAO,CAAC,kBAAkB;IAM1B;;;;;OAKG;IACH,OAAO,CAAC,iBAAiB;IAKzB,2EAA2E;IAC3E,OAAO,CAAC,QAAQ,CAAC,eAAe,CAK9B;IAEF,oEAAoE;IACpE,OAAO,CAAC,gBAAgB;IASxB,OAAO,CAAC,YAAY;IAIpB,OAAO,CAAC,SAAS;CAGjB"}
|
|
@@ -9,6 +9,7 @@ import { OverlayPositioner, ToggleDismissGuard } from '../../../utils/overlay/in
|
|
|
9
9
|
import { isDeepFocusWithin } from '../../../utils/accessibility/focus-trap.js';
|
|
10
10
|
import { dropdownTemplate } from './dropdown.template.js';
|
|
11
11
|
import { dropdownStyles } from './dropdown.styles.js';
|
|
12
|
+
import { getFocusableControl, setCrossRootActiveDescendant } from '../../../utils/accessibility/cross-root-aria.js';
|
|
12
13
|
/**
|
|
13
14
|
* ml-dropdown - Dropdown menu component
|
|
14
15
|
*
|
|
@@ -156,11 +157,11 @@ let DropdownComponent = class DropdownComponent {
|
|
|
156
157
|
};
|
|
157
158
|
/** Keep the slotted trigger's menu-button ARIA in sync with open state. */
|
|
158
159
|
this.syncTriggerAria = () => {
|
|
159
|
-
const
|
|
160
|
-
if (!
|
|
160
|
+
const control = this.getTriggerControl();
|
|
161
|
+
if (!control)
|
|
161
162
|
return;
|
|
162
|
-
|
|
163
|
-
|
|
163
|
+
control.setAttribute('aria-haspopup', 'menu');
|
|
164
|
+
control.setAttribute('aria-expanded', String(this.isOpen));
|
|
164
165
|
};
|
|
165
166
|
}
|
|
166
167
|
onCreate() {
|
|
@@ -252,11 +253,12 @@ let DropdownComponent = class DropdownComponent {
|
|
|
252
253
|
items[i].focused = i === index;
|
|
253
254
|
}
|
|
254
255
|
this._focusedIndex = index;
|
|
255
|
-
// The
|
|
256
|
-
//
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
256
|
+
// The focusable control may be inside the trigger's own shadow root
|
|
257
|
+
// (<ml-button> wraps a <button>), in which case an id reference to a
|
|
258
|
+
// light-DOM item cannot resolve — use the element reference.
|
|
259
|
+
const control = this.getTriggerControl();
|
|
260
|
+
if (control) {
|
|
261
|
+
setCrossRootActiveDescendant(control, items[index]);
|
|
260
262
|
}
|
|
261
263
|
}
|
|
262
264
|
clearFocus() {
|
|
@@ -265,7 +267,10 @@ let DropdownComponent = class DropdownComponent {
|
|
|
265
267
|
item.focused = false;
|
|
266
268
|
}
|
|
267
269
|
this._focusedIndex = -1;
|
|
268
|
-
this.
|
|
270
|
+
const control = this.getTriggerControl();
|
|
271
|
+
if (control) {
|
|
272
|
+
setCrossRootActiveDescendant(control, null);
|
|
273
|
+
}
|
|
269
274
|
}
|
|
270
275
|
findFirstEnabled(items) {
|
|
271
276
|
return items.findIndex((item) => !item.disabled);
|
|
@@ -278,7 +283,7 @@ let DropdownComponent = class DropdownComponent {
|
|
|
278
283
|
return -1;
|
|
279
284
|
}
|
|
280
285
|
returnFocusToTrigger() {
|
|
281
|
-
this.getAssignedTrigger()?.focus();
|
|
286
|
+
(this.getTriggerControl() ?? this.getAssignedTrigger())?.focus();
|
|
282
287
|
}
|
|
283
288
|
/** First element assigned to the trigger slot (light DOM). */
|
|
284
289
|
getAssignedTrigger() {
|
|
@@ -286,6 +291,16 @@ let DropdownComponent = class DropdownComponent {
|
|
|
286
291
|
const assigned = triggerSlot?.assignedElements() ?? [];
|
|
287
292
|
return assigned[0] ?? null;
|
|
288
293
|
}
|
|
294
|
+
/**
|
|
295
|
+
* The element that actually receives focus for the slotted trigger. For
|
|
296
|
+
* `<ml-button>` that is the `<button>` inside its shadow root; ARIA set on
|
|
297
|
+
* the host is not announced, which made the documented example
|
|
298
|
+
* inaccessible.
|
|
299
|
+
*/
|
|
300
|
+
getTriggerControl() {
|
|
301
|
+
const trigger = this.getAssignedTrigger();
|
|
302
|
+
return trigger ? getFocusableControl(trigger) : null;
|
|
303
|
+
}
|
|
289
304
|
/** True when the (deep) focused element is inside this dropdown. */
|
|
290
305
|
startPositioning() {
|
|
291
306
|
const triggerEl = this.getTriggerEl();
|
|
@@ -40,6 +40,14 @@ export declare class PopoverComponent implements IElementRef, OnCreate, OnDestro
|
|
|
40
40
|
private _focusTrap;
|
|
41
41
|
private readonly _dismissGuard;
|
|
42
42
|
onCreate(): void;
|
|
43
|
+
/**
|
|
44
|
+
* `popover="manual"` opts out of the platform's light-dismiss AND of its
|
|
45
|
+
* close watcher, so Escape did nothing — and because the popover traps
|
|
46
|
+
* focus, a keyboard user had no way out of it at all. Close on Escape
|
|
47
|
+
* ourselves; a manual popover that must not be dismissible should not trap
|
|
48
|
+
* focus in the first place.
|
|
49
|
+
*/
|
|
50
|
+
private readonly handleKeyDown;
|
|
43
51
|
onDestroy(): void;
|
|
44
52
|
/** Open the popover */
|
|
45
53
|
open(): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"popover.component.d.ts","sourceRoot":"","sources":["../../../../src/components/overlays/popover/popover.component.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACzE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAMzD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,qBAMa,gBAAiB,YAAW,WAAW,EAAE,QAAQ,EAAE,SAAS;IACjE,UAAU,EAAG,WAAW,CAAC;IAEhC,4CAA4C;IACrC,SAAS,EAAE,SAAS,CAAY;IAEvC,4CAA4C;IACrC,MAAM,SAAK;IAElB,0DAA0D;IACnD,MAAM,UAAS;IAEtB,wDAAwD;IACjD,KAAK,UAAS;IAErB,yBAAyB;IAClB,MAAM,UAAS;IAEtB,OAAO,CAAC,QAAQ,CAAC,WAAW,CAKxB;IACJ,OAAO,CAAC,UAAU,CAA0B;IAG5C,OAAO,CAAC,QAAQ,CAAC,aAAa,CAA4B;IAEnD,QAAQ,IAAI,IAAI;
|
|
1
|
+
{"version":3,"file":"popover.component.d.ts","sourceRoot":"","sources":["../../../../src/components/overlays/popover/popover.component.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACzE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAMzD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,qBAMa,gBAAiB,YAAW,WAAW,EAAE,QAAQ,EAAE,SAAS;IACjE,UAAU,EAAG,WAAW,CAAC;IAEhC,4CAA4C;IACrC,SAAS,EAAE,SAAS,CAAY;IAEvC,4CAA4C;IACrC,MAAM,SAAK;IAElB,0DAA0D;IACnD,MAAM,UAAS;IAEtB,wDAAwD;IACjD,KAAK,UAAS;IAErB,yBAAyB;IAClB,MAAM,UAAS;IAEtB,OAAO,CAAC,QAAQ,CAAC,WAAW,CAKxB;IACJ,OAAO,CAAC,UAAU,CAA0B;IAG5C,OAAO,CAAC,QAAQ,CAAC,aAAa,CAA4B;IAEnD,QAAQ,IAAI,IAAI;IAQvB;;;;;;OAMG;IACH,OAAO,CAAC,QAAQ,CAAC,aAAa,CAQ5B;IAEK,SAAS,IAAI,IAAI;IAWxB,uBAAuB;IAChB,IAAI,IAAI,IAAI;IAOnB,wBAAwB;IACjB,KAAK,IAAI,IAAI;IAOpB,yBAAyB;IAClB,MAAM,QAAO,IAAI,CAUtB;IAEF,OAAO,CAAC,QAAQ,CAAC,YAAY,CAsB3B;IAEF,OAAO,CAAC,iBAAiB;IASzB,OAAO,CAAC,gBAAgB;IASxB,OAAO,CAAC,YAAY;IAIpB,OAAO,CAAC,YAAY;CAGpB"}
|
|
@@ -55,6 +55,21 @@ let PopoverComponent = class PopoverComponent {
|
|
|
55
55
|
// Swallows the trigger click that just light-dismissed the open popover so
|
|
56
56
|
// it doesn't immediately reopen it.
|
|
57
57
|
this._dismissGuard = new ToggleDismissGuard();
|
|
58
|
+
/**
|
|
59
|
+
* `popover="manual"` opts out of the platform's light-dismiss AND of its
|
|
60
|
+
* close watcher, so Escape did nothing — and because the popover traps
|
|
61
|
+
* focus, a keyboard user had no way out of it at all. Close on Escape
|
|
62
|
+
* ourselves; a manual popover that must not be dismissible should not trap
|
|
63
|
+
* focus in the first place.
|
|
64
|
+
*/
|
|
65
|
+
this.handleKeyDown = (event) => {
|
|
66
|
+
if (event.key !== 'Escape' || !this.isOpen || !this.manual) {
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
event.preventDefault();
|
|
70
|
+
event.stopPropagation();
|
|
71
|
+
this.close();
|
|
72
|
+
};
|
|
58
73
|
/** Toggle the popover */
|
|
59
74
|
this.toggle = () => {
|
|
60
75
|
// Swallow the click that just light-dismissed the open popover, so the
|
|
@@ -92,6 +107,7 @@ let PopoverComponent = class PopoverComponent {
|
|
|
92
107
|
const popoverEl = this.getPopoverEl();
|
|
93
108
|
if (popoverEl) {
|
|
94
109
|
popoverEl.addEventListener('toggle', this.handleToggle);
|
|
110
|
+
popoverEl.addEventListener('keydown', this.handleKeyDown);
|
|
95
111
|
}
|
|
96
112
|
}
|
|
97
113
|
onDestroy() {
|
|
@@ -101,6 +117,7 @@ let PopoverComponent = class PopoverComponent {
|
|
|
101
117
|
const popoverEl = this.getPopoverEl();
|
|
102
118
|
if (popoverEl) {
|
|
103
119
|
popoverEl.removeEventListener('toggle', this.handleToggle);
|
|
120
|
+
popoverEl.removeEventListener('keydown', this.handleKeyDown);
|
|
104
121
|
}
|
|
105
122
|
}
|
|
106
123
|
/** Open the popover */
|
|
@@ -47,11 +47,12 @@ export declare class TooltipComponent implements IElementRef, OnCreate, OnDestro
|
|
|
47
47
|
private dismiss;
|
|
48
48
|
private readonly handleDocumentKeydown;
|
|
49
49
|
/**
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
50
|
+
* Describe the slotted trigger with the tooltip's content element.
|
|
51
|
+
*
|
|
52
|
+
* An `aria-describedby` IDREF pointing INTO this component's shadow root
|
|
53
|
+
* resolves to nothing, so the tooltip was set up to look correct in the DOM
|
|
54
|
+
* and was never announced. Element references cross the boundary; where
|
|
55
|
+
* they are unsupported the text is copied onto the trigger instead.
|
|
55
56
|
*/
|
|
56
57
|
private readonly syncTriggerAria;
|
|
57
58
|
private startPositioning;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tooltip.component.d.ts","sourceRoot":"","sources":["../../../../src/components/overlays/tooltip/tooltip.component.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACzE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAEzD,OAAO,EAAS,KAAK,QAAQ,EAAE,MAAM,uCAAuC,CAAC;
|
|
1
|
+
{"version":3,"file":"tooltip.component.d.ts","sourceRoot":"","sources":["../../../../src/components/overlays/tooltip/tooltip.component.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACzE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAEzD,OAAO,EAAS,KAAK,QAAQ,EAAE,MAAM,uCAAuC,CAAC;AAK7E;;;;;;;;;;;;;;;GAeG;AACH,qBAMa,gBAAiB,YAAW,WAAW,EAAE,QAAQ,EAAE,SAAS;IACjE,UAAU,EAAG,WAAW,CAAC;IAEhC,2BAA2B;IACpB,OAAO,SAAM;IAEpB,wBAAwB;IACjB,SAAS,EAAE,SAAS,CAAS;IAEpC,gCAAgC;IACzB,KAAK,SAAO;IAEnB,iCAAiC;IAC1B,SAAS,UAAS;IAEzB;;;;;OAKG;IACI,QAAQ,EAAE,WAAW,GAAG,IAAI,CAAQ;IAE3C,8EAA8E;IACvE,SAAS,EAAE,QAAQ,CAAW;IAErC,OAAO,CAAC,YAAY,CAAuB;IAC3C,OAAO,CAAC,YAAY,CAAuB;IAC3C,OAAO,CAAC,QAAQ,CAAC,WAAW,CAKxB;IAEG,QAAQ,IAAI,IAAI;IAMhB,SAAS,IAAI,IAAI;IAQjB,IAAI,QAAO,IAAI,CAapB;IAEK,IAAI,QAAO,IAAI,CASpB;IAEF,4CAA4C;IAC5C,OAAO,CAAC,OAAO;IAMf,OAAO,CAAC,QAAQ,CAAC,qBAAqB,CAYpC;IAEF;;;;;;;OAOG;IACH,OAAO,CAAC,QAAQ,CAAC,eAAe,CAW9B;IAEF,OAAO,CAAC,gBAAgB;IASxB,OAAO,CAAC,eAAe;IAIvB,mDAAmD;IACnD,OAAO,CAAC,cAAc;CAGtB"}
|
|
@@ -9,6 +9,7 @@ import { OverlayPositioner } from '../../../utils/overlay/index.js';
|
|
|
9
9
|
import { newID } from '../../../functions/new-id.function.js';
|
|
10
10
|
import { tooltipTemplate } from './tooltip.template.js';
|
|
11
11
|
import { tooltipStyles } from './tooltip.styles.js';
|
|
12
|
+
import { setCrossRootDescription } from '../../../utils/accessibility/cross-root-aria.js';
|
|
12
13
|
/**
|
|
13
14
|
* ml-tooltip - Tooltip component that shows on hover/focus
|
|
14
15
|
*
|
|
@@ -88,19 +89,22 @@ let TooltipComponent = class TooltipComponent {
|
|
|
88
89
|
this.dismiss();
|
|
89
90
|
};
|
|
90
91
|
/**
|
|
91
|
-
*
|
|
92
|
-
*
|
|
93
|
-
*
|
|
94
|
-
*
|
|
95
|
-
*
|
|
92
|
+
* Describe the slotted trigger with the tooltip's content element.
|
|
93
|
+
*
|
|
94
|
+
* An `aria-describedby` IDREF pointing INTO this component's shadow root
|
|
95
|
+
* resolves to nothing, so the tooltip was set up to look correct in the DOM
|
|
96
|
+
* and was never announced. Element references cross the boundary; where
|
|
97
|
+
* they are unsupported the text is copied onto the trigger instead.
|
|
96
98
|
*/
|
|
97
99
|
this.syncTriggerAria = () => {
|
|
98
|
-
const
|
|
99
|
-
const
|
|
100
|
-
const trigger =
|
|
101
|
-
|
|
102
|
-
|
|
100
|
+
const root = this.elementRef.shadowRoot;
|
|
101
|
+
const slot = root?.querySelector('.ml-tooltip__trigger slot');
|
|
102
|
+
const trigger = (slot?.assignedElements() ?? [])[0];
|
|
103
|
+
const content = root?.querySelector('.ml-tooltip__content');
|
|
104
|
+
if (!trigger || trigger.hasAttribute('aria-describedby')) {
|
|
105
|
+
return;
|
|
103
106
|
}
|
|
107
|
+
setCrossRootDescription(trigger, content ? [content] : []);
|
|
104
108
|
};
|
|
105
109
|
}
|
|
106
110
|
onCreate() {
|
|
@@ -33,12 +33,25 @@ export declare class AppShellComponent implements IElementRef, OnCreate, OnDestr
|
|
|
33
33
|
/** Media query for responsive behavior */
|
|
34
34
|
private _mediaQuery;
|
|
35
35
|
private readonly _handleMediaChange;
|
|
36
|
+
/**
|
|
37
|
+
* The viewport width below which the sidebar becomes a drawer, read from
|
|
38
|
+
* `--ml-app-shell-mobile-breakpoint`. The value used to be hardcoded in
|
|
39
|
+
* both the stylesheet and here, so overriding it in CSS left the JS
|
|
40
|
+
* behaviour switching at the old width.
|
|
41
|
+
*/
|
|
42
|
+
get mobileBreakpoint(): string;
|
|
36
43
|
onCreate(): void;
|
|
37
44
|
onDestroy(): void;
|
|
38
45
|
/** Toggle mobile sidebar drawer */
|
|
39
46
|
toggleMobileSidebar: () => void;
|
|
40
47
|
/** Close mobile sidebar */
|
|
41
48
|
closeMobileSidebar: () => void;
|
|
49
|
+
/**
|
|
50
|
+
* Escape closes the mobile drawer. It had no keyboard dismissal at all:
|
|
51
|
+
* the only way out was clicking the backdrop.
|
|
52
|
+
*/
|
|
53
|
+
handleKeyDown: (event: KeyboardEvent) => void;
|
|
54
|
+
private focusMenuButton;
|
|
42
55
|
private onMediaChange;
|
|
43
56
|
}
|
|
44
57
|
//# sourceMappingURL=app-shell.component.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app-shell.component.d.ts","sourceRoot":"","sources":["../../../../src/components/sections/app-shell/app-shell.component.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"app-shell.component.d.ts","sourceRoot":"","sources":["../../../../src/components/sections/app-shell/app-shell.component.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAMzE,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,OAAO,CAAC;AAE/C;;;;;;;;;;;;;;;;;GAiBG;AACH,qBAMa,iBAAkB,YAAW,WAAW,EAAE,QAAQ,EAAE,SAAS;IAClE,UAAU,EAAG,WAAW,CAAC;IAEhC,+EAA+E;IACxE,eAAe,EAAE,eAAe,CAAU;IAEjD,sEAAsE;IAC/D,gBAAgB,UAAS;IAEhC,mEAAmE;IAC5D,WAAW,UAAS;IAE3B,oDAAoD;IAC7C,MAAM,UAAS;IAEtB,gDAAgD;IACzC,UAAU,UAAS;IAE1B,0CAA0C;IAC1C,OAAO,CAAC,WAAW,CAA+B;IAClD,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAAiC;IAEpE;;;;;OAKG;IACH,IAAW,gBAAgB,IAAI,MAAM,CAGpC;IAEM,QAAQ,IAAI,IAAI;IAQhB,SAAS,IAAI,IAAI;IAIxB,mCAAmC;IAC5B,mBAAmB,QAAO,IAAI,CAanC;IAEF,2BAA2B;IACpB,kBAAkB,QAAO,IAAI,CAOlC;IAEF;;;OAGG;IACI,aAAa,GAAI,OAAO,aAAa,KAAG,IAAI,CAKjD;IAEF,OAAO,CAAC,eAAe;IAOvB,OAAO,CAAC,aAAa;CAOrB"}
|
|
@@ -8,6 +8,7 @@ import { MelodicComponent } from '@melodicdev/core';
|
|
|
8
8
|
import { appShellTemplate } from './app-shell.template.js';
|
|
9
9
|
import { appShellStyles } from './app-shell.styles.js';
|
|
10
10
|
import { defineLegacyAliases } from '../../../functions/index.js';
|
|
11
|
+
import { focusFirst } from '../../../utils/accessibility/focus-utils.js';
|
|
11
12
|
/**
|
|
12
13
|
* ml-app-shell - Application shell layout component
|
|
13
14
|
*
|
|
@@ -44,20 +45,63 @@ let AppShellComponent = class AppShellComponent {
|
|
|
44
45
|
/** Toggle mobile sidebar drawer */
|
|
45
46
|
this.toggleMobileSidebar = () => {
|
|
46
47
|
this.mobileOpen = !this.mobileOpen;
|
|
48
|
+
if (this.mobileOpen) {
|
|
49
|
+
// Move focus into the drawer so a keyboard user lands where the
|
|
50
|
+
// content is, and Escape has somewhere to close from.
|
|
51
|
+
queueMicrotask(() => {
|
|
52
|
+
const sidebar = this.elementRef.shadowRoot?.querySelector('.ml-app-shell__sidebar');
|
|
53
|
+
focusFirst(sidebar ?? this.elementRef);
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
this.focusMenuButton();
|
|
58
|
+
}
|
|
47
59
|
};
|
|
48
60
|
/** Close mobile sidebar */
|
|
49
61
|
this.closeMobileSidebar = () => {
|
|
62
|
+
if (!this.mobileOpen) {
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
50
65
|
this.mobileOpen = false;
|
|
66
|
+
this.focusMenuButton();
|
|
51
67
|
};
|
|
68
|
+
/**
|
|
69
|
+
* Escape closes the mobile drawer. It had no keyboard dismissal at all:
|
|
70
|
+
* the only way out was clicking the backdrop.
|
|
71
|
+
*/
|
|
72
|
+
this.handleKeyDown = (event) => {
|
|
73
|
+
if (event.key === 'Escape' && this.mobileOpen) {
|
|
74
|
+
event.preventDefault();
|
|
75
|
+
this.closeMobileSidebar();
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* The viewport width below which the sidebar becomes a drawer, read from
|
|
81
|
+
* `--ml-app-shell-mobile-breakpoint`. The value used to be hardcoded in
|
|
82
|
+
* both the stylesheet and here, so overriding it in CSS left the JS
|
|
83
|
+
* behaviour switching at the old width.
|
|
84
|
+
*/
|
|
85
|
+
get mobileBreakpoint() {
|
|
86
|
+
const value = getComputedStyle(this.elementRef).getPropertyValue('--ml-app-shell-mobile-breakpoint').trim();
|
|
87
|
+
return value || '768px';
|
|
52
88
|
}
|
|
53
89
|
onCreate() {
|
|
54
|
-
|
|
90
|
+
// Read the breakpoint from the same custom property the stylesheet uses,
|
|
91
|
+
// so overriding one no longer desynchronises JS from CSS.
|
|
92
|
+
this._mediaQuery = window.matchMedia(`(min-width: ${this.mobileBreakpoint})`);
|
|
55
93
|
this._mediaQuery.addEventListener('change', this._handleMediaChange);
|
|
56
94
|
this.mobile = !this._mediaQuery.matches;
|
|
57
95
|
}
|
|
58
96
|
onDestroy() {
|
|
59
97
|
this._mediaQuery?.removeEventListener('change', this._handleMediaChange);
|
|
60
98
|
}
|
|
99
|
+
focusMenuButton() {
|
|
100
|
+
queueMicrotask(() => {
|
|
101
|
+
const button = this.elementRef.shadowRoot?.querySelector('.ml-app-shell__menu-btn');
|
|
102
|
+
button?.focus();
|
|
103
|
+
});
|
|
104
|
+
}
|
|
61
105
|
onMediaChange(event) {
|
|
62
106
|
this.mobile = !event.matches;
|
|
63
107
|
if (event.matches) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app-shell.styles.d.ts","sourceRoot":"","sources":["../../../../src/components/sections/app-shell/app-shell.styles.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,cAAc,
|
|
1
|
+
{"version":3,"file":"app-shell.styles.d.ts","sourceRoot":"","sources":["../../../../src/components/sections/app-shell/app-shell.styles.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,cAAc,iDAyO1B,CAAC"}
|
|
@@ -13,6 +13,10 @@ export const appShellStyles = () => css `
|
|
|
13
13
|
|
|
14
14
|
/* Mobile sidebar */
|
|
15
15
|
--ml-app-shell-sidebar-width: var(--ml-sidebar-width, 280px);
|
|
16
|
+
--ml-app-shell-sidebar-collapsed-width: var(--ml-sidebar-collapsed-width, 64px);
|
|
17
|
+
/* Viewport width below which the sidebar becomes a drawer. Kept in one
|
|
18
|
+
place so the CSS media query and the component's matchMedia agree. */
|
|
19
|
+
--ml-app-shell-mobile-breakpoint: 768px;
|
|
16
20
|
--ml-app-shell-sidebar-bg: var(--ml-color-surface);
|
|
17
21
|
--ml-app-shell-sidebar-transition: var(--ml-duration-200);
|
|
18
22
|
|
|
@@ -47,6 +51,17 @@ export const appShellStyles = () => css `
|
|
|
47
51
|
overflow: hidden;
|
|
48
52
|
}
|
|
49
53
|
|
|
54
|
+
/*
|
|
55
|
+
* Collapsed sidebar: narrow the sidebar column to an icon rail. This
|
|
56
|
+
* modifier class was rendered but had no rules at all, so the documented
|
|
57
|
+
* icon-only collapse did nothing.
|
|
58
|
+
*/
|
|
59
|
+
.ml-app-shell--sidebar-collapsed .ml-app-shell__sidebar {
|
|
60
|
+
width: var(--ml-app-shell-sidebar-collapsed-width);
|
|
61
|
+
min-width: var(--ml-app-shell-sidebar-collapsed-width);
|
|
62
|
+
transition: width var(--ml-app-shell-sidebar-transition) var(--ml-ease-in-out);
|
|
63
|
+
}
|
|
64
|
+
|
|
50
65
|
/* Sidebar on the right */
|
|
51
66
|
.ml-app-shell--sidebar-right {
|
|
52
67
|
grid-template-columns: 1fr auto;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app-shell.template.d.ts","sourceRoot":"","sources":["../../../../src/components/sections/app-shell/app-shell.template.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAElE,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,iBAAiB,
|
|
1
|
+
{"version":3,"file":"app-shell.template.d.ts","sourceRoot":"","sources":["../../../../src/components/sections/app-shell/app-shell.template.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAElE,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,iBAAiB,6CAgEpD"}
|
|
@@ -14,6 +14,7 @@ export function appShellTemplate(c) {
|
|
|
14
14
|
'ml-app-shell--header-fixed': headerFixed,
|
|
15
15
|
'ml-app-shell--mobile-open': mobileOpen
|
|
16
16
|
})}
|
|
17
|
+
@keydown=${c.handleKeyDown}
|
|
17
18
|
>
|
|
18
19
|
${when(isMobile, () => html `
|
|
19
20
|
<div
|
|
@@ -26,10 +27,12 @@ export function appShellTemplate(c) {
|
|
|
26
27
|
`)}
|
|
27
28
|
|
|
28
29
|
<aside
|
|
30
|
+
id="app-shell-sidebar"
|
|
29
31
|
class=${classMap({
|
|
30
32
|
'ml-app-shell__sidebar': true,
|
|
31
33
|
'ml-app-shell__sidebar--mobile-open': mobileOpen
|
|
32
34
|
})}
|
|
35
|
+
aria-hidden=${isMobile && !mobileOpen ? 'true' : 'false'}
|
|
33
36
|
>
|
|
34
37
|
<slot name="sidebar"></slot>
|
|
35
38
|
</aside>
|
|
@@ -41,6 +44,8 @@ export function appShellTemplate(c) {
|
|
|
41
44
|
class="ml-app-shell__menu-btn"
|
|
42
45
|
type="button"
|
|
43
46
|
aria-label="Toggle navigation"
|
|
47
|
+
aria-expanded=${mobileOpen ? 'true' : 'false'}
|
|
48
|
+
aria-controls="app-shell-sidebar"
|
|
44
49
|
@click=${c.toggleMobileSidebar}
|
|
45
50
|
>
|
|
46
51
|
<svg width="20" height="20" viewBox="0 0 20 20" fill="none">
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"page-section.template.d.ts","sourceRoot":"","sources":["../../../../src/components/sections/page-section/page-section.template.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"page-section.template.d.ts","sourceRoot":"","sources":["../../../../src/components/sections/page-section/page-section.template.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AAIxE;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,EAAE,oBAAoB,6CAqC1D"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { html, classMap, when } from '@melodicdev/core';
|
|
2
2
|
import { sanitizeHref } from './sanitize-href.function.js';
|
|
3
|
+
import { routeAnchorClick } from '../../navigation/functions/route-link.function.js';
|
|
3
4
|
/**
|
|
4
5
|
* The header (and its action slot) is always rendered so `slotchange` fires
|
|
5
6
|
* when action content is added or removed after mount (see
|
|
@@ -28,7 +29,11 @@ export function pageSectionTemplate(c) {
|
|
|
28
29
|
<div class="ml-page-section__action">
|
|
29
30
|
<slot name="action">
|
|
30
31
|
${when(!!c.actionLabel, () => html `
|
|
31
|
-
<a
|
|
32
|
+
<a
|
|
33
|
+
class="ml-page-section__action-link"
|
|
34
|
+
href=${sanitizeHref(c.actionHref)}
|
|
35
|
+
@click=${(event) => routeAnchorClick(event, sanitizeHref(c.actionHref))}
|
|
36
|
+
>${c.actionLabel}</a>
|
|
32
37
|
`)}
|
|
33
38
|
</slot>
|
|
34
39
|
</div>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tooltip.directive.d.ts","sourceRoot":"","sources":["../../src/directives/tooltip.directive.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iCAAiC,EAAE,MAAM,2BAA2B,CAAC;AAEnF,OAAO,yCAAyC,CAAC;
|
|
1
|
+
{"version":3,"file":"tooltip.directive.d.ts","sourceRoot":"","sources":["../../src/directives/tooltip.directive.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iCAAiC,EAAE,MAAM,2BAA2B,CAAC;AAEnF,OAAO,yCAAyC,CAAC;AAIjD;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,MAAM,WAAW,uBAAuB;IACvC,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;CACnB;AAiJD,iBAAS,gBAAgB,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,GAAG,iCAAiC,GAAG,IAAI,CA0CpG;AAID,OAAO,EAAE,gBAAgB,EAAE,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { registerAttributeDirective } from '@melodicdev/core/template';
|
|
2
2
|
// Registers the <ml-tooltip> custom element the directive instantiates.
|
|
3
3
|
import '../components/overlays/tooltip/index.js';
|
|
4
|
+
import { setCrossRootDescription, clearCrossRootDescription } from '../utils/accessibility/cross-root-aria.js';
|
|
4
5
|
/**
|
|
5
6
|
* Live tooltip state per decorated element. The template engine always runs
|
|
6
7
|
* the previous cleanup before re-running a directive with a new value; the
|
|
@@ -54,14 +55,45 @@ function createState(element) {
|
|
|
54
55
|
element.addEventListener('focusin', show);
|
|
55
56
|
element.addEventListener('focusout', hide);
|
|
56
57
|
const state = { tooltip, pendingRemoval: false, ownsDescribedBy: false, show, hide };
|
|
57
|
-
// Mirror ml-tooltip's slotted-trigger ARIA wiring
|
|
58
|
-
//
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
58
|
+
// Mirror ml-tooltip's slotted-trigger ARIA wiring. The content lives inside
|
|
59
|
+
// the tooltip's shadow root, so an IDREF would resolve to nothing —
|
|
60
|
+
// describe the element with the content ELEMENT instead.
|
|
61
|
+
//
|
|
62
|
+
// The tooltip has only just been created here, so its shadow content does
|
|
63
|
+
// not exist yet; wiring it synchronously silently described nothing at all.
|
|
64
|
+
describeWhenReady(element, tooltip, state);
|
|
65
|
+
return state;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Attach the description once the tooltip has rendered its content.
|
|
69
|
+
*
|
|
70
|
+
* Melodic renders on a microtask, so the content element appears shortly after
|
|
71
|
+
* the tooltip is constructed. A couple of microtask turns is enough; the
|
|
72
|
+
* fallback timeout covers a tooltip whose first render is deferred further.
|
|
73
|
+
*/
|
|
74
|
+
function describeWhenReady(element, tooltip, state) {
|
|
75
|
+
if (element.hasAttribute('aria-describedby')) {
|
|
76
|
+
return; // the consumer wired their own description; never overwrite it
|
|
77
|
+
}
|
|
78
|
+
const attach = () => {
|
|
79
|
+
const content = tooltip.shadowRoot?.querySelector('.ml-tooltip__content');
|
|
80
|
+
if (!content || state.pendingRemoval) {
|
|
81
|
+
return false;
|
|
82
|
+
}
|
|
83
|
+
setCrossRootDescription(element, [content]);
|
|
62
84
|
state.ownsDescribedBy = true;
|
|
85
|
+
return true;
|
|
86
|
+
};
|
|
87
|
+
if (attach()) {
|
|
88
|
+
return;
|
|
63
89
|
}
|
|
64
|
-
|
|
90
|
+
void Promise.resolve()
|
|
91
|
+
.then(() => attach())
|
|
92
|
+
.then((done) => {
|
|
93
|
+
if (!done) {
|
|
94
|
+
setTimeout(attach, 0);
|
|
95
|
+
}
|
|
96
|
+
});
|
|
65
97
|
}
|
|
66
98
|
function destroyState(element, state) {
|
|
67
99
|
element.removeEventListener('mouseenter', state.show);
|
|
@@ -69,6 +101,7 @@ function destroyState(element, state) {
|
|
|
69
101
|
element.removeEventListener('focusin', state.show);
|
|
70
102
|
element.removeEventListener('focusout', state.hide);
|
|
71
103
|
if (state.ownsDescribedBy) {
|
|
104
|
+
clearCrossRootDescription(element);
|
|
72
105
|
element.removeAttribute('aria-describedby');
|
|
73
106
|
}
|
|
74
107
|
state.tooltip.anchorEl = null;
|