tuil
ReferencePackages

@mwillbanks/tuil-core

Core runtime, lifecycle, capability, command, semantic, and terminal contracts for tuil.

View rawEdit

Overview

Core runtime, lifecycle, capability, command, semantic, and terminal contracts for tuil.

@mwillbanks/tuil-core is independently installable and also participates in the umbrella @mwillbanks/tuil runtime where applicable.

Installation

npm install @mwillbanks/tuil-core

How it operates

Core owns the framework-neutral contracts used by every adapter: lifecycle stages, services, commands, terminal capabilities, semantic metadata, disposables, and render-mode resolution.

Documentation flow diagram. configuration; initialization; mount; ready; stop; disposal; S0 leads to S1; S1 leads to S2
Documentation flow diagram. configuration; initialization; mount; ready; stop; disposal; S0 leads to S1; S1 leads to S2

API

APISignatureDescription
AppLifecycleStatetype AppLifecycleStatePublic type AppLifecycleState.
ColorDepthtype ColorDepthPublic type ColorDepth.
Commandinterface CommandPublic interface Command.
CommandContextinterface CommandContextPublic interface CommandContext.
CommandExecutioninterface CommandExecutionPublic interface CommandExecution.
CommandRegistryclass CommandRegistryPublic class CommandRegistry.
CommandRegistryChangetype CommandRegistryChangePublic type CommandRegistryChange.
createGlobalSearchExpressionfunction createGlobalSearchExpressionPublic function createGlobalSearchExpression.
defineCommandfunction defineCommandPublic function defineCommand.
defineServicefunction defineServicePublic function defineService.
deleteOnDisposefunction deleteOnDisposePublic function deleteOnDispose.
detectTerminalCapabilitiesfunction detectTerminalCapabilitiesPublic function detectTerminalCapabilities.
Disposableinterface DisposablePublic interface Disposable.
DisposableStackclass DisposableStackPublic class DisposableStack.
Disposertype DisposerPublic type Disposer.
escapeTerminalControlCharactersfunction escapeTerminalControlCharactersPublic function escapeTerminalControlCharacters.
hasTerminalControlCharactersfunction hasTerminalControlCharactersPublic function hasTerminalControlCharacters.
isSafeRegularExpressionSourcefunction isSafeRegularExpressionSourcePublic function isSafeRegularExpressionSource.
Lifecycleclass LifecyclePublic class Lifecycle.
RenderModetype RenderModePublic type RenderMode.
resolveRenderModefunction resolveRenderModePublic function resolveRenderMode.
resolveTerminalViewportfunction resolveTerminalViewportPublic function resolveTerminalViewport.
SemanticMetadatainterface SemanticMetadataPublic interface SemanticMetadata.
SemanticRoletype SemanticRolePublic type SemanticRole.
ServiceContainerclass ServiceContainerPublic class ServiceContainer.
ServiceDefinitioninterface ServiceDefinitionPublic interface ServiceDefinition.
ServiceFactoryContextinterface ServiceFactoryContextPublic interface ServiceFactoryContext.
ServiceMaptype ServiceMapPublic type ServiceMap.
sliceTerminalTextfunction sliceTerminalTextPublic function sliceTerminalText.
TerminalBoundsinterface TerminalBoundsPublic interface TerminalBounds.
TerminalCapabilitiesinterface TerminalCapabilitiesPublic interface TerminalCapabilities.
TerminalCapabilityInputinterface TerminalCapabilityInputPublic interface TerminalCapabilityInput.
TerminalInputProbeinterface TerminalInputProbePublic interface TerminalInputProbe.
TerminalOutputProbeinterface TerminalOutputProbePublic interface TerminalOutputProbe.
TerminalPlatformtype TerminalPlatformPublic type TerminalPlatform.
terminalTextWidthfunction terminalTextWidthPublic function terminalTextWidth.
TerminalViewporttype TerminalViewportPublic type TerminalViewport.
terminalViewportBreakpointsconstant terminalViewportBreakpointsPublic constant terminalViewportBreakpoints.
toDisposablefunction toDisposablePublic function toDisposable.
truncateTerminalTextfunction truncateTerminalTextPublic function truncateTerminalText.
wrapTerminalTextfunction wrapTerminalTextPublic function wrapTerminalText.

Events and lifecycle

Core defines lifecycle state but does not own the event transport. The umbrella runtime projects lifecycle transitions onto app:* events.

All subscriptions and registrations return a disposer or belong to an owning runtime that disposes them in reverse order.

Example

import { Lifecycle } from "@mwillbanks/tuil-core";

const lifecycle = new Lifecycle();
await lifecycle.transition("initializing");

On this page