morph 0.1.0
Asynchronous bridge between GUI thread and business models
Loading...
Searching...
No Matches
document.hpp File Reference

The UI document (spec 5 §3): its model — declarations, commands, view nodes, components and customization points — and loadDocument, which parses a document and runs its load-time validation. More...

#include <algorithm>
#include <array>
#include <cstddef>
#include <cstdint>
#include <deque>
#include <expected>
#include <format>
#include <functional>
#include <initializer_list>
#include <map>
#include <memory>
#include <optional>
#include <ranges>
#include <set>
#include <span>
#include <stdexcept>
#include <string>
#include <string_view>
#include <utility>
#include <vector>
#include "expression.hpp"
#include "value.hpp"

Go to the source code of this file.

Classes

struct  morph::ui::ModelInfo
 What the catalog says about a model type. More...
struct  morph::ui::ActionEffect
 One effect an action declares, as the catalog states it. More...
struct  morph::ui::ActionRecordInfo
 A record an action's result holds, as the catalog states it. More...
struct  morph::ui::ActionInfo
 What the catalog says about an action. More...
struct  morph::ui::Catalog
 The facts load-time validation needs from the application's catalog. Local mode answers them from the model registry in-process, the server at registration, a remote client from the UI service's catalog. More...
struct  morph::ui::LoadOptions
 Options of loadDocument. More...
struct  morph::ui::ModelDecl
 A model alias. More...
struct  morph::ui::StateDecl
 A state declaration. More...
struct  morph::ui::LetDecl
 A derived value (let). More...
struct  morph::ui::QueryDecl
 A query (spec 5 §5). More...
struct  morph::ui::OptimisticDecl
 An optimistic write: the row a mutation run predicts before its reply. More...
struct  morph::ui::Command
 One command. Which members a kind uses is listed with each member. More...
struct  morph::ui::MutationDecl
 A mutation (spec 5 §5). More...
struct  morph::ui::WatchDecl
 A cascade: commands that run when a value changes (spec 5 §6). More...
struct  morph::ui::CheckDecl
 A validation across elements (spec 5 §6). More...
struct  morph::ui::ScopeDecl
 The declarations of one scope, in declaration order. More...
struct  morph::ui::DocNode
 A view node of the document (spec 5 §9), or a structured part of one (a table column, a tab, a switch case, a menu item, an a11y, drag, drop or action record, a form field overlay). More...
struct  morph::ui::Component
 A custom component declaration (spec 5 §10). More...
struct  morph::ui::CustomizePoint
 A customization point (spec 5 §12b). More...
struct  morph::ui::LoadWarning
 A finding of load-time validation that does not refuse the document. More...
struct  morph::ui::Document
 A loaded and validated UI document: a screen, or the app document (id app, spec 6 §5). More...
class  morph::ui::detail::DocumentRefused
 The exception the loader throws inside itself; loadDocument turns it into its result. More...
struct  morph::ui::detail::KeySpec
 One key of a kind. More...
struct  morph::ui::detail::KindSpec
 A node kind or part kind: its keys and its element values. More...
class  morph::ui::detail::DocumentParser
 Turns the JSON of a document into its model, refusing what does not parse. More...
struct  morph::ui::detail::NameEntry
 One declared name of a scope. More...
struct  morph::ui::detail::ScopeInfo
 One scope during validation: its names and its parent. More...
struct  morph::ui::detail::CheckContext
 Where an expression or command is checked: its scope and what is valid there. More...
class  morph::ui::detail::ScopeResolver
 Resolves an expression's names against a scope chain and a context. More...
class  morph::ui::detail::DocumentValidator
 Checks a parsed document against its own names and the catalog: every load-time rule that needs more than one place in the document. More...

Typedefs

using morph::ui::Commands = std::vector<Command>
 A command list, run as one batch.
using morph::ui::DocNodePtr = std::shared_ptr<DocNode const>
 A shared, immutable view node.

Enumerations

enum class  morph::ui::InstanceMode : std::uint8_t {
  Default , Private , Shared , Keyed ,
  Borrowed
}
 How a model alias binds its instance (spec 5 §5). More...
enum class  morph::ui::Concurrency : std::uint8_t { Exclusive , Serial , Latest , Parallel }
 What a mutation run does while another is in flight. More...
enum class  morph::ui::CommandKind : std::uint8_t {
  Set , Reset , Run , Refetch ,
  Open , Close , Navigate , Return ,
  Focus , Host , SwitchBackend , ResetPrefs ,
  SetLocale , Notify , Seq , All ,
  If , CancelClose , Retry , SignIn ,
  SignOut , Upload , Download
}
 The commands of ui/1 (spec 5 §8, spec 6). More...
enum class  morph::ui::WatchSource : std::uint8_t { Any , User }
 Which changes a watch reacts to. More...
enum class  morph::ui::LoadWarningKind : std::uint8_t { WatchFeedback , Uncovered }
 What a load-time warning is about. A warning never refuses a document. More...
enum class  morph::ui::detail::Shape : std::uint8_t {
  Expr , Condition , Commands , Nodes ,
  Text , Name , Part , Parts ,
  PartsOrExpr , ExprRecord , CommandRecord , Keys ,
  Flag
}
 What shape a node key's value takes. More...
enum class  morph::ui::detail::NameCategory : std::uint8_t {
  Param , Model , State , Let ,
  Query , Mutation , Element , Transfer
}
 What a name in a scope declares. More...

Functions

std::function< std::optional< std::string >(std::string_view)> morph::ui::documentLookup (std::map< std::string, std::string, std::less<> > documents)
 A Catalog::view or Catalog::wizard lookup over documents by action id.
void morph::ui::detail::refuse (std::string const &path, std::string reason)
 Refuses the document.
KindSpec const * morph::ui::detail::findKind (std::string_view kind, bool part)
 Looks up a node kind or a part kind.
bool morph::ui::detail::listed (std::span< std::string_view const > names, std::string_view name)
 Whether a list of names holds one.
void morph::ui::detail::refuseMustUnderstand (Json::object_t const &object, std::string const &path)
 Refuses a must-understand key (!name) the client does not know; other unknown keys are ignored.
void morph::ui::detail::checkChord (std::string const &chord, std::string const &path)
 Parses a key chord, and refuses one the workspace shell reserves.
Type morph::ui::detail::elementValueType (std::string_view value)
 The type of an element value.
bool morph::ui::detail::compatible (Type const &declared, Type const &actual)
 Whether a value of type actual may stand where declared is expected.
std::expected< Document, Refusal > morph::ui::loadDocument (Json const &json, LoadOptions const &options={})
 Parses a UI document and runs its load-time validation (spec 5 §3).
std::expected< Document, Refusal > morph::ui::loadDocumentText (std::string_view text, LoadOptions const &options={})
 Parses JSON text as a UI document and runs its load-time validation.
std::vector< std::string_view > morph::ui::nodeKinds ()
 The view node kinds of ui/1.

Variables

constexpr std::string_view morph::ui::kVocabulary = "ui/1"
 The vocabulary a document declares; the only one this client reads.
constexpr std::uint8_t morph::ui::detail::kInner = 1U
 The key is evaluated in the node's own scope (a dialog's, a row's), not the scope around it.
constexpr std::uint8_t morph::ui::detail::kRequired = 2U
 The key is required.
constexpr std::uint8_t morph::ui::detail::kBoundaryError = 4U
 The key's content is a boundary's error, where boundary.error and retry are valid.
constexpr std::uint8_t morph::ui::detail::kScope = 1U
 The node or part creates a scope.
constexpr std::uint8_t morph::ui::detail::kRowScope = 2U
 The scope it creates is a row scope, where row is valid.
constexpr std::uint8_t morph::ui::detail::kField = 4U
 It carries the input decorations readonly, required, errors and stale.
constexpr std::uint8_t morph::ui::detail::kPart = 8U
 It is a part, not a node: it has no common properties.
constexpr std::uint8_t morph::ui::detail::kWritable = 16U
 A command may write its draft with set.
constexpr std::uint8_t morph::ui::detail::kOpenValues = 32U
 Any path below its id is an element value (a form's fields).
constexpr std::array< KeySpec, 18 > morph::ui::detail::kCommonKeys
 The keys every node takes.
constexpr std::array< KeySpec, 4 > morph::ui::detail::kFieldKeys
 The input decorations text and the inputs take.
constexpr std::array< std::string_view, 5 > morph::ui::detail::kAnyValues = {"visible", "enabled", "valid", "errors", "shownErrors"}
 The element values every element has.
constexpr std::array< std::string_view, 5 > morph::ui::detail::kInputValues = {"value", "draft", "dirty", "focused", "touched"}
 The element values of a text, date-time or slider input.
constexpr std::array< std::string_view, 1 > morph::ui::detail::kCheckboxValues = {"checked"}
 The element values of a checkbox.
constexpr std::array< std::string_view, 2 > morph::ui::detail::kSelectValues = {"selected", "selectedOption"}
 The element values of a select.
constexpr std::array< std::string_view, 10 > morph::ui::detail::kTableValues
 The element values of a table.
constexpr std::array< std::string_view, 3 > morph::ui::detail::kDialogValues = {"open", "ready", "submitted"}
 The element values of a dialog or drawer.
constexpr std::array< std::string_view, 3 > morph::ui::detail::kFormValues = {"ready", "body", "submitted"}
 The element values of a form, beside its fields.
constexpr std::array< std::string_view, 3 > morph::ui::detail::kTransferValues = {"progress", "pending", "error"}
 The values of a transfer id.
constexpr std::array< KeySpec, 2 > morph::ui::detail::kTextKeys = {{{"text", Shape::Expr}, {"role", Shape::Expr}}}
 The keys of text.
constexpr std::array< KeySpec, 7 > morph::ui::detail::kButtonKeys
 The keys of button.
constexpr std::array< KeySpec, 10 > morph::ui::detail::kTextInputKeys
 The keys of textInput.
constexpr std::array< KeySpec, 4 > morph::ui::detail::kCheckboxKeys
 The keys of checkbox.
constexpr std::array< KeySpec, 8 > morph::ui::detail::kSelectKeys
 The keys of select.
constexpr std::array< KeySpec, 1 > morph::ui::detail::kMenuKeys = {{{"items", Shape::Parts, "menuItem"}}}
 The keys of menu.
constexpr std::array< KeySpec, 7 > morph::ui::detail::kMenuItemKeys
 The keys of a menu item part.
constexpr std::array< KeySpec, 4 > morph::ui::detail::kContainerKeys
 The keys of column and row.
constexpr std::array< KeySpec, 5 > morph::ui::detail::kGridKeys
 The keys of grid; justify is read only to refuse it.
constexpr std::array< KeySpec, 7 > morph::ui::detail::kPanelKeys
 The keys of panel.
constexpr std::array< KeySpec, 2 > morph::ui::detail::kScrollKeys = {{{"axis", Shape::Expr}, {"children", Shape::Nodes}}}
 The keys of scroll.
constexpr std::array< KeySpec, 3 > morph::ui::detail::kSwitchKeys
 The keys of switch.
constexpr std::array< KeySpec, 2 > morph::ui::detail::kCaseKeys
 The keys of a switch case part.
constexpr std::array< KeySpec, 1 > morph::ui::detail::kTabsKeys = {{{"tabs", Shape::Parts, "tab"}}}
 The keys of tabs.
constexpr std::array< KeySpec, 2 > morph::ui::detail::kTabKeys = {{{"label", Shape::Expr}, {"children", Shape::Nodes}}}
 The keys of a tabs page part.
constexpr std::array< KeySpec, 9 > morph::ui::detail::kDialogKeys
 The keys of dialog and drawer.
constexpr std::array< KeySpec, 2 > morph::ui::detail::kBusyKeys = {{{"active", Shape::Condition}, {"label", Shape::Expr}}}
 The keys of busy.
constexpr std::array< KeySpec, 5 > morph::ui::detail::kForEachKeys
 The keys of forEach.
constexpr std::array< KeySpec, 18 > morph::ui::detail::kTableKeys
 The keys of table.
constexpr std::array< KeySpec, 5 > morph::ui::detail::kColumnKeys
 The keys of a table column part.
constexpr std::array< KeySpec, 6 > morph::ui::detail::kDateTimeKeys
 The keys of dateTimeInput.
constexpr std::array< KeySpec, 7 > morph::ui::detail::kSliderKeys
 The keys of slider.
constexpr std::array< KeySpec, 5 > morph::ui::detail::kFilePickerKeys
 The keys of filePicker.
constexpr std::array< KeySpec, 5 > morph::ui::detail::kBannerKeys
 The keys of banner.
constexpr std::array< KeySpec, 2 > morph::ui::detail::kActionKeys = {{{"label", Shape::Expr}, {"onClick", Shape::Commands}}}
 The keys of an action part.
constexpr std::array< KeySpec, 7 > morph::ui::detail::kActionButtonKeys
 The keys of an actionButton part: a button a screen's head or an overlay's footer shows.
constexpr std::array< KeySpec, 4 > morph::ui::detail::kHeadBadgeKeys
 The keys of a headBadge part: a status badge of a screen's head.
constexpr std::array< KeySpec, 3 > morph::ui::detail::kBadgeKeys
 The keys of badge.
constexpr std::array< KeySpec, 2 > morph::ui::detail::kProgressKeys = {{{"value", Shape::Expr}, {"label", Shape::Expr}}}
 The keys of progress.
constexpr std::array< KeySpec, 2 > morph::ui::detail::kStepsKeys = {{{"items", Shape::Expr}, {"current", Shape::Expr}}}
 The keys of steps.
constexpr std::array< KeySpec, 1 > morph::ui::detail::kKeyValueKeys = {{{"items", Shape::Expr}}}
 The keys of keyValue.
constexpr std::array< KeySpec, 4 > morph::ui::detail::kEmptyStateKeys
 The keys of emptyState.
constexpr std::array< KeySpec, 3 > morph::ui::detail::kSplitterKeys
 The keys of splitter.
constexpr std::array< KeySpec, 5 > morph::ui::detail::kCollapsibleKeys
 The keys of collapsible.
constexpr std::array< KeySpec, 4 > morph::ui::detail::kDropZoneKeys
 The keys of dropZone.
constexpr std::array< KeySpec, 1 > morph::ui::detail::kCustomizeKeys = {{{"point", Shape::Name, {}, kRequired}}}
 The keys of customize.
constexpr std::array< KeySpec, 3 > morph::ui::detail::kBoundaryKeys
 The keys of boundary.
constexpr std::array< KeySpec, 15 > morph::ui::detail::kFormKeys
 The keys of form.
constexpr std::array< KeySpec, 7 > morph::ui::detail::kCollectionKeys
 The keys of collection and wizard: the model and action, and the presentation keys that reach every form the view draws.
constexpr std::array< KeySpec, 3 > morph::ui::detail::kCustomKeys
 The keys of custom.
constexpr std::array< KeySpec, 2 > morph::ui::detail::kA11yKeys = {{{"name", Shape::Expr}, {"role", Shape::Text}}}
 The keys of an a11y part.
constexpr std::array< KeySpec, 1 > morph::ui::detail::kDragKeys = {{{"payload", Shape::Expr, {}, kRequired}}}
 The keys of a drag part.
constexpr std::array< KeySpec, 2 > morph::ui::detail::kDropKeys = {{{"accepts", Shape::Expr}, {"onDrop", Shape::Commands}}}
 The keys of a drop part.
constexpr std::array< KindSpec, 48 > morph::ui::detail::kKinds
 The view node kinds of ui/1 and the part kinds inside them.

Detailed Description

The UI document (spec 5 §3): its model — declarations, commands, view nodes, components and customization points — and loadDocument, which parses a document and runs its load-time validation.

Specified in docs/spec/ui/document.md.

Definition in file document.hpp.

Typedef Documentation

◆ Commands

using morph::ui::Commands = std::vector<Command>

A command list, run as one batch.

Definition at line 239 of file document.hpp.

◆ DocNodePtr

using morph::ui::DocNodePtr = std::shared_ptr<DocNode const>

A shared, immutable view node.

Definition at line 387 of file document.hpp.

Enumeration Type Documentation

◆ InstanceMode

enum class morph::ui::InstanceMode : std::uint8_t
strong

How a model alias binds its instance (spec 5 §5).

Enumerator
Default 

None named: shared when the catalog marks the model stateless, private otherwise.

Private 

An instance of the scope's own, released when the scope unmounts.

Shared 

A stateless model's instance, its queries cached with other screens'; refused for a stateful model.

Keyed 

The shared instance an expression's key selects.

Borrowed 

The opener's binding of an alias ({"from": alias}), for a screen opened as a dialog.

Definition at line 146 of file document.hpp.

◆ Concurrency

enum class morph::ui::Concurrency : std::uint8_t
strong

What a mutation run does while another is in flight.

Enumerator
Exclusive 

The run is refused.

Serial 

Runs queue, one queue per serialKey.

Latest 

Every run is sent; only the newest reply applies.

Parallel 

Every run is sent; replies apply as they arrive.

Definition at line 217 of file document.hpp.

◆ CommandKind

enum class morph::ui::CommandKind : std::uint8_t
strong

The commands of ui/1 (spec 5 §8, spec 6).

Enumerator
Set 

{"set": "name.path", "value": e}

Reset 

{"reset": "name"}

Run 

{"run": "m", "body": e?, "as": "x"?, "each": e?}

Refetch 

{"refetch": "q"}

Open 

{"open": "dialog"}

Close 

{"close": "dialog" | "self"}

Navigate 

{"navigate": "screen" | {"route": e}, "params": e, "as": ..., "onResult": [...], ...}

Return 

{"return": e}

Focus 

{"focus": "id"}

Host 

{"host": "name", "args": e?}

SwitchBackend 

{"switchBackend": "name"}

ResetPrefs 

{"resetPrefs": "point" | "all"}

SetLocale 

{"setLocale": "de"}

Notify 

{"notify": e, "role": "success"}

Seq 

{"seq": [...]}

All 

{"all": [...]}

If 

{"if": [cond, [...], [...]]}

CancelClose 

{"cancelClose": true}

Retry 

{"retry": true}

SignIn 

{"signIn": {"from": "m"}}

SignOut 

{"signOut": true}

Upload 

{"upload": e, "to": "m", "as": "x"?, "id": "t"?, "into": "bytes"?, "nameAs"?, "typeAs"?}

Download 

{"download": e, "save": "dialog", "name": e?} or {"download": e, "to": "preview", "as": "url"}, either with "from": "bytes", a name and a type

Definition at line 242 of file document.hpp.

◆ WatchSource

enum class morph::ui::WatchSource : std::uint8_t
strong

Which changes a watch reacts to.

Enumerator
Any 

Every change.

User 

Only changes caused by the user's own edits.

Definition at line 333 of file document.hpp.

◆ LoadWarningKind

enum class morph::ui::LoadWarningKind : std::uint8_t
strong

What a load-time warning is about. A warning never refuses a document.

Enumerator
WatchFeedback 

A watch of a query runs a mutation that changes data, on any change of it.

Uncovered 

A mutation whose action declares nothing, and after which nothing refreshes.

Definition at line 508 of file document.hpp.

◆ Shape

enum class morph::ui::detail::Shape : std::uint8_t
strong

What shape a node key's value takes.

Enumerator
Expr 

An expression.

Condition 

An expression checked as a bool.

Commands 

A command list.

Nodes 

A node or a list of nodes.

Text 

A plain string.

Name 

A plain string that is a name.

Part 

A record, parsed by the part table of its part kind.

Parts 

A list of such records.

PartsOrExpr 

A list of records, or an expression yielding one.

ExprRecord 

A record of expressions.

CommandRecord 

A record of command lists.

Keys 

Key bindings: chord to command list.

Flag 

A literal true or false, set once.

Definition at line 604 of file document.hpp.

◆ NameCategory

enum class morph::ui::detail::NameCategory : std::uint8_t
strong

What a name in a scope declares.

Enumerator
Param 

A screen param.

Model 

A model alias.

State 

State.

Let 

A derived value.

Query 

A query.

Mutation 

A mutation.

Element 

An element id.

Transfer 

A transfer id of upload.

Definition at line 2106 of file document.hpp.

Function Documentation

◆ documentLookup()

std::function< std::optional< std::string >(std::string_view)> morph::ui::documentLookup ( std::map< std::string, std::string, std::less<> > documents)
inlinenodiscard

A Catalog::view or Catalog::wizard lookup over documents by action id.

Parameters
documentsThe documents by action id; the lookup keeps its own copy.
Returns
The lookup.

Definition at line 127 of file document.hpp.

◆ refuse()

void morph::ui::detail::refuse ( std::string const & path,
std::string reason )
inline

Refuses the document.

Parameters
pathWhere.
reasonWhy.

Definition at line 599 of file document.hpp.

◆ findKind()

KindSpec const * morph::ui::detail::findKind ( std::string_view kind,
bool part )
inlinenodiscard

Looks up a node kind or a part kind.

Parameters
kindThe kind.
partWhether a part kind is wanted.
Returns
The spec, or nullptr.

Definition at line 990 of file document.hpp.

◆ listed()

bool morph::ui::detail::listed ( std::span< std::string_view const > names,
std::string_view name )
inlinenodiscard

Whether a list of names holds one.

Parameters
namesThe list.
nameThe candidate.
Returns
Whether name is in names.

Definition at line 1003 of file document.hpp.

◆ refuseMustUnderstand()

void morph::ui::detail::refuseMustUnderstand ( Json::object_t const & object,
std::string const & path )
inline

Refuses a must-understand key (!name) the client does not know; other unknown keys are ignored.

Parameters
objectThe JSON object.
pathIts JSON Pointer.

Definition at line 1010 of file document.hpp.

◆ checkChord()

void morph::ui::detail::checkChord ( std::string const & chord,
std::string const & path )
inline

Parses a key chord, and refuses one the workspace shell reserves.

Parameters
chordThe chord, such as Ctrl+Shift+K.
pathIts JSON Pointer.

Definition at line 1023 of file document.hpp.

◆ elementValueType()

Type morph::ui::detail::elementValueType ( std::string_view value)
inlinenodiscard

The type of an element value.

Parameters
valueThe value's name.
Returns
Its type.

Definition at line 2213 of file document.hpp.

◆ compatible()

bool morph::ui::detail::compatible ( Type const & declared,
Type const & actual )
inlinenodiscard

Whether a value of type actual may stand where declared is expected.

Parameters
declaredThe expected type.
actualThe type found.
Returns
Whether they are compatible: equal kinds, any on either side, an int for a decimal or key, a string for a key.

Definition at line 2237 of file document.hpp.

◆ loadDocument()

std::expected< Document, Refusal > morph::ui::loadDocument ( Json const & json,
LoadOptions const & options = {} )
inlinenodiscard

Parses a UI document and runs its load-time validation (spec 5 §3).

A document is refused when it does not parse, when a reference does not resolve, when a type does not check, when the let or watch graph has a cycle, when an expression exceeds 256 nodes, when a node kind, command or function is not in the vocabulary, when a document declares invalidates, patch or refreshOn, when a must-understand key is unknown, or when a rule of spec 5 or spec 6 fails; the list is in docs/spec/ui/document.md. The rules that need catalog facts run when options supplies them.

Parameters
jsonThe document's JSON.
optionsThe catalog facts.
Returns
The document, with what validation found that does not refuse it in Document::warnings, or the first refusal, naming the document id, the JSON Pointer and the reason.

Definition at line 3801 of file document.hpp.

◆ loadDocumentText()

std::expected< Document, Refusal > morph::ui::loadDocumentText ( std::string_view text,
LoadOptions const & options = {} )
inlinenodiscard

Parses JSON text as a UI document and runs its load-time validation.

Parameters
textThe document's JSON text.
optionsThe catalog facts.
Returns
The document, or the refusal; text that is not JSON is refused at the root.

Definition at line 3829 of file document.hpp.

◆ nodeKinds()

std::vector< std::string_view > morph::ui::nodeKinds ( )
inlinenodiscard

The view node kinds of ui/1.

Returns
Their kind spellings.

Definition at line 3840 of file document.hpp.

Variable Documentation

◆ kVocabulary

std::string_view morph::ui::kVocabulary = "ui/1"
inlineconstexpr

The vocabulary a document declares; the only one this client reads.

Definition at line 37 of file document.hpp.

◆ kInner

std::uint8_t morph::ui::detail::kInner = 1U
inlineconstexpr

The key is evaluated in the node's own scope (a dialog's, a row's), not the scope around it.

Definition at line 621 of file document.hpp.

◆ kRequired

std::uint8_t morph::ui::detail::kRequired = 2U
inlineconstexpr

The key is required.

Definition at line 623 of file document.hpp.

◆ kBoundaryError

std::uint8_t morph::ui::detail::kBoundaryError = 4U
inlineconstexpr

The key's content is a boundary's error, where boundary.error and retry are valid.

Definition at line 625 of file document.hpp.

◆ kScope

std::uint8_t morph::ui::detail::kScope = 1U
inlineconstexpr

The node or part creates a scope.

Definition at line 640 of file document.hpp.

◆ kRowScope

std::uint8_t morph::ui::detail::kRowScope = 2U
inlineconstexpr

The scope it creates is a row scope, where row is valid.

Definition at line 642 of file document.hpp.

◆ kField

std::uint8_t morph::ui::detail::kField = 4U
inlineconstexpr

It carries the input decorations readonly, required, errors and stale.

Definition at line 644 of file document.hpp.

◆ kPart

std::uint8_t morph::ui::detail::kPart = 8U
inlineconstexpr

It is a part, not a node: it has no common properties.

Definition at line 646 of file document.hpp.

◆ kWritable

std::uint8_t morph::ui::detail::kWritable = 16U
inlineconstexpr

A command may write its draft with set.

Definition at line 648 of file document.hpp.

◆ kOpenValues

std::uint8_t morph::ui::detail::kOpenValues = 32U
inlineconstexpr

Any path below its id is an element value (a form's fields).

Definition at line 650 of file document.hpp.

◆ kCommonKeys

std::array<KeySpec, 18> morph::ui::detail::kCommonKeys
inlineconstexpr
Initial value:
= {{
{"id", Shape::Name},
{"visible", Shape::Condition},
{"enabled", Shape::Condition},
{"tooltip", Shape::Expr},
{"sizing", Shape::Expr},
{"minWidth", Shape::Expr},
{"maxWidth", Shape::Expr},
{"minHeight", Shape::Expr},
{"maxHeight", Shape::Expr},
{"alignSelf", Shape::Text},
{"span", Shape::Expr},
{"testId", Shape::Text},
{"surface", Shape::Text},
{"autofocus", Shape::Expr},
{"a11y", Shape::Part, "a11y"},
{"drag", Shape::Part, "drag"},
{"drop", Shape::Part, "drop"},
{"keys", Shape::Keys},
}}
@ Name
A plain string that is a name.
Definition document.hpp:610
@ Condition
An expression checked as a bool.
Definition document.hpp:606

The keys every node takes.

Definition at line 666 of file document.hpp.

◆ kFieldKeys

std::array<KeySpec, 4> morph::ui::detail::kFieldKeys
inlineconstexpr
Initial value:
= {{
{"readonly", Shape::Condition},
{"required", Shape::Condition},
{"errors", Shape::Expr},
{"stale", Shape::Condition},
}}

The input decorations text and the inputs take.

Definition at line 688 of file document.hpp.

◆ kAnyValues

std::array<std::string_view, 5> morph::ui::detail::kAnyValues = {"visible", "enabled", "valid", "errors", "shownErrors"}
inlineconstexpr

The element values every element has.

Definition at line 696 of file document.hpp.

◆ kInputValues

std::array<std::string_view, 5> morph::ui::detail::kInputValues = {"value", "draft", "dirty", "focused", "touched"}
inlineconstexpr

The element values of a text, date-time or slider input.

Definition at line 698 of file document.hpp.

◆ kCheckboxValues

std::array<std::string_view, 1> morph::ui::detail::kCheckboxValues = {"checked"}
inlineconstexpr

The element values of a checkbox.

Definition at line 700 of file document.hpp.

◆ kSelectValues

std::array<std::string_view, 2> morph::ui::detail::kSelectValues = {"selected", "selectedOption"}
inlineconstexpr

The element values of a select.

Definition at line 702 of file document.hpp.

◆ kTableValues

std::array<std::string_view, 10> morph::ui::detail::kTableValues
inlineconstexpr
Initial value:
= {
"selection", "activeKey", "sort", "filters", "viewCount",
"sourceCount", "selectedCount", "pending", "error", "hoveredKey"}

The element values of a table.

Definition at line 704 of file document.hpp.

◆ kDialogValues

std::array<std::string_view, 3> morph::ui::detail::kDialogValues = {"open", "ready", "submitted"}
inlineconstexpr

The element values of a dialog or drawer.

Definition at line 708 of file document.hpp.

◆ kFormValues

std::array<std::string_view, 3> morph::ui::detail::kFormValues = {"ready", "body", "submitted"}
inlineconstexpr

The element values of a form, beside its fields.

Definition at line 710 of file document.hpp.

◆ kTransferValues

std::array<std::string_view, 3> morph::ui::detail::kTransferValues = {"progress", "pending", "error"}
inlineconstexpr

The values of a transfer id.

Definition at line 712 of file document.hpp.

◆ kTextKeys

std::array<KeySpec, 2> morph::ui::detail::kTextKeys = {{{"text", Shape::Expr}, {"role", Shape::Expr}}}
inlineconstexpr

The keys of text.

Definition at line 715 of file document.hpp.

◆ kButtonKeys

std::array<KeySpec, 7> morph::ui::detail::kButtonKeys
inlineconstexpr
Initial value:
= {{{"label", Shape::Expr},
{"icon", Shape::Expr},
{"emphasis", Shape::Text},
{"style", Shape::Text},
{"selected", Shape::Condition},
{"onClick", Shape::Commands},
{"onActivate", Shape::Commands}}}
@ Expr
An expression.
Definition document.hpp:605

The keys of button.

Definition at line 717 of file document.hpp.

◆ kTextInputKeys

std::array<KeySpec, 10> morph::ui::detail::kTextInputKeys
inlineconstexpr
Initial value:
= {{{"value", Shape::Expr},
{"placeholder", Shape::Expr},
{"mode", Shape::Expr},
{"icon", Shape::Expr},
{"commitOn", Shape::Text},
{"label", Shape::Expr},
{"showLabel", Shape::Flag},
{"onChange", Shape::Commands},
{"onCommit", Shape::Commands},
{"onSubmit", Shape::Commands}}}

The keys of textInput.

Definition at line 725 of file document.hpp.

◆ kCheckboxKeys

std::array<KeySpec, 4> morph::ui::detail::kCheckboxKeys
inlineconstexpr
Initial value:
= {
{{"label", Shape::Expr}, {"checked", Shape::Expr}, {"onToggle", Shape::Commands}, {"onChange", Shape::Commands}}}

The keys of checkbox.

Definition at line 736 of file document.hpp.

◆ kSelectKeys

std::array<KeySpec, 8> morph::ui::detail::kSelectKeys
inlineconstexpr
Initial value:
= {{{"options", Shape::Expr},
{"selected", Shape::Expr},
{"style", Shape::Expr},
{"label", Shape::Expr},
{"showLabel", Shape::Flag},
{"onStale", Shape::Text},
{"onChoose", Shape::Commands},
{"onChange", Shape::Commands}}}

The keys of select.

Definition at line 739 of file document.hpp.

◆ kMenuKeys

std::array<KeySpec, 1> morph::ui::detail::kMenuKeys = {{{"items", Shape::Parts, "menuItem"}}}
inlineconstexpr

The keys of menu.

Definition at line 748 of file document.hpp.

◆ kMenuItemKeys

std::array<KeySpec, 7> morph::ui::detail::kMenuItemKeys
inlineconstexpr
Initial value:
= {{{"label", Shape::Expr},
{"icon", Shape::Expr},
{"keys", Shape::Text},
{"checked", Shape::Expr},
{"enabled", Shape::Condition},
{"onClick", Shape::Commands},
{"items", Shape::Parts, "menuItem"}}}

The keys of a menu item part.

Definition at line 750 of file document.hpp.

◆ kContainerKeys

std::array<KeySpec, 4> morph::ui::detail::kContainerKeys
inlineconstexpr
Initial value:
= {
{{"children", Shape::Nodes}, {"gap", Shape::Expr}, {"align", Shape::Text}, {"justify", Shape::Text}}}
@ Nodes
A node or a list of nodes.
Definition document.hpp:608

The keys of column and row.

Definition at line 758 of file document.hpp.

◆ kGridKeys

std::array<KeySpec, 5> morph::ui::detail::kGridKeys
inlineconstexpr
Initial value:
= {{{"children", Shape::Nodes},
{"gap", Shape::Expr},
{"columns", Shape::Expr},
{"align", Shape::Text},
{"justify", Shape::Text}}}

The keys of grid; justify is read only to refuse it.

Definition at line 761 of file document.hpp.

◆ kPanelKeys

std::array<KeySpec, 7> morph::ui::detail::kPanelKeys
inlineconstexpr
Initial value:
= {{{"title", Shape::Expr},
{"header", Shape::Nodes},
{"padding", Shape::Expr},
{"collapsible", Shape::Expr},
{"collapsed", Shape::Expr},
{"onToggle", Shape::Commands},
{"children", Shape::Nodes}}}

The keys of panel.

Definition at line 767 of file document.hpp.

◆ kScrollKeys

std::array<KeySpec, 2> morph::ui::detail::kScrollKeys = {{{"axis", Shape::Expr}, {"children", Shape::Nodes}}}
inlineconstexpr

The keys of scroll.

Definition at line 775 of file document.hpp.

◆ kSwitchKeys

std::array<KeySpec, 3> morph::ui::detail::kSwitchKeys
inlineconstexpr
Initial value:
= {
{{"on", Shape::Expr, {}, kRequired}, {"cases", Shape::Parts, "case"}, {"default", Shape::Nodes}}}
constexpr std::uint8_t kRequired
The key is required.
Definition document.hpp:623

The keys of switch.

Definition at line 777 of file document.hpp.

◆ kCaseKeys

std::array<KeySpec, 2> morph::ui::detail::kCaseKeys
inlineconstexpr
Initial value:
= {
{{"when", Shape::Expr, {}, kRequired}, {"children", Shape::Nodes, {}, kInner}}}

The keys of a switch case part.

Definition at line 780 of file document.hpp.

◆ kTabsKeys

std::array<KeySpec, 1> morph::ui::detail::kTabsKeys = {{{"tabs", Shape::Parts, "tab"}}}
inlineconstexpr

The keys of tabs.

Definition at line 783 of file document.hpp.

◆ kTabKeys

std::array<KeySpec, 2> morph::ui::detail::kTabKeys = {{{"label", Shape::Expr}, {"children", Shape::Nodes}}}
inlineconstexpr

The keys of a tabs page part.

Definition at line 785 of file document.hpp.

◆ kDialogKeys

std::array<KeySpec, 9> morph::ui::detail::kDialogKeys
inlineconstexpr
Initial value:
= {{{"open", Shape::Condition},
{"title", Shape::Expr},
{"showErrors", Shape::Text},
{"children", Shape::Nodes, {}, kInner},
{"onDismiss", Shape::Commands},
{"default", Shape::Commands, {}, kInner},
{"cancel", Shape::Commands, {}, kInner},
{"actions", Shape::Parts, "actionButton", kInner},
{"side", Shape::Expr}}}
constexpr std::uint8_t kInner
The key is evaluated in the node's own scope (a dialog's, a row's), not the scope around it.
Definition document.hpp:621

The keys of dialog and drawer.

Definition at line 787 of file document.hpp.

◆ kBusyKeys

std::array<KeySpec, 2> morph::ui::detail::kBusyKeys = {{{"active", Shape::Condition}, {"label", Shape::Expr}}}
inlineconstexpr

The keys of busy.

Definition at line 797 of file document.hpp.

◆ kForEachKeys

std::array<KeySpec, 5> morph::ui::detail::kForEachKeys
inlineconstexpr
Initial value:
= {{{"rows", Shape::Expr, {}, kRequired},
{"key", Shape::Expr, {}, kInner},
{"axis", Shape::Expr},
{"gap", Shape::Expr},
{"children", Shape::Nodes, {}, kInner}}}

The keys of forEach.

Definition at line 799 of file document.hpp.

◆ kTableKeys

std::array<KeySpec, 18> morph::ui::detail::kTableKeys
inlineconstexpr
Initial value:
= {{{"rows", Shape::Expr},
{"key", Shape::Expr, {}, kInner},
{"model", Shape::Name},
{"action", Shape::Text},
{"body", Shape::Expr},
{"mode", Shape::Expr},
{"columns", Shape::PartsOrExpr, "column"},
{"showHeader", Shape::Flag},
{"virtualizeThreshold", Shape::Expr},
{"virtualizeOverscan", Shape::Expr},
{"selectionMode", Shape::Expr},
{"selection", Shape::Expr},
{"sort", Shape::Expr},
{"filters", Shape::Expr},
{"rowTone", Shape::Expr, {}, kInner},
{"highlightKey", Shape::Expr},
{"onActivate", Shape::Commands, {}, kInner},
{"empty", Shape::Nodes}}}

The keys of table.

Definition at line 805 of file document.hpp.

◆ kColumnKeys

std::array<KeySpec, 5> morph::ui::detail::kColumnKeys
inlineconstexpr
Initial value:
= {{{"id", Shape::Name},
{"label", Shape::Expr},
{"width", Shape::Expr},
{"role", Shape::Expr},
{"cell", Shape::Nodes, {}, kInner}}}

The keys of a table column part.

Definition at line 824 of file document.hpp.

◆ kDateTimeKeys

std::array<KeySpec, 6> morph::ui::detail::kDateTimeKeys
inlineconstexpr
Initial value:
= {{{"value", Shape::Expr},
{"mode", Shape::Expr},
{"label", Shape::Expr},
{"showLabel", Shape::Flag},
{"onChange", Shape::Commands},
{"onCommit", Shape::Commands}}}

The keys of dateTimeInput.

Definition at line 830 of file document.hpp.

◆ kSliderKeys

std::array<KeySpec, 7> morph::ui::detail::kSliderKeys
inlineconstexpr
Initial value:
= {{{"value", Shape::Expr},
{"min", Shape::Expr},
{"max", Shape::Expr},
{"step", Shape::Expr},
{"label", Shape::Expr},
{"onChange", Shape::Commands},
{"onCommit", Shape::Commands}}}

The keys of slider.

Definition at line 837 of file document.hpp.

◆ kFilePickerKeys

std::array<KeySpec, 5> morph::ui::detail::kFilePickerKeys
inlineconstexpr
Initial value:
= {{{"accept", Shape::Expr},
{"multiple", Shape::Expr},
{"mode", Shape::Expr},
{"label", Shape::Expr},
{"onPick", Shape::Commands}}}

The keys of filePicker.

Definition at line 845 of file document.hpp.

◆ kBannerKeys

std::array<KeySpec, 5> morph::ui::detail::kBannerKeys
inlineconstexpr
Initial value:
= {{{"tone", Shape::Expr},
{"text", Shape::Expr},
{"dismissible", Shape::Expr},
{"action", Shape::Part, "action"},
{"onDismiss", Shape::Commands}}}

The keys of banner.

Definition at line 851 of file document.hpp.

◆ kActionKeys

std::array<KeySpec, 2> morph::ui::detail::kActionKeys = {{{"label", Shape::Expr}, {"onClick", Shape::Commands}}}
inlineconstexpr

The keys of an action part.

Definition at line 857 of file document.hpp.

◆ kActionButtonKeys

std::array<KeySpec, 7> morph::ui::detail::kActionButtonKeys
inlineconstexpr
Initial value:
= {{{"id", Shape::Name, {}, kRequired},
{"label", Shape::Expr, {}, kRequired},
{"icon", Shape::Expr},
{"emphasis", Shape::Text},
{"enabled", Shape::Condition},
{"visible", Shape::Condition},
{"onClick", Shape::Commands}}}

The keys of an actionButton part: a button a screen's head or an overlay's footer shows.

Definition at line 859 of file document.hpp.

◆ kHeadBadgeKeys

std::array<KeySpec, 4> morph::ui::detail::kHeadBadgeKeys
inlineconstexpr
Initial value:
= {
{{"tone", Shape::Expr}, {"text", Shape::Expr}, {"icon", Shape::Expr}, {"visible", Shape::Condition}}}

The keys of a headBadge part: a status badge of a screen's head.

Definition at line 867 of file document.hpp.

◆ kBadgeKeys

std::array<KeySpec, 3> morph::ui::detail::kBadgeKeys
inlineconstexpr
Initial value:
= {
{{"tone", Shape::Expr}, {"text", Shape::Expr}, {"icon", Shape::Expr}}}

The keys of badge.

Definition at line 870 of file document.hpp.

◆ kProgressKeys

std::array<KeySpec, 2> morph::ui::detail::kProgressKeys = {{{"value", Shape::Expr}, {"label", Shape::Expr}}}
inlineconstexpr

The keys of progress.

Definition at line 873 of file document.hpp.

◆ kStepsKeys

std::array<KeySpec, 2> morph::ui::detail::kStepsKeys = {{{"items", Shape::Expr}, {"current", Shape::Expr}}}
inlineconstexpr

The keys of steps.

Definition at line 875 of file document.hpp.

◆ kKeyValueKeys

std::array<KeySpec, 1> morph::ui::detail::kKeyValueKeys = {{{"items", Shape::Expr}}}
inlineconstexpr

The keys of keyValue.

Definition at line 877 of file document.hpp.

◆ kEmptyStateKeys

std::array<KeySpec, 4> morph::ui::detail::kEmptyStateKeys
inlineconstexpr
Initial value:
= {
{{"title", Shape::Expr}, {"text", Shape::Expr}, {"icon", Shape::Expr}, {"action", Shape::Part, "action"}}}

The keys of emptyState.

Definition at line 879 of file document.hpp.

◆ kSplitterKeys

std::array<KeySpec, 3> morph::ui::detail::kSplitterKeys
inlineconstexpr
Initial value:
= {
{{"orientation", Shape::Expr}, {"sizes", Shape::Expr}, {"children", Shape::Nodes}}}

The keys of splitter.

Definition at line 882 of file document.hpp.

◆ kCollapsibleKeys

std::array<KeySpec, 5> morph::ui::detail::kCollapsibleKeys
inlineconstexpr
Initial value:
= {{{"title", Shape::Expr},
{"open", Shape::Condition},
{"header", Shape::Nodes},
{"children", Shape::Nodes},
{"onToggle", Shape::Commands}}}

The keys of collapsible.

Definition at line 885 of file document.hpp.

◆ kDropZoneKeys

std::array<KeySpec, 4> morph::ui::detail::kDropZoneKeys
inlineconstexpr
Initial value:
= {
{{"accept", Shape::Expr}, {"multiple", Shape::Expr}, {"children", Shape::Nodes}, {"onDrop", Shape::Commands}}}

The keys of dropZone.

Definition at line 891 of file document.hpp.

◆ kCustomizeKeys

std::array<KeySpec, 1> morph::ui::detail::kCustomizeKeys = {{{"point", Shape::Name, {}, kRequired}}}
inlineconstexpr

The keys of customize.

Definition at line 894 of file document.hpp.

◆ kBoundaryKeys

std::array<KeySpec, 3> morph::ui::detail::kBoundaryKeys
inlineconstexpr
Initial value:
= {
{{"loading", Shape::Nodes}, {"error", Shape::Nodes, {}, kBoundaryError}, {"children", Shape::Nodes}}}

The keys of boundary.

Definition at line 896 of file document.hpp.

◆ kFormKeys

std::array<KeySpec, 15> morph::ui::detail::kFormKeys
inlineconstexpr
Initial value:
= {{{"model", Shape::Name, {}, kRequired},
{"action", Shape::Text, {}, kRequired},
{"prefill", Shape::Expr},
{"key", Shape::Expr},
{"submit", Shape::Text},
{"showErrors", Shape::Text},
{"fields", Shape::ExprRecord, "fields"},
{"onSubmit", Shape::Commands},
{"onSuccess", Shape::Commands},
{"onError", Shape::Commands},
{"title", Shape::Expr},
{"submitLabel", Shape::Expr},
{"showStatus", Shape::Flag},
{"columns", Shape::Expr},
{"fieldLayout", Shape::Text}}}

The keys of form.

Definition at line 899 of file document.hpp.

◆ kCollectionKeys

std::array<KeySpec, 7> morph::ui::detail::kCollectionKeys
inlineconstexpr
Initial value:
= {{{"model", Shape::Name, {}, kRequired},
{"action", Shape::Text, {}, kRequired},
{"title", Shape::Expr},
{"submitLabel", Shape::Expr},
{"showStatus", Shape::Flag},
{"columns", Shape::Expr},
{"fieldLayout", Shape::Text}}}

The keys of collection and wizard: the model and action, and the presentation keys that reach every form the view draws.

Definition at line 916 of file document.hpp.

◆ kCustomKeys

std::array<KeySpec, 3> morph::ui::detail::kCustomKeys
inlineconstexpr
Initial value:
= {
{{"name", Shape::Text, {}, kRequired}, {"props", Shape::ExprRecord}, {"on", Shape::CommandRecord}}}
@ Text
A plain string.
Definition document.hpp:609

The keys of custom.

Definition at line 924 of file document.hpp.

◆ kA11yKeys

std::array<KeySpec, 2> morph::ui::detail::kA11yKeys = {{{"name", Shape::Expr}, {"role", Shape::Text}}}
inlineconstexpr

The keys of an a11y part.

Definition at line 927 of file document.hpp.

◆ kDragKeys

std::array<KeySpec, 1> morph::ui::detail::kDragKeys = {{{"payload", Shape::Expr, {}, kRequired}}}
inlineconstexpr

The keys of a drag part.

Definition at line 929 of file document.hpp.

◆ kDropKeys

std::array<KeySpec, 2> morph::ui::detail::kDropKeys = {{{"accepts", Shape::Expr}, {"onDrop", Shape::Commands}}}
inlineconstexpr

The keys of a drop part.

Definition at line 931 of file document.hpp.

◆ kKinds

std::array<KindSpec, 48> morph::ui::detail::kKinds
inlineconstexpr

The view node kinds of ui/1 and the part kinds inside them.

Definition at line 934 of file document.hpp.