Ownership and Dependency Direction
Layer responsibility and allowed dependency edges.
HEAD a63778e| Read this page when | You need to decide whether a dependency or responsibility crosses an allowed layer. |
|---|---|
| First answer | Dependency direction is shared <- domains <- widgets <- app; each layer owns a distinct contract. |
| Boundary | This page owns dependency direction; behavior remains owned by the relevant domain or package authority. |
| Follow-up | Open the owning public.ts and the boundary guard named below. |
shared <- domains <- widgets <- app| Layer | Owns | Boundary |
|---|---|---|
shared | Domain-neutral primitives | Depends only on shared and external packages |
domains | Business rules and state | Cross-domain access uses the owning domain's public.ts |
widgets | Product interaction and presentation | Coordinates public contracts; owns no domain validation or persistence |
app | Composition and application lifecycle | Constructs runtimes and application-wide side effects |
Shared editor dependencies:
Web Host ─┐
├→ editor-input → editor-core → cell-plane → cell-core / protocol
Terminal Host ─┘ └→ @opentui/keymap
editor-core owns the runtime framework, interaction/clipboard workflows and
document/history contracts. Hosts own native input, rendering and platform IO;
shared packages cannot import Host internals. Follow the
shared API and verification map
and terminal Host contract.
editor-input owns the keymap integration: Host attachment lifetime, effective
binding layers, command forwarding and input guards. OpenTUI owns terminal
parsing and capability negotiation; @opentui/keymap owns runtime matching,
precedence and sequences. editor-core retains the binding catalog and editing
commands. Web and Terminal renderers still consume the shared core directly.
A domain reads its own source directly. Its public.ts contains explicit named
re-exports only; composition belongs in src/app. Production cross-domain imports
use the owner's public.ts; tests may use its /testing entry when present.
Use domain reference to select the business owner. The boundary check enforces layer and import direction; the state ownership check guards Canvas stores, content projection, and Yjs mutation.
Shared creation capabilities are owned by
editor-core/drawing,
character-library
and canvas-templates.
Web and Terminal adapt input, resource loading and presentation; shared creation
packages have no application, React, DOM or filesystem dependency. Character
insertion and template placement commit through Canvas document commands.