Why Mindloft Uses Multi-Sheet Documents and Flat Collections Instead of Nested Folders
Comparing nested folder trees, flat tags, and a two-layer model for Mindloft: multi-sheet .ramilo documents for tightly coupled canvases, paired with single-level LibraryShelfV1 collections that isolate shared and local-only documents.
Once a mindmap library grows past a few dozen files, everyone asks the same question: “Can I create nested folders like Finder or Explorer?”
Before refactoring the library in Mindloft (formerly Brainlet / 枝间, commit 6f76fa9b), we put three models side by side and dropped nested folder trees altogether—not because tree components are hard to build, but because nested folders fight directly against local-first sync and selective sharing.
Comparing the three options
- Option A (shipped): Multi-sheet documents + single-level sidebar collections and pins (
LibraryShelfV1). Closely related canvases live as sheets inside one.ramilofile, sharing schema, versions, exports, and share permissions. Cross-document grouping stops at one sidebar layer of collections and pins. - Option B (rejected): Nested folders in the document protocol or a filesystem-style tree. Intuitive until someone shares a map with you (
vieweroreditor) or you mark a map “Local only”. Either folder ownership travels with the file—letting collaborators scramble each other’s trees—or deleting a parent folder sweeps up shared maps and local-only maps together, while adding deep navigation stacks on mobile. - Option C (rejected): Unanchored flat tags. Safe from folder deletion accidents, but tags give you no fixed drop target in the left sidebar for quick desktop drag-and-drop.
Choosing Option A left PortableDocument, schemas/ramilo.schema.json, the Loro kernel, and storage quota accounting untouched.
Locking down deletion and privacy rules
Shelf metadata stays decoupled from document payloads, with three invariants enforced in the protocol (packages/contracts/test/library-shelf.test.ts and services/api/test/shelf.test.ts):
- Dissolving a collection never deletes maps: Dissolving writes a
deletedAttombstone and drops member maps back to “Ungrouped” without deleting content or moving anything to trash.DissolveCollectionDialogputs default focus on Cancel. onlyLocalmaps stay invisible to the cloud: Local-only maps can be pinned and grouped locally, butPUT /v0/shelfstrips their references before upload and merges local associations back on pull—the server never even sees the local-only map’s collection assignment.- Shared maps stay personal: Collaborators can pin or group a shared document inside their own view without altering the owner’s organization.
Desktop supports dragging rows onto sidebar targets ([data-drop-target="true"]), while narrow mobile viewports collapse the sidebar into a 44px horizontal chip bar and bottom action sheet.
Three CSS bugs caught only by real screenshots
After unit tests passed, headless Chromium captures across 1440×900, 1024×768, and 390×844 in light and dark themes (reviews/evidence/2026-11-18-library-collections/) caught three issues that DOM assertions missed:
- Popover colliding with modal: The row
•••menu sat atz-50and overlapped--z-modal(40) dialogs when clicking “Move to collection…”. Lowering list/sidebarPopoverelements toz-30and closing the controlled menu at theDocumentListonActionentry fixed it. - Row
•••button vanishing at390px: Inhome-shell.css,@media (hover: hover) and (pointer: fine)matched:not(:hover, :focus-within) .ramilo-library-more { opacity: 0; }, which out-rankedmobile-home.css’s single-class override on narrow hover-capable viewports. Matching specificity inside@media (max-width: 599px)withopacity: 1restored it. - Count overlap and green-bar contrast: Fine-pointer hover buttons crowded
.ramilo-home-nav-count(fixed via hover-hide pluspadding-right: 30pxunder@media (hover: none)), and.ramilo-library-active-filter-actions .ramilo-quiet-buttonneeded higher contrast against the active green filter banner.
Sheets plus one collection tier are enough for hundreds of documents. If we ever need deeper archiving for thousands of scattered maps, we can add it with real usage data rather than shipping nested-folder conflicts on day one.
Comments