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

Server-side authoring of UI documents (spec 5 §11): typed builders that write a screen's JSON, and the registration that validates it once — loadDocument with the builders' catalog facts, then the accessibility rules. More...

#include <algorithm>
#include <chrono>
#include <concepts>
#include <cstddef>
#include <cstdint>
#include <exception>
#include <expected>
#include <functional>
#include <glaze/glaze.hpp>
#include <initializer_list>
#include <iterator>
#include <map>
#include <memory>
#include <optional>
#include <stdexcept>
#include <string>
#include <string_view>
#include <type_traits>
#include <utility>
#include <vector>
#include "../core/changes.hpp"
#include "../core/effects.hpp"
#include "../core/logger.hpp"
#include "../core/model_key.hpp"
#include "../core/registry.hpp"
#include "../detail/fixed_string.hpp"
#include "../detail/reflected_member.hpp"
#include "../forms/engine/field_layout.hpp"
#include "../ui/document.hpp"
#include "../ui/value.hpp"
#include "../util/datetime.hpp"
#include "../util/rational.hpp"
#include "alignment.hpp"
#include "button_emphasis.hpp"
#include "button_style.hpp"

Go to the source code of this file.

Classes

struct  morph::ui::author::Any
 The value type of a handle whose value the screen cannot know when it is written: a query result read by name, an element value, an event payload. More...
class  morph::ui::author::AuthoringError
 What a builder throws when it is given something a document cannot say, such as a field read from a value that has no name. Registration turns it into a Refusal at the document's root. More...
struct  morph::ui::author::ModelFacts< Model >
 Catalog facts of a model type that its C++ type does not show. Specialise it for a model whose shared singleton is equivalent to a private instance. More...
struct  morph::ui::author::ActionFacts< Action >
 Catalog facts of an action that its C++ type does not show. Specialise it for an action whose reply rows carry server-calculated fields, whose reply carries a secret, or which sends a credential. More...
struct  morph::ui::author::CatalogFacts
 The catalog facts the builders gathered from the model and action types a screen names. More...
struct  morph::ui::author::detail::IsOptional< T >
 Whether a type is a std::optional. More...
struct  morph::ui::author::detail::IsOptional< std::optional< T > >
 A std::optional is one. More...
struct  morph::ui::author::detail::Unwrapped< T >
 A type with one std::optional removed. More...
struct  morph::ui::author::detail::Unwrapped< std::optional< T > >
 The engaged type of a std::optional. More...
struct  morph::ui::author::detail::IsVector< T >
 Whether a type is a std::vector. More...
struct  morph::ui::author::detail::IsVector< std::vector< T, Alloc > >
 A std::vector is one. More...
struct  morph::ui::author::detail::IsHandle< T >
 Whether a type is a Handle. More...
struct  morph::ui::author::detail::IsHandle< Handle< T > >
 A Handle is one. More...
struct  morph::ui::author::detail::LiteralOf< L >
 The value type a constant stands for. More...
struct  morph::ui::author::detail::LiteralOf< char[N]>
 Text is a std::string. More...
struct  morph::ui::author::detail::LiteralOf< char const * >
 A C string is a std::string. More...
struct  morph::ui::author::detail::LiteralOf< std::string_view >
 A string view is a std::string. More...
struct  morph::ui::author::detail::ValueOf< X >
 The value type of an operand: a handle's value type, or the type its constant stands for. More...
struct  morph::ui::author::detail::ValueOf< Handle< T > >
 A handle's value type. More...
class  morph::ui::author::Handle< T >
 An expression of a document, typed by the C++ value it evaluates to (spec 5 §11). More...
class  morph::ui::author::Element
 An element of the view, named by its id, whose live values relations read (spec 5 §6). More...
struct  morph::ui::author::Self
 The dialog or drawer a command list runs in, for close. More...
class  morph::ui::author::QueryRef
 A query of a scope, without its action type: what refetch, prefetch and optimistic name. More...
class  morph::ui::author::MutationRef
 A mutation of a scope, without its action type: what signIn, upload and can name. More...
class  morph::ui::author::QueryHandle< Action, Value >
 A query declared by a scope. More...
class  morph::ui::author::ResultHandle< T >
 A mutation's result: a Handle with no field reads. More...
class  morph::ui::author::MutationHandle< Action >
 A mutation declared by a scope. More...
class  morph::ui::author::BodyField< Action >
 One field of an action body: a member of the action, and the expression that fills it. More...
class  morph::ui::author::Body< Action >
 An action body: the action's members with expressions in place of values (spec 5 §11). C++ cannot synthesise the action's struct with its members retyped, so a body lists {&Action::member, value} pairs. More...
class  morph::ui::author::ModelHandle< Model >
 A model alias of a scope. More...
struct  morph::ui::author::Borrow
 The opener's binding of an alias, for a screen opened as a dialog ({"from": alias}). More...
class  morph::ui::author::InstanceSpec
 A model alias's instance: a binding mode, a key expression, or a borrowed binding. More...
struct  morph::ui::author::ModelOptions
 Options of a model alias. More...
struct  morph::ui::author::QueryOptions
 Options of a query (spec 5 §5). More...
struct  morph::ui::author::Optimistic
 An optimistic write: the row a mutation run predicts before its reply. More...
class  morph::ui::author::Commands
 A command list, run as one batch. More...
class  morph::ui::author::Command
 One command of ui/1 (spec 5 §8, spec 6). More...
struct  morph::ui::author::MutationOptions< Action >
 Options of a mutation (spec 5 §5). More...
struct  morph::ui::author::CheckOptions
 A validation across elements (spec 5 §6). More...
class  morph::ui::author::Nodes
 A list of view nodes. More...
class  morph::ui::author::Node
 A view node (spec 5 §9). The kind's own properties come from its builder's options; the properties every node takes come from the member functions, each of which returns a copy with the property set. More...
class  morph::ui::author::DeclScope
 A scope's declarations (spec 5 §3): model aliases, state, let, queries, mutations, watches and checks. A row, a dialog, a drawer and a switch case declare theirs on the scope their builder hands over. More...
struct  morph::ui::author::ComponentOptions
 A custom or host component (spec 5 §10). More...
class  morph::ui::author::ComponentRef
 A declared component, for custom nodes. More...
class  morph::ui::author::Point
 A customization point (spec 5 §12b). More...
struct  morph::ui::author::HeadBadgeOptions
 A status badge of the screen's head (screen.status). More...
struct  morph::ui::author::ActionButtonOptions
 A button of a screen's head (screen.action), or of a dialog's or drawer's footer. More...
class  morph::ui::author::Scope
 The screen's own scope: its declarations, params, lifecycle keys, components and customization points. More...
struct  morph::ui::author::RunOptions
 Options of run. More...
struct  morph::ui::author::NavigateOptions
 Options of navigate. More...
struct  morph::ui::author::UploadOptions
 Options of upload. More...
class  morph::ui::author::detail::NodeWriter
 Builds a node's JSON key by key, leaving out what is absent. More...
struct  morph::ui::author::TextOptions
 Options of text. More...
struct  morph::ui::author::ButtonOptions
 Options of button. More...
struct  morph::ui::author::TextInputOptions
 Options of textInput. More...
struct  morph::ui::author::CheckboxOptions
 Options of checkbox. More...
struct  morph::ui::author::SelectOptions
 Options of select. More...
struct  morph::ui::author::MenuItem
 An item of a menu; items nests a submenu. More...
struct  morph::ui::author::ContainerOptions
 Options of column, row and grid. More...
struct  morph::ui::author::PanelOptions
 Options of panel. More...
class  morph::ui::author::Case
 A case of a switch node, a scope of its own. More...
struct  morph::ui::author::Tab
 A page of a tabs node. More...
struct  morph::ui::author::DialogOptions
 Options of dialog and drawer. More...
struct  morph::ui::author::ForEachOptions
 Options of forEach. More...
struct  morph::ui::author::TableColumn
 A column of a table. More...
struct  morph::ui::author::TableOptions
 Options of table and dataTable. More...
struct  morph::ui::author::DateTimeInputOptions
 Options of dateTimeInput. More...
struct  morph::ui::author::SliderOptions
 Options of slider. More...
struct  morph::ui::author::FilePickerOptions
 Options of filePicker. More...
struct  morph::ui::author::ActionPart
 The action of a banner or emptyState. More...
struct  morph::ui::author::BannerOptions
 Options of banner. More...
struct  morph::ui::author::EmptyStateOptions
 Options of emptyState. More...
struct  morph::ui::author::CollapsibleOptions
 Options of collapsible. More...
struct  morph::ui::author::DropZoneOptions
 Options of dropZone. More...
struct  morph::ui::author::FieldSettings
 An overlay on one field of a form (spec 6 §10), applied to the parsed form model. More...
class  morph::ui::author::FieldOverlay< Action >
 One field of a form's fields overlay, by member pointer. More...
struct  morph::ui::author::FormPresentation
 How a form, collection or wizard presents its forms: the keys every one of them takes. More...
struct  morph::ui::author::FormOptions< Action >
 Options of form. More...
struct  morph::ui::author::CustomOptions
 Options of custom. More...
struct  morph::ui::author::Emitted
 A screen's emitted document: its JSON, the text that is served, and the catalog facts of its types. More...
class  morph::ui::author::Screen
 A screen definition: an id and the builder that writes the document. More...
struct  morph::ui::author::RegisteredScreen
 A registered screen: the text that is served and the document it loads as. More...
class  morph::ui::author::ScreenRegistry
 The screens of an application, each validated once when it is registered. More...

Concepts

concept  morph::ui::author::Runs
 Satisfied when Model runs Action: the model has an execute that takes it.
concept  morph::ui::author::detail::ScalarLiteral
 Satisfied by a C++ scalar a builder writes as a document constant.
concept  morph::ui::author::detail::Literal
 Satisfied by a C++ value a builder writes as a document constant: a scalar, a list of scalars, or a ui::Value.
concept  morph::ui::author::detail::Operand
 Satisfied by an operand of an expression operator: a handle or a constant.
concept  morph::ui::author::detail::HandleOperands
 Satisfied when two operands are operands and at least one is a handle, so the builders' operators never apply to two plain C++ values.

Macros

#define MORPH_UI_AUTHOR_CAT_(a, b)
 Concatenates two tokens after expanding them.
#define MORPH_UI_AUTHOR_CAT(a, b)
 Concatenates two tokens after expanding them.
#define MORPH_REGISTER_SCREEN(SCREEN)
 Enrols a screen into the process's registry at static initialisation. A refusal is kept in screenRegistry().refusals(), which a server's test asserts is empty.

Typedefs

template<typename T>
using morph::ui::author::detail::UnwrappedT = Unwrapped<T>::type
 The type with one std::optional removed.
template<typename L>
using morph::ui::author::detail::LiteralT = LiteralOf<std::remove_cvref_t<L>>::type
 The value type a constant stands for.
template<typename L, typename R>
using morph::ui::author::detail::ArithmeticT = std::conditional_t<IsHandle<L>::value, typename ValueOf<L>::type, typename ValueOf<R>::type>
 The value type of an arithmetic expression: the left handle's, else the right's.
using morph::ui::author::AnyHandle = Handle<Any>
 An expression whose value type is not tracked: the type of every node property.
using morph::ui::author::RowScope = DeclScope
 The scope a row of a table or forEach declares its own state, queries and model aliases on.
using morph::ui::author::ScopeBuilder = std::function<Nodes(DeclScope&)>
 A scope's builder: declares on the scope and returns the nodes that read it.

Enumerations

enum class  morph::ui::author::Instance : std::uint8_t { Default , Private , Shared }
 How a model alias binds when no key expression is given (spec 5 §5). More...
enum class  morph::ui::author::Mode : std::uint8_t { Exclusive , Serial , Latest , Parallel }
 What a mutation run does while another is in flight. More...
enum class  morph::ui::author::Source : std::uint8_t { Any , User }
 Which changes a watch reacts to. More...
enum class  morph::ui::author::ShowErrors : std::uint8_t { Touched , Submit , Always }
 When a scope's element errors show (spec 5 §6). More...
enum class  morph::ui::author::PropType : std::uint8_t {
  String , Bool , Int , Exact ,
  Number , Json
}
 A prop type of a component: how a value crosses into QML (spec 5 §10). More...
enum class  morph::ui::author::OpenAs : std::uint8_t {
  Default , Tab , Dialog , Drawer ,
  Window
}
 How navigate opens a screen. More...
enum class  morph::ui::author::Role : std::uint8_t { Info , Success , Warning , Error }
 The role of a notification. More...
enum class  morph::ui::author::Commit : std::uint8_t { Change , Blur , Enter }
 When a text input commits its draft. More...
enum class  morph::ui::author::OnStale : std::uint8_t { Clear , Keep }
 What a select does with a selection its new options no longer hold. More...
enum class  morph::ui::author::Selection : std::uint8_t { None , Single , Multiple }
 How a table's selection works. More...
enum class  morph::ui::author::TableMode : std::uint8_t { Client , Server }
 Where a model-backed table sorts, filters and pages. More...

Functions

template<typename Result>
std::optional< std::vector< std::string > > morph::ui::author::detail::listFields ()
 The members of an action result that hold a list, when the result is a record.
std::optional< std::vector< ActionEffect > > morph::ui::author::detail::effectsInfo (std::string_view actionId)
 The catalog's form of an action's declared effects.
std::vector< ActionRecordInfo > morph::ui::author::detail::recordsInfo (std::string_view actionId)
 The catalog's form of the records an action's result holds.
template<typename From, typename To>
consteval bool morph::ui::author::detail::scalarAssignable ()
 Whether a scalar value of one type can stand where a value of another is expected.
template<typename From, typename To>
consteval bool morph::ui::author::detail::assignable ()
 Whether an expression of one value type can stand where a value of another is expected. null propagates through every expression, so an optional value may stand for a required one.
template<typename L>
Value morph::ui::author::detail::scalarValue (L const &literal)
 A C++ scalar as a document value.
template<typename L>
Value morph::ui::author::detail::literalValue (L const &literal)
 A C++ constant as a document value.
void morph::ui::author::detail::put (Json &object, std::string_view key, Json value)
 Sets a member of a JSON object, replacing one of the same name and keeping the order of the others.
void morph::ui::author::detail::putSection (Json &object, std::string_view key, Json const &section)
 Sets a member of a JSON object to another object, unless that one is empty.
std::size_t morph::ui::author::detail::members (Json const &object)
 How many members a JSON object has.
Json morph::ui::author::detail::constant (Value const &value)
 A document value as a constant expression: a scalar as itself, a list, record, decimal or quantity wrapped in {"lit": v}.
Json morph::ui::author::detail::single (std::string_view key, Json value)
 A one-key JSON object.
std::string morph::ui::author::detail::alignName (Align align)
 An alignment's document name.
std::string morph::ui::author::detail::justifyName (Justify justify)
 A justification's document name.
std::optional< Json > morph::ui::author::detail::literalOf (Json const &expression)
 The value of a constant expression, as constant writes one.
Json morph::ui::author::detail::call (std::string_view function, std::vector< Json > args)
 A call of an expr/1 library function.
std::optional< std::pair< std::string, std::string > > morph::ui::author::detail::namedRead (Json const &json)
 The dotted path a named read reads, when the expression is one.
Json morph::ui::author::detail::fieldOf (Json const &json, std::string_view field)
 A field read below a named read.
std::string morph::ui::author::detail::refPath (Json const &json, std::string_view what)
 The name a named read reads.
template<typename Class, typename Member>
std::string morph::ui::author::detail::memberName (Member Class::*member)
 The reflected name of a data member, found by its address in a value-initialised object of its class.
template<typename X>
Json morph::ui::author::detail::operandJson (X const &operand)
 An operand's JSON.
template<typename Result, typename L, typename R>
Handle< Result > morph::ui::author::detail::binary (std::string_view function, L const &lhs, R const &rhs)
 A two-operand call.
template<typename L, typename R>
requires detail::HandleOperands<L, R>
Handle< detail::ArithmeticT< L, R > > morph::ui::author::operator+ (L const &lhs, R const &rhs)
 add.
template<typename L, typename R>
requires detail::HandleOperands<L, R>
Handle< detail::ArithmeticT< L, R > > morph::ui::author::operator- (L const &lhs, R const &rhs)
 sub.
template<typename L, typename R>
requires detail::HandleOperands<L, R>
Handle< detail::ArithmeticT< L, R > > morph::ui::author::operator* (L const &lhs, R const &rhs)
 mul.
template<typename L, typename R>
requires detail::HandleOperands<L, R>
Handle< detail::ArithmeticT< L, R > > morph::ui::author::operator/ (L const &lhs, R const &rhs)
 div.
template<typename L, typename R>
requires detail::HandleOperands<L, R>
Handle< bool > morph::ui::author::operator< (L const &lhs, R const &rhs)
 lt.
template<typename L, typename R>
requires detail::HandleOperands<L, R>
Handle< bool > morph::ui::author::operator<= (L const &lhs, R const &rhs)
 le.
template<typename L, typename R>
requires detail::HandleOperands<L, R>
Handle< bool > morph::ui::author::operator> (L const &lhs, R const &rhs)
 gt.
template<typename L, typename R>
requires detail::HandleOperands<L, R>
Handle< bool > morph::ui::author::operator>= (L const &lhs, R const &rhs)
 ge.
template<typename L, typename R>
requires detail::HandleOperands<L, R>
Handle< bool > morph::ui::author::operator&& (L const &lhs, R const &rhs)
 and, with Kleene's three-valued logic. Both operands are written: a document has no short circuit.
template<typename L, typename R>
requires detail::HandleOperands<L, R>
Handle< bool > morph::ui::author::operator|| (L const &lhs, R const &rhs)
 or, with Kleene's three-valued logic.
template<typename T>
Handle< bool > morph::ui::author::operator! (Handle< T > const &operand)
 not.
template<typename T>
Handle< T > morph::ui::author::operator- (Handle< T > const &operand)
 neg.
template<typename L, typename R>
requires detail::HandleOperands<L, R>
Handle< bool > morph::ui::author::eq (L const &lhs, R const &rhs)
 eq: equality of magnitude. A function, not ==: an == that returns an expression rather than a bool breaks the comparisons C++ rewrites from it.
template<typename L, typename R>
requires detail::HandleOperands<L, R>
Handle< bool > morph::ui::author::ne (L const &lhs, R const &rhs)
 ne.
template<typename R = Any>
Handle< R > morph::ui::author::call (std::string_view function, std::vector< AnyHandle > const &args)
 A call of any expr/1 library function, for the functions without a builder of their own.
Handle< bool > morph::ui::author::engaged (AnyHandle const &value)
 engaged: whether a value is not null.
AnyHandle morph::ui::author::coalesce (std::vector< AnyHandle > const &values)
 coalesce: the first value that is not null.
Handle< std::string > morph::ui::author::concat (std::vector< AnyHandle > const &parts)
 concat.
Handle< std::string > morph::ui::author::format (AnyHandle const &pattern, std::vector< AnyHandle > args)
 format: a template with {0}, {1}, … placeholders.
AnyHandle morph::ui::author::concatLists (std::vector< AnyHandle > const &lists)
 concatLists: the lists, one after another; null while any of them is null.
template<typename T>
Handle< std::vector< T > > morph::ui::author::concatLists (std::vector< Handle< std::vector< T > > > const &lists)
 concatLists of lists of one element type.
Handle< std::int64_t > morph::ui::author::count (AnyHandle const &list)
 count: a list's length.
AnyHandle morph::ui::author::sum (AnyHandle const &list)
 sum of a list of numbers.
Handle< bool > morph::ui::author::includes (AnyHandle const &list, AnyHandle const &value)
 includes: whether a list holds a value.
Handle< bool > morph::ui::author::isEmpty (AnyHandle const &value)
 isEmpty: an empty string or list.
AnyHandle morph::ui::author::round (AnyHandle const &value, std::int64_t places)
 round(x, dp), half to even.
AnyHandle morph::ui::author::parseDecimal (AnyHandle const &text)
 parseDecimal(text): typed text, in the client's locale, as an exact decimal; null while it does not spell one.
AnyHandle morph::ui::author::parseDecimal (AnyHandle const &text, std::int64_t places)
 parseDecimal(text, dp): typed text as an exact decimal at places; null while it does not spell one, or when it has more fraction digits than places.
Handle< std::string > morph::ui::author::quantity (AnyHandle const &value)
 quantity(x): a quantity for display in its own unit.
Handle< std::string > morph::ui::author::quantity (AnyHandle const &value, AnyHandle const &unit)
 quantity(x, unit): a quantity for display in another unit.
Handle< std::string > morph::ui::author::t (std::string const &key, std::string const &fallback, std::vector< std::pair< std::string, AnyHandle > > const &args={})
 t(key, fallback, args): a translated MessageFormat 2 message.
template<typename T>
Handle< T > morph::ui::author::cond (Handle< bool > const &condition, Handle< T > const &then, Handle< T > const &otherwise)
 {"if": [c, a, b]}: a choice between two values.
AnyHandle morph::ui::author::obj (std::vector< std::pair< std::string, AnyHandle > > const &fields)
 {"obj": {...}}: a record built from expressions.
AnyHandle morph::ui::author::content ()
 The content sizing, "content": as much as the content needs.
AnyHandle morph::ui::author::fixed (int units)
 A fixed sizing, {"lit": {"fixed": units}}.
AnyHandle morph::ui::author::stretch (int weight=1)
 A stretch sizing, {"lit": {"stretch": weight}}: a share of the leftover space.
AnyHandle morph::ui::author::list (std::vector< AnyHandle > const &items)
 {"list": [...]}: a list built from expressions.
template<typename T = Any>
Handle< T > morph::ui::author::ref (std::string const &path)
 A named read, {"ref": "name.path"}: a param, state, let, query value, element value or bound name.
template<typename T = Any>
Handle< T > morph::ui::author::row ()
 The innermost row, {"row": ""}.
template<typename Class, typename Member>
Handle< Member > morph::ui::author::row (Member Class::*member)
 A field of the innermost row, by member pointer.
AnyHandle morph::ui::author::row (std::string const &path)
 A field of the innermost row, by name.
template<typename E = Any>
AnyHandle morph::ui::author::map (AnyHandle const &source, std::string const &name, std::type_identity_t< std::function< AnyHandle(Handle< E > const &)> > const &body)
 A comprehension over a list, {"map": e, "as": "x", "to": e}.
template<typename E = Any>
AnyHandle morph::ui::author::filter (AnyHandle const &source, std::string const &name, std::type_identity_t< std::function< Handle< bool >(Handle< E > const &)> > const &where)
 A filter over a list, {"filter": e, "as": "x", "where": e}.
template<typename Class>
AnyHandle morph::ui::author::filter (AnyHandle const &source, bool Class::*member)
 The elements of a list whose boolean member is true.
AnyHandle morph::ui::author::env (std::string const &name)
 A client environment value, {"env": name}: widthClass, locale, platform, online, backend.
AnyHandle morph::ui::author::session (std::string const &name)
 A session attribute, {"session": name}.
AnyHandle morph::ui::author::hostValue (std::string const &name)
 A value the application registered with the client, {"host": name}.
AnyHandle morph::ui::author::prop (std::string const &name)
 A prop of a component, inside the component's fallback.
AnyHandle morph::ui::author::event ()
 The payload of the event whose command list runs.
Element morph::ui::author::element (std::string name)
 An element of the view.
template<typename T>
std::string morph::ui::author::detail::typeName ()
 A document type name for a C++ type, as params and state declare it.
std::string morph::ui::author::showErrorsName (ShowErrors when)
 The spelling of a ShowErrors.
void morph::ui::author::detail::putPresent (Json &json, char const *key, AnyHandle const &value)
 An expression key of a part, left out when absent.
Json morph::ui::author::detail::headBadge (HeadBadgeOptions const &badge)
 A headBadge part's JSON.
Json morph::ui::author::detail::actionButton (ActionButtonOptions const &action)
 An actionButton part's JSON.
void morph::ui::author::detail::append (Json &json, char const *key, Json item)
 Appends item to the array at key of json, making the array on first use.
Command morph::ui::author::detail::command (std::string_view key, Json value)
 A command with one key.
Command morph::ui::author::set (AnyHandle const &target, AnyHandle const &value)
 set: writes a state, an input's value or an app name.
Command morph::ui::author::reset (AnyHandle const &target)
 reset: a state to its init, or a dialog's scope.
template<typename Action>
Command morph::ui::author::run (MutationHandle< Action > const &mutation, Body< Action > const &body={}, RunOptions const &options={})
 run: runs a mutation.
Command morph::ui::author::refetch (QueryRef const &query)
 refetch: refetches a query.
Command morph::ui::author::open (Element const &dialog)
 open: opens a dialog or drawer.
Command morph::ui::author::close (Element const &dialog)
 close: closes a dialog or drawer.
Command morph::ui::author::close (Self current)
 close of the dialog or drawer the command list runs in.
Command morph::ui::author::focus (Element const &target)
 focus: moves the keyboard focus to an element.
Command morph::ui::author::detail::navigation (Json json, NavigateOptions const &options)
 Writes navigate's options.
Command morph::ui::author::navigate (std::string const &screenId, NavigateOptions const &options={})
 navigate to a screen by id.
Command morph::ui::author::navigateRoute (AnyHandle const &route, NavigateOptions const &options={})
 navigate to a route.
Command morph::ui::author::returnWith (AnyHandle const &value)
 return: a dialog screen's result.
Command morph::ui::author::host (std::string const &name, AnyHandle const &args={})
 host: a command the application registered with the client.
Command morph::ui::author::switchBackend (std::string const &name)
 switchBackend: switches to a named backend.
Command morph::ui::author::resetPrefs (Point const &point)
 resetPrefs: resets a customization point to the document's default.
Command morph::ui::author::resetAllPrefs ()
 resetPrefs of every point of the screen.
Command morph::ui::author::setLocale (std::string const &locale)
 setLocale: switches the client's locale.
Command morph::ui::author::notify (AnyHandle const &message, Role role=Role::Info)
 notify: shows a notification.
Command morph::ui::author::seq (Commands const &steps)
 seq: steps in order; a failed step stops the rest.
Command morph::ui::author::all (Commands const &steps)
 all: steps started together.
Command morph::ui::author::ifThen (AnyHandle const &condition, Commands const &then, Commands const &otherwise={})
 if: commands chosen by a condition.
Command morph::ui::author::cancelClose ()
 cancelClose: keeps a screen open, inside onClose.
Command morph::ui::author::retry ()
 retry: refetches every failed query of a boundary, inside its error.
Command morph::ui::author::signIn (MutationRef const &mutation)
 signIn: runs a sign-in mutation and installs the token it returns.
Command morph::ui::author::signOut ()
 signOut.
Command morph::ui::author::upload (AnyHandle const &file, MutationRef const &mutation, UploadOptions const &options={})
 upload: sends a file through a mutation (files/1).
Command morph::ui::author::downloadToFile (AnyHandle const &file, AnyHandle const &name={})
 download to a file the user picks.
Command morph::ui::author::downloadToPreview (AnyHandle const &file, AnyHandle const &state)
 download to a preview URL, bound to a state.
Node morph::ui::author::text (TextOptions const &options)
 A text node.
Node morph::ui::author::button (ButtonOptions const &options)
 A button node.
Node morph::ui::author::textInput (TextInputOptions const &options)
 A textInput node.
Node morph::ui::author::checkbox (CheckboxOptions const &options)
 A checkbox node.
Node morph::ui::author::select (SelectOptions const &options)
 A select node.
Json morph::ui::author::detail::menuItem (MenuItem const &item)
 A menu item's JSON.
Node morph::ui::author::menu (std::vector< MenuItem > const &items)
 A menu node.
Node morph::ui::author::detail::stackNode (char const *kind, Nodes const &children, ContainerOptions const &options)
 A row or column with its options.
Node morph::ui::author::column (Nodes const &children, ContainerOptions const &options={})
 A column node.
Node morph::ui::author::row (Nodes const &children, ContainerOptions const &options={})
 A row node.
Node morph::ui::author::grid (Nodes const &children, ContainerOptions const &options={})
 A grid node.
Node morph::ui::author::spacer ()
 A spacer node.
Node morph::ui::author::panel (Nodes const &children, PanelOptions const &options={})
 A panel node.
Node morph::ui::author::scroll (Nodes const &children, AnyHandle const &axis={})
 A scroll node.
Node morph::ui::author::switchOn (AnyHandle const &value, std::vector< Case > const &cases, Nodes const &fallback={})
 A switch node: shows the first case whose when equals its value.
Node morph::ui::author::tabs (std::vector< Tab > const &tabs)
 A tabs node.
Node morph::ui::author::detail::dialogNode (std::string_view kind, Element const &element, DialogOptions const &options, ScopeBuilder const &builder)
 A dialog or drawer.
Node morph::ui::author::dialog (Element const &element, Nodes const &children, DialogOptions const &options={})
 A dialog node, a scope of its own; open and close name it by its element.
Node morph::ui::author::dialog (Element const &element, DialogOptions const &options, ScopeBuilder const &builder)
 A dialog node that declares on its own scope.
Node morph::ui::author::drawer (Element const &element, Nodes const &children, DialogOptions const &options={})
 A drawer node, a scope of its own.
Node morph::ui::author::busy (AnyHandle const &active, AnyHandle const &label={})
 A busy node.
Node morph::ui::author::forEach (AnyHandle const &rows, ForEachOptions const &options, ScopeBuilder const &builder)
 A forEach node: its children once per row, each row a scope of its own.
std::vector< TableColumn > morph::ui::author::cells (std::vector< Node > const &cells)
 Columns from cells alone, without ids or labels.
Node morph::ui::author::detail::tableNode (NodeWriter &node, TableOptions const &options, DeclScope const &scope, std::vector< TableColumn > const &columns)
 Writes a table's options after its source.
Node morph::ui::author::table (AnyHandle const &rows, TableOptions const &options)
 A table over a list, with the columns in its options.
Node morph::ui::author::table (AnyHandle const &rows, TableOptions const &options, std::function< std::vector< TableColumn >(DeclScope &)> const &builder)
 A table over a list whose rows declare on their own scope.
template<typename Action, typename Model>
requires Runs<Model, Action>
Node morph::ui::author::dataTable (ModelHandle< Model > const &model, Body< Action > const &body, TableOptions const &options={})
 A table declared from a model's list action (spec 7): the client derives its columns from the row type and the table engine sorts, filters, selects and pages.
template<typename Action, typename Model>
requires Runs<Model, Action>
Node morph::ui::author::dataTable (ModelHandle< Model > const &model, TableOptions const &options={})
 A table declared from a model's list action that takes no parameters of its own.
Node morph::ui::author::dateTimeInput (AnyHandle const &value, AnyHandle const &label, Commands const &commit={})
 A dateTimeInput node.
Node morph::ui::author::dateTimeInput (DateTimeInputOptions const &options)
 A dateTimeInput node.
Node morph::ui::author::slider (SliderOptions const &options)
 A slider node.
Node morph::ui::author::filePicker (FilePickerOptions const &options)
 A filePicker node.
void morph::ui::author::detail::actionPart (NodeWriter &node, std::optional< ActionPart > const &action)
 Writes an action part.
Node morph::ui::author::banner (BannerOptions const &options)
 A banner node.
Node morph::ui::author::badge (AnyHandle const &text, AnyHandle const &tone={}, AnyHandle const &icon={})
 A badge node.
Node morph::ui::author::progress (AnyHandle const &value, AnyHandle const &label={})
 A progress node.
Node morph::ui::author::steps (AnyHandle const &items, AnyHandle const &current={})
 A steps node.
Node morph::ui::author::keyValue (AnyHandle const &items)
 A keyValue node.
Node morph::ui::author::emptyState (EmptyStateOptions const &options)
 An emptyState node.
Node morph::ui::author::splitter (Nodes const &children, AnyHandle const &orientation={}, AnyHandle const &sizes={})
 A splitter node.
Node morph::ui::author::collapsible (Nodes const &children, CollapsibleOptions const &options={})
 A collapsible node.
Node morph::ui::author::dropZone (Nodes const &children, DropZoneOptions const &options={})
 A dropZone node.
Node morph::ui::author::customize (Point const &point)
 A customize node: the editor of a customization point.
Node morph::ui::author::boundary (Nodes const &children, Nodes const &loading={}, Nodes const &error={})
 A boundary node: loading until its queries have values, error when one failed without one.
void morph::ui::author::detail::present (NodeWriter &node, FormPresentation const &presentation)
 Writes presentation's keys on node.
template<typename Action, typename Model>
requires Runs<Model, Action>
Node morph::ui::author::form (ModelHandle< Model > const &model, FormOptions< Action > const &options={})
 A form node: a schema form of the forms engine over an action (spec 2); each field takes its label from the schema or the overlay.
template<typename Action, typename Model>
requires Runs<Model, Action>
Node morph::ui::author::collection (ModelHandle< Model > const &model, FormPresentation const &presentation={})
 A collection node: the forms engine's list screen over an action.
template<typename Action, typename Model>
requires Runs<Model, Action>
Node morph::ui::author::wizard (ModelHandle< Model > const &model, FormPresentation const &presentation={})
 A wizard node: the forms engine's wizard over an action.
Node morph::ui::author::custom (ComponentRef const &component, CustomOptions const &options={})
 A custom node: a declared component with its props and events.
bool morph::ui::author::detail::names (DocNode const &node, std::string_view key)
 Whether a node has a property that names it: present, and not the constant "" or null.
bool morph::ui::author::detail::hasA11yName (DocNode const &node)
 Whether a node has an a11y.name that names it.
std::string morph::ui::author::detail::brokenRule (DocNode const &node)
 The accessibility rule a node breaks, if any.
std::optional< Refusal > morph::ui::author::detail::accessibilityOf (DocNode const &node, std::string const &document)
 The first accessibility rule a node or a node under it breaks.
std::optional< Refusal > morph::ui::author::detail::accessibilityOf (std::span< DocNodePtr const > nodes, std::string const &document)
 The first accessibility rule the nodes of a list break.
std::optional< Refusal > morph::ui::author::checkAccessibility (Document const &document)
 The accessibility rules of spec 5 §11, which registration runs after the load-time validation.
template<morph::detail::FixedString Id>
Screen morph::ui::author::screen (Screen::Builder builder)
 A screen with its id as a template argument, as spec 5 §11 writes it.
Screen morph::ui::author::screen (std::string screenId, Screen::Builder builder)
 A screen.
ScreenRegistry & morph::ui::author::screenRegistry () noexcept
 The process's screen registry, which MORPH_REGISTER_SCREEN enrols into.
template<std::invocable Make>
bool morph::ui::author::enrollScreen (Make const &make) noexcept
 Enrols a screen into the process's registry; what MORPH_REGISTER_SCREEN runs.

Variables

constexpr Self morph::ui::author::self {}
 The dialog or drawer a command list runs in.

Detailed Description

Server-side authoring of UI documents (spec 5 §11): typed builders that write a screen's JSON, and the registration that validates it once — loadDocument with the builders' catalog facts, then the accessibility rules.

The builders live in morph::ui::author, beside the view-tree builders of morph::ui that share their names; a screen's source writes namespace ui = morph::ui::author;. Specified in docs/spec/ui/author.md.

Definition in file author.hpp.

Macro Definition Documentation

◆ MORPH_UI_AUTHOR_CAT_

#define MORPH_UI_AUTHOR_CAT_ ( a,
b )
Value:
a##b

Concatenates two tokens after expanding them.

Definition at line 4701 of file author.hpp.

◆ MORPH_UI_AUTHOR_CAT

#define MORPH_UI_AUTHOR_CAT ( a,
b )
Value:
#define MORPH_UI_AUTHOR_CAT_(a, b)
Concatenates two tokens after expanding them.
Definition author.hpp:4701

Concatenates two tokens after expanding them.

Definition at line 4703 of file author.hpp.

◆ MORPH_REGISTER_SCREEN

#define MORPH_REGISTER_SCREEN ( SCREEN)
Value:
namespace { \
[[maybe_unused]] bool const MORPH_UI_AUTHOR_CAT(morphUiScreen_, \
__COUNTER__) = ::morph::ui::author::enrollScreen([] { \
return (SCREEN); \
}); \
}
bool enrollScreen(Make const &make) noexcept
Enrols a screen into the process's registry; what MORPH_REGISTER_SCREEN runs.
Definition author.hpp:4690
#define MORPH_UI_AUTHOR_CAT(a, b)
Concatenates two tokens after expanding them.
Definition author.hpp:4703

Enrols a screen into the process's registry at static initialisation. A refusal is kept in screenRegistry().refusals(), which a server's test asserts is empty.

Parameters
SCREENThe screen: an expression, such as a call of a function that returns it, or an object defined before the macro in the same translation unit.

Definition at line 4713 of file author.hpp.

Typedef Documentation

◆ UnwrappedT

template<typename T>
using morph::ui::author::detail::UnwrappedT = Unwrapped<T>::type

The type with one std::optional removed.

Template Parameters
TThe type.

Definition at line 299 of file author.hpp.

◆ LiteralT

template<typename L>
using morph::ui::author::detail::LiteralT = LiteralOf<std::remove_cvref_t<L>>::type

The value type a constant stands for.

Template Parameters
LThe C++ type of the constant.

Definition at line 398 of file author.hpp.

◆ ArithmeticT

template<typename L, typename R>
using morph::ui::author::detail::ArithmeticT = std::conditional_t<IsHandle<L>::value, typename ValueOf<L>::type, typename ValueOf<R>::type>

The value type of an arithmetic expression: the left handle's, else the right's.

Template Parameters
LThe left operand's C++ type.
RThe right operand's C++ type.

Definition at line 429 of file author.hpp.

◆ AnyHandle

using morph::ui::author::AnyHandle = Handle<Any>

An expression whose value type is not tracked: the type of every node property.

Definition at line 739 of file author.hpp.

◆ RowScope

using morph::ui::author::RowScope = DeclScope

The scope a row of a table or forEach declares its own state, queries and model aliases on.

Definition at line 2319 of file author.hpp.

◆ ScopeBuilder

using morph::ui::author::ScopeBuilder = std::function<Nodes(DeclScope&)>

A scope's builder: declares on the scope and returns the nodes that read it.

Definition at line 3467 of file author.hpp.

Enumeration Type Documentation

◆ Instance

enum class morph::ui::author::Instance : std::uint8_t
strong

How a model alias binds when no key expression is given (spec 5 §5).

Enumerator
Default 

shared when the catalog marks the model stateless, private otherwise.

Private 

An instance of the scope's own.

Shared 

The model's singleton.

Definition at line 1546 of file author.hpp.

◆ Mode

enum class morph::ui::author::Mode : std::uint8_t
strong

What a mutation run does while another is in flight.

Enumerator
Exclusive 

The run is refused (the default).

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 1624 of file author.hpp.

◆ Source

enum class morph::ui::author::Source : std::uint8_t
strong

Which changes a watch reacts to.

Enumerator
Any 

Every change.

User 

Only the user's own edits.

Definition at line 1718 of file author.hpp.

◆ ShowErrors

enum class morph::ui::author::ShowErrors : std::uint8_t
strong

When a scope's element errors show (spec 5 §6).

Enumerator
Touched 

Once the element has been touched.

Submit 

Once the form or dialog has been submitted.

Always 

At once.

Definition at line 2322 of file author.hpp.

◆ PropType

enum class morph::ui::author::PropType : std::uint8_t
strong

A prop type of a component: how a value crosses into QML (spec 5 §10).

Enumerator
String 

Text.

Bool 

A boolean.

Int 

An integer, as text.

Exact 

An exact decimal or quantity, as text.

Number 

A double, for charts.

Json 

Structured data, exact values inside it as text.

Definition at line 2337 of file author.hpp.

◆ OpenAs

enum class morph::ui::author::OpenAs : std::uint8_t
strong

How navigate opens a screen.

Enumerator
Default 

The host's choice.

Tab 

A tab.

Dialog 

A dialog, which returns through onResult or onCancel.

Drawer 

A drawer.

Window 

A window.

Definition at line 2800 of file author.hpp.

◆ Role

enum class morph::ui::author::Role : std::uint8_t
strong

The role of a notification.

Enumerator
Info 

Information.

Success 

A success.

Warning 

A warning.

Error 

An error.

Definition at line 2899 of file author.hpp.

◆ Commit

enum class morph::ui::author::Commit : std::uint8_t
strong

When a text input commits its draft.

Enumerator
Change 

On every edit.

Blur 

On loss of focus.

Enter 

On Enter.

Definition at line 3178 of file author.hpp.

◆ OnStale

enum class morph::ui::author::OnStale : std::uint8_t
strong

What a select does with a selection its new options no longer hold.

Enumerator
Clear 

Clears it.

Keep 

Keeps it.

Definition at line 3252 of file author.hpp.

◆ Selection

enum class morph::ui::author::Selection : std::uint8_t
strong

How a table's selection works.

Enumerator
None 

No selection.

Single 

One row.

Multiple 

Several rows.

Definition at line 3696 of file author.hpp.

◆ TableMode

enum class morph::ui::author::TableMode : std::uint8_t
strong

Where a model-backed table sorts, filters and pages.

Enumerator
Client 

In the client, over every row.

Server 

In the server, through the action's table query.

Definition at line 3703 of file author.hpp.

Function Documentation

◆ listFields()

template<typename Result>
std::optional< std::vector< std::string > > morph::ui::author::detail::listFields ( )
nodiscard

The members of an action result that hold a list, when the result is a record.

Template Parameters
ResultThe action's result type.
Returns
The names glaze writes them under, or std::nullopt when glaze does not write Result as a record.

Definition at line 102 of file author.hpp.

◆ effectsInfo()

std::optional< std::vector< ActionEffect > > morph::ui::author::detail::effectsInfo ( std::string_view actionId)
inlinenodiscard

The catalog's form of an action's declared effects.

Parameters
actionIdThe action's id.
Returns
Its effects, or std::nullopt when it declared none: the action reads.
Exceptions
morph::model::EffectsRegistrationErrorwhen the registered records and effects are invalid.

Definition at line 126 of file author.hpp.

◆ recordsInfo()

std::vector< ActionRecordInfo > morph::ui::author::detail::recordsInfo ( std::string_view actionId)
inlinenodiscard

The catalog's form of the records an action's result holds.

Parameters
actionIdThe action's id.
Returns
One entry per record; empty when the result holds none.
Exceptions
morph::model::EffectsRegistrationErrorwhen the registered records and effects are invalid.

Definition at line 169 of file author.hpp.

◆ scalarAssignable()

template<typename From, typename To>
bool morph::ui::author::detail::scalarAssignable ( )
nodiscardconsteval

Whether a scalar value of one type can stand where a value of another is expected.

Template Parameters
FromThe value's type, without std::optional.
ToThe expected type, without std::optional.
Returns
True for Any on either side, the same type, or a conversion between them.

Definition at line 327 of file author.hpp.

◆ assignable()

template<typename From, typename To>
bool morph::ui::author::detail::assignable ( )
nodiscardconsteval

Whether an expression of one value type can stand where a value of another is expected. null propagates through every expression, so an optional value may stand for a required one.

Template Parameters
FromThe expression's value type.
ToThe expected value type.
Returns
Whether it can.

Definition at line 341 of file author.hpp.

◆ scalarValue()

template<typename L>
Value morph::ui::author::detail::scalarValue ( L const & literal)
nodiscard

A C++ scalar as a document value.

Template Parameters
LThe scalar's type.
Parameters
literalThe scalar.
Returns
The value.

Definition at line 436 of file author.hpp.

◆ literalValue()

template<typename L>
Value morph::ui::author::detail::literalValue ( L const & literal)
nodiscard

A C++ constant as a document value.

Template Parameters
LThe constant's type.
Parameters
literalThe constant.
Returns
The value.

Definition at line 454 of file author.hpp.

◆ put()

void morph::ui::author::detail::put ( Json & object,
std::string_view key,
Json value )
inline

Sets a member of a JSON object, replacing one of the same name and keeping the order of the others.

Parameters
objectThe object.
keyThe member's name.
valueThe member's value.

Definition at line 473 of file author.hpp.

◆ putSection()

void morph::ui::author::detail::putSection ( Json & object,
std::string_view key,
Json const & section )
inline

Sets a member of a JSON object to another object, unless that one is empty.

Parameters
objectThe object.
keyThe member's name.
sectionThe value; an empty object is left out.

Definition at line 481 of file author.hpp.

◆ members()

std::size_t morph::ui::author::detail::members ( Json const & object)
inlinenodiscard

How many members a JSON object has.

Parameters
objectThe object.
Returns
The count.

Definition at line 490 of file author.hpp.

◆ constant()

Json morph::ui::author::detail::constant ( Value const & value)
inlinenodiscard

A document value as a constant expression: a scalar as itself, a list, record, decimal or quantity wrapped in {"lit": v}.

Parameters
valueThe value.
Returns
The expression's JSON.

Definition at line 496 of file author.hpp.

◆ single()

Json morph::ui::author::detail::single ( std::string_view key,
Json value )
inlinenodiscard

A one-key JSON object.

Parameters
keyThe key.
valueThe value.
Returns
{key: value}.

Definition at line 510 of file author.hpp.

◆ alignName()

std::string morph::ui::author::detail::alignName ( Align align)
inlinenodiscard

An alignment's document name.

Parameters
alignThe alignment.
Returns
start, center, end or stretch.

Definition at line 519 of file author.hpp.

◆ justifyName()

std::string morph::ui::author::detail::justifyName ( Justify justify)
inlinenodiscard

A justification's document name.

Parameters
justifyThe justification.
Returns
start, center, end or between.

Definition at line 527 of file author.hpp.

◆ literalOf()

std::optional< Json > morph::ui::author::detail::literalOf ( Json const & expression)
inlinenodiscard

The value of a constant expression, as constant writes one.

Parameters
expressionThe expression's JSON.
Returns
A scalar as itself, the inside of {"lit": v}; nullopt for an expression that is not a constant.

Definition at line 535 of file author.hpp.

◆ call() [1/2]

Json morph::ui::author::detail::call ( std::string_view function,
std::vector< Json > args )
inlinenodiscard

A call of an expr/1 library function.

Parameters
functionThe function's name.
argsThe argument expressions.
Returns
{"fn": function, "args": [...]}.

Definition at line 553 of file author.hpp.

◆ namedRead()

std::optional< std::pair< std::string, std::string > > morph::ui::author::detail::namedRead ( Json const & json)
inlinenodiscard

The dotted path a named read reads, when the expression is one.

Parameters
jsonThe expression.
Returns
The form (ref or row) and its path, or nothing for any other expression.

Definition at line 564 of file author.hpp.

◆ fieldOf()

Json morph::ui::author::detail::fieldOf ( Json const & json,
std::string_view field )
inlinenodiscard

A field read below a named read.

Parameters
jsonThe named read.
fieldThe field.
Returns
The read of path.field.
Exceptions
AuthoringErrorwhen json is not a named read: expr/1 reads fields only below a name.

Definition at line 582 of file author.hpp.

◆ refPath()

std::string morph::ui::author::detail::refPath ( Json const & json,
std::string_view what )
inlinenodiscard

The name a named read reads.

Parameters
jsonThe expression.
whatWhat the name is for, for the error.
Returns
The ref path.
Exceptions
AuthoringErrorwhen json is not a ref.

Definition at line 603 of file author.hpp.

◆ memberName()

template<typename Class, typename Member>
std::string morph::ui::author::detail::memberName ( Member Class::* member)
nodiscard

The reflected name of a data member, found by its address in a value-initialised object of its class.

Template Parameters
ClassThe class; glaze reflects it.
MemberThe member's type.
Parameters
memberThe member.
Returns
The name the member has in the class's JSON.
Exceptions
AuthoringErrorwhen the member is not one glaze reflects.

Definition at line 618 of file author.hpp.

◆ operandJson()

template<typename X>
Json morph::ui::author::detail::operandJson ( X const & operand)
nodiscard

An operand's JSON.

Template Parameters
XThe operand's C++ type.
Parameters
operandThe operand.
Returns
The JSON.

Definition at line 748 of file author.hpp.

◆ binary()

template<typename Result, typename L, typename R>
Handle< Result > morph::ui::author::detail::binary ( std::string_view function,
L const & lhs,
R const & rhs )
nodiscard

A two-operand call.

Template Parameters
ResultThe result's value type.
LThe left operand's C++ type.
RThe right operand's C++ type.
Parameters
functionThe library function.
lhsThe left operand.
rhsThe right operand.
Returns
The call.

Definition at line 765 of file author.hpp.

◆ operator+()

template<typename L, typename R>
requires detail::HandleOperands<L, R>
Handle< detail::ArithmeticT< L, R > > morph::ui::author::operator+ ( L const & lhs,
R const & rhs )
nodiscard

add.

Template Parameters
LThe left operand's C++ type.
RThe right operand's C++ type.
Parameters
lhsThe left operand.
rhsThe right operand.
Returns
The sum.

Definition at line 779 of file author.hpp.

◆ operator-() [1/2]

template<typename L, typename R>
requires detail::HandleOperands<L, R>
Handle< detail::ArithmeticT< L, R > > morph::ui::author::operator- ( L const & lhs,
R const & rhs )
nodiscard

sub.

Template Parameters
LThe left operand's C++ type.
RThe right operand's C++ type.
Parameters
lhsThe left operand.
rhsThe right operand.
Returns
The difference.

Definition at line 791 of file author.hpp.

◆ operator*()

template<typename L, typename R>
requires detail::HandleOperands<L, R>
Handle< detail::ArithmeticT< L, R > > morph::ui::author::operator* ( L const & lhs,
R const & rhs )
nodiscard

mul.

Template Parameters
LThe left operand's C++ type.
RThe right operand's C++ type.
Parameters
lhsThe left operand.
rhsThe right operand.
Returns
The product.

Definition at line 803 of file author.hpp.

◆ operator/()

template<typename L, typename R>
requires detail::HandleOperands<L, R>
Handle< detail::ArithmeticT< L, R > > morph::ui::author::operator/ ( L const & lhs,
R const & rhs )
nodiscard

div.

Template Parameters
LThe left operand's C++ type.
RThe right operand's C++ type.
Parameters
lhsThe left operand.
rhsThe right operand.
Returns
The exact quotient.

Definition at line 815 of file author.hpp.

◆ operator<()

template<typename L, typename R>
requires detail::HandleOperands<L, R>
Handle< bool > morph::ui::author::operator< ( L const & lhs,
R const & rhs )
nodiscard

lt.

Template Parameters
LThe left operand's C++ type.
RThe right operand's C++ type.
Parameters
lhsThe left operand.
rhsThe right operand.
Returns
Whether the left is less.

Definition at line 815 of file author.hpp.

◆ operator<=()

template<typename L, typename R>
requires detail::HandleOperands<L, R>
Handle< bool > morph::ui::author::operator<= ( L const & lhs,
R const & rhs )
nodiscard

le.

Template Parameters
LThe left operand's C++ type.
RThe right operand's C++ type.
Parameters
lhsThe left operand.
rhsThe right operand.
Returns
Whether the left is less or equal.

Definition at line 815 of file author.hpp.

◆ operator>()

template<typename L, typename R>
requires detail::HandleOperands<L, R>
Handle< bool > morph::ui::author::operator> ( L const & lhs,
R const & rhs )
nodiscard

gt.

Template Parameters
LThe left operand's C++ type.
RThe right operand's C++ type.
Parameters
lhsThe left operand.
rhsThe right operand.
Returns
Whether the left is greater.

Definition at line 851 of file author.hpp.

◆ operator>=()

template<typename L, typename R>
requires detail::HandleOperands<L, R>
Handle< bool > morph::ui::author::operator>= ( L const & lhs,
R const & rhs )
nodiscard

ge.

Template Parameters
LThe left operand's C++ type.
RThe right operand's C++ type.
Parameters
lhsThe left operand.
rhsThe right operand.
Returns
Whether the left is greater or equal.

Definition at line 863 of file author.hpp.

◆ operator&&()

template<typename L, typename R>
requires detail::HandleOperands<L, R>
Handle< bool > morph::ui::author::operator&& ( L const & lhs,
R const & rhs )
nodiscard

and, with Kleene's three-valued logic. Both operands are written: a document has no short circuit.

Template Parameters
LThe left operand's C++ type.
RThe right operand's C++ type.
Parameters
lhsThe left operand.
rhsThe right operand.
Returns
The conjunction.

Definition at line 875 of file author.hpp.

◆ operator||()

template<typename L, typename R>
requires detail::HandleOperands<L, R>
Handle< bool > morph::ui::author::operator|| ( L const & lhs,
R const & rhs )
nodiscard

or, with Kleene's three-valued logic.

Template Parameters
LThe left operand's C++ type.
RThe right operand's C++ type.
Parameters
lhsThe left operand.
rhsThe right operand.
Returns
The disjunction.

Definition at line 887 of file author.hpp.

◆ operator!()

template<typename T>
Handle< bool > morph::ui::author::operator! ( Handle< T > const & operand)
nodiscard

not.

Template Parameters
TThe operand's value type.
Parameters
operandThe operand.
Returns
The negation.

Definition at line 896 of file author.hpp.

◆ operator-() [2/2]

template<typename T>
Handle< T > morph::ui::author::operator- ( Handle< T > const & operand)
nodiscard

neg.

Template Parameters
TThe operand's value type.
Parameters
operandThe operand.
Returns
The negated number.

Definition at line 905 of file author.hpp.

◆ eq()

template<typename L, typename R>
requires detail::HandleOperands<L, R>
Handle< bool > morph::ui::author::eq ( L const & lhs,
R const & rhs )
nodiscard

eq: equality of magnitude. A function, not ==: an == that returns an expression rather than a bool breaks the comparisons C++ rewrites from it.

Template Parameters
LThe left operand's C++ type.
RThe right operand's C++ type.
Parameters
lhsThe left operand.
rhsThe right operand.
Returns
Whether they are equal.

Definition at line 918 of file author.hpp.

◆ ne()

template<typename L, typename R>
requires detail::HandleOperands<L, R>
Handle< bool > morph::ui::author::ne ( L const & lhs,
R const & rhs )
nodiscard

ne.

Template Parameters
LThe left operand's C++ type.
RThe right operand's C++ type.
Parameters
lhsThe left operand.
rhsThe right operand.
Returns
Whether they differ.

Definition at line 930 of file author.hpp.

◆ call() [2/2]

template<typename R = Any>
Handle< R > morph::ui::author::call ( std::string_view function,
std::vector< AnyHandle > const & args )
nodiscard

A call of any expr/1 library function, for the functions without a builder of their own.

Template Parameters
RThe result's value type.
Parameters
functionThe function's name.
argsThe arguments.
Returns
The call.

Definition at line 940 of file author.hpp.

◆ engaged()

Handle< bool > morph::ui::author::engaged ( AnyHandle const & value)
inlinenodiscard

engaged: whether a value is not null.

Parameters
valueThe value.
Returns
The test.

Definition at line 952 of file author.hpp.

◆ coalesce()

AnyHandle morph::ui::author::coalesce ( std::vector< AnyHandle > const & values)
inlinenodiscard

coalesce: the first value that is not null.

Parameters
valuesThe candidates, in order.
Returns
The call.

Definition at line 957 of file author.hpp.

◆ concat()

Handle< std::string > morph::ui::author::concat ( std::vector< AnyHandle > const & parts)
inlinenodiscard

concat.

Parameters
partsThe strings.
Returns
The joined string.

Definition at line 962 of file author.hpp.

◆ format()

Handle< std::string > morph::ui::author::format ( AnyHandle const & pattern,
std::vector< AnyHandle > args )
inlinenodiscard

format: a template with {0}, {1}, … placeholders.

Parameters
patternThe template.
argsThe values for the placeholders.
Returns
The formatted string.

Definition at line 970 of file author.hpp.

◆ concatLists() [1/2]

AnyHandle morph::ui::author::concatLists ( std::vector< AnyHandle > const & lists)
inlinenodiscard

concatLists: the lists, one after another; null while any of them is null.

Parameters
listsThe lists, in order.
Returns
The joined list.

Definition at line 981 of file author.hpp.

◆ concatLists() [2/2]

template<typename T>
Handle< std::vector< T > > morph::ui::author::concatLists ( std::vector< Handle< std::vector< T > > > const & lists)
nodiscard

concatLists of lists of one element type.

Template Parameters
TThe element type.
Parameters
listsThe lists, in order.
Returns
The joined list.

Definition at line 988 of file author.hpp.

◆ count()

Handle< std::int64_t > morph::ui::author::count ( AnyHandle const & list)
inlinenodiscard

count: a list's length.

Parameters
listThe list.
Returns
The count.

Definition at line 1000 of file author.hpp.

◆ sum()

AnyHandle morph::ui::author::sum ( AnyHandle const & list)
inlinenodiscard

sum of a list of numbers.

Parameters
listThe list.
Returns
The exact sum.

Definition at line 1005 of file author.hpp.

◆ includes()

Handle< bool > morph::ui::author::includes ( AnyHandle const & list,
AnyHandle const & value )
inlinenodiscard

includes: whether a list holds a value.

Parameters
listThe list.
valueThe value.
Returns
The test.

Definition at line 1011 of file author.hpp.

◆ isEmpty()

Handle< bool > morph::ui::author::isEmpty ( AnyHandle const & value)
inlinenodiscard

isEmpty: an empty string or list.

Parameters
valueThe string or list.
Returns
The test.

Definition at line 1018 of file author.hpp.

◆ round()

AnyHandle morph::ui::author::round ( AnyHandle const & value,
std::int64_t places )
inlinenodiscard

round(x, dp), half to even.

Parameters
valueThe number.
placesThe places.
Returns
The rounded number.

Definition at line 1024 of file author.hpp.

◆ parseDecimal() [1/2]

AnyHandle morph::ui::author::parseDecimal ( AnyHandle const & text)
inlinenodiscard

parseDecimal(text): typed text, in the client's locale, as an exact decimal; null while it does not spell one.

Parameters
textThe text, typically a text input's event.
Returns
The decimal, at the places typed.

Definition at line 1032 of file author.hpp.

◆ parseDecimal() [2/2]

AnyHandle morph::ui::author::parseDecimal ( AnyHandle const & text,
std::int64_t places )
inlinenodiscard

parseDecimal(text, dp): typed text as an exact decimal at places; null while it does not spell one, or when it has more fraction digits than places.

Parameters
textThe text, typically a text input's event.
placesThe places, 0 to 18.
Returns
The decimal.

Definition at line 1039 of file author.hpp.

◆ quantity() [1/2]

Handle< std::string > morph::ui::author::quantity ( AnyHandle const & value)
inlinenodiscard

quantity(x): a quantity for display in its own unit.

Parameters
valueThe quantity.
Returns
The text.

Definition at line 1046 of file author.hpp.

◆ quantity() [2/2]

Handle< std::string > morph::ui::author::quantity ( AnyHandle const & value,
AnyHandle const & unit )
inlinenodiscard

quantity(x, unit): a quantity for display in another unit.

Parameters
valueThe quantity.
unitThe display unit.
Returns
The text.

Definition at line 1054 of file author.hpp.

◆ t()

Handle< std::string > morph::ui::author::t ( std::string const & key,
std::string const & fallback,
std::vector< std::pair< std::string, AnyHandle > > const & args = {} )
inlinenodiscard

t(key, fallback, args): a translated MessageFormat 2 message.

Parameters
keyThe catalogue key.
fallbackThe pattern shown when the catalogue has none.
argsThe named arguments.
Returns
The {"t": ...} form.

Definition at line 1063 of file author.hpp.

◆ cond()

template<typename T>
Handle< T > morph::ui::author::cond ( Handle< bool > const & condition,
Handle< T > const & then,
Handle< T > const & otherwise )
nodiscard

{"if": [c, a, b]}: a choice between two values.

Template Parameters
TThe value type of the branches.
Parameters
conditionThe condition.
thenThe value when it is true.
otherwiseThe value otherwise.
Returns
The choice.

Definition at line 1085 of file author.hpp.

◆ obj()

AnyHandle morph::ui::author::obj ( std::vector< std::pair< std::string, AnyHandle > > const & fields)
inlinenodiscard

{"obj": {...}}: a record built from expressions.

Parameters
fieldsThe fields, in order.
Returns
The record.

Definition at line 1094 of file author.hpp.

◆ content()

AnyHandle morph::ui::author::content ( )
inlinenodiscard

The content sizing, "content": as much as the content needs.

Returns
The sizing, a constant the loader checks.

Definition at line 1104 of file author.hpp.

◆ fixed()

AnyHandle morph::ui::author::fixed ( int units)
inlinenodiscard

A fixed sizing, {"lit": {"fixed": units}}.

Parameters
unitsThe size in backend units, 0 or more.
Returns
The sizing, a constant the loader checks.

Definition at line 1109 of file author.hpp.

◆ stretch()

AnyHandle morph::ui::author::stretch ( int weight = 1)
inlinenodiscard

A stretch sizing, {"lit": {"stretch": weight}}: a share of the leftover space.

Parameters
weightThe share's weight, 1 or more.
Returns
The sizing, a constant the loader checks.

Definition at line 1116 of file author.hpp.

◆ list()

AnyHandle morph::ui::author::list ( std::vector< AnyHandle > const & items)
inlinenodiscard

{"list": [...]}: a list built from expressions.

Parameters
itemsThe items.
Returns
The list.

Definition at line 1123 of file author.hpp.

◆ ref()

template<typename T = Any>
Handle< T > morph::ui::author::ref ( std::string const & path)
nodiscard

A named read, {"ref": "name.path"}: a param, state, let, query value, element value or bound name.

Template Parameters
TThe value type.
Parameters
pathThe name and path.
Returns
The read.

Definition at line 1137 of file author.hpp.

◆ row() [1/4]

template<typename T = Any>
Handle< T > morph::ui::author::row ( )
nodiscard

The innermost row, {"row": ""}.

Template Parameters
TThe row's type.
Returns
The read.

Definition at line 1145 of file author.hpp.

◆ row() [2/4]

template<typename Class, typename Member>
Handle< Member > morph::ui::author::row ( Member Class::* member)
nodiscard

A field of the innermost row, by member pointer.

Template Parameters
ClassThe row type.
MemberThe member's type.
Parameters
memberThe member.
Returns
The read.

Definition at line 1155 of file author.hpp.

◆ row() [3/4]

AnyHandle morph::ui::author::row ( std::string const & path)
inlinenodiscard

A field of the innermost row, by name.

Parameters
pathThe field or dotted path.
Returns
The read.

Definition at line 1162 of file author.hpp.

◆ map()

template<typename E = Any>
AnyHandle morph::ui::author::map ( AnyHandle const & source,
std::string const & name,
std::type_identity_t< std::function< AnyHandle(Handle< E > const &)> ,
const & body )
nodiscard

A comprehension over a list, {"map": e, "as": "x", "to": e}.

Template Parameters
EThe element type.
Parameters
sourceThe list.
nameThe element's name inside body.
bodyBuilds the mapped value from the element's handle.
Returns
The mapped list.

Definition at line 1171 of file author.hpp.

◆ filter() [1/2]

template<typename E = Any>
AnyHandle morph::ui::author::filter ( AnyHandle const & source,
std::string const & name,
std::type_identity_t< std::function< Handle< bool >(Handle< E > const &)> ,
const & where )
nodiscard

A filter over a list, {"filter": e, "as": "x", "where": e}.

Template Parameters
EThe element type.
Parameters
sourceThe list.
nameThe element's name inside where.
whereBuilds the condition from the element's handle.
Returns
The filtered list.

Definition at line 1187 of file author.hpp.

◆ filter() [2/2]

template<typename Class>
AnyHandle morph::ui::author::filter ( AnyHandle const & source,
bool Class::* member )
nodiscard

The elements of a list whose boolean member is true.

Template Parameters
ClassThe element type.
Parameters
sourceThe list.
memberThe member.
Returns
The filtered list.

Definition at line 1202 of file author.hpp.

◆ env()

AnyHandle morph::ui::author::env ( std::string const & name)
inlinenodiscard

A client environment value, {"env": name}: widthClass, locale, platform, online, backend.

Parameters
nameThe name.
Returns
The read.

Definition at line 1209 of file author.hpp.

◆ session()

AnyHandle morph::ui::author::session ( std::string const & name)
inlinenodiscard

A session attribute, {"session": name}.

Parameters
nameThe attribute.
Returns
The read.

Definition at line 1214 of file author.hpp.

◆ hostValue()

AnyHandle morph::ui::author::hostValue ( std::string const & name)
inlinenodiscard

A value the application registered with the client, {"host": name}.

Parameters
nameThe value's name.
Returns
The read; null on a client without it.

Definition at line 1221 of file author.hpp.

◆ prop()

AnyHandle morph::ui::author::prop ( std::string const & name)
inlinenodiscard

A prop of a component, inside the component's fallback.

Parameters
nameThe prop.
Returns
{"ref": "props.name"}.

Definition at line 1228 of file author.hpp.

◆ event()

AnyHandle morph::ui::author::event ( )
inlinenodiscard

The payload of the event whose command list runs.

Returns
{"ref": "event"}.

Definition at line 1232 of file author.hpp.

◆ element()

Element morph::ui::author::element ( std::string name)
inlinenodiscard

An element of the view.

Parameters
nameThe element's id.
Returns
The element.

Definition at line 1289 of file author.hpp.

◆ typeName()

template<typename T>
std::string morph::ui::author::detail::typeName ( )
nodiscard

A document type name for a C++ type, as params and state declare it.

Template Parameters
TThe C++ type.
Returns
bool, int, string, decimal, quantity, timestamp, list<T>, T?, or record for any other class.

Definition at line 2019 of file author.hpp.

◆ showErrorsName()

std::string morph::ui::author::showErrorsName ( ShowErrors when)
inlinenodiscard

The spelling of a ShowErrors.

Parameters
whenThe policy.
Returns
touched, submit or always.

Definition at line 2331 of file author.hpp.

◆ putPresent()

void morph::ui::author::detail::putPresent ( Json & json,
char const * key,
AnyHandle const & value )
inline

An expression key of a part, left out when absent.

Parameters
jsonThe part.
keyThe key.
valueThe expression.

Definition at line 2436 of file author.hpp.

◆ headBadge()

Json morph::ui::author::detail::headBadge ( HeadBadgeOptions const & badge)
inlinenodiscard

A headBadge part's JSON.

Parameters
badgeThe badge.
Returns
The JSON.

Definition at line 2445 of file author.hpp.

◆ actionButton()

Json morph::ui::author::detail::actionButton ( ActionButtonOptions const & action)
inlinenodiscard

An actionButton part's JSON.

Parameters
actionThe button.
Returns
The JSON.

Definition at line 2457 of file author.hpp.

◆ append()

void morph::ui::author::detail::append ( Json & json,
char const * key,
Json item )
inline

Appends item to the array at key of json, making the array on first use.

Parameters
jsonThe object.
keyThe key.
itemThe item.

Definition at line 2481 of file author.hpp.

◆ command()

Command morph::ui::author::detail::command ( std::string_view key,
Json value )
inlinenodiscard

A command with one key.

Parameters
keyThe command's key.
valueThe key's value.
Returns
The command.

Definition at line 2713 of file author.hpp.

◆ set()

Command morph::ui::author::set ( AnyHandle const & target,
AnyHandle const & value )
inlinenodiscard

set: writes a state, an input's value or an app name.

Parameters
targetThe state or element, as its read.
valueThe value.
Returns
The command.
Exceptions
AuthoringErrorwhen target is not a named read.

Definition at line 2724 of file author.hpp.

◆ reset()

Command morph::ui::author::reset ( AnyHandle const & target)
inlinenodiscard

reset: a state to its init, or a dialog's scope.

Parameters
targetThe state, as its read.
Returns
The command.
Exceptions
AuthoringErrorwhen target is not a named read.

Definition at line 2735 of file author.hpp.

◆ run()

template<typename Action>
Command morph::ui::author::run ( MutationHandle< Action > const & mutation,
Body< Action > const & body = {},
RunOptions const & options = {} )
nodiscard

run: runs a mutation.

Template Parameters
ActionThe mutation's action.
Parameters
mutationThe mutation.
bodyThe body; empty for the mutation's own.
optionseach and as.
Returns
The command.

Definition at line 2755 of file author.hpp.

◆ refetch()

Command morph::ui::author::refetch ( QueryRef const & query)
inlinenodiscard

refetch: refetches a query.

Parameters
queryThe query.
Returns
The command.

Definition at line 2774 of file author.hpp.

◆ open()

Command morph::ui::author::open ( Element const & dialog)
inlinenodiscard

open: opens a dialog or drawer.

Parameters
dialogThe dialog.
Returns
The command.

Definition at line 2779 of file author.hpp.

◆ close() [1/2]

Command morph::ui::author::close ( Element const & dialog)
inlinenodiscard

close: closes a dialog or drawer.

Parameters
dialogThe dialog.
Returns
The command.

Definition at line 2784 of file author.hpp.

◆ close() [2/2]

Command morph::ui::author::close ( Self current)
inlinenodiscard

close of the dialog or drawer the command list runs in.

Parameters
currentself.
Returns
The command.

Definition at line 2789 of file author.hpp.

◆ focus()

Command morph::ui::author::focus ( Element const & target)
inlinenodiscard

focus: moves the keyboard focus to an element.

Parameters
targetThe element.
Returns
The command.

Definition at line 2797 of file author.hpp.

◆ navigation()

Command morph::ui::author::detail::navigation ( Json json,
NavigateOptions const & options )
inlinenodiscard

Writes navigate's options.

Parameters
jsonThe command.
optionsThe options.
Returns
The command.

Definition at line 2826 of file author.hpp.

◆ navigate()

Command morph::ui::author::navigate ( std::string const & screenId,
NavigateOptions const & options = {} )
inlinenodiscard

navigate to a screen by id.

Parameters
screenIdThe screen.
optionsParams, how it opens, and what runs when it returns.
Returns
The command.

Definition at line 2849 of file author.hpp.

◆ navigateRoute()

Command morph::ui::author::navigateRoute ( AnyHandle const & route,
NavigateOptions const & options = {} )
inlinenodiscard

navigate to a route.

Parameters
routeThe route expression.
optionsParams, how it opens, and what runs when it returns.
Returns
The command.

Definition at line 2857 of file author.hpp.

◆ returnWith()

Command morph::ui::author::returnWith ( AnyHandle const & value)
inlinenodiscard

return: a dialog screen's result.

Parameters
valueThe value.
Returns
The command.

Definition at line 2864 of file author.hpp.

◆ host()

Command morph::ui::author::host ( std::string const & name,
AnyHandle const & args = {} )
inlinenodiscard

host: a command the application registered with the client.

Parameters
nameThe command.
argsIts arguments; absent for none.
Returns
The command.

Definition at line 2870 of file author.hpp.

◆ switchBackend()

Command morph::ui::author::switchBackend ( std::string const & name)
inlinenodiscard

switchBackend: switches to a named backend.

Parameters
nameThe backend.
Returns
The command.

Definition at line 2882 of file author.hpp.

◆ resetPrefs()

Command morph::ui::author::resetPrefs ( Point const & point)
inlinenodiscard

resetPrefs: resets a customization point to the document's default.

Parameters
pointThe point.
Returns
The command.

Definition at line 2887 of file author.hpp.

◆ resetAllPrefs()

Command morph::ui::author::resetAllPrefs ( )
inlinenodiscard

resetPrefs of every point of the screen.

Returns
The command.

Definition at line 2891 of file author.hpp.

◆ setLocale()

Command morph::ui::author::setLocale ( std::string const & locale)
inlinenodiscard

setLocale: switches the client's locale.

Parameters
localeThe locale, such as de.
Returns
The command.

Definition at line 2896 of file author.hpp.

◆ notify()

Command morph::ui::author::notify ( AnyHandle const & message,
Role role = Role::Info )
inlinenodiscard

notify: shows a notification.

Parameters
messageThe message.
roleIts role.
Returns
The command.

Definition at line 2910 of file author.hpp.

◆ seq()

Command morph::ui::author::seq ( Commands const & steps)
inlinenodiscard

seq: steps in order; a failed step stops the rest.

Parameters
stepsThe steps.
Returns
The command.

Definition at line 2923 of file author.hpp.

◆ all()

Command morph::ui::author::all ( Commands const & steps)
inlinenodiscard

all: steps started together.

Parameters
stepsThe steps.
Returns
The command.

Definition at line 2928 of file author.hpp.

◆ ifThen()

Command morph::ui::author::ifThen ( AnyHandle const & condition,
Commands const & then,
Commands const & otherwise = {} )
inlinenodiscard

if: commands chosen by a condition.

Parameters
conditionThe condition.
thenThe commands when it is true.
otherwiseThe commands otherwise; empty runs nothing.
Returns
The command.

Definition at line 2935 of file author.hpp.

◆ cancelClose()

Command morph::ui::author::cancelClose ( )
inlinenodiscard

cancelClose: keeps a screen open, inside onClose.

Returns
The command.

Definition at line 2945 of file author.hpp.

◆ retry()

Command morph::ui::author::retry ( )
inlinenodiscard

retry: refetches every failed query of a boundary, inside its error.

Returns
The command.

Definition at line 2949 of file author.hpp.

◆ signIn()

Command morph::ui::author::signIn ( MutationRef const & mutation)
inlinenodiscard

signIn: runs a sign-in mutation and installs the token it returns.

Parameters
mutationThe mutation.
Returns
The command.

Definition at line 2954 of file author.hpp.

◆ signOut()

Command morph::ui::author::signOut ( )
inlinenodiscard

signOut.

Returns
The command.

Definition at line 2960 of file author.hpp.

◆ upload()

Command morph::ui::author::upload ( AnyHandle const & file,
MutationRef const & mutation,
UploadOptions const & options = {} )
inlinenodiscard

upload: sends a file through a mutation (files/1).

Parameters
fileThe file reference.
mutationThe mutation.
optionsas and the transfer id.
Returns
The command.

Definition at line 2975 of file author.hpp.

◆ downloadToFile()

Command morph::ui::author::downloadToFile ( AnyHandle const & file,
AnyHandle const & name = {} )
inlinenodiscard

download to a file the user picks.

Parameters
fileThe file reference.
nameThe suggested name; absent for none.
Returns
The command.

Definition at line 2993 of file author.hpp.

◆ downloadToPreview()

Command morph::ui::author::downloadToPreview ( AnyHandle const & file,
AnyHandle const & state )
inlinenodiscard

download to a preview URL, bound to a state.

Parameters
fileThe file reference.
stateThe state the URL is written to, as its read.
Returns
The command.
Exceptions
AuthoringErrorwhen state is not a named read.

Definition at line 3008 of file author.hpp.

◆ text()

Node morph::ui::author::text ( TextOptions const & options)
inlinenodiscard

A text node.

Parameters
optionsThe text.
Returns
The node.

Definition at line 3126 of file author.hpp.

◆ button()

Node morph::ui::author::button ( ButtonOptions const & options)
inlinenodiscard

A button node.

Parameters
optionsThe button.
Returns
The node.

Definition at line 3156 of file author.hpp.

◆ textInput()

Node morph::ui::author::textInput ( TextInputOptions const & options)
inlinenodiscard

A textInput node.

Parameters
optionsThe input.
Returns
The node.

Definition at line 3210 of file author.hpp.

◆ checkbox()

Node morph::ui::author::checkbox ( CheckboxOptions const & options)
inlinenodiscard

A checkbox node.

Parameters
optionsThe checkbox.
Returns
The node.

Definition at line 3242 of file author.hpp.

◆ select()

Node morph::ui::author::select ( SelectOptions const & options)
inlinenodiscard

A select node.

Parameters
optionsThe select.
Returns
The node.

Definition at line 3278 of file author.hpp.

◆ menuItem()

Json morph::ui::author::detail::menuItem ( MenuItem const & item)
inlinenodiscard

A menu item's JSON.

Parameters
itemThe item.
Returns
The JSON.

Definition at line 3314 of file author.hpp.

◆ menu()

Node morph::ui::author::menu ( std::vector< MenuItem > const & items)
inlinenodiscard

A menu node.

Parameters
itemsThe items.
Returns
The node.

Definition at line 3347 of file author.hpp.

◆ stackNode()

Node morph::ui::author::detail::stackNode ( char const * kind,
Nodes const & children,
ContainerOptions const & options )
inlinenodiscard

A row or column with its options.

Parameters
kindrow or column.
childrenThe children.
optionsThe gap and the alignment.
Returns
The node.

Definition at line 3376 of file author.hpp.

◆ column()

Node morph::ui::author::column ( Nodes const & children,
ContainerOptions const & options = {} )
inlinenodiscard

A column node.

Parameters
childrenThe children.
optionsThe gap and the alignment.
Returns
The node.

Definition at line 3394 of file author.hpp.

◆ row() [4/4]

Node morph::ui::author::row ( Nodes const & children,
ContainerOptions const & options = {} )
inlinenodiscard

A row node.

Parameters
childrenThe children.
optionsThe gap and the alignment.
Returns
The node.

Definition at line 3402 of file author.hpp.

◆ grid()

Node morph::ui::author::grid ( Nodes const & children,
ContainerOptions const & options = {} )
inlinenodiscard

A grid node.

Parameters
childrenThe children.
optionsThe gap, columns and alignment; a justify is written, and the loader refuses it.
Returns
The node.

Definition at line 3410 of file author.hpp.

◆ spacer()

Node morph::ui::author::spacer ( )
inlinenodiscard

A spacer node.

Returns
The node.

Definition at line 3424 of file author.hpp.

◆ panel()

Node morph::ui::author::panel ( Nodes const & children,
PanelOptions const & options = {} )
inlinenodiscard

A panel node.

Parameters
childrenThe children.
optionsThe title, header and collapsing.
Returns
The node.

Definition at line 3446 of file author.hpp.

◆ scroll()

Node morph::ui::author::scroll ( Nodes const & children,
AnyHandle const & axis = {} )
inlinenodiscard

A scroll node.

Parameters
childrenThe children.
axisThe axis; absent for the kind's own.
Returns
The node.

Definition at line 3462 of file author.hpp.

◆ switchOn()

Node morph::ui::author::switchOn ( AnyHandle const & value,
std::vector< Case > const & cases,
Nodes const & fallback = {} )
inlinenodiscard

A switch node: shows the first case whose when equals its value.

Parameters
valueThe value the cases are compared with.
casesThe cases.
fallbackThe nodes shown when no case matches.
Returns
The node.

Definition at line 3511 of file author.hpp.

◆ tabs()

Node morph::ui::author::tabs ( std::vector< Tab > const & tabs)
inlinenodiscard

A tabs node.

Parameters
tabsThe pages.
Returns
The node.

Definition at line 3536 of file author.hpp.

◆ dialogNode()

Node morph::ui::author::detail::dialogNode ( std::string_view kind,
Element const & element,
DialogOptions const & options,
ScopeBuilder const & builder )
inlinenodiscard

A dialog or drawer.

Parameters
kinddialog or drawer.
elementIts element.
optionsIts options.
builderDeclares on its scope and returns its children.
Returns
The node.

Definition at line 3578 of file author.hpp.

◆ dialog() [1/2]

Node morph::ui::author::dialog ( Element const & element,
Nodes const & children,
DialogOptions const & options = {} )
inlinenodiscard

A dialog node, a scope of its own; open and close name it by its element.

Parameters
elementThe dialog's element.
childrenThe children.
optionsThe title and command lists.
Returns
The node.

Definition at line 3611 of file author.hpp.

◆ dialog() [2/2]

Node morph::ui::author::dialog ( Element const & element,
DialogOptions const & options,
ScopeBuilder const & builder )
inlinenodiscard

A dialog node that declares on its own scope.

Parameters
elementThe dialog's element.
optionsThe title and command lists.
builderDeclares on the dialog's scope and returns its children.
Returns
The node.

Definition at line 3620 of file author.hpp.

◆ drawer()

Node morph::ui::author::drawer ( Element const & element,
Nodes const & children,
DialogOptions const & options = {} )
inlinenodiscard

A drawer node, a scope of its own.

Parameters
elementThe drawer's element.
childrenThe children.
optionsThe title, side and command lists.
Returns
The node.

Definition at line 3629 of file author.hpp.

◆ busy()

Node morph::ui::author::busy ( AnyHandle const & active,
AnyHandle const & label = {} )
inlinenodiscard

A busy node.

Parameters
activeWhether it shows.
labelIts label.
Returns
The node.

Definition at line 3637 of file author.hpp.

◆ forEach()

Node morph::ui::author::forEach ( AnyHandle const & rows,
ForEachOptions const & options,
ScopeBuilder const & builder )
inlinenodiscard

A forEach node: its children once per row, each row a scope of its own.

Parameters
rowsThe list.
optionsThe key, axis and gap.
builderDeclares on a row's scope and returns its nodes.
Returns
The node.

Definition at line 3656 of file author.hpp.

◆ cells()

std::vector< TableColumn > morph::ui::author::cells ( std::vector< Node > const & cells)
inlinenodiscard

Columns from cells alone, without ids or labels.

Parameters
cellsThe cells, one per column.
Returns
The columns.

Definition at line 3686 of file author.hpp.

◆ tableNode()

Node morph::ui::author::detail::tableNode ( NodeWriter & node,
TableOptions const & options,
DeclScope const & scope,
std::vector< TableColumn > const & columns )
inlinenodiscard

Writes a table's options after its source.

Parameters
nodeThe table so far.
optionsThe options.
scopeThe row scope.
columnsThe columns.
Returns
The node.

Definition at line 3749 of file author.hpp.

◆ table() [1/2]

Node morph::ui::author::table ( AnyHandle const & rows,
TableOptions const & options )
inlinenodiscard

A table over a list, with the columns in its options.

Parameters
rowsThe rows.
optionsThe key, columns, selection and command lists.
Returns
The node.

Definition at line 3806 of file author.hpp.

◆ table() [2/2]

Node morph::ui::author::table ( AnyHandle const & rows,
TableOptions const & options,
std::function< std::vector< TableColumn >(DeclScope &)> const & builder )
inlinenodiscard

A table over a list whose rows declare on their own scope.

Parameters
rowsThe rows.
optionsThe key, selection and command lists.
builderDeclares on a row's scope and returns the columns.
Returns
The node.

Definition at line 3817 of file author.hpp.

◆ dataTable() [1/2]

template<typename Action, typename Model>
requires Runs<Model, Action>
Node morph::ui::author::dataTable ( ModelHandle< Model > const & model,
Body< Action > const & body,
TableOptions const & options = {} )
nodiscard

A table declared from a model's list action (spec 7): the client derives its columns from the row type and the table engine sorts, filters, selects and pages.

Template Parameters
ActionThe list action.
ModelThe model type of the alias; it must run the action.
Parameters
modelThe alias.
bodyThe action's own parameters.
optionsThe mode, selection, columns and command lists.
Returns
The node.

Definition at line 3836 of file author.hpp.

◆ dataTable() [2/2]

template<typename Action, typename Model>
requires Runs<Model, Action>
Node morph::ui::author::dataTable ( ModelHandle< Model > const & model,
TableOptions const & options = {} )
nodiscard

A table declared from a model's list action that takes no parameters of its own.

Template Parameters
ActionThe list action.
ModelThe model type of the alias; it must run the action.
Parameters
modelThe alias.
optionsThe mode, selection, columns and command lists.
Returns
The node.

Definition at line 3860 of file author.hpp.

◆ dateTimeInput() [1/2]

Node morph::ui::author::dateTimeInput ( AnyHandle const & value,
AnyHandle const & label,
Commands const & commit = {} )
inlinenodiscard

A dateTimeInput node.

Parameters
valueThe value.
labelThe label.
commitCommands run on a commit.
Returns
The node.

Definition at line 3869 of file author.hpp.

◆ dateTimeInput() [2/2]

Node morph::ui::author::dateTimeInput ( DateTimeInputOptions const & options)
inlinenodiscard

A dateTimeInput node.

Parameters
optionsThe input.
Returns
The node.

Definition at line 3890 of file author.hpp.

◆ slider()

Node morph::ui::author::slider ( SliderOptions const & options)
inlinenodiscard

A slider node.

Parameters
optionsThe slider.
Returns
The node.

Definition at line 3921 of file author.hpp.

◆ filePicker()

Node morph::ui::author::filePicker ( FilePickerOptions const & options)
inlinenodiscard

A filePicker node.

Parameters
optionsThe picker.
Returns
The node.

Definition at line 3950 of file author.hpp.

◆ actionPart()

void morph::ui::author::detail::actionPart ( NodeWriter & node,
std::optional< ActionPart > const & action )
inline

Writes an action part.

Parameters
nodeThe node.
actionThe action; absent leaves it out.

Definition at line 3973 of file author.hpp.

◆ banner()

Node morph::ui::author::banner ( BannerOptions const & options)
inlinenodiscard

A banner node.

Parameters
optionsThe banner.
Returns
The node.

Definition at line 4006 of file author.hpp.

◆ badge()

Node morph::ui::author::badge ( AnyHandle const & text,
AnyHandle const & tone = {},
AnyHandle const & icon = {} )
inlinenodiscard

A badge node.

Parameters
textThe text.
toneThe tone.
iconAn icon.
Returns
The node.

Definition at line 4018 of file author.hpp.

◆ progress()

Node morph::ui::author::progress ( AnyHandle const & value,
AnyHandle const & label = {} )
inlinenodiscard

A progress node.

Parameters
valueThe fraction from 0 to 1; null is indeterminate.
labelThe label.
Returns
The node.

Definition at line 4026 of file author.hpp.

◆ steps()

Node morph::ui::author::steps ( AnyHandle const & items,
AnyHandle const & current = {} )
inlinenodiscard

A steps node.

Parameters
itemsThe steps, [{label, state}].
currentThe current step.
Returns
The node.

Definition at line 4034 of file author.hpp.

◆ keyValue()

Node morph::ui::author::keyValue ( AnyHandle const & items)
inlinenodiscard

A keyValue node.

Parameters
itemsThe pairs, [{label, value}].
Returns
The node.

Definition at line 4041 of file author.hpp.

◆ emptyState()

Node morph::ui::author::emptyState ( EmptyStateOptions const & options)
inlinenodiscard

An emptyState node.

Parameters
optionsThe empty state.
Returns
The node.

Definition at line 4060 of file author.hpp.

◆ splitter()

Node morph::ui::author::splitter ( Nodes const & children,
AnyHandle const & orientation = {},
AnyHandle const & sizes = {} )
inlinenodiscard

A splitter node.

Parameters
childrenThe panes.
orientationThe orientation.
sizesThe initial sizes.
Returns
The node.

Definition at line 4072 of file author.hpp.

◆ collapsible()

Node morph::ui::author::collapsible ( Nodes const & children,
CollapsibleOptions const & options = {} )
inlinenodiscard

A collapsible node.

Parameters
childrenThe content.
optionsThe title, header and toggle.
Returns
The node.

Definition at line 4097 of file author.hpp.

◆ dropZone()

Node morph::ui::author::dropZone ( Nodes const & children,
DropZoneOptions const & options = {} )
inlinenodiscard

A dropZone node.

Parameters
childrenThe content.
optionsThe accepted files and the drop.
Returns
The node.

Definition at line 4121 of file author.hpp.

◆ customize()

Node morph::ui::author::customize ( Point const & point)
inlinenodiscard

A customize node: the editor of a customization point.

Parameters
pointThe point.
Returns
The node.

Definition at line 4133 of file author.hpp.

◆ boundary()

Node morph::ui::author::boundary ( Nodes const & children,
Nodes const & loading = {},
Nodes const & error = {} )
inlinenodiscard

A boundary node: loading until its queries have values, error when one failed without one.

Parameters
childrenThe content.
loadingThe nodes shown while loading.
errorThe nodes shown on a failure; ref("boundary.error") and retry() are valid in them.
Returns
The node.

Definition at line 4142 of file author.hpp.

◆ present()

void morph::ui::author::detail::present ( NodeWriter & node,
FormPresentation const & presentation )
inline

Writes presentation's keys on node.

Parameters
nodeThe node being written.
presentationThe keys.

Definition at line 4221 of file author.hpp.

◆ form()

template<typename Action, typename Model>
requires Runs<Model, Action>
Node morph::ui::author::form ( ModelHandle< Model > const & model,
FormOptions< Action > const & options = {} )
nodiscard

A form node: a schema form of the forms engine over an action (spec 2); each field takes its label from the schema or the overlay.

Template Parameters
ActionThe action.
ModelThe model type of the alias; it must run the action.
Parameters
modelThe alias.
optionsThe prefill, overlay and command lists.
Returns
The node.

Definition at line 4271 of file author.hpp.

◆ collection()

template<typename Action, typename Model>
requires Runs<Model, Action>
Node morph::ui::author::collection ( ModelHandle< Model > const & model,
FormPresentation const & presentation = {} )
nodiscard

A collection node: the forms engine's list screen over an action.

Template Parameters
ActionThe action.
ModelThe model type of the alias; it must run the action.
Parameters
modelThe alias.
presentationThe keys that reach every form the view draws; its title replaces the view's heading.
Returns
The node.

Definition at line 4307 of file author.hpp.

◆ wizard()

template<typename Action, typename Model>
requires Runs<Model, Action>
Node morph::ui::author::wizard ( ModelHandle< Model > const & model,
FormPresentation const & presentation = {} )
nodiscard

A wizard node: the forms engine's wizard over an action.

Template Parameters
ActionThe action.
ModelThe model type of the alias; it must run the action.
Parameters
modelThe alias.
presentationThe keys that reach every step's form; its title replaces the view's heading.
Returns
The node.

Definition at line 4324 of file author.hpp.

◆ custom()

Node morph::ui::author::custom ( ComponentRef const & component,
CustomOptions const & options = {} )
inlinenodiscard

A custom node: a declared component with its props and events.

Parameters
componentThe component.
optionsThe props and events.
Returns
The node.

Definition at line 4345 of file author.hpp.

◆ names()

bool morph::ui::author::detail::names ( DocNode const & node,
std::string_view key )
inlinenodiscard

Whether a node has a property that names it: present, and not the constant "" or null.

Parameters
nodeThe node.
keyThe property.
Returns
Whether it names the node.

Definition at line 4373 of file author.hpp.

◆ hasA11yName()

bool morph::ui::author::detail::hasA11yName ( DocNode const & node)
inlinenodiscard

Whether a node has an a11y.name that names it.

Parameters
nodeThe node.
Returns
Whether it has.

Definition at line 4388 of file author.hpp.

◆ brokenRule()

std::string morph::ui::author::detail::brokenRule ( DocNode const & node)
inlinenodiscard

The accessibility rule a node breaks, if any.

Parameters
nodeThe node.
Returns
The rule, or empty.

Definition at line 4396 of file author.hpp.

◆ accessibilityOf() [1/2]

std::optional< Refusal > morph::ui::author::detail::accessibilityOf ( DocNode const & node,
std::string const & document )
inlinenodiscard

The first accessibility rule a node or a node under it breaks.

Parameters
nodeThe node.
documentThe document's id.
Returns
The refusal, or nothing.

Definition at line 4446 of file author.hpp.

◆ accessibilityOf() [2/2]

std::optional< Refusal > morph::ui::author::detail::accessibilityOf ( std::span< DocNodePtr const > nodes,
std::string const & document )
inlinenodiscard

The first accessibility rule the nodes of a list break.

Parameters
nodesThe nodes.
documentThe document's id.
Returns
The refusal, or nothing.

Definition at line 4436 of file author.hpp.

◆ checkAccessibility()

std::optional< Refusal > morph::ui::author::checkAccessibility ( Document const & document)
inlinenodiscard

The accessibility rules of spec 5 §11, which registration runs after the load-time validation.

Every text input, date-time input, slider, select, checkbox and file picker has a label or an a11y.name; a button without a label, every custom node and every table has an a11y.name; every dialog and drawer has a title or an a11y.name. An icon never counts, and neither does a label or name written as the constant "" or null. A form field takes its field's label, so a form is not checked. The view and every component's fallback are walked; the client does not run these rules.

Parameters
documentThe loaded document.
Returns
The first rule broken, with the node's path, or nothing.

Definition at line 4480 of file author.hpp.

◆ screen() [1/2]

Screen morph::ui::author::screen ( Screen::Builder builder)
nodiscard

A screen with its id as a template argument, as spec 5 §11 writes it.

Template Parameters
IdThe document id.
Parameters
builderThe builder.
Returns
The screen.

Definition at line 4556 of file author.hpp.

◆ screen() [2/2]

Screen morph::ui::author::screen ( std::string screenId,
Screen::Builder builder )
inlinenodiscard

A screen.

Parameters
screenIdThe document id.
builderThe builder.
Returns
The screen.

Definition at line 4564 of file author.hpp.

◆ screenRegistry()

ScreenRegistry & morph::ui::author::screenRegistry ( )
inlinenodiscardnoexcept

The process's screen registry, which MORPH_REGISTER_SCREEN enrols into.

Returns
The registry.

Definition at line 4680 of file author.hpp.

◆ enrollScreen()

template<std::invocable Make>
bool morph::ui::author::enrollScreen ( Make const & make)
noexcept

Enrols a screen into the process's registry; what MORPH_REGISTER_SCREEN runs.

Template Parameters
MakeA callable that returns the Screen.
Parameters
makeMakes the screen, inside the registration.
Returns
true, for the static initialiser that runs it.

Definition at line 4690 of file author.hpp.

Variable Documentation

◆ self

Self morph::ui::author::self {}
inlineconstexpr

The dialog or drawer a command list runs in.

Definition at line 1295 of file author.hpp.