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§
- Accordion
Item Props - Props for the
AccordionItemcomponent. - Accordion
Props - Props for the
Accordioncomponent. - Activity
BarProps - Props for the
ActivityBarcomponent. - Activity
Item - One entry in an
ActivityBar: anid, aniconglyph, and alabeltooltip. - Ansi
Terminal Props - Props for the
AnsiTerminalcomponent. - Asset
Grid Props - Props for the
AssetGridcomponent. - Asset
Item - A card in an
AssetGrid, with a stableid, alabel, athumbnailimage source, and an optionalsubtitle. - Bridge
- A handle to the render worker for posting serde-serializable messages, with an
optional transferable
OffscreenCanvas. - Chat
Message - A single message in the transcript: a stable
idfor keyed rendering, itsrole, and the messagetext. - Chat
Props - Props for the
Chatcomponent. - Check
Field Props - Props for the
CheckFieldcomponent. - Chip
Group Props - Props for the
ChipGroupcomponent. - Code
Document - One open document in a
CodeTabsset: a stableid, a displaytitle, and a reactivevaluebuffer shared with the editor. - Code
Editor Props - Props for the
CodeEditorcomponent. - Code
Surface Props - Props for the
CodeSurfacecomponent. - Code
Tabs Props - Props for the
CodeTabscomponent. - Color
Field Props - Props for the
ColorFieldcomponent. - Combo
Option - A selectable option for
Combobox, pairing a storedvaluewith a displaylabel. - Combobox
Props - Props for the
Comboboxcomponent. - Command
- A single palette action or a submenu of nested commands.
- Command
Palette Props - Props for the
CommandPalettecomponent. - Command
Registry - Reactive store of registered commands plus a bounded most-recently-run list.
- Context
Menu Props - Props for the
ContextMenucomponent. - Dialog
Props - Props for the
Dialogcomponent. - Diff
Line - A single line of a computed diff, with its content and its line numbers on
each side (
Nonewhere the line is absent). - Diff
Props - Props for the
Diffcomponent. - Disclosure
Props - Props for the
Disclosurecomponent. - Dock
Layout Props - Props for the
DockLayoutcomponent. - Dock
Main Props - Props for the
DockMaincomponent. - Dock
Panel Props - Props for the
DockPanelcomponent. - DockTab
- A tab in a
TabDock: a stableid, a displaytitle, and the id of thepaneit currently lives in. - Drag
Layer Props - Props for the
DragLayercomponent. - Drag
Payload - What is being dragged: a
kindused by drop zones to accept or reject it, anididentifying the source, and alabelshown in the drag preview. - Drag
Source Props - Props for the
DragSourcecomponent. - Drag
State - 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. - Drop
Zone Props - Props for the
DropZonecomponent. - Dropdown
Props - Props for the
Dropdowncomponent. - Dynamic
Form Props - Props for the
DynamicFormcomponent. - Editor
Shell Props - Props for the
EditorShellcomponent. - Engine
- A
Copyhandle to the render worker connection. Holds the reactivestate, buffers outgoing messages until the worker connects, and routes application messages to a registered handler. - Engine
State - Reactive signals reflecting the render worker’s status, kept in sync from the messages it sends back.
- Engine
Viewport Props - Props for the
EngineViewportcomponent. - Form
Field - A single field in a
DynamicForm, pairing a JSONkeyand displaylabelwith itsFieldSchema. - History
Node - A flattened view of one history node for rendering: its
id,label, treedepth, and whether it is thecurrentstate. - HudPanel
Props - Props for the
HudPanelcomponent. - Inspector
Props - Props for the
Inspectorcomponent. - Inspector
RowProps - Props for the
InspectorRowcomponent. - Inspector
Section Props - Props for the
InspectorSectioncomponent. - Jump
Overlay Props - Props for the
JumpOverlaycomponent. - Jump
Target - A place the jump overlay can send you: a stable
idreported on selection and the screen position (x,y, in pixels) where its label is drawn. - Keymap
Provider Props - Props for the
KeymapProvidercomponent. - List
Item - An entry in an
OrderedList, identified byidwith a displaylabel. - Loader
Props - Props for the
Loadercomponent. - LogEntry
- One row in a
LogView: a stableid, akind, a primarylabel, optionaldetailtext, and a repeatcountshown as a multiplier badge. - LogView
Props - Props for the
LogViewcomponent. - Markdown
Props - Props for the
Markdowncomponent. - Menu
BarMenu Props - Props for the
MenuBarMenucomponent. - Menu
BarProps - Props for the
MenuBarcomponent. - Menu
Item Props - Props for the
MenuItemcomponent. - Menu
Props - Props for the
Menucomponent. - Menu
Separator Props - Props for the
MenuSeparatorcomponent. - Multi
Editor Props - Props for the
MultiEditorcomponent. - NavGizmo
Props - Props for the
NavGizmocomponent. - Number
Field Props - Props for the
NumberFieldcomponent. - Ordered
List Props - Props for the
OrderedListcomponent. - Popover
Props - Props for the
Popovercomponent. - Retained
Closures - A per-owner store that keeps values (typically
Closures) alive and drops them on cleanup. Use this instead ofClosure::forgetso one-shot JS callbacks are reclaimed when the component unmounts. Create it once at component init withuse_retained_closures, thenretainfrom any later handler; the handle isCopy, so callbacks can capture it freely. - Search
Item - An entry in a
SearchList, with a stableid, atitleandsubtitle(both searched), and adetailbody shown when the entry is selected. - Search
List Props - Props for the
SearchListcomponent. - Select
Props - Props for the
Selectcomponent. - Selected
Card Props - Props for the
SelectedCardcomponent. - Slider
Field Props - Props for the
SliderFieldcomponent. - Socket
Handle - A cheap, copyable handle to a reconnecting WebSocket created by
use_reconnecting_socket. - Status
BarProps - Props for the
StatusBarcomponent. - Status
Item Props - Props for the
StatusItemcomponent. - Status
Spacer Props - Props for the
StatusSpacercomponent. - Submenu
Props - Props for the
Submenucomponent. - Swatch
Palette Props - Props for the
SwatchPalettecomponent. - Swatch
Props - Props for the
Swatchcomponent. - Switch
Props - Props for the
Switchcomponent. - TabBar
Props - Props for the
TabBarcomponent. - TabDock
Props - Props for the
TabDockcomponent. - Table
Props - Props for the
Tablecomponent. - TagInput
Props - Props for the
TagInputcomponent. - Terminal
Grid - A fixed-size character cell grid with an embedded ANSI escape-sequence parser: feeding it bytes updates the cells, cursor, and graphic attributes.
- Terminal
Handle - A cheap, copyable handle to a reactive
TerminalGrid, shared between the code that drives output and theAnsiTerminalview. - Terminal
Line - One line of terminal scrollback: a stable
idfor keyed rendering, itstext, and its displaytone. - Terminal
Props - Props for the
Terminalcomponent. - Text
Field Props - Props for the
TextFieldcomponent. - Theme
- A named color palette. Each field maps to a
--nightshade-*CSS custom property emitted byTheme::to_cssand scoped to:root[data-theme="{id}"]. - Theme
Menu Props - Props for the
ThemeMenucomponent. - Theme
Picker Props - Props for the
ThemePickercomponent. - Theme
Provider Props - Props for the
ThemeProvidercomponent. - Toast
- A single queued toast notification held by a
Toaster. - Toaster
- A handle for pushing toast notifications. Obtain one with
use_toasterinside aToastHub. - Toggle
Chip Props - Props for the
ToggleChipcomponent. - Tool
Button Props - Props for the
ToolButtoncomponent. - Toolbar
Group Props - Props for the
ToolbarGroupcomponent. - Toolbar
Props - Props for the
Toolbarcomponent. - Toolbar
Spacer Props - Props for the
ToolbarSpacercomponent. - Tree
Item - A single node in a
Tree, carrying its stableid, displaylabel, an optionaliconglyph, alazyflag for branches whose children load on expand, and itschildren. - Tree
Props - Props for the
Treecomponent. - Undo
History - 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. - Undo
Tree Props - Props for the
UndoTreecomponent. - Vec3
Field Props - Props for the
Vec3Fieldcomponent. - Viewport
Overlay Props - Props for the
ViewportOverlaycomponent. - Viewport
Props - Props for the
Viewportcomponent. - Virtual
List Props - Props for the
VirtualListcomponent. - WebGpu
Gate Props - Props for the
WebGpuGatecomponent.
Enums§
- Align
- Alignment of a floating element along the anchor’s cross axis: to its start, centered, or to its end.
- Chat
Role - Who or what produced a
ChatMessage, used to pick the bubble’s styling. - Dock
Side - Which edge a
DockPanelsits against, which also flips its resize direction. - Dropped
Files - 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. - Field
Schema - The type of a form field, which determines the control
DynamicFormrenders and the JSON shape of its value. - Line
Kind - 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. - Resize
Axis - The axis a
ResizeHandledrags along:Horizontaladjusts width,Verticaladjusts 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.
- Split
Axis - Whether a
DockLayoutarranges its children horizontally or vertically. - Terminal
Tone - Visual style applied to a terminal line.
- Viewport
Event - 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
AccordionItemchildren that keeps at most one item open at a time, optionally starting with the item whose id matchesdefault_open. - Accordion
Item - A single collapsible section within an
Accordion, identified byidand headed bytitle. Clicking its header opens it and closes any sibling that was open. - Activity
Bar - A vertical strip of icon buttons; clicking one sets
activeto its id and invokes the optionalon_selectcallback. - Ansi
Terminal - Renders the grid behind
handleas rows of style-merged spans; when a keyboardon_keycallback 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.
- Asset
Grid - A grid of thumbnail cards built from
items, invokingon_selectwith an item’s id when its card is clicked. Whensearchableis set a filter box (labeled byplaceholder) narrows cards by label. - Badge
- A small inline label. Pass a
variantclass (such as"success"or"danger") to color it and put the label text inchildren. - Button
- A styled
<button>. Pass extra classes viaclassand a click handler via the optionalon_clickcallback. - Card
- A bordered content container. When
titleis non-empty it renders a header row above thechildren, which fill the card body. - Chat
- A chat panel that renders the
messagestranscript, auto-scrolling to the latest, and a compose box that fireson_sendwith the trimmed text on click or Enter (Shift+Enter inserts a newline). The header shows aconnecteddot, abusyspinner appears while working, and an optionalon_resetrenders a “New” button.placeholdersets the input hint. - Check
Field - A labelled checkbox bound to a
boolsignal. Emits the new checked state throughon_change. - Chip
Group - A flex container that lays out chip children, with an optional extra
class. - Code
Editor - A single-buffer code editor: a transparent
textareaover a highlighted<pre>overlay, with an optional line-numbergutter(marking lines indiagnosticsas errors), a fixedheightorfillmode, and an optional Ctrl/Cmd+Ffindbar for find/replace over thevaluesignal. - Code
Surface - A read-only, virtualized code view of
value: renders only the rows in the visible window (plusoverscan) at a fixedline_heightwithin a scrollable area of the givenheight, applies the optionalhighlighter, and lets brace-delimited regions be folded from the gutter. - Code
Tabs - A tabbed multi-document editor: renders a tab bar for
documents, tracks theactivedocument id, hosts a fillingCodeEditorfor the selection, and fires the optionalon_closecallback with a document id when its close button is clicked. - Color
Field - A native color picker bound to an
[f32; 3]RGB signal (components in0.0..=1.0). Emits(rgb, committed)throughon_change, withcommittedfalse 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(orplaceholder), and the panel offers a text filter plus a keyboard-navigable list ofoptions. Emits the chosen option’s value throughon_select. - Command
Palette - Registry-driven command palette: fuzzy-ranked, shows recents when the query is empty, descends into submenus, and displays keybinding hints.
- Context
Menu - A menu portaled to the document at position (
x,y), shown whileopenistrue. - Dialog
- A modal dialog with a title, body
children, and cancel/confirm buttons. Toggled by theopensignal; both buttons close it and run the optionalon_cancel/on_confirmcallbacks. The confirm button uses danger styling whendangeris set. - Diff
- Renders a unified diff of the
oldandnewsignals, one row per line with old/new line numbers, a+/-/space marker, and per-kind styling. - Disclosure
- A collapsible section with a clickable
titleheader that shows or hides itschildren. Open state is controlled by the optionalopensignal, otherwise it starts fromdefault_open. - Dock
Layout - The dock container. Arranges its
DockMainandDockPanelchildren alongaxisand provides that axis to them via context. - Dock
Main - The flexible central region of a
DockLayoutthat fills the space left by the panels. - Dock
Panel - An edge panel with a draggable handle.
sizeholds its pixel extent along the layout axis and is updated as the handle is dragged, clamped betweenminandmax;sidepicks the edge and drag direction. Withcollapsibleset it shows a toggle in its header that drives thecollapsedsignal. - Drag
Layer - 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.
- Drag
Source - Wraps children as a draggable item. Arms a drag with a
DragPayloadbuilt fromkind,id, andlabelon pointer down; the drag starts once the pointer moves past the threshold. - Drop
Zone - Wraps children as a drop target registered under
id. Highlights while a drag hovers it and runson_dropwith the droppedDragPayloadwhen a drag is released over it. - Dropdown
- A button labelled
labelthat opens aPopovercontaining a menu ofchildren. The menu closes when any item is clicked. - Dynamic
Form - Renders a form from a list of
FormFields, maintaining the collected values as a JSON object. Emits the object throughon_changeon every edit and, when anon_submitcallback is provided, shows a submit button labelledsubmit_label. - Editor
Shell - 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*_opensignal toggles a slot’s visibility; providing a matching*_sizesignal makes that slot resizable (and drives its pixel size) via an insertedResizeHandle. - Engine
Viewport - Renders the
Viewportwired toengine: it translatesViewportEvents into worker messages, completes the connection on connect, and updates the enginestate(and any application message handler) from messages the worker sends back. - Grid
- A CSS grid container. Merge extra classes via
classto set the template. - HudPanel
- A floating panel for on-surface controls or readouts.
- Icon
Button - A square, icon-only button variant. Pass extra classes via
classand a click handler via the optionalon_clickcallback. - Inspector
- The outer container for an inspector panel; wraps its
childrensections. - Inspector
Row - A labeled inspector row pairing a
labelwith a control rendered fromchildren. - Inspector
Section - A collapsible inspector section with a
titleheader, optionalactionsrendered on the header row, and a body ofchildren.default_opencontrols the initial expanded state. - Jump
Overlay - A full-screen overlay that assigns short letter labels to each
targetsentry whileopenis set. Typing narrows the labels by prefix; a full match closes the overlay and runson_jumpwith that target’s id, and Escape cancels. - Keymap
Provider - Installs a global
keydownlistener that matches keys against registered command bindings and runs the first match, supporting chord sequences (for exampleg d). - Loader
- A full-surface overlay with a spinner and
message, shown untilreadybecomes true. - LogView
- A scrolling log panel driven by the
entriessignal. It shows an entry count header, an optional “Clear” button (on_clear), auto-scrolls to the newest row whenautoscrollis set, and callson_selectwith an entry’s id when a row is clicked. Shows theemptyplaceholder when there are no entries. - Markdown
- Parses the
sourcesignal 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
labelbutton that toggles a dropdown of itschildren, closing on outside click or Escape and moving focus with the arrow, Home, and End keys. - MenuBar
- An application menu bar that coordinates its
MenuBarMenuchildren so only one is open at a time and hover switches between them once one is open. - Menu
BarMenu - A single top-level menu within a
MenuBar, keyed byid, showing alabeltrigger that toggles itschildrendropdown and coordinates open state through the bar’s context. - Menu
Item - A single selectable menu row that fires
on_selecton click or Enter/Space. - Menu
Separator - A horizontal divider rendered between groups of menu items.
- Modal
- A portalled dialog shown while
openis true. It traps Tab focus within the dialog, closes on Escape or backdrop click, and restores focus to the previously focused element when dismissed. - Multi
Editor - A multi-cursor code editor over the
valuebuffer 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 (plusoverscan) at the givenline_height,height, and optionalhighlighter. - 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 runson_axiswith its index. - Number
Field - 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)throughon_change, wherecommittedmarks the final value on blur, Enter, or scrub end. - Ordered
List - 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, andon_selectfires when a row’s label is clicked. Renders an “Empty” placeholder when there are no items. - Overlay
- Renders
childreninto 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
titlerenders a header above thechildren, which fill the panel body. - Popover
- A floating panel anchored to a
triggerelement, toggled by theopensignal and by clicking the trigger. It repositions on scroll and resize to stay in the viewport, flippingsideand shifting as needed, and dismisses on outside click viaon_dismiss. - Progress
- A horizontal progress bar. The reactive
valueis divided bymax(default1.0) and clamped to fill 0% to 100% of the track. - Resize
Handle - A draggable divider that writes the pointer’s movement along
axisinto thevaluesignal, clamped tomin/max(defaults120.0/2000.0). Setinvertto 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_dismisscallback. - Search
List - A searchable list of
itemswith a text input that filters by title and subtitle. The active entry expands to show its detail body and scrolls into view;selectedandon_selecttrack the current selection andplaceholdercustomizes the search box. - Select
- A labelled dropdown built from
(value, text)option pairs, bound to aStringsignal. Emits the selected option value throughon_change. - Selected
Card - Renders a small card describing the
selectedentity’s name and id, or a “None” placeholder when nothing is selected. - Slider
Field - A range slider bound to a
f64signal with reactivemin,max, and a fixedstep, showing the current value. Emits(value, committed)throughon_change, withcommittedfalse during drag and true on release. - Spinner
- An indeterminate loading spinner.
- Status
Bar - The status strip container. Renders a
role="status"row and lays out itsStatusItemandStatusSpacerchildren left to right. - Status
Item - A single cell in the status bar. Shows an optional leading
iconbefore the children, and forwards an extraclassfor styling. - Status
Spacer - A flexible gap that pushes the items after it to the far end of the bar.
- Submenu
- A nested menu row that reveals its
childrenin a flyout on hover or click. - Swatch
- A single color swatch button showing
coloras its background, marked active via theactivesignal. Runs the optionalon_selectcallback when clicked. - Swatch
Palette - A row of
Swatchbuttons built fromcolors, highlighting the one matching theselectedsignal. Emits the chosen color string throughon_select. - Switch
- A labelled toggle switch (an ARIA
switchbutton) bound to aboolsignal. Emits the toggled state throughon_change. - TabBar
- A horizontal row of tabs from
(id, label)pairs, binding the selected id toactiveand cycling selection with the left and right arrow keys. - TabDock
- Renders one drop-zone pane per entry in
panes, each showing itstabsas draggable buttons and the body of theactivetab via therenderclosure. 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.
rowsis a reactive signal of row data;on_row_click,on_cell_edit, andselected_rowwire 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_addand removed tags throughon_remove. - Terminal
- A scrollback terminal that renders
lines(auto-scrolling to the bottom as they change) with apromptsigil (defaulting to$) and an input row that fireson_inputwith the trimmed draft when Enter is pressed. - Text
Field - A single-line text field with optional help and error notes. Commits on change, or
debounces input by
debouncemilliseconds when set, emitting the text throughon_commit. - Theme
Menu - A button-triggered theme menu that live-previews each theme on hover and commits the selection on click.
- Theme
Picker - A
<select>dropdown for choosing among the registered themes, bound to the active-theme signal. - Theme
Provider - Provides the active-theme signal and theme registry to
children, injects the registered themes’ CSS, and keeps the document’sdata-themein sync with the active theme. Wrap your app in this to enable theming. - Toast
Hub - Provides a
Toastertochildrenvia context and renders the stacked toast overlay. Wrap your app in this, then calluse_toasterto push messages. - Toggle
Chip - A pill-shaped toggle button reflecting an
activesignal viaaria-pressed. Emits a unit event throughon_togglewhen clicked. - Tool
Button - A toolbar button that fires
on_clickunlessdisabled, reflectingactiveas a pressed state and usingtitleas its tooltip. - Toolbar
- A horizontal toolbar container with
role="toolbar";classis appended for styling. - Toolbar
Group - Groups related toolbar controls so they cluster together visually.
- Toolbar
Spacer - A flexible gap that pushes surrounding toolbar groups apart.
- Tooltip
- Wraps
childrenin a focusable span that revealstextin 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 optionalon_select,selected,selection,on_rename,on_move, andon_expandprops wire up interaction;default_expandedopens every branch initially. - UiStyles
- Injects the
stylesheetinto<head>once (idempotent by element id). Render this near the root of your app. - Undo
Tree - Renders history
nodesnewest-first as an indented list of buttons. The current node is marked, and clicking a row runson_restorewith that node’s id. - Vec3
Field - Three numeric inputs labelled X, Y, and Z for editing a
[f64; 3]vector. Each axis clamps tomin/maxand evaluates arithmetic expressions on commit. Emits the full updated array with acommittedflag throughon_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 atworker_url, and reports theBridge, canvas, and dimensions throughon_connect. It forwards pointer, wheel, touch, and resize events asViewportEvents toon_input, worker messages toon_message, failures to the optionalon_error, and toggles thegrabbingsignal during pointer interaction. - Viewport
Overlay - A positioning layer stacked over the render surface to hold HUD elements.
- Virtual
List - A virtualized list that renders only the visible slice of
countitems, callingrenderwith each item index.item_height(fixed row height),height(viewport height), andoverscan(extra rows rendered off-screen) tune the windowing. - WebGpu
Gate - Renders
childrenwhen 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 canvasViewportrenders. - 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
oldagainstnewusing a longest-common- subsequence, returning the merged sequence of equal, inserted, and deleted lines in order. - download_
file - Saves
bytesas a browser download namedname. - download_
text - Trigger a browser download of
contentsas a plain-text file namedfilenameusing a temporary data-URL anchor. - highlight_
code - Tokenizes
sourceinto highlighted runs, classifying the givenkeywordsandcommandswords while recognizing comments, strings, and numbers. - highlight_
rhai - Tokenizes Rhai
sourceinto 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
acceptand reads the chosen file’s bytes intoon_file. - pick_
file_ text - Open the browser’s file picker and read the chosen file as text, invoking
on_pickwith 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-themeattribute 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_filesas named byte payloads: every file the transfer carried, with a single dropped.zipexpanded to its entries. Route the result withroute_dropped. - read_
file - Reads one browser
Fileintoon_fileas 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
.gltfalongside 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
colsbyrowsterminal grid and returns a handle to it. - use_
commands - Retrieves the
CommandRegistryfrom context, or a fresh empty default if none was provided. - use_
drag - Reads the drag session from context. Returns a detached, no-op
DragStateifprovide_dragwas never called. - use_
engine - Creates an
EngineoverValueProtocolfor the worker atworker_url, with the default key forwarding installed. The form for apps without message enums; pair it withEngineViewport. - use_
engine_ typed - Creates an
Engineover the app’s ownWorkerProtocolfor the worker atworker_url. Pair it withEngineViewport, and either install the default key forwarding withEngine::install_key_forwardingor forward keys throughEngine::send_key. - use_
persisted - Create a signal seeded from JSON in local storage under
key(ordefaultwhen absent or invalid) that re-serializes back to storage on every change. - use_
reconnecting_ socket - Open a WebSocket to
urlthat auto-reconnects after a short delay when closed, forwarding each received text message toon_message. The socket is closed and reconnection cancelled on cleanup. - use_
retained_ closures - Creates an owner-scoped
RetainedClosuresstore. 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 tobuiltin_themeswhen no provider is present. - use_
toaster - Retrieve the
Toasterprovided by an enclosingToastHub. 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.