UNPKG

1.41 kBTypeScriptView Raw
1import type { Dict } from './core.js';
2import type { InternalComponentManager } from './managers.js';
3import type { Reference } from './references.js';
4import type { ScopeSlot } from './runtime.js';
5import type { CompilableProgram } from './template.js';
6import type { ProgramSymbolTable } from './tier1/symbol-table.js';
7
8export type ComponentDefinitionState = object;
9export type ComponentInstanceState = unknown;
10
11declare const CapabilityBrand: unique symbol;
12export type CapabilityMask = number & {
13 [CapabilityBrand]: never;
14};
15
16export interface ComponentDefinition<
17 D extends ComponentDefinitionState = ComponentDefinitionState,
18 I = ComponentInstanceState,
19 M extends InternalComponentManager<I, D> = InternalComponentManager<I, D>,
20> {
21 resolvedName: string | null;
22 handle: number;
23 state: D;
24 manager: M;
25 capabilities: CapabilityMask;
26 compilable: CompilableProgram | null;
27}
28
29export interface ComponentInstance<
30 D extends ComponentDefinitionState = ComponentDefinitionState,
31 I = ComponentInstanceState,
32 M extends InternalComponentManager<I, D> = InternalComponentManager<I, D>,
33> {
34 definition: ComponentDefinition<D, I>;
35 manager: M;
36 capabilities: CapabilityMask;
37 state: I;
38 handle: number;
39 table: ProgramSymbolTable;
40 lookup: Record<string, ScopeSlot> | null;
41}
42
43export interface PreparedArguments {
44 positional: ReadonlyArray<Reference>;
45 named: Dict<Reference>;
46}