editor.addSecondaryImport()} />
- editor.handle.addSecondaryExport()} />
+ editor.addSecondaryExport()} />
{/if}
@@ -522,7 +521,7 @@
style:--node-chain-area-left-extension={layerChainWidth !== 0 ? layerChainWidth + 0.5 : 0}
data-tooltip-label={nodeNameTooltipLabel(node)}
data-tooltip-description={`
- ${(description || "").trim()}${editor.handle.inDevelopmentMode() ? `\n\nID: ${node.id}. Position: (${node.position[0]}, ${node.position[1]}).` : ""}
+ ${(description || "").trim()}${editor.inDevelopmentMode() ? `\n\nID: ${node.id}. Position: (${node.position[0]}, ${node.position[1]}).` : ""}
`.trim()}
data-node={node.id}
>
@@ -685,7 +684,7 @@
style:--data-color-dim={`var(--color-data-${(node.primaryOutput?.dataType || "General").toLowerCase()}-dim)`}
data-tooltip-label={nodeNameTooltipLabel(node)}
data-tooltip-description={`
- ${(description || "").trim()}${editor.handle.inDevelopmentMode() ? `\n\nID: ${node.id}. Position: (${node.position[0]}, ${node.position[1]}).` : ""}
+ ${(description || "").trim()}${editor.inDevelopmentMode() ? `\n\nID: ${node.id}. Position: (${node.position[0]}, ${node.position[1]}).` : ""}
`.trim()}
data-node={node.id}
>
diff --git a/frontend/src/components/widgets/WidgetSection.svelte b/frontend/src/components/widgets/WidgetSection.svelte
index 0314eb3114..db82e9515e 100644
--- a/frontend/src/components/widgets/WidgetSection.svelte
+++ b/frontend/src/components/widgets/WidgetSection.svelte
@@ -1,8 +1,7 @@
@@ -31,7 +30,7 @@
tooltipDescription={widgetData.pinned ? "Unpin this node so it's no longer shown here when nothing is selected." : "Pin this node so it's shown here when nothing is selected."}
size={24}
action={(e) => {
- editor.handle.setNodePinned(widgetData.id, !widgetData.pinned);
+ editor.setNodePinned(widgetData.id, !widgetData.pinned);
e?.stopPropagation();
}}
class="show-only-on-hover"
@@ -41,7 +40,7 @@
tooltipDescription="Delete this node from the layer chain."
size={24}
action={(e) => {
- editor.handle.deleteNode(widgetData.id);
+ editor.deleteNode(widgetData.id);
e?.stopPropagation();
}}
class="show-only-on-hover"
@@ -52,7 +51,7 @@
tooltipDescription={widgetData.visible ? "Hide this node." : "Show this node."}
size={24}
action={(e) => {
- editor.handle.toggleNodeVisibilityLayerPanel(widgetData.id);
+ editor.toggleNodeVisibilityLayerPanel(widgetData.id);
e?.stopPropagation();
}}
class={widgetData.visible ? "show-only-on-hover" : ""}
diff --git a/frontend/src/components/widgets/WidgetSpan.svelte b/frontend/src/components/widgets/WidgetSpan.svelte
index 43aba10b9b..3feaebe11d 100644
--- a/frontend/src/components/widgets/WidgetSpan.svelte
+++ b/frontend/src/components/widgets/WidgetSpan.svelte
@@ -1,8 +1,7 @@
diff --git a/frontend/src/components/window/Panel.svelte b/frontend/src/components/window/Panel.svelte
index 839b871e1d..c10a555d38 100644
--- a/frontend/src/components/window/Panel.svelte
+++ b/frontend/src/components/window/Panel.svelte
@@ -1,7 +1,7 @@
- panelType && editor.handle.setActivePanel(panelType)} class={`panel ${className}`.trim()} {classes} style={styleName} {styles}>
+ panelType && editor.setActivePanel(panelType)} class={`panel ${className}`.trim()} {classes} style={styleName} {styles}>
{#each tabLabels as tabLabel, tabIndex}
diff --git a/frontend/src/components/window/StatusBar.svelte b/frontend/src/components/window/StatusBar.svelte
index a246d3ef2f..1b8f53ed0b 100644
--- a/frontend/src/components/window/StatusBar.svelte
+++ b/frontend/src/components/window/StatusBar.svelte
@@ -2,32 +2,33 @@
import { getContext, onMount, onDestroy } from "svelte";
import type { Layout } from "@graphite/../wasm/pkg/graphite_wasm";
- import type { Editor } from "@graphite/editor";
+ import type { SubscriptionsRouter } from "/src/subscriptions-router";
import { patchLayout } from "@graphite/utility-functions/widgets";
import LayoutRow from "@graphite/components/layout/LayoutRow.svelte";
import Separator from "@graphite/components/widgets/labels/Separator.svelte";
import WidgetLayout from "@graphite/components/widgets/WidgetLayout.svelte";
- const editor = getContext("editor");
+ const subscriptions = getContext("subscriptions");
let statusBarHintsLayout: Layout = [];
let statusBarInfoLayout: Layout = [];
onMount(() => {
- editor.subscriptions.subscribeLayoutUpdate("StatusBarHints", (data) => {
+ subscriptions.subscribeLayoutUpdate("StatusBarHints", (data) => {
patchLayout(statusBarHintsLayout, data);
statusBarHintsLayout = statusBarHintsLayout;
});
- editor.subscriptions.subscribeLayoutUpdate("StatusBarInfo", (data) => {
+
+ subscriptions.subscribeLayoutUpdate("StatusBarInfo", (data) => {
patchLayout(statusBarInfoLayout, data);
statusBarInfoLayout = statusBarInfoLayout;
});
});
onDestroy(() => {
- editor.subscriptions.unsubscribeLayoutUpdate("StatusBarHints");
- editor.subscriptions.unsubscribeLayoutUpdate("StatusBarInfo");
+ subscriptions.unsubscribeLayoutUpdate("StatusBarHints");
+ subscriptions.unsubscribeLayoutUpdate("StatusBarInfo");
});
diff --git a/frontend/src/components/window/TitleBar.svelte b/frontend/src/components/window/TitleBar.svelte
index 618057805e..e0650734cb 100644
--- a/frontend/src/components/window/TitleBar.svelte
+++ b/frontend/src/components/window/TitleBar.svelte
@@ -2,12 +2,12 @@
import { getContext, onMount, onDestroy } from "svelte";
import { isPlatformNative } from "@graphite/../wasm/pkg/graphite_wasm";
- import type { Layout } from "@graphite/../wasm/pkg/graphite_wasm";
- import type { Editor } from "@graphite/editor";
+ import type { EditorHandle, Layout } from "@graphite/../wasm/pkg/graphite_wasm";
import type { AppWindowStore } from "@graphite/stores/app-window";
import { enterFullscreen, exitFullscreen } from "@graphite/stores/fullscreen";
import type { FullscreenStore } from "@graphite/stores/fullscreen";
import type { TooltipStore } from "@graphite/stores/tooltip";
+ import type { SubscriptionsRouter } from "/src/subscriptions-router";
import { patchLayout } from "@graphite/utility-functions/widgets";
import LayoutRow from "@graphite/components/layout/LayoutRow.svelte";
@@ -16,8 +16,9 @@
const keyboardLockApiSupported = navigator.keyboard !== undefined && "lock" in navigator.keyboard;
+ const editor = getContext("editor");
+ const subscriptions = getContext("subscriptions");
const appWindow = getContext("appWindow");
- const editor = getContext("editor");
const fullscreen = getContext("fullscreen");
const tooltip = getContext("tooltip");
@@ -29,14 +30,14 @@
$: height = $appWindow.platform === "Mac" ? 28 * (1 / $appWindow.uiScale) : 28;
onMount(() => {
- editor.subscriptions.subscribeLayoutUpdate("MenuBar", (data) => {
+ subscriptions.subscribeLayoutUpdate("MenuBar", (data) => {
patchLayout(menuBarLayout, data);
menuBarLayout = menuBarLayout;
});
});
onDestroy(() => {
- editor.subscriptions.unsubscribeLayoutUpdate("MenuBar");
+ subscriptions.unsubscribeLayoutUpdate("MenuBar");
});
@@ -48,7 +49,7 @@
{/if}
- !isFullscreen && editor.handle.appWindowDrag()} on:dblclick={() => !isFullscreen && editor.handle.appWindowMaximize()} />
+ !isFullscreen && editor.appWindowDrag()} on:dblclick={() => !isFullscreen && editor.appWindowMaximize()} />
{#if $appWindow.platform !== "Mac"}
@@ -60,20 +61,20 @@
: undefined}
tooltipShortcut={$tooltip.fullscreenShortcut}
on:click={() => {
- if (isPlatformNative()) editor.handle.appWindowFullscreen();
+ if (isPlatformNative()) editor.appWindowFullscreen();
else ($fullscreen.windowFullscreen ? exitFullscreen : enterFullscreen)();
}}
>
{:else}
- editor.handle.appWindowMinimize()}>
+ editor.appWindowMinimize()}>
- editor.handle.appWindowMaximize()}>
+ editor.appWindowMaximize()}>
- editor.handle.appWindowClose()}>
+ editor.appWindowClose()}>
{/if}
diff --git a/frontend/src/components/window/Workspace.svelte b/frontend/src/components/window/Workspace.svelte
index f19de9737b..6a57f98e93 100644
--- a/frontend/src/components/window/Workspace.svelte
+++ b/frontend/src/components/window/Workspace.svelte
@@ -1,8 +1,7 @@