Spec Studio

A diagram offers Mermaid source as copyable text

spec:consumers.spec-studio.diagram-kinds.mermaid-sourceUse Case / Behavior · storyready floor ready

New since the base graph base da4b141. See the diff.

Base input: schema 0.11.0, 405 Specs.

Packs: pack:roadmaps-and-slices-v1, pack:self-hosting-v1

Design: 6 design entries · no pinned declarations · 2 decisions

Findings: no errors, no warnings

specs/consumers/spec-studio.diagram-kinds.mermaid-source.sdp.md

No open questions and no blocking questions; implementation binding present, verifier binding present, and expected-outcome oracle none.

Mermaid source is a second serialization of the drawing's supplied values. It changes neither the static SVG renderer nor the separately shipped Mermaid root, so it requires no decision refining either ruling. A future Mermaid runtime, layout library or change to that root would need its own decision.

Intent
outcome
Copy a drawing into another document while keeping the Studio usable without script or a Mermaid runtime.
Behavior
rule.sourceOnly line 21 · specs/consumers/spec-studio.diagram-kinds.mermaid-source.sdp.md:21
Build escaped Mermaid text from the same selected and folded diagram values as the SVG. Source is an optional export, never a browser rendering path, a network request, a new command or a write to the shipped Mermaid root.

no example exercises it

rule.losslessMeaning line 22 · specs/consumers/spec-studio.diagram-kinds.mermaid-source.sdp.md:22
Each kind names its preferred syntax. Use a labelled flowchart fallback whenever that syntax cannot state the drawing's exact relations, claims or folds. State the chosen syntax and fallback reason beside the source. Preserve full ids in labels or comments and every aggregation count and folded member identity in comments; the text equivalent remains authoritative for the diagram's reading.

no example exercises it

rule.copy line 23 · specs/consumers/spec-studio.diagram-kinds.mermaid-source.sdp.md:23
A closed source disclosure contains a read-only text area with a visible label. Without script a reader selects and copies it. The page elements' copy control enhances this same text with its Copy button, Copied feedback and select-the-text fallback. The diagram element keeps only its viewport controls.

no example exercises it

rule.escaping line 24 · specs/consumers/spec-studio.diagram-kinds.mermaid-source.sdp.md:24
Treat every title, label, id and reason as data. Escape HTML at the page boundary and Mermaid syntax at the source boundary; never emit source directives, executable links, raw HTML or configuration supplied by corpus text.

no example exercises it

rule.omission line 25 · specs/consumers/spec-studio.diagram-kinds.mermaid-source.sdp.md:25
A drawing omitted for bounds or routing offers its text equivalent and a reason; it offers no partial Mermaid source that appears complete. Source follows the same explicit scope and folds as its figure.

no example exercises it

0 unkeyed rules.

Design
disclosure line 28 · specs/consumers/spec-studio.diagram-kinds.mermaid-source.sdp.md:28
Summary Mermaid source, a paragraph Copyable source; the Studio draws static SVG., a syntax label and optional fallback explanation, then a labelled read-only textarea and the script-added copy button.
sourceElement line 29 · specs/consumers/spec-studio.diagram-kinds.mermaid-source.sdp.md:29
The disclosure's copy button is the page elements' sdp-copy, given a for attribute that names the source text area so a long source is not repeated in an attribute; no new element is added, and sdp-diagram still adds only pan, zoom and pinch.
sourceEscaping line 30 · specs/consumers/spec-studio.diagram-kinds.mermaid-source.sdp.md:30
Inside a quoted label, ", #, %, < and > become Mermaid entity codes (#quot;, #35;, #37;, #lt;, #gt;); a backtick becomes #96;, a line break becomes a space, and every other character is kept.
sourceIds line 31 · specs/consumers/spec-studio.diagram-kinds.mermaid-source.sdp.md:31
Stable safe aliases assigned in displayed box order, with full graph ids in quoted labels or escaped comments. Aliases are local serialization names, never graph identities. No click directive or initialization directive is emitted.
elementIds line 32 · specs/consumers/spec-studio.diagram-kinds.mermaid-source.sdp.md:32
Use diagram.<subject>[.<view>].source and .source-text, inserting the view name exactly where the diagram's own ids do, so a trace graph's source is diagram.<subject>.source.
export line 33 · specs/consumers/spec-studio.diagram-kinds.mermaid-source.sdp.md:33
The self-contained Pack export retains source as selectable text and omits the copy script; print expands the text equivalent and leaves source closed unless the reader opened it.
Verification

Verifier bindings

  • test:protocol.studio-diagram-core · anchored · test anchor binding present · test/studio-diagram-core.test.ts:37

    External run evidence from test/studio-diagram-core.test.ts

    Test anchors: test:protocol.studio-copy-source, test:protocol.studio-diagram-core. Specs verified by those bindings: spec:consumers.spec-studio.diagram-kinds.edge-routing, spec:consumers.spec-studio.diagram-kinds.legibility, spec:consumers.spec-studio.diagram-kinds.mermaid-source, spec:consumers.spec-studio.diagram-kinds.requirement-trace, spec:consumers.spec-studio.diagrams, spec:consumers.spec-studio.page-elements.

    Run 1: external run evidence from vitest 4.1.10

    Build: CI 380 · Branch: feature/roadmap-and-slices-v0 · Commit: 34909918bf0be0e849959644401797191cae379f · Start: 2026-10-22T17:40:31.456Z · Stop: 2026-10-22T17:42:16.171Z

    NameSuiteResultDuration
    wraps by code point and shortens shared segments without collisionsshared diagram corepassed8.25 ms
    wraps boxes within the width budget and writes an instruction only for final wide drawingsshared diagram corepassed6.1 ms
    routes forward, backward and same-band edges with distinct ports and no shared segmentsshared diagram corepassed14.15 ms
    fails closed when routing cannot fit, retaining complete text and no partial sourceshared diagram corepassed50.17 ms
    serializes full identities, exact claims, reasons, counts and folds as inert Mermaid datashared diagram corepassed1.98 ms
    copies the current value of the labelled textarea and selects that same area on clipboard failurenot recordedpassed55.84 ms
    keeps the full box and edge bound routable with obstacles, separate lanes and edge labelsnot recordedpassed430.81 ms
    offers deterministic Mermaid source for each existing drawing and pins the safe text syntaxnot recordedpassed5.63 ms
    folds reason-bearing trace groups without attributing a member reason to the groupnot recordedpassed8.01 ms
    uses the full band budget for a single context and routes adjacent bands inside itnot recordedpassed0.59 ms
    prints exact short relation words and reserves keys for wording that cannot fitnot recordedpassed6.46 ms
    names viewport and instruction ids for trace and secondary viewsnot recordedpassed3.43 ms
    names the architecture syntax and serializes aliases in displayed box ordernot recordedpassed0.34 ms
    routes the current Protocol architecture and recorded adopter architecture with distinct ports and segmentsnot recordedpassed74.94 ms
    extends overflow rails past earlier labels on the adopter's dense tracesnot recordedpassed4.75 ms
    keeps high-degree boxes inside their cells when contexts share a gridnot recordedpassed1.15 ms
    folds nine refining verifiers with their tests within the band budget and keeps every text rownot recordedpassed2.68 ms
    names folded declared refiners by their relation and claim without an internal subtitlenot recordedpassed2.03 ms
    keeps examples apart from refiners when dense requirement groups foldnot recordedpassed1.09 ms
    names refines folds in plain words and preserves directionnot recordedpassed1.31 ms
    names satisfies folds in plain words and preserves directionnot recordedpassed1.09 ms
    names verifies folds in plain words and preserves directionnot recordedpassed1.46 ms
    keeps a short drawing unfolded even with many boxes and incident edgesnot recordedpassed1.77 ms
    packs disjoint endpoint intervals into shared horizontal lanesnot recordedpassed0.89 ms
    uses a legend key before spending overflow width on exact wordsnot recordedpassed1.18 ms
Design view

Requirement drawing

  • Declared verifying examples: no declared verifying example.
Requirement drawing for spec:consumers.spec-studio.diagram-kinds.mermaid-source
The diagram as text
  • spec:consumers.spec-studio.diagram-kinds.mermaid-source: A diagram offers Mermaid source as copyable text · declared Spec
  • spec:consumers.spec-studio.diagram-kinds: The Studio chooses diagram kinds from graph values · declared Spec
  • impl:protocol.studio-diagram-source: escaped Mermaid flowchart and mindmap source in placed box order · anchored code · src/projections/studio/diagrams/mermaid.ts:13
  • impl:protocol.studio-diagrams: deterministic grid and band layouts with bounded folds and full text equivalents · anchored code · src/projections/studio/diagrams/svg.ts:73
  • test:protocol.studio-diagram-core: test:protocol.studio-diagram-core · anchored test binding · binding present · test/studio-diagram-core.test.ts:37
  • spec:consumers.spec-studio.diagram-kinds.mermaid-source refines spec:consumers.spec-studio.diagram-kinds · declared
  • impl:protocol.studio-diagram-source satisfies spec:consumers.spec-studio.diagram-kinds.mermaid-source · anchored
  • impl:protocol.studio-diagrams satisfies spec:consumers.spec-studio.diagram-kinds.mermaid-source · anchored
  • test:protocol.studio-diagram-core verifies spec:consumers.spec-studio.diagram-kinds.mermaid-source · anchored
Mermaid source

Copyable source; the Studio draws static SVG.

Preferred and chosen syntax: requirementDiagram; exact refines, satisfies and verifies, with claim words in nodes and per-edge comments.

Decisions

  • The shipped projections stay frozen

    Re-specifying the shipped Design Review, census, Mermaid, or Gherkin projection is refused. These four projections are the ruled read surfaces over the one graph. A later decision Spec that supersedes this one replaces the ruling whole; a decision Spec that refines this one narrows it for one projection or one rendering and leaves the rest frozen. Either passes the ADR three-part test.

  • The engine lays out every Studio diagram as static SVG when the page set is built

    The engine lays out every Studio diagram at build time with its own deterministic layered layout and writes it into the page as inline SVG followed by a text equivalent. The custom element that holds a diagram adds only pan, zoom and pinch, by changing the SVG's view box. One diagram draws at most the bound spec:consumers.spec-studio.diagrams#design.bound names, and above it the diagram folds, by context and then by layer, as that Spec states.

Runtime
  • component:protocol.projections · read-only output, layout and owned publication · src/projections/design-review.ts:29 · layer edge · context protocol

    Uses

    • component:protocol.extract · the carrier and source pipeline · src/extract/index.ts:192 · layer application · context protocol
    • component:protocol.graph · the one graph and its semantic decisions · src/graph/schema.ts:34 · layer domain · context protocol
    • component:protocol.model · the authored contracts and stable ids · src/model/anchors.ts:100 · layer domain · context protocol
    • component:protocol.notation · the leaf step codec · src/notation/slots.ts:261 · layer domain · context protocol
    • component:protocol.reader · the typed graph contract and body evaluator · src/reader/reader.ts:671 · layer application · context protocol
    • component:protocol.validate · one finding currency and ordered checks · src/validate/validators.ts:72 · layer domain · context protocol
  • impl:protocol.studio-diagram-source · escaped Mermaid flowchart and mindmap source in placed box order · src/projections/studio/diagrams/mermaid.ts:13

    Component: component:protocol.projections · read-only output, layout and owned publication · src/projections/design-review.ts:29 · layer edge · context protocol

    Uses

    None.

  • impl:protocol.studio-diagrams · deterministic grid and band layouts with bounded folds and full text equivalents · src/projections/studio/diagrams/svg.ts:73

    Component: component:protocol.projections · read-only output, layout and owned publication · src/projections/design-review.ts:29 · layer edge · context protocol

    Uses

    • impl:protocol.studio-diagram-model · shared diagram boxes, edges and drawing bounds · src/projections/studio/diagrams/model.ts:1

Runtime observation: not tracked.

Evidence

Runtime observation: not tracked.

Build attestations: not tracked.

Deployments: not tracked.

Bills of materials: not tracked.

Impact
Relations of spec:consumers.spec-studio.diagram-kinds.mermaid-source
The diagram as text
  • spec:consumers.spec-studio.diagram-kinds: The Studio chooses diagram kinds from graph values
  • spec:consumers.spec-studio.diagram-kinds.mermaid-source: A diagram offers Mermaid source as copyable text
  • spec:consumers.spec-studio.page-elements: A few custom elements filter, search, open and copy on a rendered page
  • spec:decisions.shipped-projections-frozen: The shipped projections stay frozen
  • spec:decisions.studio-diagram-renderer: The engine lays out every Studio diagram as static SVG when the page set is built
  • spec:consumers.spec-studio.diagram-kinds.mermaid-source decidedBy spec:decisions.shipped-projections-frozen · declared
  • spec:consumers.spec-studio.diagram-kinds.mermaid-source decidedBy spec:decisions.studio-diagram-renderer · declared
  • spec:consumers.spec-studio.diagram-kinds.mermaid-source dependsOn spec:consumers.spec-studio.page-elements · declared
  • spec:consumers.spec-studio.diagram-kinds.mermaid-source refines spec:consumers.spec-studio.diagram-kinds · declared
Mermaid source

Copyable source; the Studio draws static SVG.

Preferred syntax: flowchart. Chosen syntax: labelled flowchart, preserving exact relations, claims and folds.

Rests on

Rested on by

No Spec rests on this Spec.

Relations

Relation and directionOther endClaimReasonExercised keys
decidedBy · outgoingThe shipped projections stay frozen
spec:decisions.shipped-projections-frozen · resolves
declaredNoneNone
decidedBy · outgoingThe engine lays out every Studio diagram as static SVG when the page set is built
spec:decisions.studio-diagram-renderer · resolves
declaredNoneNone
dependsOn · outgoingA few custom elements filter, search, open and copy on a rendered page
spec:consumers.spec-studio.page-elements · resolves
declaredNoneNone
refines · outgoingThe Studio chooses diagram kinds from graph values
spec:consumers.spec-studio.diagram-kinds · resolves
declaredNoneNone

Bindings

Implementation binding: present

  • impl:protocol.studio-diagram-source · escaped Mermaid flowchart and mindmap source in placed box order · src/projections/studio/diagrams/mermaid.ts:13 · role projection · component component:protocol.projections · layer edge · context protocol
  • impl:protocol.studio-diagrams · deterministic grid and band layouts with bounded folds and full text equivalents · src/projections/studio/diagrams/svg.ts:73 · role projection · component component:protocol.projections · layer edge · context protocol

Design reference: none

Verifier binding: present

  • test:protocol.studio-diagram-core · anchored · test/studio-diagram-core.test.ts:37 · test anchor

Expected-outcome oracle: none

Runtime observation: not tracked.

Run results: not recorded in the graph.

Findings

None.

Composing (0)

Composing needs the script.