mtrl 0.4.5 → 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/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/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 +35 -73
- package/dist/index.d.ts +1 -6
- package/dist/index.js +15 -15
- package/dist/index.js.map +35 -73
- package/dist/package.json +1 -1
- package/dist/styles.css +2 -2
- package/package.json +3 -2
- 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
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Configuration for icon feature
|
|
3
|
-
*/
|
|
4
|
-
export interface IconConfig {
|
|
5
|
-
/**
|
|
6
|
-
* Icon HTML content
|
|
7
|
-
*/
|
|
8
|
-
icon?: string;
|
|
9
|
-
/**
|
|
10
|
-
* Position of the icon ('start' or 'end')
|
|
11
|
-
*/
|
|
12
|
-
iconPosition?: 'start' | 'end';
|
|
13
|
-
/**
|
|
14
|
-
* Size variant for the icon
|
|
15
|
-
*/
|
|
16
|
-
iconSize?: string;
|
|
17
|
-
/**
|
|
18
|
-
* CSS class prefix
|
|
19
|
-
*/
|
|
20
|
-
prefix?: string;
|
|
21
|
-
/**
|
|
22
|
-
* Component name for class generation
|
|
23
|
-
*/
|
|
24
|
-
componentName?: string;
|
|
25
|
-
[key: string]: any;
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Enhances component schema with an icon element
|
|
29
|
-
* Unlike the traditional withIcon, this modifies the schema
|
|
30
|
-
* without creating actual DOM elements.
|
|
31
|
-
*
|
|
32
|
-
* @param config Configuration containing icon information
|
|
33
|
-
* @returns Component enhancer that adds icon to schema
|
|
34
|
-
*
|
|
35
|
-
* @example
|
|
36
|
-
* ```ts
|
|
37
|
-
* // Add icon to a component schema
|
|
38
|
-
* const component = pipe(
|
|
39
|
-
* createBase,
|
|
40
|
-
* withLayout(config),
|
|
41
|
-
* withIcon(config)
|
|
42
|
-
* )(config);
|
|
43
|
-
* ```
|
|
44
|
-
*/
|
|
45
|
-
export declare const withIcon: (config: IconConfig) => (component: any) => any;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export { withLayout } from './layout';
|
|
2
|
-
export { withIcon } from './icon';
|
|
3
|
-
export { withLabel } from './label';
|
|
4
|
-
export { withDom } from './dom';
|
|
5
|
-
export type { IconConfig } from './icon';
|
|
6
|
-
export type { LabelConfig } from './label';
|
|
7
|
-
export type { LayoutConfig } from './layout';
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Configuration for label feature
|
|
3
|
-
*/
|
|
4
|
-
export interface LabelConfig {
|
|
5
|
-
/**
|
|
6
|
-
* Label text content
|
|
7
|
-
*/
|
|
8
|
-
label?: string;
|
|
9
|
-
/**
|
|
10
|
-
* Position of the label ('start', 'end', 'top', or 'bottom')
|
|
11
|
-
*/
|
|
12
|
-
labelPosition?: "start" | "end" | "top" | "bottom";
|
|
13
|
-
/**
|
|
14
|
-
* CSS class prefix
|
|
15
|
-
*/
|
|
16
|
-
prefix?: string;
|
|
17
|
-
/**
|
|
18
|
-
* Component name for class generation
|
|
19
|
-
*/
|
|
20
|
-
componentName?: string;
|
|
21
|
-
/**
|
|
22
|
-
* ID for the input element this label is associated with
|
|
23
|
-
*/
|
|
24
|
-
id?: string;
|
|
25
|
-
/**
|
|
26
|
-
* Whether the labeled element is required
|
|
27
|
-
*/
|
|
28
|
-
required?: boolean;
|
|
29
|
-
[key: string]: any;
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* Enhances component schema with a label element
|
|
33
|
-
* Unlike the traditional withLabel, this modifies the schema
|
|
34
|
-
* without creating actual DOM elements.
|
|
35
|
-
*
|
|
36
|
-
* @param config Configuration containing label information
|
|
37
|
-
* @returns Component enhancer that adds label to schema
|
|
38
|
-
*
|
|
39
|
-
* @example
|
|
40
|
-
* ```ts
|
|
41
|
-
* // Add label to a component schema
|
|
42
|
-
* const component = pipe(
|
|
43
|
-
* createBase,
|
|
44
|
-
* withLayout(config),
|
|
45
|
-
* withLabel(config)
|
|
46
|
-
* )(config);
|
|
47
|
-
* ```
|
|
48
|
-
*/
|
|
49
|
-
export declare const withLabel: (config: LabelConfig) => (component: any) => any;
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Configuration that includes a component schema
|
|
3
|
-
*/
|
|
4
|
-
export interface LayoutConfig {
|
|
5
|
-
/**
|
|
6
|
-
* Component schema definition
|
|
7
|
-
*/
|
|
8
|
-
schema?: any;
|
|
9
|
-
[key: string]: any;
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* Adds schema definition to component without creating DOM
|
|
13
|
-
* This establishes the blueprint for the component's layout
|
|
14
|
-
* before materializing it with withDom
|
|
15
|
-
*
|
|
16
|
-
* @param config Configuration containing schema definition
|
|
17
|
-
* @returns Component enhancer with schema definition
|
|
18
|
-
*
|
|
19
|
-
* @example
|
|
20
|
-
* ```ts
|
|
21
|
-
* // Add layout to a component
|
|
22
|
-
* const component = pipe(
|
|
23
|
-
* createBase,
|
|
24
|
-
* withLayout(config),
|
|
25
|
-
* withIcon(config),
|
|
26
|
-
* withLabel(config),
|
|
27
|
-
* withDom()
|
|
28
|
-
* )(config);
|
|
29
|
-
* ```
|
|
30
|
-
*/
|
|
31
|
-
export declare const withLayout: (config: LayoutConfig) => (component: any) => any;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @module core/composition
|
|
3
|
-
* @description Composition utilities for creating components using the structure-based approach
|
|
4
|
-
*
|
|
5
|
-
* The composition module provides features that work with the structure definition
|
|
6
|
-
* mechanism. Unlike traditional features that directly modify the DOM, these
|
|
7
|
-
* features modify a layout schema that is later used to create DOM elements.
|
|
8
|
-
*
|
|
9
|
-
* This approach provides several advantages:
|
|
10
|
-
* - Clearer separation between layout and DOM creation
|
|
11
|
-
* - More predictable component creation process
|
|
12
|
-
* - Better support for server-side rendering
|
|
13
|
-
* - Enhanced testability
|
|
14
|
-
*/
|
|
15
|
-
export { withLayout, withDom, withIcon, withLabel, } from './features';
|
|
16
|
-
export type { IconConfig, LabelConfig } from './features';
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @module core/gestures
|
|
3
|
-
* @description Modular gesture recognition system for touch and mouse interactions
|
|
4
|
-
*/
|
|
5
|
-
export { createGestureManager, GESTURE_TYPES, SWIPE_DIRECTIONS } from './manager';
|
|
6
|
-
export { detectTap } from './tap';
|
|
7
|
-
export { detectSwipe } from './swipe';
|
|
8
|
-
export { detectLongPress } from './longpress';
|
|
9
|
-
export { detectPinch } from './pinch';
|
|
10
|
-
export { detectRotate } from './rotate';
|
|
11
|
-
export { detectPan } from './pan';
|
|
12
|
-
export type { GestureManager, GestureConfig, GestureEvent, TapEvent, SwipeEvent, LongPressEvent, PinchEvent, RotateEvent, PanEvent, AnyGestureEvent, GestureHandler, GestureState, GestureDetectionContext } from './types';
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @module core/gestures
|
|
3
|
-
* @description Long press gesture detection
|
|
4
|
-
*/
|
|
5
|
-
import { LongPressEvent, GestureDetectionContext } from './types';
|
|
6
|
-
/**
|
|
7
|
-
* Detect long press gesture
|
|
8
|
-
*
|
|
9
|
-
* This is slightly different from other gesture detectors as it sets up a timer
|
|
10
|
-
* and returns a callback function that will be triggered when the timer completes.
|
|
11
|
-
*
|
|
12
|
-
* @param context - Gesture detection context
|
|
13
|
-
* @param callback - Function to call when long press is detected
|
|
14
|
-
* @returns Cleanup function to cancel the long press detection
|
|
15
|
-
*/
|
|
16
|
-
export declare function detectLongPress(context: GestureDetectionContext, callback: (event: LongPressEvent) => void): () => void;
|
|
17
|
-
/**
|
|
18
|
-
* Check if movement would cancel a long press
|
|
19
|
-
*
|
|
20
|
-
* @param context - Gesture detection context
|
|
21
|
-
* @returns Whether the long press should be canceled
|
|
22
|
-
*/
|
|
23
|
-
export declare function shouldCancelLongPress(context: GestureDetectionContext): boolean;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @module core/gestures
|
|
3
|
-
* @description Gesture management system for handling touch and mouse interactions
|
|
4
|
-
*/
|
|
5
|
-
import { GestureConfig, GestureManager, GESTURE_TYPES, SWIPE_DIRECTIONS } from './types';
|
|
6
|
-
export { GESTURE_TYPES, SWIPE_DIRECTIONS };
|
|
7
|
-
/**
|
|
8
|
-
* Creates a gesture manager for handling touch and mouse interactions
|
|
9
|
-
*
|
|
10
|
-
* @param element - DOM element to attach gesture recognition to
|
|
11
|
-
* @param config - Configuration options
|
|
12
|
-
* @returns Gesture manager instance
|
|
13
|
-
*/
|
|
14
|
-
export declare const createGestureManager: (element: HTMLElement, config?: GestureConfig) => GestureManager;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @module core/gestures
|
|
3
|
-
* @description Pan gesture detection
|
|
4
|
-
*/
|
|
5
|
-
import { PanEvent, GestureDetectionContext } from "./types";
|
|
6
|
-
/**
|
|
7
|
-
* Detect pan gesture
|
|
8
|
-
*
|
|
9
|
-
* @param context - Gesture detection context
|
|
10
|
-
* @returns Pan event or null if no significant movement
|
|
11
|
-
*/
|
|
12
|
-
export declare function detectPan(context: GestureDetectionContext): PanEvent | null;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @module core/gestures
|
|
3
|
-
* @description Pinch gesture detection
|
|
4
|
-
*/
|
|
5
|
-
import { PinchEvent, GestureDetectionContext } from "./types";
|
|
6
|
-
/**
|
|
7
|
-
* Detect pinch gesture
|
|
8
|
-
*
|
|
9
|
-
* @param context - Gesture detection context
|
|
10
|
-
* @param touch1 - First touch point
|
|
11
|
-
* @param touch2 - Second touch point
|
|
12
|
-
* @returns Pinch event or null if no pinch detected
|
|
13
|
-
*/
|
|
14
|
-
export declare function detectPinch(context: GestureDetectionContext, touch1: Touch, touch2: Touch): PinchEvent | null;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @module core/gestures
|
|
3
|
-
* @description Rotate gesture detection
|
|
4
|
-
*/
|
|
5
|
-
import { RotateEvent, GestureDetectionContext } from "./types";
|
|
6
|
-
/**
|
|
7
|
-
* Detect rotate gesture
|
|
8
|
-
*
|
|
9
|
-
* @param context - Gesture detection context
|
|
10
|
-
* @param touch1 - First touch point
|
|
11
|
-
* @param touch2 - Second touch point
|
|
12
|
-
* @returns Rotate event or null if no rotation detected
|
|
13
|
-
*/
|
|
14
|
-
export declare function detectRotate(context: GestureDetectionContext, touch1: Touch, touch2: Touch): RotateEvent | null;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @module core/gestures
|
|
3
|
-
* @description Swipe gesture detection
|
|
4
|
-
*/
|
|
5
|
-
import { SwipeEvent, GestureDetectionContext, SWIPE_DIRECTIONS } from './types';
|
|
6
|
-
/**
|
|
7
|
-
* Determine swipe direction based on delta X and Y
|
|
8
|
-
*
|
|
9
|
-
* @param deltaX - Distance moved in X direction
|
|
10
|
-
* @param deltaY - Distance moved in Y direction
|
|
11
|
-
* @returns Direction of the swipe
|
|
12
|
-
*/
|
|
13
|
-
export declare function getSwipeDirection(deltaX: number, deltaY: number): SWIPE_DIRECTIONS;
|
|
14
|
-
/**
|
|
15
|
-
* Detect swipe gesture
|
|
16
|
-
*
|
|
17
|
-
* @param context - Gesture detection context
|
|
18
|
-
* @returns Swipe event or null if no swipe detected
|
|
19
|
-
*/
|
|
20
|
-
export declare function detectSwipe(context: GestureDetectionContext): SwipeEvent | null;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @module core/gestures
|
|
3
|
-
* @description Tap gesture detection
|
|
4
|
-
*/
|
|
5
|
-
import { TapEvent, GestureDetectionContext } from './types';
|
|
6
|
-
/**
|
|
7
|
-
* Detect tap gesture
|
|
8
|
-
*
|
|
9
|
-
* @param context - Gesture detection context
|
|
10
|
-
* @returns Tap event or null if no tap detected
|
|
11
|
-
*/
|
|
12
|
-
export declare function detectTap(context: GestureDetectionContext): TapEvent | null;
|
|
@@ -1,320 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @module core/gestures
|
|
3
|
-
* @description Type definitions for the gesture system
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* Types of gestures supported by the system
|
|
7
|
-
*/
|
|
8
|
-
export declare enum GESTURE_TYPES {
|
|
9
|
-
TAP = "tap",
|
|
10
|
-
SWIPE = "swipe",
|
|
11
|
-
SWIPE_LEFT = "swipeleft",
|
|
12
|
-
SWIPE_RIGHT = "swiperight",
|
|
13
|
-
SWIPE_UP = "swipeup",
|
|
14
|
-
SWIPE_DOWN = "swipedown",
|
|
15
|
-
PINCH = "pinch",
|
|
16
|
-
ROTATE = "rotate",
|
|
17
|
-
LONG_PRESS = "longpress",
|
|
18
|
-
PAN = "pan"
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Direction of swipe gestures
|
|
22
|
-
*/
|
|
23
|
-
export declare enum SWIPE_DIRECTIONS {
|
|
24
|
-
UP = "up",
|
|
25
|
-
DOWN = "down",
|
|
26
|
-
LEFT = "left",
|
|
27
|
-
RIGHT = "right"
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* Configuration options for gesture recognition
|
|
31
|
-
*/
|
|
32
|
-
export interface GestureConfig {
|
|
33
|
-
/**
|
|
34
|
-
* Minimum distance (in pixels) to recognize a swipe
|
|
35
|
-
* @default 30
|
|
36
|
-
*/
|
|
37
|
-
swipeThreshold?: number;
|
|
38
|
-
/**
|
|
39
|
-
* Maximum time (in ms) in which a swipe must be completed
|
|
40
|
-
* @default 300
|
|
41
|
-
*/
|
|
42
|
-
swipeTimeThreshold?: number;
|
|
43
|
-
/**
|
|
44
|
-
* Time (in ms) to recognize a long press
|
|
45
|
-
* @default 500
|
|
46
|
-
*/
|
|
47
|
-
longPressTime?: number;
|
|
48
|
-
/**
|
|
49
|
-
* Distance threshold (in pixels) for tap recognition
|
|
50
|
-
* @default 10
|
|
51
|
-
*/
|
|
52
|
-
tapDistanceThreshold?: number;
|
|
53
|
-
/**
|
|
54
|
-
* Whether to prevent default behaviors on touch events
|
|
55
|
-
* @default true
|
|
56
|
-
*/
|
|
57
|
-
preventDefault?: boolean;
|
|
58
|
-
/**
|
|
59
|
-
* Whether to stop event propagation
|
|
60
|
-
* @default false
|
|
61
|
-
*/
|
|
62
|
-
stopPropagation?: boolean;
|
|
63
|
-
[key: string]: any;
|
|
64
|
-
}
|
|
65
|
-
/**
|
|
66
|
-
* Base gesture event data
|
|
67
|
-
*/
|
|
68
|
-
export interface GestureEvent {
|
|
69
|
-
/**
|
|
70
|
-
* Type of the gesture
|
|
71
|
-
*/
|
|
72
|
-
type: string;
|
|
73
|
-
/**
|
|
74
|
-
* Original DOM event
|
|
75
|
-
*/
|
|
76
|
-
originalEvent: Event;
|
|
77
|
-
/**
|
|
78
|
-
* Element the gesture was triggered on
|
|
79
|
-
*/
|
|
80
|
-
target: EventTarget;
|
|
81
|
-
/**
|
|
82
|
-
* Timestamp when the gesture started
|
|
83
|
-
*/
|
|
84
|
-
startTime: number;
|
|
85
|
-
/**
|
|
86
|
-
* Timestamp when the gesture ended
|
|
87
|
-
*/
|
|
88
|
-
endTime: number;
|
|
89
|
-
/**
|
|
90
|
-
* Gesture duration in milliseconds
|
|
91
|
-
*/
|
|
92
|
-
duration: number;
|
|
93
|
-
/**
|
|
94
|
-
* Whether default behavior was prevented
|
|
95
|
-
*/
|
|
96
|
-
defaultPrevented: boolean;
|
|
97
|
-
/**
|
|
98
|
-
* Prevent default behavior
|
|
99
|
-
*/
|
|
100
|
-
preventDefault: () => void;
|
|
101
|
-
/**
|
|
102
|
-
* Stop event propagation
|
|
103
|
-
*/
|
|
104
|
-
stopPropagation: () => void;
|
|
105
|
-
}
|
|
106
|
-
/**
|
|
107
|
-
* Tap gesture event data
|
|
108
|
-
*/
|
|
109
|
-
export interface TapEvent extends GestureEvent {
|
|
110
|
-
type: 'tap';
|
|
111
|
-
/**
|
|
112
|
-
* Number of taps (for double tap detection)
|
|
113
|
-
*/
|
|
114
|
-
count: number;
|
|
115
|
-
/**
|
|
116
|
-
* X position of the tap
|
|
117
|
-
*/
|
|
118
|
-
x: number;
|
|
119
|
-
/**
|
|
120
|
-
* Y position of the tap
|
|
121
|
-
*/
|
|
122
|
-
y: number;
|
|
123
|
-
}
|
|
124
|
-
/**
|
|
125
|
-
* Swipe gesture event data
|
|
126
|
-
*/
|
|
127
|
-
export interface SwipeEvent extends GestureEvent {
|
|
128
|
-
type: 'swipe' | 'swipeleft' | 'swiperight' | 'swipeup' | 'swipedown';
|
|
129
|
-
/**
|
|
130
|
-
* Direction of the swipe
|
|
131
|
-
*/
|
|
132
|
-
direction: 'up' | 'down' | 'left' | 'right';
|
|
133
|
-
/**
|
|
134
|
-
* Distance swiped in the X direction
|
|
135
|
-
*/
|
|
136
|
-
deltaX: number;
|
|
137
|
-
/**
|
|
138
|
-
* Distance swiped in the Y direction
|
|
139
|
-
*/
|
|
140
|
-
deltaY: number;
|
|
141
|
-
/**
|
|
142
|
-
* Total distance swiped
|
|
143
|
-
*/
|
|
144
|
-
distance: number;
|
|
145
|
-
/**
|
|
146
|
-
* Velocity of the swipe in pixels per millisecond
|
|
147
|
-
*/
|
|
148
|
-
velocity: number;
|
|
149
|
-
/**
|
|
150
|
-
* Start X position
|
|
151
|
-
*/
|
|
152
|
-
startX: number;
|
|
153
|
-
/**
|
|
154
|
-
* Start Y position
|
|
155
|
-
*/
|
|
156
|
-
startY: number;
|
|
157
|
-
/**
|
|
158
|
-
* End X position
|
|
159
|
-
*/
|
|
160
|
-
endX: number;
|
|
161
|
-
/**
|
|
162
|
-
* End Y position
|
|
163
|
-
*/
|
|
164
|
-
endY: number;
|
|
165
|
-
}
|
|
166
|
-
/**
|
|
167
|
-
* Long press gesture event data
|
|
168
|
-
*/
|
|
169
|
-
export interface LongPressEvent extends GestureEvent {
|
|
170
|
-
type: 'longpress';
|
|
171
|
-
/**
|
|
172
|
-
* X position of the long press
|
|
173
|
-
*/
|
|
174
|
-
x: number;
|
|
175
|
-
/**
|
|
176
|
-
* Y position of the long press
|
|
177
|
-
*/
|
|
178
|
-
y: number;
|
|
179
|
-
}
|
|
180
|
-
/**
|
|
181
|
-
* Pinch gesture event data
|
|
182
|
-
*/
|
|
183
|
-
export interface PinchEvent extends GestureEvent {
|
|
184
|
-
type: 'pinch';
|
|
185
|
-
/**
|
|
186
|
-
* Scale factor of the pinch (>1 for zoom in, <1 for zoom out)
|
|
187
|
-
*/
|
|
188
|
-
scale: number;
|
|
189
|
-
/**
|
|
190
|
-
* Center X position of the pinch
|
|
191
|
-
*/
|
|
192
|
-
centerX: number;
|
|
193
|
-
/**
|
|
194
|
-
* Center Y position of the pinch
|
|
195
|
-
*/
|
|
196
|
-
centerY: number;
|
|
197
|
-
}
|
|
198
|
-
/**
|
|
199
|
-
* Rotate gesture event data
|
|
200
|
-
*/
|
|
201
|
-
export interface RotateEvent extends GestureEvent {
|
|
202
|
-
type: 'rotate';
|
|
203
|
-
/**
|
|
204
|
-
* Rotation angle in degrees
|
|
205
|
-
*/
|
|
206
|
-
rotation: number;
|
|
207
|
-
/**
|
|
208
|
-
* Center X position of the rotation
|
|
209
|
-
*/
|
|
210
|
-
centerX: number;
|
|
211
|
-
/**
|
|
212
|
-
* Center Y position of the rotation
|
|
213
|
-
*/
|
|
214
|
-
centerY: number;
|
|
215
|
-
}
|
|
216
|
-
/**
|
|
217
|
-
* Pan gesture event data
|
|
218
|
-
*/
|
|
219
|
-
export interface PanEvent extends GestureEvent {
|
|
220
|
-
type: 'pan';
|
|
221
|
-
/**
|
|
222
|
-
* Distance panned in the X direction
|
|
223
|
-
*/
|
|
224
|
-
deltaX: number;
|
|
225
|
-
/**
|
|
226
|
-
* Distance panned in the Y direction
|
|
227
|
-
*/
|
|
228
|
-
deltaY: number;
|
|
229
|
-
/**
|
|
230
|
-
* Start X position
|
|
231
|
-
*/
|
|
232
|
-
startX: number;
|
|
233
|
-
/**
|
|
234
|
-
* Start Y position
|
|
235
|
-
*/
|
|
236
|
-
startY: number;
|
|
237
|
-
/**
|
|
238
|
-
* Current X position
|
|
239
|
-
*/
|
|
240
|
-
currentX: number;
|
|
241
|
-
/**
|
|
242
|
-
* Current Y position
|
|
243
|
-
*/
|
|
244
|
-
currentY: number;
|
|
245
|
-
}
|
|
246
|
-
/**
|
|
247
|
-
* Union type of all gesture events
|
|
248
|
-
*/
|
|
249
|
-
export type AnyGestureEvent = TapEvent | SwipeEvent | LongPressEvent | PinchEvent | RotateEvent | PanEvent;
|
|
250
|
-
/**
|
|
251
|
-
* Handler for gesture events
|
|
252
|
-
*/
|
|
253
|
-
export type GestureHandler = (event: AnyGestureEvent) => void;
|
|
254
|
-
/**
|
|
255
|
-
* Gesture state for tracking touch interactions
|
|
256
|
-
*/
|
|
257
|
-
export interface GestureState {
|
|
258
|
-
active: boolean;
|
|
259
|
-
startTime: number;
|
|
260
|
-
startX: number;
|
|
261
|
-
startY: number;
|
|
262
|
-
lastX: number;
|
|
263
|
-
lastY: number;
|
|
264
|
-
currentX: number;
|
|
265
|
-
currentY: number;
|
|
266
|
-
touchCount: number;
|
|
267
|
-
longPressTimer: number | null;
|
|
268
|
-
startDistance: number;
|
|
269
|
-
startAngle: number;
|
|
270
|
-
lastTapTime: number;
|
|
271
|
-
tapCount: number;
|
|
272
|
-
target: EventTarget | null;
|
|
273
|
-
}
|
|
274
|
-
/**
|
|
275
|
-
* Context for gesture detection
|
|
276
|
-
*/
|
|
277
|
-
export interface GestureDetectionContext {
|
|
278
|
-
state: GestureState;
|
|
279
|
-
options: Required<GestureConfig>;
|
|
280
|
-
originalEvent: Event;
|
|
281
|
-
}
|
|
282
|
-
/**
|
|
283
|
-
* Gesture manager interface
|
|
284
|
-
*/
|
|
285
|
-
export interface GestureManager {
|
|
286
|
-
/**
|
|
287
|
-
* Add an event listener for a gesture
|
|
288
|
-
* @param eventType - Gesture type
|
|
289
|
-
* @param handler - Event handler
|
|
290
|
-
* @returns Gesture manager for chaining
|
|
291
|
-
*/
|
|
292
|
-
on: (eventType: string, handler: GestureHandler) => GestureManager;
|
|
293
|
-
/**
|
|
294
|
-
* Remove an event listener for a gesture
|
|
295
|
-
* @param eventType - Gesture type
|
|
296
|
-
* @param handler - Event handler
|
|
297
|
-
* @returns Gesture manager for chaining
|
|
298
|
-
*/
|
|
299
|
-
off: (eventType: string, handler: GestureHandler) => GestureManager;
|
|
300
|
-
/**
|
|
301
|
-
* Check if a gesture is supported on the current device
|
|
302
|
-
* @param gestureType - Type of gesture to check
|
|
303
|
-
* @returns Whether the gesture is supported
|
|
304
|
-
*/
|
|
305
|
-
isSupported: (gestureType: string) => boolean;
|
|
306
|
-
/**
|
|
307
|
-
* Enable gesture recognition
|
|
308
|
-
* @returns Gesture manager for chaining
|
|
309
|
-
*/
|
|
310
|
-
enable: () => GestureManager;
|
|
311
|
-
/**
|
|
312
|
-
* Disable gesture recognition
|
|
313
|
-
* @returns Gesture manager for chaining
|
|
314
|
-
*/
|
|
315
|
-
disable: () => GestureManager;
|
|
316
|
-
/**
|
|
317
|
-
* Clean up event listeners
|
|
318
|
-
*/
|
|
319
|
-
destroy: () => void;
|
|
320
|
-
}
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @module core/gestures
|
|
3
|
-
* @description Utility functions for gesture detection
|
|
4
|
-
*/
|
|
5
|
-
import { GestureEvent, GestureState } from './types';
|
|
6
|
-
/**
|
|
7
|
-
* Calculate distance between two points
|
|
8
|
-
*
|
|
9
|
-
* @param x1 - X coordinate of first point
|
|
10
|
-
* @param y1 - Y coordinate of first point
|
|
11
|
-
* @param x2 - X coordinate of second point
|
|
12
|
-
* @param y2 - Y coordinate of second point
|
|
13
|
-
* @returns Distance between the points
|
|
14
|
-
*/
|
|
15
|
-
export declare function getDistance(x1: number, y1: number, x2: number, y2: number): number;
|
|
16
|
-
/**
|
|
17
|
-
* Calculate angle between two points in degrees (0-360)
|
|
18
|
-
*
|
|
19
|
-
* @param x1 - X coordinate of first point
|
|
20
|
-
* @param y1 - Y coordinate of first point
|
|
21
|
-
* @param x2 - X coordinate of second point
|
|
22
|
-
* @param y2 - Y coordinate of second point
|
|
23
|
-
* @returns Angle in degrees
|
|
24
|
-
*/
|
|
25
|
-
export declare function getAngle(x1: number, y1: number, x2: number, y2: number): number;
|
|
26
|
-
/**
|
|
27
|
-
* Create a base gesture event
|
|
28
|
-
*
|
|
29
|
-
* @param type - Type of gesture
|
|
30
|
-
* @param originalEvent - Original DOM event
|
|
31
|
-
* @param state - Current gesture state
|
|
32
|
-
* @returns Base gesture event object
|
|
33
|
-
*/
|
|
34
|
-
export declare function createGestureEvent(type: string, originalEvent: Event, state: GestureState): GestureEvent;
|
|
35
|
-
/**
|
|
36
|
-
* Detect if the device supports touch events
|
|
37
|
-
*
|
|
38
|
-
* @returns Whether touch is supported
|
|
39
|
-
*/
|
|
40
|
-
export declare function hasTouchSupport(): boolean;
|
|
41
|
-
/**
|
|
42
|
-
* Detect if the device supports pointer events
|
|
43
|
-
*
|
|
44
|
-
* @returns Whether pointer events are supported
|
|
45
|
-
*/
|
|
46
|
-
export declare function hasPointerSupport(): boolean;
|
|
47
|
-
/**
|
|
48
|
-
* Extract normalized touch coordinates from an event
|
|
49
|
-
* Works with mouse events, touch events and pointer events
|
|
50
|
-
*
|
|
51
|
-
* @param e - DOM event
|
|
52
|
-
* @returns Object with clientX and clientY coordinates
|
|
53
|
-
*/
|
|
54
|
-
export declare function getTouchCoordinates(e: MouseEvent | TouchEvent | PointerEvent): {
|
|
55
|
-
clientX: number;
|
|
56
|
-
clientY: number;
|
|
57
|
-
};
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @module core/layout
|
|
3
|
-
* @description Processor for array-based layout schemas
|
|
4
|
-
*/
|
|
5
|
-
import { LayoutResult, LayoutOptions } from "./types";
|
|
6
|
-
/**
|
|
7
|
-
* Type for schema items
|
|
8
|
-
*/
|
|
9
|
-
type SchemaItem = Function | string | Record<string, unknown> | SchemaItem[];
|
|
10
|
-
/**
|
|
11
|
-
* Processes an array-based layout definition
|
|
12
|
-
*
|
|
13
|
-
* @param schema - Array-based layout definition
|
|
14
|
-
* @param parentElement - Optional parent element to attach layout to
|
|
15
|
-
* @param level - Current recursion level
|
|
16
|
-
* @param options - Layout creation options
|
|
17
|
-
* @returns Layout result object
|
|
18
|
-
*/
|
|
19
|
-
export declare function processArraySchema(schema: SchemaItem[], parentElement?: HTMLElement | null, level?: number, options?: LayoutOptions): LayoutResult;
|
|
20
|
-
export {};
|