Skip to main content

Crate provui_core

Crate provui_core 

Source
Expand description

provui-core — a frontend-neutral UI composition core over prov.

prov describes a plaintext workspace; flower edits structured metadata; leaf edits prose. This crate is the composition of the three, with no opinion about what draws it — the same core is meant to sit under a TUI, a SwiftUI app behind UniFFI, or a test harness:

  • ProvBackend — a flower_core::Backend that edits a prov document’s embedded metadata through prov’s carrier-aware MetaEditor. Lossless: comments, key order, the carrier/format, and the prose body are all preserved. Unlike flower_core::FigBackend (a standalone config file, schema-free), a ProvBackend can carry the workspace schema — the controlled vocabularies and relations resolved from the prov config — so a frontend renders term pickers, spanning-link widgets, and type-directed edits.
  • DocumentSession — one open prov document edited through a flower metadata model and a leaf body editor, reconciled on save.
  • schema_from_config — the adapter turning a resolved prov WorkspaceConfig (+ its vocabularies) into a generic flower_core::Schema for the workspace’s content documents. This is where prov’s controlled vocabularies and spanning relation reach the UI.
  • [config_schema] — the same trick turned on the config document itself, so the metadata editor a frontend already ships can edit a workspace’s policy instead of a hand-written settings form.
  • facets — what each frontmatter key is to prov: a relation, a pointer at machinery, identity, policy, a declared field, or a value prov only carries. Read off the workspace’s own vocabulary rather than a list this crate keeps.
  • links — the links a document declares, each with the metadata path it sits at, so “is the row under the cursor a link?” is a question with an answer. Lexical: no filesystem, no registry.
  • workspaceWorkspaceView, which finds the workspace a document belongs to and resolves a link to a document you can open. The one piece that reads the filesystem, and read-only.

§What this crate will not do for you

It classifies, and it never arranges. Nothing here hides a row, sinks one, reorders them, or makes one read-only — even where it plainly knows enough to: Facets can tell you id is minted and contents is structure, and hands you the lists shaped to go straight into flower’s derived and demoted sets, and then stops.

That is deliberate. An application over prov usually does separate prov’s structure from the values a person typed — diaryx does — but how is a product decision, and a mobile inspector, a terminal band and a settings sheet do not want the same one. The classification is general and lives here once; the arrangement is local and lives in the frontend. provui-tui’s nav module is a worked example of the whole policy, and it is two lines.

Scope: the single-document metadata surface (prov’s edit layer), plus read-only navigation across documents. Relation fields that maintain inverse links across documents belong to prov’s mutate layer — a later, relationship-aware backend, not this one. Following a link reads; retargeting one would write two documents, and this crate’s backend edits one.

Re-exports§

pub use config_schema::CONFIG_READONLY_KEYS;
pub use config_schema::config_schema;
pub use facets::Facet;
pub use facets::Facets;
pub use links::TargetKind;
pub use schema::schema_from_config;
pub use workspace::Destination;
pub use workspace::WorkspaceView;

Modules§

config_schema
The config document → flower schema adapter — crate::schema one module over.
facets
What a frontmatter key is to prov — the classification, offered as a question and never applied.
links
The links a document’s metadata declares — where each one sits, what it says, and what shape of target it names.
rules
The rule builders config_schema is written in.
schema
The prov → flower schema adapter, for a workspace’s content documents.
workspace
Following a link — the one step that needs a workspace to take it in.

Structs§

DocumentSession
One open prov document: a metadata editor and a body editor over the same file, reconciled on save.
ProvBackend
A backend over a single prov document, editing its embedded metadata.
SessionError
A session error, carrying a human-readable message. UniFFI-friendly to widen into a typed enum later.