Extensions: configuration and capability contracts
Practical responsibilities from nodes/marks and commands to profiles, layout and selection.
Configuration and composition
| Entry/hook | Result or responsibility | Constraint |
|---|---|---|
Extension.create(config) | Behavior definition | No schema node |
Node.create() / Mark.create() | Node/mark definition | Node content/group and mark restrictions enter one schema |
.configure(options) | Configured extension | Assemble per instance rather than mutating shared options |
.extend(config) | Extended definition | Replace intentionally; verify parent-hook invocation and ordering |
addOptions() | Defaults | Options are not persistent document data |
addStorage() | Instance state | Persist business attributes in schema where required |
addExtensions() | Child extensions | Composition point with unique schema owners |
addAttributes() / addGlobalAttributes() | Attributes | Define defaults, parsing, serialization and migration |
addCommands() | Raw command factories | Augment Commands<ReturnType> for direct/chain/can modes |
addKeyboardShortcuts() | Key handlers | Use the same commands and return handling results |
addInputRules() / addPasteRules() | Rules | Verify schema and history behavior |
addProseMirrorPlugins() | PM plugins | Use the same @quirekit/pm identity |
See custom behavior and the complete content extension.
Capability owners
| Hook | Consumer | What is not automatic |
|---|---|---|
addViewAdapters() | Core mount lifetime | Schema does not provide input/painting |
addDocumentProfiles() | Engine facet resolution | Core does not interpret Word fields or units |
addLayoutProviders() | View/Engine | HTML CSS does not become Canvas layout |
addSelectionAdapters() | Structured selection and command targets | Drawing is not selection correctness |
addDocx() | Instance editor.docx | JSON persistence does not establish DOCX round trips |
addAccessibility() | Accessibility owner | Drawing text does not provide accessible semantics |
addAiCapabilities() | AI core | Features supply facts and described commands, not model tools/prompts |
Product UI hooks such as addRibbonItems require a consuming product registry. Pure Core does not create chrome from these declarations. See product plugins.
Profiles and providers
Profiles supply model-wide page, paragraph, table and drawing semantics. Each facet has one owner; missing facets use neutral defaults. A profile is distinct from a custom Node's layout provider.
@quirekit/core/document-profileMITDocument-profile registration owned by an extension. A profile supplies document-model semantics (for example Word paragraph formatting or page sections) to a layout engine through named facets. Core treats the payload as opaque; the consuming engine validates its shape.
export interface QuireDocumentProfileRegistration<Profile = unknown> {
readonly id: string;
readonly facets: readonly string[];
readonly profile: Profile;
}Providers declare node types and capabilities and return products with source ranges and snapshot identity. Use public subpaths; an internal type name is not necessarily exported at the package root.
@quirekit/core/layout-providerMITRenderer-neutral provider registration owned by an extension.
export interface QuireLayoutProviderRegistration<Provider = unknown> {
readonly id: string;
readonly nodeTypes: readonly string[];
readonly capabilities: readonly QuireLayoutProviderCapabilityKind[];
readonly provider: Provider;
readonly layoutDependency?: QuireLayoutDependency | undefined;
}@quirekit/view-engine/layout-providerAGPL-3.0-onlyWraps one typed layout provider in renderer-neutral Core registration metadata. Core can diagnose provider ids and node ownership without opening the provider payload. View authority later verifies that the repeated metadata still agrees with the typed payload before execution. @param provider - Provider algorithm and its explicit capability declaration. @returns Core registration carrying the unchanged typed provider payload.
function createQuireLayoutProviderRegistration(provider: QuireLayoutProvider): QuireViewLayoutProviderRegistrationSee complete source for measurement → child flow → retained regions and selection. layoutDependency: { kind: 'document' } is valid only for a concrete provider that reads no undeclared external mutable state, not as a general performance switch.