1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
use *;
/// HTML tag name created when mounting a cross-platform canvas surface.
pub const WEB_CANVAS_TAG: &str = "canvas";
/// CSS custom property exposing `env(safe-area-inset-top)` without DOM mutation or layout reflow.
pub const WEB_CSS_SAFE_TOP: &str = "--euv-safe-top";
/// CSS custom property exposing `env(safe-area-inset-right)` without DOM mutation or layout reflow.
pub const WEB_CSS_SAFE_RIGHT: &str = "--euv-safe-right";
/// CSS custom property exposing `env(safe-area-inset-bottom)` without DOM mutation or layout reflow.
pub const WEB_CSS_SAFE_BOTTOM: &str = "--euv-safe-bottom";
/// CSS custom property exposing `env(safe-area-inset-left)` without DOM mutation or layout reflow.
pub const WEB_CSS_SAFE_LEFT: &str = "--euv-safe-left";
/// `window.getComputedStyle` property name.
pub const WEB_METHOD_GET_COMPUTED_STYLE: &str = "getComputedStyle";
/// `CSSStyleDeclaration.getPropertyValue` property name.
pub const WEB_METHOD_GET_PROPERTY_VALUE: &str = "getPropertyValue";
/// `navigator.gpu` WebGPU capability property name.
pub const WEB_PROP_GPU: &str = "gpu";
/// WebGPU rendering context identifier passed to `HTMLCanvasElement.getContext`.
pub const WEB_CONTEXT_WEBGPU: &str = "webgpu";
/// WebGL2 rendering context identifier passed to `HTMLCanvasElement.getContext`.
pub const WEB_CONTEXT_WEBGL2: &str = "webgl2";
/// WebGL2 context option key disabling alpha compositing overhead.
pub const WEB_GL_OPT_ALPHA: &str = "alpha";
/// WebGL2 context option key disabling MSAA overhead.
pub const WEB_GL_OPT_ANTIALIAS: &str = "antialias";
/// WebGL2 context option key disabling depth buffer allocation.
pub const WEB_GL_OPT_DEPTH: &str = "depth";
/// WebGL2 context option key requesting low-latency desynchronized presentation.
pub const WEB_GL_OPT_DESYNCHRONIZED: &str = "desynchronized";
/// WebGL2 context option key requesting discrete/high-performance GPU adapter.
pub const WEB_GL_OPT_POWER_PREF: &str = "powerPreference";
/// WebGL2 `powerPreference` value selecting the highest-throughput GPU.
pub const WEB_GL_OPT_HIGH_PERFORMANCE: &str = "high-performance";
/// WebGL2 context option key avoiding redundant drawing buffer copies.
pub const WEB_GL_OPT_PRESERVE_DRAWING: &str = "preserveDrawingBuffer";
/// Global browser `ResizeObserver` constructor name.
pub const WEB_CTOR_RESIZE_OBSERVER: &str = "ResizeObserver";
/// `ResizeObserver.observe` method name.
pub const WEB_METHOD_OBSERVE: &str = "observe";
/// `ResizeObserver.disconnect` method name.
pub const WEB_METHOD_DISCONNECT: &str = "disconnect";
/// WebGL2 `createTexture` method name.
pub const WEB_GL_CREATE_TEXTURE: &str = "createTexture";
/// WebGL2 `activeTexture` method name.
pub const WEB_GL_ACTIVE_TEXTURE: &str = "activeTexture";
/// WebGL2 `bindTexture` method name.
pub const WEB_GL_BIND_TEXTURE: &str = "bindTexture";
/// WebGL2 `texParameteri` method name.
pub const WEB_GL_TEX_PARAMETERI: &str = "texParameteri";
/// `window.visualViewport` property name.
pub const WEB_PROP_VISUAL_VIEWPORT: &str = "visualViewport";
/// `VisualViewport.width` property name.
pub const WEB_PROP_WIDTH: &str = "width";
/// `VisualViewport.height` property name.
pub const WEB_PROP_HEIGHT: &str = "height";
/// `window.open` target name opening external links in a new browser tab.
pub const WEB_OPEN_TARGET_BLANK: &str = "_blank";
/// `window.open` feature flags preventing reverse tabnabbing on external links.
pub const WEB_OPEN_FEATURES_SAFE: &str = "noopener,noreferrer";
/// Uniform name binding sampler unit 0 in `WEB_GL2_BLIT_FRAG_SHADER`.
pub const WEB_GL2_UNIFORM_TEX: &str = "u_tex";
/// Uniform name carrying the physical drawing-buffer size (`vec2`) in `WEB_GL2_BLIT_FRAG_SHADER`.
pub const WEB_GL2_UNIFORM_VIEW: &str = "u_view";
/// CSS pixel unit suffix stripped when parsing `getComputedStyle` inset strings.
pub const WEB_CSS_PX_SUFFIX: &str = "px";
/// Argument index key for single-argument `Reflect::construct` invocation.
pub const WEB_REFLECT_ARG0_KEY: &str = "0";
/// Inline style HTML attribute name.
pub const WEB_ATTR_STYLE: &str = "style";
/// Tabindex HTML attribute name enabling keyboard focus on canvas.
pub const WEB_ATTR_TABINDEX: &str = "tabindex";
/// Default full-viewport body inline CSS eliminating scrollbars and borders.
pub const WEB_BODY_STYLE: &str =
"margin:0;padding:0;width:100vw;height:100vh;overflow:hidden;background:#09090b;";
/// Inline CSS prefix for the full-viewport 1:1 physical canvas surface.
pub const WEB_CANVAS_STYLE_PREFIX: &str =
"position:fixed;inset:0;width:100%;height:100%;display:block;outline:none;cursor:";
/// Inline CSS suffix disabling browser touch panning and text selection on the canvas surface.
pub const WEB_CANVAS_STYLE_SUFFIX: &str =
";margin:0;touch-action:none;user-select:none;-webkit-user-select:none;";
/// Default canvas tabindex value enabling keyboard focus.
pub const WEB_ATTR_TABINDEX_ZERO: &str = "0";
/// 2D rendering context identifier passed to `HTMLCanvasElement.getContext`.
pub const WEB_CONTEXT_2D: &str = "2d";
/// Media query string used to detect browser dark mode preference.
pub const WEB_DARK_MEDIA_QUERY: &str = "(prefers-color-scheme: dark)";
/// Error message when browser `window` or `document` is unavailable.
pub const ERR_WEB_WINDOW_MISSING: &str = "browser window or document unavailable";
/// Error message when `HTMLCanvasElement` creation or casting fails.
pub const ERR_WEB_CANVAS_CREATE: &str = "failed to create HTMLCanvasElement";
/// Error message when `CanvasRenderingContext2d` cannot be acquired.
pub const ERR_WEB_CTX2D_MISSING: &str = "failed to acquire 2d canvas rendering context";
/// Error message when `ImageData` creation or `putImageData` fails.
pub const ERR_WEB_PRESENT_FAILED: &str = "failed to blit ImageData to canvas";
/// CSS cursor keyword for default arrow.
pub const WEB_CURSOR_DEFAULT: &str = "default";
/// CSS cursor keyword for clickable hand pointer.
pub const WEB_CURSOR_POINTER: &str = "pointer";
/// CSS cursor keyword for text selection I-beam.
pub const WEB_CURSOR_TEXT: &str = "text";
/// CSS cursor keyword for precision crosshair.
pub const WEB_CURSOR_CROSSHAIR: &str = "crosshair";
/// CSS cursor keyword for disabled control.
pub const WEB_CURSOR_NOT_ALLOWED: &str = "not-allowed";
/// CSS cursor keyword for open grab hand.
pub const WEB_CURSOR_GRAB: &str = "grab";
/// CSS cursor keyword for active grabbing hand.
pub const WEB_CURSOR_GRABBING: &str = "grabbing";
/// CSS cursor keyword for omnidirectional move.
pub const WEB_CURSOR_MOVE: &str = "move";
/// CSS cursor keyword for horizontal resize.
pub const WEB_CURSOR_EW_RESIZE: &str = "ew-resize";
/// CSS cursor keyword for vertical resize.
pub const WEB_CURSOR_NS_RESIZE: &str = "ns-resize";
/// DOM Element method name entering browser fullscreen.
pub const WEB_METHOD_REQUEST_FULLSCREEN: &str = "requestFullscreen";
/// DOM Document method name exiting browser fullscreen.
pub const WEB_METHOD_EXIT_FULLSCREEN: &str = "exitFullscreen";
/// DOM `devicemotion` window event name.
pub const WEB_EVENT_DEVICE_MOTION: &str = "devicemotion";
/// DOM `deviceorientation` window event name.
pub const WEB_EVENT_DEVICE_ORIENTATION: &str = "deviceorientation";
/// Global `DeviceMotionEvent` constructor property name on `window`.
pub const WEB_CTOR_DEVICE_MOTION_EVENT: &str = "DeviceMotionEvent";
/// Global `DeviceOrientationEvent` constructor property name on `window`.
pub const WEB_CTOR_DEVICE_ORIENTATION_EVENT: &str = "DeviceOrientationEvent";
/// iOS Safari sensor permission static method name on `DeviceMotionEvent` / `DeviceOrientationEvent`.
pub const WEB_METHOD_REQUEST_PERMISSION: &str = "requestPermission";
/// iOS Safari granted permission string value.
pub const WEB_PERMISSION_GRANTED: &str = "granted";
/// `window.screen` property name.
pub const WEB_PROP_SCREEN: &str = "screen";
/// `screen.orientation` / legacy `window.orientation` property name.
pub const WEB_PROP_ORIENTATION: &str = "orientation";
/// `screen.orientation.angle` property name.
pub const WEB_PROP_ANGLE: &str = "angle";
/// `DeviceMotionEvent.accelerationIncludingGravity` property name.
pub const WEB_PROP_ACCEL_INCLUDING_GRAVITY: &str = "accelerationIncludingGravity";
/// `DeviceMotionEvent.acceleration` property name.
pub const WEB_PROP_ACCELERATION: &str = "acceleration";
/// `DeviceMotionEvent.rotationRate` property name.
pub const WEB_PROP_ROTATION_RATE: &str = "rotationRate";
/// `DeviceOrientationEvent` / `rotationRate` alpha axis property name.
pub const WEB_PROP_ALPHA: &str = "alpha";
/// `DeviceOrientationEvent` / `rotationRate` beta axis property name.
pub const WEB_PROP_BETA: &str = "beta";
/// `DeviceOrientationEvent` / `rotationRate` gamma axis property name.
pub const WEB_PROP_GAMMA: &str = "gamma";
/// Cartesian `x` component property name.
pub const WEB_PROP_AXIS_X: &str = "x";
/// Cartesian `y` component property name.
pub const WEB_PROP_AXIS_Y: &str = "y";
/// Cartesian `z` component property name.
pub const WEB_PROP_AXIS_Z: &str = "z";
/// Degree-to-radian conversion constant (`PI / 180`).
pub const WEB_DEG_TO_RAD: f32 = PI / 180.0;
/// Exponential low-pass filter factor used to separate gravity when `DeviceMotionEvent.acceleration` is null.
pub const WEB_GRAVITY_LPF_ALPHA: f32 = 0.22;
/// Minimum dot-product magnitude between orientation gravity and accelerometer gravity to auto-detect Safari vs W3C sign convention.
pub const WEB_GRAVITY_SIGN_DOT_THRESHOLD: f32 = 12.0;