githubnext/chopinPublic

Let's compose rich plans together

Add the editor and put it on screen

The browser half: MDXEditor over the dialect's schema, a Yjs provider on the
room's socket, remote cursors, presence faces, the selection bubble and the
slash menu. The app shell is three panes — chat, plan, decisions — with only
the ones that have something to show rendered, so the grid collapses to what
exists rather than reserving space for later.

Callout and Tabs now insert locally like code and formulas do. A ULID carries
enough entropy that two editors cannot mint the same one, so the round trip
only ever bought a block appearing later than the keystroke that asked for it.

Both URL prompts validate before inserting. The link prompt previously claimed
in a comment that the dialect only accepts safe protocols, but checked nothing:
a pasted `http://` link applies locally, syncs, then fails validation on a
server that cannot undo a Yjs transaction — costing the whole room its epoch
and undo history. Images take the same guard.

The unacknowledged outbox now does something when it fills. Yjs updates merge
losslessly, so a backlog is collapsed into one update rather than trimmed or
left to grow: nothing is dropped and the replay is the same document.

Dependency singletons are asserted in a test rather than enforced by a
resolver alias. Two copies of Lexical throw `incompatible editors` and every
node operation fails quietly afterwards; the catalog is what prevents it, and
a test says so in one line instead of failing a build over a redundant guard.
KCKrzysztof Cieslak authored
2890123Patch
Parent5a39508
35 files changed+4314-78
StackedSplit
apps/web/package.json+5 −1
apps/web/src/app.tsx+48 −71
apps/web/src/collab.test.ts+192 −0
apps/web/src/workspace.tsx+108 −0
apps/web/tsconfig.json+1 −1
apps/web/vite.config.ts+5 −4
bun.lock+283 −1
packages/editor/package.json+42 −0
packages/editor/src/collaboration.tsx+243 −0
packages/editor/src/collapse.ts+40 −0
packages/editor/src/cursor.ts+38 −0
packages/editor/src/env.d.ts+3 −0
packages/editor/src/index.ts+12 −0
packages/editor/src/labels.ts+80 −0
packages/editor/src/plan-editor.tsx+186 −0
packages/editor/src/presence.tsx+110 −0
packages/editor/src/provider.ts+304 −0
packages/editor/src/shortcuts.test.ts+38 −0
packages/editor/src/status.tsx+136 −0
packages/editor/src/styles.css+692 −0
packages/editor/src/toolbar/bubble.test.ts+86 −0
packages/editor/src/toolbar/bubble.tsx+351 −0
packages/editor/src/toolbar/index.tsx+34 −0
packages/editor/src/toolbar/slash.test.ts+97 −0
packages/editor/src/toolbar/slash.tsx+397 −0
packages/editor/src/toolbar/url.ts+52 −0
packages/editor/src/transport.ts+17 −0
packages/editor/src/widgets-plugin.tsx+38 −0
packages/editor/src/widgets/callout.tsx+124 −0
packages/editor/src/widgets/image.tsx+41 −0
packages/editor/src/widgets/index.ts+27 −0
packages/editor/src/widgets/render-blocks.tsx+281 −0
packages/editor/src/widgets/tabs.tsx+149 −0
packages/editor/tsconfig.json+19 −0
singleton.test.ts+35 −0