@memoarchitect/architect 0.7.2 → 0.8.26

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.
Files changed (71) hide show
  1. package/README.md +1 -1
  2. package/dist/assets/{AiWorkspace-Bu9TlIWg.js → AiWorkspace-Z3BbnmaP.js} +1 -1
  3. package/dist/assets/{AnalysisWorkspace-CodmoI-v.js → AnalysisWorkspace-DjaUOo7U.js} +1 -1
  4. package/dist/assets/{ComplianceWizard-CTihkUi-.js → ComplianceWizard-DKxZ1z25.js} +1 -1
  5. package/dist/assets/DSMView-DJhmrXYm.js +5 -0
  6. package/dist/assets/Dashboard-CYT7KjqU.js +1 -0
  7. package/dist/assets/DhfDashboard-DacdOtkU.js +1 -0
  8. package/dist/assets/DhfWorkbench-CIhopT8J.js +69 -0
  9. package/dist/assets/DiagramCanvas-CLE_nv7Y.js +4 -0
  10. package/dist/assets/{DiagramEditor-UJDHcAUF.js → DiagramEditor-puQuE8gB.js} +2 -2
  11. package/dist/assets/DiagramToolbarControls-XMGLx08e.js +1 -0
  12. package/dist/assets/{ElementDetailView-10U0rr33.js → ElementDetailView-D5XvAL_i.js} +1 -1
  13. package/dist/assets/ExplorerTreeRow-DUmcEsqf.js +3 -0
  14. package/dist/assets/{ImportView-D8svP04Q.js → ImportView-9y1nhQS4.js} +1 -1
  15. package/dist/assets/{LayerGrid-DEe0Ryz-.js → LayerGrid-bhFpOIbe.js} +1 -1
  16. package/dist/assets/{LayerTable-CN_b2rDr.js → LayerTable-RuswZVUI.js} +1 -1
  17. package/dist/assets/{MaxGraphCanvas-bo8oPBct.js → MaxGraphCanvas-D3BXQK2y.js} +1 -1
  18. package/dist/assets/{ModelDiff-xe95oVua.js → ModelDiff-Cl2dhlk3.js} +1 -1
  19. package/dist/assets/{OntologyDecompositionDiagram-BL9R8bdB.js → OntologyDecompositionDiagram-aONGngg4.js} +1 -1
  20. package/dist/assets/{OntologyViewer-CtqNkkCn.js → OntologyViewer-VOrKTRuQ.js} +2 -2
  21. package/dist/assets/{RelationshipOverlay-DL0N8Vmk.js → RelationshipOverlay-B3AN-bM-.js} +1 -1
  22. package/dist/assets/{RelationshipsSection-BoJ0aUXe.js → RelationshipsSection-DggeGBKP.js} +1 -1
  23. package/dist/assets/{ReviewDashboard-DeTge2oC.js → ReviewDashboard--LMXZ3F4.js} +1 -1
  24. package/dist/assets/{ScenarioEditor-FAEYTHgP.js → ScenarioEditor-bB4iBbgO.js} +1 -1
  25. package/dist/assets/{StatisticsDashboard-BAZRqIPN.js → StatisticsDashboard-iXimfU20.js} +1 -1
  26. package/dist/assets/{SysmlCodeEditor-BBfup_Ni.js → SysmlCodeEditor-i0BHj3of.js} +117 -117
  27. package/dist/assets/{TabularView-I4LjHhoH.js → TabularView-DnIfq-TB.js} +1 -1
  28. package/dist/assets/TraceabilityMatrix-eilGn6Sr.js +3 -0
  29. package/dist/assets/UiScreensWorkspace-Cs1ivqzc.js +1 -0
  30. package/dist/assets/{WorkflowWizard-VwpEHt3R.js → WorkflowWizard-C7jI6C59.js} +1 -1
  31. package/dist/assets/index-CG-gfw-s.js +4067 -0
  32. package/dist/assets/index-DXB4CKwW.css +1 -0
  33. package/dist/assets/{index.es-ClbJxlAQ.js → index.es-DABt8CUc.js} +1 -1
  34. package/dist/assets/{jspdf.es.min-DZ68BGxk.js → jspdf.es.min-G-Vwo9yG.js} +3 -3
  35. package/dist/assets/{layout-providers-Dr743WlP.js → layout-providers-BSDYNZu0.js} +1 -1
  36. package/dist/assets/notation-scene-DLZms6VR.js +1 -0
  37. package/dist/assets/{reactflow-s7jmJtXx.js → reactflow-C9OlmOYw.js} +1 -1
  38. package/dist/assets/xlsx-CkFp8p6R.js +105 -0
  39. package/dist/index.html +3 -3
  40. package/dist-standalone/index.html +5504 -0
  41. package/lib/__tests__/standalone-distribution.test.d.ts +2 -0
  42. package/lib/__tests__/standalone-distribution.test.d.ts.map +1 -0
  43. package/lib/__tests__/standalone-distribution.test.js +51 -0
  44. package/lib/__tests__/standalone-distribution.test.js.map +1 -0
  45. package/lib/__tests__/supervised-child-args.test.js +21 -1
  46. package/lib/__tests__/supervised-child-args.test.js.map +1 -1
  47. package/lib/commands/build.d.ts.map +1 -1
  48. package/lib/commands/build.js +15 -18
  49. package/lib/commands/build.js.map +1 -1
  50. package/lib/commands/dev.d.ts +14 -0
  51. package/lib/commands/dev.d.ts.map +1 -1
  52. package/lib/commands/dev.js +40 -1
  53. package/lib/commands/dev.js.map +1 -1
  54. package/lib/feature-grants.d.ts.map +1 -1
  55. package/lib/feature-grants.js +3 -1
  56. package/lib/feature-grants.js.map +1 -1
  57. package/package.json +10 -6
  58. package/dist/assets/DSMView-BiC845df.js +0 -1
  59. package/dist/assets/Dashboard-CgnNLhKq.js +0 -1
  60. package/dist/assets/DhfDashboard-w-dJoJHU.js +0 -1
  61. package/dist/assets/DhfWorkbench-o6B_MT-0.js +0 -69
  62. package/dist/assets/DiagramCanvas-CqGqDbgT.js +0 -3
  63. package/dist/assets/DiagramToolbarControls-B2gZFJlg.js +0 -1
  64. package/dist/assets/ExplorerTreeRow-DqhF_qoO.js +0 -3
  65. package/dist/assets/TraceabilityMatrix-DbrvjqLN.js +0 -3
  66. package/dist/assets/UiScreensWorkspace-DDD_PyJs.js +0 -1
  67. package/dist/assets/editor.worker-DyuDvpVp.js +0 -26
  68. package/dist/assets/element-options-B7AgTB8R.js +0 -3
  69. package/dist/assets/index-BWMNo4wW.css +0 -1
  70. package/dist/assets/index-Bij8Q4Kg.js +0 -45
  71. package/dist/assets/notation-scene-DT8LpWVK.js +0 -1
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=standalone-distribution.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"standalone-distribution.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/standalone-distribution.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,51 @@
1
+ import { existsSync, readFileSync, statSync } from 'node:fs';
2
+ import { dirname, resolve } from 'node:path';
3
+ import { fileURLToPath } from 'node:url';
4
+ import { describe, expect, it } from 'vitest';
5
+ // ─── The standalone distribution is one file with nothing to fetch ───────────
6
+ //
7
+ // `memo-architect build --standalone` exists so a viewer can be opened off
8
+ // disk. Two things make that possible and neither is visible in the source: the
9
+ // build must leave no reference to a second file, and it must not reach the
10
+ // network. Both were broken before — the flag inlined the entry script but left
11
+ // its chunk imports pointing at `/assets/…`, so the page 404'd when served and
12
+ // died on CORS when opened, and it did that silently, as a blank screen.
13
+ //
14
+ // These assertions are on the built artefact rather than on the config, because
15
+ // the config is not what the user opens.
16
+ // ─────────────────────────────────────────────────────────────────────────────
17
+ const ROOT = resolve(dirname(fileURLToPath(import.meta.url)), '../..');
18
+ const INDEX = resolve(ROOT, 'dist-standalone/index.html');
19
+ const built = existsSync(INDEX);
20
+ const html = built ? readFileSync(INDEX, 'utf8') : '';
21
+ // The distribution is a build output, so a source checkout may not have one.
22
+ // Skipping keeps `pnpm test` honest without pretending the file was checked.
23
+ const describeBuilt = built ? describe : describe.skip;
24
+ describeBuilt('standalone distribution', () => {
25
+ it('is a single file', () => {
26
+ expect(statSync(INDEX).isFile()).toBe(true);
27
+ });
28
+ it('references no sibling asset', () => {
29
+ // Only fetchable paths count. The inlined bundle contains plenty of
30
+ // attribute-shaped text — `href="${url}"`, `href="$2"` — which is
31
+ // library code writing markup at runtime, not a reference this file has.
32
+ const refs = [...html.matchAll(/(?:src|href)="([^"]+)"/g)]
33
+ .map(match => match[1])
34
+ .filter(url => /^(?:\/|\.\.?\/)/.test(url) || /\.(?:js|mjs|css|png|svg|woff2?)$/.test(url))
35
+ .filter(url => !url.includes('$'));
36
+ expect(refs).toEqual([]);
37
+ });
38
+ it('loads nothing over the network', () => {
39
+ expect(html).not.toMatch(/(?:src|href)="https?:\/\//);
40
+ expect(html).not.toContain('fonts.googleapis.com');
41
+ });
42
+ it('carries no unresolved Vite preload marker', () => {
43
+ // A bare `__VITE_PRELOAD__` is a ReferenceError on load: the token is
44
+ // substituted in a hook that runs after the one that inlines the chunk.
45
+ expect(html).not.toContain('__VITE_PRELOAD__');
46
+ });
47
+ it('emits no ELK layout worker beside it', () => {
48
+ expect(existsSync(resolve(ROOT, 'dist-standalone/elk-worker.min.js'))).toBe(false);
49
+ });
50
+ });
51
+ //# sourceMappingURL=standalone-distribution.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"standalone-distribution.test.js","sourceRoot":"","sources":["../../src/__tests__/standalone-distribution.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC7D,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAE9C,gFAAgF;AAChF,EAAE;AACF,2EAA2E;AAC3E,gFAAgF;AAChF,4EAA4E;AAC5E,gFAAgF;AAChF,+EAA+E;AAC/E,yEAAyE;AACzE,EAAE;AACF,gFAAgF;AAChF,yCAAyC;AACzC,gFAAgF;AAEhF,MAAM,IAAI,GAAG,OAAO,CAAC,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;AACvE,MAAM,KAAK,GAAG,OAAO,CAAC,IAAI,EAAE,4BAA4B,CAAC,CAAC;AAE1D,MAAM,KAAK,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC;AAChC,MAAM,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,YAAY,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AAEtD,6EAA6E;AAC7E,6EAA6E;AAC7E,MAAM,aAAa,GAAG,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC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AE,GAAG,EAAE;QAC5C,MAAM,CAAC,UAAU,CAAC,OAAO,CAAC,IAAI,EAAE,mCAAmC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACvF,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import { describe, it, expect } from 'vitest';
2
- import { supervisedChildArgs } from '../commands/dev.js';
2
+ import { runningArchitectsForProject, supervisedChildArgs } from '../commands/dev.js';
3
3
  // ─── Supervised child argv ──────────────────────────────────────────────────
4
4
  //
5
5
  // The supervisor rebuilds argv rather than forwarding it, so every flag the
@@ -32,4 +32,24 @@ describe('supervisedChildArgs', () => {
32
32
  expect(supervisedChildArgs(ENTRY, {}, true)).toContain('3000');
33
33
  });
34
34
  });
35
+ describe('runningArchitectsForProject', () => {
36
+ it('reports only Architect servers whose cwd is the requested project', async () => {
37
+ const run = async (file, args) => {
38
+ if (file === 'ps') {
39
+ return {
40
+ stdout: [
41
+ '100 node /workspace/pump/node_modules/.bin/memo-architect dev --port 3111',
42
+ '200 node /workspace/other/node_modules/.bin/memo-architect dev --port 3112',
43
+ ].join('\n'),
44
+ stderr: '',
45
+ };
46
+ }
47
+ expect(file).toBe('lsof');
48
+ return { stdout: args[2] === '100' ? 'pcwd\nn/workspace/pump\n' : 'pcwd\nn/workspace/other\n', stderr: '' };
49
+ };
50
+ await expect(runningArchitectsForProject('/workspace/pump', run)).resolves.toEqual([
51
+ { pid: 100, command: 'node /workspace/pump/node_modules/.bin/memo-architect dev --port 3111' },
52
+ ]);
53
+ });
54
+ });
35
55
  //# sourceMappingURL=supervised-child-args.test.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"supervised-child-args.test.js","sourceRoot":"","sources":["../../src/__tests__/supervised-child-args.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,mBAAmB,E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AE;SACjG,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../src/commands/build.ts"],"names":[],"mappings":"AAWA,OAAO,EAAuB,KAAK,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAwB/E,wBAAsB,qBAAqB,CAAC,OAAO,EAAE;IACjD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,wFAAwF;IACxF,aAAa,CAAC,EAAE,aAAa,CAAC;CACjC,GAAG,OAAO,CAAC,IAAI,CAAC,CA4BhB"}
1
+ {"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../src/commands/build.ts"],"names":[],"mappings":"AAWA,OAAO,EAAuB,KAAK,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAM/E,wBAAsB,qBAAqB,CAAC,OAAO,EAAE;IACjD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,wFAAwF;IACxF,aAAa,CAAC,EAAE,aAAa,CAAC;CACjC,GAAG,OAAO,CAAC,IAAI,CAAC,CAoChB"}
@@ -6,22 +6,15 @@ import { injectFeatureGrants } from '../feature-grants.js';
6
6
  function architectPackageRoot() {
7
7
  return resolve(dirname(fileURLToPath(import.meta.url)), '../..');
8
8
  }
9
- function inlineEntryAssets(html, outputDir) {
10
- html = html.replace(/<link[^>]+rel="stylesheet"[^>]+href="([^"]+)"[^>]*\/?>/g, (match, href) => {
11
- const path = resolve(outputDir, href.replace(/^\//, ''));
12
- return existsSync(path) ? `<style>${readFileSync(path, 'utf-8')}</style>` : match;
13
- });
14
- html = html.replace(/<script[^>]+src="([^"]+)"[^>]*><\/script>/g, (match, src) => {
15
- const path = resolve(outputDir, src.replace(/^\//, ''));
16
- return existsSync(path) ? `<script type="module">${readFileSync(path, 'utf-8')}</script>` : match;
17
- });
18
- return html;
19
- }
20
9
  export async function architectBuildCommand(options) {
21
10
  const snapshot = await buildProjectSnapshot();
22
- const sourceDist = resolve(architectPackageRoot(), 'dist');
11
+ // Two distributions, because one file and many files are different builds,
12
+ // not the same build post-processed: see packages/web/vite.standalone.config.ts.
13
+ const sourceDist = resolve(architectPackageRoot(), options.standalone ? 'dist-standalone' : 'dist');
23
14
  if (!existsSync(resolve(sourceDist, 'index.html'))) {
24
- throw new Error('Architect distribution is missing. Reinstall @memoarchitect/architect or run its build.');
15
+ throw new Error(options.standalone
16
+ ? 'Standalone Architect distribution is missing. Reinstall @memoarchitect/architect or run `pnpm run build:client:standalone`.'
17
+ : 'Architect distribution is missing. Reinstall @memoarchitect/architect or run its build.');
25
18
  }
26
19
  const outputDir = resolve(snapshot.projectRoot, options.output || 'dist');
27
20
  if (outputDir === sourceDist) {
@@ -29,19 +22,23 @@ export async function architectBuildCommand(options) {
29
22
  }
30
23
  rmSync(outputDir, { recursive: true, force: true });
31
24
  mkdirSync(outputDir, { recursive: true });
32
- cpSync(sourceDist, outputDir, { recursive: true });
25
+ // The standalone distribution is the single HTML file and nothing beside
26
+ // it; copying the directory would be copying that one file.
27
+ if (!options.standalone)
28
+ cpSync(sourceDist, outputDir, { recursive: true });
33
29
  const indexPath = resolve(outputDir, 'index.html');
34
- let html = readFileSync(indexPath, 'utf-8');
30
+ let html = readFileSync(resolve(sourceDist, 'index.html'), 'utf-8');
35
31
  const payload = serializeForInlineScript({
36
32
  model: snapshot.model,
37
33
  validation: snapshot.validation,
38
34
  completeness: snapshot.completeness,
39
35
  });
40
- html = html.replace('</head>', `<script>window.__MEMO_DATA__=${payload};</script>\n</head>`);
36
+ // Replacer function, not a replacement string: model text containing `$&`
37
+ // or ``$` `` would otherwise be read as a substitution pattern and splice
38
+ // the document into the payload.
39
+ html = html.replace('</head>', () => `<script>window.__MEMO_DATA__=${payload};</script>\n</head>`);
41
40
  if (options.featureGrants)
42
41
  html = injectFeatureGrants(html, options.featureGrants);
43
- if (options.standalone)
44
- html = inlineEntryAssets(html, outputDir);
45
42
  writeFileSync(indexPath, html);
46
43
  process.stdout.write(`Architect viewer built at ${indexPath}\n`);
47
44
  }
@@ -1 +1 @@
1
- {"version":3,"file":"build.js","sourceRoot":"","sources":["../../src/commands/build.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,MAAM,EACN,UAAU,EACV,SAAS,EACT,YAAY,EACZ,MAAM,EACN,aAAa,GAChB,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,oBAAoB,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AACtF,OAAO,EAAE,mBAAmB,EAAsB,MAAM,sBAAsB,CAAC;AAE/E,SAAS,oBAAoB;IACzB,OAAO,OAAO,CAAC,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;AACrE,CAAC;AAED,SAAS,iBAAiB,CAAC,IAAY,EAAE,SAAiB;IACtD,IAAI,GAAG,IAAI,CAAC,OAAO,CACf,yDAAyD,EACzD,CAAC,KAAK,EAAE,IAAY,EAAE,EAAE;QACpB,MAAM,IAAI,GAAG,OAAO,CAAC,SAAS,EAAE,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,CAAC;QACzD,OAAO,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,UAAU,YAAY,CAAC,IAAI,EAAE,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,KAAK,CAAC;IACtF,CAAC,CACJ,CAAC;IACF,IAAI,GAAG,IAAI,CAAC,OAAO,CACf,4CAA4C,EAC5C,CAAC,KAAK,EAAE,GAAW,EAAE,EAAE;QACnB,MAAM,IAAI,GAAG,OAAO,CAAC,SAAS,EAAE,GAAG,CAAC,OAAO,CAA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I,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,GAAG,EAAE,CAAC,gCAAgC,OAAO,qBAAqB,CAAC,CAAC;IACnG,IAAI,OAAO,CAAC,aAAa;QAAE,IAAI,GAAG,mBAAmB,CAAC,IAAI,EAAE,OAAO,CAAC,aAAa,CAAC,CAAC;IACnF,aAAa,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;IAE/B,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,6BAA6B,SAAS,IAAI,CAAC,CAAC;AACrE,CAAC"}
@@ -1,4 +1,17 @@
1
1
  import { type FeatureGrants } from '../feature-grants.js';
2
+ type ProjectProcessRunner = (file: string, args: string[]) => Promise<{
3
+ stdout: string;
4
+ stderr: string;
5
+ }>;
6
+ export interface RunningArchitect {
7
+ pid: number;
8
+ command: string;
9
+ }
10
+ /**
11
+ * Best-effort duplicate detection. A dev server has a supervisor and a runtime
12
+ * child, so callers treat this as an advisory rather than a process count.
13
+ */
14
+ export declare function runningArchitectsForProject(projectDir: string, run?: ProjectProcessRunner): Promise<RunningArchitect[]>;
2
15
  export interface ArchitectDevOptions {
3
16
  port?: number;
4
17
  open?: boolean;
@@ -20,4 +33,5 @@ export interface ArchitectDevOptions {
20
33
  */
21
34
  export declare function supervisedChildArgs(entry: string, options: ArchitectDevOptions, firstStart: boolean): string[];
22
35
  export declare function architectDevCommand(options: ArchitectDevOptions): Promise<void>;
36
+ export {};
23
37
  //# sourceMappingURL=dev.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"dev.d.ts","sourceRoot":"","sources":["../../src/commands/dev.ts"],"names":[],"mappings":"AAMA,OAAO,EAAuB,KAAK,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAY/E,MAAM,WAAW,mBAAmB;IAChC,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,OAAO,CAAC;IAAC,aAAa,CAAC,EAAE,aAAa,CAAC;IAAC,SAAS,CAAC,EAAE,OAAO,CAA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;CAC5B;AAED;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CAC/B,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,mBAAmB,EAC5B,UAAU,EAAE,OAAO,GACpB,MAAM,EAAE,CAOV;AAED,wBAAsB,mBAAmB,CAAC,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC,CAsDrF"}
@@ -1,10 +1,43 @@
1
1
  import { existsSync } from 'node:fs';
2
2
  import { dirname, resolve } from 'node:path';
3
3
  import { fileURLToPath } from 'node:url';
4
- import { spawn } from 'node:child_process';
4
+ import { execFile, spawn } from 'node:child_process';
5
5
  import { once } from 'node:events';
6
+ import { promisify } from 'node:util';
6
7
  import { startProjectServer } from '@memoarchitect/tools';
7
8
  import { injectFeatureGrants } from '../feature-grants.js';
9
+ const execFileAsync = promisify(execFile);
10
+ const runProjectProcess = (file, args) => execFileAsync(file, args);
11
+ /**
12
+ * Best-effort duplicate detection. A dev server has a supervisor and a runtime
13
+ * child, so callers treat this as an advisory rather than a process count.
14
+ */
15
+ export async function runningArchitectsForProject(projectDir, run = runProjectProcess) {
16
+ try {
17
+ const { stdout } = await run('ps', ['-axo', 'pid=,command=']);
18
+ const candidates = stdout.split('\n').flatMap(line => {
19
+ const match = line.trim().match(/^(\d+)\s+(.+)$/);
20
+ return match && /(?:^|\/)memo-architect(?:\.js)?\s+dev\b/.test(match[2])
21
+ && Number(match[1]) !== process.pid
22
+ ? [{ pid: Number(match[1]), command: match[2] }]
23
+ : [];
24
+ });
25
+ const matching = await Promise.all(candidates.map(async (candidate) => {
26
+ try {
27
+ const { stdout } = await run('lsof', ['-a', '-p', String(candidate.pid), '-d', 'cwd', '-Fn']);
28
+ const cwd = stdout.split('\n').find(line => line.startsWith('n'))?.slice(1);
29
+ return cwd === projectDir ? candidate : undefined;
30
+ }
31
+ catch {
32
+ return undefined;
33
+ }
34
+ }));
35
+ return matching.filter((candidate) => candidate !== undefined);
36
+ }
37
+ catch {
38
+ return [];
39
+ }
40
+ }
8
41
  function architectPackageRoot() {
9
42
  return resolve(dirname(fileURLToPath(import.meta.url)), '../..');
10
43
  }
@@ -36,6 +69,12 @@ export function supervisedChildArgs(entry, options, firstStart) {
36
69
  export async function architectDevCommand(options) {
37
70
  if (process.env.MEMO_ARCHITECT_RUNTIME_CHILD !== '1') {
38
71
  const port = options.port ?? 3000;
72
+ const existing = await runningArchitectsForProject(process.cwd());
73
+ if (existing.length > 0) {
74
+ const pids = existing.map(({ pid }) => pid).join(', ');
75
+ process.stderr.write(`⚠ MEMO Architect is already running for this project (PID${existing.length === 1 ? '' : 's'} ${pids}). `
76
+ + `Starting another server on http://127.0.0.1:${port}.\n`);
77
+ }
39
78
  let stopping = false;
40
79
  let firstStart = true;
41
80
  let restartStartedAt;
@@ -1 +1 @@
1
- {"version":3,"file":"dev.js","sourceRoot":"","sources":["../../src/commands/dev.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AACnC,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,mBAAmB,EAAsB,MAAM,sBAAsB,CAAC;AAE/E,SAAS,oBAAoB;IACzB,OAAO,OAAO,CAAC,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;AACrE,CAAC;AAED,SAAS,UAAU;IACf,MAAM,IAAI,GAAG,oBAAoB,EAAE,CAAC;IACpC,MAAM,UAAU,GAAG,OAAO,CAAC,IAAI,EAAE,UAAU,EAAE,KAAK,CAAC,CAAC;IACpD,OAAO,UAA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ts"],"names":[],"mappings":"AAQA;;;;;;GAMG;AACH,MAAM,WAAW,aAAa;IAC1B,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC;CAC5B;AAED,wBAAgB,oBAAoB,CAAC,OAAO,EAAE;IAAE,YAAY,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,aAAa,CAEvF;AAED,kFAAkF;AAClF,eAAO,MAAM,6BAA6B,QAEyD,CAAC;AAEpG;;;;;;;;;;GAUG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa,GAAG,MAAM,CAI/E"}
1
+ {"version":3,"file":"feature-grants.d.ts","sourceRoot":"","sources":["../src/feature-grants.ts"],"names":[],"mappings":"AAQA;;;;;;GAMG;AACH,MAAM,WAAW,aAAa;IAC1B,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC;CAC5B;AAED,wBAAgB,oBAAoB,CAAC,OAAO,EAAE;IAAE,YAAY,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,aAAa,CAEvF;AAED,kFAAkF;AAClF,eAAO,MAAM,6BAA6B,QAEyD,CAAC;AAEpG;;;;;;;;;;GAUG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa,GAAG,MAAM,CAM/E"}
@@ -26,6 +26,8 @@ export function injectFeatureGrants(html, grants) {
26
26
  if (html.includes('__MEMO_FLAGS__'))
27
27
  return html;
28
28
  const tag = `<script>window.__MEMO_FLAGS__=${JSON.stringify(grants)};</script>`;
29
- return html.includes('</head>') ? html.replace('</head>', `${tag}\n</head>`) : tag + html;
29
+ // Replacer function: grant names are data, and `$&` in a replacement string
30
+ // is a substitution pattern rather than two characters.
31
+ return html.includes('</head>') ? html.replace('</head>', () => `${tag}\n</head>`) : tag + html;
30
32
  }
31
33
  //# sourceMappingURL=feature-grants.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"feature-grants.js","sourceRoot":"","sources":["../src/feature-grants.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,EAAE;AACF,+EAA+E;AAC/E,yCAAyC;AACzC,gFAAgF;AAChF,gCAAgC;AAChC,gFAAgF;AAchF,MAAM,UAAU,oBAAoB,CAAC,OAAmC;IACpE,OAAO,EAAE,YAAY,EAAE,OAAO,CAAC,YAAY,KAAK,IAAI,EAAE,CAAC;AAC3D,CAAC;AAED,kFAAkF;AAClF,MAAM,CAAC,MAAM,6BAA6B,GACtC,4FAA4F;MAC1F,6FAA6F,CAAC;AAEpG;;;;;;;;;;GAUG;AACH,MAAM,UAAU,mBAAmB,CAAC,IAAY,EAAE,MAAqB;IACnE,IAAI,IAAI,CAAC,QAAQ,CAAC,gBAAgB,CAAC;QAAE,OAAO,IAAI,CAAC;IACjD,MAAM,GAAG,GAAG,iCAAiC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,YAAY,CAAC;IAChF,OAAO,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,GAAG,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,IAAI,CAAC;AAC9F,CAAC"}
1
+ {"version":3,"file":"feature-grants.js","sourceRoot":"","sources":["../src/feature-grants.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,EAAE;AACF,+EAA+E;AAC/E,yCAAyC;AACzC,gFAAgF;AAChF,gCAAgC;AAChC,gFAAgF;AAchF,MAAM,UAAU,oBAAoB,CAAC,OAAmC;IACpE,OAAO,EAAE,YAAY,EAAE,OAAO,CAAC,YAAY,KAAK,IAAI,EAAE,CAAC;AAC3D,CAAC;AAED,kFAAkF;AAClF,MAAM,CAAC,MAAM,6BAA6B,GACtC,4FAA4F;MAC1F,6FAA6F,CAAC;AAEpG;;;;;;;;;;GAUG;AACH,MAAM,UAAU,mBAAmB,CAAC,IAAY,EAAE,MAAqB;IACnE,IAAI,IAAI,CAAC,QAAQ,CAAC,gBAAgB,CAAC;QAAE,OAAO,IAAI,CAAC;IACjD,MAAM,GAAG,GAAG,iCAAiC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,YAAY,CAAC;IAChF,4EAA4E;IAC5E,wDAAwD;IACxD,OAAO,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,GAAG,EAAE,CAAC,GAAG,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,IAAI,CAAC;AACpG,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@memoarchitect/architect",
3
- "version": "0.7.2",
3
+ "version": "0.8.26",
4
4
  "description": "MEMO Architect — interactive workbench and distributable viewer for medical device systems engineering",
5
5
  "type": "module",
6
6
  "bin": {
@@ -12,15 +12,17 @@
12
12
  },
13
13
  "files": [
14
14
  "dist/",
15
+ "dist-standalone/",
15
16
  "lib/",
16
17
  "README.md",
17
18
  "LICENSE"
18
19
  ],
19
20
  "scripts": {
20
- "build": "pnpm run generate:notation && pnpm run check:cache && pnpm run build:client && pnpm run check:bundle && pnpm run build:cli",
21
+ "build": "pnpm run generate:notation && pnpm run check:cache && pnpm run build:client && pnpm run check:bundle && pnpm run build:client:standalone && pnpm run build:cli",
21
22
  "generate:notation": "node scripts/generate-notation-registry.mjs",
22
23
  "prepack": "pnpm run clean && pnpm run build",
23
24
  "build:client": "vite build --config packages/web/vite.config.ts",
25
+ "build:client:standalone": "vite build --config packages/web/vite.standalone.config.ts",
24
26
  "build:cli": "tsc -p tsconfig.architect.json",
25
27
  "check:cache": "bash scripts/check-no-ontology-cache.sh",
26
28
  "check:bundle": "bash scripts/check-no-bare-imports.sh",
@@ -29,7 +31,7 @@
29
31
  "test": "pnpm run test:web && pnpm run test:cli",
30
32
  "test:coverage": "cd packages/web && vitest run --coverage",
31
33
  "type-check": "tsc -p packages/web/tsconfig.json --noEmit && tsc -p tsconfig.architect.json --noEmit",
32
- "clean": "rm -rf dist lib",
34
+ "clean": "rm -rf dist dist-standalone lib",
33
35
  "docs:serve": "pdm run docs-serve",
34
36
  "docs:build": "pdm run docs-build",
35
37
  "version:sync": "node scripts/sync-version.mjs",
@@ -41,14 +43,15 @@
41
43
  "test:cli": "vitest run --config vitest.cli.config.ts"
42
44
  },
43
45
  "dependencies": {
44
- "@memoarchitect/ontology": "0.7.0",
45
- "@memoarchitect/tools": "0.7.2",
46
+ "@memoarchitect/ontology": "0.8.1",
47
+ "@memoarchitect/tools": "0.8.6",
46
48
  "class-variance-authority": "^0.7.1",
47
49
  "clsx": "^2.1.1",
48
50
  "commander": "^12.1.0",
49
51
  "html-to-image": "^1.11.13",
50
52
  "jspdf": "^4.2.1",
51
- "tailwind-merge": "^3.6.0"
53
+ "tailwind-merge": "^3.6.0",
54
+ "xlsx": "^0.18.5"
52
55
  },
53
56
  "devDependencies": {
54
57
  "@dagrejs/dagre": "^2.0.0",
@@ -64,6 +67,7 @@
64
67
  "autoprefixer": "^10.4.20",
65
68
  "elkjs": "^0.9.3",
66
69
  "jsdom": "^29.1.1",
70
+ "libavoid-js": "0.5.0-beta.5",
67
71
  "monaco-editor": "^0.55.1",
68
72
  "postcss": "^8.4.49",
69
73
  "react": "^18.3.1",
@@ -1 +0,0 @@
1
- import{j as t}from"./reactflow-s7jmJtXx.js";import{a}from"./zustand-CrhqMOHB.js";import{C as l,F as N,S as we,u as O,r as T}from"./index-Bij8Q4Kg.js";import{l as Se,r as ke,e as ee,d as ve,c as je,s as Ce,a as W,A as te,T as B,H as Ee}from"./element-options-B7AgTB8R.js";const ne=new Set(["Function","Function","UserActivity"]),se=new Set(["System","Subsystem","Component","LogicalComponent","SoftwareComponent","SoftwareModule","Software"]);function Ie(o){var S,y;const x=[],u=[];for(const n of Object.values(o.elements))ne.has(n.kind)&&x.push(n),se.has(n.kind)&&u.push(n);const g=[],h=new Set,c=new Map;for(const n of u)c.set(n.id,[]);for(const n of o.relationships){if(n.type!=="allocateTo")continue;const i=o.elements[n.sourceId],p=o.elements[n.targetId];!i||!p||ne.has(i.kind)&&se.has(p.kind)&&(g.push({functionId:i.id,functionName:i.name,targetId:p.id,targetName:p.name}),h.add(i.id),c.has(p.id)||c.set(p.id,[]),c.get(p.id).push(i.id))}for(const n of x)if(n.allocatedTo&&!h.has(n.id)){const i=u.find(p=>p.name===n.allocatedTo||p.id===n.allocatedTo);i&&(g.push({functionId:n.id,functionName:n.name,targetId:i.id,targetName:i.name}),h.add(n.id),c.has(i.id)||c.set(i.id,[]),c.get(i.id).push(n.id))}const m=[];let b=0;for(const n of x)h.has(n.id)||m.push({id:`ci-${b++}`,type:"unallocated-function",severity:"warning",elementId:n.id,elementName:n.name,message:`Function "${n.name}" is not allocated to any component`});for(const n of u){const i=c.get(n.id);(!i||i.length===0)&&m.push({id:`ci-${b++}`,type:"no-functions-allocated",severity:"info",elementId:n.id,elementName:n.name,message:`Component "${n.name}" has no functions allocated to it`})}const f=new Map;for(const n of g)f.set(n.functionId,n.targetId);for(const n of o.relationships){if(n.type!=="flow")continue;const i=f.get(n.sourceId),p=f.get(n.targetId);if(i&&p&&i!==p){const k=o.elements[n.sourceId],M=o.elements[n.targetId];k&&M&&m.push({id:`ci-${b++}`,type:"cross-component-flow",severity:"info",elementId:n.sourceId,elementName:k.name,message:`Flow from "${k.name}" to "${M.name}" crosses component boundary (${(S=o.elements[i])==null?void 0:S.name} → ${(y=o.elements[p])==null?void 0:y.name})`,relatedIds:[n.targetId,i,p]})}}return{allocations:g,componentFunctions:c,issues:m,functions:x,structures:u}}function Re({label:o,children:x,badge:u,title:g,width:h=260}){const[c,m]=a.useState(!1),b=a.useRef(null);return a.useEffect(()=>{if(!c)return;const f=y=>{var n;(n=b.current)!=null&&n.contains(y.target)||m(!1)},S=y=>{y.key==="Escape"&&m(!1)};return document.addEventListener("mousedown",f),document.addEventListener("keydown",S),()=>{document.removeEventListener("mousedown",f),document.removeEventListener("keydown",S)}},[c]),t.jsxs("div",{ref:b,style:{position:"relative"},children:[t.jsxs("button",{type:"button","aria-haspopup":"dialog","aria-expanded":c,title:g,onClick:()=>m(f=>!f),style:{display:"flex",alignItems:"center",gap:"5px",padding:"3px 8px",borderRadius:"5px",border:`1px solid ${c||u?l.accent:l.border}`,background:c?"#E8F8F3":l.surface,fontSize:N.xs,color:l.secondary,cursor:"pointer",whiteSpace:"nowrap"},children:[o,u&&t.jsx("span",{style:{fontSize:"10px",padding:"0 4px",borderRadius:"7px",background:l.accent,color:"#08331F",fontWeight:700},children:u}),t.jsx("span",{style:{fontSize:"9px",color:l.faint},children:"▾"})]}),c&&t.jsx("div",{role:"dialog","aria-label":o,style:{position:"absolute",top:"calc(100% + 4px)",right:0,zIndex:60,width:h,padding:"10px 12px",background:l.surface,border:`1px solid ${l.border}`,borderRadius:"7px",boxShadow:we.lg,display:"flex",flexDirection:"column",gap:"9px"},children:x})]})}const oe=[{value:"natural",label:"Name",title:"Alphabetical inside every parent"},{value:"kind",label:"Element type",title:"Grouped by element type, then name"},{value:"partition",label:"Partition",title:"Sequence siblings so dependencies sit above the diagonal, leaving only real cycles as feedback"},{value:"cluster",label:"Cluster",title:"Keep mutually dependent siblings adjacent"}];function Ne(o){return o.types.length>0?T(o.types[0]):"#475569"}function ze(){var Y;const o=O(e=>e.model),x=O(e=>e.selectElement),u=O(e=>e.selectedElementId),g=O(e=>e.setAnalysisIssues),[h,c]=a.useState({}),[m,b]=a.useState({}),[f,S]=a.useState([]),[y,n]=a.useState([]),[i,p]=a.useState([]),[k,M]=a.useState(null),[$,ae]=a.useState(!1),[A,le]=a.useState("natural"),[F,ie]=a.useState(!1),[G,re]=a.useState(!0),[_,ce]=a.useState(26),[v,de]=a.useState(!0),[q,j]=a.useState(new Set),[V,C]=a.useState(new Set),[w,Z]=a.useState(null),J=a.useMemo(()=>o?Se(o):[],[o]),H=a.useMemo(()=>{if(!o)return[];const e=new Map;for(const s of o.relationships)e.set(s.type,(e.get(s.type)??0)+1);return ke(o).map(s=>({value:s,hint:String(e.get(s)??0),color:T(s)}))},[o]),z=a.useMemo(()=>ee(o,h),[o,h]),L=a.useMemo(()=>ee(o,m),[o,m]);a.useEffect(()=>{const e=new Set(z.map(s=>s.value));S(s=>s.length===0||s.every(r=>e.has(r))?s:s.filter(r=>e.has(r)))},[z]),a.useEffect(()=>{const e=new Set(L.map(s=>s.value));n(s=>s.length===0||s.every(r=>e.has(r))?s:s.filter(r=>e.has(r)))},[L]);const E=a.useMemo(()=>k??(o?ve(o):[]),[k,o]),pe=a.useMemo(()=>{const e=new Set(E);return H.map(s=>e.has(s.value)?{...s,label:`${s.value} (nesting)`,hint:"builds the tree"}:s)},[H,E]),Q=[k!==null,!v,!G,$,F].filter(Boolean).length,d=a.useMemo(()=>o?je(o,{rows:{layer:h.layer,kinds:h.kind?[h.kind]:[],elementIds:f,expanded:q},columns:{layer:m.layer,kinds:m.kind?[m.kind]:[],elementIds:y,expanded:V},dependencyTypes:i,containmentTypes:E,groupByPackage:$,ordering:A,symmetric:F}):null,[o,h,m,f,y,i,E,$,A,F,q,V]),[D,ue]=a.useState(!1);a.useEffect(()=>{if(D||!o)return;const e=Ce(o,E);e&&(c({layer:e}),b({layer:e}),ue(!0))},[o,E,D]);const[X,me]=a.useState(!1);a.useEffect(()=>{if(X||!D||!d)return;const e=d.rowRoots.filter(r=>r.children.length>0).map(r=>r.id),s=d.columnRoots.filter(r=>r.children.length>0).map(r=>r.id);e.length===0&&s.length===0||(j(new Set(e)),C(new Set(s)),me(!0))},[d,D,X]);const he=a.useCallback(e=>{j(s=>P(s,e)),v&&C(s=>P(s,e))},[v]),xe=a.useCallback(e=>{C(s=>P(s,e)),v&&j(s=>P(s,e))},[v]),fe=a.useCallback(()=>{d&&(j(new Set(W(d.rowRoots))),C(new Set(W(d.columnRoots))))},[d]),ge=a.useCallback(()=>{j(new Set),C(new Set)},[]),ye=a.useCallback(e=>{d&&(j(new Set(W(d.rowRoots,e))),C(new Set(W(d.columnRoots,e))))},[d]),K=a.useMemo(()=>o?Ie(o):null,[o]);a.useEffect(()=>{if(K)return g(K.issues.map(e=>({id:e.id,source:"DSM",severity:e.severity,elementId:e.elementId,elementName:e.elementName,message:e.message,tag:e.type==="unallocated-function"?"unallocated":e.type==="cross-component-flow"?"cross-boundary":"no functions"}))),()=>g([])},[K,g]);const be=a.useCallback(e=>{if(!e)return{};if(e.diagonal)return{text:String(e.strength),color:l.muted,background:"#E3E8EE"};const s=Ne(e),r=Math.min(.14+e.strength*.13,.55);return{text:String(e.strength),color:s,background:`${s}${Math.round(r*255).toString(16).padStart(2,"0")}`}},[]);if(!o||!d)return t.jsx("div",{className:"flex-1 flex items-center justify-center",style:{color:l.faint,fontSize:N.sm},children:"No model loaded"});const{stats:I}=d;return t.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",style:{background:"#F7F7F5"},children:[t.jsxs("div",{style:{borderBottom:`1px solid ${l.border}`,background:l.surface},children:[t.jsxs("div",{className:"flex items-center gap-3 px-4 py-2",style:{flexWrap:"wrap"},children:[t.jsx("span",{style:{fontSize:N.sm,fontWeight:600,color:l.primary},children:"Design Structure Matrix"}),t.jsxs("span",{style:{fontSize:"11px",color:l.faint},children:[d.rows.length," ","×"," ",d.columns.length," ","·"," ",d.totalDependencies," dependencies",I.internal>0&&` · ${I.internal} internal`]}),t.jsx("div",{className:"flex-1"}),t.jsx(te,{label:"Rows",layers:J,value:h,onChange:c,describedAs:"row scope",title:"What the rows list — one architecture layer, or one element type within it. An axis holds one semantic type so the marks between rows and columns can be read as a structure."}),t.jsx(B,{label:"of",allLabel:`all ${z.length}`,options:z,selected:f,onChange:S,width:110,describedAs:"row elements",placeholder:"Filter by name, kind or id…",title:"The individual elements listed down the side. Type to narrow; each word narrows further."}),t.jsx(te,{label:"Columns",layers:J,value:m,onChange:b,describedAs:"column scope",title:"What the columns list — one architecture layer, or one element type within it."}),t.jsx(B,{label:"of",allLabel:`all ${L.length}`,options:L,selected:y,onChange:n,width:110,describedAs:"column elements",placeholder:"Filter by name, kind or id…",title:"The individual elements listed across the top. Type to narrow; each word narrows further."}),t.jsx(B,{label:"Dependency",allLabel:"Any relationship",options:pe,width:140,selected:i,onChange:p,describedAs:"dependency relationships",title:"Relationships that put a mark in a cell — flow, trace, allocation, …"})]}),t.jsxs("div",{className:"flex items-center gap-3 px-4 pb-2",style:{flexWrap:"wrap"},children:[t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsx("button",{onClick:fe,style:U,title:"Expand every subsystem on both axes",children:"Expand all"}),t.jsx("button",{onClick:ge,style:U,title:"Collapse back to the top-level subsystems",children:"Collapse all"}),[1,2,3].map(e=>t.jsxs("button",{onClick:()=>ye(e),style:U,title:`Expand ${e} level${e>1?"s":""} deep`,children:["L",e]},e))]}),t.jsxs("label",{style:{...R,gap:"5px"},children:["Order",t.jsx("select",{value:A,onChange:e=>le(e.target.value),title:(Y=oe.find(e=>e.value===A))==null?void 0:Y.title,style:Te,children:oe.map(e=>t.jsx("option",{value:e.value,title:e.title,children:e.label},e.value))})]}),t.jsxs("label",{style:{...R,gap:"5px"},title:"Cell size",children:["Zoom",t.jsx("input",{type:"range",min:14,max:44,step:2,value:_,onChange:e=>ce(Number(e.target.value)),style:{width:"76px",accentColor:l.accent}})]}),t.jsxs(Re,{label:"Options",badge:Q>0?String(Q):void 0,title:"Settings you set once: how nesting is derived, how the axes are grouped, what the header shows",children:[t.jsx(B,{label:"Nesting",allLabel:"Auto (composition)",options:H,width:150,selected:k??[],onChange:e=>M(e.length===0?null:e),describedAs:"nesting relationships",title:"Relationships read as parent → child containment, which is what builds the tree"}),t.jsxs("label",{style:R,title:"Expanding a subsystem on one axis expands the same one on the other",children:[t.jsx("input",{type:"checkbox",checked:v,onChange:e=>de(e.target.checked),style:{accentColor:l.accent}}),"Linked axes"]}),t.jsxs("label",{style:R,title:"Show column names above the grid as well as their numbers",children:[t.jsx("input",{type:"checkbox",checked:G,onChange:e=>re(e.target.checked),style:{accentColor:l.accent}}),"Column names"]}),t.jsxs("label",{style:R,title:"Group top-level elements under their SysML package",children:[t.jsx("input",{type:"checkbox",checked:$,onChange:e=>ae(e.target.checked),style:{accentColor:l.accent}}),"Group by package"]}),t.jsxs("label",{style:R,title:"Count every dependency in both directions, making the matrix symmetric",children:[t.jsx("input",{type:"checkbox",checked:F,onChange:e=>ie(e.target.checked),style:{accentColor:l.accent}}),"Both directions"]})]}),t.jsx("div",{className:"flex-1"}),t.jsx("div",{style:{fontSize:"11px",color:l.muted,display:"flex",gap:"10px",whiteSpace:"nowrap"},children:[["feedback",I.feedback,"Marks below the diagonal — candidates for rework loops"],["coupled",I.couplings,"Pairs that depend on each other in both directions"],["isolated",I.isolated,"Lines with no dependency either way"],["max degree",I.maxDegree,"Most dependencies touching one line"]].map(([e,s,r])=>t.jsxs("span",{title:r,children:[t.jsx("strong",{style:{color:l.primary},children:s})," ",e]},e))})]})]}),t.jsx(Ee,{result:d,onToggleRow:he,onToggleColumn:xe,onSelectElement:x,selectedElementId:u,renderCell:be,onCellClick:(e,s,r)=>{r&&Z({row:e,column:s,cell:r}),x(e.node.id)},cellSize:_,showColumnNames:G,footer:t.jsxs("div",{style:{marginTop:"18px",display:"flex",gap:"14px",flexWrap:"wrap",fontSize:"11px",color:l.muted},children:[[...new Set(d.matrix.flat().flatMap(e=>(e==null?void 0:e.types)??[]))].sort().map(e=>t.jsxs("span",{style:{display:"flex",alignItems:"center",gap:"4px"},children:[t.jsx("span",{style:{width:"10px",height:"10px",borderRadius:"2px",background:T(e)}}),e]},e)),t.jsxs("span",{style:{display:"flex",alignItems:"center",gap:"4px"},children:[t.jsx("span",{style:{width:"10px",height:"10px",borderRadius:"2px",background:"#E3E8EE"}}),"diagonal: dependencies inside the subsystem"]}),t.jsxs("span",{style:{display:"flex",alignItems:"center",gap:"4px"},children:[t.jsx("span",{style:{width:"10px",height:"2px",background:"#94A3B8"}}),"subsystem boundary"]})]})}),w&&t.jsxs("div",{style:{position:"fixed",bottom:"76px",right:"20px",zIndex:100,width:"300px",padding:"12px 14px",borderRadius:"9px",background:l.surface,border:`1px solid ${l.border}`,boxShadow:"0 6px 22px rgba(0,0,0,0.14)",fontSize:N.xs},children:[t.jsxs("div",{className:"flex items-start justify-between gap-2",children:[t.jsxs("div",{style:{fontWeight:600,color:l.primary},children:[w.row.node.name," ","→"," ",w.column.node.name]}),t.jsx("button",{onClick:()=>Z(null),style:{color:l.faint,background:"none",border:"none",cursor:"pointer"},children:"✕"})]}),t.jsxs("div",{style:{color:l.muted,margin:"6px 0"},children:[w.cell.strength," dependenc",w.cell.strength===1?"y":"ies",w.cell.aggregated&&" · rolled up from collapsed parts",w.cell.diagonal&&" · internal to this subsystem"]}),t.jsx("div",{style:{display:"flex",gap:"4px",flexWrap:"wrap"},children:w.cell.types.map(e=>t.jsx("span",{style:{fontSize:"10px",padding:"2px 6px",borderRadius:"4px",background:`${T(e)}20`,color:T(e),fontWeight:500},children:e},e))}),w.cell.aggregated&&t.jsx("div",{style:{marginTop:"8px",fontSize:"11px",color:l.faint},children:"Expand both sides to see which parts are actually joined."})]})]})}function P(o,x){const u=new Set(o);return u.has(x)?u.delete(x):u.add(x),u}const U={padding:"3px 8px",borderRadius:"5px",border:`1px solid ${l.border}`,background:l.surface,fontSize:"11px",color:l.secondary,cursor:"pointer"},R={display:"flex",alignItems:"center",gap:"6px",fontSize:N.xs,color:l.muted,whiteSpace:"nowrap"},Te={border:`1px solid ${l.border}`,borderRadius:"5px",padding:"2px 5px",background:l.surface,fontSize:N.xs,color:l.primary};export{ze as DSMView};
@@ -1 +0,0 @@
1
- import{j as e}from"./reactflow-s7jmJtXx.js";import{a as f}from"./zustand-CrhqMOHB.js";import{u as g,h}from"./index-Bij8Q4Kg.js";function j(i,d,s){var u,l;const n=Object.values(i.elements),o={},t={};for(const r of n)o[r.layer]=(o[r.layer]||0)+1,t[r.kind.toLowerCase()]=(t[r.kind.toLowerCase()]||0)+1;const a={};for(const r of i.relationships)a[r.type.toLowerCase()]=(a[r.type.toLowerCase()]||0)+1;return{totalElements:n.length,totalRelationships:i.relationships.length,violations:d,completenessPercent:s,riskCount:(o.risk||0)+(o.analysis||0),requirementsCount:o.requirements||0,architectureCount:["logical","physical","functional","logical_structure","software_structure","hardware_structure","functions","interfaces","system","context","operational","behavior"].reduce((r,p)=>r+(o[p]||0),0),verificationCount:(o.verification||0)+(o.assurance||0),hazardCount:t.hazard||0,requirementCount:Object.entries(t).filter(([r])=>r.endsWith("requirement")).reduce((r,[,p])=>r+p,0),riskControlCount:t.riskcontrol||0,systemCount:(t.system||0)+(t.subsystem||0)+(t.softwaresystem||0)+(t.logicalcomponent||0)+(t.hardwareassembly||0)+(t.softwarecomponent||0)+(t.processingnode||0),testCount:(t.verificationcase||0)+(t.validationcase||0)+(t.testartifact||0)+(t.test||0),mitigatesCount:Object.entries(a).filter(([r])=>r.startsWith("mitigat")).reduce((r,[,p])=>r+p,0),verificationLinkCount:Object.entries(a).filter(([r])=>r.startsWith("verif")||r.startsWith("validate")||r==="testedbyusability").reduce((r,[,p])=>r+p,0),diagramCount:((u=i.diagrams)==null?void 0:u.length)??0,projectName:((l=i.metadata)==null?void 0:l.projectName)||i.projectName||i.name||"My Device Project"}}function k(i){return i.totalElements===0?{icon:"🚀",title:"Add your first model elements",description:"Start with intended use, actors, and a system requirement. Or use the Workflow Wizard to guide you step by step.",urgency:"high"}:i.requirementCount===0?{icon:"📋",title:"Define your first requirement",description:"Your model has elements but no system requirements yet. Add a Requirement in the Model Explorer.",urgency:"high"}:i.hazardCount===0?{icon:"⚠️",title:"Add your first hazard",description:`You have ${i.requirementCount} requirement(s) but no hazard analysis yet. ISO 14971 requires hazard identification early.`,urgency:"high"}:i.hazardCount>0&&i.mitigatesCount===0?{icon:"🔗",title:"Connect hazards to risk controls",description:`You have ${i.hazardCount} hazard(s) but no MitigatesHazard relationships. Connect hazards to risk controls to complete the ISO 14971 chain.`,urgency:"high"}:i.systemCount===0?{icon:"🏗️",title:"Define your system architecture",description:"No architecture components found (SoftwareSystem, LogicalComponent, HardwareAssembly, …). Add an architecture layer to ground your requirements and risk analysis.",urgency:"medium"}:i.testCount===0?{icon:"🧪",title:"Add verification tests",description:`${i.requirementCount} requirement(s) have no verification tests yet. Add VerificationCases and link them to requirements with VerifiedBy.`,urgency:"medium"}:i.verificationLinkCount===0&&i.testCount>0?{icon:"↔️",title:"Link tests to requirements",description:"Verification cases exist but no VerifiedBy links found. Open the Traceability Matrix to connect tests to their requirements.",urgency:"medium"}:{icon:"✅",title:"Good coverage so far",description:"Requirements, hazards, and risk controls are in place. Check the GapBar (⌘⇧P) for completeness gaps before your review.",urgency:"low"}}function m({label:i,value:d,color:s,subtitle:n}){return e.jsxs("div",{style:{background:"#FFFFFF",border:"1px solid #E5E5E0",borderRadius:"12px",padding:"20px 24px",display:"flex",flexDirection:"column",gap:"4px"},children:[e.jsx("div",{style:{fontSize:"28px",fontWeight:800,color:s,lineHeight:1},children:d}),e.jsx("div",{style:{fontSize:"12px",fontWeight:600,color:"#374151"},children:i}),n&&e.jsx("div",{style:{fontSize:"11px",color:"#9CA3AF"},children:n})]})}function y({layer:i,label:d,count:s,color:n,onClick:o}){const t=s>0;return e.jsxs("button",{onClick:o,style:{background:t?`${n}12`:"#F9FAFB",border:`1px solid ${t?n+"30":"#E5E5E0"}`,borderRadius:"12px",padding:"16px",cursor:"pointer",textAlign:"left",transition:"all 0.15s"},onMouseEnter:a=>{a.currentTarget.style.background=t?`${n}20`:"#F3F4F6",a.currentTarget.style.transform="translateY(-1px)",a.currentTarget.style.boxShadow="0 4px 12px rgba(0,0,0,0.08)"},onMouseLeave:a=>{a.currentTarget.style.background=t?`${n}12`:"#F9FAFB",a.currentTarget.style.transform="none",a.currentTarget.style.boxShadow="none"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"8px"},children:[e.jsx("span",{style:{fontSize:"11px",fontWeight:700,textTransform:"uppercase",letterSpacing:"0.06em",color:t?n:"#9CA3AF"},children:d}),e.jsxs("span",{style:{fontSize:"10px",fontWeight:600,padding:"2px 8px",borderRadius:"999px",background:t?n+"20":"#F3F4F6",color:t?n:"#9CA3AF"},children:[s," elements"]})]}),e.jsx("div",{style:{width:"100%",height:"4px",background:"#F3F4F6",borderRadius:"2px"},children:e.jsx("div",{style:{height:"100%",borderRadius:"2px",background:t?n:"transparent",width:t?`${Math.min(100,s/10*100)}%`:"0",transition:"width 0.4s ease"}})}),e.jsx("div",{style:{fontSize:"11px",color:"#9CA3AF",marginTop:"8px"},children:t?"Click to explore →":"Not started"})]})}function x({icon:i,label:d,onClick:s,variant:n="secondary"}){const o=n==="primary";return e.jsxs("button",{onClick:s,style:{display:"flex",alignItems:"center",gap:"8px",padding:"10px 16px",borderRadius:"8px",cursor:"pointer",fontSize:"13px",fontWeight:600,border:"none",background:o?"#1B3A4B":"rgba(255,255,255,0.7)",color:o?"#FFFFFF":"#374151",backdropFilter:"blur(4px)",transition:"all 0.15s"},onMouseEnter:t=>{t.currentTarget.style.background=o?"#244D63":"rgba(255,255,255,0.95)",t.currentTarget.style.boxShadow="0 2px 8px rgba(0,0,0,0.1)"},onMouseLeave:t=>{t.currentTarget.style.background=o?"#1B3A4B":"rgba(255,255,255,0.7)",t.currentTarget.style.boxShadow="none"},children:[e.jsx("span",{children:i}),e.jsx("span",{children:d})]})}function S(){var b;const i=g(c=>c.model),d=g(c=>c.validation),s=g(c=>c.completeness),n=g(c=>c.setActiveView),o=g(c=>c.setExplorerTab),t=g(c=>c.toggleGapBar),a=((b=d==null?void 0:d.violations)==null?void 0:b.length)??0,u=f.useMemo(()=>{if(typeof(s==null?void 0:s.overall)=="number")return Math.round(s.overall);if(!(s!=null&&s.layers)||s.layers.length===0)return 0;const c=s.layers.reduce((C,v)=>C+(v.completeness||0),0)/s.layers.length;return Math.round(c)},[s]),l=f.useMemo(()=>i?j(i,a,u):null,[i,a,u]),r=f.useMemo(()=>l?k(l):null,[l]);return!l||!i?e.jsx("div",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",background:"#F7F7F5"},children:e.jsx("div",{style:{fontSize:"13px",color:"#9CA3AF"},children:"Loading dashboard…"})}):e.jsx("div",{style:{flex:1,overflowY:"auto",background:"linear-gradient(135deg, #EEF7F3 0%, #EAF2F8 55%, #F2EEF8 100%)",padding:"32px 40px"},children:e.jsxs("div",{style:{maxWidth:"960px",margin:"0 auto"},children:[e.jsxs("div",{style:{marginBottom:"28px"},children:[e.jsxs("div",{style:{position:"relative",width:260,height:154,overflow:"hidden",margin:"0 auto -10px",opacity:.62},title:"MEMO Architect","aria-label":"MEMO Architect",children:[e.jsx("img",{src:"/logo.png",alt:"","aria-hidden":"true",style:{width:260,height:260,objectFit:"contain",transform:"translateY(-32px)",mixBlendMode:"multiply"}}),e.jsx("span",{style:{position:"absolute",left:"59%",top:115,color:"#8B949E",fontSize:20,fontWeight:600,letterSpacing:"0.02em",whiteSpace:"nowrap"},children:"Architect"})]}),e.jsxs("div",{children:[e.jsx("h1",{style:{fontSize:"22px",fontWeight:800,color:"#1B3A4B",margin:"0 0 4px 0"},children:l.projectName}),e.jsxs("p",{style:{fontSize:"13px",color:"#4B6E80",margin:0},children:["Model dashboard · ",new Date().toLocaleDateString("en-US",{month:"long",day:"numeric",year:"numeric"})]})]})]}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(4, 1fr)",gap:"12px",marginBottom:"24px"},children:[e.jsx(m,{label:"Elements",value:l.totalElements,color:"#1B3A4B"}),e.jsx(m,{label:"Relationships",value:l.totalRelationships,color:"#4A90D9"}),e.jsx(m,{label:"Completeness",value:`${u}%`,color:u>=70?"#2ECC71":u>=40?"#F39C12":"#E74C3C"}),e.jsx(m,{label:"Violations",value:a,color:a===0?"#2ECC71":"#E74C3C",subtitle:a===0?"All rules passing":"Open the GapBar"})]}),e.jsxs("div",{style:{marginBottom:"24px"},children:[e.jsx("h2",{style:{fontSize:"11px",fontWeight:700,textTransform:"uppercase",letterSpacing:"0.08em",color:"#7A9BAA",margin:"0 0 12px 0"},children:"Layer Coverage"}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(4, 1fr)",gap:"12px"},children:[e.jsx(y,{layer:"requirements",label:"Requirements",count:l.requirementsCount,color:h.requirements,onClick:()=>{o("model"),n({type:"welcome"})}}),e.jsx(y,{layer:"risk",label:"Risk",count:l.riskCount,color:h.risk,onClick:()=>{o("model"),n({type:"welcome"})}}),e.jsx(y,{layer:"logical",label:"Architecture",count:l.architectureCount,color:h.logical,onClick:()=>{o("views"),n({type:"welcome"})}}),e.jsx(y,{layer:"verification",label:"Verification",count:l.verificationCount,color:h.verification,onClick:()=>n({type:"traceability"})})]})]}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"16px",marginBottom:"24px"},children:[r&&e.jsxs("div",{style:{background:r.urgency==="high"?"rgba(231,76,60,0.06)":r.urgency==="medium"?"rgba(243,156,18,0.06)":"rgba(46,204,113,0.06)",border:`1px solid ${r.urgency==="high"?"#E74C3C30":r.urgency==="medium"?"#F39C1230":"#2ECC7130"}`,borderRadius:"12px",padding:"20px"},children:[e.jsx("div",{style:{fontSize:"11px",fontWeight:700,textTransform:"uppercase",letterSpacing:"0.08em",color:"#7A9BAA",marginBottom:"10px"},children:"💡 Suggested Next Step"}),e.jsx("div",{style:{fontSize:"16px",marginBottom:"6px"},children:r.icon}),e.jsx("div",{style:{fontSize:"14px",fontWeight:700,color:"#1B3A4B",marginBottom:"6px"},children:r.title}),e.jsx("div",{style:{fontSize:"12px",color:"#4B6E80",lineHeight:"1.6"},children:r.description}),r.urgency!=="low"&&e.jsx("button",{onClick:()=>n({type:"workflow-wizard"}),style:{marginTop:"14px",padding:"8px 14px",fontSize:"12px",fontWeight:600,background:"#1B3A4B",color:"#FFFFFF",border:"none",borderRadius:"6px",cursor:"pointer"},onMouseEnter:c=>c.currentTarget.style.background="#244D63",onMouseLeave:c=>c.currentTarget.style.background="#1B3A4B",children:"Open Workflow Wizard →"})]}),e.jsxs("div",{style:{background:"rgba(255,255,255,0.6)",border:"1px solid rgba(255,255,255,0.9)",borderRadius:"12px",padding:"20px",backdropFilter:"blur(4px)"},children:[e.jsx("div",{style:{fontSize:"11px",fontWeight:700,textTransform:"uppercase",letterSpacing:"0.08em",color:"#7A9BAA",marginBottom:"14px"},children:"Quick Actions"}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"8px"},children:[e.jsx(x,{icon:"🗂️",label:"Browse Model",onClick:()=>{o("model")}}),e.jsx(x,{icon:"📊",label:"Open Viewpoints",onClick:()=>o("views")}),e.jsx(x,{icon:"↔️",label:"Traceability Matrix",onClick:()=>n({type:"traceability"})}),e.jsx(x,{icon:"📋",label:"First Review Dashboard",onClick:()=>n({type:"review-dashboard"})}),e.jsx(x,{icon:"✅",label:"Check Completeness",onClick:()=>t()}),e.jsx(x,{icon:"📈",label:"Full Statistics",onClick:()=>n({type:"statistics"})})]})]})]}),l.diagramCount>0&&e.jsx("div",{style:{background:"rgba(255,255,255,0.6)",border:"1px solid rgba(255,255,255,0.9)",borderRadius:"12px",padding:"16px 20px",backdropFilter:"blur(4px)"},children:e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[e.jsxs("div",{style:{fontSize:"13px",fontWeight:600,color:"#374151"},children:[l.diagramCount," model view",l.diagramCount!==1?"s":""," in this project"]}),e.jsx("button",{onClick:()=>o("views"),style:{fontSize:"12px",color:"#4A90D9",background:"none",border:"none",cursor:"pointer",fontWeight:600},children:"Browse viewpoints →"})]})})]})})}export{S as Dashboard};
@@ -1 +0,0 @@
1
- import{j as e}from"./reactflow-s7jmJtXx.js";import{a as m}from"./zustand-CrhqMOHB.js";import{u as b}from"./index-Bij8Q4Kg.js";const h=[{id:"rmp",title:"Risk Management Plan",standards:["ISO 14971:2019 §4.4"],layers:["risk"],relevantKinds:["Hazard","HazardousSituation","Harm","RiskControlMeasure","RiskAcceptabilityCriteria"],group:"risk"},{id:"har",title:"Hazard Analysis Report",standards:["ISO 14971:2019 §5","ISO 14971:2019 §6"],layers:["risk"],relevantKinds:["Hazard","HazardousSituation","Harm","RiskControlMeasure"],group:"risk"},{id:"fmea",title:"Failure Mode and Effects Analysis",standards:["IEC 60812:2018"],layers:["risk","functional","physical"],relevantKinds:["Hazard","RiskControlMeasure","Function","Component","Subsystem"],group:"risk"},{id:"rtm",title:"Requirements Traceability Matrix",standards:["IEC 62304:2006 §5.1.1"],layers:["requirements","functional","verification"],relevantKinds:["Requirement","Requirement","DesignInput","DesignOutput","TestCase","VerificationActivity"],group:"design"},{id:"sad",title:"System Architecture Description",standards:["ISO/IEC/IEEE 42010:2022"],layers:["functional","logical","physical","software","interfaces"],relevantKinds:["Function","Component","Subsystem","Interface","Port","SoftwareItem","SOUPComponent"],group:"design"},{id:"sds",title:"Software Design Specification",standards:["IEC 62304:2006 §5.4"],layers:["software"],relevantKinds:["SoftwareItem","SoftwareUnit","SoftwareSystem","SOUPComponent","Interface"],group:"design"},{id:"soup",title:"SOUP List",standards:["IEC 62304:2006 §8.1.2"],layers:["software"],relevantKinds:["SOUPComponent"],group:"design"},{id:"dip",title:"Design Input Plan",standards:["ISO 13485:2016 §7.3.3"],layers:["requirements","business"],relevantKinds:["DesignInput","Requirement","Need","UseCase"],group:"design"},{id:"dop",title:"Design Output Plan",standards:["ISO 13485:2016 §7.3.4"],layers:["functional","physical","software"],relevantKinds:["DesignOutput","Component","SoftwareItem","Function"],group:"design"},{id:"vvp",title:"Verification & Validation Plan",standards:["ISO 13485:2016 §7.3.6"],layers:["verification"],relevantKinds:["TestCase","VerificationActivity","ValidationActivity","TestProtocol"],group:"verification"},{id:"vvr",title:"Verification & Validation Report",standards:["ISO 13485:2016 §7.3.7"],layers:["verification"],relevantKinds:["TestCase","VerificationActivity","ValidationActivity","TestResult"],group:"verification"},{id:"sdp",title:"Software Development Plan",standards:["IEC 62304:2006 §5.1"],layers:["software","verification"],relevantKinds:["SoftwareItem","SoftwareUnit","SoftwareSystem","TestCase"],group:"compliance"},{id:"csr",title:"Clinical Safety Report",standards:["ISO 14971:2019 §10"],layers:["risk","verification"],relevantKinds:["Hazard","RiskControlMeasure","ClinicalEvidence","ValidationActivity"],group:"compliance"},{id:"uer",title:"Usability Engineering Report",standards:["IEC 62366-1:2015"],layers:["ui","requirements"],relevantKinds:["UseCase","UserActivity","UserInterface","UsabilityRequirement"],group:"compliance"},{id:"cybersecurity",title:"Cybersecurity Documentation",standards:["IEC 81001-5-1:2021"],layers:["software","interfaces"],relevantKinds:["ThreatModel","SecurityControl","Interface","SOUPComponent"],group:"compliance"},{id:"labeling",title:"Labeling Specification",standards:["21 CFR 801"],layers:["requirements","ui"],relevantKinds:["LabelingRequirement","Requirement"],group:"compliance"},{id:"dhf-index",title:"Design History File Index",standards:["ISO 13485:2016 §4.2.4"],layers:[],relevantKinds:[],group:"all"},{id:"change-log",title:"Design Change Log",standards:["ISO 13485:2016 §7.3.9"],layers:[],relevantKinds:[],group:"all"}],j={risk:"Risk Management",design:"Design & Architecture",verification:"Verification & Validation",compliance:"Compliance & Standards",all:"General"},v={risk:"#E74C3C",design:"#4A90D9",verification:"#2ECC71",compliance:"#8E44AD",all:"#6B7280"};function B(n,i,o){const l=Object.values(i.elements).filter(s=>n.relevantKinds.includes(s.kind)),c=((o==null?void 0:o.violations)||[]).filter(s=>n.relevantKinds.includes(s.elementKind)||n.layers.includes(s.layer)),a=c.filter(s=>s.severity==="error").length;return{elementCount:l.length,gapCount:a,status:l.length===0?"empty":a===0?"complete":"partial",violations:c}}function z(){const n=b(t=>t.model),i=b(t=>t.validation),o=b(t=>t.completeness),[l,c]=m.useState(null),[a,s]=m.useState(null),r=m.useMemo(()=>{if(!n)return new Map;const t=new Map;for(const d of h)t.set(d.id,B(d,n,i));return t},[n,i]),x=m.useMemo(()=>a?h.filter(t=>t.group===a||t.group==="all"):h,[a]),g=m.useMemo(()=>{const t=new Map;for(const d of x){const p=d.group;t.has(p)||t.set(p,[]),t.get(p).push(d)}return t},[x]),f=m.useMemo(()=>{let t=0,d=0,p=0;for(const y of r.values())y.status==="complete"?t++:y.status==="partial"?d++:p++;return{complete:t,partial:d,empty:p,total:h.length}},[r]);if(!n)return e.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",height:"100%",color:"#9CA3AF"},children:"Waiting for model data..."});const C=l?h.find(t=>t.id===l):null,A=l?r.get(l):null;return e.jsxs("div",{style:{height:"100%",overflow:"auto",background:"#F7F7F5",padding:"24px"},children:[e.jsxs("div",{style:{marginBottom:"24px"},children:[e.jsx("h2",{style:{fontSize:"20px",fontWeight:700,color:"#1B3A4B",margin:0},children:"Documents"}),e.jsxs("p",{style:{color:"#6B7280",fontSize:"13px",marginTop:"4px"},children:["Design history file · ",f.total," documents | ",f.complete," complete | ",f.partial," partial | ",f.empty," empty",o&&` | Overall completeness: ${o.overall}%`]})]}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(140px, 1fr))",gap:"12px",marginBottom:"24px"},children:[e.jsx(u,{label:"Complete",value:f.complete,color:"#059669"}),e.jsx(u,{label:"Partial",value:f.partial,color:"#d97706"}),e.jsx(u,{label:"Empty",value:f.empty,color:"#dc2626"}),e.jsx(u,{label:"Completeness",value:`${(o==null?void 0:o.overall)||0}%`,color:"#2563eb"})]}),e.jsxs("div",{style:{display:"flex",gap:"8px",marginBottom:"20px",flexWrap:"wrap"},children:[e.jsx(S,{label:"All",active:!a,onClick:()=>s(null)}),Object.entries(j).filter(([t])=>t!=="all").map(([t,d])=>e.jsx(S,{label:d,active:a===t,onClick:()=>s(a===t?null:t),color:v[t]},t))]}),l?e.jsx(w,{doc:C,status:A,model:n,validation:i,onBack:()=>c(null)}):Array.from(g.entries()).map(([t,d])=>e.jsxs("div",{style:{marginBottom:"24px"},children:[e.jsxs("h3",{style:{fontSize:"14px",fontWeight:600,color:v[t]||"#374151",marginBottom:"12px",display:"flex",alignItems:"center",gap:"8px"},children:[e.jsx("span",{style:{width:"8px",height:"8px",borderRadius:"50%",background:v[t]||"#6B7280",display:"inline-block"}}),j[t]||t]}),e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(280px, 1fr))",gap:"12px"},children:d.map(p=>{const y=r.get(p.id);return e.jsx(k,{doc:p,status:y,onClick:()=>c(p.id)},p.id)})})]},t))]})}function u({label:n,value:i,color:o}){return e.jsxs("div",{style:{background:"#fff",border:"1px solid #e5e7eb",borderRadius:"8px",padding:"14px 16px",textAlign:"center"},children:[e.jsx("div",{style:{fontSize:"24px",fontWeight:700,color:o},children:i}),e.jsx("div",{style:{fontSize:"11px",color:"#6B7280",marginTop:"2px"},children:n})]})}function S({label:n,active:i,onClick:o,color:l}){return e.jsx("button",{onClick:o,style:{padding:"4px 12px",borderRadius:"16px",fontSize:"12px",fontWeight:500,border:`1px solid ${i?l||"#2DD4A8":"#e5e7eb"}`,background:i?(l||"#2DD4A8")+"15":"#fff",color:i?l||"#1B3A4B":"#6B7280",cursor:"pointer"},children:n})}function k({doc:n,status:i,onClick:o}){const l=i.status==="complete"?"#059669":i.status==="partial"?"#d97706":"#dc2626",c=i.status==="complete"?"#ecfdf5":i.status==="partial"?"#fffbeb":"#fef2f2",a=i.status==="complete"?"Complete":i.status==="partial"?"Partial":"Empty";return e.jsxs("div",{onClick:o,style:{background:"#fff",border:"1px solid #e5e7eb",borderRadius:"8px",padding:"16px",cursor:"pointer",transition:"border-color 0.15s, box-shadow 0.15s"},onMouseEnter:s=>{s.currentTarget.style.borderColor="#2DD4A8",s.currentTarget.style.boxShadow="0 2px 8px rgba(0,0,0,0.06)"},onMouseLeave:s=>{s.currentTarget.style.borderColor="#e5e7eb",s.currentTarget.style.boxShadow="none"},children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",marginBottom:"8px"},children:[e.jsx("span",{style:{fontSize:"11px",fontWeight:600,color:"#6B7280",fontFamily:"monospace"},children:n.id.toUpperCase()}),e.jsx("span",{style:{fontSize:"10px",fontWeight:600,padding:"2px 6px",borderRadius:"4px",background:c,color:l},children:a})]}),e.jsx("div",{style:{fontSize:"14px",fontWeight:600,color:"#1B3A4B",marginBottom:"6px"},children:n.title}),e.jsx("div",{style:{fontSize:"11px",color:"#9CA3AF",marginBottom:"8px"},children:n.standards[0]}),e.jsxs("div",{style:{display:"flex",gap:"16px",fontSize:"12px",color:"#6B7280"},children:[e.jsxs("span",{children:[i.elementCount," elements"]}),i.gapCount>0&&e.jsxs("span",{style:{color:"#dc2626"},children:[i.gapCount," gaps"]})]})]})}function w({doc:n,status:i,model:o,validation:l,onBack:c}){const a=Object.values(o.elements).filter(r=>n.relevantKinds.includes(r.kind)),s=new Map;for(const r of a)s.has(r.kind)||s.set(r.kind,[]),s.get(r.kind).push(r);return e.jsxs("div",{children:[e.jsxs("div",{style:{marginBottom:"20px"},children:[e.jsx("button",{onClick:c,style:{background:"none",border:"none",color:"#2563eb",cursor:"pointer",fontSize:"13px",padding:0,marginBottom:"8px"},children:"← Back to dashboard"}),e.jsx("h3",{style:{fontSize:"18px",fontWeight:700,color:"#1B3A4B",margin:0},children:n.title}),e.jsxs("p",{style:{color:"#6B7280",fontSize:"12px",marginTop:"4px"},children:[n.id.toUpperCase()," | ",n.standards.join(", ")]})]}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(120px, 1fr))",gap:"12px",marginBottom:"20px"},children:[e.jsx(u,{label:"Elements",value:i.elementCount,color:"#2563eb"}),e.jsx(u,{label:"Gaps",value:i.gapCount,color:i.gapCount>0?"#dc2626":"#059669"}),e.jsx(u,{label:"Status",value:i.status,color:i.status==="complete"?"#059669":i.status==="partial"?"#d97706":"#dc2626"})]}),Array.from(s.entries()).sort().map(([r,x])=>e.jsxs("div",{style:{marginBottom:"16px"},children:[e.jsxs("h4",{style:{fontSize:"13px",fontWeight:600,color:"#374151",marginBottom:"8px"},children:[r," (",x.length,")"]}),e.jsxs("div",{style:{background:"#fff",border:"1px solid #e5e7eb",borderRadius:"6px",overflow:"hidden"},children:[e.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:"12px"},children:[e.jsx("thead",{children:e.jsxs("tr",{style:{background:"#f3f4f6"},children:[e.jsx("th",{style:{padding:"6px 10px",textAlign:"left",fontWeight:600,color:"#374151"},children:"Name"}),e.jsx("th",{style:{padding:"6px 10px",textAlign:"left",fontWeight:600,color:"#374151"},children:"Layer"}),e.jsx("th",{style:{padding:"6px 10px",textAlign:"left",fontWeight:600,color:"#374151"},children:"Description"})]})}),e.jsx("tbody",{children:x.slice(0,50).map(g=>e.jsxs("tr",{style:{borderTop:"1px solid #e5e7eb"},children:[e.jsx("td",{style:{padding:"6px 10px",color:"#2563eb",fontWeight:500},children:g.name}),e.jsx("td",{style:{padding:"6px 10px",color:"#6B7280"},children:g.layer}),e.jsx("td",{style:{padding:"6px 10px",color:"#6B7280",maxWidth:"300px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:g.doc||"—"})]},g.id))})]}),x.length>50&&e.jsxs("div",{style:{padding:"8px 10px",fontSize:"11px",color:"#9CA3AF",background:"#f9fafb"},children:["...and ",x.length-50," more"]})]})]},r)),i.violations.length>0&&e.jsxs("div",{style:{marginBottom:"16px"},children:[e.jsxs("h4",{style:{fontSize:"13px",fontWeight:600,color:"#dc2626",marginBottom:"8px"},children:["Validation Issues (",i.violations.length,")"]}),e.jsx("div",{style:{background:"#fff",border:"1px solid #e5e7eb",borderRadius:"6px",overflow:"hidden"},children:e.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:"12px"},children:[e.jsx("thead",{children:e.jsxs("tr",{style:{background:"#f3f4f6"},children:[e.jsx("th",{style:{padding:"6px 10px",textAlign:"left",fontWeight:600},children:"Severity"}),e.jsx("th",{style:{padding:"6px 10px",textAlign:"left",fontWeight:600},children:"Rule"}),e.jsx("th",{style:{padding:"6px 10px",textAlign:"left",fontWeight:600},children:"Element"}),e.jsx("th",{style:{padding:"6px 10px",textAlign:"left",fontWeight:600},children:"Description"})]})}),e.jsx("tbody",{children:i.violations.slice(0,50).map((r,x)=>e.jsxs("tr",{style:{borderTop:"1px solid #e5e7eb"},children:[e.jsx("td",{style:{padding:"6px 10px"},children:e.jsx("span",{style:{fontSize:"10px",fontWeight:600,padding:"1px 6px",borderRadius:"3px",background:r.severity==="error"?"#fef2f2":"#fffbeb",color:r.severity==="error"?"#dc2626":"#d97706"},children:r.severity})}),e.jsx("td",{style:{padding:"6px 10px",color:"#6B7280",fontFamily:"monospace",fontSize:"11px"},children:r.ruleId}),e.jsx("td",{style:{padding:"6px 10px",color:"#2563eb"},children:r.elementName}),e.jsx("td",{style:{padding:"6px 10px",color:"#6B7280"},children:r.description})]},x))})]})})]}),a.length===0&&e.jsxs("div",{style:{padding:"40px",textAlign:"center",color:"#9CA3AF",background:"#fff",border:"1px solid #e5e7eb",borderRadius:"8px"},children:[e.jsx("p",{style:{fontSize:"14px",marginBottom:"4px"},children:"No model elements found for this document type."}),e.jsxs("p",{style:{fontSize:"12px"},children:["Add elements of kinds: ",n.relevantKinds.join(", ")]})]})]})}export{z as DhfDashboard};