nustack
ReferenceNu STD

ui

nustd.ui -- component fabric.

Module nustd.ui.

nustd.ui -- component fabric.

Layout under src/nustd/ui/:

  • lens/ -- the Shape lens: LensRef, the walk that turns a Shape and a cursor into columns, and browse to assemble the two.
  • core/ -- host-independent UI fabric: Ref, Section / SectionRef, abstract Session / Subscription, wire Frame + interactions (Write / Append / Remove / Changed). Reusable by any host.
  • refs/ -- widget kit (Row, Card, Table, Input, ...); depends only on core.
  • nudle/ -- Page-based host: Index / Page / PageRef, the Boot term, and the serve preset that assembles a whole tree.

The uvicorn lifecycle, the book of live connections and the per-connection fold live in nustd.ws_server, which knows nothing about ui.

The browser half is not in this package. It lives in the repo's npm workspace at pkgs/ts (ui-core, ui-kit, and the nudle Vite app), and its compiled bundle ships as the separate nudle wheel.

The public entry is nustd.ui itself: the core fabric, the widget kit and the nudle host names are re-exported flat, so one import nustd.ui reaches everything a UI program spells. The lens is the exception and stays whole behind nustd.ui.lens, LensRef included: it is a subsystem rather than a widget, and a surface split between two names is worse than one more dot.

Modules

ModuleWhat
nustd.ui.lensnustd.ui.lens -- any Nu Shape, browsable as cascading columns.

core.interactions

Module nustd.ui.core.interactions.

Wire interactions -- ops that flow over a Session on a Ref.

Full entries

NameSortCallMeaning
Appendscalar_commandAppend()Send an append frame on a Ref -- push onto a sequence.
Changedscalar_queryChanged()Subscribe to client-side change notifications on a Ref.
Removescalar_commandRemove()Send a remove frame on a Ref -- drop its node and its whole subtree.
Writescalar_commandWrite()Send a write frame on a Ref -- replace the value.

nudle.page

Module nustd.ui.nudle.page.

Top-level Shape kinds for nudle, and the term that boots one.

Full entries

NameSortCallMeaning
Bootscalar_commandBoot(shape_cls)Seed one browser's tree: clear it, name it, then one init per slot.
PageRefrefPageRef(address, section_cls, parent_ref=None, owner_shape=None)Substrate Ref backing a Page slot on an Index.
IndexBrowser entrypoint. One per app.
PageSection an Index mounts at a route.

refs.output

Module nustd.ui.refs.output.

Display / output Refs -- server-owned sinks that render into the body.

Full entries

NameSortCallMeaning
AlertRefrefAlertRef(address, parent_ref=None, owner_shape=None)Display banner ref. write carries partial updates; notify fires on user dismiss.
BadgeRefrefBadgeRef(address, parent_ref=None, owner_shape=None)Display-only badge ref. One write op carries every mutation.
CodeBlockRefrefCodeBlockRef(address, parent_ref=None, owner_shape=None)Display-only code block. One write carries a partial dict {code, language, show_copy}.
DividerRefrefDividerRef(address, parent_ref=None, owner_shape=None)Display-only divider ref. One write op carries every mutation.
GaugeRefrefGaugeRef(address, parent_ref=None, owner_shape=None)Display-only gauge ref. One write op carries every mutation.
HeadingRefrefHeadingRef(address, parent_ref=None, owner_shape=None)Display-only heading ref. One write op carries every mutation.
ImageRefrefImageRef(address, parent_ref=None, owner_shape=None)Display-only image ref. One write op carries every mutation.
JsonViewerRefrefJsonViewerRef(address, parent_ref=None, owner_shape=None)Display-only json viewer ref. One write op carries every mutation via partial-merge.
LinkRefrefLinkRef(address, parent_ref=None, owner_shape=None)Display-only link ref. One write op carries every mutation.
MarkdownRefrefMarkdownRef(address, parent_ref=None, owner_shape=None)Display-only markdown ref. Source string rendered as commonmark.
ProgressRefrefProgressRef(address, parent_ref=None, owner_shape=None)Display-only progress ref. One write op carries every mutation.
StatRefrefStatRef(address, parent_ref=None, owner_shape=None)Display-only stat ref. Server-owned, single write op carries partial updates.
TableRefrefTableRef(address, parent_ref=None, owner_shape=None)Tabular data; display by default, optional sortable headers and row click.
TextRefrefTextRef(address, parent_ref=None, owner_shape=None)Display-only string ref. Body copy.

refs.chart

Module nustd.ui.refs.chart.

Chart Refs -- typed visualization sinks over series payloads.

Full entries

NameSortCallMeaning
AreaChartrefAreaChart(address, parent_ref=None, owner_shape=None)Display-only area chart. write (partial) and append (one row).
BarChartrefBarChart(address, parent_ref=None, owner_shape=None)Display-only chart ref. write (partial) and append (one bar).
LineChartrefLineChart(address, parent_ref=None, owner_shape=None)Display-only chart ref. write (partial) and append (one point or one series row).
PieChartrefPieChart(address, parent_ref=None, owner_shape=None)Display-only pie chart ref. write (partial) and append (one slice).
SparklinerefSparkline(address, parent_ref=None, owner_shape=None)Display-only inline trend line. write (partial) and append (one point).

refs.input

Module nustd.ui.refs.input.

Input Refs -- tab-owned; server reads via read + notify path.

Full entries

NameSortCallMeaning
ButtonRefrefButtonRef(address, parent_ref=None, owner_shape=None)Click trigger; subscribe via .on_click().
CheckboxRefrefCheckboxRef(address, parent_ref=None, owner_shape=None)Boolean toggle whose checked state lives in the browser.
DatePickerRefrefDatePickerRef(address, parent_ref=None, owner_shape=None)Date input whose ISO yyyy-mm-dd value lives in the browser.
InputRefrefInputRef(address, parent_ref=None, owner_shape=None)Text input whose value lives in the browser.
MonacoRefrefMonacoRef(address, parent_ref=None, owner_shape=None)Editable source code. Value is the text; the browser edits it in a real editor.
NumberInputRefrefNumberInputRef(address, parent_ref=None, owner_shape=None)Numeric input whose value lives in the browser.
ProseRefrefProseRef(address, parent_ref=None, owner_shape=None)Editable rich text. Value is a markdown string; the browser edits wysiwyg.
RadioGroupRefrefRadioGroupRef(address, parent_ref=None, owner_shape=None)Single-choice radio group whose value lives in the browser.
SelectRefrefSelectRef(address, parent_ref=None, owner_shape=None)Dropdown single-select whose value lives in the browser.
SliderRefrefSliderRef(address, parent_ref=None, owner_shape=None)Numeric slider whose value lives in the browser.
SwitchRefrefSwitchRef(address, parent_ref=None, owner_shape=None)On/off switch whose checked state lives in the browser.
TagInputRefrefTagInputRef(address, parent_ref=None, owner_shape=None)Multi-tag entry field whose committed list lives in the browser.
TextAreaRefrefTextAreaRef(address, parent_ref=None, owner_shape=None)Multi-line text input whose value lives in the browser.

refs.structural

Module nustd.ui.refs.structural.

Structural Refs -- bound to non-render browser APIs.

Full entries

NameSortCallMeaning
NavRefrefNavRef(address, parent_ref=None, owner_shape=None)Bound to window.history + window.location. Index-level structural Ref.
TitleRefrefTitleRef(address, parent_ref=None, owner_shape=None)Bound to document.title. Index-level structural Ref.

core.base

Module nustd.ui.core.base.

Generic UI Ref -- host-independent base for the widget kit.

Full entries

NameSortCallMeaning
RefrefRef(address, parent_ref=None, owner_shape=None)Base for Refs backed by a client rendering surface. Async-only.

core.section

Module nustd.ui.core.section.

Section -- shape-based container primitive for the UI kit.

Full entries

NameSortCallMeaning
SectionRefrefSectionRef(address, section_cls, parent_ref=None, owner_shape=None)Substrate Ref backing a Section slot.
SectionBase for shape-based layout primitives.

refs.layout

Module nustd.ui.refs.layout.

Layout Sections -- Shape-based containers that wrap other Refs.

Full entries

NameCallMeaning
AccordionStack of collapsible sections. Tab owns open state, server owns the section list.
CardCard-styled Section: title + subtitle + body slots + footer.
ColumnVertical flex layout. Pin chrome on the slot().
ContainerStyled card-like box. Pin chrome on slot().
FieldLabel + child input + help / error text. Exactly one child slot.
FieldsetGrouped fields with a legend. Display-only, server-owned.
FormSemantic form wrapper. Pin chrome on slot(); submit lives on a child ButtonRef.
ModalDialog overlay. Pin chrome on slot(); declare body Refs as slots.
RowHorizontal flex layout. Pin chrome on slot().
TabsTab strip plus active body. Subclass and declare one child slot per tab body.

nudle.driver

Module nustd.ui.nudle.driver.

serve -- the host's two layers stacked into one tree.

Full entries

NameCallMeaning
serveui.serve(index, program, static='nudle', host='127.0.0.1', port=8080, log_level='warning', open_browser=True, ready_timeout=10.0, shutdown_timeout=5.0)Serve program in the browser, one live arm per open tab.

On this page