Skip to main content

euv_example/app/
const.rs

1/// Default window title for the native showcase binary.
2pub const SHOWCASE_WINDOW_TITLE: &str = "Euv Studio";
3/// Default logical window width in pixels.
4pub const SHOWCASE_WINDOW_WIDTH: u32 = 1200;
5/// Default logical window height in pixels.
6pub const SHOWCASE_WINDOW_HEIGHT: u32 = 800;
7/// Command-line flag enabling deterministic headless execution.
8pub const FLAG_HEADLESS: &str = "--headless";
9/// Command-line flag selecting the software rasterizer.
10pub const FLAG_SOFTWARE: &str = "--software";
11/// Command-line flag selecting the hardware GPU pipeline.
12pub const FLAG_HARDWARE: &str = "--hardware";
13/// Command-line flag selecting the hybrid compositor pipeline.
14pub const FLAG_HYBRID: &str = "--hybrid";
15/// Command-line flag keeping the native window open in an interactive event loop.
16pub const FLAG_INTERACTIVE: &str = "--interactive";
17/// Command-line flag capturing raw RGBA screenshots of all showcase routes into the following directory.
18pub const FLAG_CAPTURE_DIR: &str = "--capture-dir";
19/// Dev-only CLI flag printing the live AI Schema v1 runtime & layout snapshot JSON.
20#[cfg(all(debug_assertions, not(target_arch = "wasm32")))]
21pub const FLAG_AI_SCHEMA: &str = "--ai-schema";
22/// Dev-only CLI flag executing a single AI Schema v1 JSON request against the headless showcase.
23#[cfg(all(debug_assertions, not(target_arch = "wasm32")))]
24pub const FLAG_AI_QUERY: &str = "--ai-query";
25/// DOM KeyboardEvent key name for Enter.
26#[cfg(target_arch = "wasm32")]
27pub(crate) const WEB_KEY_ENTER: &str = "Enter";
28/// DOM KeyboardEvent key name for Backspace.
29#[cfg(target_arch = "wasm32")]
30pub(crate) const WEB_KEY_BACKSPACE: &str = "Backspace";
31/// DOM KeyboardEvent key name for Delete.
32#[cfg(target_arch = "wasm32")]
33pub(crate) const WEB_KEY_DELETE: &str = "Delete";
34/// DOM KeyboardEvent key name for Escape.
35#[cfg(target_arch = "wasm32")]
36pub(crate) const WEB_KEY_ESCAPE: &str = "Escape";
37/// DOM KeyboardEvent key name for Tab.
38#[cfg(target_arch = "wasm32")]
39pub(crate) const WEB_KEY_TAB: &str = "Tab";
40/// DOM KeyboardEvent key name for Spacebar.
41#[cfg(target_arch = "wasm32")]
42pub(crate) const WEB_KEY_SPACE: &str = " ";
43/// DOM KeyboardEvent key name for ArrowLeft.
44#[cfg(target_arch = "wasm32")]
45pub(crate) const WEB_KEY_ARROW_LEFT: &str = "ArrowLeft";
46/// DOM KeyboardEvent key name for ArrowRight.
47#[cfg(target_arch = "wasm32")]
48pub(crate) const WEB_KEY_ARROW_RIGHT: &str = "ArrowRight";
49/// DOM KeyboardEvent key name for ArrowUp.
50#[cfg(target_arch = "wasm32")]
51pub(crate) const WEB_KEY_ARROW_UP: &str = "ArrowUp";
52/// DOM KeyboardEvent key name for ArrowDown.
53#[cfg(target_arch = "wasm32")]
54pub(crate) const WEB_KEY_ARROW_DOWN: &str = "ArrowDown";
55/// DOM event name for pointer movement.
56#[cfg(target_arch = "wasm32")]
57pub(crate) const WEB_EVENT_POINTER_MOVE: &str = "pointermove";
58/// DOM event name for pointer press.
59#[cfg(target_arch = "wasm32")]
60pub(crate) const WEB_EVENT_POINTER_DOWN: &str = "pointerdown";
61/// DOM event name for pointer release.
62#[cfg(target_arch = "wasm32")]
63pub(crate) const WEB_EVENT_POINTER_UP: &str = "pointerup";
64/// DOM event name for pointer cancel.
65#[cfg(target_arch = "wasm32")]
66pub(crate) const WEB_EVENT_POINTER_CANCEL: &str = "pointercancel";
67/// DOM event name for lost pointer capture.
68#[cfg(target_arch = "wasm32")]
69pub(crate) const WEB_EVENT_LOST_POINTER_CAPTURE: &str = "lostpointercapture";
70/// DOM event name for window blur.
71#[cfg(target_arch = "wasm32")]
72pub(crate) const WEB_EVENT_BLUR: &str = "blur";
73/// DOM event name for mouse/trackpad wheel scroll.
74#[cfg(target_arch = "wasm32")]
75pub(crate) const WEB_EVENT_WHEEL: &str = "wheel";
76/// DOM event name for key down.
77#[cfg(target_arch = "wasm32")]
78pub(crate) const WEB_EVENT_KEY_DOWN: &str = "keydown";
79/// DOM event name for key up.
80#[cfg(target_arch = "wasm32")]
81pub(crate) const WEB_EVENT_KEY_UP: &str = "keyup";
82/// DOM event name for window resize.
83#[cfg(target_arch = "wasm32")]
84pub(crate) const WEB_EVENT_RESIZE: &str = "resize";
85/// DOM `PointerEvent.pointerType` value for touch contacts.
86#[cfg(target_arch = "wasm32")]
87pub(crate) const WEB_PTR_TYPE_TOUCH: &str = "touch";
88/// DOM `PointerEvent.pointerType` value for pen/stylus contacts.
89#[cfg(target_arch = "wasm32")]
90pub(crate) const WEB_PTR_TYPE_PEN: &str = "pen";
91/// DOM CSS selector for the mounted canvas element.
92#[cfg(target_arch = "wasm32")]
93pub(crate) const WEB_SELECTOR_CANVAS: &str = "canvas";
94/// DOM tag name for the hidden browser IME proxy input element.
95#[cfg(target_arch = "wasm32")]
96pub(crate) const WEB_IME_INPUT_TAG: &str = "input";
97/// DOM id attribute for the hidden browser IME proxy input element.
98#[cfg(target_arch = "wasm32")]
99pub(crate) const WEB_IME_INPUT_ID: &str = "euv-ime-proxy";
100/// DOM attribute name for `id`.
101#[cfg(target_arch = "wasm32")]
102pub(crate) const WEB_IME_ATTR_ID: &str = "id";
103/// DOM attribute name for `type`.
104#[cfg(target_arch = "wasm32")]
105pub(crate) const WEB_IME_ATTR_TYPE: &str = "type";
106/// DOM `<input type="text">` attribute value.
107#[cfg(target_arch = "wasm32")]
108pub(crate) const WEB_IME_ATTR_TEXT: &str = "text";
109/// DOM attribute name for `autocomplete`.
110#[cfg(target_arch = "wasm32")]
111pub(crate) const WEB_IME_ATTR_AUTOCOMPLETE: &str = "autocomplete";
112/// DOM attribute value disabling autocomplete/autocorrect/autocapitalize.
113#[cfg(target_arch = "wasm32")]
114pub(crate) const WEB_IME_ATTR_OFF: &str = "off";
115/// DOM attribute name for `autocorrect`.
116#[cfg(target_arch = "wasm32")]
117pub(crate) const WEB_IME_ATTR_AUTOCORRECT: &str = "autocorrect";
118/// DOM attribute name for `autocapitalize`.
119#[cfg(target_arch = "wasm32")]
120pub(crate) const WEB_IME_ATTR_AUTOCAPITALIZE: &str = "autocapitalize";
121/// DOM attribute name for `spellcheck`.
122#[cfg(target_arch = "wasm32")]
123pub(crate) const WEB_IME_ATTR_SPELLCHECK: &str = "spellcheck";
124/// DOM attribute value `"false"`.
125#[cfg(target_arch = "wasm32")]
126pub(crate) const WEB_IME_ATTR_FALSE: &str = "false";
127/// DOM attribute name for `aria-label`.
128#[cfg(target_arch = "wasm32")]
129pub(crate) const WEB_IME_ATTR_ARIA_LABEL: &str = "aria-label";
130/// Accessible label applied to the hidden IME proxy input.
131#[cfg(target_arch = "wasm32")]
132pub(crate) const WEB_IME_ARIA_LABEL: &str = "euv text input";
133/// DOM attribute name for inline CSS `style`.
134#[cfg(target_arch = "wasm32")]
135pub(crate) const WEB_IME_ATTR_STYLE: &str = "style";
136/// Inline CSS keeping the IME proxy input visually hidden without triggering iOS Safari auto-zoom.
137#[cfg(target_arch = "wasm32")]
138pub(crate) const WEB_IME_STYLE: &str = "position:fixed;left:0;top:0;width:1px;height:1px;opacity:0;pointer-events:none;border:0;padding:0;margin:0;z-index:-1;font-size:16px;";
139/// DOM event name for text input changes.
140#[cfg(target_arch = "wasm32")]
141pub(crate) const WEB_EVENT_INPUT: &str = "input";
142/// DOM event name for IME composition start.
143#[cfg(target_arch = "wasm32")]
144pub(crate) const WEB_EVENT_COMPOSITION_START: &str = "compositionstart";
145/// DOM event name for IME composition end.
146#[cfg(target_arch = "wasm32")]
147pub(crate) const WEB_EVENT_COMPOSITION_END: &str = "compositionend";
148/// DOM JS property name for an input element's string value.
149#[cfg(target_arch = "wasm32")]
150pub(crate) const WEB_PROP_VALUE: &str = "value";
151/// Native action subcommand showing the browser soft keyboard / IME proxy.
152#[cfg(target_arch = "wasm32")]
153pub(crate) const WEB_IME_ACTION_SHOW: &str = "show";
154/// Native action subcommand hiding the browser soft keyboard / IME proxy.
155#[cfg(target_arch = "wasm32")]
156pub(crate) const WEB_IME_ACTION_HIDE: &str = "hide";
157/// Native action subcommand requesting browser fullscreen entry.
158#[cfg(target_arch = "wasm32")]
159pub(crate) const WEB_FS_ACTION_ON: &str = "on";
160/// Native action subcommand requesting browser fullscreen exit.
161#[cfg(target_arch = "wasm32")]
162pub(crate) const WEB_FS_ACTION_OFF: &str = "off";
163/// DOM event name for page visibility changes.
164#[cfg(target_arch = "wasm32")]
165pub(crate) const WEB_EVENT_VISIBILITY_CHANGE: &str = "visibilitychange";
166/// DOM event name for window focus gain.
167#[cfg(target_arch = "wasm32")]
168pub(crate) const WEB_EVENT_FOCUS: &str = "focus";
169/// DOM event name for page show lifecycle notifications.
170#[cfg(target_arch = "wasm32")]
171pub(crate) const WEB_EVENT_PAGE_SHOW: &str = "pageshow";
172/// DOM event name for page hide lifecycle notifications.
173#[cfg(target_arch = "wasm32")]
174pub(crate) const WEB_EVENT_PAGE_HIDE: &str = "pagehide";
175/// DOM event name for page unload termination warnings.
176#[cfg(target_arch = "wasm32")]
177pub(crate) const WEB_EVENT_BEFORE_UNLOAD: &str = "beforeunload";
178/// DOM event name for network online transitions.
179#[cfg(target_arch = "wasm32")]
180pub(crate) const WEB_EVENT_ONLINE: &str = "online";
181/// DOM event name for network offline transitions.
182#[cfg(target_arch = "wasm32")]
183pub(crate) const WEB_EVENT_OFFLINE: &str = "offline";
184/// DOM event name for media-query preference changes.
185#[cfg(target_arch = "wasm32")]
186pub(crate) const WEB_EVENT_CHANGE: &str = "change";
187/// DOM event name for URL fragment hash navigation changes.
188#[cfg(target_arch = "wasm32")]
189pub(crate) const WEB_EVENT_HASH_CHANGE: &str = "hashchange";
190/// CSS media query detecting browser dark color scheme preference.
191#[cfg(target_arch = "wasm32")]
192pub(crate) const WEB_MEDIA_PREFERS_DARK: &str = "(prefers-color-scheme: dark)";
193/// DOM window property exposing the mobile soft-keyboard `VisualViewport`.
194#[cfg(target_arch = "wasm32")]
195pub(crate) const WEB_PROP_VISUAL_VIEWPORT: &str = "visualViewport";
196/// DOM `VisualViewport.height` property key.
197#[cfg(target_arch = "wasm32")]
198pub(crate) const WEB_PROP_HEIGHT: &str = "height";
199/// Minimum logical pixel viewport contraction treated as an active browser soft keyboard.
200#[cfg(target_arch = "wasm32")]
201pub(crate) const WEB_KEYBOARD_MIN_DELTA_PX: f32 = 80.0;
202/// JS parameter list for attaching a `ResizeObserver` onto the showcase `<canvas>`.
203#[cfg(target_arch = "wasm32")]
204pub(crate) const WEB_JS_ATTACH_RESIZE_ARGS: &str = "el,cb";
205/// JS body attaching a browser `ResizeObserver` to update cached canvas metrics without per-rAF reflows.
206#[cfg(target_arch = "wasm32")]
207pub(crate) const WEB_JS_ATTACH_RESIZE_OBSERVER: &str =
208    "if(typeof ResizeObserver!=='undefined'){new ResizeObserver(function(){cb();}).observe(el);}";
209/// JS parameter list for installing a self-rearming `devicePixelRatio` media-query watcher.
210#[cfg(target_arch = "wasm32")]
211pub(crate) const WEB_JS_WATCH_DPR_ARGS: &str = "cb";
212/// JS body listening for `devicePixelRatio` transitions via `matchMedia` without per-rAF allocations.
213#[cfg(target_arch = "wasm32")]
214pub(crate) const WEB_JS_WATCH_DPR_BODY: &str = "if(typeof matchMedia==='function'){var w=function(){var q='(resolution: '+window.devicePixelRatio+'dppx)';var m=matchMedia(q);var on=function(){cb();w();};if(m.addEventListener){m.addEventListener('change',on,{once:true});}else if(m.addListener){m.addListener(on);}};w();}";