Skip to content

feat: rework clip catalog (group paste, folder metadata, panel polish)#215

Open
fuzzzerd wants to merge 6 commits into
masterfrom
fuzzz/group-paste-folder-hierarchy
Open

feat: rework clip catalog (group paste, folder metadata, panel polish)#215
fuzzzerd wants to merge 6 commits into
masterfrom
fuzzz/group-paste-folder-hierarchy

Conversation

@fuzzzerd
Copy link
Copy Markdown
Owner

@fuzzzerd fuzzzerd commented May 19, 2026

Summary

Reworks how the clip catalog ingests, stores, and presents script and table clips. The branch grew from the original Group paste task into a broader catalog overhaul because the dependencies surfaced as I went; everything below either supports or builds on the Group-paste flow.

Closes #206

What's in here

Clip ingestion

  • Pasted <Script> and <BaseTable> clips now adopt their FileMaker-side name automatically — no more new-clip placeholders when the source XML already carries a name.
  • Pasted script Groups decompose into one clip per <Script>, mirroring the Group hierarchy as folders. Loose scripts at the snippet root share the paste root; nested Groups produce nested folders. Single-clip paste behaviour is unchanged.
  • Group attributes (id, includeInMenu, groupCollapsed) are captured on paste and persisted alongside the folder.

Catalog persistence

  • New FolderData record and IClipRepository.LoadFoldersAsync/SaveFoldersAsync (default-implemented) let the catalog track folder metadata independent of any clip living in the folder. Existing plugin repositories compile unchanged.
  • The file-system repository writes a .sharpfm-folder.json sidecar per materialised folder. An "empty folder" is a directory that contains only the sidecar; orphan sweeps now respect both clips and folder markers.
  • Names containing characters the filesystem rejects (/, :, \, etc.) are percent-encoded on the way down and decoded on the way back, so a FileMaker script literally named Go-To-Record/Request/Page round-trips cleanly instead of crashing the save.
  • Per-folder name-uniqueness for clip names; collisions still suffix (2), (3), …. Folder-name collisions merge into the existing folder.

Catalog UX

  • Clip tree fills the entire left panel and an explicit synthetic root node (labelled after the repository's leaf folder) anchors right-click "create at root" operations.
  • Folder selection in the tree drives a TargetFolderPath: new clip / paste / new folder land at the explicitly tapped folder, falling through to the selected clip's folder, then to root. Tapping a folder no longer closes the active editor tab.
  • Tree context menu mirrors the File / Edit commands — New Script, New Script Steps, New Table, New Folder, Paste, Copy variants, Rename, Delete are all reachable the same way regardless of which menu opens them.
  • "New Script" now creates a whole-script clip (Mac-XMSC); a sibling "New Script Steps" command creates the bare step list (Mac-XMSS), matching the existing Copy-as-... split.
  • TreeView's expansion state binds to the VM's IsExpanded (default true), so rebuilds triggered by create / paste / rename leave the tree expanded instead of collapsing it.

Carry-forward

  • No UI to edit IncludeInMenu / GroupCollapsed on existing folders yet — the data is persisted but only changed by re-pasting from FileMaker.
  • Folder delete isn't wired into the context menu; deleting the last clip in a paste-derived folder leaves the empty folder behind by design (it has a marker).
  • The tree's user-driven collapse state survives mouse-driven rebuilds (TwoWay binding), but a full Load (e.g. switching repos) reseeds nodes and forgets the collapse.

Pastes whose root contains <Group> elements now expand into one clip
per <Script>, mirroring the Group hierarchy as FolderPath segments.
Loose scripts paste at the currently selected clip's folder; Groups
nest beneath it. Folder name collisions merge into the existing folder.
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 19, 2026

Test Results

✔️ Tests 1407 / 1407 - passed in 17.6s
✔️ Coverage 79.18% - passed with 70% threshold
📏 15140 / 17588 lines covered 🌿 5129 / 8010 branches covered
🔍 click here for more details

✏️ updated for commit 46f1fab

fuzzzerd added 5 commits May 18, 2026 21:54
- Add FolderData with FileMaker Group attributes (id, includeInMenu, groupCollapsed)
- Extend IClipRepository with LoadFoldersAsync/SaveFoldersAsync (default-implemented)
- Persist folders as .sharpfm-folder.json sidecars; empty folders survive saves
- Capture Group attributes when decomposing a paste; carry forward through the host
- Track folder selection in the tree so new clip/folder/paste land in the targeted folder
- Add New Folder command to the File menu and tree context menu
Names containing '/', ':', or other reserved characters now round-trip cleanly
through the local file-system repository instead of failing the save with a
DirectoryNotFoundException or losing folder segments to sanitization.
- Tree context menu mirrors the File/Edit commands so New / Paste / Copy /
  Rename / Delete work consistently regardless of how the menu was opened
- New Script creates a whole-script clip (Mac-XMSC); New Script Steps creates
  a bare step list (Mac-XMSS), matching the existing Copy-as-... split
- Tapping a folder leaves the active editor tab alone; right-clicking empty
  tree area targets the repository root
- New Folder no longer auto-selects the just-created folder, so successive
  invocations produce siblings instead of nesting
The clip tree now fills the entire left panel via DockPanel layout so empty
space below the last node is a valid right-click target for root operations.
A single synthetic root node (labeled after the repo's leaf folder) wraps
the top-level items, giving root-targeted actions an explicit click target
regardless of how much content fills the panel.
The clip tree's IsExpanded property on the VM was never wired to the
container, so every RebuildTree triggered by a new clip, paste, or folder
operation collapsed the tree back to Avalonia's default. A two-way style
setter on TreeViewItem.IsExpanded honours the VM (default true) and routes
chevron clicks back to it.
@fuzzzerd fuzzzerd changed the title feat: decompose pasted script Groups into folder hierarchy feat: rework clip catalog (group paste, folder metadata, panel polish) May 19, 2026
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.

Paste Group: mirror script-folder hierarchy from FileMaker into the clip repository

1 participant