yarn-spinner-runner-ts
Version:
TypeScript parser, compiler, and runtime for Yarn Spinner 3.x with React adapter [NPM package](https://www.npmjs.com/package/yarn-spinner-runner-ts)
53 lines (52 loc) • 1.06 kB
TypeScript
import type { MarkupParseResult } from "../markup/types.js";
export type IRProgram = {
enums: Record<string, string[]>;
nodes: Record<string, IRNode | IRNodeGroup>;
};
export type IRNode = {
title: string;
instructions: IRInstruction[];
when?: string[];
css?: string;
scene?: string;
};
export type IRNodeGroup = {
title: string;
nodes: IRNode[];
};
export type IRInstruction = {
op: "line";
speaker?: string;
text: string;
tags?: string[];
markup?: MarkupParseResult;
} | {
op: "command";
content: string;
} | {
op: "jump";
target: string;
} | {
op: "detour";
target: string;
} | {
op: "options";
options: Array<{
text: string;
tags?: string[];
css?: string;
markup?: MarkupParseResult;
condition?: string;
block: IRInstruction[];
}>;
} | {
op: "if";
branches: Array<{
condition: string | null;
block: IRInstruction[];
}>;
} | {
op: "once";
id: string;
block: IRInstruction[];
};