Describes each value that Elixir writes for the script of the presenter
The renderer writes seven values for the script:
- the program that
Expresso.Presenter.Programmakes; - the list of the steps that
Expresso.Stepsmakes; - the commands of a page of the overview and of a row of the menu;
- the commands of the links that
Expresso.Gotomakes; - the sources of the embeds that
Expresso.Element.Embedmakes; - the sources of the videos that
Expresso.Element.Videomakes; - the sources of the sounds that
Expresso.Element.Audiomakes.
The two windows of the presenter also send a message to each other. This module describes the JSON form of each value. It is the one source of these forms:
Expresso.Presenter.Verifierreads the fields of the state, the views, the built-in functions and the kind of each value from it.Expresso.Test.SchemaWriterwritesassets/src/schema.tsfrom it. That file holds a TypeScript type and a decoder for each value. A test fails when the file does not agree with this module.Expresso.Presenter.Schema.Checkexamines a value with the forms. The verifier uses it for the values of a definition, and the tests use it for each value that the renderer writes.
types/0 returns the forms in order. A form can name an earlier form only.
type/0 describes the terms of a form.
constants/0 returns the constants of the script, such as the kinds of
element and the selectors of the elements that hold commands.
Expresso.Test.SchemaWriter writes each constant into
assets/src/schema.ts too, so the script and Elixir use the same values.
Summary
Functions
Return the built-in functions of the browser that a command can call
Return each constant of the script, with its name, the text that tells what it is, its form and its value
Return the directions of a swipe
Return the fields of the state and the kind of value of each field, in order
Return the form of a value of a kind
Return the parts of the window under a click
Return the built-in kinds of the transition into a slide
Return each form, with its name and the text that tells what it is
Return the views of the presenter
Types
@type kind() :: :index | :slide | :view | :boolean | :digits
The kind of value of a field of the state
@type type() :: :boolean | :string | {:string, String.t()} | {:integer, integer() | nil} | {:number, number() | nil, number() | nil} | {:literal, String.t() | boolean() | integer()} | {:enum, [String.t()]} | {:nullable, type()} | {:list, type()} | {:tuple, [type()]} | {:object, [{atom(), type()}]} | {:open_object, [{atom(), type()}]} | {:partial, [{atom(), type()}]} | {:record, [{atom(), type()}]} | {:union, [type()]} | {:ref, atom()}
The form of a JSON value
:booleanand:string- a value of that type.{:string, pattern}- a string that agrees with a regular expression, in source text.{:integer, min}- an integer that is not less thanmin, or any integer fornil.{:number, min, max}- a finite number frommintomax.nilsets no limit.{:literal, value}- exactly one string, boolean or integer.{:enum, values}- one of the strings.{:nullable, type}- a value of the type, ornull.{:list, type}- an array of values of the type.{:tuple, types}- an array with one value of each type, in order.{:record, fields}- an array with one value of each field, in order. The script reads it as an object with these keys, andExpresso.Presenter.Schema.Record.write/2writes it. Only a form with a name that starts withwritten_holds a record, or a union of records with the same keys.{:object, fields}- an object with exactly these keys.{:open_object, fields}- an object with these keys. It can have other keys, and the decoder does not return them.{:partial, fields}- an object with some of these keys and no other key.{:union, types}- a value of one of the types.{:ref, name}- the form oftypes/0with that name.
Functions
@spec builtins() :: [atom()]
Return the built-in functions of the browser that a command can call
Return each constant of the script, with its name, the text that tells what it is, its form and its value
A constant comes from Elixir and goes into the script when esbuild makes the bundle, so the document does not hold it.
@spec directions() :: [atom()]
Return the directions of a swipe
Return the fields of the state and the kind of value of each field, in order
Return the form of a value of a kind
iex> Expresso.Presenter.Schema.kind(:slide)
{:integer, 1}
@spec regions() :: [atom()]
Return the parts of the window under a click
@spec transitions() :: [atom()]
Return the built-in kinds of the transition into a slide
Return each form, with its name and the text that tells what it is
The forms come in order. A form can name an earlier form only.
@spec views() :: [atom()]
Return the views of the presenter