CRUDUI

Home > @polyspec/crudui-generator-core

crudui-generator-core package

Classes

Class

Description

FormInstance

One editable form instance over a shared template. All row operations are scoped to a collection path; no global string replacement touches siblings. Data, undo history and view state (collapsed rows) are separate; view state is never submitted.

FormRenderOptionsError

The error of decodeFormRenderOptions() and of the renderers for render options outside the contract of form-runtime.md: a FormInputError with the code INVALID_FORM_INPUT and the message of that contract.

FormTemplateError

The error of decodeFormTemplate() for a value that is no compiled form template. Its code is the INVALID_FORM_INPUT of every form input error.

UnsupportedFieldTypeError

An unregistered field type reached the renderer (default-throw mode).

Functions

Function

Description

bindButtons(template, data, options)

Evaluate the template's buttons for a record. Text is the declared content or the interface text named by the button type; design classes and styles follow the field design rules against the record data.

bindForm(template, data, options)

Bind fresh data to a cached structure. No loader, composition or template mutation.

buildDetail(detailSpec, record, options)

Compose a detail specification, evaluate one supplied record and return display cells. Detail delegates field composition, conditions, localization and cell formatting to the list engine; it queries no data.

buildList(listSpec, rows, options)

Compose a list spec and build its ListViewModel. rows are injected (no DB access); each cell value is read from a row by the column field path. Invalid input fails with the messages in the display format specification, and an unresolved $ref throws ComposeLoadError (never a silent render).

buildOutline(nodes)

Build the structure map: the form's rows, nested as in the form.

canRedo(history)

Whether a history has a record to restore in the forward direction.

canUndo(history)

Whether a history has a record to restore.

collapsibleRows(nodes, out)

Row paths ({collection}.{key}) of every collapsible row in evaluated nodes.

compileForm(rootSpec, options)

Compose and prepare the entire form before any record data exists.

connectForm(element, session)

Browser event delegation for all adapters, including raw leaf controls.

connectOutline(element, session, formElement)

Connect a rendered structure map: its buttons act on the form, and selecting a row focuses that form row's first control and scrolls it into view clear of the sticky headers and the footer.

connectStickyHeaders(element)

Mark stuck sticky row headers in a browser without scroll-state container queries (Firefox, Safari), and do nothing elsewhere. A header container is stuck while sticky positioning moves it from the top of its row; data-crudui-stuck then shows its level label and hides its card top edge, as the stylesheet's scroll-state(stuck: top) query does in other browsers. Rendering inside the element is observed, so the container is connected once even when the form is rendered without connectForm; a render that drops the attribute is marked again before the page is painted. Only the attribute changes, never a scroll position.

createForm(template, data, options)

Create an independent mutable instance from a cacheable form template.

createRowKey()

Generate a new row key. This is identity, never a serialization index.

decodeFormRenderOptions(value)

Decode render options, such as the options that a server wrote into a page with JSON.stringify and a client read back with JSON.parse, into the FormRenderOptions of renderForm and the framework Form components. It is the check that every renderer runs on its options before it places the errors on the nodes of the form.

decodeFormTemplate(value)

Decode the JSON value of a compiled form template, such as a template that a server wrote into a page with JSON.stringify(compileForm(spec)) and a client read back with JSON.parse, into a FormTemplate.

emptyHistory()

A history with nothing to undo. Replacing the record returns to it.

formButtonsHtml(buttons)

Markup of the form buttons. Every renderer inserts this one string into the footer controls group. The buttons are evaluated buttons: a list of objects whose tag is a or button, whose text is a string and whose attrs holds string values of the button attributes.

formDescription(template, options)

The root description of a template translated for options.language (default Korean) by the content rule; empty text when the template has none. The crudui-form block writes it first when it is not empty.

formMessages(language)

Return the interface text for a supported language.

initialView()

The initial view: every row expanded. Replacing the record returns to it.

patchContent(element, html)

Replace an element's content with rendered markup while keeping every existing node that the new markup still contains. A string renderer re-renders the whole form after each change; patching keeps the focused control, its text selection and an input method composition, as the framework renderers do.

Nodes match by kind and element name, and elements by their identity: a row key, a field path, an id, or a control name with its value for checkboxes and radio buttons. Unkeyed nodes match in order. Attributes are set to those of the new markup; control values and checked states are live properties, which connectForm().sync() sets from the form.

A script runs once, when its markup first appears: each script in inserted markup becomes a new script element once the whole markup is in place, and the browser runs it when it is connected, so a script finds the controls that follow it. A kept script never runs again: a parsed or cloned script never runs, and changing a started script's text does not run it.

recordChange(history, previous, path)

Record the record before a change. A value edit on the same path as the previous value edit shares its entry; every other change adds an entry, dropping the oldest beyond HISTORY_LIMIT.

redoChange(history, current)

Take the next record after the current change.

rekeyRowView(view, oldPath, newPath)

Move the collapsed state of a rekeyed row and its descendants to the new row path.

removeRowView(view, rowPath)

Drop the collapsed state of a removed row and its descendants.

resolveAction(source)

Resolve an action target from the values a button declares (CURT-081). A DOM element is read by the browser binding: the action is its data-crudui-action attribute, the path the nearest [data-field-path] at or above it and the key the nearest [data-crudui-row-key] inside that path element.

runAction(form, target)

Run a resolved action. Returns undefined when the target lacks a required path or key. Adding and copying focus the new row, moving focuses the moved row, and removing focuses the previous row, then the next row, then the collection. A name that is none of the eleven actions fails and changes nothing (CURT-091).

sequenceRowKey(sequence)

Transport key for an existing database sequence.

setAllExpandedView(nodes, expanded)

Expand every row, or collapse every collapsible row of the evaluated nodes.

toggleRowView(view, rowPath)

Expand a collapsed row or collapse an expanded one.

undoChange(history, current)

Take the record before the last change; the next value edit starts a new entry.

Interfaces

Interface

Description

ActionInput

The values a button declares: its action, collection path and row key (CURT-081).

ActionResult

The outcome of an action that ran.

ActionTarget

The operation, collection path and row key an action button targets.

ActionVM

A resolved list or detail action.

AddRowOptions

Values and insertion position for a new repeated row.

Affix

A prepend/append affix span (content + optional class/style).

BadgeDisplay

A badge display: a CSS/variant token plus its translated label.

BindButtonsOptions

Options for evaluating form buttons.

BindFormOptions

Per-instance data and presentation; never stored in the shared template.

BoolDisplay

A boolean display: the chosen label + the requested form.

BuildListOptions

Options for building a list view model.

BuildState

Per-build state threaded through the recursive tree builder.

ButtonVM

One evaluated form button.

CellFormatModel

A resolved cell format: the catalog type + its isolated dependent keys.

CellRenderCtx

Inputs the cell renderer needs to produce one cell's display value.

CellVM

A resolved cell within one row.

CheckboxVM

A standalone checkbox or switcher whose caption is its own label.

ColumnVM

A resolved list column header (markup-free).

CompileFormOptions

Composition inputs used only when preparing a template.

ConditionLabels

The interface messages of the editor controls.

ControlsVM

A group of controls for one row or empty collection.

DetailFieldVM

One field of a detail view model: a list cell with its key and its translated label.

DetailViewModel

Complete evaluated, markup-free detail model.

FocusTarget

The row that receives focus after an action, or the collection itself when key is absent.

FormConnection

Browser binding lifecycle.

FormFieldTemplate

A data-independent field blueprint. Repeated children are stored just once.

FormMessages

Interface labels for row, collection and form controls. {count} is replaced by a number.

FormRenderAction

The submission target of the form element; each member overrides the template's action.

FormRenderError

One error of a node: a validation result error is accepted unchanged.

FormRenderOptions

Options of renderForm and of the framework Form components.

FormSnapshot

Stable subscription snapshot, changed only after a successful operation or view change.

FormTemplate

JSON-serializable, immutable form structure. Safe to share between records.

History_2

Records before earlier changes and records after undone changes, oldest first.

HtmlDisplay

A raw-html display: passed through unescaped by the adapter.

ImageDisplay

An image display: resolved src + alt + size.

LinkDisplay

A link display: resolved href + text + target.

ListRowVM

A resolved row: one cell per visible column.

ListViewModel

The fully-evaluated, markup-free description of a list (SPEC §9.3).

NodeBody

Body slot of a node (crudui-node__body).

NodeHeader

Header parts of a node (crudui-node__header).

NodeVM

One evaluated node of the recursive form grammar.

OptionGroupModel

The group of a select option (docs/spec/form-markup.md, "Choice groups").

OptionModel

One static option for select/choice/multichoice/search.

OutlineRow

One row in the structure map.

OutlineState

What a structure map renders: evaluated nodes and undo availability, such as a form snapshot.

PaginationButtonVM

One pagination button. A renderer chooses the button's text by its role (‹, the page number, ›); label is its accessible name from the list interface messages.

PaginationVM

Resolved pagination declaration with the caller's current page and total.

RedoResult

The outcome of redoing one change.

RenderListOptions

Options for list rendering.

ResolvedDesign

Fully resolved design for one field at render time.

ResolvedNode

Resolved class+style for one DOM node.

RowActionVM

One control button.

SortVM

Resolved sort declaration.

UndoResult

The outcome of undoing one change.

UnsupportedVM

A surfaced unsupported-type marker (only in 'marker' mode).

ViewState

View state kept outside record data; it is never submitted or serialized with the data.

WidgetCtx

Inputs every widget evaluator needs for one leaf field.

WidgetModel

The fully-evaluated, markup-free description of one leaf widget. A field adapter renders the element tree from THIS — it computes nothing.

Type Aliases

Type Alias

Description

AnyWidget

A widget the core evaluated, or the marker of a field type the renderers do not support.

Attrs

Flat attribute bag (exact HTML attribute names, lowercase).

BuildDetailOptions

Options for building a detail view model: the list options without the list-only page and total.

CellDisplay

The display payload a cell renderer emits: a string or a structured value.

CellRenderer

One cell renderer: a function that turns a raw value + the format's isolated dependent keys (o) + render context into a CellDisplay.

ConditionEditorModel

The editor of a value that it shows (CUMK-067) or the named error of a value that it does not show (CUMK-068).

ConditionNode

One node of the editor: a group, a field comparison or a judged text.

ControlsPlacement

Where row controls are rendered.

CreateFormOptions

Per-instance presentation options.

FormActionName

Operations a data-crudui-action button can request.

FormButtonType

Button kinds a spec can declare. A link renders an anchor.

Language

Supported content language codes.

LocalizedText

Author-translated content: a string or a per-language map.

NodeKind

Node kinds of the form grammar; each is a crudui-node--{kind} modifier.

RenderDetail

Compose, evaluate and render one read-only detail without data access.

RenderList

Compose a list specification, evaluate supplied rows and render list HTML. Throws ComposeLoadError when a composition reference cannot be resolved.

RowActionName

Row and collection operations in control order.

SourceAttrs

data-source-* descriptor for a dynamic {model} items stub.

Translate

Resolve content for the selected language: the text of the language, else English, Korean or the first entry, else fallback. It takes any value of decoded JSON: a value that is no LocalizedText resolves to fallback.

UnsupportedMode

Behavior when a field type has no registered widget.