multi-window support (#62)

This commit is contained in:
Mike Sawka
2024-06-19 19:10:53 -07:00
committed by GitHub
parent 5c6cfbc112
commit fb668fd4e5
14 changed files with 423 additions and 126 deletions
+4 -4
View File
@@ -60,6 +60,10 @@
&.block-preview {
background-color: var(--main-bg-color);
.block-frame-tech-close {
display: none;
}
}
&.block-focused {
@@ -68,10 +72,6 @@
.block-frame-tech-header {
color: var(--main-text-color);
}
.block-frame-tech-close {
display: none;
}
}
.block-frame-tech-header {
+15 -6
View File
@@ -21,18 +21,24 @@ export const BlockService = new BlockServiceType()
// clientservice.ClientService (client)
class ClientServiceType {
FocusWindow(arg2: string): Promise<void> {
return WOS.callBackendService("client", "FocusWindow", Array.from(arguments))
}
GetClientData(): Promise<Client> {
return WOS.callBackendService("client", "GetClientData", Array.from(arguments))
}
GetTab(arg1: string): Promise<Tab> {
return WOS.callBackendService("client", "GetTab", Array.from(arguments))
}
GetWindow(arg1: string): Promise<Window> {
GetWindow(arg1: string): Promise<WaveWindow> {
return WOS.callBackendService("client", "GetWindow", Array.from(arguments))
}
GetWorkspace(arg1: string): Promise<Workspace> {
return WOS.callBackendService("client", "GetWorkspace", Array.from(arguments))
}
MakeWindow(): Promise<WaveWindow> {
return WOS.callBackendService("client", "MakeWindow", Array.from(arguments))
}
}
export const ClientService = new ClientServiceType()
@@ -59,11 +65,6 @@ class ObjectServiceType {
return WOS.callBackendService("object", "AddTabToWorkspace", Array.from(arguments))
}
// @returns object updates
CloseTab(tabId: string): Promise<void> {
return WOS.callBackendService("object", "CloseTab", Array.from(arguments))
}
// @returns blockId (and object updates)
CreateBlock(blockDef: BlockDef, rtOpts: RuntimeOpts): Promise<string> {
return WOS.callBackendService("object", "CreateBlock", Array.from(arguments))
@@ -109,6 +110,14 @@ export const ObjectService = new ObjectServiceType()
// windowservice.WindowService (window)
class WindowServiceType {
// @returns object updates
CloseTab(arg3: string): Promise<void> {
return WOS.callBackendService("window", "CloseTab", Array.from(arguments))
}
CloseWindow(arg2: string): Promise<void> {
return WOS.callBackendService("window", "CloseWindow", Array.from(arguments))
}
// @returns object updates
SetWindowPosAndSize(arg2: string, arg3: Point, arg4: WinSize): Promise<void> {
return WOS.callBackendService("window", "SetWindowPosAndSize", Array.from(arguments))
+1 -1
View File
@@ -313,7 +313,7 @@ const TabBar = ({ workspace }: TabBarProps) => {
};
const handleCloseTab = (tabId: string) => {
services.ObjectService.CloseTab(tabId);
services.WindowService.CloseTab(tabId);
deleteLayoutStateAtomForTab(tabId);
};
+14 -13
View File
@@ -31,7 +31,7 @@ declare global {
type BlockCommand = {
command: string;
} & ( BlockAppendIJsonCommand | ResolveIdsCommand | BlockInputCommand | BlockSetViewCommand | BlockSetMetaCommand | BlockGetMetaCommand | BlockMessageCommand | BlockAppendFileCommand );
} & ( BlockSetMetaCommand | BlockGetMetaCommand | BlockMessageCommand | BlockAppendFileCommand | BlockAppendIJsonCommand | ResolveIdsCommand | BlockInputCommand | BlockSetViewCommand );
// wstore.BlockDef
type BlockDef = {
@@ -84,6 +84,7 @@ declare global {
// wstore.Client
type Client = WaveObj & {
mainwindowid: string;
windowids: string[];
meta: MetaType;
};
@@ -253,6 +254,18 @@ declare global {
obj?: WaveObj;
};
// wstore.Window
type WaveWindow = WaveObj & {
workspaceid: string;
activetabid: string;
activeblockid?: string;
activeblockmap: {[key: string]: string};
pos: Point;
winsize: WinSize;
lastfocusts: number;
meta: MetaType;
};
// service.WebCallType
type WebCallType = {
service: string;
@@ -275,18 +288,6 @@ declare global {
height: number;
};
// wstore.Window
type WaveWindow = WaveObj & {
workspaceid: string;
activetabid: string;
activeblockid?: string;
activeblockmap: {[key: string]: string};
pos: Point;
winsize: WinSize;
lastfocusts: number;
meta: MetaType;
};
// wstore.Workspace
type Workspace = WaveObj & {
name: string;
+2
View File
@@ -27,6 +27,8 @@ function matchViewportSize() {
document.body.style.height = window.visualViewport.height + "px";
}
document.title = `The Next Wave (${windowId.substring(0, 8)})`;
matchViewportSize();
document.addEventListener("DOMContentLoaded", async () => {