@push.rocks/smartbrowser 4.0.2 → 4.2.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.
@@ -3,7 +3,7 @@
3
3
  */
4
4
  export const commitinfo = {
5
5
  name: '@push.rocks/smartbrowser',
6
- version: '4.0.2',
6
+ version: '4.2.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.2',
6
+ version: '4.2.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 inputProcessing;
46
+ private inFlightInputCommands;
47
+ private inFlightWheelCommands;
44
48
  private inputIdleResolvers;
45
49
  private inputResetTail;
46
50
  private inputResetPromise?;
47
51
  private inputResetCount;
48
- private inputOverflowRecoveryPending;
52
+ private pendingWheel?;
53
+ private wheelFlushSchedule?;
54
+ private wheelFrameElapsed;
49
55
  private pressedKeys;
50
56
  private pressedMouseButtons;
51
57
  private capturedPointerIds;
@@ -54,9 +60,17 @@ export declare class LiveBrowserCanvasRenderer {
54
60
  private viewportProcessing;
55
61
  private viewportProcessingPromise?;
56
62
  private resizeFence?;
63
+ private lastRequestedViewport?;
64
+ private resizeDebounceTimer?;
65
+ private pendingResizeSize?;
66
+ private readonly statistics;
57
67
  constructor(optionsArg: ILiveBrowserCanvasRendererOptions);
58
68
  get isRunning(): boolean;
59
69
  get isSuspended(): boolean;
70
+ /**
71
+ * Cumulative frame and input counters for this renderer instance across runs.
72
+ */
73
+ getStatistics(): ILiveBrowserCanvasRendererStatistics;
60
74
  start(): Promise<void>;
61
75
  stop(): Promise<void>;
62
76
  /**
@@ -83,6 +97,7 @@ export declare class LiveBrowserCanvasRenderer {
83
97
  private restoreCanvasAndFocus;
84
98
  private installDomListeners;
85
99
  private installResizeObserver;
100
+ private clearResizeDebounce;
86
101
  private handleEvent;
87
102
  private applyState;
88
103
  private isStateAheadOfDisplayedFrame;
@@ -90,12 +105,35 @@ export declare class LiveBrowserCanvasRenderer {
90
105
  private ensureFrameProcessor;
91
106
  private processFrameQueue;
92
107
  private processFrame;
108
+ /**
109
+ * Keeps only the newest decoded bitmap and presents it on the next animation frame.
110
+ */
111
+ private setPendingDraw;
112
+ private discardPendingDraw;
113
+ private drawPendingFrame;
114
+ /**
115
+ * Presents one decoded bitmap. The canvas backing store is reallocated only
116
+ * when the frame dimensions differ from the current intrinsic dimensions.
117
+ */
118
+ private paintBitmap;
93
119
  private canRenderFrame;
94
120
  private acknowledgeFrame;
95
121
  private handlePointerDown;
96
122
  private handlePointerMove;
97
123
  private handlePointerUp;
98
124
  private handleWheel;
125
+ /**
126
+ * Flushes accumulated wheel input at most once per animation frame and only
127
+ * while no wheel dispatch is in flight; the settling dispatch flushes the rest.
128
+ */
129
+ private tryFlushPendingWheel;
130
+ private scheduleWheelFlush;
131
+ /**
132
+ * Moves the accumulated wheel input into the command queue regardless of the
133
+ * frame gate so that later discrete commands stay behind it.
134
+ */
135
+ private flushPendingWheel;
136
+ private discardPendingWheel;
99
137
  private handleKey;
100
138
  private mapCoordinates;
101
139
  private getMouseButton;
@@ -103,10 +141,21 @@ export declare class LiveBrowserCanvasRenderer {
103
141
  private requireInputFrame;
104
142
  private isDisplayedFrameCurrent;
105
143
  private enqueueInputCommand;
144
+ /**
145
+ * Coalescable commands never exhaust capacity: they merge into a same-kind
146
+ * queue tail or evict the oldest queued coalescable command under pressure.
147
+ */
148
+ private enqueueCoalescableCommand;
149
+ private dropOldestCoalescableCommand;
150
+ /**
151
+ * Dispatches queued commands in order with a bounded number in flight. The
152
+ * remote session processes operations sequentially, so order is preserved.
153
+ */
106
154
  private processInputCommands;
155
+ private dispatchInputCommand;
156
+ private handleInputDispatchFailure;
107
157
  private waitForInputIdle;
108
158
  private scheduleInputReset;
109
- private recoverFromInputOverflow;
110
159
  private releasePressedInput;
111
160
  private tryInputRelease;
112
161
  private reportInputReleaseError;
@@ -115,9 +164,16 @@ export declare class LiveBrowserCanvasRenderer {
115
164
  private ensureViewportProcessor;
116
165
  private processViewportQueue;
117
166
  private updateInputAvailability;
167
+ private followNegotiatedViewport;
118
168
  private makeFocusTargetFocusable;
119
169
  private restoreFocusTarget;
120
170
  private clearCanvas;
171
+ /**
172
+ * Runs work on the next animation frame, or after one nominal frame period
173
+ * when the document is not visible and animation frames would not fire.
174
+ */
175
+ private scheduleAnimationFrame;
176
+ private cancelScheduledFrame;
121
177
  private callFrameRendered;
122
178
  private reportError;
123
179
  private requestSuspend;