waveterm/frontend/types/custom.d.ts
Evan Simkowitz f12e246c15
Break layout node into its own Wave Object (#21)
I am updating the layout node setup to write to its own wave object. 

The existing setup requires me to plumb the layout updates through every
time the tab gets updated, which produces a lot of annoying and
unintuitive design patterns. With this new setup, the tab object doesn't
get written to when the layout changes, only the layout object will get
written to. This prevents collisions when both the tab object and the
layout node object are getting updated, such as when a new block is
added or deleted.
2024-06-05 17:21:40 -07:00

115 lines
2.1 KiB
TypeScript

// Copyright 2024, Command Line Inc.
// SPDX-License-Identifier: Apache-2.0
declare global {
type UIContext = {
windowid: string;
activetabid: string;
};
type MetadataType = { [key: string]: any };
type ORef = {
otype: string;
oid: string;
};
interface WaveObj {
otype: string;
oid: string;
version: number;
}
type WaveObjUpdate = {
updatetype: "update" | "delete";
otype: string;
oid: string;
obj?: WaveObj;
};
type Block = WaveObj & {
blockdef: BlockDef;
controller: string;
view: string;
meta?: { [key: string]: any };
runtimeopts?: RuntimeOpts;
};
type BlockDef = {
controller?: string;
view?: string;
files?: { [key: string]: FileDef };
meta?: { [key: string]: any };
};
type FileDef = {
filetype?: string;
path?: string;
url?: string;
content?: string;
meta?: { [key: string]: any };
};
type TermSize = {
rows: number;
cols: number;
};
type Client = {
otype: string;
oid: string;
version: number;
mainwindowid: string;
};
type Tab = {
otype: string;
oid: string;
version: number;
name: string;
blockids: string[];
layoutNode: string;
};
type Point = {
x: number;
y: number;
};
type WinSize = {
width: number;
height: number;
};
type Workspace = {
otype: string;
oid: string;
version: number;
name: string;
tabids: string[];
};
type RuntimeOpts = {
termsize?: TermSize;
winsize?: WinSize;
};
type WaveWindow = {
otype: string;
oid: string;
version: number;
workspaceid: string;
activetabid: string;
activeblockmap: { [key: string]: string };
pos: Point;
winsize: WinSize;
lastfocusts: number;
};
type TabLayoutData = {
blockId: string;
};
}
export {};