@push.rocks/smartbrowser 4.0.1 → 4.1.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/dist_ts/00_commitinfo_data.js +1 -1
- package/dist_ts_web/00_commitinfo_data.js +1 -1
- package/dist_ts_web/classes.livebrowsercanvasrenderer.d.ts +59 -5
- package/dist_ts_web/classes.livebrowsercanvasrenderer.js +443 -126
- package/dist_ts_web/interfaces.livebrowsercanvas.d.ts +20 -0
- package/package.json +3 -3
- package/readme.hints.md +13 -9
- package/readme.md +9 -5
- package/ts/00_commitinfo_data.ts +1 -1
- package/ts_web/00_commitinfo_data.ts +1 -1
- package/ts_web/classes.livebrowsercanvasrenderer.ts +525 -137
- package/ts_web/interfaces.livebrowsercanvas.ts +21 -0
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
export const commitinfo = {
|
|
5
5
|
name: '@push.rocks/smartbrowser',
|
|
6
|
-
version: '4.0
|
|
6
|
+
version: '4.1.0',
|
|
7
7
|
description: 'A simplified Puppeteer wrapper for easy automation and testing tasks.'
|
|
8
8
|
};
|
|
9
9
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMDBfY29tbWl0aW5mb19kYXRhLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvMDBfY29tbWl0aW5mb19kYXRhLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOztHQUVHO0FBQ0gsTUFBTSxDQUFDLE1BQU0sVUFBVSxHQUFHO0lBQ3hCLElBQUksRUFBRSwwQkFBMEI7SUFDaEMsT0FBTyxFQUFFLE9BQU87SUFDaEIsV0FBVyxFQUFFLHVFQUF1RTtDQUNyRixDQUFBIn0=
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
export const commitinfo = {
|
|
5
5
|
name: '@push.rocks/smartbrowser',
|
|
6
|
-
version: '4.0
|
|
6
|
+
version: '4.1.0',
|
|
7
7
|
description: 'A simplified Puppeteer wrapper for easy automation and testing tasks.'
|
|
8
8
|
};
|
|
9
9
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMDBfY29tbWl0aW5mb19kYXRhLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHNfd2ViLzAwX2NvbW1pdGluZm9fZGF0YS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTs7R0FFRztBQUNILE1BQU0sQ0FBQyxNQUFNLFVBQVUsR0FBRztJQUN4QixJQUFJLEVBQUUsMEJBQTBCO0lBQ2hDLE9BQU8sRUFBRSxPQUFPO0lBQ2hCLFdBQVcsRUFBRSx1RUFBdUU7Q0FDckYsQ0FBQSJ9
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import type { ILiveBrowserCanvasRendererOptions } from './interfaces.livebrowsercanvas.js';
|
|
1
|
+
import type { ILiveBrowserCanvasRendererOptions, ILiveBrowserCanvasRendererStatistics } from './interfaces.livebrowsercanvas.js';
|
|
2
2
|
/**
|
|
3
3
|
* Renders transport-neutral live browser frames and maps DOM input back to the
|
|
4
4
|
* currently displayed SmartPuppeteer frame identity.
|
|
5
5
|
*/
|
|
6
6
|
export declare class LiveBrowserCanvasRenderer {
|
|
7
7
|
private readonly canvas;
|
|
8
|
-
private readonly canvasContext
|
|
8
|
+
private readonly canvasContext?;
|
|
9
|
+
private readonly bitmapContext?;
|
|
9
10
|
private readonly client;
|
|
10
11
|
private readonly focusTarget;
|
|
11
12
|
private readonly resizeTarget?;
|
|
@@ -36,16 +37,21 @@ export declare class LiveBrowserCanvasRenderer {
|
|
|
36
37
|
private highestFrameSequence;
|
|
37
38
|
private queuedFrame?;
|
|
38
39
|
private frameProcessingPromise?;
|
|
40
|
+
private pendingDraw?;
|
|
41
|
+
private drawSchedule?;
|
|
39
42
|
private acknowledgementPromises;
|
|
40
43
|
private rawDecodeSettlementPromises;
|
|
41
44
|
private inputBlocked;
|
|
42
45
|
private inputCommands;
|
|
43
|
-
private
|
|
46
|
+
private inFlightInputCommands;
|
|
47
|
+
private inFlightWheelCommands;
|
|
44
48
|
private inputIdleResolvers;
|
|
45
49
|
private inputResetTail;
|
|
46
50
|
private inputResetPromise?;
|
|
47
51
|
private inputResetCount;
|
|
48
|
-
private
|
|
52
|
+
private pendingWheel?;
|
|
53
|
+
private wheelFlushSchedule?;
|
|
54
|
+
private wheelFrameElapsed;
|
|
49
55
|
private pressedKeys;
|
|
50
56
|
private pressedMouseButtons;
|
|
51
57
|
private capturedPointerIds;
|
|
@@ -54,9 +60,16 @@ export declare class LiveBrowserCanvasRenderer {
|
|
|
54
60
|
private viewportProcessing;
|
|
55
61
|
private viewportProcessingPromise?;
|
|
56
62
|
private resizeFence?;
|
|
63
|
+
private resizeDebounceTimer?;
|
|
64
|
+
private pendingResizeSize?;
|
|
65
|
+
private readonly statistics;
|
|
57
66
|
constructor(optionsArg: ILiveBrowserCanvasRendererOptions);
|
|
58
67
|
get isRunning(): boolean;
|
|
59
68
|
get isSuspended(): boolean;
|
|
69
|
+
/**
|
|
70
|
+
* Cumulative frame and input counters for this renderer instance across runs.
|
|
71
|
+
*/
|
|
72
|
+
getStatistics(): ILiveBrowserCanvasRendererStatistics;
|
|
60
73
|
start(): Promise<void>;
|
|
61
74
|
stop(): Promise<void>;
|
|
62
75
|
/**
|
|
@@ -83,6 +96,7 @@ export declare class LiveBrowserCanvasRenderer {
|
|
|
83
96
|
private restoreCanvasAndFocus;
|
|
84
97
|
private installDomListeners;
|
|
85
98
|
private installResizeObserver;
|
|
99
|
+
private clearResizeDebounce;
|
|
86
100
|
private handleEvent;
|
|
87
101
|
private applyState;
|
|
88
102
|
private isStateAheadOfDisplayedFrame;
|
|
@@ -90,12 +104,35 @@ export declare class LiveBrowserCanvasRenderer {
|
|
|
90
104
|
private ensureFrameProcessor;
|
|
91
105
|
private processFrameQueue;
|
|
92
106
|
private processFrame;
|
|
107
|
+
/**
|
|
108
|
+
* Keeps only the newest decoded bitmap and presents it on the next animation frame.
|
|
109
|
+
*/
|
|
110
|
+
private setPendingDraw;
|
|
111
|
+
private discardPendingDraw;
|
|
112
|
+
private drawPendingFrame;
|
|
113
|
+
/**
|
|
114
|
+
* Presents one decoded bitmap. The canvas backing store is reallocated only
|
|
115
|
+
* when the frame dimensions differ from the current intrinsic dimensions.
|
|
116
|
+
*/
|
|
117
|
+
private paintBitmap;
|
|
93
118
|
private canRenderFrame;
|
|
94
119
|
private acknowledgeFrame;
|
|
95
120
|
private handlePointerDown;
|
|
96
121
|
private handlePointerMove;
|
|
97
122
|
private handlePointerUp;
|
|
98
123
|
private handleWheel;
|
|
124
|
+
/**
|
|
125
|
+
* Flushes accumulated wheel input at most once per animation frame and only
|
|
126
|
+
* while no wheel dispatch is in flight; the settling dispatch flushes the rest.
|
|
127
|
+
*/
|
|
128
|
+
private tryFlushPendingWheel;
|
|
129
|
+
private scheduleWheelFlush;
|
|
130
|
+
/**
|
|
131
|
+
* Moves the accumulated wheel input into the command queue regardless of the
|
|
132
|
+
* frame gate so that later discrete commands stay behind it.
|
|
133
|
+
*/
|
|
134
|
+
private flushPendingWheel;
|
|
135
|
+
private discardPendingWheel;
|
|
99
136
|
private handleKey;
|
|
100
137
|
private mapCoordinates;
|
|
101
138
|
private getMouseButton;
|
|
@@ -103,10 +140,21 @@ export declare class LiveBrowserCanvasRenderer {
|
|
|
103
140
|
private requireInputFrame;
|
|
104
141
|
private isDisplayedFrameCurrent;
|
|
105
142
|
private enqueueInputCommand;
|
|
143
|
+
/**
|
|
144
|
+
* Coalescable commands never exhaust capacity: they merge into a same-kind
|
|
145
|
+
* queue tail or evict the oldest queued coalescable command under pressure.
|
|
146
|
+
*/
|
|
147
|
+
private enqueueCoalescableCommand;
|
|
148
|
+
private dropOldestCoalescableCommand;
|
|
149
|
+
/**
|
|
150
|
+
* Dispatches queued commands in order with a bounded number in flight. The
|
|
151
|
+
* remote session processes operations sequentially, so order is preserved.
|
|
152
|
+
*/
|
|
106
153
|
private processInputCommands;
|
|
154
|
+
private dispatchInputCommand;
|
|
155
|
+
private handleInputDispatchFailure;
|
|
107
156
|
private waitForInputIdle;
|
|
108
157
|
private scheduleInputReset;
|
|
109
|
-
private recoverFromInputOverflow;
|
|
110
158
|
private releasePressedInput;
|
|
111
159
|
private tryInputRelease;
|
|
112
160
|
private reportInputReleaseError;
|
|
@@ -118,6 +166,12 @@ export declare class LiveBrowserCanvasRenderer {
|
|
|
118
166
|
private makeFocusTargetFocusable;
|
|
119
167
|
private restoreFocusTarget;
|
|
120
168
|
private clearCanvas;
|
|
169
|
+
/**
|
|
170
|
+
* Runs work on the next animation frame, or after one nominal frame period
|
|
171
|
+
* when the document is not visible and animation frames would not fire.
|
|
172
|
+
*/
|
|
173
|
+
private scheduleAnimationFrame;
|
|
174
|
+
private cancelScheduledFrame;
|
|
121
175
|
private callFrameRendered;
|
|
122
176
|
private reportError;
|
|
123
177
|
private requestSuspend;
|