Commit Graph

14 Commits

Author SHA1 Message Date
dd371c404f feat: add Gitea Actions CI workflow
Some checks failed
CI / lint-and-typecheck (push) Successful in 40s
CI / build-frontend (push) Failing after 32s
Includes lint/typechecking (svelte-check) and frontend build stages,
triggered on push/PR to main/master/develop branches.
2026-05-23 12:06:00 +03:00
27b88917ed docs: simplify README.md for clarity and consistency 2026-05-23 10:12:53 +03:00
6488acc7b9 feat(optimize): support state diagrams in the Optimize panel
Extend the Diagram Doctor beyond flowcharts to stateDiagram / stateDiagram-v2.

- New parseStateDiagram: states → nodes, transitions → edges in source order
  (including `[*]` pseudo-transitions, so linkStyle indices stay aligned);
  `[*]` itself is never a node. Composite states map to groups, notes are
  skipped. A parseDiagram() dispatcher feeds analyze/transforms.
- Fixes are tailored per kind (verified empirically against Mermaid 11):
  * ELK is flowchart-only (state diagrams reject `layout: elk`), so it's not
    offered and the no-ELK score penalty is skipped for state diagrams.
  * Spacing uses the `state` config key; direction is set via a `direction`
    statement rather than the header.
  * State diagrams can't style individual transitions — a `linkStyle` line
    renders as a stray node — so the dim-hubs fix and focus mode fade the
    busy *states* (e.g. CANCELLED) via classDef/class instead of dimming edges.
    Flowcharts keep edge dimming via linkStyle.
- Panel notice now covers flowcharts & state diagrams.

Verified in-browser: state-diagram dim/focus render with zero junk nodes;
flowchart ELK + linkStyle dimming still intact.
2026-05-22 22:25:51 +03:00
e1b5f31f87 feat(ui): toggle the diagram-list sidebar
Add a ☰ toolbar button (and ⌘/Ctrl+B shortcut) to show/hide the left sidebar
for a wider editing/preview area. The preview re-fits when the sidebar — or the
Optimize panel — toggles, so the diagram stays centred.
2026-05-22 21:50:06 +03:00
c35960761b feat(git): sync with a remote — fetch, pull and push
Add remote sync to the Git panel: set/edit an origin URL, then fetch, pull
(fast-forward) and push, with live ahead/behind counts against the
remote-tracking branch.

Backend:
- git_ops: remote_status (git2 ahead/behind + upstream), set_remote, and
  fetch/pull/push that shell out to the system git CLI so they reuse the
  user's existing credentials (SSH agent, keychain / credential helpers)
  instead of reimplementing libgit2 credential callbacks. Pull is --ff-only
  to avoid leaving a conflicted tree from the GUI; push uses --set-upstream.
- New commands git_remote_status/set_remote/fetch/pull/push, registered.
- Test: push to a bare local remote, then assert upstream + ahead/behind.

Frontend:
- RemoteStatus type, api wrappers, store state (remote, syncing) with
  refreshRemote wired into refreshGit; pull reloads diagrams + open buffer.
- GitPanel remote section: URL, ahead/behind badges, Fetch/Pull/Push, and a
  set-remote dialog.

cargo test (7 passing incl. roundtrip), svelte-check and build all green.
2026-05-22 21:32:48 +03:00
6f23c620c1 feat(toolbar): copy diagram to clipboard as PNG
Add a "⧉ Copy" button that places the current diagram on the system clipboard
as a PNG via the async Clipboard API (ClipboardItem). The write is invoked
synchronously with the PNG handed over as a promise, so it stays inside the
click gesture WebKit requires.

PNG export and clipboard copy now re-render through renderRaster(), which
forces htmlLabels off via an injected init directive. Flowcharts otherwise emit
<foreignObject> HTML labels that taint the canvas and make toBlob()/clipboard
writes fail — this also fixes pre-existing flowchart PNG export. The live
preview and SVG export keep the richer foreignObject labels.

Verified end-to-end: renderRaster yields a foreignObject-free SVG, it
rasterizes without tainting, and clipboard.write resolves on a real click.
2026-05-22 21:12:54 +03:00
3918d5b8d2 fix(preview): keep diagram centred in split view
After pinning the SVG to its intrinsic size, the stage's layout box is often
wider than a narrow (split) canvas. CSS grid centring doesn't centre an
oversized item — it anchored the stage's left edge to the canvas, pushing the
transform-origin (and the scaled-down diagram) far to the right.

Centre the stage with absolute positioning at left/top 50% plus a
translate(-50%,-50%) prefix on the transform, so centring is independent of the
unscaled size. The grid still centres the empty/error messages. Verified the
diagram and the placeholder sit at offset 0 in a 691px split pane.
2026-05-22 20:41:09 +03:00
9f4929bffa fix(preview): pin SVG to intrinsic size for all diagram types
The previous fix only disabled useMaxWidth for flowcharts, so sequence (and
other) diagrams still rendered responsively and fit shrank them to a tiny
speck. Normalise every rendered SVG to its viewBox pixel size (stripping
width:100% / max-width) in the render path, so fit/zoom is exact regardless of
diagram type. Drops the now-redundant per-type flowchart flag.
2026-05-22 20:34:30 +03:00
49b6c5191e fix(preview): smooth trackpad zoom, crisp panning, correct fit on large diagrams
- Pan no longer ghosts/stutters: drop the always-on transform transition
  (it interpolated against every mousemove) in favour of will-change layer
  promotion; a short transition is pulsed only for button zoom / fit.
- Trackpad zoom is now continuous and cursor-anchored: zoom factor is
  exponential in wheel delta (clamped) instead of a fixed 10% per event, so
  macOS pinch feels smooth; mouse-wheel deltas are tamed by the same curve.
  Two-finger scroll now pans.
- Fit no longer ends up tiny on big diagrams: render flowcharts with
  useMaxWidth:false so the SVG's laid-out size equals its viewBox, making the
  fit/zoom maths exact (previously the SVG was shrunk responsively *and* again
  by fit). Lower the zoom floor so very large diagrams can fit fully.
2026-05-22 20:30:29 +03:00
bbc12ee4be feat(optimize): Diagram Doctor panel to declutter tangled flowcharts
Add an Optimize side panel that analyses the active flowchart and applies
one-click, reversible source rewrites to make dense graphs readable.

- optimize.ts: pure, label-aware flowchart parser + metrics, a 0-100
  readability score, and transforms — ELK layered layout, node/rank
  spacing + curved edges, de-emphasising cross-cutting hub edges
  (event bus / audit / cost-style fan-ins), duplicate-edge removal,
  direction toggle, and a non-destructive focus variant.
- mermaid.ts: register @mermaid-js/layout-elk so `layout: elk` renders.
- OptimizePanel.svelte + Toolbar toggle; panels are mutually exclusive.
- Preview: render the focus variant when a node is spotlighted, with a
  clear-focus pill.
- store/Editor: applySource() bumps a revision so programmatic rewrites
  re-sync CodeMirror and stay undoable with the editor's history.
2026-05-22 20:11:49 +03:00
b648ee904d feat(editor): Mermaid syntax highlighting, linter and autocomplete
- StreamLanguage tokenizer for Mermaid: diagram-type keywords, general
  keywords, directions, arrows/links, strings, %% comments, init
  directives and YAML frontmatter, with a dark-theme HighlightStyle
- live linter via mermaid.parse: maps parse errors to the right editor
  line (accounting for the frontmatter lines mermaid strips), with wavy
  underline, gutter marker and message tooltip
- autocomplete: Mermaid keyword/type/direction options plus starter
  diagram snippets offered on the first line; bracket closing
- dark-themed completion + diagnostic tooltips

Adds @codemirror/lint, @codemirror/autocomplete and @lezer/highlight.
2026-05-22 16:46:43 +03:00
29bf6438b3 feat(frontend): Svelte editor, live preview and Git panel
- CodeMirror 6 editor with a debounced Mermaid 11 preview (zoom, pan,
  auto fit-to-view and inline error reporting)
- project start screen with recent projects, sidebar diagram explorer,
  toolbar and a Git panel (status, commit, history, branches)
- SVG/PNG export, per-project theme switching, toasts
- rune-based central store orchestrating all backend calls
- view modes (Code / Split / Preview) plus a viewer mode with a
  slide-in quick-edit drawer (Cmd/Ctrl+E)
2026-05-22 16:27:28 +03:00
890390bc65 feat(backend): Rust core for projects, diagrams and Git
- sqlx/SQLite registry of known projects + user settings (db.rs)
- project create/open with mermix.toml config and slugged paths (project.rs)
- diagram CRUD on .mmd files with frontmatter titles and path-traversal
  guards (diagram.rs)
- git2-backed versioning: commit-all, history, branches, checkout,
  working-tree status (git_ops.rs)
- Tauri command surface, shared state and unified error type
- headless tests covering project creation, diagram CRUD and branch
  isolation (tests.rs)
2026-05-22 16:27:20 +03:00
dfafea41f4 chore: scaffold Tauri 2 + Svelte 5 workspace
Standard Tauri layout with a Svelte 5 + TypeScript + Vite frontend and a
Rust backend in src-tauri. Adds build tooling, app/window config,
capabilities, generated icons and the project README.
2026-05-22 16:27:11 +03:00