@transitrix/diagrams 1.15.0 → 1.16.0
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/compliance/catalogue.d.ts +17 -0
- package/dist/compliance/catalogue.js +68 -0
- package/dist/compliance/index.d.ts +4 -2
- package/dist/compliance/index.js +2 -1
- package/dist/compliance/requirement-chain.d.ts +13 -2
- package/dist/compliance/requirement-chain.js +60 -33
- package/dist/products/types.d.ts +1 -1
- package/dist/products/validate.js +1 -1
- package/dist/standalone/validate.js +64 -3
- package/dist/webview/render-activities.d.ts +6 -0
- package/dist/webview/render-activities.js +2 -2
- package/dist/webview/render-activity-card.d.ts +6 -0
- package/dist/webview/render-activity-card.js +2 -2
- package/dist/webview/render-blocks.d.ts +10 -0
- package/dist/webview/render-blocks.js +4 -4
- package/dist/webview/render-fgca.d.ts +6 -0
- package/dist/webview/render-fgca.js +2 -2
- package/dist/webview/render-goals.d.ts +5 -0
- package/dist/webview/render-goals.js +9 -2
- package/dist/webview/render-process-blueprint.d.ts +6 -0
- package/dist/webview/render-process-blueprint.js +2 -2
- package/dist/webview/render-products.js +1 -0
- package/dist/yaml-normalize.d.ts +3 -1
- package/dist/yaml-normalize.js +11 -3
- package/package.json +1 -1
- package/src/compliance/catalogue.ts +49 -0
- package/src/compliance/index.ts +5 -2
- package/src/compliance/requirement-chain.ts +52 -27
- package/src/products/types.ts +1 -1
- package/src/products/validate.ts +1 -1
- package/src/standalone/validate.ts +38 -2
- package/src/webview/render-activities.ts +8 -2
- package/src/webview/render-activity-card.ts +8 -3
- package/src/webview/render-blocks.ts +14 -4
- package/src/webview/render-fgca.ts +8 -2
- package/src/webview/render-goals.ts +21 -2
- package/src/webview/render-process-blueprint.ts +8 -3
- package/src/webview/render-products.ts +1 -0
- package/src/yaml-normalize.ts +12 -3
|
@@ -8,6 +8,11 @@ export interface RenderGoalsOptions {
|
|
|
8
8
|
entryCurvature?: number;
|
|
9
9
|
edgeStyle?: EdgeStyle;
|
|
10
10
|
nodeSizePreset?: NodeSizePreset;
|
|
11
|
+
/**
|
|
12
|
+
* Theme CSS embedded via {@link renderGoalsLayoutSvg}.
|
|
13
|
+
* Defaults to `'transitrix'` for self-contained host-neutral SVG.
|
|
14
|
+
*/
|
|
15
|
+
embedCssTheme?: ThemeId;
|
|
11
16
|
}
|
|
12
17
|
/**
|
|
13
18
|
* Host-neutral goals renderer (IntelliJ/UI). Lays the tree out with the default
|
|
@@ -27,7 +27,7 @@ const PAD = 24;
|
|
|
27
27
|
* with the shared theme CSS embedded so the output is self-contained.
|
|
28
28
|
*/
|
|
29
29
|
export function renderGoalsSvg(tree, options = {}) {
|
|
30
|
-
const { treeName = '', curvature = DEFAULT_EDGE_CURVATURE, entryCurvature, edgeStyle, nodeSizePreset = 'normal' } = options;
|
|
30
|
+
const { treeName = '', curvature = DEFAULT_EDGE_CURVATURE, entryCurvature, edgeStyle, nodeSizePreset = 'normal', embedCssTheme = 'transitrix', } = options;
|
|
31
31
|
const nodeSize = resolveGoalsNodeSize(parseNodeSizePreset(nodeSizePreset));
|
|
32
32
|
const layout = layoutGoalTree(tree, {
|
|
33
33
|
nodeWidth: nodeSize.width,
|
|
@@ -42,7 +42,14 @@ export function renderGoalsSvg(tree, options = {}) {
|
|
|
42
42
|
? `<text class="text-header" x="${PAD}" y="${PAD - 6}">${escXml(`Goal tree — ${treeName}`)}</text>`
|
|
43
43
|
: '';
|
|
44
44
|
// Reserve a separate header row; the theme centers text on its y coordinate.
|
|
45
|
-
return renderGoalsLayoutSvg(layout, {
|
|
45
|
+
return renderGoalsLayoutSvg(layout, {
|
|
46
|
+
curvature,
|
|
47
|
+
entryCurvature,
|
|
48
|
+
edgeStyle,
|
|
49
|
+
title,
|
|
50
|
+
topInset: title ? PAD : 0,
|
|
51
|
+
embedCssTheme,
|
|
52
|
+
});
|
|
46
53
|
}
|
|
47
54
|
/**
|
|
48
55
|
* The single goals SVG emitter shared by every host. Takes an already-computed
|
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
import type { ProcessBlueprintFile, ProcessBlueprintLayout, ProcessBlueprintLayoutOptions } from '../process-blueprint/types.js';
|
|
2
2
|
import { type NodeSizePreset } from '../node-size-presets.js';
|
|
3
|
+
import { type ThemeId } from '../theme/index.js';
|
|
3
4
|
export declare function renderProcessBlueprintBody(layout: ProcessBlueprintLayout, ox: number, oy: number, clipId?: string): string;
|
|
4
5
|
export interface RenderProcessBlueprintOptions {
|
|
5
6
|
title?: string;
|
|
6
7
|
nodeSizePreset?: NodeSizePreset;
|
|
7
8
|
layoutOptions?: ProcessBlueprintLayoutOptions;
|
|
9
|
+
/**
|
|
10
|
+
* Theme CSS embedded as `<style>` so the SVG is self-contained.
|
|
11
|
+
* Defaults to `'transitrix'`. VS Code live preview uses body emitters + webview CSS instead.
|
|
12
|
+
*/
|
|
13
|
+
embedCssTheme?: ThemeId;
|
|
8
14
|
}
|
|
9
15
|
export declare function renderProcessBlueprintSvg(doc: ProcessBlueprintFile, options?: RenderProcessBlueprintOptions): string;
|
|
@@ -127,7 +127,7 @@ export function renderProcessBlueprintBody(layout, ox, oy, clipId = 'bp-clip') {
|
|
|
127
127
|
return parts.join('\n');
|
|
128
128
|
}
|
|
129
129
|
export function renderProcessBlueprintSvg(doc, options = {}) {
|
|
130
|
-
const { title = '', nodeSizePreset = 'normal', layoutOptions } = options;
|
|
130
|
+
const { title = '', nodeSizePreset = 'normal', layoutOptions, embedCssTheme = 'transitrix' } = options;
|
|
131
131
|
const sizing = resolveProcessBlueprintSize(parseNodeSizePreset(nodeSizePreset));
|
|
132
132
|
const layout = layoutProcessBlueprint(doc, {
|
|
133
133
|
...sizing,
|
|
@@ -145,7 +145,7 @@ export function renderProcessBlueprintSvg(doc, options = {}) {
|
|
|
145
145
|
const titleSvg = title
|
|
146
146
|
? `<text class="text-header" x="${PAD}" y="${PAD - 6}">${escXml(title)}</text>`
|
|
147
147
|
: '';
|
|
148
|
-
const embedCss = generateSvgEmbedCss(
|
|
148
|
+
const embedCss = generateSvgEmbedCss(embedCssTheme) + BP_EMBED_CSS;
|
|
149
149
|
return `<svg xmlns="http://www.w3.org/2000/svg" width="${w}" height="${h}" viewBox="0 0 ${w} ${h}">
|
|
150
150
|
<style>${embedCss}</style>
|
|
151
151
|
${titleSvg}
|
package/dist/yaml-normalize.d.ts
CHANGED
|
@@ -15,6 +15,8 @@
|
|
|
15
15
|
* A bare `2026-06-01` parses to midnight UTC and round-trips to
|
|
16
16
|
* `"2026-06-01"` regardless of `process.env.TZ`.
|
|
17
17
|
*
|
|
18
|
-
* Walks in place and returns the same reference for convenience.
|
|
18
|
+
* Walks in place and returns the same reference for convenience. Shared
|
|
19
|
+
* object graphs from YAML aliases (and cycles) are visited once via WeakSet
|
|
20
|
+
* so diamond / recursive anchors cannot amplify the walk into a hang.
|
|
19
21
|
*/
|
|
20
22
|
export declare function coerceDatesToIsoStrings<T>(value: T): T;
|
package/dist/yaml-normalize.js
CHANGED
|
@@ -15,9 +15,14 @@
|
|
|
15
15
|
* A bare `2026-06-01` parses to midnight UTC and round-trips to
|
|
16
16
|
* `"2026-06-01"` regardless of `process.env.TZ`.
|
|
17
17
|
*
|
|
18
|
-
* Walks in place and returns the same reference for convenience.
|
|
18
|
+
* Walks in place and returns the same reference for convenience. Shared
|
|
19
|
+
* object graphs from YAML aliases (and cycles) are visited once via WeakSet
|
|
20
|
+
* so diamond / recursive anchors cannot amplify the walk into a hang.
|
|
19
21
|
*/
|
|
20
22
|
export function coerceDatesToIsoStrings(value) {
|
|
23
|
+
return walk(value, new WeakSet());
|
|
24
|
+
}
|
|
25
|
+
function walk(value, seen) {
|
|
21
26
|
if (value === null || value === undefined)
|
|
22
27
|
return value;
|
|
23
28
|
if (value instanceof Date) {
|
|
@@ -25,6 +30,9 @@ export function coerceDatesToIsoStrings(value) {
|
|
|
25
30
|
}
|
|
26
31
|
if (typeof value !== 'object')
|
|
27
32
|
return value;
|
|
33
|
+
if (seen.has(value))
|
|
34
|
+
return value;
|
|
35
|
+
seen.add(value);
|
|
28
36
|
if (Array.isArray(value)) {
|
|
29
37
|
for (let i = 0; i < value.length; i++) {
|
|
30
38
|
const v = value[i];
|
|
@@ -32,7 +40,7 @@ export function coerceDatesToIsoStrings(value) {
|
|
|
32
40
|
value[i] = dateToIsoYmd(v);
|
|
33
41
|
}
|
|
34
42
|
else if (v !== null && typeof v === 'object') {
|
|
35
|
-
|
|
43
|
+
walk(v, seen);
|
|
36
44
|
}
|
|
37
45
|
}
|
|
38
46
|
return value;
|
|
@@ -44,7 +52,7 @@ export function coerceDatesToIsoStrings(value) {
|
|
|
44
52
|
obj[key] = dateToIsoYmd(v);
|
|
45
53
|
}
|
|
46
54
|
else if (v !== null && typeof v === 'object') {
|
|
47
|
-
|
|
55
|
+
walk(v, seen);
|
|
48
56
|
}
|
|
49
57
|
}
|
|
50
58
|
return value;
|
package/package.json
CHANGED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { emptyCanon, ingestComplianceDoc } from './classify.js';
|
|
2
|
+
|
|
3
|
+
/** Relative POSIX paths keep scanning policy and content identity independent of host APIs. */
|
|
4
|
+
export interface RequirementCatalogueIO {
|
|
5
|
+
read(path: string): Promise<string>;
|
|
6
|
+
list(path: string): Promise<Array<{ name: string; kind: 'file' | 'directory' | 'symlink' | 'other' }>>;
|
|
7
|
+
missing(error: unknown): boolean;
|
|
8
|
+
parse(content: string): unknown;
|
|
9
|
+
digest(content: string): string;
|
|
10
|
+
sourcePath?(path: string): string;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/** Shared disk/editor policy: one manifest boundary, all three zones, lossless failures. */
|
|
14
|
+
export async function scanRequirementCatalogue(io: RequirementCatalogueIO) {
|
|
15
|
+
const canon = emptyCanon();
|
|
16
|
+
const transcript: unknown[] = [];
|
|
17
|
+
const manifest = await io.read('transitrix.yaml');
|
|
18
|
+
const parsed = io.parse(manifest);
|
|
19
|
+
if (!parsed || typeof parsed !== 'object' || Array.isArray(parsed)) throw new Error('Invalid transitrix.yaml manifest: expected a mapping');
|
|
20
|
+
transcript.push(['transitrix.yaml', manifest]);
|
|
21
|
+
const fail = (path: string, message: string) => {
|
|
22
|
+
transcript.push(['failure', path, message]);
|
|
23
|
+
canon.findings.push({ id: `${path}:load`, owner: path, field: '', code: 'LOAD', message, reference: false, severity: 'error' });
|
|
24
|
+
};
|
|
25
|
+
const walk = async (dir: string, top = false): Promise<void> => {
|
|
26
|
+
let entries: Awaited<ReturnType<RequirementCatalogueIO['list']>>;
|
|
27
|
+
try { entries = await io.list(dir); }
|
|
28
|
+
catch (error) {
|
|
29
|
+
if (top && io.missing(error)) { transcript.push(['absent-zone', dir]); return; }
|
|
30
|
+
fail(dir, 'Directory could not be enumerated'); return;
|
|
31
|
+
}
|
|
32
|
+
if (!top && entries.some(e => e.name === 'transitrix.yaml')) { transcript.push(['catalogue-boundary', dir]); return; }
|
|
33
|
+
for (const { name, kind } of entries.sort((a, b) => a.name < b.name ? -1 : a.name > b.name ? 1 : 0)) {
|
|
34
|
+
const path = `${dir}/${name}`;
|
|
35
|
+
if (kind === 'symlink') { fail(path, 'Symbolic link was not enumerated'); continue; }
|
|
36
|
+
if (kind === 'directory') { await walk(path); continue; }
|
|
37
|
+
if (!/\.ya?ml$/i.test(name)) continue;
|
|
38
|
+
if (kind !== 'file') { fail(path, 'Unsupported file type'); continue; }
|
|
39
|
+
let content: string;
|
|
40
|
+
try { content = await io.read(path); }
|
|
41
|
+
catch { fail(path, 'Unreadable YAML record'); continue; }
|
|
42
|
+
transcript.push([path, content]);
|
|
43
|
+
try { ingestComplianceDoc(canon, io.parse(content), io.sourcePath?.(path) ?? path); }
|
|
44
|
+
catch { fail(path, 'Malformed YAML record'); }
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
for (const zone of ['canon', 'codex', 'field']) await walk(zone, true);
|
|
48
|
+
return { canon, snapshotId: `sha256:${io.digest(JSON.stringify(transcript))}` };
|
|
49
|
+
}
|
package/src/compliance/index.ts
CHANGED
|
@@ -76,6 +76,9 @@ export type {
|
|
|
76
76
|
TraceElementRef,
|
|
77
77
|
TraceSourceRef,
|
|
78
78
|
} from './types.js';
|
|
79
|
-
export { buildRequirementChain, requirementReleaseCounts, selectRequirementChain, RequirementChainSnapshot, CHAIN_STAGES, chainDate } from './requirement-chain.js';
|
|
80
|
-
export type { ChainInput, ChainScope, ChainSet, RequirementChainNode, RequirementChainEdge, RequirementChainProjection } from './requirement-chain.js';
|
|
79
|
+
export { buildSubjectRequirementChain, buildRequirementChain, requirementReleaseCounts, selectRequirementChain, RequirementChainSnapshot, CHAIN_STAGES, chainDate } from './requirement-chain.js';
|
|
80
|
+
export type { ChainSubject, ChainInput, ChainScope, ChainSet, RequirementChainNode, RequirementChainEdge, RequirementChainProjection } from './requirement-chain.js';
|
|
81
81
|
export type { ChainRecord, ChainFinding } from './types.js';
|
|
82
|
+
|
|
83
|
+
export { scanRequirementCatalogue } from './catalogue.js';
|
|
84
|
+
export type { RequirementCatalogueIO } from './catalogue.js';
|
|
@@ -7,7 +7,8 @@ import { validateVerification } from '../verification/validate.js';
|
|
|
7
7
|
|
|
8
8
|
export const CHAIN_STAGES = ['Source document', 'Driver', 'Need', 'Stakeholder requirement',
|
|
9
9
|
'System requirement', 'Software requirement', 'Unclassified requirement', 'Verification definition', 'Result'] as const;
|
|
10
|
-
export interface
|
|
10
|
+
export interface ChainSubject { type: 'PRODUCT' | 'APPLICATION'; id: string }
|
|
11
|
+
export interface ChainScope { catalogue: string; subject?: ChainSubject; product?: string; release?: string; project?: string }
|
|
11
12
|
export interface ChainInput {
|
|
12
13
|
index: ComplianceIndex; scope: ChainScope; asAt: string; snapshotId: string;
|
|
13
14
|
sourceRevision?: string; complete: boolean;
|
|
@@ -23,7 +24,7 @@ export interface RequirementChainEdge {
|
|
|
23
24
|
}
|
|
24
25
|
export interface ChainAssignment { requirement: string; nearest: string; depth: number; relations: string[] }
|
|
25
26
|
export interface RequirementChainProjection {
|
|
26
|
-
contract: 'requirement-chain/0.2'; contractRevision: string; asAt: string; snapshotId: string; sourceRevision?: string;
|
|
27
|
+
contract: 'requirement-chain/0.2' | 'requirement-chain/0.3'; contractRevision: string; asAt: string; snapshotId: string; sourceRevision?: string;
|
|
27
28
|
scope: ChainScope; completeness: 'complete' | 'incomplete'; scopeFindings: string[];
|
|
28
29
|
populations: { product: ChainSet; release: ChainSet; selected: ChainSet; inactive: ChainSet; unresolved: ChainSet };
|
|
29
30
|
assignments: { here: ChainSet; otherReleaseOnly: ChainSet; unassigned: ChainSet; invalid: ChainSet; provenance: ChainAssignment[] };
|
|
@@ -53,9 +54,26 @@ function freeze<T>(value: T): T {
|
|
|
53
54
|
const CODEX = ['LAW', 'REGULATION', 'STANDARD', 'POLICY', 'INTERNAL_STANDARD', 'PRINCIPLE'];
|
|
54
55
|
const FIELD = ['INTERVIEW', 'SURVEY', 'OBSERVATION', 'DRAFT'];
|
|
55
56
|
|
|
56
|
-
/**
|
|
57
|
+
/** Explicit PRODUCT compatibility adapter for requirement-chain/0.2. */
|
|
57
58
|
export function buildRequirementChain(input: ChainInput): RequirementChainProjection {
|
|
59
|
+
if (input.scope.subject) throw new Error('Use buildSubjectRequirementChain for explicit subjects');
|
|
60
|
+
return projectRequirementChain(input);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/** Subject-aware 0.3 entry point; both versions use the same deterministic projection. */
|
|
64
|
+
export function buildSubjectRequirementChain(input: ChainInput & { scope: ChainScope & { subject: ChainSubject } }): RequirementChainProjection {
|
|
65
|
+
if (input.scope.product !== undefined) throw new Error('Conflicting product and subject selectors');
|
|
66
|
+
if (!['PRODUCT', 'APPLICATION'].includes(input.scope.subject.type)) throw new Error('Unsupported subject type');
|
|
67
|
+
return projectRequirementChain(input);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/** Pure, lossless release projection; no legacy coverage verdict is reinterpreted. */
|
|
71
|
+
function projectRequirementChain(input: ChainInput): RequirementChainProjection {
|
|
58
72
|
const { index, asAt, scope } = input;
|
|
73
|
+
const subject = scope.subject ?? { type: 'PRODUCT', id: scope.product };
|
|
74
|
+
const membershipKind = subject.type === 'APPLICATION' ? 'application_scope' : 'product_scope';
|
|
75
|
+
const pairKind = subject.type === 'APPLICATION' ? 'project_application' : 'project_product';
|
|
76
|
+
const subjectWord = scope.subject ? 'subject' : 'product';
|
|
59
77
|
const findings = structuredClone(index.findings);
|
|
60
78
|
const scopeFindings: string[] = [];
|
|
61
79
|
const records = new Map<string, ChainRecord>();
|
|
@@ -64,7 +82,7 @@ export function buildRequirementChain(input: ChainInput): RequirementChainProjec
|
|
|
64
82
|
const id = `${owner}.${field}`;
|
|
65
83
|
if (!findings.some(f => f.id === id && f.code === code)) findings.push({ id, owner, field, code, message, reference, severity: warning ? 'warning' : 'error' });
|
|
66
84
|
};
|
|
67
|
-
for (const [id, versions] of index.recordsById) {
|
|
85
|
+
for (const [id, versions] of [...index.recordsById].sort(([a], [b]) => a.localeCompare(b))) {
|
|
68
86
|
if (versions.length !== 1) {
|
|
69
87
|
finding(id, 'id', 'DUPLICATE', 'Ambiguous catalogue identity'); complete = false;
|
|
70
88
|
} else records.set(id, structuredClone(versions[0]));
|
|
@@ -114,7 +132,7 @@ export function buildRequirementChain(input: ChainInput): RequirementChainProjec
|
|
|
114
132
|
if (r.raw.level !== undefined && level < 0) finding(r.id, 'level', 'REQ-LEVEL', 'Invalid level; displayed as unclassified');
|
|
115
133
|
} else if (r.type === 'NEED') node(r, 2);
|
|
116
134
|
else if (r.type === 'DRIVER') node(r, 1);
|
|
117
|
-
else if (['PRODUCT', 'RELEASE', 'ACTION'].includes(r.type)) node(r, -1);
|
|
135
|
+
else if (['PRODUCT', 'APPLICATION', 'RELEASE', 'ACTION'].includes(r.type)) node(r, -1);
|
|
118
136
|
else if (CODEX.includes(r.type) || FIELD.includes(r.type)) {
|
|
119
137
|
node(r, 0);
|
|
120
138
|
if (r.raw.source_document !== undefined) {
|
|
@@ -162,6 +180,8 @@ export function buildRequirementChain(input: ChainInput): RequirementChainProjec
|
|
|
162
180
|
const src = records.get(from), dst = records.get(to);
|
|
163
181
|
const endpoints = kind === 'requirement_parent' ? is(from, 'REQUIREMENT') && is(to, 'REQUIREMENT') :
|
|
164
182
|
kind === 'serves' ? is(from, 'REQUIREMENT') && is(to, 'NEED') :
|
|
183
|
+
kind === 'application_scope' ? is(from, 'REQUIREMENT') && is(to, 'APPLICATION') :
|
|
184
|
+
kind === 'project_application' ? isProject(from) && is(to, 'APPLICATION') :
|
|
165
185
|
kind === 'product_scope' ? is(from, 'REQUIREMENT') && is(to, 'PRODUCT') :
|
|
166
186
|
kind === 'project_scope' ? is(from, 'REQUIREMENT') && isProject(to) :
|
|
167
187
|
kind === 'project_product' ? isProject(from) && is(to, 'PRODUCT') :
|
|
@@ -198,38 +218,38 @@ export function buildRequirementChain(input: ChainInput): RequirementChainProjec
|
|
|
198
218
|
}
|
|
199
219
|
}
|
|
200
220
|
const memberships = (id: string, kind: string) => rels.filter(r => usable.has(r.id) && r.raw.type === kind && r.raw.from === id).map(r => String(r.raw.to));
|
|
201
|
-
const unresolved = requirements.filter(r => active.get(r.id) && memberships(r.id, 'product_scope').length === 0).map(r => r.id);
|
|
202
|
-
const P = requirements.filter(r => active.get(r.id) && memberships(r.id,
|
|
221
|
+
const unresolved = requirements.filter(r => active.get(r.id) && memberships(r.id, 'product_scope').length === 0 && (!scope.subject || memberships(r.id, 'application_scope').length === 0)).map(r => r.id);
|
|
222
|
+
const P = requirements.filter(r => active.get(r.id) && memberships(r.id, membershipKind).includes(subject.id ?? '')).map(r => r.id);
|
|
203
223
|
let productComplete = complete && unresolved.length === 0;
|
|
204
|
-
if (unresolved.length) scopeFindings.push(
|
|
205
|
-
if (requirements.some(r => !envelope.get(r.id)) || rels.some(r => r.raw.type ===
|
|
224
|
+
if (unresolved.length) scopeFindings.push(`Unresolved ${subjectWord} membership`);
|
|
225
|
+
if (requirements.some(r => !envelope.get(r.id)) || rels.some(r => r.raw.type === membershipKind && active.get(r.id) && !usable.has(r.id))) productComplete = false;
|
|
206
226
|
const invalidAssignments = new Set<string>();
|
|
207
227
|
for (const r of rels.filter(r => r.raw.type === 'required_for')) {
|
|
208
228
|
const from = String(r.raw.from), to = records.get(String(r.raw.to));
|
|
209
229
|
const historical = chainDate(r.raw.valid_to) && r.raw.valid_to < asAt;
|
|
210
230
|
const future = chainDate(r.raw.valid_from) && r.raw.valid_from > asAt;
|
|
211
|
-
if (!historical && !future && (!usable.has(r.id) || !memberships(from, 'product_scope').includes(String(to?.raw.of)))) {
|
|
231
|
+
if (!historical && !future && (!usable.has(r.id) || ![...memberships(from, 'product_scope'), ...(scope.subject ? memberships(from, 'application_scope') : [])].includes(String(to?.raw.of)))) {
|
|
212
232
|
invalidAssignments.add(from);
|
|
213
|
-
finding(r.id, 'to', 'ASSIGNMENT',
|
|
233
|
+
finding(r.id, 'to', 'ASSIGNMENT', `Invalid, dangling or wrong-${subjectWord} assignment`, true);
|
|
214
234
|
if (!envelope.get(r.id)) productComplete = false;
|
|
215
235
|
}
|
|
216
236
|
}
|
|
217
237
|
let selectedComplete = complete;
|
|
218
|
-
if (!is(
|
|
219
|
-
if (!is(scope.release, 'RELEASE') || records.get(scope.release ?? '')?.raw.of !==
|
|
220
|
-
selectedComplete = false; scopeFindings.push(
|
|
238
|
+
if (!is(subject.id, subject.type)) { productComplete = false; selectedComplete = false; scopeFindings.push(scope.subject ? 'Subject unselected or unresolved' : 'Product unselected or unresolved'); }
|
|
239
|
+
if (!is(scope.release, 'RELEASE') || records.get(scope.release ?? '')?.raw.of !== subject.id) {
|
|
240
|
+
selectedComplete = false; scopeFindings.push(`Release unselected, unresolved or wrong ${subjectWord}`);
|
|
221
241
|
}
|
|
222
|
-
if (scope.project && (!isProject(scope.project) || !memberships(scope.project,
|
|
223
|
-
selectedComplete = false; scopeFindings.push(
|
|
242
|
+
if (scope.project && (!isProject(scope.project) || !memberships(scope.project, pairKind).includes(subject.id ?? ''))) {
|
|
243
|
+
selectedComplete = false; scopeFindings.push(`Invalid or unmodelled project/${subjectWord} pair`);
|
|
224
244
|
}
|
|
225
245
|
function query(release: string): { ids: string[]; provenance: ChainAssignment[]; complete: boolean } {
|
|
226
246
|
const chain: string[] = []; let cursor: string | undefined = release; let valid = true;
|
|
227
247
|
while (cursor) {
|
|
228
248
|
const r: ChainRecord | undefined = records.get(cursor);
|
|
229
|
-
if (chain.includes(cursor) || !is(cursor, 'RELEASE') || r?.raw.of !==
|
|
249
|
+
if (chain.includes(cursor) || !is(cursor, 'RELEASE') || r?.raw.of !== subject.id) {
|
|
230
250
|
valid = false;
|
|
231
251
|
finding(chain[chain.length - 1] ?? release, 'predecessor', 'RELEASE-SCOPE',
|
|
232
|
-
chain.includes(cursor) ? 'Release predecessor cycle' :
|
|
252
|
+
chain.includes(cursor) ? 'Release predecessor cycle' : `Missing, invalid or cross-${subjectWord} predecessor`);
|
|
233
253
|
break;
|
|
234
254
|
}
|
|
235
255
|
chain.push(cursor);
|
|
@@ -251,13 +271,13 @@ export function buildRequirementChain(input: ChainInput): RequirementChainProjec
|
|
|
251
271
|
if (scope.project && L.some(id => memberships(id, 'project_scope').length === 0 || rels.some(r => r.raw.type === 'project_scope' && r.raw.from === id && active.get(r.id) && !usable.has(r.id)))) {
|
|
252
272
|
selectedComplete = false; scopeFindings.push('Unresolved project membership');
|
|
253
273
|
}
|
|
254
|
-
if (rels.some(r => [
|
|
255
|
-
if (scope.project && L.some(id => memberships(id, 'project_scope').some(project => !memberships(project,
|
|
256
|
-
selectedComplete = false; scopeFindings.push(
|
|
274
|
+
if (rels.some(r => [membershipKind, 'project_scope', 'required_for'].includes(String(r.raw.type)) && !envelope.get(r.id))) selectedComplete = false;
|
|
275
|
+
if (scope.project && L.some(id => memberships(id, 'project_scope').some(project => !memberships(project, pairKind).includes(subject.id ?? '')))) {
|
|
276
|
+
selectedComplete = false; scopeFindings.push(`Inconsistent project/${subjectWord} membership`);
|
|
257
277
|
}
|
|
258
278
|
const S = L.filter(id => !scope.project || memberships(id, 'project_scope').includes(scope.project));
|
|
259
279
|
const elsewhere = new Set<string>();
|
|
260
|
-
for (const release of records.values()) if (release.type === 'RELEASE' && release.raw.of ===
|
|
280
|
+
for (const release of records.values()) if (release.type === 'RELEASE' && release.raw.of === subject.id) {
|
|
261
281
|
const q = query(release.id); productComplete &&= q.complete; q.ids.forEach(id => elsewhere.add(id));
|
|
262
282
|
}
|
|
263
283
|
const unassigned = P.filter(id => !elsewhere.has(id) && !invalidAssignments.has(id));
|
|
@@ -307,7 +327,7 @@ export function buildRequirementChain(input: ChainInput): RequirementChainProjec
|
|
|
307
327
|
const owners = new Set(ancestors);
|
|
308
328
|
for (const v of verifications) if (v.raw.verifies === r.id) owners.add(v.id);
|
|
309
329
|
for (const rel of rels) {
|
|
310
|
-
const ownScope = [
|
|
330
|
+
const ownScope = [membershipKind, 'project_scope', 'required_for'].includes(String(rel.raw.type));
|
|
311
331
|
if (ownScope ? rel.raw.from === r.id : owners.has(String(rel.raw.from))) owners.add(rel.id);
|
|
312
332
|
}
|
|
313
333
|
for (const f of findings) if (owners.has(f.owner)) (affectedRequirements[f.id] ??= []).push(r.id);
|
|
@@ -326,15 +346,16 @@ export function buildRequirementChain(input: ChainInput): RequirementChainProjec
|
|
|
326
346
|
const selectedRefs = refs.filter(f => affectedRequirements[f.id]?.some(id => S.includes(id)));
|
|
327
347
|
const broken = S.filter(id => selectedRefs.some(f => affectedRequirements[f.id]?.includes(id)));
|
|
328
348
|
for (const n of nodes) if (records.get(n.recordId)?.type === 'REQUIREMENT' && !S.includes(n.recordId)) {
|
|
329
|
-
n.context.push(!active.get(n.recordId) ? 'inactive' : !P.includes(n.recordId) ?
|
|
349
|
+
n.context.push(!active.get(n.recordId) ? 'inactive' : !P.includes(n.recordId) ? `unresolved or other ${subjectWord}` :
|
|
330
350
|
!L.includes(n.recordId) ? 'other release or unassigned' : 'other project');
|
|
331
351
|
}
|
|
352
|
+
if (scope.subject && (!is(subject.id, subject.type) || !is(scope.release, 'RELEASE') || records.get(scope.release ?? '')?.raw.of !== subject.id)) productComplete = false;
|
|
332
353
|
const unassignedSet = set(unassigned, productComplete);
|
|
333
354
|
const result: RequirementChainProjection = {
|
|
334
|
-
contract: 'requirement-chain/0.2', contractRevision: '97c9d41819011ead8fe192c266cba32707eae82f', asAt, snapshotId: input.snapshotId, sourceRevision: input.sourceRevision,
|
|
355
|
+
contract: scope.subject ? 'requirement-chain/0.3' : 'requirement-chain/0.2', contractRevision: scope.subject ? 'a131b1862d86f34be8feb729e1cc6ebc994c3891' : '97c9d41819011ead8fe192c266cba32707eae82f', asAt, snapshotId: input.snapshotId, sourceRevision: input.sourceRevision,
|
|
335
356
|
scope: structuredClone(scope), completeness: productComplete && selectedComplete ? 'complete' : 'incomplete', scopeFindings: sorted(scopeFindings),
|
|
336
357
|
populations: { product: set(P, productComplete), release: set(L, selectedComplete), selected: set(S, selectedComplete),
|
|
337
|
-
inactive: set(requirements.filter(r => envelope.get(r.id) && !active.get(r.id) && rels.some(rel => rel.raw.type ===
|
|
358
|
+
inactive: set(requirements.filter(r => envelope.get(r.id) && !active.get(r.id) && rels.some(rel => rel.raw.type === membershipKind && rel.raw.from === r.id && rel.raw.to === subject.id && envelope.get(rel.id))).map(r => r.id), complete),
|
|
338
359
|
unresolved: set(unresolved, complete) },
|
|
339
360
|
assignments: { here: set(L, selectedComplete), otherReleaseOnly: set(P.filter(id => elsewhere.has(id) && !L.includes(id)), productComplete),
|
|
340
361
|
unassigned: unassignedSet, invalid: set(P.filter(id => invalidAssignments.has(id)), complete), provenance: selected.provenance.sort((a, b) => a.requirement.localeCompare(b.requirement)) },
|
|
@@ -408,6 +429,7 @@ export function requirementReleaseCounts(p: RequirementChainProjection) {
|
|
|
408
429
|
const contextUnits = { 0: 'source documents', 1: 'drivers', 2: 'needs', 7: 'definition parts', 8: 'result parts' } as const;
|
|
409
430
|
for (const stage of [0, 1, 2, 7, 8] as const) add('context-' + stage, CHAIN_STAGES[stage],
|
|
410
431
|
set(view.nodes.filter(n => n.stage === stage).map(n => n.id), p.populations.selected.completeness === 'complete'), contextUnits[stage]);
|
|
432
|
+
if (p.scope.subject) for (const count of Object.values(counts)) count.label = count.label.replace(/whole product/g, 'whole subject').replace('Product requirements', 'Subject requirements');
|
|
411
433
|
return freeze(counts);
|
|
412
434
|
}
|
|
413
435
|
|
|
@@ -421,7 +443,10 @@ export class RequirementChainSnapshot {
|
|
|
421
443
|
try {
|
|
422
444
|
const input = await load();
|
|
423
445
|
if (generation !== this.generation) return false;
|
|
424
|
-
this.current =
|
|
446
|
+
this.current = input.scope.subject
|
|
447
|
+
? buildSubjectRequirementChain({ ...input, scope: { ...input.scope, subject: input.scope.subject } })
|
|
448
|
+
: buildRequirementChain(input);
|
|
449
|
+
this.stale = false; return true;
|
|
425
450
|
} catch {
|
|
426
451
|
if (generation === this.generation) this.stale = true;
|
|
427
452
|
return false;
|
package/src/products/types.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type ProductType = 'digital_product' | 'service' | 'platform' | 'bundle';
|
|
1
|
+
export type ProductType = 'physical_product' | 'digital_product' | 'service' | 'platform' | 'bundle';
|
|
2
2
|
export type ProductStatus = 'Draft' | 'Active' | 'Deprecated';
|
|
3
3
|
|
|
4
4
|
export interface Product {
|
package/src/products/validate.ts
CHANGED
|
@@ -4,7 +4,7 @@ import type { ValidationError, ValidationWarning, ValidationResult } from '../va
|
|
|
4
4
|
|
|
5
5
|
export type { ValidationError, ValidationWarning, ValidationResult };
|
|
6
6
|
|
|
7
|
-
const VALID_TYPES = new Set<ProductType>(['digital_product', 'service', 'platform', 'bundle']);
|
|
7
|
+
const VALID_TYPES = new Set<ProductType>(['physical_product', 'digital_product', 'service', 'platform', 'bundle']);
|
|
8
8
|
const VALID_STATUSES = new Set<ProductStatus>(['Draft', 'Active', 'Deprecated']);
|
|
9
9
|
const DATE_RE = /^\d{4}-\d{2}-\d{2}$/;
|
|
10
10
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Standalone forms from ELEMENT_PRIMITIVES and CONTRACT (Methodology 7).
|
|
2
2
|
// Field payloads are opaque: only their published identity/admission contract is checked.
|
|
3
|
-
import { isCanonicalIdOfType, typeOfId, type CanonCatalog } from '../typed-id.js';
|
|
3
|
+
import { isCanonicalId, isCanonicalIdOfType, typeOfId, type CanonCatalog } from '../typed-id.js';
|
|
4
4
|
import type { ValidationResult } from '../validation-types.js';
|
|
5
5
|
|
|
6
6
|
export const mapping = (v: unknown): v is Record<string, unknown> => !!v && typeof v === 'object' && !Array.isArray(v);
|
|
@@ -45,10 +45,46 @@ export function validateStandalone(notation: string, input: unknown, options: St
|
|
|
45
45
|
};
|
|
46
46
|
optionalText('description');
|
|
47
47
|
if (notation === 'product') {
|
|
48
|
-
if (!['digital_product','service','platform','bundle'].includes(d.type as string)) fail('type', 'digital_product|service|platform|bundle', d.type);
|
|
48
|
+
if (!['physical_product', 'digital_product','service','platform','bundle'].includes(d.type as string)) fail('type', 'physical_product|digital_product|service|platform|bundle', d.type);
|
|
49
49
|
optionalText('domain'); reference('owner_role', ['ROLE']);
|
|
50
50
|
if ('maturity' in d && !(Number.isInteger(d.maturity) && Number(d.maturity) >= 1 && Number(d.maturity) <= 5)) fail('maturity', 'integer 1..5', d.maturity);
|
|
51
51
|
references('capabilities', ['CAPABILITY']); references('processes', ['PROCESS']); references('supporting_apps', ['APPLICATION']);
|
|
52
|
+
} else if (notation === 'process') {
|
|
53
|
+
reference('owner_role', ['ROLE']); reference('capability', ['CAPABILITY']);
|
|
54
|
+
references('participants', ['ROLE', 'ACTOR']);
|
|
55
|
+
optionalText('goal'); optionalText('result');
|
|
56
|
+
for (const key of ['parent', 'bpmn_file', 'maturity']) if (key in d) fail(key, 'absent inline; use canonical relations, flow or history', d[key]);
|
|
57
|
+
if (Array.isArray(d.participants) && new Set(d.participants).size !== d.participants.length) fail('participants', 'unique references', d.participants);
|
|
58
|
+
if ('flow' in d) {
|
|
59
|
+
if (!mapping(d.flow)) fail('flow', 'mapping', d.flow);
|
|
60
|
+
else {
|
|
61
|
+
const flow = d.flow;
|
|
62
|
+
const steps = Array.isArray(flow.steps) ? flow.steps : [];
|
|
63
|
+
const sequence = Array.isArray(flow.sequence) ? flow.sequence : [];
|
|
64
|
+
if (!Array.isArray(flow.steps) || !steps.length) fail('flow.steps', 'nonempty list', flow.steps);
|
|
65
|
+
if (!Array.isArray(flow.sequence)) fail('flow.sequence', 'list', flow.sequence);
|
|
66
|
+
const ids = new Set<string>();
|
|
67
|
+
const types = ['startEvent', 'endEvent', 'task', 'userTask', 'serviceTask', 'exclusiveGateway', 'parallelGateway'];
|
|
68
|
+
steps.forEach((step, i) => {
|
|
69
|
+
const key = `flow.steps[${i}]`;
|
|
70
|
+
if (!mapping(step)) { fail(key, 'mapping', step); return; }
|
|
71
|
+
if (!isCanonicalId(step.id) || ids.has(step.id)) fail(`${key}.id`, 'unique canonical step ID', step.id);
|
|
72
|
+
else ids.add(step.id);
|
|
73
|
+
if (!types.includes(step.type as string)) fail(`${key}.type`, types.join('|'), step.type);
|
|
74
|
+
if ((!['startEvent','endEvent'].includes(step.type as string) || 'name' in step) && !text(step.name)) fail(`${key}.name`, 'nonempty string', step.name);
|
|
75
|
+
ref(`${key}.performed_by`, step.performed_by, ['ROLE','ACTOR']);
|
|
76
|
+
if (!Array.isArray(d.participants) || !d.participants.includes(step.performed_by)) fail(`${key}.performed_by`, 'member of participants', step.performed_by);
|
|
77
|
+
if ('supported_by_application' in step) ref(`${key}.supported_by_application`, step.supported_by_application, ['APPLICATION']);
|
|
78
|
+
});
|
|
79
|
+
sequence.forEach((edge, i) => {
|
|
80
|
+
const key = `flow.sequence[${i}]`;
|
|
81
|
+
if (!mapping(edge)) { fail(key, 'mapping', edge); return; }
|
|
82
|
+
for (const end of ['from', 'to']) if (typeof edge[end] !== 'string' || !ids.has(edge[end] as string)) fail(`${key}.${end}`, 'ID in flow.steps', edge[end]);
|
|
83
|
+
if ('condition' in edge && !text(edge.condition)) fail(`${key}.condition`, 'nonempty string', edge.condition);
|
|
84
|
+
if ('default' in edge && typeof edge.default !== 'boolean') fail(`${key}.default`, 'boolean', edge.default);
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
}
|
|
52
88
|
} else if (notation === 'capability') {
|
|
53
89
|
if (!['domain','supporting'].includes(d.type as string)) fail('type', 'domain|supporting', d.type);
|
|
54
90
|
for (const key of ['current_maturity','target_maturity','owner_role','target_date']) if (key in d) fail(key, 'attribute in history sidecar, absent inline', d[key], 'VERSIONED-004');
|
|
@@ -26,7 +26,7 @@ import type {
|
|
|
26
26
|
} from '../activities/types.js';
|
|
27
27
|
import { horizontalCubicEdgePath, bowedCubicEdgePath, DEFAULT_EDGE_CURVATURE } from '../edge-path.js';
|
|
28
28
|
import { parseNodeSizePreset, resolveActionNodeSize, type NodeSizePreset } from '../node-size-presets.js';
|
|
29
|
-
import { generateSvgEmbedCss } from '../theme/index.js';
|
|
29
|
+
import { generateSvgEmbedCss, type ThemeId } from '../theme/index.js';
|
|
30
30
|
import { emitCenteredTextSvg, layoutCenteredEntityText } from './entity-text-layout.js';
|
|
31
31
|
import { escXml } from './render-util.js';
|
|
32
32
|
|
|
@@ -235,6 +235,11 @@ export interface RenderActivitiesOptions {
|
|
|
235
235
|
* Action name in the view header.
|
|
236
236
|
*/
|
|
237
237
|
suppressProjectNodes?: boolean;
|
|
238
|
+
/**
|
|
239
|
+
* Theme CSS embedded as `<style>` so the SVG is self-contained.
|
|
240
|
+
* Defaults to `'transitrix'`. VS Code live preview uses body emitters + webview CSS instead.
|
|
241
|
+
*/
|
|
242
|
+
embedCssTheme?: ThemeId;
|
|
238
243
|
}
|
|
239
244
|
|
|
240
245
|
/**
|
|
@@ -259,6 +264,7 @@ export function renderActivitiesSvg(doc: ActivityDoc, options: RenderActivitiesO
|
|
|
259
264
|
curvature = DEFAULT_EDGE_CURVATURE,
|
|
260
265
|
entryCurvature,
|
|
261
266
|
suppressProjectNodes = true,
|
|
267
|
+
embedCssTheme = 'transitrix',
|
|
262
268
|
} = options;
|
|
263
269
|
const nodeSize = resolveActionNodeSize(parseNodeSizePreset(nodeSizePreset));
|
|
264
270
|
const layoutGaps: ActivitiesLayoutOptions = {
|
|
@@ -300,7 +306,7 @@ export function renderActivitiesSvg(doc: ActivityDoc, options: RenderActivitiesO
|
|
|
300
306
|
// drop the SVG into the DOM and styling resolves without any cooperation from
|
|
301
307
|
// the host stylesheet. Matches what the VS Code path produces via
|
|
302
308
|
// `prepareSvgForExport`.
|
|
303
|
-
const embedCss = generateSvgEmbedCss(
|
|
309
|
+
const embedCss = generateSvgEmbedCss(embedCssTheme) + ACTIVITIES_NETWORK_CSS;
|
|
304
310
|
|
|
305
311
|
return `<svg xmlns="http://www.w3.org/2000/svg" width="${w}" height="${h}" viewBox="0 0 ${w} ${h}">
|
|
306
312
|
<style>${embedCss}</style>
|
|
@@ -31,7 +31,7 @@ import type {
|
|
|
31
31
|
ResolvedActivityCard,
|
|
32
32
|
ResolvedMilestone,
|
|
33
33
|
} from '../activity-card/types.js';
|
|
34
|
-
import { generateSvgEmbedCss } from '../theme/index.js';
|
|
34
|
+
import { generateSvgEmbedCss, type ThemeId } from '../theme/index.js';
|
|
35
35
|
import { escXml } from './render-util.js';
|
|
36
36
|
|
|
37
37
|
const PAD = 24;
|
|
@@ -39,6 +39,11 @@ const EMPTY_SVG = `<svg xmlns="http://www.w3.org/2000/svg" width="0" height="0"
|
|
|
39
39
|
|
|
40
40
|
export interface RenderActivityCardOptions {
|
|
41
41
|
title?: string;
|
|
42
|
+
/**
|
|
43
|
+
* Theme CSS embedded as `<style>` so the SVG is self-contained.
|
|
44
|
+
* Defaults to `'transitrix'`. VS Code live preview uses body emitters + webview CSS instead.
|
|
45
|
+
*/
|
|
46
|
+
embedCssTheme?: ThemeId;
|
|
42
47
|
}
|
|
43
48
|
|
|
44
49
|
function truncate(text: string, maxChars: number): string {
|
|
@@ -241,7 +246,7 @@ export function renderActivityCardSvg(
|
|
|
241
246
|
// §5.1 class convention the layout applies; keeps the import meaningful.
|
|
242
247
|
void ARCHIMATE_CLASS;
|
|
243
248
|
|
|
244
|
-
const { title = '' } = options;
|
|
249
|
+
const { title = '', embedCssTheme = 'transitrix' } = options;
|
|
245
250
|
const resolved = resolveSingleDoc(doc);
|
|
246
251
|
const layout = layoutActivityCard(resolved);
|
|
247
252
|
|
|
@@ -259,7 +264,7 @@ export function renderActivityCardSvg(
|
|
|
259
264
|
? `<text class="text-header" x="${PAD}" y="${PAD + 14}">${escXml(`Activity Card — ${title}`)}</text>`
|
|
260
265
|
: '';
|
|
261
266
|
|
|
262
|
-
const embedCss = generateSvgEmbedCss(
|
|
267
|
+
const embedCss = generateSvgEmbedCss(embedCssTheme);
|
|
263
268
|
|
|
264
269
|
return `<svg xmlns="http://www.w3.org/2000/svg" width="${w}" height="${h}" viewBox="0 0 ${w} ${h}">
|
|
265
270
|
<style>${embedCss}</style>
|
|
@@ -41,6 +41,11 @@ export interface RenderBlocksOptions {
|
|
|
41
41
|
title?: string;
|
|
42
42
|
nodeSizePreset?: NodeSizePreset;
|
|
43
43
|
layoutOptions?: BlocksLayoutOptions;
|
|
44
|
+
/**
|
|
45
|
+
* Theme CSS embedded via {@link renderBlocksLayoutSvg}.
|
|
46
|
+
* Defaults to `'transitrix'` for self-contained host-neutral SVG.
|
|
47
|
+
*/
|
|
48
|
+
embedCssTheme?: ThemeId;
|
|
44
49
|
}
|
|
45
50
|
|
|
46
51
|
/**
|
|
@@ -133,7 +138,7 @@ ${parts.join('\n')}
|
|
|
133
138
|
* with the shared theme CSS embedded so the output is self-contained.
|
|
134
139
|
*/
|
|
135
140
|
export function renderBlocksSvg(doc: BlocksFile, options: RenderBlocksOptions = {}): string {
|
|
136
|
-
const { title = '', nodeSizePreset = 'normal', layoutOptions } = options;
|
|
141
|
+
const { title = '', nodeSizePreset = 'normal', layoutOptions, embedCssTheme = 'transitrix' } = options;
|
|
137
142
|
const leaf = resolveBlocksLeafSize(parseNodeSizePreset(nodeSizePreset));
|
|
138
143
|
|
|
139
144
|
const layout: BlocksLayout = layoutNestedBlocks(doc, {
|
|
@@ -150,7 +155,7 @@ export function renderBlocksSvg(doc: BlocksFile, options: RenderBlocksOptions =
|
|
|
150
155
|
? `<text class="text-header" x="${PAD}" y="${PAD - 6}">${escXml(`Nested Blocks — ${title}`)}</text>`
|
|
151
156
|
: '';
|
|
152
157
|
|
|
153
|
-
return renderBlocksLayoutSvg(layout, { title: titleSvg, embedCssTheme
|
|
158
|
+
return renderBlocksLayoutSvg(layout, { title: titleSvg, embedCssTheme });
|
|
154
159
|
}
|
|
155
160
|
|
|
156
161
|
/**
|
|
@@ -285,11 +290,16 @@ ${body}
|
|
|
285
290
|
export interface RenderGridOptions {
|
|
286
291
|
title?: string;
|
|
287
292
|
layoutOptions?: GridLayoutOptions;
|
|
293
|
+
/**
|
|
294
|
+
* Theme CSS embedded via {@link renderGridLayoutSvg}.
|
|
295
|
+
* Defaults to `'transitrix'` for self-contained host-neutral SVG.
|
|
296
|
+
*/
|
|
297
|
+
embedCssTheme?: ThemeId;
|
|
288
298
|
}
|
|
289
299
|
|
|
290
300
|
/** Host-neutral grid (matrix subset) renderer (IntelliJ/UI). */
|
|
291
301
|
export function renderGridSvg(doc: GridFile, options: RenderGridOptions = {}): string {
|
|
292
|
-
const { title = '', layoutOptions } = options;
|
|
302
|
+
const { title = '', layoutOptions, embedCssTheme = 'transitrix' } = options;
|
|
293
303
|
const layout = layoutGrid(doc, layoutOptions);
|
|
294
304
|
|
|
295
305
|
if (layout.columns.length === 0 || layout.rows.length === 0) {
|
|
@@ -300,5 +310,5 @@ export function renderGridSvg(doc: GridFile, options: RenderGridOptions = {}): s
|
|
|
300
310
|
? `<text class="text-header" x="${PAD}" y="${PAD - 6}">${escXml(`Nested Blocks — ${title}`)}</text>`
|
|
301
311
|
: '';
|
|
302
312
|
|
|
303
|
-
return renderGridLayoutSvg(layout, { title: titleSvg, embedCssTheme
|
|
313
|
+
return renderGridLayoutSvg(layout, { title: titleSvg, embedCssTheme });
|
|
304
314
|
}
|