@ghia/native 0.0.0-stage → 0.11.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/LICENSE +201 -0
- package/browser.mjs +7 -0
- package/dist/aria.d.ts +72 -0
- package/dist/aria.d.ts.map +1 -0
- package/dist/aria.js +2 -0
- package/dist/aria.js.map +1 -0
- package/dist/automation/client.d.ts +243 -0
- package/dist/automation/client.d.ts.map +1 -0
- package/dist/automation/client.js +801 -0
- package/dist/automation/client.js.map +1 -0
- package/dist/automation/index.d.ts +5 -0
- package/dist/automation/index.d.ts.map +1 -0
- package/dist/automation/index.js +4 -0
- package/dist/automation/index.js.map +1 -0
- package/dist/automation/protocol.d.ts +309 -0
- package/dist/automation/protocol.d.ts.map +1 -0
- package/dist/automation/protocol.js +320 -0
- package/dist/automation/protocol.js.map +1 -0
- package/dist/blob-images.d.ts +32 -0
- package/dist/blob-images.d.ts.map +1 -0
- package/dist/blob-images.js +55 -0
- package/dist/blob-images.js.map +1 -0
- package/dist/bounds.d.ts +61 -0
- package/dist/bounds.d.ts.map +1 -0
- package/dist/bounds.js +85 -0
- package/dist/bounds.js.map +1 -0
- package/dist/clipboard-global.d.ts +11 -0
- package/dist/clipboard-global.d.ts.map +1 -0
- package/dist/clipboard-global.js +2 -0
- package/dist/clipboard-global.js.map +1 -0
- package/dist/clipboard.d.ts +19 -0
- package/dist/clipboard.d.ts.map +1 -0
- package/dist/clipboard.js +41 -0
- package/dist/clipboard.js.map +1 -0
- package/dist/cpu-throttle.d.ts +6 -0
- package/dist/cpu-throttle.d.ts.map +1 -0
- package/dist/cpu-throttle.js +42 -0
- package/dist/cpu-throttle.js.map +1 -0
- package/dist/events/data-transfer.d.ts +23 -0
- package/dist/events/data-transfer.d.ts.map +1 -0
- package/dist/events/data-transfer.js +97 -0
- package/dist/events/data-transfer.js.map +1 -0
- package/dist/events/dispatch.d.ts +144 -0
- package/dist/events/dispatch.d.ts.map +1 -0
- package/dist/events/dispatch.js +241 -0
- package/dist/events/dispatch.js.map +1 -0
- package/dist/events/drag.d.ts +21 -0
- package/dist/events/drag.d.ts.map +1 -0
- package/dist/events/drag.js +111 -0
- package/dist/events/drag.js.map +1 -0
- package/dist/events/event-props.d.ts +19 -0
- package/dist/events/event-props.d.ts.map +1 -0
- package/dist/events/event-props.js +104 -0
- package/dist/events/event-props.js.map +1 -0
- package/dist/events/keyboard-defaults.d.ts +18 -0
- package/dist/events/keyboard-defaults.d.ts.map +1 -0
- package/dist/events/keyboard-defaults.js +121 -0
- package/dist/events/keyboard-defaults.js.map +1 -0
- package/dist/events/listeners.d.ts +18 -0
- package/dist/events/listeners.d.ts.map +1 -0
- package/dist/events/listeners.js +49 -0
- package/dist/events/listeners.js.map +1 -0
- package/dist/events/route.d.ts +17 -0
- package/dist/events/route.d.ts.map +1 -0
- package/dist/events/route.js +36 -0
- package/dist/events/route.js.map +1 -0
- package/dist/events/types.d.ts +269 -0
- package/dist/events/types.d.ts.map +1 -0
- package/dist/events/types.js +2 -0
- package/dist/events/types.js.map +1 -0
- package/dist/events/window-target.d.ts +120 -0
- package/dist/events/window-target.d.ts.map +1 -0
- package/dist/events/window-target.js +311 -0
- package/dist/events/window-target.js.map +1 -0
- package/dist/eyedropper.d.ts +33 -0
- package/dist/eyedropper.d.ts.map +1 -0
- package/dist/eyedropper.js +66 -0
- package/dist/eyedropper.js.map +1 -0
- package/dist/focus.d.ts +18 -0
- package/dist/focus.d.ts.map +1 -0
- package/dist/focus.js +26 -0
- package/dist/focus.js.map +1 -0
- package/dist/fonts.d.ts +12 -0
- package/dist/fonts.d.ts.map +1 -0
- package/dist/fonts.js +17 -0
- package/dist/fonts.js.map +1 -0
- package/dist/forms.d.ts +10 -0
- package/dist/forms.d.ts.map +1 -0
- package/dist/forms.js +9 -0
- package/dist/forms.js.map +1 -0
- package/dist/host-runtime.d.ts +108 -0
- package/dist/host-runtime.d.ts.map +1 -0
- package/dist/host-runtime.js +213 -0
- package/dist/host-runtime.js.map +1 -0
- package/dist/host.d.ts +2403 -0
- package/dist/host.d.ts.map +1 -0
- package/dist/host.js +30 -0
- package/dist/host.js.map +1 -0
- package/dist/idle-gc.d.ts +36 -0
- package/dist/idle-gc.d.ts.map +1 -0
- package/dist/idle-gc.js +70 -0
- package/dist/idle-gc.js.map +1 -0
- package/dist/keyframes.d.ts +108 -0
- package/dist/keyframes.d.ts.map +1 -0
- package/dist/keyframes.js +107 -0
- package/dist/keyframes.js.map +1 -0
- package/dist/layout-animation.d.ts +38 -0
- package/dist/layout-animation.d.ts.map +1 -0
- package/dist/layout-animation.js +41 -0
- package/dist/layout-animation.js.map +1 -0
- package/dist/match-media.d.ts +62 -0
- package/dist/match-media.d.ts.map +1 -0
- package/dist/match-media.js +272 -0
- package/dist/match-media.js.map +1 -0
- package/dist/media-query.d.ts +21 -0
- package/dist/media-query.d.ts.map +1 -0
- package/dist/media-query.js +599 -0
- package/dist/media-query.js.map +1 -0
- package/dist/motion-bindings.d.ts +36 -0
- package/dist/motion-bindings.d.ts.map +1 -0
- package/dist/motion-bindings.js +107 -0
- package/dist/motion-bindings.js.map +1 -0
- package/dist/motion-config.d.ts +20 -0
- package/dist/motion-config.d.ts.map +1 -0
- package/dist/motion-config.js +51 -0
- package/dist/motion-config.js.map +1 -0
- package/dist/motion-span.d.ts +57 -0
- package/dist/motion-span.d.ts.map +1 -0
- package/dist/motion-span.js +150 -0
- package/dist/motion-span.js.map +1 -0
- package/dist/motion-value.d.ts +269 -0
- package/dist/motion-value.d.ts.map +1 -0
- package/dist/motion-value.js +941 -0
- package/dist/motion-value.js.map +1 -0
- package/dist/motion-variants.d.ts +190 -0
- package/dist/motion-variants.d.ts.map +1 -0
- package/dist/motion-variants.js +249 -0
- package/dist/motion-variants.js.map +1 -0
- package/dist/mutations.d.ts +65 -0
- package/dist/mutations.d.ts.map +1 -0
- package/dist/mutations.js +320 -0
- package/dist/mutations.js.map +1 -0
- package/dist/nativeview.d.ts +10 -0
- package/dist/nativeview.d.ts.map +1 -0
- package/dist/nativeview.js +92 -0
- package/dist/nativeview.js.map +1 -0
- package/dist/observers.d.ts +92 -0
- package/dist/observers.d.ts.map +1 -0
- package/dist/observers.js +579 -0
- package/dist/observers.js.map +1 -0
- package/dist/presence.d.ts +63 -0
- package/dist/presence.d.ts.map +1 -0
- package/dist/presence.js +54 -0
- package/dist/presence.js.map +1 -0
- package/dist/renderer-state.d.ts +155 -0
- package/dist/renderer-state.d.ts.map +1 -0
- package/dist/renderer-state.js +302 -0
- package/dist/renderer-state.js.map +1 -0
- package/dist/reorder.d.ts +63 -0
- package/dist/reorder.d.ts.map +1 -0
- package/dist/reorder.js +303 -0
- package/dist/reorder.js.map +1 -0
- package/dist/runtime.d.ts +23 -0
- package/dist/runtime.d.ts.map +1 -0
- package/dist/runtime.js +157 -0
- package/dist/runtime.js.map +1 -0
- package/dist/screen.d.ts +8 -0
- package/dist/screen.d.ts.map +1 -0
- package/dist/screen.js +16 -0
- package/dist/screen.js.map +1 -0
- package/dist/scroll.d.ts +79 -0
- package/dist/scroll.d.ts.map +1 -0
- package/dist/scroll.js +170 -0
- package/dist/scroll.js.map +1 -0
- package/dist/style-images.d.ts +20 -0
- package/dist/style-images.d.ts.map +1 -0
- package/dist/style-images.js +57 -0
- package/dist/style-images.js.map +1 -0
- package/dist/svg.d.ts +16 -0
- package/dist/svg.d.ts.map +1 -0
- package/dist/svg.js +119 -0
- package/dist/svg.js.map +1 -0
- package/dist/testing.d.ts +811 -0
- package/dist/testing.d.ts.map +1 -0
- package/dist/testing.js +1187 -0
- package/dist/testing.js.map +1 -0
- package/dist/text-match.d.ts +8 -0
- package/dist/text-match.d.ts.map +1 -0
- package/dist/text-match.js +10 -0
- package/dist/text-match.js.map +1 -0
- package/dist/text-selection.d.ts +34 -0
- package/dist/text-selection.d.ts.map +1 -0
- package/dist/text-selection.js +23 -0
- package/dist/text-selection.js.map +1 -0
- package/dist/universal-style.d.ts +22 -0
- package/dist/universal-style.d.ts.map +1 -0
- package/dist/universal-style.js +58 -0
- package/dist/universal-style.js.map +1 -0
- package/dist/web-animations.d.ts +300 -0
- package/dist/web-animations.d.ts.map +1 -0
- package/dist/web-animations.js +1032 -0
- package/dist/web-animations.js.map +1 -0
- package/dist/webview.d.ts +39 -0
- package/dist/webview.d.ts.map +1 -0
- package/dist/webview.js +26 -0
- package/dist/webview.js.map +1 -0
- package/gpuix-native.darwin-arm64.node +4 -0
- package/index.cjs +789 -0
- package/index.d.ts +2603 -0
- package/index.js +729 -0
- package/package.json +94 -3
- package/README.md +0 -3
|
@@ -0,0 +1,811 @@
|
|
|
1
|
+
import { type ElementWebAnimationInfo, type EventPayload, type MediaFeatures, type MotionValuePlayback, type PatchCounters, type WebAnimationEffectInfo, type WebAnimationInfo, type WebAnimationKeyframeInfo, type WebAnimationTimingUpdate, type WindowOptions } from "../index.js";
|
|
2
|
+
import type { DebugFrameOverlayMode, DebugFrameOverlayStats, ElementBounds, HighlightMatch, ImagePixelFormat, MotionValueHost, NativeRenderer, WindowKeyEventHandlers } from "./host.js";
|
|
3
|
+
import type { HostDropEffect } from "./events/types.js";
|
|
4
|
+
import { type WindowFontsOption } from "./fonts.js";
|
|
5
|
+
import { type SyncDispatchResult } from "./renderer-state.js";
|
|
6
|
+
export { applyMacCpuThrottleFromEnv, MAC_CPU_THROTTLES, readMacCpuThrottle, } from "./cpu-throttle.js";
|
|
7
|
+
export type { MacCpuThrottle } from "./cpu-throttle.js";
|
|
8
|
+
export interface BuildCounters {
|
|
9
|
+
elementsBuilt: number;
|
|
10
|
+
elementsSkipped: number;
|
|
11
|
+
styleDescClones: number;
|
|
12
|
+
inheritedClones: number;
|
|
13
|
+
retainableRoots: number;
|
|
14
|
+
retainableElements: number;
|
|
15
|
+
retainableElementsLarge: number;
|
|
16
|
+
retainMismatches: number;
|
|
17
|
+
unitsBuilt: number;
|
|
18
|
+
unitsOversized: number;
|
|
19
|
+
motionsSynced: number;
|
|
20
|
+
motionValuesSampled: number;
|
|
21
|
+
retainReasons: string;
|
|
22
|
+
}
|
|
23
|
+
export interface FrameWorkCounters {
|
|
24
|
+
prepainted: number;
|
|
25
|
+
culledPrepainted: number;
|
|
26
|
+
painted: number;
|
|
27
|
+
culledPainted: number;
|
|
28
|
+
paintedPrimitives: number;
|
|
29
|
+
replayedPrimitives: number;
|
|
30
|
+
boundsInserts: number;
|
|
31
|
+
rasterizedGlyphs: number;
|
|
32
|
+
dormantTicks: number;
|
|
33
|
+
}
|
|
34
|
+
export interface LayoutCounters {
|
|
35
|
+
nodesCreated: number;
|
|
36
|
+
nodesReused: number;
|
|
37
|
+
nodesRemoved: number;
|
|
38
|
+
stylesSet: number;
|
|
39
|
+
childrenSet: number;
|
|
40
|
+
passes: number;
|
|
41
|
+
measures: number;
|
|
42
|
+
nodesLaidOut: number;
|
|
43
|
+
nodesSized: number;
|
|
44
|
+
relationVisits: number;
|
|
45
|
+
shapes: number;
|
|
46
|
+
wrappedLayouts: number;
|
|
47
|
+
lineLayoutHits: number;
|
|
48
|
+
shapeCacheHits: number;
|
|
49
|
+
extentWalks: number;
|
|
50
|
+
overflowWalks: number;
|
|
51
|
+
unsnappedOverflowWalks: number;
|
|
52
|
+
}
|
|
53
|
+
/** What the page of a `<webview>` was asked to do. */
|
|
54
|
+
export interface WebviewCommand {
|
|
55
|
+
/** `loadURL`, `reload`, `stop`, `goBack`, `goForward`, `executeJavaScript` or
|
|
56
|
+
* `setFirstResponder`. */
|
|
57
|
+
name: string;
|
|
58
|
+
/** The URL, the code, or for `setFirstResponder` `"true"`, `"false"`, `"forward"` (Tab) or
|
|
59
|
+
* `"backward"` (Shift+Tab). */
|
|
60
|
+
argument?: string | null;
|
|
61
|
+
}
|
|
62
|
+
/** Where the last composed frame put the surface of a `<webview>`, in window pixels. */
|
|
63
|
+
export interface WebviewSurface {
|
|
64
|
+
/** Painted, and not clipped away entirely. */
|
|
65
|
+
visible: boolean;
|
|
66
|
+
/** The whole surface, uncut. */
|
|
67
|
+
x: number;
|
|
68
|
+
y: number;
|
|
69
|
+
width: number;
|
|
70
|
+
height: number;
|
|
71
|
+
/** What shows of it: the surface cut by the clip of the content around it. */
|
|
72
|
+
clipX: number;
|
|
73
|
+
clipY: number;
|
|
74
|
+
clipWidth: number;
|
|
75
|
+
clipHeight: number;
|
|
76
|
+
opacity: number;
|
|
77
|
+
cornerRadius: number;
|
|
78
|
+
/** The position among the layers of the frame, bottom to top. */
|
|
79
|
+
layer: number;
|
|
80
|
+
}
|
|
81
|
+
/** A layer of the last composed frame, bottom to top: the window's GPUI layer, native surfaces and
|
|
82
|
+
* the GPUI layers between and above them. */
|
|
83
|
+
export interface CompositionLayer {
|
|
84
|
+
kind: "gpui" | "native";
|
|
85
|
+
/** The window's own GPUI layer. */
|
|
86
|
+
isBase: boolean;
|
|
87
|
+
/** GPUI layers: how many primitives of the scene it draws. */
|
|
88
|
+
primitives: number;
|
|
89
|
+
/** Native layers: the element of its `<webview>`. */
|
|
90
|
+
webview?: number | null;
|
|
91
|
+
/** Native layers: the element of its `<nativeview>`. */
|
|
92
|
+
nativeview?: number | null;
|
|
93
|
+
visible: boolean;
|
|
94
|
+
}
|
|
95
|
+
export interface NativeviewRect {
|
|
96
|
+
x: number;
|
|
97
|
+
y: number;
|
|
98
|
+
width: number;
|
|
99
|
+
height: number;
|
|
100
|
+
}
|
|
101
|
+
/** Where the last composed frame put the native view of a `<nativeview>`, in window pixels. */
|
|
102
|
+
export interface NativeviewSurface {
|
|
103
|
+
/** The content view `onAttach` got, as a decimal string: the address of the `NSView` of the
|
|
104
|
+
* test renderer's offscreen window, a large number like `"516333569280"` that differs per run.
|
|
105
|
+
* Compare it with the `attach` handle, do not expect a fixed value. */
|
|
106
|
+
handle: string;
|
|
107
|
+
/** The whole surface: the padding box of the element. */
|
|
108
|
+
bounds: NativeviewRect;
|
|
109
|
+
/** What shows of it. For an element that does not clip it is the content mask around the
|
|
110
|
+
* element, which can be larger than `bounds`. */
|
|
111
|
+
clip: NativeviewRect;
|
|
112
|
+
opacity: number;
|
|
113
|
+
/** The radius the view is cut to: the inner radius of an element that clips, else 0. */
|
|
114
|
+
cornerRadius: number;
|
|
115
|
+
/** The view takes the pointer events over its box. */
|
|
116
|
+
capturesPointer: boolean;
|
|
117
|
+
}
|
|
118
|
+
/** A native surface made or dropped by a `<nativeview>`, in order. */
|
|
119
|
+
export interface NativeSurfaceEvent {
|
|
120
|
+
kind: "created" | "removed";
|
|
121
|
+
/** The content view of the surface, the `handle` of `onAttach`. */
|
|
122
|
+
handle: string;
|
|
123
|
+
}
|
|
124
|
+
/** The container view AppKit holds for a `<webview>` surface, in window points from the top
|
|
125
|
+
* left: the placement that was applied, not only recorded. */
|
|
126
|
+
export interface WebviewNativeView {
|
|
127
|
+
hidden: boolean;
|
|
128
|
+
x: number;
|
|
129
|
+
y: number;
|
|
130
|
+
width: number;
|
|
131
|
+
height: number;
|
|
132
|
+
/** The content view the page lives in, relative to the container: whole size, cut by it. */
|
|
133
|
+
contentX: number;
|
|
134
|
+
contentY: number;
|
|
135
|
+
contentWidth: number;
|
|
136
|
+
contentHeight: number;
|
|
137
|
+
opacity: number;
|
|
138
|
+
/** A corner radius is cut into it. */
|
|
139
|
+
masked: boolean;
|
|
140
|
+
}
|
|
141
|
+
export interface RetainedCounters {
|
|
142
|
+
hits: number;
|
|
143
|
+
replays: number;
|
|
144
|
+
lazyBuilds: number;
|
|
145
|
+
builds: number;
|
|
146
|
+
layoutFallbacks: number;
|
|
147
|
+
layoutSkips: number;
|
|
148
|
+
layoutReplays: number;
|
|
149
|
+
layoutBuilds: number;
|
|
150
|
+
layoutTranslations: number;
|
|
151
|
+
layoutRecords: number;
|
|
152
|
+
verified: number;
|
|
153
|
+
mismatches: number;
|
|
154
|
+
nonReusable: string;
|
|
155
|
+
relocations: number;
|
|
156
|
+
nonRelocatable: string;
|
|
157
|
+
relocationMisses: string;
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* The options a live window takes (`WindowOptions`), applied to the offscreen test window by
|
|
161
|
+
* the same translation, plus the fonts option and the test hooks below. The size defaults to
|
|
162
|
+
* 1280x800 and `focus` to false, since the window is offscreen and must not take the OS's
|
|
163
|
+
* keyboard. `fullscreen`, `appId`, `appName` and `layerShell` have no effect on it; the
|
|
164
|
+
* docs/reference.md's Testing section lists what each option does there.
|
|
165
|
+
*/
|
|
166
|
+
export interface TestRendererOptions extends WindowOptions, WindowFontsOption {
|
|
167
|
+
/**
|
|
168
|
+
* Device pixels per CSS px the offscreen test window opens with, `1` when unset (headless
|
|
169
|
+
* Chrome's own), whatever display the machine has. `TestRenderer` only: a live window takes
|
|
170
|
+
* its display's scale.
|
|
171
|
+
*/
|
|
172
|
+
scaleFactor?: number;
|
|
173
|
+
/** Framework scheduling boundary for events drained from native. */
|
|
174
|
+
dispatchEvent?: (event: EventPayload) => void;
|
|
175
|
+
/**
|
|
176
|
+
* Framework boundary for the events native waits on: `keydown` and `keyup`,
|
|
177
|
+
* which run inside the simulate call. Must return what the handlers decided.
|
|
178
|
+
*/
|
|
179
|
+
dispatchSyncEvent?: (event: EventPayload) => SyncDispatchResult;
|
|
180
|
+
/**
|
|
181
|
+
* Receives an error thrown by an event handler, as `onError` does for a live
|
|
182
|
+
* renderer, and the dispatch carries on with the remaining handlers. Without
|
|
183
|
+
* it the error is reported as uncaught (`reportError`), never thrown from the
|
|
184
|
+
* simulate call that delivered the event. A test that expects the error
|
|
185
|
+
* passes `onError`.
|
|
186
|
+
*/
|
|
187
|
+
onError?: (error: unknown) => void;
|
|
188
|
+
}
|
|
189
|
+
/** The motion a simulated mouse move reports, in logical pixels. */
|
|
190
|
+
/**
|
|
191
|
+
* One key an input method consumes, and what the input method then does with
|
|
192
|
+
* it. `key` is a press in the `simulateKeystrokes` grammar.
|
|
193
|
+
*/
|
|
194
|
+
export type CompositionStep =
|
|
195
|
+
/** The composition becomes `text`: `compositionstart` on the first, then `compositionupdate`. */
|
|
196
|
+
{
|
|
197
|
+
key: string;
|
|
198
|
+
action: "mark";
|
|
199
|
+
text: string;
|
|
200
|
+
}
|
|
201
|
+
/** The composition ends with `text` as the final text: `compositionend`. */
|
|
202
|
+
| {
|
|
203
|
+
key: string;
|
|
204
|
+
action: "commit";
|
|
205
|
+
text: string;
|
|
206
|
+
}
|
|
207
|
+
/** The composition ends with the text it has: `compositionend`. */
|
|
208
|
+
| {
|
|
209
|
+
key: string;
|
|
210
|
+
action: "unmark";
|
|
211
|
+
};
|
|
212
|
+
export interface MouseMovement {
|
|
213
|
+
x: number;
|
|
214
|
+
y: number;
|
|
215
|
+
}
|
|
216
|
+
/** Where a simulated wheel event sits in a gesture. A call that names none starts a
|
|
217
|
+
* gesture of its own; the scroller that took a gesture's first delta keeps the rest of
|
|
218
|
+
* it, so continue one with `"moved"`. */
|
|
219
|
+
export type ScrollGesturePhase = "started" | "moved" | "ended" | "cancelled";
|
|
220
|
+
export type TestWindowOptions = TestRendererOptions & WindowKeyEventHandlers;
|
|
221
|
+
/** Whether the native TestGpuixRenderer is available (for conditional test registration). */
|
|
222
|
+
export declare const hasNativeTestRenderer: boolean;
|
|
223
|
+
export interface TestElement {
|
|
224
|
+
id: number;
|
|
225
|
+
type: string;
|
|
226
|
+
style: Record<string, unknown>;
|
|
227
|
+
text: string | null;
|
|
228
|
+
events: Set<string>;
|
|
229
|
+
children: number[];
|
|
230
|
+
parentId: number | null;
|
|
231
|
+
testId?: string;
|
|
232
|
+
customProps?: Record<string, unknown>;
|
|
233
|
+
}
|
|
234
|
+
/** GPUI `debug_a11y_tree_json` dump. Node keys are ephemeral (`a`, `b`, …). */
|
|
235
|
+
export interface A11yTreeNode {
|
|
236
|
+
/** In device pixels from the window's content origin: clipped and off-screen
|
|
237
|
+
* nodes are in the tree, with the box they have. */
|
|
238
|
+
bounds?: {
|
|
239
|
+
x0: number;
|
|
240
|
+
y0: number;
|
|
241
|
+
x1: number;
|
|
242
|
+
y1: number;
|
|
243
|
+
};
|
|
244
|
+
aria?: {
|
|
245
|
+
role?: string;
|
|
246
|
+
label?: string;
|
|
247
|
+
description?: string;
|
|
248
|
+
value?: string;
|
|
249
|
+
author_id?: string;
|
|
250
|
+
keyboard_shortcut?: string;
|
|
251
|
+
placeholder?: string;
|
|
252
|
+
role_description?: string;
|
|
253
|
+
braille_label?: string;
|
|
254
|
+
braille_role_description?: string;
|
|
255
|
+
row_index_text?: string;
|
|
256
|
+
column_index_text?: string;
|
|
257
|
+
expanded?: boolean;
|
|
258
|
+
selected?: boolean;
|
|
259
|
+
toggled?: "False" | "True" | "Mixed";
|
|
260
|
+
hidden?: boolean;
|
|
261
|
+
disabled?: boolean;
|
|
262
|
+
required?: boolean;
|
|
263
|
+
read_only?: boolean;
|
|
264
|
+
multiselectable?: boolean;
|
|
265
|
+
busy?: boolean;
|
|
266
|
+
live_atomic?: boolean;
|
|
267
|
+
modal?: boolean;
|
|
268
|
+
invalid?: "True" | "Grammar" | "Spelling";
|
|
269
|
+
live?: "Off" | "Polite" | "Assertive";
|
|
270
|
+
aria_current?: string;
|
|
271
|
+
has_popup?: string;
|
|
272
|
+
orientation?: "Horizontal" | "Vertical";
|
|
273
|
+
sort_direction?: "Ascending" | "Descending" | "Other";
|
|
274
|
+
auto_complete?: "Inline" | "List" | "Both";
|
|
275
|
+
numeric_value?: number;
|
|
276
|
+
min_numeric_value?: number;
|
|
277
|
+
max_numeric_value?: number;
|
|
278
|
+
level?: number;
|
|
279
|
+
position_in_set?: number;
|
|
280
|
+
size_of_set?: number;
|
|
281
|
+
row_index?: number;
|
|
282
|
+
column_index?: number;
|
|
283
|
+
row_count?: number;
|
|
284
|
+
column_count?: number;
|
|
285
|
+
row_span?: number;
|
|
286
|
+
column_span?: number;
|
|
287
|
+
/** Relations hold the dump's ephemeral node keys; see `A11yTreeDump.nodes`. */
|
|
288
|
+
labelled_by?: string[];
|
|
289
|
+
described_by?: string[];
|
|
290
|
+
controls?: string[];
|
|
291
|
+
owns?: string[];
|
|
292
|
+
details?: string[];
|
|
293
|
+
flow_to?: string[];
|
|
294
|
+
error_message?: string;
|
|
295
|
+
active_descendant?: string;
|
|
296
|
+
on_action?: string[];
|
|
297
|
+
};
|
|
298
|
+
}
|
|
299
|
+
export interface A11yTreeDump {
|
|
300
|
+
root?: string;
|
|
301
|
+
/** Null when the window has no focused node. */
|
|
302
|
+
gpui_focus?: string | null;
|
|
303
|
+
/** Null when no active descendant is claimed. */
|
|
304
|
+
active_descendant_focus?: string | null;
|
|
305
|
+
/** Absent only when the dump is the empty `{}` fallback (no a11y tree yet). */
|
|
306
|
+
frame?: {
|
|
307
|
+
rendered_at: string;
|
|
308
|
+
frame_number: number;
|
|
309
|
+
window_title: string | null;
|
|
310
|
+
node_count: number;
|
|
311
|
+
tab_stop_count: number;
|
|
312
|
+
viewport_size: {
|
|
313
|
+
width: number;
|
|
314
|
+
height: number;
|
|
315
|
+
};
|
|
316
|
+
scale_factor: number;
|
|
317
|
+
};
|
|
318
|
+
nodes?: Record<string, A11yTreeNode>;
|
|
319
|
+
}
|
|
320
|
+
export declare class TestRenderer implements NativeRenderer {
|
|
321
|
+
/** Native TestGpuixRenderer — all state lives here in Rust's RetainedTree. */
|
|
322
|
+
private native;
|
|
323
|
+
readonly applyBatch: NativeRenderer["applyBatch"];
|
|
324
|
+
readonly focusNext: () => void;
|
|
325
|
+
readonly focusPrevious: () => void;
|
|
326
|
+
readonly promptForPaths: NonNullable<NativeRenderer["promptForPaths"]>;
|
|
327
|
+
/** The test window's own clipboard. It never touches the system's. */
|
|
328
|
+
readonly writeClipboardText: NonNullable<NativeRenderer["writeClipboardText"]>;
|
|
329
|
+
readonly readClipboardText: NonNullable<NativeRenderer["readClipboardText"]>;
|
|
330
|
+
readonly setWindowSelectionChange: NonNullable<NativeRenderer["setWindowSelectionChange"]>;
|
|
331
|
+
readonly setWindowAppearanceChange: NonNullable<NativeRenderer["setWindowAppearanceChange"]>;
|
|
332
|
+
readonly setWindowMediaChange: NonNullable<NativeRenderer["setWindowMediaChange"]>;
|
|
333
|
+
readonly getMediaFeatures: NonNullable<NativeRenderer["getMediaFeatures"]>;
|
|
334
|
+
readonly setWindowKeyEvents: NonNullable<NativeRenderer["setWindowKeyEvents"]>;
|
|
335
|
+
readonly setWindowEventListeners: NonNullable<NativeRenderer["setWindowEventListeners"]>;
|
|
336
|
+
private readonly dispatchEvent;
|
|
337
|
+
private readonly dispatchSyncEvent;
|
|
338
|
+
private readonly onError;
|
|
339
|
+
constructor(options?: TestRendererOptions);
|
|
340
|
+
/** Releases the sync event handler, which captures this renderer, and tears the native
|
|
341
|
+
* window down. Call it after the root is unmounted. Native calls that need the window
|
|
342
|
+
* throw afterwards; the retained tree stays readable. Without it the window is leaked
|
|
343
|
+
* when the thread exits. */
|
|
344
|
+
dispose(): void;
|
|
345
|
+
/** Trigger the real GPUI rendering pipeline (GpuixView::render() →
|
|
346
|
+
* build_element() → apply_styles() → layout). */
|
|
347
|
+
flush(): void;
|
|
348
|
+
/** Drain events collected by the native GPUI event handlers. */
|
|
349
|
+
drainEvents(): EventPayload[];
|
|
350
|
+
/** Wakes `callback` when the main run loop has work, as `GpuixRenderer.setFrameWakeCallback`
|
|
351
|
+
* does. Returns true on macOS. Pass null to clear. */
|
|
352
|
+
setFrameWakeCallback(callback?: (() => void) | null): boolean;
|
|
353
|
+
/** Whether `startFrameLoop` must tick this renderer: true on macOS. */
|
|
354
|
+
requiresTick(): boolean;
|
|
355
|
+
/** One frame-loop step: hands the input AppKit queued for the test window (see
|
|
356
|
+
* `postNativeEvent`) to it, then to the JS handlers, as `dispatchNativeEvents` does. Draws
|
|
357
|
+
* nothing: frames stay `flush` and `drawFrame`. */
|
|
358
|
+
tick(): boolean;
|
|
359
|
+
/** Posts a real NSEvent for the test window from `com.apple.NSEventThread`, the way AppKit
|
|
360
|
+
* receives input, so an idle `startFrameLoop(testRenderer)` is woken by it. `kind` is
|
|
361
|
+
* `"keyDown"` (the key `a`), `"mouseMove"`, `"click"` or `"scroll"` (3 lines down); the last
|
|
362
|
+
* three need `x` and `y` in logical pixels from the window's top left. The window is neither
|
|
363
|
+
* made key nor shown, and nothing reaches the OS. `tick()` delivers the event. */
|
|
364
|
+
postNativeEvent(kind: string, x?: number, y?: number): void;
|
|
365
|
+
/** Drain events from the native GPUI pipeline and feed them into the
|
|
366
|
+
* framework event registry, triggering state updates synchronously.
|
|
367
|
+
* Loops until no more events are produced — handles re-entrant events
|
|
368
|
+
* that may be generated during framework state updates. */
|
|
369
|
+
dispatchNativeEvents(): void;
|
|
370
|
+
/** Press keys on whatever currently holds focus, in Playwright's
|
|
371
|
+
* `keyboard.press` grammar. A press is a DOM `key` value (`"Enter"`, `"a"`,
|
|
372
|
+
* `"A"`, `"ArrowDown"`, `"Escape"`, `"Tab"`, `"F2"`) or a `code` name
|
|
373
|
+
* (`"Space"`, `"KeyA"`, `"Digit1"`), with modifiers joined by `+`
|
|
374
|
+
* (`"Shift+Tab"`, `"Meta+a"`, `"Alt+ArrowLeft"`, `"ControlOrMeta+Shift+P"`;
|
|
375
|
+
* `ControlOrMeta` is Meta on macOS). `keystrokes` is a sequence of presses
|
|
376
|
+
* separated by spaces: `"a Shift+b Enter"`. Each press is a `keydown` then a
|
|
377
|
+
* `keyup`, and a typed key inserts its character into a focused input.
|
|
378
|
+
* Names are case-sensitive and an unknown one throws before anything is
|
|
379
|
+
* pressed.
|
|
380
|
+
*
|
|
381
|
+
* Unlike `nativeSimulateKeystrokes`, this focuses nothing first, which is
|
|
382
|
+
* the only way to test that `autoFocus` (or a click) actually moved focus. */
|
|
383
|
+
simulateKeystrokes(keystrokes: string): void;
|
|
384
|
+
/** Focus an element, then press keys on it (the `simulateKeystrokes` grammar).
|
|
385
|
+
* @param elementId - element to focus
|
|
386
|
+
* @param keystrokes - space-separated presses, e.g. `"h i Enter Shift+Tab"` */
|
|
387
|
+
nativeSimulateKeystrokes(elementId: number, keystrokes: string): void;
|
|
388
|
+
/** Focus an element, then send one `keydown` for one press (the
|
|
389
|
+
* `simulateKeystrokes` grammar), with no `keyup` after it. Pairs with
|
|
390
|
+
* `nativeSimulateKeyUp`.
|
|
391
|
+
* @param elementId - element to focus
|
|
392
|
+
* @param keystroke - one press, e.g. `"a"`, `"Enter"`, `"Meta+s"`
|
|
393
|
+
* @param isHeld - whether this is a key-repeat event (default: false)
|
|
394
|
+
*/
|
|
395
|
+
nativeSimulateKeyDown(elementId: number, keystroke: string, isHeld?: boolean): void;
|
|
396
|
+
/** Focus an element, then send one `keyup` for one press (the
|
|
397
|
+
* `simulateKeystrokes` grammar). Pairs with `nativeSimulateKeyDown`.
|
|
398
|
+
* @param elementId - element to focus
|
|
399
|
+
* @param keystroke - one press, e.g. `"a"`, `"Enter"`, `"Meta+s"`
|
|
400
|
+
*/
|
|
401
|
+
nativeSimulateKeyUp(elementId: number, keystroke: string): void;
|
|
402
|
+
/** Focus a text input, then run an input method composition in it, one step
|
|
403
|
+
* per key. Each step is what macOS does for a key the input method takes: a
|
|
404
|
+
* `keydown` with `key` `"Process"`, the composition events and the `change`
|
|
405
|
+
* of the edit, then the `keyup` of that key. A text input is the only element
|
|
406
|
+
* that composes, so `elementId` must be one.
|
|
407
|
+
* @param elementId - the `<input>` or `<textarea>` to compose in
|
|
408
|
+
* @param steps - the keys the input method consumes, in order */
|
|
409
|
+
simulateComposition(elementId: number, steps: readonly CompositionStep[]): void;
|
|
410
|
+
/** End-to-end: simulate a click through GPUI hit testing →
|
|
411
|
+
* dispatch resulting events to the framework. */
|
|
412
|
+
nativeSimulateClick(x: number, y: number, button?: number, modifiers?: string): void;
|
|
413
|
+
/** End-to-end: simulate scroll wheel through GPUI →
|
|
414
|
+
* dispatch resulting events to the framework. Deltas have the DOM's sign, like
|
|
415
|
+
* `WheelEvent.deltaY`: positive `deltaY` scrolls down (the content moves up),
|
|
416
|
+
* positive `deltaX` scrolls right. */
|
|
417
|
+
nativeSimulateScrollWheel(x: number, y: number, deltaX: number, deltaY: number, modifiers?: string, phase?: ScrollGesturePhase): void;
|
|
418
|
+
/** Dispatch a wheel without the surrounding flushes, for perf sampling. Deltas
|
|
419
|
+
* have the DOM's sign: positive `deltaY` scrolls down.
|
|
420
|
+
* Call `flush()` yourself, or the sample is the framework update only and
|
|
421
|
+
* none of the GPUI build, layout and paint that follows. */
|
|
422
|
+
dispatchScrollWheel(x: number, y: number, deltaX: number, deltaY: number, modifiers?: string, phase?: ScrollGesturePhase): void;
|
|
423
|
+
/** Dispatch a move without the surrounding flushes, for perf sampling.
|
|
424
|
+
* `nativeSimulateMouseMove` draws a pending change before and after the move, so a
|
|
425
|
+
* drag timed with it includes the paint and a wheel timed with `dispatchScrollWheel`
|
|
426
|
+
* does not. */
|
|
427
|
+
dispatchMouseMove(x: number, y: number, modifiers?: string, movement?: MouseMovement): void;
|
|
428
|
+
/** End-to-end: simulate mouse move through GPUI →
|
|
429
|
+
* dispatch resulting events to the framework. The move reports the buttons held by
|
|
430
|
+
* `nativeSimulateMouseDown` and not yet released by `nativeSimulateMouseUp`, as a real
|
|
431
|
+
* OS does on every move, so a drag is a down, moves, an up.
|
|
432
|
+
* @param movement - what the platform reports as this move's motion, which becomes
|
|
433
|
+
* `movementX`/`movementY`. A real platform reports the delta from the last position;
|
|
434
|
+
* the simulation reports `{ x: 0, y: 0 }` unless told otherwise. */
|
|
435
|
+
nativeSimulateMouseMove(x: number, y: number, modifiers?: string, movement?: MouseMovement): void;
|
|
436
|
+
/** End-to-end: the pointer leaves the window at (x, y), the way the platform
|
|
437
|
+
* reports it, with no mouse move after the last position inside. */
|
|
438
|
+
nativeSimulateMouseExit(x: number, y: number): void;
|
|
439
|
+
/** The OS ate the release of `button` (0=left, the default, 1=middle, 2=right): the
|
|
440
|
+
* renderer forgets it as held and dispatches nothing. The next move reports no button,
|
|
441
|
+
* which is how a page sees a release it never got (the pointer let go outside the
|
|
442
|
+
* window), and the press is cancelled. */
|
|
443
|
+
simulateLostMouseUp(button?: number): void;
|
|
444
|
+
/** End-to-end: simulate mouse down through GPUI hit testing →
|
|
445
|
+
* dispatch resulting events to the framework.
|
|
446
|
+
* @param button - 0=left (default), 1=middle, 2=right
|
|
447
|
+
* @param clickCount - the platform's count: 2 for the second press of a double click */
|
|
448
|
+
nativeSimulateMouseDown(x: number, y: number, button?: number, modifiers?: string, clickCount?: number): void;
|
|
449
|
+
/** End-to-end: simulate mouse up through GPUI hit testing →
|
|
450
|
+
* dispatch resulting events to the framework.
|
|
451
|
+
* @param button - 0=left (default), 1=middle, 2=right
|
|
452
|
+
* @param clickCount - the platform's count: 2 for the release of a double click */
|
|
453
|
+
nativeSimulateMouseUp(x: number, y: number, button?: number, modifiers?: string, clickCount?: number): void;
|
|
454
|
+
/**
|
|
455
|
+
* End-to-end: files from the OS enter the window at `x`, `y`. Returns the operation the
|
|
456
|
+
* window answered the OS drag with, as macOS would see it: the `dropEffect` the `dragover`
|
|
457
|
+
* ended with (`"none"` when no handler cancelled it), or `null` when native picked none.
|
|
458
|
+
*/
|
|
459
|
+
nativeSimulateFileDragEnter(x: number, y: number, paths: string[]): HostDropEffect | null;
|
|
460
|
+
/** End-to-end: the dragged files move to `x`, `y`. Returns the operation, as `nativeSimulateFileDragEnter` does. */
|
|
461
|
+
nativeSimulateFileDragMove(x: number, y: number): HostDropEffect | null;
|
|
462
|
+
/** End-to-end: the dragged files are released at `x`, `y`. */
|
|
463
|
+
nativeSimulateFileDragSubmit(x: number, y: number): void;
|
|
464
|
+
/** End-to-end: the dragged files leave the window. */
|
|
465
|
+
nativeSimulateFileDragExit(): void;
|
|
466
|
+
/** End-to-end: the platform's drag session ends. */
|
|
467
|
+
nativeSimulateFileDragEnd(): void;
|
|
468
|
+
/** End-to-end: a whole Finder-style drop at `x`, `y`, as the platform sends it: enter, submit, exit, end. */
|
|
469
|
+
nativeSimulateFileDrop(x: number, y: number, paths: string[]): void;
|
|
470
|
+
/** Build a flat map of TestElements from the native tree JSON.
|
|
471
|
+
* One FFI call to get the full tree, then parse into TestElement objects. */
|
|
472
|
+
private buildElementMap;
|
|
473
|
+
/** Get the root element. */
|
|
474
|
+
getRoot(): TestElement | undefined;
|
|
475
|
+
/** Get an element by ID. */
|
|
476
|
+
getElement(id: number): TestElement | undefined;
|
|
477
|
+
/** Find elements by type (e.g. "div", "text"). */
|
|
478
|
+
findByType(type: string): TestElement[];
|
|
479
|
+
/** Find the first text element containing the given string. */
|
|
480
|
+
findByText(text: string): TestElement | undefined;
|
|
481
|
+
findByTestId(testId: string): TestElement | undefined;
|
|
482
|
+
/** Get all text content in the tree (depth-first). */
|
|
483
|
+
getAllText(): string[];
|
|
484
|
+
/** Print the tree structure for debugging. Only includes non-empty fields. */
|
|
485
|
+
toJSON(): unknown;
|
|
486
|
+
/** GPUI accessibility dump from the last painted frame. */
|
|
487
|
+
getA11yTree(): A11yTreeDump;
|
|
488
|
+
getAutomationTree(): string;
|
|
489
|
+
/** Every element the native tree holds, reachable or not. `toJSON()` walks
|
|
490
|
+
* from the root, so only this can see a node that was detached and leaked. */
|
|
491
|
+
getRetainedElementCount(): number;
|
|
492
|
+
/** What the element build has done since the last `resetBuildCounters()`:
|
|
493
|
+
* elements built and `StyleDesc` / `Inherited` clones. A draw builds every
|
|
494
|
+
* element, so divide by the frames drawn for the per-frame figure. */
|
|
495
|
+
getBuildCounters(): BuildCounters;
|
|
496
|
+
/** What the retained subtrees did since the window was made: subtrees not built, replayed,
|
|
497
|
+
* built late, and frames compared with a whole build under `setRetainVerify`. */
|
|
498
|
+
getRetainedCounters(): RetainedCounters;
|
|
499
|
+
/** What building and drawing the elements did since the window was made: elements prepainted and
|
|
500
|
+
* painted (those in a culled subtree apart), and the scene primitives painting inserted against
|
|
501
|
+
* the ones a replay inserted again. A replayed subtree prepaints and paints none of its
|
|
502
|
+
* elements; its replays are `getRetainedCounters().replays`. */
|
|
503
|
+
getFrameWorkCounters(): FrameWorkCounters;
|
|
504
|
+
/** How the frames compared under `setRetainVerify` differed from a whole build. */
|
|
505
|
+
getRetentionMismatches(): string[];
|
|
506
|
+
/** Layout nodes made, found again and freed, styles and child lists set, text measured and
|
|
507
|
+
* shaped, and the subtrees whose extent and overflow were walked again, by the window's layout
|
|
508
|
+
* engine since the window was made. */
|
|
509
|
+
getLayoutCounters(): LayoutCounters;
|
|
510
|
+
resetBuildCounters(): void;
|
|
511
|
+
/** Hashes what every element builds, and counts in `retainMismatches` an element the
|
|
512
|
+
* retain key judged unchanged that built differently since the last build. Costs a
|
|
513
|
+
* formatted style per element: leave it off to time a frame. */
|
|
514
|
+
setRetainVerify(verify: boolean): void;
|
|
515
|
+
/** Turns the skipping of unchanged subtrees on or off (on by default): off, every frame
|
|
516
|
+
* builds every element, the way `GPUIX_RETAIN_OFF` makes it for the whole run. */
|
|
517
|
+
setRetainPlanning(planning: boolean): void;
|
|
518
|
+
/** Whether a frame records what it builds at all (on by default): off, a frame costs what it did
|
|
519
|
+
* before retention, as `GPUIX_RETAIN_OFF` makes it for the whole run. Turning it on starts
|
|
520
|
+
* from a frame that builds everything. */
|
|
521
|
+
setRetainEnabled(enabled: boolean): void;
|
|
522
|
+
/** Whether a tick of animations that only change what they paint is drawn by painting the roots
|
|
523
|
+
* they change again in the frame before it (on by default, as `GPUIX_PATCH_OFF` turns off for the
|
|
524
|
+
* whole run). It is never patched while the retention is off. */
|
|
525
|
+
setPatchEnabled(enabled: boolean): void;
|
|
526
|
+
/** How ticks were drawn by patching since the window was made: the frames and roots patched, the
|
|
527
|
+
* ticks gpui drew whole after the patch was tried (`declines`, by reason, as JSON) and the ones
|
|
528
|
+
* gpuix did not try to patch (`unpatchable`, by kind, as JSON). */
|
|
529
|
+
getPatchCounters(): PatchCounters;
|
|
530
|
+
/** Counts as if these exclusions (`svg`, `overflow-hidden`, `custom-element`, ...) were lifted,
|
|
531
|
+
* to see which are worth lifting first. Nothing is reused. */
|
|
532
|
+
setRetainLift(names: string[]): void;
|
|
533
|
+
/** The elements counted in `retainMismatches`, one line each. */
|
|
534
|
+
getRetainMismatches(): string[];
|
|
535
|
+
/** Frames the window has painted. A test compares it before and after to
|
|
536
|
+
* count the draws a read caused: a bounds or scroll read paints nothing. */
|
|
537
|
+
getPaintedFrameCount(): number;
|
|
538
|
+
/** Draw a dirty window when an update or a simulated input flushes (the
|
|
539
|
+
* default), or leave that to `drawFrame`, as a real window leaves it to its
|
|
540
|
+
* display link. A test that counts draws per frame turns it off. */
|
|
541
|
+
setInlineDraws(enabled: boolean): void;
|
|
542
|
+
/** One display-link frame: deliver the queued frame callbacks, then draw a
|
|
543
|
+
* pending change once. Pairs with `setInlineDraws(false)`. */
|
|
544
|
+
drawFrame(): void;
|
|
545
|
+
/** Layout-only passes the window has run. A read of bounds or scroll metrics
|
|
546
|
+
* on a dirty window is one, in place of a draw, and the next frame draws
|
|
547
|
+
* once regardless. */
|
|
548
|
+
getLayoutPassCount(): number;
|
|
549
|
+
/** Pretends a screen reader is connected, as the test window starts out,
|
|
550
|
+
* or not. Without one no accessibility tree is built. */
|
|
551
|
+
setA11yActive(active: boolean): void;
|
|
552
|
+
/** Subtrees the window has skipped as lying outside their clip, over its
|
|
553
|
+
* life. Compare before and after a frame. */
|
|
554
|
+
getCulledSubtreeCount(): number;
|
|
555
|
+
getElementBounds(elementId: number): ElementBounds | null;
|
|
556
|
+
/** `getElementBounds` for the first report of an observer: it lays out as that does, but not the content
|
|
557
|
+
* of a skipped `content-visibility` ancestor, and an element inside it has no box (null). */
|
|
558
|
+
probeElementBounds(elementId: number): ElementBounds | null;
|
|
559
|
+
/** The box the last layout gave an element, or null if it was not built. Unlike `getElementBounds`
|
|
560
|
+
* it does not lay out the content of a skipped `content-visibility` ancestor to answer, so it
|
|
561
|
+
* tells whether that content is built. */
|
|
562
|
+
getBuiltElementBounds(elementId: number): ElementBounds | null;
|
|
563
|
+
/** Ids of the elements under the window point, topmost first. */
|
|
564
|
+
getElementsAt(x: number, y: number): number[];
|
|
565
|
+
clockPause(): number;
|
|
566
|
+
clockSet(nowMs: number): number;
|
|
567
|
+
clockFastForward(deltaMs: number): number;
|
|
568
|
+
/** `clockFastForward` without telling the window, as time passing does in a live one: the frame
|
|
569
|
+
* after it is a tick, which patches the frame before it when only paint-only animations ran. */
|
|
570
|
+
clockAdvance(deltaMs: number): number;
|
|
571
|
+
clockResume(): number;
|
|
572
|
+
createMotionValue(...args: Parameters<MotionValueHost["createMotionValue"]>): void;
|
|
573
|
+
createMotionTransform(...args: Parameters<MotionValueHost["createMotionTransform"]>): void;
|
|
574
|
+
createMotionFollower(...args: Parameters<MotionValueHost["createMotionFollower"]>): void;
|
|
575
|
+
createMotionSpring(...args: Parameters<MotionValueHost["createMotionSpring"]>): void;
|
|
576
|
+
disposeMotionValue(id: number): boolean;
|
|
577
|
+
getMotionValue(id: number): unknown;
|
|
578
|
+
getMotionValueVelocity(id: number): number;
|
|
579
|
+
isMotionValueAnimating(id: number): boolean;
|
|
580
|
+
setMotionValue(id: number, value: unknown): void;
|
|
581
|
+
jumpMotionValue(id: number, value: unknown): void;
|
|
582
|
+
animateMotionValue(id: number, target: unknown, transition?: unknown): void;
|
|
583
|
+
stopMotionValue(id: number): void;
|
|
584
|
+
pauseMotionValue(id: number): void;
|
|
585
|
+
playMotionValue(id: number): void;
|
|
586
|
+
seekMotionValue(id: number, seconds: number): void;
|
|
587
|
+
setMotionValueSpeed(id: number, speed: number): void;
|
|
588
|
+
completeMotionValue(id: number): void;
|
|
589
|
+
detachMotionValueClock(id: number): void;
|
|
590
|
+
getMotionValuePlayback(id: number): MotionValuePlayback | null;
|
|
591
|
+
setMotionValueListener(id: number, change: boolean, animation: boolean): void;
|
|
592
|
+
/** Advance GPUI's test dispatcher and run due timers.
|
|
593
|
+
* This is not `clockFastForward`. That moves the motion clock only.
|
|
594
|
+
* Use this for caret blink, input drag autoscroll, and list edge scroll. */
|
|
595
|
+
advanceTime(milliseconds: number): void;
|
|
596
|
+
focusElement(elementId: number): void;
|
|
597
|
+
blurElement(elementId: number): void;
|
|
598
|
+
matchesFocus(elementId: number, selector: string): boolean;
|
|
599
|
+
getFocusedElementId(): number | null;
|
|
600
|
+
/** Makes the offscreen window key (`true`, the default) or not, as when the user switches apps. */
|
|
601
|
+
setWindowActive(active: boolean): void;
|
|
602
|
+
focusNextWithin(elementId: number): void;
|
|
603
|
+
focusPreviousWithin(elementId: number): void;
|
|
604
|
+
/** The offscreen window size, so `useWindowSize()` works under test. */
|
|
605
|
+
getWindowSize(): {
|
|
606
|
+
width: number;
|
|
607
|
+
height: number;
|
|
608
|
+
};
|
|
609
|
+
/** `"system"` | `"light"` | `"dark"`, as on the live renderer: the window's appearance
|
|
610
|
+
* follows (`getAppearance`, `light-dark()`, `prefers-color-scheme`) and `appearanceChange`
|
|
611
|
+
* is delivered. `"system"` returns to the platform's own. */
|
|
612
|
+
setAppearance(appearance: string): void;
|
|
613
|
+
/** `"overlay"` (macOS "Show scroll bars" Automatically or When scrolling, which the test
|
|
614
|
+
* window starts with) or `"classic"` (Always, which macOS also picks while a mouse is
|
|
615
|
+
* attached). Classic bars are always drawn and take 15px (11 with `scrollbarWidth: "thin"`)
|
|
616
|
+
* out of the container, so its `clientWidth` and content box shrink by it. The test window
|
|
617
|
+
* never hears from the OS, so this is how a test flips the setting. */
|
|
618
|
+
setScrollbarStyle(style: "overlay" | "classic"): void;
|
|
619
|
+
/** The window's title, as the platform window has it: the `title` option, or `"GPUIX"`. */
|
|
620
|
+
getWindowTitle(): string;
|
|
621
|
+
/** The window's effective appearance, `"light"` or `"dark"`. */
|
|
622
|
+
getAppearance(): string;
|
|
623
|
+
/** Set the OS accessibility preferences this window reports (all start as
|
|
624
|
+
* "no preference") and deliver the resulting `mediaChange` event. The test
|
|
625
|
+
* window never hears from the OS, so this is how a test flips reduced motion. */
|
|
626
|
+
setMediaFeatures(features: Partial<MediaFeatures>): void;
|
|
627
|
+
/** Resize the offscreen window's content, as dragging its edge would: `getWindowSize()`
|
|
628
|
+
* and the size queries of `matchMedia` see the new size, and their `change` events are
|
|
629
|
+
* delivered. */
|
|
630
|
+
setWindowSize(width: number, height: number): void;
|
|
631
|
+
/** Give the offscreen window the scale factor of a display of another density (`2` is a
|
|
632
|
+
* retina one), as a window dragged to it has: the next frame lays out and paints at it, and
|
|
633
|
+
* a screenshot is the window's size times it. The factor stays until it is set again:
|
|
634
|
+
* resizing the window does not reset it. The window starts at 1 (`scaleFactor` option). */
|
|
635
|
+
setWindowScaleFactor(scaleFactor: number): void;
|
|
636
|
+
/** Scroll an element (overflow: "scroll", or a `<virtual-list>`) to a DOM scroll
|
|
637
|
+
* position: `left` and `top` are `scrollLeft` and `scrollTop`, zero or more, so
|
|
638
|
+
* scrolling down is a larger `top`. Like a browser's, the write forces a layout only if
|
|
639
|
+
* one is pending, and the window draws the new offset with its next frame. */
|
|
640
|
+
scrollTo(elementId: number, left: number, top: number, behavior?: string): void;
|
|
641
|
+
/** Scroll a child into view by its index in the children list.
|
|
642
|
+
*
|
|
643
|
+
* `offsetInItem` is in pixels. A negative value anchors the viewport top
|
|
644
|
+
* above the item, resolved against measured row heights at layout time, so
|
|
645
|
+
* a row stays pixel-stable while unmeasured rows are spliced in above it. */
|
|
646
|
+
scrollToItem(elementId: number, index: number, offsetInItem?: number): void;
|
|
647
|
+
/** The DOM's `scrollIntoView`: every scrollable ancestor scrolls until the element sits
|
|
648
|
+
* where `block` (default `"start"`) and `inline` (default `"nearest"`) ask. */
|
|
649
|
+
scrollIntoView(elementId: number, block?: string, inline?: string, behavior?: string): void;
|
|
650
|
+
/** Applies from the next simulated pointer input. See `PointerCaptureMethods`. */
|
|
651
|
+
setPointerCapture(elementId: number, pointerId: number): void;
|
|
652
|
+
releasePointerCapture(elementId: number, pointerId: number): void;
|
|
653
|
+
hasPointerCapture(elementId: number, pointerId: number): boolean;
|
|
654
|
+
clickElement(elementId: number): void;
|
|
655
|
+
getAnimations(elementId: number): WebAnimationInfo[];
|
|
656
|
+
getSubtreeAnimations(elementId: number): ElementWebAnimationInfo[];
|
|
657
|
+
getDocumentAnimations(): ElementWebAnimationInfo[];
|
|
658
|
+
/**
|
|
659
|
+
* The XML the `<svg>` painted from its shape children in the last frame, with
|
|
660
|
+
* animated attributes as that frame had them, or `null` when it painted none.
|
|
661
|
+
*/
|
|
662
|
+
getSvgMarkup(elementId: number): string | null;
|
|
663
|
+
getAnimation(animationId: number): WebAnimationInfo;
|
|
664
|
+
releaseAnimation(animationId: number): void;
|
|
665
|
+
forgetAnimation(animationId: number): void;
|
|
666
|
+
getAnimationEffect(animationId: number): WebAnimationEffectInfo;
|
|
667
|
+
getAnimationKeyframes(animationId: number): WebAnimationKeyframeInfo[];
|
|
668
|
+
updateAnimationTiming(animationId: number, timing: WebAnimationTimingUpdate): void;
|
|
669
|
+
pauseAnimation(animationId: number): void;
|
|
670
|
+
playAnimation(animationId: number): void;
|
|
671
|
+
setAnimationCurrentTime(animationId: number, milliseconds: number): void;
|
|
672
|
+
setAnimationPlaybackRate(animationId: number, rate: number): void;
|
|
673
|
+
cancelAnimation(animationId: number): void;
|
|
674
|
+
finishAnimation(animationId: number): void;
|
|
675
|
+
reverseAnimation(animationId: number): void;
|
|
676
|
+
updateAnimationPlaybackRate(animationId: number, rate: number): void;
|
|
677
|
+
setAnimationStartTime(animationId: number, startTime: number | null): void;
|
|
678
|
+
getAnimationTimelineTime(): number;
|
|
679
|
+
/** Applies from the next simulated pointer input. */
|
|
680
|
+
cancelDrag(): void;
|
|
681
|
+
/** The frame it asks for is drawn here, so `pointerlockchange` or
|
|
682
|
+
* `pointerlockerror` has reached its listeners when this returns. */
|
|
683
|
+
requestPointerLock(elementId: number): void;
|
|
684
|
+
exitPointerLock(): void;
|
|
685
|
+
pointerLockElement(): number | null;
|
|
686
|
+
/** Whether the simulated platform grants lock requests. The offscreen test
|
|
687
|
+
* window is never key, so a real GPUI lock would always be refused; this
|
|
688
|
+
* stands in for a platform that can lock, and off, for one that refuses. */
|
|
689
|
+
simulatePointerLockGranting(granting: boolean): void;
|
|
690
|
+
/** The platform drops the lock, as when the window deactivates. */
|
|
691
|
+
simulatePointerLockLost(): void;
|
|
692
|
+
/** What the window was asked to do by presses in `appRegion: "drag"` boxes since the last
|
|
693
|
+
* call, oldest first: `"move"`, `"titlebarDoubleClick"` (macOS), `"zoom"` or `"showMenu"`
|
|
694
|
+
* (Linux). The offscreen window cannot start a real move, so the test window records
|
|
695
|
+
* instead. Every test window is frameless, so `appRegion` always applies. */
|
|
696
|
+
takeSimulatedWindowActions(): string[];
|
|
697
|
+
/** The default action of a scrolling key. See `scrollByKey` on the native renderer. */
|
|
698
|
+
scrollByKey(key: string, shift: boolean): void;
|
|
699
|
+
/** `[scrollLeft, scrollTop, scrollWidth, scrollHeight, clientWidth, clientHeight]`, or
|
|
700
|
+
* null for an element that has not been painted. */
|
|
701
|
+
getScrollMetrics(elementId: number): number[] | null;
|
|
702
|
+
setImage(elementId: number, bytes: Buffer | Uint8Array): void;
|
|
703
|
+
setStyleImage(url: string, bytes: Buffer | Uint8Array): void;
|
|
704
|
+
failStyleImage(url: string, message: string): void;
|
|
705
|
+
selectText(elementId: number): void;
|
|
706
|
+
setSelectionRange(elementId: number, start: number, end: number, direction?: string): void;
|
|
707
|
+
getTextSelection(elementId: number): {
|
|
708
|
+
start: number;
|
|
709
|
+
end: number;
|
|
710
|
+
direction: string;
|
|
711
|
+
};
|
|
712
|
+
requestSubmit(elementId: number): void;
|
|
713
|
+
registerFont(bytes: Buffer | Uint8Array): void;
|
|
714
|
+
webviewCommand(elementId: number, command: string, argument?: string): void;
|
|
715
|
+
webviewState(elementId: number): {
|
|
716
|
+
url: string;
|
|
717
|
+
title: string;
|
|
718
|
+
canGoBack: boolean;
|
|
719
|
+
canGoForward: boolean;
|
|
720
|
+
};
|
|
721
|
+
webviewExecuteJavascript(elementId: number, code: string): Promise<string | null>;
|
|
722
|
+
/** What the page of the `<webview>` was asked to do, in order. */
|
|
723
|
+
getWebviewCommands(elementId: number): WebviewCommand[];
|
|
724
|
+
/** The page starts loading: `did-start-loading`. */
|
|
725
|
+
simulateWebviewStartLoading(elementId: number): void;
|
|
726
|
+
/** The page stops loading: `did-stop-loading`. */
|
|
727
|
+
simulateWebviewStopLoading(elementId: number): void;
|
|
728
|
+
/** The page commits `url`: `did-navigate`, and `getURL()` answers it. */
|
|
729
|
+
simulateWebviewNavigate(elementId: number, url: string): void;
|
|
730
|
+
/** The page hands the keyboard on, as it does when Tab leaves its last tabbable element
|
|
731
|
+
* (`backwards`: Shift+Tab leaves its first): focus moves to the next (previous) tab stop. */
|
|
732
|
+
simulateWebviewTabOut(elementId: number, backwards?: boolean): void;
|
|
733
|
+
/** The page gets a title: `page-title-updated`, and `getTitle()` answers it. */
|
|
734
|
+
simulateWebviewTitle(elementId: number, title: string, explicitSet?: boolean): void;
|
|
735
|
+
/** A load fails: `did-fail-load`, with an `NSURLError` code. */
|
|
736
|
+
simulateWebviewFail(elementId: number, errorCode: number, errorDescription: string, validatedUrl?: string): void;
|
|
737
|
+
/** What `canGoBack()` and `canGoForward()` answer. */
|
|
738
|
+
setWebviewHistory(elementId: number, canGoBack: boolean, canGoForward: boolean): void;
|
|
739
|
+
/** Settles the oldest `executeJavaScript` of the `<webview>` that waits: resolves it with
|
|
740
|
+
* `result` (anything JSON holds; `undefined` for `undefined`), or rejects it with `error`. */
|
|
741
|
+
settleWebviewScript(elementId: number, outcome: {
|
|
742
|
+
result?: unknown;
|
|
743
|
+
error?: string;
|
|
744
|
+
}): void;
|
|
745
|
+
/** Where the last frame put the surface of the `<webview>`; null while it has none. */
|
|
746
|
+
getWebviewSurface(elementId: number): WebviewSurface | null;
|
|
747
|
+
/** The layers of the last composed frame, bottom to top. */
|
|
748
|
+
getCompositionLayers(): CompositionLayer[];
|
|
749
|
+
/** The views AppKit holds for the `<webview>`, with the placement the last frame applied. */
|
|
750
|
+
getWebviewNativeView(elementId: number): WebviewNativeView;
|
|
751
|
+
/** Where the last frame put the native view of the `<nativeview>`; null while it has no
|
|
752
|
+
* surface or the frame did not place it (`display: none`, `visibility: hidden`, culled). */
|
|
753
|
+
getNativeviewSurface(elementId: number): NativeviewSurface | null;
|
|
754
|
+
/** The native surfaces the `<nativeview>` elements made and dropped, in order. `"removed"` is
|
|
755
|
+
* when the element drops the surface (after `detach`); its view leaves the window with the
|
|
756
|
+
* next frame. */
|
|
757
|
+
getNativeSurfaceEvents(): NativeSurfaceEvent[];
|
|
758
|
+
/** How many warnings the `<nativeview>` has issued: one when the platform cannot make its
|
|
759
|
+
* surface, however many frames are drawn. */
|
|
760
|
+
getNativeviewWarnings(elementId: number): number;
|
|
761
|
+
/** `false` makes the window refuse native surfaces, as a platform that cannot compose does:
|
|
762
|
+
* call it before the first frame that paints a `<nativeview>`. */
|
|
763
|
+
setNativeSurfacesAvailable(available: boolean): void;
|
|
764
|
+
setImagePixels(elementId: number, width: number, height: number, pixels: Buffer | Uint8Array, format?: ImagePixelFormat): void;
|
|
765
|
+
/** The DOM scroll position `[scrollLeft, scrollTop]` (zero or more, like `element.scrollLeft`
|
|
766
|
+
* and the `onScroll` event), or null if the element is not scrollable. */
|
|
767
|
+
getScrollOffset(elementId: number): [number, number] | null;
|
|
768
|
+
/** The CSS keyword of the cursor the window asks the platform for where the pointer last
|
|
769
|
+
* was (`"default"` when nothing asks). A mouse move updates it, a draw keeps it current.
|
|
770
|
+
* Keywords that name one cursor read back as the first of them: `"pointer"`, `"grabbing"`,
|
|
771
|
+
* `"nwse-resize"`, `"nesw-resize"`, `"not-allowed"`. */
|
|
772
|
+
getCursor(): string;
|
|
773
|
+
/** The logical scroll anchor of a `<virtual-list>`:
|
|
774
|
+
* `[itemIndex, offsetInItemPx, viewportHeightPx]`, or null for anything
|
|
775
|
+
* else. `itemIndex == item count` is gpui's at-end sentinel. Exact even
|
|
776
|
+
* while row heights are still estimates, because it is the anchor gpui
|
|
777
|
+
* itself scrolls by. */
|
|
778
|
+
getListScrollTop(elementId: number): [number, number, number] | null;
|
|
779
|
+
/** Drag-select from (x1,y1) to (x2,y2) and return the selected text.
|
|
780
|
+
*
|
|
781
|
+
* Selection listeners are registered during **paint**, so the native helper
|
|
782
|
+
* flushes between every step. Calling simulateMouseDown/Move/Up by hand
|
|
783
|
+
* without those flushes selects nothing. */
|
|
784
|
+
dragSelect(x1: number, y1: number, x2: number, y2: number): string | null;
|
|
785
|
+
/** The current selection joined in document order, or null. */
|
|
786
|
+
getSelectedText(): string | null;
|
|
787
|
+
/** Every string painted in the last frame, in paint order.
|
|
788
|
+
*
|
|
789
|
+
* `getAllText()` only sees `<text>` nodes in the retained tree. Native
|
|
790
|
+
* elements like `<code>` and `<diff>` paint their text inside GPUI, so this
|
|
791
|
+
* is the only way to assert on what they rendered. */
|
|
792
|
+
getPaintedText(): string[];
|
|
793
|
+
/** Every highlight wash painted in the last frame, in paint order.
|
|
794
|
+
*
|
|
795
|
+
* A quad never lands in `getPaintedText()`, and a soft-wrapped match must
|
|
796
|
+
* draw one box per visual row, so each entry carries its `rects`. */
|
|
797
|
+
getPaintedHighlights(): HighlightMatch[];
|
|
798
|
+
/** Syntax-cache counters as `[hits, misses, documents]`. */
|
|
799
|
+
getSyntaxCacheStats(): [number, number, number];
|
|
800
|
+
clearSelection(): void;
|
|
801
|
+
setDebugFrameOverlay(mode: DebugFrameOverlayMode): string;
|
|
802
|
+
getDebugFrameOverlay(): string;
|
|
803
|
+
cycleDebugFrameOverlay(): string;
|
|
804
|
+
resetDebugFrameOverlayStats(): void;
|
|
805
|
+
getDebugFrameOverlayStats(): DebugFrameOverlayStats;
|
|
806
|
+
/** Capture the current Metal or DirectX frame and save it as a PNG. */
|
|
807
|
+
captureScreenshot(path: string): void;
|
|
808
|
+
/** Whether the native GPUI test renderer is available. Always true. */
|
|
809
|
+
get hasNative(): boolean;
|
|
810
|
+
}
|
|
811
|
+
//# sourceMappingURL=testing.d.ts.map
|