marko
Version:
Optimized runtime for Marko templates.
36 lines (35 loc) • 1.4 kB
TypeScript
import { type AwaitCounter, type EncodedAccessor, type Scope } from "../common/types";
import { type Signal } from "./signals";
type ResumeFn = (ctx: SerializeContext) => unknown;
type ResumeData = (string | number | (string | number)[] | ResumeFn)[];
interface SerializeContext {
(data: number | (Scope | number)[], registryId?: string): unknown;
_: Record<string, unknown>;
}
export interface Renders {
(renderId: string): RenderData;
[renderId: string]: RenderData;
}
export interface RenderData {
i: string;
v: Comment[];
r?: ResumeData;
w(): void;
m?(effects: unknown[]): unknown[];
b?: Record<string, ResumeData>;
d: never;
l: never;
x: never;
j?: never;
p?: Record<string | number, AwaitCounter>;
}
export declare function enableBranches(): void;
export declare function ready(readyId: string): void;
export declare function initEmbedded(readyId: string, runtimeId?: string): void;
export declare function init(runtimeId?: string): void;
export declare let isResuming: undefined | 0 | 1;
export declare function getRegisteredWithScope(id: string, scope?: Scope): unknown;
export declare function _resume<T>(id: string, obj: T): T;
export declare function _var_resume<T extends Signal<unknown>>(id: string, signal: T): T;
export declare function _el(id: string, accessor: EncodedAccessor): (scope: Scope) => () => any;
export {};