pub struct DomBridge;Expand description
An asynchronous host bridge; errors are acknowledged by the host.
Implementations§
Source§impl DomBridge
impl DomBridge
Sourcepub async fn show_modal(self, id: &Id) -> Result<(), DomError>
pub async fn show_modal(self, id: &Id) -> Result<(), DomError>
Open a dialog modally after mount. Fall back to an inline open dialog.
§Errors
Returns a host error when the target or API is unavailable.
Sourcepub async fn close_dialog(self, id: &Id) -> Result<(), DomError>
pub async fn close_dialog(self, id: &Id) -> Result<(), DomError>
Close a dialog. Fall back to removing its open state in the virtual DOM.
§Errors
Returns a host error when the target or API is unavailable.
Sourcepub async fn toggle_popover(self, id: &Id, open: bool) -> Result<(), DomError>
pub async fn toggle_popover(self, id: &Id, open: bool) -> Result<(), DomError>
Change popover visibility. Fall back to an in-flow panel.
§Errors
Returns a host error when the target or API is unavailable.
Sourcepub async fn focus(self, id: &Id) -> Result<(), DomError>
pub async fn focus(self, id: &Id) -> Result<(), DomError>
Focus a node. Prefer MountedData::set_focus when a mount handle exists.
§Errors
Returns a host error when the target or API is unavailable.
Sourcepub async fn scroll_into_view(
self,
id: &Id,
block: ScrollBlock,
) -> Result<(), DomError>
pub async fn scroll_into_view( self, id: &Id, block: ScrollBlock, ) -> Result<(), DomError>
Scroll a node into view; unsupported hosts leave the viewport unchanged.
§Errors
Returns a host error when the target or API is unavailable.
Sourcepub async fn scroll_edges(self, id: &Id) -> Result<(bool, bool), DomError>
pub async fn scroll_edges(self, id: &Id) -> Result<(bool, bool), DomError>
Whether a scroll container is at its inline start and end, read from the host the
way upstream’s carousel.ts does, RTL included.
§Errors
Returns a host error when the target or API is unavailable.
Sourcepub async fn page(self, id: &Id, forward: bool) -> Result<(), DomError>
pub async fn page(self, id: &Id, forward: bool) -> Result<(), DomError>
Scroll a container by most of its visible width, forwards in the reading direction or back.
§Errors
Returns a host error when the target or API is unavailable.
Sourcepub async fn place_below(self, list: &Id, invoker: &Id) -> Result<(), DomError>
pub async fn place_below(self, list: &Id, invoker: &Id) -> Result<(), DomError>
Place a popup list under its invoker, or above it when there is no room below, capped to the space available. Positioning needs layout, so it is the host’s.
§Errors
Returns a host error when the target or API is unavailable.
Sourcepub async fn place_at(self, id: &Id, point: MenuPoint) -> Result<(), DomError>
pub async fn place_at(self, id: &Id, point: MenuPoint) -> Result<(), DomError>
Place a fixed popup at a viewport point, as upstream’s menu.ts does: its start
edge at x (or edge), clamped inside the viewport, and moved above flip_y
when it would cross the bottom.
§Errors
Returns a host error when the target or API is unavailable.
Sourcepub async fn point_below(self, trigger: &Id) -> Result<MenuPoint, DomError>
pub async fn point_below(self, trigger: &Id) -> Result<MenuPoint, DomError>
The point a menu opens at under a trigger: its start edge, 4px below, flipping to 4px above.
§Errors
Returns a host error when the target or API is unavailable.
Sourcepub async fn capture_pointer(
self,
id: &Id,
pointer: i32,
) -> Result<(), DomError>
pub async fn capture_pointer( self, id: &Id, pointer: i32, ) -> Result<(), DomError>
Route a pointer’s events to an element for the rest of a drag.
§Errors
Returns a host error when the target or API is unavailable.
Sourcepub async fn set_indeterminate(
self,
id: &Id,
mixed: bool,
) -> Result<(), DomError>
pub async fn set_indeterminate( self, id: &Id, mixed: bool, ) -> Result<(), DomError>
Show a checkbox as mixed, which only a DOM property can express. Without a host the checkbox renders unchecked.
§Errors
Returns a host error when the target or API is unavailable.
Sourcepub async fn copy_text(self, text: &str) -> Result<(), DomError>
pub async fn copy_text(self, text: &str) -> Result<(), DomError>
Copy text through a data channel. On failure, retain selectable source text.
§Errors
Returns Unsupported or Rejected when clipboard access is unavailable.
Sourcepub async fn delay(self, ms: u32) -> Result<(), DomError>
pub async fn delay(self, ms: u32) -> Result<(), DomError>
Wait ms milliseconds on the host’s clock, for timed behaviour such as toast
expiry. Hosts without a script runtime return Unsupported at once, and callers
keep their untimed fallback (a toast then stays until dismissed).
§Errors
Returns Unsupported when the host cannot run timers.
Sourcepub async fn reload_frame(self, id: &Id) -> Result<(), DomError>
pub async fn reload_frame(self, id: &Id) -> Result<(), DomError>
Reload a frame in place. Re-rendering the same src would not navigate.
§Errors
Returns a host error when the target is missing or not a frame.
Sourcepub async fn prefers(self, preference: MediaPreference) -> Option<bool>
pub async fn prefers(self, preference: MediaPreference) -> Option<bool>
Whether a user preference is on, or None on hosts without media queries, where
callers keep their light, standard-contrast default.
Sourcepub fn watch(self, preference: MediaPreference) -> PreferenceWatch
pub fn watch(self, preference: MediaPreference) -> PreferenceWatch
Follow a user preference: the current value, then each change. Hosts without media queries end the stream at once.
Sourcepub async fn capabilities(self) -> Capabilities
pub async fn capabilities(self) -> Capabilities
Detect available host APIs after mounting; SSR and native return defaults.
Source§impl DomBridge
impl DomBridge
Sourcepub async fn bind_editor(self, id: &Id) -> Result<EditorSession, DomError>
pub async fn bind_editor(self, id: &Id) -> Result<EditorSession, DomError>
Attach upstream’s editor binding (editor.ts, shipped unchanged as JavaScript)
to the .fc-editor with this id.
§Errors
Unsupported where the host cannot load modules (server rendering, native), and
MissingTarget when no element has the id. The editor then stays plain,
editable text with an inert toolbar, which upstream calls degraded but not broken.