UI without documents: every page a node, the library root the first; moving, copying, exporting and importing any node
The page has one head for whatever node is the page (crumbs from the library's title, a byline of
sections and nodes, its flags and ⋯); in panes the first pane is the page and every other pane has
a section's head, whatever node it shows. A prompt (a node whose sections cite its sentences) is
folded wherever it shows. The library root's sections open in place like any others; an address
outside the hoisted node un-hoists to the library, and Esc at a hoisted page's top steps out to its
parent's.
What acts on a node and everything under it acts on the node the reader is on (the focused
section, or the one a focused note or selection is in): M moves it under any node (the jump box as
a picker, the root offered too), /duplicate copies it just after itself, /export saves it, /import
reads a file in as its last child (place() prefixes the titles down to the parent), /linkhere scans
it, S lists its links (on the root, the whole library's), history's f filters to it and r reverts
it. Every node's ⋯ offers them.
The documents menu, its mode and keys, /new, /open, /rename and /linkdoc are gone; m is free and
the top bar's left is a plain label with the library's name. Addresses are /n/<node id>, and / the
root; an old /doc/ address shows the library.
Server: /api/docs gives way to /api/nodes/<id>/{tree,export,import}; link jobs take scope "node" or
"library" and pending lists ?node=<id>&subtree=1. Step-1 shims removed: docOf/documents, all of
core/library.ts (IMPORT_MAX and importTree move to seed.ts, address and resolve to address.ts),
docArg, and the old single-document replica check. revertDocTo is revertSubtreeTo.
The page scrolls the focus into view only when the focus, the page or the mode changed, not on a
render for something that arrived in the background; row flags give way on a narrow screen.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014yB6q4BHMwptTX3YFtkRab
This commit is contained in:
1 parent
e6e4ad8d26
commit
bed47c0c7a
31 files changed
+789
-1153
No files matched your search
+10
-9
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* The panes view: panes side by side, in the manner of Andy Matuschak's notes. It starts as the
|
||||
* path down from the top node; a link followed from a pane opens its target in the next pane
|
||||
* (another document's node, a Wikipedia article, a section of one), replacing what was to the
|
||||
* (a node from anywhere in the library, a Wikipedia article, a section of one), replacing what was to the
|
||||
* right. Moving back left closes nothing: the panes stay until something else is opened from an
|
||||
* earlier pane, or q or a pane's × closes them. Earlier columns stay at the left as narrow spines
|
||||
* when later ones slide over them.
|
||||
@@ -17,11 +17,11 @@
|
||||
*/
|
||||
import { Component, type ComponentChildren } from "preact";
|
||||
import { useEffect, useLayoutEffect, useRef } from "preact/hooks";
|
||||
import { docOf, label, sections, staleness, type NodeId } from "../core/model";
|
||||
import { ancestors, label, sections, staleness, type NodeId } from "../core/model";
|
||||
import { LANES, LANE_FIRST, LANE_LAST, LANE_PITCH, laneOrder } from "./lanes";
|
||||
import { ACROSS, DOWN, mark, offsets, reveal, starts, stick, unmark, whole } from "./stack";
|
||||
import { NodeBacklinks, NodeRelated, PaneCtx, TargetRow } from "./Links";
|
||||
import { Flags, NodeBody, PendingSections, Row, TitleEditor, TopMatter } from "./Node";
|
||||
import { Abstract, Flags, NodeBody, PendingSections, Row, TitleEditor, TopMatter, isPrompt } from "./Node";
|
||||
import { kidClass, refKey, store, type Aux, type Pane as PaneNode, type PaneRef } from "./store";
|
||||
import { WikiView } from "./Wiki";
|
||||
import { article } from "./wiki";
|
||||
@@ -170,9 +170,9 @@ function NodePane(props: PaneProps & { id: NodeId }) {
|
||||
const snap = store.snap;
|
||||
const n = snap.nodes[id];
|
||||
if (!n) return null;
|
||||
// The first pane is the page, headed like the column's page (crumbs, byline, its ⋯); every other
|
||||
// pane has a section's head, whatever node it shows.
|
||||
const top = props.root && id === store.top;
|
||||
// A document's pane is a page of its own, headed like one.
|
||||
const page = top || docOf(snap, id) === id;
|
||||
const kids = sections(snap, id);
|
||||
const focused = active && !store.aux && store.focus.node === id;
|
||||
const editing = store.edit?.node === id && store.edit.field === "title";
|
||||
@@ -183,23 +183,24 @@ function NodePane(props: PaneProps & { id: NodeId }) {
|
||||
const forked = new Set(t.kids.flatMap((k, j) => (j !== t.pick && k.ref.kind === "node" && store.continuesFrom(k.ref, props.p) ? [k.ref.id] : [])));
|
||||
return (
|
||||
<article
|
||||
class={`pane${top ? " root" : ""}${page && !top ? " doc" : ""}${jump ? " jumped" : ""}${n.kind === "note" ? " note-pane" : ""}${store.preview ? " preview" : ""}${paneClass(props)}`}
|
||||
class={`pane${top ? " root" : ""}${jump ? " jumped" : ""}${n.kind === "note" ? " note-pane" : ""}${store.preview ? " preview" : ""}${paneClass(props)}`}
|
||||
{...paneAttrs(props, id)}
|
||||
>
|
||||
<Chrome props={props} title={label(snap, id)} />
|
||||
<div class="pane-scroll">
|
||||
<div class="pane-body">
|
||||
<Orphaned on={props.orphan} />
|
||||
{page ? (
|
||||
{top ? (
|
||||
<TopMatter id={id} />
|
||||
) : (
|
||||
<>
|
||||
{jump && <div class="pane-from">{docOf(snap, id) ? snap.nodes[docOf(snap, id)!].title : "the library"}</div>}
|
||||
{/* A pane opened by a jump (a link, a search) says where its node is: the titles above it. */}
|
||||
{jump && <div class="pane-from">{ancestors(snap, id).reverse().map((a) => label(snap, a)).join(" › ")}</div>}
|
||||
<header class={`pane-head${focused ? " focused" : ""}`} data-node={id}>
|
||||
{editing ? <TitleEditor id={id} /> : <h2>{n.title || (n.kind === "note" ? label(snap, id) : <i class="untitled">untitled</i>)}</h2>}
|
||||
<Flags id={id} />
|
||||
</header>
|
||||
<NodeBody id={id} />
|
||||
{isPrompt(snap, id) ? <Abstract id={id} /> : <NodeBody id={id} />}
|
||||
</>
|
||||
)}
|
||||
{kids.length > 0 && (
|
||||
|
||||
Reference in new issue
Block a user