Skip to main content

Module web

Module web 

Source
Expand description

Leptos (CSR) components for building the page around an engine viewport, plus a general set of themed UI patterns: panels, forms, menus, tables, trees, a command palette, keybindings, a code editor, toasts, a status bar, drag and drop, and a resizable app shell, all driven from one set of CSS custom properties.

Enabled by the leptos cargo feature. The module is engine-free: it talks to a render worker over the crate::wire messages, so a page crate can depend on nightshade-api with default-features = false and features = ["leptos"] without compiling the engine.

Drop UiStyles and a ThemeProvider at the root, then compose components. For a worker-backed render surface, create an Engine with use_engine and render an EngineViewport; the worker side pairs with [crate::offscreen::run_offscreen] behind the offscreen feature.

use nightshade_api::web::prelude::*;

#[component]
fn App() -> impl IntoView {
    let engine = use_engine("runtime/worker.js");
    view! {
        <UiStyles />
        <ThemeProvider>
            <WebGpuGate>
                <EngineViewport engine=engine />
                <Loader ready=engine.state.ready />
            </WebGpuGate>
        </ThemeProvider>
    }
}

Re-exports§

pub use crate::wire::*;

Modules§

prelude
Everything in one import for a page crate.

Structs§

AccordionItemProps
Props for the AccordionItem component.
AccordionProps
Props for the Accordion component.
ActivityBarProps
Props for the ActivityBar component.
ActivityItem
One entry in an ActivityBar: an id, an icon glyph, and a label tooltip.
AnsiTerminalProps
Props for the AnsiTerminal component.
AssetGridProps
Props for the AssetGrid component.
AssetItem
A card in an AssetGrid, with a stable id, a label, a thumbnail image source, and an optional subtitle.
Bridge
A handle to the render worker for posting serde-serializable messages, with an optional transferable OffscreenCanvas.
ChatMessage
A single message in the transcript: a stable id for keyed rendering, its role, and the message text.
ChatProps
Props for the Chat component.
CheckFieldProps
Props for the CheckField component.
ChipGroupProps
Props for the ChipGroup component.
CodeDocument
One open document in a CodeTabs set: a stable id, a display title, and a reactive value buffer shared with the editor.
CodeEditorProps
Props for the CodeEditor component.
CodeSurfaceProps
Props for the CodeSurface component.
CodeTabsProps
Props for the CodeTabs component.
ColorFieldProps
Props for the ColorField component.
ComboOption
A selectable option for Combobox, pairing a stored value with a display label.
ComboboxProps
Props for the Combobox component.
Command
A single palette action or a submenu of nested commands.
CommandPaletteProps
Props for the CommandPalette component.
CommandRegistry
Reactive store of registered commands plus a bounded most-recently-run list.
ContextMenuProps
Props for the ContextMenu component.
DialogProps
Props for the Dialog component.
DiffLine
A single line of a computed diff, with its content and its line numbers on each side (None where the line is absent).
DiffProps
Props for the Diff component.
DisclosureProps
Props for the Disclosure component.
DockLayoutProps
Props for the DockLayout component.
DockMainProps
Props for the DockMain component.
DockPanelProps
Props for the DockPanel component.
DockTab
A tab in a TabDock: a stable id, a display title, and the id of the pane it currently lives in.
DragLayerProps
Props for the DragLayer component.
DragPayload
What is being dragged: a kind used by drop zones to accept or reject it, an id identifying the source, and a label shown in the drag preview.
DragSourceProps
Props for the DragSource component.
DragState
The shared drag session, provided via context by provide_drag. Tracks the active payload, the pointer position, the hovered drop zone, and the registry of drop callbacks. Copy, so it can be captured in event handlers.
DropZoneProps
Props for the DropZone component.
DropdownProps
Props for the Dropdown component.
DynamicFormProps
Props for the DynamicForm component.
EditorShellProps
Props for the EditorShell component.
Engine
A Copy handle to the render worker connection. Holds the reactive state, buffers outgoing messages until the worker connects, and routes application messages to a registered handler.
EngineState
Reactive signals reflecting the render worker’s status, kept in sync from the messages it sends back.
EngineViewportProps
Props for the EngineViewport component.
FormField
A single field in a DynamicForm, pairing a JSON key and display label with its FieldSchema.
HistoryNode
A flattened view of one history node for rendering: its id, label, tree depth, and whether it is the current state.
HudPanelProps
Props for the HudPanel component.
InspectorProps
Props for the Inspector component.
InspectorRowProps
Props for the InspectorRow component.
InspectorSectionProps
Props for the InspectorSection component.
JumpOverlayProps
Props for the JumpOverlay component.
JumpTarget
A place the jump overlay can send you: a stable id reported on selection and the screen position (x, y, in pixels) where its label is drawn.
KeymapProviderProps
Props for the KeymapProvider component.
ListItem
An entry in an OrderedList, identified by id with a display label.
LoaderProps
Props for the Loader component.
LogEntry
One row in a LogView: a stable id, a kind, a primary label, optional detail text, and a repeat count shown as a multiplier badge.
LogViewProps
Props for the LogView component.
MarkdownProps
Props for the Markdown component.
MenuBarMenuProps
Props for the MenuBarMenu component.
MenuBarProps
Props for the MenuBar component.
MenuItemProps
Props for the MenuItem component.
MenuProps
Props for the Menu component.
MenuSeparatorProps
Props for the MenuSeparator component.
MultiEditorProps
Props for the MultiEditor component.
NavGizmoProps
Props for the NavGizmo component.
NumberFieldProps
Props for the NumberField component.
OrderedListProps
Props for the OrderedList component.
PopoverProps
Props for the Popover component.
RetainedClosures
A per-owner store that keeps values (typically Closures) alive and drops them on cleanup. Use this instead of Closure::forget so one-shot JS callbacks are reclaimed when the component unmounts. Create it once at component init with use_retained_closures, then retain from any later handler; the handle is Copy, so callbacks can capture it freely.
SearchItem
An entry in a SearchList, with a stable id, a title and subtitle (both searched), and a detail body shown when the entry is selected.
SearchListProps
Props for the SearchList component.
SelectProps
Props for the Select component.
SelectedCardProps
Props for the SelectedCard component.
SliderFieldProps
Props for the SliderField component.
SocketHandle
A cheap, copyable handle to a reconnecting WebSocket created by use_reconnecting_socket.
StatusBarProps
Props for the StatusBar component.
StatusItemProps
Props for the StatusItem component.
StatusSpacerProps
Props for the StatusSpacer component.
SubmenuProps
Props for the Submenu component.
SwatchPaletteProps
Props for the SwatchPalette component.
SwatchProps
Props for the Swatch component.
SwitchProps
Props for the Switch component.
TabBarProps
Props for the TabBar component.
TabDockProps
Props for the TabDock component.
TableProps
Props for the Table component.
TagInputProps
Props for the TagInput component.
TerminalGrid
A fixed-size character cell grid with an embedded ANSI escape-sequence parser: feeding it bytes updates the cells, cursor, and graphic attributes.
TerminalHandle
A cheap, copyable handle to a reactive TerminalGrid, shared between the code that drives output and the AnsiTerminal view.
TerminalLine
One line of terminal scrollback: a stable id for keyed rendering, its text, and its display tone.
TerminalProps
Props for the Terminal component.
TextFieldProps
Props for the TextField component.
Theme
A named color palette. Each field maps to a --nightshade-* CSS custom property emitted by Theme::to_css and scoped to :root[data-theme="{id}"].
ThemeMenuProps
Props for the ThemeMenu component.
ThemePickerProps
Props for the ThemePicker component.
ThemeProviderProps
Props for the ThemeProvider component.
Toast
A single queued toast notification held by a Toaster.
Toaster
A handle for pushing toast notifications. Obtain one with use_toaster inside a ToastHub.
ToggleChipProps
Props for the ToggleChip component.
ToolButtonProps
Props for the ToolButton component.
ToolbarGroupProps
Props for the ToolbarGroup component.
ToolbarProps
Props for the Toolbar component.
ToolbarSpacerProps
Props for the ToolbarSpacer component.
TreeItem
A single node in a Tree, carrying its stable id, display label, an optional icon glyph, a lazy flag for branches whose children load on expand, and its children.
TreeProps
Props for the Tree component.
UndoHistory
A reactive, branching undo history. Every edit becomes a node whose parent is the state it was made from, so undoing and then editing forks a new branch rather than discarding the old one. Copy, so it can be captured freely in closures.
UndoTreeProps
Props for the UndoTree component.
Vec3FieldProps
Props for the Vec3Field component.
ViewportOverlayProps
Props for the ViewportOverlay component.
ViewportProps
Props for the Viewport component.
VirtualListProps
Props for the VirtualList component.
WebGpuGateProps
Props for the WebGpuGate component.

Enums§

Align
Alignment of a floating element along the anchor’s cross axis: to its start, centered, or to its end.
ChatRole
Who or what produced a ChatMessage, used to pick the bubble’s styling.
DockSide
Which edge a DockPanel sits against, which also flips its resize direction.
DroppedFiles
A routed drop: either a multi-file glTF with its sibling resources keyed relative to the .gltf, or plain files to load one by one.
FieldSchema
The type of a form field, which determines the control DynamicForm renders and the JSON shape of its value.
LineKind
Whether a diffed line is unchanged, added, or removed.
LogKind
The severity or category of a LogEntry, used to pick its color and short tag.
ResizeAxis
The axis a ResizeHandle drags along: Horizontal adjusts width, Vertical adjusts height.
Side
The preferred side of the anchor on which to place a floating element. Placement may flip to the opposite side when there is not enough room.
SplitAxis
Whether a DockLayout arranges its children horizontally or vertically.
TerminalTone
Visual style applied to a terminal line.
ViewportEvent
A normalized input or layout event emitted by Viewport, with coordinates in physical (device-pixel) space, ready to forward to the render worker.

Constants§

THEMES
The built-in themes as (id, label) pairs; the first entry is the default.

Functions§

Accordion
A container for AccordionItem children that keeps at most one item open at a time, optionally starting with the item whose id matches default_open.
AccordionItem
A single collapsible section within an Accordion, identified by id and headed by title. Clicking its header opens it and closes any sibling that was open.
ActivityBar
A vertical strip of icon buttons; clicking one sets active to its id and invokes the optional on_select callback.
AnsiTerminal
Renders the grid behind handle as rows of style-merged spans; when a keyboard on_key callback is supplied, key presses are translated to their terminal byte sequences and forwarded to it.
AppShell
Full-viewport root container that fills the window and hosts the rest of the app’s layout.
AssetGrid
A grid of thumbnail cards built from items, invoking on_select with an item’s id when its card is clicked. When searchable is set a filter box (labeled by placeholder) narrows cards by label.
Badge
A small inline label. Pass a variant class (such as "success" or "danger") to color it and put the label text in children.
Button
A styled <button>. Pass extra classes via class and a click handler via the optional on_click callback.
Card
A bordered content container. When title is non-empty it renders a header row above the children, which fill the card body.
Chat
A chat panel that renders the messages transcript, auto-scrolling to the latest, and a compose box that fires on_send with the trimmed text on click or Enter (Shift+Enter inserts a newline). The header shows a connected dot, a busy spinner appears while working, and an optional on_reset renders a “New” button. placeholder sets the input hint.
CheckField
A labelled checkbox bound to a bool signal. Emits the new checked state through on_change.
ChipGroup
A flex container that lays out chip children, with an optional extra class.
CodeEditor
A single-buffer code editor: a transparent textarea over a highlighted <pre> overlay, with an optional line-number gutter (marking lines in diagnostics as errors), a fixed height or fill mode, and an optional Ctrl/Cmd+F find bar for find/replace over the value signal.
CodeSurface
A read-only, virtualized code view of value: renders only the rows in the visible window (plus overscan) at a fixed line_height within a scrollable area of the given height, applies the optional highlighter, and lets brace-delimited regions be folded from the gutter.
CodeTabs
A tabbed multi-document editor: renders a tab bar for documents, tracks the active document id, hosts a filling CodeEditor for the selection, and fires the optional on_close callback with a document id when its close button is clicked.
ColorField
A native color picker bound to an [f32; 3] RGB signal (components in 0.0..=1.0). Emits (rgb, committed) through on_change, with committed false during input and true on change.
Column
A vertical flex container. Merge extra classes via class.
Combobox
A filterable dropdown selector: the trigger shows the label of the current value (or placeholder), and the panel offers a text filter plus a keyboard-navigable list of options. Emits the chosen option’s value through on_select.
CommandPalette
Registry-driven command palette: fuzzy-ranked, shows recents when the query is empty, descends into submenus, and displays keybinding hints.
ContextMenu
A menu portaled to the document at position (x, y), shown while open is true.
Dialog
A modal dialog with a title, body children, and cancel/confirm buttons. Toggled by the open signal; both buttons close it and run the optional on_cancel/on_confirm callbacks. The confirm button uses danger styling when danger is set.
Diff
Renders a unified diff of the old and new signals, one row per line with old/new line numbers, a +/-/space marker, and per-kind styling.
Disclosure
A collapsible section with a clickable title header that shows or hides its children. Open state is controlled by the optional open signal, otherwise it starts from default_open.
DockLayout
The dock container. Arranges its DockMain and DockPanel children along axis and provides that axis to them via context.
DockMain
The flexible central region of a DockLayout that fills the space left by the panels.
DockPanel
An edge panel with a draggable handle. size holds its pixel extent along the layout axis and is updated as the handle is dragged, clamped between min and max; side picks the edge and drag direction. With collapsible set it shows a toggle in its header that drives the collapsed signal.
DragLayer
Renders the floating drag preview that follows the pointer while a drag is active, showing the payload’s label. Render one of these near the root.
DragSource
Wraps children as a draggable item. Arms a drag with a DragPayload built from kind, id, and label on pointer down; the drag starts once the pointer moves past the threshold.
DropZone
Wraps children as a drop target registered under id. Highlights while a drag hovers it and runs on_drop with the dropped DragPayload when a drag is released over it.
Dropdown
A button labelled label that opens a Popover containing a menu of children. The menu closes when any item is clicked.
DynamicForm
Renders a form from a list of FormFields, maintaining the collected values as a JSON object. Emits the object through on_change on every edit and, when an on_submit callback is provided, shows a submit button labelled submit_label.
EditorShell
A code-editor layout with a top toolbar, collapsible and resizable left, right, and bottom slots around the central children, and a status footer. Each *_open signal toggles a slot’s visibility; providing a matching *_size signal makes that slot resizable (and drives its pixel size) via an inserted ResizeHandle.
EngineViewport
Renders the Viewport wired to engine: it translates ViewportEvents into worker messages, completes the connection on connect, and updates the engine state (and any application message handler) from messages the worker sends back.
Grid
A CSS grid container. Merge extra classes via class to set the template.
HudPanel
A floating panel for on-surface controls or readouts.
IconButton
A square, icon-only button variant. Pass extra classes via class and a click handler via the optional on_click callback.
Inspector
The outer container for an inspector panel; wraps its children sections.
InspectorRow
A labeled inspector row pairing a label with a control rendered from children.
InspectorSection
A collapsible inspector section with a title header, optional actions rendered on the header row, and a body of children. default_open controls the initial expanded state.
JumpOverlay
A full-screen overlay that assigns short letter labels to each targets entry while open is set. Typing narrows the labels by prefix; a full match closes the overlay and runs on_jump with that target’s id, and Escape cancels.
KeymapProvider
Installs a global keydown listener that matches keys against registered command bindings and runs the first match, supporting chord sequences (for example g d).
Loader
A full-surface overlay with a spinner and message, shown until ready becomes true.
LogView
A scrolling log panel driven by the entries signal. It shows an entry count header, an optional “Clear” button (on_clear), auto-scrolls to the newest row when autoscroll is set, and calls on_select with an entry’s id when a row is clicked. Shows the empty placeholder when there are no entries.
Markdown
Parses the source signal as Markdown and renders it reactively. Supports headings, paragraphs, fenced code, ordered and unordered lists, blockquotes, horizontal rules, and inline bold, italic, code, and links.
Menu
A label button that toggles a dropdown of its children, closing on outside click or Escape and moving focus with the arrow, Home, and End keys.
MenuBar
An application menu bar that coordinates its MenuBarMenu children so only one is open at a time and hover switches between them once one is open.
MenuBarMenu
A single top-level menu within a MenuBar, keyed by id, showing a label trigger that toggles its children dropdown and coordinates open state through the bar’s context.
MenuItem
A single selectable menu row that fires on_select on click or Enter/Space.
MenuSeparator
A horizontal divider rendered between groups of menu items.
Modal
A portalled dialog shown while open is true. It traps Tab focus within the dialog, closes on Escape or backdrop click, and restores focus to the previously focused element when dismissed.
MultiEditor
A multi-cursor code editor over the value buffer on a virtualized monospace grid: add cursors above/below (Ctrl/Cmd+Alt+Arrow), add-next- occurrence (Ctrl/Cmd+D), select-all, drag-select, clipboard, and IME composition via a hidden textarea sink. Renders only the rows in the visible window (plus overscan) at the given line_height, height, and optional highlighter.
NavGizmo
An SVG orientation gizmo that projects the camera basis (right, up, forward vectors) into six labelled axis dots, depth-sorted so near axes draw on top. Clicking an axis runs on_axis with its index.
NumberField
A numeric field that evaluates arithmetic expressions, supports drag-to-scrub on its label, optional reset-to-default, clamping to min/max, integer rounding, and live validation. Emits (value, committed) through on_change, where committed marks the final value on blur, Enter, or scrub end.
OrderedList
A reorderable list of ListItems, showing move-up, move-down, and remove actions only for the callbacks that are provided (up/down are disabled at the ends). Each callback receives the affected item’s id, and on_select fires when a row’s label is clicked. Renders an “Empty” placeholder when there are no items.
Overlay
Renders children into a <Portal> so they escape the normal DOM flow and stack above the rest of the app.
Panel
A framed section, typically for editor sidebars. A non-empty title renders a header above the children, which fill the panel body.
Popover
A floating panel anchored to a trigger element, toggled by the open signal and by clicking the trigger. It repositions on scroll and resize to stay in the viewport, flipping side and shifting as needed, and dismisses on outside click via on_dismiss.
Progress
A horizontal progress bar. The reactive value is divided by max (default 1.0) and clamped to fill 0% to 100% of the track.
ResizeHandle
A draggable divider that writes the pointer’s movement along axis into the value signal, clamped to min/max (defaults 120.0/2000.0). Set invert to reverse the drag direction (for panels anchored to the right or bottom).
Row
A horizontal flex container. Merge extra classes via class.
Scrim
A full-screen backdrop behind overlay content. Clicking it runs the optional on_dismiss callback.
SearchList
A searchable list of items with a text input that filters by title and subtitle. The active entry expands to show its detail body and scrolls into view; selected and on_select track the current selection and placeholder customizes the search box.
Select
A labelled dropdown built from (value, text) option pairs, bound to a String signal. Emits the selected option value through on_change.
SelectedCard
Renders a small card describing the selected entity’s name and id, or a “None” placeholder when nothing is selected.
SliderField
A range slider bound to a f64 signal with reactive min, max, and a fixed step, showing the current value. Emits (value, committed) through on_change, with committed false during drag and true on release.
Spinner
An indeterminate loading spinner.
StatusBar
The status strip container. Renders a role="status" row and lays out its StatusItem and StatusSpacer children left to right.
StatusItem
A single cell in the status bar. Shows an optional leading icon before the children, and forwards an extra class for styling.
StatusSpacer
A flexible gap that pushes the items after it to the far end of the bar.
Submenu
A nested menu row that reveals its children in a flyout on hover or click.
Swatch
A single color swatch button showing color as its background, marked active via the active signal. Runs the optional on_select callback when clicked.
SwatchPalette
A row of Swatch buttons built from colors, highlighting the one matching the selected signal. Emits the chosen color string through on_select.
Switch
A labelled toggle switch (an ARIA switch button) bound to a bool signal. Emits the toggled state through on_change.
TabBar
A horizontal row of tabs from (id, label) pairs, binding the selected id to active and cycling selection with the left and right arrow keys.
TabDock
Renders one drop-zone pane per entry in panes, each showing its tabs as draggable buttons and the body of the active tab via the render closure. Dragging a tab onto another pane moves it there and activates it; empty panes show a drop hint.
Table
A data table with multi-column sort (shift-click for additive sort), text filter, column resize and show/hide, sticky header, pagination, inline cell edit, and optional row virtualization. rows is a reactive signal of row data; on_row_click, on_cell_edit, and selected_row wire up selection and editing.
TagInput
An editable list of tags with a text entry that adds a trimmed tag on Enter. Emits new tags through on_add and removed tags through on_remove.
Terminal
A scrollback terminal that renders lines (auto-scrolling to the bottom as they change) with a prompt sigil (defaulting to $) and an input row that fires on_input with the trimmed draft when Enter is pressed.
TextField
A single-line text field with optional help and error notes. Commits on change, or debounces input by debounce milliseconds when set, emitting the text through on_commit.
ThemeMenu
A button-triggered theme menu that live-previews each theme on hover and commits the selection on click.
ThemePicker
A <select> dropdown for choosing among the registered themes, bound to the active-theme signal.
ThemeProvider
Provides the active-theme signal and theme registry to children, injects the registered themes’ CSS, and keeps the document’s data-theme in sync with the active theme. Wrap your app in this to enable theming.
ToastHub
Provides a Toaster to children via context and renders the stacked toast overlay. Wrap your app in this, then call use_toaster to push messages.
ToggleChip
A pill-shaped toggle button reflecting an active signal via aria-pressed. Emits a unit event through on_toggle when clicked.
ToolButton
A toolbar button that fires on_click unless disabled, reflecting active as a pressed state and using title as its tooltip.
Toolbar
A horizontal toolbar container with role="toolbar"; class is appended for styling.
ToolbarGroup
Groups related toolbar controls so they cluster together visually.
ToolbarSpacer
A flexible gap that pushes surrounding toolbar groups apart.
Tooltip
Wraps children in a focusable span that reveals text in a bubble on hover or focus.
Tree
A hierarchical tree view built from items, with arrow-key navigation, F2 inline rename, drag and drop moves, and single or multi selection. The optional on_select, selected, selection, on_rename, on_move, and on_expand props wire up interaction; default_expanded opens every branch initially.
UiStyles
Injects the stylesheet into <head> once (idempotent by element id). Render this near the root of your app.
UndoTree
Renders history nodes newest-first as an indented list of buttons. The current node is marked, and clicking a row runs on_restore with that node’s id.
Vec3Field
Three numeric inputs labelled X, Y, and Z for editing a [f64; 3] vector. Each axis clamps to min/max and evaluates arithmetic expressions on commit. Emits the full updated array with a committed flag through on_change.
Viewport
A render surface backed by a web worker. On mount it sizes a canvas to the device pixel ratio, transfers it to an OffscreenCanvas, spawns the module worker at worker_url, and reports the Bridge, canvas, and dimensions through on_connect. It forwards pointer, wheel, touch, and resize events as ViewportEvents to on_input, worker messages to on_message, failures to the optional on_error, and toggles the grabbing signal during pointer interaction.
ViewportOverlay
A positioning layer stacked over the render surface to hold HUD elements.
VirtualList
A virtualized list that renders only the visible slice of count items, calling render with each item index. item_height (fixed row height), height (viewport height), and overscan (extra rows rendered off-screen) tune the windowing.
WebGpuGate
Renders children when WebGPU is available, or an explanatory fallback card when it is not.
apply_pointer_lock
Requests or exits pointer lock on the element with id canvas, the canvas Viewport renders.
apply_theme
Apply a theme (via preview_theme) and persist its id to local storage.
builtin_themes
The set of themes shipped with the library, in display order.
diff_lines
Computes a line-level diff of old against new using a longest-common- subsequence, returning the merged sequence of equal, inserted, and deleted lines in order.
download_file
Saves bytes as a browser download named name.
download_text
Trigger a browser download of contents as a plain-text file named filename using a temporary data-URL anchor.
highlight_code
Tokenizes source into highlighted runs, classifying the given keywords and commands words while recognizing comments, strings, and numbers.
highlight_rhai
Tokenizes Rhai source into class-name and text pairs for syntax highlighting, recognizing the language keywords and the scene scripting commands.
pick_file
Opens a browser file picker filtered by accept and reads the chosen file’s bytes into on_file.
pick_file_text
Open the browser’s file picker and read the chosen file as text, invoking on_pick with its contents.
pretty_binding
Formats a raw binding string into a readable label, capitalizing keys and normalizing modifier aliases (for example "mod+shift+p" becomes "Ctrl+Shift+P").
preview_theme
Set the data-theme attribute on the document root without persisting it, useful for transient hover previews.
provide_command_registry
Creates a CommandRegistry, provides it as context, and returns it.
provide_drag
Creates the drag session, provides it via context, and installs the window pointer listeners that promote an armed drag to active, track the pointer, and commit the drop on release. Call once near the root; returns the DragState.
read_dropped_files
Reads everything in a drop into on_files as named byte payloads: every file the transfer carried, with a single dropped .zip expanded to its entries. Route the result with route_dropped.
read_file
Reads one browser File into on_file as its name and bytes.
register_theme
Add a custom theme to the enclosing ThemeProvider’s registry, replacing any existing theme with the same id. No-op without a provider.
route_dropped
Groups dropped files: when the set contains a .gltf alongside other files, the rest become its resources with the glTF’s directory prefix stripped; otherwise the files pass through unchanged.
stored_theme
Read the persisted theme id from local storage, falling back to the default when it is missing or unrecognized.
stylesheet
Concatenate every component stylesheet, wrapped in an @layer nightshade { ... } cascade layer.
terminal_grid
Creates a new cols by rows terminal grid and returns a handle to it.
use_commands
Retrieves the CommandRegistry from context, or a fresh empty default if none was provided.
use_drag
Reads the drag session from context. Returns a detached, no-op DragState if provide_drag was never called.
use_engine
Creates an Engine over ValueProtocol for the worker at worker_url, with the default key forwarding installed. The form for apps without message enums; pair it with EngineViewport.
use_engine_typed
Creates an Engine over the app’s own WorkerProtocol for the worker at worker_url. Pair it with EngineViewport, and either install the default key forwarding with Engine::install_key_forwarding or forward keys through Engine::send_key.
use_persisted
Create a signal seeded from JSON in local storage under key (or default when absent or invalid) that re-serializes back to storage on every change.
use_reconnecting_socket
Open a WebSocket to url that auto-reconnects after a short delay when closed, forwarding each received text message to on_message. The socket is closed and reconnection cancelled on cleanup.
use_retained_closures
Creates an owner-scoped RetainedClosures store. Call this in a component body.
use_theme
Get the active theme-id signal from context (provided by ThemeProvider), or a standalone signal seeded from storage when no provider is present.
use_themes
Get the registered themes from context (provided by ThemeProvider), falling back to builtin_themes when no provider is present.
use_toaster
Retrieve the Toaster provided by an enclosing ToastHub. Falls back to a detached, standalone toaster when no hub is present.
visible_range
The half-open range of item indices to render for a virtualized, fixed-row-height list, given the current scroll offset and viewport. Shared by every windowed view (VirtualList, Table, CodeSurface, MultiEditor).
webgpu_supported
Reports whether the current browser exposes WebGPU (navigator.gpu).

Type Aliases§

Highlighter
A syntax highlighter: maps source text to a sequence of (css-class, text) runs that are rendered as styled spans behind the editor’s textarea.