@memoarchitect/architect 0.6.5 → 0.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +45 -4
- package/dist/assets/AiWorkspace-Bu9TlIWg.js +7 -0
- package/dist/assets/AnalysisWorkspace-CodmoI-v.js +39 -0
- package/dist/assets/{ComplianceWizard-DWolzleI.js → ComplianceWizard-CTihkUi-.js} +1 -1
- package/dist/assets/DSMView-BiC845df.js +1 -0
- package/dist/assets/Dashboard-CgnNLhKq.js +1 -0
- package/dist/assets/{DhfDashboard-D9JxRAbD.js → DhfDashboard-w-dJoJHU.js} +1 -1
- package/dist/assets/{DhfWorkbench-BQv2WQ9o.js → DhfWorkbench-o6B_MT-0.js} +15 -15
- package/dist/assets/DiagramCanvas-CqGqDbgT.js +3 -0
- package/dist/assets/DiagramEditor-UJDHcAUF.js +4 -0
- package/dist/assets/DiagramToolbarControls-B2gZFJlg.js +1 -0
- package/dist/assets/ElementDetailView-10U0rr33.js +2 -0
- package/dist/assets/ExplorerTreeRow-DqhF_qoO.js +3 -0
- package/dist/assets/{ImportView-33dFwj6A.js → ImportView-D8svP04Q.js} +1 -1
- package/dist/assets/{LayerGrid-B3MBWswK.js → LayerGrid-DEe0Ryz-.js} +1 -1
- package/dist/assets/{LayerTable-DyIzIt5M.js → LayerTable-CN_b2rDr.js} +2 -2
- package/dist/assets/{MaxGraphCanvas-BS5wYazZ.js → MaxGraphCanvas-bo8oPBct.js} +6 -6
- package/dist/assets/{ModelDiff-BoFREnpg.js → ModelDiff-xe95oVua.js} +1 -1
- package/dist/assets/{OntologyDecompositionDiagram-IG1gj1c3.js → OntologyDecompositionDiagram-BL9R8bdB.js} +1 -1
- package/dist/assets/{OntologyViewer-CQTEg-GI.js → OntologyViewer-CtqNkkCn.js} +2 -2
- package/dist/assets/{RelationshipOverlay-B9bqt4zl.js → RelationshipOverlay-DL0N8Vmk.js} +1 -1
- package/dist/assets/{RelationshipsSection-DttMvF2i.js → RelationshipsSection-BoJ0aUXe.js} +1 -1
- package/dist/assets/{ReviewDashboard-BJ_smBGS.js → ReviewDashboard-DeTge2oC.js} +1 -1
- package/dist/assets/ScenarioEditor-FAEYTHgP.js +3 -0
- package/dist/assets/{StatisticsDashboard-CBYJGUPH.js → StatisticsDashboard-BAZRqIPN.js} +1 -1
- package/dist/assets/{SysmlCodeEditor-Die2RUsz.js → SysmlCodeEditor-BBfup_Ni.js} +1 -1
- package/dist/assets/TabularView-I4LjHhoH.js +1 -0
- package/dist/assets/TraceabilityMatrix-DbrvjqLN.js +3 -0
- package/dist/assets/UiScreensWorkspace-DDD_PyJs.js +1 -0
- package/dist/assets/{WorkflowWizard-CbkDyd1W.js → WorkflowWizard-VwpEHt3R.js} +1 -1
- package/dist/assets/element-options-B7AgTB8R.js +3 -0
- package/dist/assets/html2canvas.esm-QH1iLAAe.js +22 -0
- package/dist/assets/index-BWMNo4wW.css +1 -0
- package/dist/assets/index-Bij8Q4Kg.js +45 -0
- package/dist/assets/index.es-ClbJxlAQ.js +18 -0
- package/dist/assets/jspdf.es.min-DZ68BGxk.js +170 -0
- package/dist/assets/notation-scene-DT8LpWVK.js +1 -0
- package/dist/assets/purify.es-DP5U8-sc.js +3 -0
- package/dist/assets/{reactflow-CsCqNKB-.js → reactflow-s7jmJtXx.js} +5 -5
- package/dist/index.html +3 -3
- package/lib/__tests__/compiler-bundling.test.d.ts +2 -0
- package/lib/__tests__/compiler-bundling.test.d.ts.map +1 -0
- package/lib/__tests__/compiler-bundling.test.js +32 -0
- package/lib/__tests__/compiler-bundling.test.js.map +1 -0
- package/lib/__tests__/standard-sysml-diagrams-smoke.test.d.ts +2 -0
- package/lib/__tests__/standard-sysml-diagrams-smoke.test.d.ts.map +1 -0
- package/lib/__tests__/standard-sysml-diagrams-smoke.test.js +22 -0
- package/lib/__tests__/standard-sysml-diagrams-smoke.test.js.map +1 -0
- package/lib/__tests__/supervised-child-args.test.d.ts +2 -0
- package/lib/__tests__/supervised-child-args.test.d.ts.map +1 -0
- package/lib/__tests__/supervised-child-args.test.js +35 -0
- package/lib/__tests__/supervised-child-args.test.js.map +1 -0
- package/lib/bin/memo-architect.js +30 -4
- package/lib/bin/memo-architect.js.map +1 -1
- package/lib/commands/dev.d.ts +18 -2
- package/lib/commands/dev.d.ts.map +1 -1
- package/lib/commands/dev.js +56 -8
- package/lib/commands/dev.js.map +1 -1
- package/lib/commands/example.d.ts +1 -0
- package/lib/commands/example.d.ts.map +1 -1
- package/lib/commands/example.js +2 -0
- package/lib/commands/example.js.map +1 -1
- package/lib/feature-grants.d.ts.map +1 -1
- package/lib/feature-grants.js +2 -2
- package/lib/feature-grants.js.map +1 -1
- package/package.json +12 -6
- package/dist/assets/AiWorkspace-DHZ6a9HJ.js +0 -3
- package/dist/assets/DSMView-TdC3EADB.js +0 -1
- package/dist/assets/Dashboard-DBfAOCJv.js +0 -1
- package/dist/assets/DhfSettingsPanel-Firov0IF.js +0 -1
- package/dist/assets/DiagramCanvas-BfwO8YE5.js +0 -1
- package/dist/assets/DiagramEditor-Cp9ORYoN.js +0 -4
- package/dist/assets/ElementDetailView-DOrG8v7V.js +0 -2
- package/dist/assets/ScenarioEditor-D06nbX4h.js +0 -3
- package/dist/assets/TabularView-BLzDtgmK.js +0 -1
- package/dist/assets/TraceabilityMatrix-DbL_FkAC.js +0 -1
- package/dist/assets/index-B8HDzVLs.css +0 -1
- package/dist/assets/index-D0vtjNjX.js +0 -3280
- package/dist/assets/layout-selection-DIQaaOIC.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e}from"./reactflow-
|
|
1
|
+
import{j as e}from"./reactflow-s7jmJtXx.js";import{a as y}from"./zustand-CrhqMOHB.js";import{u as F,h as j}from"./index-Bij8Q4Kg.js";function N(l,u){const o=[],i=[],m=[],g=new Set(Object.keys(l.elements)),x=new Set(Object.keys(u.elements));for(const a of x)g.has(a)||o.push(u.elements[a]);for(const a of g)x.has(a)||i.push(l.elements[a]);for(const a of g){if(!x.has(a))continue;const p=l.elements[a],t=u.elements[a],c=[];p.name!==t.name&&c.push(`name: "${p.name}" → "${t.name}"`),p.kind!==t.kind&&c.push(`kind: ${p.kind} → ${t.kind}`),p.layer!==t.layer&&c.push(`layer: ${p.layer} → ${t.layer}`),p.doc!==t.doc&&c.push("doc changed");const s=JSON.stringify(p.attributes),n=JSON.stringify(t.attributes);s!==n&&c.push("attributes changed"),c.length>0&&m.push({element:t,changes:c})}const v=new Set(l.relationships.map(a=>a.id)),h=new Set(u.relationships.map(a=>a.id)),f=u.relationships.filter(a=>!v.has(a.id)),d=l.relationships.filter(a=>!h.has(a.id));return{added:o,removed:i,changed:m,addedRels:f,removedRels:d,summary:{added:o.length,removed:i.length,changed:m.length,addedRels:f.length,removedRels:d.length}}}function A(){const l=F(s=>s.model),u=F(s=>s.selectElement),[o,i]=y.useState(null),[m,g]=y.useState(""),[x,v]=y.useState([]),[h,f]=y.useState(null),[d,a]=y.useState("all"),p=y.useCallback(()=>{if(!l)return;const s=m.trim()||`Snapshot ${x.length+1}`;v(n=>[...n,{name:s,model:JSON.parse(JSON.stringify(l)),timestamp:Date.now()}]),g("")},[l,m,x.length]);y.useEffect(()=>{h!==null&&x[h]&&i(x[h].model)},[h,x]);const t=y.useMemo(()=>!o||!l?null:N(o,l),[o,l]),c=t?t.summary.added+t.summary.removed+t.summary.changed:0;return e.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[e.jsxs("div",{className:"w-64 flex flex-col overflow-hidden",style:{background:"#FFFFFF",borderRight:"1px solid #E5E5E0"},children:[e.jsxs("div",{className:"px-4 py-3",style:{background:"linear-gradient(135deg, #1B3A4B, #2D6A7A)"},children:[e.jsx("h2",{className:"text-sm font-bold tracking-wide",style:{color:"#2DD4A8"},children:"Model Diff"}),e.jsx("p",{className:"text-xs mt-0.5",style:{color:"rgba(255,255,255,0.6)"},children:"Compare model states"})]}),e.jsx("div",{className:"px-3 py-2.5",style:{borderBottom:"1px solid #E5E5E0"},children:e.jsxs("div",{className:"flex gap-1",children:[e.jsx("input",{type:"text",value:m,onChange:s=>g(s.target.value),placeholder:"Snapshot name...",className:"flex-1 text-xs px-2 py-1.5 rounded focus:outline-none",style:{background:"#F7F7F5",border:"1px solid #E5E5E0",color:"#1a1a1a"},onKeyDown:s=>s.key==="Enter"&&p()}),e.jsx("button",{onClick:p,className:"px-2 py-1.5 text-xs rounded font-medium",style:{background:"#2DD4A8",color:"#FFFFFF"},children:"Snap"})]})}),e.jsxs("div",{className:"flex-1 overflow-y-auto text-xs py-1",children:[x.length===0&&e.jsx("div",{className:"px-4 py-8 text-center",style:{color:"#9CA3AF"},children:"Take a snapshot to create a baseline for comparison."}),x.map((s,n)=>e.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 cursor-pointer mx-1 rounded-lg",style:{background:h===n?"#2DD4A818":"transparent",fontWeight:h===n?500:400},onMouseEnter:r=>{h!==n&&(r.currentTarget.style.background="#F0F0ED")},onMouseLeave:r=>{h!==n&&(r.currentTarget.style.background=h===n?"#2DD4A818":"transparent")},onClick:()=>f(n),children:[e.jsx("span",{className:"w-2 h-2 rounded-full flex-shrink-0",style:{background:"#2DD4A8"}}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"truncate",style:{color:"#374151"},children:s.name}),e.jsxs("div",{style:{color:"#9CA3AF",fontSize:"10px"},children:[new Date(s.timestamp).toLocaleTimeString()," · ",Object.keys(s.model.elements).length," elements"]})]})]},n))]})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto p-6",style:{background:"#F7F7F5"},children:[!t&&e.jsx("div",{className:"flex items-center justify-center h-full",style:{color:"#9CA3AF"},children:e.jsxs("div",{className:"text-center",children:[e.jsx("div",{style:{fontSize:"32px",marginBottom:"8px",opacity:.5},children:"↔"}),e.jsx("div",{className:"text-sm",children:"Take a snapshot, then make changes to see the diff"}),e.jsx("div",{className:"text-xs mt-2",style:{color:"#D1D5DB"},children:"Snapshots capture the current model state for comparison"})]})}),t&&e.jsxs("div",{className:"max-w-3xl",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[e.jsx("h2",{className:"text-sm font-semibold",style:{color:"#374151"},children:c===0?"No changes":`${c} element changes`}),t.summary.addedRels+t.summary.removedRels>0&&e.jsxs("span",{className:"text-xs",style:{color:"#9CA3AF"},children:["+ ",t.summary.addedRels+t.summary.removedRels," relationship changes"]})]}),e.jsx("div",{className:"flex gap-2 mb-4",children:[{key:"all",label:"All",count:c,color:"#6B7280"},{key:"added",label:"Added",count:t.summary.added,color:"#2ECC71"},{key:"removed",label:"Removed",count:t.summary.removed,color:"#E74C3C"},{key:"changed",label:"Changed",count:t.summary.changed,color:"#F39C12"}].map(s=>e.jsxs("button",{onClick:()=>a(s.key),className:"px-2.5 py-1 text-xs rounded-full font-medium",style:{background:d===s.key?s.color+"20":"#F3F4F6",color:d===s.key?s.color:"#9CA3AF",border:`1px solid ${d===s.key?s.color+"40":"#E5E5E0"}`},children:[s.label," (",s.count,")"]},s.key))}),(d==="all"||d==="added")&&t.added.length>0&&e.jsxs("div",{className:"mb-4",children:[e.jsxs("h3",{className:"text-xs font-semibold uppercase tracking-wider mb-2",style:{color:"#2ECC71"},children:["Added (",t.added.length,")"]}),e.jsx("div",{className:"space-y-1",children:t.added.map(s=>e.jsx(b,{element:s,type:"added",onClick:()=>u(s.id)},s.id))})]}),(d==="all"||d==="removed")&&t.removed.length>0&&e.jsxs("div",{className:"mb-4",children:[e.jsxs("h3",{className:"text-xs font-semibold uppercase tracking-wider mb-2",style:{color:"#E74C3C"},children:["Removed (",t.removed.length,")"]}),e.jsx("div",{className:"space-y-1",children:t.removed.map(s=>e.jsx(b,{element:s,type:"removed",onClick:()=>{}},s.id))})]}),(d==="all"||d==="changed")&&t.changed.length>0&&e.jsxs("div",{className:"mb-4",children:[e.jsxs("h3",{className:"text-xs font-semibold uppercase tracking-wider mb-2",style:{color:"#F39C12"},children:["Changed (",t.changed.length,")"]}),e.jsx("div",{className:"space-y-1",children:t.changed.map(({element:s,changes:n})=>e.jsxs("div",{className:"flex items-start gap-2 px-3 py-2 rounded-lg cursor-pointer",style:{background:"#FFFFFF",border:"1px solid #F39C1240"},onMouseEnter:r=>r.currentTarget.style.background="#FDF8F0",onMouseLeave:r=>r.currentTarget.style.background="#FFFFFF",onClick:()=>u(s.id),children:[e.jsx("span",{className:"text-xs mt-0.5",style:{color:"#F39C12"},children:"●"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-xs font-medium truncate",style:{color:"#374151"},children:s.name}),e.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded",style:{background:(j[s.layer]||"#95A5A6")+"18",color:j[s.layer]||"#95A5A6"},children:s.kind})]}),e.jsx("div",{className:"text-xs mt-0.5",style:{color:"#9CA3AF"},children:n.join(", ")})]})]},s.id))})]}),(t.addedRels.length>0||t.removedRels.length>0)&&e.jsxs("div",{className:"mb-4",children:[e.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider mb-2",style:{color:"#6B7280"},children:"Relationship Changes"}),e.jsxs("div",{className:"space-y-1",children:[t.addedRels.map(s=>{var n,r;return e.jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 text-xs rounded-lg",style:{background:"#F0FDF4",border:"1px solid #BBF7D0"},children:[e.jsx("span",{style:{color:"#2ECC71"},children:"+"}),e.jsx("span",{style:{color:"#374151"},children:((n=l==null?void 0:l.elements[s.sourceId])==null?void 0:n.name)||s.sourceId}),e.jsx("span",{style:{color:"#2563EB"},children:s.type}),e.jsx("span",{style:{color:"#374151"},children:((r=l==null?void 0:l.elements[s.targetId])==null?void 0:r.name)||s.targetId})]},s.id)}),t.removedRels.map(s=>{var n,r;return e.jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 text-xs rounded-lg",style:{background:"#FEF2F2",border:"1px solid #FECACA"},children:[e.jsx("span",{style:{color:"#E74C3C"},children:"-"}),e.jsx("span",{style:{color:"#374151"},children:((n=o==null?void 0:o.elements[s.sourceId])==null?void 0:n.name)||s.sourceId}),e.jsx("span",{style:{color:"#2563EB"},children:s.type}),e.jsx("span",{style:{color:"#374151"},children:((r=o==null?void 0:o.elements[s.targetId])==null?void 0:r.name)||s.targetId})]},s.id)})]})]}),c===0&&t.addedRels.length===0&&t.removedRels.length===0&&e.jsxs("div",{className:"text-center py-8",style:{color:"#9CA3AF"},children:[e.jsx("div",{style:{fontSize:"24px",marginBottom:"8px"},children:"✓"}),e.jsx("div",{className:"text-sm",children:"No differences between snapshot and current model"})]})]})]})]})}function b({element:l,type:u,onClick:o}){const i=u==="added"?{bg:"#F0FDF4",border:"#BBF7D0",dot:"#2ECC71",hoverBg:"#DCFCE7"}:{bg:"#FEF2F2",border:"#FECACA",dot:"#E74C3C",hoverBg:"#FEE2E2"};return e.jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 rounded-lg cursor-pointer text-xs",style:{background:i.bg,border:`1px solid ${i.border}`},onMouseEnter:m=>m.currentTarget.style.background=i.hoverBg,onMouseLeave:m=>m.currentTarget.style.background=i.bg,onClick:o,children:[e.jsx("span",{style:{color:i.dot},children:"●"}),e.jsx("span",{className:"font-medium truncate",style:{color:"#374151"},children:l.name}),e.jsx("span",{className:"ml-auto px-1.5 py-0.5 rounded",style:{background:(j[l.layer]||"#95A5A6")+"18",color:j[l.layer]||"#95A5A6"},children:l.kind})]})}export{A as ModelDiff,N as computeModelDiff};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e,H as C,P as k,R as D,a as S,i as O,f as R,g as I}from"./reactflow-CsCqNKB-.js";import{a as p}from"./zustand-CrhqMOHB.js";/* empty css */import{r as T}from"./layout-providers-Dr743WlP.js";import{f as L,u as h,I as P,J as M,K as z}from"./index-D0vtjNjX.js";import"./elk-6l8mIQnQ.js";const A={ontology:{bg:"#EFF6FF",fg:"#2563EB",border:"#BFDBFE"},profile:{bg:"#F0FDF4",fg:"#16A34A",border:"#BBF7D0"},extension:{bg:"#FFF7ED",fg:"#EA580C",border:"#FED7AA"}};function H({data:i}){const s=i,l=A[s.type]??A.ontology;return e.jsxs("div",{"data-testid":`ontology-package-node-${s.name}`,onClick:s.onClick,onDoubleClick:s.onDoubleClick,onContextMenu:s.onContextMenu,style:{background:"#FFFFFF",border:s.selected?"2px solid #2563EB":"1px solid #E5E5E0",borderRadius:"12px",padding:"16px",minWidth:"240px",maxWidth:"300px",cursor:"pointer",boxShadow:"0 1px 3px rgba(0,0,0,0.06)",transition:"box-shadow 200ms ease, transform 200ms ease"},children:[e.jsx(C,{type:"target",position:k.Top,id:"top",style:w}),e.jsx(C,{type:"source",position:k.Bottom,id:"bottom",style:w}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"6px",marginBottom:"8px"},children:[e.jsx("span",{style:{padding:"1px 8px",fontSize:"10px",borderRadius:"9999px",fontWeight:600,background:l.bg,color:l.fg,border:`1px solid ${l.border}`},children:s.type}),e.jsxs("span",{style:{fontSize:"10px",color:"#9CA3AF"},children:["v",s.version]})]}),e.jsx("div",{style:{fontSize:"13px",fontWeight:600,color:"#1a1a1a",marginBottom:"4px"},children:s.name}),s.description&&e.jsx("div",{style:{fontSize:"11px",color:"#9CA3AF",marginBottom:"10px",lineHeight:"1.4"},children:s.description.length>80?s.description.slice(0,80)+"…":s.description}),e.jsx("div",{style:{display:"flex",gap:"2px",marginBottom:"8px",height:"6px",borderRadius:"3px",overflow:"hidden"},children:s.layers.slice(0,12).map(d=>{const n=L[d.id]??d.color??"#6B7280";return e.jsx("div",{style:{flex:Math.max(d.kindCount,1),background:n,borderRadius:"1px"},title:`${d.label}: ${d.kindCount} kinds`},d.id)})}),e.jsxs("div",{style:{display:"flex",gap:"12px",fontSize:"11px",color:"#6B7280"},children:[e.jsxs("span",{children:[e.jsx("strong",{style:{color:"#1B3A4B"},children:s.kindCount})," kinds"]}),e.jsxs("span",{children:[e.jsx("strong",{style:{color:"#1B3A4B"},children:s.layerCount})," layers"]})]})]})}const w={width:"8px",height:"8px",background:"#2563EB",border:"2px solid #FFFFFF",opacity:0},W=p.memo(H);function $({onClose:i}){const s=h(o=>o.availableOntologies),l=h(o=>o.ontologyInstallStatus),d=h(o=>o.setOntologyInstallStatus),[n,c]=p.useState(""),[r,g]=p.useState(null);function t(){n.trim()&&(d({installing:!0}),P(n.trim()),c(""))}function x(o){M(o),g(null)}return e.jsx("div",{className:"fixed inset-0 flex items-center justify-center z-50",style:{background:"rgba(0,0,0,0.4)"},onClick:i,children:e.jsxs("div",{className:"rounded-xl shadow-2xl overflow-hidden",style:{background:"#FFFFFF",width:"520px",maxHeight:"600px",border:"1px solid #E5E5E0"},onClick:o=>o.stopPropagation(),children:[e.jsxs("div",{className:"flex items-center justify-between px-5 py-4",style:{borderBottom:"1px solid #E5E5E0"},children:[e.jsx("h2",{className:"text-sm font-semibold",style:{color:"#1a1a1a"},children:"Manage Ontology Library"}),e.jsx("button",{onClick:i,className:"text-sm px-2 py-0.5 rounded hover:bg-gray-100",style:{color:"#9CA3AF"},children:"x"})]}),e.jsxs("div",{className:"p-5 space-y-5 overflow-y-auto",style:{maxHeight:"480px"},children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-xs font-medium block mb-1.5",style:{color:"#374151"},children:"Add Ontology"}),e.jsx("p",{className:"text-xs mb-2",style:{color:"#9CA3AF"},children:"Enter a git URL (https://...git), npm package name (@memoarchitect/...), or local path."}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{type:"text",placeholder:"https://gitlab.com/org/my-ontology.git",value:n,onChange:o=>c(o.target.value),onKeyDown:o=>o.key==="Enter"&&t(),className:"flex-1 px-3 py-2 text-xs rounded-lg",style:{border:"1px solid #E5E7EB",background:"#F9FAFB",color:"#374151",outline:"none"},onFocus:o=>o.currentTarget.style.borderColor="#2563EB",onBlur:o=>o.currentTarget.style.borderColor="#E5E7EB",disabled:l.installing}),e.jsx("button",{onClick:t,disabled:!n.trim()||l.installing,className:"px-4 py-2 text-xs rounded-lg font-medium",style:{background:l.installing?"#9CA3AF":"#1B3A4B",color:"#FFFFFF",opacity:!n.trim()||l.installing?.5:1,cursor:!n.trim()||l.installing?"not-allowed":"pointer"},children:l.installing?"Installing...":"Install"})]}),l.error&&e.jsx("div",{className:"mt-2 px-3 py-2 rounded-lg text-xs",style:{background:"#FEF2F2",color:"#DC2626",border:"1px solid #FECACA"},children:l.error}),l.lastInstalled&&!l.error&&e.jsxs("div",{className:"mt-2 px-3 py-2 rounded-lg text-xs",style:{background:"#F0FDF4",color:"#16A34A",border:"1px solid #BBF7D0"},children:["Installed ",l.lastInstalled]})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"text-xs font-medium block mb-2",style:{color:"#374151"},children:["Installed Packages (",s.length,")"]}),e.jsxs("div",{className:"space-y-1.5",children:[s.map(o=>e.jsxs("div",{className:"flex items-center gap-3 px-3 py-2.5 rounded-lg",style:{border:"1px solid #E5E5E0",background:"#FAFAF8"},children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-xs font-medium truncate",style:{color:"#1a1a1a"},children:o.name}),e.jsx("span",{className:"px-1.5 py-0.5 text-xs rounded",style:{background:o.type==="ontology"?"#EFF6FF":o.type==="profile"?"#F0FDF4":"#FFF7ED",color:o.type==="ontology"?"#2563EB":o.type==="profile"?"#16A34A":"#EA580C",fontSize:"10px"},children:o.type})]}),e.jsxs("div",{className:"text-xs mt-0.5",style:{color:"#9CA3AF"},children:["v",o.version," · ",o.kindCount," kinds · ",o.layers.length," layers"]})]}),r===o.name?e.jsxs("div",{className:"flex gap-1",children:[e.jsx("button",{onClick:()=>x(o.name),className:"px-2 py-1 text-xs rounded",style:{background:"#DC2626",color:"#FFFFFF"},children:"Confirm"}),e.jsx("button",{onClick:()=>g(null),className:"px-2 py-1 text-xs rounded",style:{background:"#F3F4F6",color:"#374151"},children:"Cancel"})]}):e.jsx("button",{onClick:()=>g(o.name),className:"text-xs px-2 py-1 rounded hover:bg-red-50",style:{color:"#DC2626",border:"1px solid #FECACA"},children:"Remove"})]},o.name)),s.length===0&&e.jsx("div",{className:"text-center py-6 text-xs",style:{color:"#9CA3AF"},children:"No ontology packages installed"})]})]})]})]})})}const _={ontologyPackage:W},Y=260,K=180;async function V(i){const s=new Map(i.map(t=>[t.name,t])),l={id:"root",layoutOptions:{"elk.algorithm":"layered","elk.direction":"RIGHT","elk.layered.nodePlacement.strategy":"BRANDES_KOEPF","elk.layered.spacing.nodeNodeBetweenLayers":"100","elk.spacing.nodeNode":"32","elk.layered.crossingMinimization.strategy":"LAYER_SWEEP","elk.padding":"[top=24, left=24, bottom=24, right=24]"},children:i.map(t=>({id:t.name,width:Y,height:K})),edges:i.filter(t=>t.extends&&s.has(t.extends)).map((t,x)=>({id:`e-${x}`,sources:[t.extends],targets:[t.name]}))},d=await T(l),n=new Map;for(const t of d.children??[])n.set(t.id,{x:t.x??0,y:t.y??0});const c={ontology:"#3B82F6",profile:"#10B981",extension:"#F59E0B"},r=i.map(t=>({id:t.name,type:"ontologyPackage",position:n.get(t.name)??{x:0,y:0},data:{name:t.name,type:t.type,version:t.version,description:t.description,kindCount:t.kindCount,layerCount:t.layers.length,layers:t.layers.map(x=>({id:x.id,label:x.label,color:x.color,kindCount:x.kindCount})),selected:t.selected,onClick:()=>{}}})),g=[];for(const t of i)if(t.extends&&s.has(t.extends)){const x=c[t.type]??"#94A3B8";g.push({id:`${t.extends}->${t.name}`,source:t.extends,target:t.name,type:"smoothstep",data:{edgeType:"extends"},style:{stroke:x,strokeWidth:2,strokeDasharray:"6 3"},animated:!1,label:"extends",labelStyle:{fontSize:9,fill:x,fontWeight:500},labelBgStyle:{fill:"#F7F7F5",fillOpacity:.9},labelBgPadding:[4,2],markerEnd:{type:"arrowclosed",color:x,width:14,height:14}})}return{nodes:r,edges:g}}function G(i,s){const l=new Map;for(const c of s)c.extends&&(l.has(c.extends)||l.set(c.extends,[]),l.get(c.extends).push(c.name));const d=new Set([i]),n=[i];for(;n.length;){const c=n.shift();for(const r of l.get(c)??[])d.has(r)||(d.add(r),n.push(r))}return d}function U(){const i=h(a=>a.availableOntologies),s=h(a=>a.setActiveView),l=h(a=>a.hiddenEdgeTypes),d=h(a=>a.toggleHiddenEdgeType),[n,c]=p.useState(!1),[r,g]=p.useState({nodes:[],edges:[]}),[t,x]=p.useState(null),{fitView:o}=S();p.useEffect(()=>{let a=!1;return V(i).then(u=>{a||g(u)}).catch(u=>{console.error("[OntologyDiagram] ELK layout failed:",u)}),()=>{a=!0}},[i]);const F=p.useCallback(a=>{s({type:"ontology-detail",packageName:a})},[s]),E=p.useCallback(a=>{const u=G(a,i),m=r.nodes.filter(y=>u.has(y.id));m.length!==0&&o({nodes:m.map(y=>({id:y.id})),duration:400,padding:.2})},[i,r.nodes,o]),v=p.useCallback((a,u)=>{a.preventDefault(),x({x:a.clientX,y:a.clientY,packageName:u})},[]);p.useEffect(()=>{const a=u=>{if(u.key==="Escape"){if(t){x(null);return}o({padding:.1,duration:300})}};return window.addEventListener("keydown",a),()=>window.removeEventListener("keydown",a)},[t,o]);const{nodes:N,edges:B}=p.useMemo(()=>{const a=r.nodes.map(m=>({...m,data:{...m.data,onClick:()=>E(m.id),onDoubleClick:()=>F(m.id),onContextMenu:y=>v(y,m.id)}})),u=r.edges.filter(m=>{var j;const y=(j=m.data)==null?void 0:j.edgeType;return!y||!l.has(y)});return{nodes:a,edges:u}},[r,E,F,v,l]),f=p.useRef(null);p.useEffect(()=>{if(!t)return;const a=u=>{f.current&&!f.current.contains(u.target)&&x(null)};return window.addEventListener("mousedown",a),()=>window.removeEventListener("mousedown",a)},[t]);const b=l.has("extends");return i.length===0?e.jsx("div",{className:"flex-1 flex items-center justify-center",style:{background:"#F7F7F5"},children:e.jsxs("div",{className:"text-center",style:{color:"#9CA3AF"},children:[e.jsx("div",{className:"text-3xl mb-3",children:"◉"}),e.jsx("div",{className:"text-sm font-medium mb-1",style:{color:"#374151"},children:"No ontology packages found"}),e.jsx("div",{className:"text-xs",children:"Start the dev server to load ontology packages"})]})}):e.jsxs("div",{className:"flex-1",style:{background:"#F7F7F5"},children:[e.jsxs("div",{className:"flex items-start justify-between px-6 pt-5 pb-3",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-base font-semibold",style:{color:"#1a1a1a"},children:"Ontology Library"}),e.jsxs("p",{className:"text-xs mt-1",style:{color:"#9CA3AF"},children:[i.length," package",i.length!==1?"s":""," available. Click to zoom, double-click to open, right-click for source."]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{"data-testid":"toggle-tracing",onClick:()=>d("extends"),title:b?"Show extends tracing edges":"Hide extends tracing edges",className:"px-3 py-1.5 text-xs rounded-lg font-medium",style:b?{background:"#F0F0ED",color:"#6B7280",border:"1px solid #E5E5E0"}:{background:"#1B3A4B",color:"#2DD4A8",border:"1px solid transparent"},children:b?"Show Tracing":"Hide Tracing"}),e.jsx("button",{onClick:()=>c(!0),className:"px-3 py-1.5 text-xs rounded-lg font-medium",style:{background:"#1B3A4B",color:"#2DD4A8"},children:"+ Add Ontology"})]})]}),n&&e.jsx($,{onClose:()=>c(!1)}),e.jsx("div",{style:{flex:1,height:"calc(100% - 72px)"},children:e.jsxs(O,{nodes:N,edges:B,nodeTypes:_,fitView:!0,fitViewOptions:{padding:.1},nodesDraggable:!1,nodesConnectable:!1,elementsSelectable:!1,panOnScroll:!0,zoomOnDoubleClick:!1,minZoom:.2,maxZoom:2.5,proOptions:{hideAttribution:!0},children:[e.jsx(R,{color:"#E5E5E0",gap:24,size:1}),e.jsx(I,{showInteractive:!1})]})}),t&&e.jsx(Z,{menuRef:f,state:t,onClose:()=>x(null),packages:i})]})}const Z=({state:i,onClose:s,packages:l,menuRef:d})=>{const n=l.find(r=>r.name===i.packageName);function c(){if(!n)return;const r=n.rootDir?`${n.rootDir}/memo.package.yaml`:"";r?z(r):window.open(`vscode://file/${encodeURIComponent(n.name)}`),s()}return e.jsxs("div",{ref:d,style:{position:"fixed",top:i.y,left:i.x,zIndex:1e3,background:"#FFFFFF",border:"1px solid #E5E5E0",borderRadius:"8px",boxShadow:"0 6px 16px rgba(0,0,0,0.12)",padding:"4px",minWidth:"180px",fontSize:"12px"},children:[e.jsx("div",{style:{padding:"6px 10px",color:"#9CA3AF",fontSize:"10px",textTransform:"uppercase",letterSpacing:"0.4px"},children:i.packageName}),e.jsx("button",{onClick:c,disabled:!(n!=null&&n.rootDir),style:{display:"block",width:"100%",textAlign:"left",padding:"6px 10px",border:"none",background:"transparent",cursor:n!=null&&n.rootDir?"pointer":"not-allowed",color:n!=null&&n.rootDir?"#1a1a1a":"#9CA3AF",borderRadius:"4px"},onMouseEnter:r=>{n!=null&&n.rootDir&&(r.currentTarget.style.background="#F0F0ED")},onMouseLeave:r=>{r.currentTarget.style.background="transparent"},children:"Open source"})]})};function oe(){return e.jsx(D,{children:e.jsx(U,{})})}export{oe as OntologyDecompositionDiagram,oe as default};
|
|
1
|
+
import{j as e,H as C,P as k,R as D,b as S,i as O,k as R,l as T}from"./reactflow-s7jmJtXx.js";import{a as p}from"./zustand-CrhqMOHB.js";/* empty css */import{r as I}from"./layout-providers-Dr743WlP.js";import{h as L,u as h,W as P,X as M,d as z}from"./index-Bij8Q4Kg.js";import"./elk-6l8mIQnQ.js";const A={ontology:{bg:"#EFF6FF",fg:"#2563EB",border:"#BFDBFE"},profile:{bg:"#F0FDF4",fg:"#16A34A",border:"#BBF7D0"},extension:{bg:"#FFF7ED",fg:"#EA580C",border:"#FED7AA"}};function H({data:i}){const s=i,l=A[s.type]??A.ontology;return e.jsxs("div",{"data-testid":`ontology-package-node-${s.name}`,onClick:s.onClick,onDoubleClick:s.onDoubleClick,onContextMenu:s.onContextMenu,style:{background:"#FFFFFF",border:s.selected?"2px solid #2563EB":"1px solid #E5E5E0",borderRadius:"12px",padding:"16px",minWidth:"240px",maxWidth:"300px",cursor:"pointer",boxShadow:"0 1px 3px rgba(0,0,0,0.06)",transition:"box-shadow 200ms ease, transform 200ms ease"},children:[e.jsx(C,{type:"target",position:k.Top,id:"top",style:w}),e.jsx(C,{type:"source",position:k.Bottom,id:"bottom",style:w}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"6px",marginBottom:"8px"},children:[e.jsx("span",{style:{padding:"1px 8px",fontSize:"10px",borderRadius:"9999px",fontWeight:600,background:l.bg,color:l.fg,border:`1px solid ${l.border}`},children:s.type}),e.jsxs("span",{style:{fontSize:"10px",color:"#9CA3AF"},children:["v",s.version]})]}),e.jsx("div",{style:{fontSize:"13px",fontWeight:600,color:"#1a1a1a",marginBottom:"4px"},children:s.name}),s.description&&e.jsx("div",{style:{fontSize:"11px",color:"#9CA3AF",marginBottom:"10px",lineHeight:"1.4"},children:s.description.length>80?s.description.slice(0,80)+"…":s.description}),e.jsx("div",{style:{display:"flex",gap:"2px",marginBottom:"8px",height:"6px",borderRadius:"3px",overflow:"hidden"},children:s.layers.slice(0,12).map(d=>{const n=L[d.id]??d.color??"#6B7280";return e.jsx("div",{style:{flex:Math.max(d.kindCount,1),background:n,borderRadius:"1px"},title:`${d.label}: ${d.kindCount} kinds`},d.id)})}),e.jsxs("div",{style:{display:"flex",gap:"12px",fontSize:"11px",color:"#6B7280"},children:[e.jsxs("span",{children:[e.jsx("strong",{style:{color:"#1B3A4B"},children:s.kindCount})," kinds"]}),e.jsxs("span",{children:[e.jsx("strong",{style:{color:"#1B3A4B"},children:s.layerCount})," layers"]})]})]})}const w={width:"8px",height:"8px",background:"#2563EB",border:"2px solid #FFFFFF",opacity:0},W=p.memo(H);function $({onClose:i}){const s=h(o=>o.availableOntologies),l=h(o=>o.ontologyInstallStatus),d=h(o=>o.setOntologyInstallStatus),[n,c]=p.useState(""),[r,g]=p.useState(null);function t(){n.trim()&&(d({installing:!0}),P(n.trim()),c(""))}function x(o){M(o),g(null)}return e.jsx("div",{className:"fixed inset-0 flex items-center justify-center z-50",style:{background:"rgba(0,0,0,0.4)"},onClick:i,children:e.jsxs("div",{className:"rounded-xl shadow-2xl overflow-hidden",style:{background:"#FFFFFF",width:"520px",maxHeight:"600px",border:"1px solid #E5E5E0"},onClick:o=>o.stopPropagation(),children:[e.jsxs("div",{className:"flex items-center justify-between px-5 py-4",style:{borderBottom:"1px solid #E5E5E0"},children:[e.jsx("h2",{className:"text-sm font-semibold",style:{color:"#1a1a1a"},children:"Manage Ontology Library"}),e.jsx("button",{onClick:i,className:"text-sm px-2 py-0.5 rounded hover:bg-gray-100",style:{color:"#9CA3AF"},children:"x"})]}),e.jsxs("div",{className:"p-5 space-y-5 overflow-y-auto",style:{maxHeight:"480px"},children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-xs font-medium block mb-1.5",style:{color:"#374151"},children:"Add Ontology"}),e.jsx("p",{className:"text-xs mb-2",style:{color:"#9CA3AF"},children:"Enter a git URL (https://...git), npm package name (@memoarchitect/...), or local path."}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{type:"text",placeholder:"https://gitlab.com/org/my-ontology.git",value:n,onChange:o=>c(o.target.value),onKeyDown:o=>o.key==="Enter"&&t(),className:"flex-1 px-3 py-2 text-xs rounded-lg",style:{border:"1px solid #E5E7EB",background:"#F9FAFB",color:"#374151",outline:"none"},onFocus:o=>o.currentTarget.style.borderColor="#2563EB",onBlur:o=>o.currentTarget.style.borderColor="#E5E7EB",disabled:l.installing}),e.jsx("button",{onClick:t,disabled:!n.trim()||l.installing,className:"px-4 py-2 text-xs rounded-lg font-medium",style:{background:l.installing?"#9CA3AF":"#1B3A4B",color:"#FFFFFF",opacity:!n.trim()||l.installing?.5:1,cursor:!n.trim()||l.installing?"not-allowed":"pointer"},children:l.installing?"Installing...":"Install"})]}),l.error&&e.jsx("div",{className:"mt-2 px-3 py-2 rounded-lg text-xs",style:{background:"#FEF2F2",color:"#DC2626",border:"1px solid #FECACA"},children:l.error}),l.lastInstalled&&!l.error&&e.jsxs("div",{className:"mt-2 px-3 py-2 rounded-lg text-xs",style:{background:"#F0FDF4",color:"#16A34A",border:"1px solid #BBF7D0"},children:["Installed ",l.lastInstalled]})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"text-xs font-medium block mb-2",style:{color:"#374151"},children:["Installed Packages (",s.length,")"]}),e.jsxs("div",{className:"space-y-1.5",children:[s.map(o=>e.jsxs("div",{className:"flex items-center gap-3 px-3 py-2.5 rounded-lg",style:{border:"1px solid #E5E5E0",background:"#FAFAF8"},children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-xs font-medium truncate",style:{color:"#1a1a1a"},children:o.name}),e.jsx("span",{className:"px-1.5 py-0.5 text-xs rounded",style:{background:o.type==="ontology"?"#EFF6FF":o.type==="profile"?"#F0FDF4":"#FFF7ED",color:o.type==="ontology"?"#2563EB":o.type==="profile"?"#16A34A":"#EA580C",fontSize:"10px"},children:o.type})]}),e.jsxs("div",{className:"text-xs mt-0.5",style:{color:"#9CA3AF"},children:["v",o.version," · ",o.kindCount," kinds · ",o.layers.length," layers"]})]}),r===o.name?e.jsxs("div",{className:"flex gap-1",children:[e.jsx("button",{onClick:()=>x(o.name),className:"px-2 py-1 text-xs rounded",style:{background:"#DC2626",color:"#FFFFFF"},children:"Confirm"}),e.jsx("button",{onClick:()=>g(null),className:"px-2 py-1 text-xs rounded",style:{background:"#F3F4F6",color:"#374151"},children:"Cancel"})]}):e.jsx("button",{onClick:()=>g(o.name),className:"text-xs px-2 py-1 rounded hover:bg-red-50",style:{color:"#DC2626",border:"1px solid #FECACA"},children:"Remove"})]},o.name)),s.length===0&&e.jsx("div",{className:"text-center py-6 text-xs",style:{color:"#9CA3AF"},children:"No ontology packages installed"})]})]})]})]})})}const _={ontologyPackage:W},Y=260,V=180;async function K(i){const s=new Map(i.map(t=>[t.name,t])),l={id:"root",layoutOptions:{"elk.algorithm":"layered","elk.direction":"RIGHT","elk.layered.nodePlacement.strategy":"BRANDES_KOEPF","elk.layered.spacing.nodeNodeBetweenLayers":"100","elk.spacing.nodeNode":"32","elk.layered.crossingMinimization.strategy":"LAYER_SWEEP","elk.padding":"[top=24, left=24, bottom=24, right=24]"},children:i.map(t=>({id:t.name,width:Y,height:V})),edges:i.filter(t=>t.extends&&s.has(t.extends)).map((t,x)=>({id:`e-${x}`,sources:[t.extends],targets:[t.name]}))},d=await I(l),n=new Map;for(const t of d.children??[])n.set(t.id,{x:t.x??0,y:t.y??0});const c={ontology:"#3B82F6",profile:"#10B981",extension:"#F59E0B"},r=i.map(t=>({id:t.name,type:"ontologyPackage",position:n.get(t.name)??{x:0,y:0},data:{name:t.name,type:t.type,version:t.version,description:t.description,kindCount:t.kindCount,layerCount:t.layers.length,layers:t.layers.map(x=>({id:x.id,label:x.label,color:x.color,kindCount:x.kindCount})),selected:t.selected,onClick:()=>{}}})),g=[];for(const t of i)if(t.extends&&s.has(t.extends)){const x=c[t.type]??"#94A3B8";g.push({id:`${t.extends}->${t.name}`,source:t.extends,target:t.name,type:"smoothstep",data:{edgeType:"extends"},style:{stroke:x,strokeWidth:2,strokeDasharray:"6 3"},animated:!1,label:"extends",labelStyle:{fontSize:9,fill:x,fontWeight:500},labelBgStyle:{fill:"#F7F7F5",fillOpacity:.9},labelBgPadding:[4,2],markerEnd:{type:"arrowclosed",color:x,width:14,height:14}})}return{nodes:r,edges:g}}function G(i,s){const l=new Map;for(const c of s)c.extends&&(l.has(c.extends)||l.set(c.extends,[]),l.get(c.extends).push(c.name));const d=new Set([i]),n=[i];for(;n.length;){const c=n.shift();for(const r of l.get(c)??[])d.has(r)||(d.add(r),n.push(r))}return d}function U(){const i=h(a=>a.availableOntologies),s=h(a=>a.setActiveView),l=h(a=>a.hiddenEdgeTypes),d=h(a=>a.toggleHiddenEdgeType),[n,c]=p.useState(!1),[r,g]=p.useState({nodes:[],edges:[]}),[t,x]=p.useState(null),{fitView:o}=S();p.useEffect(()=>{let a=!1;return K(i).then(u=>{a||g(u)}).catch(u=>{console.error("[OntologyDiagram] ELK layout failed:",u)}),()=>{a=!0}},[i]);const F=p.useCallback(a=>{s({type:"ontology-detail",packageName:a})},[s]),E=p.useCallback(a=>{const u=G(a,i),m=r.nodes.filter(y=>u.has(y.id));m.length!==0&&o({nodes:m.map(y=>({id:y.id})),duration:400,padding:.2})},[i,r.nodes,o]),v=p.useCallback((a,u)=>{a.preventDefault(),x({x:a.clientX,y:a.clientY,packageName:u})},[]);p.useEffect(()=>{const a=u=>{if(u.key==="Escape"){if(t){x(null);return}o({padding:.1,duration:300})}};return window.addEventListener("keydown",a),()=>window.removeEventListener("keydown",a)},[t,o]);const{nodes:N,edges:B}=p.useMemo(()=>{const a=r.nodes.map(m=>({...m,data:{...m.data,onClick:()=>E(m.id),onDoubleClick:()=>F(m.id),onContextMenu:y=>v(y,m.id)}})),u=r.edges.filter(m=>{var j;const y=(j=m.data)==null?void 0:j.edgeType;return!y||!l.has(y)});return{nodes:a,edges:u}},[r,E,F,v,l]),f=p.useRef(null);p.useEffect(()=>{if(!t)return;const a=u=>{f.current&&!f.current.contains(u.target)&&x(null)};return window.addEventListener("mousedown",a),()=>window.removeEventListener("mousedown",a)},[t]);const b=l.has("extends");return i.length===0?e.jsx("div",{className:"flex-1 flex items-center justify-center",style:{background:"#F7F7F5"},children:e.jsxs("div",{className:"text-center",style:{color:"#9CA3AF"},children:[e.jsx("div",{className:"text-3xl mb-3",children:"◉"}),e.jsx("div",{className:"text-sm font-medium mb-1",style:{color:"#374151"},children:"No ontology packages found"}),e.jsx("div",{className:"text-xs",children:"Start the dev server to load ontology packages"})]})}):e.jsxs("div",{className:"flex-1",style:{background:"#F7F7F5"},children:[e.jsxs("div",{className:"flex items-start justify-between px-6 pt-5 pb-3",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-base font-semibold",style:{color:"#1a1a1a"},children:"Ontology Library"}),e.jsxs("p",{className:"text-xs mt-1",style:{color:"#9CA3AF"},children:[i.length," package",i.length!==1?"s":""," available. Click to zoom, double-click to open, right-click for source."]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{"data-testid":"toggle-tracing",onClick:()=>d("extends"),title:b?"Show extends tracing edges":"Hide extends tracing edges",className:"px-3 py-1.5 text-xs rounded-lg font-medium",style:b?{background:"#F0F0ED",color:"#6B7280",border:"1px solid #E5E5E0"}:{background:"#1B3A4B",color:"#2DD4A8",border:"1px solid transparent"},children:b?"Show Tracing":"Hide Tracing"}),e.jsx("button",{onClick:()=>c(!0),className:"px-3 py-1.5 text-xs rounded-lg font-medium",style:{background:"#1B3A4B",color:"#2DD4A8"},children:"+ Add Ontology"})]})]}),n&&e.jsx($,{onClose:()=>c(!1)}),e.jsx("div",{style:{flex:1,height:"calc(100% - 72px)"},children:e.jsxs(O,{nodes:N,edges:B,nodeTypes:_,fitView:!0,fitViewOptions:{padding:.1},nodesDraggable:!1,nodesConnectable:!1,elementsSelectable:!1,panOnScroll:!0,zoomOnDoubleClick:!1,minZoom:.2,maxZoom:2.5,proOptions:{hideAttribution:!0},children:[e.jsx(R,{color:"#E5E5E0",gap:24,size:1}),e.jsx(T,{showInteractive:!1})]})}),t&&e.jsx(X,{menuRef:f,state:t,onClose:()=>x(null),packages:i})]})}const X=({state:i,onClose:s,packages:l,menuRef:d})=>{const n=l.find(r=>r.name===i.packageName);function c(){if(!n)return;const r=n.rootDir?`${n.rootDir}/memo.package.yaml`:"";r?z(r):window.open(`vscode://file/${encodeURIComponent(n.name)}`),s()}return e.jsxs("div",{ref:d,style:{position:"fixed",top:i.y,left:i.x,zIndex:1e3,background:"#FFFFFF",border:"1px solid #E5E5E0",borderRadius:"8px",boxShadow:"0 6px 16px rgba(0,0,0,0.12)",padding:"4px",minWidth:"180px",fontSize:"12px"},children:[e.jsx("div",{style:{padding:"6px 10px",color:"#9CA3AF",fontSize:"10px",textTransform:"uppercase",letterSpacing:"0.4px"},children:i.packageName}),e.jsx("button",{onClick:c,disabled:!(n!=null&&n.rootDir),style:{display:"block",width:"100%",textAlign:"left",padding:"6px 10px",border:"none",background:"transparent",cursor:n!=null&&n.rootDir?"pointer":"not-allowed",color:n!=null&&n.rootDir?"#1a1a1a":"#9CA3AF",borderRadius:"4px"},onMouseEnter:r=>{n!=null&&n.rootDir&&(r.currentTarget.style.background="#F0F0ED")},onMouseLeave:r=>{r.currentTarget.style.background="transparent"},children:"Open source"})]})};function oe(){return e.jsx(D,{children:e.jsx(U,{})})}export{oe as OntologyDecompositionDiagram,oe as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/LayerGrid-
|
|
2
|
-
import{f as _,u as y,_ as O,L as X}from"./index-D0vtjNjX.js";import{j as e}from"./reactflow-CsCqNKB-.js";import{a}from"./zustand-CrhqMOHB.js";function G({ontology:s}){const i=s.layers.reduce((r,f)=>r+f.kinds.reduce((d,l)=>d+l.instanceCount,0),0);return e.jsxs("div",{className:"rounded-xl p-5 mb-5",style:{background:"#FFFFFF",border:"1px solid #E5E5E0",boxShadow:"0 1px 3px rgba(0,0,0,0.04)"},children:[e.jsx("div",{className:"flex items-start justify-between gap-3 mb-3",children:e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("span",{className:"px-2 py-0.5 text-xs rounded-full font-medium",style:{background:"#EFF6FF",color:"#2563EB",border:"1px solid #BFDBFE"},children:s.type}),s.extends&&e.jsxs("span",{className:"text-xs",style:{color:"#9CA3AF"},children:["extends ",s.extends]})]}),e.jsx("h2",{className:"text-base font-semibold truncate",style:{color:"#1a1a1a"},children:s.name}),e.jsxs("div",{className:"text-xs mt-0.5",style:{color:"#9CA3AF"},children:["v",s.version]})]})}),s.description&&e.jsx("p",{className:"text-sm mb-4",style:{color:"#6B7280",lineHeight:"1.5"},children:s.description}),e.jsxs("div",{className:"flex gap-5 text-xs",style:{color:"#6B7280"},children:[e.jsxs("div",{children:[e.jsx("span",{className:"font-semibold text-sm",style:{color:"#1B3A4B"},children:s.kindCount})," ","kinds"]}),e.jsxs("div",{children:[e.jsx("span",{className:"font-semibold text-sm",style:{color:"#1B3A4B"},children:s.layers.length})," ","layers"]}),i>0&&e.jsxs("div",{children:[e.jsx("span",{className:"font-semibold text-sm",style:{color:"#1B3A4B"},children:i})," ","model instances"]})]})]})}function J({kind:s,layers:i,onKindClick:r,onClose:f,allOntologies:d,onNavigate:l}){const o=_[s.layer]??"#6B7280",c=i.flatMap(t=>t.kinds),m=s.derivesFrom?c.find(t=>t.name===s.derivesFrom):null;function p(t){if(i.some(x=>x.kinds.some(h=>h.name===t)))return null;for(const x of d??[])if(x.layers.some(h=>h.kinds.some(N=>N.name===t)))return x.name;return null}function v(t){const x=p(t);x&&l?l(x,t):r(t)}return e.jsxs("div",{className:"flex flex-col border-l overflow-y-auto",style:{width:320,minWidth:320,background:"#FFFFFF",borderColor:"#E5E5E0"},children:[e.jsxs("div",{className:"flex items-center justify-between p-4 border-b",style:{borderColor:"#E5E5E0"},children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsx("span",{className:"w-3 h-3 rounded flex-shrink-0",style:{backgroundColor:o}}),e.jsx("h3",{className:"text-sm font-semibold truncate",style:{color:"#1a1a1a"},children:s.label})]}),e.jsx("button",{onClick:f,className:"text-sm px-1.5 rounded hover:bg-gray-100",style:{color:"#9CA3AF"},children:"✕"})]}),e.jsxs("div",{className:"p-4 space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("span",{className:"px-2 py-0.5 text-xs rounded font-mono",style:{background:"#F3F4F6",color:"#4B5563",border:"1px solid #E5E7EB"},children:s.construct}),e.jsx("span",{className:"px-2 py-0.5 text-xs rounded font-medium",style:{background:`${o}15`,color:o,border:`1px solid ${o}30`},children:s.layer})]}),s.description&&e.jsx(S,{title:"Description",children:e.jsx("p",{className:"text-xs leading-relaxed",style:{color:"#6B7280"},children:s.description})}),s.derivesFrom&&e.jsx(S,{title:"Derives From",children:e.jsx(I,{name:s.derivesFrom,layer:m==null?void 0:m.layer,crossOntology:p(s.derivesFrom)!==null,onClick:()=>v(s.derivesFrom)})}),s.derivedBy&&s.derivedBy.length>0&&e.jsx(S,{title:`Derived By (${s.derivedBy.length})`,children:e.jsx("div",{className:"flex flex-wrap gap-1.5",children:s.derivedBy.map(t=>{const x=c.find(h=>h.name===t);return e.jsx(I,{name:t,layer:x==null?void 0:x.layer,crossOntology:p(t)!==null,onClick:()=>v(t)},t)})})}),s.relationships&&s.relationships.length>0&&e.jsx(S,{title:`Relationships (${s.relationships.length})`,children:e.jsx("div",{className:"space-y-1",children:s.relationships.map((t,x)=>e.jsxs("div",{className:"flex items-center gap-1.5 text-xs",style:{color:"#6B7280"},children:[e.jsx("span",{style:{color:t.direction==="outgoing"?"#10B981":"#8B5CF6"},children:t.direction==="outgoing"?"→":"←"}),e.jsx("span",{className:"font-medium",style:{color:"#374151"},children:t.type}),e.jsx("button",{className:"hover:underline",style:{color:"#2563EB"},onClick:()=>v(t.targetKind),children:t.targetKind})]},x))})}),e.jsxs(S,{title:"Usage",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsx(V,{label:"Instances",value:s.instanceCount}),e.jsx(V,{label:"Viewpoints",value:s.viewpoints.length})]}),s.viewpoints.length>0&&e.jsx("div",{className:"flex flex-wrap gap-1 mt-2",children:s.viewpoints.map(t=>e.jsx("span",{className:"px-1.5 py-0.5 text-xs rounded",style:{background:"#F3F4F6",color:"#6B7280"},children:t},t))})]})]})]})}function S({title:s,children:i}){return e.jsxs("div",{children:[e.jsx("h4",{className:"text-xs font-medium mb-1.5",style:{color:"#9CA3AF",textTransform:"uppercase",letterSpacing:"0.05em"},children:s}),i]})}function I({name:s,layer:i,crossOntology:r,onClick:f}){const d=i?_[i]??"#6B7280":"#6B7280";return e.jsxs("button",{onClick:f,className:"inline-flex items-center gap-1.5 px-2 py-1 text-xs rounded-md hover:bg-gray-50",style:{border:"1px solid #E5E7EB",color:"#374151"},title:r?"Navigate to this kind in another ontology package":void 0,children:[e.jsx("span",{className:"w-2 h-2 rounded-full flex-shrink-0",style:{backgroundColor:d}}),s.replace(/([A-Z])/g," $1").trim(),r&&e.jsx("span",{style:{color:"#9CA3AF",fontSize:"9px"},children:"↗"})]})}function V({label:s,value:i}){return e.jsxs("div",{className:"rounded-lg p-2",style:{background:"#F9FAFB",border:"1px solid #F3F4F6"},children:[e.jsx("div",{className:"text-sm font-semibold",style:{color:"#1B3A4B"},children:i}),e.jsx("div",{className:"text-xs",style:{color:"#9CA3AF"},children:s})]})}const P={"part def":{label:"Part Definition",shorthand:"pd",description:"Defines a structural classifier (composite part)"},"connection def":{label:"Connection Definition",shorthand:"cd",description:"Defines a connector type between parts"},"attribute def":{label:"Attribute Definition",shorthand:"ad",description:"Defines a typed value property"},"item def":{label:"Item Definition",shorthand:"id",description:"Defines a flow item type"},"action def":{label:"Action Definition",shorthand:"acd",description:"Defines a behavioral action"},"state def":{label:"State Definition",shorthand:"sd",description:"Defines a state machine type"},"requirement def":{label:"Requirement Definition",shorthand:"rd",description:"Defines a requirement type"},"use case def":{label:"Use Case Definition",shorthand:"ucd",description:"Defines a use case type"},"occurrence def":{label:"Occurrence Definition",shorthand:"od",description:"Defines an occurrence (event or snapshot)"},"interface def":{label:"Interface Definition",shorthand:"ifd",description:"Defines a port interface type"},"port def":{label:"Port Definition",shorthand:"ptd",description:"Defines a port type for system interfaces"},"metadata def":{label:"Metadata Definition",shorthand:"md",description:"Defines a metadata annotation type"}},Q={purpose:"#cce5ff",business:"#cce5ff",operational:"#cce5ff",requirements:"#dae8fc",functional:"#d5e8d4",behavior:"#d5e8d4",logical:"#d5e8d4",physical:"#ffe6cc",software:"#d5e8d4",interfaces:"#d5e8d4",ui:"#d5e8d4",risk:"#f8cecc",safety:"#f8cecc",cybersecurity:"#f8cecc",verification:"#e1d5e7",analysis:"#e1d5e7","design-control":"#fff2cc",qms:"#fff2cc","software-lifecycle":"#fff2cc",operations:"#fff2cc",clinical:"#fff2cc",privacy:"#fff2cc"};function ee({layers:s}){const i=[],r=new Map;for(const l of s)for(const o of l.kinds){const c=o.construct||"part def";r.has(c)||r.set(c,[]),r.get(c).push({kindName:o.name,layer:l.id,layerLabel:l.label,layerColor:Q[l.id]??"#f3f4f6",derivesFrom:o.derivesFrom,description:o.description})}const f=Object.keys(P),d=[...r.keys()].sort((l,o)=>{const c=f.indexOf(l),m=f.indexOf(o);return c===-1&&m===-1?l.localeCompare(o):c===-1?1:m===-1?-1:c-m});for(const l of d){const o=r.get(l).sort((m,p)=>m.kindName.localeCompare(p.kindName)),c=P[l];i.push({construct:l,label:(c==null?void 0:c.label)??l,shorthand:(c==null?void 0:c.shorthand)??l,description:(c==null?void 0:c.description)??"",kinds:o})}return i.length===0?e.jsx("div",{className:"py-8 text-center text-sm",style:{color:"#9CA3AF"},children:"No kinds found in the selected viewpoint."}):e.jsxs("div",{style:{fontFamily:"inherit"},children:[e.jsxs("div",{className:"mb-4",children:[e.jsx("h3",{className:"text-sm font-semibold mb-1",style:{color:"#1a1a1a"},children:"SysML v2 Construct Mapping"}),e.jsx("p",{className:"text-xs",style:{color:"#9CA3AF"},children:"Each SysML v2 construct keyword and the MEMO kinds that use it. Shorthand codes appear on kind cards throughout the viewer."})]}),e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"16px"},children:i.map(l=>e.jsx(se,{group:l},l.construct))})]})}function se({group:s}){return e.jsxs("div",{style:{border:"1px solid #E5E5E0",borderRadius:"10px",overflow:"hidden"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"10px",padding:"8px 12px",background:"#F7F7F5",borderBottom:"1px solid #E5E5E0"},children:[e.jsx("code",{style:{fontSize:"11px",fontFamily:"monospace",background:"#1B3A4B",color:"#2DD4A8",padding:"2px 6px",borderRadius:"4px",letterSpacing:"0.02em"},children:s.construct}),e.jsx("span",{className:"text-sm font-semibold",style:{color:"#1a1a1a"},children:s.label}),e.jsx("span",{style:{fontSize:"10px",color:"#6B7280",fontFamily:"monospace",background:"#EBEBEB",padding:"1px 5px",borderRadius:"3px"},children:s.shorthand}),s.description&&e.jsxs("span",{className:"text-xs ml-1",style:{color:"#9CA3AF"},children:["— ",s.description]}),e.jsxs("span",{className:"ml-auto text-xs",style:{color:"#9CA3AF"},children:[s.kinds.length," kind",s.kinds.length!==1?"s":""]})]}),e.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:"6px",padding:"10px 12px"},children:s.kinds.map(i=>e.jsx(te,{kind:i},i.kindName))})]})}function te({kind:s}){return e.jsxs("div",{title:s.description??s.kindName,style:{display:"inline-flex",alignItems:"center",gap:"5px",padding:"3px 8px",background:s.layerColor,borderRadius:"5px",fontSize:"11px",fontWeight:500,color:"#1a1a1a",border:"1px solid rgba(0,0,0,0.06)",whiteSpace:"nowrap"},children:[e.jsx("span",{style:{fontWeight:600},children:s.kindName}),e.jsx("span",{style:{fontSize:"9px",color:"#6B7280",background:"rgba(255,255,255,0.55)",padding:"1px 4px",borderRadius:"3px"},children:s.layerLabel}),s.derivesFrom&&e.jsxs("span",{style:{fontSize:"9px",color:"#9CA3AF",fontStyle:"italic"},title:`Specializes ${s.derivesFrom}`,children:[":> ",s.derivesFrom]})]})}const ne=a.lazy(()=>O(()=>import("./LayerGrid-B3MBWswK.js"),__vite__mapDeps([0,1,2,3,4])).then(s=>({default:s.LayerGrid}))),ie=a.lazy(()=>O(()=>import("./LayerTable-DyIzIt5M.js"),__vite__mapDeps([5,1,2,3,4])).then(s=>({default:s.LayerTable}))),K=a.lazy(()=>O(()=>import("./RelationshipsSection-DttMvF2i.js"),__vite__mapDeps([6,1,2,7])).then(s=>({default:s.RelationshipsSection}))),le=a.lazy(()=>O(()=>import("./RelationshipOverlay-B9bqt4zl.js"),__vite__mapDeps([8,1,2,7])).then(s=>({default:s.RelationshipOverlay}))),L=[{id:"all",label:"All Layers",layerIds:null,description:"All architecture layers in swimlane view"},{id:"software",label:"Software Views",layerIds:["functional","behavior","logical","software","interfaces","ui"],description:"Software architecture: Logical/Service, Runtime, Module/Code, Deployment"},{id:"hardware",label:"Hardware Views",layerIds:["logical","physical","interfaces"],description:"Hardware architecture: Logical, Physical/Embodiment, Compute/Electronics, Cross-domain"},{id:"risk",label:"Risk Chain",layerIds:["requirements","risk","safety","cybersecurity","verification","analysis"],description:"Risk trace chain: Hazard → HazardousSituation → Harm → RiskControlMeasure → verification"},{id:"traceability",label:"Traceability",layerIds:["purpose","business","operational","requirements","risk","safety","functional","software","software-lifecycle","verification","analysis"],description:"Full trace: clinical, risk, software, and hardware chains"},{id:"sysml-mapping",label:"SysML Mapping",layerIds:null,type:"sysml-mapping",description:"SysML v2 construct → MEMO kind reference table"}],ae=.3,oe=2.5,R=.15;function re({children:s}){const[i,r]=a.useState(1),[f,d]=a.useState({x:0,y:0}),l=a.useRef(!1),o=a.useRef({x:0,y:0}),c=a.useRef(null),m=u=>Math.max(ae,Math.min(oe,u)),p=a.useCallback(u=>{u.preventDefault();const F=u.deltaY<0?R:-R;r(C=>m(C+F))},[]),v=a.useCallback(u=>{u.target.closest("button, input, a")||(l.current=!0,o.current={x:u.clientX,y:u.clientY},u.currentTarget.setAttribute("data-panning","true"))},[]),t=a.useCallback(u=>{if(!l.current)return;const F=u.clientX-o.current.x,C=u.clientY-o.current.y;o.current={x:u.clientX,y:u.clientY},d(k=>({x:k.x+F,y:k.y+C}))},[]),x=a.useCallback(u=>{l.current=!1,u.currentTarget.removeAttribute("data-panning")},[]),h=a.useCallback(u=>{l.current=!1,u.currentTarget.removeAttribute("data-panning")},[]);function N(){r(1),d({x:0,y:0})}return e.jsxs("div",{style:{position:"relative",width:"100%",height:"100%"},children:[e.jsxs("div",{style:{position:"absolute",top:"10px",right:"10px",zIndex:10,display:"flex",gap:"4px",background:"rgba(255,255,255,0.92)",border:"1px solid #E5E5E0",borderRadius:"8px",padding:"4px",boxShadow:"0 2px 8px rgba(0,0,0,0.08)"},children:[e.jsx(T,{title:"Zoom in",onClick:()=>r(u=>m(u+R)),children:"+"}),e.jsxs("span",{style:{fontSize:"10px",color:"#6B7280",lineHeight:"26px",minWidth:"34px",textAlign:"center"},children:[Math.round(i*100),"%"]}),e.jsx(T,{title:"Zoom out",onClick:()=>r(u=>m(u-R)),children:"−"}),e.jsx("div",{style:{width:"1px",background:"#E5E5E0",margin:"2px 0"}}),e.jsx(T,{title:"Fit to view",onClick:N,children:"⊡"})]}),e.jsx("div",{ref:c,onWheel:p,onMouseDown:v,onMouseMove:t,onMouseUp:x,onMouseLeave:h,style:{width:"100%",height:"100%",overflow:"hidden",cursor:l.current?"grabbing":"grab",userSelect:"none"},children:e.jsx("div",{style:{transform:`translate(${f.x}px, ${f.y}px) scale(${i})`,transformOrigin:"0 0",willChange:"transform",padding:"16px"},children:s})})]})}function T({onClick:s,title:i,children:r}){return e.jsx("button",{onClick:s,title:i,style:{width:"26px",height:"26px",border:"none",borderRadius:"5px",background:"transparent",cursor:"pointer",fontSize:"14px",color:"#374151",display:"flex",alignItems:"center",justifyContent:"center",lineHeight:1},onMouseEnter:f=>{f.currentTarget.style.background="#F0F0ED"},onMouseLeave:f=>{f.currentTarget.style.background="transparent"},children:r})}function ce({ontology:s,onBack:i}){const r=y(n=>n.ontologyViewMode),f=y(n=>n.setOntologyViewMode),d=y(n=>n.selectedOntologyKind),l=y(n=>n.setSelectedOntologyKind),o=y(n=>n.showOntologyRelationships),c=y(n=>n.toggleOntologyRelationships),m=y(n=>n.model),p=y(n=>n.activeView),v=y(n=>n.setActiveView),t=y(n=>n.availableOntologies),x=a.useRef(null),[h,N]=a.useState(new Set),[u,F]=a.useState("all"),[C,k]=a.useState(!1),[H,W]=a.useState(null),[Z,Y]=a.useState(0);a.useEffect(()=>{d&&(k(!0),W(d),Y(n=>n+1))},[d]);const g=a.useMemo(()=>({...s,layers:s.layers.map(n=>({...n,kinds:n.kinds.map(b=>{var M;return{...b,instanceCount:m?Object.values(m.elements).filter(A=>A.kind===b.name).length:0,viewpoints:((M=m==null?void 0:m.viewpoints)==null?void 0:M.filter(A=>A.visibleKinds.includes(b.name)).map(A=>A.id))??[]}})}))}),[s,m]),E=L.find(n=>n.id===u)??L[0],j=a.useMemo(()=>{if(!E.layerIds)return g.layers;const n=new Set(E.layerIds);return g.layers.filter(b=>n.has(b.id))},[g.layers,E.layerIds]),w=a.useMemo(()=>{if(!d)return null;for(const n of g.layers){const b=n.kinds.find(M=>M.name===d);if(b)return{kind:b,layerInfo:n}}return null},[d,g]);function q(n,b){l(b),v({type:"ontology-detail",packageName:n})}function U(n){v({type:"ontology-detail",packageName:s.name,layerId:n})}const B={background:"#1B3A4B",color:"#2DD4A8",border:"1px solid transparent"},D={background:"#F0F0ED",color:"#6B7280",border:"1px solid transparent"};return e.jsxs("div",{className:"flex flex-1 overflow-hidden",style:{background:"#F7F7F5"},children:[e.jsxs("div",{className:"flex-1 overflow-y-auto",children:[e.jsxs("div",{className:"px-6 pt-5 pb-3",style:{borderBottom:"1px solid #E5E5E0"},children:[e.jsxs("div",{className:"flex items-center gap-1.5 mb-3 text-xs flex-wrap",style:{color:"#9CA3AF"},children:[i&&e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:i,className:"hover:underline",style:{color:"#2563EB"},children:"Ontology Library"}),e.jsx("span",{children:"/"})]}),e.jsx("button",{onClick:()=>l(null),className:"hover:underline",style:{color:w?"#2563EB":"#374151",fontWeight:w?400:500},children:s.name}),w&&e.jsxs(e.Fragment,{children:[e.jsx("span",{children:"/"}),e.jsx("button",{onClick:()=>U(w.layerInfo.id),className:"hover:underline",style:{color:"#2563EB"},children:w.layerInfo.label}),e.jsx("span",{children:"/"}),e.jsx("span",{style:{color:"#1a1a1a",fontWeight:600},children:d})]})]}),e.jsx(G,{ontology:g}),e.jsxs("div",{className:"flex items-center gap-2 mt-3",children:[e.jsx("span",{className:"text-xs",style:{color:"#9CA3AF"},children:"Layers:"}),e.jsx("button",{onClick:()=>f("visual"),className:"px-2.5 py-1 text-xs rounded-md font-medium",style:r==="visual"?B:D,children:"Visual"}),e.jsx("button",{onClick:()=>f("table"),className:"px-2.5 py-1 text-xs rounded-md font-medium",style:r==="table"?B:D,children:"Table"}),e.jsx("span",{style:{width:"1px",height:"16px",background:"#E5E5E0",margin:"0 4px"}}),e.jsxs("button",{onClick:c,className:"px-2.5 py-1 text-xs rounded-md font-medium",style:o?B:D,children:[o?"Hide":"Show"," Relationships"]})]}),e.jsxs("div",{className:"flex items-center gap-0 mt-3 -mx-6 px-6",style:{borderTop:"1px solid #E5E5E0",paddingTop:"10px"},children:[e.jsx("span",{className:"text-xs mr-2",style:{color:"#9CA3AF",whiteSpace:"nowrap"},children:"View:"}),e.jsx("div",{className:"flex items-center gap-1 flex-wrap",children:L.map(n=>{const b=u===n.id;return e.jsx("button",{onClick:()=>F(n.id),title:n.description,className:"px-2.5 py-1 text-xs rounded-md font-medium transition-all",style:b?B:D,children:n.label},n.id)})}),j.length!==g.layers.length&&E.type!=="sysml-mapping"&&e.jsxs("span",{className:"ml-auto text-xs",style:{color:"#9CA3AF",whiteSpace:"nowrap"},children:[j.length," of ",g.layers.length," layers"]})]})]}),E.type==="sysml-mapping"?e.jsx("div",{className:"px-6 py-4",children:e.jsx(ee,{layers:g.layers})}):r==="visual"?e.jsxs(e.Fragment,{children:[e.jsx("div",{style:{height:"280px",position:"relative",borderBottom:"1px solid #E5E5E0"},children:e.jsx(re,{children:e.jsxs("div",{ref:x,style:{position:"relative"},children:[e.jsx(a.Suspense,{fallback:e.jsx(z,{layers:j}),children:e.jsx(ne,{layers:j,selectedKind:d,onKindClick:l,activeLayerId:p.layerId??null,flashKindName:H,flashTick:Z})}),o&&e.jsx(a.Suspense,{fallback:null,children:e.jsx(le,{containerRef:x,ontology:{...g,layers:j},activeTypes:h})})]})})}),o&&e.jsx("div",{className:"px-6 py-4",children:e.jsx(a.Suspense,{fallback:null,children:e.jsx(K,{ontology:{...g,layers:j},activeTypes:h,onActiveTypesChange:N})})})]}):e.jsxs("div",{className:"px-6 py-4",children:[e.jsx(a.Suspense,{fallback:e.jsx(z,{layers:j}),children:e.jsx(ie,{layers:j,selectedKind:d,onKindClick:l})}),o&&e.jsx(a.Suspense,{fallback:null,children:e.jsx(K,{ontology:{...g,layers:j},activeTypes:h,onActiveTypesChange:N})})]})]}),C&&w&&e.jsx(J,{kind:w.kind,layers:g.layers,allOntologies:t,onKindClick:l,onNavigate:q,onClose:()=>{l(null),k(!1)}})]})}function z({layers:s}){return e.jsx("div",{className:"grid gap-3 mb-6",style:{gridTemplateColumns:"repeat(auto-fill, minmax(220px, 1fr))"},children:s.map(i=>{const r=_[i.id]??i.color??"#6B7280";return e.jsxs("div",{className:"rounded-xl p-4",style:{background:"#FFFFFF",border:`2px solid ${r}30`},children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx("span",{className:"w-3 h-3 rounded",style:{backgroundColor:r}}),e.jsx("span",{className:"text-sm font-medium",style:{color:"#1a1a1a"},children:i.label})]}),e.jsxs("div",{className:"text-xs",style:{color:"#9CA3AF"},children:[i.kindCount," kinds"]})]},i.id)})})}const de=a.lazy(()=>O(()=>import("./OntologyDecompositionDiagram-IG1gj1c3.js"),__vite__mapDeps([9,1,2,10,11,3,4,12]))),$=Object.fromEntries(X.map((s,i)=>[s,i]));function me(){const s=y(p=>p.activeView),i=y(p=>p.availableOntologies),r=y(p=>p.setActiveView),f=y(p=>p.model),d=s.type==="ontology-detail",l=d?s.packageName:null,o=l?i.find(p=>p.name===l):null,c=a.useMemo(()=>{if(o||!d||!f)return null;const p=new Map;for(const t of Object.values(f.elements))p.has(t.layer)||p.set(t.layer,[]),p.get(t.layer).includes(t.kind)||p.get(t.layer).push(t.kind);const v=[...p.entries()].sort(([t],[x])=>($[t]??99)-($[x]??99)).map(([t,x])=>({id:t,label:t.charAt(0).toUpperCase()+t.slice(1),color:"#6B7280",kindCount:x.length,kinds:x.map(h=>({name:h,label:h.replace(/([A-Z])/g," $1").trim(),construct:"part def",layer:t,instanceCount:0,viewpoints:[]}))}));return{name:"@memo/model (inferred)",version:"–",type:"ontology",description:"Ontology inferred from loaded model elements.",layers:v,kindCount:v.reduce((t,x)=>t+x.kindCount,0),relationshipCount:0,relationshipTypes:[],selected:!0}},[o,d,f]),m=o??c;return d&&m?e.jsx(ce,{ontology:m,onBack:()=>r({type:"ontology"})}):e.jsx(a.Suspense,{fallback:e.jsx("div",{className:"flex-1 flex items-center justify-center",style:{background:"#F7F7F5"},children:e.jsx("span",{className:"text-sm",style:{color:"#9CA3AF"},children:"Loading ontology library..."})}),children:e.jsx(de,{})})}export{me as OntologyViewer,me as default};
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/LayerGrid-DEe0Ryz-.js","assets/reactflow-s7jmJtXx.js","assets/zustand-CrhqMOHB.js","assets/index-Bij8Q4Kg.js","assets/index-BWMNo4wW.css","assets/LayerTable-CN_b2rDr.js","assets/RelationshipsSection-BoJ0aUXe.js","assets/sysml-edge-styles-ByJeCWqa.js","assets/RelationshipOverlay-DL0N8Vmk.js","assets/OntologyDecompositionDiagram-BL9R8bdB.js","assets/layout-providers-Dr743WlP.js","assets/elk-6l8mIQnQ.js","assets/style-BZV40eAE.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{h as _,u as y,_ as O,L as X}from"./index-Bij8Q4Kg.js";import{j as e}from"./reactflow-s7jmJtXx.js";import{a}from"./zustand-CrhqMOHB.js";function G({ontology:s}){const i=s.layers.reduce((r,f)=>r+f.kinds.reduce((d,l)=>d+l.instanceCount,0),0);return e.jsxs("div",{className:"rounded-xl p-5 mb-5",style:{background:"#FFFFFF",border:"1px solid #E5E5E0",boxShadow:"0 1px 3px rgba(0,0,0,0.04)"},children:[e.jsx("div",{className:"flex items-start justify-between gap-3 mb-3",children:e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("span",{className:"px-2 py-0.5 text-xs rounded-full font-medium",style:{background:"#EFF6FF",color:"#2563EB",border:"1px solid #BFDBFE"},children:s.type}),s.extends&&e.jsxs("span",{className:"text-xs",style:{color:"#9CA3AF"},children:["extends ",s.extends]})]}),e.jsx("h2",{className:"text-base font-semibold truncate",style:{color:"#1a1a1a"},children:s.name}),e.jsxs("div",{className:"text-xs mt-0.5",style:{color:"#9CA3AF"},children:["v",s.version]})]})}),s.description&&e.jsx("p",{className:"text-sm mb-4",style:{color:"#6B7280",lineHeight:"1.5"},children:s.description}),e.jsxs("div",{className:"flex gap-5 text-xs",style:{color:"#6B7280"},children:[e.jsxs("div",{children:[e.jsx("span",{className:"font-semibold text-sm",style:{color:"#1B3A4B"},children:s.kindCount})," ","kinds"]}),e.jsxs("div",{children:[e.jsx("span",{className:"font-semibold text-sm",style:{color:"#1B3A4B"},children:s.layers.length})," ","layers"]}),i>0&&e.jsxs("div",{children:[e.jsx("span",{className:"font-semibold text-sm",style:{color:"#1B3A4B"},children:i})," ","model instances"]})]})]})}function J({kind:s,layers:i,onKindClick:r,onClose:f,allOntologies:d,onNavigate:l}){const o=_[s.layer]??"#6B7280",c=i.flatMap(t=>t.kinds),m=s.derivesFrom?c.find(t=>t.name===s.derivesFrom):null;function p(t){if(i.some(x=>x.kinds.some(h=>h.name===t)))return null;for(const x of d??[])if(x.layers.some(h=>h.kinds.some(N=>N.name===t)))return x.name;return null}function v(t){const x=p(t);x&&l?l(x,t):r(t)}return e.jsxs("div",{className:"flex flex-col border-l overflow-y-auto",style:{width:320,minWidth:320,background:"#FFFFFF",borderColor:"#E5E5E0"},children:[e.jsxs("div",{className:"flex items-center justify-between p-4 border-b",style:{borderColor:"#E5E5E0"},children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsx("span",{className:"w-3 h-3 rounded flex-shrink-0",style:{backgroundColor:o}}),e.jsx("h3",{className:"text-sm font-semibold truncate",style:{color:"#1a1a1a"},children:s.label})]}),e.jsx("button",{onClick:f,className:"text-sm px-1.5 rounded hover:bg-gray-100",style:{color:"#9CA3AF"},children:"✕"})]}),e.jsxs("div",{className:"p-4 space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("span",{className:"px-2 py-0.5 text-xs rounded font-mono",style:{background:"#F3F4F6",color:"#4B5563",border:"1px solid #E5E7EB"},children:s.construct}),e.jsx("span",{className:"px-2 py-0.5 text-xs rounded font-medium",style:{background:`${o}15`,color:o,border:`1px solid ${o}30`},children:s.layer})]}),s.description&&e.jsx(S,{title:"Description",children:e.jsx("p",{className:"text-xs leading-relaxed",style:{color:"#6B7280"},children:s.description})}),s.derivesFrom&&e.jsx(S,{title:"Derives From",children:e.jsx(I,{name:s.derivesFrom,layer:m==null?void 0:m.layer,crossOntology:p(s.derivesFrom)!==null,onClick:()=>v(s.derivesFrom)})}),s.derivedBy&&s.derivedBy.length>0&&e.jsx(S,{title:`Derived By (${s.derivedBy.length})`,children:e.jsx("div",{className:"flex flex-wrap gap-1.5",children:s.derivedBy.map(t=>{const x=c.find(h=>h.name===t);return e.jsx(I,{name:t,layer:x==null?void 0:x.layer,crossOntology:p(t)!==null,onClick:()=>v(t)},t)})})}),s.relationships&&s.relationships.length>0&&e.jsx(S,{title:`Relationships (${s.relationships.length})`,children:e.jsx("div",{className:"space-y-1",children:s.relationships.map((t,x)=>e.jsxs("div",{className:"flex items-center gap-1.5 text-xs",style:{color:"#6B7280"},children:[e.jsx("span",{style:{color:t.direction==="outgoing"?"#10B981":"#8B5CF6"},children:t.direction==="outgoing"?"→":"←"}),e.jsx("span",{className:"font-medium",style:{color:"#374151"},children:t.type}),e.jsx("button",{className:"hover:underline",style:{color:"#2563EB"},onClick:()=>v(t.targetKind),children:t.targetKind})]},x))})}),e.jsxs(S,{title:"Usage",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsx(V,{label:"Instances",value:s.instanceCount}),e.jsx(V,{label:"Viewpoints",value:s.viewpoints.length})]}),s.viewpoints.length>0&&e.jsx("div",{className:"flex flex-wrap gap-1 mt-2",children:s.viewpoints.map(t=>e.jsx("span",{className:"px-1.5 py-0.5 text-xs rounded",style:{background:"#F3F4F6",color:"#6B7280"},children:t},t))})]})]})]})}function S({title:s,children:i}){return e.jsxs("div",{children:[e.jsx("h4",{className:"text-xs font-medium mb-1.5",style:{color:"#9CA3AF",textTransform:"uppercase",letterSpacing:"0.05em"},children:s}),i]})}function I({name:s,layer:i,crossOntology:r,onClick:f}){const d=i?_[i]??"#6B7280":"#6B7280";return e.jsxs("button",{onClick:f,className:"inline-flex items-center gap-1.5 px-2 py-1 text-xs rounded-md hover:bg-gray-50",style:{border:"1px solid #E5E7EB",color:"#374151"},title:r?"Navigate to this kind in another ontology package":void 0,children:[e.jsx("span",{className:"w-2 h-2 rounded-full flex-shrink-0",style:{backgroundColor:d}}),s.replace(/([A-Z])/g," $1").trim(),r&&e.jsx("span",{style:{color:"#9CA3AF",fontSize:"9px"},children:"↗"})]})}function V({label:s,value:i}){return e.jsxs("div",{className:"rounded-lg p-2",style:{background:"#F9FAFB",border:"1px solid #F3F4F6"},children:[e.jsx("div",{className:"text-sm font-semibold",style:{color:"#1B3A4B"},children:i}),e.jsx("div",{className:"text-xs",style:{color:"#9CA3AF"},children:s})]})}const P={"part def":{label:"Part Definition",shorthand:"pd",description:"Defines a structural classifier (composite part)"},"connection def":{label:"Connection Definition",shorthand:"cd",description:"Defines a connector type between parts"},"attribute def":{label:"Attribute Definition",shorthand:"ad",description:"Defines a typed value property"},"item def":{label:"Item Definition",shorthand:"id",description:"Defines a flow item type"},"action def":{label:"Action Definition",shorthand:"acd",description:"Defines a behavioral action"},"state def":{label:"State Definition",shorthand:"sd",description:"Defines a state machine type"},"requirement def":{label:"Requirement Definition",shorthand:"rd",description:"Defines a requirement type"},"use case def":{label:"Use Case Definition",shorthand:"ucd",description:"Defines a use case type"},"occurrence def":{label:"Occurrence Definition",shorthand:"od",description:"Defines an occurrence (event or snapshot)"},"interface def":{label:"Interface Definition",shorthand:"ifd",description:"Defines a port interface type"},"port def":{label:"Port Definition",shorthand:"ptd",description:"Defines a port type for system interfaces"},"metadata def":{label:"Metadata Definition",shorthand:"md",description:"Defines a metadata annotation type"}},Q={purpose:"#cce5ff",business:"#cce5ff",operational:"#cce5ff",requirements:"#dae8fc",functional:"#d5e8d4",behavior:"#d5e8d4",logical:"#d5e8d4",physical:"#ffe6cc",software:"#d5e8d4",interfaces:"#d5e8d4",ui:"#d5e8d4",risk:"#f8cecc",safety:"#f8cecc",cybersecurity:"#f8cecc",verification:"#e1d5e7",analysis:"#e1d5e7","design-control":"#fff2cc",qms:"#fff2cc","software-lifecycle":"#fff2cc",operations:"#fff2cc",clinical:"#fff2cc",privacy:"#fff2cc"};function ee({layers:s}){const i=[],r=new Map;for(const l of s)for(const o of l.kinds){const c=o.construct||"part def";r.has(c)||r.set(c,[]),r.get(c).push({kindName:o.name,layer:l.id,layerLabel:l.label,layerColor:Q[l.id]??"#f3f4f6",derivesFrom:o.derivesFrom,description:o.description})}const f=Object.keys(P),d=[...r.keys()].sort((l,o)=>{const c=f.indexOf(l),m=f.indexOf(o);return c===-1&&m===-1?l.localeCompare(o):c===-1?1:m===-1?-1:c-m});for(const l of d){const o=r.get(l).sort((m,p)=>m.kindName.localeCompare(p.kindName)),c=P[l];i.push({construct:l,label:(c==null?void 0:c.label)??l,shorthand:(c==null?void 0:c.shorthand)??l,description:(c==null?void 0:c.description)??"",kinds:o})}return i.length===0?e.jsx("div",{className:"py-8 text-center text-sm",style:{color:"#9CA3AF"},children:"No kinds found in the selected viewpoint."}):e.jsxs("div",{style:{fontFamily:"inherit"},children:[e.jsxs("div",{className:"mb-4",children:[e.jsx("h3",{className:"text-sm font-semibold mb-1",style:{color:"#1a1a1a"},children:"SysML v2 Construct Mapping"}),e.jsx("p",{className:"text-xs",style:{color:"#9CA3AF"},children:"Each SysML v2 construct keyword and the MEMO kinds that use it. Shorthand codes appear on kind cards throughout the viewer."})]}),e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"16px"},children:i.map(l=>e.jsx(se,{group:l},l.construct))})]})}function se({group:s}){return e.jsxs("div",{style:{border:"1px solid #E5E5E0",borderRadius:"10px",overflow:"hidden"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"10px",padding:"8px 12px",background:"#F7F7F5",borderBottom:"1px solid #E5E5E0"},children:[e.jsx("code",{style:{fontSize:"11px",fontFamily:"monospace",background:"#1B3A4B",color:"#2DD4A8",padding:"2px 6px",borderRadius:"4px",letterSpacing:"0.02em"},children:s.construct}),e.jsx("span",{className:"text-sm font-semibold",style:{color:"#1a1a1a"},children:s.label}),e.jsx("span",{style:{fontSize:"10px",color:"#6B7280",fontFamily:"monospace",background:"#EBEBEB",padding:"1px 5px",borderRadius:"3px"},children:s.shorthand}),s.description&&e.jsxs("span",{className:"text-xs ml-1",style:{color:"#9CA3AF"},children:["— ",s.description]}),e.jsxs("span",{className:"ml-auto text-xs",style:{color:"#9CA3AF"},children:[s.kinds.length," kind",s.kinds.length!==1?"s":""]})]}),e.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:"6px",padding:"10px 12px"},children:s.kinds.map(i=>e.jsx(te,{kind:i},i.kindName))})]})}function te({kind:s}){return e.jsxs("div",{title:s.description??s.kindName,style:{display:"inline-flex",alignItems:"center",gap:"5px",padding:"3px 8px",background:s.layerColor,borderRadius:"5px",fontSize:"11px",fontWeight:500,color:"#1a1a1a",border:"1px solid rgba(0,0,0,0.06)",whiteSpace:"nowrap"},children:[e.jsx("span",{style:{fontWeight:600},children:s.kindName}),e.jsx("span",{style:{fontSize:"9px",color:"#6B7280",background:"rgba(255,255,255,0.55)",padding:"1px 4px",borderRadius:"3px"},children:s.layerLabel}),s.derivesFrom&&e.jsxs("span",{style:{fontSize:"9px",color:"#9CA3AF",fontStyle:"italic"},title:`Specializes ${s.derivesFrom}`,children:[":> ",s.derivesFrom]})]})}const ne=a.lazy(()=>O(()=>import("./LayerGrid-DEe0Ryz-.js"),__vite__mapDeps([0,1,2,3,4])).then(s=>({default:s.LayerGrid}))),ie=a.lazy(()=>O(()=>import("./LayerTable-CN_b2rDr.js"),__vite__mapDeps([5,1,2,3,4])).then(s=>({default:s.LayerTable}))),K=a.lazy(()=>O(()=>import("./RelationshipsSection-BoJ0aUXe.js"),__vite__mapDeps([6,1,2,7])).then(s=>({default:s.RelationshipsSection}))),le=a.lazy(()=>O(()=>import("./RelationshipOverlay-DL0N8Vmk.js"),__vite__mapDeps([8,1,2,7])).then(s=>({default:s.RelationshipOverlay}))),L=[{id:"all",label:"All Layers",layerIds:null,description:"All architecture layers in swimlane view"},{id:"software",label:"Software Views",layerIds:["functional","behavior","logical","software","interfaces","ui"],description:"Software architecture: Logical/Service, Runtime, Module/Code, Deployment"},{id:"hardware",label:"Hardware Views",layerIds:["logical","physical","interfaces"],description:"Hardware architecture: Logical, Physical/Embodiment, Compute/Electronics, Cross-domain"},{id:"risk",label:"Risk Chain",layerIds:["requirements","risk","safety","cybersecurity","verification","analysis"],description:"Risk trace chain: Hazard → HazardousSituation → Harm → RiskControlMeasure → verification"},{id:"traceability",label:"Traceability",layerIds:["purpose","business","operational","requirements","risk","safety","functional","software","software-lifecycle","verification","analysis"],description:"Full trace: clinical, risk, software, and hardware chains"},{id:"sysml-mapping",label:"SysML Mapping",layerIds:null,type:"sysml-mapping",description:"SysML v2 construct → MEMO kind reference table"}],ae=.3,oe=2.5,R=.15;function re({children:s}){const[i,r]=a.useState(1),[f,d]=a.useState({x:0,y:0}),l=a.useRef(!1),o=a.useRef({x:0,y:0}),c=a.useRef(null),m=u=>Math.max(ae,Math.min(oe,u)),p=a.useCallback(u=>{u.preventDefault();const F=u.deltaY<0?R:-R;r(C=>m(C+F))},[]),v=a.useCallback(u=>{u.target.closest("button, input, a")||(l.current=!0,o.current={x:u.clientX,y:u.clientY},u.currentTarget.setAttribute("data-panning","true"))},[]),t=a.useCallback(u=>{if(!l.current)return;const F=u.clientX-o.current.x,C=u.clientY-o.current.y;o.current={x:u.clientX,y:u.clientY},d(k=>({x:k.x+F,y:k.y+C}))},[]),x=a.useCallback(u=>{l.current=!1,u.currentTarget.removeAttribute("data-panning")},[]),h=a.useCallback(u=>{l.current=!1,u.currentTarget.removeAttribute("data-panning")},[]);function N(){r(1),d({x:0,y:0})}return e.jsxs("div",{style:{position:"relative",width:"100%",height:"100%"},children:[e.jsxs("div",{style:{position:"absolute",top:"10px",right:"10px",zIndex:10,display:"flex",gap:"4px",background:"rgba(255,255,255,0.92)",border:"1px solid #E5E5E0",borderRadius:"8px",padding:"4px",boxShadow:"0 2px 8px rgba(0,0,0,0.08)"},children:[e.jsx(T,{title:"Zoom in",onClick:()=>r(u=>m(u+R)),children:"+"}),e.jsxs("span",{style:{fontSize:"10px",color:"#6B7280",lineHeight:"26px",minWidth:"34px",textAlign:"center"},children:[Math.round(i*100),"%"]}),e.jsx(T,{title:"Zoom out",onClick:()=>r(u=>m(u-R)),children:"−"}),e.jsx("div",{style:{width:"1px",background:"#E5E5E0",margin:"2px 0"}}),e.jsx(T,{title:"Fit to view",onClick:N,children:"⊡"})]}),e.jsx("div",{ref:c,onWheel:p,onMouseDown:v,onMouseMove:t,onMouseUp:x,onMouseLeave:h,style:{width:"100%",height:"100%",overflow:"hidden",cursor:l.current?"grabbing":"grab",userSelect:"none"},children:e.jsx("div",{style:{transform:`translate(${f.x}px, ${f.y}px) scale(${i})`,transformOrigin:"0 0",willChange:"transform",padding:"16px"},children:s})})]})}function T({onClick:s,title:i,children:r}){return e.jsx("button",{onClick:s,title:i,style:{width:"26px",height:"26px",border:"none",borderRadius:"5px",background:"transparent",cursor:"pointer",fontSize:"14px",color:"#374151",display:"flex",alignItems:"center",justifyContent:"center",lineHeight:1},onMouseEnter:f=>{f.currentTarget.style.background="#F0F0ED"},onMouseLeave:f=>{f.currentTarget.style.background="transparent"},children:r})}function ce({ontology:s,onBack:i}){const r=y(n=>n.ontologyViewMode),f=y(n=>n.setOntologyViewMode),d=y(n=>n.selectedOntologyKind),l=y(n=>n.setSelectedOntologyKind),o=y(n=>n.showOntologyRelationships),c=y(n=>n.toggleOntologyRelationships),m=y(n=>n.model),p=y(n=>n.activeView),v=y(n=>n.setActiveView),t=y(n=>n.availableOntologies),x=a.useRef(null),[h,N]=a.useState(new Set),[u,F]=a.useState("all"),[C,k]=a.useState(!1),[H,W]=a.useState(null),[Z,Y]=a.useState(0);a.useEffect(()=>{d&&(k(!0),W(d),Y(n=>n+1))},[d]);const g=a.useMemo(()=>({...s,layers:s.layers.map(n=>({...n,kinds:n.kinds.map(b=>{var M;return{...b,instanceCount:m?Object.values(m.elements).filter(A=>A.kind===b.name).length:0,viewpoints:((M=m==null?void 0:m.viewpoints)==null?void 0:M.filter(A=>A.visibleKinds.includes(b.name)).map(A=>A.id))??[]}})}))}),[s,m]),E=L.find(n=>n.id===u)??L[0],j=a.useMemo(()=>{if(!E.layerIds)return g.layers;const n=new Set(E.layerIds);return g.layers.filter(b=>n.has(b.id))},[g.layers,E.layerIds]),w=a.useMemo(()=>{if(!d)return null;for(const n of g.layers){const b=n.kinds.find(M=>M.name===d);if(b)return{kind:b,layerInfo:n}}return null},[d,g]);function q(n,b){l(b),v({type:"ontology-detail",packageName:n})}function U(n){v({type:"ontology-detail",packageName:s.name,layerId:n})}const B={background:"#1B3A4B",color:"#2DD4A8",border:"1px solid transparent"},D={background:"#F0F0ED",color:"#6B7280",border:"1px solid transparent"};return e.jsxs("div",{className:"flex flex-1 overflow-hidden",style:{background:"#F7F7F5"},children:[e.jsxs("div",{className:"flex-1 overflow-y-auto",children:[e.jsxs("div",{className:"px-6 pt-5 pb-3",style:{borderBottom:"1px solid #E5E5E0"},children:[e.jsxs("div",{className:"flex items-center gap-1.5 mb-3 text-xs flex-wrap",style:{color:"#9CA3AF"},children:[i&&e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:i,className:"hover:underline",style:{color:"#2563EB"},children:"Ontology Library"}),e.jsx("span",{children:"/"})]}),e.jsx("button",{onClick:()=>l(null),className:"hover:underline",style:{color:w?"#2563EB":"#374151",fontWeight:w?400:500},children:s.name}),w&&e.jsxs(e.Fragment,{children:[e.jsx("span",{children:"/"}),e.jsx("button",{onClick:()=>U(w.layerInfo.id),className:"hover:underline",style:{color:"#2563EB"},children:w.layerInfo.label}),e.jsx("span",{children:"/"}),e.jsx("span",{style:{color:"#1a1a1a",fontWeight:600},children:d})]})]}),e.jsx(G,{ontology:g}),e.jsxs("div",{className:"flex items-center gap-2 mt-3",children:[e.jsx("span",{className:"text-xs",style:{color:"#9CA3AF"},children:"Layers:"}),e.jsx("button",{onClick:()=>f("visual"),className:"px-2.5 py-1 text-xs rounded-md font-medium",style:r==="visual"?B:D,children:"Visual"}),e.jsx("button",{onClick:()=>f("table"),className:"px-2.5 py-1 text-xs rounded-md font-medium",style:r==="table"?B:D,children:"Table"}),e.jsx("span",{style:{width:"1px",height:"16px",background:"#E5E5E0",margin:"0 4px"}}),e.jsxs("button",{onClick:c,className:"px-2.5 py-1 text-xs rounded-md font-medium",style:o?B:D,children:[o?"Hide":"Show"," Relationships"]})]}),e.jsxs("div",{className:"flex items-center gap-0 mt-3 -mx-6 px-6",style:{borderTop:"1px solid #E5E5E0",paddingTop:"10px"},children:[e.jsx("span",{className:"text-xs mr-2",style:{color:"#9CA3AF",whiteSpace:"nowrap"},children:"View:"}),e.jsx("div",{className:"flex items-center gap-1 flex-wrap",children:L.map(n=>{const b=u===n.id;return e.jsx("button",{onClick:()=>F(n.id),title:n.description,className:"px-2.5 py-1 text-xs rounded-md font-medium transition-all",style:b?B:D,children:n.label},n.id)})}),j.length!==g.layers.length&&E.type!=="sysml-mapping"&&e.jsxs("span",{className:"ml-auto text-xs",style:{color:"#9CA3AF",whiteSpace:"nowrap"},children:[j.length," of ",g.layers.length," layers"]})]})]}),E.type==="sysml-mapping"?e.jsx("div",{className:"px-6 py-4",children:e.jsx(ee,{layers:g.layers})}):r==="visual"?e.jsxs(e.Fragment,{children:[e.jsx("div",{style:{height:"280px",position:"relative",borderBottom:"1px solid #E5E5E0"},children:e.jsx(re,{children:e.jsxs("div",{ref:x,style:{position:"relative"},children:[e.jsx(a.Suspense,{fallback:e.jsx(z,{layers:j}),children:e.jsx(ne,{layers:j,selectedKind:d,onKindClick:l,activeLayerId:p.layerId??null,flashKindName:H,flashTick:Z})}),o&&e.jsx(a.Suspense,{fallback:null,children:e.jsx(le,{containerRef:x,ontology:{...g,layers:j},activeTypes:h})})]})})}),o&&e.jsx("div",{className:"px-6 py-4",children:e.jsx(a.Suspense,{fallback:null,children:e.jsx(K,{ontology:{...g,layers:j},activeTypes:h,onActiveTypesChange:N})})})]}):e.jsxs("div",{className:"px-6 py-4",children:[e.jsx(a.Suspense,{fallback:e.jsx(z,{layers:j}),children:e.jsx(ie,{layers:j,selectedKind:d,onKindClick:l})}),o&&e.jsx(a.Suspense,{fallback:null,children:e.jsx(K,{ontology:{...g,layers:j},activeTypes:h,onActiveTypesChange:N})})]})]}),C&&w&&e.jsx(J,{kind:w.kind,layers:g.layers,allOntologies:t,onKindClick:l,onNavigate:q,onClose:()=>{l(null),k(!1)}})]})}function z({layers:s}){return e.jsx("div",{className:"grid gap-3 mb-6",style:{gridTemplateColumns:"repeat(auto-fill, minmax(220px, 1fr))"},children:s.map(i=>{const r=_[i.id]??i.color??"#6B7280";return e.jsxs("div",{className:"rounded-xl p-4",style:{background:"#FFFFFF",border:`2px solid ${r}30`},children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx("span",{className:"w-3 h-3 rounded",style:{backgroundColor:r}}),e.jsx("span",{className:"text-sm font-medium",style:{color:"#1a1a1a"},children:i.label})]}),e.jsxs("div",{className:"text-xs",style:{color:"#9CA3AF"},children:[i.kindCount," kinds"]})]},i.id)})})}const de=a.lazy(()=>O(()=>import("./OntologyDecompositionDiagram-BL9R8bdB.js"),__vite__mapDeps([9,1,2,10,11,3,4,12]))),$=Object.fromEntries(X.map((s,i)=>[s,i]));function me(){const s=y(p=>p.activeView),i=y(p=>p.availableOntologies),r=y(p=>p.setActiveView),f=y(p=>p.model),d=s.type==="ontology-detail",l=d?s.packageName:null,o=l?i.find(p=>p.name===l):null,c=a.useMemo(()=>{if(o||!d||!f)return null;const p=new Map;for(const t of Object.values(f.elements))p.has(t.layer)||p.set(t.layer,[]),p.get(t.layer).includes(t.kind)||p.get(t.layer).push(t.kind);const v=[...p.entries()].sort(([t],[x])=>($[t]??99)-($[x]??99)).map(([t,x])=>({id:t,label:t.charAt(0).toUpperCase()+t.slice(1),color:"#6B7280",kindCount:x.length,kinds:x.map(h=>({name:h,label:h.replace(/([A-Z])/g," $1").trim(),construct:"part def",layer:t,instanceCount:0,viewpoints:[]}))}));return{name:"@memo/model (inferred)",version:"–",type:"ontology",description:"Ontology inferred from loaded model elements.",layers:v,kindCount:v.reduce((t,x)=>t+x.kindCount,0),relationshipCount:0,relationshipTypes:[],selected:!0}},[o,d,f]),m=o??c;return d&&m?e.jsx(ce,{ontology:m,onBack:()=>r({type:"ontology"})}):e.jsx(a.Suspense,{fallback:e.jsx("div",{className:"flex-1 flex items-center justify-center",style:{background:"#F7F7F5"},children:e.jsx("span",{className:"text-sm",style:{color:"#9CA3AF"},children:"Loading ontology library..."})}),children:e.jsx(de,{})})}export{me as OntologyViewer,me as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as d}from"./reactflow-
|
|
1
|
+
import{j as d}from"./reactflow-s7jmJtXx.js";import{a as k}from"./zustand-CrhqMOHB.js";import{g as W}from"./sysml-edge-styles-ByJeCWqa.js";const x="memo-sysml-edge-defs";function $(){if(document.getElementById(x))return;const e=document.createElementNS("http://www.w3.org/2000/svg","svg");e.id=x,e.setAttribute("style","position:absolute;width:0;height:0;overflow:hidden"),e.setAttribute("aria-hidden","true"),e.innerHTML=`
|
|
2
2
|
<defs>
|
|
3
3
|
<!-- Open arrowhead -->
|
|
4
4
|
<marker id="sysml-arrow" viewBox="0 0 10 10" refX="9" refY="5"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e}from"./reactflow-
|
|
1
|
+
import{j as e}from"./reactflow-s7jmJtXx.js";import{a as g}from"./zustand-CrhqMOHB.js";import{D as h,g as y}from"./sysml-edge-styles-ByJeCWqa.js";function m({style:o}){const r=o.color,i=o.lineStyle==="dashed"?"4,3":void 0,x=o.sourceMarker==="diamond-open"?e.jsx("polygon",{points:"0,7 5,3 10,7 5,11",fill:"white",stroke:r,strokeWidth:1.2}):o.sourceMarker==="diamond-filled"?e.jsx("polygon",{points:"0,7 5,3 10,7 5,11",fill:r,stroke:r,strokeWidth:1}):null,d=o.sourceMarker!=="none"?10:2,c=o.targetMarker!=="none"?27:34,t=o.targetMarker==="arrow"?e.jsx("polyline",{points:`${c},3 34,7 ${c},11`,fill:"none",stroke:r,strokeWidth:1.2}):o.targetMarker==="filled-arrow"?e.jsx("polygon",{points:`${c},3 34,7 ${c},11`,fill:r,stroke:"none"}):o.targetMarker==="triangle-open"?e.jsx("polygon",{points:`${c},2 34,7 ${c},12`,fill:"white",stroke:r,strokeWidth:1.2}):o.targetMarker==="circle"?e.jsx("circle",{cx:31,cy:7,r:3.5,fill:"white",stroke:r,strokeWidth:1.2}):null;return e.jsxs("svg",{width:36,height:14,style:{display:"inline-block",flexShrink:0,verticalAlign:"middle"},"aria-hidden":"true",children:[x,e.jsx("line",{x1:d,y1:7,x2:c,y2:7,stroke:r,strokeWidth:1.5,strokeDasharray:i}),t]})}function u({name:o,active:n,onClick:p}){const s=y(o),r=s.color;return e.jsxs("button",{onClick:p,title:s.stereotype?`«${s.stereotype}»`:o,style:{display:"inline-flex",alignItems:"center",gap:"5px",padding:"3px 7px 3px 5px",borderRadius:"6px",border:`1px solid ${n?r:`${r}30`}`,background:n?`${r}18`:"transparent",cursor:"pointer",fontSize:"10px",color:n?r:"#6B7280",fontWeight:n?600:400,transition:"all 0.15s ease",whiteSpace:"nowrap"},onMouseEnter:i=>{n||(i.currentTarget.style.background=`${r}08`)},onMouseLeave:i=>{n||(i.currentTarget.style.background="transparent")},children:[e.jsx(m,{style:s}),e.jsx("span",{children:o}),s.stereotype&&e.jsxs("span",{style:{fontSize:"9px",opacity:.7},children:["«",s.stereotype,"»"]})]})}function k({group:o,presentTypes:n,activeTypes:p,onToggleType:s,onToggleGroup:r}){const[i,x]=g.useState(!1);if(n.length===0)return null;const d=n.every(t=>p.has(t)),c=n.some(t=>p.has(t));return e.jsxs("div",{style:{marginBottom:"8px"},children:[e.jsxs("div",{className:"flex items-center gap-2 cursor-pointer select-none",style:{padding:"4px 8px",borderRadius:"6px",background:o.color.bg,marginBottom:i?0:"5px"},onClick:()=>x(t=>!t),children:[e.jsx("svg",{width:"8",height:"8",viewBox:"0 0 16 16",fill:"none",style:{transition:"transform 150ms",transform:i?"rotate(-90deg)":"rotate(0deg)",flexShrink:0},children:e.jsx("path",{d:"M4 6L8 10L12 6",stroke:o.color.text,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),e.jsx("span",{style:{fontSize:"10px",fontWeight:700,color:o.color.text,textTransform:"uppercase",letterSpacing:"0.06em",flex:1},children:o.label}),e.jsxs("span",{style:{fontSize:"9px",color:o.color.text,opacity:.7},children:[n.length," types"]}),e.jsx("button",{onClick:t=>{t.stopPropagation(),r(n)},style:{fontSize:"9px",color:o.color.text,opacity:d?1:c?.7:.5,fontWeight:d?700:400,border:"none",background:"transparent",cursor:"pointer",padding:"0 2px"},title:d?"Deselect all":"Select all in group",children:d?"✓ all":"all"})]}),!i&&e.jsx("div",{className:"flex flex-wrap gap-1.5",style:{paddingLeft:"8px"},children:n.map(t=>e.jsx(u,{name:t,active:p.has(t),onClick:()=>s(t)},t))})]})}function w({ontology:o,activeTypes:n,onActiveTypesChange:p}){const s=g.useMemo(()=>{const t=new Set;for(const a of o.relationshipTypes??[])t.add(a.name);return t},[o.relationshipTypes]);if(s.size===0)return null;const r=s.size,i=n.size;function x(t){const a=new Set(n);a.has(t)?a.delete(t):a.add(t),p(a)}function d(t){const a=t.every(f=>n.has(f)),l=new Set(n);if(a)for(const f of t)l.delete(f);else for(const f of t)l.add(f);p(l)}function c(){p(new Set)}return e.jsxs("div",{className:"mt-4",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[e.jsx("span",{style:{fontSize:"12px",fontWeight:600,color:"#374151",letterSpacing:"0.04em",textTransform:"uppercase"},children:"Relationships"}),e.jsxs("span",{style:{fontSize:"11px",color:"#9CA3AF"},children:[r," types"]}),i>0&&e.jsxs(e.Fragment,{children:[e.jsxs("span",{style:{fontSize:"10px",fontWeight:600,color:"#2563EB",background:"#EFF6FF",border:"1px solid #BFDBFE",borderRadius:"8px",padding:"1px 7px"},children:[i," active"]}),e.jsx("button",{onClick:c,style:{fontSize:"10px",color:"#6B7280",border:"none",background:"transparent",cursor:"pointer",padding:"0 2px"},children:"Clear"})]}),i===0&&e.jsx("span",{style:{fontSize:"10px",color:"#9CA3AF",fontStyle:"italic"},children:"click a type or group to filter edges"})]}),h.map(t=>{const a=t.types.filter(l=>s.has(l));return e.jsx(k,{group:t,presentTypes:a,activeTypes:n,onToggleType:x,onToggleGroup:d},t.id)}),(()=>{const t=new Set(h.flatMap(l=>l.types)),a=[...s].filter(l=>!t.has(l));return a.length===0?null:e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:"10px",fontWeight:700,color:"#6B7280",textTransform:"uppercase",letterSpacing:"0.06em",marginBottom:"5px"},children:"Other"}),e.jsx("div",{className:"flex flex-wrap gap-1.5",children:a.map(l=>e.jsx(u,{name:l,active:n.has(l),onClick:()=>x(l)},l))})]})})()]})}export{w as RelationshipsSection};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e}from"./reactflow-CsCqNKB-.js";import{a as j}from"./zustand-CrhqMOHB.js";import{u as g,f as F}from"./index-D0vtjNjX.js";function z({model:n}){const i=g(t=>t.setActiveView),s=g(t=>t.setExplorerTab),l=j.useMemo(()=>Object.values(n.elements).filter(t=>["system","subsystem","logicalcomponent","softwarecomponent","physicalcomponent"].includes(t.kind.toLowerCase())).slice(0,8),[n]),a=j.useMemo(()=>{const t={};for(const o of Object.values(n.elements))t[o.layer]=(t[o.layer]||0)+1;return t},[n]),x=Object.entries(a).sort((t,o)=>o[1]-t[1]).slice(0,5),p=Object.keys(n.elements).length;return e.jsxs("div",{style:w,children:[e.jsx(k,{icon:"🏗️",title:"System Architecture",badge:`${p} elements`,onExpand:()=>{s("model")}}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"12px"},children:[e.jsxs("div",{children:[e.jsx("div",{style:E,children:"Layer distribution"}),e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"6px"},children:x.map(([t,o])=>e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[e.jsx("div",{style:{width:"8px",height:"8px",borderRadius:"50%",background:F[t]||"#95A5A6",flexShrink:0}}),e.jsx("span",{style:{fontSize:"12px",color:"#374151",flex:1,textTransform:"capitalize"},children:t}),e.jsx("span",{style:{fontSize:"12px",fontWeight:600,color:"#6B7280"},children:o}),e.jsx("div",{style:{width:"60px",height:"4px",background:"#F3F4F6",borderRadius:"2px"},children:e.jsx("div",{style:{height:"100%",borderRadius:"2px",background:F[t]||"#95A5A6",width:`${Math.round(o/p*100)}%`}})})]},t))})]}),e.jsxs("div",{children:[e.jsx("div",{style:E,children:"Key components"}),l.length>0?e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:l.map(t=>e.jsxs("button",{onClick:()=>i({type:"element-detail",elementId:t.id}),style:{textAlign:"left",background:"none",border:"none",cursor:"pointer",padding:"3px 0",display:"flex",alignItems:"center",gap:"6px"},children:[e.jsx("span",{style:{fontSize:"10px",color:"#9CA3AF",fontFamily:"monospace"},children:t.kind}),e.jsx("span",{style:{fontSize:"12px",color:"#374151",fontWeight:500},children:t.name})]},t.id))}):e.jsx(C,{text:"No System or Subsystem elements yet"})]})]}),n.diagrams&&n.diagrams.length>0&&e.jsxs("div",{style:{marginTop:"12px",display:"flex",gap:"8px",flexWrap:"wrap"},children:[n.diagrams.slice(0,4).map(t=>e.jsxs("button",{onClick:()=>i({type:"diagram",diagramId:t.id}),style:q,onMouseEnter:o=>o.currentTarget.style.background="#E5E5E0",onMouseLeave:o=>o.currentTarget.style.background="#F3F4F6",children:["⊟ ",t.name]},t.id)),n.diagrams.length>4&&e.jsxs("span",{style:{fontSize:"11px",color:"#9CA3AF",alignSelf:"center"},children:["+",n.diagrams.length-4," more"]})]})]})}function R({model:n}){const i=g(t=>t.setActiveView),{reqs:s,withTestLink:l,withArchLink:a}=j.useMemo(()=>{const t=Object.values(n.elements),o=t.filter(d=>["systemrequirement","requirement","userneed"].includes(d.kind.toLowerCase())),f=new Set;for(const d of n.relationships)f.add(d.sourceId),f.add(d.targetId);const u=new Set(["test","verification","validationtest"]),y=new Set(["system","subsystem","logicalcomponent","softwarecomponent"]),c=new Set(t.filter(d=>u.has(d.kind.toLowerCase())).map(d=>d.id)),b=new Set(t.filter(d=>y.has(d.kind.toLowerCase())).map(d=>d.id));let r=0,S=0;for(const d of o){const A=n.relationships.filter(h=>h.sourceId===d.id||h.targetId===d.id).flatMap(h=>[h.sourceId,h.targetId]);A.some(h=>c.has(h))&&r++,A.some(h=>b.has(h))&&S++}return{reqs:o,withTestLink:r,withArchLink:S}},[n]),x=s.length>0?Math.round(l/s.length*100):0,p=s.length>0?Math.round(a/s.length*100):0;return e.jsxs("div",{style:w,children:[e.jsx(k,{icon:"📋",title:"Requirements",badge:`${s.length} total`,onExpand:()=>i({type:"traceability"})}),s.length===0?e.jsx(C,{text:"No requirements found. Add Requirement elements to your model."}):e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"10px"},children:[e.jsx(v,{label:"Verified by tests",percent:x,count:l,total:s.length,color:"#2DD4A8"}),e.jsx(v,{label:"Linked to architecture",percent:p,count:a,total:s.length,color:"#4A90D9"})]})]})}function I({model:n}){const i=g(t=>t.setActiveView),{hazards:s,riskControls:l,mitigatesCount:a,residualRiskCount:x}=j.useMemo(()=>{const t=Object.values(n.elements),o=t.filter(r=>r.kind.toLowerCase()==="hazard"),f=t.filter(r=>r.kind.toLowerCase()==="riskcontrol"),u=n.relationships.filter(r=>r.type.toLowerCase()==="mitigates"),y=u.length,c=new Set(u.map(r=>r.targetId)),b=o.filter(r=>!c.has(r.id)).length;return{hazards:o,riskControls:f,mitigatesCount:y,residualRiskCount:b}},[n]),p=s.length>0?Math.round((s.length-x)/s.length*100):0;return e.jsxs("div",{style:w,children:[e.jsx(k,{icon:"⚠️",title:"Risk Chain (ISO 14971)",badge:`${s.length} hazards`,onExpand:()=>i({type:"traceability"}),badgeColor:x>0?"#E74C3C":"#2ECC71"}),s.length===0?e.jsx(C,{text:"No hazards found. Add Hazard elements to start your ISO 14971 risk analysis."}):e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"10px"},children:[e.jsx(v,{label:"Hazards mitigated",percent:p,count:s.length-x,total:s.length,color:"#2ECC71",warningThreshold:80}),e.jsxs("div",{style:{display:"flex",gap:"16px"},children:[e.jsx(m,{label:"Risk controls",value:l.length}),e.jsx(m,{label:"Mitigates links",value:a}),x>0&&e.jsx(m,{label:"Unmitigated hazards",value:x,alert:!0})]})]})]})}function L({model:n}){const i=g(p=>p.setActiveView),{tests:s,passing:l,withReqLink:a}=j.useMemo(()=>{const p=Object.values(n.elements),t=p.filter(c=>c.kind.toLowerCase()==="test"),o=p.filter(c=>["systemrequirement","requirement"].includes(c.kind.toLowerCase())),f=new Set(o.map(c=>c.id));let u=0;for(const c of t)n.relationships.filter(r=>r.sourceId===c.id||r.targetId===c.id).flatMap(r=>[r.sourceId,r.targetId]).some(r=>f.has(r))&&u++;const y=t.filter(c=>(c.attributes.status||"").toLowerCase()==="pass").length;return{tests:t,passing:y,withReqLink:u}},[n]),x=s.length>0?Math.round(a/s.length*100):0;return e.jsxs("div",{style:w,children:[e.jsx(k,{icon:"🧪",title:"Verification",badge:`${s.length} tests`,onExpand:()=>i({type:"traceability"})}),s.length===0?e.jsx(C,{text:"No tests found. Add Test elements and link them to requirements."}):e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"10px"},children:[e.jsx(v,{label:"Tests linked to requirements",percent:x,count:a,total:s.length,color:"#2DD4A8"}),e.jsxs("div",{style:{display:"flex",gap:"16px"},children:[e.jsx(m,{label:"Tests",value:s.length}),l>0&&e.jsx(m,{label:"Passing",value:l}),s.length-l>0&&e.jsx(m,{label:"Unverified",value:s.length-l,alert:s.length-l>0&&l>0})]})]})]})}function k({icon:n,title:i,badge:s,onExpand:l,badgeColor:a}){return e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"14px"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[e.jsx("span",{style:{fontSize:"16px"},children:n}),e.jsx("span",{style:{fontSize:"14px",fontWeight:700,color:"#1B3A4B"},children:i}),e.jsx("span",{style:{fontSize:"11px",fontWeight:600,padding:"2px 8px",borderRadius:"999px",background:a?a+"20":"#F3F4F6",color:a||"#6B7280"},children:s})]}),e.jsx("button",{onClick:l,style:{fontSize:"11px",color:"#4A90D9",background:"none",border:"none",cursor:"pointer",fontWeight:600},children:"Expand →"})]})}function v({label:n,percent:i,count:s,total:l,color:a,warningThreshold:x=100}){const p=i>=x?a:i>=50?"#F39C12":"#E74C3C";return e.jsxs("div",{children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",marginBottom:"4px"},children:[e.jsx("span",{style:{fontSize:"12px",color:"#374151"},children:n}),e.jsxs("span",{style:{fontSize:"12px",fontWeight:600,color:i>=80?"#2ECC71":"#374151"},children:[s,"/",l," (",i,"%)"]})]}),e.jsx("div",{style:{height:"6px",background:"#F3F4F6",borderRadius:"3px"},children:e.jsx("div",{style:{height:"100%",borderRadius:"3px",background:p,width:`${i}%`,transition:"width 0.4s ease"}})})]})}function m({label:n,value:i,alert:s}){return e.jsxs("div",{style:{display:"flex",gap:"4px",alignItems:"baseline"},children:[e.jsx("span",{style:{fontSize:"16px",fontWeight:700,color:s?"#E74C3C":"#1B3A4B"},children:i}),e.jsx("span",{style:{fontSize:"11px",color:"#9CA3AF"},children:n})]})}function C({text:n}){return e.jsx("div",{style:{fontSize:"12px",color:"#9CA3AF",fontStyle:"italic",padding:"8px 0"},children:n})}const w={background:"#FFFFFF",border:"1px solid #E5E5E0",borderRadius:"12px",padding:"20px"},E={fontSize:"11px",fontWeight:700,textTransform:"uppercase",letterSpacing:"0.06em",color:"#9CA3AF",marginBottom:"8px"},q={fontSize:"11px",color:"#374151",background:"#F3F4F6",border:"1px solid #E5E5E0",borderRadius:"6px",padding:"4px 10px",cursor:"pointer",transition:"background 0.1s",fontWeight:500};function D(){const n=g(s=>s.model),i=g(s=>s.setActiveView);return n?e.jsx("div",{style:{flex:1,overflowY:"auto",background:"#F7F7F5",padding:"28px 40px"},children:e.jsxs("div",{style:{maxWidth:"960px",margin:"0 auto"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",marginBottom:"24px"},children:[e.jsxs("div",{children:[e.jsx("h1",{style:{fontSize:"20px",fontWeight:800,color:"#1B3A4B",margin:"0 0 4px 0"},children:"Design Review Dashboard"}),e.jsx("p",{style:{fontSize:"12px",color:"#6B7280",margin:0},children:"Architecture · Requirements · Risk · Verification — in one view"})]}),e.jsx("button",{onClick:()=>i({type:"dashboard"}),style:{fontSize:"12px",color:"#6B7280",background:"#F3F4F6",border:"1px solid #E5E5E0",borderRadius:"6px",padding:"6px 12px",cursor:"pointer",fontWeight:500},children:"← Back to Dashboard"})]}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"16px"},children:[e.jsx(z,{model:n}),e.jsx(R,{model:n}),e.jsx(I,{model:n}),e.jsx(L,{model:n})]})]})}):e.jsx("div",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",background:"#F7F7F5"},children:e.jsx("div",{style:{fontSize:"13px",color:"#9CA3AF"},children:"No model data"})})}export{D as ReviewDashboard};
|
|
1
|
+
import{j as e}from"./reactflow-s7jmJtXx.js";import{a as j}from"./zustand-CrhqMOHB.js";import{u as g,h as F}from"./index-Bij8Q4Kg.js";function z({model:n}){const i=g(t=>t.setActiveView),s=g(t=>t.setExplorerTab),l=j.useMemo(()=>Object.values(n.elements).filter(t=>["system","subsystem","logicalcomponent","softwarecomponent","physicalcomponent"].includes(t.kind.toLowerCase())).slice(0,8),[n]),a=j.useMemo(()=>{const t={};for(const o of Object.values(n.elements))t[o.layer]=(t[o.layer]||0)+1;return t},[n]),x=Object.entries(a).sort((t,o)=>o[1]-t[1]).slice(0,5),p=Object.keys(n.elements).length;return e.jsxs("div",{style:w,children:[e.jsx(k,{icon:"🏗️",title:"System Architecture",badge:`${p} elements`,onExpand:()=>{s("model")}}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"12px"},children:[e.jsxs("div",{children:[e.jsx("div",{style:E,children:"Layer distribution"}),e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"6px"},children:x.map(([t,o])=>e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[e.jsx("div",{style:{width:"8px",height:"8px",borderRadius:"50%",background:F[t]||"#95A5A6",flexShrink:0}}),e.jsx("span",{style:{fontSize:"12px",color:"#374151",flex:1,textTransform:"capitalize"},children:t}),e.jsx("span",{style:{fontSize:"12px",fontWeight:600,color:"#6B7280"},children:o}),e.jsx("div",{style:{width:"60px",height:"4px",background:"#F3F4F6",borderRadius:"2px"},children:e.jsx("div",{style:{height:"100%",borderRadius:"2px",background:F[t]||"#95A5A6",width:`${Math.round(o/p*100)}%`}})})]},t))})]}),e.jsxs("div",{children:[e.jsx("div",{style:E,children:"Key components"}),l.length>0?e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:l.map(t=>e.jsxs("button",{onClick:()=>i({type:"element-detail",elementId:t.id}),style:{textAlign:"left",background:"none",border:"none",cursor:"pointer",padding:"3px 0",display:"flex",alignItems:"center",gap:"6px"},children:[e.jsx("span",{style:{fontSize:"10px",color:"#9CA3AF",fontFamily:"monospace"},children:t.kind}),e.jsx("span",{style:{fontSize:"12px",color:"#374151",fontWeight:500},children:t.name})]},t.id))}):e.jsx(C,{text:"No System or Subsystem elements yet"})]})]}),n.diagrams&&n.diagrams.length>0&&e.jsxs("div",{style:{marginTop:"12px",display:"flex",gap:"8px",flexWrap:"wrap"},children:[n.diagrams.slice(0,4).map(t=>e.jsxs("button",{onClick:()=>i({type:"diagram",diagramId:t.id}),style:q,onMouseEnter:o=>o.currentTarget.style.background="#E5E5E0",onMouseLeave:o=>o.currentTarget.style.background="#F3F4F6",children:["⊟ ",t.name]},t.id)),n.diagrams.length>4&&e.jsxs("span",{style:{fontSize:"11px",color:"#9CA3AF",alignSelf:"center"},children:["+",n.diagrams.length-4," more"]})]})]})}function R({model:n}){const i=g(t=>t.setActiveView),{reqs:s,withTestLink:l,withArchLink:a}=j.useMemo(()=>{const t=Object.values(n.elements),o=t.filter(d=>["systemrequirement","requirement","userneed"].includes(d.kind.toLowerCase())),f=new Set;for(const d of n.relationships)f.add(d.sourceId),f.add(d.targetId);const u=new Set(["test","verification","validationtest"]),y=new Set(["system","subsystem","logicalcomponent","softwarecomponent"]),c=new Set(t.filter(d=>u.has(d.kind.toLowerCase())).map(d=>d.id)),b=new Set(t.filter(d=>y.has(d.kind.toLowerCase())).map(d=>d.id));let r=0,S=0;for(const d of o){const A=n.relationships.filter(h=>h.sourceId===d.id||h.targetId===d.id).flatMap(h=>[h.sourceId,h.targetId]);A.some(h=>c.has(h))&&r++,A.some(h=>b.has(h))&&S++}return{reqs:o,withTestLink:r,withArchLink:S}},[n]),x=s.length>0?Math.round(l/s.length*100):0,p=s.length>0?Math.round(a/s.length*100):0;return e.jsxs("div",{style:w,children:[e.jsx(k,{icon:"📋",title:"Requirements",badge:`${s.length} total`,onExpand:()=>i({type:"traceability"})}),s.length===0?e.jsx(C,{text:"No requirements found. Add Requirement elements to your model."}):e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"10px"},children:[e.jsx(v,{label:"Verified by tests",percent:x,count:l,total:s.length,color:"#2DD4A8"}),e.jsx(v,{label:"Linked to architecture",percent:p,count:a,total:s.length,color:"#4A90D9"})]})]})}function I({model:n}){const i=g(t=>t.setActiveView),{hazards:s,riskControls:l,mitigatesCount:a,residualRiskCount:x}=j.useMemo(()=>{const t=Object.values(n.elements),o=t.filter(r=>r.kind.toLowerCase()==="hazard"),f=t.filter(r=>r.kind.toLowerCase()==="riskcontrol"),u=n.relationships.filter(r=>r.type.toLowerCase()==="mitigates"),y=u.length,c=new Set(u.map(r=>r.targetId)),b=o.filter(r=>!c.has(r.id)).length;return{hazards:o,riskControls:f,mitigatesCount:y,residualRiskCount:b}},[n]),p=s.length>0?Math.round((s.length-x)/s.length*100):0;return e.jsxs("div",{style:w,children:[e.jsx(k,{icon:"⚠️",title:"Risk Chain (ISO 14971)",badge:`${s.length} hazards`,onExpand:()=>i({type:"traceability"}),badgeColor:x>0?"#E74C3C":"#2ECC71"}),s.length===0?e.jsx(C,{text:"No hazards found. Add Hazard elements to start your ISO 14971 risk analysis."}):e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"10px"},children:[e.jsx(v,{label:"Hazards mitigated",percent:p,count:s.length-x,total:s.length,color:"#2ECC71",warningThreshold:80}),e.jsxs("div",{style:{display:"flex",gap:"16px"},children:[e.jsx(m,{label:"Risk controls",value:l.length}),e.jsx(m,{label:"Mitigates links",value:a}),x>0&&e.jsx(m,{label:"Unmitigated hazards",value:x,alert:!0})]})]})]})}function L({model:n}){const i=g(p=>p.setActiveView),{tests:s,passing:l,withReqLink:a}=j.useMemo(()=>{const p=Object.values(n.elements),t=p.filter(c=>c.kind.toLowerCase()==="test"),o=p.filter(c=>["systemrequirement","requirement"].includes(c.kind.toLowerCase())),f=new Set(o.map(c=>c.id));let u=0;for(const c of t)n.relationships.filter(r=>r.sourceId===c.id||r.targetId===c.id).flatMap(r=>[r.sourceId,r.targetId]).some(r=>f.has(r))&&u++;const y=t.filter(c=>(c.attributes.status||"").toLowerCase()==="pass").length;return{tests:t,passing:y,withReqLink:u}},[n]),x=s.length>0?Math.round(a/s.length*100):0;return e.jsxs("div",{style:w,children:[e.jsx(k,{icon:"🧪",title:"Verification",badge:`${s.length} tests`,onExpand:()=>i({type:"traceability"})}),s.length===0?e.jsx(C,{text:"No tests found. Add Test elements and link them to requirements."}):e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"10px"},children:[e.jsx(v,{label:"Tests linked to requirements",percent:x,count:a,total:s.length,color:"#2DD4A8"}),e.jsxs("div",{style:{display:"flex",gap:"16px"},children:[e.jsx(m,{label:"Tests",value:s.length}),l>0&&e.jsx(m,{label:"Passing",value:l}),s.length-l>0&&e.jsx(m,{label:"Unverified",value:s.length-l,alert:s.length-l>0&&l>0})]})]})]})}function k({icon:n,title:i,badge:s,onExpand:l,badgeColor:a}){return e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"14px"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[e.jsx("span",{style:{fontSize:"16px"},children:n}),e.jsx("span",{style:{fontSize:"14px",fontWeight:700,color:"#1B3A4B"},children:i}),e.jsx("span",{style:{fontSize:"11px",fontWeight:600,padding:"2px 8px",borderRadius:"999px",background:a?a+"20":"#F3F4F6",color:a||"#6B7280"},children:s})]}),e.jsx("button",{onClick:l,style:{fontSize:"11px",color:"#4A90D9",background:"none",border:"none",cursor:"pointer",fontWeight:600},children:"Expand →"})]})}function v({label:n,percent:i,count:s,total:l,color:a,warningThreshold:x=100}){const p=i>=x?a:i>=50?"#F39C12":"#E74C3C";return e.jsxs("div",{children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",marginBottom:"4px"},children:[e.jsx("span",{style:{fontSize:"12px",color:"#374151"},children:n}),e.jsxs("span",{style:{fontSize:"12px",fontWeight:600,color:i>=80?"#2ECC71":"#374151"},children:[s,"/",l," (",i,"%)"]})]}),e.jsx("div",{style:{height:"6px",background:"#F3F4F6",borderRadius:"3px"},children:e.jsx("div",{style:{height:"100%",borderRadius:"3px",background:p,width:`${i}%`,transition:"width 0.4s ease"}})})]})}function m({label:n,value:i,alert:s}){return e.jsxs("div",{style:{display:"flex",gap:"4px",alignItems:"baseline"},children:[e.jsx("span",{style:{fontSize:"16px",fontWeight:700,color:s?"#E74C3C":"#1B3A4B"},children:i}),e.jsx("span",{style:{fontSize:"11px",color:"#9CA3AF"},children:n})]})}function C({text:n}){return e.jsx("div",{style:{fontSize:"12px",color:"#9CA3AF",fontStyle:"italic",padding:"8px 0"},children:n})}const w={background:"#FFFFFF",border:"1px solid #E5E5E0",borderRadius:"12px",padding:"20px"},E={fontSize:"11px",fontWeight:700,textTransform:"uppercase",letterSpacing:"0.06em",color:"#9CA3AF",marginBottom:"8px"},q={fontSize:"11px",color:"#374151",background:"#F3F4F6",border:"1px solid #E5E5E0",borderRadius:"6px",padding:"4px 10px",cursor:"pointer",transition:"background 0.1s",fontWeight:500};function D(){const n=g(s=>s.model),i=g(s=>s.setActiveView);return n?e.jsx("div",{style:{flex:1,overflowY:"auto",background:"#F7F7F5",padding:"28px 40px"},children:e.jsxs("div",{style:{maxWidth:"960px",margin:"0 auto"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",marginBottom:"24px"},children:[e.jsxs("div",{children:[e.jsx("h1",{style:{fontSize:"20px",fontWeight:800,color:"#1B3A4B",margin:"0 0 4px 0"},children:"Design Review Dashboard"}),e.jsx("p",{style:{fontSize:"12px",color:"#6B7280",margin:0},children:"Architecture · Requirements · Risk · Verification — in one view"})]}),e.jsx("button",{onClick:()=>i({type:"dashboard"}),style:{fontSize:"12px",color:"#6B7280",background:"#F3F4F6",border:"1px solid #E5E5E0",borderRadius:"6px",padding:"6px 12px",cursor:"pointer",fontWeight:500},children:"← Back to Dashboard"})]}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"16px"},children:[e.jsx(z,{model:n}),e.jsx(R,{model:n}),e.jsx(I,{model:n}),e.jsx(L,{model:n})]})]})}):e.jsx("div",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",background:"#F7F7F5"},children:e.jsx("div",{style:{fontSize:"13px",color:"#9CA3AF"},children:"No model data"})})}export{D as ReviewDashboard};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{j as e}from"./reactflow-s7jmJtXx.js";import{a as x}from"./zustand-CrhqMOHB.js";import{u as A,k as he,m as fe,C as f,F as C,h as E,E as O,n as Z,M as ge,o as ye,D as je}from"./index-Bij8Q4Kg.js";function ke(d){const r=d.diagramType.toLowerCase(),b=["afd","ofd","ffd"].includes(r)?ye(d):r;return je[b]}function ee({expanded:d,color:r=f.muted}){return e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",style:{transform:d?"rotate(90deg)":void 0,transition:"transform 150ms ease",flexShrink:0},children:e.jsx("path",{d:"M6 4L10 8L6 12",stroke:r,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function te({open:d,color:r}){return e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",style:{flexShrink:0},children:[e.jsx("path",{d:"M1.5 3.5h4.8l1.2 1.5H14.5v8H1.5z",fill:r,opacity:"0.15",stroke:r,strokeWidth:"1",strokeLinejoin:"round"}),d&&e.jsx("path",{d:"M1.5 5h13v8H1.5z",fill:r,opacity:"0.08"})]})}function be({color:d}){return e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",style:{flexShrink:0},children:[e.jsx("rect",{x:"2",y:"1.5",width:"12",height:"13",rx:"1.5",fill:d,opacity:"0.1",stroke:d,strokeWidth:"1"}),e.jsx("line",{x1:"5",y1:"5.5",x2:"11",y2:"5.5",stroke:d,strokeWidth:"0.8",opacity:"0.5"}),e.jsx("line",{x1:"5",y1:"8",x2:"11",y2:"8",stroke:d,strokeWidth:"0.8",opacity:"0.5"})]})}function se(d){return d?d.split(`
|
|
2
|
+
`).filter(b=>b.trim()).map((b,W)=>{const I=b.match(/^\d+\.\s*(.*)/);return{index:W,text:I?I[1]:b}}):[]}function ve(d){return d.map((r,b)=>`${b+1}. ${r.text}`).join(`
|
|
3
|
+
`)}function Ce({explorerOnly:d=!1}){const r=A(t=>t.model),b=A(t=>t.createRelationship),W=A(t=>t.inspectElement),I=A(t=>t.setActiveView),G=A(t=>t.setActiveMode),S=A(t=>t.selectedElementId),[D,ne]=x.useState(""),[i,F]=x.useState(null),[L,P]=x.useState(""),[z,_]=x.useState(null),[T,H]=x.useState(""),R=x.useMemo(()=>{if(!r)return[];const t=Object.values(r.elements),n=r.elements,o=(...s)=>{const y=new Set(s.map(j=>j.toLowerCase()));return r.relationships.filter(j=>y.has(j.type.toLowerCase()))},c=(s,y)=>{var j;return typeof s=="string"&&((j=s.split("::").at(-1))==null?void 0:j.trim())===y},h=t.filter(s=>s.kind.endsWith("UseCase")),w=new Set(h.map(s=>s.id)),u=new Map,a=new Set;for(const s of o("Includes")){if(!w.has(s.sourceId)||!w.has(s.targetId))continue;const y=u.get(s.sourceId)??[];y.push(s.targetId),u.set(s.sourceId,y),a.add(s.targetId)}const v=new Map,g=[],m=(s,y)=>{if(!v.has(s)){v.set(s,y),g.push(s);for(const j of u.get(s)??[])m(j,y+1)}};for(const s of h)a.has(s.id)||m(s.id,0);for(const s of h)m(s.id,0);const M=g.map(s=>n[s]).filter(s=>!!s),$=s=>!D||s.name.toLowerCase().includes(D.toLowerCase())||s.kind.toLowerCase().includes(D.toLowerCase());return M.map(s=>{var Q;const y=o("Supports","supportsUseCase").filter(l=>l.targetId===s.id).map(l=>n[l.sourceId]).filter(l=>!!l&&l.kind==="OperationalWorkflow"),j=t.filter(l=>l.kind.endsWith("Scenario")).filter(l=>c(l.attributes.parentUseCase,s.id)||o("Realizes","scenarioRealizesUseCase").some(N=>N.sourceId===l.id&&N.targetId===s.id)),U=j.map(l=>t.find(N=>c(l.attributes.parentWorkflow,N.id))).filter(l=>!!l),pe=[...new Map([...y,...U].map(l=>[l.id,l])).values()],ue=j.map(l=>{const N=(r.diagrams??[]).filter(me=>{var X;return(X=me.scenarioIds)==null?void 0:X.includes(l.id)});return{scenario:l,views:N}}),xe=pe.map(l=>({workflow:l,scenarios:ue.filter(({scenario:N})=>c(N.attributes.parentWorkflow,l.id))}));return{useCase:s,workflows:xe,depth:v.get(s.id)??0,hasChildren:(((Q=u.get(s.id))==null?void 0:Q.length)??0)>0}}).filter(s=>$(s.useCase)||s.workflows.some(({workflow:y,scenarios:j})=>$(y)||j.some(({scenario:U})=>$(U))))},[r,D]),p=S&&r?r.elements[S]:null,K=x.useMemo(()=>he(r,S||""),[r,S]),k=x.useMemo(()=>i||(p?se(p.doc||""):[]),[p,i]),oe=x.useCallback(()=>{p&&F(se(p.doc||""))},[p]),re=x.useCallback(()=>{if(!p||!i)return;const t=ve(i);fe({...p,doc:t}),F(null)},[p,i]),V=x.useCallback(()=>{if(!L.trim())return;const t=[...i||k,{index:k.length,text:L.trim()}];F(t),P("")},[L,i,k]),le=x.useCallback(t=>{const n=(i||k).filter((o,c)=>c!==t);F(n)},[i,k]),Y=x.useCallback((t,n)=>{const o=[...i||k],c=t+n;c<0||c>=o.length||([o[t],o[c]]=[o[c],o[t]],F(o))},[i,k]),ae=x.useCallback((t,n)=>{const o=[...i||k];o[t]={...o[t],text:n},F(o)},[i,k]),ce=x.useMemo(()=>{if(!r||!T)return[];const t=T.toLowerCase();return Object.values(r.elements).filter(n=>n.id!==S&&n.name.toLowerCase().includes(t)).slice(0,10)},[r,T,S]),[q,ie]=x.useState(new Set),J=t=>{ie(n=>{const o=new Set(n);return o.has(t)?o.delete(t):o.add(t),o})},B=t=>{F(null),G("scenario"),W(t),I({type:"element-detail",elementId:t})},de=({workflow:t,scenarios:n})=>{const o=`workflow:${t.id}`,c=q.has(o),h=()=>J(o),w=a=>{G("scenario"),I({type:"diagram",diagramId:a.id})},u=(a,v)=>{const g=S===a.id;return e.jsxs("button",{type:"button",onClick:()=>B(a.id),className:"flex w-full items-center gap-1.5 px-2 py-1 text-left",style:{borderRadius:"4px",margin:"0 4px",marginLeft:`${v+4}px`,width:`calc(100% - ${v+8}px)`,background:g?`${f.accent}18`:"transparent"},onMouseEnter:m=>{g||(m.currentTarget.style.background="#F0F0ED")},onMouseLeave:m=>{m.currentTarget.style.background=g?`${f.accent}18`:"transparent"},children:[e.jsx(be,{color:E[a.layer]||f.muted}),e.jsx(O,{element:a,selected:g})]},a.id)};return e.jsxs("div",{className:"mb-0.5",children:[e.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-1 cursor-pointer select-none",style:{borderRadius:"4px",margin:"0 4px"},onMouseEnter:a=>a.currentTarget.style.background="#F0F0ED",onMouseLeave:a=>a.currentTarget.style.background="transparent",onClick:()=>B(t.id),children:[e.jsx("button",{type:"button","aria-label":`${c?"Collapse":"Expand"} ${t.name}`,onClick:a=>{a.stopPropagation(),h()},children:e.jsx(ee,{expanded:c,color:f.muted})}),e.jsx(te,{open:c,color:E.operational}),e.jsx(O,{element:t,fontSize:C.explorer.kind,fontWeight:600}),e.jsx(Z,{count:n.length,color:E.operational,title:`${n.length} scenarios`})]}),c&&n.map(({scenario:a,views:v})=>e.jsxs("div",{style:{marginLeft:"16px"},children:[u(a,0),e.jsx("div",{style:{marginLeft:"20px"},children:v.length>0&&e.jsx("div",{className:"pt-1",children:v.map(g=>{const m=ke(g);return e.jsxs("button",{type:"button",onClick:()=>w(g),className:"flex w-full items-center gap-2 px-2 py-1 text-left",style:{borderRadius:"4px",margin:"0 4px",width:"calc(100% - 8px)"},onMouseEnter:M=>M.currentTarget.style.background="#F0F0ED",onMouseLeave:M=>M.currentTarget.style.background="transparent",title:m==null?void 0:m.fullName,children:[m&&e.jsx("span",{className:"px-1.5 py-0.5 rounded font-semibold",style:{background:m.color+"20",color:m.color,fontSize:C.badge},children:m.code}),e.jsxs("span",{className:"flex-1",style:{minWidth:0},children:[e.jsx("span",{className:"truncate block",style:{color:f.primary,fontSize:C.explorer.item},children:g.name}),e.jsx("span",{className:"truncate block font-mono",style:{color:f.faint,fontSize:"9px",marginTop:1},children:g.id})]})]},g.id)})})})]},a.id)),c&&n.length===0&&e.jsx("div",{className:"px-2 py-1",style:{color:f.faint,fontSize:C.explorer.count,marginLeft:"20px"},children:"No scenarios"})]})};return e.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[d&&e.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",style:{background:f.surface},children:[e.jsx("div",{className:"px-3 py-2",style:{borderBottom:"1px solid #E5E5E0"},children:e.jsx("input",{type:"text",placeholder:"Search "+R.length+" use cases...",value:D,onChange:t=>ne(t.target.value),className:"w-full px-3 py-2 rounded-lg focus:outline-none",style:{background:f.surfaceAlt,border:`1px solid ${f.border}`,color:f.primary,fontSize:C.explorer.search}})}),e.jsxs("div",{className:"flex-1 overflow-y-auto py-1",style:{fontSize:C.explorer.item},children:[R.map(({useCase:t,workflows:n,depth:o})=>{const c="use-case:"+t.id,h=q.has(c),w=n.reduce((u,{scenarios:a})=>u+a.length,0);return e.jsxs("div",{className:"mb-0.5",children:[e.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-1.5 cursor-pointer select-none",style:{borderRadius:"4px",margin:"0 4px",marginLeft:4+o*16},onMouseEnter:u=>u.currentTarget.style.background="#F0F0ED",onMouseLeave:u=>u.currentTarget.style.background="transparent",onClick:()=>B(t.id),children:[e.jsx("button",{type:"button","aria-label":`${h?"Collapse":"Expand"} ${t.name}`,onClick:u=>{u.stopPropagation(),J(c)},children:e.jsx(ee,{expanded:h,color:E.functional})}),e.jsx(te,{open:h,color:E.functional}),e.jsx(O,{element:t,fontSize:C.explorer.group,fontWeight:600}),e.jsx(Z,{count:w,color:E.functional,title:`${w} scenarios`})]}),h&&e.jsxs("div",{style:{marginLeft:16+o*16},children:[n.map(({workflow:u,scenarios:a})=>e.jsx(de,{workflow:u,scenarios:a},u.id)),n.length===0&&e.jsx("div",{className:"px-2 py-1",style:{color:f.faint,fontSize:C.explorer.kind},children:"No workflows"})]})]},t.id)}),R.length===0&&e.jsx("div",{className:"px-4 py-8 text-center",style:{color:f.faint},children:"No use-case scenario chains found."})]})]}),!d&&e.jsx("div",{className:"flex-1 overflow-y-auto p-6",style:{background:"#F7F7F5"},children:e.jsxs(e.Fragment,{children:[!p&&e.jsx("div",{className:"flex items-center justify-center h-full",style:{color:"#9CA3AF"},children:e.jsxs("div",{className:"text-center",children:[e.jsx("div",{style:{display:"flex",justifyContent:"center",marginBottom:2},children:e.jsx(ge,{size:180})}),e.jsx("div",{className:"text-sm",children:"Select a scenario to edit steps and link elements"})]})}),p&&e.jsxs("div",{className:"max-w-2xl",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[e.jsx("h2",{className:"text-lg font-semibold",style:{color:"#1a1a1a"},children:p.name}),e.jsx("span",{className:"px-2 py-0.5 text-xs rounded-md font-medium",style:{background:"#E67E2218",color:"#E67E22"},children:p.kind})]}),e.jsxs("div",{className:"mb-4",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider",style:{color:"#6B7280"},children:"Steps"}),!i&&e.jsx("button",{onClick:oe,className:"px-2 py-0.5 text-xs rounded",style:{background:"#2DD4A815",color:"#1B3A4B",border:"1px solid #2DD4A840"},children:"Edit"}),i&&e.jsxs("div",{className:"flex gap-1",children:[e.jsx("button",{onClick:re,className:"px-2 py-0.5 text-xs rounded font-medium",style:{background:"#2DD4A8",color:"#FFFFFF"},children:"Save"}),e.jsx("button",{onClick:()=>F(null),className:"px-2 py-0.5 text-xs rounded",style:{background:"#F3F4F6",color:"#6B7280"},children:"Cancel"})]})]}),e.jsx("div",{className:"space-y-1",children:k.map((t,n)=>e.jsxs("div",{className:"flex items-start gap-2 p-2 rounded-lg",style:{background:"#FFFFFF",border:"1px solid #E5E5E0"},children:[e.jsx("span",{className:"flex-shrink-0 w-6 h-6 rounded-full flex items-center justify-center text-xs font-medium",style:{background:"#2DD4A815",color:"#1B3A4B"},children:n+1}),i?e.jsx("input",{type:"text",value:t.text,onChange:o=>ae(n,o.target.value),className:"flex-1 text-sm px-2 py-1 rounded focus:outline-none",style:{border:"1px solid #E5E5E0",color:"#374151"}}):e.jsx("span",{className:"flex-1 text-sm",style:{color:"#374151"},children:t.text}),i&&e.jsxs("div",{className:"flex gap-0.5",children:[e.jsx("button",{onClick:()=>Y(n,-1),className:"px-1 text-xs",style:{color:"#9CA3AF"},title:"Move up",children:"▲"}),e.jsx("button",{onClick:()=>Y(n,1),className:"px-1 text-xs",style:{color:"#9CA3AF"},title:"Move down",children:"▼"}),e.jsx("button",{onClick:()=>le(n),className:"px-1 text-xs",style:{color:"#E74C3C"},title:"Remove",children:"✕"})]})]},n))}),i&&e.jsxs("div",{className:"flex gap-2 mt-2",children:[e.jsx("input",{type:"text",value:L,onChange:t=>P(t.target.value),onKeyDown:t=>t.key==="Enter"&&V(),placeholder:"Add a step...",className:"flex-1 text-sm px-3 py-2 rounded-lg focus:outline-none",style:{background:"#FFFFFF",border:"1px solid #E5E5E0",color:"#374151"}}),e.jsx("button",{onClick:V,className:"px-3 py-2 text-xs rounded-lg font-medium",style:{background:"#2DD4A815",color:"#1B3A4B",border:"1px solid #2DD4A840"},children:"+ Add"})]}),k.length===0&&!i&&e.jsx("div",{className:"text-xs p-3 rounded-lg",style:{background:"#F3F4F6",color:"#9CA3AF"},children:"No steps defined. Click Edit to add scenario steps."})]}),e.jsxs("div",{className:"mb-4",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsxs("h3",{className:"text-xs font-semibold uppercase tracking-wider",style:{color:"#6B7280"},children:["Linked Elements (",K.length,")"]}),e.jsx("button",{onClick:()=>_(z===null?0:null),className:"px-2 py-0.5 text-xs rounded",style:{background:"#4A90D915",color:"#4A90D9",border:"1px solid #4A90D940"},children:z!==null?"Done":"+ Link"})]}),z!==null&&e.jsxs("div",{className:"mb-2 p-2 rounded-lg",style:{background:"#FFFFFF",border:"1px solid #4A90D940"},children:[e.jsx("input",{type:"text",value:T,onChange:t=>H(t.target.value),placeholder:"Search elements to link...",className:"w-full text-sm px-2 py-1 rounded focus:outline-none mb-1",style:{border:"1px solid #E5E5E0",color:"#374151"}}),ce.map(t=>e.jsxs("div",{className:"flex items-center gap-2 px-2 py-1 text-xs rounded cursor-pointer",onMouseEnter:n=>n.currentTarget.style.background="#F0F0ED",onMouseLeave:n=>n.currentTarget.style.background="transparent",onClick:()=>{b({type:"traceTo",sourceId:p.id,targetId:t.id,direction:"outgoing",selectedElementId:p.id}),H(""),_(null)},children:[e.jsx("span",{className:"w-2 h-2 rounded-full",style:{background:E[t.layer]||"#95A5A6"}}),e.jsx("span",{style:{color:"#374151"},children:t.name}),e.jsx("span",{style:{color:"#9CA3AF"},children:t.kind})]},t.id))]}),e.jsx("div",{className:"space-y-1",children:K.map(t=>{const n=t.sourceId===p.id?t.targetId:t.sourceId,o=r.elements[n],c=t.sourceId===p.id?"→":"←";return e.jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 text-xs rounded-lg cursor-pointer",style:{background:"#FFFFFF",border:"1px solid #E5E5E0"},onMouseEnter:h=>h.currentTarget.style.background="#F0F0ED",onMouseLeave:h=>h.currentTarget.style.background="#FFFFFF",onClick:()=>B(n),children:[e.jsx("span",{style:{color:"#9CA3AF"},children:c}),e.jsx("span",{className:"font-medium",style:{color:"#2563EB"},children:t.type}),e.jsx("span",{style:{color:"#374151"},children:(o==null?void 0:o.name)||n}),o&&e.jsx("span",{className:"ml-auto px-1.5 py-0.5 rounded text-xs",style:{background:(E[o.layer]||"#95A5A6")+"18",color:E[o.layer]||"#95A5A6"},children:o.kind})]},t.id)})})]}),e.jsx("div",{className:"text-xs",style:{color:"#D1D5DB"},children:p.file})]})]})})]})}export{Ce as ScenarioEditor};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e}from"./reactflow-
|
|
1
|
+
import{j as e}from"./reactflow-s7jmJtXx.js";import{a as A}from"./zustand-CrhqMOHB.js";import{u as f,L as y,h as u,f as b}from"./index-Bij8Q4Kg.js";function w(a){var F;const c=Object.values(a.elements),n=c.length,t=a.relationships.length,i=((F=a.diagrams)==null?void 0:F.length)??0,d=new Map;for(const s of c){const o=d.get(s.layer)||{count:0,kinds:new Map};o.count++,o.kinds.set(s.kind,(o.kinds.get(s.kind)||0)+1),d.set(s.layer,o)}const m=y.filter(s=>d.has(s)).map(s=>({layer:s,label:b[s]||s,color:u[s]||"#95A5A6",count:d.get(s).count,kinds:d.get(s).kinds}));for(const[s,o]of d)y.includes(s)||m.push({layer:s,label:b[s]||s,color:u[s]||"#95A5A6",count:o.count,kinds:o.kinds});const l=new Map;for(const s of c){const o=l.get(s.kind)||{count:0,layer:s.layer};o.count++,l.set(s.kind,o)}const r=[...l.entries()].map(([s,{count:o,layer:C}])=>({kind:s,count:o,layer:C})).sort((s,o)=>o.count-s.count).slice(0,15),x=new Map;for(const s of a.relationships)x.set(s.type,(x.get(s.type)||0)+1);const j=[...x.entries()].map(([s,o])=>({type:s,count:o})).sort((s,o)=>o.count-s.count),p=new Set;for(const s of a.relationships)p.add(s.sourceId),p.add(s.targetId);const N=c.filter(s=>!p.has(s.id)).length;Math.max(...m.map(s=>s.count),1);const v=m.map(s=>({layer:s.layer,label:s.label,color:s.color,percent:Math.round(s.count/n*100)})),E=n>0?t/n:0,k=n>0?t/n:0;return{totalElements:n,totalRelationships:t,totalDiagrams:i,layers:m,topKinds:r,relTypes:j,avgRelsPerElement:Math.round(k*10)/10,orphanCount:N,coverage:v,density:Math.round(E*100)/100}}function B(){var d,m;const a=f(l=>l.model),c=f(l=>l.validation),n=f(l=>l.completeness),t=A.useMemo(()=>a?w(a):null,[a]);if(!t)return e.jsx("div",{className:"flex-1 flex items-center justify-center",style:{background:"#F7F7F5",color:"#9CA3AF"},children:e.jsx("div",{className:"text-sm",children:"No model data"})});const i=((d=c==null?void 0:c.violations)==null?void 0:d.length)??0;return e.jsx("div",{className:"flex-1 overflow-y-auto p-6",style:{background:"#F7F7F5"},children:e.jsxs("div",{className:"max-w-5xl mx-auto",children:[e.jsx("h2",{className:"text-lg font-semibold mb-1",style:{color:"#374151"},children:"Model Statistics"}),e.jsx("p",{className:"text-xs mb-6",style:{color:"#9CA3AF"},children:"Quick health check for your model"}),e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3 mb-6",children:[e.jsx(h,{label:"Elements",value:t.totalElements,color:"#1B3A4B"}),e.jsx(h,{label:"Relationships",value:t.totalRelationships,color:"#4A90D9"}),e.jsx(h,{label:"Diagrams",value:t.totalDiagrams,color:"#7B68EE"}),e.jsx(h,{label:"Violations",value:i,color:i>0?"#E74C3C":"#2ECC71"})]}),e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3 mb-6",children:[e.jsx(g,{label:"Rel. Density",value:`${t.avgRelsPerElement}`,unit:"per element",status:t.avgRelsPerElement>=1.5?"good":t.avgRelsPerElement>=.5?"ok":"low"}),e.jsx(g,{label:"Orphans",value:`${t.orphanCount}`,unit:"unlinked",status:t.orphanCount===0?"good":t.orphanCount<=5?"ok":"low"}),e.jsx(g,{label:"Layers Used",value:`${t.layers.length}`,unit:`of ${y.length}`,status:t.layers.length>=6?"good":t.layers.length>=3?"ok":"low"}),e.jsx(g,{label:"Kinds Used",value:`${t.topKinds.length}`,unit:"types",status:t.topKinds.length>=8?"good":t.topKinds.length>=4?"ok":"low"})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"p-4 rounded-lg",style:{background:"#FFFFFF",border:"1px solid #E5E5E0"},children:[e.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider mb-3",style:{color:"#6B7280"},children:"Elements by Layer"}),e.jsx("div",{className:"space-y-2",children:t.layers.map((l,r)=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"w-20 text-xs truncate",style:{color:"#374151"},children:l.label}),e.jsx("div",{className:"flex-1 h-4 rounded-full overflow-hidden",style:{background:"#F3F4F6"},children:e.jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${Math.max(l.count/t.totalElements*100,2)}%`,background:l.color,opacity:.8}})}),e.jsx("span",{className:"w-8 text-right text-xs font-medium",style:{color:"#374151"},children:l.count})]},`${l.layer}-${r}`))})]}),e.jsxs("div",{className:"p-4 rounded-lg",style:{background:"#FFFFFF",border:"1px solid #E5E5E0"},children:[e.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider mb-3",style:{color:"#6B7280"},children:"Layer Coverage"}),e.jsx("div",{className:"grid grid-cols-3 gap-2",children:y.map(l=>{const r=t.coverage.find(p=>p.layer===l),x=(r==null?void 0:r.percent)??0,j=x>0?Math.max(.15,x/100):.05;return e.jsxs("div",{className:"p-2 rounded-lg text-center",style:{background:`${u[l]||"#95A5A6"}${Math.round(j*255).toString(16).padStart(2,"0")}`,border:`1px solid ${u[l]||"#95A5A6"}30`},children:[e.jsx("div",{className:"text-xs font-medium truncate",style:{color:"#374151"},children:b[l]||l}),e.jsxs("div",{className:"text-lg font-bold",style:{color:u[l]||"#95A5A6"},children:[x,"%"]})]},l)})})]}),e.jsxs("div",{className:"p-4 rounded-lg",style:{background:"#FFFFFF",border:"1px solid #E5E5E0"},children:[e.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider mb-3",style:{color:"#6B7280"},children:"Top Element Types"}),e.jsx("div",{className:"space-y-1",children:t.topKinds.map((l,r)=>e.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[e.jsx("span",{className:"w-2 h-2 rounded-full",style:{background:u[l.layer]||"#95A5A6"}}),e.jsx("span",{className:"flex-1 truncate",style:{color:"#374151"},children:l.kind}),e.jsx("span",{className:"font-medium",style:{color:"#6B7280"},children:l.count})]},`${l.kind}-${r}`))})]}),e.jsxs("div",{className:"p-4 rounded-lg",style:{background:"#FFFFFF",border:"1px solid #E5E5E0"},children:[e.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider mb-3",style:{color:"#6B7280"},children:"Relationship Types"}),e.jsxs("div",{className:"space-y-1",children:[t.relTypes.map((l,r)=>e.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[e.jsx("span",{className:"w-2 h-2 rounded-full",style:{background:"#4A90D9"}}),e.jsx("span",{className:"flex-1 truncate",style:{color:"#374151"},children:l.type}),e.jsx("span",{className:"font-medium",style:{color:"#6B7280"},children:l.count})]},`${l.type}-${r}`)),t.relTypes.length===0&&e.jsx("div",{className:"text-xs",style:{color:"#9CA3AF"},children:"No relationships"})]})]})]}),n&&e.jsxs("div",{className:"mt-4 p-4 rounded-lg",style:{background:"#FFFFFF",border:"1px solid #E5E5E0"},children:[e.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider mb-3",style:{color:"#6B7280"},children:"Completeness by Layer"}),e.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-2",children:(m=n.layers)==null?void 0:m.map((l,r)=>e.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[e.jsx("span",{className:"w-2 h-2 rounded-full",style:{background:u[l.layer]||"#95A5A6"}}),e.jsx("span",{className:"flex-1 truncate",style:{color:"#374151"},children:l.layer}),e.jsxs("span",{className:"font-medium",style:{color:l.completeness>=80?"#2ECC71":l.completeness>=50?"#F39C12":"#E74C3C"},children:[Math.round(l.completeness),"%"]})]},`${l.layer}-${r}`))})]})]})})}function h({label:a,value:c,color:n}){return e.jsxs("div",{className:"p-4 rounded-lg",style:{background:"#FFFFFF",border:"1px solid #E5E5E0"},children:[e.jsx("div",{className:"text-2xl font-bold",style:{color:n},children:c.toLocaleString()}),e.jsx("div",{className:"text-xs mt-0.5",style:{color:"#9CA3AF"},children:a})]})}function g({label:a,value:c,unit:n,status:t}){const i=t==="good"?"#2ECC71":t==="ok"?"#F39C12":"#E74C3C";return e.jsxs("div",{className:"p-4 rounded-lg",style:{background:"#FFFFFF",border:`1px solid ${i}30`},children:[e.jsxs("div",{className:"flex items-baseline gap-1",children:[e.jsx("span",{className:"text-lg font-bold",style:{color:i},children:c}),e.jsx("span",{className:"text-xs",style:{color:"#9CA3AF"},children:n})]}),e.jsx("div",{className:"text-xs mt-0.5",style:{color:"#6B7280"},children:a})]})}export{B as StatisticsDashboard};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var E3=Object.defineProperty;var I3=(r,e,t)=>e in r?E3(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var Pt=(r,e,t)=>I3(r,typeof e!="symbol"?e+"":e,t);import{j as N3}from"./reactflow-
|
|
1
|
+
var E3=Object.defineProperty;var I3=(r,e,t)=>e in r?E3(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var Pt=(r,e,t)=>I3(r,typeof e!="symbol"?e+"":e,t);import{j as N3}from"./reactflow-s7jmJtXx.js";import{a as et,W as Dd}from"./zustand-CrhqMOHB.js";function YE(r,e){(e==null||e>r.length)&&(e=r.length);for(var t=0,i=Array(e);t<e;t++)i[t]=r[t];return i}function T3(r){if(Array.isArray(r))return r}function R3(r,e,t){return(e=V3(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function M3(r,e){var t=r==null?null:typeof Symbol<"u"&&r[Symbol.iterator]||r["@@iterator"];if(t!=null){var i,n,s,o,a=[],l=!0,c=!1;try{if(s=(t=t.call(r)).next,e!==0)for(;!(l=(i=s.call(t)).done)&&(a.push(i.value),a.length!==e);l=!0);}catch(h){c=!0,n=h}finally{try{if(!l&&t.return!=null&&(o=t.return(),Object(o)!==o))return}finally{if(c)throw n}}return a}}function A3(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
2
2
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ZE(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(r);e&&(i=i.filter(function(n){return Object.getOwnPropertyDescriptor(r,n).enumerable})),t.push.apply(t,i)}return t}function XE(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ZE(Object(t),!0).forEach(function(i){R3(r,i,t[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):ZE(Object(t)).forEach(function(i){Object.defineProperty(r,i,Object.getOwnPropertyDescriptor(t,i))})}return r}function O3(r,e){if(r==null)return{};var t,i,n=P3(r,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(r);for(i=0;i<s.length;i++)t=s[i],e.indexOf(t)===-1&&{}.propertyIsEnumerable.call(r,t)&&(n[t]=r[t])}return n}function P3(r,e){if(r==null)return{};var t={};for(var i in r)if({}.hasOwnProperty.call(r,i)){if(e.indexOf(i)!==-1)continue;t[i]=r[i]}return t}function F3(r,e){return T3(r)||M3(r,e)||W3(r,e)||A3()}function B3(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var i=t.call(r,e);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}function V3(r){var e=B3(r,"string");return typeof e=="symbol"?e:e+""}function W3(r,e){if(r){if(typeof r=="string")return YE(r,e);var t={}.toString.call(r).slice(8,-1);return t==="Object"&&r.constructor&&(t=r.constructor.name),t==="Map"||t==="Set"?Array.from(r):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?YE(r,e):void 0}}function H3(r,e,t){return e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function QE(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(r);e&&(i=i.filter(function(n){return Object.getOwnPropertyDescriptor(r,n).enumerable})),t.push.apply(t,i)}return t}function JE(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?QE(Object(t),!0).forEach(function(i){H3(r,i,t[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):QE(Object(t)).forEach(function(i){Object.defineProperty(r,i,Object.getOwnPropertyDescriptor(t,i))})}return r}function z3(){for(var r=arguments.length,e=new Array(r),t=0;t<r;t++)e[t]=arguments[t];return function(i){return e.reduceRight(function(n,s){return s(n)},i)}}function hf(r){return function e(){for(var t=this,i=arguments.length,n=new Array(i),s=0;s<i;s++)n[s]=arguments[s];return n.length>=r.length?r.apply(this,n):function(){for(var o=arguments.length,a=new Array(o),l=0;l<o;l++)a[l]=arguments[l];return e.apply(t,[].concat(n,a))}}}function K_(r){return{}.toString.call(r).includes("Object")}function U3(r){return!Object.keys(r).length}function xg(r){return typeof r=="function"}function $3(r,e){return Object.prototype.hasOwnProperty.call(r,e)}function j3(r,e){return K_(e)||Ha("changeType"),Object.keys(e).some(function(t){return!$3(r,t)})&&Ha("changeField"),e}function K3(r){xg(r)||Ha("selectorType")}function q3(r){xg(r)||K_(r)||Ha("handlerType"),K_(r)&&Object.values(r).some(function(e){return!xg(e)})&&Ha("handlersType")}function G3(r){r||Ha("initialIsRequired"),K_(r)||Ha("initialType"),U3(r)&&Ha("initialContent")}function Y3(r,e){throw new Error(r[e]||r.default)}var Z3={initialIsRequired:"initial state is required",initialType:"initial state should be an object",initialContent:"initial state shouldn't be an empty object",handlerType:"handler should be an object or a function",handlersType:"all handlers should be a functions",selectorType:"selector should be a function",changeType:"provided value of changes should be an object",changeField:'it seams you want to change a field in the state which is not specified in the "initial" state',default:"an unknown error accured in `state-local` package"},Ha=hf(Y3)(Z3),wp={changes:j3,selector:K3,handler:q3,initial:G3};function X3(r){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};wp.initial(r),wp.handler(e);var t={current:r},i=hf(e8)(t,e),n=hf(J3)(t),s=hf(wp.changes)(r),o=hf(Q3)(t);function a(){var c=arguments.length>0&&arguments[0]!==void 0?arguments[0]:function(h){return h};return wp.selector(c),c(t.current)}function l(c){z3(i,n,s,o)(c)}return[a,l]}function Q3(r,e){return xg(e)?e(r.current):e}function J3(r,e){return r.current=JE(JE({},r.current),e),e}function e8(r,e,t){return xg(e)?e(r.current):Object.keys(t).forEach(function(i){var n;return(n=e[i])===null||n===void 0?void 0:n.call(e,r.current[i])}),t}var t8={create:X3},i8={paths:{vs:"https://cdn.jsdelivr.net/npm/monaco-editor@0.55.1/min/vs"}};function n8(r){return function e(){for(var t=this,i=arguments.length,n=new Array(i),s=0;s<i;s++)n[s]=arguments[s];return n.length>=r.length?r.apply(this,n):function(){for(var o=arguments.length,a=new Array(o),l=0;l<o;l++)a[l]=arguments[l];return e.apply(t,[].concat(n,a))}}}function s8(r){return{}.toString.call(r).includes("Object")}function r8(r){return r||eI("configIsRequired"),s8(r)||eI("configType"),r.urls?(o8(),{paths:{vs:r.urls.monacoBase}}):r}function o8(){console.warn(n4.deprecation)}function a8(r,e){throw new Error(r[e]||r.default)}var n4={configIsRequired:"the configuration object is required",configType:"the configuration object should be an object",default:"an unknown error accured in `@monaco-editor/loader` package",deprecation:`Deprecation warning!
|
|
3
3
|
You are using deprecated way of configuration.
|
|
4
4
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as t}from"./reactflow-s7jmJtXx.js";import{a as x}from"./zustand-CrhqMOHB.js";import{u as w,F as j,f as L,h as T}from"./index-Bij8Q4Kg.js";function R({element:l}){var f;const i=!!((f=l.attributes.description)!=null&&f.trim()),d=Object.keys(l.attributes).length,S=i&&d>=1,v=i||d>=1,p=S?"#2DD4A8":v?"#F39C12":"#E5E5E0",A=S?"Complete":v?"Partial":"Empty";return t.jsx("span",{className:"inline-block rounded-full flex-shrink-0",style:{width:8,height:8,backgroundColor:p,cursor:"default"},title:A})}function Y({col:l,sortKey:i,sortDir:d}){return l!==i?t.jsx("span",{style:{color:"#D1D5DB",fontSize:"10px",marginLeft:3},children:"⇅"}):t.jsx("span",{style:{color:"#1B3A4B",fontSize:"10px",marginLeft:3},children:d==="asc"?"↑":"↓"})}function P(){const l=w(e=>e.model),i=w(e=>e.activeView),d=w(e=>e.selectedViewpointId),S=w(e=>e.selectElement),v=w(e=>e.selectedElementId),[p,A]=x.useState("name"),[f,C]=x.useState("asc"),[E,B]=x.useState(""),[b,I]=x.useState(""),[g,M]=x.useState(""),h=x.useMemo(()=>{var n,s,o,c,r;if(!l)return[];const e=Object.values(l.elements);if(i.type==="tabular"&&i.diagramId){const a=(n=l.diagrams)==null?void 0:n.find(u=>u.id===i.diagramId);if((s=a==null?void 0:a.elementIds)!=null&&s.length){const u=new Set(a.elementIds);return e.filter(m=>u.has(m.id))}}if(d){const a=(o=l.viewpoints)==null?void 0:o.find(u=>u.id===d);if(a){const u=(c=a.visibleLayers)!=null&&c.length?new Set(a.visibleLayers):null,m=(r=a.visibleKinds)!=null&&r.length?new Set(a.visibleKinds):null;return e.filter(F=>(!u||u.has(F.layer))&&(!m||m.has(F.kind)))}}return e},[l,i,d]),k=x.useMemo(()=>{const e=new Map;for(const s of h)for(const o of Object.keys(s.attributes))o==="description"||o==="shortDescription"||e.set(o,(e.get(o)??0)+1);const n=Math.max(1,h.length*.1);return[...e.entries()].filter(([,s])=>s>=n).sort((s,o)=>o[1]-s[1]).slice(0,4).map(([s])=>s)},[h]),O=x.useMemo(()=>[...new Set(h.map(e=>e.layer))].sort(),[h]),V=x.useMemo(()=>[...new Set(h.map(e=>e.kind))].sort(),[h]),N=x.useMemo(()=>{const e=E.toLowerCase();let n=h.filter(s=>!(e&&!s.name.toLowerCase().includes(e)&&!s.kind.toLowerCase().includes(e)||b&&s.layer!==b||g&&s.kind!==g));return n.sort((s,o)=>{let c="",r="";if(p==="name")c=s.name,r=o.name;else if(p==="kind")c=s.kind,r=o.kind;else if(p==="layer")c=s.layer,r=o.layer;else if(p==="status"){const u=m=>{var z;const F=!!((z=m.attributes.description)!=null&&z.trim()),D=Object.keys(m.attributes).length>=1;return F&&D?2:F||D?1:0};c=String(u(s)),r=String(u(o))}else c=s.attributes[p]??"",r=o.attributes[p]??"";const a=c.localeCompare(r,void 0,{numeric:!0});return f==="asc"?a:-a}),n},[h,E,b,g,p,f]);function K(e){p===e?C(n=>n==="asc"?"desc":"asc"):(A(e),C("asc"))}const W=x.useMemo(()=>{var e,n;if(!l)return"";if(i.type==="tabular"&&i.diagramId){const s=(e=l.diagrams)==null?void 0:e.find(o=>o.id===i.diagramId);return s?`Diagram: ${s.name}`:"Diagram"}if(d){const s=(n=l.viewpoints)==null?void 0:n.find(o=>o.id===d);return s?`Viewpoint: ${s.label}`:"Viewpoint"}return"All Elements"},[l,i,d]),y=({col:e,label:n,width:s})=>t.jsxs("th",{onClick:()=>K(e),className:"px-3 py-2 text-left cursor-pointer select-none",style:{fontSize:"11px",fontWeight:600,color:"#374151",background:"#F7F7F5",borderBottom:"1px solid #E5E5E0",whiteSpace:"nowrap",width:s,position:"sticky",top:0,zIndex:1},children:[n,t.jsx(Y,{col:e,sortKey:p,sortDir:f})]});return t.jsxs("div",{className:"flex flex-col h-full overflow-hidden",style:{background:"#FFFFFF"},children:[t.jsxs("div",{className:"flex items-center gap-3 px-4 py-3 flex-shrink-0",style:{borderBottom:"1px solid #E5E5E0",background:"#FAFAF8"},children:[t.jsxs("div",{children:[t.jsx("div",{style:{fontSize:"13px",fontWeight:700,color:"#1B3A4B"},children:"Tabular View"}),t.jsx("div",{style:{fontSize:"11px",color:"#9CA3AF"},children:W})]}),t.jsx("div",{className:"flex-1"}),t.jsx("input",{type:"text",placeholder:"Search elements…",value:E,onChange:e=>B(e.target.value),className:"px-3 py-1.5 rounded-lg focus:outline-none",style:{width:220,fontSize:j.xs,color:"#1a1a1a",border:"1px solid #E5E5E0",background:"#FFFFFF"}}),t.jsxs("select",{value:b,onChange:e=>I(e.target.value),className:"px-2 py-1.5 rounded-lg focus:outline-none",style:{fontSize:j.xs,color:"#374151",border:"1px solid #E5E5E0",background:"#FFFFFF",cursor:"pointer"},children:[t.jsx("option",{value:"",children:"All layers"}),O.map(e=>t.jsx("option",{value:e,children:L[e]??e},e))]}),t.jsxs("select",{value:g,onChange:e=>M(e.target.value),className:"px-2 py-1.5 rounded-lg focus:outline-none",style:{fontSize:j.xs,color:"#374151",border:"1px solid #E5E5E0",background:"#FFFFFF",cursor:"pointer"},children:[t.jsx("option",{value:"",children:"All kinds"}),V.map(e=>t.jsx("option",{value:e,children:e},e))]}),t.jsxs("div",{style:{fontSize:"11px",color:"#9CA3AF",whiteSpace:"nowrap"},children:[N.length," / ",h.length," elements"]})]}),t.jsx("div",{className:"flex-1 overflow-auto",children:t.jsxs("table",{className:"w-full border-collapse",style:{tableLayout:"fixed"},children:[t.jsxs("colgroup",{children:[t.jsx("col",{style:{width:28}}),t.jsx("col",{style:{width:"30%"}}),t.jsx("col",{style:{width:"13%"}}),t.jsx("col",{style:{width:"13%"}}),t.jsx("col",{style:{width:40}}),t.jsx("col",{style:{width:"20%"}}),k.map(e=>t.jsx("col",{style:{width:"10%"}},e))]}),t.jsx("thead",{children:t.jsxs("tr",{children:[t.jsx("th",{style:{background:"#F7F7F5",borderBottom:"1px solid #E5E5E0",position:"sticky",top:0,zIndex:1}}),t.jsx(y,{col:"name",label:"Name"}),t.jsx(y,{col:"kind",label:"Kind"}),t.jsx(y,{col:"layer",label:"Layer"}),t.jsx(y,{col:"status",label:"",width:40}),t.jsx(y,{col:"shortDescription",label:"Short description"}),k.map(e=>t.jsx(y,{col:e,label:e},e))]})}),t.jsxs("tbody",{children:[N.length===0&&t.jsx("tr",{children:t.jsx("td",{colSpan:6+k.length,className:"py-16 text-center",style:{fontSize:"13px",color:"#9CA3AF"},children:E||b||g?"No elements match the current filters":"No elements in scope"})}),N.map(e=>{var c;const n=e.id===v,s=T[e.layer]??"#9CA3AF",o=((c=e.attributes.shortDescription)==null?void 0:c.trim())??"";return t.jsxs("tr",{onClick:()=>S(e.id),className:"cursor-pointer",style:{background:n?"#2DD4A812":"transparent",borderBottom:"1px solid #F0F0ED"},onMouseEnter:r=>{n||(r.currentTarget.style.background="#F7F7F5")},onMouseLeave:r=>{n||(r.currentTarget.style.background="transparent")},children:[t.jsx("td",{className:"px-2",children:n&&t.jsx("span",{style:{color:"#2DD4A8",fontSize:"10px"},children:"▶"})}),t.jsxs("td",{className:"px-3 py-2",children:[t.jsx("div",{style:{fontSize:j.xs,fontWeight:500,color:"#1B3A4B",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:e.name}),e.shortId&&t.jsx("div",{style:{fontSize:"10px",color:"#9CA3AF",fontFamily:"monospace"},children:e.shortId})]}),t.jsx("td",{className:"px-3 py-2",children:t.jsx("span",{style:{fontSize:"10px",fontWeight:600,color:"#374151"},children:e.kind})}),t.jsx("td",{className:"px-3 py-2",children:t.jsx("span",{className:"px-1.5 py-0.5 rounded",style:{fontSize:"10px",fontWeight:600,background:s+"1A",color:s,whiteSpace:"nowrap"},children:L[e.layer]??e.layer})}),t.jsx("td",{className:"px-3 py-2 text-center",children:t.jsx(R,{element:e})}),t.jsx("td",{className:"px-3 py-2",children:t.jsx("span",{style:{fontSize:j.xs,color:"#6B7280",display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden"},children:o})}),k.map(r=>t.jsx("td",{className:"px-3 py-2",children:t.jsx("span",{style:{fontSize:j.xs,color:"#374151",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",display:"block"},children:e.attributes[r]??""})},r))]},e.id)})]})]})})]})}export{P as TabularView};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{j as n}from"./reactflow-s7jmJtXx.js";import{a as r}from"./zustand-CrhqMOHB.js";import{u as f,i as ke,r as H,j as ve,C as s,F as b}from"./index-Bij8Q4Kg.js";import{l as Ce,r as ie,e as re,c as je,b as Ee,A as le,T as P,a as ae,H as Re}from"./element-options-B7AgTB8R.js";const Te=[{id:"risk-control",label:"ISO 14971: Risk → Control",description:"Hazards and hazardous situations traced to risk controls",rowKinds:["Hazard","HazardousSituation"],columnKinds:["RiskControlMeasure","SafetyGoal"],linkTypes:["mitigates","tracesRisk","causes","leadsTo"]},{id:"req-test",label:"IEC 62304: Requirement → Test",description:"Software requirements traced to verification tests",rowKinds:["Requirement","SoftwareRequirement","SystemRequirement"],columnKinds:["Test","TestCase","VerificationActivity"],linkTypes:["verifiedBy","satisfiedBy","validates"]},{id:"req-function",label:"Requirement → Function",description:"Requirements traced to the functions that satisfy them",rowKinds:["Requirement","SystemRequirement"],columnKinds:["Function","SystemFunction"],linkTypes:["satisfiedBy","derivesFrom"]},{id:"function-component",label:"Function → Component",description:"Functions allocated to logical and physical components",rowKinds:["Function","SystemFunction"],columnKinds:["LogicalComponent","SoftwareModule","MechanicalPart","Component"],linkTypes:["allocatedTo","realizes"]},{id:"everything",label:"Everything",description:"Every element against every element, every relationship",rowKinds:[],columnKinds:[],linkTypes:[]}];function Me(){var oe;const i=f(e=>e.model),u=f(e=>e.connected),g=f(e=>e.selectElement),ce=f(e=>e.selectedElementId),Q=f(e=>e.selectedDiagramId),G=f(e=>e.createRelationship),U=f(e=>e.deleteRelationship),[m,A]=r.useState({}),[h,L]=r.useState({}),[O,K]=r.useState([]),[q,B]=r.useState([]),[x,V]=r.useState([]),[p,ue]=r.useState(!1),[Y,pe]=r.useState(26),[Z,me]=r.useState(!0),[J,v]=r.useState(new Set),[X,C]=r.useState(new Set),[l,j]=r.useState(null),[E,R]=r.useState(null),[T,_]=r.useState(""),[F,I]=r.useState(!1),W=r.useMemo(()=>ke(i),[i]),ee=r.useMemo(()=>i?Ce(i):[],[i]),he=r.useMemo(()=>{if(!i)return[];const e=new Map;for(const t of i.relationships)e.set(t.type,(e.get(t.type)??0)+1);return ie(i).map(t=>({value:t,hint:String(e.get(t)??0),color:H(t)}))},[i]),z=r.useMemo(()=>re(i,m),[i,m]),$=r.useMemo(()=>re(i,h),[i,h]);r.useEffect(()=>{const e=new Set(z.map(t=>t.value));K(t=>t.every(o=>e.has(o))?t:t.filter(o=>e.has(o)))},[z]),r.useEffect(()=>{const e=new Set($.map(t=>t.value));B(t=>t.every(o=>e.has(o))?t:t.filter(o=>e.has(o)))},[$]);const a=r.useMemo(()=>i?je(i,{rows:{layer:m.layer,kinds:m.kind?[m.kind]:[],elementIds:O,expanded:J},columns:{layer:h.layer,kinds:h.kind?[h.kind]:[],elementIds:q,expanded:X},dependencyTypes:x,symmetric:!0}):null,[i,m,h,O,q,x,J,X]),[M,xe]=r.useState(!1);r.useEffect(()=>{if(M||!i)return;const e=Ee(i);e.rows&&(A({layer:e.rows}),L({layer:e.columns}),xe(!0))},[i,M]);const[te,fe]=r.useState(!1);r.useEffect(()=>{if(te||!M||!a)return;const e=a.rowRoots.filter(o=>o.children.length>0).map(o=>o.id),t=a.columnRoots.filter(o=>o.children.length>0).map(o=>o.id);e.length===0&&t.length===0||(v(new Set(e)),C(new Set(t)),fe(!0))},[a,M,te]);const D=r.useCallback(e=>{if(!i)return null;for(const t of e){const o=Object.values(i.elements).find(d=>d.kind===t);if(o)return{layer:o.layer,kind:t}}return null},[i]),ge=r.useCallback(e=>{const t=new Set(i?ie(i):[]),o=D(e.rowKinds),d=D(e.columnKinds);o&&A(o),d&&L(d),V(e.linkTypes.filter(c=>t.has(c))),K([]),B([]),j(null)},[i,D]),ne=r.useMemo(()=>{var c;if(!i||!l)return[];const e=l.row.node.id,t=l.column.node.id;if(l.row.node.children.length===0&&l.column.node.children.length===0){const y=new Set(x);return i.relationships.filter(k=>(y.size===0||y.has(k.type))&&(k.sourceId===e&&k.targetId===t||k.sourceId===t&&k.targetId===e))}const d=new Set(((c=l.cell)==null?void 0:c.relationshipIds)??[]);return i.relationships.filter(y=>d.has(y.id))},[i,l,x]),w=r.useMemo(()=>{if(!i||!l||!W)return[];const e=i.elements[l.row.node.id],t=i.elements[l.column.node.id];return!e||!t||e.id===t.id?[]:ve(e,t,W)},[i,l,W]),N=r.useMemo(()=>{const e=new Set;for(const t of x)e.add(t),e.add(t.charAt(0).toUpperCase()+t.slice(1));return e},[x]),se=r.useMemo(()=>{const e=T.trim().toLowerCase();return w.filter(t=>!e||t.definition.name.toLowerCase().includes(e)).sort((t,o)=>{const d=Number(N.has(o.definition.name))-Number(N.has(t.definition.name));return d!==0?d:t.definition.name.localeCompare(o.definition.name)})},[w,T,N]),ye=!!(l&&l.row.node.isElement&&l.column.node.isElement&&!l.row.expanded&&!l.column.expanded&&l.row.node.children.length===0&&l.column.node.children.length===0),be=r.useCallback(async e=>{I(!0),R(null);const t=await G({type:e.definition.name,sourceId:e.sourceId,targetId:e.targetId,direction:e.direction,diagramId:Q??void 0});I(!1),R(t.success?{kind:"ok",message:`Trace written to ${t.sourceFile??"the model"}.`}:{kind:"error",message:t.error??"The trace could not be created."})},[G,Q]),we=r.useCallback(async e=>{I(!0),R(null);const t=await U(e);I(!1),R(t.success?{kind:"ok",message:`Trace removed from ${t.sourceFile??"the model"}.`}:{kind:"error",message:t.error??"The trace could not be removed."})},[U]),Se=r.useCallback((e,t,o)=>{if(e!=null&&e.diagonal)return{text:String(e.strength),color:s.muted,background:"#E3E8EE"};if(e){const c=e.types.length>0?H(e.types[0]):"#2DA98C",y=Math.min(.16+e.strength*.14,.6);return{text:e.aggregated?String(e.strength):"✓",color:c,background:`${c}${Math.round(y*255).toString(16).padStart(2,"0")}`,title:`${t.node.name} ↔ ${o.node.name}
|
|
2
|
+
${e.types.join(", ")}${p?`
|
|
3
|
+
Click to inspect or remove`:""}`}}return p?t.node.isElement&&o.node.isElement&&t.node.children.length===0&&o.node.children.length===0&&t.node.id!==o.node.id?{actionable:!0,title:`Click to trace ${t.node.name} → ${o.node.name}`}:{}:{}},[p]),S=r.useMemo(()=>{if(!a)return{traced:0,total:0};const e=a.rows.filter(o=>o.node.children.length===0);return{traced:e.filter(o=>{const d=a.rows.indexOf(o);return a.matrix[d].some(c=>c&&!c.diagonal)}).length,total:e.length}},[a]);return!i||!a?n.jsx("div",{className:"flex-1 flex items-center justify-center",style:{color:s.faint,fontSize:b.sm},children:"No model loaded"}):n.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",style:{background:"#FAFAF8"},children:[n.jsxs("div",{style:{borderBottom:`1px solid ${s.border}`,background:s.surface},children:[n.jsxs("div",{className:"flex items-center gap-3 px-4 py-2",style:{flexWrap:"wrap"},children:[n.jsx("span",{style:{fontSize:b.sm,fontWeight:600,color:s.primary},children:"Traceability"}),n.jsxs("span",{style:{fontSize:"11px",color:s.faint},children:[a.totalDependencies," link",a.totalDependencies===1?"":"s"," shown",S.total>0&&` · ${S.traced}/${S.total} rows traced (${Math.round(S.traced/S.total*100)}%)`]}),n.jsx("div",{className:"flex-1"}),n.jsx(le,{label:"Rows",layers:ee,value:m,onChange:A,describedAs:"row scope",title:"What the rows list — one architecture layer, or one element type within it"}),n.jsx(P,{label:"of",allLabel:`All ${z.length} elements`,options:z,selected:O,onChange:K,width:130,describedAs:"row elements",placeholder:"Filter by name, kind or id…",title:"The individual elements listed down the side"}),n.jsx(le,{label:"Columns",layers:ee,value:h,onChange:L,describedAs:"column scope",title:"What the columns list — one architecture layer, or one element type within it"}),n.jsx(P,{label:"of",allLabel:`All ${$.length} elements`,options:$,selected:q,onChange:B,width:130,describedAs:"column elements",placeholder:"Filter by name, kind or id…",title:"The individual elements listed across the top"}),n.jsx(P,{label:"Trace via",allLabel:"Any relationship",options:he,selected:x,onChange:V,title:"Relationships counted as trace"})]}),n.jsxs("div",{className:"flex items-center gap-2 px-4 pb-2",style:{flexWrap:"wrap"},children:[n.jsx("span",{style:{fontSize:"11px",color:s.faint},children:"Presets"}),Te.map(e=>n.jsx("button",{onClick:()=>ge(e),title:e.description,style:{padding:"3px 8px",borderRadius:"5px",fontSize:"11px",border:`1px solid ${s.borderLight}`,background:s.surface,color:s.secondary,cursor:"pointer"},children:e.label},e.id)),n.jsx("div",{style:{width:"1px",height:"16px",background:s.borderLight,margin:"0 4px"}}),n.jsx("button",{onClick:()=>{a&&(v(new Set(ae(a.rowRoots))),C(new Set(ae(a.columnRoots))))},style:{padding:"3px 8px",borderRadius:"5px",fontSize:"11px",border:`1px solid ${s.border}`,background:s.surface,color:s.secondary,cursor:"pointer"},children:"Expand all"}),n.jsx("button",{onClick:()=>{v(new Set),C(new Set)},style:{padding:"3px 8px",borderRadius:"5px",fontSize:"11px",border:`1px solid ${s.border}`,background:s.surface,color:s.secondary,cursor:"pointer"},children:"Collapse all"}),n.jsxs("label",{style:{display:"flex",alignItems:"center",gap:"6px",fontSize:b.xs,color:s.muted},children:[n.jsx("input",{type:"checkbox",checked:Z,onChange:e=>me(e.target.checked),style:{accentColor:s.accent}}),"Column names"]}),n.jsxs("label",{style:{display:"flex",alignItems:"center",gap:"5px",fontSize:b.xs,color:s.muted},children:["Zoom",n.jsx("input",{type:"range",min:14,max:44,step:2,value:Y,onChange:e=>pe(Number(e.target.value)),style:{width:"80px",accentColor:s.accent}})]}),n.jsx("div",{className:"flex-1"}),n.jsxs("label",{title:u?"Click cells to add or remove trace links. Only leaf-to-leaf cells can be edited.":"The dev server is unreachable, so nothing can be written to the model.",style:{display:"flex",alignItems:"center",gap:"6px",fontSize:b.xs,padding:"3px 9px",borderRadius:"5px",border:`1px solid ${p?s.accent:s.border}`,background:p?"#E8F8F3":s.surface,color:u?s.primary:s.faint,cursor:u?"pointer":"not-allowed",fontWeight:600},children:[n.jsx("input",{type:"checkbox",checked:p,disabled:!u,onChange:e=>{ue(e.target.checked),j(null)},style:{accentColor:s.accent}}),"Edit links"]})]}),E&&n.jsx("div",{style:{padding:"5px 16px",fontSize:"11px",color:E.kind==="ok"?"#0F766E":"#B91C1C",background:E.kind==="ok"?"#ECFDF5":"#FEF2F2",borderTop:`1px solid ${s.borderLight}`},children:E.message})]}),n.jsx(Re,{result:a,onToggleRow:e=>v(t=>de(t,e)),onToggleColumn:e=>C(t=>de(t,e)),onSelectElement:g,selectedElementId:ce,renderCell:Se,onCellClick:(e,t,o)=>{j({row:e,column:t,cell:o}),_("")},cellSize:Y,showColumnNames:Z}),l&&n.jsxs("div",{style:{position:"fixed",bottom:"76px",right:"20px",zIndex:100,width:"330px",maxHeight:"52vh",overflowY:"auto",padding:"12px 14px",borderRadius:"9px",background:s.surface,border:`1px solid ${s.border}`,boxShadow:"0 6px 22px rgba(0,0,0,0.14)",fontSize:b.xs},children:[n.jsxs("div",{className:"flex items-start justify-between gap-2",children:[n.jsxs("div",{style:{fontWeight:600,color:s.primary},children:[l.row.node.name," ","↔"," ",l.column.node.name]}),n.jsx("button",{onClick:()=>j(null),style:{color:s.faint,background:"none",border:"none",cursor:"pointer"},children:"✕"})]}),ne.length>0?n.jsx("div",{style:{marginTop:"9px",display:"flex",flexDirection:"column",gap:"5px"},children:ne.map(e=>{var t,o;return n.jsxs("div",{className:"flex items-center justify-between gap-2",style:{padding:"4px 6px",borderRadius:"5px",background:s.surfaceAlt},children:[n.jsx("span",{style:{color:H(e.type),fontWeight:500},children:e.type}),n.jsxs("span",{style:{flex:1,color:s.faint,fontSize:"10px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:[((t=i.elements[e.sourceId])==null?void 0:t.name)??e.sourceId," ","→"," ",((o=i.elements[e.targetId])==null?void 0:o.name)??e.targetId]}),p&&n.jsx("button",{disabled:F||e.named===!1,onClick:()=>void we(e.id),title:e.named===!1?"This connection has no declared name, so it cannot be addressed for deletion. Name it in the source first.":"Remove this trace link",style:{fontSize:"10px",padding:"1px 6px",borderRadius:"4px",border:"1px solid #FCA5A5",background:"#FEF2F2",color:"#B91C1C",cursor:F||e.named===!1?"not-allowed":"pointer",opacity:e.named===!1?.5:1},children:"Remove"})]},e.id)})}):n.jsx("div",{style:{marginTop:"8px",color:s.muted},children:"No trace between these two."}),((oe=l.cell)==null?void 0:oe.aggregated)&&n.jsx("div",{style:{marginTop:"8px",fontSize:"11px",color:s.faint},children:"This mark sums a collapsed subsystem. Expand both sides to edit individual links."}),p&&n.jsxs("div",{style:{marginTop:"11px",borderTop:`1px solid ${s.borderLight}`,paddingTop:"9px"},children:[n.jsx("div",{style:{fontSize:"11px",color:s.muted,marginBottom:"6px"},children:"Add a trace link"}),ye?w.length===0?n.jsxs("div",{style:{fontSize:"11px",color:s.faint},children:["The ontology allows no relationship between ",l.row.node.kind," and ",l.column.node.kind,"."]}):n.jsxs(n.Fragment,{children:[w.length>8&&n.jsx("input",{value:T,onChange:e=>_(e.target.value),placeholder:`Filter ${w.length} legal types…`,"aria-label":"Filter link types",style:{width:"100%",marginBottom:"7px",padding:"4px 7px",border:`1px solid ${s.border}`,borderRadius:"5px",fontSize:"11px",outline:"none",color:s.primary}}),n.jsxs("div",{style:{display:"flex",flexWrap:"wrap",gap:"5px"},children:[se.map(e=>{var o,d;const t=N.has(e.definition.name);return n.jsxs("button",{disabled:F,onClick:()=>void be(e),title:`${((o=i.elements[e.sourceId])==null?void 0:o.name)??e.sourceId} → ${((d=i.elements[e.targetId])==null?void 0:d.name)??e.targetId}`,style:{fontSize:"11px",padding:"3px 8px",borderRadius:"5px",border:`1px solid ${t?s.accent:s.border}`,background:t?"#E8F8F3":s.surface,color:s.primary,cursor:F?"wait":"pointer",fontWeight:t?600:400},children:[e.definition.name,n.jsx("span",{style:{color:s.faint,marginLeft:"4px"},children:e.direction==="outgoing"?"→":"←"})]},`${e.definition.name}-${e.direction}`)}),se.length===0&&n.jsxs("span",{style:{fontSize:"11px",color:s.faint},children:["No legal type matches ","“",T,"”","."]})]})]}):n.jsx("div",{style:{fontSize:"11px",color:s.faint},children:"Both sides must be individual elements. Expand the subsystems first."})]})]})]})}function de(i,u){const g=new Set(i);return g.has(u)?g.delete(u):g.add(u),g}export{Me as TraceabilityMatrix};
|