Skip to main content

Module widgets

Module widgets 

Source
Expand description

Widgets: React components used as capitalized HTML tags in Markdown.

On the server a page’s widget tags become placeholder elements carrying the widget’s name, its props’ source and its content ([tags]), which comrak renders as Markdown. In the browser the page script loads React and the widgets, compiled here from TSX by oxc ([compile]), and mounts each placeholder. What was read and compiled is kept in a Modules cache.

This module is the widget set a document has: its names, the address each is served at, what a page loads, and what a request for one of its modules answers ([request]).

Structs§

Compiled
A widget module, compiled, as a request for it is answered.
Modules
What was read and compiled, shared by every handle to it.
Snapshot
The files a module is made from, each read once: the module and every module its relative imports reach inside the served folder. Its version and its compiled bytes both come from one snapshot, so a save landing between the two can’t serve new bytes under the old version.
Widgets
The widgets a document’s pages can use: name → the address its module is served at.

Constants§

LIVE_CANVAS
The live session’s canvas: a scratch pad over the page.
LIVE_ORB
The live session’s orb, which starts and stops it: devpage’s own chrome, placed by devpage where the session is on.
LIVE_TASKS
The live session’s side panel: its agents and their tasks.
LIVE_TASKS_BUTTON
The navbar’s button that opens the live session’s side panel.
NOTES
The tag a slide’s speaker notes are written in.
REQUIREMENTS
The system widget that lists a part’s requirements: the server writes its content.
SHARED
The modules system widgets share, by file name: what a system widget imports by a relative specifier (./live) beside the other system widgets. None is a widget: a page can’t name one.
SIDEBAR
The widget that is a site’s sidebar: devpage’s own chrome, mounted by the page script on the sidebar the server rendered, never written in a page. Its Devpage prefix keeps it clear of a project’s names: a project may have its own Sidebar.
SYSTEM
The widgets devpage ships, compiled into the binary.

Functions§

expand
Replaces the tags of the widgets named in known in Markdown with placeholder elements, leaving code alone, and takes <Notes> out. An unknown capitalized tag, and a Tab outside a Tabs, are reported; an unknown tag is replaced by an error in its place rather than passed through as HTML.
expand_with
expand, with written giving the content the server writes for a widget, by name: what it answers replaces what the tag holds.
extension_imports
The relative specifiers (./x, ../x) a module imports or re-exports from, as the parser sees them — the same statements [compile] rewrites.
is_widget_file
Whether path is a widget or helper file: a .ts or .tsx directly in a widgets folder.
project_module
The project widget or helper at path in folder’s served folder, compiled, asked for at version. An import without an extension finds the .tsx or .ts beside it. It renders by name the widgets of the document whose widgets folder holds it — the entry document’s when no other names it. Err with why when it, or any helper its imports reach, doesn’t compile — the browser would only say an import failed; None when no such file is in the served folder.
system_address
The address the system module in file is served at for the document served under mount, carrying its version.
system_hash
A system module’s version: its source, the sources of every system module its relative imports reach, the names a system widget can render and the build — everything its compiled bytes are made from. None for a file that isn’t a system module.
system_module
The system module in file — a system widget’s, Tabs.tsx, or one they share, live.ts — compiled, asked for at version; Err with why when it doesn’t compile, and None for a file that isn’t a system module.