Reading and surfaces

Refusals

Case

Code

Case

Anything the surface context refuses

Code

POLICY_VIOLATION

Case

A malformed action⁠, or bad row key values. A repeat that may not be interactive is POLICY_VIOLATION (⁠surface.rowKey⁠)

Code

INVALID_DOCUMENT

Case

A ceiling, or the row-data size cap

Code

RESOURCE_LIMIT_EXCEEDED

Case

An operation outside the list

Code

INVALID_OPERATION

Case

Retries

Code

KEY_CONFLICT⁠, REVISION_CONFLICT

Surface refusals carry rule: 'surface.<name>'⁠, and nodeId where a node is at fault. The code is POLICY_VIOLATION unless the table says otherwise. The same checks run on a document passed to createSurface⁠, and again when the surface is drawn.

Rule

What is refused

Rule

surface.action

What is refused

An action that is not a name and a plain-text description and nothing else (⁠INVALID_DOCUMENT⁠), or an action on a kind other than a form or a button. A site document with an action is refused under this rule too

Rule

surface.backend

What is refused

Backends, origins, live sources or grants on the document, and live data on a node

Rule

surface.block

What is refused

A block the profile does not list

Rule

surface.buttonAction

What is refused

A button in a form with an action, or with a link, that has its own action

Rule

surface.cursor

What is refused

A pattern that follows the pointer

Rule

surface.document

What is refused

Anything but one page home with the top block homeroot⁠; navigation⁠; components; header or footer content

Rule

surface.embed

What is refused

An embed

Rule

surface.fieldKey

What is refused

A field of a form with an action that has no key

Rule

surface.formRepeat

What is refused

A form with an action that repeats its fields or submit buttons

Rule

surface.height

What is refused

A size written in vh⁠, because a surface has no set height

Rule

surface.island

What is refused

An island

Rule

surface.kind

What is refused

A kind its profile does not list

Rule

surface.math

What is refused

Math in a text run

Rule

surface.motion

What is refused

Motion on a node, and custom effects on the document

Rule

surface.nestedForm

What is refused

A form inside another form

Rule

surface.overlay

What is refused

A pinned or fixed block, a layer, a command that opens one, and a trigger that opens or closes one

Rule

surface.password

What is refused

A password field

Rule

surface.required

What is refused

Two cases, see Required content

Rule

surface.rowKey

What is refused

Rows that can be used outside a top-level, ungrouped repeat over a source with a key; and bad row key values (⁠INVALID_DOCUMENT⁠), see Rows

Rule

surface.src

What is refused

A src prop on any kind, a data binding to src⁠, and any assetId⁠, poster or link file (on a link, viewAll⁠, a text run or a goTo trigger) that is not a plain asset id

Rule

surface.submit

What is refused

A form with an action and no button that presses it: a button with no action, trigger or link, outside repeated rows and show conditions

Rule

surface.tool

What is refused

Tools, acts and agents

Rule

surface.trigger

What is refused

A trigger other than a click, a trigger action on values or live data, and a style that reacts to scrolling

Rule

surface.value

What is refused

Site values

Required content

In a surface only an explicit required: true protects a node. A form and its fields are not required by default, so a batch can replace a form.

No batch may add, change or remove any node's required value, by any operation (⁠surface.required⁠). The product marks a node in the document it passes to createSurface⁠.

A node marked required: true may not be in repeated rows or under a show condition, nor carry one (⁠surface.required⁠). Removing a marked node, or leaving it with only sample text, is refused with rule required⁠, and so is a change that would hide it. The sample-text case comes from the shared plan rule, which has no surface test.

Not covered: moving a marked node into a closed details⁠, emptying a marked form, and a block setting that turns a marked form into another kind.

Surfaces do not run the site rule in overview.md. The two refusals above replace it.

Actions and events

action is { name, description }⁠.

Node

Rule for action

How it is drawn

Node

A form

Rule for action

Allowed. Every field in it needs a field key. It needs a submit button outside any repeat or show condition inside it. A repeat inside it that holds fields or submit buttons is refused, so field keys are unique and a press never has to name a row. A form inside another form is refused

How it is drawn

method="dialog"⁠, with no address, no field names, no hidden input and no trap input

Node

A button inside a form that has an action

Rule for action

Refused

How it is drawn

type="submit" if it has no action, trigger or link; the form reports

Node

Any other button

Rule for action

Allowed, unless it also has a link

How it is drawn

With no link, type="button"⁠; it reports a press. A linked button stays an a

The mount reports three events:

export type SurfaceEvent =
  | {
      kind: 'submit'
      node: string
      row?: string
      action: string
      input: Record<string, string | number>
    }
  | { kind: 'press'; node: string; row?: string; action: string }
  | { kind: 'goTo'; href: string }

node is the stored node id, and row is the row key of the keyed row the node is in. action is the action's name. A number input gives a number, and everything else gives text. An empty optional number is left out. Only visible fields with a key are read. Check every value again on your server.

Rows

A data source may declare key⁠, naming a text or number field. Key values are checked only when a surface is compiled. Site builds ignore key⁠.

  • A row is interactive when the repeated template holds, at any depth, a field⁠, details⁠, video or menu⁠, or any node with an action⁠, a trigger or a state.

  • An interactive repeat must be a top-level repeat (inside no other) over a registry source with a key⁠, and not grouped. Anything else interactive is refused (⁠surface.rowKey⁠): nested, grouped and plain-value lists may only display.

  • A key value is a non-empty text or a finite number, compared as text, at most 128 UTF-8 bytes. A missing or duplicate value is refused (⁠surface.rowKey⁠, INVALID_DOCUMENT⁠, with the path <source>.<row index>.<key>⁠).

  • In a top-level, ungrouped repeat over a keyed source, the id of each copy ends in ~k plus the hex of the key's UTF-8 bytes. Every other copy keeps its position. Site builds are unchanged.

Previous

Surfaces

Edit this page on GitHub