import { ExprTextSource } from "../base/virt"; import { VirtScriptObject } from "../script/virt"; import { VirtualElementSourceInfo, VirtualNode } from "./virt"; export enum ActionKind { ReplaceNode = "ReplaceNode", InsertChild = "InsertChild", DeleteChild = "DeleteChild", SetAttribute = "SetAttribute", SetElementSourceInfo = "SetElementSourceInfo", SetAnnotations = "SetAnnotations", SourceUriChanged = "SourceUriChanged", SetText = "SetText", SetElementSourceId = "SetElementSourceId", RemoveAttribute = "RemoveAttribute", } export type BaseAction = { kind: TKind; }; export type ReplaceNode = { replacement: VirtualNode; } & BaseAction; export type InsertChild = { child: VirtualNode; index: number; } & BaseAction; export type DeleteChild = { index: number; } & BaseAction; export type SetAttribute = { name: string; value?: string; } & BaseAction; export type SetElementSourceInfo = { value: VirtualElementSourceInfo; } & BaseAction; export type SetElementSourceId = { value: string; } & BaseAction; export type SetAnnotations = { value?: VirtScriptObject; } & BaseAction; export type RemoveAttribute = { name: string; } & BaseAction; export type SetText = { value: string; } & BaseAction; export type Action = | ReplaceNode | InsertChild | DeleteChild | SetElementSourceInfo | SetAttribute | SetAnnotations | SetElementSourceId | SetText | RemoveAttribute; export type Mutation = { nodePath: number[]; action: Action; };