Move global CSS beside its code and make Documents reactive

Phase 4e.

- app.css holds only imports. Its rules moved into files beside their
  code, in the original cascade order. Dead rules of the deleted TipTap
  Writer are gone.
- workbenchKeys.ts is one table of the workbench shortcuts. Workbench
  runs the commands.
- session.linkTargets is the one link resolution for the link menu and
  for link opening.
- Documents is a rune module (documents.svelte.ts). Workbench reads the
  tabs and the active path from it, without a copy of all buffers on
  each change. The editor mount effect now copies the buffer inside
  untrack, so an edit does not remount the editor.
- Unit tests can import .svelte.ts modules through a Node module hook
  that compiles them with the Svelte compiler.

pnpm check, pnpm test (350 of 350), and the full smoke suite pass,
except tables/linkCaret, which failed one time under load and passed
on retry and 3 of 3 times alone.
This commit is contained in:
Knotty Wyvern
2026-10-28 11:50:33 -07:00
parent f32f60b540
commit 3e6bc5f088
23 changed files with 549 additions and 512 deletions
+25
View File
@@ -0,0 +1,25 @@
/* Image frames, image actions, and the image viewer, from imageControls.ts. */
.md-image-frame { display: block; position: relative; width: fit-content; max-width: 100%; margin: 1.4em 0; }
.md-image-frame.is-selected, .md-image-frame:focus-visible { outline: 2px solid var(--rs-accent); outline-offset: 3px; border-radius: 6px; }
.md-image-frame.is-selected .md-image-actions { opacity: 1; }
.md-image-frame[data-error]::after { content: attr(data-error); display: block; padding: 8px; color: var(--rs-text); background: var(--rs-bg-elevated); font: 12px/1.5 var(--rs-font-ui); }
.writer-image-inline { display: inline-block; vertical-align: middle; max-width: 100%; }
.writer-image-inline .md-image-frame { margin: .5em 0; }
.image-drop-target { outline: 2px solid var(--rs-accent); outline-offset: -3px; }
.reading .md-image-frame img { margin: 0; }
.md-image-actions { position: absolute; top: 8px; right: 8px; display: flex; gap: 2px; padding: 3px; border-radius: 6px; background: var(--rs-bg-elevated); box-shadow: 0 2px 8px #0005; opacity: 0; transition: opacity 100ms; }
.md-image-frame:hover .md-image-actions, .md-image-frame:focus-within .md-image-actions { opacity: 1; }
.image-action { position: relative; display: inline-grid; place-items: center; flex: 0 0 34px; width: 34px; height: 34px; padding: 6px; color: var(--rs-text); border: 0; border-radius: 4px; background: transparent; cursor: pointer; }
.image-action:hover, .image-action:focus-visible { background: var(--rs-bg-active); color: var(--rs-text-strong); }
.image-action:focus-visible { outline: 2px solid var(--rs-accent); outline-offset: 1px; }
.image-action:disabled { opacity: .4; cursor: default; }
.image-lightbox { position: fixed; inset: 0; width: 100vw; height: 100vh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: #090a0de8; color: var(--rs-text); }
.image-lightbox[open] { display: flex; flex-direction: column; }
.image-lightbox::backdrop { background: #0009; }
.image-lightbox-toolbar { display: flex; align-items: center; gap: 6px; padding: 8px 16px; background: var(--rs-bg-elevated); z-index: 1; }
.image-lightbox-name { margin-right: auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.image-lightbox-scale { min-width: 44px; text-align: center; font-size: 12px; }
.image-lightbox-viewport { flex: 1; min-height: 0; overflow: auto; padding: 16px; display: flex; }
.image-lightbox-viewport img { display: block; flex-shrink: 0; max-width: 100%; max-height: 100%; object-fit: contain; margin: auto; }
.image-lightbox-viewport.is-zoomed { display: block; }
.image-lightbox-viewport.is-zoomed img { max-width: none; max-height: none; height: auto; }