mtrl 0.3.9 → 0.4.3

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 (167) hide show
  1. package/dist/components/badge/api.d.ts +5 -5
  2. package/dist/components/badge/config.d.ts +18 -8
  3. package/dist/components/bottom-app-bar/bottom-app-bar.d.ts +1 -1
  4. package/dist/components/bottom-app-bar/config.d.ts +1 -1
  5. package/dist/components/button/api.d.ts +19 -3
  6. package/dist/components/button/button.d.ts +41 -1
  7. package/dist/components/button/config.d.ts +18 -7
  8. package/dist/components/button/constants.d.ts +36 -0
  9. package/dist/components/button/features/progress.d.ts +26 -0
  10. package/dist/components/button/types.d.ts +108 -1
  11. package/dist/components/card/config.d.ts +2 -2
  12. package/dist/components/card/features.d.ts +14 -1
  13. package/dist/components/card/index.d.ts +6 -6
  14. package/dist/components/carousel/api.d.ts +15 -11
  15. package/dist/components/carousel/carousel.d.ts +1 -1
  16. package/dist/components/carousel/config.d.ts +2 -2
  17. package/dist/components/carousel/features/drag.d.ts +1 -1
  18. package/dist/components/carousel/features/slides.d.ts +1 -1
  19. package/dist/components/checkbox/config.d.ts +2 -2
  20. package/dist/components/checkbox/types.d.ts +2 -2
  21. package/dist/components/chips/chip/chip.d.ts +1 -1
  22. package/dist/components/chips/chip/config.d.ts +2 -2
  23. package/dist/components/chips/chips.d.ts +1 -1
  24. package/dist/components/chips/config.d.ts +1 -1
  25. package/dist/components/chips/features/chip-items.d.ts +1 -1
  26. package/dist/components/chips/schema.d.ts +1 -2
  27. package/dist/components/datepicker/api.d.ts +1 -1
  28. package/dist/components/datepicker/config.d.ts +4 -4
  29. package/dist/components/datepicker/datepicker.d.ts +1 -1
  30. package/dist/components/datepicker/render.d.ts +5 -5
  31. package/dist/components/dialog/config.d.ts +2 -2
  32. package/dist/components/dialog/features.d.ts +1 -1
  33. package/dist/components/dialog/types.d.ts +1 -1
  34. package/dist/components/divider/divider.d.ts +2 -2
  35. package/dist/components/extended-fab/config.d.ts +2 -2
  36. package/dist/components/fab/config.d.ts +2 -2
  37. package/dist/components/index.d.ts +2 -1
  38. package/dist/components/list/config.d.ts +1 -1
  39. package/dist/components/menu/api.d.ts +14 -14
  40. package/dist/components/menu/config.d.ts +2 -2
  41. package/dist/components/menu/features/controller.d.ts +1 -1
  42. package/dist/components/menu/features/keyboard.d.ts +2 -2
  43. package/dist/components/menu/features/submenu.d.ts +1 -1
  44. package/dist/components/menu/menu.d.ts +1 -1
  45. package/dist/components/navigation/config.d.ts +2 -2
  46. package/dist/components/navigation/features/controller.d.ts +1 -1
  47. package/dist/components/navigation/features/items.d.ts +2 -1
  48. package/dist/components/navigation/navigation.d.ts +1 -1
  49. package/dist/components/navigation/system/core.d.ts +1 -1
  50. package/dist/components/navigation/system/events.d.ts +1 -1
  51. package/dist/components/navigation/system/index.d.ts +2 -2
  52. package/dist/components/progress/api.d.ts +49 -18
  53. package/dist/components/progress/config.d.ts +20 -11
  54. package/dist/components/progress/constants.d.ts +86 -1
  55. package/dist/components/progress/features/canvas.d.ts +61 -0
  56. package/dist/components/progress/features/circular.d.ts +9 -0
  57. package/dist/components/progress/features/index.d.ts +8 -0
  58. package/dist/components/progress/features/linear.d.ts +9 -0
  59. package/dist/components/progress/features/resize-observer.d.ts +5 -0
  60. package/dist/components/progress/features/state.d.ts +46 -0
  61. package/dist/components/progress/index.d.ts +2 -2
  62. package/dist/components/progress/progress.d.ts +2 -2
  63. package/dist/components/progress/types.d.ts +102 -17
  64. package/dist/components/radios/api.d.ts +11 -11
  65. package/dist/components/radios/config.d.ts +2 -2
  66. package/dist/components/radios/radios.d.ts +1 -1
  67. package/dist/components/search/api.d.ts +15 -11
  68. package/dist/components/search/config.d.ts +1 -1
  69. package/dist/components/search/features/search.d.ts +1 -1
  70. package/dist/components/segmented-button/config.d.ts +8 -8
  71. package/dist/components/select/api.d.ts +1 -1
  72. package/dist/components/select/config.d.ts +1 -1
  73. package/dist/components/select/features.d.ts +1 -1
  74. package/dist/components/select/types.d.ts +20 -5
  75. package/dist/components/sheet/config.d.ts +2 -2
  76. package/dist/components/sheet/sheet.d.ts +1 -1
  77. package/dist/components/slider/api.d.ts +3 -2
  78. package/dist/components/slider/config.d.ts +2 -2
  79. package/dist/components/slider/constants.d.ts +50 -21
  80. package/dist/components/slider/features/canvas.d.ts +47 -0
  81. package/dist/components/slider/features/controller.d.ts +1 -1
  82. package/dist/components/slider/features/handlers.d.ts +1 -1
  83. package/dist/components/slider/features/index.d.ts +1 -0
  84. package/dist/components/slider/features/states.d.ts +1 -1
  85. package/dist/components/slider/schema.d.ts +7 -50
  86. package/dist/components/slider/slider.d.ts +5 -4
  87. package/dist/components/slider/types.d.ts +10 -37
  88. package/dist/components/snackbar/api.d.ts +1 -1
  89. package/dist/components/snackbar/config.d.ts +3 -3
  90. package/dist/components/switch/api.d.ts +1 -1
  91. package/dist/components/switch/config.d.ts +2 -2
  92. package/dist/components/switch/features.d.ts +4 -4
  93. package/dist/components/switch/switch.d.ts +1 -1
  94. package/dist/components/switch/types.d.ts +22 -17
  95. package/dist/components/tabs/config.d.ts +2 -3
  96. package/dist/components/tabs/features.d.ts +5 -5
  97. package/dist/components/tabs/index.d.ts +10 -10
  98. package/dist/components/tabs/tab.d.ts +1 -1
  99. package/dist/components/tabs/utils.d.ts +1 -1
  100. package/dist/components/textfield/api.d.ts +13 -3
  101. package/dist/components/textfield/config.d.ts +2 -2
  102. package/dist/components/textfield/constants.d.ts +12 -20
  103. package/dist/components/textfield/features/density.d.ts +28 -0
  104. package/dist/components/textfield/features/index.d.ts +13 -12
  105. package/dist/components/textfield/index.d.ts +3 -3
  106. package/dist/components/textfield/textfield.d.ts +1 -1
  107. package/dist/components/textfield/types.d.ts +42 -35
  108. package/dist/components/timepicker/clockdial.d.ts +2 -2
  109. package/dist/components/timepicker/config.d.ts +4 -4
  110. package/dist/components/timepicker/render.d.ts +1 -1
  111. package/dist/components/timepicker/timepicker.d.ts +1 -1
  112. package/dist/components/timepicker/utils.d.ts +2 -2
  113. package/dist/components/tooltip/api.d.ts +1 -1
  114. package/dist/components/tooltip/config.d.ts +2 -2
  115. package/dist/components/top-app-bar/top-app-bar.d.ts +2 -2
  116. package/dist/constants.d.ts +30 -30
  117. package/dist/core/canvas/animation.d.ts +27 -0
  118. package/dist/core/canvas/drawing.d.ts +57 -0
  119. package/dist/core/canvas/index.d.ts +8 -0
  120. package/dist/core/canvas/resize.d.ts +14 -0
  121. package/dist/core/canvas/utils.d.ts +84 -0
  122. package/dist/core/collection/collection.d.ts +7 -7
  123. package/dist/core/collection/list-manager/index.d.ts +2 -2
  124. package/dist/core/collection/list-manager/renderer.d.ts +3 -3
  125. package/dist/core/collection/list-manager/scroll-tracker.d.ts +1 -1
  126. package/dist/core/compose/component.d.ts +2 -1
  127. package/dist/core/compose/features/checkable.d.ts +2 -2
  128. package/dist/core/compose/features/gestures/longpress.d.ts +2 -2
  129. package/dist/core/compose/features/gestures/pan.d.ts +2 -2
  130. package/dist/core/compose/features/gestures/pinch.d.ts +2 -2
  131. package/dist/core/compose/features/gestures/rotate.d.ts +2 -2
  132. package/dist/core/compose/features/gestures/swipe.d.ts +2 -2
  133. package/dist/core/compose/features/gestures/tap.d.ts +2 -2
  134. package/dist/core/compose/features/gestures.d.ts +2 -2
  135. package/dist/core/compose/features/input.d.ts +1 -1
  136. package/dist/core/compose/features/ripple.d.ts +2 -2
  137. package/dist/core/compose/features/size.d.ts +1 -1
  138. package/dist/core/compose/features/textinput.d.ts +1 -1
  139. package/dist/core/compose/features/throttle.d.ts +1 -1
  140. package/dist/core/compose/features/variant.d.ts +1 -1
  141. package/dist/core/compose/features/withEvents.d.ts +1 -1
  142. package/dist/core/composition/features/label.d.ts +1 -1
  143. package/dist/core/config/component.d.ts +4 -2
  144. package/dist/core/config/global.d.ts +65 -0
  145. package/dist/core/dom/attributes.d.ts +13 -15
  146. package/dist/core/dom/classes.d.ts +10 -0
  147. package/dist/core/dom/create.d.ts +36 -6
  148. package/dist/core/dom/index.d.ts +2 -2
  149. package/dist/core/gestures/pan.d.ts +1 -1
  150. package/dist/core/gestures/pinch.d.ts +1 -1
  151. package/dist/core/gestures/rotate.d.ts +1 -1
  152. package/dist/core/index.d.ts +3 -1
  153. package/dist/core/layout/array.d.ts +7 -2
  154. package/dist/core/layout/object.d.ts +2 -2
  155. package/dist/core/layout/processor.d.ts +2 -2
  156. package/dist/core/layout/utils.d.ts +1 -1
  157. package/dist/core/utils/color.d.ts +14 -0
  158. package/dist/core/utils/index.d.ts +2 -6
  159. package/dist/core/utils/theme.d.ts +38 -0
  160. package/dist/index.cjs +15 -15
  161. package/dist/index.cjs.map +158 -143
  162. package/dist/index.d.ts +7 -7
  163. package/dist/index.js +15 -15
  164. package/dist/index.js.map +158 -143
  165. package/dist/package.json +1 -1
  166. package/dist/styles.css +2 -2
  167. package/package.json +9 -13
@@ -2,7 +2,11 @@
2
2
  * @module core/layout
3
3
  * @description Processor for array-based layout schemas
4
4
  */
5
- import { LayoutResult, LayoutOptions } from './types';
5
+ import { LayoutResult, LayoutOptions } from "./types";
6
+ /**
7
+ * Type for schema items
8
+ */
9
+ type SchemaItem = Function | string | Record<string, unknown> | SchemaItem[];
6
10
  /**
7
11
  * Processes an array-based layout definition
8
12
  *
@@ -12,4 +16,5 @@ import { LayoutResult, LayoutOptions } from './types';
12
16
  * @param options - Layout creation options
13
17
  * @returns Layout result object
14
18
  */
15
- export declare function processArraySchema(schema: any[], parentElement?: HTMLElement | null, level?: number, options?: LayoutOptions): LayoutResult;
19
+ export declare function processArraySchema(schema: SchemaItem[], parentElement?: HTMLElement | null, level?: number, options?: LayoutOptions): LayoutResult;
20
+ export {};
@@ -2,7 +2,7 @@
2
2
  * @module core/layout
3
3
  * @description Processor for object-based layout schemas
4
4
  */
5
- import { Schema, LayoutResult, LayoutOptions } from './types';
5
+ import { Schema, LayoutResult, LayoutOptions } from "./types";
6
6
  /**
7
7
  * Processes an object-based layout definition
8
8
  *
@@ -11,4 +11,4 @@ import { Schema, LayoutResult, LayoutOptions } from './types';
11
11
  * @param options - Layout creation options
12
12
  * @returns Layout result object
13
13
  */
14
- export declare function processObjectSchema(schema: Schema, parentElement?: HTMLElement | DocumentFragment | null, options?: LayoutOptions): LayoutResult;
14
+ export declare function processObjectSchema(schema: Schema, parentElement?: HTMLElement | SVGElement | DocumentFragment | null, options?: LayoutOptions): LayoutResult;
@@ -2,7 +2,7 @@
2
2
  * @module core/layout
3
3
  * @description Processor for layout creation
4
4
  */
5
- import { LayoutResult, LayoutOptions } from './types';
5
+ import { LayoutResult, LayoutOptions } from "./types";
6
6
  /**
7
7
  * Creates a component from a constructor or factory function
8
8
  *
@@ -11,7 +11,7 @@ import { LayoutResult, LayoutOptions } from './types';
11
11
  * @param layoutOptions - Global layout options
12
12
  * @returns Created component instance
13
13
  */
14
- export declare function createComponentInstance(Component: any, options?: Record<string, any>, layoutOptions?: LayoutOptions): any;
14
+ export declare function createComponentInstance(Component: any, options?: Record<string, any>): any;
15
15
  /**
16
16
  * Determines if a schema is in JSX format (transformed by h function)
17
17
  */
@@ -2,7 +2,7 @@
2
2
  * @module core/layout
3
3
  * @description Utility functions for layout creation
4
4
  */
5
- import { ComponentLike } from './types';
5
+ import { ComponentLike } from "./types";
6
6
  /**
7
7
  * Checks if a value is a component object (has an element property)
8
8
  *
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Converts a color to RGBA format with specified opacity
3
+ * Handles hex, rgb, rgba, and named colors
4
+ *
5
+ * @param color - The color string to convert (hex, rgb, rgba, or named color)
6
+ * @param opacity - The opacity value (0-1)
7
+ * @returns RGBA color string
8
+ *
9
+ * @example
10
+ * colorToRGBA('#ff0000', 0.5) // 'rgba(255, 0, 0, 0.5)'
11
+ * colorToRGBA('rgb(255, 0, 0)', 0.5) // 'rgba(255, 0, 0, 0.5)'
12
+ * colorToRGBA('red', 0.5) // 'rgba(255, 0, 0, 0.5)'
13
+ */
14
+ export declare const colorToRGBA: (color: string, opacity: number) => string;
@@ -2,12 +2,8 @@ export { isObject, byString } from './object';
2
2
  export { normalizeEvent, hasTouchSupport, TOUCH_CONFIG, PASSIVE_EVENTS } from './mobile';
3
3
  export { getInheritedBackground } from './background';
4
4
  export { throttle, debounce, once } from './performance';
5
- /**
6
- * Normalizes class names by handling various input formats
7
- * @param {...(string|string[])} classes - Classes to normalize
8
- * @returns {string[]} Array of unique, non-empty class names
9
- */
10
- export declare const normalizeClasses: (...classes: (string | string[])[]) => string[];
5
+ export { getThemeColor } from './theme';
6
+ export { colorToRGBA } from './color';
11
7
  /**
12
8
  * Creates a transformer that only runs if a condition is met
13
9
  * @param {Function} predicate - Condition to check
@@ -0,0 +1,38 @@
1
+ type ThemeChangeCallback = () => void;
2
+ /**
3
+ * Register a callback to be notified of theme changes
4
+ * @param callback Function to call when theme changes
5
+ * @returns Function to unregister the callback
6
+ */
7
+ export declare const onThemeChange: (callback: ThemeChangeCallback) => (() => void);
8
+ /**
9
+ * Gets a theme color from CSS variables, with optional alpha/opacity support.
10
+ * The prefix is automatically added to the variable name.
11
+ * Colors are retrieved from the active theme (defined on body element) if available,
12
+ * falling back to the default theme (defined on :root) if not found.
13
+ *
14
+ * @param {string} varName - The CSS variable name without prefix (e.g. 'sys-color-primary' or 'sys-color-primary-rgb')
15
+ * @param {object} [options] - Options for color retrieval
16
+ * @param {number} [options.alpha] - Alpha value (0-1) for rgba output (only works with --*-rgb variables)
17
+ * @param {string} [options.fallback] - Fallback color if variable is not found
18
+ * @param {ThemeChangeCallback} [options.onThemeChange] - Optional callback for theme changes
19
+ * @returns {string} The color value (hex, rgb, or rgba)
20
+ *
21
+ * @example
22
+ * // Basic usage
23
+ * getThemeColor('sys-color-primary') // '#006493' (from active theme)
24
+ *
25
+ * // With theme change notification
26
+ * getThemeColor('sys-color-primary', {
27
+ * onThemeChange: () => {
28
+ * // Re-render or update component
29
+ * component.update();
30
+ * }
31
+ * });
32
+ */
33
+ export declare function getThemeColor(varName: string, options?: {
34
+ alpha?: number;
35
+ fallback?: string;
36
+ onThemeChange?: ThemeChangeCallback;
37
+ }): string;
38
+ export {};