schematex 0.8.0 → 0.8.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ai/ai-sdk.cjs +9 -9
- package/dist/ai/ai-sdk.d.cts +3 -3
- package/dist/ai/ai-sdk.d.ts +3 -3
- package/dist/ai/ai-sdk.js +4 -4
- package/dist/ai/index.cjs +15 -15
- package/dist/ai/index.d.cts +3 -3
- package/dist/ai/index.d.ts +3 -3
- package/dist/ai/index.js +4 -4
- package/dist/{api-BnJAPCwC.d.cts → api-BDMaX1cT.d.cts} +1 -1
- package/dist/{api-DAZJGq9r.d.ts → api-OED2jUVj.d.ts} +1 -1
- package/dist/browser.cjs +10 -10
- package/dist/browser.d.cts +3 -3
- package/dist/browser.d.ts +3 -3
- package/dist/browser.js +4 -4
- package/dist/{chunk-2YBBDPOW.cjs → chunk-AJJYWXZB.cjs} +2 -2
- package/dist/chunk-AJJYWXZB.cjs.map +1 -0
- package/dist/{chunk-TXMT4XLE.js → chunk-FLDHD4RM.js} +141 -7
- package/dist/chunk-FLDHD4RM.js.map +1 -0
- package/dist/{chunk-WNGOG4CI.js → chunk-GDZNTILD.js} +5 -3
- package/dist/chunk-GDZNTILD.js.map +1 -0
- package/dist/{chunk-RKN6QJ7K.cjs → chunk-HWNVSNDJ.cjs} +143 -9
- package/dist/chunk-HWNVSNDJ.cjs.map +1 -0
- package/dist/{chunk-6DVK5M2J.js → chunk-KF3DFASA.js} +2 -2
- package/dist/chunk-KF3DFASA.js.map +1 -0
- package/dist/{chunk-KUITLG4N.cjs → chunk-LENRV7ZJ.cjs} +5 -3
- package/dist/chunk-LENRV7ZJ.cjs.map +1 -0
- package/dist/{chunk-XI5QP7LM.js → chunk-LM5X7ZNR.js} +973 -95
- package/dist/chunk-LM5X7ZNR.js.map +1 -0
- package/dist/{chunk-3CSST5GZ.cjs → chunk-UGB42BGK.cjs} +975 -96
- package/dist/chunk-UGB42BGK.cjs.map +1 -0
- package/dist/{diagnostics-B-jOt6Ua.d.cts → diagnostics-hObcaaFC.d.cts} +1 -1
- package/dist/{diagnostics-B-jOt6Ua.d.ts → diagnostics-hObcaaFC.d.ts} +1 -1
- package/dist/diagrams/blockdiagram/index.d.cts +1 -1
- package/dist/diagrams/blockdiagram/index.d.ts +1 -1
- package/dist/diagrams/circuit/index.d.cts +1 -1
- package/dist/diagrams/circuit/index.d.ts +1 -1
- package/dist/diagrams/ecomap/index.d.cts +1 -1
- package/dist/diagrams/ecomap/index.d.ts +1 -1
- package/dist/diagrams/entity/index.cjs +5 -5
- package/dist/diagrams/entity/index.d.cts +1 -1
- package/dist/diagrams/entity/index.d.ts +1 -1
- package/dist/diagrams/entity/index.js +1 -1
- package/dist/diagrams/fishbone/index.d.cts +1 -1
- package/dist/diagrams/fishbone/index.d.ts +1 -1
- package/dist/diagrams/flowchart/index.d.cts +2 -2
- package/dist/diagrams/flowchart/index.d.ts +2 -2
- package/dist/diagrams/genogram/index.d.cts +1 -1
- package/dist/diagrams/genogram/index.d.ts +1 -1
- package/dist/diagrams/ladder/index.d.cts +1 -1
- package/dist/diagrams/ladder/index.d.ts +1 -1
- package/dist/diagrams/logic/index.d.cts +1 -1
- package/dist/diagrams/logic/index.d.ts +1 -1
- package/dist/diagrams/orgchart/index.d.cts +1 -1
- package/dist/diagrams/orgchart/index.d.ts +1 -1
- package/dist/diagrams/pedigree/index.d.cts +1 -1
- package/dist/diagrams/pedigree/index.d.ts +1 -1
- package/dist/diagrams/phylo/index.d.cts +1 -1
- package/dist/diagrams/phylo/index.d.ts +1 -1
- package/dist/diagrams/sld/index.cjs +7 -7
- package/dist/diagrams/sld/index.d.cts +1 -1
- package/dist/diagrams/sld/index.d.ts +1 -1
- package/dist/diagrams/sld/index.js +1 -1
- package/dist/diagrams/sociogram/index.d.cts +1 -1
- package/dist/diagrams/sociogram/index.d.ts +1 -1
- package/dist/diagrams/timing/index.d.cts +1 -1
- package/dist/diagrams/timing/index.d.ts +1 -1
- package/dist/diagrams/venn/index.d.cts +1 -1
- package/dist/diagrams/venn/index.d.ts +1 -1
- package/dist/{index-D-MAB6CH.d.cts → index-B0YO7rx8.d.cts} +1 -1
- package/dist/{index-8MaUFTMN.d.ts → index-u3KZBdas.d.ts} +1 -1
- package/dist/index.cjs +41 -37
- package/dist/index.d.cts +7 -5
- package/dist/index.d.ts +7 -5
- package/dist/index.js +5 -5
- package/dist/react.cjs +4 -4
- package/dist/react.d.cts +2 -2
- package/dist/react.d.ts +2 -2
- package/dist/react.js +3 -3
- package/dist/{tools-CV1JZ75-.d.cts → tools-CVgUmiGP.d.cts} +2 -2
- package/dist/{tools-CcPysgAD.d.ts → tools-CbBjmZVr.d.ts} +2 -2
- package/package.json +1 -1
- package/dist/chunk-2YBBDPOW.cjs.map +0 -1
- package/dist/chunk-3CSST5GZ.cjs.map +0 -1
- package/dist/chunk-6DVK5M2J.js.map +0 -1
- package/dist/chunk-KUITLG4N.cjs.map +0 -1
- package/dist/chunk-RKN6QJ7K.cjs.map +0 -1
- package/dist/chunk-TXMT4XLE.js.map +0 -1
- package/dist/chunk-WNGOG4CI.js.map +0 -1
- package/dist/chunk-XI5QP7LM.js.map +0 -1
|
@@ -175,7 +175,9 @@ function parseEntityDSL(text2) {
|
|
|
175
175
|
jurisdictionMap.set(code, def);
|
|
176
176
|
continue;
|
|
177
177
|
}
|
|
178
|
-
const clusterMatch = line.match(
|
|
178
|
+
const clusterMatch = line.match(
|
|
179
|
+
/^cluster\s+"([^"]*)"(?:\s*\[((?:[^\][]|\[[^\]]*\])*)\])?\s*$/i
|
|
180
|
+
);
|
|
179
181
|
if (clusterMatch) {
|
|
180
182
|
const label = clusterMatch[1];
|
|
181
183
|
const props = clusterMatch[2] ? parseProps(clusterMatch[2]) : {};
|
|
@@ -1049,5 +1051,5 @@ var entity = {
|
|
|
1049
1051
|
};
|
|
1050
1052
|
|
|
1051
1053
|
export { entity, layoutEntity, parseEntityDSL, renderEntity };
|
|
1052
|
-
//# sourceMappingURL=chunk-
|
|
1053
|
-
//# sourceMappingURL=chunk-
|
|
1054
|
+
//# sourceMappingURL=chunk-GDZNTILD.js.map
|
|
1055
|
+
//# sourceMappingURL=chunk-GDZNTILD.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/diagrams/entity/parser.ts","../src/diagrams/entity/layout.ts","../src/diagrams/entity/renderer.ts","../src/diagrams/entity/index.ts"],"names":["text","title","path","textHalf"],"mappings":";;;;;AAWO,IAAM,gBAAA,GAAN,cAA+B,KAAA,CAAM;AAAA,EAC1C,YAAY,OAAA,EAAiB;AAC3B,IAAA,KAAA,CAAM,OAAO,CAAA;AACb,IAAA,IAAA,CAAK,IAAA,GAAO,kBAAA;AAAA,EACd;AACF,CAAA;AAEA,IAAM,iBAAA,GAAgD;AAAA,EACpD,IAAA,EAAM,MAAA;AAAA,EACN,WAAA,EAAa,MAAA;AAAA,EACb,GAAA,EAAK,MAAA;AAAA,EACL,GAAA,EAAK,KAAA;AAAA,EACL,GAAA,EAAK,KAAA;AAAA,EACL,IAAA,EAAM,KAAA;AAAA,EACN,EAAA,EAAI,KAAA;AAAA,EACJ,EAAA,EAAI,IAAA;AAAA,EACJ,IAAA,EAAM,IAAA;AAAA,EACN,IAAA,EAAM,IAAA;AAAA,EACN,KAAA,EAAO,OAAA;AAAA,EACP,UAAA,EAAY,YAAA;AAAA,EACZ,MAAA,EAAQ,YAAA;AAAA,EACR,UAAA,EAAY,YAAA;AAAA,EACZ,GAAA,EAAK,YAAA;AAAA,EACL,WAAA,EAAa,aAAA;AAAA,EACb,MAAA,EAAQ,aAAA;AAAA,EACR,IAAA,EAAM,MAAA;AAAA,EACN,WAAA,EAAa,aAAA;AAAA,EACb,GAAA,EAAK;AACP,CAAA;AAEA,SAAS,aAAa,CAAA,EAAmB;AACvC,EAAA,IAAI,GAAA,GAAM,EAAA;AACV,EAAA,IAAI,OAAA,GAAU,KAAA;AACd,EAAA,KAAA,MAAW,MAAM,CAAA,EAAG;A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EA,SAAS,UAAA,CAAW,OAAmB,GAAA,EAAqB;AAC1D,EAAA,IAAI,GAAA,KAAQ,0BAA0B,OAAO,wBAAA;AAC7C,EAAA,IAAI,GAAA,KAAQ,+BAA+B,OAAO,uBAAA;AAClD,EAAA,IAAI,GAAA,KAAQ,uBAAuB,OAAO,sBAAA;AAC1C,EAAA,IAAI,GAAA,KAAQ,8BAA8B,OAAO,sBAAA;AACjD,EAAA,OAAO,iBAAA;AACT;;;ACzeO,IAAM,MAAA,GAAwB;AAAA,EACnC,IAAA,EAAM,QAAA;AAAA,EACN,OAAOH,KAAAA,EAAuB;AAC5B,IAAA,MAAM,KAAA,GAAQA,KAAAA,CAAK,IAAA,EAAK,CAAE,KAAA,CAAM,IAAI,CAAA,CAAE,CAAC,CAAA,EAAG,IAAA,EAAK,CAAE,WAAA,EAAY,IAAK,EAAA;AAClE,IAAA,OAAO,KAAA,CAAM,WAAW,kBAAkB,CAAA;AAAA,EAC5C,CAAA;AAAA,EACA,KAAA,EAAO,cAAA;AAAA,EAEP,MAAA,CAAOA,OAAc,MAAA,EAAgB;AACnC,IAAA,MAAM,GAAA,GAAM,eAAeA,KAAI,CAAA;AAC/B,IAAA,OAAO,YAAA,CAAa,KAAK,MAAM,CAAA;AAAA,EACjC;AACF","file":"chunk-GDZNTILD.js","sourcesContent":["import type {\n EntityAST,\n EntityNode,\n EntityType,\n EntityEdge,\n EntityEdgeOp,\n JurisdictionDef,\n ClusterDef,\n} from \"../../core/types\";\nimport { matchQuotedTitle } from \"../../core/quotes\";\n\nexport class EntityParseError extends Error {\n constructor(message: string) {\n super(message);\n this.name = \"EntityParseError\";\n }\n}\n\nconst ENTITY_TYPE_ALIAS: Record<string, EntityType> = {\n corp: \"corp\",\n corporation: \"corp\",\n inc: \"corp\",\n llc: \"llc\",\n llp: \"llc\",\n gmbh: \"llc\",\n bv: \"llc\",\n lp: \"lp\",\n lllp: \"lp\",\n fund: \"lp\",\n trust: \"trust\",\n individual: \"individual\",\n person: \"individual\",\n foundation: \"foundation\",\n npo: \"foundation\",\n disregarded: \"disregarded\",\n branch: \"disregarded\",\n pool: \"pool\",\n placeholder: \"placeholder\",\n tbf: \"placeholder\",\n};\n\nfunction stripComment(s: string): string {\n let out = \"\";\n let inQuote = false;\n for (const ch of s) {\n if (ch === '\"') inQuote = !inQuote;\n if (ch === \"#\" && !inQuote) break;\n out += ch;\n }\n return out;\n}\n\nfunction stripQuotes(v: string): string {\n const t = v.trim();\n if (t.length >= 2 && t.startsWith('\"') && t.endsWith('\"')) return t.slice(1, -1);\n return t;\n}\n\n/** Split by top-level commas (respecting quotes and bracket nesting) */\nfunction splitTopLevelCommas(inside: string): string[] {\n const parts: string[] = [];\n let cur = \"\";\n let inQuote = false;\n let depth = 0;\n for (const ch of inside) {\n if (ch === '\"') inQuote = !inQuote;\n if (!inQuote) {\n if (ch === \"[\") depth++;\n else if (ch === \"]\") depth--;\n }\n if (ch === \",\" && !inQuote && depth === 0) {\n parts.push(cur);\n cur = \"\";\n } else {\n cur += ch;\n }\n }\n if (cur.trim()) parts.push(cur);\n return parts;\n}\n\nfunction parseProps(inside: string): Record<string, string> {\n const out: Record<string, string> = {};\n for (const p of splitTopLevelCommas(inside)) {\n const s = p.trim();\n if (!s) continue;\n const colon = s.indexOf(\":\");\n if (colon < 0) throw new EntityParseError(`Invalid property \"${s}\" (missing \":\")`);\n const k = s.slice(0, colon).trim().toLowerCase();\n const v = s.slice(colon + 1).trim();\n out[k] = v;\n }\n return out;\n}\n\nfunction parseIdList(v: string): string[] {\n const t = v.trim();\n const inner = t.startsWith(\"[\") && t.endsWith(\"]\") ? t.slice(1, -1) : t;\n return inner\n .split(\",\")\n .map((s) => s.trim())\n .filter(Boolean);\n}\n\n/** Join lines so that a bracketed attribute block spans a single logical line. */\nfunction joinBrackets(lines: string[]): string[] {\n const out: string[] = [];\n let buf = \"\";\n let depth = 0;\n for (const raw of lines) {\n const line = stripComment(raw);\n if (!line.trim() && depth === 0) {\n if (buf) {\n out.push(buf);\n buf = \"\";\n }\n out.push(\"\");\n continue;\n }\n for (const ch of line) {\n if (ch === \"[\") depth++;\n else if (ch === \"]\") depth = Math.max(0, depth - 1);\n }\n buf = buf ? buf + \" \" + line.trim() : line;\n if (depth === 0) {\n out.push(buf);\n buf = \"\";\n }\n }\n if (buf) out.push(buf);\n return out;\n}\n\nconst EDGE_OPS: Array<{ token: string; op: EntityEdgeOp }> = [\n // Order matters: longer tokens first\n { token: \"==>\", op: \"voting\" },\n { token: \"-.->\", op: \"pool\" },\n { token: \"-~->\", op: \"license\" },\n { token: \"-->\", op: \"distribution\" },\n { token: \"->\", op: \"ownership\" },\n];\n\nfunction matchEdgeOp(line: string): { op: EntityEdgeOp; idx: number; len: number } | null {\n for (const { token, op } of EDGE_OPS) {\n // Find an instance flanked by non-alphanum (so \"->\" inside quoted label is skipped later)\n const idx = findEdgeToken(line, token);\n if (idx >= 0) return { op, idx, len: token.length };\n }\n return null;\n}\n\nfunction findEdgeToken(line: string, token: string): number {\n let inQuote = false;\n let depth = 0;\n for (let i = 0; i < line.length; i++) {\n const ch = line[i];\n if (ch === '\"') inQuote = !inQuote;\n if (!inQuote) {\n if (ch === \"[\") depth++;\n else if (ch === \"]\") depth = Math.max(0, depth - 1);\n }\n if (!inQuote && depth === 0 && line.startsWith(token, i)) {\n return i;\n }\n }\n return -1;\n}\n\nexport function parseEntityDSL(text: string): EntityAST {\n const rawLines = text.split(\"\\n\").map((l) => l.replace(/\\r$/, \"\"));\n const lines = joinBrackets(rawLines);\n\n let title: string | undefined;\n const entities: EntityNode[] = [];\n const entityMap = new Map<string, EntityNode>();\n const edges: EntityEdge[] = [];\n const jurisdictions: JurisdictionDef[] = [];\n const jurisdictionMap = new Map<string, JurisdictionDef>();\n const clusters: ClusterDef[] = [];\n\n let clusterCounter = 0;\n\n for (const raw of lines) {\n const line = raw.trim();\n if (!line) continue;\n\n // Header: entity-structure \"title\" or entity-structure: \"title\"\n if (/^entity-structure\\b/i.test(line)) {\n const t = matchQuotedTitle(line);\n if (t !== undefined) title = t;\n continue;\n }\n\n // jurisdiction CODE \"name\" [color: \"...\"]\n const jurMatch = line.match(\n /^jurisdiction\\s+([A-Za-z]{2,3})\\s+\"([^\"]*)\"(?:\\s*\\[([^\\]]*)\\])?\\s*$/i\n );\n if (jurMatch) {\n const code = jurMatch[1].toUpperCase();\n const name = jurMatch[2];\n const props = jurMatch[3] ? parseProps(jurMatch[3]) : {};\n const def: JurisdictionDef = { code, name };\n if (props.color) def.color = stripQuotes(props.color);\n jurisdictions.push(def);\n jurisdictionMap.set(code, def);\n continue;\n }\n\n // cluster \"name\" [members: [ids], color: \"...\"]\n // The attribute block is allowed to contain ONE level of nested [...] so the\n // `members: [a, b]` array does not prematurely terminate the outer bracket.\n const clusterMatch = line.match(\n /^cluster\\s+\"([^\"]*)\"(?:\\s*\\[((?:[^\\][]|\\[[^\\]]*\\])*)\\])?\\s*$/i\n );\n if (clusterMatch) {\n const label = clusterMatch[1];\n const props = clusterMatch[2] ? parseProps(clusterMatch[2]) : {};\n const def: ClusterDef = {\n id: `cluster-${++clusterCounter}`,\n label,\n members: props.members ? parseIdList(props.members) : [],\n };\n if (props.color) def.color = stripQuotes(props.color);\n clusters.push(def);\n continue;\n }\n\n // entity id \"Name\" type[@jurisdiction] [props]\n const entityMatch = line.match(\n /^entity\\s+([A-Za-z][A-Za-z0-9_-]*)\\s+\"([^\"]*)\"\\s+([a-zA-Z]+)(?:@([A-Za-z]{2,3}))?(?:\\s*\\[([^\\]]*)\\])?\\s*$/\n );\n if (entityMatch) {\n const id = entityMatch[1];\n const name = entityMatch[2];\n const typeStr = entityMatch[3].toLowerCase();\n const jurisdictionCode = entityMatch[4]?.toUpperCase();\n const propsStr = entityMatch[5];\n const entityType = ENTITY_TYPE_ALIAS[typeStr];\n if (!entityType) {\n throw new EntityParseError(`Unknown entity type \"${typeStr}\" for \"${id}\"`);\n }\n if (entityMap.has(id)) {\n throw new EntityParseError(`Duplicate entity id \"${id}\"`);\n }\n const node: EntityNode = { id, name, entityType };\n if (jurisdictionCode) node.jurisdiction = jurisdictionCode;\n if (propsStr) {\n const props = parseProps(propsStr);\n if (props.status) node.status = stripQuotes(props.status) as EntityNode[\"status\"];\n if (props.tax) node.taxClass = stripQuotes(props.tax);\n if (props.role) node.role = stripQuotes(props.role);\n if (props.note) node.note = stripQuotes(props.note);\n if (props.est) node.formationDate = stripQuotes(props.est);\n // Any other keys → properties\n const reserved = new Set([\"status\", \"tax\", \"role\", \"note\", \"est\"]);\n const extras: Record<string, string> = {};\n for (const k of Object.keys(props)) {\n if (!reserved.has(k)) extras[k] = stripQuotes(props[k]);\n }\n if (Object.keys(extras).length) node.properties = extras;\n }\n entities.push(node);\n entityMap.set(id, node);\n continue;\n }\n\n // edge: from <op> to [ : percentage ] [props]\n const edgeInfo = matchEdgeOp(line);\n if (edgeInfo) {\n const left = line.slice(0, edgeInfo.idx).trim();\n const rest = line.slice(edgeInfo.idx + edgeInfo.len).trim();\n if (!/^[A-Za-z][A-Za-z0-9_-]*$/.test(left)) {\n throw new EntityParseError(`Invalid edge source on line: ${line}`);\n }\n // rest: \"target [: pct] [props]\" OR \"target [props]\"\n const restMatch = rest.match(\n /^([A-Za-z][A-Za-z0-9_-]*)(?:\\s*:\\s*([^[]+?))?(?:\\s*\\[([^\\]]*)\\])?\\s*$/\n );\n if (!restMatch) {\n throw new EntityParseError(`Cannot parse edge: ${line}`);\n }\n const to = restMatch[1];\n const pct = restMatch[2]?.trim();\n const propsStr = restMatch[3];\n const edge: EntityEdge = { from: left, to, op: edgeInfo.op };\n if (pct) edge.percentage = pct;\n if (propsStr) {\n const props = parseProps(propsStr);\n if (props.class) edge.shareClass = stripQuotes(props.class);\n if (props.label) edge.label = stripQuotes(props.label);\n }\n edges.push(edge);\n continue;\n }\n\n throw new EntityParseError(`Cannot parse line: ${line}`);\n }\n\n // Validate edges reference known entities\n for (const e of edges) {\n if (!entityMap.has(e.from)) {\n throw new EntityParseError(`Edge references unknown entity \"${e.from}\"`);\n }\n if (!entityMap.has(e.to)) {\n throw new EntityParseError(`Edge references unknown entity \"${e.to}\"`);\n }\n }\n\n if (entities.length === 0) {\n throw new EntityParseError(\"Entity structure diagram has no entities\");\n }\n\n return {\n type: \"entity\",\n title,\n entities,\n edges,\n jurisdictions,\n clusters,\n };\n}\n","import type { EntityAST, EntityNode, EntityEdge, EntityType } from \"../../core/types\";\n\n/**\n * Tier-based top-down layout for entity structure diagrams.\n *\n * - Tier assigned via longest-path from sources (relaxation)\n * - Within-tier x placed by DFS declaration order\n * - Non-bus parents re-centered over children bottom-up\n * - Edges routed orthogonally (down → across → down)\n */\n\nexport interface EntityLayoutNode {\n node: EntityNode;\n x: number; // center x\n y: number; // center y\n tier: number;\n width: number;\n height: number;\n /** Top-center anchor for edge end */\n topY: number;\n bottomY: number;\n}\n\nexport interface EntityLayoutEdge {\n edge: EntityEdge;\n path: string;\n /** Label anchor (horizontal mid of the branch segment) */\n labelX: number;\n labelY: number;\n}\n\nexport interface EntityLayoutCluster {\n id: string;\n label: string;\n color?: string;\n x: number;\n y: number;\n width: number;\n height: number;\n}\n\nexport interface EntityLayoutResult {\n width: number;\n height: number;\n nodes: EntityLayoutNode[];\n nodeById: Map<string, EntityLayoutNode>;\n edges: EntityLayoutEdge[];\n clusters: EntityLayoutCluster[];\n}\n\nconst TIER_GAP = 170;\nconst H_GAP = 70;\nconst PADDING = 40;\nconst CLUSTER_PADDING = 26;\nconst CLUSTER_V_GAP = 16;\n\nexport function geometryFor(type: EntityType): { width: number; height: number } {\n switch (type) {\n case \"trust\":\n return { width: 200, height: 80 }; // ellipse bbox\n case \"individual\":\n return { width: 80, height: 80 }; // circle bbox; label rendered below\n case \"foundation\":\n return { width: 150, height: 80 };\n case \"pool\":\n case \"disregarded\":\n case \"placeholder\":\n case \"corp\":\n case \"llc\":\n case \"lp\":\n default:\n return { width: 170, height: 62 };\n }\n}\n\nfunction computeTiers(ast: EntityAST): Map<string, number> {\n const inEdges = new Map<string, EntityEdge[]>();\n const outEdges = new Map<string, EntityEdge[]>();\n for (const n of ast.entities) {\n inEdges.set(n.id, []);\n outEdges.set(n.id, []);\n }\n for (const e of ast.edges) {\n inEdges.get(e.to)?.push(e);\n outEdges.get(e.from)?.push(e);\n }\n\n // Only ownership-style edges define hierarchy. Lateral relationships\n // (license, distribution, management) should NOT force descendants.\n const isHierarchy = (e: EntityEdge): boolean =>\n e.op === \"ownership\" || e.op === \"voting\" || e.op === \"pool\";\n\n const tiers = new Map<string, number>();\n // Seed: entities with no hierarchical in-edges → tier 0\n for (const n of ast.entities) {\n const hierIn = (inEdges.get(n.id) ?? []).filter(isHierarchy);\n if (hierIn.length === 0) tiers.set(n.id, 0);\n }\n\n const maxIter = ast.entities.length + 4;\n for (let iter = 0; iter < maxIter; iter++) {\n let changed = false;\n for (const e of ast.edges) {\n if (!isHierarchy(e)) continue;\n const fromT = tiers.get(e.from);\n if (fromT === undefined) continue;\n const want = fromT + 1;\n const cur = tiers.get(e.to);\n if (cur === undefined || want > cur) {\n tiers.set(e.to, want);\n changed = true;\n }\n }\n if (!changed) break;\n }\n\n // Non-hierarchical targets: place at same tier as source if not already set\n for (const e of ast.edges) {\n if (isHierarchy(e)) continue;\n if (!tiers.has(e.to)) {\n const src = tiers.get(e.from);\n if (src !== undefined) tiers.set(e.to, src);\n }\n if (!tiers.has(e.from)) {\n const dst = tiers.get(e.to);\n if (dst !== undefined) tiers.set(e.from, dst);\n }\n }\n // Any orphans → tier 0\n for (const n of ast.entities) {\n if (!tiers.has(n.id)) tiers.set(n.id, 0);\n }\n return tiers;\n}\n\nexport function layoutEntity(ast: EntityAST): EntityLayoutResult {\n const tiers = computeTiers(ast);\n const maxTier = Math.max(0, ...Array.from(tiers.values()));\n\n // Group by tier, order by declaration\n const byTier = new Map<number, EntityNode[]>();\n for (const n of ast.entities) {\n const t = tiers.get(n.id) ?? 0;\n if (!byTier.has(t)) byTier.set(t, []);\n byTier.get(t)!.push(n);\n }\n\n // Build layout nodes\n const layoutNodes: EntityLayoutNode[] = [];\n const byId = new Map<string, EntityLayoutNode>();\n for (const n of ast.entities) {\n const g = geometryFor(n.entityType);\n const t = tiers.get(n.id) ?? 0;\n const ln: EntityLayoutNode = {\n node: n,\n x: 0,\n y: PADDING + t * TIER_GAP + g.height / 2,\n tier: t,\n width: g.width,\n height: g.height,\n topY: 0,\n bottomY: 0,\n };\n ln.topY = ln.y - g.height / 2;\n ln.bottomY = ln.y + g.height / 2;\n layoutNodes.push(ln);\n byId.set(n.id, ln);\n }\n\n // Assign sequential X per tier (declaration order)\n for (let t = 0; t <= maxTier; t++) {\n const nodes = byTier.get(t) ?? [];\n let cx = PADDING;\n for (const n of nodes) {\n const ln = byId.get(n.id)!;\n cx += ln.width / 2;\n ln.x = cx;\n cx += ln.width / 2 + H_GAP;\n }\n }\n\n // Parent/child maps for hierarchy only\n const children = new Map<string, string[]>();\n const parents = new Map<string, string[]>();\n for (const n of ast.entities) {\n children.set(n.id, []);\n parents.set(n.id, []);\n }\n for (const e of ast.edges) {\n if (e.op === \"ownership\" || e.op === \"voting\" || e.op === \"pool\") {\n children.get(e.from)?.push(e.to);\n parents.get(e.to)?.push(e.from);\n }\n }\n\n // Center parents over their children bottom-up\n for (let iter = 0; iter < 4; iter++) {\n for (let t = maxTier - 1; t >= 0; t--) {\n const tierNodes = byTier.get(t) ?? [];\n for (const n of tierNodes) {\n const ln = byId.get(n.id)!;\n const childIds = children.get(n.id) ?? [];\n if (childIds.length === 0) continue;\n if (childIds.length === 1) {\n // Cap-table convergence: if the only child has multiple same-tier parents,\n // spread parents around the child's x rather than collapsing them.\n const child = byId.get(childIds[0]);\n if (!child) continue;\n const siblingParents = (parents.get(child.node.id) ?? [])\n .map((pid) => byId.get(pid))\n .filter((p): p is EntityLayoutNode => !!p && p.tier === t);\n if (siblingParents.length > 1) {\n siblingParents.sort(\n (a, b) =>\n (byTier.get(t) ?? []).indexOf(a.node) -\n (byTier.get(t) ?? []).indexOf(b.node)\n );\n const totalWidth = siblingParents.reduce(\n (sum, p) => sum + effectiveHalfWidth(p) * 2,\n 0\n );\n const spread = Math.max(\n H_GAP + (effectiveHalfWidth(ln) + effectiveHalfWidth(siblingParents[0])) / 1,\n totalWidth / Math.max(1, siblingParents.length - 1)\n );\n const idx = siblingParents.indexOf(ln);\n const n2 = siblingParents.length;\n ln.x = child.x + (idx - (n2 - 1) / 2) * spread;\n } else {\n ln.x = child.x;\n }\n continue;\n }\n const xs = childIds\n .map((c) => byId.get(c)?.x)\n .filter((v): v is number => v !== undefined);\n if (xs.length > 0) {\n ln.x = (Math.min(...xs) + Math.max(...xs)) / 2;\n }\n }\n }\n\n // Center child over multiple parents (cap table convergence)\n for (let t = 1; t <= maxTier; t++) {\n const tierNodes = byTier.get(t) ?? [];\n for (const n of tierNodes) {\n const ln = byId.get(n.id)!;\n const parentIds = parents.get(n.id) ?? [];\n if (parentIds.length < 2) continue;\n const xs = parentIds\n .map((p) => byId.get(p)?.x)\n .filter((v): v is number => v !== undefined);\n if (xs.length > 0) {\n ln.x = (Math.min(...xs) + Math.max(...xs)) / 2;\n }\n }\n }\n\n // Resolve within-tier overlaps (preserve declaration order, label-aware)\n for (let t = 0; t <= maxTier; t++) {\n const tierNodes = (byTier.get(t) ?? [])\n .map((n) => byId.get(n.id)!)\n .sort((a, b) => a.x - b.x);\n for (let i = 1; i < tierNodes.length; i++) {\n const prev = tierNodes[i - 1];\n const cur = tierNodes[i];\n const gap = effectiveHalfWidth(prev) + effectiveHalfWidth(cur) + H_GAP;\n if (cur.x - prev.x < gap) cur.x = prev.x + gap;\n }\n }\n }\n\n // Shift so leftmost content sits at PADDING\n let minLeft = Infinity;\n for (const ln of layoutNodes) {\n const left = ln.x - ln.width / 2;\n if (left < minLeft) minLeft = left;\n }\n const shift = PADDING - minLeft;\n if (Math.abs(shift) > 0.5) {\n for (const ln of layoutNodes) ln.x += shift;\n }\n\n // Build edges with orthogonal routing.\n //\n // Label placement strategy for hierarchical (down) edges:\n // - fan-in (child has >1 parents, e.g. cap-table): label on child-side\n // vertical stub, just above child.topY. Owner-share reads naturally\n // as \"X% of [child]\".\n // - fan-out (parent has >1 children, e.g. holdco → subs): label on\n // parent-side vertical stub, just below parent.bottomY.\n // - 1:1 straight drop: label offset to the side of the vertical line.\n // - otherwise (branching both sides): label at midpoint of parent stub.\n // This avoids stacking multiple labels on the shared horizontal bar.\n const edges: EntityLayoutEdge[] = [];\n for (const e of ast.edges) {\n const from = byId.get(e.from);\n const to = byId.get(e.to);\n if (!from || !to) continue;\n\n const sameTier = from.tier === to.tier;\n let path: string;\n let labelX: number;\n let labelY: number;\n\n if (sameTier) {\n const leftFirst = from.x < to.x;\n const sx = leftFirst ? from.x + from.width / 2 : from.x - from.width / 2;\n const ex = leftFirst ? to.x - to.width / 2 : to.x + to.width / 2;\n path = `M ${sx} ${from.y} L ${ex} ${to.y}`;\n labelX = (sx + ex) / 2;\n labelY = from.y - 6;\n } else {\n const sx = from.x;\n const sy = from.bottomY;\n const ex = to.x;\n const ey = to.topY;\n const straight = Math.abs(sx - ex) < 0.5;\n\n if (straight) {\n // No corners → midpoint of the vertical line.\n path = `M ${sx} ${sy} L ${ex} ${ey}`;\n labelX = sx;\n labelY = (sy + ey) / 2;\n } else {\n // L-path has two corners: (sx, midY) top and (ex, midY) bottom.\n // Each edge owns its corners uniquely, so placing the label at a\n // corner avoids stacking on the shared horizontal branch.\n const midY = (sy + ey) / 2;\n path = `M ${sx} ${sy} L ${sx} ${midY} L ${ex} ${midY} L ${ex} ${ey}`;\n\n const isHier =\n e.op === \"ownership\" || e.op === \"voting\" || e.op === \"pool\";\n const parentCount = isHier ? (parents.get(e.to) ?? []).length : 0;\n const fanIn = parentCount > 1;\n\n // fan-in (many parents → one child): top corner (parent side) is\n // unique per parent.\n // fan-out (one parent → many children): bottom corner (child side)\n // is unique per child.\n // 1:1 offset: bottom corner — reads naturally as \"X% of [child]\".\n if (fanIn) {\n labelX = sx;\n labelY = midY;\n } else {\n labelX = ex;\n labelY = midY;\n }\n }\n }\n\n edges.push({ edge: e, path, labelX, labelY });\n }\n\n // Build cluster rectangles (explicit members only, or auto by jurisdiction)\n const layoutClusters: EntityLayoutCluster[] = [];\n const usedIds = new Set<string>();\n\n const LABEL_ROW = 22;\n\n for (const c of ast.clusters) {\n const members = c.members\n .map((id) => byId.get(id))\n .filter((n): n is EntityLayoutNode => !!n);\n if (members.length === 0) continue;\n const bounds = boundingBox(members);\n layoutClusters.push({\n id: c.id,\n label: c.label,\n color: c.color,\n x: bounds.minX - CLUSTER_PADDING,\n y: bounds.minY - CLUSTER_PADDING - LABEL_ROW,\n width: bounds.maxX - bounds.minX + CLUSTER_PADDING * 2,\n height: bounds.maxY - bounds.minY + CLUSTER_PADDING * 2 + LABEL_ROW,\n });\n for (const m of members) usedIds.add(m.node.id);\n }\n\n // Auto-cluster by declared jurisdiction (only those not already in explicit cluster)\n for (const j of ast.jurisdictions) {\n const members = layoutNodes.filter(\n (n) => n.node.jurisdiction === j.code && !usedIds.has(n.node.id)\n );\n if (members.length === 0) continue;\n const bounds = boundingBox(members);\n layoutClusters.push({\n id: `jur-${j.code}`,\n label: j.name,\n color: j.color,\n x: bounds.minX - CLUSTER_PADDING,\n y: bounds.minY - CLUSTER_PADDING - LABEL_ROW,\n width: bounds.maxX - bounds.minX + CLUSTER_PADDING * 2,\n height: bounds.maxY - bounds.minY + CLUSTER_PADDING * 2 + LABEL_ROW,\n });\n for (const m of members) usedIds.add(m.node.id);\n }\n\n // Resolve cluster vertical overlaps on the same band — if two clusters at\n // different tiers overlap vertically, shrink the top one's bottom and push\n // the bottom one's top so their borders don't cross.\n for (let i = 0; i < layoutClusters.length; i++) {\n for (let k = i + 1; k < layoutClusters.length; k++) {\n const a = layoutClusters[i];\n const b = layoutClusters[k];\n const hOverlap = !(a.x + a.width < b.x || b.x + b.width < a.x);\n const vOverlap = !(a.y + a.height < b.y || b.y + b.height < a.y);\n if (!hOverlap || !vOverlap) continue;\n // Determine which is above\n const [top, bot] = a.y < b.y ? [a, b] : [b, a];\n const want = bot.y - CLUSTER_V_GAP;\n if (top.y + top.height > want) top.height = Math.max(20, want - top.y);\n }\n }\n\n // Compute canvas\n let maxX = 0;\n let maxY = 0;\n for (const ln of layoutNodes) {\n const right = ln.x + ln.width / 2;\n const bottom = ln.bottomY + 40; // space for role/note label\n if (right > maxX) maxX = right;\n if (bottom > maxY) maxY = bottom;\n }\n for (const c of layoutClusters) {\n if (c.x + c.width > maxX) maxX = c.x + c.width;\n if (c.y + c.height > maxY) maxY = c.y + c.height;\n }\n const width = Math.max(400, maxX + PADDING);\n const height = Math.max(200, maxY + PADDING);\n\n return {\n width,\n height,\n nodes: layoutNodes,\n nodeById: byId,\n edges,\n clusters: layoutClusters,\n };\n}\n\n/**\n * Effective half-width for collision resolution — includes the label text that\n * extends beyond the shape (especially individuals where name/role are rendered\n * BELOW the circle, wider than the circle itself).\n */\nfunction effectiveHalfWidth(ln: EntityLayoutNode): number {\n const n = ln.node;\n const shapeHalf = ln.width / 2;\n const textLen = (s?: string): number => (s ? s.length : 0);\n if (n.entityType === \"individual\") {\n const longest = Math.max(\n textLen(n.name),\n textLen(n.role),\n textLen(n.note)\n );\n const textHalf = (longest * 6.2) / 2 + 4;\n return Math.max(shapeHalf, textHalf);\n }\n // For non-individual, below-node note can also overflow the shape\n const longestBelow = Math.max(textLen(n.note), textLen(n.role));\n const textHalf = (longestBelow * 6) / 2 + 4;\n return Math.max(shapeHalf, textHalf);\n}\n\nfunction boundingBox(nodes: EntityLayoutNode[]): {\n minX: number;\n maxX: number;\n minY: number;\n maxY: number;\n} {\n let minX = Infinity;\n let maxX = -Infinity;\n let minY = Infinity;\n let maxY = -Infinity;\n for (const n of nodes) {\n minX = Math.min(minX, n.x - n.width / 2);\n maxX = Math.max(maxX, n.x + n.width / 2);\n minY = Math.min(minY, n.topY);\n maxY = Math.max(maxY, n.bottomY + 26); // include space for below-node labels\n }\n return { minX, maxX, minY, maxY };\n}\n","import type { EntityAST, EntityNode, EntityEdge } from \"../../core/types\";\nimport type { RenderConfig } from \"../../core/types\";\nimport {\n svgRoot,\n group,\n el,\n path as pathEl,\n text as textEl,\n title as titleEl,\n desc,\n defs,\n rect,\n circle,\n polygon,\n escapeXml,\n} from \"../../core/svg\";\nimport { resolveBaseTheme, type BaseTheme } from \"../../core/theme\";\nimport {\n layoutEntity,\n type EntityLayoutNode,\n type EntityLayoutEdge,\n} from \"./layout\";\n\nfunction buildCss(t: BaseTheme): string {\n return `\n.lt-entity { font-family: system-ui, -apple-system, sans-serif; }\n.lt-entity-title { font: bold 16px sans-serif; fill: ${t.text}; }\n.lt-entity-name { font: 600 12px sans-serif; fill: ${t.text}; text-anchor: middle; }\n.lt-entity-type { font: 500 10px sans-serif; fill: ${t.textMuted}; text-anchor: middle; }\n.lt-entity-role { font: italic 10px sans-serif; fill: ${t.textMuted}; text-anchor: middle; }\n.lt-entity-note { font: 10px sans-serif; fill: ${t.textMuted}; text-anchor: middle; }\n.lt-entity-badge-bg { fill: ${t.bg}; stroke: ${t.neutral}; stroke-width: 1; }\n.lt-entity-badge-text { font: 600 9px sans-serif; fill: ${t.text}; text-anchor: middle; letter-spacing: 0.5px; }\n.lt-entity-edge { stroke: ${t.stroke}; stroke-width: 1.5; fill: none; }\n.lt-entity-edge-voting { stroke: ${t.stroke}; stroke-width: 1.2; fill: none; }\n.lt-entity-edge-pool { stroke: ${t.neutral}; stroke-width: 1.5; fill: none; stroke-dasharray: 5,4; }\n.lt-entity-edge-license { stroke: ${t.palette[3]}; stroke-width: 1.5; fill: none; stroke-dasharray: 5,4; }\n.lt-entity-edge-distribution { stroke: ${t.positive}; stroke-width: 1.5; fill: none; stroke-dasharray: 5,4; }\n.lt-entity-edge-voting-pref { stroke: ${t.accent}; stroke-width: 1.8; fill: none; }\n.lt-entity-label-bg { fill: ${t.bg}; stroke: ${t.neutral}; stroke-width: 1; }\n.lt-entity-label { font: 600 10px sans-serif; fill: ${t.text}; text-anchor: middle; }\n.lt-entity-label-sub { font: 500 9px sans-serif; fill: ${t.textMuted}; text-anchor: middle; }\n.lt-entity-cluster { fill: none; stroke-dasharray: 6,4; stroke-width: 1.2; }\n.lt-entity-cluster-label-bg { fill: ${t.bg}; }\n.lt-entity-cluster-label { font: 600 11px sans-serif; letter-spacing: 0.5px; }\n.lt-entity-status-new { stroke: ${t.positive}; stroke-width: 2.2; }\n.lt-entity-status-eliminated { stroke: ${t.negative}; stroke-width: 2.2; }\n.lt-entity-status-modified { stroke: ${t.warn}; stroke-width: 2.2; }\n.lt-entity-status-tag { font: 700 8px sans-serif; text-anchor: middle; letter-spacing: 0.5px; }\n`.trim();\n}\n\nconst FILL: Record<string, string> = {\n corp: \"#dbeafe\",\n llc: \"#dcfce7\",\n lp: \"#fef9c3\",\n trust: \"#ede9fe\",\n individual: \"#fed7aa\",\n foundation: \"#fef9c3\",\n disregarded: \"#f5f5f5\",\n pool: \"#f1f5f9\",\n placeholder: \"#f9fafb\",\n};\n\nconst TYPE_LABEL: Record<string, string> = {\n corp: \"Corporation\",\n llc: \"LLC\",\n lp: \"LP / Fund\",\n trust: \"Trust\",\n individual: \"Individual\",\n foundation: \"Foundation\",\n disregarded: \"Disregarded Entity\",\n pool: \"Reserved Pool\",\n placeholder: \"To Be Formed\",\n};\n\nfunction statusClass(node: EntityNode): string | undefined {\n switch (node.status) {\n case \"new\":\n return \"lt-entity-status-new\";\n case \"eliminated\":\n return \"lt-entity-status-eliminated\";\n case \"modified\":\n return \"lt-entity-status-modified\";\n default:\n return undefined;\n }\n}\n\nfunction renderShape(ln: EntityLayoutNode, t: BaseTheme): string {\n const n = ln.node;\n const fill = FILL[n.entityType] ?? t.bg;\n const sc = statusClass(n);\n const commonAttrs: Record<string, string | number> = {\n fill,\n stroke: t.stroke,\n \"stroke-width\": 1.4,\n };\n if (sc) {\n commonAttrs.class = sc;\n }\n // Dashed stroke for disregarded / placeholder / pool\n const dashed =\n n.entityType === \"disregarded\" ||\n n.entityType === \"placeholder\" ||\n n.entityType === \"pool\";\n\n const dashAttr = dashed ? { \"stroke-dasharray\": \"5,3\" } : {};\n const opacity = n.entityType === \"placeholder\" ? { opacity: 0.75 } : {};\n\n const x = -ln.width / 2;\n const y = -ln.height / 2;\n\n switch (n.entityType) {\n case \"corp\":\n return rect({\n x,\n y,\n width: ln.width,\n height: ln.height,\n rx: 0,\n ...commonAttrs,\n ...dashAttr,\n });\n case \"llc\":\n return rect({\n x,\n y,\n width: ln.width,\n height: ln.height,\n rx: 10,\n ry: 10,\n ...commonAttrs,\n });\n case \"lp\": {\n // Notched top corners polygon\n const w = ln.width;\n const h = ln.height;\n const notch = 12;\n const pts = [\n [x + notch, y],\n [x + w - notch, y],\n [x + w, y + notch],\n [x + w, y + h],\n [x, y + h],\n [x, y + notch],\n ]\n .map((p) => p.join(\",\"))\n .join(\" \");\n return polygon({ points: pts, ...commonAttrs });\n }\n case \"trust\":\n return el(\"ellipse\", {\n cx: 0,\n cy: 0,\n rx: ln.width / 2,\n ry: ln.height / 2,\n ...commonAttrs,\n });\n case \"individual\":\n return circle({\n cx: 0,\n cy: 0,\n r: Math.min(ln.width, ln.height) / 2 - 4,\n ...commonAttrs,\n });\n case \"foundation\": {\n const w = ln.width;\n const h = ln.height;\n const tip = 14;\n const pts = [\n [x + w / 2, y - tip],\n [x + w, y],\n [x + w, y + h],\n [x, y + h],\n [x, y],\n ]\n .map((p) => p.join(\",\"))\n .join(\" \");\n return polygon({ points: pts, ...commonAttrs });\n }\n case \"disregarded\":\n return rect({\n x,\n y,\n width: ln.width,\n height: ln.height,\n ...commonAttrs,\n ...dashAttr,\n });\n case \"pool\":\n return rect({\n x,\n y,\n width: ln.width,\n height: ln.height,\n rx: 8,\n ry: 8,\n ...commonAttrs,\n ...dashAttr,\n });\n case \"placeholder\":\n return rect({\n x,\n y,\n width: ln.width,\n height: ln.height,\n rx: 4,\n ry: 4,\n ...commonAttrs,\n ...dashAttr,\n ...opacity,\n });\n }\n}\n\nfunction renderBadge(ln: EntityLayoutNode): string | undefined {\n const j = ln.node.jurisdiction;\n if (!j) return undefined;\n const bw = j.length >= 3 ? 26 : 20;\n const bh = 13;\n // Top-right corner\n const bx = ln.width / 2 - bw - 4;\n const by = -ln.height / 2 + 4;\n return group({}, [\n rect({ x: bx, y: by, width: bw, height: bh, rx: 2, class: \"lt-entity-badge-bg\" }),\n textEl(\n { x: bx + bw / 2, y: by + bh - 3, class: \"lt-entity-badge-text\" },\n j\n ),\n ]);\n}\n\nfunction renderStatusTag(ln: EntityLayoutNode, t: BaseTheme): string | undefined {\n const n = ln.node;\n if (!n.status || n.status === \"normal\") return undefined;\n const map: Record<string, { label: string; color: string }> = {\n new: { label: \"NEW\", color: t.positive },\n eliminated: { label: \"ELIMINATED\", color: t.negative },\n modified: { label: \"MODIFIED\", color: t.warn },\n };\n const info = map[n.status];\n if (!info) return undefined;\n const w = info.label.length * 6 + 8;\n const h = 12;\n const x = -ln.width / 2 - 2;\n const y = -ln.height / 2 - h - 2;\n return group({}, [\n rect({ x, y, width: w, height: h, rx: 2, fill: info.color, stroke: \"none\" }),\n textEl(\n { x: x + w / 2, y: y + h - 3, class: \"lt-entity-status-tag\", fill: t.bg },\n info.label\n ),\n ]);\n}\n\nfunction renderNodeLabels(ln: EntityLayoutNode): string[] {\n const n = ln.node;\n const pieces: string[] = [];\n const isCircle = n.entityType === \"individual\";\n\n if (isCircle) {\n // Name and role rendered BELOW the circle\n let y = ln.height / 2 + 14;\n pieces.push(textEl({ x: 0, y, class: \"lt-entity-name\" }, n.name));\n y += 13;\n if (n.role) {\n pieces.push(textEl({ x: 0, y, class: \"lt-entity-role\" }, n.role));\n y += 12;\n }\n if (n.note) {\n pieces.push(textEl({ x: 0, y, class: \"lt-entity-note\" }, n.note));\n }\n return pieces;\n }\n\n // Inside-shape rendering\n // Name centered, type underneath\n const topY = -6;\n pieces.push(textEl({ x: 0, y: topY, class: \"lt-entity-name\" }, n.name));\n pieces.push(textEl({ x: 0, y: topY + 14, class: \"lt-entity-type\" }, TYPE_LABEL[n.entityType] ?? n.entityType));\n\n // Below-node: role, note, formation date\n let belowY = ln.height / 2 + 14;\n if (n.role) {\n pieces.push(textEl({ x: 0, y: belowY, class: \"lt-entity-role\" }, n.role));\n belowY += 12;\n }\n if (n.note) {\n pieces.push(textEl({ x: 0, y: belowY, class: \"lt-entity-note\" }, n.note));\n belowY += 12;\n }\n if (n.formationDate) {\n pieces.push(\n textEl({ x: 0, y: belowY, class: \"lt-entity-note\" }, `est. ${n.formationDate}`)\n );\n }\n return pieces;\n}\n\nfunction edgeClass(edge: EntityEdge): string {\n switch (edge.op) {\n case \"pool\":\n return \"lt-entity-edge-pool\";\n case \"license\":\n return \"lt-entity-edge-license\";\n case \"distribution\":\n return \"lt-entity-edge-distribution\";\n case \"voting\":\n return \"lt-entity-edge-voting-pref\";\n case \"ownership\":\n default:\n // Highlight preferred / Series share class\n if (edge.shareClass && /pref|series/i.test(edge.shareClass)) {\n return \"lt-entity-edge-voting-pref\";\n }\n return \"lt-entity-edge\";\n }\n}\n\nfunction renderEdgeLabel(le: EntityLayoutEdge): string | undefined {\n const e = le.edge;\n const lines: string[] = [];\n if (e.percentage) lines.push(e.percentage);\n if (e.label) lines.push(e.label);\n const hasClass = !!e.shareClass;\n if (!lines.length && !hasClass) return undefined;\n\n const main = lines[0];\n const sub = lines[1];\n const classLabel = hasClass ? e.shareClass : undefined;\n\n // Approximate width\n const maxText = Math.max(\n main ? main.length : 0,\n sub ? sub.length : 0,\n classLabel ? classLabel.length : 0\n );\n const w = Math.max(30, maxText * 6 + 10);\n const rows = (main ? 1 : 0) + (sub ? 1 : 0) + (classLabel ? 1 : 0);\n const h = 4 + rows * 12;\n const x = le.labelX - w / 2;\n const y = le.labelY - h / 2;\n const pieces: string[] = [];\n pieces.push(rect({ x, y, width: w, height: h, rx: 3, class: \"lt-entity-label-bg\" }));\n let ty = y + 12;\n if (main) {\n pieces.push(textEl({ x: le.labelX, y: ty, class: \"lt-entity-label\" }, main));\n ty += 12;\n }\n if (sub) {\n pieces.push(textEl({ x: le.labelX, y: ty, class: \"lt-entity-label-sub\" }, sub));\n ty += 12;\n }\n if (classLabel) {\n pieces.push(textEl({ x: le.labelX, y: ty, class: \"lt-entity-label-sub\" }, classLabel));\n }\n return group({}, pieces);\n}\n\nexport function renderEntity(ast: EntityAST, config?: RenderConfig): string {\n const layout = layoutEntity(ast);\n const t = resolveBaseTheme(config?.theme ?? \"default\");\n const titleOffset = ast.title ? 34 : 12;\n const width = Math.ceil(layout.width);\n const height = Math.ceil(layout.height + titleOffset);\n\n const children: string[] = [];\n children.push(titleEl(ast.title ?? \"Entity Structure Diagram\"));\n children.push(\n desc(\n `Entity structure diagram with ${ast.entities.length} entities and ${ast.edges.length} relationships`\n )\n );\n children.push(el(\"style\", {}, buildCss(t)));\n\n // Arrow markers (per semantic role)\n children.push(\n defs([\n arrowMarker(\"lt-entity-arrow\", t.stroke),\n arrowMarker(\"lt-entity-arrow-purple\", t.palette[3] ?? t.stroke),\n arrowMarker(\"lt-entity-arrow-green\", t.positive),\n arrowMarker(\"lt-entity-arrow-grey\", t.neutral),\n arrowMarker(\"lt-entity-arrow-blue\", t.accent),\n ])\n );\n\n if (ast.title) {\n children.push(textEl({ x: 20, y: 22, class: \"lt-entity-title\" }, ast.title));\n }\n\n const inner: string[] = [];\n\n // Clusters (behind nodes) — label sits INSIDE the cluster top row\n for (const c of layout.clusters) {\n const color = c.color ?? t.neutral;\n inner.push(\n rect({\n x: c.x,\n y: c.y,\n width: c.width,\n height: c.height,\n rx: 8,\n stroke: color,\n class: \"lt-entity-cluster\",\n })\n );\n inner.push(\n textEl(\n { x: c.x + 12, y: c.y + 16, class: \"lt-entity-cluster-label\", fill: color },\n c.label\n )\n );\n }\n\n // Edges (before nodes so nodes sit on top)\n for (const le of layout.edges) {\n const cls = edgeClass(le.edge);\n const markerId = pickMarker(le.edge, cls);\n inner.push(\n pathEl({\n d: le.path,\n class: cls,\n \"marker-end\": `url(#${markerId})`,\n })\n );\n }\n // Edge labels AFTER paths so they cover lines\n for (const le of layout.edges) {\n const piece = renderEdgeLabel(le);\n if (piece) inner.push(piece);\n }\n\n // Nodes\n for (const ln of layout.nodes) {\n const parts: string[] = [];\n parts.push(renderShape(ln, t));\n const badge = renderBadge(ln);\n if (badge) parts.push(badge);\n const status = renderStatusTag(ln, t);\n if (status) parts.push(status);\n for (const p of renderNodeLabels(ln)) parts.push(p);\n inner.push(\n group(\n {\n transform: `translate(${ln.x}, ${ln.y})`,\n \"data-entity-id\": ln.node.id,\n \"data-entity-type\": ln.node.entityType,\n \"data-jurisdiction\": ln.node.jurisdiction ?? \"\",\n },\n parts\n )\n );\n }\n\n const wrap = group({ transform: `translate(0, ${titleOffset})` }, inner);\n children.push(wrap);\n\n return svgRoot(\n {\n class: \"lt-entity\",\n role: \"img\",\n \"aria-label\": escapeXml(ast.title ?? \"Entity structure diagram\"),\n width,\n height,\n viewBox: `0 0 ${width} ${height}`,\n },\n children\n );\n}\n\nfunction arrowMarker(id: string, color: string): string {\n return el(\n \"marker\",\n {\n id,\n markerWidth: 9,\n markerHeight: 9,\n refX: 7,\n refY: 3,\n orient: \"auto\",\n markerUnits: \"strokeWidth\",\n },\n [el(\"path\", { d: \"M 0 0 L 7 3 L 0 6 z\", fill: color })]\n );\n}\n\nfunction pickMarker(_edge: EntityEdge, cls: string): string {\n if (cls === \"lt-entity-edge-license\") return \"lt-entity-arrow-purple\";\n if (cls === \"lt-entity-edge-distribution\") return \"lt-entity-arrow-green\";\n if (cls === \"lt-entity-edge-pool\") return \"lt-entity-arrow-grey\";\n if (cls === \"lt-entity-edge-voting-pref\") return \"lt-entity-arrow-blue\";\n return \"lt-entity-arrow\";\n}\n","import type { DiagramPlugin } from \"../../core/types\";\nimport { parseEntityDSL } from \"./parser\";\nimport { renderEntity } from \"./renderer\";\n\nexport const entity: DiagramPlugin = {\n type: \"entity\",\n detect(text: string): boolean {\n const first = text.trim().split(\"\\n\")[0]?.trim().toLowerCase() ?? \"\";\n return first.startsWith(\"entity-structure\");\n },\n parse: parseEntityDSL,\n\n render(text: string, config): string {\n const ast = parseEntityDSL(text);\n return renderEntity(ast, config);\n },\n};\n\nexport { parseEntityDSL } from \"./parser\";\nexport { renderEntity } from \"./renderer\";\nexport { layoutEntity } from \"./layout\";\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkUGB42BGK_cjs = require('./chunk-UGB42BGK.cjs');
|
|
4
4
|
|
|
5
5
|
// src/ai/registry.ts
|
|
6
6
|
var DIAGRAM_REGISTRY = [
|
|
@@ -415,6 +415,15 @@ var DIAGRAM_REGISTRY = [
|
|
|
415
415
|
cluster: "network-infrastructure",
|
|
416
416
|
standard: "Shostack, Threat Modeling (2014) STRIDE-per-element \xB7 Microsoft SDL \xB7 base DFD DeMarco/Yourdon; see 46-THREAT-MODEL-STRIDE-STANDARD.md + 31-DFD-STANDARD.md",
|
|
417
417
|
syntaxKey: "threatmodel"
|
|
418
|
+
},
|
|
419
|
+
{
|
|
420
|
+
type: "welding",
|
|
421
|
+
name: "Welding symbols",
|
|
422
|
+
tagline: "AWS A2.4 / ISO 2553 welding callouts \u2014 the reference-line skeleton with weld glyphs, dimensions, and supplementary symbols placed correct-by-construction.",
|
|
423
|
+
useWhen: 'Use to annotate a welded joint on an engineering drawing: a horizontal reference line, a leader arrow to the joint, and a weld-symbol glyph above (other side) / below (arrow side) with size, length-pitch, groove angle, root opening, contour + finish. Header `welding [standard: aws|iso-a|iso-b]`; one `joint "label" { arrow: \u2026 other: \u2026 around field tail: \u2026 }` block per joint. Full glyph catalog (fillet, all groove types, plug/slot, spot/seam, back/backing, surfacing, edge) + weld-all-around, field flag, and tail process note. Validates illegal type/side/dimension combinations.',
|
|
424
|
+
cluster: "electrical-industrial",
|
|
425
|
+
standard: "AWS A2.4:2020 \xB7 ISO 2553:2019; see 47-WELDING-SYMBOL-STANDARD.md",
|
|
426
|
+
syntaxKey: "welding"
|
|
418
427
|
}
|
|
419
428
|
];
|
|
420
429
|
var DIAGRAM_SINCE = {
|
|
@@ -474,7 +483,9 @@ var DIAGRAM_SINCE = {
|
|
|
474
483
|
gitgraph: "0.8.0",
|
|
475
484
|
epc: "0.8.0",
|
|
476
485
|
idef0: "0.8.0",
|
|
477
|
-
threatmodel: "0.8.0"
|
|
486
|
+
threatmodel: "0.8.0",
|
|
487
|
+
// 0.8.1 — welding symbols (AWS A2.4 / ISO 2553)
|
|
488
|
+
welding: "0.8.1"
|
|
478
489
|
};
|
|
479
490
|
function getDiagramSince(type) {
|
|
480
491
|
const resolved = resolveDiagramType(type);
|
|
@@ -1861,6 +1872,63 @@ If the LED doesn't light up, three things to check, in order: LED polarity (the
|
|
|
1861
1872
|
"dsl": 'matrix johari "Self vs. Team \u2014 Q2 Reflection"\nstyle: table\nQ2: "Strong technical instincts"\nQ2: "Direct in code review"\nQ2: "Patient with juniors"\nQ1: "Interrupts in meetings"\nQ1: "Hard to read when stressed"\nQ3: "Imposter syndrome about leadership"\nQ3: "Anxiety about cross-team politics"\nQ4: "Capacity for difficult conversations under pressure"',
|
|
1862
1873
|
"notes": "## Scenario\n\nA newly-promoted engineering manager runs a Johari exercise with her team during a 1:1 retro. She populates the **Open** cell (things both she and the team see); the team adds to **Blind** (things they see that she doesn't); she fills **Hidden** privately; **Unknown** is the open hypothesis space \u2014 capabilities and limitations that haven't surfaced yet.\n\nThe table form is the canonical Johari output. Coaches print it on a single page and walk through it with the coachee \u2014 a scatter plot of dots would defeat the entire purpose.\n\n## Annotation key\n\n- `matrix johari` \u2014 preset axes (Known to Self \xD7 Known to Others) with the four window panes\n- `style: table` \u2014 flips off axes/grid, places each pane title as a cell header, lists items as bullets\n- `Q1` = Blind (top-right: not known to self, known to others)\n- `Q2` = Open / Arena (top-left: known to self + others)\n- `Q3` = Hidden / Fa\xE7ade (bottom-left: known to self, not to others)\n- `Q4` = Unknown (bottom-right: not known to either \u2014 the growth hypothesis space)\n\n## How to read\n\nThe classic Johari coaching prompt: **how do you move items from Hidden \u2192 Open** (vulnerability work) **and from Blind \u2192 Open** (feedback-acceptance work)? An overstuffed Hidden pane signals psychological-safety debt; an empty Blind pane usually means the team hasn't been asked."
|
|
1863
1874
|
},
|
|
1875
|
+
{
|
|
1876
|
+
"slug": "matrix-punnett-dihybrid",
|
|
1877
|
+
"diagram": "matrix",
|
|
1878
|
+
"title": "Dihybrid cross Punnett square (9:3:3:1)",
|
|
1879
|
+
"description": "A two-gene Punnett square where the engine computes the gametes, the 4\xD74 offspring grid, and the canonical 9:3:3:1 phenotype ratio \u2014 Mendel's pea seed shape \xD7 colour cross \u2014 with each phenotype class auto-tinted.",
|
|
1880
|
+
"standard": "Mendelian genetics (Punnett square)",
|
|
1881
|
+
"tags": [
|
|
1882
|
+
"matrix",
|
|
1883
|
+
"punnett",
|
|
1884
|
+
"genetics",
|
|
1885
|
+
"mendel",
|
|
1886
|
+
"dihybrid",
|
|
1887
|
+
"biology"
|
|
1888
|
+
],
|
|
1889
|
+
"complexity": 3,
|
|
1890
|
+
"featured": false,
|
|
1891
|
+
"dsl": 'matrix punnett "Seed shape & colour (RrYy \xD7 RrYy)"\ncross: RrYy x RrYy\ntrait R: "Round" / "Wrinkled"\ntrait Y: "Yellow" / "Green"',
|
|
1892
|
+
"notes": "## What this shows\n\nA **Punnett square** predicts the offspring of a genetic cross. You write only the two parental genotypes \u2014 the engine does the Mendelian bookkeeping: it enumerates each parent's **gametes** (one allele per gene locus), fills the grid with every gamete combination, and counts the resulting **genotype and phenotype ratios**.\n\nThis is a **dihybrid** cross (two genes at once) \u2014 Mendel's classic pea experiment crossing seed shape (`R` round dominant / `r` wrinkled) with seed colour (`Y` yellow dominant / `y` green). Two heterozygous parents each produce four gametes (RY, Ry, rY, ry), so the grid is 4\xD74 = 16 boxes. The engine computes the famous **9:3:3:1** phenotype ratio \u2014 9 round-yellow : 3 wrinkled-yellow : 3 round-green : 1 wrinkled-green \u2014 and tints each box by its phenotype class so the ratio is visible at a glance. Case sets dominance (uppercase = dominant), and the optional `trait` lines name each phenotype so the legend reads in plain English."
|
|
1893
|
+
},
|
|
1894
|
+
{
|
|
1895
|
+
"slug": "matrix-punnett-monohybrid",
|
|
1896
|
+
"diagram": "matrix",
|
|
1897
|
+
"title": "Monohybrid cross Punnett square (3:1)",
|
|
1898
|
+
"description": "The classic single-gene Punnett square \u2014 two heterozygous parents (Bb \xD7 Bb) crossed for eye colour. The engine computes the gametes, the 2\xD72 grid, and the canonical 3:1 dominant-to-recessive phenotype ratio with a 1:2:1 genotype ratio.",
|
|
1899
|
+
"standard": "Mendelian genetics (Punnett square)",
|
|
1900
|
+
"tags": [
|
|
1901
|
+
"matrix",
|
|
1902
|
+
"punnett",
|
|
1903
|
+
"genetics",
|
|
1904
|
+
"mendel",
|
|
1905
|
+
"monohybrid",
|
|
1906
|
+
"biology"
|
|
1907
|
+
],
|
|
1908
|
+
"complexity": 1,
|
|
1909
|
+
"featured": false,
|
|
1910
|
+
"dsl": 'matrix punnett "Eye color (Bb \xD7 Bb)"\ncross: Bb x Bb\ntrait B: "Brown eyes" / "Blue eyes"',
|
|
1911
|
+
"notes": "## What this shows\n\nThe **monohybrid cross** is where every genetics course starts: one gene, two heterozygous parents. Here both parents are `Bb` for eye colour \u2014 `B` (brown) is dominant, `b` (blue) recessive. You write only the cross; the engine does the Mendelian bookkeeping.\n\nEach `Bb` parent makes two gametes, `B` and `b`, so the grid is 2\xD72. The engine fills it \u2014 `BB`, `Bb`, `Bb`, `bb` \u2014 and computes the two ratios every student memorises: a **3:1 phenotype ratio** (3 brown-eyed : 1 blue-eyed) and a **1:2:1 genotype ratio** (1 `BB` : 2 `Bb` : 1 `bb`). The single recessive `bb` box is tinted apart from the three dominant boxes, and the `trait` line names the phenotypes so the legend reads in plain English. Allele case sets dominance \u2014 uppercase is dominant \u2014 so the notation is exactly what a textbook uses."
|
|
1912
|
+
},
|
|
1913
|
+
{
|
|
1914
|
+
"slug": "matrix-punnett-testcross",
|
|
1915
|
+
"diagram": "matrix",
|
|
1916
|
+
"title": "Test cross Punnett square (1:1)",
|
|
1917
|
+
"description": "A genetic test cross \u2014 crossing an organism of unknown genotype against a homozygous-recessive parent (Bb \xD7 bb) to reveal whether it is heterozygous. The engine computes the 1:1 phenotype ratio that signals a heterozygous parent.",
|
|
1918
|
+
"standard": "Mendelian genetics (Punnett square)",
|
|
1919
|
+
"tags": [
|
|
1920
|
+
"matrix",
|
|
1921
|
+
"punnett",
|
|
1922
|
+
"genetics",
|
|
1923
|
+
"mendel",
|
|
1924
|
+
"test-cross",
|
|
1925
|
+
"biology"
|
|
1926
|
+
],
|
|
1927
|
+
"complexity": 2,
|
|
1928
|
+
"featured": false,
|
|
1929
|
+
"dsl": 'matrix punnett "Test cross (Bb \xD7 bb)"\ncross: Bb x bb\ntrait B: "Brown" / "Blue"',
|
|
1930
|
+
"notes": "## What this shows\n\nA **test cross** answers a practical genetics question: an organism shows the dominant trait, but is it `BB` or `Bb`? Cross it against a **homozygous-recessive** partner (`bb`) and read the offspring. You write only the cross; the engine computes the outcome that gives the answer.\n\nThe recessive `bb` parent contributes only `b` gametes, so the offspring genotypes come straight from the unknown parent's gametes. Crossing `Bb \xD7 bb` yields a **1:1 phenotype ratio** \u2014 half `Bb` (dominant phenotype), half `bb` (recessive) \u2014 the tell-tale signature of a heterozygous parent. (A `BB` parent would instead give all dominant offspring.) The engine fills the 2\xD71 grid, tints the two phenotype classes apart, and reports the 1:1 ratio, so the diagnostic result is immediate."
|
|
1931
|
+
},
|
|
1864
1932
|
{
|
|
1865
1933
|
"slug": "matrix-qfd-coffee-maker",
|
|
1866
1934
|
"diagram": "matrix",
|
|
@@ -3318,6 +3386,25 @@ If the LED doesn't light up, three things to check, in order: LED polarity (the
|
|
|
3318
3386
|
"featured": false,
|
|
3319
3387
|
"dsl": 'venn "Programming Paradigms"\nset oop "Object-Oriented" [color: "#1E88E5"]\nset fp "Functional" [color: "#E53935"]\nset logic "Logic" [color: "#43A047"]\noop & fp : 180\noop & logic : 45\nfp & logic : 90\noop & fp & logic : 12\noop only : 620\nfp only : 340\nlogic only : 95',
|
|
3320
3388
|
"notes": '## Scenario\n\nA CS instructor opens a lecture on programming paradigms with this Venn. Counts come from a language survey \u2014 how many languages offer strong OOP, FP, and logic support. The tiny triple-overlap (12) tells students that languages supporting all three well are rare; the large OOP-only region shows industry gravity; the FP \u2229 logic overlap (90) is where languages like Prolog-with-lambdas sit.\n\n## Annotation key\n\n- `set ID "Label"` \u2014 paradigm circle\n- `A & B : n` \u2014 number of languages supporting both paradigms strongly\n- `A only : n` \u2014 languages committed to a single paradigm\n\n## How to read\n\nEach circle represents a paradigm. Overlapping regions count multi-paradigm languages. The `oop & fp` intersection (180) is where modern mainstream languages \u2014 Scala, Kotlin, Swift, TypeScript \u2014 sit. The tiny triple intersection (12) is a reminder that truly multi-paradigm language design is expensive; the larger exclusive regions show how few languages commit to logic programming at all.'
|
|
3389
|
+
},
|
|
3390
|
+
{
|
|
3391
|
+
"slug": "welding-bracket-fillet",
|
|
3392
|
+
"diagram": "welding",
|
|
3393
|
+
"title": "Welded bracket \u2014 fillet + V-groove callouts",
|
|
3394
|
+
"description": "AWS A2.4 welding callouts on a fabrication drawing \u2014 an intermittent double-fillet bracket with a weld-all-around flag, and a full-penetration V-groove butt weld with backing, root opening, and the welding process in the tail.",
|
|
3395
|
+
"standard": "AWS A2.4 / ISO 2553 welding symbols",
|
|
3396
|
+
"tags": [
|
|
3397
|
+
"welding",
|
|
3398
|
+
"aws-a2.4",
|
|
3399
|
+
"iso-2553",
|
|
3400
|
+
"fillet",
|
|
3401
|
+
"groove",
|
|
3402
|
+
"fabrication"
|
|
3403
|
+
],
|
|
3404
|
+
"complexity": 3,
|
|
3405
|
+
"featured": false,
|
|
3406
|
+
"dsl": 'welding "Bracket assembly"\njoint "gusset to column" {\n arrow: fillet size=8 len=50 pitch=150\n other: fillet size=6\n around\n field\n tail: "GMAW"\n}\njoint "splice plate (butt)" {\n arrow: vgroove angle=60 root=3 throat=12 contour=flush finish=G\n other: backing\n tail: "SMAW; E7018"\n}',
|
|
3407
|
+
"notes": "## What this shows\n\nA **welding symbol** is the standard way a drawing tells a fabricator how to weld a joint \u2014 codified by **AWS A2.4** (US) and **ISO 2553** (international). It is a *reference-line skeleton*: a horizontal line, a leader arrow to the joint, and a weld glyph snapped above (other side) or below (arrow side) the line, with dimensions in fixed slots.\n\nThe first joint is an **intermittent double fillet** \u2014 a `size=8` arrow-side fillet welded `50` long on a `150` pitch, a `size=6` fillet on the other side \u2014 carried **all around** the gusset (the open circle at the leader junction) as a **field weld** (the flag), with the **GMAW** process noted in the tail. The second joint is a full-penetration **V-groove butt weld**: a `60\xB0` included angle with a `3 mm` root opening and a `12 mm` effective throat, a **backing** weld on the far side, ground **flush**, welded **SMAW** with **E7018** electrode. Each callout is placed correct-by-construction \u2014 the engine owns the skeleton, you describe the weld."
|
|
3321
3408
|
}
|
|
3322
3409
|
];
|
|
3323
3410
|
var SYNTAX = {
|
|
@@ -3387,7 +3474,7 @@ var SYNTAX = {
|
|
|
3387
3474
|
},
|
|
3388
3475
|
"matrix": {
|
|
3389
3476
|
"title": "Matrix / Quadrant diagram",
|
|
3390
|
-
"content": '## 1. Your first matrix\n\nThe smallest useful matrix: a custom 2\xD72 with two labeled axes and three points.\n\n```\nmatrix "Feature Prioritization"\nx-axis: Low Effort \u2192 High Effort\ny-axis: Low Value \u2192 High Value\n\n"Add search" at (0.3, 0.8)\n"Rebuild pipeline" at (0.85, 0.7)\n"Update footer" at (0.2, 0.2)\n```\n\nFour rules cover 80% of usage:\n\n1. Start with the keyword `matrix`, optionally followed by a template name or a quoted title.\n2. Set the axes with `x-axis:` and `y-axis:` \u2014 or use a built-in template and skip this step entirely.\n3. Each point is `"Label" at (x, y)` where `x` and `y` are decimal fractions from 0.0 (low/left/bottom) to 1.0 (high/right/top).\n4. Add optional properties \u2014 `size:`, `category:`, `color:`, `shape:`, `highlight:` \u2014 after the coordinates.\n\n> Comments must start with `#` anywhere on a line (outside quoted strings).\n\n---\n\n## 2. Built-in templates\n\nA template pre-configures axes, quadrant labels, and grid size. Just use the template name as the second token on the header line.\n\n| Template | Grid | Use case |\n|---|---|---|\n| `eisenhower` | 2\xD72 | Urgency / Importance task prioritization |\n| `impact-effort` | 2\xD72 | Feature prioritization by impact vs. effort |\n| `rice` | 2\xD72 | RICE scoring \u2014 Reach \xD7 Impact vs. Effort |\n| `bcg` | 2\xD72 | Portfolio \u2014 Market Share vs. Growth rate |\n| `ansoff` | 2\xD72 | Product/market growth strategy |\n| `johari` | 2\xD72 | Self-awareness \u2014 known-to-self vs. known-to-others |\n| `9-box` | 3\xD73 | HR talent review \u2014 Performance vs. Potential |\n| `risk-matrix` | 5\xD75 | Risk assessment \u2014 Likelihood vs. Severity (heatmap) |\n\n```\nmatrix eisenhower "This Week"\n"Ship hotfix" at (0.1, 0.9) size: 5 highlight: true\n"Team 1:1s" at (0.1, 0.7) size: 3\n"Write Q3 OKRs" at (0.8, 0.85) size: 4\n"Inbox zero" at (0.1, 0.3) size: 2\n"Refactor auth" at (0.75, 0.4) size: 3\n```\n\nAxes and quadrant labels from a template can be overridden with explicit `x-axis:` / `y-axis:` / `quadrant` directives.\n\n---\n\n## 3. Axes\n\nAxis lines declare the semantic poles of each dimension.\n\n```\nx-axis: Low Effort \u2192 High Effort\ny-axis: Low Value \u2192 High Value\n```\n\nThe arrow separates the low label (left / bottom) from the high label (right / top). All of these separators are equivalent:\n\n| Separator | Example |\n|---|---|\n| `\u2192` (Unicode) | `x-axis: Rare \u2192 Certain` |\n| `->` (ASCII) | `x-axis: Rare -> Certain` |\n| `\u2191` | `y-axis: Cheap \u2191 Expensive` |\n| `\u2190` / `<-` / `<` | Reversed axis \u2014 high label is on the left |\n\nA **reversed axis** is for conventions where the "high" value sits at the left or bottom:\n\n```\nx-axis: High Market Share \u2190 Low Market Share\n```\n\n```\nmatrix "Product Portfolio"\nx-axis: High Market Share \u2190 Low Market Share\ny-axis: Low Growth \u2192 High Growth\n\nquadrant Q1 "Question Marks"\nquadrant Q2 "Stars"\nquadrant Q3 "Cash Cows"\nquadrant Q4 "Dogs"\n\n"Analytics Suite" at (0.25, 0.35) size: 5\n"ChatBot Pro" at (0.2, 0.8) size: 4 highlight: true\n"Legacy CRM" at (0.75, 0.25) size: 6\n"Mobile App" at (0.65, 0.75) size: 3\n```\n\n---\n\n## 4. Points\n\nEach point is a bubble positioned by a normalized (x, y) coordinate pair.\n\n```\n"Label" at (x, y)\n"Label" at (x, y) size: 4 category: design color: #7B1FA2 highlight: true note: "clarify spec"\n```\n\n| Property | Values | Meaning |\n|---|---|---|\n| `size:` | positive number | Bubble area weight (default: 3) |\n| `category:` | bareword | Color group; drives the legend |\n| `color:` | hex string | Override bubble color for this point |\n| `shape:` | `circle` \\| `square` \\| `triangle` \\| `diamond` | Bubble shape (default: `circle`) |\n| `highlight:` | `true` | Draws an emphasis ring around the bubble |\n| `note:` | quoted string | Tooltip annotation |\n| `label:` | quoted string | Replaces the display label (different from the ID) |\n\nCoordinates outside `[0, 1]` are clamped to the chart boundary and flagged with a badge \u2014 the original value is stored for tooltip display.\n\n```\nmatrix "Risk Register"\nx-axis: Low Impact \u2192 High Impact\ny-axis: Rare \u2192 Certain\n\n"Vendor delay" at (0.45, 0.7) size: 4 category: schedule highlight: true\n"Security breach" at (0.9, 0.3) size: 5 category: security shape: diamond\n"Budget overrun" at (0.5, 0.65) size: 3 category: finance\n"Key hire falls through" at (0.6, 0.55) size: 3 category: people\n"Scope creep" at (0.4, 0.8) size: 4 category: schedule\n```\n\n---\n\n## 5. Quadrant labels\n\nLabel each quadrant with a name and an optional subtitle.\n\n```\nquadrant Q1 "Do First"\nquadrant Q2 "Schedule"\nquadrant Q3 "Delete"\nquadrant Q4 "Delegate"\n\n# With an optional subtitle:\nquadrant Q1 "Do First" description: "High urgency, high importance"\n```\n\nQuadrant numbering follows the standard mathematical convention: **Q1 = top-right, Q2 = top-left, Q3 = bottom-left, Q4 = bottom-right**. The `Q` prefix is optional \u2014 `quadrant 1 "Label"` is equally valid.\n\n---\n\n## 6. Heatmap mode\n\nHeatmap mode fills N\xD7M cells with color intensity instead of plotting bubble positions.\n\n```\nmatrix heatmap 4x3 "Skill Matrix"\nrows: [Strategy, Execution, Communication, Technical]\ncols: [Junior, Mid, Senior]\n\ncell (0,0) level: weak\ncell (1,0) level: medium\ncell (2,0) level: strong\ncell (0,1) value: 7\ncell (1,2) label: "Top 10%"\n```\n\n- `matrix heatmap COLxROW` \u2014 header sets the grid dimensions.\n- `rows:` and `cols:` \u2014 comma-separated or bracket-list of axis labels.\n- `cell (col, row)` \u2014 zero-indexed, column first, row second (row 0 = bottom).\n- `level:` \u2014 `strong` (3), `medium` (2), or `weak` (1) \u2014 shorthand for heat intensity.\n- `value:` \u2014 explicit numeric value (overrides `level:`).\n- `label:` \u2014 quoted text placed inside the cell.\n\n```\nmatrix heatmap 4x4 "Competency Heat Map"\nrows: [Leadership, Execution, Communication, Technical]\ncols: [Junior, Mid, Senior, Staff]\n\ncell (0,0) level: weak\ncell (1,0) level: medium\ncell (2,0) level: strong\ncell (3,0) level: strong\ncell (0,1) level: medium\ncell (1,1) level: medium\ncell (2,1) level: strong\ncell (3,1) level: strong\ncell (0,2) level: weak\ncell (1,2) level: medium\ncell (2,2) level: medium\ncell (3,2) level: strong\ncell (0,3) level: weak\ncell (1,3) level: weak\ncell (2,3) level: medium\ncell (3,3) level: strong\n```\n\n---\n\n## 7. Correlation mode\n\nCorrelation mode renders an N\xD7M dot matrix where intensity represents the relationship strength between row and column variables.\n\n```\nmatrix correlation 4x4 "Product Metrics"\nrows: [DAU, Retention, Revenue, NPS]\ncols: [DAU, Retention, Revenue, NPS]\n\ncell (0,0) value: 1\ncell (1,0) value: 0.82\ncell (2,0) value: 0.54\ncell (3,0) value: 0.71\n```\n\nThe same `cell` syntax applies. `level: strong | medium | weak` is also accepted in correlation mode.\n\n---\n\n## 8. SIPOC mode\n\nA **SIPOC** is the one-page scoping table that opens the *Define* phase of a Six Sigma DMAIC project. It names, in five fixed columns left to right, everyone and everything the process touches: **S**uppliers \xB7 **I**nputs \xB7 **P**rocess \xB7 **O**utputs \xB7 **C**ustomers. Before a team measures or improves anything, SIPOC pins down the boundary \u2014 "where does this process start, where does it end, and who hands work in and out of it."\n\n```\nmatrix sipoc "Order fulfilment"\nsuppliers: "Vendor", "Warehouse"\ninputs: "PO", "Stock levels"\nprocess: "Receive order", "Pick", "Pack", "Ship"\noutputs: "Shipped package", "Invoice"\ncustomers: "End customer", "Finance"\n```\n\n- Start with `matrix sipoc`, optionally followed by a quoted title.\n- Each of the five columns is its own directive: `suppliers:`, `inputs:`, `process:`, `outputs:`, `customers:`.\n- After the colon, list the entries as **comma-separated quoted strings**. A column may have any number of entries; the rows simply stack top-down inside that column.\n- The `process:` column is the high-level step sequence (typically 4\u20137 steps) \u2014 keep it to the major stages, not a detailed flowchart.\n\nThe five columns always render in the canonical S-I-P-O-C order regardless of the order you declare them, so the diagram reads correctly even if an LLM emits the blocks out of sequence.\n\n```\nmatrix sipoc "Order fulfilment"\nsuppliers: "Vendor", "Warehouse"\ninputs: "PO", "Stock levels"\nprocess: "Receive order", "Pick", "Pack", "Ship"\noutputs: "Shipped package", "Invoice"\ncustomers: "End customer", "Finance"\n```\n\n---\n\n## 9. QFD mode (House of Quality)\n\n**Quality Function Deployment (QFD)** \u2014 the *House of Quality*, introduced by Yoji Akao \u2014 translates what customers want into the engineering characteristics that deliver it. Rows are the **WHATs** (customer requirements, each with an importance weight); columns are the **HOWs** (the measurable engineering characteristics the team controls). The body of the grid records how strongly each HOW serves each WHAT.\n\nThe differentiator: the engine **computes** the bottom row for you. Each HOW\'s *technical importance* is the sum down its column of `weight \xD7 relationship strength` \u2014 a ranked answer to "which engineering characteristic moves the most customer value, and is therefore worth the most effort." And the roof of the house \u2014 a half-matrix of diamond cells above the columns \u2014 records whether two HOWs help or fight each other.\n\n```\nmatrix qfd "Coffee maker"\nwhat: "Quiet operation" weight: 5\nwhat: "Brews fast" weight: 3\nwhat: "Energy efficient" weight: 4\nhow: "Fan RPM" dir: down\nhow: "Heater watts" dir: up\nhow: "Insulation" dir: up\nrel (0,0): 9\nrel (0,2): 3\nrel (1,1): 9\nrel (2,1): 3\nrel (2,2): 9\nroof (0,1): --\nroof (1,2): +\n```\n\n### WHATs and HOWs\n\n| Directive | Form | Meaning |\n|---|---|---|\n| `what:` | `what: "Label" weight: N` | A customer requirement (one row). `weight:` is its importance, conventionally 1\u20135. Declaration order is the row order, indexed from 0. |\n| `how:` | `how: "Label" dir: up\\|down` | An engineering characteristic (one column). Declaration order is the column order, indexed from 0. `dir:` is the optimization target \u2014 `up` = more is better, `down` = less is better. |\n\n### Relationship cells\n\n`rel (i, j): strength` records how strongly column-`j` HOW serves row-`i` WHAT. The index is **(row, column)**, both zero-based.\n\n| Strength | Meaning |\n|---|---|\n| `9` | Strong relationship |\n| `3` | Medium relationship |\n| `1` | Weak relationship |\n| *(omitted)* | No relationship \u2014 leave the cell out |\n\nThis 9 / 3 / 1 scale is the QFD convention: it is deliberately non-linear so that one strong link outweighs several weak ones when the importance row is summed.\n\n### Computed technical-importance row\n\nThe engine sums each column to produce the technical-importance row at the foot of the house:\n\n```\nimportance(j) = \u03A3 over rows i ( weight(i) \xD7 strength(i, j) )\n```\n\nFor the coffee-maker example above the row computes to **45 / 39 / 51** \u2014 Insulation (51) is the highest-leverage characteristic, Heater watts (39) the lowest. This ranking is the deliverable: it tells the team where to spend engineering effort.\n\nAdd `normalize: true` (its own line, anywhere in the block) to show each column as a **percentage of the total** instead of a raw sum \u2014 for this example, **33% / 29% / 38%**. Percentages make the relative priorities easier to read across very different weight scales.\n\n### The roof \u2014 HOW \xD7 HOW correlations\n\nThe **roof** is the triangular half-matrix sitting above the columns. `roof (i, j): glyph` records whether HOW `i` and HOW `j` reinforce or conflict with each other \u2014 the synergies and trade-offs a team must reconcile.\n\n| Glyph | Correlation |\n|---|---|\n| `++` | Strong positive \u2014 improving one strongly helps the other |\n| `+` | Positive |\n| `-` | Negative |\n| `--` | Strong negative \u2014 improving one hurts the other (a trade-off) |\n| *(omitted)* | No correlation \u2014 leave the cell out |\n\nEach roof entry renders as a diamond cell in the standard QFD pitched-roof grid. In the example, `roof (0,1): --` flags that pushing Fan RPM down while pushing Heater watts up is a trade-off, and `roof (1,2): +` flags that Heater watts and Insulation reinforce each other.\n\n```\nmatrix qfd "Coffee maker"\nwhat: "Quiet operation" weight: 5\nwhat: "Brews fast" weight: 3\nwhat: "Energy efficient" weight: 4\nhow: "Fan RPM" dir: down\nhow: "Heater watts" dir: up\nhow: "Insulation" dir: up\nrel (0,0): 9\nrel (0,2): 3\nrel (1,1): 9\nrel (2,1): 3\nrel (2,2): 9\nroof (0,1): --\nroof (1,2): +\n```\n\n---\n\n## 10. Config options\n\nA `config:` block tunes visual rendering. Each option goes on its own indented line below the `config:` header.\n\n```\nconfig:\n quadrantBg: true\n gridLines: true\n axisArrows: true\n bubbleScale: area\n legendPosition: bottom-right\n```\n\n| Key | Values | Default | Effect |\n|---|---|---|---|\n| `quadrantBg` | `true` \\| `false` | `true` | Colored quadrant background fills |\n| `gridLines` | `true` \\| `false` | `true` | Grid lines overlay |\n| `axisArrows` | `true` \\| `false` | `true` | Arrows at axis ends |\n| `bubbleScale` | `area` \\| `radius` | `area` | Whether `size:` scales bubble area or radius |\n| `quadrantAnnotations` | `true` \\| `false` | `true` | Show quadrant label text in corners |\n| `legendPosition` | `bottom-right` \\| `right` \\| `bottom-center` \\| `none` | `bottom-right` | Category legend placement |\n| `labelCollision` | `auto` \\| `offset-only` \\| `leader-only` \\| `off` | `auto` | Overlap avoidance strategy for point labels |\n| `offChartPolicy` | `clamp-badge` \\| `drop` | `clamp-badge` | What to do with points outside [0,1] |\n\nTwo shorthand directives also work at the top level (not inside the `config:` block):\n\n```\naxis: off # off | on | auto \u2014 show or hide the axis lines\nmargins: true # true | false \u2014 show Score + Rank margins (correlation mode)\n```\n\n---\n\n## 11. Labels & comments\n\n- **Title:** `matrix "My Title"` or `title: My Title` as a standalone line.\n- **Point label:** the quoted string before `at (\u2026)`.\n- **Axis labels:** `x-axis:` and `y-axis:` directives.\n- **Quadrant labels:** `quadrant Q1 "Name"` directive.\n- **Comments:** `#` anywhere on a line, outside quoted strings.\n\n```\nmatrix "Prioritization"\n# This is a comment\nx-axis: Low Cost \u2192 High Cost # inline comment after a directive\n"Fix bug" at (0.1, 0.9) size: 3 # comment after a point\n```\n\n---\n\n## 12. Table mode (`style: table`)\n\nThe default matrix rendering is a **scatter / bubble chart** \u2014 points float at (x, y) coordinates. For frameworks where the output is a list of items grouped by quadrant (Eisenhower, Johari, Impact-Effort, 9-box), use `style: table` to switch to a **text-in-cell layout** instead.\n\n```\nmatrix eisenhower "This Week"\nstyle: table\nQ2: "Ship hotfix"\nQ2: "Customer demo prep"\nQ1: "Write Q3 OKRs"\nQ1: "Refactor auth layer"\nQ4: "LinkedIn updates"\nQ3: "Reorganize Slack channels"\n```\n\n`style: table` applies these changes automatically:\n\n| Effect | Detail |\n|---|---|\n| Axes and arrows hidden | No axis lines, labels, or arrowheads |\n| Grid lines hidden | Only the outer border and cell dividers remain |\n| Quadrant titles move inside cells | Each title becomes a cell header instead of a corner overlay |\n| Items stack as a bullet list | Multiple entries for the same quadrant stack top-down |\n\n### `Q1` \u2026 `Q4` shorthand (2\xD72 only)\n\nFor 2\xD72 templates, use `Qn: "item"` instead of the longer `cell (col, row) label: "item"` form. Mapping:\n\n| Shorthand | Cell | Eisenhower | Johari |\n|---|---|---|---|\n| `Q1:` | top-right | Schedule | Blind |\n| `Q2:` | top-left | Do First | Open / Arena |\n| `Q3:` | bottom-left | Delete | Hidden / Fa\xE7ade |\n| `Q4:` | bottom-right | Delegate | Unknown |\n\nRepeat a shorthand key to add multiple items to the same cell:\n\n```\nQ2: "Ship hotfix"\nQ2: "Customer demo prep"\n```\n\nFor 3\xD73 grids (9-box), use `cell (col, row) label: "\u2026"` directly \u2014 the `Q` shorthand is 2\xD72 only.\n\n### When to use table vs scatter\n\n| Use `style: table` for | Use scatter (default) for |\n|---|---|\n| Eisenhower with task lists | Eisenhower with `size:` effort weights |\n| Johari window coaching | Impact-Effort with bubble = revenue |\n| Backlog grouping (no numeric third dimension) | RICE / BCG portfolio (third dimension IS the bubble size) |\n| 9-box talent review | Risk heatmap (5\xD75 with numeric severity) |\n\n```\nmatrix eisenhower "This Week"\nstyle: table\nQ2: "Ship hotfix"\nQ2: "Customer demo prep"\nQ1: "Write Q3 OKRs"\nQ1: "Refactor auth layer"\nQ4: "LinkedIn updates"\nQ3: "Reorganize Slack channels"\n```\n\n---\n\n## 13. Reserved words & escaping\n\n**Reserved at line start:** `matrix` (header), `x-axis:`, `y-axis:`, `quadrant`, `config:`, `title:`, `rows:`, `cols:`, `grid:`, `axis:`, `margins:`, `cell`. In **SIPOC** mode: `suppliers:`, `inputs:`, `process:`, `outputs:`, `customers:`. In **QFD** mode: `what:`, `how:`, `rel`, `roof`, `normalize:`.\n\n**Point lines must start with a quote character** (`"` or `\'`). A line that does not start with a quote is not treated as a point.\n\n**Strings with spaces** in axis labels do not need quoting \u2014 the text after the colon (and after the arrow) is taken verbatim. In `note:` and `label:` point properties, use double quotes.\n\n---\n\n## 14. Common mistakes\n\n| You wrote | Parser says | Fix |\n|---|---|---|\n| `"Fix bug" at (1, 2)` | Point parsed; x=1 clamped, y=1 clamped; off-chart badge shown | Keep coordinates in [0.0, 1.0] or accept the clamp-badge |\n| `quadrant 1 "Quick Wins"` (no Q prefix) | Accepted \u2014 `Q` prefix is optional | Both `quadrant 1` and `quadrant Q1` work |\n| `config: gridLines: false` (on same line) | Only `config:` keyword recognized; `gridLines: false` silently ignored | Put options on their own indented lines below `config:` |\n| `x-axis: "Low" \u2192 "High"` (quoted labels) | Arrow not found inside quotes \u2014 treated as plain text | Remove quotes: `x-axis: Low \u2192 High` |\n| `matrix heatmap` without dimensions | Defaults to 2\xD72; rows/cols directives set actual size | Specify dimensions on the header: `matrix heatmap 4x4` |\n| `cell (0, 0) level: Strong` (capital S) | `level` match is case-insensitive \u2014 accepted | Both `strong` and `Strong` work |\n| `shape: oval` | Unknown shape value \u2014 silently ignored | Use `circle`, `square`, `triangle`, or `diamond` |\n| `"Fix bug" at (0.1, 0.9)` on an Eisenhower with a task list | Valid scatter point \u2014 but you probably wanted a list in a cell | Add `style: table` and use `Q2: "Fix bug"` instead |\n| `Q1: "item"` on a 3\xD73 template | `Q` shorthand is parsed as a point line \u2014 silently dropped | Use `cell (col, row) label: "item"` for 3\xD73 grids |\n\n---\n\n## 15. Grammar (EBNF)\n\n```text\ndocument = header directive*\n\nheader = "matrix" ( template-name | mode-header | title )? NEWLINE\ntemplate-name = "eisenhower"|"impact-effort"|"rice"|"bcg"|"ansoff"|"johari"|"9-box"|"risk-matrix"\nmode-header = ( "heatmap" | "correlation" ) ( number "x" number )? title?\n | ( "sipoc" | "qfd" ) title?\ntitle = quoted-string | bare-text\n\ndirective = x-axis | y-axis | quadrant-dir | config-block\n | point | cell | q-short | rows-dir | cols-dir | grid-dir\n | style-dir | title-dir | axis-dir | margins-dir\n | sipoc-col | qfd-what | qfd-how | qfd-rel | qfd-roof | normalize-dir\n | comment | blank\n\n# SIPOC mode\nsipoc-col = ( "suppliers:" | "inputs:" | "process:" | "outputs:" | "customers:" )\n WS quoted-string ( "," quoted-string )* NEWLINE\n\n# QFD / House of Quality mode\nqfd-what = "what:" WS quoted-string WS "weight:" number NEWLINE\nqfd-how = "how:" WS quoted-string ( WS "dir:" ( "up" | "down" ) )? NEWLINE\nqfd-rel = "rel" WS "(" number "," number ")" ":" WS ( "9" | "3" | "1" ) NEWLINE # (row, col)\nqfd-roof = "roof" WS "(" number "," number ")" ":" WS ( "++" | "+" | "-" | "--" ) NEWLINE # (how, how)\nnormalize-dir = "normalize:" WS "true" NEWLINE\n\nx-axis = "x-axis:" WS axis-spec NEWLINE\ny-axis = "y-axis:" WS axis-spec NEWLINE\naxis-spec = text arrow text | text # plain text \u2192 high label only\narrow = "\u2192" | "->" | "\u2191" | "\u2190" | "<-" | "<" | "\u2193"\n\nquadrant-dir = "quadrant" WS "Q"? digit WS quoted-string ( WS "description:" quoted-string )? NEWLINE\n\nconfig-block = "config:" NEWLINE ( INDENT key ":" WS value NEWLINE )*\n\npoint = quoted-string WS "at" WS "(" number "," number ")" ( WS point-prop )* NEWLINE\npoint-prop = "size:" number\n | "category:" bareword\n | "color:" hex-color\n | "shape:" ( "circle"|"square"|"triangle"|"diamond" )\n | "highlight:" "true"\n | "note:" quoted-string\n | "label:" quoted-string\n\ncell = "cell" WS "(" digit "," digit ")" ( WS cell-prop )* NEWLINE\ncell-prop = "value:" number\n | "label:" quoted-string\n | "level:" ( "strong" | "medium" | "weak" )\n\nstyle-dir = "style:" WS "table" NEWLINE\nq-short = "Q" ( "1" | "2" | "3" | "4" ) ":" WS quoted-string NEWLINE # 2\xD72 only\n\nrows-dir = "rows:" WS label-list NEWLINE\ncols-dir = "cols:" WS label-list NEWLINE\ngrid-dir = "grid:" WS number "x" number NEWLINE\naxis-dir = "axis:" WS ( "off" | "on" | "auto" ) NEWLINE\nmargins-dir = "margins:" WS ( "true" | "false" | "on" | "1" ) NEWLINE\n\nlabel-list = "[" text ("," text)* "]" | text ("," text)*\nquoted-string = \'"\' any-char-but-quote* \'"\' | "\'" any-char-but-quote* "\'"\ncomment = "#" any NEWLINE\n```\n\nAuthoritative source: `src/diagrams/matrix/parser.ts`. If this diverges from the parser, the parser wins \u2014 please open an issue.\n\n---'
|
|
3477
|
+
"content": '## 1. Your first matrix\n\nThe smallest useful matrix: a custom 2\xD72 with two labeled axes and three points.\n\n```\nmatrix "Feature Prioritization"\nx-axis: Low Effort \u2192 High Effort\ny-axis: Low Value \u2192 High Value\n\n"Add search" at (0.3, 0.8)\n"Rebuild pipeline" at (0.85, 0.7)\n"Update footer" at (0.2, 0.2)\n```\n\nFour rules cover 80% of usage:\n\n1. Start with the keyword `matrix`, optionally followed by a template name or a quoted title.\n2. Set the axes with `x-axis:` and `y-axis:` \u2014 or use a built-in template and skip this step entirely.\n3. Each point is `"Label" at (x, y)` where `x` and `y` are decimal fractions from 0.0 (low/left/bottom) to 1.0 (high/right/top).\n4. Add optional properties \u2014 `size:`, `category:`, `color:`, `shape:`, `highlight:` \u2014 after the coordinates.\n\n> Comments must start with `#` anywhere on a line (outside quoted strings).\n\n---\n\n## 2. Built-in templates\n\nA template pre-configures axes, quadrant labels, and grid size. Just use the template name as the second token on the header line.\n\n| Template | Grid | Use case |\n|---|---|---|\n| `eisenhower` | 2\xD72 | Urgency / Importance task prioritization |\n| `impact-effort` | 2\xD72 | Feature prioritization by impact vs. effort |\n| `rice` | 2\xD72 | RICE scoring \u2014 Reach \xD7 Impact vs. Effort |\n| `bcg` | 2\xD72 | Portfolio \u2014 Market Share vs. Growth rate |\n| `ansoff` | 2\xD72 | Product/market growth strategy |\n| `johari` | 2\xD72 | Self-awareness \u2014 known-to-self vs. known-to-others |\n| `9-box` | 3\xD73 | HR talent review \u2014 Performance vs. Potential |\n| `risk-matrix` | 5\xD75 | Risk assessment \u2014 Likelihood vs. Severity (heatmap) |\n\n```\nmatrix eisenhower "This Week"\n"Ship hotfix" at (0.1, 0.9) size: 5 highlight: true\n"Team 1:1s" at (0.1, 0.7) size: 3\n"Write Q3 OKRs" at (0.8, 0.85) size: 4\n"Inbox zero" at (0.1, 0.3) size: 2\n"Refactor auth" at (0.75, 0.4) size: 3\n```\n\nAxes and quadrant labels from a template can be overridden with explicit `x-axis:` / `y-axis:` / `quadrant` directives.\n\n---\n\n## 3. Axes\n\nAxis lines declare the semantic poles of each dimension.\n\n```\nx-axis: Low Effort \u2192 High Effort\ny-axis: Low Value \u2192 High Value\n```\n\nThe arrow separates the low label (left / bottom) from the high label (right / top). All of these separators are equivalent:\n\n| Separator | Example |\n|---|---|\n| `\u2192` (Unicode) | `x-axis: Rare \u2192 Certain` |\n| `->` (ASCII) | `x-axis: Rare -> Certain` |\n| `\u2191` | `y-axis: Cheap \u2191 Expensive` |\n| `\u2190` / `<-` / `<` | Reversed axis \u2014 high label is on the left |\n\nA **reversed axis** is for conventions where the "high" value sits at the left or bottom:\n\n```\nx-axis: High Market Share \u2190 Low Market Share\n```\n\n```\nmatrix "Product Portfolio"\nx-axis: High Market Share \u2190 Low Market Share\ny-axis: Low Growth \u2192 High Growth\n\nquadrant Q1 "Question Marks"\nquadrant Q2 "Stars"\nquadrant Q3 "Cash Cows"\nquadrant Q4 "Dogs"\n\n"Analytics Suite" at (0.25, 0.35) size: 5\n"ChatBot Pro" at (0.2, 0.8) size: 4 highlight: true\n"Legacy CRM" at (0.75, 0.25) size: 6\n"Mobile App" at (0.65, 0.75) size: 3\n```\n\n---\n\n## 4. Points\n\nEach point is a bubble positioned by a normalized (x, y) coordinate pair.\n\n```\n"Label" at (x, y)\n"Label" at (x, y) size: 4 category: design color: #7B1FA2 highlight: true note: "clarify spec"\n```\n\n| Property | Values | Meaning |\n|---|---|---|\n| `size:` | positive number | Bubble area weight (default: 3) |\n| `category:` | bareword | Color group; drives the legend |\n| `color:` | hex string | Override bubble color for this point |\n| `shape:` | `circle` \\| `square` \\| `triangle` \\| `diamond` | Bubble shape (default: `circle`) |\n| `highlight:` | `true` | Draws an emphasis ring around the bubble |\n| `note:` | quoted string | Tooltip annotation |\n| `label:` | quoted string | Replaces the display label (different from the ID) |\n\nCoordinates outside `[0, 1]` are clamped to the chart boundary and flagged with a badge \u2014 the original value is stored for tooltip display.\n\n```\nmatrix "Risk Register"\nx-axis: Low Impact \u2192 High Impact\ny-axis: Rare \u2192 Certain\n\n"Vendor delay" at (0.45, 0.7) size: 4 category: schedule highlight: true\n"Security breach" at (0.9, 0.3) size: 5 category: security shape: diamond\n"Budget overrun" at (0.5, 0.65) size: 3 category: finance\n"Key hire falls through" at (0.6, 0.55) size: 3 category: people\n"Scope creep" at (0.4, 0.8) size: 4 category: schedule\n```\n\n---\n\n## 5. Quadrant labels\n\nLabel each quadrant with a name and an optional subtitle.\n\n```\nquadrant Q1 "Do First"\nquadrant Q2 "Schedule"\nquadrant Q3 "Delete"\nquadrant Q4 "Delegate"\n\n# With an optional subtitle:\nquadrant Q1 "Do First" description: "High urgency, high importance"\n```\n\nQuadrant numbering follows the standard mathematical convention: **Q1 = top-right, Q2 = top-left, Q3 = bottom-left, Q4 = bottom-right**. The `Q` prefix is optional \u2014 `quadrant 1 "Label"` is equally valid.\n\n---\n\n## 6. Heatmap mode\n\nHeatmap mode fills N\xD7M cells with color intensity instead of plotting bubble positions.\n\n```\nmatrix heatmap 4x3 "Skill Matrix"\nrows: [Strategy, Execution, Communication, Technical]\ncols: [Junior, Mid, Senior]\n\ncell (0,0) level: weak\ncell (1,0) level: medium\ncell (2,0) level: strong\ncell (0,1) value: 7\ncell (1,2) label: "Top 10%"\n```\n\n- `matrix heatmap COLxROW` \u2014 header sets the grid dimensions.\n- `rows:` and `cols:` \u2014 comma-separated or bracket-list of axis labels.\n- `cell (col, row)` \u2014 zero-indexed, column first, row second (row 0 = bottom).\n- `level:` \u2014 `strong` (3), `medium` (2), or `weak` (1) \u2014 shorthand for heat intensity.\n- `value:` \u2014 explicit numeric value (overrides `level:`).\n- `label:` \u2014 quoted text placed inside the cell.\n\n```\nmatrix heatmap 4x4 "Competency Heat Map"\nrows: [Leadership, Execution, Communication, Technical]\ncols: [Junior, Mid, Senior, Staff]\n\ncell (0,0) level: weak\ncell (1,0) level: medium\ncell (2,0) level: strong\ncell (3,0) level: strong\ncell (0,1) level: medium\ncell (1,1) level: medium\ncell (2,1) level: strong\ncell (3,1) level: strong\ncell (0,2) level: weak\ncell (1,2) level: medium\ncell (2,2) level: medium\ncell (3,2) level: strong\ncell (0,3) level: weak\ncell (1,3) level: weak\ncell (2,3) level: medium\ncell (3,3) level: strong\n```\n\n---\n\n## 7. Correlation mode\n\nCorrelation mode renders an N\xD7M dot matrix where intensity represents the relationship strength between row and column variables.\n\n```\nmatrix correlation 4x4 "Product Metrics"\nrows: [DAU, Retention, Revenue, NPS]\ncols: [DAU, Retention, Revenue, NPS]\n\ncell (0,0) value: 1\ncell (1,0) value: 0.82\ncell (2,0) value: 0.54\ncell (3,0) value: 0.71\n```\n\nThe same `cell` syntax applies. `level: strong | medium | weak` is also accepted in correlation mode.\n\n---\n\n## 8. SIPOC mode\n\nA **SIPOC** is the one-page scoping table that opens the *Define* phase of a Six Sigma DMAIC project. It names, in five fixed columns left to right, everyone and everything the process touches: **S**uppliers \xB7 **I**nputs \xB7 **P**rocess \xB7 **O**utputs \xB7 **C**ustomers. Before a team measures or improves anything, SIPOC pins down the boundary \u2014 "where does this process start, where does it end, and who hands work in and out of it."\n\n```\nmatrix sipoc "Order fulfilment"\nsuppliers: "Vendor", "Warehouse"\ninputs: "PO", "Stock levels"\nprocess: "Receive order", "Pick", "Pack", "Ship"\noutputs: "Shipped package", "Invoice"\ncustomers: "End customer", "Finance"\n```\n\n- Start with `matrix sipoc`, optionally followed by a quoted title.\n- Each of the five columns is its own directive: `suppliers:`, `inputs:`, `process:`, `outputs:`, `customers:`.\n- After the colon, list the entries as **comma-separated quoted strings**. A column may have any number of entries; the rows simply stack top-down inside that column.\n- The `process:` column is the high-level step sequence (typically 4\u20137 steps) \u2014 keep it to the major stages, not a detailed flowchart.\n\nThe five columns always render in the canonical S-I-P-O-C order regardless of the order you declare them, so the diagram reads correctly even if an LLM emits the blocks out of sequence.\n\n```\nmatrix sipoc "Order fulfilment"\nsuppliers: "Vendor", "Warehouse"\ninputs: "PO", "Stock levels"\nprocess: "Receive order", "Pick", "Pack", "Ship"\noutputs: "Shipped package", "Invoice"\ncustomers: "End customer", "Finance"\n```\n\n---\n\n## 9. QFD mode (House of Quality)\n\n**Quality Function Deployment (QFD)** \u2014 the *House of Quality*, introduced by Yoji Akao \u2014 translates what customers want into the engineering characteristics that deliver it. Rows are the **WHATs** (customer requirements, each with an importance weight); columns are the **HOWs** (the measurable engineering characteristics the team controls). The body of the grid records how strongly each HOW serves each WHAT.\n\nThe differentiator: the engine **computes** the bottom row for you. Each HOW\'s *technical importance* is the sum down its column of `weight \xD7 relationship strength` \u2014 a ranked answer to "which engineering characteristic moves the most customer value, and is therefore worth the most effort." And the roof of the house \u2014 a half-matrix of diamond cells above the columns \u2014 records whether two HOWs help or fight each other.\n\n```\nmatrix qfd "Coffee maker"\nwhat: "Quiet operation" weight: 5\nwhat: "Brews fast" weight: 3\nwhat: "Energy efficient" weight: 4\nhow: "Fan RPM" dir: down\nhow: "Heater watts" dir: up\nhow: "Insulation" dir: up\nrel (0,0): 9\nrel (0,2): 3\nrel (1,1): 9\nrel (2,1): 3\nrel (2,2): 9\nroof (0,1): --\nroof (1,2): +\n```\n\n### WHATs and HOWs\n\n| Directive | Form | Meaning |\n|---|---|---|\n| `what:` | `what: "Label" weight: N` | A customer requirement (one row). `weight:` is its importance, conventionally 1\u20135. Declaration order is the row order, indexed from 0. |\n| `how:` | `how: "Label" dir: up\\|down` | An engineering characteristic (one column). Declaration order is the column order, indexed from 0. `dir:` is the optimization target \u2014 `up` = more is better, `down` = less is better. |\n\n### Relationship cells\n\n`rel (i, j): strength` records how strongly column-`j` HOW serves row-`i` WHAT. The index is **(row, column)**, both zero-based.\n\n| Strength | Meaning |\n|---|---|\n| `9` | Strong relationship |\n| `3` | Medium relationship |\n| `1` | Weak relationship |\n| *(omitted)* | No relationship \u2014 leave the cell out |\n\nThis 9 / 3 / 1 scale is the QFD convention: it is deliberately non-linear so that one strong link outweighs several weak ones when the importance row is summed.\n\n### Computed technical-importance row\n\nThe engine sums each column to produce the technical-importance row at the foot of the house:\n\n```\nimportance(j) = \u03A3 over rows i ( weight(i) \xD7 strength(i, j) )\n```\n\nFor the coffee-maker example above the row computes to **45 / 39 / 51** \u2014 Insulation (51) is the highest-leverage characteristic, Heater watts (39) the lowest. This ranking is the deliverable: it tells the team where to spend engineering effort.\n\nAdd `normalize: true` (its own line, anywhere in the block) to show each column as a **percentage of the total** instead of a raw sum \u2014 for this example, **33% / 29% / 38%**. Percentages make the relative priorities easier to read across very different weight scales.\n\n### The roof \u2014 HOW \xD7 HOW correlations\n\nThe **roof** is the triangular half-matrix sitting above the columns. `roof (i, j): glyph` records whether HOW `i` and HOW `j` reinforce or conflict with each other \u2014 the synergies and trade-offs a team must reconcile.\n\n| Glyph | Correlation |\n|---|---|\n| `++` | Strong positive \u2014 improving one strongly helps the other |\n| `+` | Positive |\n| `-` | Negative |\n| `--` | Strong negative \u2014 improving one hurts the other (a trade-off) |\n| *(omitted)* | No correlation \u2014 leave the cell out |\n\nEach roof entry renders as a diamond cell in the standard QFD pitched-roof grid. In the example, `roof (0,1): --` flags that pushing Fan RPM down while pushing Heater watts up is a trade-off, and `roof (1,2): +` flags that Heater watts and Insulation reinforce each other.\n\n```\nmatrix qfd "Coffee maker"\nwhat: "Quiet operation" weight: 5\nwhat: "Brews fast" weight: 3\nwhat: "Energy efficient" weight: 4\nhow: "Fan RPM" dir: down\nhow: "Heater watts" dir: up\nhow: "Insulation" dir: up\nrel (0,0): 9\nrel (0,2): 3\nrel (1,1): 9\nrel (2,1): 3\nrel (2,2): 9\nroof (0,1): --\nroof (1,2): +\n```\n\n---\n\n## 10. Punnett mode (Mendelian genetics)\n\nA **Punnett square** predicts the offspring of a genetic cross. You write only the two parental genotypes; the engine does the Mendelian bookkeeping \u2014 it enumerates each parent\'s **gametes** (one allele per gene locus), fills the grid with every gamete combination, and **computes the genotype and phenotype ratios**. The user never fills the grid.\n\n```\nmatrix punnett "Eye color (Bb \xD7 Bb)"\ncross: Bb x Bb\ntrait B: "Brown eyes" / "Blue eyes"\n```\n\n### The cross\n\n| Directive | Form | Meaning |\n|---|---|---|\n| `cross:` | `cross: Bb x Bb` | The two parental genotypes, separated by `x`, `\xD7`, or `*`. `parents:` is an accepted alias. |\n| `trait:` | `trait B: "Dominant" / "Recessive"` | *(optional)* Names the two phenotypes for gene `B`, so the legend reads in plain English instead of `B_` / `bb`. |\n\n**Allele case sets dominance** \u2014 this is the standard genetics convention. An uppercase letter is the **dominant** allele, the matching lowercase letter is **recessive**. A genotype groups alleles by letter: `RrYy` is two loci, `R/r` (round/wrinkled) and `Y/y` (yellow/green). One gene is a **monohybrid** cross (2\xD72 grid), two genes a **dihybrid** (4\xD74), three a trihybrid (8\xD78).\n\n### Computed ratios (the differentiator)\n\nThe engine derives, from the genotypes alone:\n\n- the **gametes** of each parent \u2014 the column and row headers \u2014 by taking one allele per locus (so a heterozygote `Bb` yields `B` and `b`);\n- the **offspring grid** \u2014 every gamete pairing, written dominant-allele-first (`Bb`, never `bB`);\n- the **phenotype ratio** \u2014 boxes grouped by which phenotype they express, reduced to lowest terms. A monohybrid `Bb \xD7 Bb` gives the classic **3:1**; a dihybrid `RrYy \xD7 RrYy` gives the famous **9:3:3:1**;\n- the **genotype ratio** \u2014 e.g. `1:2:1` (1 BB, 2 Bb, 1 bb) for the monohybrid.\n\nEach box is tinted by its phenotype class, and the footer lists the phenotype ratio with a legend plus the genotype ratio.\n\n```\nmatrix punnett "Seed shape & colour (RrYy \xD7 RrYy)"\ncross: RrYy x RrYy\ntrait R: "Round" / "Wrinkled"\ntrait Y: "Yellow" / "Green"\n```\n\n---\n\n## 11. Config options\n\nA `config:` block tunes visual rendering. Each option goes on its own indented line below the `config:` header.\n\n```\nconfig:\n quadrantBg: true\n gridLines: true\n axisArrows: true\n bubbleScale: area\n legendPosition: bottom-right\n```\n\n| Key | Values | Default | Effect |\n|---|---|---|---|\n| `quadrantBg` | `true` \\| `false` | `true` | Colored quadrant background fills |\n| `gridLines` | `true` \\| `false` | `true` | Grid lines overlay |\n| `axisArrows` | `true` \\| `false` | `true` | Arrows at axis ends |\n| `bubbleScale` | `area` \\| `radius` | `area` | Whether `size:` scales bubble area or radius |\n| `quadrantAnnotations` | `true` \\| `false` | `true` | Show quadrant label text in corners |\n| `legendPosition` | `bottom-right` \\| `right` \\| `bottom-center` \\| `none` | `bottom-right` | Category legend placement |\n| `labelCollision` | `auto` \\| `offset-only` \\| `leader-only` \\| `off` | `auto` | Overlap avoidance strategy for point labels |\n| `offChartPolicy` | `clamp-badge` \\| `drop` | `clamp-badge` | What to do with points outside [0,1] |\n\nTwo shorthand directives also work at the top level (not inside the `config:` block):\n\n```\naxis: off # off | on | auto \u2014 show or hide the axis lines\nmargins: true # true | false \u2014 show Score + Rank margins (correlation mode)\n```\n\n---\n\n## 12. Labels & comments\n\n- **Title:** `matrix "My Title"` or `title: My Title` as a standalone line.\n- **Point label:** the quoted string before `at (\u2026)`.\n- **Axis labels:** `x-axis:` and `y-axis:` directives.\n- **Quadrant labels:** `quadrant Q1 "Name"` directive.\n- **Comments:** `#` anywhere on a line, outside quoted strings.\n\n```\nmatrix "Prioritization"\n# This is a comment\nx-axis: Low Cost \u2192 High Cost # inline comment after a directive\n"Fix bug" at (0.1, 0.9) size: 3 # comment after a point\n```\n\n---\n\n## 13. Table mode (`style: table`)\n\nThe default matrix rendering is a **scatter / bubble chart** \u2014 points float at (x, y) coordinates. For frameworks where the output is a list of items grouped by quadrant (Eisenhower, Johari, Impact-Effort, 9-box), use `style: table` to switch to a **text-in-cell layout** instead.\n\n```\nmatrix eisenhower "This Week"\nstyle: table\nQ2: "Ship hotfix"\nQ2: "Customer demo prep"\nQ1: "Write Q3 OKRs"\nQ1: "Refactor auth layer"\nQ4: "LinkedIn updates"\nQ3: "Reorganize Slack channels"\n```\n\n`style: table` applies these changes automatically:\n\n| Effect | Detail |\n|---|---|\n| Axes and arrows hidden | No axis lines, labels, or arrowheads |\n| Grid lines hidden | Only the outer border and cell dividers remain |\n| Quadrant titles move inside cells | Each title becomes a cell header instead of a corner overlay |\n| Items stack as a bullet list | Multiple entries for the same quadrant stack top-down |\n\n### `Q1` \u2026 `Q4` shorthand (2\xD72 only)\n\nFor 2\xD72 templates, use `Qn: "item"` instead of the longer `cell (col, row) label: "item"` form. Mapping:\n\n| Shorthand | Cell | Eisenhower | Johari |\n|---|---|---|---|\n| `Q1:` | top-right | Schedule | Blind |\n| `Q2:` | top-left | Do First | Open / Arena |\n| `Q3:` | bottom-left | Delete | Hidden / Fa\xE7ade |\n| `Q4:` | bottom-right | Delegate | Unknown |\n\nRepeat a shorthand key to add multiple items to the same cell:\n\n```\nQ2: "Ship hotfix"\nQ2: "Customer demo prep"\n```\n\nFor 3\xD73 grids (9-box), use `cell (col, row) label: "\u2026"` directly \u2014 the `Q` shorthand is 2\xD72 only.\n\n### When to use table vs scatter\n\n| Use `style: table` for | Use scatter (default) for |\n|---|---|\n| Eisenhower with task lists | Eisenhower with `size:` effort weights |\n| Johari window coaching | Impact-Effort with bubble = revenue |\n| Backlog grouping (no numeric third dimension) | RICE / BCG portfolio (third dimension IS the bubble size) |\n| 9-box talent review | Risk heatmap (5\xD75 with numeric severity) |\n\n```\nmatrix eisenhower "This Week"\nstyle: table\nQ2: "Ship hotfix"\nQ2: "Customer demo prep"\nQ1: "Write Q3 OKRs"\nQ1: "Refactor auth layer"\nQ4: "LinkedIn updates"\nQ3: "Reorganize Slack channels"\n```\n\n---\n\n## 14. Reserved words & escaping\n\n**Reserved at line start:** `matrix` (header), `x-axis:`, `y-axis:`, `quadrant`, `config:`, `title:`, `rows:`, `cols:`, `grid:`, `axis:`, `margins:`, `cell`. In **SIPOC** mode: `suppliers:`, `inputs:`, `process:`, `outputs:`, `customers:`. In **QFD** mode: `what:`, `how:`, `rel`, `roof`, `normalize:`.\n\n**Point lines must start with a quote character** (`"` or `\'`). A line that does not start with a quote is not treated as a point.\n\n**Strings with spaces** in axis labels do not need quoting \u2014 the text after the colon (and after the arrow) is taken verbatim. In `note:` and `label:` point properties, use double quotes.\n\n---\n\n## 15. Common mistakes\n\n| You wrote | Parser says | Fix |\n|---|---|---|\n| `"Fix bug" at (1, 2)` | Point parsed; x=1 clamped, y=1 clamped; off-chart badge shown | Keep coordinates in [0.0, 1.0] or accept the clamp-badge |\n| `quadrant 1 "Quick Wins"` (no Q prefix) | Accepted \u2014 `Q` prefix is optional | Both `quadrant 1` and `quadrant Q1` work |\n| `config: gridLines: false` (on same line) | Only `config:` keyword recognized; `gridLines: false` silently ignored | Put options on their own indented lines below `config:` |\n| `x-axis: "Low" \u2192 "High"` (quoted labels) | Arrow not found inside quotes \u2014 treated as plain text | Remove quotes: `x-axis: Low \u2192 High` |\n| `matrix heatmap` without dimensions | Defaults to 2\xD72; rows/cols directives set actual size | Specify dimensions on the header: `matrix heatmap 4x4` |\n| `cell (0, 0) level: Strong` (capital S) | `level` match is case-insensitive \u2014 accepted | Both `strong` and `Strong` work |\n| `shape: oval` | Unknown shape value \u2014 silently ignored | Use `circle`, `square`, `triangle`, or `diamond` |\n| `"Fix bug" at (0.1, 0.9)` on an Eisenhower with a task list | Valid scatter point \u2014 but you probably wanted a list in a cell | Add `style: table` and use `Q2: "Fix bug"` instead |\n| `Q1: "item"` on a 3\xD73 template | `Q` shorthand is parsed as a point line \u2014 silently dropped | Use `cell (col, row) label: "item"` for 3\xD73 grids |\n\n---\n\n## 16. Grammar (EBNF)\n\n```text\ndocument = header directive*\n\nheader = "matrix" ( template-name | mode-header | title )? NEWLINE\ntemplate-name = "eisenhower"|"impact-effort"|"rice"|"bcg"|"ansoff"|"johari"|"9-box"|"risk-matrix"\nmode-header = ( "heatmap" | "correlation" ) ( number "x" number )? title?\n | ( "sipoc" | "qfd" | "punnett" ) title?\ntitle = quoted-string | bare-text\n\ndirective = x-axis | y-axis | quadrant-dir | config-block\n | point | cell | q-short | rows-dir | cols-dir | grid-dir\n | style-dir | title-dir | axis-dir | margins-dir\n | sipoc-col | qfd-what | qfd-how | qfd-rel | qfd-roof | normalize-dir\n | punnett-cross | punnett-trait\n | comment | blank\n\n# SIPOC mode\nsipoc-col = ( "suppliers:" | "inputs:" | "process:" | "outputs:" | "customers:" )\n WS quoted-string ( "," quoted-string )* NEWLINE\n\n# QFD / House of Quality mode\nqfd-what = "what:" WS quoted-string WS "weight:" number NEWLINE\nqfd-how = "how:" WS quoted-string ( WS "dir:" ( "up" | "down" ) )? NEWLINE\nqfd-rel = "rel" WS "(" number "," number ")" ":" WS ( "9" | "3" | "1" ) NEWLINE # (row, col)\nqfd-roof = "roof" WS "(" number "," number ")" ":" WS ( "++" | "+" | "-" | "--" ) NEWLINE # (how, how)\nnormalize-dir = "normalize:" WS "true" NEWLINE\n\n# Punnett (Mendelian genetics) mode\npunnett-cross = ( "cross:" | "parents:" ) WS genotype WS ( "x" | "\xD7" | "*" ) WS genotype NEWLINE\npunnett-trait = "trait" WS letter ":" WS quoted-string WS "/" WS quoted-string NEWLINE # dominant / recessive\ngenotype = ( letter letter )+ # allele pairs grouped by letter; case = dominance, e.g. "RrYy"\n\nx-axis = "x-axis:" WS axis-spec NEWLINE\ny-axis = "y-axis:" WS axis-spec NEWLINE\naxis-spec = text arrow text | text # plain text \u2192 high label only\narrow = "\u2192" | "->" | "\u2191" | "\u2190" | "<-" | "<" | "\u2193"\n\nquadrant-dir = "quadrant" WS "Q"? digit WS quoted-string ( WS "description:" quoted-string )? NEWLINE\n\nconfig-block = "config:" NEWLINE ( INDENT key ":" WS value NEWLINE )*\n\npoint = quoted-string WS "at" WS "(" number "," number ")" ( WS point-prop )* NEWLINE\npoint-prop = "size:" number\n | "category:" bareword\n | "color:" hex-color\n | "shape:" ( "circle"|"square"|"triangle"|"diamond" )\n | "highlight:" "true"\n | "note:" quoted-string\n | "label:" quoted-string\n\ncell = "cell" WS "(" digit "," digit ")" ( WS cell-prop )* NEWLINE\ncell-prop = "value:" number\n | "label:" quoted-string\n | "level:" ( "strong" | "medium" | "weak" )\n\nstyle-dir = "style:" WS "table" NEWLINE\nq-short = "Q" ( "1" | "2" | "3" | "4" ) ":" WS quoted-string NEWLINE # 2\xD72 only\n\nrows-dir = "rows:" WS label-list NEWLINE\ncols-dir = "cols:" WS label-list NEWLINE\ngrid-dir = "grid:" WS number "x" number NEWLINE\naxis-dir = "axis:" WS ( "off" | "on" | "auto" ) NEWLINE\nmargins-dir = "margins:" WS ( "true" | "false" | "on" | "1" ) NEWLINE\n\nlabel-list = "[" text ("," text)* "]" | text ("," text)*\nquoted-string = \'"\' any-char-but-quote* \'"\' | "\'" any-char-but-quote* "\'"\ncomment = "#" any NEWLINE\n```\n\nAuthoritative source: `src/diagrams/matrix/parser.ts`. If this diverges from the parser, the parser wins \u2014 please open an issue.\n\n---'
|
|
3391
3478
|
},
|
|
3392
3479
|
"orgchart": {
|
|
3393
3480
|
"title": "Org chart",
|
|
@@ -3496,6 +3583,10 @@ var SYNTAX = {
|
|
|
3496
3583
|
"threatmodel": {
|
|
3497
3584
|
"title": "Threat Model (STRIDE DFD)",
|
|
3498
3585
|
"content": '## 1. Your first threat model\n\nStart with the `threatmodel` keyword (alias `stride`), an optional title, then **declare elements** and **wire flows**:\n\n```\nthreatmodel "Login flow"\nexternal: User\nprocess 1.1: Web Server\ndatastore D1: User DB\nUser -> 1.1 : "Login request"\n1.1 -> D1 : Lookup\n```\n\nEach element is `kind: ID: Label` (or `kind: Label`, where the id is slugged from the label \u2014 `external: Mobile App` becomes id `Mobile_App`). A flow is `SOURCE -> TARGET : label`, and the **label is mandatory** (it names the data crossing).\n\n---\n\n## 2. Element kinds and flows\n\n```\nexternal: User # external entity (the attacker\'s side)\nprocess 1.1: Web Server # a process / service\ndatastore D1: User DB # a data store\ndatastore D2: Audit log # a log/audit store (gets conditional Repudiation)\nUser -> 1.1 : "HTTPS Request" # directed flow, quoted or bare label\n1.1 <-> D1 : Read/Write # <-> expands into two directed flows\n```\n\n- Process ids are often dotted DFD numbers (`1.1`, `2.3`); external/store ids are usually short slugs (`User`, `D1`).\n- A `<->` flow expands into **two** directed flows.\n- A store whose name/id matches `log|audit|journal` (or carries an explicit hint) is treated as a log store.\n\n**Flow rules** the engine enforces: no store\u2192store flows (data stores are passive), no external\u2192external flows, and every endpoint must be a declared element.\n\n---\n\n## 3. Trust boundaries\n\n```\nboundary "Internet" { User }\nboundary "DMZ" { 1.1 }\nboundary "Internal" { D1, D2 }\n```\n\n`boundary "name" { id, id, \u2026 }` groups elements into a trust zone. An element may belong to **at most one** boundary; members must be declared. Elements in no boundary share an implicit untrusted zone.\n\n---\n\n## 4. Computed STRIDE analysis\n\nThis is the differentiator. The engine applies the **STRIDE-per-element** mapping:\n\n| DFD element | Threats applied |\n|-----------------|------------------------|\n| External entity | S, R |\n| Process | S, T, R, I, D, E |\n| Data store | T, I, D (+ R if log) |\n| Data flow | T, I, D |\n\n- The data-store **Repudiation** is conditional \u2014 added for log / audit / journal stores (the Shostack green "?").\n- **Boundary crossing**: a flow whose endpoints sit in different trust zones is flagged, because that is where Spoofing / Tampering / Information-disclosure concentrate. Two elements in the same (or implicit) zone do not cross.\n\nEach element and flow carries its applicable STRIDE categories in `data-*` so the analysis is inspectable.\n\n---\n\n## 5. Common mistakes\n\n```\n# WRONG \u2014 flow with no label\nUser -> 1.1\n\n# WRONG \u2014 store to store (data stores are passive)\nD1 -> D2 : x\n\n# WRONG \u2014 external to external\nA -> B : x\n\n# WRONG \u2014 unknown flow endpoint\nP -> Ghost : x\n\n# WRONG \u2014 an element in two boundaries\nboundary "A" { P }\nboundary "B" { P }\n```\n\nEvery flow needs a label; stores and externals cannot be flow partners with their own kind; endpoints must be declared; an element belongs to at most one trust boundary. Duplicate ids are rejected.\n\n---'
|
|
3586
|
+
},
|
|
3587
|
+
"welding": {
|
|
3588
|
+
"title": "Welding symbol diagram",
|
|
3589
|
+
"content": '## 1. Your first weld\n\nThe smallest useful callout: a header, one joint, one arrow-side weld.\n\n```\nwelding "Bracket"\njoint "bracket to plate" {\n arrow: fillet size=8\n}\n```\n\nThree rules cover most usage:\n\n1. Start with `welding`, optionally `standard: aws | iso-a | iso-b` (default `aws`) and a quoted title.\n2. Each joint is a `joint "label" { \u2026 }` block. Put a weld on `arrow:` (arrow side) and/or `other:` (other side).\n3. A weld spec is a type followed by `key=value` dimensions \u2014 `fillet size=8`, `vgroove angle=60 root=3`.\n\n---\n\n## 2. Sides \u2014 arrow, other, both\n\nA joint is welded on the arrow side, the other side, or both.\n\n```\njoint "double fillet" {\n both: fillet size=6 # same weld on both sides\n}\njoint "asymmetric" {\n arrow: fillet size=8 # arrow side only\n other: vgroove angle=60 # different weld on the other side\n}\n```\n\n- **AWS** (default): the arrow-side glyph draws **below** the reference line, the other-side glyph **above**.\n- **ISO-A** (`standard: iso-a`): a **dashed companion line** appears; the arrow-side weld attaches to the solid line, the other-side weld to the dashed line. A symmetric `both:` weld suppresses the dashed line.\n\n---\n\n## 3. Weld types\n\n| Type | Glyph | Type | Glyph |\n|---|---|---|---|\n| `fillet` | triangle | `plug` / `slot` | rectangle |\n| `square` | parallel verticals | `spot` | circle on the line |\n| `vgroove` | V | `seam` | circle + line |\n| `bevel` | half-V | `back` / `backing` | semicircle |\n| `ugroove` | U | `surfacing` | build-up bumps |\n| `jgroove` | half-U | `edge` | tall verticals |\n| `flarev` / `flarebevel` | curved groove | | |\n\nAliases: `v`\u2192`vgroove`, `u`\u2192`ugroove`, `j`\u2192`jgroove`, `flare-v`\u2192`flarev`.\n\n---\n\n## 4. Dimensions\n\nDimensions read along the reference line in fixed slots.\n\n```\njoint "groove" {\n arrow: vgroove angle=60 root=3 throat=12 len=50 pitch=150\n}\n```\n\n| Key | Slot | Meaning |\n|---|---|---|\n| `size=` | left of symbol | fillet leg / groove depth / plug diameter |\n| `throat=` | left, in parentheses | effective throat `(E)` |\n| `len=` | right of symbol | weld length |\n| `pitch=` | right (with `len`) | intermittent centre-to-centre pitch \u2192 `len-pitch` |\n| `count=` | right (ISO) | number of increments \u2192 `count\xD7len (pitch)` |\n| `angle=` | at the opening | groove included angle (groove types only) |\n| `root=` | between symbol and line | root opening / gap |\n| `contour=` | above the symbol | `flush` (bar), `convex`, `concave` (arc) |\n| `finish=` | above the contour | finish method letter `G`/`M`/`C`/`R`/`H`/`U` |\n\n---\n\n## 5. Supplementary symbols\n\n```\njoint "post base" {\n arrow: fillet size=10\n around # weld-all-around \u2014 open circle at the junction\n field # field / site weld \u2014 filled flag pointing to the tail\n tail: "GTAW; WPS-12" # process / spec / NDE method\n}\n```\n\n```\nwelding\njoint "butt weld" {\n arrow: vgroove angle=60 root=3 throat=12\n other: backing\n tail: "SMAW; E7018"\n}\n```\n\n---'
|
|
3499
3590
|
}
|
|
3500
3591
|
};
|
|
3501
3592
|
|
|
@@ -3682,8 +3773,17 @@ var PROFILES = {
|
|
|
3682
3773
|
type: "entity",
|
|
3683
3774
|
header: 'entity-structure "Title"',
|
|
3684
3775
|
mode: "legal entities + ownership edges",
|
|
3685
|
-
forms: [
|
|
3686
|
-
|
|
3776
|
+
forms: [
|
|
3777
|
+
'entity holdco "HoldCo" corp@US',
|
|
3778
|
+
'entity opco "OpCo" llc@DE',
|
|
3779
|
+
"holdco -> opco : 100%",
|
|
3780
|
+
'cluster "Group Name" [members: [holdco, opco]]'
|
|
3781
|
+
],
|
|
3782
|
+
prefer: [
|
|
3783
|
+
"Use `entity` declarations before ownership edges.",
|
|
3784
|
+
"Keep legal form and jurisdiction explicit when known.",
|
|
3785
|
+
'Group entities with `cluster "Name" [members: [id1, id2]]` \u2014 the members value MUST be a bracketed list.'
|
|
3786
|
+
],
|
|
3687
3787
|
avoid: ["Avoid database schema terminology; use `erd` for tables and FKs."],
|
|
3688
3788
|
repair: ["Unknown ownership endpoints need entity declarations."]
|
|
3689
3789
|
},
|
|
@@ -4279,6 +4379,40 @@ var PROFILES = {
|
|
|
4279
4379
|
"'unknown element' \u2014 declare the external/process/datastore before referencing it.",
|
|
4280
4380
|
"'flow needs a label' \u2014 add `: \"\u2026\"` to the flow."
|
|
4281
4381
|
]
|
|
4382
|
+
},
|
|
4383
|
+
welding: {
|
|
4384
|
+
type: "welding",
|
|
4385
|
+
header: "welding [standard: aws|iso-a|iso-b]",
|
|
4386
|
+
mode: "reference-line callouts; one joint block per joint, weld glyphs above/below the line",
|
|
4387
|
+
forms: [
|
|
4388
|
+
'welding "Bracket welds"',
|
|
4389
|
+
'joint "bracket to plate" {',
|
|
4390
|
+
" arrow: fillet size=8 len=50 pitch=150",
|
|
4391
|
+
" other: fillet size=6",
|
|
4392
|
+
" around",
|
|
4393
|
+
" field",
|
|
4394
|
+
' tail: "GTAW"',
|
|
4395
|
+
"}",
|
|
4396
|
+
'joint "butt weld" {',
|
|
4397
|
+
" arrow: vgroove angle=60 root=3 throat=12",
|
|
4398
|
+
" other: backing",
|
|
4399
|
+
"}"
|
|
4400
|
+
],
|
|
4401
|
+
prefer: [
|
|
4402
|
+
'Keyword `welding`; one `joint "label" { \u2026 }` block per joint. Put a weld on `arrow:` (arrow side) and/or `other:` (other side); `both:` is shorthand for the same weld on both sides.',
|
|
4403
|
+
"A weldspec is `<type> key=value \u2026`: `size=` (left of symbol), `len=`/`pitch=` (length-pitch, right), `angle=`/`root=` (groove only), `throat=`, `contour=flush|convex|concave`, `finish=G|M|C|R|H|U`.",
|
|
4404
|
+
'Flags on their own line: `around` (weld-all-around), `field` (site weld). Process/spec/NDE goes in `tail: "GTAW; WPS-12"`.',
|
|
4405
|
+
"Types: fillet \xB7 square \xB7 vgroove \xB7 bevel \xB7 ugroove \xB7 jgroove \xB7 flarev \xB7 flarebevel \xB7 plug \xB7 slot \xB7 spot \xB7 seam \xB7 back \xB7 backing \xB7 surfacing \xB7 edge."
|
|
4406
|
+
],
|
|
4407
|
+
avoid: [
|
|
4408
|
+
"Don't put `angle=` on a fillet/plug/spot \u2014 angle is groove-only (the engine warns).",
|
|
4409
|
+
"Don't use `both:` for plug/slot/surfacing \u2014 they are single-side; surfacing is arrow-side only.",
|
|
4410
|
+
"Don't give a fillet without `size=`, or a `pitch=` without `len=`."
|
|
4411
|
+
],
|
|
4412
|
+
repair: [
|
|
4413
|
+
"'a fillet weld needs a leg size' \u2014 add `size=\u2026` to the fillet spec.",
|
|
4414
|
+
"'angle= only applies to groove welds' \u2014 drop `angle=`, or change the type to a groove."
|
|
4415
|
+
]
|
|
4282
4416
|
}
|
|
4283
4417
|
};
|
|
4284
4418
|
function getGenerationProfile(type) {
|
|
@@ -4362,7 +4496,7 @@ function getExamples(type, opts = {}) {
|
|
|
4362
4496
|
function validateDsl(type, dsl) {
|
|
4363
4497
|
const resolvedType = type ? resolveDiagramType(type) : void 0;
|
|
4364
4498
|
const config = type ? { type: resolvedType ?? type } : void 0;
|
|
4365
|
-
const result =
|
|
4499
|
+
const result = chunkUGB42BGK_cjs.parseResult(dsl, config);
|
|
4366
4500
|
if (result.ok) {
|
|
4367
4501
|
return {
|
|
4368
4502
|
ok: true,
|
|
@@ -4388,7 +4522,7 @@ function renderDsl(type, dsl, options = {}) {
|
|
|
4388
4522
|
...options,
|
|
4389
4523
|
...type ? { type: resolvedType ?? type } : {}
|
|
4390
4524
|
};
|
|
4391
|
-
const result =
|
|
4525
|
+
const result = chunkUGB42BGK_cjs.renderResult(dsl, config);
|
|
4392
4526
|
if (result.ok) {
|
|
4393
4527
|
return {
|
|
4394
4528
|
ok: true,
|
|
@@ -4441,5 +4575,5 @@ exports.listDiagrams = listDiagrams;
|
|
|
4441
4575
|
exports.renderDsl = renderDsl;
|
|
4442
4576
|
exports.resolveDiagramType = resolveDiagramType;
|
|
4443
4577
|
exports.validateDsl = validateDsl;
|
|
4444
|
-
//# sourceMappingURL=chunk-
|
|
4445
|
-
//# sourceMappingURL=chunk-
|
|
4578
|
+
//# sourceMappingURL=chunk-HWNVSNDJ.cjs.map
|
|
4579
|
+
//# sourceMappingURL=chunk-HWNVSNDJ.cjs.map
|