mtrl 0.4.0 → 0.4.4
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/dist/components/badge/api.d.ts +5 -5
- package/dist/components/badge/config.d.ts +17 -7
- package/dist/components/bottom-app-bar/bottom-app-bar.d.ts +1 -1
- package/dist/components/bottom-app-bar/config.d.ts +1 -1
- package/dist/components/button/api.d.ts +19 -3
- package/dist/components/button/button.d.ts +41 -1
- package/dist/components/button/config.d.ts +17 -6
- package/dist/components/button/constants.d.ts +36 -0
- package/dist/components/button/features/progress.d.ts +26 -0
- package/dist/components/button/types.d.ts +108 -1
- package/dist/components/card/config.d.ts +1 -1
- package/dist/components/card/features.d.ts +14 -1
- package/dist/components/card/index.d.ts +6 -6
- package/dist/components/carousel/api.d.ts +15 -11
- package/dist/components/carousel/carousel.d.ts +1 -1
- package/dist/components/carousel/config.d.ts +1 -1
- package/dist/components/carousel/features/drag.d.ts +1 -1
- package/dist/components/carousel/features/slides.d.ts +1 -1
- package/dist/components/checkbox/config.d.ts +1 -1
- package/dist/components/checkbox/types.d.ts +2 -2
- package/dist/components/chips/chip/chip.d.ts +1 -1
- package/dist/components/chips/chip/config.d.ts +1 -1
- package/dist/components/chips/chips.d.ts +1 -1
- package/dist/components/chips/features/chip-items.d.ts +1 -1
- package/dist/components/chips/schema.d.ts +0 -1
- package/dist/components/datepicker/api.d.ts +1 -1
- package/dist/components/datepicker/config.d.ts +1 -1
- package/dist/components/datepicker/datepicker.d.ts +1 -1
- package/dist/components/datepicker/render.d.ts +5 -5
- package/dist/components/dialog/features.d.ts +1 -1
- package/dist/components/divider/divider.d.ts +2 -2
- package/dist/components/extended-fab/config.d.ts +1 -1
- package/dist/components/fab/config.d.ts +1 -1
- package/dist/components/index.d.ts +2 -1
- package/dist/components/menu/api.d.ts +14 -14
- package/dist/components/menu/config.d.ts +1 -1
- package/dist/components/menu/features/controller.d.ts +1 -1
- package/dist/components/menu/features/keyboard.d.ts +2 -2
- package/dist/components/menu/features/submenu.d.ts +1 -1
- package/dist/components/menu/menu.d.ts +1 -1
- package/dist/components/navigation/config.d.ts +1 -1
- package/dist/components/navigation/features/controller.d.ts +1 -1
- package/dist/components/navigation/features/items.d.ts +2 -1
- package/dist/components/navigation/navigation.d.ts +1 -1
- package/dist/components/navigation/system/core.d.ts +1 -1
- package/dist/components/navigation/system/events.d.ts +1 -1
- package/dist/components/navigation/system/index.d.ts +2 -2
- package/dist/components/progress/api.d.ts +33 -2
- package/dist/components/progress/config.d.ts +2 -2
- package/dist/components/progress/constants.d.ts +25 -21
- package/dist/components/progress/features/canvas.d.ts +34 -5
- package/dist/components/progress/features/circular.d.ts +2 -2
- package/dist/components/progress/features/linear.d.ts +2 -2
- package/dist/components/progress/features/state.d.ts +9 -1
- package/dist/components/progress/progress.d.ts +1 -1
- package/dist/components/progress/types.d.ts +18 -6
- package/dist/components/radios/api.d.ts +11 -11
- package/dist/components/radios/config.d.ts +1 -1
- package/dist/components/radios/radios.d.ts +1 -1
- package/dist/components/search/api.d.ts +15 -11
- package/dist/components/search/features/search.d.ts +1 -1
- package/dist/components/segmented-button/config.d.ts +6 -6
- package/dist/components/select/api.d.ts +1 -1
- package/dist/components/select/config.d.ts +1 -1
- package/dist/components/select/features.d.ts +1 -1
- package/dist/components/select/types.d.ts +20 -5
- package/dist/components/sheet/config.d.ts +1 -1
- package/dist/components/sheet/sheet.d.ts +1 -1
- package/dist/components/slider/api.d.ts +3 -2
- package/dist/components/slider/config.d.ts +1 -1
- package/dist/components/slider/constants.d.ts +50 -21
- package/dist/components/slider/features/canvas.d.ts +47 -0
- package/dist/components/slider/features/controller.d.ts +1 -1
- package/dist/components/slider/features/handlers.d.ts +1 -1
- package/dist/components/slider/features/index.d.ts +1 -0
- package/dist/components/slider/features/states.d.ts +1 -1
- package/dist/components/slider/schema.d.ts +4 -47
- package/dist/components/slider/slider.d.ts +5 -4
- package/dist/components/slider/types.d.ts +10 -37
- package/dist/components/snackbar/api.d.ts +1 -1
- package/dist/components/snackbar/config.d.ts +2 -2
- package/dist/components/switch/api.d.ts +1 -1
- package/dist/components/switch/config.d.ts +1 -1
- package/dist/components/switch/features.d.ts +4 -4
- package/dist/components/switch/switch.d.ts +1 -1
- package/dist/components/switch/types.d.ts +22 -17
- package/dist/components/tabs/config.d.ts +2 -3
- package/dist/components/tabs/features.d.ts +5 -5
- package/dist/components/tabs/index.d.ts +10 -10
- package/dist/components/tabs/tab.d.ts +1 -1
- package/dist/components/tabs/utils.d.ts +1 -1
- package/dist/components/textfield/api.d.ts +13 -3
- package/dist/components/textfield/config.d.ts +1 -1
- package/dist/components/textfield/constants.d.ts +12 -20
- package/dist/components/textfield/features/density.d.ts +28 -0
- package/dist/components/textfield/features/index.d.ts +13 -12
- package/dist/components/textfield/index.d.ts +3 -3
- package/dist/components/textfield/textfield.d.ts +1 -1
- package/dist/components/textfield/types.d.ts +42 -35
- package/dist/components/timepicker/clockdial.d.ts +2 -2
- package/dist/components/timepicker/config.d.ts +1 -1
- package/dist/components/timepicker/render.d.ts +1 -1
- package/dist/components/timepicker/timepicker.d.ts +1 -1
- package/dist/components/timepicker/utils.d.ts +2 -2
- package/dist/components/tooltip/api.d.ts +1 -1
- package/dist/components/tooltip/config.d.ts +1 -1
- package/dist/components/top-app-bar/top-app-bar.d.ts +2 -2
- package/dist/constants.d.ts +30 -30
- package/dist/core/canvas/animation.d.ts +27 -0
- package/dist/core/canvas/drawing.d.ts +57 -0
- package/dist/core/canvas/index.d.ts +6 -3
- package/dist/core/canvas/utils.d.ts +84 -0
- package/dist/core/collection/collection.d.ts +7 -7
- package/dist/core/collection/list-manager/index.d.ts +2 -2
- package/dist/core/collection/list-manager/renderer.d.ts +3 -3
- package/dist/core/collection/list-manager/scroll-tracker.d.ts +1 -1
- package/dist/core/compose/component.d.ts +1 -0
- package/dist/core/compose/features/checkable.d.ts +2 -2
- package/dist/core/compose/features/gestures/longpress.d.ts +2 -2
- package/dist/core/compose/features/gestures/pan.d.ts +2 -2
- package/dist/core/compose/features/gestures/pinch.d.ts +2 -2
- package/dist/core/compose/features/gestures/rotate.d.ts +2 -2
- package/dist/core/compose/features/gestures/swipe.d.ts +2 -2
- package/dist/core/compose/features/gestures/tap.d.ts +2 -2
- package/dist/core/compose/features/gestures.d.ts +2 -2
- package/dist/core/compose/features/input.d.ts +1 -1
- package/dist/core/compose/features/ripple.d.ts +2 -2
- package/dist/core/compose/features/size.d.ts +1 -1
- package/dist/core/compose/features/textinput.d.ts +1 -1
- package/dist/core/compose/features/throttle.d.ts +1 -1
- package/dist/core/compose/features/variant.d.ts +1 -1
- package/dist/core/compose/features/withEvents.d.ts +1 -1
- package/dist/core/composition/features/label.d.ts +1 -1
- package/dist/core/config/component.d.ts +2 -0
- package/dist/core/config/global.d.ts +65 -0
- package/dist/core/dom/create.d.ts +1 -1
- package/dist/core/gestures/pan.d.ts +1 -1
- package/dist/core/gestures/pinch.d.ts +1 -1
- package/dist/core/gestures/rotate.d.ts +1 -1
- package/dist/core/index.d.ts +2 -0
- package/dist/core/layout/array.d.ts +7 -2
- package/dist/core/layout/object.d.ts +1 -1
- package/dist/core/layout/processor.d.ts +2 -2
- package/dist/core/layout/utils.d.ts +1 -1
- package/dist/core/utils/color.d.ts +14 -0
- package/dist/core/utils/index.d.ts +1 -0
- package/dist/index.cjs +15 -15
- package/dist/index.cjs.map +149 -140
- package/dist/index.d.ts +7 -7
- package/dist/index.js +15 -15
- package/dist/index.js.map +149 -140
- package/dist/package.json +1 -1
- package/dist/styles.css +2 -2
- package/package.json +8 -2
- package/dist/components/progress/features.d.ts +0 -40
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* @param {Object} params - Rendering parameters
|
|
4
4
|
* @returns {HTMLElement} Calendar header element
|
|
5
5
|
*/
|
|
6
|
-
export declare const renderHeader: ({ currentMonth, currentYear, currentView, prefix, emit }: any) => HTMLElement;
|
|
6
|
+
export declare const renderHeader: ({ currentMonth, currentYear, currentView, prefix, emit, }: any) => HTMLElement;
|
|
7
7
|
/**
|
|
8
8
|
* Renders the days of the week (S, M, T, etc.)
|
|
9
9
|
* @param {string} prefix - CSS class prefix
|
|
@@ -15,25 +15,25 @@ export declare const renderWeekdays: (prefix: string) => HTMLElement;
|
|
|
15
15
|
* @param {Object} params - Rendering parameters
|
|
16
16
|
* @returns {HTMLElement} Calendar days element
|
|
17
17
|
*/
|
|
18
|
-
export declare const renderDays: ({ currentYear, currentMonth, selectedDate, rangeEndDate, minDate, maxDate, prefix, emit }: any) => HTMLElement;
|
|
18
|
+
export declare const renderDays: ({ currentYear, currentMonth, selectedDate, rangeEndDate, minDate, maxDate, prefix, emit, }: any) => HTMLElement;
|
|
19
19
|
/**
|
|
20
20
|
* Renders the month selection view
|
|
21
21
|
* @param {Object} params - Rendering parameters
|
|
22
22
|
* @returns {HTMLElement} Month selection element
|
|
23
23
|
*/
|
|
24
|
-
export declare const renderMonthSelection: ({
|
|
24
|
+
export declare const renderMonthSelection: ({ currentMonth, prefix, emit, }: any) => HTMLElement;
|
|
25
25
|
/**
|
|
26
26
|
* Renders the year selection view
|
|
27
27
|
* @param {Object} params - Rendering parameters
|
|
28
28
|
* @returns {HTMLElement} Year selection element
|
|
29
29
|
*/
|
|
30
|
-
export declare const renderYearSelection: ({ currentYear, prefix, emit }: any) => HTMLElement;
|
|
30
|
+
export declare const renderYearSelection: ({ currentYear, prefix, emit, }: any) => HTMLElement;
|
|
31
31
|
/**
|
|
32
32
|
* Renders the footer with action buttons
|
|
33
33
|
* @param {Object} params - Rendering parameters
|
|
34
34
|
* @returns {HTMLElement} Footer element
|
|
35
35
|
*/
|
|
36
|
-
export declare const renderFooter: ({
|
|
36
|
+
export declare const renderFooter: ({ prefix, emit }: any) => HTMLElement;
|
|
37
37
|
/**
|
|
38
38
|
* Renders a complete calendar view
|
|
39
39
|
* @param {Object} state - Current datepicker state
|
|
@@ -27,7 +27,8 @@ export * from './fab';
|
|
|
27
27
|
export * from './extended-fab';
|
|
28
28
|
export * from './menu';
|
|
29
29
|
export * from './navigation';
|
|
30
|
-
export
|
|
30
|
+
export { PROGRESS_VARIANTS, PROGRESS_SHAPES, PROGRESS_EVENTS, PROGRESS_DEFAULTS, PROGRESS_CLASSES, PROGRESS_MEASUREMENTS, PROGRESS_THICKNESS } from './progress/constants';
|
|
31
|
+
export type { ProgressConfig, ProgressComponent, ProgressShape } from './progress/types';
|
|
31
32
|
export * from './radios';
|
|
32
33
|
export * from './search';
|
|
33
34
|
export * from './segmented-button';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MenuComponent, MenuContent, MenuPosition } from
|
|
1
|
+
import { MenuComponent, MenuContent, MenuPosition, MenuEvents } from "./types";
|
|
2
2
|
/**
|
|
3
3
|
* API configuration options for menu component
|
|
4
4
|
* @category Components
|
|
@@ -6,19 +6,19 @@ import { MenuComponent, MenuContent, MenuPosition } from './types';
|
|
|
6
6
|
*/
|
|
7
7
|
interface ApiOptions {
|
|
8
8
|
menu: {
|
|
9
|
-
open: (event?: Event, interactionType?:
|
|
10
|
-
close: (event?: Event, restoreFocus?: boolean, skipAnimation?: boolean) =>
|
|
11
|
-
toggle: (event?: Event, interactionType?:
|
|
9
|
+
open: (event?: Event, interactionType?: "mouse" | "keyboard") => void;
|
|
10
|
+
close: (event?: Event, restoreFocus?: boolean, skipAnimation?: boolean) => void;
|
|
11
|
+
toggle: (event?: Event, interactionType?: "mouse" | "keyboard") => void;
|
|
12
12
|
isOpen: () => boolean;
|
|
13
|
-
setItems: (items: MenuContent[]) =>
|
|
13
|
+
setItems: (items: MenuContent[]) => void;
|
|
14
14
|
getItems: () => MenuContent[];
|
|
15
|
-
setPosition: (position: MenuPosition) =>
|
|
15
|
+
setPosition: (position: MenuPosition) => void;
|
|
16
16
|
getPosition: () => MenuPosition;
|
|
17
|
-
setSelected: (itemId: string) =>
|
|
17
|
+
setSelected: (itemId: string) => void;
|
|
18
18
|
getSelected: () => string | null;
|
|
19
19
|
};
|
|
20
20
|
opener: {
|
|
21
|
-
setOpener: (opener: HTMLElement | string) =>
|
|
21
|
+
setOpener: (opener: HTMLElement | string) => void;
|
|
22
22
|
getOpener: () => HTMLElement;
|
|
23
23
|
};
|
|
24
24
|
submenu?: {
|
|
@@ -26,8 +26,8 @@ interface ApiOptions {
|
|
|
26
26
|
closeAllSubmenus: () => void;
|
|
27
27
|
};
|
|
28
28
|
events?: {
|
|
29
|
-
on: <T extends
|
|
30
|
-
off: <T extends
|
|
29
|
+
on: <T extends keyof MenuEvents>(event: T, handler: MenuEvents[T]) => void;
|
|
30
|
+
off: <T extends keyof MenuEvents>(event: T, handler: MenuEvents[T]) => void;
|
|
31
31
|
};
|
|
32
32
|
lifecycle: {
|
|
33
33
|
destroy: () => void;
|
|
@@ -40,9 +40,9 @@ interface ApiOptions {
|
|
|
40
40
|
*/
|
|
41
41
|
interface ComponentWithElements {
|
|
42
42
|
element: HTMLElement;
|
|
43
|
-
on?: <T extends
|
|
44
|
-
off?: <T extends
|
|
45
|
-
emit?: (event: string, data:
|
|
43
|
+
on?: <T extends keyof MenuEvents>(event: T, handler: MenuEvents[T]) => void;
|
|
44
|
+
off?: <T extends keyof MenuEvents>(event: T, handler: MenuEvents[T]) => void;
|
|
45
|
+
emit?: (event: string, data: unknown) => void;
|
|
46
46
|
}
|
|
47
47
|
/**
|
|
48
48
|
* Enhances a menu component with API methods.
|
|
@@ -54,5 +54,5 @@ interface ComponentWithElements {
|
|
|
54
54
|
* @category Components
|
|
55
55
|
* @internal This is an internal utility for the Menu component
|
|
56
56
|
*/
|
|
57
|
-
declare const withAPI: ({ menu, opener, events, lifecycle
|
|
57
|
+
declare const withAPI: ({ menu, opener, events, lifecycle }: ApiOptions) => (component: ComponentWithElements) => MenuComponent;
|
|
58
58
|
export { withAPI };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MenuItem } from
|
|
1
|
+
import { MenuItem } from "../types";
|
|
2
2
|
/**
|
|
3
3
|
* Keyboard navigation handler for menus
|
|
4
4
|
* Manages focus management and keyboard interactions for accessibility
|
|
@@ -22,5 +22,5 @@ export declare const createKeyboardNavigation: (component: any) => {
|
|
|
22
22
|
* @param config - Menu configuration
|
|
23
23
|
* @returns Component enhancer with keyboard navigation functionality
|
|
24
24
|
*/
|
|
25
|
-
declare const withKeyboard: (
|
|
25
|
+
declare const withKeyboard: () => (component: any) => any;
|
|
26
26
|
export default withKeyboard;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { NavigationSystemConfig, NavigationSystem } from
|
|
1
|
+
import { NavigationSystemConfig, NavigationSystem } from "./types";
|
|
2
2
|
/**
|
|
3
3
|
* Creates a complete navigation system with synchronized rail and drawer components
|
|
4
4
|
*
|
|
@@ -7,4 +7,4 @@ import { NavigationSystemConfig, NavigationSystem } from './types';
|
|
|
7
7
|
*/
|
|
8
8
|
export declare const createNavigationSystem: (options?: NavigationSystemConfig) => NavigationSystem;
|
|
9
9
|
export default createNavigationSystem;
|
|
10
|
-
export * from
|
|
10
|
+
export * from "./types";
|
|
@@ -1,4 +1,35 @@
|
|
|
1
|
-
import { ProgressComponent, ProgressThickness, ProgressShape } from
|
|
1
|
+
import { ProgressComponent, ProgressThickness, ProgressShape } from "./types";
|
|
2
|
+
/**
|
|
3
|
+
* Canvas component interface for API
|
|
4
|
+
*/
|
|
5
|
+
interface CanvasComponent {
|
|
6
|
+
element: HTMLElement;
|
|
7
|
+
canvas: HTMLCanvasElement;
|
|
8
|
+
getClass: (name: string) => string;
|
|
9
|
+
label?: HTMLElement;
|
|
10
|
+
state?: {
|
|
11
|
+
label?: HTMLElement;
|
|
12
|
+
showLabel?: boolean;
|
|
13
|
+
value?: number;
|
|
14
|
+
max?: number;
|
|
15
|
+
buffer?: number;
|
|
16
|
+
indeterminate?: boolean;
|
|
17
|
+
thickness?: number | string;
|
|
18
|
+
shape?: ProgressShape;
|
|
19
|
+
labelFormatter?: (value: number, max: number) => string;
|
|
20
|
+
};
|
|
21
|
+
draw?: () => void;
|
|
22
|
+
setThickness?: (thickness: ProgressThickness) => void;
|
|
23
|
+
setShape?: (shape: ProgressShape) => void;
|
|
24
|
+
setValue?: (value: number, animate: boolean) => void;
|
|
25
|
+
setSize?: (size: number) => void;
|
|
26
|
+
getSize?: () => number | undefined;
|
|
27
|
+
hide?: () => void;
|
|
28
|
+
show?: () => void;
|
|
29
|
+
isVisible?: () => boolean;
|
|
30
|
+
startIndeterminateAnimation?: () => void;
|
|
31
|
+
stopIndeterminateAnimation?: () => void;
|
|
32
|
+
}
|
|
2
33
|
/**
|
|
3
34
|
* API configuration options for canvas-based progress component
|
|
4
35
|
*/
|
|
@@ -42,5 +73,5 @@ interface ApiOptions {
|
|
|
42
73
|
/**
|
|
43
74
|
* Enhances a canvas-based progress component with a streamlined API
|
|
44
75
|
*/
|
|
45
|
-
export declare const withAPI: (options: ApiOptions) => (comp:
|
|
76
|
+
export declare const withAPI: (options: ApiOptions) => (comp: CanvasComponent) => ProgressComponent;
|
|
46
77
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ProgressConfig, ProgressThickness, ProgressShape } from
|
|
1
|
+
import { ProgressConfig, ProgressThickness, ProgressShape } from "./types";
|
|
2
2
|
/**
|
|
3
3
|
* Default configuration for the Progress component
|
|
4
4
|
*/
|
|
@@ -32,7 +32,7 @@ export declare const getElementConfig: (config: ProgressConfig) => {
|
|
|
32
32
|
/**
|
|
33
33
|
* Creates API configuration for the Progress component
|
|
34
34
|
*/
|
|
35
|
-
export declare const getApiConfig: (comp: any
|
|
35
|
+
export declare const getApiConfig: (comp: any) => {
|
|
36
36
|
value: {
|
|
37
37
|
getValue: () => any;
|
|
38
38
|
setValue: (value: number) => void;
|
|
@@ -11,8 +11,8 @@ export declare const PROGRESS_VARIANTS: {
|
|
|
11
11
|
* Progress component shapes (linear only)
|
|
12
12
|
*/
|
|
13
13
|
export declare const PROGRESS_SHAPES: {
|
|
14
|
-
/** Standard
|
|
15
|
-
readonly
|
|
14
|
+
/** Standard flat progress */
|
|
15
|
+
readonly FLAT: "flat";
|
|
16
16
|
/** Wavy animated progress */
|
|
17
17
|
readonly WAVY: "wavy";
|
|
18
18
|
};
|
|
@@ -38,7 +38,7 @@ export declare const PROGRESS_DEFAULTS: {
|
|
|
38
38
|
/** Buffer value for linear progress with buffer */
|
|
39
39
|
readonly BUFFER: 0;
|
|
40
40
|
/** Default shape for linear indeterminate progress */
|
|
41
|
-
readonly SHAPE: "
|
|
41
|
+
readonly SHAPE: "flat";
|
|
42
42
|
/** Whether to show percentage label */
|
|
43
43
|
readonly SHOW_LABEL: false;
|
|
44
44
|
/** Whether progress is indeterminate */
|
|
@@ -106,34 +106,38 @@ export declare const PROGRESS_WAVE: {
|
|
|
106
106
|
readonly LINEAR: {
|
|
107
107
|
/** Base amplitude of the wave in pixels */
|
|
108
108
|
readonly AMPLITUDE: 3;
|
|
109
|
-
/** Speed of
|
|
110
|
-
readonly SPEED: 0.
|
|
111
|
-
/**
|
|
112
|
-
readonly FREQUENCY:
|
|
113
|
-
/**
|
|
114
|
-
readonly INDETERMINATE_FREQUENCY:
|
|
109
|
+
/** Speed of wave animation in waves per second (Hz) */
|
|
110
|
+
readonly SPEED: 0.88;
|
|
111
|
+
/** Number of complete waves per 100 pixels */
|
|
112
|
+
readonly FREQUENCY: 2;
|
|
113
|
+
/** Number of complete waves per 100 pixels for indeterminate */
|
|
114
|
+
readonly INDETERMINATE_FREQUENCY: 4;
|
|
115
115
|
/** Amplitude for indeterminate animation */
|
|
116
116
|
readonly INDETERMINATE_AMPLITUDE: 2;
|
|
117
117
|
/** Wave shape power (lower = rounder peaks, higher = sharper) */
|
|
118
118
|
readonly POWER: 0.8;
|
|
119
|
+
/** Percentage at which wave amplitude reaches full strength from start */
|
|
120
|
+
readonly START_TRANSITION_END: 0;
|
|
121
|
+
/** Percentage at which wave amplitude begins to decrease near end */
|
|
122
|
+
readonly END_TRANSITION_START: 0.92;
|
|
119
123
|
};
|
|
120
124
|
/** Circular progress wave parameters */
|
|
121
125
|
readonly CIRCULAR: {
|
|
122
|
-
/** Amplitude as percentage of
|
|
123
|
-
readonly
|
|
124
|
-
/**
|
|
125
|
-
readonly
|
|
126
|
-
/** Speed of
|
|
127
|
-
readonly SPEED:
|
|
126
|
+
/** Amplitude as percentage of radius (7 = 7%) */
|
|
127
|
+
readonly AMPLITUDE: 6;
|
|
128
|
+
/** Amplitude as percentage of radius for indeterminate (4 = 4%) */
|
|
129
|
+
readonly INDETERMINATE_AMPLITUDE: 4;
|
|
130
|
+
/** Speed of wave rotation in rotations per second (Hz), negative value means clockwise */
|
|
131
|
+
readonly SPEED: 1.1;
|
|
128
132
|
/** Number of complete waves around the circle */
|
|
129
|
-
readonly FREQUENCY:
|
|
133
|
+
readonly FREQUENCY: 10;
|
|
130
134
|
/** Number of complete waves for indeterminate animation */
|
|
131
|
-
readonly INDETERMINATE_FREQUENCY:
|
|
132
|
-
/** Amplitude ratio for indeterminate animation */
|
|
133
|
-
readonly INDETERMINATE_AMPLITUDE_RATIO: 0.7;
|
|
134
|
-
/** Maximum amplitude for indeterminate animation */
|
|
135
|
-
readonly INDETERMINATE_AMPLITUDE_MAX: 3;
|
|
135
|
+
readonly INDETERMINATE_FREQUENCY: 16;
|
|
136
136
|
/** Wave shape power (lower = rounder peaks, higher = sharper) */
|
|
137
137
|
readonly POWER: 0.8;
|
|
138
|
+
/** Percentage at which wave amplitude reaches full strength from start */
|
|
139
|
+
readonly START_TRANSITION_END: 0;
|
|
140
|
+
/** Percentage at which wave amplitude begins to decrease near end */
|
|
141
|
+
readonly END_TRANSITION_START: 0.92;
|
|
138
142
|
};
|
|
139
143
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ProgressConfig } from
|
|
1
|
+
import { ProgressConfig, ProgressThickness } from "../types";
|
|
2
2
|
/**
|
|
3
3
|
* Canvas dimensions and drawing context
|
|
4
4
|
*/
|
|
@@ -19,14 +19,43 @@ interface CanvasComponent {
|
|
|
19
19
|
getClass: (name: string) => string;
|
|
20
20
|
draw: () => void;
|
|
21
21
|
resize: () => void;
|
|
22
|
-
[key: string]:
|
|
22
|
+
[key: string]: unknown;
|
|
23
23
|
}
|
|
24
24
|
/**
|
|
25
|
-
*
|
|
25
|
+
* Base component interface for withCanvas
|
|
26
26
|
*/
|
|
27
|
-
|
|
27
|
+
interface BaseComponent {
|
|
28
|
+
element: HTMLElement;
|
|
29
|
+
getClass: (name: string) => string;
|
|
30
|
+
lifecycle?: {
|
|
31
|
+
init?: () => void;
|
|
32
|
+
destroy?: () => void;
|
|
33
|
+
};
|
|
34
|
+
state?: {
|
|
35
|
+
value?: number;
|
|
36
|
+
max?: number;
|
|
37
|
+
buffer?: number;
|
|
38
|
+
indeterminate?: boolean;
|
|
39
|
+
[key: string]: unknown;
|
|
40
|
+
};
|
|
41
|
+
animationId?: number | null;
|
|
42
|
+
wavyAnimationId?: number | null;
|
|
43
|
+
valueAnimationId?: number | null;
|
|
44
|
+
animationTime?: number;
|
|
45
|
+
setIndeterminate?: (indeterminate: boolean) => void;
|
|
46
|
+
[key: string]: unknown;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Gets the stroke width for a given thickness preset or custom value
|
|
50
|
+
*/
|
|
51
|
+
export declare const getStrokeWidth: (thickness?: ProgressThickness) => number;
|
|
52
|
+
/**
|
|
53
|
+
* Calculates wave amplitude based on stroke width
|
|
54
|
+
* Uses thickness 4 as the baseline (where amplitude is perfect)
|
|
55
|
+
*/
|
|
56
|
+
export declare const getWaveAmplitude: (strokeWidth: number, baseAmplitude: number, maxAmplitude?: number) => number;
|
|
28
57
|
/**
|
|
29
58
|
* Adds canvas functionality to replace complex DOM structure
|
|
30
59
|
*/
|
|
31
|
-
export declare const withCanvas: (config: ProgressConfig) => (component:
|
|
60
|
+
export declare const withCanvas: (config: ProgressConfig) => (component: BaseComponent) => CanvasComponent;
|
|
32
61
|
export {};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Circular progress drawing functionality
|
|
3
3
|
*/
|
|
4
|
-
import { ProgressConfig, ProgressShape } from
|
|
5
|
-
import { CanvasContext } from
|
|
4
|
+
import { ProgressConfig, ProgressShape } from "../types";
|
|
5
|
+
import { CanvasContext } from "./canvas";
|
|
6
6
|
/**
|
|
7
7
|
* Draws circular progress on canvas
|
|
8
8
|
*/
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Linear progress drawing functionality
|
|
3
3
|
*/
|
|
4
|
-
import { ProgressConfig, ProgressShape } from
|
|
5
|
-
import { CanvasContext } from
|
|
4
|
+
import { ProgressConfig, ProgressShape } from "../types";
|
|
5
|
+
import { CanvasContext } from "./canvas";
|
|
6
6
|
/**
|
|
7
7
|
* Draws linear progress on canvas with shape support
|
|
8
8
|
*/
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ProgressConfig, ProgressShape } from
|
|
1
|
+
import { ProgressConfig, ProgressShape } from "../types";
|
|
2
2
|
/**
|
|
3
3
|
* Progress component state
|
|
4
4
|
*/
|
|
@@ -11,6 +11,7 @@ interface ProgressState {
|
|
|
11
11
|
shape: ProgressShape;
|
|
12
12
|
labelFormatter: (value: number, max: number) => string;
|
|
13
13
|
label?: HTMLElement;
|
|
14
|
+
showLabel?: boolean;
|
|
14
15
|
}
|
|
15
16
|
/**
|
|
16
17
|
* Component with lifecycle methods and canvas drawing
|
|
@@ -24,6 +25,13 @@ interface ComponentWithLifecycle {
|
|
|
24
25
|
destroy?: () => void;
|
|
25
26
|
};
|
|
26
27
|
getClass?: (name: string) => string;
|
|
28
|
+
setIndeterminate?: (indeterminate: boolean) => unknown;
|
|
29
|
+
setValue?: (value: number) => unknown;
|
|
30
|
+
setBuffer?: (buffer: number) => unknown;
|
|
31
|
+
setShape?: (shape: ProgressShape) => unknown;
|
|
32
|
+
showLabel?: () => unknown;
|
|
33
|
+
setThickness?: (thickness: number | string) => unknown;
|
|
34
|
+
state?: ProgressState;
|
|
27
35
|
[key: string]: any;
|
|
28
36
|
}
|
|
29
37
|
/**
|
|
@@ -2,22 +2,22 @@
|
|
|
2
2
|
* Progress variant types
|
|
3
3
|
* @category Components
|
|
4
4
|
*/
|
|
5
|
-
export type ProgressVariant =
|
|
5
|
+
export type ProgressVariant = "linear" | "circular";
|
|
6
6
|
/**
|
|
7
7
|
* Progress thickness options
|
|
8
8
|
* @category Components
|
|
9
9
|
*/
|
|
10
|
-
export type ProgressThickness =
|
|
10
|
+
export type ProgressThickness = "thin" | "thick" | number;
|
|
11
11
|
/**
|
|
12
12
|
* Progress shape options (linear only)
|
|
13
13
|
* @category Components
|
|
14
14
|
*/
|
|
15
|
-
export type ProgressShape =
|
|
15
|
+
export type ProgressShape = "flat" | "wavy";
|
|
16
16
|
/**
|
|
17
17
|
* Progress component event types
|
|
18
18
|
* @category Components
|
|
19
19
|
*/
|
|
20
|
-
export type ProgressEvent =
|
|
20
|
+
export type ProgressEvent = "change" | "complete";
|
|
21
21
|
/**
|
|
22
22
|
* Configuration interface for the Progress component
|
|
23
23
|
* @category Components
|
|
@@ -61,7 +61,7 @@ export interface ProgressConfig {
|
|
|
61
61
|
/**
|
|
62
62
|
* Shape of the linear indeterminate progress animation
|
|
63
63
|
* Only affects linear variant in indeterminate state
|
|
64
|
-
* @default '
|
|
64
|
+
* @default 'flat'
|
|
65
65
|
*/
|
|
66
66
|
shape?: ProgressShape;
|
|
67
67
|
/**
|
|
@@ -207,7 +207,7 @@ export interface ProgressComponent {
|
|
|
207
207
|
/**
|
|
208
208
|
* Sets the shape of the linear indeterminate progress animation
|
|
209
209
|
* Only affects linear variant in indeterminate state
|
|
210
|
-
* @param shape - Shape value ('
|
|
210
|
+
* @param shape - Shape value ('flat' or 'wavy')
|
|
211
211
|
* @returns The progress component for chaining
|
|
212
212
|
*/
|
|
213
213
|
setShape: (shape: ProgressShape) => ProgressComponent;
|
|
@@ -227,6 +227,18 @@ export interface ProgressComponent {
|
|
|
227
227
|
* @returns Whether the component is indeterminate
|
|
228
228
|
*/
|
|
229
229
|
isIndeterminate: () => boolean;
|
|
230
|
+
/**
|
|
231
|
+
* Sets the size of the circular progress indicator
|
|
232
|
+
* Only applies to circular variant
|
|
233
|
+
* @param size - Size in pixels (clamped between 24 and 240)
|
|
234
|
+
* @returns The progress component for chaining
|
|
235
|
+
*/
|
|
236
|
+
setSize: (size: number) => ProgressComponent;
|
|
237
|
+
/**
|
|
238
|
+
* Gets the current size of the circular progress indicator
|
|
239
|
+
* @returns Current size in pixels, or undefined for linear variant
|
|
240
|
+
*/
|
|
241
|
+
getSize: () => number | undefined;
|
|
230
242
|
/**
|
|
231
243
|
* Adds an event listener to the progress
|
|
232
244
|
* @param event - Event name ('change', 'complete')
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { RadiosComponent } from
|
|
1
|
+
import { RadiosComponent, RadioItem, RadioOptionConfig } from "./types";
|
|
2
2
|
interface ApiOptions {
|
|
3
3
|
disabled: {
|
|
4
4
|
enable: () => void;
|
|
@@ -10,21 +10,21 @@ interface ApiOptions {
|
|
|
10
10
|
}
|
|
11
11
|
interface ComponentWithRadio {
|
|
12
12
|
element: HTMLElement;
|
|
13
|
-
radios:
|
|
13
|
+
radios: RadioItem[];
|
|
14
14
|
getValue: () => string;
|
|
15
|
-
setValue: (value: string) =>
|
|
16
|
-
getSelected: () =>
|
|
17
|
-
addOption: (option:
|
|
18
|
-
removeOption: (value: string) =>
|
|
19
|
-
enable: () =>
|
|
20
|
-
disable: () =>
|
|
21
|
-
enableOption: (value: string) =>
|
|
22
|
-
disableOption: (value: string) =>
|
|
15
|
+
setValue: (value: string) => void;
|
|
16
|
+
getSelected: () => RadioOptionConfig | null;
|
|
17
|
+
addOption: (option: RadioOptionConfig) => void;
|
|
18
|
+
removeOption: (value: string) => void;
|
|
19
|
+
enable: () => void;
|
|
20
|
+
disable: () => void;
|
|
21
|
+
enableOption: (value: string) => void;
|
|
22
|
+
disableOption: (value: string) => void;
|
|
23
23
|
getClass: (name: string) => string;
|
|
24
24
|
events: {
|
|
25
25
|
on: (event: string, handler: Function) => void;
|
|
26
26
|
off: (event: string, handler: Function) => void;
|
|
27
|
-
emit?: (event: string, data:
|
|
27
|
+
emit?: (event: string, data: unknown) => void;
|
|
28
28
|
};
|
|
29
29
|
}
|
|
30
30
|
/**
|