Add M3: APPDATA persistence + presets + per-pane distro/label

Backend:
- save_workspace / load_workspace Tauri commands writing to
  %APPDATA%\com.megaproxy.tiletopia\workspace.json with atomic
  tmp+rename. Path from app.path().app_config_dir() (no dirs crate).

Layout helpers:
- tree.ts: changeDistro (with id swap to force XtermPane remount via
  {#key}), changeLabel, presetSingle / TwoColumns / ThreeColumns /
  TwoRows / TwoByTwo.
- New ops.ts with PaneOps interface bundling split / close /
  setDistro / setLabel / distros, drilled through Pane chain
  instead of individual callbacks.

UI:
- LeafPane: in-toolbar editable label (click to rename, Enter
  saves, Esc cancels) and distro chip popover. Picking a different
  distro respawns the pane.
- App.svelte: migrated from localStorage to APPDATA via the new
  Tauri commands, debounced 500ms. One-time localStorage migration
  on boot. Split inherits parent's distro+cwd. Titlebar preset
  buttons with confirm when replacing >1 pane.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
megaproxy 2026-05-22 12:55:46 +01:00
parent 1869d08181
commit 64b90ebddb
10 changed files with 434 additions and 74 deletions

View file

@ -1,23 +1,22 @@
<script lang="ts">
import type { TreeNode, NodeId, Orientation } from "./tree";
import type { TreeNode } from "./tree";
import type { PaneOps } from "./ops";
import SplitNode from "./SplitNode.svelte";
import LeafPane from "./LeafPane.svelte";
let {
node,
onSplit,
onClose,
ops,
}: {
node: TreeNode;
onSplit: (leafId: NodeId, orientation: Orientation) => void;
onClose: (leafId: NodeId) => void;
ops: PaneOps;
} = $props();
</script>
{#if node.kind === "split"}
<SplitNode {node} {onSplit} {onClose} />
<SplitNode {node} {ops} />
{:else}
{#key node.id}
<LeafPane leaf={node} {onSplit} {onClose} />
<LeafPane leaf={node} {ops} />
{/key}
{/if}