@melodicdev/components 3.1.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 +4269 -2377
- package/assets/melodic-components.js.map +1 -1
- package/assets/melodic-components.min.js +5477 -3831
- 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.map +1 -1
- package/lib/components/forms/select/select.component.js +13 -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
|
@@ -46,12 +46,18 @@ export declare class SidebarComponent implements IElementRef, OnCreate, OnDestro
|
|
|
46
46
|
private readonly _handleItemClick;
|
|
47
47
|
private readonly _handleMouseEnter;
|
|
48
48
|
private readonly _handleMouseLeave;
|
|
49
|
-
/**
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
49
|
+
/**
|
|
50
|
+
* Slot presence, kept in sync from the light DOM.
|
|
51
|
+
*
|
|
52
|
+
* These were live getters read inside `when()`, so nothing re-rendered when
|
|
53
|
+
* content was slotted after mount — an async-rendered user card or search
|
|
54
|
+
* box simply never appeared. `watchSlotPresence` cannot help here because
|
|
55
|
+
* the slots themselves are conditional.
|
|
56
|
+
*/
|
|
57
|
+
hasSearch: boolean;
|
|
58
|
+
hasFeature: boolean;
|
|
59
|
+
hasUser: boolean;
|
|
60
|
+
private _slotWatcherCleanup;
|
|
55
61
|
onCreate(): void;
|
|
56
62
|
onRender(): void;
|
|
57
63
|
onDestroy(): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sidebar.component.d.ts","sourceRoot":"","sources":["../../../../src/components/navigation/sidebar/sidebar.component.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACnF,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"sidebar.component.d.ts","sourceRoot":"","sources":["../../../../src/components/navigation/sidebar/sidebar.component.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACnF,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAK1F;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,qBAMa,gBAAiB,YAAW,WAAW,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ;IAC3E,UAAU,EAAG,WAAW,CAAC;IAEhC,qBAAqB;IACd,OAAO,EAAE,cAAc,CAAa;IAE3C,kCAAkC;IAC3B,MAAM,SAAM;IAEnB,yDAAyD;IAClD,SAAS,UAAS;IAEzB,yDAAyD;IAClD,UAAU,EAAE,eAAe,EAAE,CAAM;IAE1C,+BAA+B;IACxB,gBAAgB,EAAE,cAAc,EAAE,CAAM;IAE/C,+BAA+B;IAC/B,OAAO,CAAC,WAAW,CAA8C;IAEjE,2BAA2B;IAC3B,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAA+B;IAChE,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAgC;IAClE,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAgC;IAElE;;;;;;;OAOG;IACI,SAAS,UAAS;IAClB,UAAU,UAAS;IACnB,OAAO,UAAS;IAEvB,OAAO,CAAC,mBAAmB,CAA6B;IAEjD,QAAQ,IAAI,IAAI;IAsBhB,QAAQ,IAAI,IAAI;IAIhB,SAAS,IAAI,IAAI;IAYxB,kCAAkC;IAC3B,uBAAuB,QAAO,IAAI,CAEvC;IAEF,+BAA+B;IACxB,qBAAqB,GAAI,OAAO,MAAM,EAAE,OAAO,MAAM,KAAG,IAAI,CAEjE;IAEF,mCAAmC;IAC5B,kBAAkB,GAAI,MAAM,cAAc,KAAG,IAAI,CAQtD;IAEF,0BAA0B;IACnB,aAAa,GAAI,OAAO,aAAa,KAAG,IAAI,CAoCjD;IAEF;;;;;OAKG;IACH,OAAO,CAAC,iBAAiB;IAyCzB,kCAAkC;IAC3B,aAAa,cAAqB;IAEzC,uBAAuB;IACvB,OAAO,CAAC,YAAY;IAqBpB,8CAA8C;IAC9C,OAAO,CAAC,WAAW;IASnB,0CAA0C;IAC1C,OAAO,CAAC,YAAY;IASpB,0CAA0C;IAC1C,OAAO,CAAC,YAAY;IASpB,2DAA2D;IAC3D,OAAO,CAAC,gBAAgB;CAexB"}
|
|
@@ -7,6 +7,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
7
7
|
import { MelodicComponent } from '@melodicdev/core';
|
|
8
8
|
import { sidebarTemplate } from './sidebar.template.js';
|
|
9
9
|
import { sidebarStyles } from './sidebar.styles.js';
|
|
10
|
+
import { watchLightSlots, hasLightSlot } from '../../../utils/directives/watch-light-slots.js';
|
|
10
11
|
/**
|
|
11
12
|
* ml-sidebar - App-level sidebar navigation component
|
|
12
13
|
*
|
|
@@ -53,6 +54,18 @@ let SidebarComponent = class SidebarComponent {
|
|
|
53
54
|
this._handleItemClick = this.onItemClick.bind(this);
|
|
54
55
|
this._handleMouseEnter = this.onMouseEnter.bind(this);
|
|
55
56
|
this._handleMouseLeave = this.onMouseLeave.bind(this);
|
|
57
|
+
/**
|
|
58
|
+
* Slot presence, kept in sync from the light DOM.
|
|
59
|
+
*
|
|
60
|
+
* These were live getters read inside `when()`, so nothing re-rendered when
|
|
61
|
+
* content was slotted after mount — an async-rendered user card or search
|
|
62
|
+
* box simply never appeared. `watchSlotPresence` cannot help here because
|
|
63
|
+
* the slots themselves are conditional.
|
|
64
|
+
*/
|
|
65
|
+
this.hasSearch = false;
|
|
66
|
+
this.hasFeature = false;
|
|
67
|
+
this.hasUser = false;
|
|
68
|
+
this._slotWatcherCleanup = null;
|
|
56
69
|
/** Handle slotted items change */
|
|
57
70
|
this.handleDefaultSlotChange = () => {
|
|
58
71
|
this.updateItemStates();
|
|
@@ -110,23 +123,16 @@ let SidebarComponent = class SidebarComponent {
|
|
|
110
123
|
/** Track expanded config items */
|
|
111
124
|
this.expandedItems = new Set();
|
|
112
125
|
}
|
|
113
|
-
/** Check if search slot has content */
|
|
114
|
-
get hasSearch() {
|
|
115
|
-
return this.elementRef?.querySelector('[slot="search"]') !== null;
|
|
116
|
-
}
|
|
117
|
-
/** Check if feature slot has content */
|
|
118
|
-
get hasFeature() {
|
|
119
|
-
return this.elementRef?.querySelector('[slot="feature"]') !== null;
|
|
120
|
-
}
|
|
121
|
-
/** Check if user slot has content */
|
|
122
|
-
get hasUser() {
|
|
123
|
-
return this.elementRef?.querySelector('[slot="user"]') !== null;
|
|
124
|
-
}
|
|
125
126
|
onCreate() {
|
|
126
127
|
// Set initial collapsed state based on variant
|
|
127
128
|
if (this.variant === 'slim') {
|
|
128
129
|
this.collapsed = true;
|
|
129
130
|
}
|
|
131
|
+
this._slotWatcherCleanup = watchLightSlots(this.elementRef, () => {
|
|
132
|
+
this.hasSearch = hasLightSlot(this.elementRef, 'search');
|
|
133
|
+
this.hasFeature = hasLightSlot(this.elementRef, 'feature');
|
|
134
|
+
this.hasUser = hasLightSlot(this.elementRef, 'user');
|
|
135
|
+
});
|
|
130
136
|
// Listen for item click events from children
|
|
131
137
|
this.elementRef.addEventListener('ml:sidebar-item-click', this._handleItemClick);
|
|
132
138
|
// Set up hover for slim variant
|
|
@@ -139,6 +145,8 @@ let SidebarComponent = class SidebarComponent {
|
|
|
139
145
|
this.updateItemStates();
|
|
140
146
|
}
|
|
141
147
|
onDestroy() {
|
|
148
|
+
this._slotWatcherCleanup?.();
|
|
149
|
+
this._slotWatcherCleanup = null;
|
|
142
150
|
this.elementRef.removeEventListener('ml:sidebar-item-click', this._handleItemClick);
|
|
143
151
|
this.elementRef.removeEventListener('mouseenter', this._handleMouseEnter);
|
|
144
152
|
this.elementRef.removeEventListener('mouseleave', this._handleMouseLeave);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sidebar.template.d.ts","sourceRoot":"","sources":["../../../../src/components/navigation/sidebar/sidebar.template.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"sidebar.template.d.ts","sourceRoot":"","sources":["../../../../src/components/navigation/sidebar/sidebar.template.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAI/D,wBAAgB,eAAe,CAAC,CAAC,EAAE,gBAAgB,kBAkElD"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { html, classMap, repeat, when } from '@melodicdev/core';
|
|
2
|
+
import { routeAnchorClick } from '../functions/route-link.function.js';
|
|
2
3
|
export function sidebarTemplate(c) {
|
|
3
4
|
const hasNavConfig = c.navigation.length > 0;
|
|
4
5
|
const hasFooterConfig = c.footerNavigation.length > 0;
|
|
@@ -125,7 +126,10 @@ function renderNavItem(c, item, level) {
|
|
|
125
126
|
href=${item.href}
|
|
126
127
|
?target=${item.external ? '_blank' : null}
|
|
127
128
|
?rel=${item.external ? 'noopener noreferrer' : null}
|
|
128
|
-
@click=${
|
|
129
|
+
@click=${(event) => {
|
|
130
|
+
routeAnchorClick(event, item.href ?? '', { external: item.external });
|
|
131
|
+
handleClick(event);
|
|
132
|
+
}}
|
|
129
133
|
>
|
|
130
134
|
${content}
|
|
131
135
|
</a>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"step.component.d.ts","sourceRoot":"","sources":["../../../../src/components/navigation/steps/step.component.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,cAAc,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAK/G;;;;;;;;;;GAUG;AACH,
|
|
1
|
+
{"version":3,"file":"step.component.d.ts","sourceRoot":"","sources":["../../../../src/components/navigation/steps/step.component.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,cAAc,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAK/G;;;;;;;;;;GAUG;AACH,qBAwBa,aAAc,YAAW,WAAW;IACzC,UAAU,EAAG,WAAW,CAAC;IAEhC,sBAAsB;IACf,KAAK,SAAM;IAElB,iBAAiB;IACV,KAAK,SAAM;IAElB,iCAAiC;IAC1B,WAAW,SAAM;IAExB,oCAAoC;IAC7B,IAAI,SAAM;IAEjB,0BAA0B;IACnB,IAAI,SAAM;IAEjB,wBAAwB;IACjB,QAAQ,UAAS;IAExB,sCAAsC;IAC/B,MAAM,EAAE,UAAU,CAAc;IAEvC,yCAAyC;IAClC,OAAO,EAAE,YAAY,CAAc;IAE1C,0CAA0C;IACnC,SAAS,EAAE,cAAc,CAAW;IAE3C,uCAAuC;IAChC,KAAK,EAAE,UAAU,CAAa;IAErC,6CAA6C;IACtC,WAAW,EAAE,gBAAgB,CAAgB;IAEpD,8DAA8D;IACvD,UAAU,SAAO;IAExB,0CAA0C;IACnC,KAAK,UAAS;IAErB,yCAAyC;IAClC,IAAI,UAAS;IAEpB,4CAA4C;IACrC,OAAO,UAAS;IAEvB,2BAA2B;IACpB,WAAW,QAAO,IAAI,CAU3B;CACF"}
|
|
@@ -68,7 +68,25 @@ StepComponent = __decorate([
|
|
|
68
68
|
selector: 'ml-step',
|
|
69
69
|
template: stepTemplate,
|
|
70
70
|
styles: stepStyles,
|
|
71
|
-
attributes: [
|
|
71
|
+
attributes: [
|
|
72
|
+
'value',
|
|
73
|
+
'label',
|
|
74
|
+
'description',
|
|
75
|
+
'icon',
|
|
76
|
+
// `href` drives routed steps and is documented as an attribute, but it
|
|
77
|
+
// was never observed — so `<ml-step href="/x">` never navigated.
|
|
78
|
+
'href',
|
|
79
|
+
'disabled',
|
|
80
|
+
'status',
|
|
81
|
+
'variant',
|
|
82
|
+
'connector',
|
|
83
|
+
'color',
|
|
84
|
+
'orientation',
|
|
85
|
+
'step-number',
|
|
86
|
+
'first',
|
|
87
|
+
'last',
|
|
88
|
+
'compact'
|
|
89
|
+
]
|
|
72
90
|
})
|
|
73
91
|
], StepComponent);
|
|
74
92
|
export { StepComponent };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"step.template.d.ts","sourceRoot":"","sources":["../../../../src/components/navigation/steps/step.template.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEzD,wBAAgB,YAAY,CAAC,CAAC,EAAE,aAAa,
|
|
1
|
+
{"version":3,"file":"step.template.d.ts","sourceRoot":"","sources":["../../../../src/components/navigation/steps/step.template.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEzD,wBAAgB,YAAY,CAAC,CAAC,EAAE,aAAa,6CAiC5C"}
|
|
@@ -20,6 +20,12 @@ export function stepTemplate(c) {
|
|
|
20
20
|
aria-disabled=${c.disabled}
|
|
21
21
|
tabindex=${c.status === 'current' ? '0' : '-1'}
|
|
22
22
|
@click=${c.handleClick}
|
|
23
|
+
@keydown=${(e) => {
|
|
24
|
+
if (e.key !== 'Enter' && e.key !== ' ')
|
|
25
|
+
return;
|
|
26
|
+
e.preventDefault();
|
|
27
|
+
c.handleClick();
|
|
28
|
+
}}
|
|
23
29
|
>
|
|
24
30
|
${when(isBar, () => renderBarStep(c))}
|
|
25
31
|
${when(!isBar && !isCompact, () => renderStandardStep(c))}
|
|
@@ -48,6 +48,16 @@ export declare class StepsComponent implements IElementRef, OnCreate, OnDestroy,
|
|
|
48
48
|
private _slottedSteps;
|
|
49
49
|
/** Navigation event listener for routed mode */
|
|
50
50
|
private readonly _handleNavigation;
|
|
51
|
+
/**
|
|
52
|
+
* Whether the NavigationEvent listener is currently attached.
|
|
53
|
+
*
|
|
54
|
+
* `routed` used to be read once, in onCreate, to decide whether to listen.
|
|
55
|
+
* Toggling it afterwards left the listener either missing (routed turned
|
|
56
|
+
* on) or leaked (turned off).
|
|
57
|
+
*/
|
|
58
|
+
private _routedListenerAttached;
|
|
59
|
+
/** Attach or detach the routed-mode listener to match `routed`. */
|
|
60
|
+
private syncRoutedListener;
|
|
51
61
|
onCreate(): void;
|
|
52
62
|
onRender(): void;
|
|
53
63
|
onDestroy(): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"steps.component.d.ts","sourceRoot":"","sources":["../../../../src/components/navigation/steps/steps.component.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACnF,OAAO,KAAK,EAAE,YAAY,EAAE,gBAAgB,EAAE,cAAc,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"steps.component.d.ts","sourceRoot":"","sources":["../../../../src/components/navigation/steps/steps.component.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,kBAAkB,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MAAM,GAAG,UAAU;IAUnD,0DAA0D;IACnD,oBAAoB,IAAI,MAAM;IAMrC,2BAA2B;IACpB,aAAa,IAAI,MAAM;IAI9B,6CAA6C;IACtC,WAAW,IAAI,UAAU,EAAE;IAelC,wBAAwB;IACxB,OAAO,CAAC,cAAc;IAItB,yCAAyC;IACzC,OAAO,CAAC,uBAAuB;IAqB/B,8BAA8B;IAC9B,OAAO,CAAC,qBAAqB;IAuB7B,4EAA4E;IAC5E,OAAO,CAAC,SAAS;IAcjB,0CAA0C;IAC1C,OAAO,CAAC,aAAa;IAQrB,6CAA6C;IAC7C,OAAO,CAAC,YAAY;CAGpB"}
|
|
@@ -7,6 +7,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
7
7
|
import { Injector, MelodicComponent, RouterService } from '@melodicdev/core';
|
|
8
8
|
import { stepsTemplate } from './steps.template.js';
|
|
9
9
|
import { stepsStyles } from './steps.styles.js';
|
|
10
|
+
import { matchTabByRoute } from '../functions/match-by-route.function.js';
|
|
10
11
|
/**
|
|
11
12
|
* ml-steps - Multi-step progress/wizard component
|
|
12
13
|
*
|
|
@@ -55,6 +56,14 @@ let StepsComponent = class StepsComponent {
|
|
|
55
56
|
this._slottedSteps = [];
|
|
56
57
|
/** Navigation event listener for routed mode */
|
|
57
58
|
this._handleNavigation = this.onNavigation.bind(this);
|
|
59
|
+
/**
|
|
60
|
+
* Whether the NavigationEvent listener is currently attached.
|
|
61
|
+
*
|
|
62
|
+
* `routed` used to be read once, in onCreate, to decide whether to listen.
|
|
63
|
+
* Toggling it afterwards left the listener either missing (routed turned
|
|
64
|
+
* on) or leaked (turned off).
|
|
65
|
+
*/
|
|
66
|
+
this._routedListenerAttached = false;
|
|
58
67
|
/** Handle step slot changes */
|
|
59
68
|
this.handleStepSlotChange = (event) => {
|
|
60
69
|
const slot = event.target;
|
|
@@ -148,21 +157,40 @@ let StepsComponent = class StepsComponent {
|
|
|
148
157
|
}
|
|
149
158
|
};
|
|
150
159
|
}
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
this.
|
|
160
|
+
/** Attach or detach the routed-mode listener to match `routed`. */
|
|
161
|
+
syncRoutedListener() {
|
|
162
|
+
if (this.routed === this._routedListenerAttached) {
|
|
163
|
+
return;
|
|
164
|
+
}
|
|
154
165
|
if (this.routed) {
|
|
155
166
|
window.addEventListener('NavigationEvent', this._handleNavigation);
|
|
167
|
+
this._routedListenerAttached = true;
|
|
156
168
|
this.syncWithRoute();
|
|
157
169
|
}
|
|
170
|
+
else {
|
|
171
|
+
window.removeEventListener('NavigationEvent', this._handleNavigation);
|
|
172
|
+
this._routedListenerAttached = false;
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
onCreate() {
|
|
176
|
+
// Listen for step click events from slotted ml-step elements
|
|
177
|
+
this.elementRef.addEventListener('ml:step-click', this.handleSlottedStepClick);
|
|
178
|
+
this.syncRoutedListener();
|
|
158
179
|
}
|
|
159
180
|
onRender() {
|
|
181
|
+
this.syncRoutedListener();
|
|
182
|
+
// Slotted <ml-step> elements are in the LIGHT dom, so this component's
|
|
183
|
+
// own re-render never touches them. Without this, a programmatic
|
|
184
|
+
// `active` / `variant` / `color` / `connector` / `orientation` /
|
|
185
|
+
// `compact` change moved the panel but left every step header stale.
|
|
186
|
+
this.updateSlottedStepStates();
|
|
160
187
|
this.updatePanelVisibility();
|
|
161
188
|
}
|
|
162
189
|
onDestroy() {
|
|
163
190
|
this.elementRef.removeEventListener('ml:step-click', this.handleSlottedStepClick);
|
|
164
|
-
if (this.
|
|
191
|
+
if (this._routedListenerAttached) {
|
|
165
192
|
window.removeEventListener('NavigationEvent', this._handleNavigation);
|
|
193
|
+
this._routedListenerAttached = false;
|
|
166
194
|
}
|
|
167
195
|
}
|
|
168
196
|
/** Apply the active step state and notify consumers. */
|
|
@@ -218,9 +246,12 @@ let StepsComponent = class StepsComponent {
|
|
|
218
246
|
/** Update attributes on slotted steps */
|
|
219
247
|
updateSlottedStepStates() {
|
|
220
248
|
const allSteps = this.getAllSteps();
|
|
249
|
+
// Status is a function of position relative to the active step, so
|
|
250
|
+
// resolve the active index ONCE instead of scanning the list twice per
|
|
251
|
+
// step (which made the sync O(n²)).
|
|
252
|
+
const activeIndex = allSteps.findIndex((step) => step.value === this.active);
|
|
221
253
|
this._slottedSteps.forEach((step, index) => {
|
|
222
|
-
const
|
|
223
|
-
const status = this.getStepStatus(value);
|
|
254
|
+
const status = index < activeIndex ? 'completed' : index === activeIndex ? 'current' : 'upcoming';
|
|
224
255
|
step.setAttribute('status', status);
|
|
225
256
|
step.setAttribute('variant', this.variant);
|
|
226
257
|
step.setAttribute('connector', this.connector);
|
|
@@ -241,7 +272,10 @@ let StepsComponent = class StepsComponent {
|
|
|
241
272
|
panels.forEach((panel) => {
|
|
242
273
|
const value = panel.getAttribute('value');
|
|
243
274
|
const isActive = value === this.active;
|
|
244
|
-
|
|
275
|
+
// `hidden`, not an inline `display` — an inline style beats every
|
|
276
|
+
// stylesheet rule, so a consumer could not style a panel (an entry
|
|
277
|
+
// animation, a different display mode) at all.
|
|
278
|
+
panel.hidden = !isActive;
|
|
245
279
|
// Name the panel after its step. ARIA id references cannot cross
|
|
246
280
|
// shadow-root boundaries, so the association is made by accessible
|
|
247
281
|
// name instead of aria-labelledby/aria-controls (see tabs.component).
|
|
@@ -266,8 +300,7 @@ let StepsComponent = class StepsComponent {
|
|
|
266
300
|
}
|
|
267
301
|
/** Sync active step with current route */
|
|
268
302
|
syncWithRoute() {
|
|
269
|
-
const
|
|
270
|
-
const matchingStep = this.getAllSteps().find((step) => step.href && path.startsWith(step.href));
|
|
303
|
+
const matchingStep = matchTabByRoute(this.getAllSteps(), window.location.pathname);
|
|
271
304
|
if (matchingStep) {
|
|
272
305
|
this.active = matchingStep.value;
|
|
273
306
|
this.updateSlottedStepStates();
|
|
@@ -64,6 +64,15 @@ function renderConfigStep(c, step, index) {
|
|
|
64
64
|
aria-disabled=${step.disabled || false}
|
|
65
65
|
tabindex=${status === 'current' ? '0' : '-1'}
|
|
66
66
|
@click=${() => c.handleStepClick(step.value, step.href)}
|
|
67
|
+
@keydown=${(e) => {
|
|
68
|
+
// A role="tab" div must activate on Enter/Space; arrows are
|
|
69
|
+
// handled by the tablist above. Without this the step was
|
|
70
|
+
// focusable and un-activatable by keyboard.
|
|
71
|
+
if (e.key !== 'Enter' && e.key !== ' ')
|
|
72
|
+
return;
|
|
73
|
+
e.preventDefault();
|
|
74
|
+
c.handleStepClick(step.value, step.href);
|
|
75
|
+
}}
|
|
67
76
|
>
|
|
68
77
|
${when(isBar, () => renderBarStep(c, step))}
|
|
69
78
|
${when(!isBar && !isCompact, () => renderStandardStep(c, step, index, isFirst, isLast, status))}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tab-panel.styles.d.ts","sourceRoot":"","sources":["../../../../src/components/navigation/tabs/tab-panel.styles.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,cAAc,
|
|
1
|
+
{"version":3,"file":"tab-panel.styles.d.ts","sourceRoot":"","sources":["../../../../src/components/navigation/tabs/tab-panel.styles.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,cAAc,iDAsB1B,CAAC"}
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import { css } from '@melodicdev/core';
|
|
2
2
|
export const tabPanelStyles = () => css `
|
|
3
3
|
:host {
|
|
4
|
+
/* ── Tab panel: focus ── */
|
|
5
|
+
--ml-tab-panel-focus-width: 2px;
|
|
6
|
+
--ml-tab-panel-focus-color: var(--ml-color-primary);
|
|
7
|
+
--ml-tab-panel-focus-offset: 2px;
|
|
8
|
+
|
|
4
9
|
display: block;
|
|
5
10
|
}
|
|
6
11
|
|
|
@@ -13,7 +18,7 @@ export const tabPanelStyles = () => css `
|
|
|
13
18
|
}
|
|
14
19
|
|
|
15
20
|
.ml-tab-panel:focus-visible {
|
|
16
|
-
outline:
|
|
17
|
-
outline-offset:
|
|
21
|
+
outline: var(--ml-tab-panel-focus-width) solid var(--ml-tab-panel-focus-color);
|
|
22
|
+
outline-offset: var(--ml-tab-panel-focus-offset);
|
|
18
23
|
}
|
|
19
24
|
`;
|
|
@@ -55,6 +55,16 @@ export declare class TabsComponent implements IElementRef, OnCreate, OnDestroy,
|
|
|
55
55
|
private _slottedTabs;
|
|
56
56
|
/** Navigation event listener for routed mode */
|
|
57
57
|
private readonly _handleNavigation;
|
|
58
|
+
/**
|
|
59
|
+
* Whether the NavigationEvent listener is currently attached.
|
|
60
|
+
*
|
|
61
|
+
* `routed` used to be read once, in onCreate, to decide whether to listen.
|
|
62
|
+
* Toggling it afterwards left the listener either missing (routed turned
|
|
63
|
+
* on) or leaked (turned off).
|
|
64
|
+
*/
|
|
65
|
+
private _routedListenerAttached;
|
|
66
|
+
/** Attach or detach the routed-mode listener to match `routed`. */
|
|
67
|
+
private syncRoutedListener;
|
|
58
68
|
/** Listener for ml:tab-click from slotted ml-tab elements */
|
|
59
69
|
private readonly _handleTabClick;
|
|
60
70
|
onCreate(): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tabs.component.d.ts","sourceRoot":"","sources":["../../../../src/components/navigation/tabs/tabs.component.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACnF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"tabs.component.d.ts","sourceRoot":"","sources":["../../../../src/components/navigation/tabs/tabs.component.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACnF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,K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AAqB;IAyB7B,yEAAyE;IACzE,OAAO,CAAC,QAAQ;IAchB,2DAA2D;IAC3D,OAAO,CAAC,aAAa;IAQrB,6CAA6C;IAC7C,OAAO,CAAC,YAAY;CAGpB"}
|
|
@@ -7,6 +7,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
7
7
|
import { Injector, MelodicComponent, RouterService } from '@melodicdev/core';
|
|
8
8
|
import { tabsTemplate } from './tabs.template.js';
|
|
9
9
|
import { tabsStyles } from './tabs.styles.js';
|
|
10
|
+
import { matchTabByRoute } from '../functions/match-by-route.function.js';
|
|
10
11
|
/**
|
|
11
12
|
* ml-tabs - Tabbed interface component with optional router integration
|
|
12
13
|
*
|
|
@@ -61,6 +62,14 @@ let TabsComponent = class TabsComponent {
|
|
|
61
62
|
this._slottedTabs = [];
|
|
62
63
|
/** Navigation event listener for routed mode */
|
|
63
64
|
this._handleNavigation = this.onNavigation.bind(this);
|
|
65
|
+
/**
|
|
66
|
+
* Whether the NavigationEvent listener is currently attached.
|
|
67
|
+
*
|
|
68
|
+
* `routed` used to be read once, in onCreate, to decide whether to listen.
|
|
69
|
+
* Toggling it afterwards left the listener either missing (routed turned
|
|
70
|
+
* on) or leaked (turned off).
|
|
71
|
+
*/
|
|
72
|
+
this._routedListenerAttached = false;
|
|
64
73
|
/** Listener for ml:tab-click from slotted ml-tab elements */
|
|
65
74
|
this._handleTabClick = (event) => {
|
|
66
75
|
// ml:tab-click is internal tab→tabs coordination; consumers get ml:change.
|
|
@@ -139,21 +148,39 @@ let TabsComponent = class TabsComponent {
|
|
|
139
148
|
}
|
|
140
149
|
};
|
|
141
150
|
}
|
|
142
|
-
|
|
143
|
-
|
|
151
|
+
/** Attach or detach the routed-mode listener to match `routed`. */
|
|
152
|
+
syncRoutedListener() {
|
|
153
|
+
if (this.routed === this._routedListenerAttached) {
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
144
156
|
if (this.routed) {
|
|
145
157
|
window.addEventListener('NavigationEvent', this._handleNavigation);
|
|
158
|
+
this._routedListenerAttached = true;
|
|
146
159
|
this.syncWithRoute();
|
|
147
160
|
}
|
|
161
|
+
else {
|
|
162
|
+
window.removeEventListener('NavigationEvent', this._handleNavigation);
|
|
163
|
+
this._routedListenerAttached = false;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
onCreate() {
|
|
167
|
+
this.elementRef.addEventListener('ml:tab-click', this._handleTabClick);
|
|
168
|
+
this.syncRoutedListener();
|
|
148
169
|
}
|
|
149
170
|
onRender() {
|
|
150
|
-
|
|
171
|
+
this.syncRoutedListener();
|
|
172
|
+
// Slotted <ml-tab> elements live in the LIGHT dom, so a re-render of
|
|
173
|
+
// this component's own template does not touch them. Syncing only the
|
|
174
|
+
// panels meant a programmatic `value` write moved the panel but left
|
|
175
|
+
// the tab itself looking unselected.
|
|
176
|
+
this.updateTabStates();
|
|
151
177
|
this.updatePanelVisibility();
|
|
152
178
|
}
|
|
153
179
|
onDestroy() {
|
|
154
180
|
this.elementRef.removeEventListener('ml:tab-click', this._handleTabClick);
|
|
155
|
-
if (this.
|
|
181
|
+
if (this._routedListenerAttached) {
|
|
156
182
|
window.removeEventListener('NavigationEvent', this._handleNavigation);
|
|
183
|
+
this._routedListenerAttached = false;
|
|
157
184
|
}
|
|
158
185
|
}
|
|
159
186
|
/** Apply the active tab state and notify consumers. */
|
|
@@ -200,7 +227,10 @@ let TabsComponent = class TabsComponent {
|
|
|
200
227
|
panels.forEach((panel) => {
|
|
201
228
|
const value = panel.getAttribute('value');
|
|
202
229
|
const isActive = value === this.value;
|
|
203
|
-
|
|
230
|
+
// `hidden`, not an inline `display` — an inline style beats every
|
|
231
|
+
// stylesheet rule, so a consumer could not style a panel (an entry
|
|
232
|
+
// animation, a different display mode) at all.
|
|
233
|
+
panel.hidden = !isActive;
|
|
204
234
|
// Name the panel after its tab. ARIA id references cannot cross
|
|
205
235
|
// shadow-root boundaries (the tab's role="tab" element and the
|
|
206
236
|
// panel's role="tabpanel" element live in different shadow trees),
|
|
@@ -227,8 +257,7 @@ let TabsComponent = class TabsComponent {
|
|
|
227
257
|
}
|
|
228
258
|
/** Sync active tab with current route (for routed mode) */
|
|
229
259
|
syncWithRoute() {
|
|
230
|
-
const
|
|
231
|
-
const matchingTab = this.getAllTabs().find((tab) => tab.href && path.startsWith(tab.href));
|
|
260
|
+
const matchingTab = matchTabByRoute(this.getAllTabs(), window.location.pathname);
|
|
232
261
|
if (matchingTab) {
|
|
233
262
|
this.value = matchingTab.value;
|
|
234
263
|
this.updateTabStates();
|
|
@@ -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,W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