Skip to content
Ooidget

Ooidget Component Format 0.1Editor's Draft

Host interface

A runtime is embedded in a host application. This section defines what the runtime asks of the host. It defines behaviour, not an API: the reference implementation’s C ABI is one binding of it.

Component resolver

Given a component name, the host returns the component file, or nothing. A runtime calls it for names not found in the current bundle.

Assets

Given an asset name (from an image layer), the host returns the asset’s bytes and media type, or nothing. Names are opaque to the runtime; hosts typically resolve them against the project’s folder.

Use

For a use layer whose name is not a component, the runtime gives the host the name, the layer and its box in device coordinates, and the host MAY draw into that box.

Slots

For each slot layer, the host receives its name and device box every frame it is shown, draws its contents, and receives the pointer and keyboard input that falls in it instead of the instance.

Primitives

For each primitive layer, the host receives the layer, its box and the instance’s view, and draws. Primitives let an application add drawings the format cannot express, such as an LCD’s dot matrix; a component that relies on one is not portable to hosts without it, and SHOULD give a fallback layer (Extensions).

Painters

A paint layer names a painter, a program in a widget’s painters object that draws into the layer’s box through an immediate-mode canvas API. The canvas API is that of the HTML Canvas 2D context [HTML §4.12.5], restricted to drawing (no image data readback, no DOM). A runtime MAY run a painter compiled ahead of time if it produces the same pixels as the source.

Commands

The host receives each command a behaviour returns.

Diagnostics

A runtime SHOULD report to the host, without stopping: names that did not resolve, expressions that failed, layers and members it skipped, and extensions it does not support.