mtrl 0.3.9 → 0.4.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/dist/components/badge/config.d.ts +1 -1
- package/dist/components/button/config.d.ts +1 -1
- package/dist/components/card/config.d.ts +1 -1
- package/dist/components/carousel/config.d.ts +1 -1
- package/dist/components/checkbox/config.d.ts +1 -1
- package/dist/components/chips/chip/config.d.ts +1 -1
- package/dist/components/chips/config.d.ts +1 -1
- package/dist/components/chips/schema.d.ts +1 -1
- package/dist/components/datepicker/config.d.ts +3 -3
- package/dist/components/dialog/config.d.ts +2 -2
- package/dist/components/dialog/types.d.ts +1 -1
- package/dist/components/extended-fab/config.d.ts +1 -1
- package/dist/components/fab/config.d.ts +1 -1
- package/dist/components/list/config.d.ts +1 -1
- package/dist/components/menu/config.d.ts +1 -1
- package/dist/components/navigation/config.d.ts +1 -1
- package/dist/components/progress/api.d.ts +18 -18
- package/dist/components/progress/config.d.ts +19 -10
- package/dist/components/progress/constants.d.ts +82 -1
- package/dist/components/progress/features/canvas.d.ts +32 -0
- package/dist/components/progress/features/circular.d.ts +9 -0
- package/dist/components/progress/features/index.d.ts +8 -0
- package/dist/components/progress/features/linear.d.ts +9 -0
- package/dist/components/progress/features/resize-observer.d.ts +5 -0
- package/dist/components/progress/features/state.d.ts +38 -0
- package/dist/components/progress/features.d.ts +40 -0
- package/dist/components/progress/index.d.ts +2 -2
- package/dist/components/progress/progress.d.ts +1 -1
- package/dist/components/progress/types.d.ts +88 -15
- package/dist/components/radios/config.d.ts +1 -1
- package/dist/components/search/config.d.ts +1 -1
- package/dist/components/segmented-button/config.d.ts +2 -2
- package/dist/components/sheet/config.d.ts +1 -1
- package/dist/components/slider/config.d.ts +1 -1
- package/dist/components/slider/schema.d.ts +3 -3
- package/dist/components/snackbar/config.d.ts +1 -1
- package/dist/components/switch/config.d.ts +1 -1
- package/dist/components/textfield/config.d.ts +1 -1
- package/dist/components/timepicker/config.d.ts +3 -3
- package/dist/components/tooltip/config.d.ts +1 -1
- package/dist/core/canvas/index.d.ts +5 -0
- package/dist/core/canvas/resize.d.ts +14 -0
- package/dist/core/compose/component.d.ts +1 -1
- package/dist/core/config/component.d.ts +2 -2
- package/dist/core/dom/attributes.d.ts +13 -15
- package/dist/core/dom/classes.d.ts +10 -0
- package/dist/core/dom/create.d.ts +36 -6
- package/dist/core/dom/index.d.ts +2 -2
- package/dist/core/index.d.ts +1 -1
- package/dist/core/layout/object.d.ts +1 -1
- package/dist/core/utils/index.d.ts +1 -6
- package/dist/core/utils/theme.d.ts +38 -0
- package/dist/index.cjs +15 -15
- package/dist/index.cjs.map +64 -58
- package/dist/index.js +15 -15
- package/dist/index.js.map +64 -58
- package/dist/package.json +1 -1
- package/dist/styles.css +2 -2
- package/package.json +1 -1
|
@@ -29,7 +29,7 @@ export declare const createBaseConfig: (config?: BadgeConfig) => BadgeConfig;
|
|
|
29
29
|
export declare const getElementConfig: (config: BadgeConfig) => {
|
|
30
30
|
tag: string;
|
|
31
31
|
componentName: string;
|
|
32
|
-
|
|
32
|
+
attributes: Record<string, any>;
|
|
33
33
|
className: string[];
|
|
34
34
|
rawClass: string | string[];
|
|
35
35
|
html: string;
|
|
@@ -29,7 +29,7 @@ export declare const createBaseConfig: (config?: ButtonConfig) => ButtonConfig;
|
|
|
29
29
|
export declare const getElementConfig: (config: ButtonConfig) => {
|
|
30
30
|
tag: string;
|
|
31
31
|
componentName: string;
|
|
32
|
-
|
|
32
|
+
attributes: Record<string, any>;
|
|
33
33
|
className: string[];
|
|
34
34
|
rawClass: string | string[];
|
|
35
35
|
html: string;
|
|
@@ -56,7 +56,7 @@ export declare const createBaseConfig: (config?: CardSchema) => CardSchema;
|
|
|
56
56
|
export declare const getElementConfig: (config: CardSchema) => {
|
|
57
57
|
tag: string;
|
|
58
58
|
componentName: string;
|
|
59
|
-
|
|
59
|
+
attributes: Record<string, any>;
|
|
60
60
|
className: string[];
|
|
61
61
|
rawClass: string | string[];
|
|
62
62
|
html: string;
|
|
@@ -17,7 +17,7 @@ export declare const createBaseConfig: (config?: CarouselConfig) => CarouselConf
|
|
|
17
17
|
export declare const getElementConfig: (config: CarouselConfig) => {
|
|
18
18
|
tag: string;
|
|
19
19
|
componentName: string;
|
|
20
|
-
|
|
20
|
+
attributes: Record<string, any>;
|
|
21
21
|
className: string[];
|
|
22
22
|
rawClass: string | string[];
|
|
23
23
|
html: string;
|
|
@@ -17,7 +17,7 @@ export declare const createBaseConfig: (config?: CheckboxConfig) => CheckboxConf
|
|
|
17
17
|
export declare const getElementConfig: (config: CheckboxConfig) => {
|
|
18
18
|
tag: string;
|
|
19
19
|
componentName: string;
|
|
20
|
-
|
|
20
|
+
attributes: Record<string, any>;
|
|
21
21
|
className: string[];
|
|
22
22
|
rawClass: string | string[];
|
|
23
23
|
html: string;
|
|
@@ -32,7 +32,7 @@ export declare const createBaseConfig: (config?: ChipConfig) => ChipConfig;
|
|
|
32
32
|
export declare const getElementConfig: (config: ChipConfig) => {
|
|
33
33
|
tag: string;
|
|
34
34
|
componentName: string;
|
|
35
|
-
|
|
35
|
+
attributes: Record<string, any>;
|
|
36
36
|
className: string[];
|
|
37
37
|
rawClass: string | string[];
|
|
38
38
|
html: string;
|
|
@@ -17,7 +17,7 @@ export declare const createBaseConfig: (config?: ChipsConfig) => ChipsConfig;
|
|
|
17
17
|
export declare const getElementConfig: (config: ChipsConfig) => {
|
|
18
18
|
tag: string;
|
|
19
19
|
componentName: string;
|
|
20
|
-
|
|
20
|
+
attributes: Record<string, any>;
|
|
21
21
|
className: string[];
|
|
22
22
|
rawClass: string | string[];
|
|
23
23
|
html: string;
|
|
@@ -17,7 +17,7 @@ export declare const createBaseConfig: (config?: DatePickerConfig) => DatePicker
|
|
|
17
17
|
export declare const getContainerConfig: (config: DatePickerConfig) => {
|
|
18
18
|
tag: string;
|
|
19
19
|
componentName: string;
|
|
20
|
-
|
|
20
|
+
attributes: Record<string, any>;
|
|
21
21
|
className: string[];
|
|
22
22
|
rawClass: string | string[];
|
|
23
23
|
html: string;
|
|
@@ -33,7 +33,7 @@ export declare const getContainerConfig: (config: DatePickerConfig) => {
|
|
|
33
33
|
export declare const getInputConfig: (config: DatePickerConfig) => {
|
|
34
34
|
tag: string;
|
|
35
35
|
componentName: string;
|
|
36
|
-
|
|
36
|
+
attributes: Record<string, any>;
|
|
37
37
|
className: string[];
|
|
38
38
|
rawClass: string | string[];
|
|
39
39
|
html: string;
|
|
@@ -49,7 +49,7 @@ export declare const getInputConfig: (config: DatePickerConfig) => {
|
|
|
49
49
|
export declare const getCalendarConfig: (config: DatePickerConfig) => {
|
|
50
50
|
tag: string;
|
|
51
51
|
componentName: string;
|
|
52
|
-
|
|
52
|
+
attributes: Record<string, any>;
|
|
53
53
|
className: string[];
|
|
54
54
|
rawClass: string | string[];
|
|
55
55
|
html: string;
|
|
@@ -17,7 +17,7 @@ export declare const createBaseConfig: (config?: DialogConfig) => DialogConfig;
|
|
|
17
17
|
export declare const getElementConfig: (config: DialogConfig) => {
|
|
18
18
|
tag: string;
|
|
19
19
|
componentName: string;
|
|
20
|
-
|
|
20
|
+
attributes: Record<string, any>;
|
|
21
21
|
className: string[];
|
|
22
22
|
rawClass: string | string[];
|
|
23
23
|
html: string;
|
|
@@ -32,7 +32,7 @@ export declare const getElementConfig: (config: DialogConfig) => {
|
|
|
32
32
|
*/
|
|
33
33
|
export declare const getOverlayConfig: (config: DialogConfig) => {
|
|
34
34
|
tag: string;
|
|
35
|
-
|
|
35
|
+
attributes: {
|
|
36
36
|
'aria-modal': boolean;
|
|
37
37
|
role: string;
|
|
38
38
|
tabindex: number;
|
|
@@ -223,7 +223,7 @@ export interface DialogButton {
|
|
|
223
223
|
* Additional button attributes to pass to the button element
|
|
224
224
|
* @example { 'data-id': 'save-button', 'form': 'profile-form' }
|
|
225
225
|
*/
|
|
226
|
-
|
|
226
|
+
attributes?: Record<string, any>;
|
|
227
227
|
}
|
|
228
228
|
/**
|
|
229
229
|
* Dialog event object
|
|
@@ -38,7 +38,7 @@ export declare const createBaseConfig: (config?: ExtendedFabConfig) => ExtendedF
|
|
|
38
38
|
export declare const getElementConfig: (config: ExtendedFabConfig) => {
|
|
39
39
|
tag: string;
|
|
40
40
|
componentName: string;
|
|
41
|
-
|
|
41
|
+
attributes: Record<string, any>;
|
|
42
42
|
className: string[];
|
|
43
43
|
rawClass: string | string[];
|
|
44
44
|
html: string;
|
|
@@ -38,7 +38,7 @@ export declare const createBaseConfig: (config?: FabConfig) => FabConfig;
|
|
|
38
38
|
export declare const getElementConfig: (config: FabConfig) => {
|
|
39
39
|
tag: string;
|
|
40
40
|
componentName: string;
|
|
41
|
-
|
|
41
|
+
attributes: Record<string, any>;
|
|
42
42
|
className: string[];
|
|
43
43
|
rawClass: string | string[];
|
|
44
44
|
html: string;
|
|
@@ -27,7 +27,7 @@ export declare const createBaseConfig: (config?: Partial<ListConfig>) => import(
|
|
|
27
27
|
export declare const getElementConfig: (config: any) => {
|
|
28
28
|
tag: string;
|
|
29
29
|
componentName: string;
|
|
30
|
-
|
|
30
|
+
attributes: Record<string, any>;
|
|
31
31
|
className: string[];
|
|
32
32
|
rawClass: string | string[];
|
|
33
33
|
html: string;
|
|
@@ -29,7 +29,7 @@ export declare const createBaseConfig: (config: MenuConfig) => MenuConfig;
|
|
|
29
29
|
export declare const getElementConfig: (config: MenuConfig) => {
|
|
30
30
|
tag: string;
|
|
31
31
|
componentName: string;
|
|
32
|
-
|
|
32
|
+
attributes: Record<string, any>;
|
|
33
33
|
className: string[];
|
|
34
34
|
rawClass: string | string[];
|
|
35
35
|
html: string;
|
|
@@ -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
|
-
|
|
20
|
+
attributes: Record<string, any>;
|
|
21
21
|
className: string[];
|
|
22
22
|
rawClass: string | string[];
|
|
23
23
|
html: string;
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import { ProgressComponent } from './types';
|
|
1
|
+
import { ProgressComponent, ProgressThickness, ProgressShape } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* API configuration options for canvas-based progress component
|
|
4
|
+
*/
|
|
2
5
|
interface ApiOptions {
|
|
3
6
|
value: {
|
|
4
7
|
getValue: () => number;
|
|
@@ -15,10 +18,18 @@ interface ApiOptions {
|
|
|
15
18
|
isDisabled: () => boolean;
|
|
16
19
|
};
|
|
17
20
|
label: {
|
|
18
|
-
show
|
|
19
|
-
hide
|
|
20
|
-
format
|
|
21
|
-
|
|
21
|
+
show?: () => void;
|
|
22
|
+
hide?: () => void;
|
|
23
|
+
format?: (formatter: (value: number, max: number) => string) => void;
|
|
24
|
+
formatter?: (value: number, max: number) => string;
|
|
25
|
+
};
|
|
26
|
+
thickness?: {
|
|
27
|
+
getThickness: () => number;
|
|
28
|
+
setThickness: (thickness: ProgressThickness) => void;
|
|
29
|
+
};
|
|
30
|
+
shape?: {
|
|
31
|
+
getShape: () => ProgressShape;
|
|
32
|
+
setShape: (shape: ProgressShape) => void;
|
|
22
33
|
};
|
|
23
34
|
state: {
|
|
24
35
|
setIndeterminate: (indeterminate: boolean) => void;
|
|
@@ -28,19 +39,8 @@ interface ApiOptions {
|
|
|
28
39
|
destroy: () => void;
|
|
29
40
|
};
|
|
30
41
|
}
|
|
31
|
-
interface ComponentWithElements {
|
|
32
|
-
element: HTMLElement;
|
|
33
|
-
trackElement: HTMLElement;
|
|
34
|
-
indicatorElement: HTMLElement;
|
|
35
|
-
labelElement?: HTMLElement;
|
|
36
|
-
getClass: (name: string) => string;
|
|
37
|
-
emit: (event: string, data?: any) => void;
|
|
38
|
-
}
|
|
39
42
|
/**
|
|
40
|
-
* Enhances a progress component with API
|
|
41
|
-
* @param {ApiOptions} options - API configuration options
|
|
42
|
-
* @returns {Function} Higher-order function that adds API methods to component
|
|
43
|
-
* @internal This is an internal utility for the Progress component
|
|
43
|
+
* Enhances a canvas-based progress component with a streamlined API
|
|
44
44
|
*/
|
|
45
|
-
export declare const withAPI: (options: ApiOptions) => (
|
|
45
|
+
export declare const withAPI: (options: ApiOptions) => (comp: any) => ProgressComponent;
|
|
46
46
|
export {};
|
|
@@ -1,23 +1,27 @@
|
|
|
1
|
-
import { ProgressConfig } from './types';
|
|
1
|
+
import { ProgressConfig, ProgressThickness, ProgressShape } from './types';
|
|
2
2
|
/**
|
|
3
3
|
* Default configuration for the Progress component
|
|
4
4
|
*/
|
|
5
5
|
export declare const defaultConfig: ProgressConfig;
|
|
6
6
|
/**
|
|
7
|
-
* Creates the base configuration for Progress component
|
|
8
|
-
*
|
|
9
|
-
*
|
|
7
|
+
* Creates the base configuration for the Progress component
|
|
8
|
+
* with all defaults applied (no complex schema needed for canvas)
|
|
9
|
+
*
|
|
10
|
+
* @param config User-provided configuration
|
|
11
|
+
* @returns Complete configuration with defaults
|
|
10
12
|
*/
|
|
11
13
|
export declare const createBaseConfig: (config?: ProgressConfig) => ProgressConfig;
|
|
12
14
|
/**
|
|
13
|
-
* Generates element configuration for the Progress
|
|
15
|
+
* Generates element configuration for the Progress container
|
|
16
|
+
* Canvas will be added by withCanvas feature
|
|
17
|
+
*
|
|
14
18
|
* @param {ProgressConfig} config - Progress configuration
|
|
15
19
|
* @returns {Object} Element configuration object for withElement
|
|
16
20
|
*/
|
|
17
21
|
export declare const getElementConfig: (config: ProgressConfig) => {
|
|
18
22
|
tag: string;
|
|
19
23
|
componentName: string;
|
|
20
|
-
|
|
24
|
+
attributes: Record<string, any>;
|
|
21
25
|
className: string[];
|
|
22
26
|
rawClass: string | string[];
|
|
23
27
|
html: string;
|
|
@@ -27,9 +31,6 @@ export declare const getElementConfig: (config: ProgressConfig) => {
|
|
|
27
31
|
};
|
|
28
32
|
/**
|
|
29
33
|
* Creates API configuration for the Progress component
|
|
30
|
-
* @param {Object} comp - Component with state management features
|
|
31
|
-
* @param {Object} state - State object containing component state
|
|
32
|
-
* @returns {Object} API configuration object
|
|
33
34
|
*/
|
|
34
35
|
export declare const getApiConfig: (comp: any, state: any) => {
|
|
35
36
|
value: {
|
|
@@ -50,7 +51,15 @@ export declare const getApiConfig: (comp: any, state: any) => {
|
|
|
50
51
|
show: () => void;
|
|
51
52
|
hide: () => void;
|
|
52
53
|
format: (formatter: any) => void;
|
|
53
|
-
|
|
54
|
+
formatter: any;
|
|
55
|
+
};
|
|
56
|
+
thickness: {
|
|
57
|
+
getThickness: () => number;
|
|
58
|
+
setThickness: (thickness: ProgressThickness) => void;
|
|
59
|
+
};
|
|
60
|
+
shape: {
|
|
61
|
+
getShape: () => any;
|
|
62
|
+
setShape: (shape: ProgressShape) => void;
|
|
54
63
|
};
|
|
55
64
|
state: {
|
|
56
65
|
setIndeterminate: (indeterminate: boolean) => void;
|
|
@@ -7,6 +7,15 @@ export declare const PROGRESS_VARIANTS: {
|
|
|
7
7
|
/** Circular spinner progress indicator */
|
|
8
8
|
readonly CIRCULAR: "circular";
|
|
9
9
|
};
|
|
10
|
+
/**
|
|
11
|
+
* Progress component shapes (linear only)
|
|
12
|
+
*/
|
|
13
|
+
export declare const PROGRESS_SHAPES: {
|
|
14
|
+
/** Standard straight line progress */
|
|
15
|
+
readonly LINE: "line";
|
|
16
|
+
/** Wavy animated progress */
|
|
17
|
+
readonly WAVY: "wavy";
|
|
18
|
+
};
|
|
10
19
|
/**
|
|
11
20
|
* Progress component events
|
|
12
21
|
*/
|
|
@@ -28,6 +37,8 @@ export declare const PROGRESS_DEFAULTS: {
|
|
|
28
37
|
readonly MAX: 100;
|
|
29
38
|
/** Buffer value for linear progress with buffer */
|
|
30
39
|
readonly BUFFER: 0;
|
|
40
|
+
/** Default shape for linear indeterminate progress */
|
|
41
|
+
readonly SHAPE: "line";
|
|
31
42
|
/** Whether to show percentage label */
|
|
32
43
|
readonly SHOW_LABEL: false;
|
|
33
44
|
/** Whether progress is indeterminate */
|
|
@@ -43,7 +54,7 @@ export declare const PROGRESS_CLASSES: {
|
|
|
43
54
|
readonly LINEAR: "progress--linear";
|
|
44
55
|
/** Circular variant class */
|
|
45
56
|
readonly CIRCULAR: "progress--circular";
|
|
46
|
-
/** Track element (
|
|
57
|
+
/** Track element (unfilled part) class */
|
|
47
58
|
readonly TRACK: "progress__track";
|
|
48
59
|
/** Indicator element (filled part) class */
|
|
49
60
|
readonly INDICATOR: "progress__indicator";
|
|
@@ -55,4 +66,74 @@ export declare const PROGRESS_CLASSES: {
|
|
|
55
66
|
readonly INDETERMINATE: "progress--indeterminate";
|
|
56
67
|
/** Disabled state class */
|
|
57
68
|
readonly DISABLED: "progress--disabled";
|
|
69
|
+
/** Test state class */
|
|
70
|
+
readonly TEST: "progress--test";
|
|
71
|
+
readonly TRANSITION: "progress--transition";
|
|
72
|
+
};
|
|
73
|
+
/**
|
|
74
|
+
* Progress component measurements
|
|
75
|
+
*/
|
|
76
|
+
export declare const PROGRESS_MEASUREMENTS: {
|
|
77
|
+
readonly LINEAR: {
|
|
78
|
+
readonly MIN_HEIGHT: 4;
|
|
79
|
+
readonly GAP: 4;
|
|
80
|
+
readonly STOP_INDICATOR: 4;
|
|
81
|
+
readonly HEIGHT: 4;
|
|
82
|
+
};
|
|
83
|
+
readonly CIRCULAR: {
|
|
84
|
+
readonly SIZE: 48;
|
|
85
|
+
readonly GAP: 8;
|
|
86
|
+
};
|
|
87
|
+
readonly COMMON: {
|
|
88
|
+
readonly STROKE_WIDTH: 4;
|
|
89
|
+
};
|
|
90
|
+
};
|
|
91
|
+
/**
|
|
92
|
+
* Thickness presets for progress component
|
|
93
|
+
* These are the standard thickness options following Material Design 3
|
|
94
|
+
*/
|
|
95
|
+
export declare const PROGRESS_THICKNESS: {
|
|
96
|
+
/** Thin stroke width (4px) - default */
|
|
97
|
+
readonly THIN: 4;
|
|
98
|
+
/** Thick stroke width (8px) */
|
|
99
|
+
readonly THICK: 8;
|
|
100
|
+
};
|
|
101
|
+
/**
|
|
102
|
+
* Wave animation parameters for progress components
|
|
103
|
+
*/
|
|
104
|
+
export declare const PROGRESS_WAVE: {
|
|
105
|
+
/** Linear progress wave parameters */
|
|
106
|
+
readonly LINEAR: {
|
|
107
|
+
/** Base amplitude of the wave in pixels */
|
|
108
|
+
readonly AMPLITUDE: 3;
|
|
109
|
+
/** Speed of the wave animation */
|
|
110
|
+
readonly SPEED: 0.008;
|
|
111
|
+
/** Frequency of the wave (affects wavelength) */
|
|
112
|
+
readonly FREQUENCY: 0.15;
|
|
113
|
+
/** Frequency for indeterminate animation */
|
|
114
|
+
readonly INDETERMINATE_FREQUENCY: 0.35;
|
|
115
|
+
/** Amplitude for indeterminate animation */
|
|
116
|
+
readonly INDETERMINATE_AMPLITUDE: 2;
|
|
117
|
+
/** Wave shape power (lower = rounder peaks, higher = sharper) */
|
|
118
|
+
readonly POWER: 0.8;
|
|
119
|
+
};
|
|
120
|
+
/** Circular progress wave parameters */
|
|
121
|
+
readonly CIRCULAR: {
|
|
122
|
+
/** Amplitude as percentage of stroke width */
|
|
123
|
+
readonly AMPLITUDE_RATIO: 1;
|
|
124
|
+
/** Maximum amplitude in pixels */
|
|
125
|
+
readonly AMPLITUDE_MAX: 5;
|
|
126
|
+
/** Speed of the wave rotation */
|
|
127
|
+
readonly SPEED: 0.008;
|
|
128
|
+
/** Number of complete waves around the circle */
|
|
129
|
+
readonly FREQUENCY: 12;
|
|
130
|
+
/** Number of complete waves for indeterminate animation */
|
|
131
|
+
readonly INDETERMINATE_FREQUENCY: 32;
|
|
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;
|
|
136
|
+
/** Wave shape power (lower = rounder peaks, higher = sharper) */
|
|
137
|
+
readonly POWER: 0.8;
|
|
138
|
+
};
|
|
58
139
|
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { ProgressConfig } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Canvas dimensions and drawing context
|
|
4
|
+
*/
|
|
5
|
+
export interface CanvasContext {
|
|
6
|
+
canvas: HTMLCanvasElement;
|
|
7
|
+
ctx: CanvasRenderingContext2D;
|
|
8
|
+
width: number;
|
|
9
|
+
height: number;
|
|
10
|
+
pixelRatio: number;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Component with canvas capabilities
|
|
14
|
+
*/
|
|
15
|
+
interface CanvasComponent {
|
|
16
|
+
element: HTMLElement;
|
|
17
|
+
canvas: HTMLCanvasElement;
|
|
18
|
+
ctx: CanvasRenderingContext2D;
|
|
19
|
+
getClass: (name: string) => string;
|
|
20
|
+
draw: () => void;
|
|
21
|
+
resize: () => void;
|
|
22
|
+
[key: string]: any;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Gets the stroke width value from the thickness config
|
|
26
|
+
*/
|
|
27
|
+
export declare const getStrokeWidth: (thickness?: string | number) => number;
|
|
28
|
+
/**
|
|
29
|
+
* Adds canvas functionality to replace complex DOM structure
|
|
30
|
+
*/
|
|
31
|
+
export declare const withCanvas: (config: ProgressConfig) => (component: any) => CanvasComponent;
|
|
32
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Circular progress drawing functionality
|
|
3
|
+
*/
|
|
4
|
+
import { ProgressConfig, ProgressShape } from '../types';
|
|
5
|
+
import { CanvasContext } from './canvas';
|
|
6
|
+
/**
|
|
7
|
+
* Draws circular progress on canvas
|
|
8
|
+
*/
|
|
9
|
+
export declare const drawCircularProgress: (context: CanvasContext, config: ProgressConfig, value: number, max: number, isIndeterminate: boolean, animationTime?: number, currentShape?: ProgressShape) => void;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Progress component features
|
|
3
|
+
* Exports all features used by the progress component
|
|
4
|
+
*/
|
|
5
|
+
export { withCanvas } from './canvas';
|
|
6
|
+
export { withState } from './state';
|
|
7
|
+
export { drawCircularProgress } from './circular';
|
|
8
|
+
export { drawLinearProgress } from './linear';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Linear progress drawing functionality
|
|
3
|
+
*/
|
|
4
|
+
import { ProgressConfig, ProgressShape } from '../types';
|
|
5
|
+
import { CanvasContext } from './canvas';
|
|
6
|
+
/**
|
|
7
|
+
* Draws linear progress on canvas with shape support
|
|
8
|
+
*/
|
|
9
|
+
export declare const drawLinearProgress: (context: CanvasContext, config: ProgressConfig, value: number, max: number, buffer: number, isIndeterminate: boolean, animationTime?: number, showStopIndicator?: boolean, currentShape?: ProgressShape) => void;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Creates a ResizeObserver to handle canvas dimension changes
|
|
3
|
+
* This ensures the canvas always matches its container size
|
|
4
|
+
*/
|
|
5
|
+
export declare const createCanvasResizeObserver: (element: HTMLElement, canvas: HTMLCanvasElement, onResize: () => void) => (() => void);
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { ProgressConfig, ProgressShape } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Progress component state
|
|
4
|
+
*/
|
|
5
|
+
interface ProgressState {
|
|
6
|
+
value: number;
|
|
7
|
+
max: number;
|
|
8
|
+
buffer: number;
|
|
9
|
+
indeterminate: boolean;
|
|
10
|
+
thickness: number | string;
|
|
11
|
+
shape: ProgressShape;
|
|
12
|
+
labelFormatter: (value: number, max: number) => string;
|
|
13
|
+
label?: HTMLElement;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Component with lifecycle methods and canvas drawing
|
|
17
|
+
*/
|
|
18
|
+
interface ComponentWithLifecycle {
|
|
19
|
+
element: HTMLElement;
|
|
20
|
+
canvas?: HTMLCanvasElement;
|
|
21
|
+
draw?: () => void;
|
|
22
|
+
lifecycle?: {
|
|
23
|
+
init?: () => void;
|
|
24
|
+
destroy?: () => void;
|
|
25
|
+
};
|
|
26
|
+
getClass?: (name: string) => string;
|
|
27
|
+
[key: string]: any;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Adds state management for canvas-based progress component
|
|
31
|
+
*
|
|
32
|
+
* @param config Progress configuration
|
|
33
|
+
* @returns Component enhancer with state management
|
|
34
|
+
*/
|
|
35
|
+
export declare const withState: (config: ProgressConfig) => (component: ComponentWithLifecycle) => ComponentWithLifecycle & {
|
|
36
|
+
state: ProgressState;
|
|
37
|
+
};
|
|
38
|
+
export {};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { ProgressConfig, ProgressShape } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Progress component state
|
|
4
|
+
*/
|
|
5
|
+
interface ProgressState {
|
|
6
|
+
value: number;
|
|
7
|
+
max: number;
|
|
8
|
+
buffer: number;
|
|
9
|
+
indeterminate: boolean;
|
|
10
|
+
shape: ProgressShape;
|
|
11
|
+
labelFormatter: (value: number, max: number) => string;
|
|
12
|
+
label?: HTMLElement;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Component with lifecycle methods
|
|
16
|
+
*/
|
|
17
|
+
interface ComponentWithLifecycle {
|
|
18
|
+
element: HTMLElement;
|
|
19
|
+
lifecycle?: {
|
|
20
|
+
init?: () => void;
|
|
21
|
+
destroy?: () => void;
|
|
22
|
+
};
|
|
23
|
+
setIndeterminate?: (state: boolean) => unknown;
|
|
24
|
+
setValue?: (value: number) => unknown;
|
|
25
|
+
setBuffer?: (value: number) => unknown;
|
|
26
|
+
setShape?: (shape: ProgressShape) => unknown;
|
|
27
|
+
showLabel?: () => unknown;
|
|
28
|
+
getClass?: (name: string) => string;
|
|
29
|
+
[key: string]: any;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Adds state management and initialization to the progress component
|
|
33
|
+
*
|
|
34
|
+
* @param config Progress configuration
|
|
35
|
+
* @returns Component enhancer with state management
|
|
36
|
+
*/
|
|
37
|
+
export declare const withState: (config: ProgressConfig) => (component: ComponentWithLifecycle) => ComponentWithLifecycle & {
|
|
38
|
+
state: ProgressState;
|
|
39
|
+
};
|
|
40
|
+
export {};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { default } from './progress';
|
|
2
|
-
export { ProgressConfig, ProgressComponent } from './types';
|
|
3
|
-
export { PROGRESS_VARIANTS, PROGRESS_EVENTS, PROGRESS_DEFAULTS, PROGRESS_CLASSES } from './constants';
|
|
2
|
+
export { ProgressConfig, ProgressComponent, ProgressShape } from './types';
|
|
3
|
+
export { PROGRESS_VARIANTS, PROGRESS_SHAPES, PROGRESS_EVENTS, PROGRESS_DEFAULTS, PROGRESS_CLASSES, PROGRESS_MEASUREMENTS, PROGRESS_THICKNESS } from './constants';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ProgressConfig, ProgressComponent } from './types';
|
|
2
2
|
/**
|
|
3
|
-
* Creates a new Progress component
|
|
3
|
+
* Creates a new Progress component using canvas rendering
|
|
4
4
|
* @param {ProgressConfig} config - Progress configuration object
|
|
5
5
|
* @returns {ProgressComponent} Progress component instance
|
|
6
6
|
*
|