Skip to main content

Crate sim_lib_view

Crate sim_lib_view 

Source
Expand description

View/editor codec contracts, Shape-based lens dispatch, lens stack, and the universal default lens for the SIM Web-UI (WEBUI_4).

A view is a codec object in the encode direction (Value -> Scene); an editor is a codec object in the decode direction ((Value, Intent) -> Draft, then Draft -> operation). A lens pairs a view with an optional editor. View selection is overload selection, so the dispatcher reuses the kernel Shape matcher rather than inventing a second selection ladder.

This crate provides the lens contract (open metadata plus the view and editor traits), the Shape-based dispatch machinery, the universal default lens, the lens stack, and experience modes.

§Example

Any value opens in the universal default lens, rendered at the active mode’s depth (Household, Builder, Systems):

use sim_kernel::Expr;
use sim_lib_view::{Mode, universal_scene};

let scene = universal_scene(&Expr::Nil, Mode::Builder);
assert!(sim_lib_scene::validate_scene(&scene).is_ok());

Re-exports§

pub use codec::PairCodec;
pub use codec::SurfaceCodec;
pub use codec::roundtrip_holds;
pub use contract::Draft;
pub use contract::Editor;
pub use contract::Lens;
pub use contract::LensKind;
pub use contract::LensMeta;
pub use contract::Operation;
pub use contract::View;
pub use dispatch::DispatchContext;
pub use dispatch::DispatchOutcome;
pub use dispatch::DispatchReason;
pub use dispatch::LensRegistry;
pub use embed::embed_scene;
pub use mode::Exposure;
pub use mode::Mode;
pub use mode::action_exposure;
pub use mode::denied_scene;
pub use mode::readonly_scene;
pub use mode::universal_scene;
pub use palette::A11y;
pub use palette::Command;
pub use palette::CommandKind;
pub use palette::FocusDir;
pub use palette::a11y_of;
pub use palette::diagnostics_scene;
pub use palette::filter_commands;
pub use palette::focused_id;
pub use palette::move_focus;
pub use palette::palette_intent;
pub use palette::palette_scene;
pub use palette::with_a11y;
pub use palette::with_focus;
pub use profiles::DEVICE_PRESETS;
pub use profiles::project_for_preset;
pub use set_lens::active_lens;
pub use set_lens::apply_set_lens;
pub use set_lens::empty_pane_lenses;
pub use stack::LensStackEntry;
pub use surface::SurfaceCaps;
pub use surface::SurfaceError;
pub use universal::UNIVERSAL_EDITOR_ID;
pub use universal::UNIVERSAL_VIEW_ID;
pub use universal::register_universal_default;
pub use universal_editor::EDIT_MODES;
pub use universal_editor::UniversalEditor;
pub use universal_editor::render_draft;
pub use universal_view::UniversalView;
pub use universal_view::render_value;

Modules§

codec
The unified, reversible surface codec.
contract
View/editor contracts and their open metadata record.
dispatch
Shape-based lens dispatch.
embed
Scene embedding: one lens hosting another lens’s Scene.
mode
Experience modes and capability-aware action exposure.
palette
Surface-neutral command palette, focus model, accessibility metadata, and diagnostics presentation (VIEW4.06).
profiles
Device-class projection profiles.
set_lens
intent/set-lens handling and the per-pane active-lens state.
stack
The lens stack: the ordered set of lenses available for a value.
surface
Surface capability metadata – the library-level “surface” output position.
universal
Registration of the universal default view and editor.
universal_editor
The universal default editor: edit any value over one draft.
universal_view
The universal default view: a complete Scene for any value with no specialized lens.

Structs§

ViewLensDescriptor
Registration record for a view lens, exposed as a runtime Citizen.

Constants§

UNIVERSAL_DEFAULT_LENS
Marker id for the always-matching universal default lens (lowest quality).

Functions§

view_lens_descriptor_class_symbol
Returns the class symbol for the view lens descriptor Citizen.