mtrl 0.8.0 → 0.9.1

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.
Files changed (253) hide show
  1. package/dist/components/badge/config.d.ts +2 -2
  2. package/dist/components/bottom-sheet/bottom-sheet.js +1 -1
  3. package/dist/components/bottom-sheet/config.d.ts +2 -2
  4. package/dist/components/bottom-sheet/features/drag.d.ts +2 -2
  5. package/dist/components/bottom-sheet/features/drag.js +1 -1
  6. package/dist/components/button/api.d.ts +3 -3
  7. package/dist/components/button/button.d.ts +1 -1
  8. package/dist/components/button/config.d.ts +2 -2
  9. package/dist/components/button/features/progress.d.ts +17 -5
  10. package/dist/components/button-group/config.d.ts +20 -0
  11. package/dist/components/card/api.d.ts +10 -1
  12. package/dist/components/card/api.js +6 -1
  13. package/dist/components/card/card.js +1 -1
  14. package/dist/components/card/config.d.ts +15 -9
  15. package/dist/components/card/content.js +5 -2
  16. package/dist/components/card/features.d.ts +2 -1
  17. package/dist/components/card/types.d.ts +5 -4
  18. package/dist/components/carousel/config.d.ts +2 -2
  19. package/dist/components/carousel/features/slides.js +3 -2
  20. package/dist/components/checkbox/config.d.ts +2 -2
  21. package/dist/components/checkbox/types.d.ts +15 -16
  22. package/dist/components/chips/api.d.ts +6 -6
  23. package/dist/components/chips/chip/api.d.ts +2 -2
  24. package/dist/components/chips/chip/config.d.ts +6 -7
  25. package/dist/components/chips/config.d.ts +2 -2
  26. package/dist/components/chips/features/dom.js +0 -1
  27. package/dist/components/chips/types.d.ts +12 -1
  28. package/dist/components/datepicker/api.d.ts +5 -2
  29. package/dist/components/datepicker/config.d.ts +16 -13
  30. package/dist/components/datepicker/datepicker.js +10 -4
  31. package/dist/components/datepicker/render.d.ts +14 -6
  32. package/dist/components/datepicker/render.js +1 -1
  33. package/dist/components/datepicker/types.d.ts +51 -3
  34. package/dist/components/dialog/api.d.ts +1 -1
  35. package/dist/components/dialog/config.d.ts +3 -4
  36. package/dist/components/dialog/config.js +1 -1
  37. package/dist/components/dialog/features.js +1 -1
  38. package/dist/components/dialog/types.d.ts +1 -1
  39. package/dist/components/divider/features.js +2 -0
  40. package/dist/components/drawer/api.d.ts +3 -3
  41. package/dist/components/drawer/config.d.ts +2 -2
  42. package/dist/components/drawer/drawer.d.ts +1 -1
  43. package/dist/components/drawer/features/headline.d.ts +12 -2
  44. package/dist/components/drawer/features/items.d.ts +17 -3
  45. package/dist/components/drawer/features/state.d.ts +14 -2
  46. package/dist/components/extended-fab/api.d.ts +12 -4
  47. package/dist/components/extended-fab/api.js +12 -0
  48. package/dist/components/extended-fab/config.d.ts +10 -10
  49. package/dist/components/extended-fab/types.d.ts +4 -2
  50. package/dist/components/fab/api.d.ts +9 -2
  51. package/dist/components/fab/api.js +12 -0
  52. package/dist/components/fab/config.d.ts +8 -8
  53. package/dist/components/fab/types.d.ts +2 -1
  54. package/dist/components/icon-button/config.d.ts +2 -2
  55. package/dist/components/icon-button/features/toggle.d.ts +1 -5
  56. package/dist/components/icon-button/types.d.ts +6 -0
  57. package/dist/components/list/api.d.ts +18 -18
  58. package/dist/components/list/config.d.ts +6 -3
  59. package/dist/components/list/config.js +6 -7
  60. package/dist/components/list/features/renderer.js +2 -2
  61. package/dist/components/list/list.d.ts +20 -1
  62. package/dist/components/list/types.d.ts +32 -32
  63. package/dist/components/loading-indicator/config.d.ts +2 -2
  64. package/dist/components/loading-indicator/types.d.ts +3 -1
  65. package/dist/components/menu/api.d.ts +6 -5
  66. package/dist/components/menu/config.d.ts +2 -2
  67. package/dist/components/menu/features/keyboard.d.ts +19 -9
  68. package/dist/components/menu/types.d.ts +25 -9
  69. package/dist/components/navigation/config.d.ts +2 -2
  70. package/dist/components/navigation/features/controller.d.ts +1 -3
  71. package/dist/components/navigation/features/items.d.ts +1 -2
  72. package/dist/components/navigation/system/core.d.ts +6 -6
  73. package/dist/components/navigation/system/events.d.ts +3 -3
  74. package/dist/components/navigation/system/mobile.d.ts +6 -6
  75. package/dist/components/navigation/system/state.d.ts +3 -3
  76. package/dist/components/navigation/system/types.d.ts +43 -11
  77. package/dist/components/navigation/types.d.ts +15 -6
  78. package/dist/components/navigation-rail/navigation-rail.js +2 -1
  79. package/dist/components/progress/api.js +0 -1
  80. package/dist/components/progress/config.d.ts +2 -2
  81. package/dist/components/progress/features/canvas.d.ts +14 -5
  82. package/dist/components/progress/features/state.d.ts +1 -2
  83. package/dist/components/progress/types.d.ts +1 -1
  84. package/dist/components/radios/config.d.ts +2 -2
  85. package/dist/components/search/api.js +4 -4
  86. package/dist/components/search/config.d.ts +2 -2
  87. package/dist/components/search/features/suggestions.d.ts +1 -3
  88. package/dist/components/search/features/suggestions.js +16 -15
  89. package/dist/components/search/search.js +1 -1
  90. package/dist/components/segmented-button/config.d.ts +1 -5
  91. package/dist/components/segmented-button/config.js +1 -1
  92. package/dist/components/select/api.d.ts +2 -2
  93. package/dist/components/select/features.d.ts +2 -2
  94. package/dist/components/select/features.js +2 -1
  95. package/dist/components/select/types.d.ts +38 -21
  96. package/dist/components/side-sheet/config.d.ts +2 -2
  97. package/dist/components/slider/api.d.ts +6 -6
  98. package/dist/components/slider/config.d.ts +2 -2
  99. package/dist/components/slider/types.d.ts +2 -2
  100. package/dist/components/snackbar/config.d.ts +2 -2
  101. package/dist/components/snackbar/features.d.ts +3 -3
  102. package/dist/components/snackbar/position.d.ts +1 -1
  103. package/dist/components/snackbar/types.d.ts +5 -6
  104. package/dist/components/split-button/api.js +1 -3
  105. package/dist/components/split-button/config.d.ts +2 -2
  106. package/dist/components/split-button/features/buttons.d.ts +3 -2
  107. package/dist/components/split-button/features/menu.d.ts +3 -2
  108. package/dist/components/split-button/types.d.ts +13 -2
  109. package/dist/components/switch/config.d.ts +2 -2
  110. package/dist/components/switch/types.d.ts +0 -1
  111. package/dist/components/tabs/api.d.ts +8 -5
  112. package/dist/components/tabs/config.d.ts +9 -1
  113. package/dist/components/tabs/features.d.ts +7 -11
  114. package/dist/components/tabs/features.js +2 -1
  115. package/dist/components/tabs/indicator.js +4 -2
  116. package/dist/components/tabs/responsive.js +2 -1
  117. package/dist/components/tabs/tab-api.d.ts +11 -5
  118. package/dist/components/tabs/tab-api.js +1 -1
  119. package/dist/components/tabs/tab.js +9 -1
  120. package/dist/components/tabs/types.d.ts +9 -2
  121. package/dist/components/tabs/utils.d.ts +14 -3
  122. package/dist/components/textfield/api.d.ts +1 -1
  123. package/dist/components/textfield/config.d.ts +2 -2
  124. package/dist/components/textfield/features/error.d.ts +1 -2
  125. package/dist/components/textfield/features/leading-icon.d.ts +1 -2
  126. package/dist/components/textfield/features/prefix-text.d.ts +1 -2
  127. package/dist/components/textfield/features/suffix-text.d.ts +1 -2
  128. package/dist/components/textfield/features/supporting-text.d.ts +1 -2
  129. package/dist/components/textfield/features/trailing-icon.d.ts +1 -2
  130. package/dist/components/textfield/types.d.ts +0 -2
  131. package/dist/components/timepicker/api.d.ts +5 -4
  132. package/dist/components/timepicker/config.d.ts +14 -11
  133. package/dist/components/tooltip/config.d.ts +2 -2
  134. package/dist/components/tooltip/tooltip.d.ts +1 -1
  135. package/dist/core/compose/base.d.ts +2 -2
  136. package/dist/core/compose/base.js +1 -1
  137. package/dist/core/compose/component.d.ts +13 -4
  138. package/dist/core/compose/component.js +1 -1
  139. package/dist/core/compose/features/badge.d.ts +3 -4
  140. package/dist/core/compose/features/badge.js +1 -1
  141. package/dist/core/compose/features/checkable.d.ts +3 -4
  142. package/dist/core/compose/features/debounce.d.ts +2 -3
  143. package/dist/core/compose/features/disabled.d.ts +1 -2
  144. package/dist/core/compose/features/events.d.ts +4 -3
  145. package/dist/core/compose/features/icon.d.ts +1 -5
  146. package/dist/core/compose/features/input.d.ts +2 -3
  147. package/dist/core/compose/features/lifecycle.d.ts +2 -2
  148. package/dist/core/compose/features/lifecycle.js +3 -3
  149. package/dist/core/compose/features/position.d.ts +1 -2
  150. package/dist/core/compose/features/ripple.d.ts +1 -2
  151. package/dist/core/compose/features/size.d.ts +1 -2
  152. package/dist/core/compose/features/style.d.ts +1 -2
  153. package/dist/core/compose/features/text.d.ts +1 -5
  154. package/dist/core/compose/features/textinput.d.ts +2 -3
  155. package/dist/core/compose/features/textlabel.d.ts +1 -2
  156. package/dist/core/compose/features/throttle.d.ts +1 -2
  157. package/dist/core/compose/features/track.d.ts +0 -1
  158. package/dist/core/compose/features/variant.d.ts +1 -2
  159. package/dist/core/compose/index.d.ts +1 -1
  160. package/dist/core/compose/pipe.d.ts +43 -3
  161. package/dist/core/compose/pipe.js +6 -2
  162. package/dist/core/compose/utils/type-guards.d.ts +4 -4
  163. package/dist/core/compose/utils/type-guards.js +1 -1
  164. package/dist/core/config/component.d.ts +12 -9
  165. package/dist/core/config/global.d.ts +12 -8
  166. package/dist/core/config.d.ts +1 -1
  167. package/dist/core/dom/attributes.d.ts +6 -6
  168. package/dist/core/dom/attributes.js +8 -5
  169. package/dist/core/dom/create.d.ts +27 -10
  170. package/dist/core/dom/create.js +5 -26
  171. package/dist/core/dom/utils.d.ts +1 -1
  172. package/dist/core/dom/utils.js +4 -1
  173. package/dist/core/state/emitter.d.ts +2 -2
  174. package/dist/core/state/events.d.ts +3 -3
  175. package/dist/core/state/lifecycle.d.ts +0 -1
  176. package/dist/core/state/store.d.ts +3 -3
  177. package/dist/core/utils/index.d.ts +1 -0
  178. package/dist/core/utils/index.js +1 -0
  179. package/dist/core/utils/object.d.ts +2 -2
  180. package/dist/core/utils/performance.d.ts +3 -3
  181. package/dist/core/utils/url.d.ts +20 -0
  182. package/dist/core/utils/url.js +0 -0
  183. package/dist/core/utils/validate.d.ts +6 -6
  184. package/dist/core/utils/validate.js +13 -12
  185. package/dist/index.cjs +0 -0
  186. package/dist/package.json +1 -1
  187. package/dist/styles/badge.css +2 -2
  188. package/dist/styles/base.css +2 -2
  189. package/dist/styles/bottom-app-bar.css +2 -2
  190. package/dist/styles/bottom-sheet.css +2 -2
  191. package/dist/styles/button-group.css +2 -2
  192. package/dist/styles/button.css +2 -2
  193. package/dist/styles/card.css +2 -2
  194. package/dist/styles/carousel.css +2 -2
  195. package/dist/styles/checkbox.css +2 -2
  196. package/dist/styles/chips.css +2 -2
  197. package/dist/styles/dialog.css +2 -2
  198. package/dist/styles/divider.css +2 -2
  199. package/dist/styles/drawer.css +2 -2
  200. package/dist/styles/extended-fab.css +2 -2
  201. package/dist/styles/fab.css +2 -2
  202. package/dist/styles/icon-button.css +2 -2
  203. package/dist/styles/list.css +2 -2
  204. package/dist/styles/loading-indicator.css +2 -2
  205. package/dist/styles/menu.css +2 -2
  206. package/dist/styles/navigation-rail.css +2 -2
  207. package/dist/styles/navigation.css +2 -2
  208. package/dist/styles/progress.css +2 -2
  209. package/dist/styles/radios.css +2 -2
  210. package/dist/styles/search.css +2 -2
  211. package/dist/styles/segmented-button.css +2 -2
  212. package/dist/styles/select.css +2 -2
  213. package/dist/styles/side-sheet.css +2 -2
  214. package/dist/styles/slider.css +2 -2
  215. package/dist/styles/snackbar.css +2 -2
  216. package/dist/styles/split-button.css +2 -2
  217. package/dist/styles/switch.css +2 -2
  218. package/dist/styles/tabs.css +2 -2
  219. package/dist/styles/textfield.css +2 -2
  220. package/dist/styles/timepicker.css +2 -2
  221. package/dist/styles/tooltip.css +2 -0
  222. package/dist/styles/tooltip.d.ts +1 -0
  223. package/dist/styles/tooltip.js +2 -0
  224. package/dist/styles/top-app-bar.css +2 -2
  225. package/dist/styles/utilities.css +2 -2
  226. package/dist/styles.css +2 -2
  227. package/dist/themes/autumn.css +1 -1
  228. package/dist/themes/baseline.css +1 -1
  229. package/dist/themes/brownbeige.css +1 -1
  230. package/dist/themes/browngreen.css +1 -1
  231. package/dist/themes/desert.css +1 -1
  232. package/dist/themes/forest.css +1 -1
  233. package/dist/themes/highcontrast.css +1 -1
  234. package/dist/themes/legacy.css +1 -1
  235. package/dist/themes/material.css +1 -1
  236. package/dist/themes/ocean.css +1 -1
  237. package/dist/themes/sageivory.css +1 -1
  238. package/dist/themes/spring.css +1 -1
  239. package/dist/themes/summer.css +1 -1
  240. package/dist/themes/sunset.css +1 -1
  241. package/dist/themes/tealcaramel.css +1 -1
  242. package/dist/themes/winter.css +1 -1
  243. package/package.json +2 -2
  244. package/src/styles/abstract/_mixins.scss +5 -1
  245. package/src/styles/components/_checkbox.scss +27 -7
  246. package/src/styles/components/_chips.scss +13 -13
  247. package/src/styles/components/_datepicker.scss +5 -5
  248. package/src/styles/components/_dialog.scss +2 -2
  249. package/src/styles/components/_radios.scss +30 -30
  250. package/src/styles/components/_switch.scss +36 -26
  251. package/src/styles/components/_tabs.scss +59 -58
  252. package/src/styles/components/_timepicker.scss +3 -3
  253. package/src/styles/main.scss +1 -0
@@ -1,3 +1,4 @@
1
+ import type { EventCallback } from "../../core/state/emitter.js";
1
2
  /**
2
3
  * Menu position options
3
4
  * Controls where the menu will appear relative to its opener element
@@ -41,7 +42,7 @@ export type MenuPosition = (typeof MENU_POSITION)[keyof typeof MENU_POSITION];
41
42
  *
42
43
  * @category Components
43
44
  */
44
- export interface MenuItem {
45
+ export interface MenuItem<TData = unknown> {
45
46
  /**
46
47
  * Unique ID for the menu item
47
48
  * Required for accessibility and event handling
@@ -80,12 +81,12 @@ export interface MenuItem {
80
81
  * Optional array of submenu items
81
82
  * Only used when hasSubmenu is true
82
83
  */
83
- submenu?: MenuItem[];
84
+ submenu?: MenuItem<TData>[];
84
85
  /**
85
86
  * Additional data to associate with the menu item
86
87
  * This can be used for custom behavior in click handlers
87
88
  */
88
- data?: any;
89
+ data?: TData;
89
90
  }
90
91
  /**
91
92
  * Menu item type for dividers
@@ -129,7 +130,7 @@ export interface MenuGap {
129
130
  *
130
131
  * @category Components
131
132
  */
132
- export type MenuContent = MenuItem | MenuDivider | MenuGap;
133
+ export type MenuContent<TData = unknown> = MenuItem<TData> | MenuDivider | MenuGap;
133
134
  /**
134
135
  * Configuration interface for the Menu component
135
136
  *
@@ -290,13 +291,13 @@ export interface MenuEvent {
290
291
  *
291
292
  * @category Components
292
293
  */
293
- export interface MenuSelectEvent extends MenuEvent {
294
+ export interface MenuSelectEvent<TData = unknown> extends MenuEvent {
294
295
  /** The selected menu item */
295
- item: MenuItem;
296
+ item: MenuItem<TData>;
296
297
  /** ID of the selected menu item */
297
298
  itemId: string;
298
299
  /** Data associated with the menu item (if any) */
299
- itemData?: any;
300
+ itemData?: TData;
300
301
  }
301
302
  /**
302
303
  * Menu component interface
@@ -380,14 +381,29 @@ export interface MenuComponent {
380
381
  * @param handler - Event handler function
381
382
  * @returns The menu component for chaining
382
383
  */
383
- on: <T extends keyof MenuEvents>(event: T, handler: MenuEvents[T]) => MenuComponent;
384
+ on<T extends keyof MenuEvents>(event: T, handler: MenuEvents[T]): MenuComponent;
385
+ /**
386
+ * Adds an event listener for any event the menu emits, such as
387
+ * 'submenu-opened', 'submenu-closed', 'all-submenus-closed' or 'menu-closing'
388
+ * @param event - Event name
389
+ * @param handler - Event handler function
390
+ * @returns The menu component for chaining
391
+ */
392
+ on(event: string, handler: EventCallback): MenuComponent;
384
393
  /**
385
394
  * Removes an event listener from the menu
386
395
  * @param event - Event name
387
396
  * @param handler - Event handler function
388
397
  * @returns The menu component for chaining
389
398
  */
390
- off: <T extends keyof MenuEvents>(event: T, handler: MenuEvents[T]) => MenuComponent;
399
+ off<T extends keyof MenuEvents>(event: T, handler: MenuEvents[T]): MenuComponent;
400
+ /**
401
+ * Removes an event listener for any event the menu emits
402
+ * @param event - Event name
403
+ * @param handler - Event handler function
404
+ * @returns The menu component for chaining
405
+ */
406
+ off(event: string, handler: EventCallback): MenuComponent;
391
407
  /**
392
408
  * Destroys the menu component and cleans up resources
393
409
  */
@@ -17,7 +17,7 @@ export declare const createBaseConfig: (config?: NavigationConfig) => Navigation
17
17
  export declare const getElementConfig: (config: NavigationConfig) => {
18
18
  tag: string;
19
19
  componentName: string;
20
- attributes: Record<string, any>;
20
+ attributes: Record<string, unknown>;
21
21
  className: string[];
22
22
  rawClass: string | string[];
23
23
  id: string;
@@ -33,7 +33,7 @@ export declare const getElementConfig: (config: NavigationConfig) => {
33
33
  ariaHidden: boolean;
34
34
  html: string;
35
35
  text: string;
36
- forwardEvents: Record<string, boolean | ((component: any, event: Event) => boolean)>;
36
+ forwardEvents: Record<string, import("../../core/dom/create.js").EventCondition>;
37
37
  interactive: boolean;
38
38
  };
39
39
  /**
@@ -9,8 +9,6 @@ interface ControllerConfig {
9
9
  debug?: boolean;
10
10
  /** Component name */
11
11
  componentName?: string;
12
- /** Additional configuration options */
13
- [key: string]: any;
14
12
  }
15
13
  /**
16
14
  * Enhanced component with controller capabilities
@@ -26,5 +24,5 @@ interface ControllerComponent extends BaseComponent {
26
24
  * @param {ControllerConfig} config - Controller configuration
27
25
  * @returns {Function} Component enhancer function
28
26
  */
29
- export declare const withController: (config: ControllerConfig) => (component: BaseComponent) => ControllerComponent;
27
+ export declare const withController: (config: ControllerConfig) => <C extends BaseComponent>(component: C) => C & ControllerComponent;
30
28
  export default withController;
@@ -22,12 +22,11 @@ interface NavigationConfig {
22
22
  prefix?: string;
23
23
  items?: NavItemConfig[];
24
24
  debug?: boolean;
25
- [key: string]: any;
26
25
  }
27
26
  /**
28
27
  * Adds navigation items management to a component
29
28
  * @param {NavigationConfig} config - Navigation configuration
30
29
  * @returns {Function} Component enhancer function
31
30
  */
32
- export declare const withNavItems: (config: NavigationConfig) => (component: BaseComponent) => ItemsComponent;
31
+ export declare const withNavItems: (config: NavigationConfig) => <C extends BaseComponent>(component: C) => C & ItemsComponent;
33
32
  export {};
@@ -1,4 +1,4 @@
1
- import { NavigationSystemState } from "./types.js";
1
+ import { NavigationSystem, NavigationSystemComponent, NavigationSystemMobileConfig, NavigationSystemResolvedConfig, NavigationSystemState } from "./types.js";
2
2
  /**
3
3
  * Update drawer content for a specific section WITHOUT changing visibility
4
4
  *
@@ -15,7 +15,7 @@ export declare const updateDrawerContent: (state: NavigationSystemState, section
15
15
  * @param config - System configuration
16
16
  * @returns Rail navigation component
17
17
  */
18
- export declare const createRailNavigation: (state: NavigationSystemState, config: any) => any;
18
+ export declare const createRailNavigation: (state: NavigationSystemState, config: NavigationSystemResolvedConfig) => NavigationSystemComponent;
19
19
  /**
20
20
  * Creates the drawer navigation component
21
21
  *
@@ -23,21 +23,21 @@ export declare const createRailNavigation: (state: NavigationSystemState, config
23
23
  * @param config - System configuration
24
24
  * @returns Drawer navigation component
25
25
  */
26
- export declare const createDrawerNavigation: (state: NavigationSystemState, config: any) => any;
26
+ export declare const createDrawerNavigation: (state: NavigationSystemState, config: NavigationSystemResolvedConfig) => NavigationSystemComponent;
27
27
  /**
28
28
  * Shows the drawer with mobile-specific behaviors
29
29
  *
30
30
  * @param state - System state
31
31
  * @param mobileConfig - Mobile configuration
32
32
  */
33
- export declare const showDrawer: (state: NavigationSystemState, mobileConfig: any) => void;
33
+ export declare const showDrawer: (state: NavigationSystemState, mobileConfig: NavigationSystemMobileConfig) => void;
34
34
  /**
35
35
  * Hides the drawer with mobile-specific behaviors
36
36
  *
37
37
  * @param state - System state
38
38
  * @param mobileConfig - Mobile configuration
39
39
  */
40
- export declare const hideDrawer: (state: NavigationSystemState, mobileConfig: any) => void;
40
+ export declare const hideDrawer: (state: NavigationSystemState, mobileConfig: NavigationSystemMobileConfig) => void;
41
41
  /**
42
42
  * Checks if drawer is visible
43
43
  *
@@ -54,7 +54,7 @@ export declare const isDrawerVisible: (state: NavigationSystemState) => boolean;
54
54
  * @param teardownMobileMode - Function to tear down mobile mode
55
55
  * @param systemApi - Reference to the public system API
56
56
  */
57
- export declare const checkMobileState: (state: NavigationSystemState, mobileConfig: any, setupMobileMode: () => void, teardownMobileMode: () => void, systemApi: any) => void;
57
+ export declare const checkMobileState: (state: NavigationSystemState, mobileConfig: NavigationSystemMobileConfig, setupMobileMode: () => void, teardownMobileMode: () => void, systemApi: NavigationSystem) => void;
58
58
  /**
59
59
  * Clean up resources when the system is destroyed
60
60
  *
@@ -1,4 +1,4 @@
1
- import { NavigationSystemState } from "./types.js";
1
+ import { NavigationSystem, NavigationSystemResolvedConfig, NavigationSystemState } from "./types.js";
2
2
  /**
3
3
  * Registers rail navigation event handlers
4
4
  *
@@ -9,7 +9,7 @@ import { NavigationSystemState } from "./types.js";
9
9
  * @param hideDrawer - Function to hide the drawer
10
10
  * @param systemApi - Reference to the public system API
11
11
  */
12
- export declare const registerRailEvents: (state: NavigationSystemState, config: any, updateDrawerContent: (sectionId: string) => void, showDrawer: () => void, hideDrawer: () => void, systemApi: any) => void;
12
+ export declare const registerRailEvents: (state: NavigationSystemState, config: NavigationSystemResolvedConfig, updateDrawerContent: (sectionId: string) => void, showDrawer: () => void, hideDrawer: () => void, systemApi: NavigationSystem) => void;
13
13
  /**
14
14
  * Registers drawer navigation event handlers
15
15
  *
@@ -18,7 +18,7 @@ export declare const registerRailEvents: (state: NavigationSystemState, config:
18
18
  * @param hideDrawer - Function to hide the drawer
19
19
  * @param systemApi - Reference to the public system API
20
20
  */
21
- export declare const registerDrawerEvents: (state: NavigationSystemState, config: any, hideDrawer: () => void, systemApi: any) => void;
21
+ export declare const registerDrawerEvents: (state: NavigationSystemState, config: NavigationSystemResolvedConfig, hideDrawer: () => void, systemApi: NavigationSystem) => void;
22
22
  /**
23
23
  * Sets up window resize and orientation change handling
24
24
  *
@@ -1,4 +1,4 @@
1
- import { NavigationSystemState } from "./types.js";
1
+ import { NavigationSystemMobileConfig, NavigationSystemState } from "./types.js";
2
2
  /**
3
3
  * Creates and appends overlay element for mobile
4
4
  *
@@ -7,7 +7,7 @@ import { NavigationSystemState } from "./types.js";
7
7
  * @param hideDrawer - Function to hide the drawer
8
8
  * @returns Overlay element
9
9
  */
10
- export declare const createOverlay: (state: NavigationSystemState, mobileConfig: any, hideDrawer: () => void) => HTMLElement;
10
+ export declare const createOverlay: (state: NavigationSystemState, mobileConfig: NavigationSystemMobileConfig, hideDrawer: () => void) => HTMLElement;
11
11
  /**
12
12
  * Creates and adds close button to the drawer
13
13
  *
@@ -16,7 +16,7 @@ export declare const createOverlay: (state: NavigationSystemState, mobileConfig:
16
16
  * @param hideDrawer - Function to hide the drawer
17
17
  * @returns Close button element
18
18
  */
19
- export declare const createCloseButton: (state: NavigationSystemState, mobileConfig: any, hideDrawer: () => void) => HTMLElement | null;
19
+ export declare const createCloseButton: (state: NavigationSystemState, mobileConfig: NavigationSystemMobileConfig, hideDrawer: () => void) => HTMLElement | null;
20
20
  /**
21
21
  * Sets up mobile mode features
22
22
  *
@@ -25,7 +25,7 @@ export declare const createCloseButton: (state: NavigationSystemState, mobileCon
25
25
  * @param hideDrawer - Function to hide the drawer
26
26
  * @param isDrawerVisible - Function to check if drawer is visible
27
27
  */
28
- export declare const setupMobileMode: (state: NavigationSystemState, mobileConfig: any, hideDrawer: () => void, isDrawerVisible: () => boolean) => void;
28
+ export declare const setupMobileMode: (state: NavigationSystemState, mobileConfig: NavigationSystemMobileConfig, hideDrawer: () => void, isDrawerVisible: () => boolean) => void;
29
29
  /**
30
30
  * Sets up outside click handling for mobile
31
31
  *
@@ -34,7 +34,7 @@ export declare const setupMobileMode: (state: NavigationSystemState, mobileConfi
34
34
  * @param hideDrawer - Function to hide the drawer
35
35
  * @param isDrawerVisible - Function to check if drawer is visible
36
36
  */
37
- export declare const setupOutsideClickHandling: (state: NavigationSystemState, mobileConfig: any, hideDrawer: () => void, isDrawerVisible: () => boolean) => void;
37
+ export declare const setupOutsideClickHandling: (state: NavigationSystemState, mobileConfig: NavigationSystemMobileConfig, hideDrawer: () => void, isDrawerVisible: () => boolean) => void;
38
38
  /**
39
39
  * Sets up touch gestures for mobile
40
40
  *
@@ -49,4 +49,4 @@ export declare const setupTouchGestures: (state: NavigationSystemState, hideDraw
49
49
  * @param state - System state
50
50
  * @param mobileConfig - Mobile configuration
51
51
  */
52
- export declare const teardownMobileMode: (state: NavigationSystemState, mobileConfig: any) => void;
52
+ export declare const teardownMobileMode: (state: NavigationSystemState, mobileConfig: NavigationSystemMobileConfig) => void;
@@ -1,4 +1,4 @@
1
- import { NavigationSystemConfig, NavigationSystemState } from "./types.js";
1
+ import { NavigationSystemConfig, NavigationSystemMobileConfig, NavigationSystemResolvedConfig, NavigationSystemState } from "./types.js";
2
2
  /**
3
3
  * Create the initial state for the navigation system
4
4
  *
@@ -12,11 +12,11 @@ export declare const createInitialState: (options?: NavigationSystemConfig) => N
12
12
  * @param options - User-provided configuration
13
13
  * @returns Complete configuration with defaults
14
14
  */
15
- export declare const createConfig: (options?: NavigationSystemConfig) => Required<Pick<NavigationSystemConfig, "animateDrawer" | "showLabelsOnRail" | "hideDrawerOnClick" | "expanded" | "hoverDelay" | "closeDelay" | "railOptions" | "drawerOptions">>;
15
+ export declare const createConfig: (options?: NavigationSystemConfig) => NavigationSystemResolvedConfig;
16
16
  /**
17
17
  * Create mobile configuration with defaults
18
18
  *
19
19
  * @param options - User-provided configuration
20
20
  * @returns Mobile-specific configuration
21
21
  */
22
- export declare const createMobileConfig: (options?: NavigationSystemConfig) => Required<Pick<NavigationSystemConfig, "breakpoint" | "lockBodyScroll" | "hideOnClickOutside" | "enableSwipeGestures" | "optimizeForTouch" | "overlayClass" | "closeButtonClass" | "bodyLockClass">>;
22
+ export declare const createMobileConfig: (options?: NavigationSystemConfig) => NavigationSystemMobileConfig;
@@ -1,3 +1,4 @@
1
+ import type { NavChangeEvent, NavigationComponent, NavigationConfig, NavItemConfig } from "../types.js";
1
2
  /**
2
3
  * Configuration options for the navigation system
3
4
  */
@@ -87,12 +88,20 @@ export interface NavigationSystemConfig {
87
88
  /**
88
89
  * Additional options for the rail component
89
90
  */
90
- railOptions?: Record<string, any>;
91
+ railOptions?: NavigationConfig | Record<string, unknown>;
91
92
  /**
92
93
  * Additional options for the drawer component
93
94
  */
94
- drawerOptions?: Record<string, any>;
95
+ drawerOptions?: NavigationConfig | Record<string, unknown>;
95
96
  }
97
+ /**
98
+ * Display and timing configuration resolved with defaults
99
+ */
100
+ export type NavigationSystemResolvedConfig = Required<Pick<NavigationSystemConfig, 'animateDrawer' | 'showLabelsOnRail' | 'hideDrawerOnClick' | 'expanded' | 'hoverDelay' | 'closeDelay' | 'railOptions' | 'drawerOptions'>>;
101
+ /**
102
+ * Mobile configuration resolved with defaults
103
+ */
104
+ export type NavigationSystemMobileConfig = Required<Pick<NavigationSystemConfig, 'breakpoint' | 'lockBodyScroll' | 'hideOnClickOutside' | 'enableSwipeGestures' | 'optimizeForTouch' | 'overlayClass' | 'closeButtonClass' | 'bodyLockClass'>>;
96
105
  /**
97
106
  * Navigation section configuration
98
107
  */
@@ -113,7 +122,7 @@ export interface NavigationSection {
113
122
  /**
114
123
  * Navigation item configuration
115
124
  */
116
- export interface NavigationItem {
125
+ export interface NavigationItem extends NavItemConfig {
117
126
  /**
118
127
  * Unique identifier for the item
119
128
  */
@@ -130,10 +139,15 @@ export interface NavigationItem {
130
139
  * Whether the item is currently active
131
140
  */
132
141
  active?: boolean;
142
+ }
143
+ /**
144
+ * Rail or drawer navigation component managed by the system
145
+ */
146
+ export interface NavigationSystemComponent extends NavigationComponent {
133
147
  /**
134
- * Additional properties
148
+ * Sets the active item; the navigation component currently ignores `silent`
135
149
  */
136
- [key: string]: any;
150
+ setActive: (id: string, silent?: boolean) => NavigationComponent;
137
151
  }
138
152
  /**
139
153
  * Navigation system state interface
@@ -142,11 +156,11 @@ export interface NavigationSystemState {
142
156
  /**
143
157
  * Rail navigation component instance
144
158
  */
145
- rail: any;
159
+ rail: NavigationSystemComponent | null;
146
160
  /**
147
161
  * Drawer navigation component instance
148
162
  */
149
- drawer: any;
163
+ drawer: NavigationSystemComponent | null;
150
164
  /**
151
165
  * ID of the active section
152
166
  */
@@ -221,6 +235,24 @@ export interface ViewChangeEvent {
221
235
  */
222
236
  width: number;
223
237
  }
238
+ /**
239
+ * Section change event data
240
+ */
241
+ export interface SectionChangeEventData {
242
+ /**
243
+ * What triggered the section change
244
+ */
245
+ source: 'userClick' | 'programmatic';
246
+ }
247
+ /**
248
+ * Change event emitted by the rail or drawer navigation
249
+ */
250
+ export interface NavigationSystemChangeEvent extends NavChangeEvent {
251
+ /**
252
+ * What triggered the change, such as 'userAction' or 'api'
253
+ */
254
+ source?: string;
255
+ }
224
256
  /**
225
257
  * Navigation system API interface
226
258
  */
@@ -243,11 +275,11 @@ export interface NavigationSystem {
243
275
  /**
244
276
  * Get the rail navigation component
245
277
  */
246
- getRail(): any;
278
+ getRail(): NavigationComponent | null;
247
279
  /**
248
280
  * Get the drawer navigation component
249
281
  */
250
- getDrawer(): any;
282
+ getDrawer(): NavigationComponent | null;
251
283
  /**
252
284
  * Get the active section ID
253
285
  */
@@ -293,11 +325,11 @@ export interface NavigationSystem {
293
325
  /**
294
326
  * Handler for section changes
295
327
  */
296
- onSectionChange?: (sectionId: string, eventData: any) => void;
328
+ onSectionChange?: (sectionId: string, eventData: SectionChangeEventData) => void;
297
329
  /**
298
330
  * Handler for item selection
299
331
  */
300
- onItemSelect?: (event: any) => void;
332
+ onItemSelect?: (event: NavigationSystemChangeEvent) => void;
301
333
  /**
302
334
  * Handler for view changes (mobile/desktop)
303
335
  */
@@ -190,17 +190,26 @@ export interface BaseComponent {
190
190
  element: HTMLElement;
191
191
  prefix?: string;
192
192
  items?: Map<string, NavItemData>;
193
- emit?: (event: string, data: any) => void;
194
- on?: (event: string, handler: Function) => any;
195
- off?: (event: string, handler: Function) => any;
193
+ emit?: (event: string, data: unknown) => void;
194
+ on?: (event: string, handler: Function) => unknown;
195
+ off?: (event: string, handler: Function) => unknown;
196
196
  lifecycle?: {
197
197
  destroy: () => void;
198
198
  };
199
199
  disabled?: {
200
- enable: () => any;
201
- disable: () => any;
200
+ enable: () => unknown;
201
+ disable: () => unknown;
202
202
  };
203
- [key: string]: any;
203
+ variant?: string;
204
+ componentName?: string;
205
+ addItem?: (config: NavItemConfig) => unknown;
206
+ removeItem?: (id: string) => unknown;
207
+ getItem?: (id: string) => NavItemData | undefined;
208
+ getAllItems?: () => NavItemData[];
209
+ getActive?: () => NavItemData | null;
210
+ getItemPath?: (id: string) => string[];
211
+ setActive?: (id: string) => unknown;
212
+ handleItemClick?: (id: string) => void;
204
213
  }
205
214
  /**
206
215
  * API options interface
@@ -5,6 +5,7 @@ import { createElementConfig } from "../../core/config/component.js";
5
5
  import { createEmitter } from "../../core/state/emitter.js";
6
6
  import { mountRailRipple } from "./ripple.js";
7
7
  import { createBaseConfig } from "./config.js";
8
+ import { safeUrl } from "../../core/utils/url.js";
8
9
  const copyItems = (items) => {
9
10
  const ids = new Set();
10
11
  let selected = false;
@@ -104,7 +105,7 @@ export default function createNavigationRail(config = {}) {
104
105
  const element = document.createElement(item.href ? 'a' : 'button');
105
106
  if (item.href) {
106
107
  if (!item.disabled)
107
- element.setAttribute("href", item.href);
108
+ element.setAttribute("href", safeUrl(item.href));
108
109
  else {
109
110
  element.setAttribute('role', 'link');
110
111
  element.tabIndex = -1;
@@ -2,7 +2,6 @@ import { PROGRESS_CLASSES, PROGRESS_EVENTS, PROGRESS_THICKNESS, PROGRESS_SHAPES,
2
2
  import { addClass, removeClass } from "../../core/dom/index.js";
3
3
  export const withAPI = (options) => (comp) => {
4
4
  const { element, getClass, canvas } = comp;
5
- const isCircular = element.classList.contains(getClass(PROGRESS_CLASSES.CIRCULAR));
6
5
  const emitEvent = (name, detail) => {
7
6
  element.dispatchEvent(new CustomEvent(name, { detail }));
8
7
  };
@@ -21,7 +21,7 @@ export declare const createBaseConfig: (config?: ProgressConfig) => ProgressConf
21
21
  export declare const getElementConfig: (config: ProgressConfig) => {
22
22
  tag: string;
23
23
  componentName: string;
24
- attributes: Record<string, any>;
24
+ attributes: Record<string, unknown>;
25
25
  className: string[];
26
26
  rawClass: string | string[];
27
27
  id: string;
@@ -37,7 +37,7 @@ export declare const getElementConfig: (config: ProgressConfig) => {
37
37
  ariaHidden: boolean;
38
38
  html: string;
39
39
  text: string;
40
- forwardEvents: Record<string, boolean | ((component: any, event: Event) => boolean)>;
40
+ forwardEvents: Record<string, import("../../core/dom/create.js").EventCondition>;
41
41
  interactive: boolean;
42
42
  };
43
43
  /**
@@ -1,4 +1,4 @@
1
- import { ProgressConfig, ProgressThickness } from "../types.js";
1
+ import { ProgressConfig, ProgressThickness, ProgressShape } from "../types.js";
2
2
  export interface CanvasContext {
3
3
  canvas: HTMLCanvasElement;
4
4
  ctx: CanvasRenderingContext2D;
@@ -18,13 +18,22 @@ interface BaseComponent {
18
18
  max?: number;
19
19
  buffer?: number;
20
20
  indeterminate?: boolean;
21
- [key: string]: unknown;
21
+ shape?: ProgressShape;
22
22
  };
23
- [key: string]: unknown;
23
+ ctx?: CanvasRenderingContext2D;
24
+ setValue?: (value: number, animate?: boolean) => void;
25
+ setIndeterminate?: (indeterminate: boolean) => void;
26
+ setThickness?: (thickness: ProgressThickness) => void;
27
+ setShape?: (shape: ProgressShape) => void;
28
+ currentShape?: ProgressShape;
29
+ setSize?: (size: number) => void;
30
+ getSize?: () => number | undefined;
31
+ hide?: () => BaseComponent;
32
+ show?: () => BaseComponent;
33
+ isVisible?: () => boolean;
24
34
  }
25
35
  export interface CanvasComponent extends BaseComponent {
26
36
  canvas: HTMLCanvasElement;
27
- ctx?: CanvasRenderingContext2D;
28
37
  draw: () => void;
29
38
  resize: () => void;
30
39
  }
@@ -46,5 +55,5 @@ export declare const getLinearHeight: (strokeWidth: number, isWavy: boolean) =>
46
55
  /**
47
56
  * Adds the canvas, the drawing routine and the animation loop
48
57
  */
49
- export declare const withCanvas: (config: ProgressConfig) => (component: BaseComponent) => CanvasComponent;
58
+ export declare const withCanvas: (config: ProgressConfig) => <C extends BaseComponent>(component: C) => C & CanvasComponent;
50
59
  export {};
@@ -32,7 +32,6 @@ interface ComponentWithLifecycle {
32
32
  showLabel?: () => unknown;
33
33
  setThickness?: (thickness: number | string) => unknown;
34
34
  state?: ProgressState;
35
- [key: string]: any;
36
35
  }
37
36
  /**
38
37
  * Adds state management for canvas-based progress component
@@ -40,7 +39,7 @@ interface ComponentWithLifecycle {
40
39
  * @param config Progress configuration
41
40
  * @returns Component enhancer with state management
42
41
  */
43
- export declare const withState: (config: ProgressConfig) => (component: ComponentWithLifecycle) => ComponentWithLifecycle & {
42
+ export declare const withState: (config: ProgressConfig) => <C extends ComponentWithLifecycle>(component: C) => C & {
44
43
  state: ProgressState;
45
44
  };
46
45
  export {};
@@ -105,7 +105,7 @@ export interface ProgressConfig {
105
105
  * DOM structure schema
106
106
  * @internal
107
107
  */
108
- schema?: any;
108
+ schema?: object;
109
109
  /**
110
110
  * Size of the circular progress indicator in dp (only for circular variant)
111
111
  * Clamped between 24 and 240
@@ -17,7 +17,7 @@ export declare const createBaseConfig: (config: RadiosConfig) => RadiosConfig;
17
17
  export declare const getElementConfig: (config: RadiosConfig) => {
18
18
  tag: string;
19
19
  componentName: string;
20
- attributes: Record<string, any>;
20
+ attributes: Record<string, unknown>;
21
21
  className: string[];
22
22
  rawClass: string | string[];
23
23
  id: string;
@@ -33,7 +33,7 @@ export declare const getElementConfig: (config: RadiosConfig) => {
33
33
  ariaHidden: boolean;
34
34
  html: string;
35
35
  text: string;
36
- forwardEvents: Record<string, boolean | ((component: any, event: Event) => boolean)>;
36
+ forwardEvents: Record<string, import("../../core/dom/create.js").EventCondition>;
37
37
  interactive: boolean;
38
38
  };
39
39
  /**
@@ -52,19 +52,19 @@ export const withAPI = (options) => (component) => {
52
52
  options.value.submit();
53
53
  return this;
54
54
  },
55
- setLeadingIcon(iconHtml) {
55
+ setLeadingIcon() {
56
56
  console.warn("setLeadingIcon: Not yet implemented");
57
57
  return this;
58
58
  },
59
- addTrailingItem(item) {
59
+ addTrailingItem() {
60
60
  console.warn("addTrailingItem: Not yet implemented");
61
61
  return this;
62
62
  },
63
- removeTrailingItem(id) {
63
+ removeTrailingItem() {
64
64
  console.warn("removeTrailingItem: Not yet implemented");
65
65
  return this;
66
66
  },
67
- setTrailingItems(items) {
67
+ setTrailingItems() {
68
68
  console.warn("setTrailingItems: Not yet implemented");
69
69
  return this;
70
70
  },
@@ -21,7 +21,7 @@ export declare const createBaseConfig: (config?: SearchConfig) => SearchConfig;
21
21
  export declare const getElementConfig: (config: SearchConfig) => {
22
22
  tag: string;
23
23
  componentName: string;
24
- attributes: Record<string, any>;
24
+ attributes: Record<string, unknown>;
25
25
  className: string[];
26
26
  rawClass: string | string[];
27
27
  id: string;
@@ -37,7 +37,7 @@ export declare const getElementConfig: (config: SearchConfig) => {
37
37
  ariaHidden: boolean;
38
38
  html: string;
39
39
  text: string;
40
- forwardEvents: Record<string, boolean | ((component: any, event: Event) => boolean)>;
40
+ forwardEvents: Record<string, import("../../core/dom/create.js").EventCondition>;
41
41
  interactive: boolean;
42
42
  };
43
43
  /**
@@ -1,9 +1,7 @@
1
- import { SearchConfig } from "../types.js";
2
1
  /**
3
2
  * Adds suggestion list features to the search component
4
3
  * Handles rendering suggestions and keyboard navigation per MD3 specifications
5
4
  *
6
- * @param config Search configuration
7
5
  * @returns Component enhancer with suggestions features
8
6
  */
9
- export declare const withSuggestions: (config: SearchConfig) => (component: any) => any;
7
+ export declare const withSuggestions: () => (component: any) => any;