@ue-too/board 0.9.4 → 0.10.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.
Files changed (57) hide show
  1. package/README.md +66 -2
  2. package/boardify/index.d.ts +280 -9
  3. package/camera/base.d.ts +364 -68
  4. package/camera/camera-edge-auto-input.d.ts +105 -0
  5. package/camera/camera-mux/animation-and-lock/animation-and-lock.d.ts +316 -14
  6. package/camera/camera-mux/animation-and-lock/index.d.ts +27 -0
  7. package/camera/camera-mux/animation-and-lock/pan-control-state-machine.d.ts +143 -60
  8. package/camera/camera-mux/animation-and-lock/rotation-control-state-machine.d.ts +143 -55
  9. package/camera/camera-mux/animation-and-lock/zoom-control-state-machine.d.ts +205 -58
  10. package/camera/camera-mux/index.d.ts +26 -0
  11. package/camera/camera-mux/interface.d.ts +161 -5
  12. package/camera/camera-mux/relay.d.ts +79 -16
  13. package/camera/camera-rig/camera-rig.d.ts +536 -94
  14. package/camera/camera-rig/index.d.ts +26 -1
  15. package/camera/camera-rig/pan-handler.d.ts +508 -48
  16. package/camera/camera-rig/rotation-handler.d.ts +353 -31
  17. package/camera/camera-rig/zoom-handler.d.ts +369 -32
  18. package/camera/default-camera.d.ts +173 -26
  19. package/camera/index.d.ts +20 -0
  20. package/camera/interface.d.ts +202 -2
  21. package/camera/update-publisher.d.ts +128 -38
  22. package/camera/utils/coordinate-conversion.d.ts +323 -26
  23. package/camera/utils/index.d.ts +22 -0
  24. package/camera/utils/matrix.d.ts +217 -14
  25. package/camera/utils/position.d.ts +249 -11
  26. package/camera/utils/rotation.d.ts +139 -9
  27. package/camera/utils/zoom.d.ts +72 -4
  28. package/index.d.ts +37 -0
  29. package/index.js +2 -4796
  30. package/index.js.map +39 -38
  31. package/input-interpretation/index.d.ts +29 -0
  32. package/input-interpretation/input-orchestrator.d.ts +197 -0
  33. package/input-interpretation/input-state-machine/index.d.ts +18 -0
  34. package/input-interpretation/input-state-machine/kmt-input-context.d.ts +191 -38
  35. package/input-interpretation/input-state-machine/kmt-input-state-machine.d.ts +201 -85
  36. package/input-interpretation/input-state-machine/touch-input-context.d.ts +76 -10
  37. package/input-interpretation/input-state-machine/touch-input-state-machine.d.ts +138 -17
  38. package/input-interpretation/raw-input-parser/index.d.ts +19 -0
  39. package/input-interpretation/raw-input-parser/vanilla-kmt-event-parser.d.ts +107 -21
  40. package/input-interpretation/raw-input-parser/vanilla-touch-event-parser.d.ts +71 -8
  41. package/input-interpretation/raw-input-publisher/index.d.ts +18 -0
  42. package/input-interpretation/raw-input-publisher/raw-input-publisher.d.ts +133 -37
  43. package/package.json +3 -3
  44. package/utils/canvas-position-dimension.d.ts +282 -1
  45. package/utils/coordinate-conversions/canvas-viewport.d.ts +79 -0
  46. package/utils/coordinate-conversions/viewport-world.d.ts +101 -0
  47. package/utils/coordinate-conversions/window-canvas.d.ts +90 -0
  48. package/utils/coorindate-conversion.d.ts +91 -0
  49. package/utils/drawing.d.ts +151 -3
  50. package/utils/index.d.ts +21 -0
  51. package/utils/observable.d.ts +179 -0
  52. package/utils/ruler.d.ts +36 -0
  53. package/utils/zoomlevel-adjustment.d.ts +144 -8
  54. package/camera/camera-rig/update-batcher/index.d.ts +0 -3
  55. package/camera/camera-rig/update-batcher/position-update-batcher.d.ts +0 -58
  56. package/camera/camera-rig/update-batcher/rotation-update-batcher.d.ts +0 -54
  57. package/camera/camera-rig/update-batcher/zoom-udpate-batcher.d.ts +0 -60
@@ -1,18 +1,72 @@
1
1
  import { EventReactions, EventGuards, Guard, TemplateState, TemplateStateMachine } from "@ue-too/being";
2
2
  import { TouchContext, TouchPoints } from "./touch-input-context";
3
+ import type { Point } from "@ue-too/math";
4
+ /**
5
+ * Possible states of the touch input state machine.
6
+ *
7
+ * @remarks
8
+ * State transitions:
9
+ * - **IDLE**: No touches active, or single touch (reserved for UI)
10
+ * - **PENDING**: Exactly two touches active, waiting for movement to determine gesture type
11
+ * - **IN_PROGRESS**: Two-finger gesture in progress (pan or zoom)
12
+ *
13
+ * The state machine only handles two-finger gestures. Single-finger touches are ignored
14
+ * to avoid interfering with UI interactions (button clicks, text selection, etc.).
15
+ *
16
+ * @category Input State Machine - Touch
17
+ */
3
18
  export type TouchStates = "IDLE" | "PENDING" | "IN_PROGRESS";
4
19
  /**
5
- * @description The touch event payload.
20
+ * Payload for touch events containing active touch points.
6
21
  *
7
- * @category Input State Machine
22
+ * @property points - Array of touch points involved in this event
23
+ *
24
+ * @category Input State Machine - Touch
8
25
  */
9
26
  export type TouchEventPayload = {
10
27
  points: TouchPoints[];
11
28
  };
12
29
  /**
13
- * @description The touch event mapping.
30
+ * Output events produced by the touch state machine for the orchestrator.
14
31
  *
15
- * @category Input State Machine
32
+ * @remarks
33
+ * Touch gestures are recognized from two-finger interactions:
34
+ *
35
+ * **Pan Gesture**:
36
+ * - Two fingers move in the same direction
37
+ * - Delta is calculated from the midpoint movement
38
+ * - Triggers when midpoint delta > distance delta
39
+ *
40
+ * **Zoom Gesture**:
41
+ * - Two fingers move toward/away from each other (pinch)
42
+ * - Delta is calculated from distance change between fingers
43
+ * - Anchor point is the midpoint between fingers
44
+ * - Triggers when distance delta > midpoint delta
45
+ *
46
+ * **Coordinate Spaces**:
47
+ * - Pan delta is in window pixels
48
+ * - Zoom anchor point is in viewport coordinates
49
+ *
50
+ * @category Input State Machine - Touch
51
+ */
52
+ export type TouchOutputEvent = {
53
+ type: "pan";
54
+ delta: Point;
55
+ } | {
56
+ type: "zoom";
57
+ delta: number;
58
+ anchorPointInViewPort: Point;
59
+ } | {
60
+ type: "none";
61
+ };
62
+ /**
63
+ * Event mapping for the touch input state machine.
64
+ *
65
+ * @remarks
66
+ * Maps touch event names to their payload types. The state machine handles
67
+ * the three core touch events: touchstart, touchmove, and touchend.
68
+ *
69
+ * @category Input State Machine - Touch
16
70
  */
17
71
  export type TouchEventMapping = {
18
72
  touchstart: TouchEventPayload;
@@ -20,15 +74,35 @@ export type TouchEventMapping = {
20
74
  touchend: TouchEventPayload;
21
75
  };
22
76
  /**
23
- * @description The idle state of the touch input state machine.
77
+ * Mapping of events to their output types.
24
78
  *
25
- * @category Input State Machine
79
+ * @remarks
80
+ * Only touchmove produces outputs (pan or zoom gestures).
81
+ * touchstart and touchend only manage state transitions.
82
+ *
83
+ * @category Input State Machine - Touch
26
84
  */
27
- export declare class IdleState extends TemplateState<TouchEventMapping, TouchContext, TouchStates> {
85
+ export type TouchInputEventOutputMapping = {
86
+ touchmove: TouchOutputEvent;
87
+ };
88
+ /**
89
+ * IDLE state - waiting for two-finger touch.
90
+ *
91
+ * @remarks
92
+ * This state handles touch lifecycle but only transitions to PENDING when exactly
93
+ * two touches are active. Single touches and three+ touches are ignored.
94
+ *
95
+ * **Guard Condition**:
96
+ * Transitions to PENDING only when `getCurrentTouchPointsCount() === 2`.
97
+ * This ensures the state machine only handles two-finger gestures.
98
+ *
99
+ * @category Input State Machine - Touch
100
+ */
101
+ export declare class IdleState extends TemplateState<TouchEventMapping, TouchContext, TouchStates, TouchInputEventOutputMapping> {
28
102
  private _eventReactions;
29
103
  protected _guards: Guard<TouchContext, "touchPointsCount">;
30
104
  protected _eventGuards: Partial<EventGuards<TouchEventMapping, TouchStates, TouchContext, typeof this._guards>>;
31
- get eventReactions(): EventReactions<TouchEventMapping, TouchContext, TouchStates>;
105
+ get eventReactions(): EventReactions<TouchEventMapping, TouchContext, TouchStates, TouchInputEventOutputMapping>;
32
106
  touchstart(context: TouchContext, payload: TouchEventPayload): void;
33
107
  touchend(context: TouchContext, payload: TouchEventPayload): void;
34
108
  }
@@ -37,28 +111,75 @@ export declare class IdleState extends TemplateState<TouchEventMapping, TouchCon
37
111
  *
38
112
  * @category Input State Machine
39
113
  */
40
- export declare class PendingState extends TemplateState<TouchEventMapping, TouchContext, TouchStates> {
114
+ export declare class PendingState extends TemplateState<TouchEventMapping, TouchContext, TouchStates, TouchInputEventOutputMapping> {
41
115
  private _eventReactions;
42
- get eventReactions(): EventReactions<TouchEventMapping, TouchContext, TouchStates>;
116
+ get eventReactions(): EventReactions<TouchEventMapping, TouchContext, TouchStates, TouchInputEventOutputMapping>;
43
117
  touchstart(context: TouchContext, payload: TouchEventPayload): void;
44
118
  touchend(context: TouchContext, payload: TouchEventPayload): void;
45
- touchmove(context: TouchContext, payload: TouchEventPayload): void;
119
+ touchmove(context: TouchContext, payload: TouchEventPayload): TouchOutputEvent;
46
120
  }
47
121
  /**
48
122
  * @description The in progress state of the touch input state machine.
49
123
  *
50
124
  * @category Input State Machine
51
125
  */
52
- export declare class InProgressState extends TemplateState<TouchEventMapping, TouchContext, TouchStates> {
126
+ export declare class InProgressState extends TemplateState<TouchEventMapping, TouchContext, TouchStates, TouchInputEventOutputMapping> {
53
127
  private _eventReactions;
54
- get eventReactions(): EventReactions<TouchEventMapping, TouchContext, TouchStates>;
55
- touchmove(context: TouchContext, payload: TouchEventPayload): void;
128
+ get eventReactions(): EventReactions<TouchEventMapping, TouchContext, TouchStates, TouchInputEventOutputMapping>;
129
+ touchmove(context: TouchContext, payload: TouchEventPayload): TouchOutputEvent;
56
130
  touchend(context: TouchContext, payload: TouchEventPayload): void;
57
131
  }
58
132
  /**
59
- * @description The touch input state machine.
133
+ * Type alias for the touch input state machine.
60
134
  *
61
- * @category Input State Machine
135
+ * @category Input State Machine - Touch
136
+ */
137
+ export type TouchInputStateMachine = TemplateStateMachine<TouchEventMapping, TouchContext, TouchStates, TouchInputEventOutputMapping>;
138
+ /**
139
+ * Creates a new touch input state machine for multi-touch gesture recognition.
140
+ *
141
+ * @param context - The context providing touch point tracking and canvas access
142
+ * @returns A configured state machine ready to process touch events
143
+ *
144
+ * @remarks
145
+ * This factory creates a state machine that recognizes two-finger pan and pinch-to-zoom gestures.
146
+ *
147
+ * **State Flow**:
148
+ * ```
149
+ * IDLE → (2 touches start) → PENDING → (touch move) → IN_PROGRESS
150
+ * IN_PROGRESS → (touch end) → IDLE
151
+ * ```
152
+ *
153
+ * **Gesture Recognition Algorithm**:
154
+ * 1. Wait for exactly 2 touches (IDLE → PENDING)
155
+ * 2. On first move, determine gesture type:
156
+ * - If distance change > midpoint change: ZOOM
157
+ * - If midpoint change > distance change: PAN
158
+ * 3. Continue producing pan/zoom outputs until touches end
159
+ *
160
+ * **Pan Gesture**:
161
+ * Delta = current midpoint - initial midpoint
162
+ *
163
+ * **Zoom Gesture**:
164
+ * Delta = (current distance - initial distance) * 0.005
165
+ * Anchor = midpoint in viewport coordinates
166
+ *
167
+ * @category Input State Machine - Touch
168
+ *
169
+ * @example
170
+ * ```typescript
171
+ * const canvasProxy = new CanvasProxy(canvasElement);
172
+ * const context = new TouchInputTracker(canvasProxy);
173
+ * const stateMachine = createTouchInputStateMachine(context);
174
+ *
175
+ * // Process a touch start event with 2 fingers
176
+ * const result = stateMachine.happens("touchstart", {
177
+ * points: [
178
+ * {ident: 0, x: 100, y: 200},
179
+ * {ident: 1, x: 300, y: 200}
180
+ * ]
181
+ * });
182
+ * console.log(result.nextState); // "PENDING"
183
+ * ```
62
184
  */
63
- export type TouchInputStateMachine = TemplateStateMachine<TouchEventMapping, TouchContext, TouchStates>;
64
185
  export declare function createTouchInputStateMachine(context: TouchContext): TouchInputStateMachine;
@@ -1,2 +1,21 @@
1
+ /**
2
+ * Raw input parser module exports.
3
+ *
4
+ * @remarks
5
+ * This module provides DOM event parsers that listen to browser events and convert them
6
+ * into input events for the state machines. Separate parsers handle KMT and touch input.
7
+ *
8
+ * ## Components
9
+ *
10
+ * - **{@link VanillaKMTEventParser}**: Parses keyboard, mouse, and trackpad DOM events
11
+ * - **{@link VanillaTouchEventParser}**: Parses touch DOM events
12
+ *
13
+ * Parsers attach to canvas elements and forward events to their respective state machines.
14
+ *
15
+ * @see {@link VanillaKMTEventParser} for KMT event parsing
16
+ * @see {@link VanillaTouchEventParser} for touch event parsing
17
+ *
18
+ * @module
19
+ */
1
20
  export * from "./vanilla-kmt-event-parser";
2
21
  export * from "./vanilla-touch-event-parser";
@@ -1,56 +1,96 @@
1
1
  import type { KmtInputStateMachine } from "../../input-interpretation/input-state-machine";
2
+ import type { InputOrchestrator } from "../input-orchestrator";
2
3
  /**
3
- * @category Event Parser
4
+ * Interface for KMT (Keyboard/Mouse/Trackpad) event parsers.
5
+ *
6
+ * @remarks
7
+ * Event parsers bridge the gap between DOM events and the state machine.
8
+ * They listen for raw DOM events, convert them to state machine events,
9
+ * and coordinate with the orchestrator for output processing.
10
+ *
11
+ * @category Raw Input Parser
4
12
  */
5
13
  export interface KMTEventParser {
14
+ /** Whether the parser is currently disabled */
6
15
  disabled: boolean;
16
+ /** Initializes event listeners */
7
17
  setUp(): void;
18
+ /** Removes event listeners and cleans up */
8
19
  tearDown(): void;
20
+ /** Attaches to a new canvas element */
9
21
  attach(canvas: HTMLCanvasElement): void;
22
+ /** The state machine that processes parsed events */
10
23
  stateMachine: KmtInputStateMachine;
24
+ /** The orchestrator that handles state machine outputs */
25
+ orchestrator: InputOrchestrator;
11
26
  }
12
27
  /**
13
- * @description The minimum pointer event.
14
- * This is for the interoperability between the vanilla javascript and the pixijs event system.
28
+ * Minimal pointer event interface for framework interoperability.
15
29
  *
16
- * @category Event Parser
30
+ * @remarks
31
+ * This subset of the DOM PointerEvent interface allows the parser to work with
32
+ * both vanilla JavaScript PointerEvents and framework-wrapped events (e.g., PixiJS).
33
+ *
34
+ * @category Raw Input Parser
17
35
  */
18
36
  export type MinimumPointerEvent = {
37
+ /** Mouse button number (0=left, 1=middle, 2=right) */
19
38
  button: number;
39
+ /** Pointer type ("mouse", "pen", "touch") */
20
40
  pointerType: string;
41
+ /** X coordinate in window space */
21
42
  clientX: number;
43
+ /** Y coordinate in window space */
22
44
  clientY: number;
45
+ /** Bitmask of currently pressed buttons */
23
46
  buttons: number;
24
47
  };
25
48
  /**
26
- * @description The minimum wheel event.
27
- * This is for the interoperability between the vanilla javascript and the pixijs event system.
49
+ * Minimal wheel event interface for framework interoperability.
50
+ *
51
+ * @remarks
52
+ * This subset of the DOM WheelEvent interface allows the parser to work with
53
+ * both vanilla JavaScript WheelEvents and framework-wrapped events.
28
54
  *
29
- * @category Event Parser
55
+ * @category Raw Input Parser
30
56
  */
31
57
  export type MinimumWheelEvent = {
58
+ /** Prevents default scroll behavior */
32
59
  preventDefault: () => void;
60
+ /** Horizontal scroll delta */
33
61
  deltaX: number;
62
+ /** Vertical scroll delta */
34
63
  deltaY: number;
64
+ /** Whether Ctrl key is pressed (for zoom) */
35
65
  ctrlKey: boolean;
66
+ /** X coordinate in window space */
36
67
  clientX: number;
68
+ /** Y coordinate in window space */
37
69
  clientY: number;
38
70
  };
39
71
  /**
40
- * @description The minimum keyboard event.
41
- * This is for the interoperability between the vanilla javascript and the pixijs event system.
72
+ * Minimal keyboard event interface for framework interoperability.
42
73
  *
43
- * @category Event Parser
74
+ * @remarks
75
+ * This subset of the DOM KeyboardEvent interface allows the parser to work with
76
+ * both vanilla JavaScript KeyboardEvents and framework-wrapped events.
77
+ *
78
+ * @category Raw Input Parser
44
79
  */
45
80
  export type MinimumKeyboardEvent = {
81
+ /** Prevents default keyboard behavior */
46
82
  preventDefault: () => void;
83
+ /** The key that was pressed */
47
84
  key: string;
48
85
  };
49
86
  /**
50
- * @description The event target with pointer events.
51
- * This is for the interoperability between the vanilla javascript and the pixijs event system.
87
+ * Minimal event target interface for framework interoperability.
88
+ *
89
+ * @remarks
90
+ * This interface allows the parser to attach event listeners to different
91
+ * types of event targets (HTMLElement, Canvas, PixiJS Container, etc.).
52
92
  *
53
- * @category Event Parser
93
+ * @category Raw Input Parser
54
94
  */
55
95
  export type EventTargetWithPointerEvents = {
56
96
  addEventListener: (type: string, listener: (event: any) => void, options?: {
@@ -59,29 +99,75 @@ export type EventTargetWithPointerEvents = {
59
99
  removeEventListener: (type: string, listener: (event: any) => void) => void;
60
100
  };
61
101
  /**
62
- * @description The vanilla keyboard mouse and trackpad(KMT) event parser.
63
- * This parser converts the raw events to events that can be used by the input state machine.
102
+ * DOM event parser for Keyboard/Mouse/Trackpad input.
103
+ *
104
+ * @remarks
105
+ * This parser converts raw DOM events into state machine events and coordinates with
106
+ * the orchestrator to process outputs. It serves as the entry point for all KMT input
107
+ * in the input interpretation pipeline.
108
+ *
109
+ * **Event Flow**:
110
+ * ```
111
+ * DOM Events → Parser → State Machine → Parser → Orchestrator → Camera/Observers
112
+ * ```
113
+ *
114
+ * **Responsibilities**:
115
+ * 1. Listen for DOM pointer, wheel, and keyboard events
116
+ * 2. Convert DOM events to state machine event format
117
+ * 3. Send events to the state machine
118
+ * 4. Forward state machine outputs to the orchestrator
119
+ *
120
+ * **Handled DOM Events**:
121
+ * - pointerdown/up/move (canvas-scoped)
122
+ * - wheel (canvas-scoped)
123
+ * - keydown/up (window-scoped for spacebar)
124
+ *
125
+ * **Keyboard Handling**:
126
+ * Keyboard events are only processed when `document.body` is the target,
127
+ * preventing interference with text inputs and other UI elements.
128
+ *
129
+ * The parser can be disabled to temporarily stop input processing (e.g., during
130
+ * modal dialogs or animations).
131
+ *
132
+ * @category Raw Input Parser
133
+ *
134
+ * @example
135
+ * ```typescript
136
+ * const canvasElement = document.getElementById("canvas");
137
+ * const stateMachine = createKmtInputStateMachine(context);
138
+ * const orchestrator = new InputOrchestrator(cameraMux, cameraRig, publisher);
139
+ * const parser = new VanillaKMTEventParser(stateMachine, orchestrator, canvasElement);
140
+ *
141
+ * parser.setUp(); // Starts listening for events
142
+ *
143
+ * // Later, to disable input temporarily
144
+ * parser.disabled = true;
64
145
  *
65
- * @category Event Parser
146
+ * // Cleanup when done
147
+ * parser.tearDown();
148
+ * ```
66
149
  */
67
150
  export declare class VanillaKMTEventParser implements KMTEventParser {
68
151
  private _disabled;
69
152
  private _stateMachine;
153
+ private _orchestrator;
70
154
  private _keyfirstPressed;
71
155
  private _abortController;
72
156
  private _canvas?;
73
- constructor(kmtInputStateMachine: KmtInputStateMachine, canvas?: HTMLCanvasElement);
157
+ constructor(kmtInputStateMachine: KmtInputStateMachine, orchestrator: InputOrchestrator, canvas?: HTMLCanvasElement | SVGSVGElement);
74
158
  get disabled(): boolean;
75
159
  set disabled(value: boolean);
76
160
  get stateMachine(): KmtInputStateMachine;
161
+ get orchestrator(): InputOrchestrator;
77
162
  addEventListeners(signal: AbortSignal): void;
78
163
  setUp(): void;
79
164
  tearDown(): void;
80
165
  bindFunctions(): void;
81
- pointerDownHandler(e: MinimumPointerEvent): void;
82
- pointerUpHandler(e: MinimumPointerEvent): void;
83
- pointerMoveHandler(e: MinimumPointerEvent): void;
84
- scrollHandler(e: MinimumWheelEvent): void;
166
+ private processEvent;
167
+ pointerDownHandler(e: PointerEvent): void;
168
+ pointerUpHandler(e: PointerEvent): void;
169
+ pointerMoveHandler(e: PointerEvent): void;
170
+ scrollHandler(e: WheelEvent): void;
85
171
  keypressHandler(e: KeyboardEvent): void;
86
172
  keyupHandler(e: KeyboardEvent): void;
87
173
  attach(canvas: HTMLCanvasElement): void;
@@ -1,24 +1,83 @@
1
1
  import { TouchInputStateMachine } from "../../input-interpretation/input-state-machine/touch-input-state-machine";
2
+ import type { InputOrchestrator } from "../input-orchestrator";
2
3
  /**
3
- * @description The touch event parser.
4
- * This is for the interoperability between the vanilla javascript and the pixijs event system.
4
+ * Interface for touch event parsers.
5
5
  *
6
- * @category Event Parser
6
+ * @remarks
7
+ * Touch event parsers bridge DOM TouchEvents and the touch state machine.
8
+ * They provide granular control over which gesture types are enabled.
9
+ *
10
+ * @category Raw Input Parser
7
11
  */
8
12
  export interface TouchEventParser {
13
+ /** Whether all touch input is disabled */
9
14
  disabled: boolean;
15
+ /** Whether pan gestures are disabled */
10
16
  panDisabled: boolean;
17
+ /** Whether zoom gestures are disabled */
11
18
  zoomDisabled: boolean;
19
+ /** Whether rotation gestures are disabled (currently unused) */
12
20
  rotateDisabled: boolean;
21
+ /** Initializes event listeners */
13
22
  setUp(): void;
23
+ /** Removes event listeners and cleans up */
14
24
  tearDown(): void;
25
+ /** Attaches to a new canvas element */
15
26
  attach(canvas: HTMLCanvasElement): void;
27
+ /** The state machine that processes parsed events */
28
+ stateMachine: TouchInputStateMachine;
29
+ /** The orchestrator that handles state machine outputs */
30
+ orchestrator: InputOrchestrator;
16
31
  }
17
32
  /**
18
- * @description The vanilla touch event parser.
19
- * This parser converts the raw events to events that can be used by the input state machine.
33
+ * DOM event parser for touch input.
34
+ *
35
+ * @remarks
36
+ * This parser converts raw DOM TouchEvents into state machine events and coordinates
37
+ * with the orchestrator to process outputs. It serves as the entry point for all touch
38
+ * input in the input interpretation pipeline.
39
+ *
40
+ * **Event Flow**:
41
+ * ```
42
+ * DOM TouchEvents → Parser → State Machine → Parser → Orchestrator → Camera/Observers
43
+ * ```
44
+ *
45
+ * **Responsibilities**:
46
+ * 1. Listen for DOM touch events (touchstart/move/end/cancel)
47
+ * 2. Extract touch point data (identifier, x, y)
48
+ * 3. Convert to state machine event format
49
+ * 4. Send events to the state machine
50
+ * 5. Forward state machine outputs to the orchestrator
51
+ *
52
+ * **Touch Point Extraction**:
53
+ * - touchstart/touchend: Uses `changedTouches` (only new/removed touches)
54
+ * - touchmove: Uses `targetTouches` (all touches on the canvas)
55
+ *
56
+ * **Gesture Control**:
57
+ * Individual gesture types (pan, zoom, rotate) can be disabled independently,
58
+ * though currently the state machine outputs are filtered by the orchestrator
59
+ * rather than the parser.
60
+ *
61
+ * The parser prevents default touch behavior to avoid browser scroll/zoom
62
+ * interfering with canvas gestures.
63
+ *
64
+ * @category Raw Input Parser
65
+ *
66
+ * @example
67
+ * ```typescript
68
+ * const canvasElement = document.getElementById("canvas");
69
+ * const stateMachine = createTouchInputStateMachine(context);
70
+ * const orchestrator = new InputOrchestrator(cameraMux, cameraRig, publisher);
71
+ * const parser = new VanillaTouchEventParser(stateMachine, orchestrator, canvasElement);
72
+ *
73
+ * parser.setUp(); // Starts listening for touch events
74
+ *
75
+ * // Disable zoom gestures temporarily
76
+ * parser.zoomDisabled = true;
20
77
  *
21
- * @category Event Parser
78
+ * // Cleanup when done
79
+ * parser.tearDown();
80
+ * ```
22
81
  */
23
82
  export declare class VanillaTouchEventParser implements TouchEventParser {
24
83
  private _canvas?;
@@ -26,9 +85,12 @@ export declare class VanillaTouchEventParser implements TouchEventParser {
26
85
  private _panDisabled;
27
86
  private _zoomDisabled;
28
87
  private _rotateDisabled;
29
- private touchSM;
88
+ private _stateMachine;
89
+ private _orchestrator;
30
90
  private _abortController;
31
- constructor(touchInputStateMachine: TouchInputStateMachine, canvas?: HTMLCanvasElement);
91
+ constructor(touchInputStateMachine: TouchInputStateMachine, orchestrator: InputOrchestrator, canvas?: HTMLCanvasElement);
92
+ get stateMachine(): TouchInputStateMachine;
93
+ get orchestrator(): InputOrchestrator;
32
94
  get touchStateMachine(): TouchInputStateMachine;
33
95
  bindListeners(): void;
34
96
  enableStrategy(): void;
@@ -42,6 +104,7 @@ export declare class VanillaTouchEventParser implements TouchEventParser {
42
104
  set zoomDisabled(zoomDisabled: boolean);
43
105
  get rotateDisabled(): boolean;
44
106
  set rotateDisabled(rotateDisabled: boolean);
107
+ private processEvent;
45
108
  touchstartHandler(e: TouchEvent): void;
46
109
  touchcancelHandler(e: TouchEvent): void;
47
110
  touchendHandler(e: TouchEvent): void;
@@ -1 +1,19 @@
1
+ /**
2
+ * Raw input publisher module exports.
3
+ *
4
+ * @remarks
5
+ * This module provides the event publishing system for raw user input events.
6
+ * The {@link RawUserInputPublisher} allows subscribing to input events (pan, zoom, rotate)
7
+ * at the application level, before they are processed into camera operations.
8
+ *
9
+ * ## Components
10
+ *
11
+ * - **{@link RawUserInputPublisher}**: Event publisher for raw input subscriptions
12
+ *
13
+ * Use this to listen to user input gestures without directly handling camera control.
14
+ *
15
+ * @see {@link RawUserInputPublisher} for the publisher implementation
16
+ *
17
+ * @module
18
+ */
1
19
  export * from "./raw-input-publisher";