Skip to content

feat(gui): Svelte layer list + layer editors (#217) - #224

Merged
CameronBrooks11 merged 1 commit into
mainfrom
feat/svelte-layers
Jun 26, 2026
Merged

CameronBrooks11 merged 1 commit into
mainfrom
feat/svelte-layers

Conversation

@CameronBrooks11

Copy link
Copy Markdown
Member

Part of #217 (project & layer editing). This is the layer-editing half — layer list + reordering + the three layer editors. File operations (open/save/export + dirty prompt) follow in a second PR that closes #217. Part of epic #214 (strangler-on-main: React still ships; Svelte stays behind the dev-only entry and out of vite build).

What changed

  • Layer state — project-session.svelte.ts gains the layer operations deferred from Svelte 5 foundation + config-forms vertical slice (decision gate) #215: addLayer / removeLayer / updateLayer / reorderLayers / duplicateLayer / selectLayer, plus a selectedLayer derived. Selection is session-only (never dirties the document); document mutations bump the revision.
  • Layer list — LayerList.svelte replaces LayerStack + LayerRow and drops @hello-pangea/dnd: reordering is native HTML5 drag for pointer plus ArrowUp/Down on the drag handle for keyboard accessibility. Add (type picker) / select / duplicate / remove all ported at parity.
  • Editors — HoopLayerEditor / SkipLayerEditor / HelicalLayerEditor ported to Svelte, reusing the framework-agnostic helicalValidation.ts unchanged: debounced live + on-blur validation, backend-error precedence, integer parsing for pattern/skip, the coprime cross-field rule (editing pattern or skip re-validates both), and the geometry hint (skip≥pattern / circuit-divisibility). The circuit-mismatch messaging the issue calls out is intact.
  • Primitive unification — the editors reuse the single NumberField primitive (now with an optional tooltip) instead of a second numeric-input component.
  • Wired into the GUI shell: Prepare/Machine workspace, regions, menu + status bar, restrained desktop redesign #216 shell: layer list in the left inspector, the selected layer's editor in the right "Layer Properties" inspector.

@hello-pangea/dnd

Still in package.json because the live React LayerStack still uses it; no Svelte file imports it. It's removed at the #221 cutover when React goes.

Verification

  • Local gate green: tsc, svelte-check (0 errors), 678 vitest tests (+15), coverage 83.7/74.4/81.6/82.7 (> 60/65/50/60), stylelint, lint:css:vars, vite build, bundle budget.
  • Production bundle unchanged: index-*.js still 595.75 kB (Svelte not in the rollup input).
  • Visual + functional parity confirmed in-browser: add Helical → editor renders with correct defaults; set skip=6 (pattern 3) → both fields flag "Pattern and skip must be coprime" + the geometry-hint warning; select/duplicate/remove and keyboard/drag reorder all work.
  • Adversarially reviewed before commit (findings folded in).

Notes for reviewers

  • No change to the Python backend, OpenAPI contract, Rust shell, or the shipped React app.
  • Preview: http://localhost:5173/index.svelte.html → Prepare workspace → Layers.

Part of #214, part of #217.

Layer-editing half of #217 (file ops follow in a second PR). Part of epic #214,
strangler-on-main: React still ships; Svelte stays behind the dev-only entry and
out of the production bundle (unchanged at 595.75 kB).

- project-session.svelte.ts gains the layer ops deferred from #215: add / remove
  / update / reorder / duplicate / selectLayer + a selectedLayer derived.
  Selection is session-only (never dirties the document).
- LayerList.svelte replaces LayerStack + LayerRow and drops @hello-pangea/dnd
  from the Svelte path: native HTML5 drag for pointer + ArrowUp/Down on the drag
  handle for keyboard reorder. Add (type picker) / select / duplicate / remove
  at parity. (@hello-pangea/dnd stays in package.json until the React app is
  removed at #221.)
- Hoop / Skip / Helical editors ported, reusing helicalValidation.ts unchanged:
  debounced + on-blur + on-mount validation (via $effect, matching React's
  validate-on-store-value model), backend-error precedence, integer parsing for
  pattern/skip, the coprime cross-field rule, and the geometry hint.
- Editors reuse the single NumberField primitive (now with an optional tooltip).
- Wired into the #216 shell: list in the left inspector, selected editor in the
  right Layer Properties inspector.

680 tests; coverage 83.7/74.3/81.7/82.6. Adversarially reviewed (mount-validation
parity, coprime/aliasing guards folded in).

Refs #214, refs #217
@CameronBrooks11 CameronBrooks11 added the gui Pull requests that update GUI components label Jun 26, 2026
@CameronBrooks11
CameronBrooks11 merged commit e0468ab into main Jun 26, 2026
18 checks passed
@CameronBrooks11
CameronBrooks11 deleted the feat/svelte-layers branch June 26, 2026 22:19
CameronBrooks11 added a commit that referenced this pull request Jun 26, 2026
Closes #217 (file-operations half; editing landed in #224). Part of epic #214,
strangler-on-main: React still ships; Svelte stays behind the dev-only entry and
out of the production bundle (unchanged at 595.75 kB).

- file-operations.svelte.ts: new/open/openRecent/save/saveAs/exportGcode against
  projectSession, reusing commands (save/load/planWind), @tauri-apps/plugin-dialog,
  WindDefinitionSchema validation, and recentFiles. Dirty prompt preserved; a
  failed save keeps the doc dirty; declined prompt / cancelled dialog leave it
  untouched. Errors notify + return false (no unhandled rejections from handlers).
- notifications.svelte.ts runes store + Toasts.svelte renderer (self-contained
  scoped styles), replacing the Zustand toastStore + ToastContainer; wired into
  App.svelte. (Toast portion of #220, brought forward as a file-ops dependency.)
- MenuBar File/Edit items enabled + wired; keyboard shortcuts Ctrl/Cmd+N/O/S,
  +Shift+S, +E, +D, Delete (skipped while typing; Alt excluded so AltGr is safe).
- Domain/state split: ProjectDocument + createEmptyDocument extracted to a plain
  types/document.ts (shared by tsc-checked modules); added windDefinitionToDocument.

696 tests; coverage 83.0/72.6/81.7/82.x. Adversarially reviewed (a toast-styling
defect — the Svelte entry never imported ToastContainer.css — caught and fixed
with self-contained scoped styles + a Toasts render test).

Closes #217. Refs #214
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gui Pull requests that update GUI components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Migrate project & layer editing to Svelte (editors, native reorder, file ops, export)

1 participant