UNPKG

3.3 kBTypeScriptView Raw
1import { Bounds, DynamicScope, ElementBuilder, Environment, ExceptionHandler, GlimmerTreeChanges, LiveBlock, Option, RuntimeContext, Scope, UpdatableBlock, UpdatingVM, UpdatingOpcode } from '@glimmer/interfaces';
2import { OpaqueIterationItem, OpaqueIterator, Reference } from '@glimmer/reference';
3import { InternalVM, VmInitCallback } from './append';
4import { LiveBlockList } from './element-builder';
5export default class UpdatingVMImpl implements UpdatingVM {
6 env: Environment;
7 dom: GlimmerTreeChanges;
8 alwaysRevalidate: boolean;
9 private frameStack;
10 constructor(env: Environment, { alwaysRevalidate }: {
11 alwaysRevalidate?: boolean | undefined;
12 });
13 execute(opcodes: UpdatingOpcode[], handler: ExceptionHandler): void;
14 private _execute;
15 private get frame();
16 goto(index: number): void;
17 try(ops: UpdatingOpcode[], handler: Option<ExceptionHandler>): void;
18 throw(): void;
19}
20export interface VMState {
21 readonly pc: number;
22 readonly scope: Scope;
23 readonly dynamicScope: DynamicScope;
24 readonly stack: unknown[];
25}
26export interface ResumableVMState {
27 resume(runtime: RuntimeContext, builder: ElementBuilder): InternalVM;
28}
29export declare class ResumableVMStateImpl implements ResumableVMState {
30 readonly state: VMState;
31 private resumeCallback;
32 constructor(state: VMState, resumeCallback: VmInitCallback);
33 resume(runtime: RuntimeContext, builder: ElementBuilder): InternalVM;
34}
35export declare abstract class BlockOpcode implements UpdatingOpcode, Bounds {
36 protected state: ResumableVMState;
37 protected runtime: RuntimeContext;
38 children: UpdatingOpcode[];
39 protected readonly bounds: LiveBlock;
40 constructor(state: ResumableVMState, runtime: RuntimeContext, bounds: LiveBlock, children: UpdatingOpcode[]);
41 parentElement(): import("@simple-dom/interface").SimpleElement;
42 firstNode(): import("@simple-dom/interface").SimpleNode;
43 lastNode(): import("@simple-dom/interface").SimpleNode;
44 evaluate(vm: UpdatingVMImpl): void;
45}
46export declare class TryOpcode extends BlockOpcode implements ExceptionHandler {
47 type: string;
48 protected bounds: UpdatableBlock;
49 evaluate(vm: UpdatingVMImpl): void;
50 handleException(): void;
51}
52export declare class ListItemOpcode extends TryOpcode {
53 key: unknown;
54 memo: Reference;
55 value: Reference;
56 retained: boolean;
57 index: number;
58 constructor(state: ResumableVMState, runtime: RuntimeContext, bounds: UpdatableBlock, key: unknown, memo: Reference, value: Reference);
59 updateReferences(item: OpaqueIterationItem): void;
60 shouldRemove(): boolean;
61 reset(): void;
62}
63export declare class ListBlockOpcode extends BlockOpcode {
64 private iterableRef;
65 type: string;
66 children: ListItemOpcode[];
67 private opcodeMap;
68 private marker;
69 private lastIterator;
70 protected readonly bounds: LiveBlockList;
71 constructor(state: ResumableVMState, runtime: RuntimeContext, bounds: LiveBlockList, children: ListItemOpcode[], iterableRef: Reference<OpaqueIterator>);
72 initializeChild(opcode: ListItemOpcode): void;
73 evaluate(vm: UpdatingVMImpl): void;
74 private sync;
75 private retainItem;
76 private insertItem;
77 private moveItem;
78 private deleteItem;
79}
80//# sourceMappingURL=update.d.ts.map
\No newline at end of file