Skip to content

Feat/svelte export webview#25

Merged
ulysse-bouchet-simvia merged 7 commits intomainfrom
feat/svelte-export-webview
Apr 20, 2026
Merged

Feat/svelte export webview#25
ulysse-bouchet-simvia merged 7 commits intomainfrom
feat/svelte-export-webview

Conversation

@ulysse-bouchet-simvia
Copy link
Copy Markdown
Collaborator

[1.8.0] - 2026-04-20

Full rewrite of the .export form in Svelte + Tailwind, first-class language support for .export files (syntax highlighting, formatter, format-on-save), and a batch of UX upgrades.

Added

  • Redesigned export form — rewritten in Svelte 5 + Tailwind 4, styled with VS Code theme tokens (--vscode-input-*, --vscode-focusBorder, --vscode-editorWarning-foreground, ...), so it looks native in every theme.
    • Tab icon is a blue pencil; tab title lives-updates to match the filename (falls back to untitled).
    • Titles inside the form adapt to mode: "Create a new export file" vs "Edit an export file".
    • New export files are pre-seeded with a sensible default: comm + mmed inputs and an rmed output, filenames simvia.comm / simvia.mmed / simvia.rmed.
    • .export extension locked as a visual suffix on the filename field — it can't be edited away.
    • Nested paths supported in the filename (subdir/file.export); missing folders are created on save.
    • Unsaved drafts persist via vscode.setState + retainContextWhenHidden, so switching tabs or reloading the panel no longer clears the form.
  • File rows — drag-to-reorder (powered by svelte-dnd-action, theme-colored drop zones, keyboard-accessible); per-row × delete; full-width "Add input/output file" button at the end of each section.
    • Type dropdown is filtered by direction (inputs vs outputs) and shows a Type placeholder on new rows; the file-type list is the full code_aster set (comm, mmed, rmed, mess, nom, base, mail, libr, tab, msh, dat).
    • Unit auto-increment scoped to the same type and max+1 (so med: 20, 50 → next is 51, not 21), idempotent when re-picking the same type; nom rows are locked to unit 0; ArrowUp/Down steps integer inputs.
    • Name autocomplete list matches the type dropdown styling; empty rows (no type and no name) are ignored by validation and on save.
  • Validation — per-field inline error messages, a sticky footer with clickable error / warning counts that smooth-scroll to the corresponding panel.
    • Blocking errors: filename required, parameters must be integers, at least one comm input file required.
    • Non-blocking warnings: duplicate unit across files (listing the file names), no mesh file set, no rmed output set, rename-in-edit-mode (tells the user the original file will be deleted).
  • .export language support — new TextMate grammar (source.export) colors P/F directives, parameter names, file types, direction flags (D vs R/RC), unit numbers, and # comments.
  • Document formatter for .export — available via Format Document. On save/create the form applies the same formatter automatically:
    • Groups lines into # Simulation parameters, # Input files, # Output files sections separated by blank lines.
    • Sorts F lines within each direction by a canonical type priority (comm, mmed, rmed, mess, nom, base, mail, libr, tab, msh, dat).
    • Keeps standalone # comments attached to the line they precede.
    • Emits a three-line header at the top crediting VS Code Aster and Simvia; re-saving is idempotent (no stacked headers).
  • Dedicated pencil icon (media/images/icone-edit.svg) for the "Edit export file" command, replacing the plain $(book) codicon.
  • Extension now activates on onLanguage:export, so opening a .export file registers the formatter without any prior command run.
  • Refreshed Simvia logo (new SVG), separate light/dark variants for both Simvia and code_aster logos in the form header.

Changed

  • Editing a file and changing its name now renames the file on disk (old file is deleted after the new one is written). A warning panel previews the rename before the user saves.
  • When writing a file, the output is always formatted (P/F grouping, section headers, shoutout) — so files stay clean across multiple save cycles.

Fixed

  • Loading an existing .export into the form (e.g. after a tab switch) no longer clobbers the pre-filled data with the seeded default.
  • Removing the last row no longer leaves stale autocomplete suggestions keyed to the dead row.
  • Missing parent directories no longer cause save to fail silently when the filename contains a path separator.

Removed

  • The legacy vanilla HTML/CSS/JS export form (webviews/export/export.{html,css,js}) and its hardcoded blue-on-light styling.
  • Unused media assets: media/images/aster.png, media/icons/3d.svg, media/icons/3d_light.svg.

Replace the vanilla HTML/CSS/JS export webview with a Svelte 5 + Tailwind 4
implementation that uses VS Code theme tokens, so the form looks native in
every theme instead of hardcoded light-blue. Add a ready handshake to fix
the initial-message race with the async module load, normalize unit
validation to strings (unit 0 freely reusable), and associate labels with
inputs. Refresh the Simvia and code_aster logos with dedicated dark-theme
variants, and swap the Edit-export-file command icon for a colored
pencil-on-document SVG matching the other command icons.
Drop aster.png (superseded by code-aster.svg) and media/icons/3d.svg /
3d_light.svg, which are not referenced anywhere in the code or README.
Register a TextMate grammar for the export language so P/F lines,
directions (D/R/RC), and trailing # comments get colored by the active
theme, instead of being rendered as plain text.
Register a DocumentFormattingEditProvider so "Format Document" on a
.export file groups lines into sections (parameters, inputs, results)
ordered by file-type priority (comm, *med, rmed, other, mess), with
comments travelling with the line they precede. Activate the extension
on .export so the provider is registered before the user invokes format.
Major pass on the export form: native VS Code input styling, sticky
submit bar with click-to-scroll error/warning counts, drag-to-reorder
rows via svelte-dnd-action (with theme-colored drop zone), direction-
filtered type dropdowns with a placeholder, per-row delete, same-type
scoped unit auto-increment, arrow-key integer stepping, .export suffix
locked on the filename field, and draft persistence so switching tabs
no longer loses in-progress edits. New files are pre-seeded with a
comm+mmed+rmed starter and a "comm is required" blocker. Saving a
renamed file now deletes the old one (previewed as a warning).
The formatter emits a file-header shoutout, three section comments
("# Simulation parameters", "# Input files", "# Output files"), sorts
F lines by a canonical type priority, and is applied on every save so
files stay clean across edits.
Add the 1.8.0 changelog entry covering the Svelte rewrite, new UX,
validation overhaul, syntax highlighting, formatter, and format-on-save.
Refresh the README section about the export form to match the new
behavior (pencil icon, live tab title, locked .export suffix, drag-to-
reorder, inline validation, sticky footer, formatter) and mention the
export webview in the architecture overview.
@ulysse-bouchet-simvia ulysse-bouchet-simvia self-assigned this Apr 20, 2026
@ulysse-bouchet-simvia ulysse-bouchet-simvia merged commit 361a378 into main Apr 20, 2026
4 checks passed
@ulysse-bouchet-simvia ulysse-bouchet-simvia deleted the feat/svelte-export-webview branch April 20, 2026 09:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant