Skip to main content

Module theme_host

Module theme_host 

Source
Expand description

The theme guest→host element-declaration seam (TC.4).

A theme-contributing plugin implements the theme-plugin world: it imports the theme API (register-element) and exports register-theme-elements, which the host calls once to drive declaration. This module holds the bindgen! for that world plus the host-side conversion from the WIT style-spec to a native StyleSpec, factored out so it is unit-testable without a Store (the config_host precedent).

The canonical API is the WIT (theme.wit) — any component-model language calls register-element directly. A plugin element lands in the SAME registry builtins use, so themes override it, :customize edits it and :describe-element documents it with NO host kind-branch.

This closes theme-system.md’s deferred WIT-registration item, which was designed there and waited for a real consumer.

Functions§

register_plugin_element
The register-element host-service body. Registers into the SAME registry builtins use, owned by the plugin so unload can reverse it.
set_plugin_element_override
TK.5: the set-element-override body — an override for an element this plugin owns, above the theme.
style_spec_from_wit
Convert a WIT style-spec to the native StyleSpec.