@push.rocks/smartbrowser 4.1.0 → 4.3.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.
@@ -0,0 +1,194 @@
1
+ import type { ILiveBrowserCanvasRendererOptions } from './interfaces.livebrowsercanvas.js';
2
+ import type { ILiveBrowserVideoRendererOptions, ILiveBrowserVideoRendererStatistics } from './interfaces.livebrowservideo.js';
3
+ /**
4
+ * Renders transport-neutral live browser frames and maps DOM input back to the
5
+ * currently displayed SmartPuppeteer frame identity.
6
+ */
7
+ export declare class LiveBrowserRenderer {
8
+ private readonly canvas;
9
+ private readonly videoReceiver?;
10
+ private readonly canvasContext?;
11
+ private readonly bitmapContext?;
12
+ private readonly client;
13
+ private readonly focusTarget;
14
+ private readonly resizeTarget?;
15
+ private readonly getDeviceScaleFactor;
16
+ private readonly operationTimeoutMs;
17
+ private readonly frameDecodeTimeoutMs;
18
+ private readonly onError?;
19
+ private readonly onFrameRendered?;
20
+ private readonly initialCanvasWidth;
21
+ private readonly initialCanvasHeight;
22
+ private lifecycleTail;
23
+ private runEpoch;
24
+ private running;
25
+ private suspended;
26
+ private stopping;
27
+ private interruptionRequested;
28
+ private runController?;
29
+ private operationControllers;
30
+ private acceptingFrames;
31
+ private state?;
32
+ private unsubscribe?;
33
+ private listenerController?;
34
+ private resizeObserver?;
35
+ private focusWasAdjusted;
36
+ private focusHadTabIndex;
37
+ private focusTabIndexValue;
38
+ private displayedFrame?;
39
+ private highestFrameSequence;
40
+ private queuedFrame?;
41
+ private frameProcessingPromise?;
42
+ private pendingDraw?;
43
+ private drawSchedule?;
44
+ private acknowledgementPromises;
45
+ private rawDecodeSettlementPromises;
46
+ private inputBlocked;
47
+ private inputCommands;
48
+ private inFlightInputCommands;
49
+ private inFlightWheelCommands;
50
+ private inputIdleResolvers;
51
+ private inputResetTail;
52
+ private inputResetPromise?;
53
+ private inputResetCount;
54
+ private pendingWheel?;
55
+ private wheelFlushSchedule?;
56
+ private wheelFrameElapsed;
57
+ private pressedKeys;
58
+ private pressedMouseButtons;
59
+ private capturedPointerIds;
60
+ private pendingViewport?;
61
+ private inFlightViewport?;
62
+ private viewportProcessing;
63
+ private viewportProcessingPromise?;
64
+ private resizeFence?;
65
+ private lastRequestedViewport?;
66
+ private resizeDebounceTimer?;
67
+ private pendingResizeSize?;
68
+ private readonly statistics;
69
+ constructor(optionsArg: ILiveBrowserCanvasRendererOptions | ILiveBrowserVideoRendererOptions);
70
+ get isRunning(): boolean;
71
+ get isSuspended(): boolean;
72
+ /**
73
+ * Cumulative frame and input counters for this renderer instance across runs.
74
+ */
75
+ getStatistics(): ILiveBrowserVideoRendererStatistics;
76
+ start(): Promise<void>;
77
+ stop(): Promise<void>;
78
+ /**
79
+ * Aborts the current transport generation without replaying input recovery.
80
+ */
81
+ suspend(): Promise<void>;
82
+ /**
83
+ * Starts a new transport generation that requires new state and a new frame.
84
+ */
85
+ resume(): Promise<void>;
86
+ /**
87
+ * Sends arbitrary committed text, including text produced by an external IME.
88
+ */
89
+ insertText(textArg: string): Promise<void>;
90
+ /**
91
+ * Reads the configured stable resize target and requests the corresponding
92
+ * remote CSS viewport. Intrinsic canvas dimensions are never used here.
93
+ */
94
+ syncViewport(): void;
95
+ private enqueueLifecycle;
96
+ private startRun;
97
+ private interruptRun;
98
+ private finishRun;
99
+ private restoreCanvasAndFocus;
100
+ private installDomListeners;
101
+ private installResizeObserver;
102
+ private clearResizeDebounce;
103
+ private handleEvent;
104
+ private applyState;
105
+ private presentVideo;
106
+ private isStateAheadOfDisplayedFrame;
107
+ private queueFrame;
108
+ private ensureFrameProcessor;
109
+ private processFrameQueue;
110
+ private processFrame;
111
+ /**
112
+ * Keeps only the newest decoded bitmap and presents it on the next animation frame.
113
+ */
114
+ private setPendingDraw;
115
+ private discardPendingDraw;
116
+ private drawPendingFrame;
117
+ /**
118
+ * Presents one decoded bitmap. The canvas backing store is reallocated only
119
+ * when the frame dimensions differ from the current intrinsic dimensions.
120
+ */
121
+ private paintBitmap;
122
+ private canRenderFrame;
123
+ private acknowledgeFrame;
124
+ private handlePointerDown;
125
+ private handlePointerMove;
126
+ private handlePointerUp;
127
+ private handleWheel;
128
+ /**
129
+ * Flushes accumulated wheel input at most once per animation frame and only
130
+ * while no wheel dispatch is in flight; the settling dispatch flushes the rest.
131
+ */
132
+ private tryFlushPendingWheel;
133
+ private scheduleWheelFlush;
134
+ /**
135
+ * Moves the accumulated wheel input into the command queue regardless of the
136
+ * frame gate so that later discrete commands stay behind it.
137
+ */
138
+ private flushPendingWheel;
139
+ private discardPendingWheel;
140
+ private handleKey;
141
+ private mapCoordinates;
142
+ private getMouseButton;
143
+ private getInputFrame;
144
+ private requireInputFrame;
145
+ private isDisplayedFrameCurrent;
146
+ private enqueueInputCommand;
147
+ /**
148
+ * Coalescable commands never exhaust capacity: they merge into a same-kind
149
+ * queue tail or evict the oldest queued coalescable command under pressure.
150
+ */
151
+ private enqueueCoalescableCommand;
152
+ private dropOldestCoalescableCommand;
153
+ /**
154
+ * Dispatches queued commands in order with a bounded number in flight. The
155
+ * remote session processes operations sequentially, so order is preserved.
156
+ */
157
+ private processInputCommands;
158
+ private dispatchInputCommand;
159
+ private handleInputDispatchFailure;
160
+ private waitForInputIdle;
161
+ private scheduleInputReset;
162
+ private releasePressedInput;
163
+ private tryInputRelease;
164
+ private reportInputReleaseError;
165
+ private queueViewport;
166
+ private normalizeGeneratedViewport;
167
+ private ensureViewportProcessor;
168
+ private processViewportQueue;
169
+ private updateInputAvailability;
170
+ private followNegotiatedViewport;
171
+ private makeFocusTargetFocusable;
172
+ private restoreFocusTarget;
173
+ private clearCanvas;
174
+ /**
175
+ * Runs work on the next animation frame, or after one nominal frame period
176
+ * when the document is not visible and animation frames would not fire.
177
+ */
178
+ private scheduleAnimationFrame;
179
+ private cancelScheduledFrame;
180
+ private callFrameRendered;
181
+ private reportError;
182
+ private requestSuspend;
183
+ private validateTimeout;
184
+ private runClientOperation;
185
+ private runAbortableOperation;
186
+ private decodeFrame;
187
+ private isRunActive;
188
+ private validateFrame;
189
+ private validateViewport;
190
+ private validateProtocolInteger;
191
+ private validateProtocolNumber;
192
+ private releasePointerCapture;
193
+ private releasePointerCaptures;
194
+ }