28namespace morph::client {
65 std::function<
void(
SignedIn)> signedIn, std::function<
void()> signedOut,
66 std::function<
void(std::string
const&)> onProblem = {});
82 std::function<
void(std::expected<ui::Value, std::string>)> done)
override;
91 std::function<
void(std::expected<ui::Value, std::string>)> done)
override;
100 std::function<
void(std::expected<ui::InlineFile, std::string>)> done)
override;
108 std::function<
void(std::expected<ui::Value, std::string>)> done)
override;
112 void setNotifySink(std::function<
bool(std::string
const&, std::string
const&)> sink);
118 bool notify(std::string
const& text, std::string
const& role)
override;
123 std::filesystem::path _downloads;
124 std::function<void(
SignedIn)> _signedIn;
125 std::function<void()> _signedOut;
126 std::function<void(std::string
const&)> _onProblem;
127 std::function<bool(std::string
const&, std::string
const&)> _notifySink;
138 std::function<void(std::string
const& problem)>
onProblem;
140 std::function<void(std::string
const& screenId)>
onMounted;
153 std::function<void(std::vector<std::string>
const& remounted)>
onReloaded;
173 std::expected<ui::Bundle, ui::ConnectError> opened,
bool notify(std::string const &text, std::string const &role) override
Calls the notify sink if one is set.
void setNotifySink(std::function< bool(std::string const &, std::string const &)> sink)
Sets what notify calls to show a transient message; empty falls through to the base class's false.
void signOut() override
Calls signedOut.
ApplicationHost(Source &source, SignInMapper signIn, std::filesystem::path downloads, std::function< void(SignedIn)> signedIn, std::function< void()> signedOut, std::function< void(std::string const &)> onProblem={})
A host over source.
bool saveFile(ui::InlineFile const &file, std::string const &option, std::function< void(std::expected< ui::Value, std::string >)> done) override
Saves a file a document holds the bytes of in the downloads directory. A preview is not supported.
bool signIn(ui::Value const &reply) override
Maps the reply and hands a principal to signedIn.
bool uploadFor(ui::UploadRequest const &request, std::function< void(ui::Value)> progress, std::function< void(std::expected< ui::Value, std::string >)> done) override
Reads the picked file from disk and sends it through the source's file store.
bool download(ui::Value const &file, std::string const &option, ui::Value const &name, std::function< void(std::expected< ui::Value, std::string >)> done) override
Fetches a file by reference and saves it in the downloads directory. A preview is not supported.
bool readFile(ui::Value const &file, std::size_t maxBytes, std::function< void(std::expected< ui::InlineFile, std::string >)> done) override
Reads a picked file whose bytes a document moves inline; its size is read first, and one over the cap...
An AppSource that also hands the shell what it mounts screens with, once it delivered a bundle.
What a frontend lends the source it opens and the screens it mounts.
A history of routes: a browser's session history, or a test's.
Makes widgets. Each factory appends the new widget to parent, or makes a root when it is null,...
What the application answers for the commands a document cannot carry out alone (spec 6)....
The document's typed value (spec 5 §3): what every expression evaluates to.
The host contract (spec 6 §4): how a host mounts UI documents and closes them, whether it owns its ow...
ValueRecord ParamMap
A screen's params, by name.
The UI document interpreter: Interpreter::mount turns a loaded Document into reactive state and a vie...
Route history (spec 3 §10, spec 6 §20): the route of the screen a shell shows, kept in a history the ...
std::unique_ptr< ui::MountedShell > mountShell(ui::AppContext &context, ui::IViewBackend &backend, std::expected< ui::Bundle, ui::ConnectError > opened, Source &source, ShellOptions options)
Mounts the client's shell for what source delivered.
std::optional< SignedIn > defaultSignIn(ui::Value const &reply)
The default sign-in mapping: a reply {ok, principal, token}, refused when ok is false or there is no ...
std::function< std::optional< SignedIn >(ui::Value const &reply)> SignInMapper
Maps a sign-in mutation's reply to the principal and token to install; std::nullopt refuses the sign-...
Where the generic client's screens and models come from: a server (remote) or an application linked i...
What a client shell reports, and how it starts.
bool dev
Development mode (spec 5 §12): every second the shell polls the source's ui-hello digest,...
std::function< void(std::vector< std::string > const &remounted)> onReloaded
Called after each development reload with the ids of the screens it remounted; empty ignores it.
std::string startScreen
The screen mounted first; empty for the first the source lists.
std::function< void(std::string const &problem)> onProblem
Called with each problem: why the source did not open, a document that did not load,...
std::filesystem::path downloads
Where a screen's download saves a file, under the name the screen suggests; the working directory whe...
std::function< void(std::string const &screenId)> onMounted
Called with the id of each screen once it is mounted.
ui::ParamMap startParams
The start screen's params.
ui::IHistory * history
The history the shown screen's route is kept in (spec 3 §10), such as the browser's: back and forward...
SignInMapper signIn
Maps a sign-in mutation's reply to the principal and token the shell installs. Required.
What a sign-in installs: the principal, and the session token its server needs (empty for none).
std::string token
The session token; empty when the server needs none, as in process.
std::string principal
The principal.
A file whose bytes a document moves inline: download from bytes, upload into bytes.
What an upload command asks the host to send, and the mutation that will reference the file,...
The backend contract: the retained widgets a mount drives, and the factory that makes them.
The frontend seam: main picks a frontend at runtime, and the frontend runs whatever an AppSource open...
The UI document's typed values (ui::Value), its types (ui::Type), their JSON form,...