mtrl 0.4.4 → 0.5.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/README.md +61 -60
- package/dist/README.md +61 -60
- package/dist/components/chips/chips.d.ts +2 -2
- package/dist/components/chips/config.d.ts +1 -1
- package/dist/components/chips/features/controller.d.ts +1 -1
- package/dist/components/chips/features/dom.d.ts +15 -0
- package/dist/components/chips/features/index.d.ts +5 -4
- package/dist/components/chips/schema.d.ts +2 -2
- package/dist/components/list/api.d.ts +82 -39
- package/dist/components/list/config.d.ts +23 -19
- package/dist/components/list/features/index.d.ts +1 -1
- package/dist/components/list/features/renderer.d.ts +9 -0
- package/dist/components/list/features/selection.d.ts +1 -1
- package/dist/components/list/list.d.ts +3 -2
- package/dist/components/list/types.d.ts +68 -121
- package/dist/components/progress/constants.d.ts +3 -3
- package/dist/components/slider/features/canvas.d.ts +2 -2
- package/dist/components/slider/features/dom.d.ts +21 -0
- package/dist/components/slider/features/index.d.ts +5 -4
- package/dist/components/slider/slider.d.ts +4 -4
- package/dist/components/textfield/api.d.ts +2 -0
- package/dist/components/textfield/features/error.d.ts +54 -0
- package/dist/components/textfield/features/index.d.ts +1 -0
- package/dist/components/textfield/features/placement.d.ts +1 -1
- package/dist/components/textfield/features/supporting-text.d.ts +1 -1
- package/dist/components/textfield/types.d.ts +7 -0
- package/dist/core/compose/features/icon.d.ts +2 -2
- package/dist/core/compose/features/index.d.ts +0 -2
- package/dist/core/compose/features/textinput.d.ts +4 -0
- package/dist/core/compose/features/textlabel.d.ts +2 -2
- package/dist/core/compose/index.d.ts +1 -5
- package/dist/core/dom/attributes.d.ts +32 -2
- package/dist/core/dom/classes.d.ts +15 -13
- package/dist/core/dom/create.d.ts +35 -87
- package/dist/core/dom/index.d.ts +6 -6
- package/dist/core/dom/utils.d.ts +1 -10
- package/dist/core/index.d.ts +18 -22
- package/dist/index.cjs +15 -15
- package/dist/index.cjs.map +36 -74
- package/dist/index.d.ts +1 -6
- package/dist/index.js +15 -15
- package/dist/index.js.map +36 -74
- package/dist/package.json +1 -1
- package/dist/styles.css +2 -2
- package/package.json +4 -3
- package/dist/components/list/features/listmanager.d.ts +0 -9
- package/dist/components/slider/schema.d.ts +0 -65
- package/dist/core/collection/adapters/base.d.ts +0 -47
- package/dist/core/collection/adapters/route.d.ts +0 -149
- package/dist/core/collection/collection.d.ts +0 -131
- package/dist/core/collection/index.d.ts +0 -10
- package/dist/core/collection/list-manager/config.d.ts +0 -29
- package/dist/core/collection/list-manager/dom-elements.d.ts +0 -30
- package/dist/core/collection/list-manager/index.d.ts +0 -61
- package/dist/core/collection/list-manager/item-measurement.d.ts +0 -91
- package/dist/core/collection/list-manager/renderer.d.ts +0 -31
- package/dist/core/collection/list-manager/scroll-tracker.d.ts +0 -20
- package/dist/core/collection/list-manager/state.d.ts +0 -60
- package/dist/core/collection/list-manager/types.d.ts +0 -361
- package/dist/core/collection/list-manager/utils/recycling.d.ts +0 -34
- package/dist/core/collection/list-manager/utils/visibility.d.ts +0 -45
- package/dist/core/compose/features/gestures/longpress.d.ts +0 -85
- package/dist/core/compose/features/gestures/pan.d.ts +0 -108
- package/dist/core/compose/features/gestures/pinch.d.ts +0 -111
- package/dist/core/compose/features/gestures/rotate.d.ts +0 -111
- package/dist/core/compose/features/gestures/swipe.d.ts +0 -149
- package/dist/core/compose/features/gestures/tap.d.ts +0 -79
- package/dist/core/compose/features/gestures.d.ts +0 -86
- package/dist/core/composition/features/dom.d.ts +0 -19
- package/dist/core/composition/features/icon.d.ts +0 -45
- package/dist/core/composition/features/index.d.ts +0 -7
- package/dist/core/composition/features/label.d.ts +0 -49
- package/dist/core/composition/features/layout.d.ts +0 -31
- package/dist/core/composition/index.d.ts +0 -16
- package/dist/core/gestures/index.d.ts +0 -12
- package/dist/core/gestures/longpress.d.ts +0 -23
- package/dist/core/gestures/manager.d.ts +0 -14
- package/dist/core/gestures/pan.d.ts +0 -12
- package/dist/core/gestures/pinch.d.ts +0 -14
- package/dist/core/gestures/rotate.d.ts +0 -14
- package/dist/core/gestures/swipe.d.ts +0 -20
- package/dist/core/gestures/tap.d.ts +0 -12
- package/dist/core/gestures/types.d.ts +0 -320
- package/dist/core/gestures/utils.d.ts +0 -57
- package/dist/core/layout/array.d.ts +0 -20
- package/dist/core/layout/config.d.ts +0 -32
- package/dist/core/layout/create.d.ts +0 -14
- package/dist/core/layout/index.d.ts +0 -13
- package/dist/core/layout/jsx.d.ts +0 -13
- package/dist/core/layout/object.d.ts +0 -14
- package/dist/core/layout/processor.d.ts +0 -28
- package/dist/core/layout/result.d.ts +0 -12
- package/dist/core/layout/template.d.ts +0 -12
- package/dist/core/layout/types.d.ts +0 -137
- package/dist/core/layout/utils.d.ts +0 -38
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { BaseComponent, ElementComponent } from "../../../core/compose/component";
|
|
2
|
+
/**
|
|
3
|
+
* Configuration for error feature
|
|
4
|
+
*/
|
|
5
|
+
export interface ErrorConfig {
|
|
6
|
+
/**
|
|
7
|
+
* Initial error state
|
|
8
|
+
*/
|
|
9
|
+
error?: boolean;
|
|
10
|
+
/**
|
|
11
|
+
* CSS class prefix
|
|
12
|
+
*/
|
|
13
|
+
prefix?: string;
|
|
14
|
+
/**
|
|
15
|
+
* Component name
|
|
16
|
+
*/
|
|
17
|
+
componentName?: string;
|
|
18
|
+
[key: string]: any;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Component with supporting text capabilities (if available)
|
|
22
|
+
*/
|
|
23
|
+
interface ComponentWithSupportingText extends ElementComponent {
|
|
24
|
+
setSupportingText?: (text: string, isError?: boolean) => void;
|
|
25
|
+
supportingTextElement?: HTMLElement | null;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Component with error state capabilities
|
|
29
|
+
*/
|
|
30
|
+
export interface ErrorComponent extends BaseComponent {
|
|
31
|
+
/**
|
|
32
|
+
* Current error state
|
|
33
|
+
*/
|
|
34
|
+
errorState: boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Sets error state
|
|
37
|
+
* @param error - Whether to show error state
|
|
38
|
+
* @param message - Optional error message to display
|
|
39
|
+
* @returns Component instance for chaining
|
|
40
|
+
*/
|
|
41
|
+
setError: (error: boolean, message?: string) => ErrorComponent;
|
|
42
|
+
/**
|
|
43
|
+
* Gets current error state
|
|
44
|
+
* @returns Whether component is in error state
|
|
45
|
+
*/
|
|
46
|
+
isError: () => boolean;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Adds error state management to a component
|
|
50
|
+
* @param config - Configuration with error settings
|
|
51
|
+
* @returns Function that enhances a component with error state
|
|
52
|
+
*/
|
|
53
|
+
export declare const withError: <T extends ErrorConfig>(config: T) => <C extends ComponentWithSupportingText>(component: C) => C & ErrorComponent;
|
|
54
|
+
export {};
|
|
@@ -5,6 +5,7 @@ export { withSuffixText } from "./suffix-text";
|
|
|
5
5
|
export { withSupportingText } from "./supporting-text";
|
|
6
6
|
export { withPlacement } from "./placement";
|
|
7
7
|
export { withDensity } from "./density";
|
|
8
|
+
export { withError } from "./error";
|
|
8
9
|
export type { LeadingIconComponent, LeadingIconConfig } from "./leading-icon";
|
|
9
10
|
export type { TrailingIconComponent, TrailingIconConfig, } from "./trailing-icon";
|
|
10
11
|
export type { PrefixTextComponent, PrefixTextConfig } from "./prefix-text";
|
|
@@ -148,6 +148,10 @@ export interface TextfieldComponent {
|
|
|
148
148
|
removeSuffixText: () => TextfieldComponent;
|
|
149
149
|
/** Manually update element positions (useful after DOM changes) */
|
|
150
150
|
updatePositions: () => TextfieldComponent;
|
|
151
|
+
/** Sets the error state of the textfield */
|
|
152
|
+
setError: (error: boolean, message?: string) => TextfieldComponent;
|
|
153
|
+
/** Gets the current error state */
|
|
154
|
+
isError: () => boolean;
|
|
151
155
|
/** Sets the density of the textfield */
|
|
152
156
|
setDensity: (density: TextfieldDensity | string) => TextfieldComponent;
|
|
153
157
|
/** Gets the current density setting */
|
|
@@ -220,5 +224,8 @@ export interface BaseComponent {
|
|
|
220
224
|
lifecycle?: {
|
|
221
225
|
destroy: () => void;
|
|
222
226
|
};
|
|
227
|
+
errorState?: boolean;
|
|
228
|
+
setError?: (error: boolean, message?: string) => void;
|
|
229
|
+
isError?: () => boolean;
|
|
223
230
|
[key: string]: unknown;
|
|
224
231
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BaseComponent, ElementComponent } from
|
|
1
|
+
import { BaseComponent, ElementComponent } from "../component";
|
|
2
2
|
/**
|
|
3
3
|
* Icon manager interface
|
|
4
4
|
*/
|
|
@@ -31,7 +31,7 @@ export interface IconConfig {
|
|
|
31
31
|
/**
|
|
32
32
|
* Icon position ('start' or 'end')
|
|
33
33
|
*/
|
|
34
|
-
iconPosition?:
|
|
34
|
+
iconPosition?: "start" | "end";
|
|
35
35
|
/**
|
|
36
36
|
* Icon size variant
|
|
37
37
|
*/
|
|
@@ -15,7 +15,6 @@ export { withEvents as withEnhancedEvents } from './withEvents';
|
|
|
15
15
|
export { withBadge } from './badge';
|
|
16
16
|
export { withThrottle } from './throttle';
|
|
17
17
|
export { withDebounce } from './debounce';
|
|
18
|
-
export { withGestures } from './gestures';
|
|
19
18
|
export { withDisabled } from './disabled';
|
|
20
19
|
export { withLifecycle } from './lifecycle';
|
|
21
20
|
export type { EventComponent } from './events';
|
|
@@ -33,4 +32,3 @@ export type { EnhancedEventComponent } from './withEvents';
|
|
|
33
32
|
export type { BadgeComponent, BadgeConfig } from './badge';
|
|
34
33
|
export type { ThrottleComponent, ThrottleConfig } from './throttle';
|
|
35
34
|
export type { DebounceComponent, DebounceConfig } from './debounce';
|
|
36
|
-
export type { GesturesComponent, GesturesFeatureConfig } from './gestures';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BaseComponent, ElementComponent } from
|
|
1
|
+
import { BaseComponent, ElementComponent } from "../component";
|
|
2
2
|
/**
|
|
3
3
|
* Configuration for text label feature
|
|
4
4
|
*/
|
|
@@ -10,7 +10,7 @@ export interface TextLabelConfig {
|
|
|
10
10
|
/**
|
|
11
11
|
* Label position ('start' or 'end')
|
|
12
12
|
*/
|
|
13
|
-
labelPosition?:
|
|
13
|
+
labelPosition?: "start" | "end";
|
|
14
14
|
/**
|
|
15
15
|
* CSS class prefix
|
|
16
16
|
*/
|
|
@@ -5,11 +5,7 @@
|
|
|
5
5
|
export { pipe, compose, transform } from './pipe';
|
|
6
6
|
export { createComponent } from './base';
|
|
7
7
|
export { createBase, withElement } from './component';
|
|
8
|
-
export { withEvents, withIcon, withSize, withPosition, withText, withVariant, withDisabled, withLifecycle, withRipple, withInput, withCheckable, withStyle, withTextInput, withTextLabel, withTrack, withEnhancedEvents, withThrottle, withDebounce
|
|
9
|
-
export { withTapGesture } from './features/gestures/tap';
|
|
10
|
-
export { withSwipeGesture } from './features/gestures/swipe';
|
|
11
|
-
export { withLongPressGesture } from './features/gestures/longpress';
|
|
12
|
-
export { withPanGesture } from './features/gestures/pan';
|
|
8
|
+
export { withEvents, withIcon, withSize, withPosition, withText, withVariant, withDisabled, withLifecycle, withRipple, withInput, withCheckable, withStyle, withTextInput, withTextLabel, withTrack, withEnhancedEvents, withThrottle, withDebounce } from './features';
|
|
13
9
|
export type { Component } from './base';
|
|
14
10
|
export type { BaseComponent, ElementComponent, TouchState, WithElementOptions } from './component';
|
|
15
11
|
export type { EventComponent, TextComponent, IconComponent, LifecycleComponent, Lifecycle, DisabledComponent, DisabledManager, RippleComponent, InputComponent, CheckableComponent, CheckableManager, TextInputComponent, LabelComponent, TrackComponent, EnhancedEventComponent, ThrottleComponent, ThrottleConfig, DebounceComponent, DebounceConfig, GesturesComponent, GesturesFeatureConfig } from './features';
|
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
* @description DOM attribute helpers
|
|
4
4
|
*/
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
6
|
+
* Set attributes on an element with performance optimizations
|
|
7
|
+
* Fast path for single attribute, efficient iteration for multiple
|
|
7
8
|
*
|
|
8
9
|
* @param {HTMLElement} element - Element to set attributes on
|
|
9
10
|
* @param {Record<string, any>} attributes - Attributes to set
|
|
@@ -11,10 +12,39 @@
|
|
|
11
12
|
*/
|
|
12
13
|
export declare const setAttributes: (element: HTMLElement, attributes?: Record<string, any>) => HTMLElement;
|
|
13
14
|
/**
|
|
14
|
-
*
|
|
15
|
+
* Remove attributes from an element
|
|
16
|
+
* Standard for loop is fastest for array iteration
|
|
15
17
|
*
|
|
16
18
|
* @param {HTMLElement} element - Element to remove attributes from
|
|
17
19
|
* @param {string[]} attributes - Attributes to remove
|
|
18
20
|
* @returns {HTMLElement} The element for chaining
|
|
19
21
|
*/
|
|
20
22
|
export declare const removeAttributes: (element: HTMLElement, attributes?: string[]) => HTMLElement;
|
|
23
|
+
/**
|
|
24
|
+
* Batch attribute operations for better performance when setting many attributes
|
|
25
|
+
* Single pass through operations array for optimal performance
|
|
26
|
+
*
|
|
27
|
+
* @param {HTMLElement} element - Element to modify
|
|
28
|
+
* @param {Array<{action: "set" | "remove", key: string, value?: any}>} operations - Array of attribute operations
|
|
29
|
+
* @returns {HTMLElement} The element for chaining
|
|
30
|
+
*/
|
|
31
|
+
export declare const batchAttributes: (element: HTMLElement, operations: Array<{
|
|
32
|
+
action: "set" | "remove";
|
|
33
|
+
key: string;
|
|
34
|
+
value?: any;
|
|
35
|
+
}>) => HTMLElement;
|
|
36
|
+
/**
|
|
37
|
+
* Check if element has attribute
|
|
38
|
+
* @param element - Element to check
|
|
39
|
+
* @param attribute - Attribute name to check
|
|
40
|
+
* @returns True if element has the attribute
|
|
41
|
+
*/
|
|
42
|
+
export declare const hasAttribute: (element: HTMLElement, attribute: string) => boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Get attribute value with default
|
|
45
|
+
* @param element - Element to get attribute from
|
|
46
|
+
* @param attribute - Attribute name
|
|
47
|
+
* @param defaultValue - Default value if attribute doesn't exist
|
|
48
|
+
* @returns Attribute value or default
|
|
49
|
+
*/
|
|
50
|
+
export declare const getAttribute: (element: HTMLElement, attribute: string, defaultValue?: string) => string;
|
|
@@ -3,47 +3,49 @@
|
|
|
3
3
|
* @description DOM manipulation utilities optimized for performance
|
|
4
4
|
*/
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
6
|
+
* Normalize classes to array of unique strings with optimization and caching
|
|
7
7
|
* - String with space-separated classes
|
|
8
8
|
* - Array of strings
|
|
9
9
|
* - Mixed array of strings and space-separated classes
|
|
10
10
|
*
|
|
11
|
-
* @param classes - Classes to normalize
|
|
12
|
-
* @returns Array of unique, non-empty class names
|
|
11
|
+
* @param {...(string | string[])} classes - Classes to normalize
|
|
12
|
+
* @returns {string[]} Array of unique, non-empty class names
|
|
13
13
|
*/
|
|
14
14
|
export declare const normalizeClasses: (...classes: (string | string[])[]) => string[];
|
|
15
15
|
/**
|
|
16
|
-
*
|
|
16
|
+
* Add prefixed classes to element with optimizations
|
|
17
17
|
* Automatically adds prefix to classes that don't already have it
|
|
18
|
-
* Optimized for minimal
|
|
18
|
+
* Optimized for minimal DOM interactions and single-class scenarios
|
|
19
19
|
*
|
|
20
20
|
* @param {HTMLElement} element - Target element
|
|
21
21
|
* @param {...(string | string[])} classes - Classes to add
|
|
22
|
-
* @returns {HTMLElement} Modified element
|
|
22
|
+
* @returns {HTMLElement} Modified element for chaining
|
|
23
23
|
*/
|
|
24
24
|
export declare const addClass: (element: HTMLElement, ...classes: (string | string[])[]) => HTMLElement;
|
|
25
25
|
/**
|
|
26
|
-
*
|
|
27
|
-
* Handles
|
|
28
|
-
*
|
|
26
|
+
* Remove prefixed classes from element with optimizations
|
|
27
|
+
* Handles exact class names as specified with automatic prefixing
|
|
28
|
+
* Optimized for single-class scenarios and batch operations
|
|
29
29
|
*
|
|
30
30
|
* @param {HTMLElement} element - Target element
|
|
31
31
|
* @param {...(string | string[])} classes - Classes to remove
|
|
32
|
-
* @returns {HTMLElement} Modified element
|
|
32
|
+
* @returns {HTMLElement} Modified element for chaining
|
|
33
33
|
*/
|
|
34
34
|
export declare const removeClass: (element: HTMLElement, ...classes: (string | string[])[]) => HTMLElement;
|
|
35
35
|
/**
|
|
36
|
-
*
|
|
36
|
+
* Toggle prefixed classes on element with optimizations
|
|
37
37
|
* Automatically adds prefix to classes that don't already have it
|
|
38
|
+
* Optimized for single-class scenarios
|
|
38
39
|
*
|
|
39
40
|
* @param {HTMLElement} element - Target element
|
|
40
41
|
* @param {...(string | string[])} classes - Classes to toggle
|
|
41
|
-
* @returns {HTMLElement} Modified element
|
|
42
|
+
* @returns {HTMLElement} Modified element for chaining
|
|
42
43
|
*/
|
|
43
44
|
export declare const toggleClass: (element: HTMLElement, ...classes: (string | string[])[]) => HTMLElement;
|
|
44
45
|
/**
|
|
45
|
-
*
|
|
46
|
+
* Check if element has all specified prefixed classes with optimizations
|
|
46
47
|
* Automatically adds prefix to classes that don't already have it
|
|
48
|
+
* Returns true only if ALL specified classes are present
|
|
47
49
|
*
|
|
48
50
|
* @param {HTMLElement} element - Target element
|
|
49
51
|
* @param {...(string | string[])} classes - Classes to check
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
export type EventHandler = (event: Event) => void;
|
|
9
9
|
/**
|
|
10
|
-
* Event condition type
|
|
10
|
+
* Event condition type
|
|
11
11
|
*/
|
|
12
12
|
export type EventCondition = boolean | ((context: any, event: Event) => boolean);
|
|
13
13
|
/**
|
|
@@ -15,140 +15,88 @@ export type EventCondition = boolean | ((context: any, event: Event) => boolean)
|
|
|
15
15
|
*/
|
|
16
16
|
export type DOMElement = HTMLElement | SVGElement;
|
|
17
17
|
/**
|
|
18
|
-
* Options for element creation
|
|
18
|
+
* Options for element creation with comprehensive configuration
|
|
19
19
|
*/
|
|
20
20
|
export interface CreateElementOptions {
|
|
21
|
-
/**
|
|
22
|
-
* HTML tag name
|
|
23
|
-
*/
|
|
21
|
+
/** HTML tag name */
|
|
24
22
|
tag?: string;
|
|
25
|
-
/**
|
|
26
|
-
* Container to append element to
|
|
27
|
-
*/
|
|
23
|
+
/** Container to append element to */
|
|
28
24
|
container?: HTMLElement | null;
|
|
29
|
-
/**
|
|
30
|
-
* Inner HTML content
|
|
31
|
-
*/
|
|
25
|
+
/** Inner HTML content */
|
|
32
26
|
html?: string;
|
|
33
|
-
/**
|
|
34
|
-
* Text content
|
|
35
|
-
*/
|
|
27
|
+
/** Text content */
|
|
36
28
|
text?: string;
|
|
37
|
-
/**
|
|
38
|
-
* Element ID
|
|
39
|
-
*/
|
|
29
|
+
/** Element ID */
|
|
40
30
|
id?: string;
|
|
41
|
-
/**
|
|
42
|
-
* Element ariaLabel
|
|
43
|
-
*/
|
|
31
|
+
/** Element aria-label */
|
|
44
32
|
ariaLabel?: string;
|
|
45
|
-
/**
|
|
46
|
-
* Dataset attributes
|
|
47
|
-
*/
|
|
33
|
+
/** Dataset attributes */
|
|
48
34
|
data?: Record<string, string>;
|
|
49
|
-
/**
|
|
50
|
-
* CSS classes (will be automatically prefixed with 'mtrl-')
|
|
51
|
-
* Alias for 'className'
|
|
52
|
-
*/
|
|
35
|
+
/** CSS classes (will be automatically prefixed with 'mtrl-') - alias for className */
|
|
53
36
|
class?: string | string[];
|
|
54
|
-
/**
|
|
55
|
-
* CSS classes (will be automatically prefixed with 'mtrl-')
|
|
56
|
-
* Alias for 'class'
|
|
57
|
-
*/
|
|
37
|
+
/** CSS classes (will be automatically prefixed with 'mtrl-') - alias for class */
|
|
58
38
|
className?: string | string[];
|
|
59
|
-
/**
|
|
60
|
-
* CSS classes that will NOT be prefixed
|
|
61
|
-
* Added as-is to the element
|
|
62
|
-
*/
|
|
39
|
+
/** CSS classes that will NOT be prefixed - added as-is to the element */
|
|
63
40
|
rawClass?: string | string[];
|
|
64
|
-
/**
|
|
65
|
-
* HTML attributes
|
|
66
|
-
*/
|
|
41
|
+
/** HTML attributes */
|
|
67
42
|
attributes?: Record<string, any>;
|
|
68
|
-
/**
|
|
69
|
-
* Events to forward when component has emit method
|
|
70
|
-
*/
|
|
43
|
+
/** Events to forward when component has emit method */
|
|
71
44
|
forwardEvents?: Record<string, EventCondition>;
|
|
72
|
-
/**
|
|
73
|
-
* Callback after element creation
|
|
74
|
-
*/
|
|
45
|
+
/** Callback after element creation */
|
|
75
46
|
onCreate?: (element: HTMLElement, context?: any) => void;
|
|
76
|
-
/**
|
|
77
|
-
* Component context
|
|
78
|
-
*/
|
|
47
|
+
/** Component context */
|
|
79
48
|
context?: any;
|
|
80
|
-
/**
|
|
81
|
-
* Additional attributes
|
|
82
|
-
*/
|
|
49
|
+
/** Additional attributes via spread */
|
|
83
50
|
[key: string]: any;
|
|
84
51
|
}
|
|
85
52
|
/**
|
|
86
|
-
* Options for SVG element creation
|
|
53
|
+
* Options for SVG element creation
|
|
87
54
|
*/
|
|
88
55
|
export interface CreateSVGElementOptions extends Omit<CreateElementOptions, "container" | "onCreate"> {
|
|
89
|
-
/**
|
|
90
|
-
* Container to append element to
|
|
91
|
-
*/
|
|
92
56
|
container?: DOMElement | null;
|
|
93
|
-
/**
|
|
94
|
-
* Callback after element creation
|
|
95
|
-
*/
|
|
96
57
|
onCreate?: (element: SVGElement, context?: any) => void;
|
|
97
58
|
}
|
|
98
59
|
/**
|
|
99
|
-
* Event handler storage
|
|
60
|
+
* Event handler storage
|
|
100
61
|
*/
|
|
101
62
|
export interface EventHandlerStorage {
|
|
102
63
|
[eventName: string]: EventHandler;
|
|
103
64
|
}
|
|
104
65
|
/**
|
|
105
|
-
*
|
|
66
|
+
* Create an HTML element with comprehensive options and optimizations
|
|
67
|
+
* Fast paths for common scenarios, full feature support for complex cases
|
|
106
68
|
*
|
|
107
69
|
* @param {CreateElementOptions} options - Element creation options
|
|
108
70
|
* @returns {HTMLElement} Created HTML element
|
|
109
71
|
*/
|
|
110
72
|
export declare const createElement: (options?: CreateElementOptions) => HTMLElement;
|
|
111
73
|
/**
|
|
112
|
-
*
|
|
113
|
-
*
|
|
114
|
-
* @
|
|
115
|
-
* @returns {SVGElement} Created SVG element
|
|
74
|
+
* Create a pooled HTML element
|
|
75
|
+
* @param options - Element creation options
|
|
76
|
+
* @returns Created HTML element from pool
|
|
116
77
|
*/
|
|
117
|
-
export declare const
|
|
78
|
+
export declare const createElementPooled: (options?: CreateElementOptions) => HTMLElement;
|
|
118
79
|
/**
|
|
119
|
-
*
|
|
120
|
-
* @param element - Element to
|
|
80
|
+
* Release an element back to the pool
|
|
81
|
+
* @param element - Element to release
|
|
121
82
|
*/
|
|
122
|
-
export declare const
|
|
83
|
+
export declare const releaseElement: (element: HTMLElement) => void;
|
|
123
84
|
/**
|
|
124
|
-
*
|
|
125
|
-
* @param
|
|
126
|
-
* @returns
|
|
85
|
+
* Create an SVG element
|
|
86
|
+
* @param options - SVG element creation options
|
|
87
|
+
* @returns Created SVG element
|
|
127
88
|
*/
|
|
128
|
-
export declare const
|
|
129
|
-
/**
|
|
130
|
-
* Higher-order function to add classes to an element
|
|
131
|
-
* @param {...(string | string[])} classes - Classes to add
|
|
132
|
-
* @returns {(element: HTMLElement) => HTMLElement} Element transformer
|
|
133
|
-
*/
|
|
134
|
-
export declare const withClasses: (...classes: (string | string[])[]) => (element: HTMLElement) => HTMLElement;
|
|
89
|
+
export declare const createSVGElement: (options?: CreateSVGElementOptions) => SVGElement;
|
|
135
90
|
/**
|
|
136
|
-
*
|
|
137
|
-
* @param
|
|
138
|
-
* @returns {(element: HTMLElement) => HTMLElement} Element transformer
|
|
91
|
+
* Remove event handlers from an element
|
|
92
|
+
* @param element - Element to clean up
|
|
139
93
|
*/
|
|
140
|
-
export declare const
|
|
94
|
+
export declare const removeEventHandlers: (element: HTMLElement | SVGElement) => void;
|
|
141
95
|
declare global {
|
|
142
96
|
interface HTMLElement {
|
|
143
|
-
/**
|
|
144
|
-
* Storage for event handlers to enable cleanup
|
|
145
|
-
*/
|
|
146
97
|
__eventHandlers?: EventHandlerStorage;
|
|
147
98
|
}
|
|
148
99
|
interface SVGElement {
|
|
149
|
-
/**
|
|
150
|
-
* Storage for event handlers to enable cleanup
|
|
151
|
-
*/
|
|
152
100
|
__eventHandlers?: EventHandlerStorage;
|
|
153
101
|
}
|
|
154
102
|
}
|
package/dist/core/dom/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { createElement, createSVGElement } from
|
|
2
|
-
export type { CreateElementOptions } from
|
|
3
|
-
export { setAttributes, removeAttributes } from
|
|
4
|
-
export { addClass, removeClass, toggleClass, hasClass, normalizeClasses } from
|
|
5
|
-
export { createEventManager } from
|
|
6
|
-
export type { EventManager } from
|
|
1
|
+
export { createElement, createSVGElement } from "./create";
|
|
2
|
+
export type { CreateElementOptions } from "./create";
|
|
3
|
+
export { setAttributes, removeAttributes, batchAttributes, hasAttribute, getAttribute, } from "./attributes";
|
|
4
|
+
export { addClass, removeClass, toggleClass, hasClass, normalizeClasses, } from "./classes";
|
|
5
|
+
export { createEventManager } from "./events";
|
|
6
|
+
export type { EventManager } from "./events";
|
package/dist/core/dom/utils.d.ts
CHANGED
|
@@ -1,13 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
* Normalizes class names input by handling various formats:
|
|
3
|
-
* - String with space-separated classes
|
|
4
|
-
* - Array of strings
|
|
5
|
-
* - Mixed array of strings and space-separated classes
|
|
6
|
-
*
|
|
7
|
-
* @param classes - Classes to normalize
|
|
8
|
-
* @returns Array of unique, non-empty class names
|
|
9
|
-
*/
|
|
10
|
-
export declare const normalizeClasses: (...classes: (string | string[])[]) => string[];
|
|
1
|
+
export { normalizeClasses } from "./classes";
|
|
11
2
|
/**
|
|
12
3
|
* Creates a DOM element with attributes
|
|
13
4
|
*
|
package/dist/core/index.d.ts
CHANGED
|
@@ -7,25 +7,21 @@
|
|
|
7
7
|
*
|
|
8
8
|
* @packageDocumentation
|
|
9
9
|
*/
|
|
10
|
-
export * from
|
|
11
|
-
export * from
|
|
12
|
-
export { createEmitter } from
|
|
13
|
-
export type { Emitter, EventCallback } from
|
|
14
|
-
export { createStore, loggingMiddleware, deriveFiltered } from
|
|
15
|
-
export type { Store, StoreOptions, Selector, Computation, Updater } from
|
|
16
|
-
export { createLifecycle } from
|
|
17
|
-
export type { LifecycleManager, LifecycleManagers } from
|
|
18
|
-
export { createDisabled } from
|
|
19
|
-
export type { DisabledState } from
|
|
20
|
-
export { createEventManager as createStateEventManager } from
|
|
21
|
-
export type { EventManagerState } from
|
|
22
|
-
export * from
|
|
23
|
-
export
|
|
24
|
-
export
|
|
25
|
-
export {
|
|
26
|
-
export {
|
|
27
|
-
export {
|
|
28
|
-
export { createGestureManager } from './gestures';
|
|
29
|
-
export type { GestureManager, GestureConfig, GestureEvent, TapEvent, SwipeEvent, LongPressEvent, PinchEvent, RotateEvent, PanEvent, AnyGestureEvent, GestureHandler } from './gestures';
|
|
30
|
-
export type { ThemeConfig, ComponentConfig, ThemedComponentConfig, VariantComponentConfig, StateComponentConfig } from './config';
|
|
31
|
-
export type { NormalizedEvent } from './utils/mobile';
|
|
10
|
+
export * from "./compose";
|
|
11
|
+
export * from "./dom";
|
|
12
|
+
export { createEmitter } from "./state/emitter";
|
|
13
|
+
export type { Emitter, EventCallback } from "./state/emitter";
|
|
14
|
+
export { createStore, loggingMiddleware, deriveFiltered } from "./state/store";
|
|
15
|
+
export type { Store, StoreOptions, Selector, Computation, Updater, } from "./state/store";
|
|
16
|
+
export { createLifecycle } from "./state/lifecycle";
|
|
17
|
+
export type { LifecycleManager, LifecycleManagers } from "./state/lifecycle";
|
|
18
|
+
export { createDisabled } from "./state/disabled";
|
|
19
|
+
export type { DisabledState } from "./state/disabled";
|
|
20
|
+
export { createEventManager as createStateEventManager } from "./state/events";
|
|
21
|
+
export type { EventManagerState } from "./state/events";
|
|
22
|
+
export * from "./canvas";
|
|
23
|
+
export { PREFIX, COMPONENTS, STATES, classNames, getComponentClass, getModifierClass, getElementClass, } from "./config";
|
|
24
|
+
export { setComponentDefaults, getComponentDefaults, setGlobalDefaults, clearGlobalDefaults, type ComponentConfigMap, } from "./config/global";
|
|
25
|
+
export { when, classNames as joinClasses, isObject, byString, hasTouchSupport, normalizeEvent, throttle, debounce, once, getInheritedBackground, } from "./utils";
|
|
26
|
+
export type { ThemeConfig, ComponentConfig, ThemedComponentConfig, VariantComponentConfig, StateComponentConfig, } from "./config";
|
|
27
|
+
export type { NormalizedEvent } from "./utils/mobile";
|