Unwrap the Layout enum to replace it with the WidgetLayout struct now called Layout (#3448)

This commit is contained in:
Keavon Chambers
2025-12-04 15:24:40 -08:00
committed by GitHub
parent 3c4ad8b720
commit 783ea0b437
49 changed files with 205 additions and 254 deletions
+14 -14
View File
@@ -4,7 +4,7 @@ import { writable } from "svelte/store";
import { type Editor } from "@graphite/editor";
import {
patchWidgetLayout,
patchLayout,
UpdateDocumentBarLayout,
UpdateDocumentModeLayout,
UpdateToolOptionsLayout,
@@ -13,18 +13,18 @@ import {
UpdateNodeGraphControlBarLayout,
UpdateGraphViewOverlay,
UpdateGraphFadeArtwork,
type LayoutGroup,
} from "@graphite/messages";
import type { Layout } from "@graphite/messages";
export function createDocumentState(editor: Editor) {
const state = writable({
// Layouts
documentModeLayout: [] as LayoutGroup[],
toolOptionsLayout: [] as LayoutGroup[],
documentBarLayout: [] as LayoutGroup[],
toolShelfLayout: [] as LayoutGroup[],
workingColorsLayout: [] as LayoutGroup[],
nodeGraphControlBarLayout: [] as LayoutGroup[],
documentModeLayout: [] as Layout,
toolOptionsLayout: [] as Layout,
documentBarLayout: [] as Layout,
toolShelfLayout: [] as Layout,
workingColorsLayout: [] as Layout,
nodeGraphControlBarLayout: [] as Layout,
// Graph view overlay
graphViewOverlayOpen: false,
fadeArtwork: 100,
@@ -42,7 +42,7 @@ export function createDocumentState(editor: Editor) {
await tick();
update((state) => {
patchWidgetLayout(state.documentModeLayout, updateDocumentModeLayout);
patchLayout(state.documentModeLayout, updateDocumentModeLayout);
return state;
});
});
@@ -50,7 +50,7 @@ export function createDocumentState(editor: Editor) {
await tick();
update((state) => {
patchWidgetLayout(state.toolOptionsLayout, updateToolOptionsLayout);
patchLayout(state.toolOptionsLayout, updateToolOptionsLayout);
return state;
});
});
@@ -58,7 +58,7 @@ export function createDocumentState(editor: Editor) {
await tick();
update((state) => {
patchWidgetLayout(state.documentBarLayout, updateDocumentBarLayout);
patchLayout(state.documentBarLayout, updateDocumentBarLayout);
return state;
});
});
@@ -66,7 +66,7 @@ export function createDocumentState(editor: Editor) {
await tick();
update((state) => {
patchWidgetLayout(state.toolShelfLayout, updateToolShelfLayout);
patchLayout(state.toolShelfLayout, updateToolShelfLayout);
return state;
});
});
@@ -74,13 +74,13 @@ export function createDocumentState(editor: Editor) {
await tick();
update((state) => {
patchWidgetLayout(state.workingColorsLayout, updateWorkingColorsLayout);
patchLayout(state.workingColorsLayout, updateWorkingColorsLayout);
return state;
});
});
editor.subscriptions.subscribeJsMessage(UpdateNodeGraphControlBarLayout, (updateNodeGraphControlBarLayout) => {
update((state) => {
patchWidgetLayout(state.nodeGraphControlBarLayout, updateNodeGraphControlBarLayout);
patchLayout(state.nodeGraphControlBarLayout, updateNodeGraphControlBarLayout);
return state;
});
});