@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
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { IElementRef
|
|
1
|
+
import type { IElementRef } from '@melodicdev/core';
|
|
2
2
|
import type { ControlSize } from '../../../types/index.js';
|
|
3
3
|
/**
|
|
4
4
|
* ml-textarea - Multi-line text input component
|
|
@@ -15,7 +15,7 @@ import type { ControlSize } from '../../../types/index.js';
|
|
|
15
15
|
* @fires ml:focus - Emitted on focus
|
|
16
16
|
* @fires ml:blur - Emitted on blur
|
|
17
17
|
*/
|
|
18
|
-
export declare class TextareaComponent implements IElementRef
|
|
18
|
+
export declare class TextareaComponent implements IElementRef {
|
|
19
19
|
elementRef: HTMLElement;
|
|
20
20
|
/** Current value */
|
|
21
21
|
value: string;
|
|
@@ -43,7 +43,14 @@ export declare class TextareaComponent implements IElementRef, OnInit {
|
|
|
43
43
|
resize: boolean;
|
|
44
44
|
/** Internal focus state */
|
|
45
45
|
focused: boolean;
|
|
46
|
-
|
|
46
|
+
/** Form field name, forwarded to the inner textarea. */
|
|
47
|
+
name: string;
|
|
48
|
+
/**
|
|
49
|
+
* Accessible name for the inner control when there is no visible label.
|
|
50
|
+
* An `aria-label` on the HOST names the custom element, not the
|
|
51
|
+
* `<textarea>` inside its shadow root.
|
|
52
|
+
*/
|
|
53
|
+
get fieldLabel(): string;
|
|
47
54
|
handleInput: (event: Event) => void;
|
|
48
55
|
handleChange: (event: Event) => void;
|
|
49
56
|
handleFocus: () => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"textarea.component.d.ts","sourceRoot":"","sources":["../../../../src/components/forms/textarea/textarea.component.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"textarea.component.d.ts","sourceRoot":"","sources":["../../../../src/components/forms/textarea/textarea.component.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAEpD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAY3D;;;;;;;;;;;;;;GAcG;AACH,qBAMa,iBAAkB,YAAW,WAAW;IAC7C,UAAU,EAAG,WAAW,CAAC;IAEhC,oBAAoB;IACb,KAAK,SAAM;IAElB,uBAAuB;IAChB,WAAW,SAAM;IAExB,iBAAiB;IACV,KAAK,SAAM;IAElB,qCAAqC;IAC9B,IAAI,SAAM;IAEjB,iDAAiD;IAC1C,KAAK,SAAM;IAElB,iBAAiB;IACV,IAAI,EAAE,WAAW,CAAQ;IAEhC,mCAAmC;IAC5B,IAAI,SAAK;IAEhB,+BAA+B;IACxB,SAAS,SAAK;IAErB,2BAA2B;IACpB,QAAQ,UAAS;IAExB,6BAA6B;IACtB,QAAQ,UAAS;IAExB,uBAAuB;IAChB,QAAQ,UAAS;IAExB,4BAA4B;IACrB,MAAM,UAAS;IAEtB,2BAA2B;IACpB,OAAO,UAAS;IAEvB,wDAAwD;IACjD,IAAI,SAAM;IAEjB;;;;OAIG;IACH,IAAW,UAAU,IAAI,MAAM,CAE9B;IAEM,WAAW,GAAI,OAAO,KAAK,KAAG,IAAI,CAWvC;IAEK,YAAY,GAAI,OAAO,KAAK,KAAG,IAAI,CAWxC;IAEK,WAAW,QAAO,IAAI,CAQ3B;IAEK,UAAU,QAAO,IAAI,CAQ1B;CACF"}
|
|
@@ -58,6 +58,8 @@ let TextareaComponent = class TextareaComponent {
|
|
|
58
58
|
this.resize = false;
|
|
59
59
|
/** Internal focus state */
|
|
60
60
|
this.focused = false;
|
|
61
|
+
/** Form field name, forwarded to the inner textarea. */
|
|
62
|
+
this.name = '';
|
|
61
63
|
this.handleInput = (event) => {
|
|
62
64
|
const target = event.target;
|
|
63
65
|
this.value = target.value;
|
|
@@ -91,10 +93,13 @@ let TextareaComponent = class TextareaComponent {
|
|
|
91
93
|
}));
|
|
92
94
|
};
|
|
93
95
|
}
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
96
|
+
/**
|
|
97
|
+
* Accessible name for the inner control when there is no visible label.
|
|
98
|
+
* An `aria-label` on the HOST names the custom element, not the
|
|
99
|
+
* `<textarea>` inside its shadow root.
|
|
100
|
+
*/
|
|
101
|
+
get fieldLabel() {
|
|
102
|
+
return this.label || this.elementRef?.getAttribute('aria-label') || this.placeholder || '';
|
|
98
103
|
}
|
|
99
104
|
};
|
|
100
105
|
TextareaComponent = __decorate([
|
|
@@ -102,7 +107,7 @@ TextareaComponent = __decorate([
|
|
|
102
107
|
selector: 'ml-textarea',
|
|
103
108
|
template: textareaTemplate,
|
|
104
109
|
styles: textareaStyles,
|
|
105
|
-
attributes: ['value', 'placeholder', 'label', 'hint', 'error', 'size', 'rows', 'max-length', 'disabled', 'readonly', 'required', 'resize']
|
|
110
|
+
attributes: ['value', 'placeholder', 'label', 'hint', 'error', 'size', 'rows', 'max-length', 'disabled', 'readonly', 'required', 'resize', 'name']
|
|
106
111
|
})
|
|
107
112
|
], TextareaComponent);
|
|
108
113
|
export { TextareaComponent };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"textarea.template.d.ts","sourceRoot":"","sources":["../../../../src/components/forms/textarea/textarea.template.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAEjE,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,iBAAiB,
|
|
1
|
+
{"version":3,"file":"textarea.template.d.ts","sourceRoot":"","sources":["../../../../src/components/forms/textarea/textarea.template.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAEjE,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,iBAAiB,6CA0DpD"}
|
|
@@ -29,6 +29,8 @@ export function textareaTemplate(c) {
|
|
|
29
29
|
?readonly=${c.readonly}
|
|
30
30
|
?required=${c.required}
|
|
31
31
|
maxlength="${c.maxLength || ''}"
|
|
32
|
+
name="${c.name}"
|
|
33
|
+
aria-label=${c.label ? '' : c.fieldLabel}
|
|
32
34
|
aria-invalid=${c.error ? 'true' : 'false'}
|
|
33
35
|
aria-describedby=${c.error ? 'error' : c.hint ? 'hint' : ''}
|
|
34
36
|
@input=${c.handleInput}
|
|
@@ -86,7 +86,23 @@ export declare class TimePickerComponent implements IElementRef, OnCreate, OnDes
|
|
|
86
86
|
private closePopover;
|
|
87
87
|
private startPositioning;
|
|
88
88
|
private updatePosition;
|
|
89
|
+
/**
|
|
90
|
+
* Return focus to the input — but only when focus was still inside this
|
|
91
|
+
* component (Escape, a selection, a click on the trigger). Closing because
|
|
92
|
+
* the user clicked or tabbed somewhere else used to yank focus back here,
|
|
93
|
+
* which made the picker impossible to leave.
|
|
94
|
+
*/
|
|
89
95
|
private returnFocus;
|
|
96
|
+
/** Minutes since midnight for an `HH:mm[:ss]` string, or null. */
|
|
97
|
+
private toMinutes;
|
|
98
|
+
/**
|
|
99
|
+
* Clamp the edited time into the `min`/`max` window.
|
|
100
|
+
*
|
|
101
|
+
* The typed-input path validated against min/max; the popover's steppers
|
|
102
|
+
* and Now button did not, so the picker happily produced an out-of-range
|
|
103
|
+
* value the same component would reject when typed.
|
|
104
|
+
*/
|
|
105
|
+
private clampEditToRange;
|
|
90
106
|
private getInputEl;
|
|
91
107
|
private getTriggerEl;
|
|
92
108
|
private getPopoverEl;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"time-picker.component.d.ts","sourceRoot":"","sources":["../../../../src/components/forms/time-picker/time-picker.component.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"time-picker.component.d.ts","sourceRoot":"","sources":["../../../../src/components/forms/time-picker/time-picker.component.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAwCzE;;;;;;;;;;;GAWG;AACH,qBAMa,mBAAoB,YAAW,WAAW,EAAE,QAAQ,EAAE,SAAS;IACpE,UAAU,EAAG,WAAW,CAAC;IAEhC,gDAAgD;IACzC,KAAK,SAAM;IAElB,uBAAuB;IAChB,WAAW,SAAiB;IAEnC,kBAAkB;IACX,KAAK,SAAM;IAElB,gBAAgB;IACT,IAAI,SAAM;IAEjB,oBAAoB;IACb,KAAK,SAAM;IAElB,iBAAiB;IACV,IAAI,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CAAQ;IAEvC,qBAAqB;IACd,QAAQ,UAAS;IAExB,qBAAqB;IACd,QAAQ,UAAS;IAExB,sCAAsC;IAC/B,GAAG,SAAM;IAEhB,sCAAsC;IAC/B,GAAG,SAAM;IAEhB,uFAAuF;IAChF,IAAI,SAAM;IAEjB,oDAAoD;IAC7C,UAAU,UAAQ;IAEzB,kCAAkC;IAC3B,MAAM,UAAS;IAEtB,2BAA2B;IACpB,QAAQ,SAAK;IAEpB,6BAA6B;IACtB,UAAU,SAAK;IAEtB,6BAA6B;IACtB,UAAU,SAAK;IAEtB,oCAAoC;IAC7B,UAAU,EAAE,IAAI,GAAG,IAAI,CAAQ;IAEtC,OAAO,CAAC,kBAAkB,CAA6B;IAEvD,IAAW,SAAS,IAAI,OAAO,CAE9B;IAED,IAAW,WAAW,IAAI,OAAO,CAEhC;IAED,IAAW,YAAY,IAAI,MAAM,CAEhC;IAED,IAAW,WAAW,IAAI,MAAM,CAQ/B;IAED,IAAW,aAAa,IAAI,MAAM,CAEjC;IAED,IAAW,aAAa,IAAI,MAAM,CAEjC;IAEM,QAAQ,IAAI,IAAI;IAOhB,SAAS,IAAI,IAAI;IAQjB,aAAa,QAAO,IAAI,CAM7B;IAEK,aAAa,QAAO,IAAI,CAS7B;IAEK,aAAa,QAAO,IAAI,CAQ7B;IAEK,eAAe,QAAO,IAAI,CAE/B;IAEK,eAAe,QAAO,IAAI,CAE/B;IAEK,eAAe,QAAO,IAAI,CAE/B;IAEK,eAAe,QAAO,IAAI,CAE/B;IAEK,YAAY,QAAO,IAAI,CAI5B;IAEK,gBAAgB,QAAO,IAAI,CAQhC;IAEK,cAAc,QAAO,IAAI,CAO9B;IAEF,uDAAuD;IAChD,eAAe,GAAI,OAAO,KAAK,KAAG,IAAI,CAG3C;IAEF,2CAA2C;IACpC,gBAAgB,QAAO,IAAI,CAIhC;IAEK,aAAa,GAAI,OAAO,aAAa,KAAG,IAAI,CAmBjD;IAEK,eAAe,GAAI,OAAO,KAAK,KAAG,IAAI,CAa3C;IAEK,iBAAiB,GAAI,OAAO,KAAK,KAAG,IAAI,CAO7C;IAEK,iBAAiB,GAAI,OAAO,KAAK,KAAG,IAAI,CAO7C;IAEK,cAAc,QAAO,IAAI,CAK9B;IAEK,gBAAgB,QAAO,IAAI,CAEhC;IAEK,gBAAgB,QAAO,IAAI,CAEhC;IAEK,gBAAgB,GAAI,OAAO,KAAK,KAAG,IAAI,CAE5C;IAEK,oBAAoB,GAAI,OAAO,aAAa,KAAG,IAAI,CAkBxD;IAEF,OAAO,CAAC,QAAQ;IAKhB,OAAO,CAAC,iBAAiB;IAezB,OAAO,CAAC,WAAW;IAWnB,OAAO,CAAC,QAAQ,CAAC,aAAa,CAY5B;IAEF,OAAO,CAAC,YAAY;IAOpB,OAAO,CAAC,gBAAgB;IAUxB,OAAO,CAAC,cAAc;IAUtB;;;;;OAKG;IACH,OAAO,CAAC,WAAW;IAWnB,kEAAkE;IAClE,OAAO,CAAC,SAAS;IAWjB;;;;;;OAMG;IACH,OAAO,CAAC,gBAAgB;IAgBxB,OAAO,CAAC,UAAU;IAIlB,OAAO,CAAC,YAAY;IAIpB,OAAO,CAAC,YAAY;CAGpB"}
|
|
@@ -9,6 +9,7 @@ import { registerAdapter } from '@melodicdev/core/forms';
|
|
|
9
9
|
import { computePosition, autoUpdate, offset, flip, shift } from '../../../utils/positioning/index.js';
|
|
10
10
|
import { timePickerTemplate } from './time-picker.template.js';
|
|
11
11
|
import { timePickerStyles } from './time-picker.styles.js';
|
|
12
|
+
import { getDeepActiveElement } from '../../../utils/accessibility/focus-trap.js';
|
|
12
13
|
registerAdapter((el) => el.tagName === 'ML-TIME-PICKER', {
|
|
13
14
|
inputEvent: 'ml:change',
|
|
14
15
|
blurEvent: 'focusout',
|
|
@@ -141,6 +142,7 @@ let TimePickerComponent = class TimePickerComponent {
|
|
|
141
142
|
this.editHour = this.to24Hour(h12, this.editPeriod);
|
|
142
143
|
};
|
|
143
144
|
this.confirmSelection = () => {
|
|
145
|
+
this.clampEditToRange();
|
|
144
146
|
let timeStr = `${pad(this.editHour)}:${pad(this.editMinute)}`;
|
|
145
147
|
if (this.showSeconds) {
|
|
146
148
|
timeStr += `:${pad(this.editSecond)}`;
|
|
@@ -154,6 +156,7 @@ let TimePickerComponent = class TimePickerComponent {
|
|
|
154
156
|
this.editMinute = now.getMinutes();
|
|
155
157
|
this.editSecond = now.getSeconds();
|
|
156
158
|
this.editPeriod = this.editHour >= 12 ? 'PM' : 'AM';
|
|
159
|
+
this.clampEditToRange();
|
|
157
160
|
};
|
|
158
161
|
/** Called when the user types a time into the input */
|
|
159
162
|
this.handleTimeInput = (event) => {
|
|
@@ -374,11 +377,48 @@ let TimePickerComponent = class TimePickerComponent {
|
|
|
374
377
|
popoverEl.style.left = `${x}px`;
|
|
375
378
|
popoverEl.style.top = `${y}px`;
|
|
376
379
|
}
|
|
380
|
+
/**
|
|
381
|
+
* Return focus to the input — but only when focus was still inside this
|
|
382
|
+
* component (Escape, a selection, a click on the trigger). Closing because
|
|
383
|
+
* the user clicked or tabbed somewhere else used to yank focus back here,
|
|
384
|
+
* which made the picker impossible to leave.
|
|
385
|
+
*/
|
|
377
386
|
returnFocus() {
|
|
378
|
-
const
|
|
379
|
-
|
|
380
|
-
|
|
387
|
+
const active = getDeepActiveElement();
|
|
388
|
+
const focusMovedAway = active !== null && active !== document.body && !this.elementRef.contains(active) && !this.elementRef.shadowRoot?.contains(active);
|
|
389
|
+
if (focusMovedAway) {
|
|
390
|
+
return;
|
|
391
|
+
}
|
|
392
|
+
this.getInputEl()?.focus();
|
|
393
|
+
}
|
|
394
|
+
/** Minutes since midnight for an `HH:mm[:ss]` string, or null. */
|
|
395
|
+
toMinutes(time) {
|
|
396
|
+
const parts = time.split(':');
|
|
397
|
+
if (parts.length < 2) {
|
|
398
|
+
return null;
|
|
381
399
|
}
|
|
400
|
+
const hours = Number.parseInt(parts[0], 10);
|
|
401
|
+
const minutes = Number.parseInt(parts[1], 10);
|
|
402
|
+
return Number.isNaN(hours) || Number.isNaN(minutes) ? null : hours * 60 + minutes;
|
|
403
|
+
}
|
|
404
|
+
/**
|
|
405
|
+
* Clamp the edited time into the `min`/`max` window.
|
|
406
|
+
*
|
|
407
|
+
* The typed-input path validated against min/max; the popover's steppers
|
|
408
|
+
* and Now button did not, so the picker happily produced an out-of-range
|
|
409
|
+
* value the same component would reject when typed.
|
|
410
|
+
*/
|
|
411
|
+
clampEditToRange() {
|
|
412
|
+
const current = this.editHour * 60 + this.editMinute;
|
|
413
|
+
const min = this.min ? this.toMinutes(this.min) : null;
|
|
414
|
+
const max = this.max ? this.toMinutes(this.max) : null;
|
|
415
|
+
const clamped = min !== null && current < min ? min : max !== null && current > max ? max : current;
|
|
416
|
+
if (clamped === current) {
|
|
417
|
+
return;
|
|
418
|
+
}
|
|
419
|
+
this.editHour = Math.floor(clamped / 60);
|
|
420
|
+
this.editMinute = clamped % 60;
|
|
421
|
+
this.editPeriod = this.editHour >= 12 ? 'PM' : 'AM';
|
|
382
422
|
}
|
|
383
423
|
getInputEl() {
|
|
384
424
|
return this.elementRef.shadowRoot?.querySelector('.ml-time-picker__input');
|
|
@@ -40,12 +40,12 @@ let ContainerComponent = class ContainerComponent {
|
|
|
40
40
|
xl: '1280px',
|
|
41
41
|
full: '100%'
|
|
42
42
|
};
|
|
43
|
+
// Component-scoped custom properties, not inline declarations — see the
|
|
44
|
+
// note on ml-stack.getStyles().
|
|
43
45
|
return {
|
|
44
|
-
'max-width': maxWidthMap[this.size],
|
|
45
|
-
'padding-
|
|
46
|
-
'
|
|
47
|
-
'margin-left': this.centered ? 'auto' : '0',
|
|
48
|
-
'margin-right': this.centered ? 'auto' : '0'
|
|
46
|
+
'--ml-container-max-width': maxWidthMap[this.size],
|
|
47
|
+
'--ml-container-padding-x': `var(--ml-space-${this.padding})`,
|
|
48
|
+
'--ml-container-margin-x': this.centered ? 'auto' : '0'
|
|
49
49
|
};
|
|
50
50
|
}
|
|
51
51
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"container.styles.d.ts","sourceRoot":"","sources":["../../../../src/components/foundation/container/container.styles.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,eAAe,
|
|
1
|
+
{"version":3,"file":"container.styles.d.ts","sourceRoot":"","sources":["../../../../src/components/foundation/container/container.styles.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,eAAe,iDAmB3B,CAAC"}
|
|
@@ -1,11 +1,21 @@
|
|
|
1
1
|
import { css } from '@melodicdev/core';
|
|
2
2
|
export const containerStyles = () => css `
|
|
3
3
|
:host {
|
|
4
|
+
/* ── Container: layout ── */
|
|
5
|
+
--ml-container-max-width: 1024px;
|
|
6
|
+
--ml-container-padding-x: var(--ml-space-4);
|
|
7
|
+
--ml-container-margin-x: auto;
|
|
8
|
+
|
|
4
9
|
display: block;
|
|
5
10
|
width: 100%;
|
|
6
11
|
}
|
|
7
12
|
|
|
8
13
|
.ml-container {
|
|
9
14
|
width: 100%;
|
|
15
|
+
max-width: var(--ml-container-max-width);
|
|
16
|
+
padding-left: var(--ml-container-padding-x);
|
|
17
|
+
padding-right: var(--ml-container-padding-x);
|
|
18
|
+
margin-left: var(--ml-container-margin-x);
|
|
19
|
+
margin-right: var(--ml-container-margin-x);
|
|
10
20
|
}
|
|
11
21
|
`;
|
|
@@ -30,6 +30,12 @@ export declare class StackComponent implements IElementRef {
|
|
|
30
30
|
justify: Justify;
|
|
31
31
|
/** Allow items to wrap */
|
|
32
32
|
wrap: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Layout values, exposed as component-scoped custom properties rather than
|
|
35
|
+
* inline declarations. An inline `style` beats every stylesheet rule, so
|
|
36
|
+
* inline layout could not be overridden — not by a token, not by a class,
|
|
37
|
+
* not by a media query.
|
|
38
|
+
*/
|
|
33
39
|
getStyles(): Record<string, string>;
|
|
34
40
|
}
|
|
35
41
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stack.component.d.ts","sourceRoot":"","sources":["../../../../src/components/foundation/stack/stack.component.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAI3D,KAAK,SAAS,GAAG,OAAO,GAAG,QAAQ,GAAG,KAAK,GAAG,SAAS,GAAG,UAAU,CAAC;AACrE,KAAK,OAAO,GAAG,OAAO,GAAG,QAAQ,GAAG,KAAK,GAAG,SAAS,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAE5E;;;;;;;;;;;;;;;GAeG;AACH,qBAMa,cAAe,YAAW,WAAW;IAC1C,UAAU,EAAG,WAAW,CAAC;IAEhC,sBAAsB;IACf,SAAS,EAAE,WAAW,CAAc;IAE3C,mDAAmD;IAC5C,GAAG,EAAE,MAAM,CAAO;IAEzB,2BAA2B;IACpB,KAAK,EAAE,SAAS,CAAa;IAEpC,8BAA8B;IACvB,OAAO,EAAE,OAAO,CAAW;IAElC,0BAA0B;IACnB,IAAI,UAAS;
|
|
1
|
+
{"version":3,"file":"stack.component.d.ts","sourceRoot":"","sources":["../../../../src/components/foundation/stack/stack.component.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAI3D,KAAK,SAAS,GAAG,OAAO,GAAG,QAAQ,GAAG,KAAK,GAAG,SAAS,GAAG,UAAU,CAAC;AACrE,KAAK,OAAO,GAAG,OAAO,GAAG,QAAQ,GAAG,KAAK,GAAG,SAAS,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAE5E;;;;;;;;;;;;;;;GAeG;AACH,qBAMa,cAAe,YAAW,WAAW;IAC1C,UAAU,EAAG,WAAW,CAAC;IAEhC,sBAAsB;IACf,SAAS,EAAE,WAAW,CAAc;IAE3C,mDAAmD;IAC5C,GAAG,EAAE,MAAM,CAAO;IAEzB,2BAA2B;IACpB,KAAK,EAAE,SAAS,CAAa;IAEpC,8BAA8B;IACvB,OAAO,EAAE,OAAO,CAAW;IAElC,0BAA0B;IACnB,IAAI,UAAS;IAEpB;;;;;OAKG;IACI,SAAS,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;CA0B1C"}
|
|
@@ -36,6 +36,12 @@ let StackComponent = class StackComponent {
|
|
|
36
36
|
/** Allow items to wrap */
|
|
37
37
|
this.wrap = false;
|
|
38
38
|
}
|
|
39
|
+
/**
|
|
40
|
+
* Layout values, exposed as component-scoped custom properties rather than
|
|
41
|
+
* inline declarations. An inline `style` beats every stylesheet rule, so
|
|
42
|
+
* inline layout could not be overridden — not by a token, not by a class,
|
|
43
|
+
* not by a media query.
|
|
44
|
+
*/
|
|
39
45
|
getStyles() {
|
|
40
46
|
const alignMap = {
|
|
41
47
|
start: 'flex-start',
|
|
@@ -53,11 +59,11 @@ let StackComponent = class StackComponent {
|
|
|
53
59
|
evenly: 'space-evenly'
|
|
54
60
|
};
|
|
55
61
|
return {
|
|
56
|
-
'
|
|
57
|
-
gap: `var(--ml-space-${this.gap})`,
|
|
58
|
-
'align
|
|
59
|
-
'justify
|
|
60
|
-
'
|
|
62
|
+
'--ml-stack-direction': this.direction === 'vertical' ? 'column' : 'row',
|
|
63
|
+
'--ml-stack-gap': `var(--ml-space-${this.gap})`,
|
|
64
|
+
'--ml-stack-align': alignMap[this.align],
|
|
65
|
+
'--ml-stack-justify': justifyMap[this.justify],
|
|
66
|
+
'--ml-stack-wrap': this.wrap ? 'wrap' : 'nowrap'
|
|
61
67
|
};
|
|
62
68
|
}
|
|
63
69
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stack.styles.d.ts","sourceRoot":"","sources":["../../../../src/components/foundation/stack/stack.styles.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,WAAW,
|
|
1
|
+
{"version":3,"file":"stack.styles.d.ts","sourceRoot":"","sources":["../../../../src/components/foundation/stack/stack.styles.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,WAAW,iDAsBvB,CAAC"}
|
|
@@ -1,10 +1,24 @@
|
|
|
1
1
|
import { css } from '@melodicdev/core';
|
|
2
2
|
export const stackStyles = () => css `
|
|
3
3
|
:host {
|
|
4
|
+
/* ── Stack: layout ──
|
|
5
|
+
Set from the component's properties; override any of them from a
|
|
6
|
+
parent rule to change the layout without touching the markup. */
|
|
7
|
+
--ml-stack-direction: row;
|
|
8
|
+
--ml-stack-gap: var(--ml-space-4);
|
|
9
|
+
--ml-stack-align: stretch;
|
|
10
|
+
--ml-stack-justify: flex-start;
|
|
11
|
+
--ml-stack-wrap: nowrap;
|
|
12
|
+
|
|
4
13
|
display: block;
|
|
5
14
|
}
|
|
6
15
|
|
|
7
16
|
.ml-stack {
|
|
8
17
|
display: flex;
|
|
18
|
+
flex-direction: var(--ml-stack-direction);
|
|
19
|
+
gap: var(--ml-stack-gap);
|
|
20
|
+
align-items: var(--ml-stack-align);
|
|
21
|
+
justify-content: var(--ml-stack-justify);
|
|
22
|
+
flex-wrap: var(--ml-stack-wrap);
|
|
9
23
|
}
|
|
10
24
|
`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"icon.template.d.ts","sourceRoot":"","sources":["../../../../src/components/general/icon/icon.template.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAGzD,eAAO,MAAM,YAAY,GAAI,GAAG,aAAa,
|
|
1
|
+
{"version":3,"file":"icon.template.d.ts","sourceRoot":"","sources":["../../../../src/components/general/icon/icon.template.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAGzD,eAAO,MAAM,YAAY,GAAI,GAAG,aAAa,8CAiB5C,CAAC"}
|
|
@@ -1,8 +1,14 @@
|
|
|
1
|
-
import { html } from '@melodicdev/core';
|
|
1
|
+
import { html, devWarn } from '@melodicdev/core';
|
|
2
2
|
import { PHOSPHOR_ICON_MAP } from './icon.map.js';
|
|
3
3
|
export const iconTemplate = (c) => {
|
|
4
4
|
const className = c.format === 'regular' ? 'ph' : `ph-${c.format}`;
|
|
5
5
|
const codepoint = PHOSPHOR_ICON_MAP[c.icon] ?? '';
|
|
6
|
+
// An unknown name rendered an empty <i> with no diagnostic, so a typo was
|
|
7
|
+
// invisible: the icon simply did not appear.
|
|
8
|
+
if (c.icon && !codepoint) {
|
|
9
|
+
devWarn(`unknown-icon:${c.icon}`, `<ml-icon icon="${c.icon}"> is not a known Phosphor icon name, so nothing is rendered. ` +
|
|
10
|
+
'Check the name against https://phosphoricons.com (kebab-case, e.g. "caret-double-left").');
|
|
11
|
+
}
|
|
6
12
|
// aria-hidden: the ligature codepoint is presentational; without it screen
|
|
7
13
|
// readers announce the raw private-use character.
|
|
8
14
|
return html `<i class="${className}" aria-hidden="true">${codepoint}</i>`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"breadcrumb-item.template.d.ts","sourceRoot":"","sources":["../../../../src/components/navigation/breadcrumb/breadcrumb-item.template.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;
|
|
1
|
+
{"version":3,"file":"breadcrumb-item.template.d.ts","sourceRoot":"","sources":["../../../../src/components/navigation/breadcrumb/breadcrumb-item.template.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AAG9E,wBAAgB,sBAAsB,CAAC,CAAC,EAAE,uBAAuB,6CA8BhE"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { html, classMap, when } from '@melodicdev/core';
|
|
2
|
+
import { routeAnchorClick } from '../functions/route-link.function.js';
|
|
2
3
|
export function breadcrumbItemTemplate(c) {
|
|
3
4
|
const separatorIcon = c.separator === 'slash' ? 'slash-forward' : 'caret-right';
|
|
4
5
|
return html `
|
|
@@ -12,7 +13,7 @@ export function breadcrumbItemTemplate(c) {
|
|
|
12
13
|
<ml-icon icon=${separatorIcon} size="sm"></ml-icon>
|
|
13
14
|
</span>
|
|
14
15
|
${when(!!c.href && !c.current, () => html `
|
|
15
|
-
<a class="ml-breadcrumb-item__link" href=${c.href}>
|
|
16
|
+
<a class="ml-breadcrumb-item__link" href=${c.href} @click=${(event) => routeAnchorClick(event, c.href)}>
|
|
16
17
|
${when(!!c.icon, () => html `<ml-icon icon=${c.icon} size="sm"></ml-icon>`)}
|
|
17
18
|
<slot></slot>
|
|
18
19
|
</a>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pick the entry whose `href` best matches `path`.
|
|
3
|
+
*
|
|
4
|
+
* A plain `startsWith` + first match let a shorter href shadow a longer one:
|
|
5
|
+
* with `/admin` declared before `/admin/users`, every page under `/admin`
|
|
6
|
+
* highlighted the `/admin` tab. Matching is therefore:
|
|
7
|
+
*
|
|
8
|
+
* 1. an exact path match, else
|
|
9
|
+
* 2. the LONGEST href that is a path-segment prefix of `path` — `/admin` matches
|
|
10
|
+
* `/admin/users` but not `/administration`.
|
|
11
|
+
*/
|
|
12
|
+
export declare function matchTabByRoute<T extends {
|
|
13
|
+
href?: string;
|
|
14
|
+
value: string;
|
|
15
|
+
}>(entries: T[], path: string): T | undefined;
|
|
16
|
+
//# sourceMappingURL=match-by-route.function.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"match-by-route.function.d.ts","sourceRoot":"","sources":["../../../../src/components/navigation/functions/match-by-route.function.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,wBAAgB,eAAe,CAAC,CAAC,SAAS;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,EAAE,OAAO,EAAE,CAAC,EAAE,EAAE,IAAI,EAAE,MAAM,GAAG,CAAC,GAAG,SAAS,CAwBrH"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pick the entry whose `href` best matches `path`.
|
|
3
|
+
*
|
|
4
|
+
* A plain `startsWith` + first match let a shorter href shadow a longer one:
|
|
5
|
+
* with `/admin` declared before `/admin/users`, every page under `/admin`
|
|
6
|
+
* highlighted the `/admin` tab. Matching is therefore:
|
|
7
|
+
*
|
|
8
|
+
* 1. an exact path match, else
|
|
9
|
+
* 2. the LONGEST href that is a path-segment prefix of `path` — `/admin` matches
|
|
10
|
+
* `/admin/users` but not `/administration`.
|
|
11
|
+
*/
|
|
12
|
+
export function matchTabByRoute(entries, path) {
|
|
13
|
+
const normalized = normalize(path);
|
|
14
|
+
let best;
|
|
15
|
+
let bestLength = -1;
|
|
16
|
+
for (const entry of entries) {
|
|
17
|
+
if (!entry.href) {
|
|
18
|
+
continue;
|
|
19
|
+
}
|
|
20
|
+
const href = normalize(entry.href.split(/[?#]/)[0]);
|
|
21
|
+
if (href === normalized) {
|
|
22
|
+
return entry;
|
|
23
|
+
}
|
|
24
|
+
if (normalized.startsWith(`${href === '/' ? '' : href}/`) && href.length > bestLength) {
|
|
25
|
+
best = entry;
|
|
26
|
+
bestLength = href.length;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
return best;
|
|
30
|
+
}
|
|
31
|
+
function normalize(path) {
|
|
32
|
+
const withSlash = path.startsWith('/') ? path : `/${path}`;
|
|
33
|
+
return withSlash.length > 1 ? withSlash.replace(/\/+$/, '') : withSlash;
|
|
34
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Intercept an anchor click and route it through the router when possible.
|
|
3
|
+
*
|
|
4
|
+
* Navigation components rendered raw `<a href>` elements with no
|
|
5
|
+
* `preventDefault`, so clicking one triggered a full page load — while tabs and
|
|
6
|
+
* steps in the same app navigated client-side. That inconsistency reloads the
|
|
7
|
+
* whole SPA (losing state) on what looks like ordinary in-app navigation.
|
|
8
|
+
*
|
|
9
|
+
* Native behaviour is preserved where it is the right thing:
|
|
10
|
+
* - modifier / non-primary clicks (new tab, new window, download)
|
|
11
|
+
* - external links, explicit `target`, and non-http(s) schemes
|
|
12
|
+
* - apps with no router registered
|
|
13
|
+
*
|
|
14
|
+
* Returns true when the router handled it.
|
|
15
|
+
*/
|
|
16
|
+
export declare function routeAnchorClick(event: MouseEvent, href: string, options?: {
|
|
17
|
+
external?: boolean;
|
|
18
|
+
target?: string;
|
|
19
|
+
}): boolean;
|
|
20
|
+
//# sourceMappingURL=route-link.function.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"route-link.function.d.ts","sourceRoot":"","sources":["../../../../src/components/navigation/functions/route-link.function.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE;IAAE,QAAQ,CAAC,EAAE,OAAO,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAO,GAAG,OAAO,CAqBhI"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { Injector, RouterService } from '@melodicdev/core';
|
|
2
|
+
/**
|
|
3
|
+
* Intercept an anchor click and route it through the router when possible.
|
|
4
|
+
*
|
|
5
|
+
* Navigation components rendered raw `<a href>` elements with no
|
|
6
|
+
* `preventDefault`, so clicking one triggered a full page load — while tabs and
|
|
7
|
+
* steps in the same app navigated client-side. That inconsistency reloads the
|
|
8
|
+
* whole SPA (losing state) on what looks like ordinary in-app navigation.
|
|
9
|
+
*
|
|
10
|
+
* Native behaviour is preserved where it is the right thing:
|
|
11
|
+
* - modifier / non-primary clicks (new tab, new window, download)
|
|
12
|
+
* - external links, explicit `target`, and non-http(s) schemes
|
|
13
|
+
* - apps with no router registered
|
|
14
|
+
*
|
|
15
|
+
* Returns true when the router handled it.
|
|
16
|
+
*/
|
|
17
|
+
export function routeAnchorClick(event, href, options = {}) {
|
|
18
|
+
if (event.defaultPrevented || event.button !== 0 || event.metaKey || event.ctrlKey || event.shiftKey || event.altKey) {
|
|
19
|
+
return false;
|
|
20
|
+
}
|
|
21
|
+
if (!href || options.external || (options.target && options.target !== '_self')) {
|
|
22
|
+
return false;
|
|
23
|
+
}
|
|
24
|
+
// Absolute URLs to another origin, mailto:, tel:, … stay native.
|
|
25
|
+
if (/^[a-z][a-z0-9+.-]*:/i.test(href) && !href.startsWith(window.location.origin)) {
|
|
26
|
+
return false;
|
|
27
|
+
}
|
|
28
|
+
if (!Injector.has(RouterService)) {
|
|
29
|
+
return false;
|
|
30
|
+
}
|
|
31
|
+
event.preventDefault();
|
|
32
|
+
void Injector.get(RouterService).navigate(href);
|
|
33
|
+
return true;
|
|
34
|
+
}
|
|
@@ -30,6 +30,14 @@ export declare class PaginationComponent implements IElementRef {
|
|
|
30
30
|
/** Number of sibling pages to show around current */
|
|
31
31
|
siblings: number;
|
|
32
32
|
get pages(): PaginationPage[];
|
|
33
|
+
/**
|
|
34
|
+
* The page actually being displayed, clamped into `[1, totalPages]`.
|
|
35
|
+
*
|
|
36
|
+
* `pages` already clamps, so a `page` outside the range (a filter that
|
|
37
|
+
* shrank the result set while the user was on page 9) rendered a list where
|
|
38
|
+
* nothing matched `page` — no active styling and no `aria-current` at all.
|
|
39
|
+
*/
|
|
40
|
+
get currentPage(): number;
|
|
33
41
|
get hasPrevious(): boolean;
|
|
34
42
|
get hasNext(): boolean;
|
|
35
43
|
goToPage: (page: number) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pagination.component.d.ts","sourceRoot":"","sources":["../../../../src/components/navigation/pagination/pagination.component.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAIpD,MAAM,MAAM,cAAc,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,IAAI,EAAE,UAAU,CAAA;CAAE,CAAC;AAEpF;;;;;;;;;;GAUG;AACH,qBAMa,mBAAoB,YAAW,WAAW;IAC/C,UAAU,EAAG,WAAW,CAAC;IAIhC,OAAc,aAAa;;;;MAIhB;IAEX,oCAAoC;IAC7B,IAAI,SAAK;IAEhB,4BAA4B;IACrB,UAAU,SAAK;IAEtB,qDAAqD;IAC9C,QAAQ,SAAK;IAEpB,IAAW,KAAK,IAAI,cAAc,EAAE,CA2CnC;IAED,IAAW,WAAW,IAAI,OAAO,CAEhC;IAED,IAAW,OAAO,IAAI,OAAO,CAE5B;IAEM,QAAQ,GAAI,MAAM,MAAM,KAAG,IAAI,CAWpC;IAEK,QAAQ,QAAO,IAAI,CAExB;IAEK,IAAI,QAAO,IAAI,CAEpB;CACF"}
|
|
1
|
+
{"version":3,"file":"pagination.component.d.ts","sourceRoot":"","sources":["../../../../src/components/navigation/pagination/pagination.component.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAIpD,MAAM,MAAM,cAAc,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,IAAI,EAAE,UAAU,CAAA;CAAE,CAAC;AAEpF;;;;;;;;;;GAUG;AACH,qBAMa,mBAAoB,YAAW,WAAW;IAC/C,UAAU,EAAG,WAAW,CAAC;IAIhC,OAAc,aAAa;;;;MAIhB;IAEX,oCAAoC;IAC7B,IAAI,SAAK;IAEhB,4BAA4B;IACrB,UAAU,SAAK;IAEtB,qDAAqD;IAC9C,QAAQ,SAAK;IAEpB,IAAW,KAAK,IAAI,cAAc,EAAE,CA2CnC;IAED;;;;;;OAMG;IACH,IAAW,WAAW,IAAI,MAAM,CAE/B;IAED,IAAW,WAAW,IAAI,OAAO,CAEhC;IAED,IAAW,OAAO,IAAI,OAAO,CAE5B;IAEM,QAAQ,GAAI,MAAM,MAAM,KAAG,IAAI,CAWpC;IAEK,QAAQ,QAAO,IAAI,CAExB;IAEK,IAAI,QAAO,IAAI,CAEpB;CACF"}
|
|
@@ -85,11 +85,21 @@ let PaginationComponent = class PaginationComponent {
|
|
|
85
85
|
{ type: 'page', value: total }
|
|
86
86
|
];
|
|
87
87
|
}
|
|
88
|
+
/**
|
|
89
|
+
* The page actually being displayed, clamped into `[1, totalPages]`.
|
|
90
|
+
*
|
|
91
|
+
* `pages` already clamps, so a `page` outside the range (a filter that
|
|
92
|
+
* shrank the result set while the user was on page 9) rendered a list where
|
|
93
|
+
* nothing matched `page` — no active styling and no `aria-current` at all.
|
|
94
|
+
*/
|
|
95
|
+
get currentPage() {
|
|
96
|
+
return Math.min(Math.max(1, Number(this.page) || 1), Math.max(1, this.totalPages));
|
|
97
|
+
}
|
|
88
98
|
get hasPrevious() {
|
|
89
|
-
return this.
|
|
99
|
+
return this.currentPage > 1;
|
|
90
100
|
}
|
|
91
101
|
get hasNext() {
|
|
92
|
-
return this.
|
|
102
|
+
return this.currentPage < this.totalPages;
|
|
93
103
|
}
|
|
94
104
|
};
|
|
95
105
|
PaginationComponent = __decorate([
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pagination.styles.d.ts","sourceRoot":"","sources":["../../../../src/components/navigation/pagination/pagination.styles.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,gBAAgB,
|
|
1
|
+
{"version":3,"file":"pagination.styles.d.ts","sourceRoot":"","sources":["../../../../src/components/navigation/pagination/pagination.styles.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,gBAAgB,iDA0H5B,CAAC"}
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import { css } from '@melodicdev/core';
|
|
2
2
|
export const paginationStyles = () => css `
|
|
3
3
|
:host {
|
|
4
|
+
/* ── Pagination: focus ── */
|
|
5
|
+
--ml-pagination-focus-width: 2px;
|
|
6
|
+
--ml-pagination-focus-color: var(--ml-color-primary);
|
|
7
|
+
--ml-pagination-focus-offset: 2px;
|
|
8
|
+
|
|
4
9
|
/* Layout */
|
|
5
10
|
--ml-pagination-gap: var(--ml-space-3);
|
|
6
11
|
--ml-pagination-pages-gap: var(--ml-space-1);
|
|
@@ -79,6 +84,11 @@ export const paginationStyles = () => css `
|
|
|
79
84
|
color: var(--ml-pagination-btn-hover-color);
|
|
80
85
|
}
|
|
81
86
|
|
|
87
|
+
.ml-pagination__btn:focus-visible {
|
|
88
|
+
outline: var(--ml-pagination-focus-width) solid var(--ml-pagination-focus-color);
|
|
89
|
+
outline-offset: var(--ml-pagination-focus-offset);
|
|
90
|
+
}
|
|
91
|
+
|
|
82
92
|
.ml-pagination__btn--nav {
|
|
83
93
|
font-weight: var(--ml-pagination-nav-font-weight);
|
|
84
94
|
}
|
|
@@ -26,10 +26,10 @@ export function paginationTemplate(c) {
|
|
|
26
26
|
class=${classMap({
|
|
27
27
|
'ml-pagination__btn': true,
|
|
28
28
|
'ml-pagination__btn--page': true,
|
|
29
|
-
'ml-pagination__btn--active': p.value ===
|
|
29
|
+
'ml-pagination__btn--active': p.value === c.currentPage
|
|
30
30
|
})}
|
|
31
31
|
aria-label=${`Page ${p.value}`}
|
|
32
|
-
aria-current=${p.value ===
|
|
32
|
+
aria-current=${p.value === c.currentPage ? 'page' : false}
|
|
33
33
|
@click=${() => c.goToPage(p.value)}
|
|
34
34
|
>
|
|
35
35
|
${p.value}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sidebar-item.template.d.ts","sourceRoot":"","sources":["../../../../src/components/navigation/sidebar/sidebar-item.template.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"sidebar-item.template.d.ts","sourceRoot":"","sources":["../../../../src/components/navigation/sidebar/sidebar-item.template.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AAGxE,wBAAgB,mBAAmB,CAAC,CAAC,EAAE,oBAAoB,6CAmF1D"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { html, classMap, when } from '@melodicdev/core';
|
|
2
|
+
import { routeAnchorClick } from '../functions/route-link.function.js';
|
|
2
3
|
export function sidebarItemTemplate(c) {
|
|
3
4
|
const level = parseInt(c.level, 10) || 0;
|
|
4
5
|
const isCollapsed = c.collapsed;
|
|
@@ -46,7 +47,10 @@ export function sidebarItemTemplate(c) {
|
|
|
46
47
|
href=${c.href}
|
|
47
48
|
?target=${c.external ? '_blank' : null}
|
|
48
49
|
?rel=${c.external ? 'noopener noreferrer' : null}
|
|
49
|
-
@click=${
|
|
50
|
+
@click=${(event) => {
|
|
51
|
+
routeAnchorClick(event, c.href, { external: c.external });
|
|
52
|
+
c.handleClick(event);
|
|
53
|
+
}}
|
|
50
54
|
>
|
|
51
55
|
${content}
|
|
52
56
|
</a>
|