Expand description
The contract: Twip’s public editor API. Every first-class SDK (@twip/web, Twip.Core) follows what this module
defines: the operations, state, events, errors and warnings, and what each one means. It is typed throughout, and
its values cross the SDK wire as JSON through wire.
An engine::Engine owns the font library and the sessions of one thread. A session::Session is one document
being edited: command::Commands change it, each as one transaction, and after each change its
state::State is rebuilt and the engine’s listener hears an event::Event.
Modules§
- catalog
- The command catalog: every command’s id, label, group, shortcuts and undo grouping, for building toolbars, menus and shortcut help.
- command
- Commands: one typed variant per operation an application can run, applied at the selection.
- drawing
- Shape values: preset geometries, colours, fills, outlines, effects and text bodies, as applications set and read them. Colours stay as written (a theme colour and its transforms), never only the resolved RGB.
- engine
- The engine: the font library, the shared clipboard and the sessions of one thread, and the listener every session’s events go to.
- error
- Errors: a stable code, a readable message and optional details.
- event
- Events: what the engine tells its host, in commit order. A session’s state is rebuilt before any event of the same change is delivered.
- fonts
- The font library sessions share: added fonts, a resolver’s requests, and the application’s font settings.
- input
- Raw input hosts forward: keys (by
KeyboardEvent.code), modifiers, pointer and composition phases, and the clipboard’s contents. The engine recognises shortcuts and gestures from these. - record
- Transaction records: who changed what, when, and with which undo label.
- review
- Revisions, comments and people, as applications read them, and where comment cards go beside the pages.
- services
- The host services’ models: menus, dialogs, find, spelling, navigation, styles, elements and data parts, accessibility, shortcuts, gestures, rulers and word count. The engine computes them; applications draw them.
- session
- A session: one document being edited, with its selection, history, pipeline, services and presentation. Each submodule holds one area’s methods.
- state
- The state snapshot: what an application’s controls show, with mixed values explicit. A session rebuilds it after
every observable change;
sequencecounts those,revisioncounts document changes. - value
- Values that commands, state and services share: lengths, colours, bytes, ids, and the formatting vocabularies (underline styles, alignments, tab stops, wrapping, content control kinds).
- warning
- Warnings: fidelity notes from reading and writing documents, one per code and part with a count.
- wire
- The wire: how API values serialize to JSON for the SDKs, and the fixtures that pin it.