outcomeA diagram offers Mermaid source as copyable text
spec:consumers.spec-studio.diagram-kinds.mermaid-sourceNew 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
- Copy a drawing into another document while keeping the Studio usable without script or a Mermaid runtime.
Behavior
rule.sourceOnlyline 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.losslessMeaningline 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.copyline 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.escapingline 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.omissionline 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
disclosureline 28 ·specs/consumers/spec-studio.diagram-kinds.mermaid-source.sdp.md:28- Summary
Mermaid source, a paragraphCopyable 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. sourceElementline 29 ·specs/consumers/spec-studio.diagram-kinds.mermaid-source.sdp.md:29- The disclosure's copy button is the page elements'
sdp-copy, given aforattribute that names the source text area so a long source is not repeated in an attribute; no new element is added, andsdp-diagramstill adds only pan, zoom and pinch. sourceEscapingline 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. sourceIdsline 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.
elementIdsline 32 ·specs/consumers/spec-studio.diagram-kinds.mermaid-source.sdp.md:32- Use
diagram.<subject>[.<view>].sourceand.source-text, inserting the view name exactly where the diagram's own ids do, so a trace graph's source isdiagram.<subject>.source. exportline 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:37External run evidence from
test/studio-diagram-core.test.tsTest 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
Name Suite Result Duration wraps by code point and shortens shared segments without collisions shared diagram core passed 8.25 ms wraps boxes within the width budget and writes an instruction only for final wide drawings shared diagram core passed 6.1 ms routes forward, backward and same-band edges with distinct ports and no shared segments shared diagram core passed 14.15 ms fails closed when routing cannot fit, retaining complete text and no partial source shared diagram core passed 50.17 ms serializes full identities, exact claims, reasons, counts and folds as inert Mermaid data shared diagram core passed 1.98 ms copies the current value of the labelled textarea and selects that same area on clipboard failure not recorded passed 55.84 ms keeps the full box and edge bound routable with obstacles, separate lanes and edge labels not recorded passed 430.81 ms offers deterministic Mermaid source for each existing drawing and pins the safe text syntax not recorded passed 5.63 ms folds reason-bearing trace groups without attributing a member reason to the group not recorded passed 8.01 ms uses the full band budget for a single context and routes adjacent bands inside it not recorded passed 0.59 ms prints exact short relation words and reserves keys for wording that cannot fit not recorded passed 6.46 ms names viewport and instruction ids for trace and secondary views not recorded passed 3.43 ms names the architecture syntax and serializes aliases in displayed box order not recorded passed 0.34 ms routes the current Protocol architecture and recorded adopter architecture with distinct ports and segments not recorded passed 74.94 ms extends overflow rails past earlier labels on the adopter's dense traces not recorded passed 4.75 ms keeps high-degree boxes inside their cells when contexts share a grid not recorded passed 1.15 ms folds nine refining verifiers with their tests within the band budget and keeps every text row not recorded passed 2.68 ms names folded declared refiners by their relation and claim without an internal subtitle not recorded passed 2.03 ms keeps examples apart from refiners when dense requirement groups fold not recorded passed 1.09 ms names refines folds in plain words and preserves direction not recorded passed 1.31 ms names satisfies folds in plain words and preserves direction not recorded passed 1.09 ms names verifies folds in plain words and preserves direction not recorded passed 1.46 ms keeps a short drawing unfolded even with many boxes and incident edges not recorded passed 1.77 ms packs disjoint endpoint intervals into shared horizontal lanes not recorded passed 0.89 ms uses a legend key before spending overflow width on exact words not recorded passed 1.18 ms
Design view
Requirement drawing
- Declared verifying examples: no declared verifying example.
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.boundnames, 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:13Component:
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:73Component:
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
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
- refines · spec:consumers.spec-studio.diagram-kinds · stated ready, floor ready
- dependsOn · spec:consumers.spec-studio.page-elements · stated ready, floor ready
- decidedBy · spec:decisions.shipped-projections-frozen · stated ready, floor ready
- decidedBy · spec:decisions.studio-diagram-renderer · stated ready, floor ready
Rested on by
No Spec rests on this Spec.
Relations
| Relation and direction | Other end | Claim | Reason | Exercised keys |
|---|---|---|---|---|
| decidedBy · outgoing | The shipped projections stay frozenspec:decisions.shipped-projections-frozen · resolves | declared | None | None |
| decidedBy · outgoing | The engine lays out every Studio diagram as static SVG when the page set is builtspec:decisions.studio-diagram-renderer · resolves | declared | None | None |
| dependsOn · outgoing | A few custom elements filter, search, open and copy on a rendered pagespec:consumers.spec-studio.page-elements · resolves | declared | None | None |
| refines · outgoing | The Studio chooses diagram kinds from graph valuesspec:consumers.spec-studio.diagram-kinds · resolves | declared | None | None |
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 protocolimpl: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.