MVP M1–M3: visual port, TipTap text editor, React Flow diagram

apps/web — Next.js 16 + TypeScript + React 19 (no Tailwind)

M1 Visual port
- Manuscript theme + base styles ported verbatim from design-source
- 100dvh layout with internal scroll regions (rail / narrative / dock thread)
- TopBar, LeftRail (collapsible sections + collapsed strip), CanvasHeader,
  StatusBar, EditorShell composing the dual-canvas
- SocratesDock (subtle/default/prominent) with bubbles + numbered options
- Sigil (Σ + laurel) used across editor and seed screens
- SeedScreen with emerging-seed rail, mini-graph, confidence bar, thread,
  typing indicator, input row
- Routes: / (homepage), /editor/[projectId], /seed
- Aristotle fixture in lib/fixtures (ported from data.js)

M2 Real text editor
- TipTap (StarterKit + custom Chip atom inline node + ReactNodeViewRenderer)
- Slash-menu insertion via @tiptap/suggestion with arrow / number-key shortcuts
- ChipFocusContext bridges narrative ↔ diagram hover/selection across the
  TipTap render boundary
- fixtureToDoc converts the fixture narrative → ProseMirror JSON

M3 Real diagram
- React Flow (@xyflow/react) custom node (block / actor / constraint / system)
  matching prototype's softened look
- Custom edge with bezier path + label renderer (association / composition /
  constraint variants)
- Drag-create from a left-side palette via HTML5 DnD + screenToFlowPosition
- NodeInspector panel: edit kind / label / properties (or expression for
  constraints); delete cascades to incident edges
- Bidirectional focus highlighting between chips (narrative) and blocks
  (diagram)
- Removed redundant legend (stereotype labels on nodes serve same purpose)

State for M3 lives in component memory; persistence + bidirectional sync land
in M4–M5.
This commit is contained in:
2026-04-28 22:54:36 +02:00
parent f1c4566576
commit a0566ce64c
38 changed files with 7988 additions and 0 deletions

925
apps/web/styles/base.css Normal file
View File

@@ -0,0 +1,925 @@
/* ─── Base shared styles (theme variables defined per-aesthetic in HTML) ─── */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
font-family: var(--font-body);
color: var(--fg);
background: var(--bg);
/* Direct children fill the viewport */
display: flex;
flex-direction: column;
min-height: 100dvh;
}
body > * { flex: 1; min-height: 0; }
button { font-family: inherit; }
/* ─── Shell ─── */
.shell {
width: 100%;
height: 100dvh;
min-height: 0;
display: flex;
flex-direction: column;
background: var(--bg);
color: var(--fg);
font-family: var(--font-body);
font-size: 13.5px;
line-height: 1.55;
overflow: hidden;
letter-spacing: var(--tracking);
}
.shell-density-compact { font-size: 12.5px; line-height: 1.45; }
/* ─── Top bar ─── */
.topbar {
display: flex;
align-items: center;
justify-content: space-between;
height: 44px;
padding: 0 16px;
background: var(--surface);
border-bottom: 1px solid var(--border);
flex-shrink: 0;
}
.topbar-left { display: flex; align-items: center; gap: 14px; }
.brand { display: flex; align-items: center; gap: 8px; }
.brand-name { font-family: var(--font-display); font-weight: 600; font-size: 15px; letter-spacing: 0.01em; }
.breadcrumbs { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); font-family: var(--font-mono); }
.bc-sep { opacity: 0.45; }
.bc-active { color: var(--fg); }
.bc-branch { margin-left: 10px; padding: 2px 8px; border-radius: 4px; background: var(--accent-soft); color: var(--accent-strong); font-size: 11.5px; }
.bc-branch-glyph { margin-right: 4px; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.sync-pill { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--muted); font-family: var(--font-mono); }
.sync-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.topbar-divider { width: 1px; height: 18px; background: var(--border); }
.icon-btn {
width: 26px; height: 26px; border-radius: 5px; border: 1px solid transparent;
background: transparent; color: var(--muted); font-size: 13px;
display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
font-family: var(--font-mono);
}
.icon-btn:hover { background: var(--surface-2); color: var(--fg); border-color: var(--border); }
.avatar {
width: 26px; height: 26px; border-radius: 50%;
background: var(--accent); color: var(--accent-on);
font-size: 11px; font-weight: 600;
display: inline-flex; align-items: center; justify-content: center;
font-family: var(--font-display); letter-spacing: 0.02em;
}
/* ─── Body layout ─── */
.shell-body {
flex: 1;
display: grid;
grid-template-columns: 320px 184px 1fr;
min-height: 0;
}
.shell-density-compact .shell-body { grid-template-columns: 296px 168px 1fr; }
.shell-presence-prominent .shell-body { grid-template-columns: 360px 184px 1fr; }
.shell-presence-subtle .shell-body { grid-template-columns: 0px 184px 1fr; }
/* ─── Left rail ─── */
.leftrail {
border-right: 1px solid var(--border);
border-left: 1px solid var(--border);
background: var(--surface);
padding: 8px 8px;
overflow-y: auto;
font-size: 11.5px;
position: relative;
}
.leftrail-collapsed {
padding: 14px 0;
display: flex; flex-direction: column; align-items: center; gap: 14px;
width: 36px;
min-width: 36px;
}
.rail-collapsed-stack {
display: flex; flex-direction: column; gap: 18px;
margin-top: 8px;
}
.rail-collapsed-tag {
font-family: var(--font-mono); font-size: 9.5px; letter-spacing: 0.08em;
color: var(--muted); writing-mode: vertical-rl; text-orientation: mixed;
cursor: pointer;
}
.rail-collapsed-tag:hover { color: var(--fg); }
.rail-section-head {
display: flex; align-items: center; gap: 5px;
width: 100%;
background: transparent; border: none; padding: 0 4px;
cursor: pointer;
margin-bottom: 4px;
color: inherit;
height: 20px;
}
.rail-section-head:hover .rail-label { color: var(--fg); }
.rail-caret { display: none; }
.rail-section .rail-label { margin-bottom: 0; padding: 0; }
.rail-collapse-btn {
position: absolute; top: 8px; right: 6px;
width: 18px; height: 18px; border-radius: 4px;
border: none; background: transparent; color: var(--muted);
cursor: pointer; font-size: 11px; line-height: 1;
display: flex; align-items: center; justify-content: center;
}
.rail-collapse-btn:hover { background: var(--surface-2); color: var(--fg); }
.leftrail-collapsed .rail-collapse-btn { position: static; }
.rail-collapse-btn-bottom { display: none; }
.shell-density-compact .leftrail { padding: 10px 10px; font-size: 11.5px; }
.rail-section { margin-bottom: 10px; }
.rail-label {
text-transform: uppercase;
font-size: 9.5px;
font-family: var(--font-mono);
letter-spacing: 0.10em;
color: var(--muted);
margin-bottom: 4px;
padding: 0 4px;
}
.rail-list { list-style: none; padding: 0; margin: 0; }
.rail-item {
padding: 2px 6px; border-radius: 3px; cursor: pointer; color: var(--fg);
display: flex; align-items: center; gap: 6px;
font-size: 11.5px; line-height: 1.35;
}
.rail-item-text { flex: 1; }
.rail-count {
font-family: var(--font-mono); font-size: 9.5px;
padding: 1px 5px; border-radius: 3px;
background: var(--surface-2); color: var(--muted-strong);
letter-spacing: 0.02em;
flex-shrink: 0;
}
.rail-count-asm { background: var(--c-prop-bg); color: var(--c-prop-fg); }
.rail-count-req { background: var(--c-block-bg); color: var(--c-block-fg); }
.rail-count-q { background: var(--accent-soft); color: var(--accent-strong); }
.rail-count-risk { background: var(--warn-soft); color: var(--warn-strong); }
.rail-item:hover { background: var(--surface-2); }
.rail-item-active { background: var(--accent-soft); color: var(--accent-strong); }
.rail-item-muted { color: var(--muted); }
.rail-blocks { display: flex; flex-direction: column; gap: 1px; }
.rail-block {
display: flex; align-items: center; gap: 6px;
padding: 2px 6px; border-radius: 3px; cursor: pointer;
font-family: var(--font-mono); font-size: 10.5px;
line-height: 1.4;
}
.rail-block:hover { background: var(--surface-2); }
.rail-block-active { background: var(--accent-soft); color: var(--accent-strong); }
.rail-block-glyph { color: var(--muted); width: 12px; }
.rail-constraint .rail-block-glyph { color: var(--warn); }
.rail-actor .rail-block-glyph { color: var(--info); }
.rail-block-label { flex: 1; }
.rail-block-count {
font-size: 10px; color: var(--muted);
background: var(--surface-2); padding: 1px 5px; border-radius: 3px;
display: inline-flex; align-items: center; gap: 3px;
cursor: help;
}
.rail-block-count-glyph { opacity: 0.6; }
.rail-req {
display: flex; align-items: center; justify-content: space-between;
padding: 2px 6px; font-family: var(--font-mono); font-size: 10px; color: var(--muted-strong);
}
.req-tag { letter-spacing: 0.04em; }
.req-status { width: 6px; height: 6px; border-radius: 50%; }
.req-traced { background: var(--ok); }
.req-untraced { background: var(--warn); }
/* ─── Canvases ─── */
.canvases { display: grid; grid-template-columns: 1fr 1px 1fr; min-height: 0; background: var(--bg); }
.canvas { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.canvas-divider { background: var(--border); }
.canvas-header {
height: auto; min-height: 44px; padding: 8px 16px; flex-shrink: 0;
display: flex; align-items: center; justify-content: space-between;
border-bottom: 1px solid var(--border); background: var(--surface);
}
.shell-density-compact .canvas-header { min-height: 38px; padding: 6px 12px; }
.canvas-title { font-family: var(--font-display); font-weight: 600; font-size: 12.5px; letter-spacing: 0.02em; line-height: 1.3; }
.canvas-sub { font-size: 10.5px; color: var(--muted); font-family: var(--font-mono); line-height: 1.3; margin-top: 2px; }
.canvas-actions { display: flex; gap: 2px; background: var(--surface-2); padding: 2px; border-radius: 5px; }
.canvas-mode-pill {
font-size: 10.5px; padding: 3px 8px; border-radius: 4px;
color: var(--muted); cursor: pointer; font-family: var(--font-mono);
}
.canvas-mode-active { background: var(--surface); color: var(--fg); box-shadow: 0 1px 2px var(--shadow); }
.canvas-scroll { flex: 1; overflow-y: auto; min-height: 0; position: relative; }
.canvas-scroll-diagram { overflow: hidden; }
/* ─── Text canvas ─── */
.text-canvas {
max-width: 720px;
margin: 0 auto;
font-family: var(--font-prose);
color: var(--fg);
}
.t-h1 {
font-family: var(--font-display);
font-weight: 600;
font-size: 22px;
letter-spacing: -0.01em;
margin: 14px 0 16px 0;
color: var(--fg);
}
.t-h2 {
font-family: var(--font-display);
font-weight: 600;
font-size: 15px;
letter-spacing: 0.01em;
margin: 24px 0 8px 0;
color: var(--fg);
}
.t-p {
margin: 0 0 14px 0;
font-size: 14.5px;
line-height: 1.65;
color: var(--prose);
text-wrap: pretty;
}
.shell-density-compact .t-p { font-size: 13px; line-height: 1.55; margin-bottom: 10px; }
.shell-density-compact .t-h1 { font-size: 19px; }
.shell-density-compact .t-h2 { font-size: 13.5px; }
/* ─── Chips ─── */
.chip {
display: inline-flex; align-items: baseline; gap: 3px;
padding: 1px 6px; border-radius: 4px; cursor: pointer;
font-family: var(--font-mono);
font-size: 0.86em;
vertical-align: baseline;
transition: background .12s, box-shadow .12s;
white-space: nowrap;
}
.chip-glyph { font-size: 0.85em; opacity: 0.75; }
.chip-label { font-weight: 500; }
.chip-focus { box-shadow: 0 0 0 1.5px var(--accent); }
/* pill (default) */
.chip-style-pill { background: var(--chip-bg); color: var(--chip-fg); }
.chip-style-pill:hover { background: var(--chip-bg-hover); }
/* color-coded by kind */
.chip-style-color.chip-block { background: var(--c-block-bg); color: var(--c-block-fg); }
.chip-style-color.chip-property { background: var(--c-prop-bg); color: var(--c-prop-fg); }
.chip-style-color.chip-association { background: var(--c-assoc-bg); color: var(--c-assoc-fg); }
.chip-style-color.chip-requirement { background: var(--c-req-bg); color: var(--c-req-fg); }
/* underline */
.chip-style-underline {
background: transparent;
padding: 0 1px;
border-bottom: 1.5px solid var(--accent);
border-radius: 0;
color: var(--fg);
}
.chip-style-underline.chip-block { border-bottom-color: var(--c-block-fg); }
.chip-style-underline.chip-property { border-bottom-color: var(--c-prop-fg); }
.chip-style-underline.chip-association { border-bottom-color: var(--c-assoc-fg); }
.chip-style-underline.chip-requirement { border-bottom-color: var(--c-req-fg); }
.chip-style-underline:hover { background: var(--chip-bg); }
/* bracket */
.chip-style-bracket {
background: transparent;
color: var(--muted-strong);
padding: 0 1px;
}
.chip-style-bracket .chip-bracket { color: var(--muted); opacity: 0.6; }
.chip-style-bracket .chip-kind { color: var(--accent); margin-right: 3px; }
.chip-style-bracket .chip-label { color: var(--fg); }
.chip-style-bracket:hover { background: var(--chip-bg); border-radius: 3px; }
/* ─── Margin note ─── */
.margin-note {
display: flex; gap: 12px;
margin: 24px 0 8px 0;
padding: 12px 14px;
background: var(--note-bg);
border-left: 2px solid var(--accent);
border-radius: 0 6px 6px 0;
font-family: var(--font-prose);
font-size: 13px;
color: var(--prose);
}
.margin-note-glyph {
font-family: var(--font-display); font-weight: 600;
color: var(--accent); font-size: 17px; line-height: 1;
flex-shrink: 0;
}
.margin-note-who {
display: block;
font-family: var(--font-mono); font-size: 10.5px;
color: var(--accent); letter-spacing: 0.04em; text-transform: uppercase;
margin-bottom: 4px;
}
.margin-note-text { line-height: 1.5; }
/* ─── Diagram ─── */
.diagram-grid {
position: absolute; inset: 0;
background-image: radial-gradient(var(--grid-dot) 1px, transparent 1px);
background-size: 18px 18px;
background-position: 0 0;
opacity: 0.7;
pointer-events: none;
}
.diagram-legend {
position: absolute; bottom: 12px; left: 12px;
display: flex; gap: 14px;
background: var(--surface);
border: 1px solid var(--border);
padding: 6px 10px;
border-radius: 5px;
font-family: var(--font-mono);
font-size: 10.5px;
color: var(--muted);
}
.legend-sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.legend-block { background: var(--block-bg); border: 1px solid var(--block-border); }
.legend-actor { background: var(--block-actor-bg); border: 1px solid var(--block-border); }
.legend-constraint { background: var(--block-constraint-bg); border: 1px dashed var(--block-border); }
/* ─── Socrates dock ─── */
.dock {
border-right: 1px solid var(--border);
background: var(--surface);
display: flex; flex-direction: column;
overflow: hidden;
font-size: 12.5px;
min-height: 0;
}
.dock-header {
display: flex; align-items: center; gap: 8px;
padding: 8px 10px;
border-bottom: 1px solid var(--border);
flex-shrink: 0;
}
.dock-header-text { flex: 1; min-width: 0; }
.dock-header-action {
width: 22px; height: 22px; border-radius: 4px;
border: 1px solid var(--border-strong);
background: transparent; color: var(--muted);
cursor: pointer; font-size: 13px; line-height: 1;
display: flex; align-items: center; justify-content: center;
}
.dock-header-action:hover { background: var(--surface-2); color: var(--fg); }
.dock-thread-wrap {
flex: 1;
min-height: 0;
overflow-y: auto;
padding: 10px 10px 6px;
display: flex; flex-direction: column;
}
.dock-section-label-inline {
margin-bottom: 8px;
flex-shrink: 0;
}
.dock-thread {
display: flex; flex-direction: column; gap: 8px;
flex: 1;
}
.bubble {
padding: 8px 10px; border-radius: 8px;
font-family: var(--font-prose); font-size: 12.5px; line-height: 1.5;
display: flex; gap: 8px;
align-items: flex-start;
}
.bubble-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.bubble-text { display: block; }
.dock-input-wrap {
flex-shrink: 0;
padding: 8px 10px;
border-top: 1px solid var(--border);
background: var(--surface);
}
.dock-input { margin-top: 0; }
/* Numbered options inside a bubble */
.bubble-options {
display: flex; flex-direction: column; gap: 3px;
margin-top: 2px;
}
.bubble-option {
display: flex; align-items: center; gap: 8px;
padding: 4px 7px;
background: var(--surface);
border: 1px solid var(--border-strong);
border-radius: 5px;
cursor: pointer;
text-align: left;
font-family: var(--font-prose);
color: var(--fg);
width: 100%;
transition: background .12s, border-color .12s;
}
.bubble-option:hover {
background: var(--surface-2);
border-color: var(--accent);
}
.bubble-option-num {
width: 15px; height: 15px; flex-shrink: 0;
border-radius: 3px;
background: var(--accent-soft); color: var(--accent-strong);
font-family: var(--font-mono); font-size: 9.5px; font-weight: 600;
display: flex; align-items: center; justify-content: center;
}
.bubble-option-text { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 6px; }
.bubble-option-label {
font-size: 11.5px; font-weight: 500; color: var(--fg);
line-height: 1.25;
}
.bubble-option-sub {
font-family: var(--font-mono); font-size: 9.5px;
color: var(--muted);
line-height: 1.25;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.bubble-option-key { display: none; }
.bubble-options-hint {
font-family: var(--font-mono); font-size: 9.5px;
color: var(--muted);
margin-top: 3px;
padding: 0 2px;
}
.bubble-options-hint kbd {
font-family: var(--font-mono); font-size: 9px;
padding: 0 3px; border-radius: 2px;
background: var(--surface-2); color: var(--muted-strong);
border: 1px solid var(--border);
margin: 0 1px;
}
.dock-subtle {
position: fixed; bottom: 24px; right: 24px;
width: 50px; height: 50px;
border-radius: 50%; border: 1px solid var(--border);
background: var(--surface);
display: flex; align-items: center; justify-content: center;
box-shadow: 0 6px 20px var(--shadow-strong);
cursor: pointer;
z-index: 10;
}
.dock-subtle-count {
position: absolute; top: -4px; right: -4px;
width: 18px; height: 18px; border-radius: 50%;
background: var(--accent); color: var(--accent-on);
font-size: 10px; font-weight: 600;
display: flex; align-items: center; justify-content: center;
font-family: var(--font-mono);
}
.dock-header {
display: flex; align-items: center; gap: 8px;
padding: 8px 10px;
border-bottom: 1px solid var(--border);
}
.dock-name { font-family: var(--font-display); font-weight: 600; font-size: 12.5px; }
.dock-status { display: flex; align-items: center; gap: 4px; font-size: 10px; color: var(--muted); font-family: var(--font-mono); }
.dock-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 2px var(--ok-soft); }
.dock-section { padding: 8px 10px; border-bottom: 1px solid var(--border); }
.dock-section:last-child { border-bottom: none; }
.dock-section-label {
text-transform: uppercase;
font-family: var(--font-mono); font-size: 9.5px; letter-spacing: 0.10em;
color: var(--muted); margin-bottom: 6px;
}
.dock-section-label-2 { margin-top: 16px; }
.dock-thread { display: flex; flex-direction: column; gap: 8px; }
.bubble-socrates {
background: var(--bubble-socrates);
color: var(--prose);
border-left: 2px solid var(--accent);
border-radius: 2px 8px 8px 2px;
padding-left: 10px;
}
.bubble-socrates .bubble-sigil {
display: inline-block;
font-family: var(--font-display); font-weight: 600;
color: var(--accent); margin-right: 6px;
flex-shrink: 0;
}
.bubble-user {
background: var(--bubble-user);
color: var(--fg);
align-self: flex-end;
max-width: 88%;
}
.dock-input {
display: flex; align-items: center; gap: 6px;
padding: 7px 10px;
border: 1px solid var(--border-strong);
border-radius: 6px;
font-family: var(--font-mono);
font-size: 11.5px;
color: var(--muted);
background: var(--bg);
}
.dock-input-prompt { color: var(--accent); }
.dock-input-placeholder { flex: 1; }
.dock-input-shortcut { font-size: 10px; opacity: 0.55; }
/* Proposal */
.proposal {
background: var(--surface-2);
border: 1px solid var(--border);
border-radius: 6px;
padding: 10px;
}
.proposal-title {
font-family: var(--font-display); font-weight: 600; font-size: 12.5px;
color: var(--fg); margin-bottom: 8px;
line-height: 1.35;
}
.proposal-meta { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; }
.proposal-row { display: flex; gap: 8px; font-family: var(--font-mono); font-size: 10.5px; align-items: baseline; }
.proposal-key { color: var(--muted); width: 70px; flex-shrink: 0; }
.proposal-val { display: flex; gap: 4px; flex-wrap: wrap; }
.proposal-pill {
background: var(--accent-soft); color: var(--accent-strong);
padding: 1px 6px; border-radius: 3px; font-size: 10.5px;
}
.proposal-pill-req { background: var(--c-req-bg); color: var(--c-req-fg); }
.proposal-actions { display: flex; gap: 6px; }
.btn {
flex: 1;
padding: 6px 10px;
border-radius: 5px;
border: 1px solid var(--border-strong);
background: var(--surface);
color: var(--fg);
font-family: var(--font-mono);
font-size: 11.5px;
cursor: pointer;
}
.btn:hover { background: var(--surface-2); }
.btn-primary { background: var(--accent); color: var(--accent-on); border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-strong); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); flex: 0; padding: 6px 8px; }
/* Watch list */
.watch { display: flex; flex-direction: column; gap: 6px; }
.watch-row {
display: flex; gap: 8px; align-items: flex-start;
font-size: 11.5px; line-height: 1.4; color: var(--prose);
}
.watch-tag {
font-family: var(--font-mono); font-size: 9.5px; letter-spacing: 0.04em;
background: var(--c-prop-bg); color: var(--c-prop-fg);
padding: 2px 5px; border-radius: 3px;
flex-shrink: 0; margin-top: 1px;
}
.watch-tag-risk { background: var(--warn-soft); color: var(--warn-strong); }
.watch-validated .watch-tag { background: var(--ok-soft); color: var(--ok-strong); }
.watch-text { flex: 1; }
.watch-risk-high .watch-text { color: var(--fg); }
/* ─── Status bar ─── */
.statusbar {
height: 24px; flex-shrink: 0;
display: flex; align-items: center; gap: 12px;
padding: 0 16px;
font-family: var(--font-mono); font-size: 10.5px; color: var(--muted);
border-top: 1px solid var(--border);
background: var(--surface);
}
.status-spacer { flex: 1; }
/* ─── Sigil ─── */
.sigil { position: relative; }
.sigil-pulse {
animation: sigilpulse 2.4s ease-in-out infinite;
transform-origin: center;
}
@keyframes sigilpulse {
0%, 100% { opacity: 0.3; r: 2; }
50% { opacity: 1; r: 3.5; }
}
/* ─── Seed screen ─── */
.seed-screen {
width: 100%; height: 100dvh; min-height: 0;
display: flex; flex-direction: column;
background: var(--bg);
font-family: var(--font-body);
color: var(--fg);
overflow: hidden;
}
.seed-top {
display: flex; align-items: center; justify-content: space-between;
padding: 12px 20px;
border-bottom: 1px solid var(--border);
background: var(--surface);
flex-shrink: 0;
}
.seed-top-left { display: flex; align-items: center; gap: 10px; }
.seed-brand { font-family: var(--font-display); font-weight: 600; font-size: 16px; }
.seed-pip { color: var(--muted); }
.seed-step { font-family: var(--font-mono); font-size: 11.5px; color: var(--muted); }
.seed-top-right { display: flex; gap: 2px; background: var(--surface-2); padding: 2px; border-radius: 5px; }
.seed-mode-pill {
font-family: var(--font-mono); font-size: 11px; padding: 4px 12px;
border-radius: 4px; color: var(--muted); cursor: pointer;
}
.seed-mode-active { background: var(--surface); color: var(--fg); box-shadow: 0 1px 2px var(--shadow); }
.seed-body {
flex: 1;
display: grid;
grid-template-columns: minmax(280px, 380px) 1fr;
min-height: 0;
}
.seed-left {
border-right: 1px solid var(--border);
background: var(--surface);
padding: 22px 22px 18px;
overflow-y: auto;
}
.seed-section-label {
text-transform: uppercase;
font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.14em;
color: var(--muted); margin-bottom: 12px;
}
.seed-section-label-2 { margin-top: 24px; }
.seed-fields { display: flex; flex-direction: column; gap: 14px; }
.seed-field {
padding-left: 12px;
border-left: 2px solid var(--border-strong);
}
.seed-field-inferred { border-left-color: var(--accent); border-left-style: dashed; }
.seed-field-label {
font-family: var(--font-mono); font-size: 10.5px;
color: var(--muted); letter-spacing: 0.04em;
margin-bottom: 3px;
display: flex; gap: 8px; align-items: baseline;
}
.seed-conf { font-size: 9.5px; color: var(--accent); opacity: 0.85; }
.seed-field-value {
font-family: var(--font-prose);
font-size: 13.5px; line-height: 1.5;
color: var(--fg);
text-wrap: pretty;
}
.seed-mini-graph {
display: grid;
grid-template-columns: 1fr;
gap: 8px;
padding: 14px;
background: var(--bg);
border: 1px solid var(--border);
border-radius: 6px;
position: relative;
}
.mini-block {
border: 1px solid var(--block-border);
background: var(--block-bg);
padding: 8px 10px;
border-radius: 6px;
display: flex; flex-direction: column; gap: 1px;
}
.mini-block-3 { background: var(--block-constraint-bg); border-style: dashed; }
.mini-block-focus {
border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft);
}
.mini-stereo { font-family: var(--font-mono); font-size: 9.5px; color: var(--muted); letter-spacing: 0.04em; }
.mini-name { font-family: var(--font-display); font-weight: 600; font-size: 13px; }
.mini-prop { font-family: var(--font-mono); font-size: 11px; color: var(--muted-strong); margin-top: 2px; }
.mini-edge {
height: 14px;
background: linear-gradient(to bottom, var(--edge), var(--edge)) center/1px 100% no-repeat;
margin-left: 18px;
position: relative;
}
.mini-edge::after {
content: ""; position: absolute; left: -3px; bottom: 0;
border-left: 4px solid transparent; border-right: 4px solid transparent;
border-top: 5px solid var(--edge);
}
.seed-confidence { margin-top: 18px; }
.seed-confidence-row {
display: flex; justify-content: space-between;
font-family: var(--font-mono); font-size: 11px; color: var(--muted);
margin-bottom: 5px;
}
.seed-confidence-bar {
height: 4px; border-radius: 2px;
background: var(--surface-2);
overflow: hidden;
}
.seed-confidence-fill {
height: 100%; background: var(--accent);
}
.seed-confidence-hint {
margin-top: 6px;
font-size: 11px; color: var(--muted); font-family: var(--font-prose);
font-style: italic;
}
.seed-right {
display: flex; flex-direction: column;
min-height: 0;
background: var(--bg);
}
.seed-thread {
flex: 1; min-height: 0;
overflow-y: auto;
padding: 22px 36px;
display: flex; flex-direction: column; gap: 18px;
max-width: 760px;
margin: 0 auto;
width: 100%;
}
.seed-bubble {
display: flex; gap: 14px;
}
.seed-bubble-user { justify-content: flex-end; }
.seed-bubble-avatar { flex-shrink: 0; padding-top: 2px; }
.seed-bubble-body { max-width: 78%; }
.seed-bubble-user .seed-bubble-body {
background: var(--bubble-user);
padding: 10px 14px;
border-radius: 12px 12px 2px 12px;
color: var(--fg);
}
.seed-bubble-who {
font-family: var(--font-mono); font-size: 10.5px;
color: var(--muted); letter-spacing: 0.04em;
text-transform: uppercase; margin-bottom: 4px;
}
.seed-bubble-user .seed-bubble-who { display: none; }
.seed-bubble-text {
font-family: var(--font-prose);
font-size: 14.5px; line-height: 1.6;
color: var(--prose);
text-wrap: pretty;
}
.seed-bubble-user .seed-bubble-text { color: var(--fg); }
.seed-bubble-typing .seed-bubble-text { color: var(--muted); }
.seed-typing { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); font-family: var(--font-mono); }
.seed-typing span {
width: 4px; height: 4px; border-radius: 50%;
background: var(--accent); opacity: 0.35;
animation: typing 1.4s ease-in-out infinite;
}
.seed-typing span:nth-child(2) { animation-delay: 0.2s; }
.seed-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typing {
0%, 80%, 100% { opacity: 0.25; transform: translateY(0); }
40% { opacity: 1; transform: translateY(-2px); }
}
.seed-input-row {
border-top: 1px solid var(--border);
background: var(--surface);
padding: 14px 36px;
max-width: 760px; margin: 0 auto; width: 100%;
display: flex; flex-direction: column; gap: 10px;
flex-shrink: 0;
}
.seed-input {
display: flex; align-items: baseline; gap: 8px;
padding: 10px 14px;
background: var(--bg);
border: 1px solid var(--border-strong);
border-radius: 8px;
font-family: var(--font-prose);
font-size: 14px;
line-height: 1.5;
color: var(--fg);
}
.seed-input-prompt { color: var(--accent); font-family: var(--font-mono); }
.seed-input-text { flex: 1; }
.seed-input-caret {
display: inline-block;
width: 1.5px; height: 16px;
background: var(--accent);
animation: caret 1s steps(1) infinite;
vertical-align: -3px;
}
@keyframes caret { 50% { opacity: 0; } }
.seed-input-actions { display: flex; justify-content: flex-end; gap: 8px; }
.seed-btn {
padding: 6px 12px;
border-radius: 5px;
border: 1px solid var(--border-strong);
background: var(--surface);
color: var(--fg);
font-family: var(--font-mono);
font-size: 11.5px;
cursor: pointer;
}
.seed-btn-primary { background: var(--accent); color: var(--accent-on); border-color: var(--accent); }
/* ─── Slash menu (M2) ─── */
.slash-menu {
background: var(--surface);
border: 1px solid var(--border-strong);
border-radius: 6px;
box-shadow: 0 8px 24px var(--shadow-strong);
padding: 4px;
min-width: 280px;
display: flex; flex-direction: column; gap: 2px;
}
.slash-menu-empty {
padding: 10px 12px;
font-family: var(--font-mono);
font-size: 11.5px;
color: var(--muted);
}
.slash-menu-item {
display: grid;
grid-template-columns: 20px 1fr auto auto;
align-items: center;
gap: 8px;
padding: 6px 8px;
border-radius: 4px;
background: transparent;
border: none;
cursor: pointer;
text-align: left;
font-family: inherit;
color: var(--fg);
}
.slash-menu-item:hover,
.slash-menu-item-active {
background: var(--accent-soft);
color: var(--accent-strong);
}
.slash-menu-glyph {
font-family: var(--font-mono);
font-size: 13px;
color: var(--muted);
text-align: center;
}
.slash-menu-glyph-block { color: var(--c-block-fg); }
.slash-menu-glyph-property { color: var(--c-prop-fg); }
.slash-menu-glyph-association { color: var(--c-assoc-fg); }
.slash-menu-glyph-requirement { color: var(--c-req-fg); }
.slash-menu-label {
font-family: var(--font-display);
font-size: 13px;
font-weight: 500;
}
.slash-menu-hint {
font-family: var(--font-mono);
font-size: 10.5px;
color: var(--muted);
margin-right: 4px;
}
.slash-menu-key {
font-family: var(--font-mono);
font-size: 10px;
background: var(--surface-2);
color: var(--muted-strong);
border: 1px solid var(--border);
padding: 1px 5px;
border-radius: 3px;
}
/* TipTap-rendered narrative root */
.tiptap { outline: none; }
.tiptap:focus { outline: none; }
.tiptap p.t-p,
.tiptap > p {
margin: 0 0 14px 0;
font-size: 14.5px;
line-height: 1.65;
color: var(--prose);
text-wrap: pretty;
}
.tiptap > h1 {
font-family: var(--font-display);
font-weight: 600;
font-size: 22px;
margin: 14px 0 16px 0;
}
.tiptap > h2 {
font-family: var(--font-display);
font-weight: 600;
font-size: 15px;
margin: 24px 0 8px 0;
}
/* Make ProseMirror's inline-atom selection look like our chip-focus state. */
.tiptap .ProseMirror-selectednode .chip {
box-shadow: 0 0 0 1.5px var(--accent);
}

336
apps/web/styles/diagram.css Normal file
View File

@@ -0,0 +1,336 @@
/* React Flow styling overrides for the Manuscript theme. */
.diagram-flow {
width: 100%;
height: 100%;
background: var(--diagram-bg);
}
/* Hide the default attribution badge for cleaner aesthetic */
.react-flow__attribution {
display: none;
}
.react-flow__pane {
cursor: default;
}
/* Background dots */
.react-flow__background {
background-color: var(--diagram-bg);
}
/* Connection line drawn while drag-creating an edge */
.react-flow__connection-path {
stroke: var(--accent);
stroke-width: 1.5;
stroke-dasharray: 4 3;
}
/* Selection box */
.react-flow__nodesselection-rect,
.react-flow__selection {
background: var(--accent-soft);
border: 1px dashed var(--accent);
}
/* Node base wrapper — we draw our own card; React Flow's outer just provides position. */
.react-flow__node {
font-family: var(--font-body);
cursor: grab;
}
.react-flow__node:active { cursor: grabbing; }
/* Custom node card (BlockNode component) */
.sysml-node {
position: relative;
background: var(--block-bg);
border: 1px solid var(--block-border);
border-radius: 8px;
box-shadow: 0 2px 4px var(--shadow);
font-family: var(--font-body);
user-select: none;
display: flex; flex-direction: column;
min-width: 168px;
}
.sysml-node-actor {
background: var(--block-actor-bg);
}
.sysml-node-constraint {
background: var(--block-constraint-bg);
border-style: dashed;
}
.sysml-node-system {
border-color: var(--accent);
border-width: 1.5px;
}
.sysml-node-selected,
.react-flow__node.selected .sysml-node {
border-color: var(--accent);
box-shadow: 0 0 0 2px var(--accent-soft), 0 2px 4px var(--shadow);
}
.sysml-node-stereo {
font-family: var(--font-mono);
font-size: 9px;
color: var(--muted);
letter-spacing: 0.04em;
padding: 6px 12px 0 12px;
}
.sysml-node-title {
font-family: var(--font-display);
font-weight: 600;
font-size: 13px;
color: var(--fg);
padding: 1px 12px 8px 12px;
}
.sysml-node-divider {
height: 1px;
background: var(--block-divider);
}
.sysml-node-props {
padding: 6px 12px 8px 12px;
display: flex; flex-direction: column; gap: 3px;
}
.sysml-node-prop {
font-family: var(--font-mono);
font-size: 11.5px;
color: var(--muted-strong);
}
.sysml-node-prop-empty {
font-family: var(--font-mono);
font-size: 10.5px;
color: var(--muted);
font-style: italic;
}
.sysml-node-constraint-body {
padding: 4px 12px 8px 12px;
font-family: var(--font-mono);
font-size: 11px;
color: var(--muted-strong);
}
/* Connection handles — kept subtle; visible on hover */
.react-flow__handle {
width: 8px;
height: 8px;
background: var(--surface);
border: 1.25px solid var(--accent);
opacity: 0;
transition: opacity 0.15s;
}
.react-flow__node:hover .react-flow__handle,
.react-flow__node.selected .react-flow__handle {
opacity: 1;
}
/* Edges */
.react-flow__edge-path {
stroke: var(--edge);
stroke-width: 1;
}
.react-flow__edge.selected .react-flow__edge-path {
stroke: var(--accent);
stroke-width: 1.5;
}
.react-flow__edge-text {
font-family: var(--font-mono);
font-size: 10.5px;
fill: var(--edge-label);
}
.react-flow__edge-textbg {
fill: var(--diagram-bg);
}
.sysml-edge-label {
background: var(--diagram-bg);
border: 0.75px solid var(--edge-soft);
border-radius: 4px;
padding: 1px 6px;
font-family: var(--font-mono);
font-size: 10.5px;
color: var(--edge-label);
white-space: nowrap;
pointer-events: all;
}
/* Controls (zoom in/out/fit) — positioned via React Flow's `position` prop */
.react-flow__controls {
box-shadow: 0 2px 8px var(--shadow);
background: var(--surface);
border: 1px solid var(--border);
border-radius: 6px;
overflow: hidden;
}
.react-flow__controls-button {
background: transparent;
border: none;
border-bottom: 1px solid var(--border);
color: var(--muted-strong);
width: 26px;
height: 26px;
padding: 0;
display: flex;
align-items: center;
justify-content: center;
}
.react-flow__controls-button:last-child { border-bottom: none; }
.react-flow__controls-button:hover {
background: var(--surface-2);
color: var(--fg);
}
.react-flow__controls-button svg {
fill: currentColor;
width: 11px;
height: 11px;
max-width: 11px;
max-height: 11px;
}
/* Palette — drag source for new blocks */
.diagram-palette {
position: absolute;
top: 12px;
left: 12px;
display: flex; flex-direction: column; gap: 6px;
z-index: 5;
background: var(--surface);
border: 1px solid var(--border);
border-radius: 6px;
padding: 6px;
box-shadow: 0 2px 8px var(--shadow);
}
.diagram-palette-label {
font-family: var(--font-mono);
font-size: 9.5px;
color: var(--muted);
letter-spacing: 0.10em;
text-transform: uppercase;
padding: 2px 4px 4px 4px;
}
.diagram-palette-item {
display: flex; align-items: center; gap: 8px;
padding: 5px 8px;
border-radius: 4px;
background: var(--bg);
border: 1px solid var(--border);
cursor: grab;
font-family: var(--font-mono);
font-size: 11px;
color: var(--fg);
}
.diagram-palette-item:hover {
background: var(--accent-soft);
border-color: var(--accent);
color: var(--accent-strong);
}
.diagram-palette-item:active { cursor: grabbing; }
.diagram-palette-glyph {
width: 14px; height: 14px;
display: inline-flex; align-items: center; justify-content: center;
font-size: 11px;
color: var(--muted);
}
/* Inspector panel for selected node */
.diagram-inspector {
position: absolute;
top: 12px;
right: 12px;
width: 240px;
background: var(--surface);
border: 1px solid var(--border);
border-radius: 6px;
padding: 10px 12px;
box-shadow: 0 2px 8px var(--shadow);
z-index: 5;
display: flex; flex-direction: column; gap: 8px;
font-family: var(--font-body);
}
.diagram-inspector-row {
display: flex; flex-direction: column; gap: 3px;
}
.diagram-inspector-label {
font-family: var(--font-mono);
font-size: 9.5px;
color: var(--muted);
letter-spacing: 0.08em;
text-transform: uppercase;
}
.diagram-inspector-input {
font-family: inherit;
font-size: 13px;
padding: 5px 7px;
background: var(--bg);
border: 1px solid var(--border-strong);
border-radius: 4px;
color: var(--fg);
outline: none;
}
.diagram-inspector-input:focus { border-color: var(--accent); }
.diagram-inspector-select {
font-family: var(--font-mono);
font-size: 11.5px;
padding: 4px 6px;
background: var(--bg);
border: 1px solid var(--border-strong);
border-radius: 4px;
color: var(--fg);
}
.diagram-inspector-prop {
display: flex; gap: 4px; align-items: center;
}
.diagram-inspector-prop input {
flex: 1;
font-family: var(--font-mono);
font-size: 11.5px;
padding: 3px 6px;
background: var(--bg);
border: 1px solid var(--border);
border-radius: 3px;
color: var(--fg);
outline: none;
}
.diagram-inspector-prop input:focus { border-color: var(--accent); }
.diagram-inspector-prop-x {
width: 18px; height: 18px;
display: flex; align-items: center; justify-content: center;
background: transparent;
border: none;
color: var(--muted);
cursor: pointer;
font-size: 13px;
}
.diagram-inspector-prop-x:hover { color: var(--warn-strong); }
.diagram-inspector-add {
margin-top: 2px;
padding: 4px 8px;
background: transparent;
border: 1px dashed var(--border-strong);
border-radius: 4px;
color: var(--muted-strong);
font-family: var(--font-mono);
font-size: 10.5px;
cursor: pointer;
}
.diagram-inspector-add:hover {
background: var(--accent-soft);
border-color: var(--accent);
color: var(--accent-strong);
}
.diagram-inspector-actions {
display: flex; gap: 6px; margin-top: 6px;
}
.diagram-inspector-btn {
flex: 1;
padding: 5px 8px;
font-family: var(--font-mono);
font-size: 11px;
background: var(--surface);
border: 1px solid var(--border-strong);
border-radius: 4px;
cursor: pointer;
color: var(--fg);
}
.diagram-inspector-btn:hover { background: var(--surface-2); }
.diagram-inspector-btn-danger { color: var(--warn-strong); }
.diagram-inspector-btn-danger:hover { background: var(--warn-soft); }

View File

@@ -0,0 +1,79 @@
/* MANUSCRIPT — warm parchment, scholarly serif, ink-blue accent.
Document-first; Socrates feels like a character in a book. */
.theme-manuscript {
--font-display: "Newsreader", "Source Serif Pro", "Iowan Old Style", Georgia, serif;
--font-prose: "Newsreader", "Source Serif Pro", "Iowan Old Style", Georgia, serif;
--font-body: "Söhne", "Inter Tight", -apple-system, system-ui, sans-serif;
--font-mono: "JetBrains Mono", "IBM Plex Mono", ui-monospace, Menlo, monospace;
--tracking: 0;
--bg: #f5efe2; /* parchment */
--surface: #faf5e9;
--surface-2: #ede4cf;
--fg: #2a241a;
--prose: #3d3527;
--muted: #8a7c63;
--muted-strong: #5e533f;
--border: #d9ceb3;
--border-strong: #b8a982;
--accent: #2c4a6b; /* ink blue */
--accent-strong: #1c3550;
--accent-soft: #d6def0;
--accent-on: #faf5e9;
--ok: #5e7a3a;
--ok-soft: #d9e3c7;
--ok-strong: #3d5421;
--warn: #a8551c;
--warn-soft: #f0d9c2;
--warn-strong: #6b3309;
--info: #5b6e8a;
--shadow: rgba(60,40,15,0.08);
--shadow-strong: rgba(60,40,15,0.18);
--grid-dot: rgba(120,90,40,0.18);
--diagram-bg: #f0e9d6;
--block-bg: #fdfaf0;
--block-border: #b8a982;
--block-divider: #d9ceb3;
--block-actor-bg: #f0e6cf;
--block-constraint-bg:#f5dccb;
--edge: #6e5d3d;
--edge-soft: #c8b88f;
--edge-label: #5e533f;
--note-bg: #f0e3c4;
--bubble-socrates: #f0e3c4;
--bubble-user: #ede4cf;
--chip-bg: #ede4cf;
--chip-bg-hover: #e2d6b8;
--chip-fg: #2a241a;
/* color-coded chips */
--c-block-bg: #d6def0; --c-block-fg: #1c3550;
--c-prop-bg: #e8e0c2; --c-prop-fg: #6b5a25;
--c-assoc-bg: #d9e3c7; --c-assoc-fg: #3d5421;
--c-req-bg: #f0d9c2; --c-req-fg: #6b3309;
}
/* Manuscript-only flourishes: drop-cap-ish heading underline */
.theme-manuscript .t-h1 {
border-bottom: 1px solid var(--border-strong);
padding-bottom: 8px;
font-style: italic;
letter-spacing: -0.005em;
}
.theme-manuscript .t-h2 {
font-style: italic;
font-weight: 500;
color: var(--accent-strong);
}
.theme-manuscript .brand-name { font-style: italic; }
.theme-manuscript .canvas-title { font-style: italic; font-weight: 500; }