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.
- package/dist/components/badge/config.d.ts +2 -2
- package/dist/components/bottom-sheet/bottom-sheet.js +1 -1
- package/dist/components/bottom-sheet/config.d.ts +2 -2
- package/dist/components/bottom-sheet/features/drag.d.ts +2 -2
- package/dist/components/bottom-sheet/features/drag.js +1 -1
- package/dist/components/button/api.d.ts +3 -3
- package/dist/components/button/button.d.ts +1 -1
- package/dist/components/button/config.d.ts +2 -2
- package/dist/components/button/features/progress.d.ts +17 -5
- package/dist/components/button-group/config.d.ts +20 -0
- package/dist/components/card/api.d.ts +10 -1
- package/dist/components/card/api.js +6 -1
- package/dist/components/card/card.js +1 -1
- package/dist/components/card/config.d.ts +15 -9
- package/dist/components/card/content.js +5 -2
- package/dist/components/card/features.d.ts +2 -1
- package/dist/components/card/types.d.ts +5 -4
- package/dist/components/carousel/config.d.ts +2 -2
- package/dist/components/carousel/features/slides.js +3 -2
- package/dist/components/checkbox/config.d.ts +2 -2
- package/dist/components/checkbox/types.d.ts +15 -16
- package/dist/components/chips/api.d.ts +6 -6
- package/dist/components/chips/chip/api.d.ts +2 -2
- package/dist/components/chips/chip/config.d.ts +6 -7
- package/dist/components/chips/config.d.ts +2 -2
- package/dist/components/chips/features/dom.js +0 -1
- package/dist/components/chips/types.d.ts +12 -1
- package/dist/components/datepicker/api.d.ts +5 -2
- package/dist/components/datepicker/config.d.ts +16 -13
- package/dist/components/datepicker/datepicker.js +10 -4
- package/dist/components/datepicker/render.d.ts +14 -6
- package/dist/components/datepicker/render.js +1 -1
- package/dist/components/datepicker/types.d.ts +51 -3
- package/dist/components/dialog/api.d.ts +1 -1
- package/dist/components/dialog/config.d.ts +3 -4
- package/dist/components/dialog/config.js +1 -1
- package/dist/components/dialog/features.js +1 -1
- package/dist/components/dialog/types.d.ts +1 -1
- package/dist/components/divider/features.js +2 -0
- package/dist/components/drawer/api.d.ts +3 -3
- package/dist/components/drawer/config.d.ts +2 -2
- package/dist/components/drawer/drawer.d.ts +1 -1
- package/dist/components/drawer/features/headline.d.ts +12 -2
- package/dist/components/drawer/features/items.d.ts +17 -3
- package/dist/components/drawer/features/state.d.ts +14 -2
- package/dist/components/extended-fab/api.d.ts +12 -4
- package/dist/components/extended-fab/api.js +12 -0
- package/dist/components/extended-fab/config.d.ts +10 -10
- package/dist/components/extended-fab/types.d.ts +4 -2
- package/dist/components/fab/api.d.ts +9 -2
- package/dist/components/fab/api.js +12 -0
- package/dist/components/fab/config.d.ts +8 -8
- package/dist/components/fab/types.d.ts +2 -1
- package/dist/components/icon-button/config.d.ts +2 -2
- package/dist/components/icon-button/features/toggle.d.ts +1 -5
- package/dist/components/icon-button/types.d.ts +6 -0
- package/dist/components/list/api.d.ts +18 -18
- package/dist/components/list/config.d.ts +6 -3
- package/dist/components/list/config.js +6 -7
- package/dist/components/list/features/renderer.js +2 -2
- package/dist/components/list/list.d.ts +20 -1
- package/dist/components/list/types.d.ts +32 -32
- package/dist/components/loading-indicator/config.d.ts +2 -2
- package/dist/components/loading-indicator/types.d.ts +3 -1
- package/dist/components/menu/api.d.ts +6 -5
- package/dist/components/menu/config.d.ts +2 -2
- package/dist/components/menu/features/keyboard.d.ts +19 -9
- package/dist/components/menu/types.d.ts +25 -9
- package/dist/components/navigation/config.d.ts +2 -2
- package/dist/components/navigation/features/controller.d.ts +1 -3
- package/dist/components/navigation/features/items.d.ts +1 -2
- package/dist/components/navigation/system/core.d.ts +6 -6
- package/dist/components/navigation/system/events.d.ts +3 -3
- package/dist/components/navigation/system/mobile.d.ts +6 -6
- package/dist/components/navigation/system/state.d.ts +3 -3
- package/dist/components/navigation/system/types.d.ts +43 -11
- package/dist/components/navigation/types.d.ts +15 -6
- package/dist/components/navigation-rail/navigation-rail.js +2 -1
- package/dist/components/progress/api.js +0 -1
- package/dist/components/progress/config.d.ts +2 -2
- package/dist/components/progress/features/canvas.d.ts +14 -5
- package/dist/components/progress/features/state.d.ts +1 -2
- package/dist/components/progress/types.d.ts +1 -1
- package/dist/components/radios/config.d.ts +2 -2
- package/dist/components/search/api.js +4 -4
- package/dist/components/search/config.d.ts +2 -2
- package/dist/components/search/features/suggestions.d.ts +1 -3
- package/dist/components/search/features/suggestions.js +16 -15
- package/dist/components/search/search.js +1 -1
- package/dist/components/segmented-button/config.d.ts +1 -5
- package/dist/components/segmented-button/config.js +1 -1
- package/dist/components/select/api.d.ts +2 -2
- package/dist/components/select/features.d.ts +2 -2
- package/dist/components/select/features.js +2 -1
- package/dist/components/select/types.d.ts +38 -21
- package/dist/components/side-sheet/config.d.ts +2 -2
- package/dist/components/slider/api.d.ts +6 -6
- package/dist/components/slider/config.d.ts +2 -2
- package/dist/components/slider/types.d.ts +2 -2
- package/dist/components/snackbar/config.d.ts +2 -2
- package/dist/components/snackbar/features.d.ts +3 -3
- package/dist/components/snackbar/position.d.ts +1 -1
- package/dist/components/snackbar/types.d.ts +5 -6
- package/dist/components/split-button/api.js +1 -3
- package/dist/components/split-button/config.d.ts +2 -2
- package/dist/components/split-button/features/buttons.d.ts +3 -2
- package/dist/components/split-button/features/menu.d.ts +3 -2
- package/dist/components/split-button/types.d.ts +13 -2
- package/dist/components/switch/config.d.ts +2 -2
- package/dist/components/switch/types.d.ts +0 -1
- package/dist/components/tabs/api.d.ts +8 -5
- package/dist/components/tabs/config.d.ts +9 -1
- package/dist/components/tabs/features.d.ts +7 -11
- package/dist/components/tabs/features.js +2 -1
- package/dist/components/tabs/indicator.js +4 -2
- package/dist/components/tabs/responsive.js +2 -1
- package/dist/components/tabs/tab-api.d.ts +11 -5
- package/dist/components/tabs/tab-api.js +1 -1
- package/dist/components/tabs/tab.js +9 -1
- package/dist/components/tabs/types.d.ts +9 -2
- package/dist/components/tabs/utils.d.ts +14 -3
- package/dist/components/textfield/api.d.ts +1 -1
- package/dist/components/textfield/config.d.ts +2 -2
- package/dist/components/textfield/features/error.d.ts +1 -2
- package/dist/components/textfield/features/leading-icon.d.ts +1 -2
- package/dist/components/textfield/features/prefix-text.d.ts +1 -2
- package/dist/components/textfield/features/suffix-text.d.ts +1 -2
- package/dist/components/textfield/features/supporting-text.d.ts +1 -2
- package/dist/components/textfield/features/trailing-icon.d.ts +1 -2
- package/dist/components/textfield/types.d.ts +0 -2
- package/dist/components/timepicker/api.d.ts +5 -4
- package/dist/components/timepicker/config.d.ts +14 -11
- package/dist/components/tooltip/config.d.ts +2 -2
- package/dist/components/tooltip/tooltip.d.ts +1 -1
- package/dist/core/compose/base.d.ts +2 -2
- package/dist/core/compose/base.js +1 -1
- package/dist/core/compose/component.d.ts +13 -4
- package/dist/core/compose/component.js +1 -1
- package/dist/core/compose/features/badge.d.ts +3 -4
- package/dist/core/compose/features/badge.js +1 -1
- package/dist/core/compose/features/checkable.d.ts +3 -4
- package/dist/core/compose/features/debounce.d.ts +2 -3
- package/dist/core/compose/features/disabled.d.ts +1 -2
- package/dist/core/compose/features/events.d.ts +4 -3
- package/dist/core/compose/features/icon.d.ts +1 -5
- package/dist/core/compose/features/input.d.ts +2 -3
- package/dist/core/compose/features/lifecycle.d.ts +2 -2
- package/dist/core/compose/features/lifecycle.js +3 -3
- package/dist/core/compose/features/position.d.ts +1 -2
- package/dist/core/compose/features/ripple.d.ts +1 -2
- package/dist/core/compose/features/size.d.ts +1 -2
- package/dist/core/compose/features/style.d.ts +1 -2
- package/dist/core/compose/features/text.d.ts +1 -5
- package/dist/core/compose/features/textinput.d.ts +2 -3
- package/dist/core/compose/features/textlabel.d.ts +1 -2
- package/dist/core/compose/features/throttle.d.ts +1 -2
- package/dist/core/compose/features/track.d.ts +0 -1
- package/dist/core/compose/features/variant.d.ts +1 -2
- package/dist/core/compose/index.d.ts +1 -1
- package/dist/core/compose/pipe.d.ts +43 -3
- package/dist/core/compose/pipe.js +6 -2
- package/dist/core/compose/utils/type-guards.d.ts +4 -4
- package/dist/core/compose/utils/type-guards.js +1 -1
- package/dist/core/config/component.d.ts +12 -9
- package/dist/core/config/global.d.ts +12 -8
- package/dist/core/config.d.ts +1 -1
- package/dist/core/dom/attributes.d.ts +6 -6
- package/dist/core/dom/attributes.js +8 -5
- package/dist/core/dom/create.d.ts +27 -10
- package/dist/core/dom/create.js +5 -26
- package/dist/core/dom/utils.d.ts +1 -1
- package/dist/core/dom/utils.js +4 -1
- package/dist/core/state/emitter.d.ts +2 -2
- package/dist/core/state/events.d.ts +3 -3
- package/dist/core/state/lifecycle.d.ts +0 -1
- package/dist/core/state/store.d.ts +3 -3
- package/dist/core/utils/index.d.ts +1 -0
- package/dist/core/utils/index.js +1 -0
- package/dist/core/utils/object.d.ts +2 -2
- package/dist/core/utils/performance.d.ts +3 -3
- package/dist/core/utils/url.d.ts +20 -0
- package/dist/core/utils/url.js +0 -0
- package/dist/core/utils/validate.d.ts +6 -6
- package/dist/core/utils/validate.js +13 -12
- package/dist/index.cjs +0 -0
- package/dist/package.json +1 -1
- package/dist/styles/badge.css +2 -2
- package/dist/styles/base.css +2 -2
- package/dist/styles/bottom-app-bar.css +2 -2
- package/dist/styles/bottom-sheet.css +2 -2
- package/dist/styles/button-group.css +2 -2
- package/dist/styles/button.css +2 -2
- package/dist/styles/card.css +2 -2
- package/dist/styles/carousel.css +2 -2
- package/dist/styles/checkbox.css +2 -2
- package/dist/styles/chips.css +2 -2
- package/dist/styles/dialog.css +2 -2
- package/dist/styles/divider.css +2 -2
- package/dist/styles/drawer.css +2 -2
- package/dist/styles/extended-fab.css +2 -2
- package/dist/styles/fab.css +2 -2
- package/dist/styles/icon-button.css +2 -2
- package/dist/styles/list.css +2 -2
- package/dist/styles/loading-indicator.css +2 -2
- package/dist/styles/menu.css +2 -2
- package/dist/styles/navigation-rail.css +2 -2
- package/dist/styles/navigation.css +2 -2
- package/dist/styles/progress.css +2 -2
- package/dist/styles/radios.css +2 -2
- package/dist/styles/search.css +2 -2
- package/dist/styles/segmented-button.css +2 -2
- package/dist/styles/select.css +2 -2
- package/dist/styles/side-sheet.css +2 -2
- package/dist/styles/slider.css +2 -2
- package/dist/styles/snackbar.css +2 -2
- package/dist/styles/split-button.css +2 -2
- package/dist/styles/switch.css +2 -2
- package/dist/styles/tabs.css +2 -2
- package/dist/styles/textfield.css +2 -2
- package/dist/styles/timepicker.css +2 -2
- package/dist/styles/tooltip.css +2 -0
- package/dist/styles/tooltip.d.ts +1 -0
- package/dist/styles/tooltip.js +2 -0
- package/dist/styles/top-app-bar.css +2 -2
- package/dist/styles/utilities.css +2 -2
- package/dist/styles.css +2 -2
- package/dist/themes/autumn.css +1 -1
- package/dist/themes/baseline.css +1 -1
- package/dist/themes/brownbeige.css +1 -1
- package/dist/themes/browngreen.css +1 -1
- package/dist/themes/desert.css +1 -1
- package/dist/themes/forest.css +1 -1
- package/dist/themes/highcontrast.css +1 -1
- package/dist/themes/legacy.css +1 -1
- package/dist/themes/material.css +1 -1
- package/dist/themes/ocean.css +1 -1
- package/dist/themes/sageivory.css +1 -1
- package/dist/themes/spring.css +1 -1
- package/dist/themes/summer.css +1 -1
- package/dist/themes/sunset.css +1 -1
- package/dist/themes/tealcaramel.css +1 -1
- package/dist/themes/winter.css +1 -1
- package/package.json +2 -2
- package/src/styles/abstract/_mixins.scss +5 -1
- package/src/styles/components/_checkbox.scss +27 -7
- package/src/styles/components/_chips.scss +13 -13
- package/src/styles/components/_datepicker.scss +5 -5
- package/src/styles/components/_dialog.scss +2 -2
- package/src/styles/components/_radios.scss +30 -30
- package/src/styles/components/_switch.scss +36 -26
- package/src/styles/components/_tabs.scss +59 -58
- package/src/styles/components/_timepicker.scss +3 -3
- package/src/styles/main.scss +1 -0
|
@@ -5,7 +5,6 @@ import { BaseComponent, ElementComponent } from "../component.js";
|
|
|
5
5
|
export interface DisabledConfig {
|
|
6
6
|
disabled?: boolean;
|
|
7
7
|
componentName?: string;
|
|
8
|
-
[key: string]: any;
|
|
9
8
|
}
|
|
10
9
|
/**
|
|
11
10
|
* Disabled state manager interface
|
|
@@ -44,4 +43,4 @@ export interface DisabledComponent extends BaseComponent {
|
|
|
44
43
|
* @param config - Configuration object
|
|
45
44
|
* @returns Function that enhances a component with disabled state management
|
|
46
45
|
*/
|
|
47
|
-
export declare const withDisabled: <T extends DisabledConfig>(config: T) => <C extends ElementComponent>(component: C) => C & DisabledComponent;
|
|
46
|
+
export declare const withDisabled: <T extends DisabledConfig & object>(config: T) => <C extends ElementComponent>(component: C) => C & DisabledComponent;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @module core/compose/features
|
|
3
3
|
*/
|
|
4
|
+
import { EventCallback } from "../../state/emitter.js";
|
|
4
5
|
import { BaseComponent } from "../component.js";
|
|
5
6
|
/**
|
|
6
7
|
* Component with event capabilities
|
|
@@ -12,21 +13,21 @@ export interface EventComponent extends BaseComponent {
|
|
|
12
13
|
* @param handler - Event handler
|
|
13
14
|
* @returns Component instance for chaining
|
|
14
15
|
*/
|
|
15
|
-
on(event: string, handler:
|
|
16
|
+
on(event: string, handler: EventCallback): EventComponent;
|
|
16
17
|
/**
|
|
17
18
|
* Unsubscribe from an event
|
|
18
19
|
* @param event - Event name
|
|
19
20
|
* @param handler - Event handler
|
|
20
21
|
* @returns Component instance for chaining
|
|
21
22
|
*/
|
|
22
|
-
off(event: string, handler:
|
|
23
|
+
off(event: string, handler: EventCallback): EventComponent;
|
|
23
24
|
/**
|
|
24
25
|
* Emit an event
|
|
25
26
|
* @param event - Event name
|
|
26
27
|
* @param data - Event data
|
|
27
28
|
* @returns Component instance for chaining
|
|
28
29
|
*/
|
|
29
|
-
emit(event: string, data?:
|
|
30
|
+
emit(event: string, data?: unknown): EventComponent;
|
|
30
31
|
}
|
|
31
32
|
/**
|
|
32
33
|
* Adds event handling capabilities to a component
|
|
@@ -48,10 +48,6 @@ export interface IconConfig {
|
|
|
48
48
|
* Text content (for determining button styling)
|
|
49
49
|
*/
|
|
50
50
|
text?: string;
|
|
51
|
-
/**
|
|
52
|
-
* Additional configuration options
|
|
53
|
-
*/
|
|
54
|
-
[key: string]: unknown;
|
|
55
51
|
}
|
|
56
52
|
/**
|
|
57
53
|
* Component with icon capabilities
|
|
@@ -68,4 +64,4 @@ export interface IconComponent extends BaseComponent {
|
|
|
68
64
|
* @param config - Configuration object containing icon information
|
|
69
65
|
* @returns Function that enhances a component with icon capabilities
|
|
70
66
|
*/
|
|
71
|
-
export declare const withIcon: <T extends IconConfig>(config: T) => <C extends ElementComponent>(component: C) => C & IconComponent;
|
|
67
|
+
export declare const withIcon: <T extends IconConfig & object>(config: T) => <C extends ElementComponent>(component: C) => C & IconComponent;
|
|
@@ -35,7 +35,6 @@ export interface InputConfig {
|
|
|
35
35
|
* Component name for classes
|
|
36
36
|
*/
|
|
37
37
|
componentName?: string;
|
|
38
|
-
[key: string]: any;
|
|
39
38
|
}
|
|
40
39
|
/**
|
|
41
40
|
* Component with input element and related methods
|
|
@@ -59,7 +58,7 @@ export interface InputComponent extends ElementComponent {
|
|
|
59
58
|
/**
|
|
60
59
|
* Event emission method if available
|
|
61
60
|
*/
|
|
62
|
-
emit?: (event: string, data:
|
|
61
|
+
emit?: (event: string, data: unknown) => InputComponent;
|
|
63
62
|
}
|
|
64
63
|
/**
|
|
65
64
|
* Creates an input element and adds it to a component
|
|
@@ -68,4 +67,4 @@ export interface InputComponent extends ElementComponent {
|
|
|
68
67
|
* @param config - Input configuration
|
|
69
68
|
* @returns Function that enhances a component with input functionality
|
|
70
69
|
*/
|
|
71
|
-
export declare const withInput: <T extends InputConfig>(config?: T) => <C extends ElementComponent>(component: C) => C & InputComponent;
|
|
70
|
+
export declare const withInput: <T extends InputConfig & object>(config?: T) => <C extends ElementComponent>(component: C) => C & InputComponent;
|
|
@@ -12,7 +12,7 @@ export interface ComponentManagers {
|
|
|
12
12
|
icon?: {
|
|
13
13
|
getElement: () => HTMLElement | null;
|
|
14
14
|
};
|
|
15
|
-
[key: string]:
|
|
15
|
+
[key: string]: unknown;
|
|
16
16
|
}
|
|
17
17
|
/**
|
|
18
18
|
* Lifecycle methods interface
|
|
@@ -58,4 +58,4 @@ export interface LifecycleComponent extends BaseComponent {
|
|
|
58
58
|
*
|
|
59
59
|
* @returns Function that enhances a component with lifecycle management
|
|
60
60
|
*/
|
|
61
|
-
export declare const withLifecycle: () => <T extends ElementComponent
|
|
61
|
+
export declare const withLifecycle: () => <T extends BaseComponent & Partial<Pick<ElementComponent, "element" | "destroy">>>(component: T) => T & LifecycleComponent;
|
|
@@ -2,22 +2,22 @@ import { getCleanup } from "../cleanup.js";
|
|
|
2
2
|
import { createEmitter } from "../../state/emitter.js";
|
|
3
3
|
function hasEvents(component) {
|
|
4
4
|
return 'events' in component &&
|
|
5
|
-
component.events &&
|
|
6
5
|
typeof component.events === 'object' &&
|
|
6
|
+
component.events !== null &&
|
|
7
7
|
'destroy' in component.events &&
|
|
8
8
|
typeof component.events.destroy === 'function';
|
|
9
9
|
}
|
|
10
10
|
function hasText(component) {
|
|
11
11
|
return 'text' in component &&
|
|
12
|
-
component.text &&
|
|
13
12
|
typeof component.text === 'object' &&
|
|
13
|
+
component.text !== null &&
|
|
14
14
|
'getElement' in component.text &&
|
|
15
15
|
typeof component.text.getElement === 'function';
|
|
16
16
|
}
|
|
17
17
|
function hasIcon(component) {
|
|
18
18
|
return 'icon' in component &&
|
|
19
|
-
component.icon &&
|
|
20
19
|
typeof component.icon === 'object' &&
|
|
20
|
+
component.icon !== null &&
|
|
21
21
|
'getElement' in component.icon &&
|
|
22
22
|
typeof component.icon.getElement === 'function';
|
|
23
23
|
}
|
|
@@ -18,7 +18,6 @@ export interface PositionConfig {
|
|
|
18
18
|
position?: string;
|
|
19
19
|
prefix?: string;
|
|
20
20
|
componentName?: string;
|
|
21
|
-
[key: string]: any;
|
|
22
21
|
}
|
|
23
22
|
/**
|
|
24
23
|
* Position manager interface
|
|
@@ -48,4 +47,4 @@ export interface PositionComponent extends BaseComponent {
|
|
|
48
47
|
* @param config - Configuration object containing position information
|
|
49
48
|
* @returns Function that enhances a component with position capabilities
|
|
50
49
|
*/
|
|
51
|
-
export declare const withPosition: <T extends PositionConfig>(config: T) => <C extends ElementComponent>(component: C) => C & PositionComponent;
|
|
50
|
+
export declare const withPosition: <T extends PositionConfig & object>(config: T) => <C extends ElementComponent>(component: C) => C & PositionComponent;
|
|
@@ -38,7 +38,6 @@ export interface RippleController {
|
|
|
38
38
|
export interface RippleFeatureConfig {
|
|
39
39
|
ripple?: boolean;
|
|
40
40
|
rippleConfig?: RippleConfig;
|
|
41
|
-
[key: string]: any;
|
|
42
41
|
}
|
|
43
42
|
/**
|
|
44
43
|
* Component with ripple capabilities
|
|
@@ -58,4 +57,4 @@ export declare const createRipple: (config?: RippleConfig) => RippleController;
|
|
|
58
57
|
* @param config - Configuration object
|
|
59
58
|
* @returns Function that enhances a component with ripple effect
|
|
60
59
|
*/
|
|
61
|
-
export declare const withRipple: <T extends RippleFeatureConfig>(config: T) => <C extends ElementComponent & Partial<LifecycleComponent>>(component: C) => C & RippleComponent;
|
|
60
|
+
export declare const withRipple: <T extends RippleFeatureConfig & object>(config: T) => <C extends ElementComponent & Partial<LifecycleComponent>>(component: C) => C & RippleComponent;
|
|
@@ -6,7 +6,6 @@ export interface SizeConfig {
|
|
|
6
6
|
size?: string;
|
|
7
7
|
prefix?: string;
|
|
8
8
|
componentName?: string;
|
|
9
|
-
[key: string]: any;
|
|
10
9
|
}
|
|
11
10
|
/**
|
|
12
11
|
* Adds a size class to a component
|
|
@@ -14,4 +13,4 @@ export interface SizeConfig {
|
|
|
14
13
|
* @param config - Configuration object containing size information
|
|
15
14
|
* @returns Function that enhances a component with the size class
|
|
16
15
|
*/
|
|
17
|
-
export declare const withSize: <T extends SizeConfig>(config: T) => <C extends ElementComponent>(component: C) => C;
|
|
16
|
+
export declare const withSize: <T extends SizeConfig & object>(config: T) => <C extends ElementComponent>(component: C) => C;
|
|
@@ -5,7 +5,6 @@ import { ElementComponent } from "../component.js";
|
|
|
5
5
|
export interface StyleConfig {
|
|
6
6
|
variant?: string;
|
|
7
7
|
size?: string;
|
|
8
|
-
[key: string]: any;
|
|
9
8
|
}
|
|
10
9
|
/**
|
|
11
10
|
* Adds style classes to a component based on configuration
|
|
@@ -13,4 +12,4 @@ export interface StyleConfig {
|
|
|
13
12
|
* @param config - Configuration object containing style information
|
|
14
13
|
* @returns Function that enhances a component with style classes
|
|
15
14
|
*/
|
|
16
|
-
export declare const withStyle: <T extends StyleConfig>(config?: T) => <C extends ElementComponent>(component: C) => C;
|
|
15
|
+
export declare const withStyle: <T extends StyleConfig & object>(config?: T) => <C extends ElementComponent>(component: C) => C;
|
|
@@ -40,10 +40,6 @@ export interface TextConfig {
|
|
|
40
40
|
* Element to insert text before (optional)
|
|
41
41
|
*/
|
|
42
42
|
beforeElement?: HTMLElement;
|
|
43
|
-
/**
|
|
44
|
-
* Additional configuration options
|
|
45
|
-
*/
|
|
46
|
-
[key: string]: any;
|
|
47
43
|
}
|
|
48
44
|
/**
|
|
49
45
|
* Component with text capabilities
|
|
@@ -60,4 +56,4 @@ export interface TextComponent extends BaseComponent {
|
|
|
60
56
|
* @param config - Configuration object containing text information
|
|
61
57
|
* @returns Function that enhances a component with text capabilities
|
|
62
58
|
*/
|
|
63
|
-
export declare const withText: <T extends TextConfig>(config: T) => <C extends ElementComponent>(component: C) => C & TextComponent;
|
|
59
|
+
export declare const withText: <T extends TextConfig & object>(config: T) => <C extends ElementComponent>(component: C) => C & TextComponent;
|
|
@@ -43,7 +43,6 @@ export interface TextInputConfig {
|
|
|
43
43
|
* Placeholder attribute
|
|
44
44
|
*/
|
|
45
45
|
placeholder?: string;
|
|
46
|
-
[key: string]: any;
|
|
47
46
|
}
|
|
48
47
|
/**
|
|
49
48
|
* Component with text input capabilities
|
|
@@ -86,7 +85,7 @@ export interface TextInputComponent extends ElementComponent {
|
|
|
86
85
|
/**
|
|
87
86
|
* Event emission method if available
|
|
88
87
|
*/
|
|
89
|
-
emit?: (event: string, data:
|
|
88
|
+
emit?: (event: string, data: unknown) => TextInputComponent;
|
|
90
89
|
}
|
|
91
90
|
/**
|
|
92
91
|
* Enhances a component with text input functionality
|
|
@@ -94,4 +93,4 @@ export interface TextInputComponent extends ElementComponent {
|
|
|
94
93
|
* @param config - Text input configuration
|
|
95
94
|
* @returns Function that enhances a component with text input capabilities
|
|
96
95
|
*/
|
|
97
|
-
export declare const withTextInput: <T extends TextInputConfig>(config?: T) => <C extends ElementComponent>(component: C) => C & TextInputComponent;
|
|
96
|
+
export declare const withTextInput: <T extends TextInputConfig & object>(config?: T) => <C extends ElementComponent>(component: C) => C & TextInputComponent;
|
|
@@ -19,7 +19,6 @@ export interface TextLabelConfig {
|
|
|
19
19
|
* Component name for class generation
|
|
20
20
|
*/
|
|
21
21
|
componentName?: string;
|
|
22
|
-
[key: string]: any;
|
|
23
22
|
}
|
|
24
23
|
/**
|
|
25
24
|
* Label manager interface
|
|
@@ -54,4 +53,4 @@ export interface LabelComponent extends BaseComponent {
|
|
|
54
53
|
* @param config - Configuration object containing label information
|
|
55
54
|
* @returns Function that enhances a component with a label
|
|
56
55
|
*/
|
|
57
|
-
export declare const withTextLabel: <T extends TextLabelConfig>(config?: T) => <C extends ElementComponent>(component: C) => C & LabelComponent;
|
|
56
|
+
export declare const withTextLabel: <T extends TextLabelConfig & object>(config?: T) => <C extends ElementComponent>(component: C) => C & LabelComponent;
|
|
@@ -18,7 +18,6 @@ export interface ThrottleConfig {
|
|
|
18
18
|
trailing?: boolean;
|
|
19
19
|
};
|
|
20
20
|
}>;
|
|
21
|
-
[key: string]: any;
|
|
22
21
|
}
|
|
23
22
|
/**
|
|
24
23
|
* Component with throttled event capabilities
|
|
@@ -71,5 +70,5 @@ export interface ThrottleComponent extends BaseComponent {
|
|
|
71
70
|
* )(config);
|
|
72
71
|
* ```
|
|
73
72
|
*/
|
|
74
|
-
export declare const withThrottle: (config?:
|
|
73
|
+
export declare const withThrottle: <T extends ThrottleConfig & object>(config?: T) => <C extends ElementComponent>(component: C) => C & ThrottleComponent;
|
|
75
74
|
export default withThrottle;
|
|
@@ -6,7 +6,6 @@ export interface VariantConfig {
|
|
|
6
6
|
variant?: string;
|
|
7
7
|
prefix?: string;
|
|
8
8
|
componentName?: string;
|
|
9
|
-
[key: string]: any;
|
|
10
9
|
}
|
|
11
10
|
/**
|
|
12
11
|
* Adds a variant class to a component
|
|
@@ -14,4 +13,4 @@ export interface VariantConfig {
|
|
|
14
13
|
* @param config - Configuration object containing variant information
|
|
15
14
|
* @returns Function that enhances a component with the variant class
|
|
16
15
|
*/
|
|
17
|
-
export declare const withVariant: <T extends VariantConfig>(config: T) => <C extends ElementComponent>(component: C) => C;
|
|
16
|
+
export declare const withVariant: <T extends VariantConfig & object>(config: T) => <C extends ElementComponent>(component: C) => C;
|
|
@@ -7,7 +7,7 @@ export { createComponent } from "./base.js";
|
|
|
7
7
|
export { createBase, withElement } from "./component.js";
|
|
8
8
|
export { withEvents, withIcon, withSize, withPosition, withText, withVariant, withDisabled, withLifecycle, withRipple, withInput, withCheckable, withStyle, withTextInput, withTextLabel, withTrack, withEnhancedEvents, withThrottle, withDebounce, } from "./features/index.js";
|
|
9
9
|
export type { Component } from "./base.js";
|
|
10
|
-
export type { BaseComponent, ElementComponent, TouchState, WithElementOptions, } from "./component.js";
|
|
10
|
+
export type { BaseComponent, BaseConfig, ElementComponent, TouchState, WithElementOptions, } from "./component.js";
|
|
11
11
|
export type { EventComponent, TextComponent, IconComponent, LifecycleComponent, Lifecycle, DisabledComponent, DisabledManager, RippleComponent, InputComponent, CheckableComponent, CheckableManager, TextInputComponent, LabelComponent, TrackComponent, EnhancedEventComponent, ThrottleComponent, ThrottleConfig, DebounceComponent, DebounceConfig, } from "./features/index.js";
|
|
12
12
|
export { hasLifecycle, hasEmit } from "./utils/type-guards.js";
|
|
13
13
|
export type { ComponentWithLifecycle, ComponentWithEmit, } from "./utils/type-guards.js";
|
|
@@ -17,7 +17,27 @@
|
|
|
17
17
|
* const addOneThenDouble = pipe(addOne, double);
|
|
18
18
|
* console.log(addOneThenDouble(3)); // Output: 8
|
|
19
19
|
*/
|
|
20
|
-
export declare
|
|
20
|
+
export declare function pipe<A, B>(f1: (arg: A) => B): (x: A) => B;
|
|
21
|
+
export declare function pipe<A, B, C>(f1: (arg: A) => B, f2: (arg: B) => C): (x: A) => C;
|
|
22
|
+
export declare function pipe<A, B, C, D>(f1: (arg: A) => B, f2: (arg: B) => C, f3: (arg: C) => D): (x: A) => D;
|
|
23
|
+
export declare function pipe<A, B, C, D, E>(f1: (arg: A) => B, f2: (arg: B) => C, f3: (arg: C) => D, f4: (arg: D) => E): (x: A) => E;
|
|
24
|
+
export declare function pipe<A, B, C, D, E, F>(f1: (arg: A) => B, f2: (arg: B) => C, f3: (arg: C) => D, f4: (arg: D) => E, f5: (arg: E) => F): (x: A) => F;
|
|
25
|
+
export declare function pipe<A, B, C, D, E, F, G>(f1: (arg: A) => B, f2: (arg: B) => C, f3: (arg: C) => D, f4: (arg: D) => E, f5: (arg: E) => F, f6: (arg: F) => G): (x: A) => G;
|
|
26
|
+
export declare function pipe<A, B, C, D, E, F, G, H>(f1: (arg: A) => B, f2: (arg: B) => C, f3: (arg: C) => D, f4: (arg: D) => E, f5: (arg: E) => F, f6: (arg: F) => G, f7: (arg: G) => H): (x: A) => H;
|
|
27
|
+
export declare function pipe<A, B, C, D, E, F, G, H, I>(f1: (arg: A) => B, f2: (arg: B) => C, f3: (arg: C) => D, f4: (arg: D) => E, f5: (arg: E) => F, f6: (arg: F) => G, f7: (arg: G) => H, f8: (arg: H) => I): (x: A) => I;
|
|
28
|
+
export declare function pipe<A, B, C, D, E, F, G, H, I, J>(f1: (arg: A) => B, f2: (arg: B) => C, f3: (arg: C) => D, f4: (arg: D) => E, f5: (arg: E) => F, f6: (arg: F) => G, f7: (arg: G) => H, f8: (arg: H) => I, f9: (arg: I) => J): (x: A) => J;
|
|
29
|
+
export declare function pipe<A, B, C, D, E, F, G, H, I, J, K>(f1: (arg: A) => B, f2: (arg: B) => C, f3: (arg: C) => D, f4: (arg: D) => E, f5: (arg: E) => F, f6: (arg: F) => G, f7: (arg: G) => H, f8: (arg: H) => I, f9: (arg: I) => J, f10: (arg: J) => K): (x: A) => K;
|
|
30
|
+
export declare function pipe<A, B, C, D, E, F, G, H, I, J, K, L>(f1: (arg: A) => B, f2: (arg: B) => C, f3: (arg: C) => D, f4: (arg: D) => E, f5: (arg: E) => F, f6: (arg: F) => G, f7: (arg: G) => H, f8: (arg: H) => I, f9: (arg: I) => J, f10: (arg: J) => K, f11: (arg: K) => L): (x: A) => L;
|
|
31
|
+
export declare function pipe<A, B, C, D, E, F, G, H, I, J, K, L, M>(f1: (arg: A) => B, f2: (arg: B) => C, f3: (arg: C) => D, f4: (arg: D) => E, f5: (arg: E) => F, f6: (arg: F) => G, f7: (arg: G) => H, f8: (arg: H) => I, f9: (arg: I) => J, f10: (arg: J) => K, f11: (arg: K) => L, f12: (arg: L) => M): (x: A) => M;
|
|
32
|
+
export declare function pipe<A, B, C, D, E, F, G, H, I, J, K, L, M, N>(f1: (arg: A) => B, f2: (arg: B) => C, f3: (arg: C) => D, f4: (arg: D) => E, f5: (arg: E) => F, f6: (arg: F) => G, f7: (arg: G) => H, f8: (arg: H) => I, f9: (arg: I) => J, f10: (arg: J) => K, f11: (arg: K) => L, f12: (arg: L) => M, f13: (arg: M) => N): (x: A) => N;
|
|
33
|
+
export declare function pipe<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O>(f1: (arg: A) => B, f2: (arg: B) => C, f3: (arg: C) => D, f4: (arg: D) => E, f5: (arg: E) => F, f6: (arg: F) => G, f7: (arg: G) => H, f8: (arg: H) => I, f9: (arg: I) => J, f10: (arg: J) => K, f11: (arg: K) => L, f12: (arg: L) => M, f13: (arg: M) => N, f14: (arg: N) => O): (x: A) => O;
|
|
34
|
+
export declare function pipe<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P>(f1: (arg: A) => B, f2: (arg: B) => C, f3: (arg: C) => D, f4: (arg: D) => E, f5: (arg: E) => F, f6: (arg: F) => G, f7: (arg: G) => H, f8: (arg: H) => I, f9: (arg: I) => J, f10: (arg: J) => K, f11: (arg: K) => L, f12: (arg: L) => M, f13: (arg: M) => N, f14: (arg: N) => O, f15: (arg: O) => P): (x: A) => P;
|
|
35
|
+
export declare function pipe<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q>(f1: (arg: A) => B, f2: (arg: B) => C, f3: (arg: C) => D, f4: (arg: D) => E, f5: (arg: E) => F, f6: (arg: F) => G, f7: (arg: G) => H, f8: (arg: H) => I, f9: (arg: I) => J, f10: (arg: J) => K, f11: (arg: K) => L, f12: (arg: L) => M, f13: (arg: M) => N, f14: (arg: N) => O, f15: (arg: O) => P, f16: (arg: P) => Q): (x: A) => Q;
|
|
36
|
+
export declare function pipe<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R>(f1: (arg: A) => B, f2: (arg: B) => C, f3: (arg: C) => D, f4: (arg: D) => E, f5: (arg: E) => F, f6: (arg: F) => G, f7: (arg: G) => H, f8: (arg: H) => I, f9: (arg: I) => J, f10: (arg: J) => K, f11: (arg: K) => L, f12: (arg: L) => M, f13: (arg: M) => N, f14: (arg: N) => O, f15: (arg: O) => P, f16: (arg: P) => Q, f17: (arg: Q) => R): (x: A) => R;
|
|
37
|
+
export declare function pipe<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S>(f1: (arg: A) => B, f2: (arg: B) => C, f3: (arg: C) => D, f4: (arg: D) => E, f5: (arg: E) => F, f6: (arg: F) => G, f7: (arg: G) => H, f8: (arg: H) => I, f9: (arg: I) => J, f10: (arg: J) => K, f11: (arg: K) => L, f12: (arg: L) => M, f13: (arg: M) => N, f14: (arg: N) => O, f15: (arg: O) => P, f16: (arg: P) => Q, f17: (arg: Q) => R, f18: (arg: R) => S): (x: A) => S;
|
|
38
|
+
export declare function pipe<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T>(f1: (arg: A) => B, f2: (arg: B) => C, f3: (arg: C) => D, f4: (arg: D) => E, f5: (arg: E) => F, f6: (arg: F) => G, f7: (arg: G) => H, f8: (arg: H) => I, f9: (arg: I) => J, f10: (arg: J) => K, f11: (arg: K) => L, f12: (arg: L) => M, f13: (arg: M) => N, f14: (arg: N) => O, f15: (arg: O) => P, f16: (arg: P) => Q, f17: (arg: Q) => R, f18: (arg: R) => S, f19: (arg: S) => T): (x: A) => T;
|
|
39
|
+
export declare function pipe<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U>(f1: (arg: A) => B, f2: (arg: B) => C, f3: (arg: C) => D, f4: (arg: D) => E, f5: (arg: E) => F, f6: (arg: F) => G, f7: (arg: G) => H, f8: (arg: H) => I, f9: (arg: I) => J, f10: (arg: J) => K, f11: (arg: K) => L, f12: (arg: L) => M, f13: (arg: M) => N, f14: (arg: N) => O, f15: (arg: O) => P, f16: (arg: P) => Q, f17: (arg: Q) => R, f18: (arg: R) => S, f19: (arg: S) => T, f20: (arg: T) => U): (x: A) => U;
|
|
40
|
+
export declare function pipe<T>(...fns: Array<(arg: T) => T>): (x: T) => T;
|
|
21
41
|
/**
|
|
22
42
|
* Performs right-to-left function composition.
|
|
23
43
|
* This is the mathematical composition order: (f ∘ g)(x) = f(g(x))
|
|
@@ -33,7 +53,27 @@ export declare const pipe: <T>(...fns: Array<(arg: any) => any>) => (x: T) => an
|
|
|
33
53
|
* const doubleTheAddOne = compose(addOne, double);
|
|
34
54
|
* console.log(doubleTheAddOne(3)); // Output: 7
|
|
35
55
|
*/
|
|
36
|
-
export declare
|
|
56
|
+
export declare function compose<A, B>(f1: (arg: A) => B): (x: A) => B;
|
|
57
|
+
export declare function compose<A, B, C>(f2: (arg: B) => C, f1: (arg: A) => B): (x: A) => C;
|
|
58
|
+
export declare function compose<A, B, C, D>(f3: (arg: C) => D, f2: (arg: B) => C, f1: (arg: A) => B): (x: A) => D;
|
|
59
|
+
export declare function compose<A, B, C, D, E>(f4: (arg: D) => E, f3: (arg: C) => D, f2: (arg: B) => C, f1: (arg: A) => B): (x: A) => E;
|
|
60
|
+
export declare function compose<A, B, C, D, E, F>(f5: (arg: E) => F, f4: (arg: D) => E, f3: (arg: C) => D, f2: (arg: B) => C, f1: (arg: A) => B): (x: A) => F;
|
|
61
|
+
export declare function compose<A, B, C, D, E, F, G>(f6: (arg: F) => G, f5: (arg: E) => F, f4: (arg: D) => E, f3: (arg: C) => D, f2: (arg: B) => C, f1: (arg: A) => B): (x: A) => G;
|
|
62
|
+
export declare function compose<A, B, C, D, E, F, G, H>(f7: (arg: G) => H, f6: (arg: F) => G, f5: (arg: E) => F, f4: (arg: D) => E, f3: (arg: C) => D, f2: (arg: B) => C, f1: (arg: A) => B): (x: A) => H;
|
|
63
|
+
export declare function compose<A, B, C, D, E, F, G, H, I>(f8: (arg: H) => I, f7: (arg: G) => H, f6: (arg: F) => G, f5: (arg: E) => F, f4: (arg: D) => E, f3: (arg: C) => D, f2: (arg: B) => C, f1: (arg: A) => B): (x: A) => I;
|
|
64
|
+
export declare function compose<A, B, C, D, E, F, G, H, I, J>(f9: (arg: I) => J, f8: (arg: H) => I, f7: (arg: G) => H, f6: (arg: F) => G, f5: (arg: E) => F, f4: (arg: D) => E, f3: (arg: C) => D, f2: (arg: B) => C, f1: (arg: A) => B): (x: A) => J;
|
|
65
|
+
export declare function compose<A, B, C, D, E, F, G, H, I, J, K>(f10: (arg: J) => K, f9: (arg: I) => J, f8: (arg: H) => I, f7: (arg: G) => H, f6: (arg: F) => G, f5: (arg: E) => F, f4: (arg: D) => E, f3: (arg: C) => D, f2: (arg: B) => C, f1: (arg: A) => B): (x: A) => K;
|
|
66
|
+
export declare function compose<A, B, C, D, E, F, G, H, I, J, K, L>(f11: (arg: K) => L, f10: (arg: J) => K, f9: (arg: I) => J, f8: (arg: H) => I, f7: (arg: G) => H, f6: (arg: F) => G, f5: (arg: E) => F, f4: (arg: D) => E, f3: (arg: C) => D, f2: (arg: B) => C, f1: (arg: A) => B): (x: A) => L;
|
|
67
|
+
export declare function compose<A, B, C, D, E, F, G, H, I, J, K, L, M>(f12: (arg: L) => M, f11: (arg: K) => L, f10: (arg: J) => K, f9: (arg: I) => J, f8: (arg: H) => I, f7: (arg: G) => H, f6: (arg: F) => G, f5: (arg: E) => F, f4: (arg: D) => E, f3: (arg: C) => D, f2: (arg: B) => C, f1: (arg: A) => B): (x: A) => M;
|
|
68
|
+
export declare function compose<A, B, C, D, E, F, G, H, I, J, K, L, M, N>(f13: (arg: M) => N, f12: (arg: L) => M, f11: (arg: K) => L, f10: (arg: J) => K, f9: (arg: I) => J, f8: (arg: H) => I, f7: (arg: G) => H, f6: (arg: F) => G, f5: (arg: E) => F, f4: (arg: D) => E, f3: (arg: C) => D, f2: (arg: B) => C, f1: (arg: A) => B): (x: A) => N;
|
|
69
|
+
export declare function compose<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O>(f14: (arg: N) => O, f13: (arg: M) => N, f12: (arg: L) => M, f11: (arg: K) => L, f10: (arg: J) => K, f9: (arg: I) => J, f8: (arg: H) => I, f7: (arg: G) => H, f6: (arg: F) => G, f5: (arg: E) => F, f4: (arg: D) => E, f3: (arg: C) => D, f2: (arg: B) => C, f1: (arg: A) => B): (x: A) => O;
|
|
70
|
+
export declare function compose<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P>(f15: (arg: O) => P, f14: (arg: N) => O, f13: (arg: M) => N, f12: (arg: L) => M, f11: (arg: K) => L, f10: (arg: J) => K, f9: (arg: I) => J, f8: (arg: H) => I, f7: (arg: G) => H, f6: (arg: F) => G, f5: (arg: E) => F, f4: (arg: D) => E, f3: (arg: C) => D, f2: (arg: B) => C, f1: (arg: A) => B): (x: A) => P;
|
|
71
|
+
export declare function compose<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q>(f16: (arg: P) => Q, f15: (arg: O) => P, f14: (arg: N) => O, f13: (arg: M) => N, f12: (arg: L) => M, f11: (arg: K) => L, f10: (arg: J) => K, f9: (arg: I) => J, f8: (arg: H) => I, f7: (arg: G) => H, f6: (arg: F) => G, f5: (arg: E) => F, f4: (arg: D) => E, f3: (arg: C) => D, f2: (arg: B) => C, f1: (arg: A) => B): (x: A) => Q;
|
|
72
|
+
export declare function compose<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R>(f17: (arg: Q) => R, f16: (arg: P) => Q, f15: (arg: O) => P, f14: (arg: N) => O, f13: (arg: M) => N, f12: (arg: L) => M, f11: (arg: K) => L, f10: (arg: J) => K, f9: (arg: I) => J, f8: (arg: H) => I, f7: (arg: G) => H, f6: (arg: F) => G, f5: (arg: E) => F, f4: (arg: D) => E, f3: (arg: C) => D, f2: (arg: B) => C, f1: (arg: A) => B): (x: A) => R;
|
|
73
|
+
export declare function compose<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S>(f18: (arg: R) => S, f17: (arg: Q) => R, f16: (arg: P) => Q, f15: (arg: O) => P, f14: (arg: N) => O, f13: (arg: M) => N, f12: (arg: L) => M, f11: (arg: K) => L, f10: (arg: J) => K, f9: (arg: I) => J, f8: (arg: H) => I, f7: (arg: G) => H, f6: (arg: F) => G, f5: (arg: E) => F, f4: (arg: D) => E, f3: (arg: C) => D, f2: (arg: B) => C, f1: (arg: A) => B): (x: A) => S;
|
|
74
|
+
export declare function compose<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T>(f19: (arg: S) => T, f18: (arg: R) => S, f17: (arg: Q) => R, f16: (arg: P) => Q, f15: (arg: O) => P, f14: (arg: N) => O, f13: (arg: M) => N, f12: (arg: L) => M, f11: (arg: K) => L, f10: (arg: J) => K, f9: (arg: I) => J, f8: (arg: H) => I, f7: (arg: G) => H, f6: (arg: F) => G, f5: (arg: E) => F, f4: (arg: D) => E, f3: (arg: C) => D, f2: (arg: B) => C, f1: (arg: A) => B): (x: A) => T;
|
|
75
|
+
export declare function compose<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U>(f20: (arg: T) => U, f19: (arg: S) => T, f18: (arg: R) => S, f17: (arg: Q) => R, f16: (arg: P) => Q, f15: (arg: O) => P, f14: (arg: N) => O, f13: (arg: M) => N, f12: (arg: L) => M, f11: (arg: K) => L, f10: (arg: J) => K, f9: (arg: I) => J, f8: (arg: H) => I, f7: (arg: G) => H, f6: (arg: F) => G, f5: (arg: E) => F, f4: (arg: D) => E, f3: (arg: C) => D, f2: (arg: B) => C, f1: (arg: A) => B): (x: A) => U;
|
|
76
|
+
export declare function compose<T>(...fns: Array<(arg: T) => T>): (x: T) => T;
|
|
37
77
|
/**
|
|
38
78
|
* Creates a function that applies transformations to an object with shared context.
|
|
39
79
|
* Useful for applying multiple transformations while maintaining a shared state.
|
|
@@ -51,7 +91,7 @@ export declare const compose: <T>(...fns: Array<(arg: any) => any>) => (x: T) =>
|
|
|
51
91
|
* const person = createPerson({}, { name: 'John', age: 30 });
|
|
52
92
|
* // Result: { name: 'John', age: 30 }
|
|
53
93
|
*/
|
|
54
|
-
export declare const transform: <T, C = Record<string,
|
|
94
|
+
export declare const transform: <T, C = Record<string, unknown>>(...transformers: Array<(obj: T, context: C) => Partial<T>>) => (obj: T, context?: C) => T;
|
|
55
95
|
/**
|
|
56
96
|
* @typedef {Object} TransformContext
|
|
57
97
|
* @property {any} [key] - Any contextual data needed by transformers
|
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
export
|
|
2
|
-
|
|
1
|
+
export function pipe(...fns) {
|
|
2
|
+
return (x) => fns.reduce((v, f) => f(v), x);
|
|
3
|
+
}
|
|
4
|
+
export function compose(...fns) {
|
|
5
|
+
return (x) => fns.reduceRight((v, f) => f(v), x);
|
|
6
|
+
}
|
|
3
7
|
export const transform = (...transformers) => (obj, context = {}) => transformers.reduce((acc, transformer) => ({
|
|
4
8
|
...acc,
|
|
5
9
|
...transformer(acc, context)
|
|
@@ -8,20 +8,20 @@ import { ElementComponent } from "../component.js";
|
|
|
8
8
|
export interface ComponentWithLifecycle extends ElementComponent {
|
|
9
9
|
lifecycle: {
|
|
10
10
|
destroy: () => void;
|
|
11
|
-
[key: string]:
|
|
11
|
+
[key: string]: unknown;
|
|
12
12
|
};
|
|
13
13
|
}
|
|
14
14
|
/**
|
|
15
15
|
* Interface for components with emit method
|
|
16
16
|
*/
|
|
17
17
|
export interface ComponentWithEmit extends ElementComponent {
|
|
18
|
-
emit: (event: string, data:
|
|
18
|
+
emit: (event: string, data: unknown) => unknown;
|
|
19
19
|
}
|
|
20
20
|
/**
|
|
21
21
|
* Type guard to check if component has lifecycle
|
|
22
22
|
*/
|
|
23
|
-
export declare function hasLifecycle(component:
|
|
23
|
+
export declare function hasLifecycle(component: object): component is ComponentWithLifecycle;
|
|
24
24
|
/**
|
|
25
25
|
* Type guard to check if component has emit method
|
|
26
26
|
*/
|
|
27
|
-
export declare function hasEmit(component:
|
|
27
|
+
export declare function hasEmit(component: object): component is ComponentWithEmit;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export function hasLifecycle(component) {
|
|
2
2
|
return 'lifecycle' in component &&
|
|
3
|
-
component.lifecycle &&
|
|
4
3
|
typeof component.lifecycle === 'object' &&
|
|
4
|
+
component.lifecycle !== null &&
|
|
5
5
|
'destroy' in component.lifecycle &&
|
|
6
6
|
typeof component.lifecycle.destroy === 'function';
|
|
7
7
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { EventCondition } from "../dom/create.js";
|
|
1
2
|
/**
|
|
2
3
|
* Base component configuration interface
|
|
3
4
|
* Common configuration properties shared by all components
|
|
@@ -20,23 +21,25 @@ export interface BaseComponentConfig {
|
|
|
20
21
|
ariaDescribedBy?: string;
|
|
21
22
|
ariaLabelledBy?: string;
|
|
22
23
|
ariaHidden?: boolean;
|
|
23
|
-
[key: string]: any;
|
|
24
24
|
}
|
|
25
25
|
/**
|
|
26
26
|
* Creates a base configuration for any component
|
|
27
27
|
* Automatically merges global defaults if available
|
|
28
28
|
*
|
|
29
|
-
* @param {
|
|
30
|
-
* @param {
|
|
29
|
+
* @param {T} defaults - Default configuration for the component
|
|
30
|
+
* @param {Partial<T>} userConfig - User provided configuration
|
|
31
31
|
* @param {string} componentName - The name of the component
|
|
32
|
-
* @returns {
|
|
32
|
+
* @returns {T} Complete configuration with defaults applied
|
|
33
33
|
*
|
|
34
34
|
* @example
|
|
35
35
|
* // In button/config.ts
|
|
36
36
|
* export const createBaseConfig = (config: ButtonConfig = {}) =>
|
|
37
37
|
* createComponentConfig(defaultConfig, config, 'button');
|
|
38
38
|
*/
|
|
39
|
-
export declare const createComponentConfig: (defaults:
|
|
39
|
+
export declare const createComponentConfig: <T extends BaseComponentConfig & object>(defaults: T, userConfig: Partial<T>, componentName: string) => T & {
|
|
40
|
+
componentName: string;
|
|
41
|
+
prefix: string;
|
|
42
|
+
};
|
|
40
43
|
/**
|
|
41
44
|
* Creates a class name with proper prefixing
|
|
42
45
|
*
|
|
@@ -82,16 +85,16 @@ export declare const processClassNames: (classNames: string | string[] | null) =
|
|
|
82
85
|
*/
|
|
83
86
|
export declare const createElementConfig: (config: BaseComponentConfig, options: {
|
|
84
87
|
tag: string;
|
|
85
|
-
attributes?: Record<string,
|
|
88
|
+
attributes?: Record<string, unknown>;
|
|
86
89
|
className?: string | string[] | null;
|
|
87
90
|
html?: string;
|
|
88
91
|
text?: string;
|
|
89
|
-
forwardEvents?: Record<string,
|
|
92
|
+
forwardEvents?: Record<string, EventCondition>;
|
|
90
93
|
interactive?: boolean;
|
|
91
94
|
}) => {
|
|
92
95
|
tag: string;
|
|
93
96
|
componentName: string;
|
|
94
|
-
attributes: Record<string,
|
|
97
|
+
attributes: Record<string, unknown>;
|
|
95
98
|
className: string[];
|
|
96
99
|
rawClass: string | string[];
|
|
97
100
|
id: string;
|
|
@@ -107,6 +110,6 @@ export declare const createElementConfig: (config: BaseComponentConfig, options:
|
|
|
107
110
|
ariaHidden: boolean;
|
|
108
111
|
html: string;
|
|
109
112
|
text: string;
|
|
110
|
-
forwardEvents: Record<string,
|
|
113
|
+
forwardEvents: Record<string, EventCondition>;
|
|
111
114
|
interactive: boolean;
|
|
112
115
|
};
|
|
@@ -5,24 +5,28 @@
|
|
|
5
5
|
* without adding complexity or performance overhead.
|
|
6
6
|
*/
|
|
7
7
|
import { ButtonConfig } from "../../components/button/types.js";
|
|
8
|
+
import type { CardSchema } from "../../components/card/types.js";
|
|
9
|
+
import type { CheckboxConfig } from "../../components/checkbox/types.js";
|
|
10
|
+
import type { ChipConfig } from "../../components/chips/types.js";
|
|
11
|
+
import type { DialogConfig } from "../../components/dialog/types.js";
|
|
8
12
|
import type { NavigationRailConfig } from "../../components/navigation-rail/types.js";
|
|
13
|
+
import type { SliderConfig } from "../../components/slider/types.js";
|
|
14
|
+
import type { SwitchConfig } from "../../components/switch/types.js";
|
|
9
15
|
import { TextfieldConfig } from "../../components/textfield/types.js";
|
|
10
16
|
/**
|
|
11
17
|
* Component configuration map
|
|
12
18
|
* Add new components here as they support global config
|
|
13
|
-
*
|
|
14
|
-
* For components not yet integrated, use Partial<any> as a placeholder
|
|
15
19
|
*/
|
|
16
20
|
export interface ComponentConfigMap {
|
|
17
21
|
"navigation-rail"?: Partial<NavigationRailConfig>;
|
|
18
22
|
button?: Partial<ButtonConfig>;
|
|
19
23
|
textfield?: Partial<TextfieldConfig>;
|
|
20
|
-
checkbox?: Partial<
|
|
21
|
-
switch?: Partial<
|
|
22
|
-
slider?: Partial<
|
|
23
|
-
card?: Partial<
|
|
24
|
-
chip?: Partial<
|
|
25
|
-
dialog?: Partial<
|
|
24
|
+
checkbox?: Partial<CheckboxConfig>;
|
|
25
|
+
switch?: Partial<SwitchConfig>;
|
|
26
|
+
slider?: Partial<SliderConfig>;
|
|
27
|
+
card?: Partial<CardSchema>;
|
|
28
|
+
chip?: Partial<ChipConfig>;
|
|
29
|
+
dialog?: Partial<DialogConfig>;
|
|
26
30
|
}
|
|
27
31
|
/**
|
|
28
32
|
* Sets global defaults for a specific component
|
package/dist/core/config.d.ts
CHANGED
|
@@ -6,11 +6,11 @@
|
|
|
6
6
|
* Set attributes on an element with performance optimizations
|
|
7
7
|
* Fast path for single attribute, efficient iteration for multiple
|
|
8
8
|
*
|
|
9
|
-
* @param {HTMLElement} element - Element to set attributes on
|
|
10
|
-
* @param {
|
|
11
|
-
* @returns {HTMLElement} The element for chaining
|
|
9
|
+
* @param {HTMLElement | SVGElement} element - Element to set attributes on
|
|
10
|
+
* @param {object} attributes - Attributes to set
|
|
11
|
+
* @returns {HTMLElement | SVGElement} The element for chaining
|
|
12
12
|
*/
|
|
13
|
-
export declare const setAttributes: (element:
|
|
13
|
+
export declare const setAttributes: <E extends HTMLElement | SVGElement>(element: E, attributes?: object) => E;
|
|
14
14
|
/**
|
|
15
15
|
* Remove attributes from an element
|
|
16
16
|
* Standard for loop is fastest for array iteration
|
|
@@ -25,13 +25,13 @@ export declare const removeAttributes: (element: HTMLElement, attributes?: strin
|
|
|
25
25
|
* Single pass through operations array for optimal performance
|
|
26
26
|
*
|
|
27
27
|
* @param {HTMLElement} element - Element to modify
|
|
28
|
-
* @param {Array<{action: "set" | "remove", key: string, value?:
|
|
28
|
+
* @param {Array<{action: "set" | "remove", key: string, value?: unknown}>} operations - Array of attribute operations
|
|
29
29
|
* @returns {HTMLElement} The element for chaining
|
|
30
30
|
*/
|
|
31
31
|
export declare const batchAttributes: (element: HTMLElement, operations: Array<{
|
|
32
32
|
action: "set" | "remove";
|
|
33
33
|
key: string;
|
|
34
|
-
value?:
|
|
34
|
+
value?: unknown;
|
|
35
35
|
}>) => HTMLElement;
|
|
36
36
|
/**
|
|
37
37
|
* Check if element has attribute
|
|
@@ -1,18 +1,21 @@
|
|
|
1
|
+
import { safeUrl, URL_ATTRIBUTES } from "../utils/url.js";
|
|
1
2
|
export const setAttributes = (element, attributes = {}) => {
|
|
2
3
|
if (!attributes)
|
|
3
4
|
return element;
|
|
5
|
+
const values = attributes;
|
|
6
|
+
const attributeValue = (key, value) => URL_ATTRIBUTES.has(key.toLowerCase()) ? safeUrl(String(value)) : String(value);
|
|
4
7
|
const keys = Object.keys(attributes);
|
|
5
8
|
if (keys.length === 1) {
|
|
6
|
-
const value =
|
|
9
|
+
const value = values[keys[0]];
|
|
7
10
|
if (value != null) {
|
|
8
|
-
element.setAttribute(keys[0],
|
|
11
|
+
element.setAttribute(keys[0], attributeValue(keys[0], value));
|
|
9
12
|
}
|
|
10
13
|
return element;
|
|
11
14
|
}
|
|
12
15
|
for (const key in attributes) {
|
|
13
|
-
const value =
|
|
16
|
+
const value = values[key];
|
|
14
17
|
if (value != null) {
|
|
15
|
-
element.setAttribute(key,
|
|
18
|
+
element.setAttribute(key, attributeValue(key, value));
|
|
16
19
|
}
|
|
17
20
|
}
|
|
18
21
|
return element;
|
|
@@ -27,7 +30,7 @@ export const batchAttributes = (element, operations) => {
|
|
|
27
30
|
for (let i = 0; i < operations.length; i++) {
|
|
28
31
|
const op = operations[i];
|
|
29
32
|
if (op.action === "set" && op.value != null) {
|
|
30
|
-
element.setAttribute(op.key, String(op.value));
|
|
33
|
+
element.setAttribute(op.key, URL_ATTRIBUTES.has(op.key.toLowerCase()) ? safeUrl(String(op.value)) : String(op.value));
|
|
31
34
|
}
|
|
32
35
|
else if (op.action === "remove") {
|
|
33
36
|
element.removeAttribute(op.key);
|